Version Notes
Inital release
Download this release
Release Info
| Developer | James Anelay |
| Extension | TheExtensionLab_MultiselectFilters |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/TheExtensionLab/MultiselectFilters/Block/Adminhtml/Widget/Grid/Column/Filter/Multiselect.php +75 -0
- app/code/community/TheExtensionLab/MultiselectFilters/Block/Adminhtml/Widget/Grid/Column/Filter/Multiselect/Country.php +20 -0
- app/code/community/TheExtensionLab/MultiselectFilters/Model/Observer.php +45 -0
- app/code/community/TheExtensionLab/MultiselectFilters/Test/Config/Main.php +24 -0
- app/code/community/TheExtensionLab/MultiselectFilters/etc/config.xml +69 -0
- app/design/adminhtml/default/default/layout/theextensionlab/multiselectfilters.xml +22 -0
- app/design/adminhtml/default/default/template/theextensionlab/multiselectfilters/chosen/init-js.phtml +12 -0
- app/etc/modules/TheExtensionLab_MultiselectFilters.xml +9 -0
- js/theextensionlab/multiselectfilters/chosen/chosen.proto.js +1259 -0
- js/theextensionlab/multiselectfilters/chosen/chosen.proto.min.js +2 -0
- js/theextensionlab/multiselectfilters/chosen/init.js +0 -0
- js/theextensionlab/multiselectfilters/chosen/simulate.js +57 -0
- package.xml +20 -0
- skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/css/chosen.css +451 -0
- skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/images/chosen-sprite.png +0 -0
- skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/images/chosen-sprite@2x.png +0 -0
app/code/community/TheExtensionLab/MultiselectFilters/Block/Adminhtml/Widget/Grid/Column/Filter/Multiselect.php
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Multiselect Filter Block
|
| 4 |
+
*
|
| 5 |
+
* @category TheExtensionLab
|
| 6 |
+
* @package TheExtensionLab_MultiselectFilters
|
| 7 |
+
* @copyright Copyright (c) TheExtensionLab (http://www.theextensionlab.com)
|
| 8 |
+
* @license Open Software License (OSL 3.0)
|
| 9 |
+
* @author James Anelay @ TheExtensionLab <james@theextensionlab.com>
|
| 10 |
+
*/
|
| 11 |
+
class TheExtensionLab_MultiselectFilters_Block_Adminhtml_Widget_Grid_Column_Filter_Multiselect extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract
|
| 12 |
+
{
|
| 13 |
+
protected function _getOptions()
|
| 14 |
+
{
|
| 15 |
+
$optionGroups = $this->getColumn()->getOptionGroups();
|
| 16 |
+
if ($optionGroups) {
|
| 17 |
+
array_unshift($optionGroups, $emptyOption);
|
| 18 |
+
return $optionGroups;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
$colOptions = $this->getColumn()->getOptions();
|
| 22 |
+
if (!empty($colOptions) && is_array($colOptions) ) {
|
| 23 |
+
foreach ($colOptions as $value => $label) {
|
| 24 |
+
$options[] = array('value' => $value, 'label' => $label);
|
| 25 |
+
}
|
| 26 |
+
return $options;
|
| 27 |
+
}
|
| 28 |
+
return array();
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Render an option with selected value
|
| 33 |
+
*
|
| 34 |
+
* @param array $option
|
| 35 |
+
* @param string $value
|
| 36 |
+
* @return string
|
| 37 |
+
*/
|
| 38 |
+
protected function _renderOption($option, $values)
|
| 39 |
+
{
|
| 40 |
+
$explodedValues = explode(',',$values);
|
| 41 |
+
$selected = ((in_array($option['value'], $explodedValues) && (!is_null($explodedValues)) && ($values != "")) ? ' selected="selected"' : '' );
|
| 42 |
+
return '<option value="'. $this->escapeHtml($option['value']).'"'.$selected.'>'.$this->escapeHtml($option['label']).'</option>';
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function getHtml()
|
| 46 |
+
{
|
| 47 |
+
$values = $this->getValue();
|
| 48 |
+
$html = '<select name="'.$this->_getHtmlName().'" id="'.$this->_getHtmlId().'" class="no-changes" data-placeholder="'.$this->__('Click here to filter').'" multiple>';
|
| 49 |
+
|
| 50 |
+
foreach ($this->_getOptions() as $option){
|
| 51 |
+
if (is_array($option['value'])) {
|
| 52 |
+
$html .= '<optgroup label="' . $this->escapeHtml($option['label']) . '">';
|
| 53 |
+
foreach ($option['value'] as $subOption) {
|
| 54 |
+
$html .= $this->_renderOption($subOption, $values);
|
| 55 |
+
}
|
| 56 |
+
$html .= '</optgroup>';
|
| 57 |
+
} else {
|
| 58 |
+
$html .= $this->_renderOption($option, $values);
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
$html.='</select>';
|
| 62 |
+
return $html;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
public function getCondition()
|
| 66 |
+
{
|
| 67 |
+
if (is_null($this->getValue())) {
|
| 68 |
+
return null;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
$values = explode(",",$this->getValue());
|
| 72 |
+
return array('in' => $values);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
}
|
app/code/community/TheExtensionLab/MultiselectFilters/Block/Adminhtml/Widget/Grid/Column/Filter/Multiselect/Country.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Country Select Block
|
| 4 |
+
*
|
| 5 |
+
* @category TheExtensionLab
|
| 6 |
+
* @package TheExtensionLab_MultiselectFilters
|
| 7 |
+
* @copyright Copyright (c) TheExtensionLab (http://www.theextensionlab.com)
|
| 8 |
+
* @license Open Software License (OSL 3.0)
|
| 9 |
+
* @author James Anelay @ TheExtensionLab <james@theextensionlab.com>
|
| 10 |
+
*/
|
| 11 |
+
class TheExtensionLab_MultiselectFilters_Block_Adminhtml_Widget_Grid_Column_Filter_Multiselect_Country
|
| 12 |
+
extends TheExtensionLab_MultiselectFilters_Block_Adminhtml_Widget_Grid_Column_Filter_Multiselect
|
| 13 |
+
{
|
| 14 |
+
protected function _getOptions()
|
| 15 |
+
{
|
| 16 |
+
$options = Mage::getResourceModel('directory/country_collection')->load()->toOptionArray(false);
|
| 17 |
+
array_unshift($options, array('value'=>'', 'label'=>Mage::helper('cms')->__('All Countries')));
|
| 18 |
+
return $options;
|
| 19 |
+
}
|
| 20 |
+
}
|
app/code/community/TheExtensionLab/MultiselectFilters/Model/Observer.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* MultiselectFilters Observer Model
|
| 4 |
+
*
|
| 5 |
+
* @category TheExtensionLab
|
| 6 |
+
* @package TheExtensionLab_MultiselectFilters
|
| 7 |
+
* @copyright Copyright (c) TheExtensionLab (http://www.theextensionlab.com)
|
| 8 |
+
* @license Open Software License (OSL 3.0)
|
| 9 |
+
* @author James Anelay @ TheExtensionLab <james@theextensionlab.com>
|
| 10 |
+
*/
|
| 11 |
+
class TheExtensionLab_MultiselectFilters_Model_Observer
|
| 12 |
+
{
|
| 13 |
+
//getColumnFilters
|
| 14 |
+
public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
|
| 15 |
+
{
|
| 16 |
+
$block = $observer->getEvent()->getBlock();
|
| 17 |
+
|
| 18 |
+
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid) {
|
| 19 |
+
$filters = array();
|
| 20 |
+
$filters['options'] = "theextensionlab_multiselectfilters/adminhtml_widget_grid_column_filter_multiselect";
|
| 21 |
+
$filters['country'] = "theextensionlab_multiselectfilters/adminhtml_widget_grid_column_filter_multiselect_country";
|
| 22 |
+
$block->setColumnFilters($filters);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
|
| 27 |
+
{
|
| 28 |
+
$block = $observer->getEvent()->getBlock();
|
| 29 |
+
|
| 30 |
+
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid) {
|
| 31 |
+
$transport = $observer->getTransport();
|
| 32 |
+
//get the HTML
|
| 33 |
+
$html = $transport->getHtml();
|
| 34 |
+
|
| 35 |
+
//Get container so that js is only fired on this grid
|
| 36 |
+
$uniqIdClass = 'grid-container-'.uniqid();
|
| 37 |
+
|
| 38 |
+
//render the block
|
| 39 |
+
$newHtml = $block->getLayout()->createBlock('adminhtml/template')
|
| 40 |
+
->setTemplate('theextensionlab/multiselectfilters/chosen/init-js.phtml')->setUniqId($uniqIdClass)->toHtml();
|
| 41 |
+
|
| 42 |
+
$transport->setHtml('<div class="'.$uniqIdClass.'">'.$html.' '.$newHtml.'</div>');
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/community/TheExtensionLab/MultiselectFilters/Test/Config/Main.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php class TheExtensionLab_MultiselectFilters_Test_Config_Main extends EcomDev_PHPUnit_Test_Case_Config
|
| 2 |
+
{
|
| 3 |
+
public function testClassAsliases()
|
| 4 |
+
{
|
| 5 |
+
$this->assertModelAlias('theextensionlab_multiselectfilters/observer','TheExtensionLab_MultiselectFilters_Model_Observer');
|
| 6 |
+
$this->assertBlockAlias('theextensionlab_multiselectfilters/example','TheExtensionLab_MultiselectFilters_Block_Example');
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
public function testObserverConfig()
|
| 10 |
+
{
|
| 11 |
+
$this->assertEventObserverDefined(
|
| 12 |
+
'adminhtml',
|
| 13 |
+
'core_block_abstract_to_html_before',
|
| 14 |
+
'theextensionlab_multiselectfilters/observer',
|
| 15 |
+
'coreBlockAbstractToHtmlBefore'
|
| 16 |
+
);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function testLayoutConfig()
|
| 20 |
+
{
|
| 21 |
+
$this->assertLayoutFileDefined('adminhtml','theextensionlab/multiselectfilters.xml');
|
| 22 |
+
$this->assertLayoutFileExists('adminhtml','theextensionlab/multiselectfilters.xml');
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/community/TheExtensionLab/MultiselectFilters/etc/config.xml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
* @category TheExtensionLab
|
| 4 |
+
* @package TheExtensionLab_MultiselectFilters
|
| 5 |
+
* @copyright Copyright (c) TheExtensionLab (http://www.theextensionlab.com)
|
| 6 |
+
* @license Open Software License (OSL 3.0)
|
| 7 |
+
* @author James Anelay @ TheExtensionLab <james@theextensionlab.com>
|
| 8 |
+
*
|
| 9 |
+
-->
|
| 10 |
+
<config>
|
| 11 |
+
<modules>
|
| 12 |
+
<TheExtensionLab_MultiselectFilters>
|
| 13 |
+
<version>0.1.0</version>
|
| 14 |
+
</TheExtensionLab_MultiselectFilters>
|
| 15 |
+
</modules>
|
| 16 |
+
|
| 17 |
+
<global>
|
| 18 |
+
<blocks>
|
| 19 |
+
<theextensionlab_multiselectfilters>
|
| 20 |
+
<class>TheExtensionLab_MultiselectFilters_Block</class>
|
| 21 |
+
</theextensionlab_multiselectfilters>
|
| 22 |
+
</blocks>
|
| 23 |
+
|
| 24 |
+
<models>
|
| 25 |
+
<theextensionlab_multiselectfilters>
|
| 26 |
+
<class>TheExtensionLab_MultiselectFilters_Model</class>
|
| 27 |
+
</theextensionlab_multiselectfilters>
|
| 28 |
+
</models>
|
| 29 |
+
</global>
|
| 30 |
+
|
| 31 |
+
<adminhtml>
|
| 32 |
+
|
| 33 |
+
<layout>
|
| 34 |
+
<updates>
|
| 35 |
+
<theextensionlab_multiselectfilters>
|
| 36 |
+
<file>theextensionlab/multiselectfilters.xml</file>
|
| 37 |
+
</theextensionlab_multiselectfilters>
|
| 38 |
+
</updates>
|
| 39 |
+
</layout>
|
| 40 |
+
|
| 41 |
+
<events>
|
| 42 |
+
<core_block_abstract_to_html_before>
|
| 43 |
+
<observers>
|
| 44 |
+
<theextensionlab_multiselectfilters>
|
| 45 |
+
<class>theextensionlab_multiselectfilters/observer</class>
|
| 46 |
+
<method>coreBlockAbstractToHtmlBefore</method>
|
| 47 |
+
</theextensionlab_multiselectfilters>
|
| 48 |
+
</observers>
|
| 49 |
+
</core_block_abstract_to_html_before>
|
| 50 |
+
|
| 51 |
+
<core_block_abstract_to_html_after>
|
| 52 |
+
<observers>
|
| 53 |
+
<theextensionlab_multiselectfilters>
|
| 54 |
+
<class>theextensionlab_multiselectfilters/observer</class>
|
| 55 |
+
<method>coreBlockAbstractToHtmlAfter</method>
|
| 56 |
+
</theextensionlab_multiselectfilters>
|
| 57 |
+
</observers>
|
| 58 |
+
</core_block_abstract_to_html_after>
|
| 59 |
+
</events>
|
| 60 |
+
</adminhtml>
|
| 61 |
+
|
| 62 |
+
<phpunit>
|
| 63 |
+
<suite>
|
| 64 |
+
<modules>
|
| 65 |
+
<TheExtensionLab_MultiselectFilters/>
|
| 66 |
+
</modules>
|
| 67 |
+
</suite>
|
| 68 |
+
</phpunit>
|
| 69 |
+
</config>
|
app/design/adminhtml/default/default/layout/theextensionlab/multiselectfilters.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addJs"><file>theextensionlab/multiselectfilters/chosen/simulate.js</file></action>
|
| 6 |
+
<action method="addJs"><file>theextensionlab/multiselectfilters/chosen/chosen.proto.js</file></action>
|
| 7 |
+
<action method="addCss"><file>theextensionlab/multiselectfilters/chosen/css/chosen.css</file></action>
|
| 8 |
+
</reference>
|
| 9 |
+
|
| 10 |
+
<!--<reference name="before_body_end">-->
|
| 11 |
+
<!--<block type="core/template" name="chosen.js" template="theextensionlab/multiselectfilters/chosen/init-js.phtml"/>-->
|
| 12 |
+
<!--</reference>-->
|
| 13 |
+
</default>
|
| 14 |
+
|
| 15 |
+
<!--<widget_grid_page>-->
|
| 16 |
+
<!--<block type="adminhtml/template" name="chosen.js" template="theextensionlab/multiselectfilters/chosen/init-ajax-js.phtml" output="toHtml"/>-->
|
| 17 |
+
<!--</widget_grid_page>-->
|
| 18 |
+
|
| 19 |
+
<!--<adminhtml_sales_order_grid>-->
|
| 20 |
+
<!--<block type="adminhtml/template" name="chosen.js" template="theextensionlab/multiselectfilters/chosen/init-ajax-js.phtml" output="toHtml"/>-->
|
| 21 |
+
<!--</adminhtml_sales_order_grid>-->
|
| 22 |
+
</config>
|
app/design/adminhtml/default/default/template/theextensionlab/multiselectfilters/chosen/init-js.phtml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script type="text/javascript">
|
| 2 |
+
var config = {
|
| 3 |
+
'.<?php echo $this->getUniqId() ?> .filter select[multiple],.chosen-select' : {}
|
| 4 |
+
}
|
| 5 |
+
var results = [];
|
| 6 |
+
for (var selector in config) {
|
| 7 |
+
var elements = $$(selector);
|
| 8 |
+
for (var i = 0; i < elements.length; i++) {
|
| 9 |
+
results.push(new Chosen(elements[i],config[selector]));
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
</script>
|
app/etc/modules/TheExtensionLab_MultiselectFilters.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<TheExtensionLab_MultiselectFilters>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</TheExtensionLab_MultiselectFilters>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/theextensionlab/multiselectfilters/chosen/chosen.proto.js
ADDED
|
@@ -0,0 +1,1259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
| 3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
| 4 |
+
|
| 5 |
+
Version 1.3.0
|
| 6 |
+
Full source at https://github.com/harvesthq/chosen
|
| 7 |
+
Copyright (c) 2011-2014 Harvest http://getharvest.com
|
| 8 |
+
|
| 9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
| 10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
(function() {
|
| 14 |
+
var AbstractChosen, SelectParser, _ref,
|
| 15 |
+
__hasProp = {}.hasOwnProperty,
|
| 16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
| 17 |
+
|
| 18 |
+
SelectParser = (function() {
|
| 19 |
+
function SelectParser() {
|
| 20 |
+
this.options_index = 0;
|
| 21 |
+
this.parsed = [];
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
SelectParser.prototype.add_node = function(child) {
|
| 25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
| 26 |
+
return this.add_group(child);
|
| 27 |
+
} else {
|
| 28 |
+
return this.add_option(child);
|
| 29 |
+
}
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
SelectParser.prototype.add_group = function(group) {
|
| 33 |
+
var group_position, option, _i, _len, _ref, _results;
|
| 34 |
+
group_position = this.parsed.length;
|
| 35 |
+
this.parsed.push({
|
| 36 |
+
array_index: group_position,
|
| 37 |
+
group: true,
|
| 38 |
+
label: this.escapeExpression(group.label),
|
| 39 |
+
children: 0,
|
| 40 |
+
disabled: group.disabled,
|
| 41 |
+
classes: group.className
|
| 42 |
+
});
|
| 43 |
+
_ref = group.childNodes;
|
| 44 |
+
_results = [];
|
| 45 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 46 |
+
option = _ref[_i];
|
| 47 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
| 48 |
+
}
|
| 49 |
+
return _results;
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
| 53 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
| 54 |
+
if (option.text !== "") {
|
| 55 |
+
if (group_position != null) {
|
| 56 |
+
this.parsed[group_position].children += 1;
|
| 57 |
+
}
|
| 58 |
+
this.parsed.push({
|
| 59 |
+
array_index: this.parsed.length,
|
| 60 |
+
options_index: this.options_index,
|
| 61 |
+
value: option.value,
|
| 62 |
+
text: option.text,
|
| 63 |
+
html: option.innerHTML,
|
| 64 |
+
selected: option.selected,
|
| 65 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
| 66 |
+
group_array_index: group_position,
|
| 67 |
+
classes: option.className,
|
| 68 |
+
style: option.style.cssText
|
| 69 |
+
});
|
| 70 |
+
} else {
|
| 71 |
+
this.parsed.push({
|
| 72 |
+
array_index: this.parsed.length,
|
| 73 |
+
options_index: this.options_index,
|
| 74 |
+
empty: true
|
| 75 |
+
});
|
| 76 |
+
}
|
| 77 |
+
return this.options_index += 1;
|
| 78 |
+
}
|
| 79 |
+
};
|
| 80 |
+
|
| 81 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
| 82 |
+
var map, unsafe_chars;
|
| 83 |
+
if ((text == null) || text === false) {
|
| 84 |
+
return "";
|
| 85 |
+
}
|
| 86 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
| 87 |
+
return text;
|
| 88 |
+
}
|
| 89 |
+
map = {
|
| 90 |
+
"<": "<",
|
| 91 |
+
">": ">",
|
| 92 |
+
'"': """,
|
| 93 |
+
"'": "'",
|
| 94 |
+
"`": "`"
|
| 95 |
+
};
|
| 96 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
| 97 |
+
return text.replace(unsafe_chars, function(chr) {
|
| 98 |
+
return map[chr] || "&";
|
| 99 |
+
});
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
return SelectParser;
|
| 103 |
+
|
| 104 |
+
})();
|
| 105 |
+
|
| 106 |
+
SelectParser.select_to_array = function(select) {
|
| 107 |
+
var child, parser, _i, _len, _ref;
|
| 108 |
+
parser = new SelectParser();
|
| 109 |
+
_ref = select.childNodes;
|
| 110 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 111 |
+
child = _ref[_i];
|
| 112 |
+
parser.add_node(child);
|
| 113 |
+
}
|
| 114 |
+
return parser.parsed;
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
AbstractChosen = (function() {
|
| 118 |
+
function AbstractChosen(form_field, options) {
|
| 119 |
+
this.form_field = form_field;
|
| 120 |
+
this.options = options != null ? options : {};
|
| 121 |
+
if (!AbstractChosen.browser_is_supported()) {
|
| 122 |
+
return;
|
| 123 |
+
}
|
| 124 |
+
this.is_multiple = this.form_field.multiple;
|
| 125 |
+
this.set_default_text();
|
| 126 |
+
this.set_default_values();
|
| 127 |
+
this.setup();
|
| 128 |
+
this.set_up_html();
|
| 129 |
+
this.register_observers();
|
| 130 |
+
this.on_ready();
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
AbstractChosen.prototype.set_default_values = function() {
|
| 134 |
+
var _this = this;
|
| 135 |
+
this.click_test_action = function(evt) {
|
| 136 |
+
return _this.test_active_click(evt);
|
| 137 |
+
};
|
| 138 |
+
this.activate_action = function(evt) {
|
| 139 |
+
return _this.activate_field(evt);
|
| 140 |
+
};
|
| 141 |
+
this.active_field = false;
|
| 142 |
+
this.mouse_on_container = false;
|
| 143 |
+
this.results_showing = false;
|
| 144 |
+
this.result_highlighted = null;
|
| 145 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
| 146 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
| 147 |
+
this.disable_search = this.options.disable_search || false;
|
| 148 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
| 149 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
| 150 |
+
this.search_contains = this.options.search_contains || false;
|
| 151 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
| 152 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
| 153 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
| 154 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
| 155 |
+
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
| 156 |
+
};
|
| 157 |
+
|
| 158 |
+
AbstractChosen.prototype.set_default_text = function() {
|
| 159 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
| 160 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
| 161 |
+
} else if (this.is_multiple) {
|
| 162 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
| 163 |
+
} else {
|
| 164 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
| 165 |
+
}
|
| 166 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
| 167 |
+
};
|
| 168 |
+
|
| 169 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
| 170 |
+
return this.mouse_on_container = true;
|
| 171 |
+
};
|
| 172 |
+
|
| 173 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
| 174 |
+
return this.mouse_on_container = false;
|
| 175 |
+
};
|
| 176 |
+
|
| 177 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
| 178 |
+
var _this = this;
|
| 179 |
+
if (this.is_multiple) {
|
| 180 |
+
if (!this.active_field) {
|
| 181 |
+
return setTimeout((function() {
|
| 182 |
+
return _this.container_mousedown();
|
| 183 |
+
}), 50);
|
| 184 |
+
}
|
| 185 |
+
} else {
|
| 186 |
+
if (!this.active_field) {
|
| 187 |
+
return this.activate_field();
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
};
|
| 191 |
+
|
| 192 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
| 193 |
+
var _this = this;
|
| 194 |
+
if (!this.mouse_on_container) {
|
| 195 |
+
this.active_field = false;
|
| 196 |
+
return setTimeout((function() {
|
| 197 |
+
return _this.blur_test();
|
| 198 |
+
}), 100);
|
| 199 |
+
}
|
| 200 |
+
};
|
| 201 |
+
|
| 202 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
| 203 |
+
var content, data, _i, _len, _ref;
|
| 204 |
+
content = '';
|
| 205 |
+
_ref = this.results_data;
|
| 206 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 207 |
+
data = _ref[_i];
|
| 208 |
+
if (data.group) {
|
| 209 |
+
content += this.result_add_group(data);
|
| 210 |
+
} else {
|
| 211 |
+
content += this.result_add_option(data);
|
| 212 |
+
}
|
| 213 |
+
if (options != null ? options.first : void 0) {
|
| 214 |
+
if (data.selected && this.is_multiple) {
|
| 215 |
+
this.choice_build(data);
|
| 216 |
+
} else if (data.selected && !this.is_multiple) {
|
| 217 |
+
this.single_set_selected_text(data.text);
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
return content;
|
| 222 |
+
};
|
| 223 |
+
|
| 224 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
| 225 |
+
var classes, option_el;
|
| 226 |
+
if (!option.search_match) {
|
| 227 |
+
return '';
|
| 228 |
+
}
|
| 229 |
+
if (!this.include_option_in_results(option)) {
|
| 230 |
+
return '';
|
| 231 |
+
}
|
| 232 |
+
classes = [];
|
| 233 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
| 234 |
+
classes.push("active-result");
|
| 235 |
+
}
|
| 236 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
| 237 |
+
classes.push("disabled-result");
|
| 238 |
+
}
|
| 239 |
+
if (option.selected) {
|
| 240 |
+
classes.push("result-selected");
|
| 241 |
+
}
|
| 242 |
+
if (option.group_array_index != null) {
|
| 243 |
+
classes.push("group-option");
|
| 244 |
+
}
|
| 245 |
+
if (option.classes !== "") {
|
| 246 |
+
classes.push(option.classes);
|
| 247 |
+
}
|
| 248 |
+
option_el = document.createElement("li");
|
| 249 |
+
option_el.className = classes.join(" ");
|
| 250 |
+
option_el.style.cssText = option.style;
|
| 251 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
| 252 |
+
option_el.innerHTML = option.search_text;
|
| 253 |
+
return this.outerHTML(option_el);
|
| 254 |
+
};
|
| 255 |
+
|
| 256 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
| 257 |
+
var classes, group_el;
|
| 258 |
+
if (!(group.search_match || group.group_match)) {
|
| 259 |
+
return '';
|
| 260 |
+
}
|
| 261 |
+
if (!(group.active_options > 0)) {
|
| 262 |
+
return '';
|
| 263 |
+
}
|
| 264 |
+
classes = [];
|
| 265 |
+
classes.push("group-result");
|
| 266 |
+
if (group.classes) {
|
| 267 |
+
classes.push(group.classes);
|
| 268 |
+
}
|
| 269 |
+
group_el = document.createElement("li");
|
| 270 |
+
group_el.className = classes.join(" ");
|
| 271 |
+
group_el.innerHTML = group.search_text;
|
| 272 |
+
return this.outerHTML(group_el);
|
| 273 |
+
};
|
| 274 |
+
|
| 275 |
+
AbstractChosen.prototype.results_update_field = function() {
|
| 276 |
+
this.set_default_text();
|
| 277 |
+
if (!this.is_multiple) {
|
| 278 |
+
this.results_reset_cleanup();
|
| 279 |
+
}
|
| 280 |
+
this.result_clear_highlight();
|
| 281 |
+
this.results_build();
|
| 282 |
+
if (this.results_showing) {
|
| 283 |
+
return this.winnow_results();
|
| 284 |
+
}
|
| 285 |
+
};
|
| 286 |
+
|
| 287 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
| 288 |
+
var result, _i, _len, _ref, _results;
|
| 289 |
+
_ref = this.results_data;
|
| 290 |
+
_results = [];
|
| 291 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 292 |
+
result = _ref[_i];
|
| 293 |
+
if (result.selected) {
|
| 294 |
+
_results.push(result.selected = false);
|
| 295 |
+
} else {
|
| 296 |
+
_results.push(void 0);
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
return _results;
|
| 300 |
+
};
|
| 301 |
+
|
| 302 |
+
AbstractChosen.prototype.results_toggle = function() {
|
| 303 |
+
if (this.results_showing) {
|
| 304 |
+
return this.results_hide();
|
| 305 |
+
} else {
|
| 306 |
+
return this.results_show();
|
| 307 |
+
}
|
| 308 |
+
};
|
| 309 |
+
|
| 310 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
| 311 |
+
if (this.results_showing) {
|
| 312 |
+
return this.winnow_results();
|
| 313 |
+
} else {
|
| 314 |
+
return this.results_show();
|
| 315 |
+
}
|
| 316 |
+
};
|
| 317 |
+
|
| 318 |
+
AbstractChosen.prototype.winnow_results = function() {
|
| 319 |
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
| 320 |
+
this.no_results_clear();
|
| 321 |
+
results = 0;
|
| 322 |
+
searchText = this.get_search_text();
|
| 323 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
| 324 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
| 325 |
+
regex = this.get_search_regex(escapedSearchText);
|
| 326 |
+
_ref = this.results_data;
|
| 327 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 328 |
+
option = _ref[_i];
|
| 329 |
+
option.search_match = false;
|
| 330 |
+
results_group = null;
|
| 331 |
+
if (this.include_option_in_results(option)) {
|
| 332 |
+
if (option.group) {
|
| 333 |
+
option.group_match = false;
|
| 334 |
+
option.active_options = 0;
|
| 335 |
+
}
|
| 336 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
| 337 |
+
results_group = this.results_data[option.group_array_index];
|
| 338 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
| 339 |
+
results += 1;
|
| 340 |
+
}
|
| 341 |
+
results_group.active_options += 1;
|
| 342 |
+
}
|
| 343 |
+
if (!(option.group && !this.group_search)) {
|
| 344 |
+
option.search_text = option.group ? option.label : option.text;
|
| 345 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
| 346 |
+
if (option.search_match && !option.group) {
|
| 347 |
+
results += 1;
|
| 348 |
+
}
|
| 349 |
+
if (option.search_match) {
|
| 350 |
+
if (searchText.length) {
|
| 351 |
+
startpos = option.search_text.search(zregex);
|
| 352 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
| 353 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
| 354 |
+
}
|
| 355 |
+
if (results_group != null) {
|
| 356 |
+
results_group.group_match = true;
|
| 357 |
+
}
|
| 358 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
| 359 |
+
option.search_match = true;
|
| 360 |
+
}
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
this.result_clear_highlight();
|
| 365 |
+
if (results < 1 && searchText.length) {
|
| 366 |
+
this.update_results_content("");
|
| 367 |
+
return this.no_results(searchText);
|
| 368 |
+
} else {
|
| 369 |
+
this.update_results_content(this.results_option_build());
|
| 370 |
+
return this.winnow_results_set_highlight();
|
| 371 |
+
}
|
| 372 |
+
};
|
| 373 |
+
|
| 374 |
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
| 375 |
+
var regex_anchor;
|
| 376 |
+
regex_anchor = this.search_contains ? "" : "^";
|
| 377 |
+
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
| 378 |
+
};
|
| 379 |
+
|
| 380 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
| 381 |
+
var part, parts, _i, _len;
|
| 382 |
+
if (regex.test(search_string)) {
|
| 383 |
+
return true;
|
| 384 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
| 385 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
| 386 |
+
if (parts.length) {
|
| 387 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
| 388 |
+
part = parts[_i];
|
| 389 |
+
if (regex.test(part)) {
|
| 390 |
+
return true;
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
};
|
| 396 |
+
|
| 397 |
+
AbstractChosen.prototype.choices_count = function() {
|
| 398 |
+
var option, _i, _len, _ref;
|
| 399 |
+
if (this.selected_option_count != null) {
|
| 400 |
+
return this.selected_option_count;
|
| 401 |
+
}
|
| 402 |
+
this.selected_option_count = 0;
|
| 403 |
+
_ref = this.form_field.options;
|
| 404 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
| 405 |
+
option = _ref[_i];
|
| 406 |
+
if (option.selected) {
|
| 407 |
+
this.selected_option_count += 1;
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
return this.selected_option_count;
|
| 411 |
+
};
|
| 412 |
+
|
| 413 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
| 414 |
+
evt.preventDefault();
|
| 415 |
+
if (!(this.results_showing || this.is_disabled)) {
|
| 416 |
+
return this.results_show();
|
| 417 |
+
}
|
| 418 |
+
};
|
| 419 |
+
|
| 420 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
| 421 |
+
var stroke, _ref;
|
| 422 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
| 423 |
+
this.search_field_scale();
|
| 424 |
+
switch (stroke) {
|
| 425 |
+
case 8:
|
| 426 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
| 427 |
+
return this.keydown_backstroke();
|
| 428 |
+
} else if (!this.pending_backstroke) {
|
| 429 |
+
this.result_clear_highlight();
|
| 430 |
+
return this.results_search();
|
| 431 |
+
}
|
| 432 |
+
break;
|
| 433 |
+
case 13:
|
| 434 |
+
evt.preventDefault();
|
| 435 |
+
if (this.results_showing) {
|
| 436 |
+
return this.result_select(evt);
|
| 437 |
+
}
|
| 438 |
+
break;
|
| 439 |
+
case 27:
|
| 440 |
+
if (this.results_showing) {
|
| 441 |
+
this.results_hide();
|
| 442 |
+
}
|
| 443 |
+
return true;
|
| 444 |
+
case 9:
|
| 445 |
+
case 38:
|
| 446 |
+
case 40:
|
| 447 |
+
case 16:
|
| 448 |
+
case 91:
|
| 449 |
+
case 17:
|
| 450 |
+
break;
|
| 451 |
+
default:
|
| 452 |
+
return this.results_search();
|
| 453 |
+
}
|
| 454 |
+
};
|
| 455 |
+
|
| 456 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
| 457 |
+
var _this = this;
|
| 458 |
+
return setTimeout((function() {
|
| 459 |
+
return _this.results_search();
|
| 460 |
+
}), 50);
|
| 461 |
+
};
|
| 462 |
+
|
| 463 |
+
AbstractChosen.prototype.container_width = function() {
|
| 464 |
+
if (this.options.width != null) {
|
| 465 |
+
return this.options.width;
|
| 466 |
+
} else {
|
| 467 |
+
return "" + this.form_field.offsetWidth + "px";
|
| 468 |
+
}
|
| 469 |
+
};
|
| 470 |
+
|
| 471 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
| 472 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
| 473 |
+
return false;
|
| 474 |
+
}
|
| 475 |
+
if (!this.display_disabled_options && option.disabled) {
|
| 476 |
+
return false;
|
| 477 |
+
}
|
| 478 |
+
if (option.empty) {
|
| 479 |
+
return false;
|
| 480 |
+
}
|
| 481 |
+
return true;
|
| 482 |
+
};
|
| 483 |
+
|
| 484 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
| 485 |
+
this.touch_started = true;
|
| 486 |
+
return this.search_results_mouseover(evt);
|
| 487 |
+
};
|
| 488 |
+
|
| 489 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
| 490 |
+
this.touch_started = false;
|
| 491 |
+
return this.search_results_mouseout(evt);
|
| 492 |
+
};
|
| 493 |
+
|
| 494 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
| 495 |
+
if (this.touch_started) {
|
| 496 |
+
return this.search_results_mouseup(evt);
|
| 497 |
+
}
|
| 498 |
+
};
|
| 499 |
+
|
| 500 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
| 501 |
+
var tmp;
|
| 502 |
+
if (element.outerHTML) {
|
| 503 |
+
return element.outerHTML;
|
| 504 |
+
}
|
| 505 |
+
tmp = document.createElement("div");
|
| 506 |
+
tmp.appendChild(element);
|
| 507 |
+
return tmp.innerHTML;
|
| 508 |
+
};
|
| 509 |
+
|
| 510 |
+
AbstractChosen.browser_is_supported = function() {
|
| 511 |
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
| 512 |
+
return document.documentMode >= 8;
|
| 513 |
+
}
|
| 514 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
| 515 |
+
return false;
|
| 516 |
+
}
|
| 517 |
+
if (/Android/i.test(window.navigator.userAgent)) {
|
| 518 |
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
| 519 |
+
return false;
|
| 520 |
+
}
|
| 521 |
+
}
|
| 522 |
+
return true;
|
| 523 |
+
};
|
| 524 |
+
|
| 525 |
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
| 526 |
+
|
| 527 |
+
AbstractChosen.default_single_text = "Select an Option";
|
| 528 |
+
|
| 529 |
+
AbstractChosen.default_no_result_text = "No results match";
|
| 530 |
+
|
| 531 |
+
return AbstractChosen;
|
| 532 |
+
|
| 533 |
+
})();
|
| 534 |
+
|
| 535 |
+
this.Chosen = (function(_super) {
|
| 536 |
+
__extends(Chosen, _super);
|
| 537 |
+
|
| 538 |
+
function Chosen() {
|
| 539 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
| 540 |
+
return _ref;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
Chosen.prototype.setup = function() {
|
| 544 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
| 545 |
+
return this.is_rtl = this.form_field.hasClassName("chosen-rtl");
|
| 546 |
+
};
|
| 547 |
+
|
| 548 |
+
Chosen.prototype.set_default_values = function() {
|
| 549 |
+
Chosen.__super__.set_default_values.call(this);
|
| 550 |
+
this.single_temp = new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
| 551 |
+
this.multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
| 552 |
+
return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
|
| 553 |
+
};
|
| 554 |
+
|
| 555 |
+
Chosen.prototype.set_up_html = function() {
|
| 556 |
+
var container_classes, container_props;
|
| 557 |
+
container_classes = ["chosen-container"];
|
| 558 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
| 559 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
| 560 |
+
container_classes.push(this.form_field.className);
|
| 561 |
+
}
|
| 562 |
+
if (this.is_rtl) {
|
| 563 |
+
container_classes.push("chosen-rtl");
|
| 564 |
+
}
|
| 565 |
+
container_props = {
|
| 566 |
+
'class': container_classes.join(' '),
|
| 567 |
+
'style': "width: " + (this.container_width()) + ";",
|
| 568 |
+
'title': this.form_field.title
|
| 569 |
+
};
|
| 570 |
+
if (this.form_field.id.length) {
|
| 571 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
| 572 |
+
}
|
| 573 |
+
this.container = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
|
| 574 |
+
"default": this.default_text
|
| 575 |
+
})) : new Element('div', container_props).update(this.single_temp.evaluate({
|
| 576 |
+
"default": this.default_text
|
| 577 |
+
}));
|
| 578 |
+
this.form_field.hide().insert({
|
| 579 |
+
after: this.container
|
| 580 |
+
});
|
| 581 |
+
this.dropdown = this.container.down('div.chosen-drop');
|
| 582 |
+
this.search_field = this.container.down('input');
|
| 583 |
+
this.search_results = this.container.down('ul.chosen-results');
|
| 584 |
+
this.search_field_scale();
|
| 585 |
+
this.search_no_results = this.container.down('li.no-results');
|
| 586 |
+
if (this.is_multiple) {
|
| 587 |
+
this.search_choices = this.container.down('ul.chosen-choices');
|
| 588 |
+
this.search_container = this.container.down('li.search-field');
|
| 589 |
+
} else {
|
| 590 |
+
this.search_container = this.container.down('div.chosen-search');
|
| 591 |
+
this.selected_item = this.container.down('.chosen-single');
|
| 592 |
+
}
|
| 593 |
+
this.results_build();
|
| 594 |
+
this.set_tab_index();
|
| 595 |
+
return this.set_label_behavior();
|
| 596 |
+
};
|
| 597 |
+
|
| 598 |
+
Chosen.prototype.on_ready = function() {
|
| 599 |
+
return this.form_field.fire("chosen:ready", {
|
| 600 |
+
chosen: this
|
| 601 |
+
});
|
| 602 |
+
};
|
| 603 |
+
|
| 604 |
+
Chosen.prototype.register_observers = function() {
|
| 605 |
+
var _this = this;
|
| 606 |
+
this.container.observe("touchstart", function(evt) {
|
| 607 |
+
return _this.container_mousedown(evt);
|
| 608 |
+
});
|
| 609 |
+
this.container.observe("touchend", function(evt) {
|
| 610 |
+
return _this.container_mouseup(evt);
|
| 611 |
+
});
|
| 612 |
+
this.container.observe("mousedown", function(evt) {
|
| 613 |
+
return _this.container_mousedown(evt);
|
| 614 |
+
});
|
| 615 |
+
this.container.observe("mouseup", function(evt) {
|
| 616 |
+
return _this.container_mouseup(evt);
|
| 617 |
+
});
|
| 618 |
+
this.container.observe("mouseenter", function(evt) {
|
| 619 |
+
return _this.mouse_enter(evt);
|
| 620 |
+
});
|
| 621 |
+
this.container.observe("mouseleave", function(evt) {
|
| 622 |
+
return _this.mouse_leave(evt);
|
| 623 |
+
});
|
| 624 |
+
this.search_results.observe("mouseup", function(evt) {
|
| 625 |
+
return _this.search_results_mouseup(evt);
|
| 626 |
+
});
|
| 627 |
+
this.search_results.observe("mouseover", function(evt) {
|
| 628 |
+
return _this.search_results_mouseover(evt);
|
| 629 |
+
});
|
| 630 |
+
this.search_results.observe("mouseout", function(evt) {
|
| 631 |
+
return _this.search_results_mouseout(evt);
|
| 632 |
+
});
|
| 633 |
+
this.search_results.observe("mousewheel", function(evt) {
|
| 634 |
+
return _this.search_results_mousewheel(evt);
|
| 635 |
+
});
|
| 636 |
+
this.search_results.observe("DOMMouseScroll", function(evt) {
|
| 637 |
+
return _this.search_results_mousewheel(evt);
|
| 638 |
+
});
|
| 639 |
+
this.search_results.observe("touchstart", function(evt) {
|
| 640 |
+
return _this.search_results_touchstart(evt);
|
| 641 |
+
});
|
| 642 |
+
this.search_results.observe("touchmove", function(evt) {
|
| 643 |
+
return _this.search_results_touchmove(evt);
|
| 644 |
+
});
|
| 645 |
+
this.search_results.observe("touchend", function(evt) {
|
| 646 |
+
return _this.search_results_touchend(evt);
|
| 647 |
+
});
|
| 648 |
+
this.form_field.observe("chosen:updated", function(evt) {
|
| 649 |
+
return _this.results_update_field(evt);
|
| 650 |
+
});
|
| 651 |
+
this.form_field.observe("chosen:activate", function(evt) {
|
| 652 |
+
return _this.activate_field(evt);
|
| 653 |
+
});
|
| 654 |
+
this.form_field.observe("chosen:open", function(evt) {
|
| 655 |
+
return _this.container_mousedown(evt);
|
| 656 |
+
});
|
| 657 |
+
this.form_field.observe("chosen:close", function(evt) {
|
| 658 |
+
return _this.input_blur(evt);
|
| 659 |
+
});
|
| 660 |
+
this.search_field.observe("blur", function(evt) {
|
| 661 |
+
return _this.input_blur(evt);
|
| 662 |
+
});
|
| 663 |
+
this.search_field.observe("keyup", function(evt) {
|
| 664 |
+
return _this.keyup_checker(evt);
|
| 665 |
+
});
|
| 666 |
+
this.search_field.observe("keydown", function(evt) {
|
| 667 |
+
return _this.keydown_checker(evt);
|
| 668 |
+
});
|
| 669 |
+
this.search_field.observe("focus", function(evt) {
|
| 670 |
+
return _this.input_focus(evt);
|
| 671 |
+
});
|
| 672 |
+
this.search_field.observe("cut", function(evt) {
|
| 673 |
+
return _this.clipboard_event_checker(evt);
|
| 674 |
+
});
|
| 675 |
+
this.search_field.observe("paste", function(evt) {
|
| 676 |
+
return _this.clipboard_event_checker(evt);
|
| 677 |
+
});
|
| 678 |
+
if (this.is_multiple) {
|
| 679 |
+
return this.search_choices.observe("click", function(evt) {
|
| 680 |
+
return _this.choices_click(evt);
|
| 681 |
+
});
|
| 682 |
+
} else {
|
| 683 |
+
return this.container.observe("click", function(evt) {
|
| 684 |
+
return evt.preventDefault();
|
| 685 |
+
});
|
| 686 |
+
}
|
| 687 |
+
};
|
| 688 |
+
|
| 689 |
+
Chosen.prototype.destroy = function() {
|
| 690 |
+
this.container.ownerDocument.stopObserving("click", this.click_test_action);
|
| 691 |
+
this.form_field.stopObserving();
|
| 692 |
+
this.container.stopObserving();
|
| 693 |
+
this.search_results.stopObserving();
|
| 694 |
+
this.search_field.stopObserving();
|
| 695 |
+
if (this.form_field_label != null) {
|
| 696 |
+
this.form_field_label.stopObserving();
|
| 697 |
+
}
|
| 698 |
+
if (this.is_multiple) {
|
| 699 |
+
this.search_choices.stopObserving();
|
| 700 |
+
this.container.select(".search-choice-close").each(function(choice) {
|
| 701 |
+
return choice.stopObserving();
|
| 702 |
+
});
|
| 703 |
+
} else {
|
| 704 |
+
this.selected_item.stopObserving();
|
| 705 |
+
}
|
| 706 |
+
if (this.search_field.tabIndex) {
|
| 707 |
+
this.form_field.tabIndex = this.search_field.tabIndex;
|
| 708 |
+
}
|
| 709 |
+
this.container.remove();
|
| 710 |
+
return this.form_field.show();
|
| 711 |
+
};
|
| 712 |
+
|
| 713 |
+
Chosen.prototype.search_field_disabled = function() {
|
| 714 |
+
this.is_disabled = this.form_field.disabled;
|
| 715 |
+
if (this.is_disabled) {
|
| 716 |
+
this.container.addClassName('chosen-disabled');
|
| 717 |
+
this.search_field.disabled = true;
|
| 718 |
+
if (!this.is_multiple) {
|
| 719 |
+
this.selected_item.stopObserving("focus", this.activate_action);
|
| 720 |
+
}
|
| 721 |
+
return this.close_field();
|
| 722 |
+
} else {
|
| 723 |
+
this.container.removeClassName('chosen-disabled');
|
| 724 |
+
this.search_field.disabled = false;
|
| 725 |
+
if (!this.is_multiple) {
|
| 726 |
+
return this.selected_item.observe("focus", this.activate_action);
|
| 727 |
+
}
|
| 728 |
+
}
|
| 729 |
+
};
|
| 730 |
+
|
| 731 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
| 732 |
+
if (!this.is_disabled) {
|
| 733 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
| 734 |
+
evt.stop();
|
| 735 |
+
}
|
| 736 |
+
if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
|
| 737 |
+
if (!this.active_field) {
|
| 738 |
+
if (this.is_multiple) {
|
| 739 |
+
this.search_field.clear();
|
| 740 |
+
}
|
| 741 |
+
this.container.ownerDocument.observe("click", this.click_test_action);
|
| 742 |
+
this.results_show();
|
| 743 |
+
} else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
|
| 744 |
+
this.results_toggle();
|
| 745 |
+
}
|
| 746 |
+
return this.activate_field();
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
};
|
| 750 |
+
|
| 751 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
| 752 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
| 753 |
+
return this.results_reset(evt);
|
| 754 |
+
}
|
| 755 |
+
};
|
| 756 |
+
|
| 757 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
| 758 |
+
var delta;
|
| 759 |
+
delta = evt.deltaY || -evt.wheelDelta || evt.detail;
|
| 760 |
+
if (delta != null) {
|
| 761 |
+
evt.preventDefault();
|
| 762 |
+
if (evt.type === 'DOMMouseScroll') {
|
| 763 |
+
delta = delta * 40;
|
| 764 |
+
}
|
| 765 |
+
return this.search_results.scrollTop = delta + this.search_results.scrollTop;
|
| 766 |
+
}
|
| 767 |
+
};
|
| 768 |
+
|
| 769 |
+
Chosen.prototype.blur_test = function(evt) {
|
| 770 |
+
if (!this.active_field && this.container.hasClassName("chosen-container-active")) {
|
| 771 |
+
return this.close_field();
|
| 772 |
+
}
|
| 773 |
+
};
|
| 774 |
+
|
| 775 |
+
Chosen.prototype.close_field = function() {
|
| 776 |
+
this.container.ownerDocument.stopObserving("click", this.click_test_action);
|
| 777 |
+
this.active_field = false;
|
| 778 |
+
this.results_hide();
|
| 779 |
+
this.container.removeClassName("chosen-container-active");
|
| 780 |
+
this.clear_backstroke();
|
| 781 |
+
this.show_search_field_default();
|
| 782 |
+
return this.search_field_scale();
|
| 783 |
+
};
|
| 784 |
+
|
| 785 |
+
Chosen.prototype.activate_field = function() {
|
| 786 |
+
this.container.addClassName("chosen-container-active");
|
| 787 |
+
this.active_field = true;
|
| 788 |
+
this.search_field.value = this.search_field.value;
|
| 789 |
+
return this.search_field.focus();
|
| 790 |
+
};
|
| 791 |
+
|
| 792 |
+
Chosen.prototype.test_active_click = function(evt) {
|
| 793 |
+
if (evt.target.up('.chosen-container') === this.container) {
|
| 794 |
+
return this.active_field = true;
|
| 795 |
+
} else {
|
| 796 |
+
return this.close_field();
|
| 797 |
+
}
|
| 798 |
+
};
|
| 799 |
+
|
| 800 |
+
Chosen.prototype.results_build = function() {
|
| 801 |
+
this.parsing = true;
|
| 802 |
+
this.selected_option_count = null;
|
| 803 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
| 804 |
+
if (this.is_multiple) {
|
| 805 |
+
this.search_choices.select("li.search-choice").invoke("remove");
|
| 806 |
+
} else if (!this.is_multiple) {
|
| 807 |
+
this.single_set_selected_text();
|
| 808 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
| 809 |
+
this.search_field.readOnly = true;
|
| 810 |
+
this.container.addClassName("chosen-container-single-nosearch");
|
| 811 |
+
} else {
|
| 812 |
+
this.search_field.readOnly = false;
|
| 813 |
+
this.container.removeClassName("chosen-container-single-nosearch");
|
| 814 |
+
}
|
| 815 |
+
}
|
| 816 |
+
this.update_results_content(this.results_option_build({
|
| 817 |
+
first: true
|
| 818 |
+
}));
|
| 819 |
+
this.search_field_disabled();
|
| 820 |
+
this.show_search_field_default();
|
| 821 |
+
this.search_field_scale();
|
| 822 |
+
return this.parsing = false;
|
| 823 |
+
};
|
| 824 |
+
|
| 825 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
| 826 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
| 827 |
+
this.result_clear_highlight();
|
| 828 |
+
this.result_highlight = el;
|
| 829 |
+
this.result_highlight.addClassName("highlighted");
|
| 830 |
+
maxHeight = parseInt(this.search_results.getStyle('maxHeight'), 10);
|
| 831 |
+
visible_top = this.search_results.scrollTop;
|
| 832 |
+
visible_bottom = maxHeight + visible_top;
|
| 833 |
+
high_top = this.result_highlight.positionedOffset().top;
|
| 834 |
+
high_bottom = high_top + this.result_highlight.getHeight();
|
| 835 |
+
if (high_bottom >= visible_bottom) {
|
| 836 |
+
return this.search_results.scrollTop = (high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0;
|
| 837 |
+
} else if (high_top < visible_top) {
|
| 838 |
+
return this.search_results.scrollTop = high_top;
|
| 839 |
+
}
|
| 840 |
+
};
|
| 841 |
+
|
| 842 |
+
Chosen.prototype.result_clear_highlight = function() {
|
| 843 |
+
if (this.result_highlight) {
|
| 844 |
+
this.result_highlight.removeClassName('highlighted');
|
| 845 |
+
}
|
| 846 |
+
return this.result_highlight = null;
|
| 847 |
+
};
|
| 848 |
+
|
| 849 |
+
Chosen.prototype.results_show = function() {
|
| 850 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
| 851 |
+
this.form_field.fire("chosen:maxselected", {
|
| 852 |
+
chosen: this
|
| 853 |
+
});
|
| 854 |
+
return false;
|
| 855 |
+
}
|
| 856 |
+
this.container.addClassName("chosen-with-drop");
|
| 857 |
+
this.results_showing = true;
|
| 858 |
+
this.search_field.focus();
|
| 859 |
+
this.search_field.value = this.search_field.value;
|
| 860 |
+
this.winnow_results();
|
| 861 |
+
return this.form_field.fire("chosen:showing_dropdown", {
|
| 862 |
+
chosen: this
|
| 863 |
+
});
|
| 864 |
+
};
|
| 865 |
+
|
| 866 |
+
Chosen.prototype.update_results_content = function(content) {
|
| 867 |
+
return this.search_results.update(content);
|
| 868 |
+
};
|
| 869 |
+
|
| 870 |
+
Chosen.prototype.results_hide = function() {
|
| 871 |
+
if (this.results_showing) {
|
| 872 |
+
this.result_clear_highlight();
|
| 873 |
+
this.container.removeClassName("chosen-with-drop");
|
| 874 |
+
this.form_field.fire("chosen:hiding_dropdown", {
|
| 875 |
+
chosen: this
|
| 876 |
+
});
|
| 877 |
+
}
|
| 878 |
+
return this.results_showing = false;
|
| 879 |
+
};
|
| 880 |
+
|
| 881 |
+
Chosen.prototype.set_tab_index = function(el) {
|
| 882 |
+
var ti;
|
| 883 |
+
if (this.form_field.tabIndex) {
|
| 884 |
+
ti = this.form_field.tabIndex;
|
| 885 |
+
this.form_field.tabIndex = -1;
|
| 886 |
+
return this.search_field.tabIndex = ti;
|
| 887 |
+
}
|
| 888 |
+
};
|
| 889 |
+
|
| 890 |
+
Chosen.prototype.set_label_behavior = function() {
|
| 891 |
+
var _this = this;
|
| 892 |
+
this.form_field_label = this.form_field.up("label");
|
| 893 |
+
if (this.form_field_label == null) {
|
| 894 |
+
this.form_field_label = $$("label[for='" + this.form_field.id + "']").first();
|
| 895 |
+
}
|
| 896 |
+
if (this.form_field_label != null) {
|
| 897 |
+
return this.form_field_label.observe("click", function(evt) {
|
| 898 |
+
if (_this.is_multiple) {
|
| 899 |
+
return _this.container_mousedown(evt);
|
| 900 |
+
} else {
|
| 901 |
+
return _this.activate_field();
|
| 902 |
+
}
|
| 903 |
+
});
|
| 904 |
+
}
|
| 905 |
+
};
|
| 906 |
+
|
| 907 |
+
Chosen.prototype.show_search_field_default = function() {
|
| 908 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
| 909 |
+
this.search_field.value = this.default_text;
|
| 910 |
+
return this.search_field.addClassName("default");
|
| 911 |
+
} else {
|
| 912 |
+
this.search_field.value = "";
|
| 913 |
+
return this.search_field.removeClassName("default");
|
| 914 |
+
}
|
| 915 |
+
};
|
| 916 |
+
|
| 917 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
| 918 |
+
var target;
|
| 919 |
+
target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
|
| 920 |
+
if (target) {
|
| 921 |
+
this.result_highlight = target;
|
| 922 |
+
this.result_select(evt);
|
| 923 |
+
return this.search_field.focus();
|
| 924 |
+
}
|
| 925 |
+
};
|
| 926 |
+
|
| 927 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
| 928 |
+
var target;
|
| 929 |
+
target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
|
| 930 |
+
if (target) {
|
| 931 |
+
return this.result_do_highlight(target);
|
| 932 |
+
}
|
| 933 |
+
};
|
| 934 |
+
|
| 935 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
| 936 |
+
if (evt.target.hasClassName('active-result') || evt.target.up('.active-result')) {
|
| 937 |
+
return this.result_clear_highlight();
|
| 938 |
+
}
|
| 939 |
+
};
|
| 940 |
+
|
| 941 |
+
Chosen.prototype.choice_build = function(item) {
|
| 942 |
+
var choice, close_link,
|
| 943 |
+
_this = this;
|
| 944 |
+
choice = new Element('li', {
|
| 945 |
+
"class": "search-choice"
|
| 946 |
+
}).update("<span>" + item.html + "</span>");
|
| 947 |
+
if (item.disabled) {
|
| 948 |
+
choice.addClassName('search-choice-disabled');
|
| 949 |
+
} else {
|
| 950 |
+
close_link = new Element('a', {
|
| 951 |
+
href: '#',
|
| 952 |
+
"class": 'search-choice-close',
|
| 953 |
+
rel: item.array_index
|
| 954 |
+
});
|
| 955 |
+
close_link.observe("click", function(evt) {
|
| 956 |
+
return _this.choice_destroy_link_click(evt);
|
| 957 |
+
});
|
| 958 |
+
choice.insert(close_link);
|
| 959 |
+
}
|
| 960 |
+
return this.search_container.insert({
|
| 961 |
+
before: choice
|
| 962 |
+
});
|
| 963 |
+
};
|
| 964 |
+
|
| 965 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
| 966 |
+
evt.preventDefault();
|
| 967 |
+
evt.stopPropagation();
|
| 968 |
+
if (!this.is_disabled) {
|
| 969 |
+
return this.choice_destroy(evt.target);
|
| 970 |
+
}
|
| 971 |
+
};
|
| 972 |
+
|
| 973 |
+
Chosen.prototype.choice_destroy = function(link) {
|
| 974 |
+
if (this.result_deselect(link.readAttribute("rel"))) {
|
| 975 |
+
this.show_search_field_default();
|
| 976 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.value.length < 1) {
|
| 977 |
+
this.results_hide();
|
| 978 |
+
}
|
| 979 |
+
link.up('li').remove();
|
| 980 |
+
return this.search_field_scale();
|
| 981 |
+
}
|
| 982 |
+
};
|
| 983 |
+
|
| 984 |
+
Chosen.prototype.results_reset = function() {
|
| 985 |
+
this.reset_single_select_options();
|
| 986 |
+
this.form_field.options[0].selected = true;
|
| 987 |
+
this.single_set_selected_text();
|
| 988 |
+
this.show_search_field_default();
|
| 989 |
+
this.results_reset_cleanup();
|
| 990 |
+
if (typeof Event.simulate === 'function') {
|
| 991 |
+
this.form_field.simulate("change");
|
| 992 |
+
}
|
| 993 |
+
if (this.active_field) {
|
| 994 |
+
return this.results_hide();
|
| 995 |
+
}
|
| 996 |
+
};
|
| 997 |
+
|
| 998 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
| 999 |
+
var deselect_trigger;
|
| 1000 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
| 1001 |
+
deselect_trigger = this.selected_item.down("abbr");
|
| 1002 |
+
if (deselect_trigger) {
|
| 1003 |
+
return deselect_trigger.remove();
|
| 1004 |
+
}
|
| 1005 |
+
};
|
| 1006 |
+
|
| 1007 |
+
Chosen.prototype.result_select = function(evt) {
|
| 1008 |
+
var high, item;
|
| 1009 |
+
if (this.result_highlight) {
|
| 1010 |
+
high = this.result_highlight;
|
| 1011 |
+
this.result_clear_highlight();
|
| 1012 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
| 1013 |
+
this.form_field.fire("chosen:maxselected", {
|
| 1014 |
+
chosen: this
|
| 1015 |
+
});
|
| 1016 |
+
return false;
|
| 1017 |
+
}
|
| 1018 |
+
if (this.is_multiple) {
|
| 1019 |
+
high.removeClassName("active-result");
|
| 1020 |
+
} else {
|
| 1021 |
+
this.reset_single_select_options();
|
| 1022 |
+
}
|
| 1023 |
+
high.addClassName("result-selected");
|
| 1024 |
+
item = this.results_data[high.getAttribute("data-option-array-index")];
|
| 1025 |
+
item.selected = true;
|
| 1026 |
+
this.form_field.options[item.options_index].selected = true;
|
| 1027 |
+
this.selected_option_count = null;
|
| 1028 |
+
if (this.is_multiple) {
|
| 1029 |
+
this.choice_build(item);
|
| 1030 |
+
} else {
|
| 1031 |
+
this.single_set_selected_text(item.text);
|
| 1032 |
+
}
|
| 1033 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
| 1034 |
+
this.results_hide();
|
| 1035 |
+
}
|
| 1036 |
+
this.search_field.value = "";
|
| 1037 |
+
if (typeof Event.simulate === 'function' && (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex)) {
|
| 1038 |
+
this.form_field.simulate("change");
|
| 1039 |
+
}
|
| 1040 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
| 1041 |
+
return this.search_field_scale();
|
| 1042 |
+
}
|
| 1043 |
+
};
|
| 1044 |
+
|
| 1045 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
| 1046 |
+
if (text == null) {
|
| 1047 |
+
text = this.default_text;
|
| 1048 |
+
}
|
| 1049 |
+
if (text === this.default_text) {
|
| 1050 |
+
this.selected_item.addClassName("chosen-default");
|
| 1051 |
+
} else {
|
| 1052 |
+
this.single_deselect_control_build();
|
| 1053 |
+
this.selected_item.removeClassName("chosen-default");
|
| 1054 |
+
}
|
| 1055 |
+
return this.selected_item.down("span").update(text);
|
| 1056 |
+
};
|
| 1057 |
+
|
| 1058 |
+
Chosen.prototype.result_deselect = function(pos) {
|
| 1059 |
+
var result_data;
|
| 1060 |
+
result_data = this.results_data[pos];
|
| 1061 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
| 1062 |
+
result_data.selected = false;
|
| 1063 |
+
this.form_field.options[result_data.options_index].selected = false;
|
| 1064 |
+
this.selected_option_count = null;
|
| 1065 |
+
this.result_clear_highlight();
|
| 1066 |
+
if (this.results_showing) {
|
| 1067 |
+
this.winnow_results();
|
| 1068 |
+
}
|
| 1069 |
+
if (typeof Event.simulate === 'function') {
|
| 1070 |
+
this.form_field.simulate("change");
|
| 1071 |
+
}
|
| 1072 |
+
this.search_field_scale();
|
| 1073 |
+
return true;
|
| 1074 |
+
} else {
|
| 1075 |
+
return false;
|
| 1076 |
+
}
|
| 1077 |
+
};
|
| 1078 |
+
|
| 1079 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
| 1080 |
+
if (!this.allow_single_deselect) {
|
| 1081 |
+
return;
|
| 1082 |
+
}
|
| 1083 |
+
if (!this.selected_item.down("abbr")) {
|
| 1084 |
+
this.selected_item.down("span").insert({
|
| 1085 |
+
after: "<abbr class=\"search-choice-close\"></abbr>"
|
| 1086 |
+
});
|
| 1087 |
+
}
|
| 1088 |
+
return this.selected_item.addClassName("chosen-single-with-deselect");
|
| 1089 |
+
};
|
| 1090 |
+
|
| 1091 |
+
Chosen.prototype.get_search_text = function() {
|
| 1092 |
+
if (this.search_field.value === this.default_text) {
|
| 1093 |
+
return "";
|
| 1094 |
+
} else {
|
| 1095 |
+
return this.search_field.value.strip().escapeHTML();
|
| 1096 |
+
}
|
| 1097 |
+
};
|
| 1098 |
+
|
| 1099 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
| 1100 |
+
var do_high;
|
| 1101 |
+
if (!this.is_multiple) {
|
| 1102 |
+
do_high = this.search_results.down(".result-selected.active-result");
|
| 1103 |
+
}
|
| 1104 |
+
if (do_high == null) {
|
| 1105 |
+
do_high = this.search_results.down(".active-result");
|
| 1106 |
+
}
|
| 1107 |
+
if (do_high != null) {
|
| 1108 |
+
return this.result_do_highlight(do_high);
|
| 1109 |
+
}
|
| 1110 |
+
};
|
| 1111 |
+
|
| 1112 |
+
Chosen.prototype.no_results = function(terms) {
|
| 1113 |
+
this.search_results.insert(this.no_results_temp.evaluate({
|
| 1114 |
+
terms: terms
|
| 1115 |
+
}));
|
| 1116 |
+
return this.form_field.fire("chosen:no_results", {
|
| 1117 |
+
chosen: this
|
| 1118 |
+
});
|
| 1119 |
+
};
|
| 1120 |
+
|
| 1121 |
+
Chosen.prototype.no_results_clear = function() {
|
| 1122 |
+
var nr, _results;
|
| 1123 |
+
nr = null;
|
| 1124 |
+
_results = [];
|
| 1125 |
+
while (nr = this.search_results.down(".no-results")) {
|
| 1126 |
+
_results.push(nr.remove());
|
| 1127 |
+
}
|
| 1128 |
+
return _results;
|
| 1129 |
+
};
|
| 1130 |
+
|
| 1131 |
+
Chosen.prototype.keydown_arrow = function() {
|
| 1132 |
+
var next_sib;
|
| 1133 |
+
if (this.results_showing && this.result_highlight) {
|
| 1134 |
+
next_sib = this.result_highlight.next('.active-result');
|
| 1135 |
+
if (next_sib) {
|
| 1136 |
+
return this.result_do_highlight(next_sib);
|
| 1137 |
+
}
|
| 1138 |
+
} else {
|
| 1139 |
+
return this.results_show();
|
| 1140 |
+
}
|
| 1141 |
+
};
|
| 1142 |
+
|
| 1143 |
+
Chosen.prototype.keyup_arrow = function() {
|
| 1144 |
+
var actives, prevs, sibs;
|
| 1145 |
+
if (!this.results_showing && !this.is_multiple) {
|
| 1146 |
+
return this.results_show();
|
| 1147 |
+
} else if (this.result_highlight) {
|
| 1148 |
+
sibs = this.result_highlight.previousSiblings();
|
| 1149 |
+
actives = this.search_results.select("li.active-result");
|
| 1150 |
+
prevs = sibs.intersect(actives);
|
| 1151 |
+
if (prevs.length) {
|
| 1152 |
+
return this.result_do_highlight(prevs.first());
|
| 1153 |
+
} else {
|
| 1154 |
+
if (this.choices_count() > 0) {
|
| 1155 |
+
this.results_hide();
|
| 1156 |
+
}
|
| 1157 |
+
return this.result_clear_highlight();
|
| 1158 |
+
}
|
| 1159 |
+
}
|
| 1160 |
+
};
|
| 1161 |
+
|
| 1162 |
+
Chosen.prototype.keydown_backstroke = function() {
|
| 1163 |
+
var next_available_destroy;
|
| 1164 |
+
if (this.pending_backstroke) {
|
| 1165 |
+
this.choice_destroy(this.pending_backstroke.down("a"));
|
| 1166 |
+
return this.clear_backstroke();
|
| 1167 |
+
} else {
|
| 1168 |
+
next_available_destroy = this.search_container.siblings().last();
|
| 1169 |
+
if (next_available_destroy && next_available_destroy.hasClassName("search-choice") && !next_available_destroy.hasClassName("search-choice-disabled")) {
|
| 1170 |
+
this.pending_backstroke = next_available_destroy;
|
| 1171 |
+
if (this.pending_backstroke) {
|
| 1172 |
+
this.pending_backstroke.addClassName("search-choice-focus");
|
| 1173 |
+
}
|
| 1174 |
+
if (this.single_backstroke_delete) {
|
| 1175 |
+
return this.keydown_backstroke();
|
| 1176 |
+
} else {
|
| 1177 |
+
return this.pending_backstroke.addClassName("search-choice-focus");
|
| 1178 |
+
}
|
| 1179 |
+
}
|
| 1180 |
+
}
|
| 1181 |
+
};
|
| 1182 |
+
|
| 1183 |
+
Chosen.prototype.clear_backstroke = function() {
|
| 1184 |
+
if (this.pending_backstroke) {
|
| 1185 |
+
this.pending_backstroke.removeClassName("search-choice-focus");
|
| 1186 |
+
}
|
| 1187 |
+
return this.pending_backstroke = null;
|
| 1188 |
+
};
|
| 1189 |
+
|
| 1190 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
| 1191 |
+
var stroke, _ref1;
|
| 1192 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
| 1193 |
+
this.search_field_scale();
|
| 1194 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
| 1195 |
+
this.clear_backstroke();
|
| 1196 |
+
}
|
| 1197 |
+
switch (stroke) {
|
| 1198 |
+
case 8:
|
| 1199 |
+
this.backstroke_length = this.search_field.value.length;
|
| 1200 |
+
break;
|
| 1201 |
+
case 9:
|
| 1202 |
+
if (this.results_showing && !this.is_multiple) {
|
| 1203 |
+
this.result_select(evt);
|
| 1204 |
+
}
|
| 1205 |
+
this.mouse_on_container = false;
|
| 1206 |
+
break;
|
| 1207 |
+
case 13:
|
| 1208 |
+
if (this.results_showing) {
|
| 1209 |
+
evt.preventDefault();
|
| 1210 |
+
}
|
| 1211 |
+
break;
|
| 1212 |
+
case 32:
|
| 1213 |
+
if (this.disable_search) {
|
| 1214 |
+
evt.preventDefault();
|
| 1215 |
+
}
|
| 1216 |
+
break;
|
| 1217 |
+
case 38:
|
| 1218 |
+
evt.preventDefault();
|
| 1219 |
+
this.keyup_arrow();
|
| 1220 |
+
break;
|
| 1221 |
+
case 40:
|
| 1222 |
+
evt.preventDefault();
|
| 1223 |
+
this.keydown_arrow();
|
| 1224 |
+
break;
|
| 1225 |
+
}
|
| 1226 |
+
};
|
| 1227 |
+
|
| 1228 |
+
Chosen.prototype.search_field_scale = function() {
|
| 1229 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
| 1230 |
+
if (this.is_multiple) {
|
| 1231 |
+
h = 0;
|
| 1232 |
+
w = 0;
|
| 1233 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
| 1234 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
| 1235 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
| 1236 |
+
style = styles[_i];
|
| 1237 |
+
style_block += style + ":" + this.search_field.getStyle(style) + ";";
|
| 1238 |
+
}
|
| 1239 |
+
div = new Element('div', {
|
| 1240 |
+
'style': style_block
|
| 1241 |
+
}).update(this.search_field.value.escapeHTML());
|
| 1242 |
+
document.body.appendChild(div);
|
| 1243 |
+
w = Element.measure(div, 'width') + 25;
|
| 1244 |
+
div.remove();
|
| 1245 |
+
f_width = this.container.getWidth();
|
| 1246 |
+
if (w > f_width - 10) {
|
| 1247 |
+
w = f_width - 10;
|
| 1248 |
+
}
|
| 1249 |
+
return this.search_field.setStyle({
|
| 1250 |
+
'width': w + 'px'
|
| 1251 |
+
});
|
| 1252 |
+
}
|
| 1253 |
+
};
|
| 1254 |
+
|
| 1255 |
+
return Chosen;
|
| 1256 |
+
|
| 1257 |
+
})(AbstractChosen);
|
| 1258 |
+
|
| 1259 |
+
}).call(this);
|
js/theextensionlab/multiselectfilters/chosen/chosen.proto.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
| 1 |
+
/* Chosen v1.3.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
| 2 |
+
!function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.text,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b)}),this.container.observe("touchend",function(b){return a.container_mouseup(b)}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+a.html+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.value="","function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}.call(this);
|
js/theextensionlab/multiselectfilters/chosen/init.js
ADDED
|
File without changes
|
js/theextensionlab/multiselectfilters/chosen/simulate.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Event.simulate(@element, eventName[, options]) -> Element
|
| 3 |
+
*
|
| 4 |
+
* - @element: element to fire event on
|
| 5 |
+
* - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
|
| 6 |
+
* - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
|
| 7 |
+
*
|
| 8 |
+
* $('foo').simulate('click'); // => fires "click" event on an element with id=foo
|
| 9 |
+
*
|
| 10 |
+
**/
|
| 11 |
+
(function(){
|
| 12 |
+
var eventMatchers = {
|
| 13 |
+
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
| 14 |
+
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
|
| 15 |
+
}
|
| 16 |
+
var defaultOptions = {
|
| 17 |
+
pointerX: 0,
|
| 18 |
+
pointerY: 0,
|
| 19 |
+
button: 0,
|
| 20 |
+
ctrlKey: false,
|
| 21 |
+
altKey: false,
|
| 22 |
+
shiftKey: false,
|
| 23 |
+
metaKey: false,
|
| 24 |
+
bubbles: true,
|
| 25 |
+
cancelable: true
|
| 26 |
+
}
|
| 27 |
+
Event.simulate = function(element, eventName) {
|
| 28 |
+
var options = Object.extend(defaultOptions, arguments[2] || { });
|
| 29 |
+
var oEvent, eventType = null;
|
| 30 |
+
element = $(element);
|
| 31 |
+
for (var name in eventMatchers) {
|
| 32 |
+
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
| 33 |
+
}
|
| 34 |
+
if (!eventType)
|
| 35 |
+
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
| 36 |
+
if (document.createEvent) {
|
| 37 |
+
oEvent = document.createEvent(eventType);
|
| 38 |
+
if (eventType == 'HTMLEvents') {
|
| 39 |
+
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
| 40 |
+
}
|
| 41 |
+
else {
|
| 42 |
+
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
| 43 |
+
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
| 44 |
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
| 45 |
+
}
|
| 46 |
+
element.dispatchEvent(oEvent);
|
| 47 |
+
}
|
| 48 |
+
else {
|
| 49 |
+
options.clientX = options.pointerX;
|
| 50 |
+
options.clientY = options.pointerY;
|
| 51 |
+
oEvent = Object.extend(document.createEventObject(), options);
|
| 52 |
+
element.fireEvent('on' + eventName, oEvent);
|
| 53 |
+
}
|
| 54 |
+
return element;
|
| 55 |
+
}
|
| 56 |
+
Element.addMethods({ simulate: Event.simulate });
|
| 57 |
+
})()
|
package.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>TheExtensionLab_MultiselectFilters</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="https://opensource.org/licenses/OSL-3.0">OSL 3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>An extension that replaces the default single select dropdowns with multi-select dropdowns in Magento admin grids.</summary>
|
| 10 |
+
<description>Sometimes you need to filter by more that one dropdown value, and without customisation that isn't possible in Magento.
|
| 11 |
+

|
| 12 |
+
This extension replaces the default single select dropdowns with multi-select dropdowns in Magento admin grids.. With this extension you can now search admin grids by Simple and Configurable Products, Refunded and Cancelled order status. Take a look a the quick preview below.</description>
|
| 13 |
+
<notes>Inital release</notes>
|
| 14 |
+
<authors><author><name>James Anelay</name><user>TheExtensionLab</user><email>james@theextensionlab.com</email></author></authors>
|
| 15 |
+
<date>2015-10-01</date>
|
| 16 |
+
<time>13:11:18</time>
|
| 17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="TheExtensionLab_MultiselectFilters.xml" hash="a93669fac8e173890130fc733aaaf2a5"/></dir></target><target name="magecommunity"><dir name="TheExtensionLab"><dir name="MultiselectFilters"><dir name="Block"><dir name="Adminhtml"><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><dir name="Multiselect"><file name="Country.php" hash="2a2731631b23401b1f5112b741bdb3be"/></dir><file name="Multiselect.php" hash="8c76dae09d3fb5bef85e051ec240ab5d"/></dir></dir></dir></dir></dir></dir><dir name="Model"><file name="Observer.php" hash="40024327c50dd6f5d0a3c64c9517f982"/></dir><dir name="Test"><dir name="Config"><file name="Main.php" hash="c3dd8b5944d2feaa6b25f34da2dcebb1"/></dir></dir><dir name="etc"><file name="config.xml" hash="0dca9fe44a7ffa71443ed735d5eab655"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="theextensionlab"><file name="multiselectfilters.xml" hash="d10baa11f7c0d4e1d9dee412447a6a51"/></dir></dir><dir name="template"><dir name="theextensionlab"><dir name="multiselectfilters"><dir name="chosen"><file name="init-js.phtml" hash="ab40273889b2af913ac35cdcbe0225ac"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="theextensionlab"><dir name="multiselectfilters"><dir name="chosen"><file name="chosen.proto.js" hash="249ee64baf95772fe3f4ad34e9ccb6b9"/><file name="chosen.proto.min.js" hash="93d1133ded89a8d03997a20dc220c2ae"/><file name="init.js" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="simulate.js" hash="2b982ed43725af6b8d2b6db97cee71fe"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="theextensionlab"><dir name="multiselectfilters"><dir><dir name="chosen"><dir name="css"><file name="chosen.css" hash="2b5387f8e94abf9ff275be9946b2ef9b"/></dir><dir name="images"><file name="chosen-sprite.png" hash="8b55a822e72b8fd5e2ee069236f2d797"/><file name="chosen-sprite@2x.png" hash="614fad616d014daf5367e068505cad35"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
| 18 |
+
<compatible/>
|
| 19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
+
</package>
|
skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/css/chosen.css
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
| 3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
| 4 |
+
|
| 5 |
+
Version 1.3.0
|
| 6 |
+
Full source at https://github.com/harvesthq/chosen
|
| 7 |
+
Copyright (c) 2011-2014 Harvest http://getharvest.com
|
| 8 |
+
|
| 9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
| 10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
/* @group Base */
|
| 14 |
+
.chosen-container {
|
| 15 |
+
position: relative;
|
| 16 |
+
display: inline-block;
|
| 17 |
+
vertical-align: middle;
|
| 18 |
+
font-size: 13px;
|
| 19 |
+
zoom: 1;
|
| 20 |
+
min-width:150px;
|
| 21 |
+
*display: inline;
|
| 22 |
+
-webkit-user-select: none;
|
| 23 |
+
-moz-user-select: none;
|
| 24 |
+
user-select: none;
|
| 25 |
+
}
|
| 26 |
+
.chosen-container * {
|
| 27 |
+
-webkit-box-sizing: border-box;
|
| 28 |
+
-moz-box-sizing: border-box;
|
| 29 |
+
box-sizing: border-box;
|
| 30 |
+
}
|
| 31 |
+
.chosen-container .chosen-drop {
|
| 32 |
+
position: absolute;
|
| 33 |
+
top: 100%;
|
| 34 |
+
left: -9999px;
|
| 35 |
+
z-index: 1010;
|
| 36 |
+
width: 100%;
|
| 37 |
+
border: 1px solid #aaa;
|
| 38 |
+
border-top: 0;
|
| 39 |
+
background: #fff;
|
| 40 |
+
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
| 41 |
+
}
|
| 42 |
+
.chosen-container.chosen-with-drop .chosen-drop {
|
| 43 |
+
left: 0;
|
| 44 |
+
}
|
| 45 |
+
.chosen-container a {
|
| 46 |
+
cursor: pointer;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* @end */
|
| 50 |
+
/* @group Single Chosen */
|
| 51 |
+
.chosen-container-single .chosen-single {
|
| 52 |
+
position: relative;
|
| 53 |
+
display: block;
|
| 54 |
+
overflow: hidden;
|
| 55 |
+
padding: 0 0 0 8px;
|
| 56 |
+
height: 25px;
|
| 57 |
+
border: 1px solid #aaa;
|
| 58 |
+
border-radius: 5px;
|
| 59 |
+
background-color: #fff;
|
| 60 |
+
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
|
| 61 |
+
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
| 62 |
+
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
| 63 |
+
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
| 64 |
+
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
| 65 |
+
background-clip: padding-box;
|
| 66 |
+
box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
| 67 |
+
color: #444;
|
| 68 |
+
text-decoration: none;
|
| 69 |
+
white-space: nowrap;
|
| 70 |
+
line-height: 24px;
|
| 71 |
+
}
|
| 72 |
+
.chosen-container-single .chosen-default {
|
| 73 |
+
color: #999;
|
| 74 |
+
}
|
| 75 |
+
.chosen-container-single .chosen-single span {
|
| 76 |
+
display: block;
|
| 77 |
+
overflow: hidden;
|
| 78 |
+
margin-right: 26px;
|
| 79 |
+
text-overflow: ellipsis;
|
| 80 |
+
white-space: nowrap;
|
| 81 |
+
}
|
| 82 |
+
.chosen-container-single .chosen-single-with-deselect span {
|
| 83 |
+
margin-right: 38px;
|
| 84 |
+
}
|
| 85 |
+
.chosen-container-single .chosen-single abbr {
|
| 86 |
+
position: absolute;
|
| 87 |
+
top: 6px;
|
| 88 |
+
right: 26px;
|
| 89 |
+
display: block;
|
| 90 |
+
width: 12px;
|
| 91 |
+
height: 12px;
|
| 92 |
+
background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
|
| 93 |
+
font-size: 1px;
|
| 94 |
+
}
|
| 95 |
+
.chosen-container-single .chosen-single abbr:hover {
|
| 96 |
+
background-position: -42px -10px;
|
| 97 |
+
}
|
| 98 |
+
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
| 99 |
+
background-position: -42px -10px;
|
| 100 |
+
}
|
| 101 |
+
.chosen-container-single .chosen-single div {
|
| 102 |
+
position: absolute;
|
| 103 |
+
top: 0;
|
| 104 |
+
right: 0;
|
| 105 |
+
display: block;
|
| 106 |
+
width: 18px;
|
| 107 |
+
height: 100%;
|
| 108 |
+
}
|
| 109 |
+
.chosen-container-single .chosen-single div b {
|
| 110 |
+
display: block;
|
| 111 |
+
width: 100%;
|
| 112 |
+
height: 100%;
|
| 113 |
+
background: url('../images/chosen-sprite.png') no-repeat 0px 2px;
|
| 114 |
+
}
|
| 115 |
+
.chosen-container-single .chosen-search {
|
| 116 |
+
position: relative;
|
| 117 |
+
z-index: 1010;
|
| 118 |
+
margin: 0;
|
| 119 |
+
padding: 3px 4px;
|
| 120 |
+
white-space: nowrap;
|
| 121 |
+
}
|
| 122 |
+
.chosen-container-single .chosen-search input[type="text"] {
|
| 123 |
+
margin: 1px 0;
|
| 124 |
+
padding: 4px 20px 4px 5px;
|
| 125 |
+
width: 100%;
|
| 126 |
+
height: auto;
|
| 127 |
+
outline: 0;
|
| 128 |
+
border: 1px solid #aaa;
|
| 129 |
+
background: white url('../images/chosen-sprite.png') no-repeat 100% -20px;
|
| 130 |
+
background: url('../images/chosen-sprite.png') no-repeat 100% -20px;
|
| 131 |
+
font-size: 1em;
|
| 132 |
+
font-family: sans-serif;
|
| 133 |
+
line-height: normal;
|
| 134 |
+
border-radius: 0;
|
| 135 |
+
}
|
| 136 |
+
.chosen-container-single .chosen-drop {
|
| 137 |
+
margin-top: -1px;
|
| 138 |
+
border-radius: 0 0 4px 4px;
|
| 139 |
+
background-clip: padding-box;
|
| 140 |
+
}
|
| 141 |
+
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
| 142 |
+
position: absolute;
|
| 143 |
+
left: -9999px;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/* @end */
|
| 147 |
+
/* @group Results */
|
| 148 |
+
.chosen-container .chosen-results {
|
| 149 |
+
color: #444;
|
| 150 |
+
position: relative;
|
| 151 |
+
overflow-x: hidden;
|
| 152 |
+
overflow-y: auto;
|
| 153 |
+
margin: 0 4px 4px 0;
|
| 154 |
+
padding: 0 0 0 4px;
|
| 155 |
+
max-height: 240px;
|
| 156 |
+
-webkit-overflow-scrolling: touch;
|
| 157 |
+
}
|
| 158 |
+
.chosen-container .chosen-results li {
|
| 159 |
+
display: none;
|
| 160 |
+
margin: 0;
|
| 161 |
+
padding: 5px 6px;
|
| 162 |
+
list-style: none;
|
| 163 |
+
line-height: 15px;
|
| 164 |
+
word-wrap: break-word;
|
| 165 |
+
-webkit-touch-callout: none;
|
| 166 |
+
}
|
| 167 |
+
.chosen-container .chosen-results li.active-result {
|
| 168 |
+
display: list-item;
|
| 169 |
+
cursor: pointer;
|
| 170 |
+
}
|
| 171 |
+
.chosen-container .chosen-results li.disabled-result {
|
| 172 |
+
display: list-item;
|
| 173 |
+
color: #ccc;
|
| 174 |
+
cursor: default;
|
| 175 |
+
}
|
| 176 |
+
.chosen-container .chosen-results li.highlighted {
|
| 177 |
+
background-color: #3875d7;
|
| 178 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
| 179 |
+
background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
| 180 |
+
background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
| 181 |
+
background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
| 182 |
+
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
| 183 |
+
color: #fff;
|
| 184 |
+
}
|
| 185 |
+
.chosen-container .chosen-results li.no-results {
|
| 186 |
+
color: #777;
|
| 187 |
+
display: list-item;
|
| 188 |
+
background: #f4f4f4;
|
| 189 |
+
}
|
| 190 |
+
.chosen-container .chosen-results li.group-result {
|
| 191 |
+
display: list-item;
|
| 192 |
+
font-weight: bold;
|
| 193 |
+
cursor: default;
|
| 194 |
+
}
|
| 195 |
+
.chosen-container .chosen-results li.group-option {
|
| 196 |
+
padding-left: 15px;
|
| 197 |
+
}
|
| 198 |
+
.chosen-container .chosen-results li em {
|
| 199 |
+
font-style: normal;
|
| 200 |
+
text-decoration: underline;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/* @end */
|
| 204 |
+
/* @group Multi Chosen */
|
| 205 |
+
.chosen-container-multi .chosen-choices {
|
| 206 |
+
position: relative;
|
| 207 |
+
overflow: hidden;
|
| 208 |
+
margin: 0;
|
| 209 |
+
padding: 0 5px;
|
| 210 |
+
width: 100%;
|
| 211 |
+
height: auto !important;
|
| 212 |
+
height: 1%;
|
| 213 |
+
border: 1px solid #aaa;
|
| 214 |
+
background-color: #fff;
|
| 215 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
| 216 |
+
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
| 217 |
+
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
| 218 |
+
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
| 219 |
+
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
|
| 220 |
+
cursor: text;
|
| 221 |
+
}
|
| 222 |
+
.chosen-container-multi .chosen-choices li {
|
| 223 |
+
float: left;
|
| 224 |
+
list-style: none;
|
| 225 |
+
}
|
| 226 |
+
.chosen-container-multi .chosen-choices li.search-field {
|
| 227 |
+
margin: 0;
|
| 228 |
+
padding: 0;
|
| 229 |
+
white-space: nowrap;
|
| 230 |
+
}
|
| 231 |
+
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
| 232 |
+
margin: 1px 0;
|
| 233 |
+
padding: 0;
|
| 234 |
+
height: 25px;
|
| 235 |
+
outline: 0;
|
| 236 |
+
border: 0 !important;
|
| 237 |
+
background: transparent !important;
|
| 238 |
+
box-shadow: none;
|
| 239 |
+
color: #999;
|
| 240 |
+
font-size: 100%;
|
| 241 |
+
font-family: sans-serif;
|
| 242 |
+
line-height: normal;
|
| 243 |
+
border-radius: 0;
|
| 244 |
+
}
|
| 245 |
+
.chosen-container-multi .chosen-choices li.search-choice {
|
| 246 |
+
position: relative;
|
| 247 |
+
margin: 3px 5px 3px 0;
|
| 248 |
+
padding: 3px 20px 3px 5px;
|
| 249 |
+
border: 1px solid #aaa;
|
| 250 |
+
max-width: 100%;
|
| 251 |
+
border-radius: 3px;
|
| 252 |
+
background-color: #eeeeee;
|
| 253 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
| 254 |
+
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 255 |
+
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 256 |
+
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 257 |
+
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 258 |
+
background-size: 100% 19px;
|
| 259 |
+
background-repeat: repeat-x;
|
| 260 |
+
background-clip: padding-box;
|
| 261 |
+
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
| 262 |
+
color: #333;
|
| 263 |
+
line-height: 13px;
|
| 264 |
+
cursor: default;
|
| 265 |
+
}
|
| 266 |
+
.chosen-container-multi .chosen-choices li.search-choice span {
|
| 267 |
+
word-wrap: break-word;
|
| 268 |
+
}
|
| 269 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
| 270 |
+
position: absolute;
|
| 271 |
+
top: 4px;
|
| 272 |
+
right: 3px;
|
| 273 |
+
display: block;
|
| 274 |
+
width: 12px;
|
| 275 |
+
height: 12px;
|
| 276 |
+
background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
|
| 277 |
+
font-size: 1px;
|
| 278 |
+
}
|
| 279 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
| 280 |
+
background-position: -42px -10px;
|
| 281 |
+
}
|
| 282 |
+
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
| 283 |
+
padding-right: 5px;
|
| 284 |
+
border: 1px solid #ccc;
|
| 285 |
+
background-color: #e4e4e4;
|
| 286 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
| 287 |
+
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 288 |
+
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 289 |
+
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 290 |
+
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
| 291 |
+
color: #666;
|
| 292 |
+
}
|
| 293 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
| 294 |
+
background: #d4d4d4;
|
| 295 |
+
}
|
| 296 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
| 297 |
+
background-position: -42px -10px;
|
| 298 |
+
}
|
| 299 |
+
.chosen-container-multi .chosen-results {
|
| 300 |
+
margin: 0;
|
| 301 |
+
padding: 0;
|
| 302 |
+
}
|
| 303 |
+
.chosen-container-multi .chosen-drop .result-selected {
|
| 304 |
+
display: list-item;
|
| 305 |
+
color: #ccc;
|
| 306 |
+
cursor: default;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
/* @end */
|
| 310 |
+
/* @group Active */
|
| 311 |
+
.chosen-container-active .chosen-single {
|
| 312 |
+
border: 1px solid #5897fb;
|
| 313 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
| 314 |
+
}
|
| 315 |
+
.chosen-container-active.chosen-with-drop .chosen-single {
|
| 316 |
+
border: 1px solid #aaa;
|
| 317 |
+
-moz-border-radius-bottomright: 0;
|
| 318 |
+
border-bottom-right-radius: 0;
|
| 319 |
+
-moz-border-radius-bottomleft: 0;
|
| 320 |
+
border-bottom-left-radius: 0;
|
| 321 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
|
| 322 |
+
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
| 323 |
+
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
| 324 |
+
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
| 325 |
+
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
|
| 326 |
+
box-shadow: 0 1px 0 #fff inset;
|
| 327 |
+
}
|
| 328 |
+
.chosen-container-active.chosen-with-drop .chosen-single div {
|
| 329 |
+
border-left: none;
|
| 330 |
+
background: transparent;
|
| 331 |
+
}
|
| 332 |
+
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
| 333 |
+
background-position: -18px 2px;
|
| 334 |
+
}
|
| 335 |
+
.chosen-container-active .chosen-choices {
|
| 336 |
+
border: 1px solid #5897fb;
|
| 337 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
| 338 |
+
}
|
| 339 |
+
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
| 340 |
+
color: #222 !important;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
/* @end */
|
| 344 |
+
/* @group Disabled Support */
|
| 345 |
+
.chosen-disabled {
|
| 346 |
+
opacity: 0.5 !important;
|
| 347 |
+
cursor: default;
|
| 348 |
+
}
|
| 349 |
+
.chosen-disabled .chosen-single {
|
| 350 |
+
cursor: default;
|
| 351 |
+
}
|
| 352 |
+
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
| 353 |
+
cursor: default;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
/* @end */
|
| 357 |
+
/* @group Right to Left */
|
| 358 |
+
.chosen-rtl {
|
| 359 |
+
text-align: right;
|
| 360 |
+
}
|
| 361 |
+
.chosen-rtl .chosen-single {
|
| 362 |
+
overflow: visible;
|
| 363 |
+
padding: 0 8px 0 0;
|
| 364 |
+
}
|
| 365 |
+
.chosen-rtl .chosen-single span {
|
| 366 |
+
margin-right: 0;
|
| 367 |
+
margin-left: 26px;
|
| 368 |
+
direction: rtl;
|
| 369 |
+
}
|
| 370 |
+
.chosen-rtl .chosen-single-with-deselect span {
|
| 371 |
+
margin-left: 38px;
|
| 372 |
+
}
|
| 373 |
+
.chosen-rtl .chosen-single div {
|
| 374 |
+
right: auto;
|
| 375 |
+
left: 3px;
|
| 376 |
+
}
|
| 377 |
+
.chosen-rtl .chosen-single abbr {
|
| 378 |
+
right: auto;
|
| 379 |
+
left: 26px;
|
| 380 |
+
}
|
| 381 |
+
.chosen-rtl .chosen-choices li {
|
| 382 |
+
float: right;
|
| 383 |
+
}
|
| 384 |
+
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
| 385 |
+
direction: rtl;
|
| 386 |
+
}
|
| 387 |
+
.chosen-rtl .chosen-choices li.search-choice {
|
| 388 |
+
margin: 3px 5px 3px 0;
|
| 389 |
+
padding: 3px 5px 3px 19px;
|
| 390 |
+
}
|
| 391 |
+
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
| 392 |
+
right: auto;
|
| 393 |
+
left: 4px;
|
| 394 |
+
}
|
| 395 |
+
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
| 396 |
+
.chosen-rtl .chosen-drop {
|
| 397 |
+
left: 9999px;
|
| 398 |
+
}
|
| 399 |
+
.chosen-rtl.chosen-container-single .chosen-results {
|
| 400 |
+
margin: 0 0 4px 4px;
|
| 401 |
+
padding: 0 4px 0 0;
|
| 402 |
+
}
|
| 403 |
+
.chosen-rtl .chosen-results li.group-option {
|
| 404 |
+
padding-right: 15px;
|
| 405 |
+
padding-left: 0;
|
| 406 |
+
}
|
| 407 |
+
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
| 408 |
+
border-right: none;
|
| 409 |
+
}
|
| 410 |
+
.chosen-rtl .chosen-search input[type="text"] {
|
| 411 |
+
padding: 4px 5px 4px 20px;
|
| 412 |
+
background: white url('../images/chosen-sprite.png') no-repeat -30px -20px;
|
| 413 |
+
background: url('../images/chosen-sprite.png') no-repeat -30px -20px;
|
| 414 |
+
direction: rtl;
|
| 415 |
+
}
|
| 416 |
+
.chosen-rtl.chosen-container-single .chosen-single div b {
|
| 417 |
+
background-position: 6px 2px;
|
| 418 |
+
}
|
| 419 |
+
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
| 420 |
+
background-position: -12px 2px;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/* @end */
|
| 424 |
+
/* @group Retina compatibility */
|
| 425 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
|
| 426 |
+
.chosen-rtl .chosen-search input[type="text"],
|
| 427 |
+
.chosen-container-single .chosen-single abbr,
|
| 428 |
+
.chosen-container-single .chosen-single div b,
|
| 429 |
+
.chosen-container-single .chosen-search input[type="text"],
|
| 430 |
+
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
| 431 |
+
.chosen-container .chosen-results-scroll-down span,
|
| 432 |
+
.chosen-container .chosen-results-scroll-up span {
|
| 433 |
+
background-image: url('../images/chosen-sprite@2x.png') !important;
|
| 434 |
+
background-size: 52px 37px !important;
|
| 435 |
+
background-repeat: no-repeat !important;
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
/* @end */
|
| 439 |
+
|
| 440 |
+
/* Magento specific */
|
| 441 |
+
.grid .hor-scroll{
|
| 442 |
+
overflow:visible;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
| 446 |
+
height:auto;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
.grid tr.filter{
|
| 450 |
+
background-color:#d4e3e5; /* Matches the background image better */
|
| 451 |
+
}
|
skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/images/chosen-sprite.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/theextensionlab/multiselectfilters/chosen/images/chosen-sprite@2x.png
ADDED
|
Binary file
|
