Version Description
(9th January 2019) = * Added: Compatibility with new and all default WP widgets #1400 * Fixed: Performance issue #2762 * Fixed: Need to add amp endpoint filter #2761 * Fixed: When Hide AMP Option is enabled in PageEditor with Convert AMP to WP theme (Beta) enabled it's providing output as AMP Page #2735 * Fixed: Whenever an image inserted, has width="100%" and height="100%", its giving Validation error. #2748 * Fixed: Custom post type is showing a blank page in the swift theme #2512 * Fixed: Whenever Responsive AD is enabled then the AD should load on the screen without any effect to the normal mode AD in D1,2,3, and Swift #2531 * Fixed: When Convert AMP to WP theme (Beta) is enabled GDPR popup isn't closing #2763 * Fixed: If twitter embed code is added then other blockquotes tag are not working #2750 * Fixed: Custom post type is showing a blank page in the swift theme #2512 * Fixed: Conflict with the Schema and Structure data plugin #2777 * Fixed: In the swift theme the Sticky social icons overlaps #2601 * Fixed: " Top " Button functionality to be improved. #2529 * Fixed: Drop down icon appearing twice #2785 * Fixed: Custom front page Meta description and content are not rendering for ALL in SEO plugin. #2702 * Fixed: Hover color is not appearing properly #2787
Full changelog available in changelog.txt
Release Info
Developer | mohammed_kaludi |
Plugin | AMP for WP – Accelerated Mobile Pages |
Version | 0.9.97.24 |
Comparing to | |
See all releases |
Code changes from version 0.9.97.23 to 0.9.97.24
- README.md +20 -2
- accelerated-moblie-pages.php +57 -4
- changelog.txt +18 -0
- components/components-core.php +38 -2
- components/loop/loop.php +20 -19
- components/menu/menu.php +1 -13
- images/banner.png +0 -0
- includes/includes.php +1 -0
- includes/options/admin-config.php +42 -51
- includes/options/extensions/vendor_support/vendor_support/vendor/select2/select2.css +454 -674
- includes/options/extensions/vendor_support/vendor_support/vendor/select2/select2.js +6029 -3011
- includes/options/redux-core/assets/css/redux-admin.css +0 -18
- includes/options/redux-core/inc/fields/select/field_select.js +67 -2
- includes/options/redux-core/inc/fields/select/field_select.min.js +1 -1
- includes/options/redux-core/inc/fields/select/field_select.php +27 -4
- includes/options/redux-core/templates/panel/header.tpl.php +0 -2
- includes/thirdparty-compatibility.php +18 -0
- includes/vendor/amp/includes/amp-post-template-actions.php +1 -1
- includes/vendor/amp/includes/lib/fasterimage/FasterImage.php +45 -135
- includes/vendor/amp/includes/sanitizers/class-amp-img-sanitizer.php +28 -3
- includes/vendor/amp/includes/widgets/class-amp-widget-archives.php +93 -0
- includes/vendor/amp/includes/widgets/class-amp-widget-categories.php +82 -0
- includes/vendor/amp/includes/widgets/class-amp-widget-media-video.php +28 -0
- includes/vendor/amp/includes/widgets/class-amp-widget-recent-comments.php +28 -0
- includes/vendor/amp/includes/widgets/class-amp-widget-text.php +28 -0
- includes/vendor/vendor-changelog.txt +3 -1
- readme.txt +21 -11
- templates/design-manager/design-1/footer.php +12 -2
- templates/design-manager/design-1/style.php +151 -4
- templates/design-manager/design-2/footer.php +8 -5
- templates/design-manager/design-2/style.php +142 -0
- templates/design-manager/design-3/footer.php +15 -5
- templates/design-manager/design-3/style.php +153 -5
- templates/design-manager/swift/archive.php +6 -14
- templates/design-manager/swift/footer.php +5 -25
- templates/design-manager/swift/index.php +6 -14
- templates/design-manager/swift/page.php +6 -14
- templates/design-manager/swift/search.php +6 -14
- templates/design-manager/swift/single.php +6 -21
- templates/design-manager/swift/style.php +132 -9
- templates/features.php +292 -66
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
|
|
3 |
Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 5.0
|
7 |
-
Stable tag: 0.9.97.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -184,6 +184,24 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
184 |
|
185 |
== Changelog ==
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
= 0.9.97.23 (18th December 2018) =
|
188 |
* Fixed: Sub menu items and arrows are not functioning in publisher theme. #2672
|
189 |
* Fixed: Fatal error when Polylang(Core) is activated. #2657
|
3 |
Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 5.0.2
|
7 |
+
Stable tag: 0.9.97.24
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
184 |
|
185 |
== Changelog ==
|
186 |
|
187 |
+
= 0.9.97.24 (9th January 2019) =
|
188 |
+
* Added: Compatibility with new and all default WP widgets #1400
|
189 |
+
* Fixed: Performance issue #2762
|
190 |
+
* Fixed: Need to add amp endpoint filter #2761
|
191 |
+
* Fixed: When Hide AMP Option is enabled in PageEditor with Convert AMP to WP theme (Beta) enabled it's providing output as AMP Page #2735
|
192 |
+
* Fixed: Whenever an image inserted, has width="100%" and height="100%", its giving Validation error. #2748
|
193 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
194 |
+
* Fixed: Whenever Responsive AD is enabled then the AD should load on the screen without any effect to the normal mode AD in D1,2,3, and Swift #2531
|
195 |
+
* Fixed: When Convert AMP to WP theme (Beta) is enabled GDPR popup isn't closing #2763
|
196 |
+
* Fixed: If twitter embed code is added then other blockquotes tag are not working #2750
|
197 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
198 |
+
* Fixed: Conflict with the Schema and Structure data plugin #2777
|
199 |
+
* Fixed: In the swift theme the Sticky social icons overlaps #2601
|
200 |
+
* Fixed: " Top " Button functionality to be improved. #2529
|
201 |
+
* Fixed: Drop down icon appearing twice #2785
|
202 |
+
* Fixed: Custom front page Meta description and content are not rendering for ALL in SEO plugin. #2702
|
203 |
+
* Fixed: Hover color is not appearing properly #2787
|
204 |
+
|
205 |
= 0.9.97.23 (18th December 2018) =
|
206 |
* Fixed: Sub menu items and arrows are not functioning in publisher theme. #2672
|
207 |
* Fixed: Fatal error when Polylang(Core) is activated. #2657
|
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Accelerated Mobile Pages
|
4 |
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
|
5 |
Description: AMP for WP - Accelerated Mobile Pages for WordPress
|
6 |
-
Version: 0.9.97.
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/25
|
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
|
|
20 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
|
21 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
22 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
23 |
-
define('AMPFORWP_VERSION','0.9.97.
|
24 |
// any changes to AMP_QUERY_VAR should be refelected here
|
25 |
function ampforwp_generate_endpoint(){
|
26 |
$ampforwp_slug = '';
|
@@ -204,7 +204,18 @@ function ampforwp_add_custom_rewrite_rules() {
|
|
204 |
}
|
205 |
}
|
206 |
}
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
$taxonomies = apply_filters( 'ampforwp_modify_rewrite_tax', $taxonomies );
|
209 |
if ( $taxonomies ) {
|
210 |
foreach ( $taxonomies as $key => $taxonomy ) {
|
@@ -511,7 +522,7 @@ function ampforwp_is_amp_endpoint() {
|
|
511 |
return ampforwp_is_non_amp();
|
512 |
}
|
513 |
else {
|
514 |
-
return false !== get_query_var( 'amp', false );
|
515 |
}
|
516 |
}
|
517 |
|
@@ -573,6 +584,12 @@ function ampforwp_bundle_core_amp_files(){
|
|
573 |
require_once( AMP__DIR__ . '/includes/admin/functions.php' );
|
574 |
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-settings.php' );
|
575 |
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-design-settings.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
}
|
577 |
add_action('plugins_loaded','ampforwp_bundle_core_amp_files', 8);
|
578 |
|
@@ -792,4 +809,40 @@ function ampforwp_sanitize_color( $color ) {
|
|
792 |
$color = str_replace( ' ', '', $color );
|
793 |
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
794 |
return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
795 |
}
|
3 |
Plugin Name: Accelerated Mobile Pages
|
4 |
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
|
5 |
Description: AMP for WP - Accelerated Mobile Pages for WordPress
|
6 |
+
Version: 0.9.97.24
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/25
|
20 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
|
21 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
22 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
23 |
+
define('AMPFORWP_VERSION','0.9.97.24');
|
24 |
// any changes to AMP_QUERY_VAR should be refelected here
|
25 |
function ampforwp_generate_endpoint(){
|
26 |
$ampforwp_slug = '';
|
204 |
}
|
205 |
}
|
206 |
}
|
207 |
+
$post_types = ampforwp_get_all_post_types();
|
208 |
+
if ( $post_types ) {
|
209 |
+
foreach ($post_types as $post_type ) {
|
210 |
+
if ( 'post' != $post_type && 'page' != $post_type ){
|
211 |
+
add_rewrite_rule(
|
212 |
+
$post_type.'\/amp/?$',
|
213 |
+
'index.php?amp&post_type='.$post_type,
|
214 |
+
'top'
|
215 |
+
);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
$taxonomies = apply_filters( 'ampforwp_modify_rewrite_tax', $taxonomies );
|
220 |
if ( $taxonomies ) {
|
221 |
foreach ( $taxonomies as $key => $taxonomy ) {
|
522 |
return ampforwp_is_non_amp();
|
523 |
}
|
524 |
else {
|
525 |
+
return apply_filters('ampforwp_is_amp_endpoint', false !== get_query_var( 'amp', false ) );
|
526 |
}
|
527 |
}
|
528 |
|
584 |
require_once( AMP__DIR__ . '/includes/admin/functions.php' );
|
585 |
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-settings.php' );
|
586 |
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-design-settings.php' );
|
587 |
+
// Widgets
|
588 |
+
require_once ( AMP__DIR__ . '/includes/widgets/class-amp-widget-categories.php' );
|
589 |
+
require_once ( AMP__DIR__ . '/includes/widgets/class-amp-widget-archives.php' );
|
590 |
+
require_once ( AMP__DIR__ . '/includes/widgets/class-amp-widget-media-video.php' );
|
591 |
+
require_once ( AMP__DIR__ . '/includes/widgets/class-amp-widget-recent-comments.php' );
|
592 |
+
require_once ( AMP__DIR__ . '/includes/widgets/class-amp-widget-text.php' );
|
593 |
}
|
594 |
add_action('plugins_loaded','ampforwp_bundle_core_amp_files', 8);
|
595 |
|
809 |
$color = str_replace( ' ', '', $color );
|
810 |
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
811 |
return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')';
|
812 |
+
}
|
813 |
+
|
814 |
+
// Post Types
|
815 |
+
function ampforwp_get_all_post_types(){
|
816 |
+
global $redux_builder_amp;
|
817 |
+
$post_types = array();
|
818 |
+
$selected_post_types = array();
|
819 |
+
$post_types = array('post' => 'post', 'page' => 'page');
|
820 |
+
if ( isset($redux_builder_amp['ampforwp-custom-type']) && $redux_builder_amp['ampforwp-custom-type'] ) {
|
821 |
+
foreach ($redux_builder_amp['ampforwp-custom-type'] as $key) {
|
822 |
+
$selected_post_types[$key] = $key;
|
823 |
+
}
|
824 |
+
$post_types = array_merge($post_types, $selected_post_types);
|
825 |
+
}
|
826 |
+
return $post_types;
|
827 |
+
}
|
828 |
+
|
829 |
+
// Register widgets
|
830 |
+
add_action('init', 'ampforwp_widgets',0.5);
|
831 |
+
function ampforwp_widgets(){
|
832 |
+
add_action( 'widgets_init', 'ampforwp_register_widgets' );
|
833 |
+
}
|
834 |
+
function ampforwp_register_widgets() {
|
835 |
+
global $wp_widget_factory;
|
836 |
+
foreach ( $wp_widget_factory->widgets as $registered_widget ) {
|
837 |
+
$registered_widget_class_name = get_class( $registered_widget );
|
838 |
+
if ( ! preg_match( '/^WP_Widget_(.+)$/', $registered_widget_class_name, $matches ) ) {
|
839 |
+
continue;
|
840 |
+
}
|
841 |
+
$amp_class_name = 'AMP_Widget_' . $matches[1];
|
842 |
+
if ( ! class_exists( $amp_class_name ) || is_a( $amp_class_name, $registered_widget_class_name ) ) {
|
843 |
+
continue;
|
844 |
+
}
|
845 |
+
unregister_widget( $registered_widget_class_name );
|
846 |
+
register_widget( $amp_class_name );
|
847 |
+
}
|
848 |
}
|
@@ -1,5 +1,23 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 0.9.97.23 (18th December 2018) =
|
4 |
* Fixed: Sub menu items and arrows are not functioning in publisher theme. #2672
|
5 |
* Fixed: Fatal error when Polylang(Core) is activated. #2657
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 0.9.97.24 (9th January 2019) =
|
4 |
+
* Added: Compatibility with new and all default WP widgets #1400
|
5 |
+
* Fixed: Performance issue #2762
|
6 |
+
* Fixed: Need to add amp endpoint filter #2761
|
7 |
+
* Fixed: When Hide AMP Option is enabled in PageEditor with Convert AMP to WP theme (Beta) enabled it's providing output as AMP Page #2735
|
8 |
+
* Fixed: Whenever an image inserted, has width="100%" and height="100%", its giving Validation error. #2748
|
9 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
10 |
+
* Fixed: Whenever Responsive AD is enabled then the AD should load on the screen without any effect to the normal mode AD in D1,2,3, and Swift #2531
|
11 |
+
* Fixed: When Convert AMP to WP theme (Beta) is enabled GDPR popup isn't closing #2763
|
12 |
+
* Fixed: If twitter embed code is added then other blockquotes tag are not working #2750
|
13 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
14 |
+
* Fixed: Conflict with the Schema and Structure data plugin #2777
|
15 |
+
* Fixed: In the swift theme the Sticky social icons overlaps #2601
|
16 |
+
* Fixed: " Top " Button functionality to be improved. #2529
|
17 |
+
* Fixed: Drop down icon appearing twice #2785
|
18 |
+
* Fixed: Custom front page Meta description and content are not rendering for ALL in SEO plugin. #2702
|
19 |
+
* Fixed: Hover color is not appearing properly #2787
|
20 |
+
|
21 |
= 0.9.97.23 (18th December 2018) =
|
22 |
* Fixed: Sub menu items and arrows are not functioning in publisher theme. #2672
|
23 |
* Fixed: Fatal error when Polylang(Core) is activated. #2657
|
@@ -425,8 +425,44 @@ function amp_non_amp_link(){
|
|
425 |
// Back to Top
|
426 |
function amp_back_to_top_link(){
|
427 |
global $redux_builder_amp;
|
428 |
-
if(
|
429 |
-
<a title="back to top" on="tap:backtotop.scrollTo(duration=500)" class="btt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
<?php }
|
431 |
}
|
432 |
|
425 |
// Back to Top
|
426 |
function amp_back_to_top_link(){
|
427 |
global $redux_builder_amp;
|
428 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
429 |
+
<a id="scrollToTopButton" title="back to top" on="tap:backtotop.scrollTo(duration=500)" class="btt" ></a>
|
430 |
+
<amp-animation id="showAnim"
|
431 |
+
layout="nodisplay">
|
432 |
+
<script type="application/json">
|
433 |
+
{
|
434 |
+
"duration": "400ms",
|
435 |
+
"fill": "both",
|
436 |
+
"iterations": "1",
|
437 |
+
"direction": "alternate",
|
438 |
+
"animations": [{
|
439 |
+
"selector": "#scrollToTopButton",
|
440 |
+
"keyframes": [{
|
441 |
+
"opacity": "1",
|
442 |
+
"visibility": "visible"
|
443 |
+
}]
|
444 |
+
}]
|
445 |
+
}
|
446 |
+
</script>
|
447 |
+
</amp-animation>
|
448 |
+
<amp-animation id="hideAnim"
|
449 |
+
layout="nodisplay">
|
450 |
+
<script type="application/json">
|
451 |
+
{
|
452 |
+
"duration": "400ms",
|
453 |
+
"fill": "both",
|
454 |
+
"iterations": "1",
|
455 |
+
"direction": "alternate",
|
456 |
+
"animations": [{
|
457 |
+
"selector": "#scrollToTopButton",
|
458 |
+
"keyframes": [{
|
459 |
+
"opacity": "0",
|
460 |
+
"visibility": "hidden"
|
461 |
+
}]
|
462 |
+
}]
|
463 |
+
}
|
464 |
+
</script>
|
465 |
+
</amp-animation>
|
466 |
<?php }
|
467 |
}
|
468 |
|
@@ -91,25 +91,26 @@ function call_loops_standard($data=array()){
|
|
91 |
$qobj_taxonomy = $qobj->taxonomy;
|
92 |
$qobj_term_id = $qobj->term_id;
|
93 |
}
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
113 |
}
|
114 |
if ( is_home() ) {
|
115 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
91 |
$qobj_taxonomy = $qobj->taxonomy;
|
92 |
$qobj_term_id = $qobj->term_id;
|
93 |
}
|
94 |
+
if( !is_date() ){
|
95 |
+
$args = array(
|
96 |
+
'post_type' => $post_type,
|
97 |
+
'orderby' => 'date',
|
98 |
+
'ignore_sticky_posts' => 1,
|
99 |
+
'paged' => esc_attr($paged),
|
100 |
+
'post__not_in' => $exclude_ids,
|
101 |
+
'has_password' => false ,
|
102 |
+
'post_status'=> 'publish'
|
103 |
+
);
|
104 |
+
if ( is_category() || ( isset($qobj->taxonomy) && taxonomy_exists($qobj->taxonomy)) ) {
|
105 |
+
$args['tax_query'] = array(
|
106 |
+
array(
|
107 |
+
'taxonomy' => $qobj->taxonomy,
|
108 |
+
'field' => 'id',
|
109 |
+
'terms' => $qobj->term_id,
|
110 |
+
),
|
111 |
+
);
|
112 |
+
}
|
113 |
+
}
|
114 |
}
|
115 |
if ( is_home() ) {
|
116 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
@@ -22,17 +22,5 @@ function amp_menu_html($echo){
|
|
22 |
add_action('amp_post_template_css','amp_menu_styles',11);
|
23 |
function amp_menu_styles(){ ?>
|
24 |
aside{width:150px}
|
25 |
-
.amp-menu{list-style-type:none;margin:0;padding:0}
|
26 |
-
.amp-menu li{position:relative;display:block}
|
27 |
-
.amp-menu li.menu-item-has-children ul{display:none}
|
28 |
-
.amp-menu li.menu-item-has-children:hover>ul{display:}
|
29 |
-
.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}
|
30 |
-
.amp-menu li ul li a{
|
31 |
-
padding: 4px 10px;
|
32 |
-
font-size:14px;
|
33 |
-
}
|
34 |
-
.amp-menu input{display:none;}
|
35 |
-
.amp-menu [id^=drop]:checked + label + ul{ display: block;}
|
36 |
-
.amp-menu .toggle:after{content:'\25be';position:absolute;padding: 10px 15px 10px 30px;right:0;font-size:18px;color:#6d6a6a;top:0px;z-index:10000;line-height:1;cursor: pointer;}
|
37 |
-
.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}
|
38 |
<?php }
|
22 |
add_action('amp_post_template_css','amp_menu_styles',11);
|
23 |
function amp_menu_styles(){ ?>
|
24 |
aside{width:150px}
|
25 |
+
.amp-menu{list-style-type:none;margin:0;padding:0}.amp-menu li{position:relative;display:block}.amp-menu li.menu-item-has-children ul{display:none}.amp-menu li.menu-item-has-children:hover>ul{display:}.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}.amp-menu li.menu-item-has-children:after{content:" > ";position:absolute;padding:10px;right:0;top:0;z-index:10000;line-height:1;}.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<?php }
|
Binary file
|
@@ -53,6 +53,7 @@ function ampforwp_add_admin_styling(){
|
|
53 |
|
54 |
// Localize the script with new data
|
55 |
wp_localize_script( 'ampforwp_admin_js', 'redux_data', $redux_builder_amp );
|
|
|
56 |
|
57 |
wp_enqueue_script( 'ampforwp_admin_js' );
|
58 |
}
|
53 |
|
54 |
// Localize the script with new data
|
55 |
wp_localize_script( 'ampforwp_admin_js', 'redux_data', $redux_builder_amp );
|
56 |
+
wp_localize_script( 'ampforwp_admin_js', 'ampforwp_nonce', wp_create_nonce('ampforwp-verify-request') );
|
57 |
|
58 |
wp_enqueue_script( 'ampforwp_admin_js' );
|
59 |
}
|
@@ -517,7 +517,7 @@ $freepro_listing = '
|
|
517 |
<span class="ov"></span>
|
518 |
</div>
|
519 |
<div class="fp-cnt">
|
520 |
-
<h1>Upgrade to Pro
|
521 |
<p>Take your AMP to the next level with more beautiful themes, great extensions and more powerful features.</p>
|
522 |
<a class="buy" href="#upgrade">BUY NOW</a>
|
523 |
</div>
|
@@ -684,10 +684,9 @@ $freepro_listing = '
|
|
684 |
</div>
|
685 |
<div class="pri-lst">
|
686 |
<div class="pri-tb">
|
687 |
-
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&
|
688 |
<h5>PERSONAL</h5>
|
689 |
-
<span class="amt
|
690 |
-
<span class="amt"><sup>$</sup>89.4</span>
|
691 |
<span class="bil">Billed Annually</span>
|
692 |
<span class="s">1 Site License</span>
|
693 |
<span class="e">E-mail support</span>
|
@@ -697,10 +696,9 @@ $freepro_listing = '
|
|
697 |
</a>
|
698 |
</div>
|
699 |
<div class="pri-tb rec">
|
700 |
-
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&
|
701 |
<h5>MULTIPLE</h5>
|
702 |
-
<span class="amt
|
703 |
-
<span class="amt"><sup>$</sup>119.4</span>
|
704 |
<span class="bil">Billed Annually</span>
|
705 |
<span class="s">3 Site License</span>
|
706 |
<span class="e">E-mail support</span>
|
@@ -711,10 +709,9 @@ $freepro_listing = '
|
|
711 |
</a>
|
712 |
</div>
|
713 |
<div class="pri-tb">
|
714 |
-
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&
|
715 |
<h5>WEBMASTER</h5>
|
716 |
-
<span class="amt
|
717 |
-
<span class="amt"><sup>$</sup>149.40</span>
|
718 |
<span class="bil">Billed Annually</span>
|
719 |
<span class="s">10 Site License</span>
|
720 |
<span class="e">E-mail support</span>
|
@@ -724,10 +721,9 @@ $freepro_listing = '
|
|
724 |
</a>
|
725 |
</div>
|
726 |
<div class="pri-tb">
|
727 |
-
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&
|
728 |
<h5>FREELANCER</h5>
|
729 |
-
<span class="amt
|
730 |
-
<span class="amt"><sup>$</sup>179.40</span>
|
731 |
<span class="bil">Billed Annually</span>
|
732 |
<span class="s">25 Site License</span>
|
733 |
<span class="e">E-mail support</span>
|
@@ -737,10 +733,9 @@ $freepro_listing = '
|
|
737 |
</a>
|
738 |
</div>
|
739 |
<div class="pri-tb">
|
740 |
-
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&
|
741 |
<h5>AGENCY</h5>
|
742 |
-
<span class="amt
|
743 |
-
<span class="amt"><sup>$</sup>299.40</span>
|
744 |
<span class="bil">Billed Annually</span>
|
745 |
<span class="s">Unlimited</span>
|
746 |
<span class="e">E-mail support</span>
|
@@ -3539,7 +3534,19 @@ Redux::setSection( $opt_name, array(
|
|
3539 |
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
|
3540 |
'default' => 0,
|
3541 |
'data' => 'category_list_hierarchy',
|
3542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3543 |
array(
|
3544 |
'id' =>'hide-amp-tags-bulk-option',
|
3545 |
'type' => 'checkbox',
|
@@ -3547,6 +3554,17 @@ Redux::setSection( $opt_name, array(
|
|
3547 |
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected tags.', 'accelerated-mobile-pages' ),
|
3548 |
'default' => 0,
|
3549 |
'data' => 'tags',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3550 |
|
3551 |
),
|
3552 |
)
|
@@ -5261,25 +5279,7 @@ Redux::setSection( $opt_name, array(
|
|
5261 |
}
|
5262 |
//End of code for fetching categories to show as a list in redux settings
|
5263 |
|
5264 |
-
|
5265 |
-
$tags_array = '';
|
5266 |
-
if(get_tags()){
|
5267 |
-
$tags = get_tags( array(
|
5268 |
-
'orderby' => 'name',
|
5269 |
-
'order' => 'ASC',
|
5270 |
-
'number' => 500
|
5271 |
-
) );
|
5272 |
-
$tags_array = array();
|
5273 |
-
if( $tags ) :
|
5274 |
-
foreach( $tags as $tag ){
|
5275 |
-
$tag_id = $tag->term_id;
|
5276 |
-
$key = "".$tag_id;
|
5277 |
-
// building associative array of ID-tag_name
|
5278 |
-
$tags_array[ $key ] = $tag->name;
|
5279 |
-
}
|
5280 |
-
endif;
|
5281 |
-
}
|
5282 |
-
// End of code for fetching tags to show as a list in redux settings
|
5283 |
$ampforwp_home_loop = array();
|
5284 |
$ampforwp_home_loop = get_option('ampforwp_custom_post_types');
|
5285 |
$ampforwp_home_loop['post'] = 'Posts';
|
@@ -5339,12 +5339,16 @@ Redux::setSection( $opt_name, array(
|
|
5339 |
'type' => 'select',
|
5340 |
'class' => 'child_opt',
|
5341 |
'title' => esc_html__( 'Featured Slider from Tags', 'accelerated-mobile-pages' ),
|
5342 |
-
'options' => $tags_array,
|
5343 |
'required' => array(
|
5344 |
array('amp-design-selector', '=' , '3'),
|
5345 |
array('amp-design-3-featured-slider', '=' , '1'),
|
5346 |
array('amp-design-3-featured-content', '=' , '2'),
|
5347 |
-
),
|
|
|
|
|
|
|
|
|
5348 |
),
|
5349 |
array(
|
5350 |
'id' =>'ampforwp-featur-slider-num-posts',
|
@@ -6253,19 +6257,6 @@ else{
|
|
6253 |
'true' => 'true',
|
6254 |
'false' => 'false',
|
6255 |
'default' => 1,
|
6256 |
-
'required' => array(
|
6257 |
-
array('amp-design-selector', '!=' , '3')
|
6258 |
-
)
|
6259 |
-
),
|
6260 |
-
array(
|
6261 |
-
'id' => 'ampforwp-footer-top-design3',
|
6262 |
-
'type' => 'switch',
|
6263 |
-
'title' => esc_html__('Back to Top link', 'accelerated-mobile-pages'),
|
6264 |
-
'tooltip-subtitle' => esc_html__('Enable / Disable Link to top of the page in the footer', 'accelerated-mobile-pages'),
|
6265 |
-
'true' => 'true',
|
6266 |
-
'false' => 'false',
|
6267 |
-
'default' => 0,
|
6268 |
-
'required' => array( array( 'amp-design-selector', '=' , '3' ) )
|
6269 |
),
|
6270 |
|
6271 |
array(
|
517 |
<span class="ov"></span>
|
518 |
</div>
|
519 |
<div class="fp-cnt">
|
520 |
+
<h1>Upgrade to Pro</h1>
|
521 |
<p>Take your AMP to the next level with more beautiful themes, great extensions and more powerful features.</p>
|
522 |
<a class="buy" href="#upgrade">BUY NOW</a>
|
523 |
</div>
|
684 |
</div>
|
685 |
<div class="pri-lst">
|
686 |
<div class="pri-tb">
|
687 |
+
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&edd_options[price_id]=1&utm_medium=freevspro&utm_campaign=AMP%20Plugin">
|
688 |
<h5>PERSONAL</h5>
|
689 |
+
<span class="amt"><sup>$</sup>149</span>
|
|
|
690 |
<span class="bil">Billed Annually</span>
|
691 |
<span class="s">1 Site License</span>
|
692 |
<span class="e">E-mail support</span>
|
696 |
</a>
|
697 |
</div>
|
698 |
<div class="pri-tb rec">
|
699 |
+
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&edd_options[price_id]=2&utm_medium=freevspro&utm_campaign=AMP%20Plugin">
|
700 |
<h5>MULTIPLE</h5>
|
701 |
+
<span class="amt"><sup>$</sup>199</span>
|
|
|
702 |
<span class="bil">Billed Annually</span>
|
703 |
<span class="s">3 Site License</span>
|
704 |
<span class="e">E-mail support</span>
|
709 |
</a>
|
710 |
</div>
|
711 |
<div class="pri-tb">
|
712 |
+
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&edd_options[price_id]=3&utm_medium=freevspro&utm_campaign=AMP%20Plugin">
|
713 |
<h5>WEBMASTER</h5>
|
714 |
+
<span class="amt"><sup>$</sup>249</span>
|
|
|
715 |
<span class="bil">Billed Annually</span>
|
716 |
<span class="s">10 Site License</span>
|
717 |
<span class="e">E-mail support</span>
|
721 |
</a>
|
722 |
</div>
|
723 |
<div class="pri-tb">
|
724 |
+
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&edd_options[price_id]=4&utm_medium=freevspro&utm_campaign=AMP%20Plugin">
|
725 |
<h5>FREELANCER</h5>
|
726 |
+
<span class="amt"><sup>$</sup>299</span>
|
|
|
727 |
<span class="bil">Billed Annually</span>
|
728 |
<span class="s">25 Site License</span>
|
729 |
<span class="e">E-mail support</span>
|
733 |
</a>
|
734 |
</div>
|
735 |
<div class="pri-tb">
|
736 |
+
<a href="https://accounts.ampforwp.com/order?edd_action=add_to_cart&download_id=24570&edd_options[price_id]=5&utm_medium=freevspro&utm_campaign=AMP%20Plugin">
|
737 |
<h5>AGENCY</h5>
|
738 |
+
<span class="amt"><sup>$</sup>499</span>
|
|
|
739 |
<span class="bil">Billed Annually</span>
|
740 |
<span class="s">Unlimited</span>
|
741 |
<span class="e">E-mail support</span>
|
3534 |
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
|
3535 |
'default' => 0,
|
3536 |
'data' => 'category_list_hierarchy',
|
3537 |
+
|
3538 |
+
'class' => 'hide'
|
3539 |
+
),
|
3540 |
+
array(
|
3541 |
+
'id' =>'hide-amp-categories2',
|
3542 |
+
'type' => 'select',
|
3543 |
+
'title' => __('Select Categories to Hide AMP'),
|
3544 |
+
'tooltip-subtitle' => __( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
|
3545 |
+
'multi' => true,
|
3546 |
+
'ajax' => true,
|
3547 |
+
'data-action' => 'ampforwp_categories',
|
3548 |
+
'data' => 'categories',
|
3549 |
+
),
|
3550 |
array(
|
3551 |
'id' =>'hide-amp-tags-bulk-option',
|
3552 |
'type' => 'checkbox',
|
3554 |
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected tags.', 'accelerated-mobile-pages' ),
|
3555 |
'default' => 0,
|
3556 |
'data' => 'tags',
|
3557 |
+
'class' => 'hide'
|
3558 |
+
),
|
3559 |
+
array(
|
3560 |
+
'id' =>'hide-amp-tags-bulk-option2',
|
3561 |
+
'type' => 'select',
|
3562 |
+
'title' => __('Select Tags to Hide AMP'),
|
3563 |
+
'tooltip-subtitle' => __( 'Hide AMP from all the posts of a selected tags.', 'accelerated-mobile-pages' ),
|
3564 |
+
'multi' => true,
|
3565 |
+
'ajax' => true,
|
3566 |
+
'data-action' => 'ampforwp_tags',
|
3567 |
+
'data' => 'tags',
|
3568 |
|
3569 |
),
|
3570 |
)
|
5279 |
}
|
5280 |
//End of code for fetching categories to show as a list in redux settings
|
5281 |
|
5282 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5283 |
$ampforwp_home_loop = array();
|
5284 |
$ampforwp_home_loop = get_option('ampforwp_custom_post_types');
|
5285 |
$ampforwp_home_loop['post'] = 'Posts';
|
5339 |
'type' => 'select',
|
5340 |
'class' => 'child_opt',
|
5341 |
'title' => esc_html__( 'Featured Slider from Tags', 'accelerated-mobile-pages' ),
|
5342 |
+
//'options' => $tags_array,
|
5343 |
'required' => array(
|
5344 |
array('amp-design-selector', '=' , '3'),
|
5345 |
array('amp-design-3-featured-slider', '=' , '1'),
|
5346 |
array('amp-design-3-featured-content', '=' , '2'),
|
5347 |
+
),
|
5348 |
+
//'multi' => true,
|
5349 |
+
'ajax' => true,
|
5350 |
+
'data-action' => 'tags',
|
5351 |
+
'data' => 'tags',
|
5352 |
),
|
5353 |
array(
|
5354 |
'id' =>'ampforwp-featur-slider-num-posts',
|
6257 |
'true' => 'true',
|
6258 |
'false' => 'false',
|
6259 |
'default' => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6260 |
),
|
6261 |
|
6262 |
array(
|
@@ -1,704 +1,484 @@
|
|
1 |
-
/*
|
2 |
-
Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
|
3 |
-
*/
|
4 |
.select2-container {
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
.select2-container,
|
15 |
-
.select2-drop,
|
16 |
-
.select2-search,
|
17 |
-
.select2-search input {
|
18 |
-
/*
|
19 |
-
Force border-box so that % widths fit the parent
|
20 |
-
container without overlap because of margin/padding.
|
21 |
-
More Info : http://www.quirksmode.org/css/box.html
|
22 |
-
*/
|
23 |
-
-webkit-box-sizing: border-box; /* webkit */
|
24 |
-
-moz-box-sizing: border-box; /* firefox */
|
25 |
-
box-sizing: border-box; /* css3 */
|
26 |
-
}
|
27 |
-
|
28 |
-
.select2-container .select2-choice {
|
29 |
-
display: block;
|
30 |
-
height: 26px;
|
31 |
-
padding: 0 0 0 8px;
|
32 |
-
overflow: hidden;
|
33 |
-
position: relative;
|
34 |
-
|
35 |
-
border: 1px solid #aaa;
|
36 |
-
white-space: nowrap;
|
37 |
-
line-height: 26px;
|
38 |
-
color: #444;
|
39 |
-
text-decoration: none;
|
40 |
-
|
41 |
-
border-radius: 4px;
|
42 |
-
|
43 |
-
background-clip: padding-box;
|
44 |
-
|
45 |
-
-webkit-touch-callout: none;
|
46 |
-
-webkit-user-select: none;
|
47 |
-
-moz-user-select: none;
|
48 |
-
-ms-user-select: none;
|
49 |
-
user-select: none;
|
50 |
-
|
51 |
-
background-color: #fff;
|
52 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
|
53 |
-
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
|
54 |
-
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
|
55 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
|
56 |
-
background-image: linear-gradient(to top, #eee 0%, #fff 50%);
|
57 |
-
}
|
58 |
-
|
59 |
-
html[dir="rtl"] .select2-container .select2-choice {
|
60 |
-
padding: 0 8px 0 0;
|
61 |
-
}
|
62 |
-
|
63 |
-
.select2-container.select2-drop-above .select2-choice {
|
64 |
-
border-bottom-color: #aaa;
|
65 |
-
|
66 |
-
border-radius: 0 0 4px 4px;
|
67 |
-
|
68 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
|
69 |
-
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
|
70 |
-
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
|
71 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
|
72 |
-
background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
|
73 |
-
}
|
74 |
-
|
75 |
-
.select2-container.select2-allowclear .select2-choice .select2-chosen {
|
76 |
-
margin-right: 42px;
|
77 |
-
}
|
78 |
-
|
79 |
-
.select2-container .select2-choice > .select2-chosen {
|
80 |
-
margin-right: 26px;
|
81 |
-
display: block;
|
82 |
-
overflow: hidden;
|
83 |
-
|
84 |
-
white-space: nowrap;
|
85 |
-
|
86 |
-
text-overflow: ellipsis;
|
87 |
-
float: none;
|
88 |
-
width: auto;
|
89 |
-
}
|
90 |
-
|
91 |
-
html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
|
92 |
-
margin-left: 26px;
|
93 |
-
margin-right: 0;
|
94 |
-
}
|
95 |
-
|
96 |
-
.select2-container .select2-choice abbr {
|
97 |
-
display: none;
|
98 |
-
width: 12px;
|
99 |
-
height: 12px;
|
100 |
-
position: absolute;
|
101 |
-
right: 24px;
|
102 |
-
top: 8px;
|
103 |
-
|
104 |
-
font-size: 1px;
|
105 |
-
text-decoration: none;
|
106 |
-
|
107 |
-
border: 0;
|
108 |
-
background: url('select2.png') right top no-repeat;
|
109 |
cursor: pointer;
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
cursor: pointer;
|
120 |
-
}
|
121 |
-
|
122 |
-
.select2-drop-mask {
|
123 |
-
border: 0;
|
124 |
-
margin: 0;
|
125 |
-
padding: 0;
|
126 |
-
position: fixed;
|
127 |
-
left: 0;
|
128 |
-
top: 0;
|
129 |
-
min-height: 100%;
|
130 |
-
min-width: 100%;
|
131 |
-
height: auto;
|
132 |
-
width: auto;
|
133 |
-
opacity: 0;
|
134 |
-
z-index: 9998;
|
135 |
-
/* styles required for IE to work */
|
136 |
-
background-color: #fff;
|
137 |
-
filter: alpha(opacity=0);
|
138 |
-
}
|
139 |
-
|
140 |
-
.select2-drop {
|
141 |
-
width: 100%;
|
142 |
-
margin-top: -1px;
|
143 |
-
position: absolute;
|
144 |
-
z-index: 9999;
|
145 |
-
top: 100%;
|
146 |
-
|
147 |
-
background: #fff;
|
148 |
-
color: #000;
|
149 |
-
border: 1px solid #aaa;
|
150 |
-
border-top: 0;
|
151 |
-
|
152 |
-
border-radius: 0 0 4px 4px;
|
153 |
-
|
154 |
-
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
155 |
-
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
156 |
-
}
|
157 |
-
|
158 |
-
.select2-drop.select2-drop-above {
|
159 |
-
margin-top: 1px;
|
160 |
-
border-top: 1px solid #aaa;
|
161 |
-
border-bottom: 0;
|
162 |
-
|
163 |
-
border-radius: 4px 4px 0 0;
|
164 |
-
|
165 |
-
-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
166 |
-
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
167 |
-
}
|
168 |
-
|
169 |
-
.select2-drop-active {
|
170 |
-
border: 1px solid #5897fb;
|
171 |
-
border-top: none;
|
172 |
-
}
|
173 |
-
|
174 |
-
.select2-drop.select2-drop-above.select2-drop-active {
|
175 |
-
border-top: 1px solid #5897fb;
|
176 |
-
}
|
177 |
-
|
178 |
-
.select2-drop-auto-width {
|
179 |
-
border-top: 1px solid #aaa;
|
180 |
-
width: auto;
|
181 |
-
}
|
182 |
-
|
183 |
-
.select2-drop-auto-width .select2-search {
|
184 |
-
padding-top: 4px;
|
185 |
-
}
|
186 |
-
|
187 |
-
.select2-container .select2-choice .select2-arrow {
|
188 |
-
display: inline-block;
|
189 |
-
width: 18px;
|
190 |
-
height: 100%;
|
191 |
-
position: absolute;
|
192 |
-
right: 0;
|
193 |
-
top: 0;
|
194 |
-
|
195 |
-
border-left: 1px solid #aaa;
|
196 |
-
border-radius: 0 4px 4px 0;
|
197 |
-
|
198 |
-
background-clip: padding-box;
|
199 |
-
|
200 |
-
background: #ccc;
|
201 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
|
202 |
-
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
203 |
-
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
204 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
|
205 |
-
background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
|
206 |
-
}
|
207 |
-
|
208 |
-
html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
|
209 |
-
left: 0;
|
210 |
-
right: auto;
|
211 |
-
|
212 |
-
border-left: none;
|
213 |
-
border-right: 1px solid #aaa;
|
214 |
-
border-radius: 4px 0 0 4px;
|
215 |
-
}
|
216 |
-
|
217 |
-
.select2-container .select2-choice .select2-arrow b {
|
218 |
display: block;
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
}
|
241 |
-
|
242 |
-
.select2-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
width: 100%;
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
html[dir="rtl"] .select2-search input {
|
267 |
-
padding: 4px 5px 4px 20px;
|
268 |
-
|
269 |
-
background: #fff url('select2.png') no-repeat -37px -22px;
|
270 |
-
background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
|
271 |
-
background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
272 |
-
background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
273 |
-
background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
|
274 |
-
}
|
275 |
-
|
276 |
-
.select2-drop.select2-drop-above .select2-search input {
|
277 |
-
margin-top: 4px;
|
278 |
-
}
|
279 |
-
|
280 |
-
.select2-search input.select2-active {
|
281 |
-
background: #fff url('select2-spinner.gif') no-repeat 100%;
|
282 |
-
background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
|
283 |
-
background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
284 |
-
background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
285 |
-
background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
|
286 |
-
}
|
287 |
-
|
288 |
-
.select2-container-active .select2-choice,
|
289 |
-
.select2-container-active .select2-choices {
|
290 |
-
border: 1px solid #5897fb;
|
291 |
-
outline: none;
|
292 |
-
|
293 |
-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
294 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
295 |
-
}
|
296 |
-
|
297 |
-
.select2-dropdown-open .select2-choice {
|
298 |
-
border-bottom-color: transparent;
|
299 |
-
-webkit-box-shadow: 0 1px 0 #fff inset;
|
300 |
-
box-shadow: 0 1px 0 #fff inset;
|
301 |
-
|
302 |
-
border-bottom-left-radius: 0;
|
303 |
-
border-bottom-right-radius: 0;
|
304 |
-
|
305 |
-
background-color: #eee;
|
306 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
|
307 |
-
background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
|
308 |
-
background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
|
309 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
|
310 |
-
background-image: linear-gradient(to top, #fff 0%, #eee 50%);
|
311 |
-
}
|
312 |
-
|
313 |
-
.select2-dropdown-open.select2-drop-above .select2-choice,
|
314 |
-
.select2-dropdown-open.select2-drop-above .select2-choices {
|
315 |
-
border: 1px solid #5897fb;
|
316 |
-
border-top-color: transparent;
|
317 |
-
|
318 |
-
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
|
319 |
-
background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
|
320 |
-
background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
|
321 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
|
322 |
-
background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
|
323 |
-
}
|
324 |
-
|
325 |
-
.select2-dropdown-open .select2-choice .select2-arrow {
|
326 |
-
background: transparent;
|
327 |
-
border-left: none;
|
328 |
-
filter: none;
|
329 |
-
}
|
330 |
-
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
|
331 |
-
border-right: none;
|
332 |
-
}
|
333 |
-
|
334 |
-
.select2-dropdown-open .select2-choice .select2-arrow b {
|
335 |
-
background-position: -18px 1px;
|
336 |
-
}
|
337 |
-
|
338 |
-
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
|
339 |
-
background-position: -16px 1px;
|
340 |
-
}
|
341 |
|
342 |
.select2-hidden-accessible {
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
position: absolute;
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
list-style: none;
|
376 |
-
display: list-item;
|
377 |
-
background-image: none;
|
378 |
-
}
|
379 |
-
|
380 |
-
.select2-results li.select2-result-with-children > .select2-result-label {
|
381 |
-
font-weight: bold;
|
382 |
-
}
|
383 |
-
|
384 |
-
.select2-results .select2-result-label {
|
385 |
-
padding: 3px 7px 4px;
|
386 |
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
cursor: pointer;
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
}
|
397 |
-
|
398 |
-
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
|
399 |
-
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
|
400 |
-
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
|
401 |
-
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
|
402 |
-
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
|
403 |
-
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
|
404 |
-
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
|
405 |
-
|
406 |
-
.select2-results .select2-highlighted {
|
407 |
-
background: #3875d7;
|
408 |
-
color: #fff;
|
409 |
-
}
|
410 |
-
|
411 |
-
.select2-results li em {
|
412 |
-
background: #feffde;
|
413 |
-
font-style: normal;
|
414 |
-
}
|
415 |
-
|
416 |
-
.select2-results .select2-highlighted em {
|
417 |
-
background: transparent;
|
418 |
-
}
|
419 |
-
|
420 |
-
.select2-results .select2-highlighted ul {
|
421 |
-
background: #fff;
|
422 |
-
color: #000;
|
423 |
-
}
|
424 |
-
|
425 |
-
.select2-results .select2-no-results,
|
426 |
-
.select2-results .select2-searching,
|
427 |
-
.select2-results .select2-ajax-error,
|
428 |
-
.select2-results .select2-selection-limit {
|
429 |
-
background: #f4f4f4;
|
430 |
-
display: list-item;
|
431 |
-
padding-left: 5px;
|
432 |
-
}
|
433 |
-
|
434 |
-
/*
|
435 |
-
disabled look for disabled choices in the results dropdown
|
436 |
-
*/
|
437 |
-
.select2-results .select2-disabled.select2-highlighted {
|
438 |
-
color: #666;
|
439 |
-
background: #f4f4f4;
|
440 |
-
display: list-item;
|
441 |
cursor: default;
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
cursor: default;
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
|
457 |
-
.select2-
|
458 |
-
|
459 |
-
|
|
|
460 |
|
461 |
-
.select2-
|
462 |
-
|
463 |
-
|
464 |
-
}
|
465 |
|
466 |
-
|
|
|
467 |
|
468 |
-
.select2-container.select2-container-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
cursor: default;
|
473 |
-
}
|
474 |
|
475 |
-
.select2-container.select2-container
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
}
|
480 |
|
481 |
-
.select2-container.select2-
|
482 |
-
|
483 |
-
}
|
484 |
|
|
|
|
|
|
|
485 |
|
486 |
-
|
|
|
|
|
487 |
|
488 |
-
.select2-container
|
489 |
-
|
490 |
-
height: 1%;
|
491 |
-
margin: 0;
|
492 |
-
padding: 0 5px 0 0;
|
493 |
-
position: relative;
|
494 |
|
495 |
-
|
496 |
-
|
497 |
-
overflow: hidden;
|
498 |
-
|
499 |
-
background-color: #fff;
|
500 |
-
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
|
501 |
-
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
|
502 |
-
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
|
503 |
-
background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
|
504 |
-
}
|
505 |
-
|
506 |
-
html[dir="rtl"] .select2-container-multi .select2-choices {
|
507 |
-
padding: 0 0 0 5px;
|
508 |
-
}
|
509 |
-
|
510 |
-
.select2-locked {
|
511 |
-
padding: 3px 5px 3px 5px !important;
|
512 |
-
}
|
513 |
-
|
514 |
-
.select2-container-multi .select2-choices {
|
515 |
-
min-height: 26px;
|
516 |
-
}
|
517 |
-
|
518 |
-
.select2-container-multi.select2-container-active .select2-choices {
|
519 |
-
border: 1px solid #5897fb;
|
520 |
-
outline: none;
|
521 |
-
|
522 |
-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
523 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
524 |
-
}
|
525 |
-
.select2-container-multi .select2-choices li {
|
526 |
-
float: left;
|
527 |
-
list-style: none;
|
528 |
-
}
|
529 |
-
html[dir="rtl"] .select2-container-multi .select2-choices li
|
530 |
-
{
|
531 |
-
float: right;
|
532 |
-
}
|
533 |
-
.select2-container-multi .select2-choices .select2-search-field {
|
534 |
-
margin: 0;
|
535 |
-
padding: 0;
|
536 |
-
white-space: nowrap;
|
537 |
-
}
|
538 |
-
|
539 |
-
.select2-container-multi .select2-choices .select2-search-field input {
|
540 |
-
padding: 5px;
|
541 |
-
margin: 1px 0;
|
542 |
-
|
543 |
-
font-family: sans-serif;
|
544 |
-
font-size: 100%;
|
545 |
-
color: #666;
|
546 |
-
outline: 0;
|
547 |
-
border: 0;
|
548 |
-
-webkit-box-shadow: none;
|
549 |
-
box-shadow: none;
|
550 |
-
background: transparent !important;
|
551 |
-
}
|
552 |
-
|
553 |
-
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
554 |
-
background: #fff url('select2-spinner.gif') no-repeat 100% !important;
|
555 |
-
}
|
556 |
-
|
557 |
-
.select2-default {
|
558 |
-
color: #999 !important;
|
559 |
-
}
|
560 |
-
|
561 |
-
.select2-container-multi .select2-choices .select2-search-choice {
|
562 |
-
padding: 3px 5px 3px 18px;
|
563 |
-
margin: 3px 0 3px 5px;
|
564 |
-
position: relative;
|
565 |
-
|
566 |
-
line-height: 13px;
|
567 |
-
color: #333;
|
568 |
-
cursor: default;
|
569 |
-
border: 1px solid #aaaaaa;
|
570 |
|
571 |
-
|
|
|
|
|
572 |
|
573 |
-
|
574 |
-
|
575 |
|
576 |
-
|
|
|
577 |
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
-ms-user-select: none;
|
582 |
-
user-select: none;
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
589 |
-
background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
590 |
-
}
|
591 |
-
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
|
592 |
-
{
|
593 |
-
margin: 3px 5px 3px 0;
|
594 |
-
padding: 3px 18px 3px 5px;
|
595 |
-
}
|
596 |
-
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
|
597 |
-
cursor: default;
|
598 |
-
}
|
599 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus {
|
600 |
-
background: #d4d4d4;
|
601 |
-
}
|
602 |
|
603 |
-
.select2-
|
604 |
-
|
605 |
-
width: 12px;
|
606 |
-
height: 13px;
|
607 |
-
position: absolute;
|
608 |
-
right: 3px;
|
609 |
-
top: 4px;
|
610 |
-
|
611 |
-
font-size: 1px;
|
612 |
-
outline: none;
|
613 |
-
background: url('select2.png') right top no-repeat;
|
614 |
-
}
|
615 |
-
html[dir="rtl"] .select2-search-choice-close {
|
616 |
-
right: auto;
|
617 |
-
left: 3px;
|
618 |
-
}
|
619 |
-
|
620 |
-
.select2-container-multi .select2-search-choice-close {
|
621 |
-
left: 3px;
|
622 |
-
}
|
623 |
-
|
624 |
-
html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
|
625 |
-
left: auto;
|
626 |
-
right: 2px;
|
627 |
-
}
|
628 |
-
|
629 |
-
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
|
630 |
-
background-position: right -11px;
|
631 |
-
}
|
632 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
|
633 |
-
background-position: right -11px;
|
634 |
-
}
|
635 |
-
|
636 |
-
/* disabled styles */
|
637 |
-
.select2-container-multi.select2-container-disabled .select2-choices {
|
638 |
-
background-color: #f4f4f4;
|
639 |
-
background-image: none;
|
640 |
-
border: 1px solid #ddd;
|
641 |
-
cursor: default;
|
642 |
-
}
|
643 |
-
|
644 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
|
645 |
-
padding: 3px 5px 3px 5px;
|
646 |
-
border: 1px solid #ddd;
|
647 |
-
background-image: none;
|
648 |
-
background-color: #f4f4f4;
|
649 |
-
}
|
650 |
-
|
651 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
|
652 |
-
background: none;
|
653 |
-
}
|
654 |
-
/* end multiselect */
|
655 |
-
|
656 |
-
|
657 |
-
.select2-result-selectable .select2-match,
|
658 |
-
.select2-result-unselectable .select2-match {
|
659 |
-
text-decoration: underline;
|
660 |
-
}
|
661 |
-
|
662 |
-
.select2-offscreen, .select2-offscreen:focus {
|
663 |
-
clip: rect(0 0 0 0) !important;
|
664 |
-
width: 1px !important;
|
665 |
-
height: 1px !important;
|
666 |
-
border: 0 !important;
|
667 |
-
margin: 0 !important;
|
668 |
-
padding: 0 !important;
|
669 |
-
overflow: hidden !important;
|
670 |
-
position: absolute !important;
|
671 |
-
outline: 0 !important;
|
672 |
-
left: 0px !important;
|
673 |
-
top: 0px !important;
|
674 |
-
}
|
675 |
-
|
676 |
-
.select2-display-none {
|
677 |
-
display: none;
|
678 |
-
}
|
679 |
-
|
680 |
-
.select2-measure-scrollbar {
|
681 |
-
position: absolute;
|
682 |
-
top: -10000px;
|
683 |
-
left: -10000px;
|
684 |
-
width: 100px;
|
685 |
-
height: 100px;
|
686 |
-
overflow: scroll;
|
687 |
-
}
|
688 |
-
|
689 |
-
/* Retina-ize icons */
|
690 |
-
|
691 |
-
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
|
692 |
-
.select2-search input,
|
693 |
-
.select2-search-choice-close,
|
694 |
-
.select2-container .select2-choice abbr,
|
695 |
-
.select2-container .select2-choice .select2-arrow b {
|
696 |
-
background-image: url('select2x2.png') !important;
|
697 |
-
background-repeat: no-repeat !important;
|
698 |
-
background-size: 60px 40px !important;
|
699 |
-
}
|
700 |
-
|
701 |
-
.select2-search input {
|
702 |
-
background-position: 100% -21px !important;
|
703 |
-
}
|
704 |
-
}
|
|
|
|
|
|
|
1 |
.select2-container {
|
2 |
+
box-sizing: border-box;
|
3 |
+
display: inline-block;
|
4 |
+
margin: 0;
|
5 |
+
position: relative;
|
6 |
+
vertical-align: middle; }
|
7 |
+
.select2-container .select2-selection--single {
|
8 |
+
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
cursor: pointer;
|
10 |
+
display: block;
|
11 |
+
height: 28px;
|
12 |
+
user-select: none;
|
13 |
+
-webkit-user-select: none; }
|
14 |
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
15 |
+
display: block;
|
16 |
+
padding-left: 8px;
|
17 |
+
padding-right: 20px;
|
18 |
+
overflow: hidden;
|
19 |
+
text-overflow: ellipsis;
|
20 |
+
white-space: nowrap; }
|
21 |
+
.select2-container .select2-selection--single .select2-selection__clear {
|
22 |
+
position: relative; }
|
23 |
+
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
24 |
+
padding-right: 8px;
|
25 |
+
padding-left: 20px; }
|
26 |
+
.select2-container .select2-selection--multiple {
|
27 |
+
box-sizing: border-box;
|
28 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
display: block;
|
30 |
+
min-height: 32px;
|
31 |
+
user-select: none;
|
32 |
+
-webkit-user-select: none; }
|
33 |
+
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
34 |
+
display: inline-block;
|
35 |
+
overflow: hidden;
|
36 |
+
padding-left: 8px;
|
37 |
+
text-overflow: ellipsis;
|
38 |
+
white-space: nowrap; }
|
39 |
+
.select2-container .select2-search--inline {
|
40 |
+
float: left; }
|
41 |
+
.select2-container .select2-search--inline .select2-search__field {
|
42 |
+
box-sizing: border-box;
|
43 |
+
border: none;
|
44 |
+
font-size: 100%;
|
45 |
+
margin-top: 5px;
|
46 |
+
padding: 0; }
|
47 |
+
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
48 |
+
-webkit-appearance: none; }
|
49 |
+
|
50 |
+
.select2-dropdown {
|
51 |
+
background-color: white;
|
52 |
+
border: 1px solid #aaa;
|
53 |
+
border-radius: 4px;
|
54 |
+
box-sizing: border-box;
|
55 |
+
display: block;
|
56 |
+
position: absolute;
|
57 |
+
left: -100000px;
|
58 |
+
width: 100%;
|
59 |
+
z-index: 1051; }
|
60 |
|
61 |
+
.select2-results {
|
62 |
+
display: block; }
|
63 |
+
|
64 |
+
.select2-results__options {
|
65 |
+
list-style: none;
|
66 |
+
margin: 0;
|
67 |
+
padding: 0; }
|
68 |
+
|
69 |
+
.select2-results__option {
|
70 |
+
padding: 6px;
|
71 |
+
user-select: none;
|
72 |
+
-webkit-user-select: none; }
|
73 |
+
.select2-results__option[aria-selected] {
|
74 |
+
cursor: pointer; }
|
75 |
+
|
76 |
+
.select2-container--open .select2-dropdown {
|
77 |
+
left: 0; }
|
78 |
+
|
79 |
+
.select2-container--open .select2-dropdown--above {
|
80 |
+
border-bottom: none;
|
81 |
+
border-bottom-left-radius: 0;
|
82 |
+
border-bottom-right-radius: 0; }
|
83 |
+
|
84 |
+
.select2-container--open .select2-dropdown--below {
|
85 |
+
border-top: none;
|
86 |
+
border-top-left-radius: 0;
|
87 |
+
border-top-right-radius: 0; }
|
88 |
+
|
89 |
+
.select2-search--dropdown {
|
90 |
+
display: block;
|
91 |
+
padding: 4px; }
|
92 |
+
.select2-search--dropdown .select2-search__field {
|
93 |
+
padding: 4px;
|
94 |
width: 100%;
|
95 |
+
box-sizing: border-box; }
|
96 |
+
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
97 |
+
-webkit-appearance: none; }
|
98 |
+
.select2-search--dropdown.select2-search--hide {
|
99 |
+
display: none; }
|
100 |
+
|
101 |
+
.select2-close-mask {
|
102 |
+
border: 0;
|
103 |
+
margin: 0;
|
104 |
+
padding: 0;
|
105 |
+
display: block;
|
106 |
+
position: fixed;
|
107 |
+
left: 0;
|
108 |
+
top: 0;
|
109 |
+
min-height: 100%;
|
110 |
+
min-width: 100%;
|
111 |
+
height: auto;
|
112 |
+
width: auto;
|
113 |
+
opacity: 0;
|
114 |
+
z-index: 99;
|
115 |
+
background-color: #fff;
|
116 |
+
filter: alpha(opacity=0); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
.select2-hidden-accessible {
|
119 |
+
border: 0 !important;
|
120 |
+
clip: rect(0 0 0 0) !important;
|
121 |
+
-webkit-clip-path: inset(50%) !important;
|
122 |
+
clip-path: inset(50%) !important;
|
123 |
+
height: 1px !important;
|
124 |
+
overflow: hidden !important;
|
125 |
+
padding: 0 !important;
|
126 |
+
position: absolute !important;
|
127 |
+
width: 1px !important;
|
128 |
+
white-space: nowrap !important; }
|
129 |
+
|
130 |
+
.select2-container--default .select2-selection--single {
|
131 |
+
background-color: #fff;
|
132 |
+
border: 1px solid #aaa;
|
133 |
+
border-radius: 4px; }
|
134 |
+
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
135 |
+
color: #444;
|
136 |
+
line-height: 28px; }
|
137 |
+
.select2-container--default .select2-selection--single .select2-selection__clear {
|
138 |
+
cursor: pointer;
|
139 |
+
float: right;
|
140 |
+
font-weight: bold; }
|
141 |
+
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
142 |
+
color: #999; }
|
143 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
144 |
+
height: 26px;
|
145 |
position: absolute;
|
146 |
+
top: 1px;
|
147 |
+
right: 1px;
|
148 |
+
width: 20px; }
|
149 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
150 |
+
border-color: #888 transparent transparent transparent;
|
151 |
+
border-style: solid;
|
152 |
+
border-width: 5px 4px 0 4px;
|
153 |
+
height: 0;
|
154 |
+
left: 50%;
|
155 |
+
margin-left: -4px;
|
156 |
+
margin-top: -2px;
|
157 |
+
position: absolute;
|
158 |
+
top: 50%;
|
159 |
+
width: 0; }
|
160 |
+
|
161 |
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
162 |
+
float: left; }
|
163 |
+
|
164 |
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
165 |
+
left: 1px;
|
166 |
+
right: auto; }
|
167 |
+
|
168 |
+
.select2-container--default.select2-container--disabled .select2-selection--single {
|
169 |
+
background-color: #eee;
|
170 |
+
cursor: default; }
|
171 |
+
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
172 |
+
display: none; }
|
173 |
+
|
174 |
+
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
175 |
+
border-color: transparent transparent #888 transparent;
|
176 |
+
border-width: 0 4px 5px 4px; }
|
177 |
+
|
178 |
+
.select2-container--default .select2-selection--multiple {
|
179 |
+
background-color: white;
|
180 |
+
border: 1px solid #aaa;
|
181 |
+
border-radius: 4px;
|
182 |
+
cursor: text; }
|
183 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
184 |
+
box-sizing: border-box;
|
185 |
list-style: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
margin: 0;
|
187 |
+
padding: 0 5px;
|
188 |
+
width: 100%; }
|
189 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
190 |
+
list-style: none; }
|
191 |
+
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
192 |
+
color: #999;
|
193 |
+
margin-top: 5px;
|
194 |
+
float: left; }
|
195 |
+
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
196 |
cursor: pointer;
|
197 |
+
float: right;
|
198 |
+
font-weight: bold;
|
199 |
+
margin-top: 5px;
|
200 |
+
margin-right: 10px; }
|
201 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
202 |
+
background-color: #e4e4e4;
|
203 |
+
border: 1px solid #aaa;
|
204 |
+
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
cursor: default;
|
206 |
+
float: left;
|
207 |
+
margin-right: 5px;
|
208 |
+
margin-top: 5px;
|
209 |
+
padding: 0 5px; }
|
210 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
211 |
+
color: #999;
|
212 |
+
cursor: pointer;
|
213 |
+
display: inline-block;
|
214 |
+
font-weight: bold;
|
215 |
+
margin-right: 2px; }
|
216 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
217 |
+
color: #333; }
|
218 |
+
|
219 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
220 |
+
float: right; }
|
221 |
+
|
222 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
223 |
+
margin-left: 5px;
|
224 |
+
margin-right: auto; }
|
225 |
+
|
226 |
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
227 |
+
margin-left: 2px;
|
228 |
+
margin-right: auto; }
|
229 |
+
|
230 |
+
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
231 |
+
border: solid black 1px;
|
232 |
+
outline: 0; }
|
233 |
+
|
234 |
+
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
235 |
+
background-color: #eee;
|
236 |
+
cursor: default; }
|
237 |
+
|
238 |
+
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
239 |
+
display: none; }
|
240 |
+
|
241 |
+
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
242 |
+
border-top-left-radius: 0;
|
243 |
+
border-top-right-radius: 0; }
|
244 |
+
|
245 |
+
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
246 |
+
border-bottom-left-radius: 0;
|
247 |
+
border-bottom-right-radius: 0; }
|
248 |
+
|
249 |
+
.select2-container--default .select2-search--dropdown .select2-search__field {
|
250 |
+
border: 1px solid #aaa; }
|
251 |
+
|
252 |
+
.select2-container--default .select2-search--inline .select2-search__field {
|
253 |
+
background: transparent;
|
254 |
+
border: none;
|
255 |
+
outline: 0;
|
256 |
+
box-shadow: none;
|
257 |
+
-webkit-appearance: textfield; }
|
258 |
+
|
259 |
+
.select2-container--default .select2-results > .select2-results__options {
|
260 |
+
max-height: 200px;
|
261 |
+
overflow-y: auto; }
|
262 |
+
|
263 |
+
.select2-container--default .select2-results__option[role=group] {
|
264 |
+
padding: 0; }
|
265 |
+
|
266 |
+
.select2-container--default .select2-results__option[aria-disabled=true] {
|
267 |
+
color: #999; }
|
268 |
+
|
269 |
+
.select2-container--default .select2-results__option[aria-selected=true] {
|
270 |
+
background-color: #ddd; }
|
271 |
+
|
272 |
+
.select2-container--default .select2-results__option .select2-results__option {
|
273 |
+
padding-left: 1em; }
|
274 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
275 |
+
padding-left: 0; }
|
276 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
277 |
+
margin-left: -1em;
|
278 |
+
padding-left: 2em; }
|
279 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
280 |
+
margin-left: -2em;
|
281 |
+
padding-left: 3em; }
|
282 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
283 |
+
margin-left: -3em;
|
284 |
+
padding-left: 4em; }
|
285 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
286 |
+
margin-left: -4em;
|
287 |
+
padding-left: 5em; }
|
288 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
289 |
+
margin-left: -5em;
|
290 |
+
padding-left: 6em; }
|
291 |
+
|
292 |
+
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
293 |
+
background-color: #5897fb;
|
294 |
+
color: white; }
|
295 |
+
|
296 |
+
.select2-container--default .select2-results__group {
|
297 |
cursor: default;
|
298 |
+
display: block;
|
299 |
+
padding: 6px; }
|
300 |
+
|
301 |
+
.select2-container--classic .select2-selection--single {
|
302 |
+
background-color: #f7f7f7;
|
303 |
+
border: 1px solid #aaa;
|
304 |
+
border-radius: 4px;
|
305 |
+
outline: 0;
|
306 |
+
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
307 |
+
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
308 |
+
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
309 |
+
background-repeat: repeat-x;
|
310 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
311 |
+
.select2-container--classic .select2-selection--single:focus {
|
312 |
+
border: 1px solid #5897fb; }
|
313 |
+
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
314 |
+
color: #444;
|
315 |
+
line-height: 28px; }
|
316 |
+
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
317 |
+
cursor: pointer;
|
318 |
+
float: right;
|
319 |
+
font-weight: bold;
|
320 |
+
margin-right: 10px; }
|
321 |
+
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
322 |
+
color: #999; }
|
323 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
324 |
+
background-color: #ddd;
|
325 |
+
border: none;
|
326 |
+
border-left: 1px solid #aaa;
|
327 |
+
border-top-right-radius: 4px;
|
328 |
+
border-bottom-right-radius: 4px;
|
329 |
+
height: 26px;
|
330 |
+
position: absolute;
|
331 |
+
top: 1px;
|
332 |
+
right: 1px;
|
333 |
+
width: 20px;
|
334 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
335 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
336 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
337 |
+
background-repeat: repeat-x;
|
338 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
339 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
340 |
+
border-color: #888 transparent transparent transparent;
|
341 |
+
border-style: solid;
|
342 |
+
border-width: 5px 4px 0 4px;
|
343 |
+
height: 0;
|
344 |
+
left: 50%;
|
345 |
+
margin-left: -4px;
|
346 |
+
margin-top: -2px;
|
347 |
+
position: absolute;
|
348 |
+
top: 50%;
|
349 |
+
width: 0; }
|
350 |
+
|
351 |
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
352 |
+
float: left; }
|
353 |
+
|
354 |
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
355 |
+
border: none;
|
356 |
+
border-right: 1px solid #aaa;
|
357 |
+
border-radius: 0;
|
358 |
+
border-top-left-radius: 4px;
|
359 |
+
border-bottom-left-radius: 4px;
|
360 |
+
left: 1px;
|
361 |
+
right: auto; }
|
362 |
+
|
363 |
+
.select2-container--classic.select2-container--open .select2-selection--single {
|
364 |
+
border: 1px solid #5897fb; }
|
365 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
366 |
+
background: transparent;
|
367 |
+
border: none; }
|
368 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
369 |
+
border-color: transparent transparent #888 transparent;
|
370 |
+
border-width: 0 4px 5px 4px; }
|
371 |
+
|
372 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
373 |
+
border-top: none;
|
374 |
+
border-top-left-radius: 0;
|
375 |
+
border-top-right-radius: 0;
|
376 |
+
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
377 |
+
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
378 |
+
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
379 |
+
background-repeat: repeat-x;
|
380 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
381 |
+
|
382 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
383 |
+
border-bottom: none;
|
384 |
+
border-bottom-left-radius: 0;
|
385 |
+
border-bottom-right-radius: 0;
|
386 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
387 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
388 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
389 |
+
background-repeat: repeat-x;
|
390 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
391 |
+
|
392 |
+
.select2-container--classic .select2-selection--multiple {
|
393 |
+
background-color: white;
|
394 |
+
border: 1px solid #aaa;
|
395 |
+
border-radius: 4px;
|
396 |
+
cursor: text;
|
397 |
+
outline: 0; }
|
398 |
+
.select2-container--classic .select2-selection--multiple:focus {
|
399 |
+
border: 1px solid #5897fb; }
|
400 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
401 |
+
list-style: none;
|
402 |
+
margin: 0;
|
403 |
+
padding: 0 5px; }
|
404 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
405 |
+
display: none; }
|
406 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
407 |
+
background-color: #e4e4e4;
|
408 |
+
border: 1px solid #aaa;
|
409 |
+
border-radius: 4px;
|
410 |
+
cursor: default;
|
411 |
+
float: left;
|
412 |
+
margin-right: 5px;
|
413 |
+
margin-top: 5px;
|
414 |
+
padding: 0 5px; }
|
415 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
416 |
+
color: #888;
|
417 |
+
cursor: pointer;
|
418 |
+
display: inline-block;
|
419 |
+
font-weight: bold;
|
420 |
+
margin-right: 2px; }
|
421 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
422 |
+
color: #555; }
|
423 |
|
424 |
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
425 |
+
float: right;
|
426 |
+
margin-left: 5px;
|
427 |
+
margin-right: auto; }
|
428 |
|
429 |
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
430 |
+
margin-left: 2px;
|
431 |
+
margin-right: auto; }
|
|
|
432 |
|
433 |
+
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
434 |
+
border: 1px solid #5897fb; }
|
435 |
|
436 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
437 |
+
border-top: none;
|
438 |
+
border-top-left-radius: 0;
|
439 |
+
border-top-right-radius: 0; }
|
|
|
|
|
440 |
|
441 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
442 |
+
border-bottom: none;
|
443 |
+
border-bottom-left-radius: 0;
|
444 |
+
border-bottom-right-radius: 0; }
|
|
|
445 |
|
446 |
+
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
447 |
+
border: 1px solid #aaa;
|
448 |
+
outline: 0; }
|
449 |
|
450 |
+
.select2-container--classic .select2-search--inline .select2-search__field {
|
451 |
+
outline: 0;
|
452 |
+
box-shadow: none; }
|
453 |
|
454 |
+
.select2-container--classic .select2-dropdown {
|
455 |
+
background-color: white;
|
456 |
+
border: 1px solid transparent; }
|
457 |
|
458 |
+
.select2-container--classic .select2-dropdown--above {
|
459 |
+
border-bottom: none; }
|
|
|
|
|
|
|
|
|
460 |
|
461 |
+
.select2-container--classic .select2-dropdown--below {
|
462 |
+
border-top: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
|
464 |
+
.select2-container--classic .select2-results > .select2-results__options {
|
465 |
+
max-height: 200px;
|
466 |
+
overflow-y: auto; }
|
467 |
|
468 |
+
.select2-container--classic .select2-results__option[role=group] {
|
469 |
+
padding: 0; }
|
470 |
|
471 |
+
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
472 |
+
color: grey; }
|
473 |
|
474 |
+
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
475 |
+
background-color: #3875d7;
|
476 |
+
color: white; }
|
|
|
|
|
477 |
|
478 |
+
.select2-container--classic .select2-results__group {
|
479 |
+
cursor: default;
|
480 |
+
display: block;
|
481 |
+
padding: 6px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
|
483 |
+
.select2-container--classic.select2-container--open .select2-dropdown {
|
484 |
+
border-color: #5897fb; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,3541 +1,6559 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
case KEY.UP:
|
76 |
-
case KEY.DOWN:
|
77 |
-
return true;
|
78 |
}
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
}
|
89 |
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
-
|
93 |
-
},
|
94 |
-
isFunctionKey: function (k) {
|
95 |
-
k = k.which ? k.which : k;
|
96 |
-
return k >= 112 && k <= 123;
|
97 |
}
|
98 |
-
},
|
99 |
-
MEASURE_SCROLLBAR_TEMPLATE = "<div class='select2-measure-scrollbar'></div>",
|
100 |
|
101 |
-
DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
|
|
|
|
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
|
|
|
|
|
|
|
|
107 |
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
placeholder.before(element);
|
113 |
-
placeholder.remove();
|
114 |
}
|
115 |
|
116 |
-
function
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
-
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
-
function
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
}
|
130 |
-
return -1;
|
131 |
}
|
132 |
|
133 |
-
function
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
*/
|
151 |
-
function equal(a, b) {
|
152 |
-
if (a === b) return true;
|
153 |
-
if (a === undefined || b === undefined) return false;
|
154 |
-
if (a === null || b === null) return false;
|
155 |
-
// Check whether 'a' or 'b' is a string (primitive or object).
|
156 |
-
// The concatenation of an empty string (+'') converts its argument to a string's primitive.
|
157 |
-
if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
|
158 |
-
if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
|
159 |
-
return false;
|
160 |
}
|
161 |
|
162 |
/**
|
163 |
-
*
|
164 |
-
*
|
165 |
-
*
|
166 |
-
* @param separator
|
167 |
*/
|
168 |
-
function
|
169 |
-
var
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
return val;
|
174 |
-
}
|
175 |
|
176 |
-
|
177 |
-
return element.outerWidth(false) - element.width();
|
178 |
-
}
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
192 |
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
var lastpos = lastMousePosition;
|
206 |
-
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
|
207 |
-
$(e.target).trigger("mousemove-filtered", e);
|
208 |
-
}
|
209 |
-
});
|
210 |
-
}
|
211 |
|
212 |
-
|
213 |
-
* Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
|
214 |
-
* within the last quietMillis milliseconds.
|
215 |
-
*
|
216 |
-
* @param quietMillis number of milliseconds to wait before invoking fn
|
217 |
-
* @param fn function to be debounced
|
218 |
-
* @param ctx object to be used as this reference within fn
|
219 |
-
* @return debounced version of fn
|
220 |
-
*/
|
221 |
-
function debounce(quietMillis, fn, ctx) {
|
222 |
-
ctx = ctx || undefined;
|
223 |
-
var timeout;
|
224 |
return function () {
|
225 |
-
|
226 |
-
window.clearTimeout(timeout);
|
227 |
-
timeout = window.setTimeout(function() {
|
228 |
-
fn.apply(ctx, args);
|
229 |
-
}, quietMillis);
|
230 |
};
|
231 |
}
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
if (isVisible && el === document.activeElement) {
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
}
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
}
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
el = $(el)[0];
|
273 |
-
var offset = 0;
|
274 |
-
var length = 0;
|
275 |
-
if ('selectionStart' in el) {
|
276 |
-
offset = el.selectionStart;
|
277 |
-
length = el.selectionEnd - offset;
|
278 |
-
} else if ('selection' in document) {
|
279 |
-
el.focus();
|
280 |
-
var sel = document.selection.createRange();
|
281 |
-
length = document.selection.createRange().text.length;
|
282 |
-
sel.moveStart('character', -el.value.length);
|
283 |
-
offset = sel.text.length - length;
|
284 |
-
}
|
285 |
-
return { offset: offset, length: length };
|
286 |
-
}
|
287 |
-
|
288 |
-
function killEvent(event) {
|
289 |
-
event.preventDefault();
|
290 |
-
event.stopPropagation();
|
291 |
-
}
|
292 |
-
function killEventImmediately(event) {
|
293 |
-
event.preventDefault();
|
294 |
-
event.stopImmediatePropagation();
|
295 |
-
}
|
296 |
-
|
297 |
-
function measureTextWidth(e) {
|
298 |
-
if (!sizer){
|
299 |
-
var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
|
300 |
-
sizer = $(document.createElement("div")).css({
|
301 |
-
position: "absolute",
|
302 |
-
left: "-10000px",
|
303 |
-
top: "-10000px",
|
304 |
-
display: "none",
|
305 |
-
fontSize: style.fontSize,
|
306 |
-
fontFamily: style.fontFamily,
|
307 |
-
fontStyle: style.fontStyle,
|
308 |
-
fontWeight: style.fontWeight,
|
309 |
-
letterSpacing: style.letterSpacing,
|
310 |
-
textTransform: style.textTransform,
|
311 |
-
whiteSpace: "nowrap"
|
312 |
-
});
|
313 |
-
sizer.attr("class","select2-sizer");
|
314 |
-
$(document.body).append(sizer);
|
315 |
}
|
316 |
-
|
317 |
-
return sizer.width();
|
318 |
-
}
|
319 |
|
320 |
-
function
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
-
|
326 |
-
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
}
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
adapted = adapter(this);
|
343 |
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
350 |
|
351 |
-
|
352 |
-
|
|
|
|
|
353 |
|
|
|
|
|
|
|
|
|
354 |
|
355 |
-
|
356 |
-
|
357 |
-
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
-
if (
|
360 |
-
|
361 |
-
return;
|
362 |
}
|
|
|
363 |
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
385 |
}
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
* @param options object containing configuration parameters
|
391 |
-
* @param options.params parameter map for the transport ajax call, can contain such options as cache, jsonpCallback, etc. see $.ajax
|
392 |
-
* @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
|
393 |
-
* @param options.url url for the data
|
394 |
-
* @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
|
395 |
-
* @param options.dataType request data type: ajax, jsonp, other datatypes supported by jQuery's $.ajax function or the transport function if specified
|
396 |
-
* @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
|
397 |
-
* @param options.results a function(remoteData, pageNumber, query) that converts data returned form the remote request to the format expected by Select2.
|
398 |
-
* The expected format is an object containing the following keys:
|
399 |
-
* results array of objects that will be used as choices
|
400 |
-
* more (optional) boolean indicating whether there are more results available
|
401 |
-
* Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
|
402 |
-
*/
|
403 |
-
function ajax(options) {
|
404 |
-
var timeout, // current scheduled but not yet executed request
|
405 |
-
handler = null,
|
406 |
-
quietMillis = options.quietMillis || 100,
|
407 |
-
ajaxUrl = options.url,
|
408 |
-
self = this;
|
409 |
-
|
410 |
-
return function (query) {
|
411 |
-
window.clearTimeout(timeout);
|
412 |
-
timeout = window.setTimeout(function () {
|
413 |
-
var data = options.data, // ajax data function
|
414 |
-
url = ajaxUrl, // ajax url string or function
|
415 |
-
transport = options.transport || $.fn.select2.ajaxDefaults.transport,
|
416 |
-
// deprecated - to be removed in 4.0 - use params instead
|
417 |
-
deprecated = {
|
418 |
-
type: options.type || 'GET', // set type of request (GET or POST)
|
419 |
-
cache: options.cache || false,
|
420 |
-
jsonpCallback: options.jsonpCallback||undefined,
|
421 |
-
dataType: options.dataType||"json"
|
422 |
-
},
|
423 |
-
params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
|
424 |
-
|
425 |
-
data = data ? data.call(self, query.term, query.page, query.context) : null;
|
426 |
-
url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
|
427 |
-
|
428 |
-
if (handler && typeof handler.abort === "function") { handler.abort(); }
|
429 |
-
|
430 |
-
if (options.params) {
|
431 |
-
if ($.isFunction(options.params)) {
|
432 |
-
$.extend(params, options.params.call(self));
|
433 |
-
} else {
|
434 |
-
$.extend(params, options.params);
|
435 |
-
}
|
436 |
-
}
|
437 |
|
438 |
-
|
439 |
-
|
440 |
-
dataType: options.dataType,
|
441 |
-
data: data,
|
442 |
-
success: function (data) {
|
443 |
-
// TODO - replace query.page with query so users have access to term, page, etc.
|
444 |
-
// added query as third paramter to keep backwards compatibility
|
445 |
-
var results = options.results(data, query.page, query);
|
446 |
-
query.callback(results);
|
447 |
-
},
|
448 |
-
error: function(jqXHR, textStatus, errorThrown){
|
449 |
-
var results = {
|
450 |
-
hasError: true,
|
451 |
-
jqXHR: jqXHR,
|
452 |
-
textStatus: textStatus,
|
453 |
-
errorThrown: errorThrown
|
454 |
-
};
|
455 |
-
|
456 |
-
query.callback(results);
|
457 |
-
}
|
458 |
-
});
|
459 |
-
handler = transport.call(self, params);
|
460 |
-
}, quietMillis);
|
461 |
-
};
|
462 |
-
}
|
463 |
|
464 |
-
|
465 |
-
|
466 |
-
*
|
467 |
-
* @param options object containing configuration parameters. The options parameter can either be an array or an
|
468 |
-
* object.
|
469 |
-
*
|
470 |
-
* If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
|
471 |
-
*
|
472 |
-
* If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
|
473 |
-
* an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
|
474 |
-
* key can either be a String in which case it is expected that each element in the 'data' array has a key with the
|
475 |
-
* value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
|
476 |
-
* the text.
|
477 |
-
*/
|
478 |
-
function local(options) {
|
479 |
-
var data = options, // data elements
|
480 |
-
dataText,
|
481 |
-
tmp,
|
482 |
-
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
|
483 |
-
|
484 |
-
if ($.isArray(data)) {
|
485 |
-
tmp = data;
|
486 |
-
data = { results: tmp };
|
487 |
-
}
|
488 |
|
489 |
-
|
490 |
-
tmp = data;
|
491 |
-
data = function() { return tmp; };
|
492 |
-
}
|
493 |
|
494 |
-
|
495 |
-
|
496 |
-
text = dataItem.text;
|
497 |
-
// if text is not a function we assume it to be a key name
|
498 |
-
if (!$.isFunction(text)) {
|
499 |
-
dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
|
500 |
-
text = function (item) { return item[dataText]; };
|
501 |
-
}
|
502 |
-
}
|
503 |
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
query.callback(data());
|
508 |
-
return;
|
509 |
-
}
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
if (datum.children) {
|
515 |
-
group = {};
|
516 |
-
for (attr in datum) {
|
517 |
-
if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
|
518 |
-
}
|
519 |
-
group.children=[];
|
520 |
-
$(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
|
521 |
-
if (group.children.length || query.matcher(t, text(group), datum)) {
|
522 |
-
collection.push(group);
|
523 |
-
}
|
524 |
-
} else {
|
525 |
-
if (query.matcher(t, text(datum), datum)) {
|
526 |
-
collection.push(datum);
|
527 |
-
}
|
528 |
-
}
|
529 |
-
};
|
530 |
|
531 |
-
|
532 |
-
query.callback(filtered);
|
533 |
-
};
|
534 |
}
|
535 |
|
536 |
-
|
537 |
-
|
538 |
-
var isFunc = $.isFunction(data);
|
539 |
-
return function (query) {
|
540 |
-
var t = query.term, filtered = {results: []};
|
541 |
-
var result = isFunc ? data(query) : data;
|
542 |
-
if ($.isArray(result)) {
|
543 |
-
$(result).each(function () {
|
544 |
-
var isObject = this.text !== undefined,
|
545 |
-
text = isObject ? this.text : this;
|
546 |
-
if (t === "" || query.matcher(t, text)) {
|
547 |
-
filtered.results.push(isObject ? this : {id: this, text: this});
|
548 |
-
}
|
549 |
-
});
|
550 |
-
query.callback(filtered);
|
551 |
-
}
|
552 |
-
};
|
553 |
-
}
|
554 |
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
* Throws an error if it is not a function. Returns true if it should be used,
|
559 |
-
* false if no formatting should be performed.
|
560 |
-
*
|
561 |
-
* @param formatter
|
562 |
-
*/
|
563 |
-
function checkFormatter(formatter, formatterName) {
|
564 |
-
if ($.isFunction(formatter)) return true;
|
565 |
-
if (!formatter) return false;
|
566 |
-
if (typeof(formatter) === 'string') return true;
|
567 |
-
throw new Error(formatterName +" must be a string, function, or falsy value");
|
568 |
-
}
|
569 |
|
570 |
-
|
571 |
-
|
572 |
-
* If given a function, returns its output
|
573 |
-
*
|
574 |
-
* @param val string|function
|
575 |
-
* @param context value of "this" to be passed to function
|
576 |
-
* @returns {*}
|
577 |
-
*/
|
578 |
-
function evaluate(val, context) {
|
579 |
-
if ($.isFunction(val)) {
|
580 |
-
var args = Array.prototype.slice.call(arguments, 2);
|
581 |
-
return val.apply(context, args);
|
582 |
-
}
|
583 |
-
return val;
|
584 |
-
}
|
585 |
|
586 |
-
|
587 |
-
var count = 0;
|
588 |
-
$.each(results, function(i, item) {
|
589 |
-
if (item.children) {
|
590 |
-
count += countResults(item.children);
|
591 |
-
} else {
|
592 |
-
count++;
|
593 |
-
}
|
594 |
-
});
|
595 |
-
return count;
|
596 |
-
}
|
597 |
|
598 |
-
|
599 |
-
* Default tokenizer. This function uses breaks the input on substring match of any string from the
|
600 |
-
* opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
|
601 |
-
* two options have to be defined in order for the tokenizer to work.
|
602 |
-
*
|
603 |
-
* @param input text user has typed so far or pasted into the search field
|
604 |
-
* @param selection currently selected choices
|
605 |
-
* @param selectCallback function(choice) callback tho add the choice to selection
|
606 |
-
* @param opts select2's opts
|
607 |
-
* @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
|
608 |
-
*/
|
609 |
-
function defaultTokenizer(input, selection, selectCallback, opts) {
|
610 |
-
var original = input, // store the original so we can compare and know if we need to tell the search to update its text
|
611 |
-
dupe = false, // check for whether a token we extracted represents a duplicate selected choice
|
612 |
-
token, // token
|
613 |
-
index, // position at which the separator was found
|
614 |
-
i, l, // looping variables
|
615 |
-
separator; // the matched separator
|
616 |
-
|
617 |
-
if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
|
618 |
-
|
619 |
-
while (true) {
|
620 |
-
index = -1;
|
621 |
-
|
622 |
-
for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
|
623 |
-
separator = opts.tokenSeparators[i];
|
624 |
-
index = input.indexOf(separator);
|
625 |
-
if (index >= 0) break;
|
626 |
-
}
|
627 |
|
628 |
-
|
|
|
629 |
|
630 |
-
|
631 |
-
|
632 |
|
633 |
-
|
634 |
-
|
635 |
-
if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
|
636 |
-
dupe = false;
|
637 |
-
for (i = 0, l = selection.length; i < l; i++) {
|
638 |
-
if (equal(opts.id(token), opts.id(selection[i]))) {
|
639 |
-
dupe = true; break;
|
640 |
-
}
|
641 |
-
}
|
642 |
|
643 |
-
|
644 |
-
}
|
645 |
-
}
|
646 |
-
}
|
647 |
|
648 |
-
|
|
|
649 |
}
|
650 |
|
651 |
-
|
652 |
-
var self = this;
|
653 |
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
|
|
658 |
}
|
659 |
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
* @param superClass
|
664 |
-
* @param methods
|
665 |
-
*/
|
666 |
-
function clazz(SuperClass, methods) {
|
667 |
-
var constructor = function () {};
|
668 |
-
constructor.prototype = new SuperClass;
|
669 |
-
constructor.prototype.constructor = constructor;
|
670 |
-
constructor.prototype.parent = SuperClass.prototype;
|
671 |
-
constructor.prototype = $.extend(constructor.prototype, methods);
|
672 |
-
return constructor;
|
673 |
-
}
|
674 |
-
|
675 |
-
AbstractSelect2 = clazz(Object, {
|
676 |
-
|
677 |
-
// abstract
|
678 |
-
bind: function (func) {
|
679 |
-
var self = this;
|
680 |
-
return function () {
|
681 |
-
func.apply(self, arguments);
|
682 |
-
};
|
683 |
-
},
|
684 |
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
|
689 |
-
|
690 |
-
this.opts = opts = this.prepareOpts(opts);
|
691 |
|
692 |
-
|
|
|
693 |
|
694 |
-
|
695 |
-
if (opts.element.data("select2") !== undefined &&
|
696 |
-
opts.element.data("select2") !== null) {
|
697 |
-
opts.element.data("select2").destroy();
|
698 |
-
}
|
699 |
|
700 |
-
|
|
|
|
|
701 |
|
702 |
-
|
703 |
-
|
704 |
-
this.liveRegion = $("<span>", {
|
705 |
-
role: "status",
|
706 |
-
"aria-live": "polite"
|
707 |
-
})
|
708 |
-
.addClass("select2-hidden-accessible")
|
709 |
-
.appendTo(document.body);
|
710 |
-
}
|
711 |
|
712 |
-
|
713 |
-
|
714 |
-
.replace(/([.])/g, '_')
|
715 |
-
.replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
|
716 |
-
this.container.attr("id", this.containerId);
|
717 |
|
718 |
-
|
|
|
719 |
|
720 |
-
|
|
|
|
|
721 |
|
722 |
-
|
|
|
723 |
|
724 |
-
|
725 |
-
|
726 |
-
|
|
|
|
|
|
|
727 |
|
728 |
-
|
|
|
|
|
729 |
|
730 |
-
|
731 |
-
this.opts.element
|
732 |
-
.data("select2", this)
|
733 |
-
.attr("tabindex", "-1")
|
734 |
-
.before(this.container)
|
735 |
-
.on("click.select2", killEvent); // do not leak click events
|
736 |
|
737 |
-
|
|
|
|
|
|
|
738 |
|
739 |
-
|
|
|
|
|
|
|
740 |
|
741 |
-
|
|
|
742 |
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
|
747 |
-
|
748 |
-
|
|
|
|
|
749 |
|
750 |
-
|
751 |
-
|
752 |
-
|
|
|
|
|
753 |
|
754 |
-
|
755 |
-
this.initContainer();
|
756 |
|
757 |
-
|
|
|
758 |
|
759 |
-
|
|
|
|
|
|
|
760 |
|
761 |
-
|
762 |
-
|
763 |
-
this._touchEvent = true;
|
764 |
-
this.highlightUnderEvent(event);
|
765 |
-
}));
|
766 |
-
this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
|
767 |
-
this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
this.selectHighlighted();
|
775 |
-
}
|
776 |
-
}));
|
777 |
-
|
778 |
-
installDebouncedScroll(80, this.results);
|
779 |
-
this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
|
780 |
-
|
781 |
-
// do not propagate change event from the search field out of the component
|
782 |
-
$(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
|
783 |
-
$(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
|
784 |
-
|
785 |
-
// if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
|
786 |
-
if ($.fn.mousewheel) {
|
787 |
-
results.mousewheel(function (e, delta, deltaX, deltaY) {
|
788 |
-
var top = results.scrollTop();
|
789 |
-
if (deltaY > 0 && top - deltaY <= 0) {
|
790 |
-
results.scrollTop(0);
|
791 |
-
killEvent(e);
|
792 |
-
} else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
|
793 |
-
results.scrollTop(results.get(0).scrollHeight - results.height());
|
794 |
-
killEvent(e);
|
795 |
-
}
|
796 |
-
});
|
797 |
-
}
|
798 |
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
search.on("blur", function () { search.removeClass("select2-focused");});
|
803 |
|
804 |
-
|
805 |
-
if ($(e.target).closest(".select2-result-selectable").length > 0) {
|
806 |
-
this.highlightUnderEvent(e);
|
807 |
-
this.selectHighlighted(e);
|
808 |
-
}
|
809 |
-
}));
|
810 |
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
// focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
|
815 |
-
this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
|
816 |
|
817 |
-
|
|
|
818 |
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
}
|
827 |
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
|
832 |
-
|
833 |
-
|
834 |
-
this.enable(!disabled);
|
835 |
|
836 |
-
|
837 |
-
|
838 |
-
this.readonly(readonly);
|
839 |
|
840 |
-
|
841 |
-
|
842 |
|
843 |
-
|
844 |
-
|
845 |
-
|
|
|
|
|
|
|
846 |
|
847 |
-
|
848 |
-
|
|
|
849 |
|
850 |
-
|
851 |
-
|
852 |
-
|
|
|
|
|
853 |
|
854 |
-
|
|
|
|
|
855 |
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
select2.container.remove();
|
871 |
-
select2.liveRegion.remove();
|
872 |
-
select2.dropdown.remove();
|
873 |
-
element
|
874 |
-
.show()
|
875 |
-
.removeData("select2")
|
876 |
-
.off(".select2")
|
877 |
-
.prop("autofocus", this.autofocus || false);
|
878 |
-
if (this.elementTabIndex) {
|
879 |
-
element.attr({tabindex: this.elementTabIndex});
|
880 |
-
} else {
|
881 |
-
element.removeAttr("tabindex");
|
882 |
-
}
|
883 |
-
element.show();
|
884 |
-
}
|
885 |
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
"results",
|
891 |
-
"search"
|
892 |
-
);
|
893 |
-
},
|
894 |
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
id:element.prop("value"),
|
900 |
-
text:element.text(),
|
901 |
-
element: element.get(),
|
902 |
-
css: element.attr("class"),
|
903 |
-
disabled: element.prop("disabled"),
|
904 |
-
locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
|
905 |
-
};
|
906 |
-
} else if (element.is("optgroup")) {
|
907 |
-
return {
|
908 |
-
text:element.attr("label"),
|
909 |
-
children:[],
|
910 |
-
element: element.get(),
|
911 |
-
css: element.attr("class")
|
912 |
-
};
|
913 |
-
}
|
914 |
-
},
|
915 |
|
916 |
-
|
917 |
-
|
918 |
-
|
|
|
|
|
|
|
919 |
|
920 |
-
|
|
|
|
|
921 |
|
922 |
-
|
923 |
-
|
924 |
-
}
|
925 |
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
|
935 |
-
|
936 |
-
|
937 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
|
939 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
|
941 |
-
|
|
|
942 |
|
943 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
|
945 |
-
|
946 |
-
|
947 |
-
for (i = 0, l = results.length; i < l; i = i + 1) {
|
948 |
|
949 |
-
|
950 |
|
951 |
-
|
952 |
-
|
|
|
|
|
953 |
|
954 |
-
|
|
|
|
|
955 |
|
956 |
-
|
957 |
-
node.addClass("select2-results-dept-"+depth);
|
958 |
-
node.addClass("select2-result");
|
959 |
-
node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
|
960 |
-
if (disabled) { node.addClass("select2-disabled"); }
|
961 |
-
if (compound) { node.addClass("select2-result-with-children"); }
|
962 |
-
node.addClass(self.opts.formatResultCssClass(result));
|
963 |
-
node.attr("role", "presentation");
|
964 |
|
965 |
-
|
966 |
-
|
967 |
-
label.attr("id", "select2-result-label-" + nextUid());
|
968 |
-
label.attr("role", "option");
|
969 |
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
node.append(label);
|
974 |
-
}
|
975 |
|
|
|
|
|
976 |
|
977 |
-
|
|
|
978 |
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
}
|
984 |
|
985 |
-
|
986 |
-
nodes.push(node[0]);
|
987 |
-
}
|
988 |
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
|
|
993 |
|
994 |
-
|
995 |
-
}
|
996 |
-
}, $.fn.select2.defaults, opts);
|
997 |
|
998 |
-
|
999 |
-
|
1000 |
-
opts.id = function (e) { return e[idKey]; };
|
1001 |
-
}
|
1002 |
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
}
|
1007 |
-
opts.tags=opts.element.data("select2Tags");
|
1008 |
-
}
|
1009 |
|
1010 |
-
|
1011 |
-
|
1012 |
-
var data = { results: [], more: false },
|
1013 |
-
term = query.term,
|
1014 |
-
children, placeholderOption, process;
|
1015 |
-
|
1016 |
-
process=function(element, collection) {
|
1017 |
-
var group;
|
1018 |
-
if (element.is("option")) {
|
1019 |
-
if (query.matcher(term, element.text(), element)) {
|
1020 |
-
collection.push(self.optionToData(element));
|
1021 |
-
}
|
1022 |
-
} else if (element.is("optgroup")) {
|
1023 |
-
group=self.optionToData(element);
|
1024 |
-
element.children().each2(function(i, elm) { process(elm, group.children); });
|
1025 |
-
if (group.children.length>0) {
|
1026 |
-
collection.push(group);
|
1027 |
-
}
|
1028 |
-
}
|
1029 |
-
};
|
1030 |
|
1031 |
-
|
1032 |
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
}
|
1040 |
|
1041 |
-
|
|
|
1042 |
|
1043 |
-
|
1044 |
-
});
|
1045 |
-
// this is needed because inside val() we construct choices from options and their id is hardcoded
|
1046 |
-
opts.id=function(e) { return e.id; };
|
1047 |
-
} else {
|
1048 |
-
if (!("query" in opts)) {
|
1049 |
|
1050 |
-
|
1051 |
-
|
1052 |
-
if (ajaxUrl && ajaxUrl.length > 0) {
|
1053 |
-
opts.ajax.url = ajaxUrl;
|
1054 |
-
}
|
1055 |
-
opts.query = ajax.call(opts.element, opts.ajax);
|
1056 |
-
} else if ("data" in opts) {
|
1057 |
-
opts.query = local(opts.data);
|
1058 |
-
} else if ("tags" in opts) {
|
1059 |
-
opts.query = tags(opts.tags);
|
1060 |
-
if (opts.createSearchChoice === undefined) {
|
1061 |
-
opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
|
1062 |
-
}
|
1063 |
-
if (opts.initSelection === undefined) {
|
1064 |
-
opts.initSelection = function (element, callback) {
|
1065 |
-
var data = [];
|
1066 |
-
$(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
|
1067 |
-
var obj = { id: this, text: this },
|
1068 |
-
tags = opts.tags;
|
1069 |
-
if ($.isFunction(tags)) tags=tags();
|
1070 |
-
$(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
|
1071 |
-
data.push(obj);
|
1072 |
-
});
|
1073 |
-
|
1074 |
-
callback(data);
|
1075 |
-
};
|
1076 |
-
}
|
1077 |
-
}
|
1078 |
-
}
|
1079 |
-
}
|
1080 |
-
if (typeof(opts.query) !== "function") {
|
1081 |
-
throw "query function not defined for Select2 " + opts.element.attr("id");
|
1082 |
-
}
|
1083 |
|
1084 |
-
|
1085 |
-
opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
|
1086 |
-
}
|
1087 |
-
else if (opts.createSearchChoicePosition === 'bottom') {
|
1088 |
-
opts.createSearchChoicePosition = function(list, item) { list.push(item); };
|
1089 |
-
}
|
1090 |
-
else if (typeof(opts.createSearchChoicePosition) !== "function") {
|
1091 |
-
throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
|
1092 |
-
}
|
1093 |
|
1094 |
-
|
1095 |
-
|
1096 |
|
1097 |
-
|
1098 |
-
|
1099 |
-
*/
|
1100 |
-
// abstract
|
1101 |
-
monitorSource: function () {
|
1102 |
-
var el = this.opts.element, observer, self = this;
|
1103 |
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
}));
|
1109 |
|
1110 |
-
|
|
|
1111 |
|
1112 |
-
|
1113 |
-
|
1114 |
-
if (disabled === undefined) disabled = false;
|
1115 |
-
this.enable(!disabled);
|
1116 |
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
|
1121 |
-
|
1122 |
-
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
|
1123 |
-
this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
|
1124 |
-
}
|
1125 |
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
|
|
|
|
|
|
|
|
|
|
1130 |
|
1131 |
-
|
|
|
1132 |
|
1133 |
-
|
1134 |
-
|
1135 |
-
el.each(function() {
|
1136 |
-
this.attachEvent("onpropertychange", self._sync);
|
1137 |
-
});
|
1138 |
-
}
|
1139 |
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
this.propertyObserver = new observer(function (mutations) {
|
1145 |
-
$.each(mutations, self._sync);
|
1146 |
-
});
|
1147 |
-
this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
|
1148 |
-
}
|
1149 |
-
},
|
1150 |
|
1151 |
-
|
1152 |
-
|
1153 |
-
var evt = $.Event("select2-selecting", { val: this.id(data), object: data, choice: data });
|
1154 |
-
this.opts.element.trigger(evt);
|
1155 |
-
return !evt.isDefaultPrevented();
|
1156 |
-
},
|
1157 |
|
1158 |
-
|
1159 |
-
|
1160 |
-
*/
|
1161 |
-
// abstract
|
1162 |
-
triggerChange: function (details) {
|
1163 |
-
|
1164 |
-
details = details || {};
|
1165 |
-
details= $.extend({}, details, { type: "change", val: this.val() });
|
1166 |
-
// prevents recursive triggering
|
1167 |
-
this.opts.element.data("select2-change-triggered", true);
|
1168 |
-
this.opts.element.trigger(details);
|
1169 |
-
this.opts.element.data("select2-change-triggered", false);
|
1170 |
-
|
1171 |
-
// some validation frameworks ignore the change event and listen instead to keyup, click for selects
|
1172 |
-
// so here we trigger the click event manually
|
1173 |
-
this.opts.element.click();
|
1174 |
-
|
1175 |
-
// ValidationEngine ignores the change event and listens instead to blur
|
1176 |
-
// so here we trigger the blur event manually if so desired
|
1177 |
-
if (this.opts.blurOnChange)
|
1178 |
-
this.opts.element.blur();
|
1179 |
-
},
|
1180 |
|
1181 |
-
|
1182 |
-
isInterfaceEnabled: function()
|
1183 |
-
{
|
1184 |
-
return this.enabledInterface === true;
|
1185 |
-
},
|
1186 |
|
1187 |
-
//
|
1188 |
-
|
1189 |
-
var enabled = this._enabled && !this._readonly,
|
1190 |
-
disabled = !enabled;
|
1191 |
|
1192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
|
1194 |
-
|
1195 |
-
|
1196 |
-
this.enabledInterface = enabled;
|
1197 |
|
1198 |
-
|
1199 |
-
|
1200 |
|
1201 |
-
|
1202 |
-
enable: function(enabled) {
|
1203 |
-
if (enabled === undefined) enabled = true;
|
1204 |
-
if (this._enabled === enabled) return;
|
1205 |
-
this._enabled = enabled;
|
1206 |
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
|
|
|
|
|
|
|
|
1210 |
|
1211 |
-
|
1212 |
-
|
1213 |
-
this.enable(false);
|
1214 |
-
},
|
1215 |
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
if (this._readonly === enabled) return;
|
1220 |
-
this._readonly = enabled;
|
1221 |
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
offset = container.offset(),
|
1236 |
-
height = container.outerHeight(false),
|
1237 |
-
width = container.outerWidth(false),
|
1238 |
-
dropHeight = $dropdown.outerHeight(false),
|
1239 |
-
$window = $(window),
|
1240 |
-
windowWidth = $window.width(),
|
1241 |
-
windowHeight = $window.height(),
|
1242 |
-
viewPortRight = $window.scrollLeft() + windowWidth,
|
1243 |
-
viewportBottom = $window.scrollTop() + windowHeight,
|
1244 |
-
dropTop = offset.top + height,
|
1245 |
-
dropLeft = offset.left,
|
1246 |
-
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
|
1247 |
-
enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
|
1248 |
-
dropWidth = $dropdown.outerWidth(false),
|
1249 |
-
enoughRoomOnRight = function() {
|
1250 |
-
return dropLeft + dropWidth <= viewPortRight;
|
1251 |
-
},
|
1252 |
-
enoughRoomOnLeft = function() {
|
1253 |
-
return offset.left + viewPortRight + container.outerWidth(false) > dropWidth;
|
1254 |
-
},
|
1255 |
-
aboveNow = $dropdown.hasClass("select2-drop-above"),
|
1256 |
-
bodyOffset,
|
1257 |
-
above,
|
1258 |
-
changeDirection,
|
1259 |
-
css,
|
1260 |
-
resultsListNode;
|
1261 |
-
|
1262 |
-
// always prefer the current above/below alignment, unless there is not enough room
|
1263 |
-
if (aboveNow) {
|
1264 |
-
above = true;
|
1265 |
-
if (!enoughRoomAbove && enoughRoomBelow) {
|
1266 |
-
changeDirection = true;
|
1267 |
-
above = false;
|
1268 |
-
}
|
1269 |
-
} else {
|
1270 |
-
above = false;
|
1271 |
-
if (!enoughRoomBelow && enoughRoomAbove) {
|
1272 |
-
changeDirection = true;
|
1273 |
-
above = true;
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
offset = this.container.offset();
|
1281 |
-
height = this.container.outerHeight(false);
|
1282 |
-
width = this.container.outerWidth(false);
|
1283 |
-
dropHeight = $dropdown.outerHeight(false);
|
1284 |
-
viewPortRight = $window.scrollLeft() + windowWidth;
|
1285 |
-
viewportBottom = $window.scrollTop() + windowHeight;
|
1286 |
-
dropTop = offset.top + height;
|
1287 |
-
dropLeft = offset.left;
|
1288 |
-
dropWidth = $dropdown.outerWidth(false);
|
1289 |
-
$dropdown.show();
|
1290 |
-
|
1291 |
-
// fix so the cursor does not move to the left within the search-textbox in IE
|
1292 |
-
this.focusSearch();
|
1293 |
-
}
|
1294 |
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
$dropdown.css('width', '');
|
1299 |
-
// Add scrollbar width to dropdown if vertical scrollbar is present
|
1300 |
-
dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
|
1301 |
-
dropWidth > width ? width = dropWidth : dropWidth = width;
|
1302 |
-
dropHeight = $dropdown.outerHeight(false);
|
1303 |
-
}
|
1304 |
-
else {
|
1305 |
-
this.container.removeClass('select2-drop-auto-width');
|
1306 |
-
}
|
1307 |
|
1308 |
-
|
1309 |
-
|
|
|
1310 |
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
}
|
1317 |
|
1318 |
-
|
1319 |
-
|
1320 |
-
}
|
1321 |
|
1322 |
-
|
1323 |
-
|
1324 |
-
width: width
|
1325 |
-
};
|
1326 |
|
1327 |
-
|
1328 |
-
|
1329 |
-
css.bottom = 'auto';
|
1330 |
-
this.container.addClass("select2-drop-above");
|
1331 |
-
$dropdown.addClass("select2-drop-above");
|
1332 |
-
}
|
1333 |
-
else {
|
1334 |
-
css.top = dropTop;
|
1335 |
-
css.bottom = 'auto';
|
1336 |
-
this.container.removeClass("select2-drop-above");
|
1337 |
-
$dropdown.removeClass("select2-drop-above");
|
1338 |
-
}
|
1339 |
-
css = $.extend(css, evaluate(this.opts.dropdownCss, this.opts.element));
|
1340 |
|
1341 |
-
|
1342 |
-
|
1343 |
|
1344 |
-
|
1345 |
-
|
1346 |
-
var event;
|
1347 |
|
1348 |
-
|
1349 |
|
1350 |
-
|
|
|
1351 |
|
1352 |
-
|
1353 |
-
this.opts.element.trigger(event);
|
1354 |
-
return !event.isDefaultPrevented();
|
1355 |
-
},
|
1356 |
|
1357 |
-
|
1358 |
-
|
1359 |
-
// clear the classes used to figure out the preference of where the dropdown should be opened
|
1360 |
-
this.container.removeClass("select2-drop-above");
|
1361 |
-
this.dropdown.removeClass("select2-drop-above");
|
1362 |
-
},
|
1363 |
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
* @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
|
1368 |
-
* the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
|
1369 |
-
*/
|
1370 |
-
// abstract
|
1371 |
-
open: function () {
|
1372 |
|
1373 |
-
|
1374 |
|
1375 |
-
|
|
|
|
|
|
|
|
|
1376 |
|
1377 |
-
|
1378 |
-
$document.on("mousemove.select2Event", function (e) {
|
1379 |
-
lastMousePosition.x = e.pageX;
|
1380 |
-
lastMousePosition.y = e.pageY;
|
1381 |
-
});
|
1382 |
|
1383 |
-
|
1384 |
-
|
1385 |
|
1386 |
-
|
1387 |
-
|
1388 |
-
*/
|
1389 |
-
// abstract
|
1390 |
-
opening: function() {
|
1391 |
-
var cid = this.containerEventName,
|
1392 |
-
scroll = "scroll." + cid,
|
1393 |
-
resize = "resize."+cid,
|
1394 |
-
orient = "orientationchange."+cid,
|
1395 |
-
mask;
|
1396 |
|
1397 |
-
|
1398 |
|
1399 |
-
|
1400 |
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
mask.hide();
|
1411 |
-
mask.appendTo(this.body);
|
1412 |
-
mask.on("mousedown touchstart click", function (e) {
|
1413 |
-
// Prevent IE from generating a click event on the body
|
1414 |
-
reinsertElement(mask);
|
1415 |
-
|
1416 |
-
var dropdown = $("#select2-drop"), self;
|
1417 |
-
if (dropdown.length > 0) {
|
1418 |
-
self=dropdown.data("select2");
|
1419 |
-
if (self.opts.selectOnBlur) {
|
1420 |
-
self.selectHighlighted({noFocus: true});
|
1421 |
-
}
|
1422 |
-
self.close();
|
1423 |
-
e.preventDefault();
|
1424 |
-
e.stopPropagation();
|
1425 |
-
}
|
1426 |
-
});
|
1427 |
-
}
|
1428 |
|
1429 |
-
|
1430 |
-
|
1431 |
-
this.dropdown.before(mask);
|
1432 |
-
}
|
1433 |
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
|
|
1437 |
|
1438 |
-
|
1439 |
-
|
|
|
|
|
1440 |
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
|
|
1444 |
|
1445 |
-
|
|
|
|
|
1446 |
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
$(this).on(resize+" "+scroll+" "+orient, function (e) {
|
1452 |
-
if (that.opened()) that.positionDropdown();
|
1453 |
-
});
|
1454 |
-
});
|
1455 |
|
|
|
|
|
|
|
1456 |
|
1457 |
-
|
|
|
|
|
|
|
1458 |
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
|
|
|
|
1467 |
|
1468 |
-
|
1469 |
-
|
1470 |
|
1471 |
-
|
|
|
|
|
1472 |
|
1473 |
-
|
1474 |
-
|
1475 |
-
this.dropdown.hide();
|
1476 |
-
this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
|
1477 |
-
this.results.empty();
|
1478 |
|
1479 |
-
|
1480 |
-
|
1481 |
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
},
|
1486 |
|
1487 |
-
|
1488 |
-
* Opens control, sets input value, and updates results.
|
1489 |
-
*/
|
1490 |
-
// abstract
|
1491 |
-
externalSearch: function (term) {
|
1492 |
-
this.open();
|
1493 |
-
this.search.val(term);
|
1494 |
-
this.updateResults(false);
|
1495 |
-
},
|
1496 |
|
1497 |
-
|
1498 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1499 |
|
1500 |
-
|
|
|
1501 |
|
1502 |
-
|
1503 |
-
getMaximumSelectionSize: function() {
|
1504 |
-
return evaluate(this.opts.maximumSelectionSize, this.opts.element);
|
1505 |
-
},
|
1506 |
|
1507 |
-
|
1508 |
-
ensureHighlightVisible: function () {
|
1509 |
-
var results = this.results, children, index, child, hb, rb, y, more, topOffset;
|
1510 |
|
1511 |
-
|
|
|
|
|
|
|
|
|
1512 |
|
1513 |
-
|
1514 |
|
1515 |
-
|
|
|
|
|
|
|
1516 |
|
1517 |
-
|
1518 |
-
// that way any unselectable headers above it will also be scrolled
|
1519 |
-
// into view
|
1520 |
|
1521 |
-
|
1522 |
-
return;
|
1523 |
-
}
|
1524 |
|
1525 |
-
|
|
|
|
|
1526 |
|
1527 |
-
|
|
|
|
|
|
|
|
|
|
|
1528 |
|
1529 |
-
|
|
|
1530 |
|
1531 |
-
|
1532 |
|
1533 |
-
|
1534 |
-
if (index === children.length - 1) {
|
1535 |
-
more = results.find("li.select2-more-results");
|
1536 |
-
if (more.length > 0) {
|
1537 |
-
hb = more.offset().top + more.outerHeight(true);
|
1538 |
-
}
|
1539 |
-
}
|
1540 |
|
1541 |
-
|
1542 |
-
if (hb > rb) {
|
1543 |
-
results.scrollTop(results.scrollTop() + (hb - rb));
|
1544 |
-
}
|
1545 |
-
y = topOffset - results.offset().top;
|
1546 |
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
},
|
1552 |
|
1553 |
-
|
1554 |
-
findHighlightableChoices: function() {
|
1555 |
-
return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
|
1556 |
-
},
|
1557 |
|
1558 |
-
|
1559 |
-
moveHighlight: function (delta) {
|
1560 |
-
var choices = this.findHighlightableChoices(),
|
1561 |
-
index = this.highlight();
|
1562 |
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
this.highlight(index);
|
1568 |
-
break;
|
1569 |
-
}
|
1570 |
-
}
|
1571 |
-
},
|
1572 |
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
|
|
1578 |
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
|
1583 |
-
|
1584 |
-
|
|
|
1585 |
|
1586 |
-
|
|
|
|
|
1587 |
|
1588 |
-
|
1589 |
-
choice.addClass("select2-highlighted");
|
1590 |
|
1591 |
-
|
1592 |
-
|
1593 |
|
1594 |
-
|
|
|
1595 |
|
1596 |
-
|
|
|
|
|
|
|
|
|
|
|
1597 |
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
|
1608 |
-
|
1609 |
-
this._touchMoved = true;
|
1610 |
-
},
|
1611 |
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1615 |
|
1616 |
-
|
1617 |
-
|
1618 |
-
return this.findHighlightableChoices().length;
|
1619 |
-
},
|
1620 |
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
this.highlight(choices.index(el));
|
1627 |
-
} else if (el.length == 0) {
|
1628 |
-
// if we are over an unselectable item remove all highlights
|
1629 |
-
this.removeHighlight();
|
1630 |
-
}
|
1631 |
-
},
|
1632 |
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
more = results.find("li.select2-more-results"),
|
1637 |
-
below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
|
1638 |
-
page = this.resultsPage + 1,
|
1639 |
-
self=this,
|
1640 |
-
term=this.search.val(),
|
1641 |
-
context=this.context;
|
1642 |
-
|
1643 |
-
if (more.length === 0) return;
|
1644 |
-
below = more.offset().top - results.offset().top - results.height();
|
1645 |
-
|
1646 |
-
if (below <= this.opts.loadMorePadding) {
|
1647 |
-
more.addClass("select2-active");
|
1648 |
-
this.opts.query({
|
1649 |
-
element: this.opts.element,
|
1650 |
-
term: term,
|
1651 |
-
page: page,
|
1652 |
-
context: context,
|
1653 |
-
matcher: this.opts.matcher,
|
1654 |
-
callback: this.bind(function (data) {
|
1655 |
-
|
1656 |
-
// ignore a response if the select2 has been closed before it was received
|
1657 |
-
if (!self.opened()) return;
|
1658 |
-
|
1659 |
-
|
1660 |
-
self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
|
1661 |
-
self.postprocessResults(data, false, false);
|
1662 |
-
|
1663 |
-
if (data.more===true) {
|
1664 |
-
more.detach().appendTo(results).html(self.opts.escapeMarkup(evaluate(self.opts.formatLoadMore, self.opts.element, page+1)));
|
1665 |
-
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
|
1666 |
-
} else {
|
1667 |
-
more.remove();
|
1668 |
-
}
|
1669 |
-
self.positionDropdown();
|
1670 |
-
self.resultsPage = page;
|
1671 |
-
self.context = data.context;
|
1672 |
-
this.opts.element.trigger({ type: "select2-loaded", items: data });
|
1673 |
-
})});
|
1674 |
-
}
|
1675 |
-
},
|
1676 |
|
1677 |
-
|
1678 |
-
|
1679 |
-
*/
|
1680 |
-
tokenize: function() {
|
1681 |
|
1682 |
-
|
|
|
|
|
|
|
|
|
|
|
1683 |
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
// abstract
|
1688 |
-
updateResults: function (initial) {
|
1689 |
-
var search = this.search,
|
1690 |
-
results = this.results,
|
1691 |
-
opts = this.opts,
|
1692 |
-
data,
|
1693 |
-
self = this,
|
1694 |
-
input,
|
1695 |
-
term = search.val(),
|
1696 |
-
lastTerm = $.data(this.container, "select2-last-term"),
|
1697 |
-
// sequence number used to drop out-of-order responses
|
1698 |
-
queryNumber;
|
1699 |
-
|
1700 |
-
// prevent duplicate queries against the same term
|
1701 |
-
if (initial !== true && lastTerm && equal(term, lastTerm)) return;
|
1702 |
-
|
1703 |
-
$.data(this.container, "select2-last-term", term);
|
1704 |
-
|
1705 |
-
// if the search is currently hidden we do not alter the results
|
1706 |
-
if (initial !== true && (this.showSearchInput === false || !this.opened())) {
|
1707 |
-
return;
|
1708 |
-
}
|
1709 |
|
1710 |
-
|
1711 |
-
|
1712 |
-
self.positionDropdown();
|
1713 |
-
if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
|
1714 |
-
self.liveRegion.text(results.text());
|
1715 |
-
}
|
1716 |
-
else {
|
1717 |
-
self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
|
1718 |
-
}
|
1719 |
-
}
|
1720 |
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
}
|
1725 |
|
1726 |
-
|
|
|
1727 |
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
|
1732 |
-
render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
|
1733 |
-
return;
|
1734 |
-
}
|
1735 |
-
}
|
1736 |
|
1737 |
-
|
1738 |
-
if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
|
1739 |
-
render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, opts.element, search.val(), opts.minimumInputLength) + "</li>");
|
1740 |
-
} else {
|
1741 |
-
render("");
|
1742 |
-
}
|
1743 |
-
if (initial && this.showSearch) this.showSearch(true);
|
1744 |
-
return;
|
1745 |
-
}
|
1746 |
|
1747 |
-
|
1748 |
-
if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
|
1749 |
-
render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, opts.element, search.val(), opts.maximumInputLength) + "</li>");
|
1750 |
-
} else {
|
1751 |
-
render("");
|
1752 |
-
}
|
1753 |
-
return;
|
1754 |
-
}
|
1755 |
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
|
1760 |
-
|
|
|
1761 |
|
1762 |
-
|
|
|
|
|
|
|
|
|
|
|
1763 |
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
search.val(input);
|
1768 |
-
}
|
1769 |
|
1770 |
-
|
1771 |
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1780 |
|
1781 |
-
|
1782 |
-
|
1783 |
-
return;
|
1784 |
-
}
|
1785 |
|
1786 |
-
|
1787 |
-
if (!this.opened()) {
|
1788 |
-
this.search.removeClass("select2-active");
|
1789 |
-
return;
|
1790 |
-
}
|
1791 |
|
1792 |
-
|
1793 |
-
|
1794 |
-
render("<li class='select2-ajax-error'>" + evaluate(opts.formatAjaxError, opts.element, data.jqXHR, data.textStatus, data.errorThrown) + "</li>");
|
1795 |
-
return;
|
1796 |
-
}
|
1797 |
|
1798 |
-
|
1799 |
-
|
1800 |
-
// create a default choice and prepend it to the list
|
1801 |
-
if (this.opts.createSearchChoice && search.val() !== "") {
|
1802 |
-
def = this.opts.createSearchChoice.call(self, search.val(), data.results);
|
1803 |
-
if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
|
1804 |
-
if ($(data.results).filter(
|
1805 |
-
function () {
|
1806 |
-
return equal(self.id(this), self.id(def));
|
1807 |
-
}).length === 0) {
|
1808 |
-
this.opts.createSearchChoicePosition(data.results, def);
|
1809 |
-
}
|
1810 |
-
}
|
1811 |
-
}
|
1812 |
|
1813 |
-
|
1814 |
-
|
1815 |
-
return;
|
1816 |
-
}
|
1817 |
|
1818 |
-
|
1819 |
-
self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
|
1820 |
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
}
|
1825 |
|
1826 |
-
|
|
|
|
|
1827 |
|
1828 |
-
|
|
|
1829 |
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
|
|
1833 |
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
},
|
1838 |
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
if (this.opts.selectOnBlur)
|
1843 |
-
this.selectHighlighted({noFocus: true});
|
1844 |
-
|
1845 |
-
this.close();
|
1846 |
-
this.container.removeClass("select2-container-active");
|
1847 |
-
// synonymous to .is(':focus'), which is available in jquery >= 1.6
|
1848 |
-
if (this.search[0] === document.activeElement) { this.search.blur(); }
|
1849 |
-
this.clearSearch();
|
1850 |
-
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
1851 |
-
},
|
1852 |
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
|
1858 |
-
|
1859 |
-
|
1860 |
-
if (this._touchMoved) {
|
1861 |
-
this.clearTouchMoved();
|
1862 |
-
return;
|
1863 |
-
}
|
1864 |
-
var index=this.highlight(),
|
1865 |
-
highlighted=this.results.find(".select2-highlighted"),
|
1866 |
-
data = highlighted.closest('.select2-result').data("select2-data");
|
1867 |
-
|
1868 |
-
if (data) {
|
1869 |
-
this.highlight(index);
|
1870 |
-
this.onSelect(data, options);
|
1871 |
-
} else if (options && options.noFocus) {
|
1872 |
-
this.close();
|
1873 |
-
}
|
1874 |
-
},
|
1875 |
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
this.opts.element.data("placeholder") ||
|
1882 |
-
this.opts.placeholder ||
|
1883 |
-
((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
|
1884 |
-
},
|
1885 |
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
if (this.opts.placeholderOption !== undefined ) {
|
1891 |
-
//Determine the placeholder option based on the specified placeholderOption setting
|
1892 |
-
return (this.opts.placeholderOption === "first" && firstOption) ||
|
1893 |
-
(typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
|
1894 |
-
} else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
|
1895 |
-
//No explicit placeholder option specified, use the first if it's blank
|
1896 |
-
return firstOption;
|
1897 |
-
}
|
1898 |
-
}
|
1899 |
-
},
|
1900 |
|
1901 |
-
|
1902 |
-
|
1903 |
-
* derived first from option `width` passed to select2, then
|
1904 |
-
* the inline 'style' on the original element, and finally
|
1905 |
-
* falls back to the jQuery calculated element width.
|
1906 |
-
*/
|
1907 |
-
// abstract
|
1908 |
-
initContainerWidth: function () {
|
1909 |
-
function resolveContainerWidth() {
|
1910 |
-
var style, attrs, matches, i, l, attr;
|
1911 |
-
|
1912 |
-
if (this.opts.width === "off") {
|
1913 |
-
return null;
|
1914 |
-
} else if (this.opts.width === "element"){
|
1915 |
-
return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
|
1916 |
-
} else if (this.opts.width === "copy" || this.opts.width === "resolve") {
|
1917 |
-
// check if there is inline style on the element that contains width
|
1918 |
-
style = this.opts.element.attr('style');
|
1919 |
-
if (style !== undefined) {
|
1920 |
-
attrs = style.split(';');
|
1921 |
-
for (i = 0, l = attrs.length; i < l; i = i + 1) {
|
1922 |
-
attr = attrs[i].replace(/\s/g, '');
|
1923 |
-
matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
|
1924 |
-
if (matches !== null && matches.length >= 1)
|
1925 |
-
return matches[1];
|
1926 |
-
}
|
1927 |
-
}
|
1928 |
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
style = this.opts.element.css('width');
|
1933 |
-
if (style.indexOf("%") > 0) return style;
|
1934 |
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1938 |
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
} else {
|
1943 |
-
return this.opts.width;
|
1944 |
-
}
|
1945 |
-
};
|
1946 |
|
1947 |
-
|
1948 |
-
|
1949 |
-
this.container.css("width", width);
|
1950 |
-
}
|
1951 |
-
}
|
1952 |
-
});
|
1953 |
|
1954 |
-
|
1955 |
-
|
1956 |
-
// single
|
1957 |
-
|
1958 |
-
createContainer: function () {
|
1959 |
-
var container = $(document.createElement("div")).attr({
|
1960 |
-
"class": "select2-container"
|
1961 |
-
}).html([
|
1962 |
-
"<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
|
1963 |
-
" <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>",
|
1964 |
-
" <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>",
|
1965 |
-
"</a>",
|
1966 |
-
"<label for='' class='select2-offscreen'></label>",
|
1967 |
-
"<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />",
|
1968 |
-
"<div class='select2-drop select2-display-none'>",
|
1969 |
-
" <div class='select2-search'>",
|
1970 |
-
" <label for='' class='select2-offscreen'></label>",
|
1971 |
-
" <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'",
|
1972 |
-
" aria-autocomplete='list' />",
|
1973 |
-
" </div>",
|
1974 |
-
" <ul class='select2-results' role='listbox'>",
|
1975 |
-
" </ul>",
|
1976 |
-
"</div>"].join(""));
|
1977 |
-
return container;
|
1978 |
-
},
|
1979 |
|
1980 |
-
|
1981 |
-
enableInterface: function() {
|
1982 |
-
if (this.parent.enableInterface.apply(this, arguments)) {
|
1983 |
-
this.focusser.prop("disabled", !this.isInterfaceEnabled());
|
1984 |
-
}
|
1985 |
-
},
|
1986 |
|
1987 |
-
|
1988 |
-
opening: function () {
|
1989 |
-
var el, range, len;
|
1990 |
|
1991 |
-
|
1992 |
-
|
1993 |
-
}
|
1994 |
|
1995 |
-
|
|
|
|
|
1996 |
|
1997 |
-
|
1998 |
-
// IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
|
1999 |
-
// all other browsers handle this just fine
|
2000 |
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
// move the cursor to the end after focussing, otherwise it will be at the beginning and
|
2006 |
-
// new text will appear *before* focusser.val()
|
2007 |
-
el = this.search.get(0);
|
2008 |
-
if (el.createTextRange) {
|
2009 |
-
range = el.createTextRange();
|
2010 |
-
range.collapse(false);
|
2011 |
-
range.select();
|
2012 |
-
} else if (el.setSelectionRange) {
|
2013 |
-
len = this.search.val().length;
|
2014 |
-
el.setSelectionRange(len, len);
|
2015 |
-
}
|
2016 |
-
}
|
2017 |
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
if(this.nextSearchTerm != undefined){
|
2022 |
-
this.search.val(this.nextSearchTerm);
|
2023 |
-
this.search.select();
|
2024 |
-
}
|
2025 |
-
}
|
2026 |
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
this.parent.close.apply(this, arguments);
|
2036 |
|
2037 |
-
|
|
|
|
|
2038 |
|
2039 |
-
|
2040 |
-
|
2041 |
-
}
|
2042 |
-
},
|
2043 |
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
}
|
2054 |
-
},
|
2055 |
|
2056 |
-
|
2057 |
-
isFocused: function () {
|
2058 |
-
return this.container.hasClass("select2-container-active");
|
2059 |
-
},
|
2060 |
|
2061 |
-
|
2062 |
-
|
2063 |
-
this.parent.cancel.apply(this, arguments);
|
2064 |
-
this.focusser.prop("disabled", false);
|
2065 |
|
2066 |
-
|
2067 |
-
this.focusser.focus();
|
2068 |
-
}
|
2069 |
-
},
|
2070 |
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
|
|
2076 |
|
2077 |
-
|
2078 |
-
|
2079 |
-
"focusser"
|
2080 |
-
);
|
2081 |
-
},
|
2082 |
|
2083 |
-
|
2084 |
-
|
2085 |
|
2086 |
-
|
2087 |
-
container = this.container,
|
2088 |
-
dropdown = this.dropdown,
|
2089 |
-
idSuffix = nextUid(),
|
2090 |
-
elementLabel;
|
2091 |
|
2092 |
-
|
2093 |
-
this.showSearch(false);
|
2094 |
-
} else {
|
2095 |
-
this.showSearch(true);
|
2096 |
-
}
|
2097 |
|
2098 |
-
|
|
|
|
|
|
|
|
|
2099 |
|
2100 |
-
|
|
|
|
|
|
|
|
|
2101 |
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
this.search.attr("aria-owns", "select2-results-"+idSuffix);
|
2107 |
|
2108 |
-
|
2109 |
-
|
|
|
2110 |
|
2111 |
-
|
2112 |
-
|
|
|
2113 |
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
|
|
|
|
|
|
2117 |
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
|
|
|
|
2121 |
|
2122 |
-
|
|
|
|
|
2123 |
|
2124 |
-
|
2125 |
-
|
2126 |
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
|
2131 |
-
|
2132 |
-
|
|
|
|
|
|
|
2133 |
|
2134 |
-
|
2135 |
-
if (229 == e.keyCode) return;
|
2136 |
|
2137 |
-
|
2138 |
-
|
2139 |
-
killEvent(e);
|
2140 |
-
return;
|
2141 |
-
}
|
2142 |
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
|
2147 |
-
killEvent(e);
|
2148 |
-
return;
|
2149 |
-
case KEY.ENTER:
|
2150 |
-
this.selectHighlighted();
|
2151 |
-
killEvent(e);
|
2152 |
-
return;
|
2153 |
-
case KEY.TAB:
|
2154 |
-
this.selectHighlighted({noFocus: true});
|
2155 |
-
return;
|
2156 |
-
case KEY.ESC:
|
2157 |
-
this.cancel(e);
|
2158 |
-
killEvent(e);
|
2159 |
-
return;
|
2160 |
-
}
|
2161 |
-
}));
|
2162 |
-
|
2163 |
-
this.search.on("blur", this.bind(function(e) {
|
2164 |
-
// a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
|
2165 |
-
// without this the search field loses focus which is annoying
|
2166 |
-
if (document.activeElement === this.body.get(0)) {
|
2167 |
-
window.setTimeout(this.bind(function() {
|
2168 |
-
if (this.opened()) {
|
2169 |
-
this.search.focus();
|
2170 |
-
}
|
2171 |
-
}), 0);
|
2172 |
-
}
|
2173 |
-
}));
|
2174 |
|
2175 |
-
|
2176 |
-
|
2177 |
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
|
|
|
|
|
|
|
|
|
|
2181 |
|
2182 |
-
|
2183 |
-
killEvent(e);
|
2184 |
-
return;
|
2185 |
-
}
|
2186 |
|
2187 |
-
|
2188 |
-
|
2189 |
|
2190 |
-
|
2191 |
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
}
|
2196 |
|
2197 |
-
|
2198 |
-
|
2199 |
-
this.clear();
|
2200 |
-
}
|
2201 |
-
killEvent(e);
|
2202 |
-
return;
|
2203 |
-
}
|
2204 |
-
}));
|
2205 |
|
|
|
|
|
2206 |
|
2207 |
-
|
2208 |
-
this.focusser.on("keyup-change input", this.bind(function(e) {
|
2209 |
-
if (this.opts.minimumResultsForSearch >= 0) {
|
2210 |
-
e.stopPropagation();
|
2211 |
-
if (this.opened()) return;
|
2212 |
-
this.open();
|
2213 |
-
}
|
2214 |
-
}));
|
2215 |
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
|
|
2220 |
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
|
|
|
|
|
|
|
|
|
|
2224 |
|
2225 |
-
|
2226 |
-
|
2227 |
-
}
|
2228 |
-
}));
|
2229 |
|
2230 |
-
|
2231 |
-
// Prevent IE from generating a click event on the body
|
2232 |
-
reinsertElement(selection);
|
2233 |
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2237 |
|
2238 |
-
|
2239 |
-
this.close();
|
2240 |
-
} else if (this.isInterfaceEnabled()) {
|
2241 |
-
this.open();
|
2242 |
-
}
|
2243 |
|
2244 |
-
|
2245 |
-
|
2246 |
|
2247 |
-
|
2248 |
-
|
2249 |
-
this.search.focus();
|
2250 |
-
}
|
2251 |
-
}));
|
2252 |
|
2253 |
-
|
2254 |
-
|
2255 |
-
}));
|
2256 |
|
2257 |
-
|
2258 |
-
if (!this.container.hasClass("select2-container-active")) {
|
2259 |
-
this.opts.element.trigger($.Event("select2-focus"));
|
2260 |
-
}
|
2261 |
-
this.container.addClass("select2-container-active");
|
2262 |
-
})).on("blur", this.bind(function() {
|
2263 |
-
if (!this.opened()) {
|
2264 |
-
this.container.removeClass("select2-container-active");
|
2265 |
-
this.opts.element.trigger($.Event("select2-blur"));
|
2266 |
-
}
|
2267 |
-
}));
|
2268 |
-
this.search.on("focus", this.bind(function(){
|
2269 |
-
if (!this.container.hasClass("select2-container-active")) {
|
2270 |
-
this.opts.element.trigger($.Event("select2-focus"));
|
2271 |
-
}
|
2272 |
-
this.container.addClass("select2-container-active");
|
2273 |
-
}));
|
2274 |
|
2275 |
-
|
2276 |
-
|
2277 |
-
this.setPlaceholder();
|
2278 |
|
2279 |
-
|
2280 |
|
2281 |
-
|
2282 |
-
|
2283 |
-
var data=this.selection.data("select2-data");
|
2284 |
-
if (data) { // guard against queued quick consecutive clicks
|
2285 |
-
var evt = $.Event("select2-clearing");
|
2286 |
-
this.opts.element.trigger(evt);
|
2287 |
-
if (evt.isDefaultPrevented()) {
|
2288 |
-
return;
|
2289 |
-
}
|
2290 |
-
var placeholderOption = this.getPlaceholderOption();
|
2291 |
-
this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
|
2292 |
-
this.selection.find(".select2-chosen").empty();
|
2293 |
-
this.selection.removeData("select2-data");
|
2294 |
-
this.setPlaceholder();
|
2295 |
-
|
2296 |
-
if (triggerChange !== false){
|
2297 |
-
this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
|
2298 |
-
this.triggerChange({removed:data});
|
2299 |
-
}
|
2300 |
-
}
|
2301 |
-
},
|
2302 |
|
2303 |
-
|
2304 |
-
|
2305 |
-
*/
|
2306 |
-
// single
|
2307 |
-
initSelection: function () {
|
2308 |
-
var selected;
|
2309 |
-
if (this.isPlaceholderOptionSelected()) {
|
2310 |
-
this.updateSelection(null);
|
2311 |
-
this.close();
|
2312 |
-
this.setPlaceholder();
|
2313 |
-
} else {
|
2314 |
-
var self = this;
|
2315 |
-
this.opts.initSelection.call(null, this.opts.element, function(selected){
|
2316 |
-
if (selected !== undefined && selected !== null) {
|
2317 |
-
self.updateSelection(selected);
|
2318 |
-
self.close();
|
2319 |
-
self.setPlaceholder();
|
2320 |
-
self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
|
2321 |
-
}
|
2322 |
-
});
|
2323 |
-
}
|
2324 |
-
},
|
2325 |
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|| (this.opts.element.val() === undefined)
|
2332 |
-
|| (this.opts.element.val() === null);
|
2333 |
-
},
|
2334 |
|
2335 |
-
|
2336 |
-
|
2337 |
-
var opts = this.parent.prepareOpts.apply(this, arguments),
|
2338 |
-
self=this;
|
2339 |
-
|
2340 |
-
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
2341 |
-
// install the selection initializer
|
2342 |
-
opts.initSelection = function (element, callback) {
|
2343 |
-
var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
|
2344 |
-
// a single select box always has a value, no need to null check 'selected'
|
2345 |
-
callback(self.optionToData(selected));
|
2346 |
-
};
|
2347 |
-
} else if ("data" in opts) {
|
2348 |
-
// install default initSelection when applied to hidden input and data is local
|
2349 |
-
opts.initSelection = opts.initSelection || function (element, callback) {
|
2350 |
-
var id = element.val();
|
2351 |
-
//search in data by id, storing the actual matching item
|
2352 |
-
var match = null;
|
2353 |
-
opts.query({
|
2354 |
-
matcher: function(term, text, el){
|
2355 |
-
var is_match = equal(id, opts.id(el));
|
2356 |
-
if (is_match) {
|
2357 |
-
match = el;
|
2358 |
-
}
|
2359 |
-
return is_match;
|
2360 |
-
},
|
2361 |
-
callback: !$.isFunction(callback) ? $.noop : function() {
|
2362 |
-
callback(match);
|
2363 |
-
}
|
2364 |
-
});
|
2365 |
-
};
|
2366 |
-
}
|
2367 |
|
2368 |
-
|
2369 |
-
|
|
|
|
|
|
|
|
|
|
|
2370 |
|
2371 |
-
|
2372 |
-
|
2373 |
-
// if a placeholder is specified on a single select without a valid placeholder option ignore it
|
2374 |
-
if (this.select) {
|
2375 |
-
if (this.getPlaceholderOption() === undefined) {
|
2376 |
-
return undefined;
|
2377 |
-
}
|
2378 |
-
}
|
2379 |
|
2380 |
-
|
2381 |
-
|
2382 |
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
|
2387 |
-
|
|
|
2388 |
|
2389 |
-
|
2390 |
-
|
|
|
|
|
|
|
2391 |
|
2392 |
-
|
|
|
|
|
2393 |
|
2394 |
-
|
2395 |
|
2396 |
-
|
2397 |
-
}
|
2398 |
-
},
|
2399 |
|
2400 |
-
|
2401 |
-
|
2402 |
-
var selected = 0, self = this, showSearchInput = true;
|
2403 |
|
2404 |
-
|
|
|
2405 |
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
|
2413 |
-
|
2414 |
-
|
2415 |
-
if (initial === true && selected >= 0) {
|
2416 |
-
this.highlight(selected);
|
2417 |
-
} else {
|
2418 |
-
this.highlight(0);
|
2419 |
-
}
|
2420 |
-
}
|
2421 |
|
2422 |
-
|
2423 |
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
|
|
2431 |
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
|
|
2435 |
|
2436 |
-
|
|
|
|
|
|
|
2437 |
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
|
2444 |
-
|
2445 |
-
onSelect: function (data, options) {
|
2446 |
|
2447 |
-
|
|
|
|
|
|
|
2448 |
|
2449 |
-
|
2450 |
-
oldData = this.data();
|
2451 |
|
2452 |
-
|
2453 |
-
this.updateSelection(data);
|
2454 |
|
2455 |
-
|
|
|
2456 |
|
2457 |
-
|
2458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2459 |
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
|
|
2463 |
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
},
|
2468 |
|
2469 |
-
|
2470 |
-
|
|
|
|
|
|
|
|
|
2471 |
|
2472 |
-
|
2473 |
|
2474 |
-
|
|
|
2475 |
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
if (formatted !== undefined) {
|
2481 |
-
container.append(formatted);
|
2482 |
-
}
|
2483 |
-
cssClass=this.opts.formatSelectionCssClass(data, container);
|
2484 |
-
if (cssClass !== undefined) {
|
2485 |
-
container.addClass(cssClass);
|
2486 |
-
}
|
2487 |
|
2488 |
-
|
|
|
|
|
|
|
2489 |
|
2490 |
-
|
2491 |
-
|
2492 |
-
}
|
2493 |
-
},
|
2494 |
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
data = null,
|
2500 |
-
self = this,
|
2501 |
-
oldData = this.data();
|
2502 |
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
|
|
|
|
|
|
2506 |
|
2507 |
-
|
|
|
2508 |
|
2509 |
-
|
2510 |
-
|
2511 |
-
}
|
2512 |
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
this.setPlaceholder();
|
2522 |
-
if (triggerChange) {
|
2523 |
-
this.triggerChange({added: data, removed:oldData});
|
2524 |
-
}
|
2525 |
-
} else {
|
2526 |
-
// val is an id. !val is true for [undefined,null,'',0] - 0 is legal
|
2527 |
-
if (!val && val !== 0) {
|
2528 |
-
this.clear(triggerChange);
|
2529 |
-
return;
|
2530 |
-
}
|
2531 |
-
if (this.opts.initSelection === undefined) {
|
2532 |
-
throw new Error("cannot call val() if initSelection() is not defined");
|
2533 |
-
}
|
2534 |
-
this.opts.element.val(val);
|
2535 |
-
this.opts.initSelection(this.opts.element, function(data){
|
2536 |
-
self.opts.element.val(!data ? "" : self.id(data));
|
2537 |
-
self.updateSelection(data);
|
2538 |
-
self.setPlaceholder();
|
2539 |
-
if (triggerChange) {
|
2540 |
-
self.triggerChange({added: data, removed:oldData});
|
2541 |
-
}
|
2542 |
-
});
|
2543 |
-
}
|
2544 |
-
},
|
2545 |
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
|
|
|
|
|
|
2551 |
|
2552 |
-
|
2553 |
-
|
2554 |
-
var data,
|
2555 |
-
triggerChange = false;
|
2556 |
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2575 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2576 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2577 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2578 |
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
"<div class='select2-drop select2-drop-multi select2-display-none'>",
|
2593 |
-
" <ul class='select2-results'>",
|
2594 |
-
" </ul>",
|
2595 |
-
"</div>"].join(""));
|
2596 |
-
return container;
|
2597 |
-
},
|
2598 |
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
self=this;
|
2603 |
-
|
2604 |
-
// TODO validate placeholder is a string if specified
|
2605 |
-
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
2606 |
-
// install the selection initializer
|
2607 |
-
opts.initSelection = function (element, callback) {
|
2608 |
-
|
2609 |
-
var data = [];
|
2610 |
-
|
2611 |
-
element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
|
2612 |
-
data.push(self.optionToData(elm));
|
2613 |
-
});
|
2614 |
-
callback(data);
|
2615 |
-
};
|
2616 |
-
} else if ("data" in opts) {
|
2617 |
-
// install default initSelection when applied to hidden input and data is local
|
2618 |
-
opts.initSelection = opts.initSelection || function (element, callback) {
|
2619 |
-
var ids = splitVal(element.val(), opts.separator, opts.transformVal);
|
2620 |
-
//search in data by array of ids, storing matching items in a list
|
2621 |
-
var matches = [];
|
2622 |
-
opts.query({
|
2623 |
-
matcher: function(term, text, el){
|
2624 |
-
var is_match = $.grep(ids, function(id) {
|
2625 |
-
return equal(id, opts.id(el));
|
2626 |
-
}).length;
|
2627 |
-
if (is_match) {
|
2628 |
-
matches.push(el);
|
2629 |
-
}
|
2630 |
-
return is_match;
|
2631 |
-
},
|
2632 |
-
callback: !$.isFunction(callback) ? $.noop : function() {
|
2633 |
-
// reorder matches based on the order they appear in the ids array because right now
|
2634 |
-
// they are in the order in which they appear in data array
|
2635 |
-
var ordered = [];
|
2636 |
-
for (var i = 0; i < ids.length; i++) {
|
2637 |
-
var id = ids[i];
|
2638 |
-
for (var j = 0; j < matches.length; j++) {
|
2639 |
-
var match = matches[j];
|
2640 |
-
if (equal(id, opts.id(match))) {
|
2641 |
-
ordered.push(match);
|
2642 |
-
matches.splice(j, 1);
|
2643 |
-
break;
|
2644 |
-
}
|
2645 |
-
}
|
2646 |
-
}
|
2647 |
-
callback(ordered);
|
2648 |
-
}
|
2649 |
-
});
|
2650 |
-
};
|
2651 |
-
}
|
2652 |
|
2653 |
-
|
2654 |
-
|
|
|
|
|
|
|
|
|
|
|
2655 |
|
2656 |
-
|
2657 |
-
selectChoice: function (choice) {
|
2658 |
|
2659 |
-
|
2660 |
-
|
2661 |
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
}
|
2666 |
-
selected.removeClass("select2-search-choice-focus");
|
2667 |
-
if (choice && choice.length) {
|
2668 |
-
this.close();
|
2669 |
-
choice.addClass("select2-search-choice-focus");
|
2670 |
-
this.opts.element.trigger("choice-selected", choice);
|
2671 |
-
}
|
2672 |
-
}
|
2673 |
-
},
|
2674 |
|
2675 |
-
|
2676 |
-
|
2677 |
-
$("label[for='" + this.search.attr('id') + "']")
|
2678 |
-
.attr('for', this.opts.element.attr("id"));
|
2679 |
-
this.parent.destroy.apply(this, arguments);
|
2680 |
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
},
|
2686 |
|
2687 |
-
|
2688 |
-
|
|
|
|
|
|
|
|
|
2689 |
|
2690 |
-
|
|
|
|
|
|
|
2691 |
|
2692 |
-
|
2693 |
-
|
2694 |
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
});
|
2700 |
|
2701 |
-
|
2702 |
-
|
2703 |
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
this.opts.element.focus(this.bind(function () { this.focus(); }));
|
2708 |
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
if (!this.opened()) {
|
2713 |
-
this.open();
|
2714 |
-
}
|
2715 |
-
}));
|
2716 |
|
2717 |
-
|
|
|
|
|
|
|
|
|
2718 |
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2722 |
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
var next = selected.next(".select2-search-choice:not(.select2-locked)");
|
2727 |
-
var pos = getCursorInfo(this.search);
|
2728 |
|
2729 |
-
|
2730 |
-
(e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
|
2731 |
-
var selectedChoice = selected;
|
2732 |
-
if (e.which == KEY.LEFT && prev.length) {
|
2733 |
-
selectedChoice = prev;
|
2734 |
-
}
|
2735 |
-
else if (e.which == KEY.RIGHT) {
|
2736 |
-
selectedChoice = next.length ? next : null;
|
2737 |
-
}
|
2738 |
-
else if (e.which === KEY.BACKSPACE) {
|
2739 |
-
if (this.unselect(selected.first())) {
|
2740 |
-
this.search.width(10);
|
2741 |
-
selectedChoice = prev.length ? prev : next;
|
2742 |
-
}
|
2743 |
-
} else if (e.which == KEY.DELETE) {
|
2744 |
-
if (this.unselect(selected.first())) {
|
2745 |
-
this.search.width(10);
|
2746 |
-
selectedChoice = next.length ? next : null;
|
2747 |
-
}
|
2748 |
-
} else if (e.which == KEY.ENTER) {
|
2749 |
-
selectedChoice = null;
|
2750 |
-
}
|
2751 |
|
2752 |
-
|
2753 |
-
|
2754 |
-
if (!selectedChoice || !selectedChoice.length) {
|
2755 |
-
this.open();
|
2756 |
-
}
|
2757 |
-
return;
|
2758 |
-
} else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
|
2759 |
-
|| e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
|
2760 |
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
|
2766 |
-
|
|
|
|
|
2767 |
|
2768 |
-
|
2769 |
-
switch (e.which) {
|
2770 |
-
case KEY.UP:
|
2771 |
-
case KEY.DOWN:
|
2772 |
-
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
|
2773 |
-
killEvent(e);
|
2774 |
-
return;
|
2775 |
-
case KEY.ENTER:
|
2776 |
-
this.selectHighlighted();
|
2777 |
-
killEvent(e);
|
2778 |
-
return;
|
2779 |
-
case KEY.TAB:
|
2780 |
-
this.selectHighlighted({noFocus:true});
|
2781 |
-
this.close();
|
2782 |
-
return;
|
2783 |
-
case KEY.ESC:
|
2784 |
-
this.cancel(e);
|
2785 |
-
killEvent(e);
|
2786 |
-
return;
|
2787 |
-
}
|
2788 |
-
}
|
2789 |
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
}
|
2794 |
|
2795 |
-
|
2796 |
-
|
2797 |
-
return;
|
2798 |
-
} else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
|
2799 |
-
return;
|
2800 |
-
}
|
2801 |
-
}
|
2802 |
|
2803 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2804 |
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
}
|
2809 |
|
2810 |
-
|
2811 |
-
// prevent form from being submitted
|
2812 |
-
killEvent(e);
|
2813 |
-
}
|
2814 |
|
2815 |
-
|
|
|
|
|
|
|
|
|
2816 |
|
2817 |
-
|
2818 |
-
|
2819 |
-
this.resizeSearch();
|
2820 |
-
})
|
2821 |
-
);
|
2822 |
|
2823 |
-
|
2824 |
-
|
2825 |
-
this.search.removeClass("select2-focused");
|
2826 |
-
this.selectChoice(null);
|
2827 |
-
if (!this.opened()) this.clearSearch();
|
2828 |
-
e.stopImmediatePropagation();
|
2829 |
-
this.opts.element.trigger($.Event("select2-blur"));
|
2830 |
-
}));
|
2831 |
-
|
2832 |
-
this.container.on("click", selector, this.bind(function (e) {
|
2833 |
-
if (!this.isInterfaceEnabled()) return;
|
2834 |
-
if ($(e.target).closest(".select2-search-choice").length > 0) {
|
2835 |
-
// clicked inside a select2 search choice, do not open
|
2836 |
-
return;
|
2837 |
-
}
|
2838 |
-
this.selectChoice(null);
|
2839 |
-
this.clearPlaceholder();
|
2840 |
-
if (!this.container.hasClass("select2-container-active")) {
|
2841 |
-
this.opts.element.trigger($.Event("select2-focus"));
|
2842 |
-
}
|
2843 |
-
this.open();
|
2844 |
-
this.focusSearch();
|
2845 |
-
e.preventDefault();
|
2846 |
-
}));
|
2847 |
-
|
2848 |
-
this.container.on("focus", selector, this.bind(function () {
|
2849 |
-
if (!this.isInterfaceEnabled()) return;
|
2850 |
-
if (!this.container.hasClass("select2-container-active")) {
|
2851 |
-
this.opts.element.trigger($.Event("select2-focus"));
|
2852 |
-
}
|
2853 |
-
this.container.addClass("select2-container-active");
|
2854 |
-
this.dropdown.addClass("select2-drop-active");
|
2855 |
-
this.clearPlaceholder();
|
2856 |
-
}));
|
2857 |
|
2858 |
-
|
2859 |
-
|
|
|
2860 |
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2864 |
|
2865 |
-
|
2866 |
-
|
2867 |
-
if (this.parent.enableInterface.apply(this, arguments)) {
|
2868 |
-
this.search.prop("disabled", !this.isInterfaceEnabled());
|
2869 |
-
}
|
2870 |
-
},
|
2871 |
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
if (this.opts.element.val() === "" && this.opts.element.text() === "") {
|
2876 |
-
this.updateSelection([]);
|
2877 |
-
this.close();
|
2878 |
-
// set the placeholder if necessary
|
2879 |
-
this.clearSearch();
|
2880 |
-
}
|
2881 |
-
if (this.select || this.opts.element.val() !== "") {
|
2882 |
-
var self = this;
|
2883 |
-
this.opts.initSelection.call(null, this.opts.element, function(data){
|
2884 |
-
if (data !== undefined && data !== null) {
|
2885 |
-
self.updateSelection(data);
|
2886 |
-
self.close();
|
2887 |
-
// set the placeholder if necessary
|
2888 |
-
self.clearSearch();
|
2889 |
-
}
|
2890 |
-
});
|
2891 |
-
}
|
2892 |
-
},
|
2893 |
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
|
2904 |
-
} else {
|
2905 |
-
this.search.val("").width(10);
|
2906 |
-
}
|
2907 |
-
},
|
2908 |
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
},
|
2915 |
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
|
|
|
|
|
|
2920 |
|
2921 |
-
|
2922 |
|
2923 |
-
|
2924 |
|
2925 |
-
|
2926 |
-
// ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
|
2927 |
-
if(this.search.val() === "") {
|
2928 |
-
if(this.nextSearchTerm != undefined){
|
2929 |
-
this.search.val(this.nextSearchTerm);
|
2930 |
-
this.search.select();
|
2931 |
-
}
|
2932 |
-
}
|
2933 |
|
2934 |
-
|
2935 |
-
if (this.opts.shouldFocusInput(this)) {
|
2936 |
-
this.search.focus();
|
2937 |
-
}
|
2938 |
-
this.opts.element.trigger($.Event("select2-open"));
|
2939 |
-
},
|
2940 |
|
2941 |
-
|
2942 |
-
|
2943 |
-
if (!this.opened()) return;
|
2944 |
-
this.parent.close.apply(this, arguments);
|
2945 |
-
},
|
2946 |
|
2947 |
-
|
2948 |
-
|
2949 |
-
this.close();
|
2950 |
-
this.search.focus();
|
2951 |
-
},
|
2952 |
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
|
|
2957 |
|
2958 |
-
|
2959 |
-
updateSelection: function (data) {
|
2960 |
-
var ids = [], filtered = [], self = this;
|
2961 |
|
2962 |
-
|
2963 |
-
|
2964 |
-
if (indexOf(self.id(this), ids) < 0) {
|
2965 |
-
ids.push(self.id(this));
|
2966 |
-
filtered.push(this);
|
2967 |
-
}
|
2968 |
-
});
|
2969 |
-
data = filtered;
|
2970 |
-
|
2971 |
-
this.selection.find(".select2-search-choice").remove();
|
2972 |
-
$(data).each(function () {
|
2973 |
-
self.addSelectedChoice(this);
|
2974 |
-
});
|
2975 |
-
self.postprocessResults();
|
2976 |
-
},
|
2977 |
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
this.open();
|
2986 |
-
}
|
2987 |
-
}
|
2988 |
|
2989 |
-
|
2990 |
|
2991 |
-
|
2992 |
-
|
2993 |
|
2994 |
-
|
|
|
|
|
|
|
2995 |
|
2996 |
-
|
|
|
|
|
|
|
|
|
|
|
2997 |
|
2998 |
-
|
|
|
2999 |
|
3000 |
-
|
3001 |
-
|
|
|
|
|
3002 |
|
3003 |
-
|
3004 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3005 |
|
3006 |
-
|
3007 |
|
3008 |
-
|
3009 |
-
|
3010 |
-
this.search.width(10);
|
3011 |
-
} else {
|
3012 |
-
if (this.countSelectableResults()>0) {
|
3013 |
-
this.search.width(10);
|
3014 |
-
this.resizeSearch();
|
3015 |
-
if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
|
3016 |
-
// if we reached max selection size repaint the results so choices
|
3017 |
-
// are replaced with the max selection reached message
|
3018 |
-
this.updateResults(true);
|
3019 |
-
} else {
|
3020 |
-
// initializes search's value with nextSearchTerm and update search result
|
3021 |
-
if(this.nextSearchTerm != undefined){
|
3022 |
-
this.search.val(this.nextSearchTerm);
|
3023 |
-
this.updateResults();
|
3024 |
-
this.search.select();
|
3025 |
-
}
|
3026 |
-
}
|
3027 |
-
this.positionDropdown();
|
3028 |
-
} else {
|
3029 |
-
// if nothing left to select close
|
3030 |
-
this.close();
|
3031 |
-
this.search.width(10);
|
3032 |
-
}
|
3033 |
-
}
|
3034 |
|
3035 |
-
|
3036 |
-
// added we do not need to check if this is a new element before firing change
|
3037 |
-
this.triggerChange({ added: data });
|
3038 |
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
|
3043 |
-
|
3044 |
-
|
3045 |
-
this.close();
|
3046 |
-
this.focusSearch();
|
3047 |
-
},
|
3048 |
|
3049 |
-
|
3050 |
-
|
3051 |
-
enabledItem = $(
|
3052 |
-
"<li class='select2-search-choice'>" +
|
3053 |
-
" <div></div>" +
|
3054 |
-
" <a href='#' class='select2-search-choice-close' tabindex='-1'></a>" +
|
3055 |
-
"</li>"),
|
3056 |
-
disabledItem = $(
|
3057 |
-
"<li class='select2-search-choice select2-locked'>" +
|
3058 |
-
"<div></div>" +
|
3059 |
-
"</li>");
|
3060 |
-
var choice = enableChoice ? enabledItem : disabledItem,
|
3061 |
-
id = this.id(data),
|
3062 |
-
val = this.getVal(),
|
3063 |
-
formatted,
|
3064 |
-
cssClass;
|
3065 |
-
|
3066 |
-
formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
|
3067 |
-
if (formatted != undefined) {
|
3068 |
-
choice.find("div").replaceWith($("<div></div>").html(formatted));
|
3069 |
-
}
|
3070 |
-
cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
|
3071 |
-
if (cssClass != undefined) {
|
3072 |
-
choice.addClass(cssClass);
|
3073 |
-
}
|
3074 |
|
3075 |
-
|
3076 |
-
choice.find(".select2-search-choice-close")
|
3077 |
-
.on("mousedown", killEvent)
|
3078 |
-
.on("click dblclick", this.bind(function (e) {
|
3079 |
-
if (!this.isInterfaceEnabled()) return;
|
3080 |
-
|
3081 |
-
this.unselect($(e.target));
|
3082 |
-
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
3083 |
-
killEvent(e);
|
3084 |
-
this.close();
|
3085 |
-
this.focusSearch();
|
3086 |
-
})).on("focus", this.bind(function () {
|
3087 |
-
if (!this.isInterfaceEnabled()) return;
|
3088 |
-
this.container.addClass("select2-container-active");
|
3089 |
-
this.dropdown.addClass("select2-drop-active");
|
3090 |
-
}));
|
3091 |
-
}
|
3092 |
|
3093 |
-
|
3094 |
-
|
3095 |
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
|
|
3099 |
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
data,
|
3104 |
-
index;
|
3105 |
-
selected = selected.closest(".select2-search-choice");
|
3106 |
|
3107 |
-
|
3108 |
-
throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
|
3109 |
-
}
|
3110 |
|
3111 |
-
|
|
|
|
|
3112 |
|
3113 |
-
|
3114 |
-
// prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
|
3115 |
-
// and invoked on an element already removed
|
3116 |
-
return;
|
3117 |
-
}
|
3118 |
|
3119 |
-
|
3120 |
-
|
3121 |
-
evt.choice = data;
|
3122 |
-
this.opts.element.trigger(evt);
|
3123 |
|
3124 |
-
|
3125 |
-
|
3126 |
-
}
|
3127 |
|
3128 |
-
|
3129 |
-
|
3130 |
-
this.setVal(val);
|
3131 |
-
if (this.select) this.postprocessResults();
|
3132 |
-
}
|
3133 |
|
3134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3135 |
|
3136 |
-
|
3137 |
-
this.triggerChange({ removed: data });
|
3138 |
|
3139 |
-
|
3140 |
-
|
3141 |
|
3142 |
-
|
3143 |
-
postprocessResults: function (data, initial, noHighlightUpdate) {
|
3144 |
-
var val = this.getVal(),
|
3145 |
-
choices = this.results.find(".select2-result"),
|
3146 |
-
compound = this.results.find(".select2-result-with-children"),
|
3147 |
-
self = this;
|
3148 |
-
|
3149 |
-
choices.each2(function (i, choice) {
|
3150 |
-
var id = self.id(choice.data("select2-data"));
|
3151 |
-
if (indexOf(id, val) >= 0) {
|
3152 |
-
choice.addClass("select2-selected");
|
3153 |
-
// mark all children of the selected parent as selected
|
3154 |
-
choice.find(".select2-result-selectable").addClass("select2-selected");
|
3155 |
-
}
|
3156 |
-
});
|
3157 |
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
&& choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
|
3162 |
-
choice.addClass("select2-selected");
|
3163 |
-
}
|
3164 |
-
});
|
3165 |
|
3166 |
-
|
3167 |
-
|
3168 |
-
}
|
3169 |
|
3170 |
-
|
3171 |
-
|
3172 |
-
if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
|
3173 |
-
if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
|
3174 |
-
this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.opts.element, self.search.val()) + "</li>");
|
3175 |
-
}
|
3176 |
-
}
|
3177 |
-
}
|
3178 |
|
3179 |
-
|
3180 |
|
3181 |
-
|
3182 |
-
|
3183 |
-
return this.selection.width() - getSideBorderPadding(this.search);
|
3184 |
-
},
|
3185 |
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
|
3191 |
-
|
|
|
|
|
3192 |
|
3193 |
-
|
3194 |
|
3195 |
-
|
3196 |
-
|
|
|
3197 |
|
3198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3199 |
|
3200 |
-
|
3201 |
-
|
3202 |
-
}
|
3203 |
|
3204 |
-
|
3205 |
-
|
3206 |
-
}
|
3207 |
|
3208 |
-
|
3209 |
-
|
3210 |
-
}
|
3211 |
|
3212 |
-
|
3213 |
-
|
3214 |
|
3215 |
-
|
3216 |
-
|
3217 |
-
var val;
|
3218 |
-
if (this.select) {
|
3219 |
-
val = this.select.val();
|
3220 |
-
return val === null ? [] : val;
|
3221 |
-
} else {
|
3222 |
-
val = this.opts.element.val();
|
3223 |
-
return splitVal(val, this.opts.separator, this.opts.transformVal);
|
3224 |
-
}
|
3225 |
-
},
|
3226 |
|
3227 |
-
|
3228 |
-
|
3229 |
-
var unique;
|
3230 |
-
if (this.select) {
|
3231 |
-
this.select.val(val);
|
3232 |
-
} else {
|
3233 |
-
unique = [];
|
3234 |
-
// filter out duplicates
|
3235 |
-
$(val).each(function () {
|
3236 |
-
if (indexOf(this, unique) < 0) unique.push(this);
|
3237 |
-
});
|
3238 |
-
this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
|
3239 |
-
}
|
3240 |
-
},
|
3241 |
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
old = old.slice(0);
|
3246 |
-
|
3247 |
-
// remove intersection from each array
|
3248 |
-
for (var i = 0; i < current.length; i++) {
|
3249 |
-
for (var j = 0; j < old.length; j++) {
|
3250 |
-
if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
|
3251 |
-
current.splice(i, 1);
|
3252 |
-
if(i>0){
|
3253 |
-
i--;
|
3254 |
-
}
|
3255 |
-
old.splice(j, 1);
|
3256 |
-
j--;
|
3257 |
-
}
|
3258 |
-
}
|
3259 |
-
}
|
3260 |
|
3261 |
-
|
3262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3263 |
|
|
|
|
|
3264 |
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
|
|
|
|
|
|
3272 |
|
3273 |
-
|
3274 |
-
|
|
|
3275 |
|
3276 |
-
|
3277 |
-
|
3278 |
-
this.opts.element.val("");
|
3279 |
-
this.updateSelection([]);
|
3280 |
-
this.clearSearch();
|
3281 |
-
if (triggerChange) {
|
3282 |
-
this.triggerChange({added: this.data(), removed: oldData});
|
3283 |
-
}
|
3284 |
-
return;
|
3285 |
-
}
|
3286 |
|
3287 |
-
|
3288 |
-
this.setVal(val);
|
3289 |
|
3290 |
-
|
3291 |
-
|
3292 |
-
if (triggerChange) {
|
3293 |
-
this.triggerChange(this.buildChangeDetails(oldData, this.data()));
|
3294 |
-
}
|
3295 |
-
} else {
|
3296 |
-
if (this.opts.initSelection === undefined) {
|
3297 |
-
throw new Error("val() cannot be called if initSelection() is not defined");
|
3298 |
-
}
|
3299 |
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
this.clearSearch();
|
3311 |
-
},
|
3312 |
|
3313 |
-
|
3314 |
-
|
3315 |
-
if (this.select) {
|
3316 |
-
throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
|
3317 |
-
}
|
3318 |
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
|
|
|
|
3324 |
|
3325 |
-
|
3326 |
-
|
|
|
|
|
|
|
3327 |
|
3328 |
-
|
|
|
|
|
|
|
3329 |
|
3330 |
-
|
3331 |
-
|
3332 |
-
// make sure the search container is the last item in the list
|
3333 |
-
this.searchContainer.appendTo(this.searchContainer.parent());
|
3334 |
-
// since we collapsed the width in dragStarted, we resize it here
|
3335 |
-
this.resizeSearch();
|
3336 |
|
3337 |
-
|
3338 |
-
this.selection.find(".select2-search-choice").each(function() {
|
3339 |
-
val.push(self.opts.id($(this).data("select2-data")));
|
3340 |
-
});
|
3341 |
-
this.setVal(val);
|
3342 |
-
this.triggerChange();
|
3343 |
-
},
|
3344 |
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
} else {
|
3354 |
-
old = this.data();
|
3355 |
-
if (!values) { values = []; }
|
3356 |
-
ids = $.map(values, function(e) { return self.opts.id(e); });
|
3357 |
-
this.setVal(ids);
|
3358 |
-
this.updateSelection(values);
|
3359 |
-
this.clearSearch();
|
3360 |
-
if (triggerChange) {
|
3361 |
-
this.triggerChange(this.buildChangeDetails(old, this.data()));
|
3362 |
-
}
|
3363 |
-
}
|
3364 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3365 |
});
|
|
|
3366 |
|
3367 |
-
|
|
|
3368 |
|
3369 |
-
|
3370 |
-
|
3371 |
-
select2,
|
3372 |
-
method, value, multiple,
|
3373 |
-
allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
|
3374 |
-
valueMethods = ["opened", "isFocused", "container", "dropdown"],
|
3375 |
-
propertyMethods = ["val", "data"],
|
3376 |
-
methodsMap = { search: "externalSearch" };
|
3377 |
|
3378 |
-
|
3379 |
-
if (args.length === 0 || typeof(args[0]) === "object") {
|
3380 |
-
opts = args.length === 0 ? {} : $.extend({}, args[0]);
|
3381 |
-
opts.element = $(this);
|
3382 |
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
3387 |
-
if ("tags" in opts) {opts.multiple = multiple = true;}
|
3388 |
-
}
|
3389 |
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
|
|
3393 |
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
|
|
3397 |
|
3398 |
-
|
3399 |
-
|
3400 |
-
if (select2 === undefined) return;
|
3401 |
|
3402 |
-
|
|
|
3403 |
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3416 |
}
|
3417 |
} else {
|
3418 |
-
|
3419 |
}
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
// plugin defaults, accessible to users
|
3425 |
-
$.fn.select2.defaults = {
|
3426 |
-
width: "copy",
|
3427 |
-
loadMorePadding: 0,
|
3428 |
-
closeOnSelect: true,
|
3429 |
-
openOnEnter: true,
|
3430 |
-
containerCss: {},
|
3431 |
-
dropdownCss: {},
|
3432 |
-
containerCssClass: "",
|
3433 |
-
dropdownCssClass: "",
|
3434 |
-
formatResult: function(result, container, query, escapeMarkup) {
|
3435 |
-
var markup=[];
|
3436 |
-
markMatch(this.text(result), query.term, markup, escapeMarkup);
|
3437 |
-
return markup.join("");
|
3438 |
-
},
|
3439 |
-
transformVal: function(val) {
|
3440 |
-
return $.trim(val);
|
3441 |
},
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
formatResultCssClass: function(data) {return data.css;},
|
3449 |
-
formatSelectionCssClass: function(data, container) {return undefined;},
|
3450 |
-
minimumResultsForSearch: 0,
|
3451 |
-
minimumInputLength: 0,
|
3452 |
-
maximumInputLength: null,
|
3453 |
-
maximumSelectionSize: 0,
|
3454 |
-
id: function (e) { return e == undefined ? null : e.id; },
|
3455 |
-
text: function (e) {
|
3456 |
-
if (e && this.data && this.data.text) {
|
3457 |
-
if ($.isFunction(this.data.text)) {
|
3458 |
-
return this.data.text(e);
|
3459 |
} else {
|
3460 |
-
|
3461 |
}
|
3462 |
-
|
3463 |
-
|
3464 |
-
|
3465 |
-
},
|
3466 |
-
matcher: function(term, text) {
|
3467 |
-
return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
|
3468 |
},
|
3469 |
-
separator: ",",
|
3470 |
-
tokenSeparators: [],
|
3471 |
-
tokenizer: defaultTokenizer,
|
3472 |
-
escapeMarkup: defaultEscapeMarkup,
|
3473 |
-
blurOnChange: false,
|
3474 |
-
selectOnBlur: false,
|
3475 |
-
adaptContainerCssClass: function(c) { return c; },
|
3476 |
-
adaptDropdownCssClass: function(c) { return null; },
|
3477 |
-
nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
|
3478 |
-
searchInputPlaceholder: '',
|
3479 |
-
createSearchChoicePosition: 'top',
|
3480 |
-
shouldFocusInput: function (instance) {
|
3481 |
-
// Attempt to detect touch devices
|
3482 |
-
var supportsTouchEvents = (('ontouchstart' in window) ||
|
3483 |
-
(navigator.msMaxTouchPoints > 0));
|
3484 |
-
|
3485 |
-
// Only devices which support touch events should be special cased
|
3486 |
-
if (!supportsTouchEvents) {
|
3487 |
-
return true;
|
3488 |
-
}
|
3489 |
|
3490 |
-
|
3491 |
-
|
3492 |
-
|
|
|
|
|
3493 |
}
|
|
|
|
|
3494 |
|
3495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3496 |
}
|
3497 |
};
|
3498 |
|
3499 |
-
$.fn.
|
3500 |
-
|
3501 |
-
|
3502 |
-
|
3503 |
-
formatNoMatches: function () { return "No matches found"; },
|
3504 |
-
formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; },
|
3505 |
-
formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
|
3506 |
-
formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
|
3507 |
-
formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
|
3508 |
-
formatLoadMore: function (pageNumber) { return "Loading more results…"; },
|
3509 |
-
formatSearching: function () { return "Searching…"; }
|
3510 |
-
};
|
3511 |
|
3512 |
-
|
|
|
|
|
|
|
3513 |
|
3514 |
-
|
3515 |
-
|
3516 |
-
|
3517 |
-
|
3518 |
-
|
3519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3520 |
}
|
3521 |
-
};
|
3522 |
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
3526 |
-
|
3527 |
-
|
3528 |
-
|
3529 |
-
|
3530 |
-
debounce: debounce,
|
3531 |
-
markMatch: markMatch,
|
3532 |
-
escapeMarkup: defaultEscapeMarkup,
|
3533 |
-
stripDiacritics: stripDiacritics
|
3534 |
-
}, "class": {
|
3535 |
-
"abstract": AbstractSelect2,
|
3536 |
-
"single": SingleSelect2,
|
3537 |
-
"multi": MultiSelect2
|
3538 |
}
|
3539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3540 |
|
3541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Select2 4.0.6-rc.1
|
3 |
+
* https://select2.github.io
|
4 |
+
*
|
5 |
+
* Released under the MIT license
|
6 |
+
* https://github.com/select2/select2/blob/master/LICENSE.md
|
7 |
+
*/
|
8 |
+
;(function (factory) {
|
9 |
+
if (typeof define === 'function' && define.amd) {
|
10 |
+
// AMD. Register as an anonymous module.
|
11 |
+
define(['jquery'], factory);
|
12 |
+
} else if (typeof module === 'object' && module.exports) {
|
13 |
+
// Node/CommonJS
|
14 |
+
module.exports = function (root, jQuery) {
|
15 |
+
if (jQuery === undefined) {
|
16 |
+
// require('jQuery') returns a factory that requires window to
|
17 |
+
// build a jQuery instance, we normalize how we use modules
|
18 |
+
// that require this pattern but the window provided is a noop
|
19 |
+
// if it's defined (how jquery works)
|
20 |
+
if (typeof window !== 'undefined') {
|
21 |
+
jQuery = require('jquery');
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
jQuery = require('jquery')(root);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
factory(jQuery);
|
28 |
+
return jQuery;
|
29 |
+
};
|
30 |
+
} else {
|
31 |
+
// Browser globals
|
32 |
+
factory(jQuery);
|
33 |
+
}
|
34 |
+
} (function (jQuery) {
|
35 |
+
// This is needed so we can catch the AMD loader configuration and use it
|
36 |
+
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
37 |
+
// returns the AMD loader references.
|
38 |
+
var S2 =(function () {
|
39 |
+
// Restore the Select2 AMD loader so it can be used
|
40 |
+
// Needed mostly in the language files, where the loader is not inserted
|
41 |
+
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
42 |
+
var S2 = jQuery.fn.select2.amd;
|
43 |
+
}
|
44 |
+
var S2;(function () { if (!S2 || !S2.requirejs) {
|
45 |
+
if (!S2) { S2 = {}; } else { require = S2; }
|
46 |
+
/**
|
47 |
+
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
|
48 |
+
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
|
49 |
+
*/
|
50 |
+
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
51 |
+
//be followed.
|
52 |
+
/*global setTimeout: false */
|
53 |
+
|
54 |
+
var requirejs, require, define;
|
55 |
+
(function (undef) {
|
56 |
+
var main, req, makeMap, handlers,
|
57 |
+
defined = {},
|
58 |
+
waiting = {},
|
59 |
+
config = {},
|
60 |
+
defining = {},
|
61 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
62 |
+
aps = [].slice,
|
63 |
+
jsSuffixRegExp = /\.js$/;
|
64 |
+
|
65 |
+
function hasProp(obj, prop) {
|
66 |
+
return hasOwn.call(obj, prop);
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Given a relative module name, like ./something, normalize it to
|
71 |
+
* a real name that can be mapped to a path.
|
72 |
+
* @param {String} name the relative name
|
73 |
+
* @param {String} baseName a real name that the name arg is relative
|
74 |
+
* to.
|
75 |
+
* @returns {String} normalized name
|
76 |
+
*/
|
77 |
+
function normalize(name, baseName) {
|
78 |
+
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
79 |
+
foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
|
80 |
+
baseParts = baseName && baseName.split("/"),
|
81 |
+
map = config.map,
|
82 |
+
starMap = (map && map['*']) || {};
|
83 |
+
|
84 |
+
//Adjust any relative paths.
|
85 |
+
if (name) {
|
86 |
+
name = name.split('/');
|
87 |
+
lastIndex = name.length - 1;
|
88 |
+
|
89 |
+
// If wanting node ID compatibility, strip .js from end
|
90 |
+
// of IDs. Have to do this here, and not in nameToUrl
|
91 |
+
// because node allows either .js or non .js to map
|
92 |
+
// to same file.
|
93 |
+
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
94 |
+
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
|
|
|
|
|
|
95 |
}
|
96 |
+
|
97 |
+
// Starts with a '.' so need the baseName
|
98 |
+
if (name[0].charAt(0) === '.' && baseParts) {
|
99 |
+
//Convert baseName to array, and lop off the last part,
|
100 |
+
//so that . matches that 'directory' and not name of the baseName's
|
101 |
+
//module. For instance, baseName of 'one/two/three', maps to
|
102 |
+
//'one/two/three.js', but we want the directory, 'one/two' for
|
103 |
+
//this normalization.
|
104 |
+
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
105 |
+
name = normalizedBaseParts.concat(name);
|
106 |
}
|
107 |
|
108 |
+
//start trimDots
|
109 |
+
for (i = 0; i < name.length; i++) {
|
110 |
+
part = name[i];
|
111 |
+
if (part === '.') {
|
112 |
+
name.splice(i, 1);
|
113 |
+
i -= 1;
|
114 |
+
} else if (part === '..') {
|
115 |
+
// If at the start, or previous value is still ..,
|
116 |
+
// keep them so that when converted to a path it may
|
117 |
+
// still work when converted to a path, even though
|
118 |
+
// as an ID it is less than ideal. In larger point
|
119 |
+
// releases, may be better to just kick out an error.
|
120 |
+
if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
|
121 |
+
continue;
|
122 |
+
} else if (i > 0) {
|
123 |
+
name.splice(i - 1, 2);
|
124 |
+
i -= 2;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
//end trimDots
|
129 |
|
130 |
+
name = name.join('/');
|
|
|
|
|
|
|
|
|
131 |
}
|
|
|
|
|
132 |
|
133 |
+
//Apply map config if available.
|
134 |
+
if ((baseParts || starMap) && map) {
|
135 |
+
nameParts = name.split('/');
|
136 |
+
|
137 |
+
for (i = nameParts.length; i > 0; i -= 1) {
|
138 |
+
nameSegment = nameParts.slice(0, i).join("/");
|
139 |
+
|
140 |
+
if (baseParts) {
|
141 |
+
//Find the longest baseName segment match in the config.
|
142 |
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
143 |
+
for (j = baseParts.length; j > 0; j -= 1) {
|
144 |
+
mapValue = map[baseParts.slice(0, j).join('/')];
|
145 |
+
|
146 |
+
//baseName segment has config, find if it has one for
|
147 |
+
//this name.
|
148 |
+
if (mapValue) {
|
149 |
+
mapValue = mapValue[nameSegment];
|
150 |
+
if (mapValue) {
|
151 |
+
//Match, update name to the new value.
|
152 |
+
foundMap = mapValue;
|
153 |
+
foundI = i;
|
154 |
+
break;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
|
160 |
+
if (foundMap) {
|
161 |
+
break;
|
162 |
+
}
|
163 |
|
164 |
+
//Check for a star map match, but just hold on to it,
|
165 |
+
//if there is a shorter segment match later in a matching
|
166 |
+
//config, then favor over this star map.
|
167 |
+
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
168 |
+
foundStarMap = starMap[nameSegment];
|
169 |
+
starI = i;
|
170 |
+
}
|
171 |
+
}
|
172 |
|
173 |
+
if (!foundMap && foundStarMap) {
|
174 |
+
foundMap = foundStarMap;
|
175 |
+
foundI = starI;
|
176 |
+
}
|
177 |
|
178 |
+
if (foundMap) {
|
179 |
+
nameParts.splice(0, foundI, foundMap);
|
180 |
+
name = nameParts.join('/');
|
181 |
+
}
|
182 |
+
}
|
183 |
|
184 |
+
return name;
|
|
|
|
|
185 |
}
|
186 |
|
187 |
+
function makeRequire(relName, forceSync) {
|
188 |
+
return function () {
|
189 |
+
//A version of a require function that passes a moduleName
|
190 |
+
//value for items that may need to
|
191 |
+
//look up paths relative to the moduleName
|
192 |
+
var args = aps.call(arguments, 0);
|
193 |
+
|
194 |
+
//If first arg is not require('string'), and there is only
|
195 |
+
//one arg, it is the array form without a callback. Insert
|
196 |
+
//a null so that the following concat is correct.
|
197 |
+
if (typeof args[0] !== 'string' && args.length === 1) {
|
198 |
+
args.push(null);
|
199 |
+
}
|
200 |
+
return req.apply(undef, args.concat([relName, forceSync]));
|
201 |
+
};
|
202 |
+
}
|
203 |
|
204 |
+
function makeNormalize(relName) {
|
205 |
+
return function (name) {
|
206 |
+
return normalize(name, relName);
|
207 |
+
};
|
208 |
}
|
209 |
|
210 |
+
function makeLoad(depName) {
|
211 |
+
return function (value) {
|
212 |
+
defined[depName] = value;
|
213 |
+
};
|
|
|
|
|
214 |
}
|
215 |
|
216 |
+
function callDep(name) {
|
217 |
+
if (hasProp(waiting, name)) {
|
218 |
+
var args = waiting[name];
|
219 |
+
delete waiting[name];
|
220 |
+
defining[name] = true;
|
221 |
+
main.apply(undef, args);
|
222 |
+
}
|
223 |
|
224 |
+
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
225 |
+
throw new Error('No ' + name);
|
226 |
+
}
|
227 |
+
return defined[name];
|
228 |
+
}
|
229 |
|
230 |
+
//Turns a plugin!resource to [plugin, resource]
|
231 |
+
//with the plugin being undefined if the name
|
232 |
+
//did not have a plugin prefix.
|
233 |
+
function splitPrefix(name) {
|
234 |
+
var prefix,
|
235 |
+
index = name ? name.indexOf('!') : -1;
|
236 |
+
if (index > -1) {
|
237 |
+
prefix = name.substring(0, index);
|
238 |
+
name = name.substring(index + 1, name.length);
|
239 |
+
}
|
240 |
+
return [prefix, name];
|
241 |
}
|
242 |
|
243 |
+
//Creates a parts array for a relName where first part is plugin ID,
|
244 |
+
//second part is resource ID. Assumes relName has already been normalized.
|
245 |
+
function makeRelParts(relName) {
|
246 |
+
return relName ? splitPrefix(relName) : [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
+
* Makes a name map, normalizing the name, and using a plugin
|
251 |
+
* for normalization if necessary. Grabs a ref to plugin
|
252 |
+
* too, as an optimization.
|
|
|
253 |
*/
|
254 |
+
makeMap = function (name, relParts) {
|
255 |
+
var plugin,
|
256 |
+
parts = splitPrefix(name),
|
257 |
+
prefix = parts[0],
|
258 |
+
relResourceName = relParts[1];
|
|
|
|
|
259 |
|
260 |
+
name = parts[1];
|
|
|
|
|
261 |
|
262 |
+
if (prefix) {
|
263 |
+
prefix = normalize(prefix, relResourceName);
|
264 |
+
plugin = callDep(prefix);
|
265 |
+
}
|
266 |
+
|
267 |
+
//Normalize according
|
268 |
+
if (prefix) {
|
269 |
+
if (plugin && plugin.normalize) {
|
270 |
+
name = plugin.normalize(name, makeNormalize(relResourceName));
|
271 |
+
} else {
|
272 |
+
name = normalize(name, relResourceName);
|
273 |
}
|
274 |
+
} else {
|
275 |
+
name = normalize(name, relResourceName);
|
276 |
+
parts = splitPrefix(name);
|
277 |
+
prefix = parts[0];
|
278 |
+
name = parts[1];
|
279 |
+
if (prefix) {
|
280 |
+
plugin = callDep(prefix);
|
281 |
}
|
282 |
+
}
|
|
|
|
|
283 |
|
284 |
+
//Using ridiculous property names for space reasons
|
285 |
+
return {
|
286 |
+
f: prefix ? prefix + '!' + name : name, //fullName
|
287 |
+
n: name,
|
288 |
+
pr: prefix,
|
289 |
+
p: plugin
|
290 |
+
};
|
291 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
|
293 |
+
function makeConfig(name) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
return function () {
|
295 |
+
return (config && config.config && config.config[name]) || {};
|
|
|
|
|
|
|
|
|
296 |
};
|
297 |
}
|
298 |
|
299 |
+
handlers = {
|
300 |
+
require: function (name) {
|
301 |
+
return makeRequire(name);
|
302 |
+
},
|
303 |
+
exports: function (name) {
|
304 |
+
var e = defined[name];
|
305 |
+
if (typeof e !== 'undefined') {
|
306 |
+
return e;
|
307 |
+
} else {
|
308 |
+
return (defined[name] = {});
|
309 |
+
}
|
310 |
+
},
|
311 |
+
module: function (name) {
|
312 |
+
return {
|
313 |
+
id: name,
|
314 |
+
uri: '',
|
315 |
+
exports: defined[name],
|
316 |
+
config: makeConfig(name)
|
317 |
+
};
|
318 |
+
}
|
319 |
+
};
|
|
|
320 |
|
321 |
+
main = function (name, deps, callback, relName) {
|
322 |
+
var cjsModule, depName, ret, map, i, relParts,
|
323 |
+
args = [],
|
324 |
+
callbackType = typeof callback,
|
325 |
+
usingExports;
|
326 |
+
|
327 |
+
//Use name if no relName
|
328 |
+
relName = relName || name;
|
329 |
+
relParts = makeRelParts(relName);
|
330 |
+
|
331 |
+
//Call the callback to define the module, if necessary.
|
332 |
+
if (callbackType === 'undefined' || callbackType === 'function') {
|
333 |
+
//Pull out the defined dependencies and pass the ordered
|
334 |
+
//values to the callback.
|
335 |
+
//Default to [require, exports, module] if no deps
|
336 |
+
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
337 |
+
for (i = 0; i < deps.length; i += 1) {
|
338 |
+
map = makeMap(deps[i], relParts);
|
339 |
+
depName = map.f;
|
340 |
+
|
341 |
+
//Fast path CommonJS standard dependencies.
|
342 |
+
if (depName === "require") {
|
343 |
+
args[i] = handlers.require(name);
|
344 |
+
} else if (depName === "exports") {
|
345 |
+
//CommonJS module spec 1.1
|
346 |
+
args[i] = handlers.exports(name);
|
347 |
+
usingExports = true;
|
348 |
+
} else if (depName === "module") {
|
349 |
+
//CommonJS module spec 1.1
|
350 |
+
cjsModule = args[i] = handlers.module(name);
|
351 |
+
} else if (hasProp(defined, depName) ||
|
352 |
+
hasProp(waiting, depName) ||
|
353 |
+
hasProp(defining, depName)) {
|
354 |
+
args[i] = callDep(depName);
|
355 |
+
} else if (map.p) {
|
356 |
+
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
357 |
+
args[i] = defined[depName];
|
358 |
+
} else {
|
359 |
+
throw new Error(name + ' missing ' + depName);
|
360 |
}
|
361 |
+
}
|
362 |
+
|
363 |
+
ret = callback ? callback.apply(defined[name], args) : undefined;
|
364 |
+
|
365 |
+
if (name) {
|
366 |
+
//If setting exports via "module" is in play,
|
367 |
+
//favor that over return value and exports. After that,
|
368 |
+
//favor a non-undefined return value over exports use.
|
369 |
+
if (cjsModule && cjsModule.exports !== undef &&
|
370 |
+
cjsModule.exports !== defined[name]) {
|
371 |
+
defined[name] = cjsModule.exports;
|
372 |
+
} else if (ret !== undef || !usingExports) {
|
373 |
+
//Use the return value from the function.
|
374 |
+
defined[name] = ret;
|
375 |
}
|
376 |
}
|
377 |
+
} else if (name) {
|
378 |
+
//May just be an object definition for the module. Only
|
379 |
+
//worry about defining if have a module name.
|
380 |
+
defined[name] = callback;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
+
};
|
|
|
|
|
383 |
|
384 |
+
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
385 |
+
if (typeof deps === "string") {
|
386 |
+
if (handlers[deps]) {
|
387 |
+
//callback in this case is really relName
|
388 |
+
return handlers[deps](callback);
|
389 |
+
}
|
390 |
+
//Just return the module wanted. In this scenario, the
|
391 |
+
//deps arg is the module name, and second arg (if passed)
|
392 |
+
//is just the relName.
|
393 |
+
//Normalize module name, if it contains . or ..
|
394 |
+
return callDep(makeMap(deps, makeRelParts(callback)).f);
|
395 |
+
} else if (!deps.splice) {
|
396 |
+
//deps is a config object, not an array.
|
397 |
+
config = deps;
|
398 |
+
if (config.deps) {
|
399 |
+
req(config.deps, config.callback);
|
400 |
+
}
|
401 |
+
if (!callback) {
|
402 |
+
return;
|
403 |
+
}
|
404 |
|
405 |
+
if (callback.splice) {
|
406 |
+
//callback is an array, which means it is a dependency list.
|
407 |
+
//Adjust args if there are dependencies
|
408 |
+
deps = callback;
|
409 |
+
callback = relName;
|
410 |
+
relName = null;
|
411 |
+
} else {
|
412 |
+
deps = undef;
|
413 |
+
}
|
414 |
+
}
|
415 |
|
416 |
+
//Support require(['a'])
|
417 |
+
callback = callback || function () {};
|
418 |
|
419 |
+
//If relName is a function, it is an errback handler,
|
420 |
+
//so remove it.
|
421 |
+
if (typeof relName === 'function') {
|
422 |
+
relName = forceSync;
|
423 |
+
forceSync = alt;
|
424 |
}
|
425 |
|
426 |
+
//Simulate async callback;
|
427 |
+
if (forceSync) {
|
428 |
+
main(undef, deps, callback, relName);
|
429 |
+
} else {
|
430 |
+
//Using a non-zero value because of concern for what old browsers
|
431 |
+
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
432 |
+
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
433 |
+
//If want a value immediately, use require('id') instead -- something
|
434 |
+
//that works in almond on the global level, but not guaranteed and
|
435 |
+
//unlikely to work in other AMD implementations.
|
436 |
+
setTimeout(function () {
|
437 |
+
main(undef, deps, callback, relName);
|
438 |
+
}, 4);
|
439 |
+
}
|
440 |
|
441 |
+
return req;
|
442 |
+
};
|
|
|
443 |
|
444 |
+
/**
|
445 |
+
* Just drops the config on the floor, but returns req in case
|
446 |
+
* the config return value is used.
|
447 |
+
*/
|
448 |
+
req.config = function (cfg) {
|
449 |
+
return req(cfg);
|
450 |
+
};
|
451 |
|
452 |
+
/**
|
453 |
+
* Expose module registry for debugging and tooling
|
454 |
+
*/
|
455 |
+
requirejs._defined = defined;
|
456 |
|
457 |
+
define = function (name, deps, callback) {
|
458 |
+
if (typeof name !== 'string') {
|
459 |
+
throw new Error('See almond README: incorrect module build, no module name');
|
460 |
+
}
|
461 |
|
462 |
+
//This module may not have dependencies
|
463 |
+
if (!deps.splice) {
|
464 |
+
//deps is not an array, so probably means
|
465 |
+
//an object literal or factory function for
|
466 |
+
//the value. Adjust args.
|
467 |
+
callback = deps;
|
468 |
+
deps = [];
|
469 |
+
}
|
470 |
|
471 |
+
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
472 |
+
waiting[name] = [name, deps, callback];
|
|
|
473 |
}
|
474 |
+
};
|
475 |
|
476 |
+
define.amd = {
|
477 |
+
jQuery: true
|
478 |
+
};
|
479 |
+
}());
|
480 |
+
|
481 |
+
S2.requirejs = requirejs;S2.require = require;S2.define = define;
|
482 |
+
}
|
483 |
+
}());
|
484 |
+
S2.define("almond", function(){});
|
485 |
+
|
486 |
+
/* global jQuery:false, $:false */
|
487 |
+
S2.define('jquery',[],function () {
|
488 |
+
var _$ = jQuery || $;
|
489 |
+
|
490 |
+
if (_$ == null && console && console.error) {
|
491 |
+
console.error(
|
492 |
+
'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
|
493 |
+
'found. Make sure that you are including jQuery before Select2 on your ' +
|
494 |
+
'web page.'
|
495 |
+
);
|
496 |
+
}
|
497 |
+
|
498 |
+
return _$;
|
499 |
+
});
|
500 |
+
|
501 |
+
S2.define('select2/utils',[
|
502 |
+
'jquery'
|
503 |
+
], function ($) {
|
504 |
+
var Utils = {};
|
505 |
+
|
506 |
+
Utils.Extend = function (ChildClass, SuperClass) {
|
507 |
+
var __hasProp = {}.hasOwnProperty;
|
508 |
+
|
509 |
+
function BaseConstructor () {
|
510 |
+
this.constructor = ChildClass;
|
511 |
+
}
|
512 |
|
513 |
+
for (var key in SuperClass) {
|
514 |
+
if (__hasProp.call(SuperClass, key)) {
|
515 |
+
ChildClass[key] = SuperClass[key];
|
516 |
+
}
|
517 |
}
|
518 |
|
519 |
+
BaseConstructor.prototype = SuperClass.prototype;
|
520 |
+
ChildClass.prototype = new BaseConstructor();
|
521 |
+
ChildClass.__super__ = SuperClass.prototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
+
return ChildClass;
|
524 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
|
526 |
+
function getMethods (theClass) {
|
527 |
+
var proto = theClass.prototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
|
529 |
+
var methods = [];
|
|
|
|
|
|
|
530 |
|
531 |
+
for (var methodName in proto) {
|
532 |
+
var m = proto[methodName];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
|
534 |
+
if (typeof m !== 'function') {
|
535 |
+
continue;
|
536 |
+
}
|
|
|
|
|
|
|
537 |
|
538 |
+
if (methodName === 'constructor') {
|
539 |
+
continue;
|
540 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
|
542 |
+
methods.push(methodName);
|
|
|
|
|
543 |
}
|
544 |
|
545 |
+
return methods;
|
546 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
|
548 |
+
Utils.Decorate = function (SuperClass, DecoratorClass) {
|
549 |
+
var decoratedMethods = getMethods(DecoratorClass);
|
550 |
+
var superMethods = getMethods(SuperClass);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
|
552 |
+
function DecoratedClass () {
|
553 |
+
var unshift = Array.prototype.unshift;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
|
555 |
+
var argCount = DecoratorClass.prototype.constructor.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
|
557 |
+
var calledConstructor = SuperClass.prototype.constructor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
|
559 |
+
if (argCount > 0) {
|
560 |
+
unshift.call(arguments, SuperClass.prototype.constructor);
|
561 |
|
562 |
+
calledConstructor = DecoratorClass.prototype.constructor;
|
563 |
+
}
|
564 |
|
565 |
+
calledConstructor.apply(this, arguments);
|
566 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
|
568 |
+
DecoratorClass.displayName = SuperClass.displayName;
|
|
|
|
|
|
|
569 |
|
570 |
+
function ctr () {
|
571 |
+
this.constructor = DecoratedClass;
|
572 |
}
|
573 |
|
574 |
+
DecoratedClass.prototype = new ctr();
|
|
|
575 |
|
576 |
+
for (var m = 0; m < superMethods.length; m++) {
|
577 |
+
var superMethod = superMethods[m];
|
578 |
+
|
579 |
+
DecoratedClass.prototype[superMethod] =
|
580 |
+
SuperClass.prototype[superMethod];
|
581 |
}
|
582 |
|
583 |
+
var calledMethod = function (methodName) {
|
584 |
+
// Stub out the original method if it's not decorating an actual method
|
585 |
+
var originalMethod = function () {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
|
587 |
+
if (methodName in DecoratedClass.prototype) {
|
588 |
+
originalMethod = DecoratedClass.prototype[methodName];
|
589 |
+
}
|
590 |
|
591 |
+
var decoratedMethod = DecoratorClass.prototype[methodName];
|
|
|
592 |
|
593 |
+
return function () {
|
594 |
+
var unshift = Array.prototype.unshift;
|
595 |
|
596 |
+
unshift.call(arguments, originalMethod);
|
|
|
|
|
|
|
|
|
597 |
|
598 |
+
return decoratedMethod.apply(this, arguments);
|
599 |
+
};
|
600 |
+
};
|
601 |
|
602 |
+
for (var d = 0; d < decoratedMethods.length; d++) {
|
603 |
+
var decoratedMethod = decoratedMethods[d];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
|
605 |
+
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
|
606 |
+
}
|
|
|
|
|
|
|
607 |
|
608 |
+
return DecoratedClass;
|
609 |
+
};
|
610 |
|
611 |
+
var Observable = function () {
|
612 |
+
this.listeners = {};
|
613 |
+
};
|
614 |
|
615 |
+
Observable.prototype.on = function (event, callback) {
|
616 |
+
this.listeners = this.listeners || {};
|
617 |
|
618 |
+
if (event in this.listeners) {
|
619 |
+
this.listeners[event].push(callback);
|
620 |
+
} else {
|
621 |
+
this.listeners[event] = [callback];
|
622 |
+
}
|
623 |
+
};
|
624 |
|
625 |
+
Observable.prototype.trigger = function (event) {
|
626 |
+
var slice = Array.prototype.slice;
|
627 |
+
var params = slice.call(arguments, 1);
|
628 |
|
629 |
+
this.listeners = this.listeners || {};
|
|
|
|
|
|
|
|
|
|
|
630 |
|
631 |
+
// Params should always come in as an array
|
632 |
+
if (params == null) {
|
633 |
+
params = [];
|
634 |
+
}
|
635 |
|
636 |
+
// If there are no arguments to the event, use a temporary object
|
637 |
+
if (params.length === 0) {
|
638 |
+
params.push({});
|
639 |
+
}
|
640 |
|
641 |
+
// Set the `_type` of the first object to the event
|
642 |
+
params[0]._type = event;
|
643 |
|
644 |
+
if (event in this.listeners) {
|
645 |
+
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
646 |
+
}
|
647 |
|
648 |
+
if ('*' in this.listeners) {
|
649 |
+
this.invoke(this.listeners['*'], arguments);
|
650 |
+
}
|
651 |
+
};
|
652 |
|
653 |
+
Observable.prototype.invoke = function (listeners, params) {
|
654 |
+
for (var i = 0, len = listeners.length; i < len; i++) {
|
655 |
+
listeners[i].apply(this, params);
|
656 |
+
}
|
657 |
+
};
|
658 |
|
659 |
+
Utils.Observable = Observable;
|
|
|
660 |
|
661 |
+
Utils.generateChars = function (length) {
|
662 |
+
var chars = '';
|
663 |
|
664 |
+
for (var i = 0; i < length; i++) {
|
665 |
+
var randomChar = Math.floor(Math.random() * 36);
|
666 |
+
chars += randomChar.toString(36);
|
667 |
+
}
|
668 |
|
669 |
+
return chars;
|
670 |
+
};
|
|
|
|
|
|
|
|
|
|
|
671 |
|
672 |
+
Utils.bind = function (func, context) {
|
673 |
+
return function () {
|
674 |
+
func.apply(context, arguments);
|
675 |
+
};
|
676 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
|
678 |
+
Utils._convertData = function (data) {
|
679 |
+
for (var originalKey in data) {
|
680 |
+
var keys = originalKey.split('-');
|
|
|
681 |
|
682 |
+
var dataLevel = data;
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
+
if (keys.length === 1) {
|
685 |
+
continue;
|
686 |
+
}
|
|
|
|
|
687 |
|
688 |
+
for (var k = 0; k < keys.length; k++) {
|
689 |
+
var key = keys[k];
|
690 |
|
691 |
+
// Lowercase the first letter
|
692 |
+
// By default, dash-separated becomes camelCase
|
693 |
+
key = key.substring(0, 1).toLowerCase() + key.substring(1);
|
694 |
|
695 |
+
if (!(key in dataLevel)) {
|
696 |
+
dataLevel[key] = {};
|
697 |
+
}
|
|
|
698 |
|
699 |
+
if (k == keys.length - 1) {
|
700 |
+
dataLevel[key] = data[originalKey];
|
701 |
+
}
|
702 |
|
703 |
+
dataLevel = dataLevel[key];
|
704 |
+
}
|
|
|
705 |
|
706 |
+
delete data[originalKey];
|
707 |
+
}
|
|
|
708 |
|
709 |
+
return data;
|
710 |
+
};
|
711 |
|
712 |
+
Utils.hasScroll = function (index, el) {
|
713 |
+
// Adapted from the function created by @ShadowScripter
|
714 |
+
// and adapted by @BillBarry on the Stack Exchange Code Review website.
|
715 |
+
// The original code can be found at
|
716 |
+
// http://codereview.stackexchange.com/q/13338
|
717 |
+
// and was designed to be used with the Sizzle selector engine.
|
718 |
|
719 |
+
var $el = $(el);
|
720 |
+
var overflowX = el.style.overflowX;
|
721 |
+
var overflowY = el.style.overflowY;
|
722 |
|
723 |
+
//Check both x and y declarations
|
724 |
+
if (overflowX === overflowY &&
|
725 |
+
(overflowY === 'hidden' || overflowY === 'visible')) {
|
726 |
+
return false;
|
727 |
+
}
|
728 |
|
729 |
+
if (overflowX === 'scroll' || overflowY === 'scroll') {
|
730 |
+
return true;
|
731 |
+
}
|
732 |
|
733 |
+
return ($el.innerHeight() < el.scrollHeight ||
|
734 |
+
$el.innerWidth() < el.scrollWidth);
|
735 |
+
};
|
736 |
+
|
737 |
+
Utils.escapeMarkup = function (markup) {
|
738 |
+
var replaceMap = {
|
739 |
+
'\\': '\',
|
740 |
+
'&': '&',
|
741 |
+
'<': '<',
|
742 |
+
'>': '>',
|
743 |
+
'"': '"',
|
744 |
+
'\'': ''',
|
745 |
+
'/': '/'
|
746 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
747 |
|
748 |
+
// Do not try to escape the markup if it's not a string
|
749 |
+
if (typeof markup !== 'string') {
|
750 |
+
return markup;
|
751 |
+
}
|
|
|
|
|
|
|
|
|
752 |
|
753 |
+
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
754 |
+
return replaceMap[match];
|
755 |
+
});
|
756 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
757 |
|
758 |
+
// Append an array of jQuery nodes to a given element.
|
759 |
+
Utils.appendMany = function ($element, $nodes) {
|
760 |
+
// jQuery 1.7.x does not support $.fn.append() with an array
|
761 |
+
// Fall back to a jQuery object collection using $.fn.add()
|
762 |
+
if ($.fn.jquery.substr(0, 3) === '1.7') {
|
763 |
+
var $jqNodes = $();
|
764 |
|
765 |
+
$.map($nodes, function (node) {
|
766 |
+
$jqNodes = $jqNodes.add(node);
|
767 |
+
});
|
768 |
|
769 |
+
$nodes = $jqNodes;
|
770 |
+
}
|
|
|
771 |
|
772 |
+
$element.append($nodes);
|
773 |
+
};
|
774 |
+
|
775 |
+
// Cache objects in Utils.__cache instead of $.data (see #4346)
|
776 |
+
Utils.__cache = {};
|
777 |
+
|
778 |
+
var id = 0;
|
779 |
+
Utils.GetUniqueElementId = function (element) {
|
780 |
+
// Get a unique element Id. If element has no id,
|
781 |
+
// creates a new unique number, stores it in the id
|
782 |
+
// attribute and returns the new id.
|
783 |
+
// If an id already exists, it simply returns it.
|
784 |
+
|
785 |
+
var select2Id = element.getAttribute('data-select2-id');
|
786 |
+
if (select2Id == null) {
|
787 |
+
// If element has id, use it.
|
788 |
+
if (element.id) {
|
789 |
+
select2Id = element.id;
|
790 |
+
element.setAttribute('data-select2-id', select2Id);
|
791 |
+
} else {
|
792 |
+
element.setAttribute('data-select2-id', ++id);
|
793 |
+
select2Id = id.toString();
|
794 |
+
}
|
795 |
+
}
|
796 |
+
return select2Id;
|
797 |
+
};
|
798 |
+
|
799 |
+
Utils.StoreData = function (element, name, value) {
|
800 |
+
// Stores an item in the cache for a specified element.
|
801 |
+
// name is the cache key.
|
802 |
+
var id = Utils.GetUniqueElementId(element);
|
803 |
+
if (!Utils.__cache[id]) {
|
804 |
+
Utils.__cache[id] = {};
|
805 |
+
}
|
806 |
|
807 |
+
Utils.__cache[id][name] = value;
|
808 |
+
};
|
809 |
+
|
810 |
+
Utils.GetData = function (element, name) {
|
811 |
+
// Retrieves a value from the cache by its key (name)
|
812 |
+
// name is optional. If no name specified, return
|
813 |
+
// all cache items for the specified element.
|
814 |
+
// and for a specified element.
|
815 |
+
var id = Utils.GetUniqueElementId(element);
|
816 |
+
if (name) {
|
817 |
+
if (Utils.__cache[id]) {
|
818 |
+
return Utils.__cache[id][name] != null ?
|
819 |
+
Utils.__cache[id][name]:
|
820 |
+
$(element).data(name); // Fallback to HTML5 data attribs.
|
821 |
+
}
|
822 |
+
return $(element).data(name); // Fallback to HTML5 data attribs.
|
823 |
+
} else {
|
824 |
+
return Utils.__cache[id];
|
825 |
+
}
|
826 |
+
};
|
827 |
|
828 |
+
Utils.RemoveData = function (element) {
|
829 |
+
// Removes all cached items for a specified element.
|
830 |
+
var id = Utils.GetUniqueElementId(element);
|
831 |
+
if (Utils.__cache[id] != null) {
|
832 |
+
delete Utils.__cache[id];
|
833 |
+
}
|
834 |
+
};
|
835 |
|
836 |
+
return Utils;
|
837 |
+
});
|
838 |
|
839 |
+
S2.define('select2/results',[
|
840 |
+
'jquery',
|
841 |
+
'./utils'
|
842 |
+
], function ($, Utils) {
|
843 |
+
function Results ($element, options, dataAdapter) {
|
844 |
+
this.$element = $element;
|
845 |
+
this.data = dataAdapter;
|
846 |
+
this.options = options;
|
847 |
|
848 |
+
Results.__super__.constructor.call(this);
|
849 |
+
}
|
|
|
850 |
|
851 |
+
Utils.Extend(Results, Utils.Observable);
|
852 |
|
853 |
+
Results.prototype.render = function () {
|
854 |
+
var $results = $(
|
855 |
+
'<ul class="select2-results__options" role="tree"></ul>'
|
856 |
+
);
|
857 |
|
858 |
+
if (this.options.get('multiple')) {
|
859 |
+
$results.attr('aria-multiselectable', 'true');
|
860 |
+
}
|
861 |
|
862 |
+
this.$results = $results;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
863 |
|
864 |
+
return $results;
|
865 |
+
};
|
|
|
|
|
866 |
|
867 |
+
Results.prototype.clear = function () {
|
868 |
+
this.$results.empty();
|
869 |
+
};
|
|
|
|
|
870 |
|
871 |
+
Results.prototype.displayMessage = function (params) {
|
872 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
873 |
|
874 |
+
this.clear();
|
875 |
+
this.hideLoading();
|
876 |
|
877 |
+
var $message = $(
|
878 |
+
'<li role="treeitem" aria-live="assertive"' +
|
879 |
+
' class="select2-results__option"></li>'
|
880 |
+
);
|
|
|
881 |
|
882 |
+
var message = this.options.get('translations').get(params.message);
|
|
|
|
|
883 |
|
884 |
+
$message.append(
|
885 |
+
escapeMarkup(
|
886 |
+
message(params.args)
|
887 |
+
)
|
888 |
+
);
|
889 |
|
890 |
+
$message[0].className += ' select2-results__message';
|
|
|
|
|
891 |
|
892 |
+
this.$results.append($message);
|
893 |
+
};
|
|
|
|
|
894 |
|
895 |
+
Results.prototype.hideMessages = function () {
|
896 |
+
this.$results.find('.select2-results__message').remove();
|
897 |
+
};
|
|
|
|
|
|
|
898 |
|
899 |
+
Results.prototype.append = function (data) {
|
900 |
+
this.hideLoading();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
|
902 |
+
var $options = [];
|
903 |
|
904 |
+
if (data.results == null || data.results.length === 0) {
|
905 |
+
if (this.$results.children().length === 0) {
|
906 |
+
this.trigger('results:message', {
|
907 |
+
message: 'noResults'
|
908 |
+
});
|
909 |
+
}
|
|
|
910 |
|
911 |
+
return;
|
912 |
+
}
|
913 |
|
914 |
+
data.results = this.sort(data.results);
|
|
|
|
|
|
|
|
|
|
|
915 |
|
916 |
+
for (var d = 0; d < data.results.length; d++) {
|
917 |
+
var item = data.results[d];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
|
919 |
+
var $option = this.option(item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
|
921 |
+
$options.push($option);
|
922 |
+
}
|
923 |
|
924 |
+
this.$results.append($options);
|
925 |
+
};
|
|
|
|
|
|
|
|
|
926 |
|
927 |
+
Results.prototype.position = function ($results, $dropdown) {
|
928 |
+
var $resultsContainer = $dropdown.find('.select2-results');
|
929 |
+
$resultsContainer.append($results);
|
930 |
+
};
|
|
|
931 |
|
932 |
+
Results.prototype.sort = function (data) {
|
933 |
+
var sorter = this.options.get('sorter');
|
934 |
|
935 |
+
return sorter(data);
|
936 |
+
};
|
|
|
|
|
937 |
|
938 |
+
Results.prototype.highlightFirstItem = function () {
|
939 |
+
var $options = this.$results
|
940 |
+
.find('.select2-results__option[aria-selected]');
|
941 |
|
942 |
+
var $selected = $options.filter('[aria-selected=true]');
|
|
|
|
|
|
|
943 |
|
944 |
+
// Check if there are any selected options
|
945 |
+
if ($selected.length > 0) {
|
946 |
+
// If there are selected options, highlight the first
|
947 |
+
$selected.first().trigger('mouseenter');
|
948 |
+
} else {
|
949 |
+
// If there are no selected options, highlight the first option
|
950 |
+
// in the dropdown
|
951 |
+
$options.first().trigger('mouseenter');
|
952 |
+
}
|
953 |
|
954 |
+
this.ensureHighlightVisible();
|
955 |
+
};
|
956 |
|
957 |
+
Results.prototype.setClasses = function () {
|
958 |
+
var self = this;
|
|
|
|
|
|
|
|
|
959 |
|
960 |
+
this.data.current(function (selected) {
|
961 |
+
var selectedIds = $.map(selected, function (s) {
|
962 |
+
return s.id.toString();
|
963 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
964 |
|
965 |
+
var $options = self.$results
|
966 |
+
.find('.select2-results__option[aria-selected]');
|
|
|
|
|
|
|
|
|
967 |
|
968 |
+
$options.each(function () {
|
969 |
+
var $option = $(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
|
971 |
+
var item = Utils.GetData(this, 'data');
|
|
|
|
|
|
|
|
|
972 |
|
973 |
+
// id needs to be converted to a string when comparing
|
974 |
+
var id = '' + item.id;
|
|
|
|
|
975 |
|
976 |
+
if ((item.element != null && item.element.selected) ||
|
977 |
+
(item.element == null && $.inArray(id, selectedIds) > -1)) {
|
978 |
+
$option.attr('aria-selected', 'true');
|
979 |
+
} else {
|
980 |
+
$option.attr('aria-selected', 'false');
|
981 |
+
}
|
982 |
+
});
|
983 |
|
984 |
+
});
|
985 |
+
};
|
|
|
986 |
|
987 |
+
Results.prototype.showLoading = function (params) {
|
988 |
+
this.hideLoading();
|
989 |
|
990 |
+
var loadingMore = this.options.get('translations').get('searching');
|
|
|
|
|
|
|
|
|
991 |
|
992 |
+
var loading = {
|
993 |
+
disabled: true,
|
994 |
+
loading: true,
|
995 |
+
text: loadingMore(params)
|
996 |
+
};
|
997 |
+
var $loading = this.option(loading);
|
998 |
+
$loading.className += ' loading-results';
|
999 |
|
1000 |
+
this.$results.prepend($loading);
|
1001 |
+
};
|
|
|
|
|
1002 |
|
1003 |
+
Results.prototype.hideLoading = function () {
|
1004 |
+
this.$results.find('.loading-results').remove();
|
1005 |
+
};
|
|
|
|
|
1006 |
|
1007 |
+
Results.prototype.option = function (data) {
|
1008 |
+
var option = document.createElement('li');
|
1009 |
+
option.className = 'select2-results__option';
|
1010 |
|
1011 |
+
var attrs = {
|
1012 |
+
'role': 'treeitem',
|
1013 |
+
'aria-selected': 'false'
|
1014 |
+
};
|
1015 |
|
1016 |
+
if (data.disabled) {
|
1017 |
+
delete attrs['aria-selected'];
|
1018 |
+
attrs['aria-disabled'] = 'true';
|
1019 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
|
1021 |
+
if (data.id == null) {
|
1022 |
+
delete attrs['aria-selected'];
|
1023 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1024 |
|
1025 |
+
if (data._resultId != null) {
|
1026 |
+
option.id = data._resultId;
|
1027 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
|
1029 |
+
if (data.title) {
|
1030 |
+
option.title = data.title;
|
1031 |
+
}
|
1032 |
|
1033 |
+
if (data.children) {
|
1034 |
+
attrs.role = 'group';
|
1035 |
+
attrs['aria-label'] = data.text;
|
1036 |
+
delete attrs['aria-selected'];
|
1037 |
+
}
|
|
|
1038 |
|
1039 |
+
for (var attr in attrs) {
|
1040 |
+
var val = attrs[attr];
|
|
|
1041 |
|
1042 |
+
option.setAttribute(attr, val);
|
1043 |
+
}
|
|
|
|
|
1044 |
|
1045 |
+
if (data.children) {
|
1046 |
+
var $option = $(option);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1047 |
|
1048 |
+
var label = document.createElement('strong');
|
1049 |
+
label.className = 'select2-results__group';
|
1050 |
|
1051 |
+
var $label = $(label);
|
1052 |
+
this.template(data, label);
|
|
|
1053 |
|
1054 |
+
var $children = [];
|
1055 |
|
1056 |
+
for (var c = 0; c < data.children.length; c++) {
|
1057 |
+
var child = data.children[c];
|
1058 |
|
1059 |
+
var $child = this.option(child);
|
|
|
|
|
|
|
1060 |
|
1061 |
+
$children.push($child);
|
1062 |
+
}
|
|
|
|
|
|
|
|
|
1063 |
|
1064 |
+
var $childrenContainer = $('<ul></ul>', {
|
1065 |
+
'class': 'select2-results__options select2-results__options--nested'
|
1066 |
+
});
|
|
|
|
|
|
|
|
|
|
|
1067 |
|
1068 |
+
$childrenContainer.append($children);
|
1069 |
|
1070 |
+
$option.append(label);
|
1071 |
+
$option.append($childrenContainer);
|
1072 |
+
} else {
|
1073 |
+
this.template(data, option);
|
1074 |
+
}
|
1075 |
|
1076 |
+
Utils.StoreData(option, 'data', data);
|
|
|
|
|
|
|
|
|
1077 |
|
1078 |
+
return option;
|
1079 |
+
};
|
1080 |
|
1081 |
+
Results.prototype.bind = function (container, $container) {
|
1082 |
+
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1083 |
|
1084 |
+
var id = container.id + '-results';
|
1085 |
|
1086 |
+
this.$results.attr('id', id);
|
1087 |
|
1088 |
+
container.on('results:all', function (params) {
|
1089 |
+
self.clear();
|
1090 |
+
self.append(params.data);
|
1091 |
|
1092 |
+
if (container.isOpen()) {
|
1093 |
+
self.setClasses();
|
1094 |
+
self.highlightFirstItem();
|
1095 |
+
}
|
1096 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1097 |
|
1098 |
+
container.on('results:append', function (params) {
|
1099 |
+
self.append(params.data);
|
|
|
|
|
1100 |
|
1101 |
+
if (container.isOpen()) {
|
1102 |
+
self.setClasses();
|
1103 |
+
}
|
1104 |
+
});
|
1105 |
|
1106 |
+
container.on('query', function (params) {
|
1107 |
+
self.hideMessages();
|
1108 |
+
self.showLoading(params);
|
1109 |
+
});
|
1110 |
|
1111 |
+
container.on('select', function () {
|
1112 |
+
if (!container.isOpen()) {
|
1113 |
+
return;
|
1114 |
+
}
|
1115 |
|
1116 |
+
self.setClasses();
|
1117 |
+
self.highlightFirstItem();
|
1118 |
+
});
|
1119 |
|
1120 |
+
container.on('unselect', function () {
|
1121 |
+
if (!container.isOpen()) {
|
1122 |
+
return;
|
1123 |
+
}
|
|
|
|
|
|
|
|
|
1124 |
|
1125 |
+
self.setClasses();
|
1126 |
+
self.highlightFirstItem();
|
1127 |
+
});
|
1128 |
|
1129 |
+
container.on('open', function () {
|
1130 |
+
// When the dropdown is open, aria-expended="true"
|
1131 |
+
self.$results.attr('aria-expanded', 'true');
|
1132 |
+
self.$results.attr('aria-hidden', 'false');
|
1133 |
|
1134 |
+
self.setClasses();
|
1135 |
+
self.ensureHighlightVisible();
|
1136 |
+
});
|
1137 |
|
1138 |
+
container.on('close', function () {
|
1139 |
+
// When the dropdown is closed, aria-expended="false"
|
1140 |
+
self.$results.attr('aria-expanded', 'false');
|
1141 |
+
self.$results.attr('aria-hidden', 'true');
|
1142 |
+
self.$results.removeAttr('aria-activedescendant');
|
1143 |
+
});
|
1144 |
|
1145 |
+
container.on('results:toggle', function () {
|
1146 |
+
var $highlighted = self.getHighlightedResults();
|
1147 |
|
1148 |
+
if ($highlighted.length === 0) {
|
1149 |
+
return;
|
1150 |
+
}
|
1151 |
|
1152 |
+
$highlighted.trigger('mouseup');
|
1153 |
+
});
|
|
|
|
|
|
|
1154 |
|
1155 |
+
container.on('results:select', function () {
|
1156 |
+
var $highlighted = self.getHighlightedResults();
|
1157 |
|
1158 |
+
if ($highlighted.length === 0) {
|
1159 |
+
return;
|
1160 |
+
}
|
|
|
1161 |
|
1162 |
+
var data = Utils.GetData($highlighted[0], 'data');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1163 |
|
1164 |
+
if ($highlighted.attr('aria-selected') == 'true') {
|
1165 |
+
self.trigger('close', {});
|
1166 |
+
} else {
|
1167 |
+
self.trigger('select', {
|
1168 |
+
data: data
|
1169 |
+
});
|
1170 |
+
}
|
1171 |
+
});
|
1172 |
|
1173 |
+
container.on('results:previous', function () {
|
1174 |
+
var $highlighted = self.getHighlightedResults();
|
1175 |
|
1176 |
+
var $options = self.$results.find('[aria-selected]');
|
|
|
|
|
|
|
1177 |
|
1178 |
+
var currentIndex = $options.index($highlighted);
|
|
|
|
|
1179 |
|
1180 |
+
// If we are already at te top, don't move further
|
1181 |
+
// If no options, currentIndex will be -1
|
1182 |
+
if (currentIndex <= 0) {
|
1183 |
+
return;
|
1184 |
+
}
|
1185 |
|
1186 |
+
var nextIndex = currentIndex - 1;
|
1187 |
|
1188 |
+
// If none are highlighted, highlight the first
|
1189 |
+
if ($highlighted.length === 0) {
|
1190 |
+
nextIndex = 0;
|
1191 |
+
}
|
1192 |
|
1193 |
+
var $next = $options.eq(nextIndex);
|
|
|
|
|
1194 |
|
1195 |
+
$next.trigger('mouseenter');
|
|
|
|
|
1196 |
|
1197 |
+
var currentOffset = self.$results.offset().top;
|
1198 |
+
var nextTop = $next.offset().top;
|
1199 |
+
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
|
1200 |
|
1201 |
+
if (nextIndex === 0) {
|
1202 |
+
self.$results.scrollTop(0);
|
1203 |
+
} else if (nextTop - currentOffset < 0) {
|
1204 |
+
self.$results.scrollTop(nextOffset);
|
1205 |
+
}
|
1206 |
+
});
|
1207 |
|
1208 |
+
container.on('results:next', function () {
|
1209 |
+
var $highlighted = self.getHighlightedResults();
|
1210 |
|
1211 |
+
var $options = self.$results.find('[aria-selected]');
|
1212 |
|
1213 |
+
var currentIndex = $options.index($highlighted);
|
|
|
|
|
|
|
|
|
|
|
|
|
1214 |
|
1215 |
+
var nextIndex = currentIndex + 1;
|
|
|
|
|
|
|
|
|
1216 |
|
1217 |
+
// If we are at the last option, stay there
|
1218 |
+
if (nextIndex >= $options.length) {
|
1219 |
+
return;
|
1220 |
+
}
|
|
|
1221 |
|
1222 |
+
var $next = $options.eq(nextIndex);
|
|
|
|
|
|
|
1223 |
|
1224 |
+
$next.trigger('mouseenter');
|
|
|
|
|
|
|
1225 |
|
1226 |
+
var currentOffset = self.$results.offset().top +
|
1227 |
+
self.$results.outerHeight(false);
|
1228 |
+
var nextBottom = $next.offset().top + $next.outerHeight(false);
|
1229 |
+
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
|
|
|
|
|
|
|
|
|
|
|
1230 |
|
1231 |
+
if (nextIndex === 0) {
|
1232 |
+
self.$results.scrollTop(0);
|
1233 |
+
} else if (nextBottom > currentOffset) {
|
1234 |
+
self.$results.scrollTop(nextOffset);
|
1235 |
+
}
|
1236 |
+
});
|
1237 |
|
1238 |
+
container.on('results:focus', function (params) {
|
1239 |
+
params.element.addClass('select2-results__option--highlighted');
|
1240 |
+
});
|
1241 |
|
1242 |
+
container.on('results:message', function (params) {
|
1243 |
+
self.displayMessage(params);
|
1244 |
+
});
|
1245 |
|
1246 |
+
if ($.fn.mousewheel) {
|
1247 |
+
this.$results.on('mousewheel', function (e) {
|
1248 |
+
var top = self.$results.scrollTop();
|
1249 |
|
1250 |
+
var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
|
|
|
1251 |
|
1252 |
+
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
|
1253 |
+
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
|
1254 |
|
1255 |
+
if (isAtTop) {
|
1256 |
+
self.$results.scrollTop(0);
|
1257 |
|
1258 |
+
e.preventDefault();
|
1259 |
+
e.stopPropagation();
|
1260 |
+
} else if (isAtBottom) {
|
1261 |
+
self.$results.scrollTop(
|
1262 |
+
self.$results.get(0).scrollHeight - self.$results.height()
|
1263 |
+
);
|
1264 |
|
1265 |
+
e.preventDefault();
|
1266 |
+
e.stopPropagation();
|
1267 |
+
}
|
1268 |
+
});
|
1269 |
+
}
|
1270 |
|
1271 |
+
this.$results.on('mouseup', '.select2-results__option[aria-selected]',
|
1272 |
+
function (evt) {
|
1273 |
+
var $this = $(this);
|
1274 |
|
1275 |
+
var data = Utils.GetData(this, 'data');
|
|
|
|
|
1276 |
|
1277 |
+
if ($this.attr('aria-selected') === 'true') {
|
1278 |
+
if (self.options.get('multiple')) {
|
1279 |
+
self.trigger('unselect', {
|
1280 |
+
originalEvent: evt,
|
1281 |
+
data: data
|
1282 |
+
});
|
1283 |
+
} else {
|
1284 |
+
self.trigger('close', {});
|
1285 |
+
}
|
1286 |
|
1287 |
+
return;
|
1288 |
+
}
|
|
|
|
|
1289 |
|
1290 |
+
self.trigger('select', {
|
1291 |
+
originalEvent: evt,
|
1292 |
+
data: data
|
1293 |
+
});
|
1294 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
1295 |
|
1296 |
+
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
|
1297 |
+
function (evt) {
|
1298 |
+
var data = Utils.GetData(this, 'data');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1299 |
|
1300 |
+
self.getHighlightedResults()
|
1301 |
+
.removeClass('select2-results__option--highlighted');
|
|
|
|
|
1302 |
|
1303 |
+
self.trigger('results:focus', {
|
1304 |
+
data: data,
|
1305 |
+
element: $(this)
|
1306 |
+
});
|
1307 |
+
});
|
1308 |
+
};
|
1309 |
|
1310 |
+
Results.prototype.getHighlightedResults = function () {
|
1311 |
+
var $highlighted = this.$results
|
1312 |
+
.find('.select2-results__option--highlighted');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1313 |
|
1314 |
+
return $highlighted;
|
1315 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1316 |
|
1317 |
+
Results.prototype.destroy = function () {
|
1318 |
+
this.$results.remove();
|
1319 |
+
};
|
|
|
1320 |
|
1321 |
+
Results.prototype.ensureHighlightVisible = function () {
|
1322 |
+
var $highlighted = this.getHighlightedResults();
|
1323 |
|
1324 |
+
if ($highlighted.length === 0) {
|
1325 |
+
return;
|
1326 |
+
}
|
|
|
|
|
|
|
|
|
|
|
1327 |
|
1328 |
+
var $options = this.$results.find('[aria-selected]');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1329 |
|
1330 |
+
var currentIndex = $options.index($highlighted);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1331 |
|
1332 |
+
var currentOffset = this.$results.offset().top;
|
1333 |
+
var nextTop = $highlighted.offset().top;
|
1334 |
+
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
|
1335 |
|
1336 |
+
var offsetDelta = nextTop - currentOffset;
|
1337 |
+
nextOffset -= $highlighted.outerHeight(false) * 2;
|
1338 |
|
1339 |
+
if (currentIndex <= 2) {
|
1340 |
+
this.$results.scrollTop(0);
|
1341 |
+
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
|
1342 |
+
this.$results.scrollTop(nextOffset);
|
1343 |
+
}
|
1344 |
+
};
|
1345 |
|
1346 |
+
Results.prototype.template = function (result, container) {
|
1347 |
+
var template = this.options.get('templateResult');
|
1348 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
|
|
|
|
1349 |
|
1350 |
+
var content = template(result, container);
|
1351 |
|
1352 |
+
if (content == null) {
|
1353 |
+
container.style.display = 'none';
|
1354 |
+
} else if (typeof content === 'string') {
|
1355 |
+
container.innerHTML = escapeMarkup(content);
|
1356 |
+
} else {
|
1357 |
+
$(container).append(content);
|
1358 |
+
}
|
1359 |
+
};
|
1360 |
+
|
1361 |
+
return Results;
|
1362 |
+
});
|
1363 |
+
|
1364 |
+
S2.define('select2/keys',[
|
1365 |
+
|
1366 |
+
], function () {
|
1367 |
+
var KEYS = {
|
1368 |
+
BACKSPACE: 8,
|
1369 |
+
TAB: 9,
|
1370 |
+
ENTER: 13,
|
1371 |
+
SHIFT: 16,
|
1372 |
+
CTRL: 17,
|
1373 |
+
ALT: 18,
|
1374 |
+
ESC: 27,
|
1375 |
+
SPACE: 32,
|
1376 |
+
PAGE_UP: 33,
|
1377 |
+
PAGE_DOWN: 34,
|
1378 |
+
END: 35,
|
1379 |
+
HOME: 36,
|
1380 |
+
LEFT: 37,
|
1381 |
+
UP: 38,
|
1382 |
+
RIGHT: 39,
|
1383 |
+
DOWN: 40,
|
1384 |
+
DELETE: 46
|
1385 |
+
};
|
1386 |
+
|
1387 |
+
return KEYS;
|
1388 |
+
});
|
1389 |
+
|
1390 |
+
S2.define('select2/selection/base',[
|
1391 |
+
'jquery',
|
1392 |
+
'../utils',
|
1393 |
+
'../keys'
|
1394 |
+
], function ($, Utils, KEYS) {
|
1395 |
+
function BaseSelection ($element, options) {
|
1396 |
+
this.$element = $element;
|
1397 |
+
this.options = options;
|
1398 |
+
|
1399 |
+
BaseSelection.__super__.constructor.call(this);
|
1400 |
+
}
|
1401 |
+
|
1402 |
+
Utils.Extend(BaseSelection, Utils.Observable);
|
1403 |
+
|
1404 |
+
BaseSelection.prototype.render = function () {
|
1405 |
+
var $selection = $(
|
1406 |
+
'<span class="select2-selection" role="combobox" ' +
|
1407 |
+
' aria-haspopup="true" aria-expanded="false">' +
|
1408 |
+
'</span>'
|
1409 |
+
);
|
1410 |
+
|
1411 |
+
this._tabindex = 0;
|
1412 |
+
|
1413 |
+
if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
|
1414 |
+
this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
|
1415 |
+
} else if (this.$element.attr('tabindex') != null) {
|
1416 |
+
this._tabindex = this.$element.attr('tabindex');
|
1417 |
+
}
|
1418 |
|
1419 |
+
$selection.attr('title', this.$element.attr('title'));
|
1420 |
+
$selection.attr('tabindex', this._tabindex);
|
|
|
|
|
1421 |
|
1422 |
+
this.$selection = $selection;
|
|
|
|
|
|
|
|
|
1423 |
|
1424 |
+
return $selection;
|
1425 |
+
};
|
|
|
|
|
|
|
1426 |
|
1427 |
+
BaseSelection.prototype.bind = function (container, $container) {
|
1428 |
+
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1429 |
|
1430 |
+
var id = container.id + '-container';
|
1431 |
+
var resultsId = container.id + '-results';
|
|
|
|
|
1432 |
|
1433 |
+
this.container = container;
|
|
|
1434 |
|
1435 |
+
this.$selection.on('focus', function (evt) {
|
1436 |
+
self.trigger('focus', evt);
|
1437 |
+
});
|
|
|
1438 |
|
1439 |
+
this.$selection.on('blur', function (evt) {
|
1440 |
+
self._handleBlur(evt);
|
1441 |
+
});
|
1442 |
|
1443 |
+
this.$selection.on('keydown', function (evt) {
|
1444 |
+
self.trigger('keypress', evt);
|
1445 |
|
1446 |
+
if (evt.which === KEYS.SPACE) {
|
1447 |
+
evt.preventDefault();
|
1448 |
+
}
|
1449 |
+
});
|
1450 |
|
1451 |
+
container.on('results:focus', function (params) {
|
1452 |
+
self.$selection.attr('aria-activedescendant', params.data._resultId);
|
1453 |
+
});
|
|
|
1454 |
|
1455 |
+
container.on('selection:update', function (params) {
|
1456 |
+
self.update(params.data);
|
1457 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1458 |
|
1459 |
+
container.on('open', function () {
|
1460 |
+
// When the dropdown is open, aria-expanded="true"
|
1461 |
+
self.$selection.attr('aria-expanded', 'true');
|
1462 |
+
self.$selection.attr('aria-owns', resultsId);
|
1463 |
|
1464 |
+
self._attachCloseHandler(container);
|
1465 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1466 |
|
1467 |
+
container.on('close', function () {
|
1468 |
+
// When the dropdown is closed, aria-expanded="false"
|
1469 |
+
self.$selection.attr('aria-expanded', 'false');
|
1470 |
+
self.$selection.removeAttr('aria-activedescendant');
|
1471 |
+
self.$selection.removeAttr('aria-owns');
|
|
|
|
|
|
|
|
|
1472 |
|
1473 |
+
self.$selection.focus();
|
1474 |
+
window.setTimeout(function () {
|
1475 |
+
self.$selection.focus();
|
1476 |
+
}, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1477 |
|
1478 |
+
self._detachCloseHandler(container);
|
1479 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1480 |
|
1481 |
+
container.on('enable', function () {
|
1482 |
+
self.$selection.attr('tabindex', self._tabindex);
|
1483 |
+
});
|
|
|
|
|
1484 |
|
1485 |
+
container.on('disable', function () {
|
1486 |
+
self.$selection.attr('tabindex', '-1');
|
1487 |
+
});
|
1488 |
+
};
|
1489 |
+
|
1490 |
+
BaseSelection.prototype._handleBlur = function (evt) {
|
1491 |
+
var self = this;
|
1492 |
+
|
1493 |
+
// This needs to be delayed as the active element is the body when the tab
|
1494 |
+
// key is pressed, possibly along with others.
|
1495 |
+
window.setTimeout(function () {
|
1496 |
+
// Don't trigger `blur` if the focus is still in the selection
|
1497 |
+
if (
|
1498 |
+
(document.activeElement == self.$selection[0]) ||
|
1499 |
+
($.contains(self.$selection[0], document.activeElement))
|
1500 |
+
) {
|
1501 |
+
return;
|
1502 |
+
}
|
1503 |
|
1504 |
+
self.trigger('blur', evt);
|
1505 |
+
}, 1);
|
1506 |
+
};
|
|
|
|
|
|
|
|
|
1507 |
|
1508 |
+
BaseSelection.prototype._attachCloseHandler = function (container) {
|
1509 |
+
var self = this;
|
|
|
|
|
|
|
|
|
1510 |
|
1511 |
+
$(document.body).on('mousedown.select2.' + container.id, function (e) {
|
1512 |
+
var $target = $(e.target);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1513 |
|
1514 |
+
var $select = $target.closest('.select2');
|
|
|
|
|
|
|
|
|
|
|
1515 |
|
1516 |
+
var $all = $('.select2.select2-container--open');
|
|
|
|
|
1517 |
|
1518 |
+
$all.each(function () {
|
1519 |
+
var $this = $(this);
|
|
|
1520 |
|
1521 |
+
if (this == $select[0]) {
|
1522 |
+
return;
|
1523 |
+
}
|
1524 |
|
1525 |
+
var $element = Utils.GetData(this, 'element');
|
|
|
|
|
1526 |
|
1527 |
+
$element.select2('close');
|
1528 |
+
});
|
1529 |
+
});
|
1530 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1531 |
|
1532 |
+
BaseSelection.prototype._detachCloseHandler = function (container) {
|
1533 |
+
$(document.body).off('mousedown.select2.' + container.id);
|
1534 |
+
};
|
|
|
|
|
|
|
|
|
|
|
1535 |
|
1536 |
+
BaseSelection.prototype.position = function ($selection, $container) {
|
1537 |
+
var $selectionContainer = $container.find('.selection');
|
1538 |
+
$selectionContainer.append($selection);
|
1539 |
+
};
|
1540 |
|
1541 |
+
BaseSelection.prototype.destroy = function () {
|
1542 |
+
this._detachCloseHandler(this.container);
|
1543 |
+
};
|
|
|
1544 |
|
1545 |
+
BaseSelection.prototype.update = function (data) {
|
1546 |
+
throw new Error('The `update` method must be defined in child classes.');
|
1547 |
+
};
|
1548 |
|
1549 |
+
return BaseSelection;
|
1550 |
+
});
|
|
|
|
|
1551 |
|
1552 |
+
S2.define('select2/selection/single',[
|
1553 |
+
'jquery',
|
1554 |
+
'./base',
|
1555 |
+
'../utils',
|
1556 |
+
'../keys'
|
1557 |
+
], function ($, BaseSelection, Utils, KEYS) {
|
1558 |
+
function SingleSelection () {
|
1559 |
+
SingleSelection.__super__.constructor.apply(this, arguments);
|
1560 |
+
}
|
|
|
|
|
1561 |
|
1562 |
+
Utils.Extend(SingleSelection, BaseSelection);
|
|
|
|
|
|
|
1563 |
|
1564 |
+
SingleSelection.prototype.render = function () {
|
1565 |
+
var $selection = SingleSelection.__super__.render.call(this);
|
|
|
|
|
1566 |
|
1567 |
+
$selection.addClass('select2-selection--single');
|
|
|
|
|
|
|
1568 |
|
1569 |
+
$selection.html(
|
1570 |
+
'<span class="select2-selection__rendered"></span>' +
|
1571 |
+
'<span class="select2-selection__arrow" role="presentation">' +
|
1572 |
+
'<b role="presentation"></b>' +
|
1573 |
+
'</span>'
|
1574 |
+
);
|
1575 |
|
1576 |
+
return $selection;
|
1577 |
+
};
|
|
|
|
|
|
|
1578 |
|
1579 |
+
SingleSelection.prototype.bind = function (container, $container) {
|
1580 |
+
var self = this;
|
1581 |
|
1582 |
+
SingleSelection.__super__.bind.apply(this, arguments);
|
|
|
|
|
|
|
|
|
1583 |
|
1584 |
+
var id = container.id + '-container';
|
|
|
|
|
|
|
|
|
1585 |
|
1586 |
+
this.$selection.find('.select2-selection__rendered')
|
1587 |
+
.attr('id', id)
|
1588 |
+
.attr('role', 'textbox')
|
1589 |
+
.attr('aria-readonly', 'true');
|
1590 |
+
this.$selection.attr('aria-labelledby', id);
|
1591 |
|
1592 |
+
this.$selection.on('mousedown', function (evt) {
|
1593 |
+
// Only respond to left clicks
|
1594 |
+
if (evt.which !== 1) {
|
1595 |
+
return;
|
1596 |
+
}
|
1597 |
|
1598 |
+
self.trigger('toggle', {
|
1599 |
+
originalEvent: evt
|
1600 |
+
});
|
1601 |
+
});
|
|
|
1602 |
|
1603 |
+
this.$selection.on('focus', function (evt) {
|
1604 |
+
// User focuses on the container
|
1605 |
+
});
|
1606 |
|
1607 |
+
this.$selection.on('blur', function (evt) {
|
1608 |
+
// User exits the container
|
1609 |
+
});
|
1610 |
|
1611 |
+
container.on('focus', function (evt) {
|
1612 |
+
if (!container.isOpen()) {
|
1613 |
+
self.$selection.focus();
|
1614 |
+
}
|
1615 |
+
});
|
1616 |
+
};
|
1617 |
|
1618 |
+
SingleSelection.prototype.clear = function () {
|
1619 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1620 |
+
$rendered.empty();
|
1621 |
+
$rendered.removeAttr('title'); // clear tooltip on empty
|
1622 |
+
};
|
1623 |
|
1624 |
+
SingleSelection.prototype.display = function (data, container) {
|
1625 |
+
var template = this.options.get('templateSelection');
|
1626 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1627 |
|
1628 |
+
return escapeMarkup(template(data, container));
|
1629 |
+
};
|
1630 |
|
1631 |
+
SingleSelection.prototype.selectionContainer = function () {
|
1632 |
+
return $('<span></span>');
|
1633 |
+
};
|
1634 |
|
1635 |
+
SingleSelection.prototype.update = function (data) {
|
1636 |
+
if (data.length === 0) {
|
1637 |
+
this.clear();
|
1638 |
+
return;
|
1639 |
+
}
|
1640 |
|
1641 |
+
var selection = data[0];
|
|
|
1642 |
|
1643 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1644 |
+
var formatted = this.display(selection, $rendered);
|
|
|
|
|
|
|
1645 |
|
1646 |
+
$rendered.empty().append(formatted);
|
1647 |
+
$rendered.attr('title', selection.title || selection.text);
|
1648 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1649 |
|
1650 |
+
return SingleSelection;
|
1651 |
+
});
|
1652 |
|
1653 |
+
S2.define('select2/selection/multiple',[
|
1654 |
+
'jquery',
|
1655 |
+
'./base',
|
1656 |
+
'../utils'
|
1657 |
+
], function ($, BaseSelection, Utils) {
|
1658 |
+
function MultipleSelection ($element, options) {
|
1659 |
+
MultipleSelection.__super__.constructor.apply(this, arguments);
|
1660 |
+
}
|
1661 |
|
1662 |
+
Utils.Extend(MultipleSelection, BaseSelection);
|
|
|
|
|
|
|
1663 |
|
1664 |
+
MultipleSelection.prototype.render = function () {
|
1665 |
+
var $selection = MultipleSelection.__super__.render.call(this);
|
1666 |
|
1667 |
+
$selection.addClass('select2-selection--multiple');
|
1668 |
|
1669 |
+
$selection.html(
|
1670 |
+
'<ul class="select2-selection__rendered"></ul>'
|
1671 |
+
);
|
|
|
1672 |
|
1673 |
+
return $selection;
|
1674 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1675 |
|
1676 |
+
MultipleSelection.prototype.bind = function (container, $container) {
|
1677 |
+
var self = this;
|
1678 |
|
1679 |
+
MultipleSelection.__super__.bind.apply(this, arguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1680 |
|
1681 |
+
this.$selection.on('click', function (evt) {
|
1682 |
+
self.trigger('toggle', {
|
1683 |
+
originalEvent: evt
|
1684 |
+
});
|
1685 |
+
});
|
1686 |
|
1687 |
+
this.$selection.on(
|
1688 |
+
'click',
|
1689 |
+
'.select2-selection__choice__remove',
|
1690 |
+
function (evt) {
|
1691 |
+
// Ignore the event if it is disabled
|
1692 |
+
if (self.options.get('disabled')) {
|
1693 |
+
return;
|
1694 |
+
}
|
1695 |
|
1696 |
+
var $remove = $(this);
|
1697 |
+
var $selection = $remove.parent();
|
|
|
|
|
1698 |
|
1699 |
+
var data = Utils.GetData($selection[0], 'data');
|
|
|
|
|
1700 |
|
1701 |
+
self.trigger('unselect', {
|
1702 |
+
originalEvent: evt,
|
1703 |
+
data: data
|
1704 |
+
});
|
1705 |
+
}
|
1706 |
+
);
|
1707 |
+
};
|
1708 |
+
|
1709 |
+
MultipleSelection.prototype.clear = function () {
|
1710 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1711 |
+
$rendered.empty();
|
1712 |
+
$rendered.removeAttr('title');
|
1713 |
+
};
|
1714 |
+
|
1715 |
+
MultipleSelection.prototype.display = function (data, container) {
|
1716 |
+
var template = this.options.get('templateSelection');
|
1717 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1718 |
+
|
1719 |
+
return escapeMarkup(template(data, container));
|
1720 |
+
};
|
1721 |
+
|
1722 |
+
MultipleSelection.prototype.selectionContainer = function () {
|
1723 |
+
var $container = $(
|
1724 |
+
'<li class="select2-selection__choice">' +
|
1725 |
+
'<span class="select2-selection__choice__remove" role="presentation">' +
|
1726 |
+
'×' +
|
1727 |
+
'</span>' +
|
1728 |
+
'</li>'
|
1729 |
+
);
|
1730 |
+
|
1731 |
+
return $container;
|
1732 |
+
};
|
1733 |
+
|
1734 |
+
MultipleSelection.prototype.update = function (data) {
|
1735 |
+
this.clear();
|
1736 |
+
|
1737 |
+
if (data.length === 0) {
|
1738 |
+
return;
|
1739 |
+
}
|
1740 |
|
1741 |
+
var $selections = [];
|
|
|
|
|
|
|
|
|
1742 |
|
1743 |
+
for (var d = 0; d < data.length; d++) {
|
1744 |
+
var selection = data[d];
|
1745 |
|
1746 |
+
var $selection = this.selectionContainer();
|
1747 |
+
var formatted = this.display(selection, $selection);
|
|
|
|
|
|
|
1748 |
|
1749 |
+
$selection.append(formatted);
|
1750 |
+
$selection.attr('title', selection.title || selection.text);
|
|
|
1751 |
|
1752 |
+
Utils.StoreData($selection[0], 'data', selection);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1753 |
|
1754 |
+
$selections.push($selection);
|
1755 |
+
}
|
|
|
1756 |
|
1757 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1758 |
|
1759 |
+
Utils.appendMany($rendered, $selections);
|
1760 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1761 |
|
1762 |
+
return MultipleSelection;
|
1763 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1764 |
|
1765 |
+
S2.define('select2/selection/placeholder',[
|
1766 |
+
'../utils'
|
1767 |
+
], function (Utils) {
|
1768 |
+
function Placeholder (decorated, $element, options) {
|
1769 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
|
|
|
|
|
|
1770 |
|
1771 |
+
decorated.call(this, $element, options);
|
1772 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1773 |
|
1774 |
+
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
1775 |
+
if (typeof placeholder === 'string') {
|
1776 |
+
placeholder = {
|
1777 |
+
id: '',
|
1778 |
+
text: placeholder
|
1779 |
+
};
|
1780 |
+
}
|
1781 |
|
1782 |
+
return placeholder;
|
1783 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1784 |
|
1785 |
+
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
|
1786 |
+
var $placeholder = this.selectionContainer();
|
1787 |
|
1788 |
+
$placeholder.html(this.display(placeholder));
|
1789 |
+
$placeholder.addClass('select2-selection__placeholder')
|
1790 |
+
.removeClass('select2-selection__choice');
|
1791 |
|
1792 |
+
return $placeholder;
|
1793 |
+
};
|
1794 |
|
1795 |
+
Placeholder.prototype.update = function (decorated, data) {
|
1796 |
+
var singlePlaceholder = (
|
1797 |
+
data.length == 1 && data[0].id != this.placeholder.id
|
1798 |
+
);
|
1799 |
+
var multipleSelections = data.length > 1;
|
1800 |
|
1801 |
+
if (multipleSelections || singlePlaceholder) {
|
1802 |
+
return decorated.call(this, data);
|
1803 |
+
}
|
1804 |
|
1805 |
+
this.clear();
|
1806 |
|
1807 |
+
var $placeholder = this.createPlaceholder(this.placeholder);
|
|
|
|
|
1808 |
|
1809 |
+
this.$selection.find('.select2-selection__rendered').append($placeholder);
|
1810 |
+
};
|
|
|
1811 |
|
1812 |
+
return Placeholder;
|
1813 |
+
});
|
1814 |
|
1815 |
+
S2.define('select2/selection/allowClear',[
|
1816 |
+
'jquery',
|
1817 |
+
'../keys',
|
1818 |
+
'../utils'
|
1819 |
+
], function ($, KEYS, Utils) {
|
1820 |
+
function AllowClear () { }
|
1821 |
|
1822 |
+
AllowClear.prototype.bind = function (decorated, container, $container) {
|
1823 |
+
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
1824 |
|
1825 |
+
decorated.call(this, container, $container);
|
1826 |
|
1827 |
+
if (this.placeholder == null) {
|
1828 |
+
if (this.options.get('debug') && window.console && console.error) {
|
1829 |
+
console.error(
|
1830 |
+
'Select2: The `allowClear` option should be used in combination ' +
|
1831 |
+
'with the `placeholder` option.'
|
1832 |
+
);
|
1833 |
+
}
|
1834 |
+
}
|
1835 |
|
1836 |
+
this.$selection.on('mousedown', '.select2-selection__clear',
|
1837 |
+
function (evt) {
|
1838 |
+
self._handleClear(evt);
|
1839 |
+
});
|
1840 |
|
1841 |
+
container.on('keypress', function (evt) {
|
1842 |
+
self._handleKeyboardClear(evt, container);
|
1843 |
+
});
|
1844 |
+
};
|
1845 |
|
1846 |
+
AllowClear.prototype._handleClear = function (_, evt) {
|
1847 |
+
// Ignore the event if it is disabled
|
1848 |
+
if (this.options.get('disabled')) {
|
1849 |
+
return;
|
1850 |
+
}
|
1851 |
|
1852 |
+
var $clear = this.$selection.find('.select2-selection__clear');
|
|
|
1853 |
|
1854 |
+
// Ignore the event if nothing has been selected
|
1855 |
+
if ($clear.length === 0) {
|
1856 |
+
return;
|
1857 |
+
}
|
1858 |
|
1859 |
+
evt.stopPropagation();
|
|
|
1860 |
|
1861 |
+
var data = Utils.GetData($clear[0], 'data');
|
|
|
1862 |
|
1863 |
+
var previousVal = this.$element.val();
|
1864 |
+
this.$element.val(this.placeholder.id);
|
1865 |
|
1866 |
+
var unselectData = {
|
1867 |
+
data: data
|
1868 |
+
};
|
1869 |
+
this.trigger('clear', unselectData);
|
1870 |
+
if (unselectData.prevented) {
|
1871 |
+
this.$element.val(previousVal);
|
1872 |
+
return;
|
1873 |
+
}
|
1874 |
|
1875 |
+
for (var d = 0; d < data.length; d++) {
|
1876 |
+
unselectData = {
|
1877 |
+
data: data[d]
|
1878 |
+
};
|
1879 |
|
1880 |
+
// Trigger the `unselect` event, so people can prevent it from being
|
1881 |
+
// cleared.
|
1882 |
+
this.trigger('unselect', unselectData);
|
|
|
1883 |
|
1884 |
+
// If the event was prevented, don't clear it out.
|
1885 |
+
if (unselectData.prevented) {
|
1886 |
+
this.$element.val(previousVal);
|
1887 |
+
return;
|
1888 |
+
}
|
1889 |
+
}
|
1890 |
|
1891 |
+
this.$element.trigger('change');
|
1892 |
|
1893 |
+
this.trigger('toggle', {});
|
1894 |
+
};
|
1895 |
|
1896 |
+
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
|
1897 |
+
if (container.isOpen()) {
|
1898 |
+
return;
|
1899 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1900 |
|
1901 |
+
if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
|
1902 |
+
this._handleClear(evt);
|
1903 |
+
}
|
1904 |
+
};
|
1905 |
|
1906 |
+
AllowClear.prototype.update = function (decorated, data) {
|
1907 |
+
decorated.call(this, data);
|
|
|
|
|
1908 |
|
1909 |
+
if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
|
1910 |
+
data.length === 0) {
|
1911 |
+
return;
|
1912 |
+
}
|
|
|
|
|
|
|
1913 |
|
1914 |
+
var $remove = $(
|
1915 |
+
'<span class="select2-selection__clear">' +
|
1916 |
+
'×' +
|
1917 |
+
'</span>'
|
1918 |
+
);
|
1919 |
+
Utils.StoreData($remove[0], 'data', data);
|
1920 |
|
1921 |
+
this.$selection.find('.select2-selection__rendered').prepend($remove);
|
1922 |
+
};
|
1923 |
|
1924 |
+
return AllowClear;
|
1925 |
+
});
|
|
|
1926 |
|
1927 |
+
S2.define('select2/selection/search',[
|
1928 |
+
'jquery',
|
1929 |
+
'../utils',
|
1930 |
+
'../keys'
|
1931 |
+
], function ($, Utils, KEYS) {
|
1932 |
+
function Search (decorated, $element, options) {
|
1933 |
+
decorated.call(this, $element, options);
|
1934 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1935 |
|
1936 |
+
Search.prototype.render = function (decorated) {
|
1937 |
+
var $search = $(
|
1938 |
+
'<li class="select2-search select2-search--inline">' +
|
1939 |
+
'<input class="select2-search__field" type="search" tabindex="-1"' +
|
1940 |
+
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
|
1941 |
+
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
|
1942 |
+
'</li>'
|
1943 |
+
);
|
1944 |
|
1945 |
+
this.$searchContainer = $search;
|
1946 |
+
this.$search = $search.find('input');
|
|
|
|
|
1947 |
|
1948 |
+
var $rendered = decorated.call(this);
|
1949 |
+
|
1950 |
+
this._transferTabIndex();
|
1951 |
+
|
1952 |
+
return $rendered;
|
1953 |
+
};
|
1954 |
+
|
1955 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
1956 |
+
var self = this;
|
1957 |
+
|
1958 |
+
decorated.call(this, container, $container);
|
1959 |
+
|
1960 |
+
container.on('open', function () {
|
1961 |
+
self.$search.trigger('focus');
|
1962 |
+
});
|
1963 |
+
|
1964 |
+
container.on('close', function () {
|
1965 |
+
self.$search.val('');
|
1966 |
+
self.$search.removeAttr('aria-activedescendant');
|
1967 |
+
self.$search.trigger('focus');
|
1968 |
+
});
|
1969 |
+
|
1970 |
+
container.on('enable', function () {
|
1971 |
+
self.$search.prop('disabled', false);
|
1972 |
+
|
1973 |
+
self._transferTabIndex();
|
1974 |
+
});
|
1975 |
+
|
1976 |
+
container.on('disable', function () {
|
1977 |
+
self.$search.prop('disabled', true);
|
1978 |
+
});
|
1979 |
+
|
1980 |
+
container.on('focus', function (evt) {
|
1981 |
+
self.$search.trigger('focus');
|
1982 |
+
});
|
1983 |
+
|
1984 |
+
container.on('results:focus', function (params) {
|
1985 |
+
self.$search.attr('aria-activedescendant', params.id);
|
1986 |
+
});
|
1987 |
+
|
1988 |
+
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
|
1989 |
+
self.trigger('focus', evt);
|
1990 |
+
});
|
1991 |
+
|
1992 |
+
this.$selection.on('focusout', '.select2-search--inline', function (evt) {
|
1993 |
+
self._handleBlur(evt);
|
1994 |
+
});
|
1995 |
+
|
1996 |
+
this.$selection.on('keydown', '.select2-search--inline', function (evt) {
|
1997 |
+
evt.stopPropagation();
|
1998 |
+
|
1999 |
+
self.trigger('keypress', evt);
|
2000 |
+
|
2001 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
2002 |
+
|
2003 |
+
var key = evt.which;
|
2004 |
+
|
2005 |
+
if (key === KEYS.BACKSPACE && self.$search.val() === '') {
|
2006 |
+
var $previousChoice = self.$searchContainer
|
2007 |
+
.prev('.select2-selection__choice');
|
2008 |
+
|
2009 |
+
if ($previousChoice.length > 0) {
|
2010 |
+
var item = Utils.GetData($previousChoice[0], 'data');
|
2011 |
+
|
2012 |
+
self.searchRemoveChoice(item);
|
2013 |
+
|
2014 |
+
evt.preventDefault();
|
2015 |
+
}
|
2016 |
+
}
|
2017 |
+
});
|
2018 |
+
|
2019 |
+
// Try to detect the IE version should the `documentMode` property that
|
2020 |
+
// is stored on the document. This is only implemented in IE and is
|
2021 |
+
// slightly cleaner than doing a user agent check.
|
2022 |
+
// This property is not available in Edge, but Edge also doesn't have
|
2023 |
+
// this bug.
|
2024 |
+
var msie = document.documentMode;
|
2025 |
+
var disableInputEvents = msie && msie <= 11;
|
2026 |
+
|
2027 |
+
// Workaround for browsers which do not support the `input` event
|
2028 |
+
// This will prevent double-triggering of events for browsers which support
|
2029 |
+
// both the `keyup` and `input` events.
|
2030 |
+
this.$selection.on(
|
2031 |
+
'input.searchcheck',
|
2032 |
+
'.select2-search--inline',
|
2033 |
+
function (evt) {
|
2034 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
2035 |
+
// search box. To get around this issue, we are forced to ignore all
|
2036 |
+
// `input` events in IE and keep using `keyup`.
|
2037 |
+
if (disableInputEvents) {
|
2038 |
+
self.$selection.off('input.search input.searchcheck');
|
2039 |
+
return;
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
// Unbind the duplicated `keyup` event
|
2043 |
+
self.$selection.off('keyup.search');
|
2044 |
+
}
|
2045 |
+
);
|
2046 |
+
|
2047 |
+
this.$selection.on(
|
2048 |
+
'keyup.search input.search',
|
2049 |
+
'.select2-search--inline',
|
2050 |
+
function (evt) {
|
2051 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
2052 |
+
// search box. To get around this issue, we are forced to ignore all
|
2053 |
+
// `input` events in IE and keep using `keyup`.
|
2054 |
+
if (disableInputEvents && evt.type === 'input') {
|
2055 |
+
self.$selection.off('input.search input.searchcheck');
|
2056 |
+
return;
|
2057 |
+
}
|
2058 |
+
|
2059 |
+
var key = evt.which;
|
2060 |
+
|
2061 |
+
// We can freely ignore events from modifier keys
|
2062 |
+
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
|
2063 |
+
return;
|
2064 |
+
}
|
2065 |
+
|
2066 |
+
// Tabbing will be handled during the `keydown` phase
|
2067 |
+
if (key == KEYS.TAB) {
|
2068 |
+
return;
|
2069 |
+
}
|
2070 |
+
|
2071 |
+
self.handleSearch(evt);
|
2072 |
+
}
|
2073 |
+
);
|
2074 |
+
};
|
2075 |
+
|
2076 |
+
/**
|
2077 |
+
* This method will transfer the tabindex attribute from the rendered
|
2078 |
+
* selection to the search box. This allows for the search box to be used as
|
2079 |
+
* the primary focus instead of the selection container.
|
2080 |
+
*
|
2081 |
+
* @private
|
2082 |
+
*/
|
2083 |
+
Search.prototype._transferTabIndex = function (decorated) {
|
2084 |
+
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
|
2085 |
+
this.$selection.attr('tabindex', '-1');
|
2086 |
+
};
|
2087 |
+
|
2088 |
+
Search.prototype.createPlaceholder = function (decorated, placeholder) {
|
2089 |
+
this.$search.attr('placeholder', placeholder.text);
|
2090 |
+
};
|
2091 |
+
|
2092 |
+
Search.prototype.update = function (decorated, data) {
|
2093 |
+
var searchHadFocus = this.$search[0] == document.activeElement;
|
2094 |
+
|
2095 |
+
this.$search.attr('placeholder', '');
|
2096 |
+
|
2097 |
+
decorated.call(this, data);
|
2098 |
+
|
2099 |
+
this.$selection.find('.select2-selection__rendered')
|
2100 |
+
.append(this.$searchContainer);
|
2101 |
+
|
2102 |
+
this.resizeSearch();
|
2103 |
+
if (searchHadFocus) {
|
2104 |
+
var isTagInput = this.$element.find('[data-select2-tag]').length;
|
2105 |
+
if (isTagInput) {
|
2106 |
+
// fix IE11 bug where tag input lost focus
|
2107 |
+
this.$element.focus();
|
2108 |
+
} else {
|
2109 |
+
this.$search.focus();
|
2110 |
+
}
|
2111 |
+
}
|
2112 |
+
};
|
2113 |
+
|
2114 |
+
Search.prototype.handleSearch = function () {
|
2115 |
+
this.resizeSearch();
|
2116 |
+
|
2117 |
+
if (!this._keyUpPrevented) {
|
2118 |
+
var input = this.$search.val();
|
2119 |
+
|
2120 |
+
this.trigger('query', {
|
2121 |
+
term: input
|
2122 |
+
});
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
this._keyUpPrevented = false;
|
2126 |
+
};
|
2127 |
+
|
2128 |
+
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
2129 |
+
this.trigger('unselect', {
|
2130 |
+
data: item
|
2131 |
+
});
|
2132 |
+
|
2133 |
+
this.$search.val(item.text);
|
2134 |
+
this.handleSearch();
|
2135 |
+
};
|
2136 |
+
|
2137 |
+
Search.prototype.resizeSearch = function () {
|
2138 |
+
this.$search.css('width', '25px');
|
2139 |
+
|
2140 |
+
var width = '';
|
2141 |
+
|
2142 |
+
if (this.$search.attr('placeholder') !== '') {
|
2143 |
+
width = this.$selection.find('.select2-selection__rendered').innerWidth();
|
2144 |
+
} else {
|
2145 |
+
var minimumWidth = this.$search.val().length + 1;
|
2146 |
+
|
2147 |
+
width = (minimumWidth * 0.75) + 'em';
|
2148 |
+
}
|
2149 |
+
|
2150 |
+
this.$search.css('width', width);
|
2151 |
+
};
|
2152 |
+
|
2153 |
+
return Search;
|
2154 |
+
});
|
2155 |
+
|
2156 |
+
S2.define('select2/selection/eventRelay',[
|
2157 |
+
'jquery'
|
2158 |
+
], function ($) {
|
2159 |
+
function EventRelay () { }
|
2160 |
+
|
2161 |
+
EventRelay.prototype.bind = function (decorated, container, $container) {
|
2162 |
+
var self = this;
|
2163 |
+
var relayEvents = [
|
2164 |
+
'open', 'opening',
|
2165 |
+
'close', 'closing',
|
2166 |
+
'select', 'selecting',
|
2167 |
+
'unselect', 'unselecting',
|
2168 |
+
'clear', 'clearing'
|
2169 |
+
];
|
2170 |
+
|
2171 |
+
var preventableEvents = [
|
2172 |
+
'opening', 'closing', 'selecting', 'unselecting', 'clearing'
|
2173 |
+
];
|
2174 |
+
|
2175 |
+
decorated.call(this, container, $container);
|
2176 |
+
|
2177 |
+
container.on('*', function (name, params) {
|
2178 |
+
// Ignore events that should not be relayed
|
2179 |
+
if ($.inArray(name, relayEvents) === -1) {
|
2180 |
+
return;
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
// The parameters should always be an object
|
2184 |
+
params = params || {};
|
2185 |
+
|
2186 |
+
// Generate the jQuery event for the Select2 event
|
2187 |
+
var evt = $.Event('select2:' + name, {
|
2188 |
+
params: params
|
2189 |
+
});
|
2190 |
+
|
2191 |
+
self.$element.trigger(evt);
|
2192 |
+
|
2193 |
+
// Only handle preventable events if it was one
|
2194 |
+
if ($.inArray(name, preventableEvents) === -1) {
|
2195 |
+
return;
|
2196 |
+
}
|
2197 |
+
|
2198 |
+
params.prevented = evt.isDefaultPrevented();
|
2199 |
+
});
|
2200 |
+
};
|
2201 |
+
|
2202 |
+
return EventRelay;
|
2203 |
+
});
|
2204 |
+
|
2205 |
+
S2.define('select2/translation',[
|
2206 |
+
'jquery',
|
2207 |
+
'require'
|
2208 |
+
], function ($, require) {
|
2209 |
+
function Translation (dict) {
|
2210 |
+
this.dict = dict || {};
|
2211 |
+
}
|
2212 |
+
|
2213 |
+
Translation.prototype.all = function () {
|
2214 |
+
return this.dict;
|
2215 |
+
};
|
2216 |
+
|
2217 |
+
Translation.prototype.get = function (key) {
|
2218 |
+
return this.dict[key];
|
2219 |
+
};
|
2220 |
+
|
2221 |
+
Translation.prototype.extend = function (translation) {
|
2222 |
+
this.dict = $.extend({}, translation.all(), this.dict);
|
2223 |
+
};
|
2224 |
+
|
2225 |
+
// Static functions
|
2226 |
+
|
2227 |
+
Translation._cache = {};
|
2228 |
+
|
2229 |
+
Translation.loadPath = function (path) {
|
2230 |
+
if (!(path in Translation._cache)) {
|
2231 |
+
var translations = require(path);
|
2232 |
+
|
2233 |
+
Translation._cache[path] = translations;
|
2234 |
+
}
|
2235 |
+
|
2236 |
+
return new Translation(Translation._cache[path]);
|
2237 |
+
};
|
2238 |
+
|
2239 |
+
return Translation;
|
2240 |
+
});
|
2241 |
+
|
2242 |
+
S2.define('select2/diacritics',[
|
2243 |
+
|
2244 |
+
], function () {
|
2245 |
+
var diacritics = {
|
2246 |
+
'\u24B6': 'A',
|
2247 |
+
'\uFF21': 'A',
|
2248 |
+
'\u00C0': 'A',
|
2249 |
+
'\u00C1': 'A',
|
2250 |
+
'\u00C2': 'A',
|
2251 |
+
'\u1EA6': 'A',
|
2252 |
+
'\u1EA4': 'A',
|
2253 |
+
'\u1EAA': 'A',
|
2254 |
+
'\u1EA8': 'A',
|
2255 |
+
'\u00C3': 'A',
|
2256 |
+
'\u0100': 'A',
|
2257 |
+
'\u0102': 'A',
|
2258 |
+
'\u1EB0': 'A',
|
2259 |
+
'\u1EAE': 'A',
|
2260 |
+
'\u1EB4': 'A',
|
2261 |
+
'\u1EB2': 'A',
|
2262 |
+
'\u0226': 'A',
|
2263 |
+
'\u01E0': 'A',
|
2264 |
+
'\u00C4': 'A',
|
2265 |
+
'\u01DE': 'A',
|
2266 |
+
'\u1EA2': 'A',
|
2267 |
+
'\u00C5': 'A',
|
2268 |
+
'\u01FA': 'A',
|
2269 |
+
'\u01CD': 'A',
|
2270 |
+
'\u0200': 'A',
|
2271 |
+
'\u0202': 'A',
|
2272 |
+
'\u1EA0': 'A',
|
2273 |
+
'\u1EAC': 'A',
|
2274 |
+
'\u1EB6': 'A',
|
2275 |
+
'\u1E00': 'A',
|
2276 |
+
'\u0104': 'A',
|
2277 |
+
'\u023A': 'A',
|
2278 |
+
'\u2C6F': 'A',
|
2279 |
+
'\uA732': 'AA',
|
2280 |
+
'\u00C6': 'AE',
|
2281 |
+
'\u01FC': 'AE',
|
2282 |
+
'\u01E2': 'AE',
|
2283 |
+
'\uA734': 'AO',
|
2284 |
+
'\uA736': 'AU',
|
2285 |
+
'\uA738': 'AV',
|
2286 |
+
'\uA73A': 'AV',
|
2287 |
+
'\uA73C': 'AY',
|
2288 |
+
'\u24B7': 'B',
|
2289 |
+
'\uFF22': 'B',
|
2290 |
+
'\u1E02': 'B',
|
2291 |
+
'\u1E04': 'B',
|
2292 |
+
'\u1E06': 'B',
|
2293 |
+
'\u0243': 'B',
|
2294 |
+
'\u0182': 'B',
|
2295 |
+
'\u0181': 'B',
|
2296 |
+
'\u24B8': 'C',
|
2297 |
+
'\uFF23': 'C',
|
2298 |
+
'\u0106': 'C',
|
2299 |
+
'\u0108': 'C',
|
2300 |
+
'\u010A': 'C',
|
2301 |
+
'\u010C': 'C',
|
2302 |
+
'\u00C7': 'C',
|
2303 |
+
'\u1E08': 'C',
|
2304 |
+
'\u0187': 'C',
|
2305 |
+
'\u023B': 'C',
|
2306 |
+
'\uA73E': 'C',
|
2307 |
+
'\u24B9': 'D',
|
2308 |
+
'\uFF24': 'D',
|
2309 |
+
'\u1E0A': 'D',
|
2310 |
+
'\u010E': 'D',
|
2311 |
+
'\u1E0C': 'D',
|
2312 |
+
'\u1E10': 'D',
|
2313 |
+
'\u1E12': 'D',
|
2314 |
+
'\u1E0E': 'D',
|
2315 |
+
'\u0110': 'D',
|
2316 |
+
'\u018B': 'D',
|
2317 |
+
'\u018A': 'D',
|
2318 |
+
'\u0189': 'D',
|
2319 |
+
'\uA779': 'D',
|
2320 |
+
'\u01F1': 'DZ',
|
2321 |
+
'\u01C4': 'DZ',
|
2322 |
+
'\u01F2': 'Dz',
|
2323 |
+
'\u01C5': 'Dz',
|
2324 |
+
'\u24BA': 'E',
|
2325 |
+
'\uFF25': 'E',
|
2326 |
+
'\u00C8': 'E',
|
2327 |
+
'\u00C9': 'E',
|
2328 |
+
'\u00CA': 'E',
|
2329 |
+
'\u1EC0': 'E',
|
2330 |
+
'\u1EBE': 'E',
|
2331 |
+
'\u1EC4': 'E',
|
2332 |
+
'\u1EC2': 'E',
|
2333 |
+
'\u1EBC': 'E',
|
2334 |
+
'\u0112': 'E',
|
2335 |
+
'\u1E14': 'E',
|
2336 |
+
'\u1E16': 'E',
|
2337 |
+
'\u0114': 'E',
|
2338 |
+
'\u0116': 'E',
|
2339 |
+
'\u00CB': 'E',
|
2340 |
+
'\u1EBA': 'E',
|
2341 |
+
'\u011A': 'E',
|
2342 |
+
'\u0204': 'E',
|
2343 |
+
'\u0206': 'E',
|
2344 |
+
'\u1EB8': 'E',
|
2345 |
+
'\u1EC6': 'E',
|
2346 |
+
'\u0228': 'E',
|
2347 |
+
'\u1E1C': 'E',
|
2348 |
+
'\u0118': 'E',
|
2349 |
+
'\u1E18': 'E',
|
2350 |
+
'\u1E1A': 'E',
|
2351 |
+
'\u0190': 'E',
|
2352 |
+
'\u018E': 'E',
|
2353 |
+
'\u24BB': 'F',
|
2354 |
+
'\uFF26': 'F',
|
2355 |
+
'\u1E1E': 'F',
|
2356 |
+
'\u0191': 'F',
|
2357 |
+
'\uA77B': 'F',
|
2358 |
+
'\u24BC': 'G',
|
2359 |
+
'\uFF27': 'G',
|
2360 |
+
'\u01F4': 'G',
|
2361 |
+
'\u011C': 'G',
|
2362 |
+
'\u1E20': 'G',
|
2363 |
+
'\u011E': 'G',
|
2364 |
+
'\u0120': 'G',
|
2365 |
+
'\u01E6': 'G',
|
2366 |
+
'\u0122': 'G',
|
2367 |
+
'\u01E4': 'G',
|
2368 |
+
'\u0193': 'G',
|
2369 |
+
'\uA7A0': 'G',
|
2370 |
+
'\uA77D': 'G',
|
2371 |
+
'\uA77E': 'G',
|
2372 |
+
'\u24BD': 'H',
|
2373 |
+
'\uFF28': 'H',
|
2374 |
+
'\u0124': 'H',
|
2375 |
+
'\u1E22': 'H',
|
2376 |
+
'\u1E26': 'H',
|
2377 |
+
'\u021E': 'H',
|
2378 |
+
'\u1E24': 'H',
|
2379 |
+
'\u1E28': 'H',
|
2380 |
+
'\u1E2A': 'H',
|
2381 |
+
'\u0126': 'H',
|
2382 |
+
'\u2C67': 'H',
|
2383 |
+
'\u2C75': 'H',
|
2384 |
+
'\uA78D': 'H',
|
2385 |
+
'\u24BE': 'I',
|
2386 |
+
'\uFF29': 'I',
|
2387 |
+
'\u00CC': 'I',
|
2388 |
+
'\u00CD': 'I',
|
2389 |
+
'\u00CE': 'I',
|
2390 |
+
'\u0128': 'I',
|
2391 |
+
'\u012A': 'I',
|
2392 |
+
'\u012C': 'I',
|
2393 |
+
'\u0130': 'I',
|
2394 |
+
'\u00CF': 'I',
|
2395 |
+
'\u1E2E': 'I',
|
2396 |
+
'\u1EC8': 'I',
|
2397 |
+
'\u01CF': 'I',
|
2398 |
+
'\u0208': 'I',
|
2399 |
+
'\u020A': 'I',
|
2400 |
+
'\u1ECA': 'I',
|
2401 |
+
'\u012E': 'I',
|
2402 |
+
'\u1E2C': 'I',
|
2403 |
+
'\u0197': 'I',
|
2404 |
+
'\u24BF': 'J',
|
2405 |
+
'\uFF2A': 'J',
|
2406 |
+
'\u0134': 'J',
|
2407 |
+
'\u0248': 'J',
|
2408 |
+
'\u24C0': 'K',
|
2409 |
+
'\uFF2B': 'K',
|
2410 |
+
'\u1E30': 'K',
|
2411 |
+
'\u01E8': 'K',
|
2412 |
+
'\u1E32': 'K',
|
2413 |
+
'\u0136': 'K',
|
2414 |
+
'\u1E34': 'K',
|
2415 |
+
'\u0198': 'K',
|
2416 |
+
'\u2C69': 'K',
|
2417 |
+
'\uA740': 'K',
|
2418 |
+
'\uA742': 'K',
|
2419 |
+
'\uA744': 'K',
|
2420 |
+
'\uA7A2': 'K',
|
2421 |
+
'\u24C1': 'L',
|
2422 |
+
'\uFF2C': 'L',
|
2423 |
+
'\u013F': 'L',
|
2424 |
+
'\u0139': 'L',
|
2425 |
+
'\u013D': 'L',
|
2426 |
+
'\u1E36': 'L',
|
2427 |
+
'\u1E38': 'L',
|
2428 |
+
'\u013B': 'L',
|
2429 |
+
'\u1E3C': 'L',
|
2430 |
+
'\u1E3A': 'L',
|
2431 |
+
'\u0141': 'L',
|
2432 |
+
'\u023D': 'L',
|
2433 |
+
'\u2C62': 'L',
|
2434 |
+
'\u2C60': 'L',
|
2435 |
+
'\uA748': 'L',
|
2436 |
+
'\uA746': 'L',
|
2437 |
+
'\uA780': 'L',
|
2438 |
+
'\u01C7': 'LJ',
|
2439 |
+
'\u01C8': 'Lj',
|
2440 |
+
'\u24C2': 'M',
|
2441 |
+
'\uFF2D': 'M',
|
2442 |
+
'\u1E3E': 'M',
|
2443 |
+
'\u1E40': 'M',
|
2444 |
+
'\u1E42': 'M',
|
2445 |
+
'\u2C6E': 'M',
|
2446 |
+
'\u019C': 'M',
|
2447 |
+
'\u24C3': 'N',
|
2448 |
+
'\uFF2E': 'N',
|
2449 |
+
'\u01F8': 'N',
|
2450 |
+
'\u0143': 'N',
|
2451 |
+
'\u00D1': 'N',
|
2452 |
+
'\u1E44': 'N',
|
2453 |
+
'\u0147': 'N',
|
2454 |
+
'\u1E46': 'N',
|
2455 |
+
'\u0145': 'N',
|
2456 |
+
'\u1E4A': 'N',
|
2457 |
+
'\u1E48': 'N',
|
2458 |
+
'\u0220': 'N',
|
2459 |
+
'\u019D': 'N',
|
2460 |
+
'\uA790': 'N',
|
2461 |
+
'\uA7A4': 'N',
|
2462 |
+
'\u01CA': 'NJ',
|
2463 |
+
'\u01CB': 'Nj',
|
2464 |
+
'\u24C4': 'O',
|
2465 |
+
'\uFF2F': 'O',
|
2466 |
+
'\u00D2': 'O',
|
2467 |
+
'\u00D3': 'O',
|
2468 |
+
'\u00D4': 'O',
|
2469 |
+
'\u1ED2': 'O',
|
2470 |
+
'\u1ED0': 'O',
|
2471 |
+
'\u1ED6': 'O',
|
2472 |
+
'\u1ED4': 'O',
|
2473 |
+
'\u00D5': 'O',
|
2474 |
+
'\u1E4C': 'O',
|
2475 |
+
'\u022C': 'O',
|
2476 |
+
'\u1E4E': 'O',
|
2477 |
+
'\u014C': 'O',
|
2478 |
+
'\u1E50': 'O',
|
2479 |
+
'\u1E52': 'O',
|
2480 |
+
'\u014E': 'O',
|
2481 |
+
'\u022E': 'O',
|
2482 |
+
'\u0230': 'O',
|
2483 |
+
'\u00D6': 'O',
|
2484 |
+
'\u022A': 'O',
|
2485 |
+
'\u1ECE': 'O',
|
2486 |
+
'\u0150': 'O',
|
2487 |
+
'\u01D1': 'O',
|
2488 |
+
'\u020C': 'O',
|
2489 |
+
'\u020E': 'O',
|
2490 |
+
'\u01A0': 'O',
|
2491 |
+
'\u1EDC': 'O',
|
2492 |
+
'\u1EDA': 'O',
|
2493 |
+
'\u1EE0': 'O',
|
2494 |
+
'\u1EDE': 'O',
|
2495 |
+
'\u1EE2': 'O',
|
2496 |
+
'\u1ECC': 'O',
|
2497 |
+
'\u1ED8': 'O',
|
2498 |
+
'\u01EA': 'O',
|
2499 |
+
'\u01EC': 'O',
|
2500 |
+
'\u00D8': 'O',
|
2501 |
+
'\u01FE': 'O',
|
2502 |
+
'\u0186': 'O',
|
2503 |
+
'\u019F': 'O',
|
2504 |
+
'\uA74A': 'O',
|
2505 |
+
'\uA74C': 'O',
|
2506 |
+
'\u01A2': 'OI',
|
2507 |
+
'\uA74E': 'OO',
|
2508 |
+
'\u0222': 'OU',
|
2509 |
+
'\u24C5': 'P',
|
2510 |
+
'\uFF30': 'P',
|
2511 |
+
'\u1E54': 'P',
|
2512 |
+
'\u1E56': 'P',
|
2513 |
+
'\u01A4': 'P',
|
2514 |
+
'\u2C63': 'P',
|
2515 |
+
'\uA750': 'P',
|
2516 |
+
'\uA752': 'P',
|
2517 |
+
'\uA754': 'P',
|
2518 |
+
'\u24C6': 'Q',
|
2519 |
+
'\uFF31': 'Q',
|
2520 |
+
'\uA756': 'Q',
|
2521 |
+
'\uA758': 'Q',
|
2522 |
+
'\u024A': 'Q',
|
2523 |
+
'\u24C7': 'R',
|
2524 |
+
'\uFF32': 'R',
|
2525 |
+
'\u0154': 'R',
|
2526 |
+
'\u1E58': 'R',
|
2527 |
+
'\u0158': 'R',
|
2528 |
+
'\u0210': 'R',
|
2529 |
+
'\u0212': 'R',
|
2530 |
+
'\u1E5A': 'R',
|
2531 |
+
'\u1E5C': 'R',
|
2532 |
+
'\u0156': 'R',
|
2533 |
+
'\u1E5E': 'R',
|
2534 |
+
'\u024C': 'R',
|
2535 |
+
'\u2C64': 'R',
|
2536 |
+
'\uA75A': 'R',
|
2537 |
+
'\uA7A6': 'R',
|
2538 |
+
'\uA782': 'R',
|
2539 |
+
'\u24C8': 'S',
|
2540 |
+
'\uFF33': 'S',
|
2541 |
+
'\u1E9E': 'S',
|
2542 |
+
'\u015A': 'S',
|
2543 |
+
'\u1E64': 'S',
|
2544 |
+
'\u015C': 'S',
|
2545 |
+
'\u1E60': 'S',
|
2546 |
+
'\u0160': 'S',
|
2547 |
+
'\u1E66': 'S',
|
2548 |
+
'\u1E62': 'S',
|
2549 |
+
'\u1E68': 'S',
|
2550 |
+
'\u0218': 'S',
|
2551 |
+
'\u015E': 'S',
|
2552 |
+
'\u2C7E': 'S',
|
2553 |
+
'\uA7A8': 'S',
|
2554 |
+
'\uA784': 'S',
|
2555 |
+
'\u24C9': 'T',
|
2556 |
+
'\uFF34': 'T',
|
2557 |
+
'\u1E6A': 'T',
|
2558 |
+
'\u0164': 'T',
|
2559 |
+
'\u1E6C': 'T',
|
2560 |
+
'\u021A': 'T',
|
2561 |
+
'\u0162': 'T',
|
2562 |
+
'\u1E70': 'T',
|
2563 |
+
'\u1E6E': 'T',
|
2564 |
+
'\u0166': 'T',
|
2565 |
+
'\u01AC': 'T',
|
2566 |
+
'\u01AE': 'T',
|
2567 |
+
'\u023E': 'T',
|
2568 |
+
'\uA786': 'T',
|
2569 |
+
'\uA728': 'TZ',
|
2570 |
+
'\u24CA': 'U',
|
2571 |
+
'\uFF35': 'U',
|
2572 |
+
'\u00D9': 'U',
|
2573 |
+
'\u00DA': 'U',
|
2574 |
+
'\u00DB': 'U',
|
2575 |
+
'\u0168': 'U',
|
2576 |
+
'\u1E78': 'U',
|
2577 |
+
'\u016A': 'U',
|
2578 |
+
'\u1E7A': 'U',
|
2579 |
+
'\u016C': 'U',
|
2580 |
+
'\u00DC': 'U',
|
2581 |
+
'\u01DB': 'U',
|
2582 |
+
'\u01D7': 'U',
|
2583 |
+
'\u01D5': 'U',
|
2584 |
+
'\u01D9': 'U',
|
2585 |
+
'\u1EE6': 'U',
|
2586 |
+
'\u016E': 'U',
|
2587 |
+
'\u0170': 'U',
|
2588 |
+
'\u01D3': 'U',
|
2589 |
+
'\u0214': 'U',
|
2590 |
+
'\u0216': 'U',
|
2591 |
+
'\u01AF': 'U',
|
2592 |
+
'\u1EEA': 'U',
|
2593 |
+
'\u1EE8': 'U',
|
2594 |
+
'\u1EEE': 'U',
|
2595 |
+
'\u1EEC': 'U',
|
2596 |
+
'\u1EF0': 'U',
|
2597 |
+
'\u1EE4': 'U',
|
2598 |
+
'\u1E72': 'U',
|
2599 |
+
'\u0172': 'U',
|
2600 |
+
'\u1E76': 'U',
|
2601 |
+
'\u1E74': 'U',
|
2602 |
+
'\u0244': 'U',
|
2603 |
+
'\u24CB': 'V',
|
2604 |
+
'\uFF36': 'V',
|
2605 |
+
'\u1E7C': 'V',
|
2606 |
+
'\u1E7E': 'V',
|
2607 |
+
'\u01B2': 'V',
|
2608 |
+
'\uA75E': 'V',
|
2609 |
+
'\u0245': 'V',
|
2610 |
+
'\uA760': 'VY',
|
2611 |
+
'\u24CC': 'W',
|
2612 |
+
'\uFF37': 'W',
|
2613 |
+
'\u1E80': 'W',
|
2614 |
+
'\u1E82': 'W',
|
2615 |
+
'\u0174': 'W',
|
2616 |
+
'\u1E86': 'W',
|
2617 |
+
'\u1E84': 'W',
|
2618 |
+
'\u1E88': 'W',
|
2619 |
+
'\u2C72': 'W',
|
2620 |
+
'\u24CD': 'X',
|
2621 |
+
'\uFF38': 'X',
|
2622 |
+
'\u1E8A': 'X',
|
2623 |
+
'\u1E8C': 'X',
|
2624 |
+
'\u24CE': 'Y',
|
2625 |
+
'\uFF39': 'Y',
|
2626 |
+
'\u1EF2': 'Y',
|
2627 |
+
'\u00DD': 'Y',
|
2628 |
+
'\u0176': 'Y',
|
2629 |
+
'\u1EF8': 'Y',
|
2630 |
+
'\u0232': 'Y',
|
2631 |
+
'\u1E8E': 'Y',
|
2632 |
+
'\u0178': 'Y',
|
2633 |
+
'\u1EF6': 'Y',
|
2634 |
+
'\u1EF4': 'Y',
|
2635 |
+
'\u01B3': 'Y',
|
2636 |
+
'\u024E': 'Y',
|
2637 |
+
'\u1EFE': 'Y',
|
2638 |
+
'\u24CF': 'Z',
|
2639 |
+
'\uFF3A': 'Z',
|
2640 |
+
'\u0179': 'Z',
|
2641 |
+
'\u1E90': 'Z',
|
2642 |
+
'\u017B': 'Z',
|
2643 |
+
'\u017D': 'Z',
|
2644 |
+
'\u1E92': 'Z',
|
2645 |
+
'\u1E94': 'Z',
|
2646 |
+
'\u01B5': 'Z',
|
2647 |
+
'\u0224': 'Z',
|
2648 |
+
'\u2C7F': 'Z',
|
2649 |
+
'\u2C6B': 'Z',
|
2650 |
+
'\uA762': 'Z',
|
2651 |
+
'\u24D0': 'a',
|
2652 |
+
'\uFF41': 'a',
|
2653 |
+
'\u1E9A': 'a',
|
2654 |
+
'\u00E0': 'a',
|
2655 |
+
'\u00E1': 'a',
|
2656 |
+
'\u00E2': 'a',
|
2657 |
+
'\u1EA7': 'a',
|
2658 |
+
'\u1EA5': 'a',
|
2659 |
+
'\u1EAB': 'a',
|
2660 |
+
'\u1EA9': 'a',
|
2661 |
+
'\u00E3': 'a',
|
2662 |
+
'\u0101': 'a',
|
2663 |
+
'\u0103': 'a',
|
2664 |
+
'\u1EB1': 'a',
|
2665 |
+
'\u1EAF': 'a',
|
2666 |
+
'\u1EB5': 'a',
|
2667 |
+
'\u1EB3': 'a',
|
2668 |
+
'\u0227': 'a',
|
2669 |
+
'\u01E1': 'a',
|
2670 |
+
'\u00E4': 'a',
|
2671 |
+
'\u01DF': 'a',
|
2672 |
+
'\u1EA3': 'a',
|
2673 |
+
'\u00E5': 'a',
|
2674 |
+
'\u01FB': 'a',
|
2675 |
+
'\u01CE': 'a',
|
2676 |
+
'\u0201': 'a',
|
2677 |
+
'\u0203': 'a',
|
2678 |
+
'\u1EA1': 'a',
|
2679 |
+
'\u1EAD': 'a',
|
2680 |
+
'\u1EB7': 'a',
|
2681 |
+
'\u1E01': 'a',
|
2682 |
+
'\u0105': 'a',
|
2683 |
+
'\u2C65': 'a',
|
2684 |
+
'\u0250': 'a',
|
2685 |
+
'\uA733': 'aa',
|
2686 |
+
'\u00E6': 'ae',
|
2687 |
+
'\u01FD': 'ae',
|
2688 |
+
'\u01E3': 'ae',
|
2689 |
+
'\uA735': 'ao',
|
2690 |
+
'\uA737': 'au',
|
2691 |
+
'\uA739': 'av',
|
2692 |
+
'\uA73B': 'av',
|
2693 |
+
'\uA73D': 'ay',
|
2694 |
+
'\u24D1': 'b',
|
2695 |
+
'\uFF42': 'b',
|
2696 |
+
'\u1E03': 'b',
|
2697 |
+
'\u1E05': 'b',
|
2698 |
+
'\u1E07': 'b',
|
2699 |
+
'\u0180': 'b',
|
2700 |
+
'\u0183': 'b',
|
2701 |
+
'\u0253': 'b',
|
2702 |
+
'\u24D2': 'c',
|
2703 |
+
'\uFF43': 'c',
|
2704 |
+
'\u0107': 'c',
|
2705 |
+
'\u0109': 'c',
|
2706 |
+
'\u010B': 'c',
|
2707 |
+
'\u010D': 'c',
|
2708 |
+
'\u00E7': 'c',
|
2709 |
+
'\u1E09': 'c',
|
2710 |
+
'\u0188': 'c',
|
2711 |
+
'\u023C': 'c',
|
2712 |
+
'\uA73F': 'c',
|
2713 |
+
'\u2184': 'c',
|
2714 |
+
'\u24D3': 'd',
|
2715 |
+
'\uFF44': 'd',
|
2716 |
+
'\u1E0B': 'd',
|
2717 |
+
'\u010F': 'd',
|
2718 |
+
'\u1E0D': 'd',
|
2719 |
+
'\u1E11': 'd',
|
2720 |
+
'\u1E13': 'd',
|
2721 |
+
'\u1E0F': 'd',
|
2722 |
+
'\u0111': 'd',
|
2723 |
+
'\u018C': 'd',
|
2724 |
+
'\u0256': 'd',
|
2725 |
+
'\u0257': 'd',
|
2726 |
+
'\uA77A': 'd',
|
2727 |
+
'\u01F3': 'dz',
|
2728 |
+
'\u01C6': 'dz',
|
2729 |
+
'\u24D4': 'e',
|
2730 |
+
'\uFF45': 'e',
|
2731 |
+
'\u00E8': 'e',
|
2732 |
+
'\u00E9': 'e',
|
2733 |
+
'\u00EA': 'e',
|
2734 |
+
'\u1EC1': 'e',
|
2735 |
+
'\u1EBF': 'e',
|
2736 |
+
'\u1EC5': 'e',
|
2737 |
+
'\u1EC3': 'e',
|
2738 |
+
'\u1EBD': 'e',
|
2739 |
+
'\u0113': 'e',
|
2740 |
+
'\u1E15': 'e',
|
2741 |
+
'\u1E17': 'e',
|
2742 |
+
'\u0115': 'e',
|
2743 |
+
'\u0117': 'e',
|
2744 |
+
'\u00EB': 'e',
|
2745 |
+
'\u1EBB': 'e',
|
2746 |
+
'\u011B': 'e',
|
2747 |
+
'\u0205': 'e',
|
2748 |
+
'\u0207': 'e',
|
2749 |
+
'\u1EB9': 'e',
|
2750 |
+
'\u1EC7': 'e',
|
2751 |
+
'\u0229': 'e',
|
2752 |
+
'\u1E1D': 'e',
|
2753 |
+
'\u0119': 'e',
|
2754 |
+
'\u1E19': 'e',
|
2755 |
+
'\u1E1B': 'e',
|
2756 |
+
'\u0247': 'e',
|
2757 |
+
'\u025B': 'e',
|
2758 |
+
'\u01DD': 'e',
|
2759 |
+
'\u24D5': 'f',
|
2760 |
+
'\uFF46': 'f',
|
2761 |
+
'\u1E1F': 'f',
|
2762 |
+
'\u0192': 'f',
|
2763 |
+
'\uA77C': 'f',
|
2764 |
+
'\u24D6': 'g',
|
2765 |
+
'\uFF47': 'g',
|
2766 |
+
'\u01F5': 'g',
|
2767 |
+
'\u011D': 'g',
|
2768 |
+
'\u1E21': 'g',
|
2769 |
+
'\u011F': 'g',
|
2770 |
+
'\u0121': 'g',
|
2771 |
+
'\u01E7': 'g',
|
2772 |
+
'\u0123': 'g',
|
2773 |
+
'\u01E5': 'g',
|
2774 |
+
'\u0260': 'g',
|
2775 |
+
'\uA7A1': 'g',
|
2776 |
+
'\u1D79': 'g',
|
2777 |
+
'\uA77F': 'g',
|
2778 |
+
'\u24D7': 'h',
|
2779 |
+
'\uFF48': 'h',
|
2780 |
+
'\u0125': 'h',
|
2781 |
+
'\u1E23': 'h',
|
2782 |
+
'\u1E27': 'h',
|
2783 |
+
'\u021F': 'h',
|
2784 |
+
'\u1E25': 'h',
|
2785 |
+
'\u1E29': 'h',
|
2786 |
+
'\u1E2B': 'h',
|
2787 |
+
'\u1E96': 'h',
|
2788 |
+
'\u0127': 'h',
|
2789 |
+
'\u2C68': 'h',
|
2790 |
+
'\u2C76': 'h',
|
2791 |
+
'\u0265': 'h',
|
2792 |
+
'\u0195': 'hv',
|
2793 |
+
'\u24D8': 'i',
|
2794 |
+
'\uFF49': 'i',
|
2795 |
+
'\u00EC': 'i',
|
2796 |
+
'\u00ED': 'i',
|
2797 |
+
'\u00EE': 'i',
|
2798 |
+
'\u0129': 'i',
|
2799 |
+
'\u012B': 'i',
|
2800 |
+
'\u012D': 'i',
|
2801 |
+
'\u00EF': 'i',
|
2802 |
+
'\u1E2F': 'i',
|
2803 |
+
'\u1EC9': 'i',
|
2804 |
+
'\u01D0': 'i',
|
2805 |
+
'\u0209': 'i',
|
2806 |
+
'\u020B': 'i',
|
2807 |
+
'\u1ECB': 'i',
|
2808 |
+
'\u012F': 'i',
|
2809 |
+
'\u1E2D': 'i',
|
2810 |
+
'\u0268': 'i',
|
2811 |
+
'\u0131': 'i',
|
2812 |
+
'\u24D9': 'j',
|
2813 |
+
'\uFF4A': 'j',
|
2814 |
+
'\u0135': 'j',
|
2815 |
+
'\u01F0': 'j',
|
2816 |
+
'\u0249': 'j',
|
2817 |
+
'\u24DA': 'k',
|
2818 |
+
'\uFF4B': 'k',
|
2819 |
+
'\u1E31': 'k',
|
2820 |
+
'\u01E9': 'k',
|
2821 |
+
'\u1E33': 'k',
|
2822 |
+
'\u0137': 'k',
|
2823 |
+
'\u1E35': 'k',
|
2824 |
+
'\u0199': 'k',
|
2825 |
+
'\u2C6A': 'k',
|
2826 |
+
'\uA741': 'k',
|
2827 |
+
'\uA743': 'k',
|
2828 |
+
'\uA745': 'k',
|
2829 |
+
'\uA7A3': 'k',
|
2830 |
+
'\u24DB': 'l',
|
2831 |
+
'\uFF4C': 'l',
|
2832 |
+
'\u0140': 'l',
|
2833 |
+
'\u013A': 'l',
|
2834 |
+
'\u013E': 'l',
|
2835 |
+
'\u1E37': 'l',
|
2836 |
+
'\u1E39': 'l',
|
2837 |
+
'\u013C': 'l',
|
2838 |
+
'\u1E3D': 'l',
|
2839 |
+
'\u1E3B': 'l',
|
2840 |
+
'\u017F': 'l',
|
2841 |
+
'\u0142': 'l',
|
2842 |
+
'\u019A': 'l',
|
2843 |
+
'\u026B': 'l',
|
2844 |
+
'\u2C61': 'l',
|
2845 |
+
'\uA749': 'l',
|
2846 |
+
'\uA781': 'l',
|
2847 |
+
'\uA747': 'l',
|
2848 |
+
'\u01C9': 'lj',
|
2849 |
+
'\u24DC': 'm',
|
2850 |
+
'\uFF4D': 'm',
|
2851 |
+
'\u1E3F': 'm',
|
2852 |
+
'\u1E41': 'm',
|
2853 |
+
'\u1E43': 'm',
|
2854 |
+
'\u0271': 'm',
|
2855 |
+
'\u026F': 'm',
|
2856 |
+
'\u24DD': 'n',
|
2857 |
+
'\uFF4E': 'n',
|
2858 |
+
'\u01F9': 'n',
|
2859 |
+
'\u0144': 'n',
|
2860 |
+
'\u00F1': 'n',
|
2861 |
+
'\u1E45': 'n',
|
2862 |
+
'\u0148': 'n',
|
2863 |
+
'\u1E47': 'n',
|
2864 |
+
'\u0146': 'n',
|
2865 |
+
'\u1E4B': 'n',
|
2866 |
+
'\u1E49': 'n',
|
2867 |
+
'\u019E': 'n',
|
2868 |
+
'\u0272': 'n',
|
2869 |
+
'\u0149': 'n',
|
2870 |
+
'\uA791': 'n',
|
2871 |
+
'\uA7A5': 'n',
|
2872 |
+
'\u01CC': 'nj',
|
2873 |
+
'\u24DE': 'o',
|
2874 |
+
'\uFF4F': 'o',
|
2875 |
+
'\u00F2': 'o',
|
2876 |
+
'\u00F3': 'o',
|
2877 |
+
'\u00F4': 'o',
|
2878 |
+
'\u1ED3': 'o',
|
2879 |
+
'\u1ED1': 'o',
|
2880 |
+
'\u1ED7': 'o',
|
2881 |
+
'\u1ED5': 'o',
|
2882 |
+
'\u00F5': 'o',
|
2883 |
+
'\u1E4D': 'o',
|
2884 |
+
'\u022D': 'o',
|
2885 |
+
'\u1E4F': 'o',
|
2886 |
+
'\u014D': 'o',
|
2887 |
+
'\u1E51': 'o',
|
2888 |
+
'\u1E53': 'o',
|
2889 |
+
'\u014F': 'o',
|
2890 |
+
'\u022F': 'o',
|
2891 |
+
'\u0231': 'o',
|
2892 |
+
'\u00F6': 'o',
|
2893 |
+
'\u022B': 'o',
|
2894 |
+
'\u1ECF': 'o',
|
2895 |
+
'\u0151': 'o',
|
2896 |
+
'\u01D2': 'o',
|
2897 |
+
'\u020D': 'o',
|
2898 |
+
'\u020F': 'o',
|
2899 |
+
'\u01A1': 'o',
|
2900 |
+
'\u1EDD': 'o',
|
2901 |
+
'\u1EDB': 'o',
|
2902 |
+
'\u1EE1': 'o',
|
2903 |
+
'\u1EDF': 'o',
|
2904 |
+
'\u1EE3': 'o',
|
2905 |
+
'\u1ECD': 'o',
|
2906 |
+
'\u1ED9': 'o',
|
2907 |
+
'\u01EB': 'o',
|
2908 |
+
'\u01ED': 'o',
|
2909 |
+
'\u00F8': 'o',
|
2910 |
+
'\u01FF': 'o',
|
2911 |
+
'\u0254': 'o',
|
2912 |
+
'\uA74B': 'o',
|
2913 |
+
'\uA74D': 'o',
|
2914 |
+
'\u0275': 'o',
|
2915 |
+
'\u01A3': 'oi',
|
2916 |
+
'\u0223': 'ou',
|
2917 |
+
'\uA74F': 'oo',
|
2918 |
+
'\u24DF': 'p',
|
2919 |
+
'\uFF50': 'p',
|
2920 |
+
'\u1E55': 'p',
|
2921 |
+
'\u1E57': 'p',
|
2922 |
+
'\u01A5': 'p',
|
2923 |
+
'\u1D7D': 'p',
|
2924 |
+
'\uA751': 'p',
|
2925 |
+
'\uA753': 'p',
|
2926 |
+
'\uA755': 'p',
|
2927 |
+
'\u24E0': 'q',
|
2928 |
+
'\uFF51': 'q',
|
2929 |
+
'\u024B': 'q',
|
2930 |
+
'\uA757': 'q',
|
2931 |
+
'\uA759': 'q',
|
2932 |
+
'\u24E1': 'r',
|
2933 |
+
'\uFF52': 'r',
|
2934 |
+
'\u0155': 'r',
|
2935 |
+
'\u1E59': 'r',
|
2936 |
+
'\u0159': 'r',
|
2937 |
+
'\u0211': 'r',
|
2938 |
+
'\u0213': 'r',
|
2939 |
+
'\u1E5B': 'r',
|
2940 |
+
'\u1E5D': 'r',
|
2941 |
+
'\u0157': 'r',
|
2942 |
+
'\u1E5F': 'r',
|
2943 |
+
'\u024D': 'r',
|
2944 |
+
'\u027D': 'r',
|
2945 |
+
'\uA75B': 'r',
|
2946 |
+
'\uA7A7': 'r',
|
2947 |
+
'\uA783': 'r',
|
2948 |
+
'\u24E2': 's',
|
2949 |
+
'\uFF53': 's',
|
2950 |
+
'\u00DF': 's',
|
2951 |
+
'\u015B': 's',
|
2952 |
+
'\u1E65': 's',
|
2953 |
+
'\u015D': 's',
|
2954 |
+
'\u1E61': 's',
|
2955 |
+
'\u0161': 's',
|
2956 |
+
'\u1E67': 's',
|
2957 |
+
'\u1E63': 's',
|
2958 |
+
'\u1E69': 's',
|
2959 |
+
'\u0219': 's',
|
2960 |
+
'\u015F': 's',
|
2961 |
+
'\u023F': 's',
|
2962 |
+
'\uA7A9': 's',
|
2963 |
+
'\uA785': 's',
|
2964 |
+
'\u1E9B': 's',
|
2965 |
+
'\u24E3': 't',
|
2966 |
+
'\uFF54': 't',
|
2967 |
+
'\u1E6B': 't',
|
2968 |
+
'\u1E97': 't',
|
2969 |
+
'\u0165': 't',
|
2970 |
+
'\u1E6D': 't',
|
2971 |
+
'\u021B': 't',
|
2972 |
+
'\u0163': 't',
|
2973 |
+
'\u1E71': 't',
|
2974 |
+
'\u1E6F': 't',
|
2975 |
+
'\u0167': 't',
|
2976 |
+
'\u01AD': 't',
|
2977 |
+
'\u0288': 't',
|
2978 |
+
'\u2C66': 't',
|
2979 |
+
'\uA787': 't',
|
2980 |
+
'\uA729': 'tz',
|
2981 |
+
'\u24E4': 'u',
|
2982 |
+
'\uFF55': 'u',
|
2983 |
+
'\u00F9': 'u',
|
2984 |
+
'\u00FA': 'u',
|
2985 |
+
'\u00FB': 'u',
|
2986 |
+
'\u0169': 'u',
|
2987 |
+
'\u1E79': 'u',
|
2988 |
+
'\u016B': 'u',
|
2989 |
+
'\u1E7B': 'u',
|
2990 |
+
'\u016D': 'u',
|
2991 |
+
'\u00FC': 'u',
|
2992 |
+
'\u01DC': 'u',
|
2993 |
+
'\u01D8': 'u',
|
2994 |
+
'\u01D6': 'u',
|
2995 |
+
'\u01DA': 'u',
|
2996 |
+
'\u1EE7': 'u',
|
2997 |
+
'\u016F': 'u',
|
2998 |
+
'\u0171': 'u',
|
2999 |
+
'\u01D4': 'u',
|
3000 |
+
'\u0215': 'u',
|
3001 |
+
'\u0217': 'u',
|
3002 |
+
'\u01B0': 'u',
|
3003 |
+
'\u1EEB': 'u',
|
3004 |
+
'\u1EE9': 'u',
|
3005 |
+
'\u1EEF': 'u',
|
3006 |
+
'\u1EED': 'u',
|
3007 |
+
'\u1EF1': 'u',
|
3008 |
+
'\u1EE5': 'u',
|
3009 |
+
'\u1E73': 'u',
|
3010 |
+
'\u0173': 'u',
|
3011 |
+
'\u1E77': 'u',
|
3012 |
+
'\u1E75': 'u',
|
3013 |
+
'\u0289': 'u',
|
3014 |
+
'\u24E5': 'v',
|
3015 |
+
'\uFF56': 'v',
|
3016 |
+
'\u1E7D': 'v',
|
3017 |
+
'\u1E7F': 'v',
|
3018 |
+
'\u028B': 'v',
|
3019 |
+
'\uA75F': 'v',
|
3020 |
+
'\u028C': 'v',
|
3021 |
+
'\uA761': 'vy',
|
3022 |
+
'\u24E6': 'w',
|
3023 |
+
'\uFF57': 'w',
|
3024 |
+
'\u1E81': 'w',
|
3025 |
+
'\u1E83': 'w',
|
3026 |
+
'\u0175': 'w',
|
3027 |
+
'\u1E87': 'w',
|
3028 |
+
'\u1E85': 'w',
|
3029 |
+
'\u1E98': 'w',
|
3030 |
+
'\u1E89': 'w',
|
3031 |
+
'\u2C73': 'w',
|
3032 |
+
'\u24E7': 'x',
|
3033 |
+
'\uFF58': 'x',
|
3034 |
+
'\u1E8B': 'x',
|
3035 |
+
'\u1E8D': 'x',
|
3036 |
+
'\u24E8': 'y',
|
3037 |
+
'\uFF59': 'y',
|
3038 |
+
'\u1EF3': 'y',
|
3039 |
+
'\u00FD': 'y',
|
3040 |
+
'\u0177': 'y',
|
3041 |
+
'\u1EF9': 'y',
|
3042 |
+
'\u0233': 'y',
|
3043 |
+
'\u1E8F': 'y',
|
3044 |
+
'\u00FF': 'y',
|
3045 |
+
'\u1EF7': 'y',
|
3046 |
+
'\u1E99': 'y',
|
3047 |
+
'\u1EF5': 'y',
|
3048 |
+
'\u01B4': 'y',
|
3049 |
+
'\u024F': 'y',
|
3050 |
+
'\u1EFF': 'y',
|
3051 |
+
'\u24E9': 'z',
|
3052 |
+
'\uFF5A': 'z',
|
3053 |
+
'\u017A': 'z',
|
3054 |
+
'\u1E91': 'z',
|
3055 |
+
'\u017C': 'z',
|
3056 |
+
'\u017E': 'z',
|
3057 |
+
'\u1E93': 'z',
|
3058 |
+
'\u1E95': 'z',
|
3059 |
+
'\u01B6': 'z',
|
3060 |
+
'\u0225': 'z',
|
3061 |
+
'\u0240': 'z',
|
3062 |
+
'\u2C6C': 'z',
|
3063 |
+
'\uA763': 'z',
|
3064 |
+
'\u0386': '\u0391',
|
3065 |
+
'\u0388': '\u0395',
|
3066 |
+
'\u0389': '\u0397',
|
3067 |
+
'\u038A': '\u0399',
|
3068 |
+
'\u03AA': '\u0399',
|
3069 |
+
'\u038C': '\u039F',
|
3070 |
+
'\u038E': '\u03A5',
|
3071 |
+
'\u03AB': '\u03A5',
|
3072 |
+
'\u038F': '\u03A9',
|
3073 |
+
'\u03AC': '\u03B1',
|
3074 |
+
'\u03AD': '\u03B5',
|
3075 |
+
'\u03AE': '\u03B7',
|
3076 |
+
'\u03AF': '\u03B9',
|
3077 |
+
'\u03CA': '\u03B9',
|
3078 |
+
'\u0390': '\u03B9',
|
3079 |
+
'\u03CC': '\u03BF',
|
3080 |
+
'\u03CD': '\u03C5',
|
3081 |
+
'\u03CB': '\u03C5',
|
3082 |
+
'\u03B0': '\u03C5',
|
3083 |
+
'\u03C9': '\u03C9',
|
3084 |
+
'\u03C2': '\u03C3'
|
3085 |
+
};
|
3086 |
+
|
3087 |
+
return diacritics;
|
3088 |
+
});
|
3089 |
+
|
3090 |
+
S2.define('select2/data/base',[
|
3091 |
+
'../utils'
|
3092 |
+
], function (Utils) {
|
3093 |
+
function BaseAdapter ($element, options) {
|
3094 |
+
BaseAdapter.__super__.constructor.call(this);
|
3095 |
+
}
|
3096 |
+
|
3097 |
+
Utils.Extend(BaseAdapter, Utils.Observable);
|
3098 |
+
|
3099 |
+
BaseAdapter.prototype.current = function (callback) {
|
3100 |
+
throw new Error('The `current` method must be defined in child classes.');
|
3101 |
+
};
|
3102 |
+
|
3103 |
+
BaseAdapter.prototype.query = function (params, callback) {
|
3104 |
+
throw new Error('The `query` method must be defined in child classes.');
|
3105 |
+
};
|
3106 |
+
|
3107 |
+
BaseAdapter.prototype.bind = function (container, $container) {
|
3108 |
+
// Can be implemented in subclasses
|
3109 |
+
};
|
3110 |
+
|
3111 |
+
BaseAdapter.prototype.destroy = function () {
|
3112 |
+
// Can be implemented in subclasses
|
3113 |
+
};
|
3114 |
+
|
3115 |
+
BaseAdapter.prototype.generateResultId = function (container, data) {
|
3116 |
+
var id = container.id + '-result-';
|
3117 |
+
|
3118 |
+
id += Utils.generateChars(4);
|
3119 |
+
|
3120 |
+
if (data.id != null) {
|
3121 |
+
id += '-' + data.id.toString();
|
3122 |
+
} else {
|
3123 |
+
id += '-' + Utils.generateChars(4);
|
3124 |
+
}
|
3125 |
+
return id;
|
3126 |
+
};
|
3127 |
+
|
3128 |
+
return BaseAdapter;
|
3129 |
+
});
|
3130 |
+
|
3131 |
+
S2.define('select2/data/select',[
|
3132 |
+
'./base',
|
3133 |
+
'../utils',
|
3134 |
+
'jquery'
|
3135 |
+
], function (BaseAdapter, Utils, $) {
|
3136 |
+
function SelectAdapter ($element, options) {
|
3137 |
+
this.$element = $element;
|
3138 |
+
this.options = options;
|
3139 |
+
|
3140 |
+
SelectAdapter.__super__.constructor.call(this);
|
3141 |
+
}
|
3142 |
+
|
3143 |
+
Utils.Extend(SelectAdapter, BaseAdapter);
|
3144 |
+
|
3145 |
+
SelectAdapter.prototype.current = function (callback) {
|
3146 |
+
var data = [];
|
3147 |
+
var self = this;
|
3148 |
+
|
3149 |
+
this.$element.find(':selected').each(function () {
|
3150 |
+
var $option = $(this);
|
3151 |
+
|
3152 |
+
var option = self.item($option);
|
3153 |
+
|
3154 |
+
data.push(option);
|
3155 |
+
});
|
3156 |
+
|
3157 |
+
callback(data);
|
3158 |
+
};
|
3159 |
+
|
3160 |
+
SelectAdapter.prototype.select = function (data) {
|
3161 |
+
var self = this;
|
3162 |
+
|
3163 |
+
data.selected = true;
|
3164 |
+
|
3165 |
+
// If data.element is a DOM node, use it instead
|
3166 |
+
if ($(data.element).is('option')) {
|
3167 |
+
data.element.selected = true;
|
3168 |
+
|
3169 |
+
this.$element.trigger('change');
|
3170 |
+
|
3171 |
+
return;
|
3172 |
+
}
|
3173 |
+
|
3174 |
+
if (this.$element.prop('multiple')) {
|
3175 |
+
this.current(function (currentData) {
|
3176 |
+
var val = [];
|
3177 |
+
|
3178 |
+
data = [data];
|
3179 |
+
data.push.apply(data, currentData);
|
3180 |
+
|
3181 |
+
for (var d = 0; d < data.length; d++) {
|
3182 |
+
var id = data[d].id;
|
3183 |
+
|
3184 |
+
if ($.inArray(id, val) === -1) {
|
3185 |
+
val.push(id);
|
3186 |
+
}
|
3187 |
+
}
|
3188 |
+
|
3189 |
+
self.$element.val(val);
|
3190 |
+
self.$element.trigger('change');
|
3191 |
+
});
|
3192 |
+
} else {
|
3193 |
+
var val = data.id;
|
3194 |
+
|
3195 |
+
this.$element.val(val);
|
3196 |
+
this.$element.trigger('change');
|
3197 |
+
}
|
3198 |
+
};
|
3199 |
+
|
3200 |
+
SelectAdapter.prototype.unselect = function (data) {
|
3201 |
+
var self = this;
|
3202 |
+
|
3203 |
+
if (!this.$element.prop('multiple')) {
|
3204 |
+
return;
|
3205 |
+
}
|
3206 |
+
|
3207 |
+
data.selected = false;
|
3208 |
+
|
3209 |
+
if ($(data.element).is('option')) {
|
3210 |
+
data.element.selected = false;
|
3211 |
+
|
3212 |
+
this.$element.trigger('change');
|
3213 |
+
|
3214 |
+
return;
|
3215 |
+
}
|
3216 |
+
|
3217 |
+
this.current(function (currentData) {
|
3218 |
+
var val = [];
|
3219 |
+
|
3220 |
+
for (var d = 0; d < currentData.length; d++) {
|
3221 |
+
var id = currentData[d].id;
|
3222 |
+
|
3223 |
+
if (id !== data.id && $.inArray(id, val) === -1) {
|
3224 |
+
val.push(id);
|
3225 |
+
}
|
3226 |
+
}
|
3227 |
+
|
3228 |
+
self.$element.val(val);
|
3229 |
+
|
3230 |
+
self.$element.trigger('change');
|
3231 |
+
});
|
3232 |
+
};
|
3233 |
+
|
3234 |
+
SelectAdapter.prototype.bind = function (container, $container) {
|
3235 |
+
var self = this;
|
3236 |
+
|
3237 |
+
this.container = container;
|
3238 |
+
|
3239 |
+
container.on('select', function (params) {
|
3240 |
+
self.select(params.data);
|
3241 |
+
});
|
3242 |
+
|
3243 |
+
container.on('unselect', function (params) {
|
3244 |
+
self.unselect(params.data);
|
3245 |
+
});
|
3246 |
+
};
|
3247 |
+
|
3248 |
+
SelectAdapter.prototype.destroy = function () {
|
3249 |
+
// Remove anything added to child elements
|
3250 |
+
this.$element.find('*').each(function () {
|
3251 |
+
// Remove any custom data set by Select2
|
3252 |
+
Utils.RemoveData(this);
|
3253 |
+
});
|
3254 |
+
};
|
3255 |
+
|
3256 |
+
SelectAdapter.prototype.query = function (params, callback) {
|
3257 |
+
var data = [];
|
3258 |
+
var self = this;
|
3259 |
+
|
3260 |
+
var $options = this.$element.children();
|
3261 |
+
|
3262 |
+
$options.each(function () {
|
3263 |
+
var $option = $(this);
|
3264 |
+
|
3265 |
+
if (!$option.is('option') && !$option.is('optgroup')) {
|
3266 |
+
return;
|
3267 |
+
}
|
3268 |
+
|
3269 |
+
var option = self.item($option);
|
3270 |
+
|
3271 |
+
var matches = self.matches(params, option);
|
3272 |
+
|
3273 |
+
if (matches !== null) {
|
3274 |
+
data.push(matches);
|
3275 |
+
}
|
3276 |
+
});
|
3277 |
+
|
3278 |
+
callback({
|
3279 |
+
results: data
|
3280 |
+
});
|
3281 |
+
};
|
3282 |
+
|
3283 |
+
SelectAdapter.prototype.addOptions = function ($options) {
|
3284 |
+
Utils.appendMany(this.$element, $options);
|
3285 |
+
};
|
3286 |
+
|
3287 |
+
SelectAdapter.prototype.option = function (data) {
|
3288 |
+
var option;
|
3289 |
+
|
3290 |
+
if (data.children) {
|
3291 |
+
option = document.createElement('optgroup');
|
3292 |
+
option.label = data.text;
|
3293 |
+
} else {
|
3294 |
+
option = document.createElement('option');
|
3295 |
+
|
3296 |
+
if (option.textContent !== undefined) {
|
3297 |
+
option.textContent = data.text;
|
3298 |
+
} else {
|
3299 |
+
option.innerText = data.text;
|
3300 |
+
}
|
3301 |
+
}
|
3302 |
+
|
3303 |
+
if (data.id !== undefined) {
|
3304 |
+
option.value = data.id;
|
3305 |
+
}
|
3306 |
+
|
3307 |
+
if (data.disabled) {
|
3308 |
+
option.disabled = true;
|
3309 |
+
}
|
3310 |
+
|
3311 |
+
if (data.selected) {
|
3312 |
+
option.selected = true;
|
3313 |
+
}
|
3314 |
+
|
3315 |
+
if (data.title) {
|
3316 |
+
option.title = data.title;
|
3317 |
+
}
|
3318 |
+
|
3319 |
+
var $option = $(option);
|
3320 |
+
|
3321 |
+
var normalizedData = this._normalizeItem(data);
|
3322 |
+
normalizedData.element = option;
|
3323 |
+
|
3324 |
+
// Override the option's data with the combined data
|
3325 |
+
Utils.StoreData(option, 'data', normalizedData);
|
3326 |
+
|
3327 |
+
return $option;
|
3328 |
+
};
|
3329 |
+
|
3330 |
+
SelectAdapter.prototype.item = function ($option) {
|
3331 |
+
var data = {};
|
3332 |
+
|
3333 |
+
data = Utils.GetData($option[0], 'data');
|
3334 |
+
|
3335 |
+
if (data != null) {
|
3336 |
+
return data;
|
3337 |
+
}
|
3338 |
+
|
3339 |
+
if ($option.is('option')) {
|
3340 |
+
data = {
|
3341 |
+
id: $option.val(),
|
3342 |
+
text: $option.text(),
|
3343 |
+
disabled: $option.prop('disabled'),
|
3344 |
+
selected: $option.prop('selected'),
|
3345 |
+
title: $option.prop('title')
|
3346 |
+
};
|
3347 |
+
} else if ($option.is('optgroup')) {
|
3348 |
+
data = {
|
3349 |
+
text: $option.prop('label'),
|
3350 |
+
children: [],
|
3351 |
+
title: $option.prop('title')
|
3352 |
+
};
|
3353 |
+
|
3354 |
+
var $children = $option.children('option');
|
3355 |
+
var children = [];
|
3356 |
+
|
3357 |
+
for (var c = 0; c < $children.length; c++) {
|
3358 |
+
var $child = $($children[c]);
|
3359 |
+
|
3360 |
+
var child = this.item($child);
|
3361 |
+
|
3362 |
+
children.push(child);
|
3363 |
+
}
|
3364 |
+
|
3365 |
+
data.children = children;
|
3366 |
+
}
|
3367 |
+
|
3368 |
+
data = this._normalizeItem(data);
|
3369 |
+
data.element = $option[0];
|
3370 |
+
|
3371 |
+
Utils.StoreData($option[0], 'data', data);
|
3372 |
+
|
3373 |
+
return data;
|
3374 |
+
};
|
3375 |
+
|
3376 |
+
SelectAdapter.prototype._normalizeItem = function (item) {
|
3377 |
+
if (item !== Object(item)) {
|
3378 |
+
item = {
|
3379 |
+
id: item,
|
3380 |
+
text: item
|
3381 |
+
};
|
3382 |
+
}
|
3383 |
+
|
3384 |
+
item = $.extend({}, {
|
3385 |
+
text: ''
|
3386 |
+
}, item);
|
3387 |
+
|
3388 |
+
var defaults = {
|
3389 |
+
selected: false,
|
3390 |
+
disabled: false
|
3391 |
+
};
|
3392 |
+
|
3393 |
+
if (item.id != null) {
|
3394 |
+
item.id = item.id.toString();
|
3395 |
+
}
|
3396 |
+
|
3397 |
+
if (item.text != null) {
|
3398 |
+
item.text = item.text.toString();
|
3399 |
+
}
|
3400 |
+
|
3401 |
+
if (item._resultId == null && item.id && this.container != null) {
|
3402 |
+
item._resultId = this.generateResultId(this.container, item);
|
3403 |
+
}
|
3404 |
+
|
3405 |
+
return $.extend({}, defaults, item);
|
3406 |
+
};
|
3407 |
+
|
3408 |
+
SelectAdapter.prototype.matches = function (params, data) {
|
3409 |
+
var matcher = this.options.get('matcher');
|
3410 |
+
|
3411 |
+
return matcher(params, data);
|
3412 |
+
};
|
3413 |
+
|
3414 |
+
return SelectAdapter;
|
3415 |
+
});
|
3416 |
+
|
3417 |
+
S2.define('select2/data/array',[
|
3418 |
+
'./select',
|
3419 |
+
'../utils',
|
3420 |
+
'jquery'
|
3421 |
+
], function (SelectAdapter, Utils, $) {
|
3422 |
+
function ArrayAdapter ($element, options) {
|
3423 |
+
var data = options.get('data') || [];
|
3424 |
+
|
3425 |
+
ArrayAdapter.__super__.constructor.call(this, $element, options);
|
3426 |
+
|
3427 |
+
this.addOptions(this.convertToOptions(data));
|
3428 |
+
}
|
3429 |
+
|
3430 |
+
Utils.Extend(ArrayAdapter, SelectAdapter);
|
3431 |
+
|
3432 |
+
ArrayAdapter.prototype.select = function (data) {
|
3433 |
+
var $option = this.$element.find('option').filter(function (i, elm) {
|
3434 |
+
return elm.value == data.id.toString();
|
3435 |
+
});
|
3436 |
+
|
3437 |
+
if ($option.length === 0) {
|
3438 |
+
$option = this.option(data);
|
3439 |
+
|
3440 |
+
this.addOptions($option);
|
3441 |
+
}
|
3442 |
+
|
3443 |
+
ArrayAdapter.__super__.select.call(this, data);
|
3444 |
+
};
|
3445 |
+
|
3446 |
+
ArrayAdapter.prototype.convertToOptions = function (data) {
|
3447 |
+
var self = this;
|
3448 |
+
|
3449 |
+
var $existing = this.$element.find('option');
|
3450 |
+
var existingIds = $existing.map(function () {
|
3451 |
+
return self.item($(this)).id;
|
3452 |
+
}).get();
|
3453 |
+
|
3454 |
+
var $options = [];
|
3455 |
+
|
3456 |
+
// Filter out all items except for the one passed in the argument
|
3457 |
+
function onlyItem (item) {
|
3458 |
+
return function () {
|
3459 |
+
return $(this).val() == item.id;
|
3460 |
+
};
|
3461 |
+
}
|
3462 |
+
|
3463 |
+
for (var d = 0; d < data.length; d++) {
|
3464 |
+
var item = this._normalizeItem(data[d]);
|
3465 |
+
|
3466 |
+
// Skip items which were pre-loaded, only merge the data
|
3467 |
+
if ($.inArray(item.id, existingIds) >= 0) {
|
3468 |
+
var $existingOption = $existing.filter(onlyItem(item));
|
3469 |
+
|
3470 |
+
var existingData = this.item($existingOption);
|
3471 |
+
var newData = $.extend(true, {}, item, existingData);
|
3472 |
+
|
3473 |
+
var $newOption = this.option(newData);
|
3474 |
+
|
3475 |
+
$existingOption.replaceWith($newOption);
|
3476 |
+
|
3477 |
+
continue;
|
3478 |
+
}
|
3479 |
+
|
3480 |
+
var $option = this.option(item);
|
3481 |
+
|
3482 |
+
if (item.children) {
|
3483 |
+
var $children = this.convertToOptions(item.children);
|
3484 |
+
|
3485 |
+
Utils.appendMany($option, $children);
|
3486 |
+
}
|
3487 |
+
|
3488 |
+
$options.push($option);
|
3489 |
+
}
|
3490 |
+
|
3491 |
+
return $options;
|
3492 |
+
};
|
3493 |
+
|
3494 |
+
return ArrayAdapter;
|
3495 |
+
});
|
3496 |
+
|
3497 |
+
S2.define('select2/data/ajax',[
|
3498 |
+
'./array',
|
3499 |
+
'../utils',
|
3500 |
+
'jquery'
|
3501 |
+
], function (ArrayAdapter, Utils, $) {
|
3502 |
+
function AjaxAdapter ($element, options) {
|
3503 |
+
this.ajaxOptions = this._applyDefaults(options.get('ajax'));
|
3504 |
+
|
3505 |
+
if (this.ajaxOptions.processResults != null) {
|
3506 |
+
this.processResults = this.ajaxOptions.processResults;
|
3507 |
+
}
|
3508 |
+
|
3509 |
+
AjaxAdapter.__super__.constructor.call(this, $element, options);
|
3510 |
+
}
|
3511 |
+
|
3512 |
+
Utils.Extend(AjaxAdapter, ArrayAdapter);
|
3513 |
+
|
3514 |
+
AjaxAdapter.prototype._applyDefaults = function (options) {
|
3515 |
+
var defaults = {
|
3516 |
+
data: function (params) {
|
3517 |
+
return $.extend({}, params, {
|
3518 |
+
q: params.term
|
3519 |
+
});
|
3520 |
+
},
|
3521 |
+
transport: function (params, success, failure) {
|
3522 |
+
var $request = $.ajax(params);
|
3523 |
+
|
3524 |
+
$request.then(success);
|
3525 |
+
$request.fail(failure);
|
3526 |
+
|
3527 |
+
return $request;
|
3528 |
+
}
|
3529 |
+
};
|
3530 |
+
|
3531 |
+
return $.extend({}, defaults, options, true);
|
3532 |
+
};
|
3533 |
+
|
3534 |
+
AjaxAdapter.prototype.processResults = function (results) {
|
3535 |
+
return results;
|
3536 |
+
};
|
3537 |
+
|
3538 |
+
AjaxAdapter.prototype.query = function (params, callback) {
|
3539 |
+
var matches = [];
|
3540 |
+
var self = this;
|
3541 |
+
|
3542 |
+
if (this._request != null) {
|
3543 |
+
// JSONP requests cannot always be aborted
|
3544 |
+
if ($.isFunction(this._request.abort)) {
|
3545 |
+
this._request.abort();
|
3546 |
+
}
|
3547 |
+
|
3548 |
+
this._request = null;
|
3549 |
+
}
|
3550 |
+
|
3551 |
+
var options = $.extend({
|
3552 |
+
type: 'GET'
|
3553 |
+
}, this.ajaxOptions);
|
3554 |
+
|
3555 |
+
if (typeof options.url === 'function') {
|
3556 |
+
options.url = options.url.call(this.$element, params);
|
3557 |
+
}
|
3558 |
+
|
3559 |
+
if (typeof options.data === 'function') {
|
3560 |
+
options.data = options.data.call(this.$element, params);
|
3561 |
+
}
|
3562 |
+
|
3563 |
+
function request () {
|
3564 |
+
var $request = options.transport(options, function (data) {
|
3565 |
+
var results = self.processResults(data, params);
|
3566 |
+
|
3567 |
+
if (self.options.get('debug') && window.console && console.error) {
|
3568 |
+
// Check to make sure that the response included a `results` key.
|
3569 |
+
if (!results || !results.results || !$.isArray(results.results)) {
|
3570 |
+
console.error(
|
3571 |
+
'Select2: The AJAX results did not return an array in the ' +
|
3572 |
+
'`results` key of the response.'
|
3573 |
+
);
|
3574 |
+
}
|
3575 |
+
}
|
3576 |
+
|
3577 |
+
callback(results);
|
3578 |
+
}, function () {
|
3579 |
+
// Attempt to detect if a request was aborted
|
3580 |
+
// Only works if the transport exposes a status property
|
3581 |
+
if ('status' in $request &&
|
3582 |
+
($request.status === 0 || $request.status === '0')) {
|
3583 |
+
return;
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
self.trigger('results:message', {
|
3587 |
+
message: 'errorLoading'
|
3588 |
+
});
|
3589 |
+
});
|
3590 |
+
|
3591 |
+
self._request = $request;
|
3592 |
+
}
|
3593 |
+
|
3594 |
+
if (this.ajaxOptions.delay && params.term != null) {
|
3595 |
+
if (this._queryTimeout) {
|
3596 |
+
window.clearTimeout(this._queryTimeout);
|
3597 |
+
}
|
3598 |
+
|
3599 |
+
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
|
3600 |
+
} else {
|
3601 |
+
request();
|
3602 |
+
}
|
3603 |
+
};
|
3604 |
+
|
3605 |
+
return AjaxAdapter;
|
3606 |
+
});
|
3607 |
+
|
3608 |
+
S2.define('select2/data/tags',[
|
3609 |
+
'jquery'
|
3610 |
+
], function ($) {
|
3611 |
+
function Tags (decorated, $element, options) {
|
3612 |
+
var tags = options.get('tags');
|
3613 |
+
|
3614 |
+
var createTag = options.get('createTag');
|
3615 |
+
|
3616 |
+
if (createTag !== undefined) {
|
3617 |
+
this.createTag = createTag;
|
3618 |
+
}
|
3619 |
+
|
3620 |
+
var insertTag = options.get('insertTag');
|
3621 |
+
|
3622 |
+
if (insertTag !== undefined) {
|
3623 |
+
this.insertTag = insertTag;
|
3624 |
+
}
|
3625 |
+
|
3626 |
+
decorated.call(this, $element, options);
|
3627 |
+
|
3628 |
+
if ($.isArray(tags)) {
|
3629 |
+
for (var t = 0; t < tags.length; t++) {
|
3630 |
+
var tag = tags[t];
|
3631 |
+
var item = this._normalizeItem(tag);
|
3632 |
+
|
3633 |
+
var $option = this.option(item);
|
3634 |
+
|
3635 |
+
this.$element.append($option);
|
3636 |
+
}
|
3637 |
+
}
|
3638 |
+
}
|
3639 |
+
|
3640 |
+
Tags.prototype.query = function (decorated, params, callback) {
|
3641 |
+
var self = this;
|
3642 |
+
|
3643 |
+
this._removeOldTags();
|
3644 |
+
|
3645 |
+
if (params.term == null || params.page != null) {
|
3646 |
+
decorated.call(this, params, callback);
|
3647 |
+
return;
|
3648 |
+
}
|
3649 |
+
|
3650 |
+
function wrapper (obj, child) {
|
3651 |
+
var data = obj.results;
|
3652 |
+
|
3653 |
+
for (var i = 0; i < data.length; i++) {
|
3654 |
+
var option = data[i];
|
3655 |
+
|
3656 |
+
var checkChildren = (
|
3657 |
+
option.children != null &&
|
3658 |
+
!wrapper({
|
3659 |
+
results: option.children
|
3660 |
+
}, true)
|
3661 |
+
);
|
3662 |
+
|
3663 |
+
var optionText = (option.text || '').toUpperCase();
|
3664 |
+
var paramsTerm = (params.term || '').toUpperCase();
|
3665 |
+
|
3666 |
+
var checkText = optionText === paramsTerm;
|
3667 |
+
|
3668 |
+
if (checkText || checkChildren) {
|
3669 |
+
if (child) {
|
3670 |
+
return false;
|
3671 |
+
}
|
3672 |
+
|
3673 |
+
obj.data = data;
|
3674 |
+
callback(obj);
|
3675 |
+
|
3676 |
+
return;
|
3677 |
+
}
|
3678 |
+
}
|
3679 |
+
|
3680 |
+
if (child) {
|
3681 |
+
return true;
|
3682 |
+
}
|
3683 |
+
|
3684 |
+
var tag = self.createTag(params);
|
3685 |
+
|
3686 |
+
if (tag != null) {
|
3687 |
+
var $option = self.option(tag);
|
3688 |
+
$option.attr('data-select2-tag', true);
|
3689 |
+
|
3690 |
+
self.addOptions([$option]);
|
3691 |
+
|
3692 |
+
self.insertTag(data, tag);
|
3693 |
+
}
|
3694 |
+
|
3695 |
+
obj.results = data;
|
3696 |
+
|
3697 |
+
callback(obj);
|
3698 |
+
}
|
3699 |
+
|
3700 |
+
decorated.call(this, params, wrapper);
|
3701 |
+
};
|
3702 |
+
|
3703 |
+
Tags.prototype.createTag = function (decorated, params) {
|
3704 |
+
var term = $.trim(params.term);
|
3705 |
+
|
3706 |
+
if (term === '') {
|
3707 |
+
return null;
|
3708 |
+
}
|
3709 |
+
|
3710 |
+
return {
|
3711 |
+
id: term,
|
3712 |
+
text: term
|
3713 |
+
};
|
3714 |
+
};
|
3715 |
+
|
3716 |
+
Tags.prototype.insertTag = function (_, data, tag) {
|
3717 |
+
data.unshift(tag);
|
3718 |
+
};
|
3719 |
+
|
3720 |
+
Tags.prototype._removeOldTags = function (_) {
|
3721 |
+
var tag = this._lastTag;
|
3722 |
+
|
3723 |
+
var $options = this.$element.find('option[data-select2-tag]');
|
3724 |
+
|
3725 |
+
$options.each(function () {
|
3726 |
+
if (this.selected) {
|
3727 |
+
return;
|
3728 |
+
}
|
3729 |
+
|
3730 |
+
$(this).remove();
|
3731 |
+
});
|
3732 |
+
};
|
3733 |
+
|
3734 |
+
return Tags;
|
3735 |
+
});
|
3736 |
+
|
3737 |
+
S2.define('select2/data/tokenizer',[
|
3738 |
+
'jquery'
|
3739 |
+
], function ($) {
|
3740 |
+
function Tokenizer (decorated, $element, options) {
|
3741 |
+
var tokenizer = options.get('tokenizer');
|
3742 |
+
|
3743 |
+
if (tokenizer !== undefined) {
|
3744 |
+
this.tokenizer = tokenizer;
|
3745 |
+
}
|
3746 |
+
|
3747 |
+
decorated.call(this, $element, options);
|
3748 |
+
}
|
3749 |
+
|
3750 |
+
Tokenizer.prototype.bind = function (decorated, container, $container) {
|
3751 |
+
decorated.call(this, container, $container);
|
3752 |
+
|
3753 |
+
this.$search = container.dropdown.$search || container.selection.$search ||
|
3754 |
+
$container.find('.select2-search__field');
|
3755 |
+
};
|
3756 |
+
|
3757 |
+
Tokenizer.prototype.query = function (decorated, params, callback) {
|
3758 |
+
var self = this;
|
3759 |
+
|
3760 |
+
function createAndSelect (data) {
|
3761 |
+
// Normalize the data object so we can use it for checks
|
3762 |
+
var item = self._normalizeItem(data);
|
3763 |
+
|
3764 |
+
// Check if the data object already exists as a tag
|
3765 |
+
// Select it if it doesn't
|
3766 |
+
var $existingOptions = self.$element.find('option').filter(function () {
|
3767 |
+
return $(this).val() === item.id;
|
3768 |
+
});
|
3769 |
+
|
3770 |
+
// If an existing option wasn't found for it, create the option
|
3771 |
+
if (!$existingOptions.length) {
|
3772 |
+
var $option = self.option(item);
|
3773 |
+
$option.attr('data-select2-tag', true);
|
3774 |
+
|
3775 |
+
self._removeOldTags();
|
3776 |
+
self.addOptions([$option]);
|
3777 |
+
}
|
3778 |
+
|
3779 |
+
// Select the item, now that we know there is an option for it
|
3780 |
+
select(item);
|
3781 |
+
}
|
3782 |
+
|
3783 |
+
function select (data) {
|
3784 |
+
self.trigger('select', {
|
3785 |
+
data: data
|
3786 |
+
});
|
3787 |
+
}
|
3788 |
+
|
3789 |
+
params.term = params.term || '';
|
3790 |
+
|
3791 |
+
var tokenData = this.tokenizer(params, this.options, createAndSelect);
|
3792 |
+
|
3793 |
+
if (tokenData.term !== params.term) {
|
3794 |
+
// Replace the search term if we have the search box
|
3795 |
+
if (this.$search.length) {
|
3796 |
+
this.$search.val(tokenData.term);
|
3797 |
+
this.$search.focus();
|
3798 |
+
}
|
3799 |
+
|
3800 |
+
params.term = tokenData.term;
|
3801 |
+
}
|
3802 |
+
|
3803 |
+
decorated.call(this, params, callback);
|
3804 |
+
};
|
3805 |
+
|
3806 |
+
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
|
3807 |
+
var separators = options.get('tokenSeparators') || [];
|
3808 |
+
var term = params.term;
|
3809 |
+
var i = 0;
|
3810 |
+
|
3811 |
+
var createTag = this.createTag || function (params) {
|
3812 |
+
return {
|
3813 |
+
id: params.term,
|
3814 |
+
text: params.term
|
3815 |
+
};
|
3816 |
+
};
|
3817 |
+
|
3818 |
+
while (i < term.length) {
|
3819 |
+
var termChar = term[i];
|
3820 |
+
|
3821 |
+
if ($.inArray(termChar, separators) === -1) {
|
3822 |
+
i++;
|
3823 |
+
|
3824 |
+
continue;
|
3825 |
+
}
|
3826 |
+
|
3827 |
+
var part = term.substr(0, i);
|
3828 |
+
var partParams = $.extend({}, params, {
|
3829 |
+
term: part
|
3830 |
+
});
|
3831 |
+
|
3832 |
+
var data = createTag(partParams);
|
3833 |
+
|
3834 |
+
if (data == null) {
|
3835 |
+
i++;
|
3836 |
+
continue;
|
3837 |
+
}
|
3838 |
+
|
3839 |
+
callback(data);
|
3840 |
+
|
3841 |
+
// Reset the term to not include the tokenized portion
|
3842 |
+
term = term.substr(i + 1) || '';
|
3843 |
+
i = 0;
|
3844 |
+
}
|
3845 |
+
|
3846 |
+
return {
|
3847 |
+
term: term
|
3848 |
+
};
|
3849 |
+
};
|
3850 |
+
|
3851 |
+
return Tokenizer;
|
3852 |
+
});
|
3853 |
+
|
3854 |
+
S2.define('select2/data/minimumInputLength',[
|
3855 |
+
|
3856 |
+
], function () {
|
3857 |
+
function MinimumInputLength (decorated, $e, options) {
|
3858 |
+
this.minimumInputLength = options.get('minimumInputLength');
|
3859 |
+
|
3860 |
+
decorated.call(this, $e, options);
|
3861 |
+
}
|
3862 |
+
|
3863 |
+
MinimumInputLength.prototype.query = function (decorated, params, callback) {
|
3864 |
+
params.term = params.term || '';
|
3865 |
+
|
3866 |
+
if (params.term.length < this.minimumInputLength) {
|
3867 |
+
this.trigger('results:message', {
|
3868 |
+
message: 'inputTooShort',
|
3869 |
+
args: {
|
3870 |
+
minimum: this.minimumInputLength,
|
3871 |
+
input: params.term,
|
3872 |
+
params: params
|
3873 |
+
}
|
3874 |
+
});
|
3875 |
+
|
3876 |
+
return;
|
3877 |
+
}
|
3878 |
+
|
3879 |
+
decorated.call(this, params, callback);
|
3880 |
+
};
|
3881 |
+
|
3882 |
+
return MinimumInputLength;
|
3883 |
+
});
|
3884 |
+
|
3885 |
+
S2.define('select2/data/maximumInputLength',[
|
3886 |
+
|
3887 |
+
], function () {
|
3888 |
+
function MaximumInputLength (decorated, $e, options) {
|
3889 |
+
this.maximumInputLength = options.get('maximumInputLength');
|
3890 |
+
|
3891 |
+
decorated.call(this, $e, options);
|
3892 |
+
}
|
3893 |
+
|
3894 |
+
MaximumInputLength.prototype.query = function (decorated, params, callback) {
|
3895 |
+
params.term = params.term || '';
|
3896 |
+
|
3897 |
+
if (this.maximumInputLength > 0 &&
|
3898 |
+
params.term.length > this.maximumInputLength) {
|
3899 |
+
this.trigger('results:message', {
|
3900 |
+
message: 'inputTooLong',
|
3901 |
+
args: {
|
3902 |
+
maximum: this.maximumInputLength,
|
3903 |
+
input: params.term,
|
3904 |
+
params: params
|
3905 |
+
}
|
3906 |
+
});
|
3907 |
+
|
3908 |
+
return;
|
3909 |
+
}
|
3910 |
+
|
3911 |
+
decorated.call(this, params, callback);
|
3912 |
+
};
|
3913 |
+
|
3914 |
+
return MaximumInputLength;
|
3915 |
+
});
|
3916 |
+
|
3917 |
+
S2.define('select2/data/maximumSelectionLength',[
|
3918 |
+
|
3919 |
+
], function (){
|
3920 |
+
function MaximumSelectionLength (decorated, $e, options) {
|
3921 |
+
this.maximumSelectionLength = options.get('maximumSelectionLength');
|
3922 |
+
|
3923 |
+
decorated.call(this, $e, options);
|
3924 |
+
}
|
3925 |
+
|
3926 |
+
MaximumSelectionLength.prototype.query =
|
3927 |
+
function (decorated, params, callback) {
|
3928 |
+
var self = this;
|
3929 |
+
|
3930 |
+
this.current(function (currentData) {
|
3931 |
+
var count = currentData != null ? currentData.length : 0;
|
3932 |
+
if (self.maximumSelectionLength > 0 &&
|
3933 |
+
count >= self.maximumSelectionLength) {
|
3934 |
+
self.trigger('results:message', {
|
3935 |
+
message: 'maximumSelected',
|
3936 |
+
args: {
|
3937 |
+
maximum: self.maximumSelectionLength
|
3938 |
+
}
|
3939 |
+
});
|
3940 |
+
return;
|
3941 |
+
}
|
3942 |
+
decorated.call(self, params, callback);
|
3943 |
+
});
|
3944 |
+
};
|
3945 |
+
|
3946 |
+
return MaximumSelectionLength;
|
3947 |
+
});
|
3948 |
+
|
3949 |
+
S2.define('select2/dropdown',[
|
3950 |
+
'jquery',
|
3951 |
+
'./utils'
|
3952 |
+
], function ($, Utils) {
|
3953 |
+
function Dropdown ($element, options) {
|
3954 |
+
this.$element = $element;
|
3955 |
+
this.options = options;
|
3956 |
+
|
3957 |
+
Dropdown.__super__.constructor.call(this);
|
3958 |
+
}
|
3959 |
+
|
3960 |
+
Utils.Extend(Dropdown, Utils.Observable);
|
3961 |
+
|
3962 |
+
Dropdown.prototype.render = function () {
|
3963 |
+
var $dropdown = $(
|
3964 |
+
'<span class="select2-dropdown">' +
|
3965 |
+
'<span class="select2-results"></span>' +
|
3966 |
+
'</span>'
|
3967 |
+
);
|
3968 |
+
|
3969 |
+
$dropdown.attr('dir', this.options.get('dir'));
|
3970 |
+
|
3971 |
+
this.$dropdown = $dropdown;
|
3972 |
+
|
3973 |
+
return $dropdown;
|
3974 |
+
};
|
3975 |
+
|
3976 |
+
Dropdown.prototype.bind = function () {
|
3977 |
+
// Should be implemented in subclasses
|
3978 |
+
};
|
3979 |
+
|
3980 |
+
Dropdown.prototype.position = function ($dropdown, $container) {
|
3981 |
+
// Should be implmented in subclasses
|
3982 |
+
};
|
3983 |
+
|
3984 |
+
Dropdown.prototype.destroy = function () {
|
3985 |
+
// Remove the dropdown from the DOM
|
3986 |
+
this.$dropdown.remove();
|
3987 |
+
};
|
3988 |
+
|
3989 |
+
return Dropdown;
|
3990 |
+
});
|
3991 |
+
|
3992 |
+
S2.define('select2/dropdown/search',[
|
3993 |
+
'jquery',
|
3994 |
+
'../utils'
|
3995 |
+
], function ($, Utils) {
|
3996 |
+
function Search () { }
|
3997 |
+
|
3998 |
+
Search.prototype.render = function (decorated) {
|
3999 |
+
var $rendered = decorated.call(this);
|
4000 |
+
|
4001 |
+
var $search = $(
|
4002 |
+
'<span class="select2-search select2-search--dropdown">' +
|
4003 |
+
'<input class="select2-search__field" type="search" tabindex="-1"' +
|
4004 |
+
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
|
4005 |
+
' spellcheck="false" role="textbox" />' +
|
4006 |
+
'</span>'
|
4007 |
+
);
|
4008 |
+
|
4009 |
+
this.$searchContainer = $search;
|
4010 |
+
this.$search = $search.find('input');
|
4011 |
+
|
4012 |
+
$rendered.prepend($search);
|
4013 |
+
|
4014 |
+
return $rendered;
|
4015 |
+
};
|
4016 |
+
|
4017 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
4018 |
+
var self = this;
|
4019 |
+
|
4020 |
+
decorated.call(this, container, $container);
|
4021 |
+
|
4022 |
+
this.$search.on('keydown', function (evt) {
|
4023 |
+
self.trigger('keypress', evt);
|
4024 |
+
|
4025 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
4026 |
+
});
|
4027 |
+
|
4028 |
+
// Workaround for browsers which do not support the `input` event
|
4029 |
+
// This will prevent double-triggering of events for browsers which support
|
4030 |
+
// both the `keyup` and `input` events.
|
4031 |
+
this.$search.on('input', function (evt) {
|
4032 |
+
// Unbind the duplicated `keyup` event
|
4033 |
+
$(this).off('keyup');
|
4034 |
+
});
|
4035 |
+
|
4036 |
+
this.$search.on('keyup input', function (evt) {
|
4037 |
+
self.handleSearch(evt);
|
4038 |
+
});
|
4039 |
+
|
4040 |
+
container.on('open', function () {
|
4041 |
+
self.$search.attr('tabindex', 0);
|
4042 |
+
|
4043 |
+
self.$search.focus();
|
4044 |
+
|
4045 |
+
window.setTimeout(function () {
|
4046 |
+
self.$search.focus();
|
4047 |
+
}, 0);
|
4048 |
+
});
|
4049 |
+
|
4050 |
+
container.on('close', function () {
|
4051 |
+
self.$search.attr('tabindex', -1);
|
4052 |
+
|
4053 |
+
self.$search.val('');
|
4054 |
+
self.$search.blur();
|
4055 |
+
});
|
4056 |
+
|
4057 |
+
container.on('focus', function () {
|
4058 |
+
if (!container.isOpen()) {
|
4059 |
+
self.$search.focus();
|
4060 |
+
}
|
4061 |
+
});
|
4062 |
+
|
4063 |
+
container.on('results:all', function (params) {
|
4064 |
+
if (params.query.term == null || params.query.term === '') {
|
4065 |
+
var showSearch = self.showSearch(params);
|
4066 |
+
|
4067 |
+
if (showSearch) {
|
4068 |
+
self.$searchContainer.removeClass('select2-search--hide');
|
4069 |
+
} else {
|
4070 |
+
self.$searchContainer.addClass('select2-search--hide');
|
4071 |
+
}
|
4072 |
+
}
|
4073 |
+
});
|
4074 |
+
};
|
4075 |
+
|
4076 |
+
Search.prototype.handleSearch = function (evt) {
|
4077 |
+
if (!this._keyUpPrevented) {
|
4078 |
+
var input = this.$search.val();
|
4079 |
+
|
4080 |
+
this.trigger('query', {
|
4081 |
+
term: input
|
4082 |
+
});
|
4083 |
+
}
|
4084 |
+
|
4085 |
+
this._keyUpPrevented = false;
|
4086 |
+
};
|
4087 |
+
|
4088 |
+
Search.prototype.showSearch = function (_, params) {
|
4089 |
+
return true;
|
4090 |
+
};
|
4091 |
+
|
4092 |
+
return Search;
|
4093 |
+
});
|
4094 |
+
|
4095 |
+
S2.define('select2/dropdown/hidePlaceholder',[
|
4096 |
+
|
4097 |
+
], function () {
|
4098 |
+
function HidePlaceholder (decorated, $element, options, dataAdapter) {
|
4099 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
4100 |
+
|
4101 |
+
decorated.call(this, $element, options, dataAdapter);
|
4102 |
+
}
|
4103 |
+
|
4104 |
+
HidePlaceholder.prototype.append = function (decorated, data) {
|
4105 |
+
data.results = this.removePlaceholder(data.results);
|
4106 |
+
|
4107 |
+
decorated.call(this, data);
|
4108 |
+
};
|
4109 |
+
|
4110 |
+
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
4111 |
+
if (typeof placeholder === 'string') {
|
4112 |
+
placeholder = {
|
4113 |
+
id: '',
|
4114 |
+
text: placeholder
|
4115 |
+
};
|
4116 |
+
}
|
4117 |
+
|
4118 |
+
return placeholder;
|
4119 |
+
};
|
4120 |
+
|
4121 |
+
HidePlaceholder.prototype.removePlaceholder = function (_, data) {
|
4122 |
+
var modifiedData = data.slice(0);
|
4123 |
+
|
4124 |
+
for (var d = data.length - 1; d >= 0; d--) {
|
4125 |
+
var item = data[d];
|
4126 |
+
|
4127 |
+
if (this.placeholder.id === item.id) {
|
4128 |
+
modifiedData.splice(d, 1);
|
4129 |
+
}
|
4130 |
+
}
|
4131 |
+
|
4132 |
+
return modifiedData;
|
4133 |
+
};
|
4134 |
+
|
4135 |
+
return HidePlaceholder;
|
4136 |
+
});
|
4137 |
+
|
4138 |
+
S2.define('select2/dropdown/infiniteScroll',[
|
4139 |
+
'jquery'
|
4140 |
+
], function ($) {
|
4141 |
+
function InfiniteScroll (decorated, $element, options, dataAdapter) {
|
4142 |
+
this.lastParams = {};
|
4143 |
+
|
4144 |
+
decorated.call(this, $element, options, dataAdapter);
|
4145 |
+
|
4146 |
+
this.$loadingMore = this.createLoadingMore();
|
4147 |
+
this.loading = false;
|
4148 |
+
}
|
4149 |
+
|
4150 |
+
InfiniteScroll.prototype.append = function (decorated, data) {
|
4151 |
+
this.$loadingMore.remove();
|
4152 |
+
this.loading = false;
|
4153 |
+
|
4154 |
+
decorated.call(this, data);
|
4155 |
+
|
4156 |
+
if (this.showLoadingMore(data)) {
|
4157 |
+
this.$results.append(this.$loadingMore);
|
4158 |
+
}
|
4159 |
+
};
|
4160 |
+
|
4161 |
+
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
|
4162 |
+
var self = this;
|
4163 |
+
|
4164 |
+
decorated.call(this, container, $container);
|
4165 |
+
|
4166 |
+
container.on('query', function (params) {
|
4167 |
+
self.lastParams = params;
|
4168 |
+
self.loading = true;
|
4169 |
+
});
|
4170 |
+
|
4171 |
+
container.on('query:append', function (params) {
|
4172 |
+
self.lastParams = params;
|
4173 |
+
self.loading = true;
|
4174 |
+
});
|
4175 |
+
|
4176 |
+
this.$results.on('scroll', function () {
|
4177 |
+
var isLoadMoreVisible = $.contains(
|
4178 |
+
document.documentElement,
|
4179 |
+
self.$loadingMore[0]
|
4180 |
+
);
|
4181 |
+
|
4182 |
+
if (self.loading || !isLoadMoreVisible) {
|
4183 |
+
return;
|
4184 |
+
}
|
4185 |
+
|
4186 |
+
var currentOffset = self.$results.offset().top +
|
4187 |
+
self.$results.outerHeight(false);
|
4188 |
+
var loadingMoreOffset = self.$loadingMore.offset().top +
|
4189 |
+
self.$loadingMore.outerHeight(false);
|
4190 |
+
|
4191 |
+
if (currentOffset + 50 >= loadingMoreOffset) {
|
4192 |
+
self.loadMore();
|
4193 |
+
}
|
4194 |
+
});
|
4195 |
+
};
|
4196 |
+
|
4197 |
+
InfiniteScroll.prototype.loadMore = function () {
|
4198 |
+
this.loading = true;
|
4199 |
+
|
4200 |
+
var params = $.extend({}, {page: 1}, this.lastParams);
|
4201 |
+
|
4202 |
+
params.page++;
|
4203 |
+
|
4204 |
+
this.trigger('query:append', params);
|
4205 |
+
};
|
4206 |
+
|
4207 |
+
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
|
4208 |
+
return data.pagination && data.pagination.more;
|
4209 |
+
};
|
4210 |
+
|
4211 |
+
InfiniteScroll.prototype.createLoadingMore = function () {
|
4212 |
+
var $option = $(
|
4213 |
+
'<li ' +
|
4214 |
+
'class="select2-results__option select2-results__option--load-more"' +
|
4215 |
+
'role="treeitem" aria-disabled="true"></li>'
|
4216 |
+
);
|
4217 |
+
|
4218 |
+
var message = this.options.get('translations').get('loadingMore');
|
4219 |
+
|
4220 |
+
$option.html(message(this.lastParams));
|
4221 |
+
|
4222 |
+
return $option;
|
4223 |
+
};
|
4224 |
+
|
4225 |
+
return InfiniteScroll;
|
4226 |
+
});
|
4227 |
+
|
4228 |
+
S2.define('select2/dropdown/attachBody',[
|
4229 |
+
'jquery',
|
4230 |
+
'../utils'
|
4231 |
+
], function ($, Utils) {
|
4232 |
+
function AttachBody (decorated, $element, options) {
|
4233 |
+
this.$dropdownParent = options.get('dropdownParent') || $(document.body);
|
4234 |
+
|
4235 |
+
decorated.call(this, $element, options);
|
4236 |
+
}
|
4237 |
+
|
4238 |
+
AttachBody.prototype.bind = function (decorated, container, $container) {
|
4239 |
+
var self = this;
|
4240 |
+
|
4241 |
+
var setupResultsEvents = false;
|
4242 |
+
|
4243 |
+
decorated.call(this, container, $container);
|
4244 |
+
|
4245 |
+
container.on('open', function () {
|
4246 |
+
self._showDropdown();
|
4247 |
+
self._attachPositioningHandler(container);
|
4248 |
+
|
4249 |
+
if (!setupResultsEvents) {
|
4250 |
+
setupResultsEvents = true;
|
4251 |
+
|
4252 |
+
container.on('results:all', function () {
|
4253 |
+
self._positionDropdown();
|
4254 |
+
self._resizeDropdown();
|
4255 |
+
});
|
4256 |
+
|
4257 |
+
container.on('results:append', function () {
|
4258 |
+
self._positionDropdown();
|
4259 |
+
self._resizeDropdown();
|
4260 |
+
});
|
4261 |
+
}
|
4262 |
+
});
|
4263 |
+
|
4264 |
+
container.on('close', function () {
|
4265 |
+
self._hideDropdown();
|
4266 |
+
self._detachPositioningHandler(container);
|
4267 |
+
});
|
4268 |
+
|
4269 |
+
this.$dropdownContainer.on('mousedown', function (evt) {
|
4270 |
+
evt.stopPropagation();
|
4271 |
+
});
|
4272 |
+
};
|
4273 |
+
|
4274 |
+
AttachBody.prototype.destroy = function (decorated) {
|
4275 |
+
decorated.call(this);
|
4276 |
+
|
4277 |
+
this.$dropdownContainer.remove();
|
4278 |
+
};
|
4279 |
+
|
4280 |
+
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
4281 |
+
// Clone all of the container classes
|
4282 |
+
$dropdown.attr('class', $container.attr('class'));
|
4283 |
+
|
4284 |
+
$dropdown.removeClass('select2');
|
4285 |
+
$dropdown.addClass('select2-container--open');
|
4286 |
+
|
4287 |
+
$dropdown.css({
|
4288 |
+
position: 'absolute',
|
4289 |
+
top: -999999
|
4290 |
+
});
|
4291 |
+
|
4292 |
+
this.$container = $container;
|
4293 |
+
};
|
4294 |
+
|
4295 |
+
AttachBody.prototype.render = function (decorated) {
|
4296 |
+
var $container = $('<span></span>');
|
4297 |
+
|
4298 |
+
var $dropdown = decorated.call(this);
|
4299 |
+
$container.append($dropdown);
|
4300 |
+
|
4301 |
+
this.$dropdownContainer = $container;
|
4302 |
+
|
4303 |
+
return $container;
|
4304 |
+
};
|
4305 |
+
|
4306 |
+
AttachBody.prototype._hideDropdown = function (decorated) {
|
4307 |
+
this.$dropdownContainer.detach();
|
4308 |
+
};
|
4309 |
+
|
4310 |
+
AttachBody.prototype._attachPositioningHandler =
|
4311 |
+
function (decorated, container) {
|
4312 |
+
var self = this;
|
4313 |
+
|
4314 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4315 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4316 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4317 |
+
|
4318 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4319 |
+
$watchers.each(function () {
|
4320 |
+
Utils.StoreData(this, 'select2-scroll-position', {
|
4321 |
+
x: $(this).scrollLeft(),
|
4322 |
+
y: $(this).scrollTop()
|
4323 |
+
});
|
4324 |
+
});
|
4325 |
+
|
4326 |
+
$watchers.on(scrollEvent, function (ev) {
|
4327 |
+
var position = Utils.GetData(this, 'select2-scroll-position');
|
4328 |
+
$(this).scrollTop(position.y);
|
4329 |
+
});
|
4330 |
+
|
4331 |
+
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
|
4332 |
+
function (e) {
|
4333 |
+
self._positionDropdown();
|
4334 |
+
self._resizeDropdown();
|
4335 |
+
});
|
4336 |
+
};
|
4337 |
+
|
4338 |
+
AttachBody.prototype._detachPositioningHandler =
|
4339 |
+
function (decorated, container) {
|
4340 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4341 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4342 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4343 |
+
|
4344 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4345 |
+
$watchers.off(scrollEvent);
|
4346 |
+
|
4347 |
+
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
|
4348 |
+
};
|
4349 |
+
|
4350 |
+
AttachBody.prototype._positionDropdown = function () {
|
4351 |
+
var $window = $(window);
|
4352 |
+
|
4353 |
+
var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
|
4354 |
+
var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
|
4355 |
+
|
4356 |
+
var newDirection = null;
|
4357 |
+
|
4358 |
+
var offset = this.$container.offset();
|
4359 |
+
|
4360 |
+
offset.bottom = offset.top + this.$container.outerHeight(false);
|
4361 |
+
|
4362 |
+
var container = {
|
4363 |
+
height: this.$container.outerHeight(false)
|
4364 |
+
};
|
4365 |
+
|
4366 |
+
container.top = offset.top;
|
4367 |
+
container.bottom = offset.top + container.height;
|
4368 |
+
|
4369 |
+
var dropdown = {
|
4370 |
+
height: this.$dropdown.outerHeight(false)
|
4371 |
+
};
|
4372 |
+
|
4373 |
+
var viewport = {
|
4374 |
+
top: $window.scrollTop(),
|
4375 |
+
bottom: $window.scrollTop() + $window.height()
|
4376 |
+
};
|
4377 |
+
|
4378 |
+
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
|
4379 |
+
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
|
4380 |
+
|
4381 |
+
var css = {
|
4382 |
+
left: offset.left,
|
4383 |
+
top: container.bottom
|
4384 |
+
};
|
4385 |
+
|
4386 |
+
// Determine what the parent element is to use for calciulating the offset
|
4387 |
+
var $offsetParent = this.$dropdownParent;
|
4388 |
+
|
4389 |
+
// For statically positoned elements, we need to get the element
|
4390 |
+
// that is determining the offset
|
4391 |
+
if ($offsetParent.css('position') === 'static') {
|
4392 |
+
$offsetParent = $offsetParent.offsetParent();
|
4393 |
+
}
|
4394 |
+
|
4395 |
+
var parentOffset = $offsetParent.offset();
|
4396 |
+
|
4397 |
+
css.top -= parentOffset.top;
|
4398 |
+
css.left -= parentOffset.left;
|
4399 |
+
|
4400 |
+
if (!isCurrentlyAbove && !isCurrentlyBelow) {
|
4401 |
+
newDirection = 'below';
|
4402 |
+
}
|
4403 |
+
|
4404 |
+
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
|
4405 |
+
newDirection = 'above';
|
4406 |
+
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
|
4407 |
+
newDirection = 'below';
|
4408 |
+
}
|
4409 |
+
|
4410 |
+
if (newDirection == 'above' ||
|
4411 |
+
(isCurrentlyAbove && newDirection !== 'below')) {
|
4412 |
+
css.top = container.top - parentOffset.top - dropdown.height;
|
4413 |
+
}
|
4414 |
+
|
4415 |
+
if (newDirection != null) {
|
4416 |
+
this.$dropdown
|
4417 |
+
.removeClass('select2-dropdown--below select2-dropdown--above')
|
4418 |
+
.addClass('select2-dropdown--' + newDirection);
|
4419 |
+
this.$container
|
4420 |
+
.removeClass('select2-container--below select2-container--above')
|
4421 |
+
.addClass('select2-container--' + newDirection);
|
4422 |
+
}
|
4423 |
+
|
4424 |
+
this.$dropdownContainer.css(css);
|
4425 |
+
};
|
4426 |
+
|
4427 |
+
AttachBody.prototype._resizeDropdown = function () {
|
4428 |
+
var css = {
|
4429 |
+
width: this.$container.outerWidth(false) + 'px'
|
4430 |
+
};
|
4431 |
+
|
4432 |
+
if (this.options.get('dropdownAutoWidth')) {
|
4433 |
+
css.minWidth = css.width;
|
4434 |
+
css.position = 'relative';
|
4435 |
+
css.width = 'auto';
|
4436 |
+
}
|
4437 |
+
|
4438 |
+
this.$dropdown.css(css);
|
4439 |
+
};
|
4440 |
+
|
4441 |
+
AttachBody.prototype._showDropdown = function (decorated) {
|
4442 |
+
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
4443 |
+
|
4444 |
+
this._positionDropdown();
|
4445 |
+
this._resizeDropdown();
|
4446 |
+
};
|
4447 |
+
|
4448 |
+
return AttachBody;
|
4449 |
+
});
|
4450 |
+
|
4451 |
+
S2.define('select2/dropdown/minimumResultsForSearch',[
|
4452 |
+
|
4453 |
+
], function () {
|
4454 |
+
function countResults (data) {
|
4455 |
+
var count = 0;
|
4456 |
+
|
4457 |
+
for (var d = 0; d < data.length; d++) {
|
4458 |
+
var item = data[d];
|
4459 |
+
|
4460 |
+
if (item.children) {
|
4461 |
+
count += countResults(item.children);
|
4462 |
+
} else {
|
4463 |
+
count++;
|
4464 |
+
}
|
4465 |
+
}
|
4466 |
+
|
4467 |
+
return count;
|
4468 |
+
}
|
4469 |
+
|
4470 |
+
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
|
4471 |
+
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
|
4472 |
+
|
4473 |
+
if (this.minimumResultsForSearch < 0) {
|
4474 |
+
this.minimumResultsForSearch = Infinity;
|
4475 |
+
}
|
4476 |
+
|
4477 |
+
decorated.call(this, $element, options, dataAdapter);
|
4478 |
+
}
|
4479 |
+
|
4480 |
+
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
|
4481 |
+
if (countResults(params.data.results) < this.minimumResultsForSearch) {
|
4482 |
+
return false;
|
4483 |
+
}
|
4484 |
+
|
4485 |
+
return decorated.call(this, params);
|
4486 |
+
};
|
4487 |
+
|
4488 |
+
return MinimumResultsForSearch;
|
4489 |
+
});
|
4490 |
+
|
4491 |
+
S2.define('select2/dropdown/selectOnClose',[
|
4492 |
+
'../utils'
|
4493 |
+
], function (Utils) {
|
4494 |
+
function SelectOnClose () { }
|
4495 |
+
|
4496 |
+
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
4497 |
+
var self = this;
|
4498 |
+
|
4499 |
+
decorated.call(this, container, $container);
|
4500 |
+
|
4501 |
+
container.on('close', function (params) {
|
4502 |
+
self._handleSelectOnClose(params);
|
4503 |
+
});
|
4504 |
+
};
|
4505 |
+
|
4506 |
+
SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
|
4507 |
+
if (params && params.originalSelect2Event != null) {
|
4508 |
+
var event = params.originalSelect2Event;
|
4509 |
+
|
4510 |
+
// Don't select an item if the close event was triggered from a select or
|
4511 |
+
// unselect event
|
4512 |
+
if (event._type === 'select' || event._type === 'unselect') {
|
4513 |
+
return;
|
4514 |
+
}
|
4515 |
+
}
|
4516 |
+
|
4517 |
+
var $highlightedResults = this.getHighlightedResults();
|
4518 |
+
|
4519 |
+
// Only select highlighted results
|
4520 |
+
if ($highlightedResults.length < 1) {
|
4521 |
+
return;
|
4522 |
+
}
|
4523 |
+
|
4524 |
+
var data = Utils.GetData($highlightedResults[0], 'data');
|
4525 |
+
|
4526 |
+
// Don't re-select already selected resulte
|
4527 |
+
if (
|
4528 |
+
(data.element != null && data.element.selected) ||
|
4529 |
+
(data.element == null && data.selected)
|
4530 |
+
) {
|
4531 |
+
return;
|
4532 |
+
}
|
4533 |
+
|
4534 |
+
this.trigger('select', {
|
4535 |
+
data: data
|
4536 |
+
});
|
4537 |
+
};
|
4538 |
+
|
4539 |
+
return SelectOnClose;
|
4540 |
+
});
|
4541 |
+
|
4542 |
+
S2.define('select2/dropdown/closeOnSelect',[
|
4543 |
+
|
4544 |
+
], function () {
|
4545 |
+
function CloseOnSelect () { }
|
4546 |
+
|
4547 |
+
CloseOnSelect.prototype.bind = function (decorated, container, $container) {
|
4548 |
+
var self = this;
|
4549 |
+
|
4550 |
+
decorated.call(this, container, $container);
|
4551 |
+
|
4552 |
+
container.on('select', function (evt) {
|
4553 |
+
self._selectTriggered(evt);
|
4554 |
+
});
|
4555 |
+
|
4556 |
+
container.on('unselect', function (evt) {
|
4557 |
+
self._selectTriggered(evt);
|
4558 |
+
});
|
4559 |
+
};
|
4560 |
+
|
4561 |
+
CloseOnSelect.prototype._selectTriggered = function (_, evt) {
|
4562 |
+
var originalEvent = evt.originalEvent;
|
4563 |
+
|
4564 |
+
// Don't close if the control key is being held
|
4565 |
+
if (originalEvent && originalEvent.ctrlKey) {
|
4566 |
+
return;
|
4567 |
+
}
|
4568 |
+
|
4569 |
+
this.trigger('close', {
|
4570 |
+
originalEvent: originalEvent,
|
4571 |
+
originalSelect2Event: evt
|
4572 |
+
});
|
4573 |
+
};
|
4574 |
+
|
4575 |
+
return CloseOnSelect;
|
4576 |
+
});
|
4577 |
+
|
4578 |
+
S2.define('select2/i18n/en',[],function () {
|
4579 |
+
// English
|
4580 |
+
return {
|
4581 |
+
errorLoading: function () {
|
4582 |
+
return 'The results could not be loaded.';
|
4583 |
+
},
|
4584 |
+
inputTooLong: function (args) {
|
4585 |
+
var overChars = args.input.length - args.maximum;
|
4586 |
+
|
4587 |
+
var message = 'Please delete ' + overChars + ' character';
|
4588 |
+
|
4589 |
+
if (overChars != 1) {
|
4590 |
+
message += 's';
|
4591 |
+
}
|
4592 |
+
|
4593 |
+
return message;
|
4594 |
+
},
|
4595 |
+
inputTooShort: function (args) {
|
4596 |
+
var remainingChars = args.minimum - args.input.length;
|
4597 |
+
|
4598 |
+
var message = 'Please enter ' + remainingChars + ' or more characters';
|
4599 |
+
|
4600 |
+
return message;
|
4601 |
+
},
|
4602 |
+
loadingMore: function () {
|
4603 |
+
return 'Loading more results…';
|
4604 |
+
},
|
4605 |
+
maximumSelected: function (args) {
|
4606 |
+
var message = 'You can only select ' + args.maximum + ' item';
|
4607 |
+
|
4608 |
+
if (args.maximum != 1) {
|
4609 |
+
message += 's';
|
4610 |
+
}
|
4611 |
+
|
4612 |
+
return message;
|
4613 |
+
},
|
4614 |
+
noResults: function () {
|
4615 |
+
return 'No results found';
|
4616 |
+
},
|
4617 |
+
searching: function () {
|
4618 |
+
return 'Searching…';
|
4619 |
+
}
|
4620 |
+
};
|
4621 |
+
});
|
4622 |
+
|
4623 |
+
S2.define('select2/defaults',[
|
4624 |
+
'jquery',
|
4625 |
+
'require',
|
4626 |
+
|
4627 |
+
'./results',
|
4628 |
+
|
4629 |
+
'./selection/single',
|
4630 |
+
'./selection/multiple',
|
4631 |
+
'./selection/placeholder',
|
4632 |
+
'./selection/allowClear',
|
4633 |
+
'./selection/search',
|
4634 |
+
'./selection/eventRelay',
|
4635 |
+
|
4636 |
+
'./utils',
|
4637 |
+
'./translation',
|
4638 |
+
'./diacritics',
|
4639 |
+
|
4640 |
+
'./data/select',
|
4641 |
+
'./data/array',
|
4642 |
+
'./data/ajax',
|
4643 |
+
'./data/tags',
|
4644 |
+
'./data/tokenizer',
|
4645 |
+
'./data/minimumInputLength',
|
4646 |
+
'./data/maximumInputLength',
|
4647 |
+
'./data/maximumSelectionLength',
|
4648 |
+
|
4649 |
+
'./dropdown',
|
4650 |
+
'./dropdown/search',
|
4651 |
+
'./dropdown/hidePlaceholder',
|
4652 |
+
'./dropdown/infiniteScroll',
|
4653 |
+
'./dropdown/attachBody',
|
4654 |
+
'./dropdown/minimumResultsForSearch',
|
4655 |
+
'./dropdown/selectOnClose',
|
4656 |
+
'./dropdown/closeOnSelect',
|
4657 |
+
|
4658 |
+
'./i18n/en'
|
4659 |
+
], function ($, require,
|
4660 |
+
|
4661 |
+
ResultsList,
|
4662 |
+
|
4663 |
+
SingleSelection, MultipleSelection, Placeholder, AllowClear,
|
4664 |
+
SelectionSearch, EventRelay,
|
4665 |
+
|
4666 |
+
Utils, Translation, DIACRITICS,
|
4667 |
+
|
4668 |
+
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
4669 |
+
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
4670 |
+
|
4671 |
+
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
4672 |
+
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
|
4673 |
+
|
4674 |
+
EnglishTranslation) {
|
4675 |
+
function Defaults () {
|
4676 |
+
this.reset();
|
4677 |
+
}
|
4678 |
+
|
4679 |
+
Defaults.prototype.apply = function (options) {
|
4680 |
+
options = $.extend(true, {}, this.defaults, options);
|
4681 |
+
|
4682 |
+
if (options.dataAdapter == null) {
|
4683 |
+
if (options.ajax != null) {
|
4684 |
+
options.dataAdapter = AjaxData;
|
4685 |
+
} else if (options.data != null) {
|
4686 |
+
options.dataAdapter = ArrayData;
|
4687 |
+
} else {
|
4688 |
+
options.dataAdapter = SelectData;
|
4689 |
+
}
|
4690 |
+
|
4691 |
+
if (options.minimumInputLength > 0) {
|
4692 |
+
options.dataAdapter = Utils.Decorate(
|
4693 |
+
options.dataAdapter,
|
4694 |
+
MinimumInputLength
|
4695 |
+
);
|
4696 |
+
}
|
4697 |
+
|
4698 |
+
if (options.maximumInputLength > 0) {
|
4699 |
+
options.dataAdapter = Utils.Decorate(
|
4700 |
+
options.dataAdapter,
|
4701 |
+
MaximumInputLength
|
4702 |
+
);
|
4703 |
+
}
|
4704 |
+
|
4705 |
+
if (options.maximumSelectionLength > 0) {
|
4706 |
+
options.dataAdapter = Utils.Decorate(
|
4707 |
+
options.dataAdapter,
|
4708 |
+
MaximumSelectionLength
|
4709 |
+
);
|
4710 |
+
}
|
4711 |
+
|
4712 |
+
if (options.tags) {
|
4713 |
+
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
4714 |
+
}
|
4715 |
+
|
4716 |
+
if (options.tokenSeparators != null || options.tokenizer != null) {
|
4717 |
+
options.dataAdapter = Utils.Decorate(
|
4718 |
+
options.dataAdapter,
|
4719 |
+
Tokenizer
|
4720 |
+
);
|
4721 |
+
}
|
4722 |
+
|
4723 |
+
if (options.query != null) {
|
4724 |
+
var Query = require(options.amdBase + 'compat/query');
|
4725 |
+
|
4726 |
+
options.dataAdapter = Utils.Decorate(
|
4727 |
+
options.dataAdapter,
|
4728 |
+
Query
|
4729 |
+
);
|
4730 |
+
}
|
4731 |
+
|
4732 |
+
if (options.initSelection != null) {
|
4733 |
+
var InitSelection = require(options.amdBase + 'compat/initSelection');
|
4734 |
+
|
4735 |
+
options.dataAdapter = Utils.Decorate(
|
4736 |
+
options.dataAdapter,
|
4737 |
+
InitSelection
|
4738 |
+
);
|
4739 |
+
}
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
if (options.resultsAdapter == null) {
|
4743 |
+
options.resultsAdapter = ResultsList;
|
4744 |
+
|
4745 |
+
if (options.ajax != null) {
|
4746 |
+
options.resultsAdapter = Utils.Decorate(
|
4747 |
+
options.resultsAdapter,
|
4748 |
+
InfiniteScroll
|
4749 |
+
);
|
4750 |
+
}
|
4751 |
+
|
4752 |
+
if (options.placeholder != null) {
|
4753 |
+
options.resultsAdapter = Utils.Decorate(
|
4754 |
+
options.resultsAdapter,
|
4755 |
+
HidePlaceholder
|
4756 |
+
);
|
4757 |
+
}
|
4758 |
+
|
4759 |
+
if (options.selectOnClose) {
|
4760 |
+
options.resultsAdapter = Utils.Decorate(
|
4761 |
+
options.resultsAdapter,
|
4762 |
+
SelectOnClose
|
4763 |
+
);
|
4764 |
+
}
|
4765 |
+
}
|
4766 |
+
|
4767 |
+
if (options.dropdownAdapter == null) {
|
4768 |
+
if (options.multiple) {
|
4769 |
+
options.dropdownAdapter = Dropdown;
|
4770 |
+
} else {
|
4771 |
+
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
|
4772 |
+
|
4773 |
+
options.dropdownAdapter = SearchableDropdown;
|
4774 |
+
}
|
4775 |
+
|
4776 |
+
if (options.minimumResultsForSearch !== 0) {
|
4777 |
+
options.dropdownAdapter = Utils.Decorate(
|
4778 |
+
options.dropdownAdapter,
|
4779 |
+
MinimumResultsForSearch
|
4780 |
+
);
|
4781 |
+
}
|
4782 |
+
|
4783 |
+
if (options.closeOnSelect) {
|
4784 |
+
options.dropdownAdapter = Utils.Decorate(
|
4785 |
+
options.dropdownAdapter,
|
4786 |
+
CloseOnSelect
|
4787 |
+
);
|
4788 |
+
}
|
4789 |
+
|
4790 |
+
if (
|
4791 |
+
options.dropdownCssClass != null ||
|
4792 |
+
options.dropdownCss != null ||
|
4793 |
+
options.adaptDropdownCssClass != null
|
4794 |
+
) {
|
4795 |
+
var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
|
4796 |
+
|
4797 |
+
options.dropdownAdapter = Utils.Decorate(
|
4798 |
+
options.dropdownAdapter,
|
4799 |
+
DropdownCSS
|
4800 |
+
);
|
4801 |
+
}
|
4802 |
+
|
4803 |
+
options.dropdownAdapter = Utils.Decorate(
|
4804 |
+
options.dropdownAdapter,
|
4805 |
+
AttachBody
|
4806 |
+
);
|
4807 |
+
}
|
4808 |
+
|
4809 |
+
if (options.selectionAdapter == null) {
|
4810 |
+
if (options.multiple) {
|
4811 |
+
options.selectionAdapter = MultipleSelection;
|
4812 |
+
} else {
|
4813 |
+
options.selectionAdapter = SingleSelection;
|
4814 |
+
}
|
4815 |
+
|
4816 |
+
// Add the placeholder mixin if a placeholder was specified
|
4817 |
+
if (options.placeholder != null) {
|
4818 |
+
options.selectionAdapter = Utils.Decorate(
|
4819 |
+
options.selectionAdapter,
|
4820 |
+
Placeholder
|
4821 |
+
);
|
4822 |
+
}
|
4823 |
+
|
4824 |
+
if (options.allowClear) {
|
4825 |
+
options.selectionAdapter = Utils.Decorate(
|
4826 |
+
options.selectionAdapter,
|
4827 |
+
AllowClear
|
4828 |
+
);
|
4829 |
+
}
|
4830 |
+
|
4831 |
+
if (options.multiple) {
|
4832 |
+
options.selectionAdapter = Utils.Decorate(
|
4833 |
+
options.selectionAdapter,
|
4834 |
+
SelectionSearch
|
4835 |
+
);
|
4836 |
+
}
|
4837 |
+
|
4838 |
+
if (
|
4839 |
+
options.containerCssClass != null ||
|
4840 |
+
options.containerCss != null ||
|
4841 |
+
options.adaptContainerCssClass != null
|
4842 |
+
) {
|
4843 |
+
var ContainerCSS = require(options.amdBase + 'compat/containerCss');
|
4844 |
+
|
4845 |
+
options.selectionAdapter = Utils.Decorate(
|
4846 |
+
options.selectionAdapter,
|
4847 |
+
ContainerCSS
|
4848 |
+
);
|
4849 |
+
}
|
4850 |
+
|
4851 |
+
options.selectionAdapter = Utils.Decorate(
|
4852 |
+
options.selectionAdapter,
|
4853 |
+
EventRelay
|
4854 |
+
);
|
4855 |
+
}
|
4856 |
+
|
4857 |
+
if (typeof options.language === 'string') {
|
4858 |
+
// Check if the language is specified with a region
|
4859 |
+
if (options.language.indexOf('-') > 0) {
|
4860 |
+
// Extract the region information if it is included
|
4861 |
+
var languageParts = options.language.split('-');
|
4862 |
+
var baseLanguage = languageParts[0];
|
4863 |
+
|
4864 |
+
options.language = [options.language, baseLanguage];
|
4865 |
+
} else {
|
4866 |
+
options.language = [options.language];
|
4867 |
+
}
|
4868 |
+
}
|
4869 |
+
|
4870 |
+
if ($.isArray(options.language)) {
|
4871 |
+
var languages = new Translation();
|
4872 |
+
options.language.push('en');
|
4873 |
+
|
4874 |
+
var languageNames = options.language;
|
4875 |
+
|
4876 |
+
for (var l = 0; l < languageNames.length; l++) {
|
4877 |
+
var name = languageNames[l];
|
4878 |
+
var language = {};
|
4879 |
+
|
4880 |
+
try {
|
4881 |
+
// Try to load it with the original name
|
4882 |
+
language = Translation.loadPath(name);
|
4883 |
+
} catch (e) {
|
4884 |
+
try {
|
4885 |
+
// If we couldn't load it, check if it wasn't the full path
|
4886 |
+
name = this.defaults.amdLanguageBase + name;
|
4887 |
+
language = Translation.loadPath(name);
|
4888 |
+
} catch (ex) {
|
4889 |
+
// The translation could not be loaded at all. Sometimes this is
|
4890 |
+
// because of a configuration problem, other times this can be
|
4891 |
+
// because of how Select2 helps load all possible translation files.
|
4892 |
+
if (options.debug && window.console && console.warn) {
|
4893 |
+
console.warn(
|
4894 |
+
'Select2: The language file for "' + name + '" could not be ' +
|
4895 |
+
'automatically loaded. A fallback will be used instead.'
|
4896 |
+
);
|
4897 |
}
|
4898 |
+
|
4899 |
+
continue;
|
4900 |
+
}
|
4901 |
+
}
|
4902 |
+
|
4903 |
+
languages.extend(language);
|
4904 |
+
}
|
4905 |
+
|
4906 |
+
options.translations = languages;
|
4907 |
+
} else {
|
4908 |
+
var baseTranslation = Translation.loadPath(
|
4909 |
+
this.defaults.amdLanguageBase + 'en'
|
4910 |
+
);
|
4911 |
+
var customTranslation = new Translation(options.language);
|
4912 |
+
|
4913 |
+
customTranslation.extend(baseTranslation);
|
4914 |
+
|
4915 |
+
options.translations = customTranslation;
|
4916 |
+
}
|
4917 |
+
|
4918 |
+
return options;
|
4919 |
+
};
|
4920 |
+
|
4921 |
+
Defaults.prototype.reset = function () {
|
4922 |
+
function stripDiacritics (text) {
|
4923 |
+
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
4924 |
+
function match(a) {
|
4925 |
+
return DIACRITICS[a] || a;
|
4926 |
+
}
|
4927 |
+
|
4928 |
+
return text.replace(/[^\u0000-\u007E]/g, match);
|
4929 |
+
}
|
4930 |
+
|
4931 |
+
function matcher (params, data) {
|
4932 |
+
// Always return the object if there is nothing to compare
|
4933 |
+
if ($.trim(params.term) === '') {
|
4934 |
+
return data;
|
4935 |
+
}
|
4936 |
+
|
4937 |
+
// Do a recursive check for options with children
|
4938 |
+
if (data.children && data.children.length > 0) {
|
4939 |
+
// Clone the data object if there are children
|
4940 |
+
// This is required as we modify the object to remove any non-matches
|
4941 |
+
var match = $.extend(true, {}, data);
|
4942 |
+
|
4943 |
+
// Check each child of the option
|
4944 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
4945 |
+
var child = data.children[c];
|
4946 |
+
|
4947 |
+
var matches = matcher(params, child);
|
4948 |
+
|
4949 |
+
// If there wasn't a match, remove the object in the array
|
4950 |
+
if (matches == null) {
|
4951 |
+
match.children.splice(c, 1);
|
4952 |
+
}
|
4953 |
+
}
|
4954 |
+
|
4955 |
+
// If any children matched, return the new object
|
4956 |
+
if (match.children.length > 0) {
|
4957 |
+
return match;
|
4958 |
+
}
|
4959 |
+
|
4960 |
+
// If there were no matching children, check just the plain object
|
4961 |
+
return matcher(params, match);
|
4962 |
+
}
|
4963 |
+
|
4964 |
+
var original = stripDiacritics(data.text).toUpperCase();
|
4965 |
+
var term = stripDiacritics(params.term).toUpperCase();
|
4966 |
+
|
4967 |
+
// Check if the text contains the term
|
4968 |
+
if (original.indexOf(term) > -1) {
|
4969 |
+
return data;
|
4970 |
+
}
|
4971 |
+
|
4972 |
+
// If it doesn't contain the term, don't return anything
|
4973 |
+
return null;
|
4974 |
+
}
|
4975 |
+
|
4976 |
+
this.defaults = {
|
4977 |
+
amdBase: './',
|
4978 |
+
amdLanguageBase: './i18n/',
|
4979 |
+
closeOnSelect: true,
|
4980 |
+
debug: false,
|
4981 |
+
dropdownAutoWidth: false,
|
4982 |
+
escapeMarkup: Utils.escapeMarkup,
|
4983 |
+
language: EnglishTranslation,
|
4984 |
+
matcher: matcher,
|
4985 |
+
minimumInputLength: 0,
|
4986 |
+
maximumInputLength: 0,
|
4987 |
+
maximumSelectionLength: 0,
|
4988 |
+
minimumResultsForSearch: 0,
|
4989 |
+
selectOnClose: false,
|
4990 |
+
sorter: function (data) {
|
4991 |
+
return data;
|
4992 |
+
},
|
4993 |
+
templateResult: function (result) {
|
4994 |
+
return result.text;
|
4995 |
+
},
|
4996 |
+
templateSelection: function (selection) {
|
4997 |
+
return selection.text;
|
4998 |
+
},
|
4999 |
+
theme: 'default',
|
5000 |
+
width: 'resolve'
|
5001 |
+
};
|
5002 |
+
};
|
5003 |
+
|
5004 |
+
Defaults.prototype.set = function (key, value) {
|
5005 |
+
var camelKey = $.camelCase(key);
|
5006 |
+
|
5007 |
+
var data = {};
|
5008 |
+
data[camelKey] = value;
|
5009 |
+
|
5010 |
+
var convertedData = Utils._convertData(data);
|
5011 |
+
|
5012 |
+
$.extend(true, this.defaults, convertedData);
|
5013 |
+
};
|
5014 |
+
|
5015 |
+
var defaults = new Defaults();
|
5016 |
+
|
5017 |
+
return defaults;
|
5018 |
+
});
|
5019 |
+
|
5020 |
+
S2.define('select2/options',[
|
5021 |
+
'require',
|
5022 |
+
'jquery',
|
5023 |
+
'./defaults',
|
5024 |
+
'./utils'
|
5025 |
+
], function (require, $, Defaults, Utils) {
|
5026 |
+
function Options (options, $element) {
|
5027 |
+
this.options = options;
|
5028 |
+
|
5029 |
+
if ($element != null) {
|
5030 |
+
this.fromElement($element);
|
5031 |
+
}
|
5032 |
+
|
5033 |
+
this.options = Defaults.apply(this.options);
|
5034 |
+
|
5035 |
+
if ($element && $element.is('input')) {
|
5036 |
+
var InputCompat = require(this.get('amdBase') + 'compat/inputData');
|
5037 |
+
|
5038 |
+
this.options.dataAdapter = Utils.Decorate(
|
5039 |
+
this.options.dataAdapter,
|
5040 |
+
InputCompat
|
5041 |
+
);
|
5042 |
+
}
|
5043 |
+
}
|
5044 |
+
|
5045 |
+
Options.prototype.fromElement = function ($e) {
|
5046 |
+
var excludedData = ['select2'];
|
5047 |
+
|
5048 |
+
if (this.options.multiple == null) {
|
5049 |
+
this.options.multiple = $e.prop('multiple');
|
5050 |
+
}
|
5051 |
+
|
5052 |
+
if (this.options.disabled == null) {
|
5053 |
+
this.options.disabled = $e.prop('disabled');
|
5054 |
+
}
|
5055 |
+
|
5056 |
+
if (this.options.language == null) {
|
5057 |
+
if ($e.prop('lang')) {
|
5058 |
+
this.options.language = $e.prop('lang').toLowerCase();
|
5059 |
+
} else if ($e.closest('[lang]').prop('lang')) {
|
5060 |
+
this.options.language = $e.closest('[lang]').prop('lang');
|
5061 |
+
}
|
5062 |
+
}
|
5063 |
+
|
5064 |
+
if (this.options.dir == null) {
|
5065 |
+
if ($e.prop('dir')) {
|
5066 |
+
this.options.dir = $e.prop('dir');
|
5067 |
+
} else if ($e.closest('[dir]').prop('dir')) {
|
5068 |
+
this.options.dir = $e.closest('[dir]').prop('dir');
|
5069 |
+
} else {
|
5070 |
+
this.options.dir = 'ltr';
|
5071 |
+
}
|
5072 |
+
}
|
5073 |
+
|
5074 |
+
$e.prop('disabled', this.options.disabled);
|
5075 |
+
$e.prop('multiple', this.options.multiple);
|
5076 |
+
|
5077 |
+
if (Utils.GetData($e[0], 'select2Tags')) {
|
5078 |
+
if (this.options.debug && window.console && console.warn) {
|
5079 |
+
console.warn(
|
5080 |
+
'Select2: The `data-select2-tags` attribute has been changed to ' +
|
5081 |
+
'use the `data-data` and `data-tags="true"` attributes and will be ' +
|
5082 |
+
'removed in future versions of Select2.'
|
5083 |
+
);
|
5084 |
+
}
|
5085 |
+
|
5086 |
+
Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
|
5087 |
+
Utils.StoreData($e[0], 'tags', true);
|
5088 |
+
}
|
5089 |
+
|
5090 |
+
if (Utils.GetData($e[0], 'ajaxUrl')) {
|
5091 |
+
if (this.options.debug && window.console && console.warn) {
|
5092 |
+
console.warn(
|
5093 |
+
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
5094 |
+
'`data-ajax--url` and support for the old attribute will be removed' +
|
5095 |
+
' in future versions of Select2.'
|
5096 |
+
);
|
5097 |
+
}
|
5098 |
+
|
5099 |
+
$e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
|
5100 |
+
Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
|
5101 |
+
|
5102 |
+
}
|
5103 |
+
|
5104 |
+
var dataset = {};
|
5105 |
+
|
5106 |
+
// Prefer the element's `dataset` attribute if it exists
|
5107 |
+
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
5108 |
+
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
5109 |
+
dataset = $.extend(true, {}, $e[0].dataset, Utils.GetData($e[0]));
|
5110 |
+
} else {
|
5111 |
+
dataset = Utils.GetData($e[0]);
|
5112 |
+
}
|
5113 |
+
|
5114 |
+
var data = $.extend(true, {}, dataset);
|
5115 |
+
|
5116 |
+
data = Utils._convertData(data);
|
5117 |
+
|
5118 |
+
for (var key in data) {
|
5119 |
+
if ($.inArray(key, excludedData) > -1) {
|
5120 |
+
continue;
|
5121 |
+
}
|
5122 |
+
|
5123 |
+
if ($.isPlainObject(this.options[key])) {
|
5124 |
+
$.extend(this.options[key], data[key]);
|
5125 |
+
} else {
|
5126 |
+
this.options[key] = data[key];
|
5127 |
+
}
|
5128 |
+
}
|
5129 |
+
|
5130 |
+
return this;
|
5131 |
+
};
|
5132 |
+
|
5133 |
+
Options.prototype.get = function (key) {
|
5134 |
+
return this.options[key];
|
5135 |
+
};
|
5136 |
+
|
5137 |
+
Options.prototype.set = function (key, val) {
|
5138 |
+
this.options[key] = val;
|
5139 |
+
};
|
5140 |
+
|
5141 |
+
return Options;
|
5142 |
+
});
|
5143 |
+
|
5144 |
+
S2.define('select2/core',[
|
5145 |
+
'jquery',
|
5146 |
+
'./options',
|
5147 |
+
'./utils',
|
5148 |
+
'./keys'
|
5149 |
+
], function ($, Options, Utils, KEYS) {
|
5150 |
+
var Select2 = function ($element, options) {
|
5151 |
+
if (Utils.GetData($element[0], 'select2') != null) {
|
5152 |
+
Utils.GetData($element[0], 'select2').destroy();
|
5153 |
+
}
|
5154 |
+
|
5155 |
+
this.$element = $element;
|
5156 |
+
|
5157 |
+
this.id = this._generateId($element);
|
5158 |
+
|
5159 |
+
options = options || {};
|
5160 |
+
|
5161 |
+
this.options = new Options(options, $element);
|
5162 |
+
|
5163 |
+
Select2.__super__.constructor.call(this);
|
5164 |
+
|
5165 |
+
// Set up the tabindex
|
5166 |
+
|
5167 |
+
var tabindex = $element.attr('tabindex') || 0;
|
5168 |
+
Utils.StoreData($element[0], 'old-tabindex', tabindex);
|
5169 |
+
$element.attr('tabindex', '-1');
|
5170 |
+
|
5171 |
+
// Set up containers and adapters
|
5172 |
+
|
5173 |
+
var DataAdapter = this.options.get('dataAdapter');
|
5174 |
+
this.dataAdapter = new DataAdapter($element, this.options);
|
5175 |
+
|
5176 |
+
var $container = this.render();
|
5177 |
+
|
5178 |
+
this._placeContainer($container);
|
5179 |
+
|
5180 |
+
var SelectionAdapter = this.options.get('selectionAdapter');
|
5181 |
+
this.selection = new SelectionAdapter($element, this.options);
|
5182 |
+
this.$selection = this.selection.render();
|
5183 |
+
|
5184 |
+
this.selection.position(this.$selection, $container);
|
5185 |
+
|
5186 |
+
var DropdownAdapter = this.options.get('dropdownAdapter');
|
5187 |
+
this.dropdown = new DropdownAdapter($element, this.options);
|
5188 |
+
this.$dropdown = this.dropdown.render();
|
5189 |
+
|
5190 |
+
this.dropdown.position(this.$dropdown, $container);
|
5191 |
+
|
5192 |
+
var ResultsAdapter = this.options.get('resultsAdapter');
|
5193 |
+
this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
|
5194 |
+
this.$results = this.results.render();
|
5195 |
+
|
5196 |
+
this.results.position(this.$results, this.$dropdown);
|
5197 |
+
|
5198 |
+
// Bind events
|
5199 |
+
|
5200 |
+
var self = this;
|
5201 |
+
|
5202 |
+
// Bind the container to all of the adapters
|
5203 |
+
this._bindAdapters();
|
5204 |
+
|
5205 |
+
// Register any DOM event handlers
|
5206 |
+
this._registerDomEvents();
|
5207 |
+
|
5208 |
+
// Register any internal event handlers
|
5209 |
+
this._registerDataEvents();
|
5210 |
+
this._registerSelectionEvents();
|
5211 |
+
this._registerDropdownEvents();
|
5212 |
+
this._registerResultsEvents();
|
5213 |
+
this._registerEvents();
|
5214 |
+
|
5215 |
+
// Set the initial state
|
5216 |
+
this.dataAdapter.current(function (initialData) {
|
5217 |
+
self.trigger('selection:update', {
|
5218 |
+
data: initialData
|
5219 |
+
});
|
5220 |
+
});
|
5221 |
+
|
5222 |
+
// Hide the original select
|
5223 |
+
$element.addClass('select2-hidden-accessible');
|
5224 |
+
$element.attr('aria-hidden', 'true');
|
5225 |
+
|
5226 |
+
// Synchronize any monitored attributes
|
5227 |
+
this._syncAttributes();
|
5228 |
+
|
5229 |
+
Utils.StoreData($element[0], 'select2', this);
|
5230 |
+
|
5231 |
+
// Ensure backwards compatibility with $element.data('select2').
|
5232 |
+
$element.data('select2', this);
|
5233 |
+
};
|
5234 |
+
|
5235 |
+
Utils.Extend(Select2, Utils.Observable);
|
5236 |
+
|
5237 |
+
Select2.prototype._generateId = function ($element) {
|
5238 |
+
var id = '';
|
5239 |
+
|
5240 |
+
if ($element.attr('id') != null) {
|
5241 |
+
id = $element.attr('id');
|
5242 |
+
} else if ($element.attr('name') != null) {
|
5243 |
+
id = $element.attr('name') + '-' + Utils.generateChars(2);
|
5244 |
+
} else {
|
5245 |
+
id = Utils.generateChars(4);
|
5246 |
+
}
|
5247 |
+
|
5248 |
+
id = id.replace(/(:|\.|\[|\]|,)/g, '');
|
5249 |
+
id = 'select2-' + id;
|
5250 |
+
|
5251 |
+
return id;
|
5252 |
+
};
|
5253 |
+
|
5254 |
+
Select2.prototype._placeContainer = function ($container) {
|
5255 |
+
$container.insertAfter(this.$element);
|
5256 |
+
|
5257 |
+
var width = this._resolveWidth(this.$element, this.options.get('width'));
|
5258 |
+
|
5259 |
+
if (width != null) {
|
5260 |
+
$container.css('width', width);
|
5261 |
+
}
|
5262 |
+
};
|
5263 |
+
|
5264 |
+
Select2.prototype._resolveWidth = function ($element, method) {
|
5265 |
+
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
|
5266 |
+
|
5267 |
+
if (method == 'resolve') {
|
5268 |
+
var styleWidth = this._resolveWidth($element, 'style');
|
5269 |
+
|
5270 |
+
if (styleWidth != null) {
|
5271 |
+
return styleWidth;
|
5272 |
+
}
|
5273 |
+
|
5274 |
+
return this._resolveWidth($element, 'element');
|
5275 |
+
}
|
5276 |
+
|
5277 |
+
if (method == 'element') {
|
5278 |
+
var elementWidth = $element.outerWidth(false);
|
5279 |
+
|
5280 |
+
if (elementWidth <= 0) {
|
5281 |
+
return 'auto';
|
5282 |
+
}
|
5283 |
+
|
5284 |
+
return elementWidth + 'px';
|
5285 |
+
}
|
5286 |
+
|
5287 |
+
if (method == 'style') {
|
5288 |
+
var style = $element.attr('style');
|
5289 |
+
|
5290 |
+
if (typeof(style) !== 'string') {
|
5291 |
+
return null;
|
5292 |
+
}
|
5293 |
+
|
5294 |
+
var attrs = style.split(';');
|
5295 |
+
|
5296 |
+
for (var i = 0, l = attrs.length; i < l; i = i + 1) {
|
5297 |
+
var attr = attrs[i].replace(/\s/g, '');
|
5298 |
+
var matches = attr.match(WIDTH);
|
5299 |
+
|
5300 |
+
if (matches !== null && matches.length >= 1) {
|
5301 |
+
return matches[1];
|
5302 |
+
}
|
5303 |
+
}
|
5304 |
+
|
5305 |
+
return null;
|
5306 |
+
}
|
5307 |
+
|
5308 |
+
return method;
|
5309 |
+
};
|
5310 |
+
|
5311 |
+
Select2.prototype._bindAdapters = function () {
|
5312 |
+
this.dataAdapter.bind(this, this.$container);
|
5313 |
+
this.selection.bind(this, this.$container);
|
5314 |
+
|
5315 |
+
this.dropdown.bind(this, this.$container);
|
5316 |
+
this.results.bind(this, this.$container);
|
5317 |
+
};
|
5318 |
+
|
5319 |
+
Select2.prototype._registerDomEvents = function () {
|
5320 |
+
var self = this;
|
5321 |
+
|
5322 |
+
this.$element.on('change.select2', function () {
|
5323 |
+
self.dataAdapter.current(function (data) {
|
5324 |
+
self.trigger('selection:update', {
|
5325 |
+
data: data
|
5326 |
+
});
|
5327 |
+
});
|
5328 |
+
});
|
5329 |
+
|
5330 |
+
this.$element.on('focus.select2', function (evt) {
|
5331 |
+
self.trigger('focus', evt);
|
5332 |
+
});
|
5333 |
+
|
5334 |
+
this._syncA = Utils.bind(this._syncAttributes, this);
|
5335 |
+
this._syncS = Utils.bind(this._syncSubtree, this);
|
5336 |
+
|
5337 |
+
if (this.$element[0].attachEvent) {
|
5338 |
+
this.$element[0].attachEvent('onpropertychange', this._syncA);
|
5339 |
+
}
|
5340 |
+
|
5341 |
+
var observer = window.MutationObserver ||
|
5342 |
+
window.WebKitMutationObserver ||
|
5343 |
+
window.MozMutationObserver
|
5344 |
+
;
|
5345 |
+
|
5346 |
+
if (observer != null) {
|
5347 |
+
this._observer = new observer(function (mutations) {
|
5348 |
+
$.each(mutations, self._syncA);
|
5349 |
+
$.each(mutations, self._syncS);
|
5350 |
+
});
|
5351 |
+
this._observer.observe(this.$element[0], {
|
5352 |
+
attributes: true,
|
5353 |
+
childList: true,
|
5354 |
+
subtree: false
|
5355 |
+
});
|
5356 |
+
} else if (this.$element[0].addEventListener) {
|
5357 |
+
this.$element[0].addEventListener(
|
5358 |
+
'DOMAttrModified',
|
5359 |
+
self._syncA,
|
5360 |
+
false
|
5361 |
+
);
|
5362 |
+
this.$element[0].addEventListener(
|
5363 |
+
'DOMNodeInserted',
|
5364 |
+
self._syncS,
|
5365 |
+
false
|
5366 |
+
);
|
5367 |
+
this.$element[0].addEventListener(
|
5368 |
+
'DOMNodeRemoved',
|
5369 |
+
self._syncS,
|
5370 |
+
false
|
5371 |
+
);
|
5372 |
+
}
|
5373 |
+
};
|
5374 |
+
|
5375 |
+
Select2.prototype._registerDataEvents = function () {
|
5376 |
+
var self = this;
|
5377 |
+
|
5378 |
+
this.dataAdapter.on('*', function (name, params) {
|
5379 |
+
self.trigger(name, params);
|
5380 |
+
});
|
5381 |
+
};
|
5382 |
+
|
5383 |
+
Select2.prototype._registerSelectionEvents = function () {
|
5384 |
+
var self = this;
|
5385 |
+
var nonRelayEvents = ['toggle', 'focus'];
|
5386 |
+
|
5387 |
+
this.selection.on('toggle', function () {
|
5388 |
+
self.toggleDropdown();
|
5389 |
+
});
|
5390 |
+
|
5391 |
+
this.selection.on('focus', function (params) {
|
5392 |
+
self.focus(params);
|
5393 |
+
});
|
5394 |
+
|
5395 |
+
this.selection.on('*', function (name, params) {
|
5396 |
+
if ($.inArray(name, nonRelayEvents) !== -1) {
|
5397 |
+
return;
|
5398 |
+
}
|
5399 |
+
|
5400 |
+
self.trigger(name, params);
|
5401 |
+
});
|
5402 |
+
};
|
5403 |
+
|
5404 |
+
Select2.prototype._registerDropdownEvents = function () {
|
5405 |
+
var self = this;
|
5406 |
+
|
5407 |
+
this.dropdown.on('*', function (name, params) {
|
5408 |
+
self.trigger(name, params);
|
5409 |
+
});
|
5410 |
+
};
|
5411 |
+
|
5412 |
+
Select2.prototype._registerResultsEvents = function () {
|
5413 |
+
var self = this;
|
5414 |
+
|
5415 |
+
this.results.on('*', function (name, params) {
|
5416 |
+
self.trigger(name, params);
|
5417 |
+
});
|
5418 |
+
};
|
5419 |
+
|
5420 |
+
Select2.prototype._registerEvents = function () {
|
5421 |
+
var self = this;
|
5422 |
+
|
5423 |
+
this.on('open', function () {
|
5424 |
+
self.$container.addClass('select2-container--open');
|
5425 |
+
});
|
5426 |
+
|
5427 |
+
this.on('close', function () {
|
5428 |
+
self.$container.removeClass('select2-container--open');
|
5429 |
+
});
|
5430 |
+
|
5431 |
+
this.on('enable', function () {
|
5432 |
+
self.$container.removeClass('select2-container--disabled');
|
5433 |
+
});
|
5434 |
+
|
5435 |
+
this.on('disable', function () {
|
5436 |
+
self.$container.addClass('select2-container--disabled');
|
5437 |
+
});
|
5438 |
+
|
5439 |
+
this.on('blur', function () {
|
5440 |
+
self.$container.removeClass('select2-container--focus');
|
5441 |
+
});
|
5442 |
+
|
5443 |
+
this.on('query', function (params) {
|
5444 |
+
if (!self.isOpen()) {
|
5445 |
+
self.trigger('open', {});
|
5446 |
+
}
|
5447 |
+
|
5448 |
+
this.dataAdapter.query(params, function (data) {
|
5449 |
+
self.trigger('results:all', {
|
5450 |
+
data: data,
|
5451 |
+
query: params
|
5452 |
+
});
|
5453 |
+
});
|
5454 |
+
});
|
5455 |
+
|
5456 |
+
this.on('query:append', function (params) {
|
5457 |
+
this.dataAdapter.query(params, function (data) {
|
5458 |
+
self.trigger('results:append', {
|
5459 |
+
data: data,
|
5460 |
+
query: params
|
5461 |
+
});
|
5462 |
+
});
|
5463 |
+
});
|
5464 |
+
|
5465 |
+
this.on('keypress', function (evt) {
|
5466 |
+
var key = evt.which;
|
5467 |
+
|
5468 |
+
if (self.isOpen()) {
|
5469 |
+
if (key === KEYS.ESC || key === KEYS.TAB ||
|
5470 |
+
(key === KEYS.UP && evt.altKey)) {
|
5471 |
+
self.close();
|
5472 |
+
|
5473 |
+
evt.preventDefault();
|
5474 |
+
} else if (key === KEYS.ENTER) {
|
5475 |
+
self.trigger('results:select', {});
|
5476 |
+
|
5477 |
+
evt.preventDefault();
|
5478 |
+
} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
|
5479 |
+
self.trigger('results:toggle', {});
|
5480 |
+
|
5481 |
+
evt.preventDefault();
|
5482 |
+
} else if (key === KEYS.UP) {
|
5483 |
+
self.trigger('results:previous', {});
|
5484 |
+
|
5485 |
+
evt.preventDefault();
|
5486 |
+
} else if (key === KEYS.DOWN) {
|
5487 |
+
self.trigger('results:next', {});
|
5488 |
+
|
5489 |
+
evt.preventDefault();
|
5490 |
}
|
5491 |
+
} else {
|
5492 |
+
if (key === KEYS.ENTER || key === KEYS.SPACE ||
|
5493 |
+
(key === KEYS.DOWN && evt.altKey)) {
|
5494 |
+
self.open();
|
5495 |
+
|
5496 |
+
evt.preventDefault();
|
5497 |
+
}
|
5498 |
+
}
|
5499 |
});
|
5500 |
+
};
|
5501 |
+
|
5502 |
+
Select2.prototype._syncAttributes = function () {
|
5503 |
+
this.options.set('disabled', this.$element.prop('disabled'));
|
5504 |
+
|
5505 |
+
if (this.options.get('disabled')) {
|
5506 |
+
if (this.isOpen()) {
|
5507 |
+
this.close();
|
5508 |
+
}
|
5509 |
+
|
5510 |
+
this.trigger('disable', {});
|
5511 |
+
} else {
|
5512 |
+
this.trigger('enable', {});
|
5513 |
+
}
|
5514 |
+
};
|
5515 |
+
|
5516 |
+
Select2.prototype._syncSubtree = function (evt, mutations) {
|
5517 |
+
var changed = false;
|
5518 |
+
var self = this;
|
5519 |
+
|
5520 |
+
// Ignore any mutation events raised for elements that aren't options or
|
5521 |
+
// optgroups. This handles the case when the select element is destroyed
|
5522 |
+
if (
|
5523 |
+
evt && evt.target && (
|
5524 |
+
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
|
5525 |
+
)
|
5526 |
+
) {
|
5527 |
+
return;
|
5528 |
+
}
|
5529 |
+
|
5530 |
+
if (!mutations) {
|
5531 |
+
// If mutation events aren't supported, then we can only assume that the
|
5532 |
+
// change affected the selections
|
5533 |
+
changed = true;
|
5534 |
+
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
|
5535 |
+
for (var n = 0; n < mutations.addedNodes.length; n++) {
|
5536 |
+
var node = mutations.addedNodes[n];
|
5537 |
+
|
5538 |
+
if (node.selected) {
|
5539 |
+
changed = true;
|
5540 |
+
}
|
5541 |
+
}
|
5542 |
+
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
|
5543 |
+
changed = true;
|
5544 |
+
}
|
5545 |
+
|
5546 |
+
// Only re-pull the data if we think there is a change
|
5547 |
+
if (changed) {
|
5548 |
+
this.dataAdapter.current(function (currentData) {
|
5549 |
+
self.trigger('selection:update', {
|
5550 |
+
data: currentData
|
5551 |
+
});
|
5552 |
+
});
|
5553 |
+
}
|
5554 |
+
};
|
5555 |
|
5556 |
+
/**
|
5557 |
+
* Override the trigger method to automatically trigger pre-events when
|
5558 |
+
* there are events that can be prevented.
|
5559 |
+
*/
|
5560 |
+
Select2.prototype.trigger = function (name, args) {
|
5561 |
+
var actualTrigger = Select2.__super__.trigger;
|
5562 |
+
var preTriggerMap = {
|
5563 |
+
'open': 'opening',
|
5564 |
+
'close': 'closing',
|
5565 |
+
'select': 'selecting',
|
5566 |
+
'unselect': 'unselecting',
|
5567 |
+
'clear': 'clearing'
|
5568 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
5569 |
|
5570 |
+
if (args === undefined) {
|
5571 |
+
args = {};
|
5572 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5573 |
|
5574 |
+
if (name in preTriggerMap) {
|
5575 |
+
var preTriggerName = preTriggerMap[name];
|
5576 |
+
var preTriggerArgs = {
|
5577 |
+
prevented: false,
|
5578 |
+
name: name,
|
5579 |
+
args: args
|
5580 |
+
};
|
5581 |
|
5582 |
+
actualTrigger.call(this, preTriggerName, preTriggerArgs);
|
|
|
5583 |
|
5584 |
+
if (preTriggerArgs.prevented) {
|
5585 |
+
args.prevented = true;
|
5586 |
|
5587 |
+
return;
|
5588 |
+
}
|
5589 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5590 |
|
5591 |
+
actualTrigger.call(this, name, args);
|
5592 |
+
};
|
|
|
|
|
|
|
5593 |
|
5594 |
+
Select2.prototype.toggleDropdown = function () {
|
5595 |
+
if (this.options.get('disabled')) {
|
5596 |
+
return;
|
5597 |
+
}
|
|
|
5598 |
|
5599 |
+
if (this.isOpen()) {
|
5600 |
+
this.close();
|
5601 |
+
} else {
|
5602 |
+
this.open();
|
5603 |
+
}
|
5604 |
+
};
|
5605 |
|
5606 |
+
Select2.prototype.open = function () {
|
5607 |
+
if (this.isOpen()) {
|
5608 |
+
return;
|
5609 |
+
}
|
5610 |
|
5611 |
+
this.trigger('query', {});
|
5612 |
+
};
|
5613 |
|
5614 |
+
Select2.prototype.close = function () {
|
5615 |
+
if (!this.isOpen()) {
|
5616 |
+
return;
|
5617 |
+
}
|
|
|
5618 |
|
5619 |
+
this.trigger('close', {});
|
5620 |
+
};
|
5621 |
|
5622 |
+
Select2.prototype.isOpen = function () {
|
5623 |
+
return this.$container.hasClass('select2-container--open');
|
5624 |
+
};
|
|
|
5625 |
|
5626 |
+
Select2.prototype.hasFocus = function () {
|
5627 |
+
return this.$container.hasClass('select2-container--focus');
|
5628 |
+
};
|
|
|
|
|
|
|
|
|
5629 |
|
5630 |
+
Select2.prototype.focus = function (data) {
|
5631 |
+
// No need to re-trigger focus events if we are already focused
|
5632 |
+
if (this.hasFocus()) {
|
5633 |
+
return;
|
5634 |
+
}
|
5635 |
|
5636 |
+
this.$container.addClass('select2-container--focus');
|
5637 |
+
this.trigger('focus', {});
|
5638 |
+
};
|
5639 |
+
|
5640 |
+
Select2.prototype.enable = function (args) {
|
5641 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5642 |
+
console.warn(
|
5643 |
+
'Select2: The `select2("enable")` method has been deprecated and will' +
|
5644 |
+
' be removed in later Select2 versions. Use $element.prop("disabled")' +
|
5645 |
+
' instead.'
|
5646 |
+
);
|
5647 |
+
}
|
5648 |
|
5649 |
+
if (args == null || args.length === 0) {
|
5650 |
+
args = [true];
|
5651 |
+
}
|
|
|
|
|
5652 |
|
5653 |
+
var disabled = !args[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5654 |
|
5655 |
+
this.$element.prop('disabled', disabled);
|
5656 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
5657 |
|
5658 |
+
Select2.prototype.data = function () {
|
5659 |
+
if (this.options.get('debug') &&
|
5660 |
+
arguments.length > 0 && window.console && console.warn) {
|
5661 |
+
console.warn(
|
5662 |
+
'Select2: Data can no longer be set using `select2("data")`. You ' +
|
5663 |
+
'should consider setting the value instead using `$element.val()`.'
|
5664 |
+
);
|
5665 |
+
}
|
5666 |
|
5667 |
+
var data = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5668 |
|
5669 |
+
this.dataAdapter.current(function (currentData) {
|
5670 |
+
data = currentData;
|
5671 |
+
});
|
|
|
5672 |
|
5673 |
+
return data;
|
5674 |
+
};
|
|
|
|
|
|
|
|
|
|
|
5675 |
|
5676 |
+
Select2.prototype.val = function (args) {
|
5677 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5678 |
+
console.warn(
|
5679 |
+
'Select2: The `select2("val")` method has been deprecated and will be' +
|
5680 |
+
' removed in later Select2 versions. Use $element.val() instead.'
|
5681 |
+
);
|
5682 |
+
}
|
5683 |
|
5684 |
+
if (args == null || args.length === 0) {
|
5685 |
+
return this.$element.val();
|
5686 |
+
}
|
|
|
5687 |
|
5688 |
+
var newVal = args[0];
|
|
|
|
|
|
|
5689 |
|
5690 |
+
if ($.isArray(newVal)) {
|
5691 |
+
newVal = $.map(newVal, function (obj) {
|
5692 |
+
return obj.toString();
|
5693 |
+
});
|
5694 |
+
}
|
5695 |
|
5696 |
+
this.$element.val(newVal).trigger('change');
|
5697 |
+
};
|
|
|
|
|
|
|
5698 |
|
5699 |
+
Select2.prototype.destroy = function () {
|
5700 |
+
this.$container.remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5701 |
|
5702 |
+
if (this.$element[0].detachEvent) {
|
5703 |
+
this.$element[0].detachEvent('onpropertychange', this._syncA);
|
5704 |
+
}
|
5705 |
|
5706 |
+
if (this._observer != null) {
|
5707 |
+
this._observer.disconnect();
|
5708 |
+
this._observer = null;
|
5709 |
+
} else if (this.$element[0].removeEventListener) {
|
5710 |
+
this.$element[0]
|
5711 |
+
.removeEventListener('DOMAttrModified', this._syncA, false);
|
5712 |
+
this.$element[0]
|
5713 |
+
.removeEventListener('DOMNodeInserted', this._syncS, false);
|
5714 |
+
this.$element[0]
|
5715 |
+
.removeEventListener('DOMNodeRemoved', this._syncS, false);
|
5716 |
+
}
|
5717 |
|
5718 |
+
this._syncA = null;
|
5719 |
+
this._syncS = null;
|
|
|
|
|
|
|
|
|
5720 |
|
5721 |
+
this.$element.off('.select2');
|
5722 |
+
this.$element.attr('tabindex',
|
5723 |
+
Utils.GetData(this.$element[0], 'old-tabindex'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5724 |
|
5725 |
+
this.$element.removeClass('select2-hidden-accessible');
|
5726 |
+
this.$element.attr('aria-hidden', 'false');
|
5727 |
+
Utils.RemoveData(this.$element[0]);
|
5728 |
+
this.$element.removeData('select2');
|
5729 |
|
5730 |
+
this.dataAdapter.destroy();
|
5731 |
+
this.selection.destroy();
|
5732 |
+
this.dropdown.destroy();
|
5733 |
+
this.results.destroy();
|
|
|
|
|
|
|
|
|
|
|
5734 |
|
5735 |
+
this.dataAdapter = null;
|
5736 |
+
this.selection = null;
|
5737 |
+
this.dropdown = null;
|
5738 |
+
this.results = null;
|
5739 |
+
};
|
|
|
5740 |
|
5741 |
+
Select2.prototype.render = function () {
|
5742 |
+
var $container = $(
|
5743 |
+
'<span class="select2 select2-container">' +
|
5744 |
+
'<span class="selection"></span>' +
|
5745 |
+
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
|
5746 |
+
'</span>'
|
5747 |
+
);
|
5748 |
|
5749 |
+
$container.attr('dir', this.options.get('dir'));
|
5750 |
|
5751 |
+
this.$container = $container;
|
5752 |
|
5753 |
+
this.$container.addClass('select2-container--' + this.options.get('theme'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5754 |
|
5755 |
+
Utils.StoreData($container[0], 'element', this.$element);
|
|
|
|
|
|
|
|
|
|
|
5756 |
|
5757 |
+
return $container;
|
5758 |
+
};
|
|
|
|
|
|
|
5759 |
|
5760 |
+
return Select2;
|
5761 |
+
});
|
|
|
|
|
|
|
5762 |
|
5763 |
+
S2.define('select2/compat/utils',[
|
5764 |
+
'jquery'
|
5765 |
+
], function ($) {
|
5766 |
+
function syncCssClasses ($dest, $src, adapter) {
|
5767 |
+
var classes, replacements = [], adapted;
|
5768 |
|
5769 |
+
classes = $.trim($dest.attr('class'));
|
|
|
|
|
5770 |
|
5771 |
+
if (classes) {
|
5772 |
+
classes = '' + classes; // for IE which returns object
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5773 |
|
5774 |
+
$(classes.split(/\s+/)).each(function () {
|
5775 |
+
// Save all Select2 classes
|
5776 |
+
if (this.indexOf('select2-') === 0) {
|
5777 |
+
replacements.push(this);
|
5778 |
+
}
|
5779 |
+
});
|
5780 |
+
}
|
|
|
|
|
|
|
5781 |
|
5782 |
+
classes = $.trim($src.attr('class'));
|
5783 |
|
5784 |
+
if (classes) {
|
5785 |
+
classes = '' + classes; // for IE which returns object
|
5786 |
|
5787 |
+
$(classes.split(/\s+/)).each(function () {
|
5788 |
+
// Only adapt non-Select2 classes
|
5789 |
+
if (this.indexOf('select2-') !== 0) {
|
5790 |
+
adapted = adapter(this);
|
5791 |
|
5792 |
+
if (adapted != null) {
|
5793 |
+
replacements.push(adapted);
|
5794 |
+
}
|
5795 |
+
}
|
5796 |
+
});
|
5797 |
+
}
|
5798 |
|
5799 |
+
$dest.attr('class', replacements.join(' '));
|
5800 |
+
}
|
5801 |
|
5802 |
+
return {
|
5803 |
+
syncCssClasses: syncCssClasses
|
5804 |
+
};
|
5805 |
+
});
|
5806 |
|
5807 |
+
S2.define('select2/compat/containerCss',[
|
5808 |
+
'jquery',
|
5809 |
+
'./utils'
|
5810 |
+
], function ($, CompatUtils) {
|
5811 |
+
// No-op CSS adapter that discards all classes by default
|
5812 |
+
function _containerAdapter (clazz) {
|
5813 |
+
return null;
|
5814 |
+
}
|
5815 |
|
5816 |
+
function ContainerCSS () { }
|
5817 |
|
5818 |
+
ContainerCSS.prototype.render = function (decorated) {
|
5819 |
+
var $container = decorated.call(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5820 |
|
5821 |
+
var containerCssClass = this.options.get('containerCssClass') || '';
|
|
|
|
|
5822 |
|
5823 |
+
if ($.isFunction(containerCssClass)) {
|
5824 |
+
containerCssClass = containerCssClass(this.$element);
|
5825 |
+
}
|
5826 |
|
5827 |
+
var containerCssAdapter = this.options.get('adaptContainerCssClass');
|
5828 |
+
containerCssAdapter = containerCssAdapter || _containerAdapter;
|
|
|
|
|
|
|
5829 |
|
5830 |
+
if (containerCssClass.indexOf(':all:') !== -1) {
|
5831 |
+
containerCssClass = containerCssClass.replace(':all:', '');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5832 |
|
5833 |
+
var _cssAdapter = containerCssAdapter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5834 |
|
5835 |
+
containerCssAdapter = function (clazz) {
|
5836 |
+
var adapted = _cssAdapter(clazz);
|
5837 |
|
5838 |
+
if (adapted != null) {
|
5839 |
+
// Append the old one along with the adapted one
|
5840 |
+
return adapted + ' ' + clazz;
|
5841 |
+
}
|
5842 |
|
5843 |
+
return clazz;
|
5844 |
+
};
|
5845 |
+
}
|
|
|
|
|
|
|
5846 |
|
5847 |
+
var containerCss = this.options.get('containerCss') || {};
|
|
|
|
|
5848 |
|
5849 |
+
if ($.isFunction(containerCss)) {
|
5850 |
+
containerCss = containerCss(this.$element);
|
5851 |
+
}
|
5852 |
|
5853 |
+
CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
|
|
|
|
|
|
|
|
|
5854 |
|
5855 |
+
$container.css(containerCss);
|
5856 |
+
$container.addClass(containerCssClass);
|
|
|
|
|
5857 |
|
5858 |
+
return $container;
|
5859 |
+
};
|
|
|
5860 |
|
5861 |
+
return ContainerCSS;
|
5862 |
+
});
|
|
|
|
|
|
|
5863 |
|
5864 |
+
S2.define('select2/compat/dropdownCss',[
|
5865 |
+
'jquery',
|
5866 |
+
'./utils'
|
5867 |
+
], function ($, CompatUtils) {
|
5868 |
+
// No-op CSS adapter that discards all classes by default
|
5869 |
+
function _dropdownAdapter (clazz) {
|
5870 |
+
return null;
|
5871 |
+
}
|
5872 |
|
5873 |
+
function DropdownCSS () { }
|
|
|
5874 |
|
5875 |
+
DropdownCSS.prototype.render = function (decorated) {
|
5876 |
+
var $dropdown = decorated.call(this);
|
5877 |
|
5878 |
+
var dropdownCssClass = this.options.get('dropdownCssClass') || '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5879 |
|
5880 |
+
if ($.isFunction(dropdownCssClass)) {
|
5881 |
+
dropdownCssClass = dropdownCssClass(this.$element);
|
5882 |
+
}
|
|
|
|
|
|
|
|
|
5883 |
|
5884 |
+
var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
|
5885 |
+
dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
|
|
|
5886 |
|
5887 |
+
if (dropdownCssClass.indexOf(':all:') !== -1) {
|
5888 |
+
dropdownCssClass = dropdownCssClass.replace(':all:', '');
|
|
|
|
|
|
|
|
|
|
|
|
|
5889 |
|
5890 |
+
var _cssAdapter = dropdownCssAdapter;
|
5891 |
|
5892 |
+
dropdownCssAdapter = function (clazz) {
|
5893 |
+
var adapted = _cssAdapter(clazz);
|
|
|
|
|
5894 |
|
5895 |
+
if (adapted != null) {
|
5896 |
+
// Append the old one along with the adapted one
|
5897 |
+
return adapted + ' ' + clazz;
|
5898 |
+
}
|
5899 |
|
5900 |
+
return clazz;
|
5901 |
+
};
|
5902 |
+
}
|
5903 |
|
5904 |
+
var dropdownCss = this.options.get('dropdownCss') || {};
|
5905 |
|
5906 |
+
if ($.isFunction(dropdownCss)) {
|
5907 |
+
dropdownCss = dropdownCss(this.$element);
|
5908 |
+
}
|
5909 |
|
5910 |
+
CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
|
5911 |
+
|
5912 |
+
$dropdown.css(dropdownCss);
|
5913 |
+
$dropdown.addClass(dropdownCssClass);
|
5914 |
+
|
5915 |
+
return $dropdown;
|
5916 |
+
};
|
5917 |
+
|
5918 |
+
return DropdownCSS;
|
5919 |
+
});
|
5920 |
+
|
5921 |
+
S2.define('select2/compat/initSelection',[
|
5922 |
+
'jquery'
|
5923 |
+
], function ($) {
|
5924 |
+
function InitSelection (decorated, $element, options) {
|
5925 |
+
if (options.get('debug') && window.console && console.warn) {
|
5926 |
+
console.warn(
|
5927 |
+
'Select2: The `initSelection` option has been deprecated in favor' +
|
5928 |
+
' of a custom data adapter that overrides the `current` method. ' +
|
5929 |
+
'This method is now called multiple times instead of a single ' +
|
5930 |
+
'time when the instance is initialized. Support will be removed ' +
|
5931 |
+
'for the `initSelection` option in future versions of Select2'
|
5932 |
+
);
|
5933 |
+
}
|
5934 |
|
5935 |
+
this.initSelection = options.get('initSelection');
|
5936 |
+
this._isInitialized = false;
|
|
|
5937 |
|
5938 |
+
decorated.call(this, $element, options);
|
5939 |
+
}
|
|
|
5940 |
|
5941 |
+
InitSelection.prototype.current = function (decorated, callback) {
|
5942 |
+
var self = this;
|
|
|
5943 |
|
5944 |
+
if (this._isInitialized) {
|
5945 |
+
decorated.call(this, callback);
|
5946 |
|
5947 |
+
return;
|
5948 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5949 |
|
5950 |
+
this.initSelection.call(null, this.$element, function (data) {
|
5951 |
+
self._isInitialized = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5952 |
|
5953 |
+
if (!$.isArray(data)) {
|
5954 |
+
data = [data];
|
5955 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5956 |
|
5957 |
+
callback(data);
|
5958 |
+
});
|
5959 |
+
};
|
5960 |
+
|
5961 |
+
return InitSelection;
|
5962 |
+
});
|
5963 |
+
|
5964 |
+
S2.define('select2/compat/inputData',[
|
5965 |
+
'jquery',
|
5966 |
+
'../utils'
|
5967 |
+
], function ($, Utils) {
|
5968 |
+
function InputData (decorated, $element, options) {
|
5969 |
+
this._currentData = [];
|
5970 |
+
this._valueSeparator = options.get('valueSeparator') || ',';
|
5971 |
+
|
5972 |
+
if ($element.prop('type') === 'hidden') {
|
5973 |
+
if (options.get('debug') && console && console.warn) {
|
5974 |
+
console.warn(
|
5975 |
+
'Select2: Using a hidden input with Select2 is no longer ' +
|
5976 |
+
'supported and may stop working in the future. It is recommended ' +
|
5977 |
+
'to use a `<select>` element instead.'
|
5978 |
+
);
|
5979 |
+
}
|
5980 |
+
}
|
5981 |
|
5982 |
+
decorated.call(this, $element, options);
|
5983 |
+
}
|
5984 |
|
5985 |
+
InputData.prototype.current = function (_, callback) {
|
5986 |
+
function getSelected (data, selectedIds) {
|
5987 |
+
var selected = [];
|
5988 |
|
5989 |
+
if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
|
5990 |
+
data.selected = true;
|
5991 |
+
selected.push(data);
|
5992 |
+
} else {
|
5993 |
+
data.selected = false;
|
5994 |
+
}
|
5995 |
|
5996 |
+
if (data.children) {
|
5997 |
+
selected.push.apply(selected, getSelected(data.children, selectedIds));
|
5998 |
+
}
|
5999 |
|
6000 |
+
return selected;
|
6001 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6002 |
|
6003 |
+
var selected = [];
|
|
|
6004 |
|
6005 |
+
for (var d = 0; d < this._currentData.length; d++) {
|
6006 |
+
var data = this._currentData[d];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6007 |
|
6008 |
+
selected.push.apply(
|
6009 |
+
selected,
|
6010 |
+
getSelected(
|
6011 |
+
data,
|
6012 |
+
this.$element.val().split(
|
6013 |
+
this._valueSeparator
|
6014 |
+
)
|
6015 |
+
)
|
6016 |
+
);
|
6017 |
+
}
|
|
|
|
|
6018 |
|
6019 |
+
callback(selected);
|
6020 |
+
};
|
|
|
|
|
|
|
6021 |
|
6022 |
+
InputData.prototype.select = function (_, data) {
|
6023 |
+
if (!this.options.get('multiple')) {
|
6024 |
+
this.current(function (allData) {
|
6025 |
+
$.map(allData, function (data) {
|
6026 |
+
data.selected = false;
|
6027 |
+
});
|
6028 |
+
});
|
6029 |
|
6030 |
+
this.$element.val(data.id);
|
6031 |
+
this.$element.trigger('change');
|
6032 |
+
} else {
|
6033 |
+
var value = this.$element.val();
|
6034 |
+
value += this._valueSeparator + data.id;
|
6035 |
|
6036 |
+
this.$element.val(value);
|
6037 |
+
this.$element.trigger('change');
|
6038 |
+
}
|
6039 |
+
};
|
6040 |
|
6041 |
+
InputData.prototype.unselect = function (_, data) {
|
6042 |
+
var self = this;
|
|
|
|
|
|
|
|
|
6043 |
|
6044 |
+
data.selected = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
6045 |
|
6046 |
+
this.current(function (allData) {
|
6047 |
+
var values = [];
|
6048 |
+
|
6049 |
+
for (var d = 0; d < allData.length; d++) {
|
6050 |
+
var item = allData[d];
|
6051 |
+
|
6052 |
+
if (data.id == item.id) {
|
6053 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6054 |
}
|
6055 |
+
|
6056 |
+
values.push(item.id);
|
6057 |
+
}
|
6058 |
+
|
6059 |
+
self.$element.val(values.join(self._valueSeparator));
|
6060 |
+
self.$element.trigger('change');
|
6061 |
});
|
6062 |
+
};
|
6063 |
|
6064 |
+
InputData.prototype.query = function (_, params, callback) {
|
6065 |
+
var results = [];
|
6066 |
|
6067 |
+
for (var d = 0; d < this._currentData.length; d++) {
|
6068 |
+
var data = this._currentData[d];
|
|
|
|
|
|
|
|
|
|
|
|
|
6069 |
|
6070 |
+
var matches = this.matches(params, data);
|
|
|
|
|
|
|
6071 |
|
6072 |
+
if (matches !== null) {
|
6073 |
+
results.push(matches);
|
6074 |
+
}
|
6075 |
+
}
|
|
|
|
|
6076 |
|
6077 |
+
callback({
|
6078 |
+
results: results
|
6079 |
+
});
|
6080 |
+
};
|
6081 |
|
6082 |
+
InputData.prototype.addOptions = function (_, $options) {
|
6083 |
+
var options = $.map($options, function ($option) {
|
6084 |
+
return Utils.GetData($option[0], 'data');
|
6085 |
+
});
|
6086 |
|
6087 |
+
this._currentData.push.apply(this._currentData, options);
|
6088 |
+
};
|
|
|
6089 |
|
6090 |
+
return InputData;
|
6091 |
+
});
|
6092 |
|
6093 |
+
S2.define('select2/compat/matcher',[
|
6094 |
+
'jquery'
|
6095 |
+
], function ($) {
|
6096 |
+
function oldMatcher (matcher) {
|
6097 |
+
function wrappedMatcher (params, data) {
|
6098 |
+
var match = $.extend(true, {}, data);
|
6099 |
|
6100 |
+
if (params.term == null || $.trim(params.term) === '') {
|
6101 |
+
return match;
|
6102 |
+
}
|
6103 |
+
|
6104 |
+
if (data.children) {
|
6105 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
6106 |
+
var child = data.children[c];
|
6107 |
+
|
6108 |
+
// Check if the child object matches
|
6109 |
+
// The old matcher returned a boolean true or false
|
6110 |
+
var doesMatch = matcher(params.term, child.text, child);
|
6111 |
+
|
6112 |
+
// If the child didn't match, pop it off
|
6113 |
+
if (!doesMatch) {
|
6114 |
+
match.children.splice(c, 1);
|
6115 |
+
}
|
6116 |
+
}
|
6117 |
+
|
6118 |
+
if (match.children.length > 0) {
|
6119 |
+
return match;
|
6120 |
+
}
|
6121 |
+
}
|
6122 |
+
|
6123 |
+
if (matcher(params.term, data.text, data)) {
|
6124 |
+
return match;
|
6125 |
+
}
|
6126 |
+
|
6127 |
+
return null;
|
6128 |
+
}
|
6129 |
+
|
6130 |
+
return wrappedMatcher;
|
6131 |
+
}
|
6132 |
+
|
6133 |
+
return oldMatcher;
|
6134 |
+
});
|
6135 |
+
|
6136 |
+
S2.define('select2/compat/query',[
|
6137 |
+
|
6138 |
+
], function () {
|
6139 |
+
function Query (decorated, $element, options) {
|
6140 |
+
if (options.get('debug') && window.console && console.warn) {
|
6141 |
+
console.warn(
|
6142 |
+
'Select2: The `query` option has been deprecated in favor of a ' +
|
6143 |
+
'custom data adapter that overrides the `query` method. Support ' +
|
6144 |
+
'will be removed for the `query` option in future versions of ' +
|
6145 |
+
'Select2.'
|
6146 |
+
);
|
6147 |
+
}
|
6148 |
+
|
6149 |
+
decorated.call(this, $element, options);
|
6150 |
+
}
|
6151 |
+
|
6152 |
+
Query.prototype.query = function (_, params, callback) {
|
6153 |
+
params.callback = callback;
|
6154 |
+
|
6155 |
+
var query = this.options.get('query');
|
6156 |
+
|
6157 |
+
query.call(null, params);
|
6158 |
+
};
|
6159 |
+
|
6160 |
+
return Query;
|
6161 |
+
});
|
6162 |
+
|
6163 |
+
S2.define('select2/dropdown/attachContainer',[
|
6164 |
+
|
6165 |
+
], function () {
|
6166 |
+
function AttachContainer (decorated, $element, options) {
|
6167 |
+
decorated.call(this, $element, options);
|
6168 |
+
}
|
6169 |
+
|
6170 |
+
AttachContainer.prototype.position =
|
6171 |
+
function (decorated, $dropdown, $container) {
|
6172 |
+
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
6173 |
+
$dropdownContainer.append($dropdown);
|
6174 |
+
|
6175 |
+
$dropdown.addClass('select2-dropdown--below');
|
6176 |
+
$container.addClass('select2-container--below');
|
6177 |
+
};
|
6178 |
+
|
6179 |
+
return AttachContainer;
|
6180 |
+
});
|
6181 |
+
|
6182 |
+
S2.define('select2/dropdown/stopPropagation',[
|
6183 |
+
|
6184 |
+
], function () {
|
6185 |
+
function StopPropagation () { }
|
6186 |
+
|
6187 |
+
StopPropagation.prototype.bind = function (decorated, container, $container) {
|
6188 |
+
decorated.call(this, container, $container);
|
6189 |
+
|
6190 |
+
var stoppedEvents = [
|
6191 |
+
'blur',
|
6192 |
+
'change',
|
6193 |
+
'click',
|
6194 |
+
'dblclick',
|
6195 |
+
'focus',
|
6196 |
+
'focusin',
|
6197 |
+
'focusout',
|
6198 |
+
'input',
|
6199 |
+
'keydown',
|
6200 |
+
'keyup',
|
6201 |
+
'keypress',
|
6202 |
+
'mousedown',
|
6203 |
+
'mouseenter',
|
6204 |
+
'mouseleave',
|
6205 |
+
'mousemove',
|
6206 |
+
'mouseover',
|
6207 |
+
'mouseup',
|
6208 |
+
'search',
|
6209 |
+
'touchend',
|
6210 |
+
'touchstart'
|
6211 |
+
];
|
6212 |
+
|
6213 |
+
this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
|
6214 |
+
evt.stopPropagation();
|
6215 |
+
});
|
6216 |
+
};
|
6217 |
+
|
6218 |
+
return StopPropagation;
|
6219 |
+
});
|
6220 |
+
|
6221 |
+
S2.define('select2/selection/stopPropagation',[
|
6222 |
+
|
6223 |
+
], function () {
|
6224 |
+
function StopPropagation () { }
|
6225 |
+
|
6226 |
+
StopPropagation.prototype.bind = function (decorated, container, $container) {
|
6227 |
+
decorated.call(this, container, $container);
|
6228 |
+
|
6229 |
+
var stoppedEvents = [
|
6230 |
+
'blur',
|
6231 |
+
'change',
|
6232 |
+
'click',
|
6233 |
+
'dblclick',
|
6234 |
+
'focus',
|
6235 |
+
'focusin',
|
6236 |
+
'focusout',
|
6237 |
+
'input',
|
6238 |
+
'keydown',
|
6239 |
+
'keyup',
|
6240 |
+
'keypress',
|
6241 |
+
'mousedown',
|
6242 |
+
'mouseenter',
|
6243 |
+
'mouseleave',
|
6244 |
+
'mousemove',
|
6245 |
+
'mouseover',
|
6246 |
+
'mouseup',
|
6247 |
+
'search',
|
6248 |
+
'touchend',
|
6249 |
+
'touchstart'
|
6250 |
+
];
|
6251 |
+
|
6252 |
+
this.$selection.on(stoppedEvents.join(' '), function (evt) {
|
6253 |
+
evt.stopPropagation();
|
6254 |
+
});
|
6255 |
+
};
|
6256 |
+
|
6257 |
+
return StopPropagation;
|
6258 |
+
});
|
6259 |
+
|
6260 |
+
/*!
|
6261 |
+
* jQuery Mousewheel 3.1.13
|
6262 |
+
*
|
6263 |
+
* Copyright jQuery Foundation and other contributors
|
6264 |
+
* Released under the MIT license
|
6265 |
+
* http://jquery.org/license
|
6266 |
+
*/
|
6267 |
+
|
6268 |
+
(function (factory) {
|
6269 |
+
if ( typeof S2.define === 'function' && S2.define.amd ) {
|
6270 |
+
// AMD. Register as an anonymous module.
|
6271 |
+
S2.define('jquery-mousewheel',['jquery'], factory);
|
6272 |
+
} else if (typeof exports === 'object') {
|
6273 |
+
// Node/CommonJS style for Browserify
|
6274 |
+
module.exports = factory;
|
6275 |
+
} else {
|
6276 |
+
// Browser globals
|
6277 |
+
factory(jQuery);
|
6278 |
+
}
|
6279 |
+
}(function ($) {
|
6280 |
+
|
6281 |
+
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
|
6282 |
+
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
6283 |
+
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
6284 |
+
slice = Array.prototype.slice,
|
6285 |
+
nullLowestDeltaTimeout, lowestDelta;
|
6286 |
+
|
6287 |
+
if ( $.event.fixHooks ) {
|
6288 |
+
for ( var i = toFix.length; i; ) {
|
6289 |
+
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
|
6290 |
+
}
|
6291 |
+
}
|
6292 |
+
|
6293 |
+
var special = $.event.special.mousewheel = {
|
6294 |
+
version: '3.1.12',
|
6295 |
+
|
6296 |
+
setup: function() {
|
6297 |
+
if ( this.addEventListener ) {
|
6298 |
+
for ( var i = toBind.length; i; ) {
|
6299 |
+
this.addEventListener( toBind[--i], handler, false );
|
6300 |
}
|
6301 |
} else {
|
6302 |
+
this.onmousewheel = handler;
|
6303 |
}
|
6304 |
+
// Store the line height and page height for this particular element
|
6305 |
+
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
|
6306 |
+
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6307 |
},
|
6308 |
+
|
6309 |
+
teardown: function() {
|
6310 |
+
if ( this.removeEventListener ) {
|
6311 |
+
for ( var i = toBind.length; i; ) {
|
6312 |
+
this.removeEventListener( toBind[--i], handler, false );
|
6313 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6314 |
} else {
|
6315 |
+
this.onmousewheel = null;
|
6316 |
}
|
6317 |
+
// Clean up the data we added to the element
|
6318 |
+
$.removeData(this, 'mousewheel-line-height');
|
6319 |
+
$.removeData(this, 'mousewheel-page-height');
|
|
|
|
|
|
|
6320 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6321 |
|
6322 |
+
getLineHeight: function(elem) {
|
6323 |
+
var $elem = $(elem),
|
6324 |
+
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
|
6325 |
+
if (!$parent.length) {
|
6326 |
+
$parent = $('body');
|
6327 |
}
|
6328 |
+
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
|
6329 |
+
},
|
6330 |
|
6331 |
+
getPageHeight: function(elem) {
|
6332 |
+
return $(elem).height();
|
6333 |
+
},
|
6334 |
+
|
6335 |
+
settings: {
|
6336 |
+
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
|
6337 |
+
normalizeOffset: true // calls getBoundingClientRect for each event
|
6338 |
}
|
6339 |
};
|
6340 |
|
6341 |
+
$.fn.extend({
|
6342 |
+
mousewheel: function(fn) {
|
6343 |
+
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
|
6344 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6345 |
|
6346 |
+
unmousewheel: function(fn) {
|
6347 |
+
return this.unbind('mousewheel', fn);
|
6348 |
+
}
|
6349 |
+
});
|
6350 |
|
6351 |
+
|
6352 |
+
function handler(event) {
|
6353 |
+
var orgEvent = event || window.event,
|
6354 |
+
args = slice.call(arguments, 1),
|
6355 |
+
delta = 0,
|
6356 |
+
deltaX = 0,
|
6357 |
+
deltaY = 0,
|
6358 |
+
absDelta = 0,
|
6359 |
+
offsetX = 0,
|
6360 |
+
offsetY = 0;
|
6361 |
+
event = $.event.fix(orgEvent);
|
6362 |
+
event.type = 'mousewheel';
|
6363 |
+
|
6364 |
+
// Old school scrollwheel delta
|
6365 |
+
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
|
6366 |
+
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
|
6367 |
+
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
|
6368 |
+
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
|
6369 |
+
|
6370 |
+
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
|
6371 |
+
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
6372 |
+
deltaX = deltaY * -1;
|
6373 |
+
deltaY = 0;
|
6374 |
}
|
|
|
6375 |
|
6376 |
+
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
|
6377 |
+
delta = deltaY === 0 ? deltaX : deltaY;
|
6378 |
+
|
6379 |
+
// New school wheel delta (wheel event)
|
6380 |
+
if ( 'deltaY' in orgEvent ) {
|
6381 |
+
deltaY = orgEvent.deltaY * -1;
|
6382 |
+
delta = deltaY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6383 |
}
|
6384 |
+
if ( 'deltaX' in orgEvent ) {
|
6385 |
+
deltaX = orgEvent.deltaX;
|
6386 |
+
if ( deltaY === 0 ) { delta = deltaX * -1; }
|
6387 |
+
}
|
6388 |
+
|
6389 |
+
// No change actually happened, no reason to go any further
|
6390 |
+
if ( deltaY === 0 && deltaX === 0 ) { return; }
|
6391 |
+
|
6392 |
+
// Need to convert lines and pages to pixels if we aren't already in pixels
|
6393 |
+
// There are three delta modes:
|
6394 |
+
// * deltaMode 0 is by pixels, nothing to do
|
6395 |
+
// * deltaMode 1 is by lines
|
6396 |
+
// * deltaMode 2 is by pages
|
6397 |
+
if ( orgEvent.deltaMode === 1 ) {
|
6398 |
+
var lineHeight = $.data(this, 'mousewheel-line-height');
|
6399 |
+
delta *= lineHeight;
|
6400 |
+
deltaY *= lineHeight;
|
6401 |
+
deltaX *= lineHeight;
|
6402 |
+
} else if ( orgEvent.deltaMode === 2 ) {
|
6403 |
+
var pageHeight = $.data(this, 'mousewheel-page-height');
|
6404 |
+
delta *= pageHeight;
|
6405 |
+
deltaY *= pageHeight;
|
6406 |
+
deltaX *= pageHeight;
|
6407 |
+
}
|
6408 |
+
|
6409 |
+
// Store lowest absolute delta to normalize the delta values
|
6410 |
+
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
|
6411 |
+
|
6412 |
+
if ( !lowestDelta || absDelta < lowestDelta ) {
|
6413 |
+
lowestDelta = absDelta;
|
6414 |
+
|
6415 |
+
// Adjust older deltas if necessary
|
6416 |
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
6417 |
+
lowestDelta /= 40;
|
6418 |
+
}
|
6419 |
+
}
|
6420 |
+
|
6421 |
+
// Adjust older deltas if necessary
|
6422 |
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
6423 |
+
// Divide all the things by 40!
|
6424 |
+
delta /= 40;
|
6425 |
+
deltaX /= 40;
|
6426 |
+
deltaY /= 40;
|
6427 |
+
}
|
6428 |
+
|
6429 |
+
// Get a whole, normalized value for the deltas
|
6430 |
+
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
|
6431 |
+
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
|
6432 |
+
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
|
6433 |
+
|
6434 |
+
// Normalise offsetX and offsetY properties
|
6435 |
+
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
|
6436 |
+
var boundingRect = this.getBoundingClientRect();
|
6437 |
+
offsetX = event.clientX - boundingRect.left;
|
6438 |
+
offsetY = event.clientY - boundingRect.top;
|
6439 |
+
}
|
6440 |
+
|
6441 |
+
// Add information to the event object
|
6442 |
+
event.deltaX = deltaX;
|
6443 |
+
event.deltaY = deltaY;
|
6444 |
+
event.deltaFactor = lowestDelta;
|
6445 |
+
event.offsetX = offsetX;
|
6446 |
+
event.offsetY = offsetY;
|
6447 |
+
// Go ahead and set deltaMode to 0 since we converted to pixels
|
6448 |
+
// Although this is a little odd since we overwrite the deltaX/Y
|
6449 |
+
// properties with normalized deltas.
|
6450 |
+
event.deltaMode = 0;
|
6451 |
+
|
6452 |
+
// Add event and delta to the front of the arguments
|
6453 |
+
args.unshift(event, delta, deltaX, deltaY);
|
6454 |
+
|
6455 |
+
// Clearout lowestDelta after sometime to better
|
6456 |
+
// handle multiple device types that give different
|
6457 |
+
// a different lowestDelta
|
6458 |
+
// Ex: trackpad = 3 and mouse wheel = 120
|
6459 |
+
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
|
6460 |
+
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
|
6461 |
+
|
6462 |
+
return ($.event.dispatch || $.event.handle).apply(this, args);
|
6463 |
+
}
|
6464 |
+
|
6465 |
+
function nullLowestDelta() {
|
6466 |
+
lowestDelta = null;
|
6467 |
+
}
|
6468 |
+
|
6469 |
+
function shouldAdjustOldDeltas(orgEvent, absDelta) {
|
6470 |
+
// If this is an older event and the delta is divisable by 120,
|
6471 |
+
// then we are assuming that the browser is treating this as an
|
6472 |
+
// older mouse wheel event and that we should divide the deltas
|
6473 |
+
// by 40 to try and get a more usable deltaFactor.
|
6474 |
+
// Side note, this actually impacts the reported scroll distance
|
6475 |
+
// in older browsers and can cause scrolling to be slower than native.
|
6476 |
+
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
|
6477 |
+
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
|
6478 |
+
}
|
6479 |
+
|
6480 |
+
}));
|
6481 |
+
|
6482 |
+
S2.define('jquery.select2',[
|
6483 |
+
'jquery',
|
6484 |
+
'jquery-mousewheel',
|
6485 |
+
|
6486 |
+
'./select2/core',
|
6487 |
+
'./select2/defaults',
|
6488 |
+
'./select2/utils'
|
6489 |
+
], function ($, _, Select2, Defaults, Utils) {
|
6490 |
+
if ($.fn.select2 == null) {
|
6491 |
+
// All methods that should return the element
|
6492 |
+
var thisMethods = ['open', 'close', 'destroy'];
|
6493 |
|
6494 |
+
$.fn.select2 = function (options) {
|
6495 |
+
options = options || {};
|
6496 |
+
|
6497 |
+
if (typeof options === 'object') {
|
6498 |
+
this.each(function () {
|
6499 |
+
var instanceOptions = $.extend(true, {}, options);
|
6500 |
+
|
6501 |
+
var instance = new Select2($(this), instanceOptions);
|
6502 |
+
});
|
6503 |
+
|
6504 |
+
return this;
|
6505 |
+
} else if (typeof options === 'string') {
|
6506 |
+
var ret;
|
6507 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
6508 |
+
|
6509 |
+
this.each(function () {
|
6510 |
+
var instance = Utils.GetData(this, 'select2');
|
6511 |
+
|
6512 |
+
if (instance == null && window.console && console.error) {
|
6513 |
+
console.error(
|
6514 |
+
'The select2(\'' + options + '\') method was called on an ' +
|
6515 |
+
'element that is not using Select2.'
|
6516 |
+
);
|
6517 |
+
}
|
6518 |
+
|
6519 |
+
ret = instance[options].apply(instance, args);
|
6520 |
+
});
|
6521 |
+
|
6522 |
+
// Check if we should be returning `this`
|
6523 |
+
if ($.inArray(options, thisMethods) > -1) {
|
6524 |
+
return this;
|
6525 |
+
}
|
6526 |
+
|
6527 |
+
return ret;
|
6528 |
+
} else {
|
6529 |
+
throw new Error('Invalid arguments for Select2: ' + options);
|
6530 |
+
}
|
6531 |
+
};
|
6532 |
+
}
|
6533 |
+
|
6534 |
+
if ($.fn.select2.defaults == null) {
|
6535 |
+
$.fn.select2.defaults = Defaults;
|
6536 |
+
}
|
6537 |
+
|
6538 |
+
return Select2;
|
6539 |
+
});
|
6540 |
+
|
6541 |
+
// Return the AMD loader configuration so it can be used outside of this file
|
6542 |
+
return {
|
6543 |
+
define: S2.define,
|
6544 |
+
require: S2.require
|
6545 |
+
};
|
6546 |
+
}());
|
6547 |
+
|
6548 |
+
// Autoload the jQuery bindings
|
6549 |
+
// We know that all of the modules exist above this, so we're safe
|
6550 |
+
var select2 = S2.require('jquery.select2');
|
6551 |
+
|
6552 |
+
// Hold the AMD module references on the jQuery function that was just loaded
|
6553 |
+
// This allows Select2 to use the internal loader outside of this file, such
|
6554 |
+
// as in the language files.
|
6555 |
+
jQuery.fn.select2.amd = S2;
|
6556 |
+
|
6557 |
+
// Return the Select2 instance for anyone who is importing it.
|
6558 |
+
return select2;
|
6559 |
+
}));
|
@@ -1139,24 +1139,6 @@ background: linear-gradient(45deg, #E47B49 0%, #ea4c89 100%);
|
|
1139 |
-o-transform: rotate(45deg);
|
1140 |
transform: rotate(45deg);
|
1141 |
font-size: 20px
|
1142 |
-
}
|
1143 |
-
.strikethrough {
|
1144 |
-
position: relative;
|
1145 |
-
font-size: 30px !important;
|
1146 |
-
}
|
1147 |
-
.strikethrough:before {
|
1148 |
-
position: absolute;
|
1149 |
-
content: "";
|
1150 |
-
left: -5px;
|
1151 |
-
top: 55%;
|
1152 |
-
right: -5px;
|
1153 |
-
border-top: 4px solid;
|
1154 |
-
border-color: inherit;
|
1155 |
-
-webkit-transform:rotate(-5deg);
|
1156 |
-
-moz-transform:rotate(-5deg);
|
1157 |
-
-ms-transform:rotate(-5deg);
|
1158 |
-
-o-transform:rotate(-5deg);
|
1159 |
-
transform:rotate(-5deg);
|
1160 |
}
|
1161 |
.fp-cnt h1 span{
|
1162 |
text-decoration: underline;
|
1139 |
-o-transform: rotate(45deg);
|
1140 |
transform: rotate(45deg);
|
1141 |
font-size: 20px
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1142 |
}
|
1143 |
.fp-cnt h1 span{
|
1144 |
text-decoration: underline;
|
@@ -67,14 +67,79 @@
|
|
67 |
$( this ).select2Sortable( default_params );
|
68 |
}
|
69 |
|
70 |
-
|
71 |
"change", function() {
|
72 |
redux_change( $( $( this ) ) );
|
73 |
$( this ).select2SortableOrder();
|
74 |
}
|
75 |
-
)
|
76 |
}
|
77 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
);
|
80 |
};
|
67 |
$( this ).select2Sortable( default_params );
|
68 |
}
|
69 |
|
70 |
+
/* $( this ).on(
|
71 |
"change", function() {
|
72 |
redux_change( $( $( this ) ) );
|
73 |
$( this ).select2SortableOrder();
|
74 |
}
|
75 |
+
);*/
|
76 |
}
|
77 |
);
|
78 |
+
|
79 |
+
el.find( 'select.redux-select-item-ajax' ).each(function(){
|
80 |
+
// multiple select with AJAX search
|
81 |
+
var action = $( this ).attr('data-action');
|
82 |
+
if ( $( this ).siblings( '.select2_params' ).size() > 0 ) {
|
83 |
+
var select2_params = $( this ).siblings( '.select2_params' ).val();
|
84 |
+
select2_params = JSON.parse( select2_params );
|
85 |
+
default_params = $.extend( {}, default_params, select2_params );
|
86 |
+
}
|
87 |
+
$( this ).select2({
|
88 |
+
allowClear: true,
|
89 |
+
triggerChange: true,
|
90 |
+
ajax: {
|
91 |
+
url: ajaxurl, // AJAX URL is predefined in WordPress admin
|
92 |
+
dataType: 'json',
|
93 |
+
delay: 250, // delay in ms while typing when to perform a AJAX search
|
94 |
+
data: function (params) {
|
95 |
+
return {
|
96 |
+
q: params.term, // search query
|
97 |
+
action: action, // AJAX action for admin-ajax.php
|
98 |
+
security: ampforwp_nonce
|
99 |
+
};
|
100 |
+
},
|
101 |
+
processResults: function( data ) {
|
102 |
+
var options = [];
|
103 |
+
if ( data ) {
|
104 |
+
|
105 |
+
// data is the array of arrays, and each of them contains ID and the Label of the option
|
106 |
+
$.each( data, function( index, text ) { // do not forget that "index" is just auto incremented value
|
107 |
+
options.push( { id: text[0], text: text[1] } );
|
108 |
+
});
|
109 |
+
|
110 |
+
}
|
111 |
+
return {
|
112 |
+
results: options
|
113 |
+
};
|
114 |
+
},
|
115 |
+
cache: true
|
116 |
+
},
|
117 |
+
formatResult: function(data) {
|
118 |
+
return data.title;
|
119 |
+
},
|
120 |
+
formatSelection: function(data) {
|
121 |
+
return data.title;
|
122 |
+
},
|
123 |
+
matcher: function(term, text) { return text.toUpperCase().indexOf(term.toUpperCase())>=0; },
|
124 |
+
sorter: function(data) {
|
125 |
+
/* Sort data using lowercase comparison */
|
126 |
+
return data.sort(function (a, b) {
|
127 |
+
a = a.text.toLowerCase();
|
128 |
+
b = b.text.toLowerCase();
|
129 |
+
if (a > b) {
|
130 |
+
return 1;
|
131 |
+
} else if (a < b) {
|
132 |
+
return -1;
|
133 |
+
}
|
134 |
+
return 0;
|
135 |
+
});
|
136 |
+
},
|
137 |
+
minimumInputLength: 2 // the minimum of symbols to input before perform a search
|
138 |
+
});
|
139 |
+
|
140 |
+
$(this).parent('fieldset').find('.select2-container--default').css('width','100%');
|
141 |
+
$(this).parent('fieldset').find('.select2-search__field').css('width','100%');
|
142 |
+
});
|
143 |
}
|
144 |
);
|
145 |
};
|
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(e){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.select=redux.field_objects.select||{},redux.field_objects.select.init=function(t){t||(t=e(document).find(".redux-container-select:visible")),e(t).each(function(){var t=e(this),s=t;t.hasClass("redux-field-container")||(s=t.parents(".redux-field-container:first")),s.is(":hidden")||s.hasClass("redux-field-init")&&(s.removeClass("redux-field-init"),t.find("select.redux-select-item").each(function(){var t={width:"resolve",triggerChange:!0,allowClear:!0};if("multiple"==e(this).attr("multiple")&&(t.width="100%"),e(this).siblings(".select2_params").size()>0){var s=e(this).siblings(".select2_params").val();s=JSON.parse(s),t=e.extend({},t,s)}e(this).hasClass("font-icons")&&(t=e.extend({},{formatResult:redux.field_objects.select.addIcon,formatSelection:redux.field_objects.select.addIcon,escapeMarkup:function(e){return e}},t)),e(this).select2(t),e(this).hasClass("select2-sortable")&&((t={}).bindOrder="sortableStop",t.sortableOptions={placeholder:"ui-state-highlight"},e(this).select2Sortable(t))}),t.find("select.redux-select-item-ajax").each(function(){var t=e(this).attr("data-action");if(e(this).siblings(".select2_params").size()>0){var s=e(this).siblings(".select2_params").val();s=JSON.parse(s),default_params=e.extend({},default_params,s)}e(this).select2({allowClear:!0,triggerChange:!0,ajax:{url:ajaxurl,dataType:"json",delay:250,data:function(e){return{q:e.term,action:t,security:ampforwp_nonce}},processResults:function(t){var s=[];return t&&e.each(t,function(e,t){s.push({id:t[0],text:t[1]})}),{results:s}},cache:!0},formatResult:function(e){return e.title},formatSelection:function(e){return e.title},matcher:function(e,t){return t.toUpperCase().indexOf(e.toUpperCase())>=0},sorter:function(e){return e.sort(function(e,t){return(e=e.text.toLowerCase())>(t=t.text.toLowerCase())?1:e<t?-1:0})},minimumInputLength:2}),e(this).parent("fieldset").find(".select2-container--default").css("width","100%"),e(this).parent("fieldset").find(".select2-search__field").css("width","100%")}))})},redux.field_objects.select.addIcon=function(e){if(e.hasOwnProperty("id"))return"<span class='elusive'><i class='"+e.id+"'></i> "+e.text+"</span>"}}(jQuery);
|
@@ -71,8 +71,10 @@ if ( ! class_exists( 'ReduxFramework_select' ) ) {
|
|
71 |
}
|
72 |
//if
|
73 |
|
74 |
-
if ( ! empty( $this->field['options'] ) ) {
|
75 |
$multi = ( isset( $this->field['multi'] ) && $this->field['multi'] ) ? ' multiple="multiple"' : "";
|
|
|
|
|
76 |
|
77 |
if ( ! empty( $this->field['width'] ) ) {
|
78 |
$width = ' style="' . $this->field['width'] . '"';
|
@@ -85,7 +87,7 @@ if ( ! class_exists( 'ReduxFramework_select' ) ) {
|
|
85 |
$nameBrackets = "[]";
|
86 |
}
|
87 |
|
88 |
-
$placeholder = ( isset( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : __( 'Select an
|
89 |
|
90 |
if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js
|
91 |
$select2_params = json_encode( $this->field['select2'] );
|
@@ -112,8 +114,29 @@ if ( ! class_exists( 'ReduxFramework_select' ) ) {
|
|
112 |
}
|
113 |
|
114 |
$sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : "";
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
echo '<option></option>';
|
118 |
|
119 |
foreach ( $this->field['options'] as $k => $v ) {
|
71 |
}
|
72 |
//if
|
73 |
|
74 |
+
if ( ! empty( $this->field['options'] ) || ! empty( $this->field['ajax'] ) ) {
|
75 |
$multi = ( isset( $this->field['multi'] ) && $this->field['multi'] ) ? ' multiple="multiple"' : "";
|
76 |
+
$ajax = ( isset( $this->field['ajax'] ) && $this->field['ajax'] ) ? '-ajax' : ' ';
|
77 |
+
$action = ( isset( $this->field['data-action'] ) && $this->field['data-action'] ) ? 'data-action='.$this->field['data-action'] : ' ';
|
78 |
|
79 |
if ( ! empty( $this->field['width'] ) ) {
|
80 |
$width = ' style="' . $this->field['width'] . '"';
|
87 |
$nameBrackets = "[]";
|
88 |
}
|
89 |
|
90 |
+
$placeholder = ( isset( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : __( 'Select an option', 'accelerated-mobile-pages' );
|
91 |
|
92 |
if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js
|
93 |
$select2_params = json_encode( $this->field['select2'] );
|
114 |
}
|
115 |
|
116 |
$sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : "";
|
117 |
+
echo '<select ' . $multi . ' id="' . $this->field['id'] . '-select" data-placeholder="' . $placeholder . '" name="' . $this->field['name'] . $this->field['name_suffix'] . $nameBrackets . '" class="redux-select-item ' . 'redux-select-item'.$ajax. $this->field['class'] . $sortable . '"' . $width . ' rows="6" '.$action.'>';
|
118 |
+
$redux_options = get_option('redux_builder_amp');
|
119 |
+
$options = $new_options = array();
|
120 |
+
if ( isset($this->field['data']) && 'categories' == $this->field['data'] ) {
|
121 |
+
$options = $redux_options['hide-amp-categories'];
|
122 |
+
if ( is_array($options) ) {
|
123 |
+
$options = array_keys(array_filter($options));
|
124 |
+
foreach ($options as $option ) {
|
125 |
+
echo '<option selected="selected" value="'.$option.'">'.get_the_category_by_ID($option).'</option>';
|
126 |
+
$new_options[] = $option;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
elseif ( isset($this->field['data']) && 'tags' == $this->field['data'] ) {
|
131 |
+
$options = $redux_options['hide-amp-tags-bulk-option'];
|
132 |
+
if ( is_array($options) ) {
|
133 |
+
$options = array_keys(array_filter($options));
|
134 |
+
foreach ($options as $option ) {
|
135 |
+
echo '<option selected="selected" value="'.$option.'">'.get_tag($option)->name.'</option>';
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
echo '<option></option>';
|
141 |
|
142 |
foreach ( $this->field['options'] as $k => $v ) {
|
@@ -70,6 +70,4 @@
|
|
70 |
<?php } ?>
|
71 |
|
72 |
<div class="clear"></div>
|
73 |
-
<!-- Black Friday/Cyber Monday Banner -->
|
74 |
-
<a class="bfcm" href="https://ampforwp.com/festive-season/#utm_source=options-panel&utm_medium=banner&utm_campaign=BFCM2018" target="__blank"><img class="bfcm-img" src="<?php echo AMPFORWP_IMAGE_DIR . '/banner.png'?>" layout="responsive" style="max-width: 100%;height: auto"></a>
|
75 |
</div>
|
70 |
<?php } ?>
|
71 |
|
72 |
<div class="clear"></div>
|
|
|
|
|
73 |
</div>
|
@@ -50,12 +50,30 @@ if(!function_exists('ampforwp_amp_nonamp_convert')){
|
|
50 |
"<style amp-custom>",
|
51 |
"<amp-sidebar ",
|
52 |
"</amp-sidebar>",
|
|
|
|
|
|
|
|
|
53 |
),
|
54 |
array(
|
55 |
"img",
|
56 |
"<style type=\"text/css\">",
|
57 |
"<sidebar ",
|
58 |
"</sidebar>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
)
|
60 |
, $ampData);
|
61 |
|
50 |
"<style amp-custom>",
|
51 |
"<amp-sidebar ",
|
52 |
"</amp-sidebar>",
|
53 |
+
'on="tap:ampforwpConsent.dismiss"',
|
54 |
+
'<div id="post-consent-ui"',
|
55 |
+
'on="tap:ampforwpConsent.reject"',
|
56 |
+
'on="tap:ampforwpConsent.accept"'
|
57 |
),
|
58 |
array(
|
59 |
"img",
|
60 |
"<style type=\"text/css\">",
|
61 |
"<sidebar ",
|
62 |
"</sidebar>",
|
63 |
+
'onClick="ampforwp_gdrp_set()"',
|
64 |
+
'<script>
|
65 |
+
function ampforwp_gdpr_getCookie(name) {
|
66 |
+
var value = "; " + document.cookie;
|
67 |
+
var parts = value.split("; " + name + "=");
|
68 |
+
if (parts.length == 2) return parts.pop().split(";").shift();
|
69 |
+
}
|
70 |
+
function ampforwp_gdpr(){
|
71 |
+
if(ampforwp_gdpr_getCookie(\'ampforwpcookie\') == \'1\'){document.getElementById(\'gdpr_c\').remove();}
|
72 |
+
}ampforwp_gdpr();
|
73 |
+
function ampforwp_gdrp_set(){document.getElementById(\'ampforwpConsent\').remove(); document.cookie = \'ampforwpcookie=1;expires;path=/\';}
|
74 |
+
</script><div id="post-consent-ui"',
|
75 |
+
'onClick="ampforwp_gdrp_set()"',
|
76 |
+
'onClick="ampforwp_gdrp_set()"',
|
77 |
)
|
78 |
, $ampData);
|
79 |
|
@@ -40,7 +40,7 @@ function amp_post_template_add_boilerplate_css( $amp_template ) {
|
|
40 |
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
|
41 |
<?php
|
42 |
}
|
43 |
-
if( ! is_plugin_active('structured-data-for-wp/structured-data-for-wp.php')
|
44 |
add_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata' );
|
45 |
function amp_post_template_add_schemaorg_metadata( $amp_template ) {
|
46 |
$metadata = $amp_template->get( 'metadata' );
|
40 |
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
|
41 |
<?php
|
42 |
}
|
43 |
+
if( ! is_plugin_active('structured-data-for-wp/structured-data-for-wp.php') && ! is_plugin_active('schema-and-structured-data-for-wp/structured-data-for-wp.php') ):
|
44 |
add_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata' );
|
45 |
function amp_post_template_add_schemaorg_metadata( $amp_template ) {
|
46 |
$metadata = $amp_template->get( 'metadata' );
|
@@ -36,46 +36,52 @@ class FasterImage
|
|
36 |
public function batch(array $urls)
|
37 |
{
|
38 |
|
39 |
-
$
|
40 |
-
$
|
41 |
-
|
42 |
-
|
43 |
-
foreach ( array_values($urls) as $count => $uri ) {
|
44 |
-
|
45 |
-
$results[$uri] = [];
|
46 |
-
|
47 |
-
$$count = $this->handle($uri, $results[$uri]);
|
48 |
-
|
49 |
-
$code = curl_multi_add_handle($multi, $$count);
|
50 |
-
|
51 |
-
if ( $code != CURLM_OK ) {
|
52 |
-
throw new \Exception("Curl handle for $uri could not be added");
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
// Perform the requests
|
57 |
-
do {
|
58 |
-
while ( ($mrc = curl_multi_exec($multi, $active)) == CURLM_CALL_MULTI_PERFORM ) ;
|
59 |
-
if ( $mrc != CURLM_OK && $mrc != CURLM_CALL_MULTI_PERFORM ) {
|
60 |
-
throw new \Exception("Curl error code: $mrc");
|
61 |
-
}
|
62 |
-
|
63 |
-
if ( $active && curl_multi_select($multi) === -1 ) {
|
64 |
-
// Perform a usleep if a select returns -1.
|
65 |
-
// See: https://bugs.php.net/bug.php?id=61141
|
66 |
-
usleep(250);
|
67 |
-
}
|
68 |
-
} while ( $active );
|
69 |
-
|
70 |
-
// Figure out why individual requests may have failed
|
71 |
foreach ( array_values($urls) as $count => $uri ) {
|
72 |
-
$
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
}
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
return $results;
|
80 |
}
|
81 |
|
@@ -87,101 +93,5 @@ class FasterImage
|
|
87 |
$this->timeout = $seconds;
|
88 |
}
|
89 |
|
90 |
-
|
91 |
-
* Create the handle for the curl request
|
92 |
-
*
|
93 |
-
* @param $url
|
94 |
-
* @param $result
|
95 |
-
*
|
96 |
-
* @return resource
|
97 |
-
*/
|
98 |
-
protected function handle($url, & $result)
|
99 |
-
{
|
100 |
-
$stream = new Stream();
|
101 |
-
$parser = new ImageParser($stream);
|
102 |
-
$result['rounds'] = 0;
|
103 |
-
$result['bytes'] = 0;
|
104 |
-
$result['size'] = 'failed';
|
105 |
-
|
106 |
-
$ch = curl_init();
|
107 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
108 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
109 |
-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
110 |
-
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
|
111 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
112 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
113 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
114 |
-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
|
115 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
|
116 |
-
|
117 |
-
# Some web servers require the useragent to be not a bot. So we are liars.
|
118 |
-
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36');
|
119 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
120 |
-
"Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
|
121 |
-
"Cache-Control: max-age=0",
|
122 |
-
"Connection: keep-alive",
|
123 |
-
"Keep-Alive: 300",
|
124 |
-
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
|
125 |
-
"Accept-Language: en-us,en;q=0.5",
|
126 |
-
"Pragma: ", // browsers keep this blank.
|
127 |
-
]);
|
128 |
-
curl_setopt($ch, CURLOPT_ENCODING, "");
|
129 |
-
|
130 |
-
curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($ch, $str) use (& $result, & $parser, & $stream, $url) {
|
131 |
-
|
132 |
-
$result['rounds']++;
|
133 |
-
$result['bytes'] += strlen($str);
|
134 |
-
|
135 |
-
$stream->write($str);
|
136 |
-
|
137 |
-
try {
|
138 |
-
// store the type in the result array by looking at the bits
|
139 |
-
$result['type'] = $parser->parseType();
|
140 |
-
|
141 |
-
/*
|
142 |
-
* We try here to parse the buffer of characters we already have
|
143 |
-
* for the size.
|
144 |
-
*/
|
145 |
-
$result['size'] = $parser->parseSize() ?: 'failed';
|
146 |
-
}
|
147 |
-
catch (StreamBufferTooSmallException $e) {
|
148 |
-
/*
|
149 |
-
* If this exception is thrown, we don't have enough of the stream buffered
|
150 |
-
* so in order to tell curl to keep streaming we need to return the number
|
151 |
-
* of bytes we have already handled
|
152 |
-
*
|
153 |
-
* We set the 'size' to 'failed' in the case that we've done
|
154 |
-
* the entire image and we couldn't figure it out. Otherwise
|
155 |
-
* it'll get overwritten with the next round.
|
156 |
-
*/
|
157 |
-
$result['size'] = 'failed';
|
158 |
-
|
159 |
-
return strlen($str);
|
160 |
-
}
|
161 |
-
catch (InvalidImageException $e) {
|
162 |
-
|
163 |
-
/*
|
164 |
-
* This means we've determined that we're lost and don't know
|
165 |
-
* how to parse this image.
|
166 |
-
*
|
167 |
-
* We set the size to invalid and move on
|
168 |
-
*/
|
169 |
-
$result['size'] = 'invalid';
|
170 |
-
|
171 |
-
return -1;
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
/*
|
176 |
-
* We return -1 to abort the transfer when we have enough buffered
|
177 |
-
* to find the size
|
178 |
-
*/
|
179 |
-
//
|
180 |
-
// hey curl! this is an error. But really we just are stopping cause
|
181 |
-
// we already have what we wwant
|
182 |
-
return -1;
|
183 |
-
});
|
184 |
-
|
185 |
-
return $ch;
|
186 |
-
}
|
187 |
}
|
36 |
public function batch(array $urls)
|
37 |
{
|
38 |
|
39 |
+
$stream = new Stream();
|
40 |
+
$parser = new ImageParser($stream);
|
41 |
+
$results = [];
|
42 |
+
$request = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
foreach ( array_values($urls) as $count => $uri ) {
|
44 |
+
$results[$uri] = array();
|
45 |
+
$request[$uri] = array(
|
46 |
+
'url' => $uri,
|
47 |
+
'type' => 'GET',
|
48 |
+
);
|
49 |
}
|
50 |
+
$options= array(
|
51 |
+
'timeout'=>$this->timeout,
|
52 |
+
'connect_timeout'=>$this->timeout,
|
53 |
+
'useragent'=>'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36',
|
54 |
+
'verify'=> 1,
|
55 |
+
'verifyname'=>1,
|
56 |
+
'follow_redirects'=>false,
|
57 |
+
'complete'=> function($response, $url) use(&$results, &$parser, &$stream){
|
58 |
+
$results[$url]['rounds'] = 0;
|
59 |
+
$results[$url]['bytes'] = 0;
|
60 |
+
$results[$url]['size'] = 'failed';
|
61 |
+
if( is_a( $response, 'Requests_Response' ) ){
|
62 |
+
$str = $response->body;
|
63 |
+
$results[$url]['bytes'] += strlen($str);
|
64 |
+
$results[$url]['rounds']++;
|
65 |
+
$stream->write($str);
|
66 |
+
try {
|
67 |
+
// store the type in the result array by looking at the bits
|
68 |
+
$results[$url]['type'] = $parser->parseType();
|
69 |
+
$results[$url]['size'] = $parser->parseSize() ?: 'failed';
|
70 |
+
}
|
71 |
+
catch (StreamBufferTooSmallException $e) {
|
72 |
+
$results[$url]['size'] = 'failed';
|
73 |
+
return strlen($str);
|
74 |
+
}
|
75 |
+
catch (InvalidImageException $e) {
|
76 |
+
$results[$url]['size'] = 'invalid';
|
77 |
+
return -1;
|
78 |
+
}
|
79 |
+
return -1;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
);
|
83 |
+
|
84 |
+
$responseResults = \Requests::request_multiple($request , $options);
|
85 |
return $results;
|
86 |
}
|
87 |
|
93 |
$this->timeout = $seconds;
|
94 |
}
|
95 |
|
96 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
@@ -52,7 +52,7 @@ class AMP_Img_Sanitizer extends AMP_Base_Sanitizer {
|
|
52 |
}
|
53 |
|
54 |
// Determine which images need their dimensions determined/extracted.
|
55 |
-
if (
|
56 |
$need_dimensions[ $node->getAttribute( 'src' ) ][] = $node;
|
57 |
} else {
|
58 |
$this->adjust_and_replace_node( $node );
|
@@ -78,10 +78,35 @@ class AMP_Img_Sanitizer extends AMP_Base_Sanitizer {
|
|
78 |
if ( false === $dimensions ) {
|
79 |
$width = isset( $this->args['content_max_width'] ) ? $this->args['content_max_width'] : self::FALLBACK_WIDTH;
|
80 |
$height = self::FALLBACK_HEIGHT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
$node->setAttribute( 'width', $width );
|
82 |
$node->setAttribute( 'height', $height );
|
83 |
-
$
|
84 |
-
$node->setAttribute( 'class', $class );
|
85 |
} else {
|
86 |
$node->setAttribute( 'width', $dimensions['width'] );
|
87 |
$node->setAttribute( 'height', $dimensions['height'] );
|
52 |
}
|
53 |
|
54 |
// Determine which images need their dimensions determined/extracted.
|
55 |
+
if ( ! is_numeric( $node->getAttribute( 'width' ) ) || ! is_numeric( $node->getAttribute( 'height' ) ) ) {
|
56 |
$need_dimensions[ $node->getAttribute( 'src' ) ][] = $node;
|
57 |
} else {
|
58 |
$this->adjust_and_replace_node( $node );
|
78 |
if ( false === $dimensions ) {
|
79 |
$width = isset( $this->args['content_max_width'] ) ? $this->args['content_max_width'] : self::FALLBACK_WIDTH;
|
80 |
$height = self::FALLBACK_HEIGHT;
|
81 |
+
if ( isset( $dimensions['width'] ) ) {
|
82 |
+
$width = $dimensions['width'];
|
83 |
+
}
|
84 |
+
if ( isset( $dimensions['height'] ) ) {
|
85 |
+
$height = $dimensions['height'];
|
86 |
+
}
|
87 |
+
if ( ! is_numeric( $node->getAttribute( 'width' ) ) ) {
|
88 |
+
// Let width have the right aspect ratio based on the height attribute.
|
89 |
+
if ( is_numeric( $node->getAttribute( 'height' ) ) && isset( $dimensions['height'] ) && isset( $dimensions['width'] ) ) {
|
90 |
+
$width = ( floatval( $node->getAttribute( 'height' ) ) * $dimensions['width'] ) / $dimensions['height'];
|
91 |
+
}
|
92 |
+
$node->setAttribute( 'width', $width );
|
93 |
+
if ( ! isset( $dimensions['width'] ) ) {
|
94 |
+
$class .= ' amp-wp-unknown-width';
|
95 |
+
}
|
96 |
+
}
|
97 |
+
if ( ! is_numeric( $node->getAttribute( 'height' ) ) ) {
|
98 |
+
// Let height have the right aspect ratio based on the width attribute.
|
99 |
+
if ( is_numeric( $node->getAttribute( 'width' ) ) && isset( $dimensions['width'] ) && isset( $dimensions['height'] ) ) {
|
100 |
+
$height = ( floatval( $node->getAttribute( 'width' ) ) * $dimensions['height'] ) / $dimensions['width'];
|
101 |
+
}
|
102 |
+
$node->setAttribute( 'height', $height );
|
103 |
+
if ( ! isset( $dimensions['height'] ) ) {
|
104 |
+
$class .= ' amp-wp-unknown-height';
|
105 |
+
}
|
106 |
+
}
|
107 |
$node->setAttribute( 'width', $width );
|
108 |
$node->setAttribute( 'height', $height );
|
109 |
+
$node->setAttribute( 'class', trim( $class ) );
|
|
|
110 |
} else {
|
111 |
$node->setAttribute( 'width', $dimensions['width'] );
|
112 |
$node->setAttribute( 'height', $dimensions['height'] );
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'AMP_Widget_Archives' ) ) {
|
3 |
+
class AMP_Widget_Archives extends WP_Widget_Archives {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Echoes the markup of the widget.
|
7 |
+
*
|
8 |
+
* Mainly copied from WP_Widget_Archives::widget()
|
9 |
+
* Changes include:
|
10 |
+
* An id for the <form>.
|
11 |
+
* More escaping.
|
12 |
+
* The dropdown is now filtered with 'wp_dropdown_cats.'
|
13 |
+
* This enables adding an 'on' attribute, with the id of the form.
|
14 |
+
* So changing the dropdown value will redirect to the category page, with valid AMP.
|
15 |
+
*
|
16 |
+
* @since 0.7.0
|
17 |
+
*
|
18 |
+
* @param array $args Widget display data.
|
19 |
+
* @param array $instance Data for widget.
|
20 |
+
* @return void.
|
21 |
+
*/
|
22 |
+
public function widget( $args, $instance ) {
|
23 |
+
if ( false === get_query_var( AMP_QUERY_VAR, false ) ) {
|
24 |
+
//if ( ! is_amp_endpoint() ) {
|
25 |
+
parent::widget( $args, $instance );
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
$c = ! empty( $instance['count'] ) ? '1' : '0';
|
30 |
+
$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
31 |
+
|
32 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
|
33 |
+
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives', 'default' ) : $instance['title'], $instance, $this->id_base );
|
34 |
+
echo wp_kses_post( $args['before_widget'] );
|
35 |
+
if ( $title ) :
|
36 |
+
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
|
37 |
+
endif;
|
38 |
+
|
39 |
+
if ( $d ) :
|
40 |
+
$dropdown_id = "{$this->id_base}-dropdown-{$this->number}";
|
41 |
+
?>
|
42 |
+
<form action="<?php echo esc_url( home_url() ); ?>" method="get" target="_top">
|
43 |
+
<label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ); ?>"><?php echo esc_html( $title ); ?></label>
|
44 |
+
<select id="<?php echo esc_attr( $dropdown_id ); ?>" name="archive-dropdown" on="change:AMP.navigateTo(url=event.value)">
|
45 |
+
<?php
|
46 |
+
|
47 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
|
48 |
+
$dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
|
49 |
+
'type' => 'monthly',
|
50 |
+
'format' => 'option',
|
51 |
+
'show_post_count' => $c,
|
52 |
+
) );
|
53 |
+
|
54 |
+
switch ( $dropdown_args['type'] ) {
|
55 |
+
case 'yearly':
|
56 |
+
$label = __( 'Select Year', 'default' );
|
57 |
+
break;
|
58 |
+
case 'monthly':
|
59 |
+
$label = __( 'Select Month', 'default' );
|
60 |
+
break;
|
61 |
+
case 'daily':
|
62 |
+
$label = __( 'Select Day', 'default' );
|
63 |
+
break;
|
64 |
+
case 'weekly':
|
65 |
+
$label = __( 'Select Week', 'default' );
|
66 |
+
break;
|
67 |
+
default:
|
68 |
+
$label = __( 'Select Post', 'default' );
|
69 |
+
break;
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
<option value=""><?php echo esc_attr( $label ); ?></option>
|
73 |
+
<?php wp_get_archives( $dropdown_args ); ?>
|
74 |
+
</select>
|
75 |
+
</form>
|
76 |
+
<?php else : ?>
|
77 |
+
<ul>
|
78 |
+
<?php
|
79 |
+
|
80 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
|
81 |
+
wp_get_archives( apply_filters( 'widget_archives_args', array(
|
82 |
+
'type' => 'monthly',
|
83 |
+
'show_post_count' => $c,
|
84 |
+
) ) );
|
85 |
+
?>
|
86 |
+
</ul>
|
87 |
+
<?php
|
88 |
+
endif;
|
89 |
+
echo wp_kses_post( $args['after_widget'] );
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
}
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists('AMP_Widget_Categories') ) {
|
3 |
+
class AMP_Widget_Categories extends WP_Widget_Categories {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Echoes the markup of the widget.
|
7 |
+
*
|
8 |
+
* Mainly copied from WP_Widget_Categories::widget()
|
9 |
+
* There's now an id for the <form>.
|
10 |
+
* And the dropdown is now filtered with 'wp_dropdown_cats.'
|
11 |
+
* This enables adding an 'on' attribute, with the id of the form.
|
12 |
+
* So changing the dropdown value will redirect to the category page, with valid AMP.
|
13 |
+
*
|
14 |
+
* @since 0.7.0
|
15 |
+
*
|
16 |
+
* @param array $args Widget display data.
|
17 |
+
* @param array $instance Data for widget.
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
public function widget( $args, $instance ) {
|
21 |
+
if ( false === get_query_var( AMP_QUERY_VAR, false ) ) {
|
22 |
+
//if ( ! is_amp_endpoint() ) {
|
23 |
+
parent::widget( $args, $instance );
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
static $first_dropdown = true;
|
28 |
+
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories', 'default' );
|
29 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
|
30 |
+
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
31 |
+
$c = ! empty( $instance['count'] ) ? '1' : '0';
|
32 |
+
$h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
|
33 |
+
$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
34 |
+
echo wp_kses_post( $args['before_widget'] );
|
35 |
+
if ( $title ) {
|
36 |
+
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
|
37 |
+
}
|
38 |
+
$cat_args = array(
|
39 |
+
'orderby' => 'name',
|
40 |
+
'show_count' => $c,
|
41 |
+
'hierarchical' => $h,
|
42 |
+
);
|
43 |
+
if ( $d ) :
|
44 |
+
$form_id = sprintf( 'widget-categories-dropdown-%d', $this->number );
|
45 |
+
printf( '<form action="%s" method="get" target="_top" id="%s">', esc_url( home_url() ), esc_attr( $form_id ) );
|
46 |
+
$dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}";
|
47 |
+
$first_dropdown = false;
|
48 |
+
echo '<label class="screen-reader-text" for="' . esc_attr( $dropdown_id ) . '">' . esc_html( $title ) . '</label>';
|
49 |
+
$cat_args['show_option_none'] = __( 'Select Category', 'default' );
|
50 |
+
$cat_args['id'] = $dropdown_id;
|
51 |
+
|
52 |
+
$dropdown = wp_dropdown_categories( array_merge(
|
53 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-categories.php */
|
54 |
+
//apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ),
|
55 |
+
array( 'echo' => false )
|
56 |
+
) );
|
57 |
+
|
58 |
+
$dropdown = preg_replace(
|
59 |
+
'/(?<=<select\b)/',
|
60 |
+
sprintf( '<select on="change:%s.submit"', esc_attr( $form_id ) ),
|
61 |
+
$dropdown,
|
62 |
+
1
|
63 |
+
);
|
64 |
+
echo $dropdown; // WPCS: XSS OK.
|
65 |
+
echo '</form>';
|
66 |
+
else :
|
67 |
+
?>
|
68 |
+
<ul>
|
69 |
+
<?php
|
70 |
+
$cat_args['title_li'] = '';
|
71 |
+
|
72 |
+
/** This filter is documented in wp-includes/widgets/class-wp-widget-categories.php */
|
73 |
+
wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
|
74 |
+
?>
|
75 |
+
</ul>
|
76 |
+
<?php
|
77 |
+
endif;
|
78 |
+
echo wp_kses_post( $args['after_widget'] );
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( class_exists( 'WP_Widget_Media_Video' ) && ! class_exists('AMP_Widget_Media_Video') ) {
|
4 |
+
/**
|
5 |
+
* Class AMP_Widget_Media_Video
|
6 |
+
*
|
7 |
+
* @since 0.7.0
|
8 |
+
* @package AMP
|
9 |
+
*/
|
10 |
+
class AMP_Widget_Media_Video extends WP_Widget_Media_Video {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Overrides the parent callback that strips width and height values.
|
14 |
+
*
|
15 |
+
* @param string $html Video shortcode HTML output.
|
16 |
+
* @return string HTML Output.
|
17 |
+
*/
|
18 |
+
public function inject_video_max_width_style( $html ) {
|
19 |
+
if ( false === get_query_var( AMP_QUERY_VAR, false ) ) {
|
20 |
+
//if ( is_amp_endpoint() ) {
|
21 |
+
return $html;
|
22 |
+
}
|
23 |
+
return parent::inject_video_max_width_style( $html );
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists('AMP_Widget_Recent_Comments') ) {
|
3 |
+
class AMP_Widget_Recent_Comments extends WP_Widget_Recent_Comments {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Instantiates the widget, and prevents inline styling.
|
7 |
+
*
|
8 |
+
* @since 0.7.0
|
9 |
+
*/
|
10 |
+
public function __construct() {
|
11 |
+
parent::__construct();
|
12 |
+
add_filter( 'wp_head', array( $this, 'remove_head_style_in_amp' ), 0 );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Prevent recent comments widget style from printing in AMP,
|
17 |
+
*
|
18 |
+
* @since 0.7.0
|
19 |
+
*/
|
20 |
+
public function remove_head_style_in_amp() {
|
21 |
+
if ( false === get_query_var( AMP_QUERY_VAR, false ) ) {
|
22 |
+
//if ( is_amp_endpoint() ) {
|
23 |
+
add_filter( 'show_recent_comments_widget_style', '__return_false' );
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( class_exists( 'WP_Widget_Text' ) && ! class_exists('AMP_Widget_Text') ) {
|
4 |
+
/**
|
5 |
+
* Class AMP_Widget_Text
|
6 |
+
*
|
7 |
+
* @since 0.7.0
|
8 |
+
* @package AMP
|
9 |
+
*/
|
10 |
+
class AMP_Widget_Text extends WP_Widget_Text {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Overrides the parent callback that strips width and height attributes.
|
14 |
+
*
|
15 |
+
* @param array $matches The matches returned from preg_replace_callback().
|
16 |
+
* @return string $html The markup, unaltered.
|
17 |
+
*/
|
18 |
+
public function inject_video_max_width_style( $matches ) {
|
19 |
+
if ( false === get_query_var( AMP_QUERY_VAR, false ) ) {
|
20 |
+
//if ( is_amp_endpoint() ) {
|
21 |
+
return $matches[0];
|
22 |
+
}
|
23 |
+
return parent::inject_video_max_width_style( $matches );
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
@@ -54,4 +54,6 @@ Reason: To extend the functionality of sidebars and Pagebuilder
|
|
54 |
27. Class AMP_DOM_Utils updated #2445
|
55 |
28. Class AMP_Gallery_Embed_Handler updated #1968
|
56 |
29. Converted the space into %20 on anchor links which have spaces on line number 166 and here is the github ticket #2465
|
57 |
-
30. FTP protocol has been whitelisted in anchor tags #2477
|
|
|
|
54 |
27. Class AMP_DOM_Utils updated #2445
|
55 |
28. Class AMP_Gallery_Embed_Handler updated #1968
|
56 |
29. Converted the space into %20 on anchor links which have spaces on line number 166 and here is the github ticket #2465
|
57 |
+
30. FTP protocol has been whitelisted in anchor tags #2477
|
58 |
+
31. Class AMP_Img_Sanitizer Updated #2748
|
59 |
+
32. Widgets folder added in Vendor amp/includes #1400
|
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
|
|
3 |
Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 5.0
|
7 |
-
Stable tag: 0.9.97.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -185,12 +185,22 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
185 |
|
186 |
== Changelog ==
|
187 |
|
188 |
-
= 0.9.97.
|
189 |
-
*
|
190 |
-
* Fixed:
|
191 |
-
* Fixed:
|
192 |
-
* Fixed:
|
193 |
-
* Fixed:
|
194 |
-
* Fixed:
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 5.0.2
|
7 |
+
Stable tag: 0.9.97.24
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
185 |
|
186 |
== Changelog ==
|
187 |
|
188 |
+
= 0.9.97.24 (9th January 2019) =
|
189 |
+
* Added: Compatibility with new and all default WP widgets #1400
|
190 |
+
* Fixed: Performance issue #2762
|
191 |
+
* Fixed: Need to add amp endpoint filter #2761
|
192 |
+
* Fixed: When Hide AMP Option is enabled in PageEditor with Convert AMP to WP theme (Beta) enabled it's providing output as AMP Page #2735
|
193 |
+
* Fixed: Whenever an image inserted, has width="100%" and height="100%", its giving Validation error. #2748
|
194 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
195 |
+
* Fixed: Whenever Responsive AD is enabled then the AD should load on the screen without any effect to the normal mode AD in D1,2,3, and Swift #2531
|
196 |
+
* Fixed: When Convert AMP to WP theme (Beta) is enabled GDPR popup isn't closing #2763
|
197 |
+
* Fixed: If twitter embed code is added then other blockquotes tag are not working #2750
|
198 |
+
* Fixed: Custom post type is showing a blank page in the swift theme #2512
|
199 |
+
* Fixed: Conflict with the Schema and Structure data plugin #2777
|
200 |
+
* Fixed: In the swift theme the Sticky social icons overlaps #2601
|
201 |
+
* Fixed: " Top " Button functionality to be improved. #2529
|
202 |
+
* Fixed: Drop down icon appearing twice #2785
|
203 |
+
* Fixed: Custom front page Meta description and content are not rendering for ALL in SEO plugin. #2702
|
204 |
+
* Fixed: Hover color is not appearing properly #2787
|
205 |
+
|
206 |
+
Full changelog available in changelog.txt
|
@@ -26,8 +26,18 @@ wp_reset_postdata(); ?>
|
|
26 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
27 |
echo strip_tags( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_tags );
|
28 |
?></p><p class="back-to-top">
|
29 |
-
<?php
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
|
33 |
if($redux_builder_amp['ampforwp-footer-top']=='1') {
|
26 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
27 |
echo strip_tags( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_tags );
|
28 |
?></p><p class="back-to-top">
|
29 |
+
<?php
|
30 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
31 |
+
<p class="rightslink back-to-top">
|
32 |
+
<?php amp_back_to_top_link();
|
33 |
+
if(true == ampforwp_get_setting('amp-footer-link-non-amp-page')){
|
34 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
35 |
+
| <?php ampforwp_view_nonamp();
|
36 |
+
}
|
37 |
+
else{
|
38 |
+
ampforwp_view_nonamp();
|
39 |
+
}
|
40 |
+
}
|
41 |
}
|
42 |
if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
|
43 |
if($redux_builder_amp['ampforwp-footer-top']=='1') {
|
@@ -16,9 +16,6 @@
|
|
16 |
$header_color = $get_customizer->get_customizer_setting( 'header_color' );
|
17 |
?>
|
18 |
|
19 |
-
/* Widgets styling */
|
20 |
-
.amp-wp-content.widget-wrapper { margin: 20px 17px 17px 17px;}
|
21 |
-
|
22 |
#statcounter{width: 1px;height:1px;}
|
23 |
@font-face {
|
24 |
font-family: 'Merriweather';
|
@@ -223,4 +220,154 @@ if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
|
223 |
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
224 |
<?php }
|
225 |
echo $redux_builder_amp['css_editor'];
|
226 |
-
//} ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
$header_color = $get_customizer->get_customizer_setting( 'header_color' );
|
17 |
?>
|
18 |
|
|
|
|
|
|
|
19 |
#statcounter{width: 1px;height:1px;}
|
20 |
@font-face {
|
21 |
font-family: 'Merriweather';
|
220 |
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
221 |
<?php }
|
222 |
echo $redux_builder_amp['css_editor'];
|
223 |
+
//} ?>
|
224 |
+
<?php
|
225 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-1')){?>
|
226 |
+
.amp-ad-1 {
|
227 |
+
max-width: 1000px;
|
228 |
+
}
|
229 |
+
<?php } ?>
|
230 |
+
<?php
|
231 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-2')){?>
|
232 |
+
.amp-ad-2 {
|
233 |
+
max-width: 1000px;
|
234 |
+
}
|
235 |
+
<?php } ?>
|
236 |
+
<?php
|
237 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-3')){?>
|
238 |
+
.amp-ad-3 {
|
239 |
+
max-width: 1000px;
|
240 |
+
}
|
241 |
+
<?php } ?>
|
242 |
+
<?php
|
243 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-4')){?>
|
244 |
+
.amp-ad-4 {
|
245 |
+
max-width: 1000px;
|
246 |
+
}
|
247 |
+
<?php } ?>
|
248 |
+
<?php
|
249 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-5')){?>
|
250 |
+
.amp-ad-5 {
|
251 |
+
max-width: 1000px;
|
252 |
+
}
|
253 |
+
<?php } ?>
|
254 |
+
<?php
|
255 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
|
256 |
+
.amp-ad-6 {
|
257 |
+
max-width: 1000px;
|
258 |
+
}
|
259 |
+
<?php } ?>
|
260 |
+
<?php // Widgets CSS
|
261 |
+
if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
262 |
+
.f-w{display: inline-flex;width:auto;flex-wrap:wrap;}
|
263 |
+
.w-bl{margin-left: 0;display: flex;flex-direction: column;position: relative;flex: 1 0 22%;margin:0 15px 30px;line-height:1.5;font-size:14px;}
|
264 |
+
.w-bl h4{font-size: <?php echo $redux_builder_amp['swift-head-size'] ?>;font-weight: <?php echo $redux_builder_amp['swift-head-fntwgth'] ?>;margin-bottom: 20px;text-transform: uppercase;letter-spacing: 1px;padding-bottom: 4px;}
|
265 |
+
.w-bl ul li{list-style-type: none;margin-bottom: 15px;}
|
266 |
+
.w-bl ul li:last-child{margin-bottom:0;}
|
267 |
+
.w-bl ul li a{text-decoration: none;}
|
268 |
+
.w-bl .menu li .sub-menu, .w-bl .lb-x{display:none;}
|
269 |
+
.w-bl table {
|
270 |
+
border-collapse: collapse;
|
271 |
+
margin: 0 0 1.5em;
|
272 |
+
width: 100%;
|
273 |
+
}
|
274 |
+
.w-bl tr {
|
275 |
+
border-bottom: 1px solid #eee;
|
276 |
+
}
|
277 |
+
.w-bl th, .w-bl td {
|
278 |
+
text-align: center;
|
279 |
+
}
|
280 |
+
.w-bl td {
|
281 |
+
padding: 0.4em;
|
282 |
+
}
|
283 |
+
.w-bl th:first-child, .w-bl td:first-child {
|
284 |
+
padding-left: 0;
|
285 |
+
}
|
286 |
+
.w-bl thead th {
|
287 |
+
border-bottom: 2px solid #bbb;
|
288 |
+
padding-bottom: 0.5em;
|
289 |
+
padding: 0.4em;
|
290 |
+
}
|
291 |
+
.w-bl .calendar_wrap caption{
|
292 |
+
font-size: 14px;
|
293 |
+
margin-bottom: 10px;
|
294 |
+
}
|
295 |
+
.w-bl form{
|
296 |
+
display:inline-flex;
|
297 |
+
flex-wrap:wrap;
|
298 |
+
align-items: center;
|
299 |
+
}
|
300 |
+
.w-bl .search-submit{
|
301 |
+
text-indent: -9999px;
|
302 |
+
padding: 0;
|
303 |
+
margin: 0;
|
304 |
+
background: transparent;
|
305 |
+
line-height: 0;
|
306 |
+
display: inline-block;
|
307 |
+
opacity: 0;
|
308 |
+
}
|
309 |
+
.w-bl .search-button{
|
310 |
+
border: 1px solid;
|
311 |
+
width: 10px;
|
312 |
+
height: 10px;
|
313 |
+
border-radius: 50%;
|
314 |
+
-webkit-transform: rotate(45deg);
|
315 |
+
-ms-transform: rotate(45deg);
|
316 |
+
transform: rotate(45deg);
|
317 |
+
margin: 4px 4px 8px 8px;
|
318 |
+
position: relative;
|
319 |
+
cursor: pointer;
|
320 |
+
}
|
321 |
+
.w-bl .search-button:after{
|
322 |
+
content: "";
|
323 |
+
position: absolute;
|
324 |
+
left: 50%;
|
325 |
+
-webkit-transform: rotate(270deg);
|
326 |
+
-ms-transform: rotate(270deg);
|
327 |
+
transform: rotate(270deg);
|
328 |
+
width: 2px;
|
329 |
+
height: 9px;
|
330 |
+
box-shadow: inset 0 0 0 32px;
|
331 |
+
top: 0px;
|
332 |
+
border-radius: 0 0 1px 1px;
|
333 |
+
left: 14px;
|
334 |
+
}
|
335 |
+
.w-bl .search-field{
|
336 |
+
border: 1px solid #ccc;
|
337 |
+
padding: 6px 10px;
|
338 |
+
}
|
339 |
+
<?php endif; ?>
|
340 |
+
@media(max-width:480px){
|
341 |
+
<?php if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
342 |
+
.f-w{ display: inline-block;}
|
343 |
+
.w-bl{flex:1 0 100%;}
|
344 |
+
<?php endif; ?>
|
345 |
+
}
|
346 |
+
<?php // Back to Top CSS //
|
347 |
+
if( true == ampforwp_get_setting('ampforwp-footer-top') ) { ?>
|
348 |
+
.btt{
|
349 |
+
position: fixed;
|
350 |
+
<?php if( (is_single() && true == ampforwp_get_setting('enable-single-social-icons') ) || (is_page() && true == ampforwp_get_setting('ampforwp-page-sticky-social') ) ){ ?>
|
351 |
+
bottom: 55px;
|
352 |
+
<?php } else { ?>
|
353 |
+
bottom: 20px;
|
354 |
+
<?php } ?>
|
355 |
+
right: 20px;
|
356 |
+
background: rgba(71, 71, 71, 0.5);
|
357 |
+
color: #fff;
|
358 |
+
border-radius: 100%;
|
359 |
+
width: 50px;
|
360 |
+
height: 50px;
|
361 |
+
}
|
362 |
+
.btt:hover{color:#fff;background:#474747;}
|
363 |
+
.btt:before{
|
364 |
+
content: '\25be';
|
365 |
+
display: block;
|
366 |
+
font-size: 35px;
|
367 |
+
font-weight: 600;
|
368 |
+
color:#fff;
|
369 |
+
transform: rotate(180deg);
|
370 |
+
text-align: center;
|
371 |
+
line-height: 1.5;
|
372 |
+
}
|
373 |
+
<?php } ?>
|
@@ -21,13 +21,16 @@
|
|
21 |
</div>
|
22 |
<?php } ?>
|
23 |
<p><?php
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
else{
|
30 |
ampforwp_view_nonamp();
|
|
|
31 |
}
|
32 |
}
|
33 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
21 |
</div>
|
22 |
<?php } ?>
|
23 |
<p><?php
|
24 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
25 |
+
<p class="rightslink back-to-top">
|
26 |
+
<?php amp_back_to_top_link();
|
27 |
+
if(true == ampforwp_get_setting('amp-footer-link-non-amp-page')){
|
28 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
29 |
+
| <?php ampforwp_view_nonamp();
|
30 |
+
}
|
31 |
else{
|
32 |
ampforwp_view_nonamp();
|
33 |
+
}
|
34 |
}
|
35 |
}
|
36 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
@@ -361,3 +361,145 @@ if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
|
361 |
<?php }
|
362 |
echo $redux_builder_amp['css_editor'];
|
363 |
//} ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
<?php }
|
362 |
echo $redux_builder_amp['css_editor'];
|
363 |
//} ?>
|
364 |
+
<?php
|
365 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-1')){?>
|
366 |
+
.amp-ad-1 {
|
367 |
+
max-width: 1000px;
|
368 |
+
}
|
369 |
+
<?php } ?>
|
370 |
+
<?php
|
371 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-2')){?>
|
372 |
+
.amp-ad-2 {
|
373 |
+
max-width: 1000px;
|
374 |
+
}
|
375 |
+
<?php } ?>
|
376 |
+
<?php
|
377 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-3')){?>
|
378 |
+
.amp-ad-3 {
|
379 |
+
max-width: 1000px;
|
380 |
+
}
|
381 |
+
<?php } ?>
|
382 |
+
<?php
|
383 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-4')){?>
|
384 |
+
.amp-ad-4 {
|
385 |
+
max-width: 1000px;
|
386 |
+
}
|
387 |
+
<?php } ?>
|
388 |
+
<?php
|
389 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-5')){?>
|
390 |
+
.amp-ad-5 {
|
391 |
+
max-width: 1000px;
|
392 |
+
}
|
393 |
+
<?php } ?>
|
394 |
+
<?php
|
395 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
|
396 |
+
.amp-ad-6 {
|
397 |
+
max-width: 1000px;
|
398 |
+
}
|
399 |
+
<?php } ?>
|
400 |
+
<?php // Widgets CSS
|
401 |
+
if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
402 |
+
.f-w{display: inline-flex;width:auto;flex-wrap:wrap;}
|
403 |
+
.w-bl{margin-left: 0;display: flex;flex-direction: column;position: relative;flex: 1 0 22%;margin:0 15px 30px;line-height:1.5;font-size:14px;}
|
404 |
+
.w-bl h4{font-size: <?php echo $redux_builder_amp['swift-head-size'] ?>;font-weight: <?php echo $redux_builder_amp['swift-head-fntwgth'] ?>;margin-bottom: 20px;text-transform: uppercase;letter-spacing: 1px;padding-bottom: 4px;}
|
405 |
+
.w-bl ul{padding:0;margin:0;}
|
406 |
+
.w-bl ul li{list-style-type: none;margin-bottom: 15px;}
|
407 |
+
.w-bl ul li:last-child{margin-bottom:0;}
|
408 |
+
.w-bl ul li a{text-decoration: none;}
|
409 |
+
.w-bl .menu li .sub-menu, .w-bl .lb-x{display:none;}
|
410 |
+
.w-bl table {
|
411 |
+
border-collapse: collapse;
|
412 |
+
margin: 0 0 1.5em;
|
413 |
+
width: 100%;
|
414 |
+
}
|
415 |
+
.w-bl tr {
|
416 |
+
border-bottom: 1px solid #eee;
|
417 |
+
}
|
418 |
+
.w-bl th, .w-bl td {
|
419 |
+
text-align: center;
|
420 |
+
}
|
421 |
+
.w-bl td {
|
422 |
+
padding: 0.4em;
|
423 |
+
}
|
424 |
+
.w-bl th:first-child, .w-bl td:first-child {
|
425 |
+
padding-left: 0;
|
426 |
+
}
|
427 |
+
.w-bl thead th {
|
428 |
+
border-bottom: 2px solid #bbb;
|
429 |
+
padding-bottom: 0.5em;
|
430 |
+
padding: 0.4em;
|
431 |
+
}
|
432 |
+
.w-bl .calendar_wrap caption{
|
433 |
+
font-size: 14px;
|
434 |
+
margin-bottom: 10px;
|
435 |
+
}
|
436 |
+
.w-bl form{
|
437 |
+
display:inline-flex;
|
438 |
+
flex-wrap:wrap;
|
439 |
+
align-items: center;
|
440 |
+
}
|
441 |
+
.w-bl .search-button{
|
442 |
+
border: 1px solid;
|
443 |
+
width: 10px;
|
444 |
+
height: 10px;
|
445 |
+
border-radius: 50%;
|
446 |
+
-webkit-transform: rotate(45deg);
|
447 |
+
-ms-transform: rotate(45deg);
|
448 |
+
transform: rotate(45deg);
|
449 |
+
margin: 4px 4px 8px 8px;
|
450 |
+
position: relative;
|
451 |
+
cursor: pointer;
|
452 |
+
}
|
453 |
+
.w-bl .search-button:after{
|
454 |
+
content: "";
|
455 |
+
position: absolute;
|
456 |
+
left: 50%;
|
457 |
+
-webkit-transform: rotate(270deg);
|
458 |
+
-ms-transform: rotate(270deg);
|
459 |
+
transform: rotate(270deg);
|
460 |
+
width: 2px;
|
461 |
+
height: 9px;
|
462 |
+
box-shadow: inset 0 0 0 32px;
|
463 |
+
top: 0px;
|
464 |
+
border-radius: 0 0 1px 1px;
|
465 |
+
left: 14px;
|
466 |
+
}
|
467 |
+
.w-bl .search-field{
|
468 |
+
border: 1px solid #ccc;
|
469 |
+
padding: 6px 10px;
|
470 |
+
}
|
471 |
+
<?php endif; ?>
|
472 |
+
@media(max-width:480px){
|
473 |
+
<?php if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
474 |
+
.f-w{ display: inline-block;}
|
475 |
+
.w-bl{flex:1 0 100%;}
|
476 |
+
<?php endif; ?>
|
477 |
+
}
|
478 |
+
<?php // Back to Top CSS //
|
479 |
+
if( true == ampforwp_get_setting('ampforwp-footer-top') ) { ?>
|
480 |
+
.btt{
|
481 |
+
position: fixed;
|
482 |
+
<?php if( (is_single() && true == ampforwp_get_setting('enable-single-social-icons') ) || (is_page() && true == ampforwp_get_setting('ampforwp-page-sticky-social') ) ){ ?>
|
483 |
+
bottom: 55px;
|
484 |
+
<?php } else { ?>
|
485 |
+
bottom: 20px;
|
486 |
+
<?php } ?>
|
487 |
+
right: 20px;
|
488 |
+
background: rgba(71, 71, 71, 0.5);
|
489 |
+
color: #fff;
|
490 |
+
border-radius: 100%;
|
491 |
+
width: 50px;
|
492 |
+
height: 50px;
|
493 |
+
}
|
494 |
+
.btt:hover{color:#fff;background:#474747;}
|
495 |
+
.btt:before{
|
496 |
+
content: '\25be';
|
497 |
+
display: block;
|
498 |
+
font-size: 35px;
|
499 |
+
font-weight: 600;
|
500 |
+
color:#fff;
|
501 |
+
transform: rotate(180deg);
|
502 |
+
text-align: center;
|
503 |
+
line-height: 1.4;
|
504 |
+
}
|
505 |
+
<?php } ?>
|
@@ -86,11 +86,21 @@
|
|
86 |
</ul>
|
87 |
</div>
|
88 |
<?php }
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
95 |
echo strip_tags( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_tags );
|
96 |
if ( '1' == $redux_builder_amp['amp-footer-link-non-amp-page'] ) {
|
86 |
</ul>
|
87 |
</div>
|
88 |
<?php }
|
89 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
90 |
+
<p class="rightslink back-to-top">
|
91 |
+
<?php amp_back_to_top_link();
|
92 |
+
if(true == ampforwp_get_setting('amp-footer-link-non-amp-page')){
|
93 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
94 |
+
| <?php ampforwp_view_nonamp();
|
95 |
+
}
|
96 |
+
else{
|
97 |
+
ampforwp_view_nonamp();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
$allowed_html = ampforwp_wp_kses_allowed_html();
|
101 |
+
echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer'),$allowed_html);
|
102 |
+
?> </p> <?php } ?>
|
103 |
+
<p class="rightslink"><?php
|
104 |
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
|
105 |
echo strip_tags( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_tags );
|
106 |
if ( '1' == $redux_builder_amp['amp-footer-link-non-amp-page'] ) {
|
@@ -20,9 +20,6 @@
|
|
20 |
$header_color = $get_customizer->get_customizer_setting( 'header_color' );
|
21 |
?>
|
22 |
|
23 |
-
/* Widgets styling */
|
24 |
-
.amp-wp-content.widget-wrapper { margin: 20px 17px 17px 17px;}
|
25 |
-
|
26 |
/* Global Styling */
|
27 |
body{ font: 16px/1.4 Sans-serif; }
|
28 |
a{ color: #312C7E; text-decoration: none }
|
@@ -173,7 +170,7 @@ body .amp-loop-list-noimg .amp-wp-post-content{ width:100% }
|
|
173 |
#footer .social_icons{ margin: 0px 20px 25px 20px; border-bottom: 1px solid #3c3c3c; padding-bottom: 25px; }
|
174 |
#footer p{ margin: 0 }
|
175 |
.back-to-top{padding-bottom: 8px;}
|
176 |
-
.rightslink, #footer .rightslink a{ font-size:13px; color:#
|
177 |
.poweredby{ padding-top:10px; font-size:10px; }
|
178 |
#footer .poweredby a{ color:#666 }
|
179 |
.footer_menu ul{ list-style-type: none; padding: 0; text-align: center; margin: 0px 20px 25px 20px; line-height: 27px; font-size: 13px }
|
@@ -521,4 +518,155 @@ if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
|
521 |
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
522 |
<?php }
|
523 |
echo $redux_builder_amp['css_editor'];
|
524 |
-
//} ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
$header_color = $get_customizer->get_customizer_setting( 'header_color' );
|
21 |
?>
|
22 |
|
|
|
|
|
|
|
23 |
/* Global Styling */
|
24 |
body{ font: 16px/1.4 Sans-serif; }
|
25 |
a{ color: #312C7E; text-decoration: none }
|
170 |
#footer .social_icons{ margin: 0px 20px 25px 20px; border-bottom: 1px solid #3c3c3c; padding-bottom: 25px; }
|
171 |
#footer p{ margin: 0 }
|
172 |
.back-to-top{padding-bottom: 8px;}
|
173 |
+
.rightslink, #footer .rightslink a{ font-size:13px; color:#fff }
|
174 |
.poweredby{ padding-top:10px; font-size:10px; }
|
175 |
#footer .poweredby a{ color:#666 }
|
176 |
.footer_menu ul{ list-style-type: none; padding: 0; text-align: center; margin: 0px 20px 25px 20px; line-height: 27px; font-size: 13px }
|
518 |
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
519 |
<?php }
|
520 |
echo $redux_builder_amp['css_editor'];
|
521 |
+
//} ?>
|
522 |
+
<?php
|
523 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-1')){?>
|
524 |
+
.amp-ad-1 {
|
525 |
+
max-width: 1000px;
|
526 |
+
}
|
527 |
+
<?php } ?>
|
528 |
+
<?php
|
529 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-2')){?>
|
530 |
+
.amp-ad-2 {
|
531 |
+
max-width: 1000px;
|
532 |
+
}
|
533 |
+
<?php } ?>
|
534 |
+
<?php
|
535 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-3')){?>
|
536 |
+
.amp-ad-3 {
|
537 |
+
max-width: 1000px;
|
538 |
+
}
|
539 |
+
<?php } ?>
|
540 |
+
<?php
|
541 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-4')){?>
|
542 |
+
.amp-ad-4 {
|
543 |
+
max-width: 1000px;
|
544 |
+
}
|
545 |
+
<?php } ?>
|
546 |
+
<?php
|
547 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-5')){?>
|
548 |
+
.amp-ad-5 {
|
549 |
+
max-width: 1000px;
|
550 |
+
}
|
551 |
+
<?php } ?>
|
552 |
+
<?php
|
553 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
|
554 |
+
.amp-ad-6 {
|
555 |
+
max-width: 1000px;
|
556 |
+
}
|
557 |
+
<?php } ?>
|
558 |
+
<?php // Widgets CSS
|
559 |
+
if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
560 |
+
.f-w{display: inline-flex;width:auto;flex-wrap:wrap;}
|
561 |
+
.w-bl{margin-left: 0;display: flex;flex-direction: column;position: relative;flex: 1 0 22%;margin:0 15px 30px;line-height:1.5;font-size:14px;}
|
562 |
+
.w-bl h4{font-size: <?php echo $redux_builder_amp['swift-head-size'] ?>;font-weight: <?php echo $redux_builder_amp['swift-head-fntwgth'] ?>;margin-bottom: 20px;text-transform: uppercase;letter-spacing: 1px;padding-bottom: 4px;}
|
563 |
+
.w-bl ul{padding:0;margin:0;}
|
564 |
+
.w-bl ul li{list-style-type: none;margin-bottom: 15px;}
|
565 |
+
.w-bl ul li:last-child{margin-bottom:0;}
|
566 |
+
.w-bl ul li a{text-decoration: none;}
|
567 |
+
.w-bl .menu li .sub-menu, .w-bl .lb-x{display:none;}
|
568 |
+
.w-bl table {
|
569 |
+
border-collapse: collapse;
|
570 |
+
margin: 0 0 1.5em;
|
571 |
+
width: 100%;
|
572 |
+
}
|
573 |
+
.w-bl tr {
|
574 |
+
border-bottom: 1px solid #eee;
|
575 |
+
}
|
576 |
+
.w-bl th, .w-bl td {
|
577 |
+
text-align: center;
|
578 |
+
}
|
579 |
+
.w-bl td {
|
580 |
+
padding: 0.4em;
|
581 |
+
}
|
582 |
+
.w-bl th:first-child, .w-bl td:first-child {
|
583 |
+
padding-left: 0;
|
584 |
+
}
|
585 |
+
.w-bl thead th {
|
586 |
+
border-bottom: 2px solid #bbb;
|
587 |
+
padding-bottom: 0.5em;
|
588 |
+
padding: 0.4em;
|
589 |
+
}
|
590 |
+
.w-bl .calendar_wrap caption{
|
591 |
+
font-size: 14px;
|
592 |
+
margin-bottom: 10px;
|
593 |
+
}
|
594 |
+
.w-bl form{
|
595 |
+
display:inline-flex;
|
596 |
+
flex-wrap:wrap;
|
597 |
+
align-items: center;
|
598 |
+
}
|
599 |
+
.w-bl .search-submit{
|
600 |
+
text-indent: -9999px;
|
601 |
+
padding: 0;
|
602 |
+
margin: 0;
|
603 |
+
background: transparent;
|
604 |
+
line-height: 0;
|
605 |
+
display: inline-block;
|
606 |
+
opacity: 0;
|
607 |
+
}
|
608 |
+
.w-bl .search-button{
|
609 |
+
border: 1px solid;
|
610 |
+
width: 10px;
|
611 |
+
height: 10px;
|
612 |
+
border-radius: 50%;
|
613 |
+
-webkit-transform: rotate(45deg);
|
614 |
+
-ms-transform: rotate(45deg);
|
615 |
+
transform: rotate(45deg);
|
616 |
+
margin: 4px 4px 8px 8px;
|
617 |
+
position: relative;
|
618 |
+
cursor: pointer;
|
619 |
+
}
|
620 |
+
.w-bl .search-button:after{
|
621 |
+
content: "";
|
622 |
+
position: absolute;
|
623 |
+
left: 50%;
|
624 |
+
-webkit-transform: rotate(270deg);
|
625 |
+
-ms-transform: rotate(270deg);
|
626 |
+
transform: rotate(270deg);
|
627 |
+
width: 2px;
|
628 |
+
height: 9px;
|
629 |
+
box-shadow: inset 0 0 0 32px;
|
630 |
+
top: 0px;
|
631 |
+
border-radius: 0 0 1px 1px;
|
632 |
+
left: 14px;
|
633 |
+
}
|
634 |
+
.w-bl .search-field{
|
635 |
+
border: 1px solid #ccc;
|
636 |
+
padding: 6px 10px;
|
637 |
+
}
|
638 |
+
<?php endif; ?>
|
639 |
+
@media(max-width:480px){
|
640 |
+
<?php if ( is_active_sidebar( 'ampforwp-above-footer' ) || is_active_sidebar( 'ampforwp-below-header' ) || is_active_sidebar( 'ampforwp-above-loop' ) || is_active_sidebar( 'ampforwp-below-loop' ) ) : ?>
|
641 |
+
.f-w{ display: inline-block;}
|
642 |
+
.w-bl{flex:1 0 100%;}
|
643 |
+
<?php endif; ?>
|
644 |
+
}
|
645 |
+
<?php // Back to Top CSS //
|
646 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
|
647 |
+
.btt{
|
648 |
+
position: fixed;
|
649 |
+
<?php if( (is_single() && true == ampforwp_get_setting('enable-single-social-icons') ) || (is_page() && true == ampforwp_get_setting('ampforwp-page-sticky-social') ) ){ ?>
|
650 |
+
bottom: 55px;
|
651 |
+
<?php } else { ?>
|
652 |
+
bottom: 20px;
|
653 |
+
<?php } ?>
|
654 |
+
right: 20px;
|
655 |
+
background: rgba(71, 71, 71, 0.5);
|
656 |
+
color: #fff;
|
657 |
+
border-radius: 100%;
|
658 |
+
width: 50px;
|
659 |
+
height: 50px;
|
660 |
+
}
|
661 |
+
.btt:hover{color:#fff;background:#474747;}
|
662 |
+
.btt:before{
|
663 |
+
content: '\25be';
|
664 |
+
display: block;
|
665 |
+
font-size: 35px;
|
666 |
+
font-weight: 600;
|
667 |
+
color:#fff;
|
668 |
+
transform: rotate(180deg);
|
669 |
+
text-align: center;
|
670 |
+
line-height: 1.4;
|
671 |
+
}
|
672 |
+
<?php } ?>
|
@@ -14,20 +14,12 @@ amp_header() ?>
|
|
14 |
if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
15 |
<div class="sdbr-right">
|
16 |
<?php
|
17 |
-
|
18 |
-
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
array(),
|
24 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
25 |
-
array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(),
|
26 |
-
)
|
27 |
-
)
|
28 |
-
);
|
29 |
-
$sanitized_footer_widget = $sanitizer_obj->get_amp_content();
|
30 |
-
echo $sanitized_footer_widget;// amphtml content, no kses
|
31 |
?>
|
32 |
</div>
|
33 |
<?php } ?>
|
14 |
if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
15 |
<div class="sdbr-right">
|
16 |
<?php
|
17 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
18 |
+
if ( $sanitized_sidebar) {
|
19 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
20 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
21 |
+
}
|
22 |
+
echo $sidebar_output;// amphtml content, no kses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
?>
|
24 |
</div>
|
25 |
<?php } ?>
|
@@ -7,32 +7,12 @@
|
|
7 |
<div class="cntr">
|
8 |
<div class="f-w">
|
9 |
<?php
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
13 |
}
|
14 |
-
|
15 |
-
dynamic_sidebar('swift-footer-widget-area');
|
16 |
-
$swift_footer_widget = ob_get_contents();
|
17 |
-
ob_end_clean();
|
18 |
-
$sanitizer_obj = new AMPFORWP_Content(
|
19 |
-
$swift_footer_widget,
|
20 |
-
array(),
|
21 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
22 |
-
array( 'AMP_Img_Sanitizer' => array(),
|
23 |
-
'AMP_Blacklist_Sanitizer' => array(),
|
24 |
-
'AMP_Style_Sanitizer' => array(),
|
25 |
-
'AMP_Video_Sanitizer' => array(),
|
26 |
-
'AMP_Audio_Sanitizer' => array(),
|
27 |
-
'AMP_Iframe_Sanitizer' => array(
|
28 |
-
'add_placeholder' => true,
|
29 |
-
),
|
30 |
-
)
|
31 |
-
)
|
32 |
-
);
|
33 |
-
$sanitized_footer_widget = $sanitizer_obj->get_amp_content();
|
34 |
-
$sanitized_footer_widget = apply_filters('ampforwp_modify_sidebars_content',$sanitized_footer_widget);
|
35 |
-
echo $sanitized_footer_widget; // amphtml content, no kses
|
36 |
?>
|
37 |
</div>
|
38 |
</div>
|
7 |
<div class="cntr">
|
8 |
<div class="f-w">
|
9 |
<?php
|
10 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
11 |
+
if ( $sanitized_sidebar) {
|
12 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
13 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
14 |
}
|
15 |
+
echo $sidebar_output; // amphtml content, no kses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
?>
|
17 |
</div>
|
18 |
</div>
|
@@ -66,20 +66,12 @@
|
|
66 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
67 |
<div class="sdbr-right">
|
68 |
<?php
|
69 |
-
|
70 |
-
|
71 |
-
$
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
array(),
|
76 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
77 |
-
array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(),
|
78 |
-
)
|
79 |
-
)
|
80 |
-
);
|
81 |
-
$sanitized_footer_widget = $sanitizer_obj->get_amp_content();
|
82 |
-
echo $sanitized_footer_widget; // amphtml content, no kses
|
83 |
?>
|
84 |
</div>
|
85 |
<?php } ?>
|
66 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
67 |
<div class="sdbr-right">
|
68 |
<?php
|
69 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
70 |
+
if ( $sanitized_sidebar) {
|
71 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
72 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
73 |
+
}
|
74 |
+
echo $sidebar_output; // amphtml content, no kses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
?>
|
76 |
</div>
|
77 |
<?php } ?>
|
@@ -22,20 +22,12 @@ amp_header(); ?>
|
|
22 |
</div>
|
23 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
24 |
<div class="sdbr-right"> <?php
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
array(),
|
32 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
33 |
-
array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(),
|
34 |
-
)
|
35 |
-
)
|
36 |
-
);
|
37 |
-
$sanitized_content = $sanitizer_obj->get_amp_content();
|
38 |
-
echo $sanitized_content; // amphtml content, no kses?>
|
39 |
</div>
|
40 |
<?php } ?>
|
41 |
</div><!-- /.cntr -->
|
22 |
</div>
|
23 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
24 |
<div class="sdbr-right"> <?php
|
25 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
26 |
+
if ( $sanitized_sidebar) {
|
27 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
28 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
29 |
+
}
|
30 |
+
echo $sidebar_output; // amphtml content, no kses?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
<?php } ?>
|
33 |
</div><!-- /.cntr -->
|
@@ -12,20 +12,12 @@ amp_header() ?>
|
|
12 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
13 |
<div class="sdbr-right">
|
14 |
<?php
|
15 |
-
|
16 |
-
|
17 |
-
$
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
array(),
|
22 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
23 |
-
array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(),
|
24 |
-
)
|
25 |
-
)
|
26 |
-
);
|
27 |
-
$sanitized_footer_widget = $sanitizer_obj->get_amp_content();
|
28 |
-
echo $sanitized_footer_widget; // amphtml content, no kses
|
29 |
?>
|
30 |
</div>
|
31 |
<?php } ?>
|
12 |
<?php if(isset($redux_builder_amp['gbl-sidebar']) && $redux_builder_amp['gbl-sidebar'] == '1'){ ?>
|
13 |
<div class="sdbr-right">
|
14 |
<?php
|
15 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
16 |
+
if ( $sanitized_sidebar) {
|
17 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
18 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
19 |
+
}
|
20 |
+
echo $sidebar_output; // amphtml content, no kses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
?>
|
22 |
</div>
|
23 |
<?php } ?>
|
@@ -423,27 +423,12 @@ do_action("ampforwp_single_design_type_handle");
|
|
423 |
<?php if ( is_active_sidebar( 'swift-sidebar' ) ) : ?>
|
424 |
<div class="sdbr-right">
|
425 |
<?php
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
array(),
|
433 |
-
apply_filters( 'ampforwp_content_sanitizers',
|
434 |
-
array( 'AMP_Img_Sanitizer' => array(),
|
435 |
-
'AMP_Style_Sanitizer' => array(),
|
436 |
-
'AMP_Blacklist_Sanitizer' => array(),
|
437 |
-
'AMP_Video_Sanitizer' => array(),
|
438 |
-
'AMP_Audio_Sanitizer' => array(),
|
439 |
-
'AMP_Iframe_Sanitizer' => array(
|
440 |
-
'add_placeholder' => true,
|
441 |
-
),
|
442 |
-
)
|
443 |
-
)
|
444 |
-
);
|
445 |
-
$sanitized_footer_widget = $sanitizer_obj->get_amp_content();
|
446 |
-
echo $sanitized_footer_widget; // amphtml content, no kses
|
447 |
?>
|
448 |
</div>
|
449 |
<?php endif; ?>
|
423 |
<?php if ( is_active_sidebar( 'swift-sidebar' ) ) : ?>
|
424 |
<div class="sdbr-right">
|
425 |
<?php
|
426 |
+
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
427 |
+
if ( $sanitized_sidebar) {
|
428 |
+
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
429 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
430 |
+
}
|
431 |
+
echo $sidebar_output; // amphtml content, no kses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
?>
|
433 |
</div>
|
434 |
<?php endif; ?>
|
@@ -10,10 +10,15 @@ body{<?php $fontFamily = "font-family: 'Poppins', sans-serif;";
|
|
10 |
if(isset($redux_builder_amp['amp_font_selector']) && $redux_builder_amp['amp_font_selector'] != 1 && !empty($redux_builder_amp['amp_font_selector'])){
|
11 |
$fontFamily = "font-family: '".$redux_builder_amp['amp_font_selector']."';"; }
|
12 |
echo $fontFamily;?>
|
|
|
|
|
|
|
|
|
|
|
13 |
font-size: 16px; line-height:1.25; }
|
14 |
ol, ul{ list-style-position: inside }
|
15 |
p, ol, ul, figure{ margin: 0 0 1em; padding: 0; }
|
16 |
-
a, a:active, a:visited{ text-decoration: none; color: <?php echo ampforwp_sanitize_color($
|
17 |
a:hover, a:active, a:focus{}
|
18 |
pre{ white-space: pre-wrap;}
|
19 |
.left{float:left}
|
@@ -49,7 +54,7 @@ header .cntr{
|
|
49 |
<?php }?>
|
50 |
}
|
51 |
<?php if($redux_builder_amp['amp-sticky-header'] == '1'){?>
|
52 |
-
.h_m{position:fixed;z-index:
|
53 |
<?php if($redux_builder_amp['swift-background-scheme']['rgba']){?>background: <?php echo $redux_builder_amp['swift-background-scheme'] ['rgba'] ?>;<?php }?>
|
54 |
<?php if($redux_builder_amp['swift-border-line-control']){?>border-bottom: <?php echo $redux_builder_amp['swift-border-line-control'] ?>px solid;<?php } ?>
|
55 |
<?php if($redux_builder_amp['swift-border-color-control']['rgba']){?>border-color:<?php echo ampforwp_sanitize_color($redux_builder_amp['swift-border-color-control'] ['rgba']) ?>;<?php } ?>
|
@@ -239,7 +244,7 @@ if( is_home() || is_archive() || is_search() || (function_exists('is_shop') && i
|
|
239 |
.loop-category li a{color:#555;text-transform: uppercase;}
|
240 |
.loop-category li:hover a{color:#005be2;}
|
241 |
.fbp-cnt p, .fsp-cnt p{color:#444;font-size:13px;line-height:1.5;letter-spacing: 0.10px;word-break: break-word;}
|
242 |
-
.fbp:hover h2 a, .fsp:hover h2 a{color: <?php echo ampforwp_sanitize_color($
|
243 |
.fsp h2 a{color:#191919;}
|
244 |
.fsp{margin: 15px;flex-basis: calc(33.33% - 30px);}
|
245 |
.fsp-img {margin-bottom:10px;}
|
@@ -1090,7 +1095,7 @@ if(isset($redux_builder_amp['ftr1-gapping'])){
|
|
1090 |
?>;
|
1091 |
width:100%; border-top: 1px solid <?php echo $redux_builder_amp['swift-footer-brdrclr']['rgba']?>;}
|
1092 |
<?php endif; ?>
|
1093 |
-
.f-w{display: inline-flex;width: 100%;flex-wrap:wrap;}
|
1094 |
.f-w-f2{text-align: center;border-top: 1px solid <?php echo $redux_builder_amp['swift-footer-brdrclr']['rgba']?>;
|
1095 |
padding:<?php
|
1096 |
if(isset($redux_builder_amp['ftr2-gapping'])){
|
@@ -1101,13 +1106,64 @@ if(isset($redux_builder_amp['ftr2-gapping'])){
|
|
1101 |
}
|
1102 |
?>;
|
1103 |
}
|
1104 |
-
.w-bl{margin-left: 0;display: flex;flex-direction: column;position: relative;flex: 1 0 22%;margin:0 15px 30px;line-height:1.5;}
|
1105 |
.w-bl h4{font-size: <?php echo $redux_builder_amp['swift-head-size'] ?>;font-weight: <?php echo $redux_builder_amp['swift-head-fntwgth'] ?>;margin-bottom: 20px;text-transform: uppercase;letter-spacing: 1px;padding-bottom: 4px;}
|
1106 |
.w-bl ul li, .ampforwp_wc_shortcode_title{list-style-type: none;margin-bottom: 15px;}
|
1107 |
.w-bl ul li:last-child{margin-bottom:0;}
|
1108 |
.w-bl ul li a{text-decoration: none;}
|
1109 |
-
.w-bl .menu li .sub-menu{display:none;}
|
1110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1111 |
.ampforwp_wc_shortcode_title{
|
1112 |
margin-top: 12px;
|
1113 |
display: inline-block;
|
@@ -1217,7 +1273,7 @@ else{ // Default Footer CSS ?>
|
|
1217 |
.f-w-f1 { padding: 45px 0px 10px 0px;}
|
1218 |
<?php endif; ?>
|
1219 |
.f-w-f2 {padding: 25px 0px;}
|
1220 |
-
.f-w{display:block;}
|
1221 |
.w-bl{margin-bottom:40px;}
|
1222 |
.w-bl{flex:100%;}
|
1223 |
.w-bl ul li {margin-bottom: 11px;}
|
@@ -1452,4 +1508,71 @@ a.lb-x{
|
|
1452 |
left:0;
|
1453 |
}
|
1454 |
.amp-ad-wrapper{direction:ltr;}
|
1455 |
-
<?php } //RTL End ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
if(isset($redux_builder_amp['amp_font_selector']) && $redux_builder_amp['amp_font_selector'] != 1 && !empty($redux_builder_amp['amp_font_selector'])){
|
11 |
$fontFamily = "font-family: '".$redux_builder_amp['amp_font_selector']."';"; }
|
12 |
echo $fontFamily;?>
|
13 |
+
<?php $swift_cs_color = '#005be2';
|
14 |
+
$swift_cs = ampforwp_get_setting('swift-color-scheme');
|
15 |
+
if( !empty($swift_cs['color']) ) {
|
16 |
+
$swift_cs_color = $swift_cs['color'];
|
17 |
+
}?>
|
18 |
font-size: 16px; line-height:1.25; }
|
19 |
ol, ul{ list-style-position: inside }
|
20 |
p, ol, ul, figure{ margin: 0 0 1em; padding: 0; }
|
21 |
+
a, a:active, a:visited{ text-decoration: none; color: <?php echo ampforwp_sanitize_color($swift_cs_color); ?>;}
|
22 |
a:hover, a:active, a:focus{}
|
23 |
pre{ white-space: pre-wrap;}
|
24 |
.left{float:left}
|
54 |
<?php }?>
|
55 |
}
|
56 |
<?php if($redux_builder_amp['amp-sticky-header'] == '1'){?>
|
57 |
+
.h_m{position:fixed;z-index:999;top:0px;width: 100vw;display:inline-block;
|
58 |
<?php if($redux_builder_amp['swift-background-scheme']['rgba']){?>background: <?php echo $redux_builder_amp['swift-background-scheme'] ['rgba'] ?>;<?php }?>
|
59 |
<?php if($redux_builder_amp['swift-border-line-control']){?>border-bottom: <?php echo $redux_builder_amp['swift-border-line-control'] ?>px solid;<?php } ?>
|
60 |
<?php if($redux_builder_amp['swift-border-color-control']['rgba']){?>border-color:<?php echo ampforwp_sanitize_color($redux_builder_amp['swift-border-color-control'] ['rgba']) ?>;<?php } ?>
|
244 |
.loop-category li a{color:#555;text-transform: uppercase;}
|
245 |
.loop-category li:hover a{color:#005be2;}
|
246 |
.fbp-cnt p, .fsp-cnt p{color:#444;font-size:13px;line-height:1.5;letter-spacing: 0.10px;word-break: break-word;}
|
247 |
+
.fbp:hover h2 a, .fsp:hover h2 a{color: <?php echo ampforwp_sanitize_color($swift_cs_color); ?>;}
|
248 |
.fsp h2 a{color:#191919;}
|
249 |
.fsp{margin: 15px;flex-basis: calc(33.33% - 30px);}
|
250 |
.fsp-img {margin-bottom:10px;}
|
1095 |
?>;
|
1096 |
width:100%; border-top: 1px solid <?php echo $redux_builder_amp['swift-footer-brdrclr']['rgba']?>;}
|
1097 |
<?php endif; ?>
|
1098 |
+
.f-w{display: inline-flex;width: 100%;flex-wrap:wrap;margin:15px -15px 0px;}
|
1099 |
.f-w-f2{text-align: center;border-top: 1px solid <?php echo $redux_builder_amp['swift-footer-brdrclr']['rgba']?>;
|
1100 |
padding:<?php
|
1101 |
if(isset($redux_builder_amp['ftr2-gapping'])){
|
1106 |
}
|
1107 |
?>;
|
1108 |
}
|
1109 |
+
.w-bl{margin-left: 0;display: flex;flex-direction: column;position: relative;flex: 1 0 22%;margin:0 15px 30px;line-height:1.5;font-size:14px;}
|
1110 |
.w-bl h4{font-size: <?php echo $redux_builder_amp['swift-head-size'] ?>;font-weight: <?php echo $redux_builder_amp['swift-head-fntwgth'] ?>;margin-bottom: 20px;text-transform: uppercase;letter-spacing: 1px;padding-bottom: 4px;}
|
1111 |
.w-bl ul li, .ampforwp_wc_shortcode_title{list-style-type: none;margin-bottom: 15px;}
|
1112 |
.w-bl ul li:last-child{margin-bottom:0;}
|
1113 |
.w-bl ul li a{text-decoration: none;}
|
1114 |
+
.w-bl .menu li .sub-menu, .w-bl .lb-x{display:none;}
|
1115 |
+
.w-bl .menu li .sub-menu, .w-bl .lb-x{display:none;}
|
1116 |
+
.w-bl table {
|
1117 |
+
border-collapse: collapse;
|
1118 |
+
margin: 0 0 1.5em;
|
1119 |
+
width: 100%;
|
1120 |
+
}
|
1121 |
+
.w-bl tr {
|
1122 |
+
border-bottom: 1px solid #eee;
|
1123 |
+
}
|
1124 |
+
.w-bl th, .w-bl td {
|
1125 |
+
text-align: center;
|
1126 |
+
}
|
1127 |
+
.w-bl td {
|
1128 |
+
padding: 0.4em;
|
1129 |
+
}
|
1130 |
+
.w-bl th:first-child, .w-bl td:first-child {
|
1131 |
+
padding-left: 0;
|
1132 |
+
}
|
1133 |
+
.w-bl thead th {
|
1134 |
+
border-bottom: 2px solid #bbb;
|
1135 |
+
padding-bottom: 0.5em;
|
1136 |
+
padding: 0.4em;
|
1137 |
+
}
|
1138 |
+
.w-bl .calendar_wrap caption{
|
1139 |
+
font-size: 14px;
|
1140 |
+
margin-bottom: 10px;
|
1141 |
+
}
|
1142 |
+
.w-bl form{
|
1143 |
+
display:inline-flex;
|
1144 |
+
flex-wrap:wrap;
|
1145 |
+
align-items: center;
|
1146 |
+
}
|
1147 |
+
.w-bl .search-submit{
|
1148 |
+
text-indent: -9999px;
|
1149 |
+
padding: 0;
|
1150 |
+
margin: 0;
|
1151 |
+
background: transparent;
|
1152 |
+
line-height: 0;
|
1153 |
+
display: inline-block;
|
1154 |
+
opacity: 0;
|
1155 |
+
}
|
1156 |
+
.w-bl .search-button:after{
|
1157 |
+
content: "\e8b6";
|
1158 |
+
display:inline-block;
|
1159 |
+
font-family: 'icomoon';
|
1160 |
+
font-size: 23px;
|
1161 |
+
cursor: pointer;
|
1162 |
+
}
|
1163 |
+
.w-bl .search-field{
|
1164 |
+
border: 1px solid #ccc;
|
1165 |
+
padding: 6px 10px;
|
1166 |
+
}
|
1167 |
.ampforwp_wc_shortcode_title{
|
1168 |
margin-top: 12px;
|
1169 |
display: inline-block;
|
1273 |
.f-w-f1 { padding: 45px 0px 10px 0px;}
|
1274 |
<?php endif; ?>
|
1275 |
.f-w-f2 {padding: 25px 0px;}
|
1276 |
+
.f-w{display:block;margin: 15px 0px 0px;}
|
1277 |
.w-bl{margin-bottom:40px;}
|
1278 |
.w-bl{flex:100%;}
|
1279 |
.w-bl ul li {margin-bottom: 11px;}
|
1508 |
left:0;
|
1509 |
}
|
1510 |
.amp-ad-wrapper{direction:ltr;}
|
1511 |
+
<?php } //RTL End ?>
|
1512 |
+
<?php
|
1513 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-1')){?>
|
1514 |
+
.amp-ad-1 {
|
1515 |
+
max-width: 1000px;
|
1516 |
+
}
|
1517 |
+
<?php } ?>
|
1518 |
+
<?php
|
1519 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-2')){?>
|
1520 |
+
.amp-ad-2 {
|
1521 |
+
max-width: 1000px;
|
1522 |
+
}
|
1523 |
+
<?php } ?>
|
1524 |
+
<?php
|
1525 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-3')){?>
|
1526 |
+
.amp-ad-3 {
|
1527 |
+
max-width: 1000px;
|
1528 |
+
}
|
1529 |
+
<?php } ?>
|
1530 |
+
<?php
|
1531 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-4')){?>
|
1532 |
+
.amp-ad-4 {
|
1533 |
+
max-width: 1000px;
|
1534 |
+
}
|
1535 |
+
<?php } ?>
|
1536 |
+
<?php
|
1537 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-5')){?>
|
1538 |
+
.amp-ad-5 {
|
1539 |
+
max-width: 1000px;
|
1540 |
+
}
|
1541 |
+
<?php } ?>
|
1542 |
+
<?php
|
1543 |
+
if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
|
1544 |
+
.amp-ad-6 {
|
1545 |
+
max-width: 1000px;
|
1546 |
+
}
|
1547 |
+
<?php } ?>
|
1548 |
+
<?php // Back to Top CSS //
|
1549 |
+
if( true == ampforwp_get_setting('ampforwp-footer-top') ) { ?>
|
1550 |
+
|
1551 |
+
.btt{
|
1552 |
+
position: fixed;
|
1553 |
+
<?php if( (is_single() && true == ampforwp_get_setting('enable-single-social-icons') ) || (is_page() && true == ampforwp_get_setting('ampforwp-page-sticky-social') ) ){ ?>
|
1554 |
+
bottom: 55px;
|
1555 |
+
<?php } else { ?>
|
1556 |
+
bottom: 20px;
|
1557 |
+
<?php } ?>
|
1558 |
+
right: 20px;
|
1559 |
+
padding: 10px;
|
1560 |
+
background: rgba(71, 71, 71, 0.5);
|
1561 |
+
color: #fff;
|
1562 |
+
border-radius: 100%;
|
1563 |
+
width: 50px;
|
1564 |
+
height: 50px;
|
1565 |
+
}
|
1566 |
+
.btt:hover{color:#fff;background:#474747;}
|
1567 |
+
.btt:before{
|
1568 |
+
content: "\e316";
|
1569 |
+
font-family: 'icomoon';
|
1570 |
+
display:block;
|
1571 |
+
font-size: 30px;
|
1572 |
+
font-weight: 600;
|
1573 |
+
color:#fff;
|
1574 |
+
text-align: center;
|
1575 |
+
line-height: 1;
|
1576 |
+
}
|
1577 |
+
.rr a#scrollToTopButton{color:#fff;}
|
1578 |
+
<?php } ?>
|
@@ -1454,7 +1454,7 @@ function ampforwp_new_dir( $dir ) {
|
|
1454 |
// Removing the type attribute from the <ul> (Improved after 0.9.63)
|
1455 |
$content = preg_replace('/<ul(.*?)\btype=".*?"(.*?)/','<ul $1',$content);
|
1456 |
//Convert the Twitter embed into url for better sanitization #1010
|
1457 |
-
$content = preg_replace('/<blockquote
|
1458 |
// Convert the Soundcloud embed into URL to build amp-soundcloud
|
1459 |
$content = preg_replace('/<iframe .*(https?).*(\/\/api\.soundcloud\.com\/tracks\/)([0-9]+)(.*)<\/iframe>/', "$1:$2$3", $content);
|
1460 |
// for readability attibute in div tag
|
@@ -1644,28 +1644,6 @@ function ampforwp_new_dir( $dir ) {
|
|
1644 |
/**
|
1645 |
* Adds a meta box to the post editing screen for AMP on-off on specific pages
|
1646 |
*/
|
1647 |
-
function ampforwp_get_all_post_types(){
|
1648 |
-
global $redux_builder_amp;
|
1649 |
-
$post_types = array();
|
1650 |
-
$selected_post_types = array();
|
1651 |
-
if(ampforwp_get_setting('amp-on-off-for-all-posts')){
|
1652 |
-
$post_type['post'] = 'post';
|
1653 |
-
}
|
1654 |
-
if(ampforwp_get_setting('amp-on-off-for-all-pages')){
|
1655 |
-
$post_type['page'] = 'page';
|
1656 |
-
}
|
1657 |
-
$post_types = array('post' => 'post', 'page' => 'page');
|
1658 |
-
if ( isset($redux_builder_amp['ampforwp-custom-type']) && $redux_builder_amp['ampforwp-custom-type'] ) {
|
1659 |
-
|
1660 |
-
foreach ($redux_builder_amp['ampforwp-custom-type'] as $key) {
|
1661 |
-
$selected_post_types[$key] = $key;
|
1662 |
-
}
|
1663 |
-
$post_types = array_merge($post_types, $selected_post_types);
|
1664 |
-
}
|
1665 |
-
|
1666 |
-
return $post_types;
|
1667 |
-
}
|
1668 |
-
|
1669 |
function ampforwp_title_custom_meta() {
|
1670 |
global $redux_builder_amp;
|
1671 |
|
@@ -2506,7 +2484,7 @@ add_action('amp_post_template_include_single','ampforwp_update_title_for_frontpa
|
|
2506 |
function ampforwp_update_title_for_frontpage() {
|
2507 |
$check_custom_front_page = get_option('show_on_front');
|
2508 |
|
2509 |
-
if ( $check_custom_front_page == 'page' &&
|
2510 |
|
2511 |
remove_action( 'amp_post_template_head', 'amp_post_template_add_title' );
|
2512 |
add_action('amp_post_template_head','ampforwp_frontpage_title_markup');
|
@@ -3018,6 +2996,16 @@ function ampforwp_auto_flush_on_save($redux_builder_amp) {
|
|
3018 |
global $wp_rewrite;
|
3019 |
$wp_rewrite->flush_rules();
|
3020 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3021 |
}
|
3022 |
add_action("redux/options/redux_builder_amp/saved",'ampforwp_auto_flush_on_save', 10, 1);
|
3023 |
|
@@ -3106,9 +3094,18 @@ function ampforwp_output_widget_content_above_loop() {
|
|
3106 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
|
3107 |
if ( $sanitized_sidebar) {
|
3108 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3109 |
-
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content'
|
3110 |
-
}
|
3111 |
-
if ( $sidebar_output) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3112 |
}
|
3113 |
|
3114 |
add_action( 'ampforwp_home_below_loop' , 'ampforwp_output_widget_content_below_loop' );
|
@@ -3119,9 +3116,15 @@ function ampforwp_output_widget_content_below_loop() {
|
|
3119 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
|
3120 |
if ( $sanitized_sidebar) {
|
3121 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3122 |
-
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content'
|
3123 |
}
|
3124 |
-
if ( $sidebar_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
3125 |
}
|
3126 |
|
3127 |
add_action( 'ampforwp_after_header' , 'ampforwp_output_widget_content_below_the_header' );
|
@@ -3132,12 +3135,15 @@ function ampforwp_output_widget_content_below_the_header() {
|
|
3132 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
|
3133 |
if ( $sanitized_sidebar) {
|
3134 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3135 |
-
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content'
|
3136 |
}
|
3137 |
if ( $sidebar_output ) { ?>
|
3138 |
<div class="amp-wp-content widget-wrapper">
|
3139 |
-
|
3140 |
-
|
|
|
|
|
|
|
3141 |
</div>
|
3142 |
<?php }
|
3143 |
}
|
@@ -3149,12 +3155,15 @@ function ampforwp_output_widget_content_above_the_footer() {
|
|
3149 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
|
3150 |
if ( $sanitized_sidebar) {
|
3151 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3152 |
-
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content'
|
3153 |
}
|
3154 |
if ( $sidebar_output ) { ?>
|
3155 |
<div class="amp-wp-content widget-wrapper">
|
3156 |
-
|
3157 |
-
|
|
|
|
|
|
|
3158 |
</div>
|
3159 |
<?php }
|
3160 |
}
|
@@ -3202,9 +3211,9 @@ function ampforwp_sidebar_content_sanitizer($sidebar){
|
|
3202 |
) ), array('non-content'=>'non-content')
|
3203 |
);
|
3204 |
}
|
3205 |
-
|
|
|
3206 |
if ( is_active_widget(false,false,'search') && $sanitized_sidebar) {
|
3207 |
-
add_filter('amp_blacklisted_tags','ampforwp_sidebar_blacklist_tags');
|
3208 |
add_filter('ampforwp_modify_sidebars_content','ampforwp_modified_search_sidebar');
|
3209 |
}
|
3210 |
return $sanitized_sidebar;
|
@@ -3239,6 +3248,29 @@ function ampforwp_modified_search_sidebar( $content ) {
|
|
3239 |
$element->setAttribute('target', '_top');
|
3240 |
}
|
3241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3242 |
$content = AMP_DOM_Utils::get_content_from_dom($dom);
|
3243 |
return $content;
|
3244 |
}
|
@@ -3267,15 +3299,19 @@ function ampforwp_sidebar_blacklist_tags($tags) {
|
|
3267 |
// Sidebar Scripts
|
3268 |
add_filter( 'amp_post_template_data', 'ampforwp_add_sidebar_data' );
|
3269 |
function ampforwp_add_sidebar_data( $data ) {
|
3270 |
-
$sanitized_data_above_loop
|
3271 |
-
$sanitized_data_below_loop
|
3272 |
-
$sanitized_data_below_header
|
3273 |
-
$sanitized_data_above_footer
|
|
|
|
|
3274 |
// Get the Data
|
3275 |
$sanitized_data_above_loop = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
|
3276 |
$sanitized_data_below_loop = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
|
3277 |
$sanitized_data_below_header = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
|
3278 |
$sanitized_data_above_footer = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
|
|
|
|
|
3279 |
|
3280 |
if ( $sanitized_data_above_loop ) {
|
3281 |
// Add Scripts
|
@@ -3285,6 +3321,13 @@ function ampforwp_add_sidebar_data( $data ) {
|
|
3285 |
$data['amp_component_scripts'][$key] = $value;
|
3286 |
}
|
3287 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3288 |
}
|
3289 |
// Add Styles
|
3290 |
if ( $sanitized_data_above_loop->get_amp_styles() ) {
|
@@ -3303,6 +3346,13 @@ function ampforwp_add_sidebar_data( $data ) {
|
|
3303 |
$data['amp_component_scripts'][$key] = $value;
|
3304 |
}
|
3305 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3306 |
}
|
3307 |
// Add Styles
|
3308 |
if ( $sanitized_data_below_loop->get_amp_styles() ) {
|
@@ -3321,6 +3371,13 @@ function ampforwp_add_sidebar_data( $data ) {
|
|
3321 |
$data['amp_component_scripts'][$key] = $value;
|
3322 |
}
|
3323 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3324 |
}
|
3325 |
// Add Styles
|
3326 |
if ( $sanitized_data_below_header->get_amp_styles() ) {
|
@@ -3339,6 +3396,13 @@ function ampforwp_add_sidebar_data( $data ) {
|
|
3339 |
$data['amp_component_scripts'][$key] = $value;
|
3340 |
}
|
3341 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3342 |
}
|
3343 |
// Add Styles
|
3344 |
if ( $sanitized_data_above_footer->get_amp_styles() ) {
|
@@ -3349,6 +3413,56 @@ function ampforwp_add_sidebar_data( $data ) {
|
|
3349 |
}
|
3350 |
}
|
3351 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3352 |
return $data;
|
3353 |
}
|
3354 |
// 44. auto adding /amp for the menu
|
@@ -4563,12 +4677,12 @@ function ampforwp_posts_to_remove () {
|
|
4563 |
$selected_cats = array();
|
4564 |
$post_id_array = array();
|
4565 |
$current_cats_ids = array();
|
4566 |
-
if(isset($redux_builder_amp['hide-amp-
|
4567 |
-
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-
|
4568 |
if($get_categories_from_checkbox){
|
4569 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
4570 |
foreach ($get_selected_cats as $key => $value) {
|
4571 |
-
$selected_cats[] = $
|
4572 |
}
|
4573 |
}
|
4574 |
$current_cats = get_the_category(get_the_ID());
|
@@ -4581,8 +4695,8 @@ function ampforwp_posts_to_remove () {
|
|
4581 |
return true;
|
4582 |
}
|
4583 |
}
|
4584 |
-
if( is_array($redux_builder_amp['hide-amp-tags-bulk-
|
4585 |
-
$get_tags_checkbox =
|
4586 |
$all_tags = get_the_tags(get_the_ID());
|
4587 |
$tagsOnPost = array();
|
4588 |
if ( $all_tags ) {
|
@@ -4603,13 +4717,13 @@ if ( ! function_exists('ampforwp_exclude_archive') ) {
|
|
4603 |
global $redux_builder_amp;
|
4604 |
$exclude = array();
|
4605 |
// Categories
|
4606 |
-
if ( isset($redux_builder_amp['hide-amp-
|
4607 |
-
$exclude =
|
4608 |
return $exclude;
|
4609 |
}
|
4610 |
// Tags
|
4611 |
-
if ( isset($redux_builder_amp['hide-amp-tags-bulk-
|
4612 |
-
$exclude =
|
4613 |
return $exclude;
|
4614 |
}
|
4615 |
}
|
@@ -4710,6 +4824,7 @@ function ampforwp_add_blacklist_sanitizer($data){
|
|
4710 |
function ampforwp_generate_meta_desc($json=""){
|
4711 |
global $post, $redux_builder_amp;
|
4712 |
$desc = $post_id = '';
|
|
|
4713 |
if ( $redux_builder_amp['ampforwp-seo-meta-description'] ) {
|
4714 |
if ( ampforwp_is_home() || ampforwp_is_blog() ) {
|
4715 |
$desc = addslashes( strip_tags( get_bloginfo( 'description' ) ) );
|
@@ -4764,11 +4879,20 @@ function ampforwp_generate_meta_desc($json=""){
|
|
4764 |
if ( class_exists('All_in_One_SEO_Pack') && 2 == $redux_builder_amp['ampforwp-seo-selection'] ) {
|
4765 |
$aisop_class = $aisop_desc = $opts = '';
|
4766 |
$aisop_class = new All_in_One_SEO_Pack();
|
4767 |
-
|
|
|
|
|
|
|
|
|
4768 |
$opts = $aisop_class->get_current_options( array(), 'aiosp' );
|
4769 |
if ( (is_category() || is_tax() || is_tag()) && $aisop_class->show_page_description() ) {
|
4770 |
$aisop_desc = $opts['aiosp_description'];
|
4771 |
}
|
|
|
|
|
|
|
|
|
|
|
4772 |
if ( $aisop_desc ) {
|
4773 |
$desc = $aisop_desc;
|
4774 |
}
|
@@ -4849,7 +4973,7 @@ function is_category_amp_disabled(){
|
|
4849 |
global $redux_builder_amp;
|
4850 |
$current_cats_ids = $selected_cats = array();
|
4851 |
if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==1){
|
4852 |
-
if(is_tag() && is_array($redux_builder_amp['hide-amp-tags-bulk-
|
4853 |
$all_tags = get_the_tags();
|
4854 |
$tagsOnPost = array();
|
4855 |
if ( $all_tags ) {
|
@@ -4857,7 +4981,7 @@ function is_category_amp_disabled(){
|
|
4857 |
$tagsOnPost[] = $tagsvalue->term_id;
|
4858 |
}
|
4859 |
}
|
4860 |
-
$get_tags_checkbox =
|
4861 |
|
4862 |
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
4863 |
return true;
|
@@ -4868,12 +4992,12 @@ function is_category_amp_disabled(){
|
|
4868 |
}//tags check area closed
|
4869 |
$categories = get_the_category();
|
4870 |
if ( $categories) {
|
4871 |
-
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-
|
4872 |
// Check if $get_categories_from_checkbox has some cats then only show
|
4873 |
if ( $get_categories_from_checkbox ) {
|
4874 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
4875 |
foreach ($get_selected_cats as $key => $value) {
|
4876 |
-
$selected_cats[] = $
|
4877 |
}
|
4878 |
foreach ($categories as $key => $cats) {
|
4879 |
$current_cats_ids[] =$cats->cat_ID;
|
@@ -6271,7 +6395,7 @@ function ampforwp_url_controller( $url, $nonamp = '' ) {
|
|
6271 |
} else {
|
6272 |
$new_url = add_query_arg( 'amp', '1', $url );
|
6273 |
}
|
6274 |
-
return esc_url( $new_url );
|
6275 |
}
|
6276 |
// 99. Merriweather Font Management
|
6277 |
add_filter( 'amp_post_template_data', 'ampforwp_merriweather_font_management' );
|
@@ -6601,17 +6725,58 @@ if ( ! function_exists( 'ampforwp_google_fonts_generator' ) ) {
|
|
6601 |
}
|
6602 |
|
6603 |
function swifttheme_footer_widgets_init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6604 |
if(ampforwp_design_selector()==4){
|
6605 |
register_sidebar( array(
|
6606 |
'name' => esc_html__( 'AMP Footer', 'accelerated-mobile-pages' ),
|
6607 |
'id' => 'swift-footer-widget-area',
|
6608 |
-
'description' => esc_html__( '
|
6609 |
'class'=>'w-bl',
|
6610 |
'before_widget' => '<div class="w-bl">',
|
6611 |
'after_widget' => '</div>',
|
6612 |
'before_title' => '<h4>',
|
6613 |
'after_title' => '</h4>',
|
6614 |
) );
|
|
|
6615 |
register_sidebar( array(
|
6616 |
'name' => esc_html__( 'AMP Sidebar', 'accelerated-mobile-pages' ),
|
6617 |
'id' => 'swift-sidebar',
|
@@ -6630,6 +6795,8 @@ add_action( 'init', 'swifttheme_footer_widgets_init' );
|
|
6630 |
function ampforwp_is_non_amp( $type="" ) {
|
6631 |
global $redux_builder_amp;
|
6632 |
$non_amp = false;
|
|
|
|
|
6633 |
if ( false !== get_query_var( 'amp', false ) ) {
|
6634 |
return false;
|
6635 |
}
|
@@ -6668,10 +6835,7 @@ function ampforwp_is_non_amp( $type="" ) {
|
|
6668 |
if ( is_feed() ) {
|
6669 |
return false;
|
6670 |
}
|
6671 |
-
|
6672 |
-
if($ampforwp_amp_post_on_off_meta == 'hide-amp'){
|
6673 |
-
return false;
|
6674 |
-
}
|
6675 |
}elseif( (
|
6676 |
ampforwp_get_setting('amp-design-selector') == 4)
|
6677 |
&&
|
@@ -6694,9 +6858,15 @@ function ampforwp_is_non_amp( $type="" ) {
|
|
6694 |
return;
|
6695 |
}
|
6696 |
// Pages
|
6697 |
-
|
6698 |
-
|
6699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6700 |
// Removing the AMP on login register etc of Theme My Login plugin
|
6701 |
|
6702 |
if (function_exists('tml_register_default_actions')){
|
@@ -7250,7 +7420,15 @@ function ampforwp_check_excerpt(){
|
|
7250 |
// Back to top
|
7251 |
add_action( 'ampforwp_body_beginning' ,'ampforwp_back_to_top_markup');
|
7252 |
function ampforwp_back_to_top_markup(){
|
7253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7254 |
}
|
7255 |
|
7256 |
|
@@ -7476,4 +7654,52 @@ $new_filetypes['svg'] = 'image/svg+xml';
|
|
7476 |
$file_types = array_merge($file_types, $new_filetypes );
|
7477 |
return $file_types;
|
7478 |
}
|
7479 |
-
add_action('upload_mimes', 'ampforwp_upload_svg');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
// Removing the type attribute from the <ul> (Improved after 0.9.63)
|
1455 |
$content = preg_replace('/<ul(.*?)\btype=".*?"(.*?)/','<ul $1',$content);
|
1456 |
//Convert the Twitter embed into url for better sanitization #1010
|
1457 |
+
$content = preg_replace('/<blockquote(\s)class="twitter-(.*?)"[^>](.*?)<a href="(https:\/\/twitter.com\/)(.*?)">(.*?)<\/blockquote>/si', "https://twitter.com/$5", $content);
|
1458 |
// Convert the Soundcloud embed into URL to build amp-soundcloud
|
1459 |
$content = preg_replace('/<iframe .*(https?).*(\/\/api\.soundcloud\.com\/tracks\/)([0-9]+)(.*)<\/iframe>/', "$1:$2$3", $content);
|
1460 |
// for readability attibute in div tag
|
1644 |
/**
|
1645 |
* Adds a meta box to the post editing screen for AMP on-off on specific pages
|
1646 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1647 |
function ampforwp_title_custom_meta() {
|
1648 |
global $redux_builder_amp;
|
1649 |
|
2484 |
function ampforwp_update_title_for_frontpage() {
|
2485 |
$check_custom_front_page = get_option('show_on_front');
|
2486 |
|
2487 |
+
if ( $check_custom_front_page == 'page' && ampforwp_is_home() ) {
|
2488 |
|
2489 |
remove_action( 'amp_post_template_head', 'amp_post_template_add_title' );
|
2490 |
add_action('amp_post_template_head','ampforwp_frontpage_title_markup');
|
2996 |
global $wp_rewrite;
|
2997 |
$wp_rewrite->flush_rules();
|
2998 |
}
|
2999 |
+
$options = $new_options = array();
|
3000 |
+
if ( is_array($redux_builder_amp['hide-amp-categories']) && !is_array($redux_builder_amp['hide-amp-categories2'])) {
|
3001 |
+
$options = array_keys(array_filter($redux_builder_amp['hide-amp-categories'] ) );
|
3002 |
+
foreach ($options as $option ) {
|
3003 |
+
$new_options[] = $option;
|
3004 |
+
}
|
3005 |
+
$redux_builder_amp['hide-amp-categories2'] = $new_options;
|
3006 |
+
$redux_builder_amp['hide-amp-categories'] = '';
|
3007 |
+
update_option('redux_builder_amp',$redux_builder_amp);
|
3008 |
+
}
|
3009 |
}
|
3010 |
add_action("redux/options/redux_builder_amp/saved",'ampforwp_auto_flush_on_save', 10, 1);
|
3011 |
|
3094 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
|
3095 |
if ( $sanitized_sidebar) {
|
3096 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3097 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
|
3098 |
+
}
|
3099 |
+
if ( $sidebar_output ) { ?>
|
3100 |
+
<div class="cntr">
|
3101 |
+
<div class="amp-wp-content widget-wrapper amp_widget_above_loop">
|
3102 |
+
<div class="f-w">
|
3103 |
+
<?php echo do_shortcode($sidebar_output); ?>
|
3104 |
+
<div style="clear:both"></div>
|
3105 |
+
</div>
|
3106 |
+
</div>
|
3107 |
+
</div>
|
3108 |
+
<?php }
|
3109 |
}
|
3110 |
|
3111 |
add_action( 'ampforwp_home_below_loop' , 'ampforwp_output_widget_content_below_loop' );
|
3116 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
|
3117 |
if ( $sanitized_sidebar) {
|
3118 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3119 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
|
3120 |
}
|
3121 |
+
if ( $sidebar_output ) { ?>
|
3122 |
+
<div class="amp-wp-content widget-wrapper">
|
3123 |
+
<div class="amp_widget_below_loop f-w">
|
3124 |
+
<?php echo do_shortcode($sidebar_output); ?>
|
3125 |
+
</div>
|
3126 |
+
</div>
|
3127 |
+
<?php }
|
3128 |
}
|
3129 |
|
3130 |
add_action( 'ampforwp_after_header' , 'ampforwp_output_widget_content_below_the_header' );
|
3135 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
|
3136 |
if ( $sanitized_sidebar) {
|
3137 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3138 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
|
3139 |
}
|
3140 |
if ( $sidebar_output ) { ?>
|
3141 |
<div class="amp-wp-content widget-wrapper">
|
3142 |
+
<div class="cntr">
|
3143 |
+
<div class="amp_widget_below_the_header f-w">
|
3144 |
+
<?php echo do_shortcode($sidebar_output); ?>
|
3145 |
+
</div>
|
3146 |
+
</div>
|
3147 |
</div>
|
3148 |
<?php }
|
3149 |
}
|
3155 |
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
|
3156 |
if ( $sanitized_sidebar) {
|
3157 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
3158 |
+
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
|
3159 |
}
|
3160 |
if ( $sidebar_output ) { ?>
|
3161 |
<div class="amp-wp-content widget-wrapper">
|
3162 |
+
<div class="cntr">
|
3163 |
+
<div class="amp_widget_above_the_footer f-w">
|
3164 |
+
<?php echo do_shortcode($sidebar_output); ?>
|
3165 |
+
</div>
|
3166 |
+
</div>
|
3167 |
</div>
|
3168 |
<?php }
|
3169 |
}
|
3211 |
) ), array('non-content'=>'non-content')
|
3212 |
);
|
3213 |
}
|
3214 |
+
// Allow some blacklisted tags #1400
|
3215 |
+
add_filter('amp_blacklisted_tags','ampforwp_sidebar_blacklist_tags');
|
3216 |
if ( is_active_widget(false,false,'search') && $sanitized_sidebar) {
|
|
|
3217 |
add_filter('ampforwp_modify_sidebars_content','ampforwp_modified_search_sidebar');
|
3218 |
}
|
3219 |
return $sanitized_sidebar;
|
3248 |
$element->setAttribute('target', '_top');
|
3249 |
}
|
3250 |
}
|
3251 |
+
// Remove http/https from Audio and Video URLs #1400
|
3252 |
+
$video_nodes = $dom->getElementsByTagName( 'amp-video' );
|
3253 |
+
$num_nodes = $video_nodes->length;
|
3254 |
+
if ( 0 !== $num_nodes ) {
|
3255 |
+
for ( $i = 0; $i < $video_nodes->length; ++$i ) {
|
3256 |
+
$element = $video_nodes->item( $i );
|
3257 |
+
$source = $element->childNodes->item(0);
|
3258 |
+
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
|
3259 |
+
$source = $element->childNodes->item(1);
|
3260 |
+
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
|
3261 |
+
}
|
3262 |
+
}
|
3263 |
+
$audio = $dom->getElementsByTagName( 'amp-audio' );
|
3264 |
+
$num_nodes = $audio->length;
|
3265 |
+
if ( 0 !== $num_nodes ) {
|
3266 |
+
for ( $i = 0; $i < $audio->length; ++$i ) {
|
3267 |
+
$element = $audio->item( $i );
|
3268 |
+
$source = $element->childNodes->item(0);
|
3269 |
+
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
|
3270 |
+
$source = $element->childNodes->item(1);
|
3271 |
+
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
|
3272 |
+
}
|
3273 |
+
}
|
3274 |
$content = AMP_DOM_Utils::get_content_from_dom($dom);
|
3275 |
return $content;
|
3276 |
}
|
3299 |
// Sidebar Scripts
|
3300 |
add_filter( 'amp_post_template_data', 'ampforwp_add_sidebar_data' );
|
3301 |
function ampforwp_add_sidebar_data( $data ) {
|
3302 |
+
$sanitized_data_above_loop = '';
|
3303 |
+
$sanitized_data_below_loop = '';
|
3304 |
+
$sanitized_data_below_header = '';
|
3305 |
+
$sanitized_data_above_footer = '';
|
3306 |
+
$sanitized_data_swift_sidebar = '';
|
3307 |
+
$sanitized_data_swift_footer = '';
|
3308 |
// Get the Data
|
3309 |
$sanitized_data_above_loop = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
|
3310 |
$sanitized_data_below_loop = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
|
3311 |
$sanitized_data_below_header = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
|
3312 |
$sanitized_data_above_footer = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
|
3313 |
+
$sanitized_data_swift_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
|
3314 |
+
$sanitized_data_swift_footer = ampforwp_sidebar_content_sanitizer('swift-footer-widget-area');
|
3315 |
|
3316 |
if ( $sanitized_data_above_loop ) {
|
3317 |
// Add Scripts
|
3321 |
$data['amp_component_scripts'][$key] = $value;
|
3322 |
}
|
3323 |
}
|
3324 |
+
// Form script #1400
|
3325 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_above_loop->get_amp_content());
|
3326 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3327 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3328 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3329 |
+
}
|
3330 |
+
}
|
3331 |
}
|
3332 |
// Add Styles
|
3333 |
if ( $sanitized_data_above_loop->get_amp_styles() ) {
|
3346 |
$data['amp_component_scripts'][$key] = $value;
|
3347 |
}
|
3348 |
}
|
3349 |
+
// Form script #1400
|
3350 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_below_loop->get_amp_content());
|
3351 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3352 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3353 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3354 |
+
}
|
3355 |
+
}
|
3356 |
}
|
3357 |
// Add Styles
|
3358 |
if ( $sanitized_data_below_loop->get_amp_styles() ) {
|
3371 |
$data['amp_component_scripts'][$key] = $value;
|
3372 |
}
|
3373 |
}
|
3374 |
+
// Form script #1400
|
3375 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_below_header->get_amp_content());
|
3376 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3377 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3378 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3379 |
+
}
|
3380 |
+
}
|
3381 |
}
|
3382 |
// Add Styles
|
3383 |
if ( $sanitized_data_below_header->get_amp_styles() ) {
|
3396 |
$data['amp_component_scripts'][$key] = $value;
|
3397 |
}
|
3398 |
}
|
3399 |
+
// Form script #1400
|
3400 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_above_footer->get_amp_content());
|
3401 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3402 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3403 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3404 |
+
}
|
3405 |
+
}
|
3406 |
}
|
3407 |
// Add Styles
|
3408 |
if ( $sanitized_data_above_footer->get_amp_styles() ) {
|
3413 |
}
|
3414 |
}
|
3415 |
}
|
3416 |
+
if ( $sanitized_data_swift_sidebar ) {
|
3417 |
+
// Add Scripts
|
3418 |
+
if ( $sanitized_data_swift_sidebar->get_amp_scripts() ) {
|
3419 |
+
foreach ($sanitized_data_swift_sidebar->get_amp_scripts() as $key => $value ) {
|
3420 |
+
if( empty( $data['amp_component_scripts'][$key] ) ){
|
3421 |
+
$data['amp_component_scripts'][$key] = $value;
|
3422 |
+
}
|
3423 |
+
}
|
3424 |
+
// Form script #1400
|
3425 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_swift_sidebar->get_amp_content());
|
3426 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3427 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3428 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3429 |
+
}
|
3430 |
+
}
|
3431 |
+
}
|
3432 |
+
// Add Styles
|
3433 |
+
if ( $sanitized_data_swift_sidebar->get_amp_styles() ) {
|
3434 |
+
foreach ($sanitized_data_swift_sidebar->get_amp_styles() as $key => $value ) {
|
3435 |
+
if( empty( $data['post_amp_styles'][$key] ) ){
|
3436 |
+
$data['post_amp_styles'][$key] = $value;
|
3437 |
+
}
|
3438 |
+
}
|
3439 |
+
}
|
3440 |
+
}
|
3441 |
+
if ( $sanitized_data_swift_footer ) {
|
3442 |
+
// Add Scripts
|
3443 |
+
if ( $sanitized_data_swift_footer->get_amp_scripts() ) {
|
3444 |
+
foreach ($sanitized_data_swift_footer->get_amp_scripts() as $key => $value ) {
|
3445 |
+
if( empty( $data['amp_component_scripts'][$key] ) ){
|
3446 |
+
$data['amp_component_scripts'][$key] = $value;
|
3447 |
+
}
|
3448 |
+
}
|
3449 |
+
// Form script #1400
|
3450 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_swift_footer->get_amp_content());
|
3451 |
+
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
|
3452 |
+
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
|
3453 |
+
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
|
3454 |
+
}
|
3455 |
+
}
|
3456 |
+
}
|
3457 |
+
// Add Styles
|
3458 |
+
if ( $sanitized_data_swift_footer->get_amp_styles() ) {
|
3459 |
+
foreach ($sanitized_data_swift_footer->get_amp_styles() as $key => $value ) {
|
3460 |
+
if( empty( $data['post_amp_styles'][$key] ) ){
|
3461 |
+
$data['post_amp_styles'][$key] = $value;
|
3462 |
+
}
|
3463 |
+
}
|
3464 |
+
}
|
3465 |
+
}
|
3466 |
return $data;
|
3467 |
}
|
3468 |
// 44. auto adding /amp for the menu
|
4677 |
$selected_cats = array();
|
4678 |
$post_id_array = array();
|
4679 |
$current_cats_ids = array();
|
4680 |
+
if(isset($redux_builder_amp['hide-amp-categories2'])){
|
4681 |
+
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories2'];
|
4682 |
if($get_categories_from_checkbox){
|
4683 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
4684 |
foreach ($get_selected_cats as $key => $value) {
|
4685 |
+
$selected_cats[] = $value;
|
4686 |
}
|
4687 |
}
|
4688 |
$current_cats = get_the_category(get_the_ID());
|
4695 |
return true;
|
4696 |
}
|
4697 |
}
|
4698 |
+
if( is_array($redux_builder_amp['hide-amp-tags-bulk-option2']) ) {
|
4699 |
+
$get_tags_checkbox = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
|
4700 |
$all_tags = get_the_tags(get_the_ID());
|
4701 |
$tagsOnPost = array();
|
4702 |
if ( $all_tags ) {
|
4717 |
global $redux_builder_amp;
|
4718 |
$exclude = array();
|
4719 |
// Categories
|
4720 |
+
if ( isset($redux_builder_amp['hide-amp-categories2']) && is_array($redux_builder_amp['hide-amp-categories2']) && 'cat' == $archive ) {
|
4721 |
+
$exclude = array_values(array_filter($redux_builder_amp['hide-amp-categories2']));
|
4722 |
return $exclude;
|
4723 |
}
|
4724 |
// Tags
|
4725 |
+
if ( isset($redux_builder_amp['hide-amp-tags-bulk-option2']) && is_array($redux_builder_amp['hide-amp-tags-bulk-option2']) && 'tag' == $archive ) {
|
4726 |
+
$exclude = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
|
4727 |
return $exclude;
|
4728 |
}
|
4729 |
}
|
4824 |
function ampforwp_generate_meta_desc($json=""){
|
4825 |
global $post, $redux_builder_amp;
|
4826 |
$desc = $post_id = '';
|
4827 |
+
$post_id = $post->ID;
|
4828 |
if ( $redux_builder_amp['ampforwp-seo-meta-description'] ) {
|
4829 |
if ( ampforwp_is_home() || ampforwp_is_blog() ) {
|
4830 |
$desc = addslashes( strip_tags( get_bloginfo( 'description' ) ) );
|
4879 |
if ( class_exists('All_in_One_SEO_Pack') && 2 == $redux_builder_amp['ampforwp-seo-selection'] ) {
|
4880 |
$aisop_class = $aisop_desc = $opts = '';
|
4881 |
$aisop_class = new All_in_One_SEO_Pack();
|
4882 |
+
if ( ampforwp_is_home() ) {
|
4883 |
+
$post_id = ampforwp_get_blog_details('id');
|
4884 |
+
$post = get_post($post_id);
|
4885 |
+
}
|
4886 |
+
$aisop_desc = $aisop_class->get_aioseop_description($post);
|
4887 |
$opts = $aisop_class->get_current_options( array(), 'aiosp' );
|
4888 |
if ( (is_category() || is_tax() || is_tag()) && $aisop_class->show_page_description() ) {
|
4889 |
$aisop_desc = $opts['aiosp_description'];
|
4890 |
}
|
4891 |
+
if ( ampforwp_is_front_page() ) {
|
4892 |
+
$post_id = ampforwp_get_frontpage_id();
|
4893 |
+
$post = get_post($post_id);
|
4894 |
+
$aisop_desc = $aisop_class->get_post_description( $post );
|
4895 |
+
}
|
4896 |
if ( $aisop_desc ) {
|
4897 |
$desc = $aisop_desc;
|
4898 |
}
|
4973 |
global $redux_builder_amp;
|
4974 |
$current_cats_ids = $selected_cats = array();
|
4975 |
if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==1){
|
4976 |
+
if(is_tag() && is_array($redux_builder_amp['hide-amp-tags-bulk-option2'])) {
|
4977 |
$all_tags = get_the_tags();
|
4978 |
$tagsOnPost = array();
|
4979 |
if ( $all_tags ) {
|
4981 |
$tagsOnPost[] = $tagsvalue->term_id;
|
4982 |
}
|
4983 |
}
|
4984 |
+
$get_tags_checkbox = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
|
4985 |
|
4986 |
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
4987 |
return true;
|
4992 |
}//tags check area closed
|
4993 |
$categories = get_the_category();
|
4994 |
if ( $categories) {
|
4995 |
+
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories2'];
|
4996 |
// Check if $get_categories_from_checkbox has some cats then only show
|
4997 |
if ( $get_categories_from_checkbox ) {
|
4998 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
4999 |
foreach ($get_selected_cats as $key => $value) {
|
5000 |
+
$selected_cats[] = $value;
|
5001 |
}
|
5002 |
foreach ($categories as $key => $cats) {
|
5003 |
$current_cats_ids[] =$cats->cat_ID;
|
6395 |
} else {
|
6396 |
$new_url = add_query_arg( 'amp', '1', $url );
|
6397 |
}
|
6398 |
+
return esc_url( apply_filters( 'ampforwp_url_controller', $new_url ) );
|
6399 |
}
|
6400 |
// 99. Merriweather Font Management
|
6401 |
add_filter( 'amp_post_template_data', 'ampforwp_merriweather_font_management' );
|
6725 |
}
|
6726 |
|
6727 |
function swifttheme_footer_widgets_init() {
|
6728 |
+
register_sidebar( array(
|
6729 |
+
'name' => esc_html__( 'AMP Widget Below Header', 'accelerated-mobile-pages' ),
|
6730 |
+
'id' => 'ampforwp-below-header',
|
6731 |
+
'description' => esc_html__( 'This Widget will be display on Below Header area', 'accelerated-mobile-pages' ),
|
6732 |
+
'class'=>'w-bl',
|
6733 |
+
'before_widget' => '<div class="w-bl">',
|
6734 |
+
'after_widget' => '</div>',
|
6735 |
+
'before_title' => '<h4>',
|
6736 |
+
'after_title' => '</h4>',
|
6737 |
+
) );
|
6738 |
+
register_sidebar( array(
|
6739 |
+
'name' => esc_html__( 'AMP Widget Above Footer', 'accelerated-mobile-pages' ),
|
6740 |
+
'id' => 'ampforwp-above-loop',
|
6741 |
+
'description' => esc_html__( 'This Widget will be display on Above Loop area', 'accelerated-mobile-pages' ),
|
6742 |
+
'class'=>'w-bl',
|
6743 |
+
'before_widget' => '<div class="w-bl">',
|
6744 |
+
'after_widget' => '</div>',
|
6745 |
+
'before_title' => '<h4>',
|
6746 |
+
'after_title' => '</h4>',
|
6747 |
+
) );
|
6748 |
+
register_sidebar( array(
|
6749 |
+
'name' => esc_html__( 'AMP Widget Above Footer', 'accelerated-mobile-pages' ),
|
6750 |
+
'id' => 'ampforwp-below-loop',
|
6751 |
+
'description' => esc_html__( 'This Widget will be display on Below loop area', 'accelerated-mobile-pages' ),
|
6752 |
+
'class'=>'w-bl',
|
6753 |
+
'before_widget' => '<div class="w-bl">',
|
6754 |
+
'after_widget' => '</div>',
|
6755 |
+
'before_title' => '<h4>',
|
6756 |
+
'after_title' => '</h4>',
|
6757 |
+
) );
|
6758 |
+
register_sidebar( array(
|
6759 |
+
'name' => esc_html__( 'AMP Widget Above Footer', 'accelerated-mobile-pages' ),
|
6760 |
+
'id' => 'ampforwp-above-footer',
|
6761 |
+
'description' => esc_html__( 'This Widget will be display on Above Footer area', 'accelerated-mobile-pages' ),
|
6762 |
+
'class'=>'w-bl',
|
6763 |
+
'before_widget' => '<div class="w-bl">',
|
6764 |
+
'after_widget' => '</div>',
|
6765 |
+
'before_title' => '<h4>',
|
6766 |
+
'after_title' => '</h4>',
|
6767 |
+
) );
|
6768 |
if(ampforwp_design_selector()==4){
|
6769 |
register_sidebar( array(
|
6770 |
'name' => esc_html__( 'AMP Footer', 'accelerated-mobile-pages' ),
|
6771 |
'id' => 'swift-footer-widget-area',
|
6772 |
+
'description' => esc_html__( 'This Widget will be display on Above Footer area', 'accelerated-mobile-pages' ),
|
6773 |
'class'=>'w-bl',
|
6774 |
'before_widget' => '<div class="w-bl">',
|
6775 |
'after_widget' => '</div>',
|
6776 |
'before_title' => '<h4>',
|
6777 |
'after_title' => '</h4>',
|
6778 |
) );
|
6779 |
+
|
6780 |
register_sidebar( array(
|
6781 |
'name' => esc_html__( 'AMP Sidebar', 'accelerated-mobile-pages' ),
|
6782 |
'id' => 'swift-sidebar',
|
6795 |
function ampforwp_is_non_amp( $type="" ) {
|
6796 |
global $redux_builder_amp;
|
6797 |
$non_amp = false;
|
6798 |
+
$amp_metas = array();
|
6799 |
+
$ampforwp_amp_post_on_off_meta = '';
|
6800 |
if ( false !== get_query_var( 'amp', false ) ) {
|
6801 |
return false;
|
6802 |
}
|
6835 |
if ( is_feed() ) {
|
6836 |
return false;
|
6837 |
}
|
6838 |
+
|
|
|
|
|
|
|
6839 |
}elseif( (
|
6840 |
ampforwp_get_setting('amp-design-selector') == 4)
|
6841 |
&&
|
6858 |
return;
|
6859 |
}
|
6860 |
// Pages
|
6861 |
+
|
6862 |
+
if ( is_page() && false == $redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
6863 |
+
return;
|
6864 |
+
}
|
6865 |
+
$amp_metas = json_decode(get_post_meta( get_the_ID(),'ampforwp-post-metas',true), true );
|
6866 |
+
$ampforwp_amp_post_on_off_meta = $amp_metas['ampforwp-amp-on-off'];
|
6867 |
+
if($ampforwp_amp_post_on_off_meta == 'hide-amp'){
|
6868 |
+
return false;
|
6869 |
+
}
|
6870 |
// Removing the AMP on login register etc of Theme My Login plugin
|
6871 |
|
6872 |
if (function_exists('tml_register_default_actions')){
|
7420 |
// Back to top
|
7421 |
add_action( 'ampforwp_body_beginning' ,'ampforwp_back_to_top_markup');
|
7422 |
function ampforwp_back_to_top_markup(){
|
7423 |
+
global $redux_builder_amp;
|
7424 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){
|
7425 |
+
echo '<div id="backtotop"></div>
|
7426 |
+
<div id="marker">
|
7427 |
+
<amp-position-observer on="enter:hideAnim.start; exit:showAnim.start"
|
7428 |
+
layout="nodisplay">
|
7429 |
+
</amp-position-observer>
|
7430 |
+
</div>';
|
7431 |
+
}
|
7432 |
}
|
7433 |
|
7434 |
|
7654 |
$file_types = array_merge($file_types, $new_filetypes );
|
7655 |
return $file_types;
|
7656 |
}
|
7657 |
+
add_action('upload_mimes', 'ampforwp_upload_svg');
|
7658 |
+
|
7659 |
+
// Ajax functions
|
7660 |
+
add_action( 'wp_ajax_ampforwp_categories', 'ampforwp_ajax_cats' );
|
7661 |
+
function ampforwp_ajax_cats(){
|
7662 |
+
if(!wp_verify_nonce($_GET['security'],'ampforwp-verify-request') ){
|
7663 |
+
echo json_encode(array('status'=>403,'message'=>'user request is not allowed')) ;
|
7664 |
+
die;
|
7665 |
+
}
|
7666 |
+
$return = array();
|
7667 |
+
$categories = get_categories(array('search'=> esc_html($_GET['q']),'number'=>500));
|
7668 |
+
$categories_array = array();
|
7669 |
+
if ( $categories ) :
|
7670 |
+
foreach ($categories as $cat ) {
|
7671 |
+
$return[] = array($cat->cat_ID,$cat->name);// array( Cat ID, Cat Name )
|
7672 |
+
}
|
7673 |
+
endif;
|
7674 |
+
wp_send_json( $return );
|
7675 |
+
}
|
7676 |
+
add_action( 'wp_ajax_ampforwp_tags', 'ampforwp_ajax_tags' );
|
7677 |
+
function ampforwp_ajax_tags(){
|
7678 |
+
if(!wp_verify_nonce($_GET['security'],'ampforwp-verify-request') ){
|
7679 |
+
echo json_encode(array('status'=>403,'message'=>'user request is not allowed')) ;
|
7680 |
+
die;
|
7681 |
+
}
|
7682 |
+
$return = array();
|
7683 |
+
$tags = get_tags(array('search'=> esc_html($_GET['q']),'number'=>500));
|
7684 |
+
if ( $tags ) :
|
7685 |
+
foreach ($tags as $tag ) {
|
7686 |
+
$return[] = array($tag->term_id,$tag->name);// array( Tag ID, tag Name )
|
7687 |
+
}
|
7688 |
+
endif;
|
7689 |
+
wp_send_json( $return );
|
7690 |
+
}
|
7691 |
+
add_filter( 'amp_post_template_data', 'ampforwp_backtotop' );
|
7692 |
+
function ampforwp_backtotop( $data ) {
|
7693 |
+
global $redux_builder_amp;
|
7694 |
+
if(true == ampforwp_get_setting('ampforwp-footer-top')){
|
7695 |
+
if ( empty( $data['amp_component_scripts']['amp-position-observer'] ) ) {
|
7696 |
+
$data['amp_component_scripts']['amp-position-observer'] = 'https://cdn.ampproject.org/v0/amp-position-observer-0.1.js';
|
7697 |
+
}
|
7698 |
+
if ( empty( $data['amp_component_scripts']['amp-animation'] ) ) {
|
7699 |
+
$data['amp_component_scripts']['amp-animation'] = 'https://cdn.ampproject.org/v0/amp-animation-0.1.js';
|
7700 |
+
}
|
7701 |
+
|
7702 |
+
}
|
7703 |
+
return $data;
|
7704 |
+
}
|
7705 |
+
|