Version Description
Download this release
Release Info
Developer | namith.jawahar |
Plugin | Wp-Insert |
Version | 2.1.8 |
Comparing to | |
See all releases |
Code changes from version 2.1.7 to 2.1.8
- includes/assets/images/adsense-logo.png +0 -0
- includes/assets/images/adsense.gif +0 -0
- includes/assets/images/chitika.png +0 -0
- includes/assets/images/vi-logo-square.png +0 -0
- includes/assets/images/wpinsert-vi.png +0 -0
- includes/assets/js/wp-insert-global.js +10 -0
- includes/assets/js/wp-insert.js +0 -4
- includes/common/abtesting.php +5 -5
- includes/common/control-panel.php +30 -0
- includes/controls/assets/css/controls.css +522 -0
- includes/controls/assets/images/jquery-te.png +0 -0
- includes/controls/assets/js/controls.js +15 -1246
- includes/controls/controls.php +8 -0
- includes/legal-pages.php +47 -36
- includes/tracking-codes.php +3 -3
- readme.txt +2 -2
- wp-insert.php +2 -2
includes/assets/images/adsense-logo.png
ADDED
Binary file
|
includes/assets/images/adsense.gif
DELETED
Binary file
|
includes/assets/images/chitika.png
DELETED
Binary file
|
includes/assets/images/vi-logo-square.png
ADDED
Binary file
|
includes/assets/images/wpinsert-vi.png
ADDED
Binary file
|
includes/assets/js/wp-insert-global.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
jQuery('.wp_insert_notice').click(function() {
|
3 |
+
jQuery.post(
|
4 |
+
jQuery('#wp_insert_admin_notice_ajax').val(), {
|
5 |
+
'action': 'wp_insert_admin_notice_dismiss',
|
6 |
+
'wp_insert_admin_notice_nonce': jQuery('#wp_insert_admin_notice_nonce').val(),
|
7 |
+
}, function(response) { }
|
8 |
+
);
|
9 |
+
});
|
10 |
+
});
|
includes/assets/js/wp-insert.js
CHANGED
@@ -89,7 +89,6 @@ jQuery(document).ready(function() {
|
|
89 |
jQuery("body").height() * 0.8,
|
90 |
function() { },
|
91 |
function() {
|
92 |
-
tinyMCE.triggerSave();
|
93 |
jQuery.post(
|
94 |
jQuery('#wp_insert_admin_ajax').val(), {
|
95 |
'action': 'wp_insert_legalpages_privacy_policy_form_save_action',
|
@@ -109,7 +108,6 @@ jQuery(document).ready(function() {
|
|
109 |
jQuery("body").height() * 0.8,
|
110 |
function() { },
|
111 |
function() {
|
112 |
-
tinyMCE.triggerSave();
|
113 |
jQuery.post(
|
114 |
jQuery('#wp_insert_admin_ajax').val(), {
|
115 |
'action': 'wp_insert_legalpages_terms_conditions_form_save_action',
|
@@ -129,7 +127,6 @@ jQuery(document).ready(function() {
|
|
129 |
jQuery("body").height() * 0.8,
|
130 |
function() { },
|
131 |
function() {
|
132 |
-
tinyMCE.triggerSave();
|
133 |
jQuery.post(
|
134 |
jQuery('#wp_insert_admin_ajax').val(), {
|
135 |
'action': 'wp_insert_legalpages_disclaimer_form_save_action',
|
@@ -149,7 +146,6 @@ jQuery(document).ready(function() {
|
|
149 |
jQuery("body").height() * 0.8,
|
150 |
function() { },
|
151 |
function() {
|
152 |
-
tinyMCE.triggerSave();
|
153 |
jQuery.post(
|
154 |
jQuery('#wp_insert_admin_ajax').val(), {
|
155 |
'action': 'wp_insert_legalpages_copyright_form_save_action',
|
89 |
jQuery("body").height() * 0.8,
|
90 |
function() { },
|
91 |
function() {
|
|
|
92 |
jQuery.post(
|
93 |
jQuery('#wp_insert_admin_ajax').val(), {
|
94 |
'action': 'wp_insert_legalpages_privacy_policy_form_save_action',
|
108 |
jQuery("body").height() * 0.8,
|
109 |
function() { },
|
110 |
function() {
|
|
|
111 |
jQuery.post(
|
112 |
jQuery('#wp_insert_admin_ajax').val(), {
|
113 |
'action': 'wp_insert_legalpages_terms_conditions_form_save_action',
|
127 |
jQuery("body").height() * 0.8,
|
128 |
function() { },
|
129 |
function() {
|
|
|
130 |
jQuery.post(
|
131 |
jQuery('#wp_insert_admin_ajax').val(), {
|
132 |
'action': 'wp_insert_legalpages_disclaimer_form_save_action',
|
146 |
jQuery("body").height() * 0.8,
|
147 |
function() { },
|
148 |
function() {
|
|
|
149 |
jQuery.post(
|
150 |
jQuery('#wp_insert_admin_ajax').val(), {
|
151 |
'action': 'wp_insert_legalpages_copyright_form_save_action',
|
includes/common/abtesting.php
CHANGED
@@ -3,21 +3,21 @@
|
|
3 |
add_action('wp_ajax_wp_insert_abtesting_configuration_form_get_content', 'wp_insert_abtesting_configuration_form_get_content');
|
4 |
function wp_insert_abtesting_configuration_form_get_content() {
|
5 |
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
|
7 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
8 |
$abtestingModes = array(
|
9 |
array('value' => '1', 'text' => 'Primary Ad Network'),
|
10 |
array('value' => '2', 'text' => 'Primary and Secondary Ad Networks'),
|
11 |
array('value' => '3', 'text' => 'All Ad Networks'),
|
12 |
);
|
|
|
13 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
14 |
$control = new smartlogixControls(array('type' => 'radio-group', 'id' => 'wp_insert_abtesting_mode', 'name' => 'wp_insert_abtesting_mode', 'label' => 'Select the Ad Network Setup that best suits you', 'value' => $abtestingMode, 'options' => $abtestingModes));
|
15 |
$control->add_control();
|
16 |
echo $control->HTML;
|
17 |
echo '<p>';
|
18 |
-
echo '<b>Recommended Ad Networks</b><br />';
|
19 |
-
echo '<a href="http://google.com/adsense" target="_blank"><img src="'.WP_INSERT_URL.'/includes/assets/images/adsense.
|
20 |
-
echo '<a href="
|
21 |
echo '</p>';
|
22 |
echo '</div>';
|
23 |
die();
|
3 |
add_action('wp_ajax_wp_insert_abtesting_configuration_form_get_content', 'wp_insert_abtesting_configuration_form_get_content');
|
4 |
function wp_insert_abtesting_configuration_form_get_content() {
|
5 |
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
+
$abtestingMode = get_option('wp_insert_abtesting_mode', 1);
|
|
|
7 |
$abtestingModes = array(
|
8 |
array('value' => '1', 'text' => 'Primary Ad Network'),
|
9 |
array('value' => '2', 'text' => 'Primary and Secondary Ad Networks'),
|
10 |
array('value' => '3', 'text' => 'All Ad Networks'),
|
11 |
);
|
12 |
+
|
13 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
14 |
$control = new smartlogixControls(array('type' => 'radio-group', 'id' => 'wp_insert_abtesting_mode', 'name' => 'wp_insert_abtesting_mode', 'label' => 'Select the Ad Network Setup that best suits you', 'value' => $abtestingMode, 'options' => $abtestingModes));
|
15 |
$control->add_control();
|
16 |
echo $control->HTML;
|
17 |
echo '<p>';
|
18 |
+
echo '<b>Recommended Ad Networks</b><br /><br />';
|
19 |
+
echo '<a href="http://google.com/adsense" target="_blank"><img src="'.WP_INSERT_URL.'/includes/assets/images/adsense-logo.png" /></a>';
|
20 |
+
echo '<a href="https://www.vi.ai/publisher-video-monetization/" style="margin-left: 10px;" target="_blank"><img src="'.WP_INSERT_URL.'/includes/assets/images/vi-logo-square.png" /></a>';
|
21 |
echo '</p>';
|
22 |
echo '</div>';
|
23 |
die();
|
includes/common/control-panel.php
CHANGED
@@ -6,6 +6,8 @@ function wp_insert_admin_menu() {
|
|
6 |
|
7 |
add_action('admin_enqueue_scripts', 'wp_insert_admin_enqueue_scripts');
|
8 |
function wp_insert_admin_enqueue_scripts($page) {
|
|
|
|
|
9 |
if($page == 'toplevel_page_wp-insert') {
|
10 |
wp_register_style('wp-insert-css', WP_INSERT_URL.'includes/assets/css/wp-insert.css', array(), WP_INSERT_VERSION);
|
11 |
wp_enqueue_style('wp-insert-css');
|
@@ -22,6 +24,7 @@ function wp_insert_admin_enqueue_scripts($page) {
|
|
22 |
|
23 |
function wp_insert_admin_page() { ?>
|
24 |
<div class="wrap wp-insert">
|
|
|
25 |
<div class="wp-list-table widefat plugin-install">
|
26 |
<div class="plugin-card">
|
27 |
<div class="plugin-card-top">
|
@@ -138,4 +141,31 @@ function wp_insert_admin_page() { ?>
|
|
138 |
</div>
|
139 |
<?php
|
140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
?>
|
6 |
|
7 |
add_action('admin_enqueue_scripts', 'wp_insert_admin_enqueue_scripts');
|
8 |
function wp_insert_admin_enqueue_scripts($page) {
|
9 |
+
wp_register_script('wp-insert-global-js', WP_INSERT_URL.'includes/assets/js/wp-insert-global.js', array('jquery'), WP_INSERT_VERSION);
|
10 |
+
wp_enqueue_script('wp-insert-global-js');
|
11 |
if($page == 'toplevel_page_wp-insert') {
|
12 |
wp_register_style('wp-insert-css', WP_INSERT_URL.'includes/assets/css/wp-insert.css', array(), WP_INSERT_VERSION);
|
13 |
wp_enqueue_style('wp-insert-css');
|
24 |
|
25 |
function wp_insert_admin_page() { ?>
|
26 |
<div class="wrap wp-insert">
|
27 |
+
<h1></h1>
|
28 |
<div class="wp-list-table widefat plugin-install">
|
29 |
<div class="plugin-card">
|
30 |
<div class="plugin-card-top">
|
141 |
</div>
|
142 |
<?php
|
143 |
}
|
144 |
+
|
145 |
+
/* Begin Admin Notice */
|
146 |
+
add_action('admin_notices', 'wp_insert_admin_notices');
|
147 |
+
function wp_insert_admin_notices() {
|
148 |
+
if(current_user_can('manage_options')) {
|
149 |
+
$userId = get_current_user_id();
|
150 |
+
if(!get_user_meta($userId, 'wp_insert_admin_notice_dismissed', true)) {
|
151 |
+
echo '<div class="notice wp_insert_notice is-dismissible" style="padding: 15px;">';
|
152 |
+
echo '<img style="float: left; margin-right: 20px;" src="'.WP_INSERT_URL.'includes/assets/images/wpinsert-vi.png" />';
|
153 |
+
echo '<p style="float: left; font-size: 14px; margin: 7px 0px;">Coming soon: The next update to <b>WP-INSERT</b> plugin will feature native video ad units for upto 10x higher revenue (RPM) powered by video intelligence.<br /><a href="https://www.vi.ai/publisher-video-monetization/" target="_blank">https://www.vi.ai/publisher-video-monetization/</a></p>';
|
154 |
+
echo '<a style="float: right; vertical-align: middle; height: 36px; font-size: 16px; padding: 0px 25px; line-height: 32px; margin: 12px 40px 0px 20px;" href="https://www.vi.ai/publisher-video-monetization/" class="button button-primary" target="_blank">Learn More</a>';
|
155 |
+
echo '<div class="clear"></div>';
|
156 |
+
echo '<input type="hidden" id="wp_insert_admin_notice_nonce" name="wp_insert_admin_notice_nonce" value="'.wp_create_nonce('wp-insert-admin-notice').'" />';
|
157 |
+
echo '<input type="hidden" id="wp_insert_admin_notice_ajax" name="wp_insert_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
|
158 |
+
echo '</div>';
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
add_action('wp_ajax_wp_insert_admin_notice_dismiss', 'wp_insert_admin_notice_dismiss');
|
164 |
+
function wp_insert_admin_notice_dismiss() {
|
165 |
+
check_ajax_referer('wp-insert-admin-notice', 'wp_insert_admin_notice_nonce');
|
166 |
+
$userId = get_current_user_id();
|
167 |
+
update_user_meta($userId, 'wp_insert_admin_notice_dismissed', 'true');
|
168 |
+
die();
|
169 |
+
}
|
170 |
+
/* End Admin Notice */
|
171 |
?>
|
includes/controls/assets/css/controls.css
CHANGED
@@ -537,6 +537,528 @@
|
|
537 |
background-position: -12px 2px;
|
538 |
}
|
539 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
541 |
only screen and (min-resolution: 144dpi),
|
542 |
only screen and (min-resolution: 1.5dppx) {
|
537 |
background-position: -12px 2px;
|
538 |
}
|
539 |
|
540 |
+
.jqte {
|
541 |
+
margin:30px 0;
|
542 |
+
border:#bbb 1px solid;
|
543 |
+
overflow:hidden;
|
544 |
+
}
|
545 |
+
|
546 |
+
.jqte * {
|
547 |
+
color:#333;
|
548 |
+
font-family:Arial, Helvetica, sans-serif;
|
549 |
+
font-size:14px;
|
550 |
+
}
|
551 |
+
|
552 |
+
.jqte_focused {
|
553 |
+
/*border-color:#00AAE7;
|
554 |
+
box-shadow:0 0 10px #00BDFF; -webkit-box-shadow:0 0 10px #00BDFF; -moz-box-shadow:0 0 10px #00BDFF;*/
|
555 |
+
}
|
556 |
+
|
557 |
+
.jqte_toolbar {
|
558 |
+
overflow:auto;
|
559 |
+
padding:3px 4px;
|
560 |
+
background:#EEE;
|
561 |
+
border-bottom:#BBB 1px solid;
|
562 |
+
}
|
563 |
+
|
564 |
+
.jqte_tool {
|
565 |
+
float:left;
|
566 |
+
margin:0;
|
567 |
+
padding:0;
|
568 |
+
cursor:pointer;
|
569 |
+
}
|
570 |
+
|
571 |
+
.jqte_tool, .jqte_tool_icon, .jqte_tool_label {
|
572 |
+
border:#EEE 1px solid;
|
573 |
+
border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px
|
574 |
+
}
|
575 |
+
|
576 |
+
.jqte_hiddenField {
|
577 |
+
display:none
|
578 |
+
}
|
579 |
+
|
580 |
+
.jqte_tool_icon {
|
581 |
+
display:block;
|
582 |
+
width:22px;
|
583 |
+
height:22px;
|
584 |
+
background:url('../images/jquery-te.png') no-repeat
|
585 |
+
}
|
586 |
+
|
587 |
+
.jqte_tool.jqte_tool_1 .jqte_tool_label {
|
588 |
+
position:relative;
|
589 |
+
display:block;
|
590 |
+
padding:3px;
|
591 |
+
width:70px;
|
592 |
+
height:16px;
|
593 |
+
overflow:hidden;
|
594 |
+
}
|
595 |
+
|
596 |
+
.jqte_tool.jqte_tool_1 .jqte_tool_text {
|
597 |
+
font:bold 13px Arial,sans-serif;
|
598 |
+
color:#222;
|
599 |
+
}
|
600 |
+
|
601 |
+
.jqte_tool.jqte_tool_1 .jqte_tool_icon {
|
602 |
+
position:absolute;
|
603 |
+
top:10px;
|
604 |
+
right:2px;
|
605 |
+
width:6px;
|
606 |
+
height:4px;
|
607 |
+
background-position:-19px -23px;
|
608 |
+
border:none;
|
609 |
+
border-radius:none; -webkit-border-radius:none; -moz-border-radius:none
|
610 |
+
}
|
611 |
+
|
612 |
+
.jqte_tool.jqte_tool_2 .jqte_tool_icon {
|
613 |
+
background-position:0 0
|
614 |
+
}
|
615 |
+
|
616 |
+
.jqte_tool.jqte_tool_3 .jqte_tool_icon {
|
617 |
+
background-position:-22px 0
|
618 |
+
}
|
619 |
+
|
620 |
+
.jqte_tool.jqte_tool_4 .jqte_tool_icon {
|
621 |
+
background-position:-44px 0
|
622 |
+
}
|
623 |
+
|
624 |
+
.jqte_tool.jqte_tool_5 .jqte_tool_icon {
|
625 |
+
background-position:-66px 0
|
626 |
+
}
|
627 |
+
|
628 |
+
.jqte_tool.jqte_tool_6 .jqte_tool_icon {
|
629 |
+
background-position:-88px 0
|
630 |
+
}
|
631 |
+
|
632 |
+
.jqte_tool.jqte_tool_7 .jqte_tool_icon {
|
633 |
+
background-position:-110px 0
|
634 |
+
}
|
635 |
+
|
636 |
+
.jqte_tool.jqte_tool_8 .jqte_tool_icon {
|
637 |
+
background-position:-132px 0
|
638 |
+
}
|
639 |
+
|
640 |
+
.jqte_tool.jqte_tool_9 .jqte_tool_icon {
|
641 |
+
background-position:-154px 0
|
642 |
+
}
|
643 |
+
|
644 |
+
.jqte_tool.jqte_tool_10 .jqte_tool_icon {
|
645 |
+
background-position:-176px 0
|
646 |
+
}
|
647 |
+
|
648 |
+
.jqte_tool.jqte_tool_11 .jqte_tool_icon {
|
649 |
+
background-position:-198px 0
|
650 |
+
}
|
651 |
+
|
652 |
+
.jqte_tool.jqte_tool_12 .jqte_tool_icon {
|
653 |
+
background-position:-220px 0
|
654 |
+
}
|
655 |
+
|
656 |
+
.jqte_tool.jqte_tool_13 .jqte_tool_icon {
|
657 |
+
background-position:-242px 0
|
658 |
+
}
|
659 |
+
|
660 |
+
.jqte_tool.jqte_tool_14 .jqte_tool_icon {
|
661 |
+
background-position:-264px 0
|
662 |
+
}
|
663 |
+
|
664 |
+
.jqte_tool.jqte_tool_15 .jqte_tool_icon {
|
665 |
+
background-position:-286px 0
|
666 |
+
}
|
667 |
+
|
668 |
+
.jqte_tool.jqte_tool_16 .jqte_tool_icon {
|
669 |
+
background-position:-308px 0
|
670 |
+
}
|
671 |
+
|
672 |
+
.jqte_tool.jqte_tool_17 .jqte_tool_icon {
|
673 |
+
background-position:-330px 0
|
674 |
+
}
|
675 |
+
|
676 |
+
.jqte_tool.jqte_tool_18 .jqte_tool_icon {
|
677 |
+
background-position:-352px 0
|
678 |
+
}
|
679 |
+
|
680 |
+
.jqte_tool.jqte_tool_19 .jqte_tool_icon {
|
681 |
+
background-position:-374px 0
|
682 |
+
}
|
683 |
+
|
684 |
+
.jqte_tool.jqte_tool_20 .jqte_tool_icon {
|
685 |
+
background-position:-396px 0
|
686 |
+
}
|
687 |
+
|
688 |
+
.jqte_tool.jqte_tool_21 .jqte_tool_icon {
|
689 |
+
background-position:-418px 0
|
690 |
+
}
|
691 |
+
|
692 |
+
.jqte_tool:hover {
|
693 |
+
background-color:#FFF;
|
694 |
+
border-color:#FFF
|
695 |
+
}
|
696 |
+
|
697 |
+
.jqte_tool:hover .jqte_tool_icon, .jqte_tool:hover .jqte_tool_label {
|
698 |
+
border:#AAA 1px solid
|
699 |
+
}
|
700 |
+
|
701 |
+
.jqte_tool:active .jqte_tool_icon, .jqte_tool:active .jqte_tool_label {
|
702 |
+
border:#777 1px solid
|
703 |
+
}
|
704 |
+
|
705 |
+
.jqte_tool.jqte_tool_1:hover .jqte_tool_icon, .jqte_tool.jqte_tool_1:active .jqte_tool_icon {
|
706 |
+
border:none
|
707 |
+
}
|
708 |
+
|
709 |
+
.jqte_tool_depressed {
|
710 |
+
background-color:#DDD;
|
711 |
+
border-color:#CCC
|
712 |
+
}
|
713 |
+
|
714 |
+
.jqte_tool_depressed .jqte_tool_icon {
|
715 |
+
border-color:#AAA
|
716 |
+
}
|
717 |
+
|
718 |
+
.jqte_tool_depressed:hover {
|
719 |
+
background-color:#EEE
|
720 |
+
}
|
721 |
+
|
722 |
+
.jqte_linkform {
|
723 |
+
padding:5px 10px;
|
724 |
+
background:#DDD;
|
725 |
+
border-bottom:#BBB 1px solid;
|
726 |
+
}
|
727 |
+
|
728 |
+
.jqte_linktypeselect {
|
729 |
+
position:relative;
|
730 |
+
float:left;
|
731 |
+
width:130px;
|
732 |
+
background:#EEE;
|
733 |
+
cursor:pointer
|
734 |
+
}
|
735 |
+
|
736 |
+
.jqte_linktypeselect:Active {
|
737 |
+
background:#FFF
|
738 |
+
}
|
739 |
+
|
740 |
+
.jqte_linktypeview {
|
741 |
+
padding:3px 5px;
|
742 |
+
border:#333 1px solid;
|
743 |
+
color:#777;
|
744 |
+
border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
|
745 |
+
outline:none
|
746 |
+
}
|
747 |
+
|
748 |
+
.jqte_linktypetext {
|
749 |
+
font-size:12px;
|
750 |
+
}
|
751 |
+
|
752 |
+
.jqte_linktypearrow {
|
753 |
+
position:absolute;
|
754 |
+
bottom:8px; right:6px;
|
755 |
+
width:7px;
|
756 |
+
height:6px;
|
757 |
+
margin:0 auto;
|
758 |
+
background:url('../images/jquery-te.png') -7px -23px no-repeat;
|
759 |
+
}
|
760 |
+
|
761 |
+
.jqte_linktypes {
|
762 |
+
display:none;
|
763 |
+
position:absolute;
|
764 |
+
top:22px; left:1px;
|
765 |
+
width:125px;
|
766 |
+
background:#FFF;
|
767 |
+
border:#333 1px solid;
|
768 |
+
box-shadow:0 1px 4px #AAA; -webkit-box-shadow:0 1px 4px #AAA; -moz-box-shadow:0 1px 4px #AAA
|
769 |
+
}
|
770 |
+
|
771 |
+
.jqte_linktypes a {
|
772 |
+
display:block;
|
773 |
+
padding:4px 5px;
|
774 |
+
font-size:12px;
|
775 |
+
}
|
776 |
+
|
777 |
+
.jqte_linktypes a:hover {
|
778 |
+
background:#DDD
|
779 |
+
}
|
780 |
+
|
781 |
+
.jqte_linkinput {
|
782 |
+
float:left;
|
783 |
+
margin:0 5px;
|
784 |
+
padding:3px 5px;
|
785 |
+
width:300px;
|
786 |
+
background:#EEE;
|
787 |
+
border:#333 1px solid;
|
788 |
+
color:#777;
|
789 |
+
font-size:12px;
|
790 |
+
border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
|
791 |
+
outline:none;
|
792 |
+
}
|
793 |
+
|
794 |
+
.jqte_linkinput:focus, .jqte_linkinput:hover {
|
795 |
+
background:#FFF;
|
796 |
+
border-color:#000;
|
797 |
+
}
|
798 |
+
|
799 |
+
.jqte_linkbutton {
|
800 |
+
float:left;
|
801 |
+
padding:3px 12px;
|
802 |
+
background:#AAA;
|
803 |
+
border:#333 1px solid;
|
804 |
+
color:#FFF;
|
805 |
+
font-size:12px;
|
806 |
+
font-weight:bold;
|
807 |
+
cursor:pointer;
|
808 |
+
border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
|
809 |
+
box-shadow:inset 0 1px #EEE; -webkit-box-shadow:inset 0 1px #EEE; -moz-box-shadow:inset 0 1px #EEE;
|
810 |
+
}
|
811 |
+
|
812 |
+
.jqte_linkbutton:hover {
|
813 |
+
background:#A1A1A1
|
814 |
+
}
|
815 |
+
|
816 |
+
.jqte_linkbutton:active {
|
817 |
+
box-shadow:inset 0 1px #CCC; -webkit-box-shadow:inset 0 1px #CCC; -moz-box-shadow:inset 0 1px #CCC;
|
818 |
+
background:#888;
|
819 |
+
}
|
820 |
+
|
821 |
+
.jqte_formats {
|
822 |
+
display:none;
|
823 |
+
position:absolute;
|
824 |
+
width:180px;
|
825 |
+
oveflow-x:hidden;
|
826 |
+
overflow-y:auto;
|
827 |
+
background:#FFF;
|
828 |
+
border:#AAA 1px solid;
|
829 |
+
box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA;
|
830 |
+
z-index:100;
|
831 |
+
}
|
832 |
+
|
833 |
+
.jqte_format {
|
834 |
+
display:block;
|
835 |
+
padding:4px 7px;
|
836 |
+
font-size:13px
|
837 |
+
}
|
838 |
+
|
839 |
+
.jqte_format:hover {
|
840 |
+
background:#DDD
|
841 |
+
}
|
842 |
+
|
843 |
+
.jqte_format_1, .jqte_format_2, .jqte_format_3, .jqte_format_4, .jqte_format_5, .jqte_format_6 {
|
844 |
+
font-weight:bold
|
845 |
+
}
|
846 |
+
|
847 |
+
.jqte_format_1 {
|
848 |
+
font-size:22px
|
849 |
+
}
|
850 |
+
|
851 |
+
.jqte_format_2 {
|
852 |
+
font-size:20px
|
853 |
+
}
|
854 |
+
|
855 |
+
.jqte_format_3 {
|
856 |
+
font-size:18px
|
857 |
+
}
|
858 |
+
|
859 |
+
.jqte_format_4 {
|
860 |
+
font-size:16px
|
861 |
+
}
|
862 |
+
|
863 |
+
.jqte_format_5 {
|
864 |
+
font-size:14px
|
865 |
+
}
|
866 |
+
|
867 |
+
.jqte_format_6 {
|
868 |
+
font-size:12px
|
869 |
+
}
|
870 |
+
|
871 |
+
.jqte_format_7 {
|
872 |
+
font-family:"Courier New", Courier, monospace
|
873 |
+
}
|
874 |
+
|
875 |
+
.jqte_fontsizes {
|
876 |
+
display:none;
|
877 |
+
position:absolute;
|
878 |
+
width:180px;
|
879 |
+
height:198px;
|
880 |
+
oveflow-x:hidden;
|
881 |
+
overflow-y:auto;
|
882 |
+
background:#FFF;
|
883 |
+
border:#AAA 1px solid;
|
884 |
+
box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
|
885 |
+
}
|
886 |
+
|
887 |
+
.jqte_fontsize {
|
888 |
+
display:block;
|
889 |
+
padding:3px 7px;
|
890 |
+
}
|
891 |
+
|
892 |
+
.jqte_fontsize:hover {
|
893 |
+
background:#DDD
|
894 |
+
}
|
895 |
+
|
896 |
+
.jqte_cpalette {
|
897 |
+
display:none;
|
898 |
+
position:absolute;
|
899 |
+
padding:6px;
|
900 |
+
width:144px;
|
901 |
+
background:#FFF;
|
902 |
+
border:#AAA 1px solid;
|
903 |
+
box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
|
904 |
+
}
|
905 |
+
|
906 |
+
.jqte_color {
|
907 |
+
display:block;
|
908 |
+
float:left;
|
909 |
+
width:16px;
|
910 |
+
height:16px;
|
911 |
+
border:#FFF 1px solid;
|
912 |
+
}
|
913 |
+
|
914 |
+
.jqte_color:hover {
|
915 |
+
border-color:#000
|
916 |
+
}
|
917 |
+
|
918 |
+
.jqte_colorSeperator {
|
919 |
+
float:none;
|
920 |
+
clear:both;
|
921 |
+
height:7px;
|
922 |
+
}
|
923 |
+
|
924 |
+
.jqte_editor, .jqte_source {
|
925 |
+
padding:10px;
|
926 |
+
background:#FFF;
|
927 |
+
min-height:100px;
|
928 |
+
max-height:900px;
|
929 |
+
overflow:auto;
|
930 |
+
outline:none;
|
931 |
+
word-wrap:break-word; -ms-word-wrap:break-word;
|
932 |
+
resize:vertical
|
933 |
+
}
|
934 |
+
|
935 |
+
.jqte_editor div, .jqte_editor p {
|
936 |
+
margin:0 0 7px
|
937 |
+
}
|
938 |
+
|
939 |
+
.jqte_editor a:link, .jqte_editor a:link * {
|
940 |
+
color:#0066FF !important;
|
941 |
+
text-decoration:underline;
|
942 |
+
}
|
943 |
+
|
944 |
+
.jqte_editor blockquote {
|
945 |
+
margin-top:0;
|
946 |
+
margin-bottom:7px
|
947 |
+
}
|
948 |
+
|
949 |
+
.jqte_editor img {
|
950 |
+
float:left;
|
951 |
+
margin:0 10px 5px 0
|
952 |
+
}
|
953 |
+
|
954 |
+
.jqte_editor a[jqte-setlink], .jqte_editor a[jqte-setlink] * {
|
955 |
+
background:#3297FD !important;
|
956 |
+
color:#FFF !important
|
957 |
+
}
|
958 |
+
|
959 |
+
.jqte_editor h1, .jqte_editor h2, .jqte_editor h3, .jqte_editor h4, .jqte_editor h5, .jqte_editor h6, .jqte_editor pre {
|
960 |
+
display:block;
|
961 |
+
margin:0 0 3px;
|
962 |
+
}
|
963 |
+
|
964 |
+
.jqte_editor h1, .jqte_editor h1 * {
|
965 |
+
font-size:26px
|
966 |
+
}
|
967 |
+
|
968 |
+
.jqte_editor h2, .jqte_editor h2 * {
|
969 |
+
font-size:24px
|
970 |
+
}
|
971 |
+
|
972 |
+
.jqte_editor h3, .jqte_editor h3 * {
|
973 |
+
font-size:22px
|
974 |
+
}
|
975 |
+
|
976 |
+
.jqte_editor h4, .jqte_editor h4 * {
|
977 |
+
font-size:20px
|
978 |
+
}
|
979 |
+
|
980 |
+
.jqte_editor h5, .jqte_editor h5 * {
|
981 |
+
font-size:18px
|
982 |
+
}
|
983 |
+
|
984 |
+
.jqte_editor h6, .jqte_editor h6 * {
|
985 |
+
font-size:15px
|
986 |
+
}
|
987 |
+
|
988 |
+
.jqte_editor pre, .jqte_editor pre * {
|
989 |
+
font-family:"Courier New", Courier, monospace
|
990 |
+
}
|
991 |
+
|
992 |
+
.jqte_source, .jqte_source textarea {
|
993 |
+
background:#FFF1E8
|
994 |
+
}
|
995 |
+
|
996 |
+
.jqte_source textarea {
|
997 |
+
margin:0 !important;
|
998 |
+
padding:0 !important;
|
999 |
+
display:block !important;
|
1000 |
+
width:100% !important;
|
1001 |
+
min-height:100px;
|
1002 |
+
font-family:Courier, Arial, sans-serif !important;
|
1003 |
+
font-weight:normal;
|
1004 |
+
font-size:15px;
|
1005 |
+
overflow:hidden !important;
|
1006 |
+
outline:none;
|
1007 |
+
resize:none;
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
.jqte_source textarea, .jqte_source textarea:focus {
|
1011 |
+
css_shadow:none !important;
|
1012 |
+
background:none !important;
|
1013 |
+
border:none !important;
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
.jqte_title {
|
1017 |
+
display:none;
|
1018 |
+
position:absolute;
|
1019 |
+
z-index:9999;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
.jqte_titleArrow {
|
1023 |
+
position:relative;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
.jqte_titleArrowIcon {
|
1027 |
+
width:7px;
|
1028 |
+
height:6px;
|
1029 |
+
margin:0 auto;
|
1030 |
+
background:url('../images/jquery-te.png') 0 -23px no-repeat;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
.jqte_titleText {
|
1034 |
+
padding:5px 7px;
|
1035 |
+
margin-top:0;
|
1036 |
+
min-width:5px;
|
1037 |
+
min-height:1px;
|
1038 |
+
max-width:400px;
|
1039 |
+
background:#000;
|
1040 |
+
border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
|
1041 |
+
word-wrap:break-word; -ms-word-wrap:break-word
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
.jqte_titleText, .jqte_titleText * {
|
1045 |
+
color:#FFF;
|
1046 |
+
font-size:11px
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
.jqte_placeholder {
|
1050 |
+
position:relative;
|
1051 |
+
display:none;
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
.jqte_placeholder_text {
|
1055 |
+
position:absolute;
|
1056 |
+
top:43px;
|
1057 |
+
left:10px;
|
1058 |
+
font-size:14px;
|
1059 |
+
color:#CCC;
|
1060 |
+
}
|
1061 |
+
|
1062 |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
1063 |
only screen and (min-resolution: 144dpi),
|
1064 |
only screen and (min-resolution: 1.5dppx) {
|
includes/controls/assets/images/jquery-te.png
ADDED
Binary file
|
includes/controls/assets/js/controls.js
CHANGED
@@ -22,1249 +22,18 @@
|
|
22 |
/* End ipCheckbox */
|
23 |
|
24 |
/* Begin Chosen Selectbox */
|
25 |
-
(
|
26 |
-
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
return this.add_group(child);
|
39 |
-
|
40 |
-
return this.add_option(child);
|
41 |
-
}
|
42 |
-
};
|
43 |
-
|
44 |
-
SelectParser.prototype.add_group = function(group) {
|
45 |
-
var group_position, option, _i, _len, _ref, _results;
|
46 |
-
group_position = this.parsed.length;
|
47 |
-
this.parsed.push({
|
48 |
-
array_index: group_position,
|
49 |
-
group: true,
|
50 |
-
label: this.escapeExpression(group.label),
|
51 |
-
title: group.title ? group.title : void 0,
|
52 |
-
children: 0,
|
53 |
-
disabled: group.disabled,
|
54 |
-
classes: group.className
|
55 |
-
});
|
56 |
-
_ref = group.childNodes;
|
57 |
-
_results = [];
|
58 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
59 |
-
option = _ref[_i];
|
60 |
-
_results.push(this.add_option(option, group_position, group.disabled));
|
61 |
-
}
|
62 |
-
return _results;
|
63 |
-
};
|
64 |
-
|
65 |
-
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
66 |
-
if (option.nodeName.toUpperCase() === "OPTION") {
|
67 |
-
if (option.text !== "") {
|
68 |
-
if (group_position != null) {
|
69 |
-
this.parsed[group_position].children += 1;
|
70 |
-
}
|
71 |
-
this.parsed.push({
|
72 |
-
array_index: this.parsed.length,
|
73 |
-
options_index: this.options_index,
|
74 |
-
value: option.value,
|
75 |
-
text: option.text,
|
76 |
-
html: option.innerHTML,
|
77 |
-
title: option.title ? option.title : void 0,
|
78 |
-
selected: option.selected,
|
79 |
-
disabled: group_disabled === true ? group_disabled : option.disabled,
|
80 |
-
group_array_index: group_position,
|
81 |
-
group_label: group_position != null ? this.parsed[group_position].label : null,
|
82 |
-
classes: option.className,
|
83 |
-
style: option.style.cssText
|
84 |
-
});
|
85 |
-
} else {
|
86 |
-
this.parsed.push({
|
87 |
-
array_index: this.parsed.length,
|
88 |
-
options_index: this.options_index,
|
89 |
-
empty: true
|
90 |
-
});
|
91 |
-
}
|
92 |
-
return this.options_index += 1;
|
93 |
-
}
|
94 |
-
};
|
95 |
-
|
96 |
-
SelectParser.prototype.escapeExpression = function(text) {
|
97 |
-
var map, unsafe_chars;
|
98 |
-
if ((text == null) || text === false) {
|
99 |
-
return "";
|
100 |
-
}
|
101 |
-
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
102 |
-
return text;
|
103 |
-
}
|
104 |
-
map = {
|
105 |
-
"<": "<",
|
106 |
-
">": ">",
|
107 |
-
'"': """,
|
108 |
-
"'": "'",
|
109 |
-
"`": "`"
|
110 |
-
};
|
111 |
-
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
112 |
-
return text.replace(unsafe_chars, function(chr) {
|
113 |
-
return map[chr] || "&";
|
114 |
-
});
|
115 |
-
};
|
116 |
-
|
117 |
-
return SelectParser;
|
118 |
-
|
119 |
-
})();
|
120 |
-
|
121 |
-
SelectParser.select_to_array = function(select) {
|
122 |
-
var child, parser, _i, _len, _ref;
|
123 |
-
parser = new SelectParser();
|
124 |
-
_ref = select.childNodes;
|
125 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
126 |
-
child = _ref[_i];
|
127 |
-
parser.add_node(child);
|
128 |
-
}
|
129 |
-
return parser.parsed;
|
130 |
-
};
|
131 |
-
|
132 |
-
AbstractChosen = (function() {
|
133 |
-
function AbstractChosen(form_field, options) {
|
134 |
-
this.form_field = form_field;
|
135 |
-
this.options = options != null ? options : {};
|
136 |
-
if (!AbstractChosen.browser_is_supported()) {
|
137 |
-
return;
|
138 |
-
}
|
139 |
-
this.is_multiple = this.form_field.multiple;
|
140 |
-
this.set_default_text();
|
141 |
-
this.set_default_values();
|
142 |
-
this.setup();
|
143 |
-
this.set_up_html();
|
144 |
-
this.register_observers();
|
145 |
-
this.on_ready();
|
146 |
-
}
|
147 |
-
|
148 |
-
AbstractChosen.prototype.set_default_values = function() {
|
149 |
-
var _this = this;
|
150 |
-
this.click_test_action = function(evt) {
|
151 |
-
return _this.test_active_click(evt);
|
152 |
-
};
|
153 |
-
this.activate_action = function(evt) {
|
154 |
-
return _this.activate_field(evt);
|
155 |
-
};
|
156 |
-
this.active_field = false;
|
157 |
-
this.mouse_on_container = false;
|
158 |
-
this.results_showing = false;
|
159 |
-
this.result_highlighted = null;
|
160 |
-
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
161 |
-
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
162 |
-
this.disable_search = this.options.disable_search || false;
|
163 |
-
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
164 |
-
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
165 |
-
this.search_contains = this.options.search_contains || false;
|
166 |
-
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
167 |
-
this.max_selected_options = this.options.max_selected_options || Infinity;
|
168 |
-
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
169 |
-
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
170 |
-
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
171 |
-
return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
172 |
-
};
|
173 |
-
|
174 |
-
AbstractChosen.prototype.set_default_text = function() {
|
175 |
-
if (this.form_field.getAttribute("data-placeholder")) {
|
176 |
-
this.default_text = this.form_field.getAttribute("data-placeholder");
|
177 |
-
} else if (this.is_multiple) {
|
178 |
-
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
179 |
-
} else {
|
180 |
-
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
181 |
-
}
|
182 |
-
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
183 |
-
};
|
184 |
-
|
185 |
-
AbstractChosen.prototype.choice_label = function(item) {
|
186 |
-
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
187 |
-
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
188 |
-
} else {
|
189 |
-
return item.html;
|
190 |
-
}
|
191 |
-
};
|
192 |
-
|
193 |
-
AbstractChosen.prototype.mouse_enter = function() {
|
194 |
-
return this.mouse_on_container = true;
|
195 |
-
};
|
196 |
-
|
197 |
-
AbstractChosen.prototype.mouse_leave = function() {
|
198 |
-
return this.mouse_on_container = false;
|
199 |
-
};
|
200 |
-
|
201 |
-
AbstractChosen.prototype.input_focus = function(evt) {
|
202 |
-
var _this = this;
|
203 |
-
if (this.is_multiple) {
|
204 |
-
if (!this.active_field) {
|
205 |
-
return setTimeout((function() {
|
206 |
-
return _this.container_mousedown();
|
207 |
-
}), 50);
|
208 |
-
}
|
209 |
-
} else {
|
210 |
-
if (!this.active_field) {
|
211 |
-
return this.activate_field();
|
212 |
-
}
|
213 |
-
}
|
214 |
-
};
|
215 |
-
|
216 |
-
AbstractChosen.prototype.input_blur = function(evt) {
|
217 |
-
var _this = this;
|
218 |
-
if (!this.mouse_on_container) {
|
219 |
-
this.active_field = false;
|
220 |
-
return setTimeout((function() {
|
221 |
-
return _this.blur_test();
|
222 |
-
}), 100);
|
223 |
-
}
|
224 |
-
};
|
225 |
-
|
226 |
-
AbstractChosen.prototype.results_option_build = function(options) {
|
227 |
-
var content, data, _i, _len, _ref;
|
228 |
-
content = '';
|
229 |
-
_ref = this.results_data;
|
230 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
231 |
-
data = _ref[_i];
|
232 |
-
if (data.group) {
|
233 |
-
content += this.result_add_group(data);
|
234 |
-
} else {
|
235 |
-
content += this.result_add_option(data);
|
236 |
-
}
|
237 |
-
if (options != null ? options.first : void 0) {
|
238 |
-
if (data.selected && this.is_multiple) {
|
239 |
-
this.choice_build(data);
|
240 |
-
} else if (data.selected && !this.is_multiple) {
|
241 |
-
this.single_set_selected_text(this.choice_label(data));
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}
|
245 |
-
return content;
|
246 |
-
};
|
247 |
-
|
248 |
-
AbstractChosen.prototype.result_add_option = function(option) {
|
249 |
-
var classes, option_el;
|
250 |
-
if (!option.search_match) {
|
251 |
-
return '';
|
252 |
-
}
|
253 |
-
if (!this.include_option_in_results(option)) {
|
254 |
-
return '';
|
255 |
-
}
|
256 |
-
classes = [];
|
257 |
-
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
258 |
-
classes.push("active-result");
|
259 |
-
}
|
260 |
-
if (option.disabled && !(option.selected && this.is_multiple)) {
|
261 |
-
classes.push("disabled-result");
|
262 |
-
}
|
263 |
-
if (option.selected) {
|
264 |
-
classes.push("result-selected");
|
265 |
-
}
|
266 |
-
if (option.group_array_index != null) {
|
267 |
-
classes.push("group-option");
|
268 |
-
}
|
269 |
-
if (option.classes !== "") {
|
270 |
-
classes.push(option.classes);
|
271 |
-
}
|
272 |
-
option_el = document.createElement("li");
|
273 |
-
option_el.className = classes.join(" ");
|
274 |
-
option_el.style.cssText = option.style;
|
275 |
-
option_el.setAttribute("data-option-array-index", option.array_index);
|
276 |
-
option_el.innerHTML = option.search_text;
|
277 |
-
if (option.title) {
|
278 |
-
option_el.title = option.title;
|
279 |
-
}
|
280 |
-
return this.outerHTML(option_el);
|
281 |
-
};
|
282 |
-
|
283 |
-
AbstractChosen.prototype.result_add_group = function(group) {
|
284 |
-
var classes, group_el;
|
285 |
-
if (!(group.search_match || group.group_match)) {
|
286 |
-
return '';
|
287 |
-
}
|
288 |
-
if (!(group.active_options > 0)) {
|
289 |
-
return '';
|
290 |
-
}
|
291 |
-
classes = [];
|
292 |
-
classes.push("group-result");
|
293 |
-
if (group.classes) {
|
294 |
-
classes.push(group.classes);
|
295 |
-
}
|
296 |
-
group_el = document.createElement("li");
|
297 |
-
group_el.className = classes.join(" ");
|
298 |
-
group_el.innerHTML = group.search_text;
|
299 |
-
if (group.title) {
|
300 |
-
group_el.title = group.title;
|
301 |
-
}
|
302 |
-
return this.outerHTML(group_el);
|
303 |
-
};
|
304 |
-
|
305 |
-
AbstractChosen.prototype.results_update_field = function() {
|
306 |
-
this.set_default_text();
|
307 |
-
if (!this.is_multiple) {
|
308 |
-
this.results_reset_cleanup();
|
309 |
-
}
|
310 |
-
this.result_clear_highlight();
|
311 |
-
this.results_build();
|
312 |
-
if (this.results_showing) {
|
313 |
-
return this.winnow_results();
|
314 |
-
}
|
315 |
-
};
|
316 |
-
|
317 |
-
AbstractChosen.prototype.reset_single_select_options = function() {
|
318 |
-
var result, _i, _len, _ref, _results;
|
319 |
-
_ref = this.results_data;
|
320 |
-
_results = [];
|
321 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
322 |
-
result = _ref[_i];
|
323 |
-
if (result.selected) {
|
324 |
-
_results.push(result.selected = false);
|
325 |
-
} else {
|
326 |
-
_results.push(void 0);
|
327 |
-
}
|
328 |
-
}
|
329 |
-
return _results;
|
330 |
-
};
|
331 |
-
|
332 |
-
AbstractChosen.prototype.results_toggle = function() {
|
333 |
-
if (this.results_showing) {
|
334 |
-
return this.results_hide();
|
335 |
-
} else {
|
336 |
-
return this.results_show();
|
337 |
-
}
|
338 |
-
};
|
339 |
-
|
340 |
-
AbstractChosen.prototype.results_search = function(evt) {
|
341 |
-
if (this.results_showing) {
|
342 |
-
return this.winnow_results();
|
343 |
-
} else {
|
344 |
-
return this.results_show();
|
345 |
-
}
|
346 |
-
};
|
347 |
-
|
348 |
-
AbstractChosen.prototype.winnow_results = function() {
|
349 |
-
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
350 |
-
this.no_results_clear();
|
351 |
-
results = 0;
|
352 |
-
searchText = this.get_search_text();
|
353 |
-
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
354 |
-
zregex = new RegExp(escapedSearchText, 'i');
|
355 |
-
regex = this.get_search_regex(escapedSearchText);
|
356 |
-
_ref = this.results_data;
|
357 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
358 |
-
option = _ref[_i];
|
359 |
-
option.search_match = false;
|
360 |
-
results_group = null;
|
361 |
-
if (this.include_option_in_results(option)) {
|
362 |
-
if (option.group) {
|
363 |
-
option.group_match = false;
|
364 |
-
option.active_options = 0;
|
365 |
-
}
|
366 |
-
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
367 |
-
results_group = this.results_data[option.group_array_index];
|
368 |
-
if (results_group.active_options === 0 && results_group.search_match) {
|
369 |
-
results += 1;
|
370 |
-
}
|
371 |
-
results_group.active_options += 1;
|
372 |
-
}
|
373 |
-
option.search_text = option.group ? option.label : option.html;
|
374 |
-
if (!(option.group && !this.group_search)) {
|
375 |
-
option.search_match = this.search_string_match(option.search_text, regex);
|
376 |
-
if (option.search_match && !option.group) {
|
377 |
-
results += 1;
|
378 |
-
}
|
379 |
-
if (option.search_match) {
|
380 |
-
if (searchText.length) {
|
381 |
-
startpos = option.search_text.search(zregex);
|
382 |
-
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
383 |
-
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
384 |
-
}
|
385 |
-
if (results_group != null) {
|
386 |
-
results_group.group_match = true;
|
387 |
-
}
|
388 |
-
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
389 |
-
option.search_match = true;
|
390 |
-
}
|
391 |
-
}
|
392 |
-
}
|
393 |
-
}
|
394 |
-
this.result_clear_highlight();
|
395 |
-
if (results < 1 && searchText.length) {
|
396 |
-
this.update_results_content("");
|
397 |
-
return this.no_results(searchText);
|
398 |
-
} else {
|
399 |
-
this.update_results_content(this.results_option_build());
|
400 |
-
return this.winnow_results_set_highlight();
|
401 |
-
}
|
402 |
-
};
|
403 |
-
|
404 |
-
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
405 |
-
var regex_anchor;
|
406 |
-
regex_anchor = this.search_contains ? "" : "^";
|
407 |
-
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
408 |
-
};
|
409 |
-
|
410 |
-
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
411 |
-
var part, parts, _i, _len;
|
412 |
-
if (regex.test(search_string)) {
|
413 |
-
return true;
|
414 |
-
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
415 |
-
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
416 |
-
if (parts.length) {
|
417 |
-
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
418 |
-
part = parts[_i];
|
419 |
-
if (regex.test(part)) {
|
420 |
-
return true;
|
421 |
-
}
|
422 |
-
}
|
423 |
-
}
|
424 |
-
}
|
425 |
-
};
|
426 |
-
|
427 |
-
AbstractChosen.prototype.choices_count = function() {
|
428 |
-
var option, _i, _len, _ref;
|
429 |
-
if (this.selected_option_count != null) {
|
430 |
-
return this.selected_option_count;
|
431 |
-
}
|
432 |
-
this.selected_option_count = 0;
|
433 |
-
_ref = this.form_field.options;
|
434 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
435 |
-
option = _ref[_i];
|
436 |
-
if (option.selected) {
|
437 |
-
this.selected_option_count += 1;
|
438 |
-
}
|
439 |
-
}
|
440 |
-
return this.selected_option_count;
|
441 |
-
};
|
442 |
-
|
443 |
-
AbstractChosen.prototype.choices_click = function(evt) {
|
444 |
-
evt.preventDefault();
|
445 |
-
if (!(this.results_showing || this.is_disabled)) {
|
446 |
-
return this.results_show();
|
447 |
-
}
|
448 |
-
};
|
449 |
-
|
450 |
-
AbstractChosen.prototype.keyup_checker = function(evt) {
|
451 |
-
var stroke, _ref;
|
452 |
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
453 |
-
this.search_field_scale();
|
454 |
-
switch (stroke) {
|
455 |
-
case 8:
|
456 |
-
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
457 |
-
return this.keydown_backstroke();
|
458 |
-
} else if (!this.pending_backstroke) {
|
459 |
-
this.result_clear_highlight();
|
460 |
-
return this.results_search();
|
461 |
-
}
|
462 |
-
break;
|
463 |
-
case 13:
|
464 |
-
evt.preventDefault();
|
465 |
-
if (this.results_showing) {
|
466 |
-
return this.result_select(evt);
|
467 |
-
}
|
468 |
-
break;
|
469 |
-
case 27:
|
470 |
-
if (this.results_showing) {
|
471 |
-
this.results_hide();
|
472 |
-
}
|
473 |
-
return true;
|
474 |
-
case 9:
|
475 |
-
case 38:
|
476 |
-
case 40:
|
477 |
-
case 16:
|
478 |
-
case 91:
|
479 |
-
case 17:
|
480 |
-
break;
|
481 |
-
default:
|
482 |
-
return this.results_search();
|
483 |
-
}
|
484 |
-
};
|
485 |
-
|
486 |
-
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
487 |
-
var _this = this;
|
488 |
-
return setTimeout((function() {
|
489 |
-
return _this.results_search();
|
490 |
-
}), 50);
|
491 |
-
};
|
492 |
-
|
493 |
-
AbstractChosen.prototype.container_width = function() {
|
494 |
-
if (this.options.width != null) {
|
495 |
-
return this.options.width;
|
496 |
-
} else {
|
497 |
-
return "" + this.form_field.offsetWidth + "px";
|
498 |
-
}
|
499 |
-
};
|
500 |
-
|
501 |
-
AbstractChosen.prototype.include_option_in_results = function(option) {
|
502 |
-
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
503 |
-
return false;
|
504 |
-
}
|
505 |
-
if (!this.display_disabled_options && option.disabled) {
|
506 |
-
return false;
|
507 |
-
}
|
508 |
-
if (option.empty) {
|
509 |
-
return false;
|
510 |
-
}
|
511 |
-
return true;
|
512 |
-
};
|
513 |
-
|
514 |
-
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
515 |
-
this.touch_started = true;
|
516 |
-
return this.search_results_mouseover(evt);
|
517 |
-
};
|
518 |
-
|
519 |
-
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
520 |
-
this.touch_started = false;
|
521 |
-
return this.search_results_mouseout(evt);
|
522 |
-
};
|
523 |
-
|
524 |
-
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
525 |
-
if (this.touch_started) {
|
526 |
-
return this.search_results_mouseup(evt);
|
527 |
-
}
|
528 |
-
};
|
529 |
-
|
530 |
-
AbstractChosen.prototype.outerHTML = function(element) {
|
531 |
-
var tmp;
|
532 |
-
if (element.outerHTML) {
|
533 |
-
return element.outerHTML;
|
534 |
-
}
|
535 |
-
tmp = document.createElement("div");
|
536 |
-
tmp.appendChild(element);
|
537 |
-
return tmp.innerHTML;
|
538 |
-
};
|
539 |
-
|
540 |
-
AbstractChosen.browser_is_supported = function() {
|
541 |
-
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
542 |
-
return document.documentMode >= 8;
|
543 |
-
}
|
544 |
-
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
545 |
-
return false;
|
546 |
-
}
|
547 |
-
if (/Android/i.test(window.navigator.userAgent)) {
|
548 |
-
if (/Mobile/i.test(window.navigator.userAgent)) {
|
549 |
-
return false;
|
550 |
-
}
|
551 |
-
}
|
552 |
-
return true;
|
553 |
-
};
|
554 |
-
|
555 |
-
AbstractChosen.default_multiple_text = "Select Some Options";
|
556 |
-
|
557 |
-
AbstractChosen.default_single_text = "Select an Option";
|
558 |
-
|
559 |
-
AbstractChosen.default_no_result_text = "No results match";
|
560 |
-
|
561 |
-
return AbstractChosen;
|
562 |
-
|
563 |
-
})();
|
564 |
-
|
565 |
-
$ = jQuery;
|
566 |
-
|
567 |
-
$.fn.extend({
|
568 |
-
chosen: function(options) {
|
569 |
-
if (!AbstractChosen.browser_is_supported()) {
|
570 |
-
return this;
|
571 |
-
}
|
572 |
-
return this.each(function(input_field) {
|
573 |
-
var $this, chosen;
|
574 |
-
$this = $(this);
|
575 |
-
chosen = $this.data('chosen');
|
576 |
-
if (options === 'destroy' && chosen instanceof Chosen) {
|
577 |
-
chosen.destroy();
|
578 |
-
} else if (!(chosen instanceof Chosen)) {
|
579 |
-
$this.data('chosen', new Chosen(this, options));
|
580 |
-
}
|
581 |
-
});
|
582 |
-
}
|
583 |
-
});
|
584 |
-
|
585 |
-
Chosen = (function(_super) {
|
586 |
-
__extends(Chosen, _super);
|
587 |
-
|
588 |
-
function Chosen() {
|
589 |
-
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
590 |
-
return _ref;
|
591 |
-
}
|
592 |
-
|
593 |
-
Chosen.prototype.setup = function() {
|
594 |
-
this.form_field_jq = $(this.form_field);
|
595 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
596 |
-
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
597 |
-
};
|
598 |
-
|
599 |
-
Chosen.prototype.set_up_html = function() {
|
600 |
-
var container_classes, container_props;
|
601 |
-
container_classes = ["chosen-container"];
|
602 |
-
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
603 |
-
if (this.inherit_select_classes && this.form_field.className) {
|
604 |
-
container_classes.push(this.form_field.className);
|
605 |
-
}
|
606 |
-
if (this.is_rtl) {
|
607 |
-
container_classes.push("chosen-rtl");
|
608 |
-
}
|
609 |
-
container_props = {
|
610 |
-
'class': container_classes.join(' '),
|
611 |
-
'style': "width: " + (this.container_width()) + ";",
|
612 |
-
'title': this.form_field.title
|
613 |
-
};
|
614 |
-
if (this.form_field.id.length) {
|
615 |
-
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
616 |
-
}
|
617 |
-
this.container = $("<div />", container_props);
|
618 |
-
if (this.is_multiple) {
|
619 |
-
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
620 |
-
} else {
|
621 |
-
this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
622 |
-
}
|
623 |
-
this.form_field_jq.hide().after(this.container);
|
624 |
-
this.dropdown = this.container.find('div.chosen-drop').first();
|
625 |
-
this.search_field = this.container.find('input').first();
|
626 |
-
this.search_results = this.container.find('ul.chosen-results').first();
|
627 |
-
this.search_field_scale();
|
628 |
-
this.search_no_results = this.container.find('li.no-results').first();
|
629 |
-
if (this.is_multiple) {
|
630 |
-
this.search_choices = this.container.find('ul.chosen-choices').first();
|
631 |
-
this.search_container = this.container.find('li.search-field').first();
|
632 |
-
} else {
|
633 |
-
this.search_container = this.container.find('div.chosen-search').first();
|
634 |
-
this.selected_item = this.container.find('.chosen-single').first();
|
635 |
-
}
|
636 |
-
this.results_build();
|
637 |
-
this.set_tab_index();
|
638 |
-
return this.set_label_behavior();
|
639 |
-
};
|
640 |
-
|
641 |
-
Chosen.prototype.on_ready = function() {
|
642 |
-
return this.form_field_jq.trigger("chosen:ready", {
|
643 |
-
chosen: this
|
644 |
-
});
|
645 |
-
};
|
646 |
-
|
647 |
-
Chosen.prototype.register_observers = function() {
|
648 |
-
var _this = this;
|
649 |
-
this.container.bind('touchstart.chosen', function(evt) {
|
650 |
-
_this.container_mousedown(evt);
|
651 |
-
return evt.preventDefault();
|
652 |
-
});
|
653 |
-
this.container.bind('touchend.chosen', function(evt) {
|
654 |
-
_this.container_mouseup(evt);
|
655 |
-
return evt.preventDefault();
|
656 |
-
});
|
657 |
-
this.container.bind('mousedown.chosen', function(evt) {
|
658 |
-
_this.container_mousedown(evt);
|
659 |
-
});
|
660 |
-
this.container.bind('mouseup.chosen', function(evt) {
|
661 |
-
_this.container_mouseup(evt);
|
662 |
-
});
|
663 |
-
this.container.bind('mouseenter.chosen', function(evt) {
|
664 |
-
_this.mouse_enter(evt);
|
665 |
-
});
|
666 |
-
this.container.bind('mouseleave.chosen', function(evt) {
|
667 |
-
_this.mouse_leave(evt);
|
668 |
-
});
|
669 |
-
this.search_results.bind('mouseup.chosen', function(evt) {
|
670 |
-
_this.search_results_mouseup(evt);
|
671 |
-
});
|
672 |
-
this.search_results.bind('mouseover.chosen', function(evt) {
|
673 |
-
_this.search_results_mouseover(evt);
|
674 |
-
});
|
675 |
-
this.search_results.bind('mouseout.chosen', function(evt) {
|
676 |
-
_this.search_results_mouseout(evt);
|
677 |
-
});
|
678 |
-
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
679 |
-
_this.search_results_mousewheel(evt);
|
680 |
-
});
|
681 |
-
this.search_results.bind('touchstart.chosen', function(evt) {
|
682 |
-
_this.search_results_touchstart(evt);
|
683 |
-
});
|
684 |
-
this.search_results.bind('touchmove.chosen', function(evt) {
|
685 |
-
_this.search_results_touchmove(evt);
|
686 |
-
});
|
687 |
-
this.search_results.bind('touchend.chosen', function(evt) {
|
688 |
-
_this.search_results_touchend(evt);
|
689 |
-
});
|
690 |
-
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
691 |
-
_this.results_update_field(evt);
|
692 |
-
});
|
693 |
-
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
694 |
-
_this.activate_field(evt);
|
695 |
-
});
|
696 |
-
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
697 |
-
_this.container_mousedown(evt);
|
698 |
-
});
|
699 |
-
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
700 |
-
_this.input_blur(evt);
|
701 |
-
});
|
702 |
-
this.search_field.bind('blur.chosen', function(evt) {
|
703 |
-
_this.input_blur(evt);
|
704 |
-
});
|
705 |
-
this.search_field.bind('keyup.chosen', function(evt) {
|
706 |
-
_this.keyup_checker(evt);
|
707 |
-
});
|
708 |
-
this.search_field.bind('keydown.chosen', function(evt) {
|
709 |
-
_this.keydown_checker(evt);
|
710 |
-
});
|
711 |
-
this.search_field.bind('focus.chosen', function(evt) {
|
712 |
-
_this.input_focus(evt);
|
713 |
-
});
|
714 |
-
this.search_field.bind('cut.chosen', function(evt) {
|
715 |
-
_this.clipboard_event_checker(evt);
|
716 |
-
});
|
717 |
-
this.search_field.bind('paste.chosen', function(evt) {
|
718 |
-
_this.clipboard_event_checker(evt);
|
719 |
-
});
|
720 |
-
if (this.is_multiple) {
|
721 |
-
return this.search_choices.bind('click.chosen', function(evt) {
|
722 |
-
_this.choices_click(evt);
|
723 |
-
});
|
724 |
-
} else {
|
725 |
-
return this.container.bind('click.chosen', function(evt) {
|
726 |
-
evt.preventDefault();
|
727 |
-
});
|
728 |
-
}
|
729 |
-
};
|
730 |
-
|
731 |
-
Chosen.prototype.destroy = function() {
|
732 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
733 |
-
if (this.search_field[0].tabIndex) {
|
734 |
-
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
735 |
-
}
|
736 |
-
this.container.remove();
|
737 |
-
this.form_field_jq.removeData('chosen');
|
738 |
-
return this.form_field_jq.show();
|
739 |
-
};
|
740 |
-
|
741 |
-
Chosen.prototype.search_field_disabled = function() {
|
742 |
-
this.is_disabled = this.form_field_jq[0].disabled;
|
743 |
-
if (this.is_disabled) {
|
744 |
-
this.container.addClass('chosen-disabled');
|
745 |
-
this.search_field[0].disabled = true;
|
746 |
-
if (!this.is_multiple) {
|
747 |
-
this.selected_item.unbind("focus.chosen", this.activate_action);
|
748 |
-
}
|
749 |
-
return this.close_field();
|
750 |
-
} else {
|
751 |
-
this.container.removeClass('chosen-disabled');
|
752 |
-
this.search_field[0].disabled = false;
|
753 |
-
if (!this.is_multiple) {
|
754 |
-
return this.selected_item.bind("focus.chosen", this.activate_action);
|
755 |
-
}
|
756 |
-
}
|
757 |
-
};
|
758 |
-
|
759 |
-
Chosen.prototype.container_mousedown = function(evt) {
|
760 |
-
if (!this.is_disabled) {
|
761 |
-
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
762 |
-
evt.preventDefault();
|
763 |
-
}
|
764 |
-
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
765 |
-
if (!this.active_field) {
|
766 |
-
if (this.is_multiple) {
|
767 |
-
this.search_field.val("");
|
768 |
-
}
|
769 |
-
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
770 |
-
this.results_show();
|
771 |
-
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
772 |
-
evt.preventDefault();
|
773 |
-
this.results_toggle();
|
774 |
-
}
|
775 |
-
return this.activate_field();
|
776 |
-
}
|
777 |
-
}
|
778 |
-
};
|
779 |
-
|
780 |
-
Chosen.prototype.container_mouseup = function(evt) {
|
781 |
-
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
782 |
-
return this.results_reset(evt);
|
783 |
-
}
|
784 |
-
};
|
785 |
-
|
786 |
-
Chosen.prototype.search_results_mousewheel = function(evt) {
|
787 |
-
var delta;
|
788 |
-
if (evt.originalEvent) {
|
789 |
-
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
790 |
-
}
|
791 |
-
if (delta != null) {
|
792 |
-
evt.preventDefault();
|
793 |
-
if (evt.type === 'DOMMouseScroll') {
|
794 |
-
delta = delta * 40;
|
795 |
-
}
|
796 |
-
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
797 |
-
}
|
798 |
-
};
|
799 |
-
|
800 |
-
Chosen.prototype.blur_test = function(evt) {
|
801 |
-
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
802 |
-
return this.close_field();
|
803 |
-
}
|
804 |
-
};
|
805 |
-
|
806 |
-
Chosen.prototype.close_field = function() {
|
807 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
808 |
-
this.active_field = false;
|
809 |
-
this.results_hide();
|
810 |
-
this.container.removeClass("chosen-container-active");
|
811 |
-
this.clear_backstroke();
|
812 |
-
this.show_search_field_default();
|
813 |
-
return this.search_field_scale();
|
814 |
-
};
|
815 |
-
|
816 |
-
Chosen.prototype.activate_field = function() {
|
817 |
-
this.container.addClass("chosen-container-active");
|
818 |
-
this.active_field = true;
|
819 |
-
this.search_field.val(this.search_field.val());
|
820 |
-
return this.search_field.focus();
|
821 |
-
};
|
822 |
-
|
823 |
-
Chosen.prototype.test_active_click = function(evt) {
|
824 |
-
var active_container;
|
825 |
-
active_container = $(evt.target).closest('.chosen-container');
|
826 |
-
if (active_container.length && this.container[0] === active_container[0]) {
|
827 |
-
return this.active_field = true;
|
828 |
-
} else {
|
829 |
-
return this.close_field();
|
830 |
-
}
|
831 |
-
};
|
832 |
-
|
833 |
-
Chosen.prototype.results_build = function() {
|
834 |
-
this.parsing = true;
|
835 |
-
this.selected_option_count = null;
|
836 |
-
this.results_data = SelectParser.select_to_array(this.form_field);
|
837 |
-
if (this.is_multiple) {
|
838 |
-
this.search_choices.find("li.search-choice").remove();
|
839 |
-
} else if (!this.is_multiple) {
|
840 |
-
this.single_set_selected_text();
|
841 |
-
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
842 |
-
this.search_field[0].readOnly = true;
|
843 |
-
this.container.addClass("chosen-container-single-nosearch");
|
844 |
-
} else {
|
845 |
-
this.search_field[0].readOnly = false;
|
846 |
-
this.container.removeClass("chosen-container-single-nosearch");
|
847 |
-
}
|
848 |
-
}
|
849 |
-
this.update_results_content(this.results_option_build({
|
850 |
-
first: true
|
851 |
-
}));
|
852 |
-
this.search_field_disabled();
|
853 |
-
this.show_search_field_default();
|
854 |
-
this.search_field_scale();
|
855 |
-
return this.parsing = false;
|
856 |
-
};
|
857 |
-
|
858 |
-
Chosen.prototype.result_do_highlight = function(el) {
|
859 |
-
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
860 |
-
if (el.length) {
|
861 |
-
this.result_clear_highlight();
|
862 |
-
this.result_highlight = el;
|
863 |
-
this.result_highlight.addClass("highlighted");
|
864 |
-
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
865 |
-
visible_top = this.search_results.scrollTop();
|
866 |
-
visible_bottom = maxHeight + visible_top;
|
867 |
-
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
868 |
-
high_bottom = high_top + this.result_highlight.outerHeight();
|
869 |
-
if (high_bottom >= visible_bottom) {
|
870 |
-
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
871 |
-
} else if (high_top < visible_top) {
|
872 |
-
return this.search_results.scrollTop(high_top);
|
873 |
-
}
|
874 |
-
}
|
875 |
-
};
|
876 |
-
|
877 |
-
Chosen.prototype.result_clear_highlight = function() {
|
878 |
-
if (this.result_highlight) {
|
879 |
-
this.result_highlight.removeClass("highlighted");
|
880 |
-
}
|
881 |
-
return this.result_highlight = null;
|
882 |
-
};
|
883 |
-
|
884 |
-
Chosen.prototype.results_show = function() {
|
885 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
886 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
887 |
-
chosen: this
|
888 |
-
});
|
889 |
-
return false;
|
890 |
-
}
|
891 |
-
this.container.addClass("chosen-with-drop");
|
892 |
-
this.results_showing = true;
|
893 |
-
this.search_field.focus();
|
894 |
-
this.search_field.val(this.search_field.val());
|
895 |
-
this.winnow_results();
|
896 |
-
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
897 |
-
chosen: this
|
898 |
-
});
|
899 |
-
};
|
900 |
-
|
901 |
-
Chosen.prototype.update_results_content = function(content) {
|
902 |
-
return this.search_results.html(content);
|
903 |
-
};
|
904 |
-
|
905 |
-
Chosen.prototype.results_hide = function() {
|
906 |
-
if (this.results_showing) {
|
907 |
-
this.result_clear_highlight();
|
908 |
-
this.container.removeClass("chosen-with-drop");
|
909 |
-
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
910 |
-
chosen: this
|
911 |
-
});
|
912 |
-
}
|
913 |
-
return this.results_showing = false;
|
914 |
-
};
|
915 |
-
|
916 |
-
Chosen.prototype.set_tab_index = function(el) {
|
917 |
-
var ti;
|
918 |
-
if (this.form_field.tabIndex) {
|
919 |
-
ti = this.form_field.tabIndex;
|
920 |
-
this.form_field.tabIndex = -1;
|
921 |
-
return this.search_field[0].tabIndex = ti;
|
922 |
-
}
|
923 |
-
};
|
924 |
-
|
925 |
-
Chosen.prototype.set_label_behavior = function() {
|
926 |
-
var _this = this;
|
927 |
-
this.form_field_label = this.form_field_jq.parents("label");
|
928 |
-
if (!this.form_field_label.length && this.form_field.id.length) {
|
929 |
-
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
930 |
-
}
|
931 |
-
if (this.form_field_label.length > 0) {
|
932 |
-
return this.form_field_label.bind('click.chosen', function(evt) {
|
933 |
-
if (_this.is_multiple) {
|
934 |
-
return _this.container_mousedown(evt);
|
935 |
-
} else {
|
936 |
-
return _this.activate_field();
|
937 |
-
}
|
938 |
-
});
|
939 |
-
}
|
940 |
-
};
|
941 |
-
|
942 |
-
Chosen.prototype.show_search_field_default = function() {
|
943 |
-
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
944 |
-
this.search_field.val(this.default_text);
|
945 |
-
return this.search_field.addClass("default");
|
946 |
-
} else {
|
947 |
-
this.search_field.val("");
|
948 |
-
return this.search_field.removeClass("default");
|
949 |
-
}
|
950 |
-
};
|
951 |
-
|
952 |
-
Chosen.prototype.search_results_mouseup = function(evt) {
|
953 |
-
var target;
|
954 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
955 |
-
if (target.length) {
|
956 |
-
this.result_highlight = target;
|
957 |
-
this.result_select(evt);
|
958 |
-
return this.search_field.focus();
|
959 |
-
}
|
960 |
-
};
|
961 |
-
|
962 |
-
Chosen.prototype.search_results_mouseover = function(evt) {
|
963 |
-
var target;
|
964 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
965 |
-
if (target) {
|
966 |
-
return this.result_do_highlight(target);
|
967 |
-
}
|
968 |
-
};
|
969 |
-
|
970 |
-
Chosen.prototype.search_results_mouseout = function(evt) {
|
971 |
-
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
972 |
-
return this.result_clear_highlight();
|
973 |
-
}
|
974 |
-
};
|
975 |
-
|
976 |
-
Chosen.prototype.choice_build = function(item) {
|
977 |
-
var choice, close_link,
|
978 |
-
_this = this;
|
979 |
-
choice = $('<li />', {
|
980 |
-
"class": "search-choice"
|
981 |
-
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
982 |
-
if (item.disabled) {
|
983 |
-
choice.addClass('search-choice-disabled');
|
984 |
-
} else {
|
985 |
-
close_link = $('<a />', {
|
986 |
-
"class": 'search-choice-close',
|
987 |
-
'data-option-array-index': item.array_index
|
988 |
-
});
|
989 |
-
close_link.bind('click.chosen', function(evt) {
|
990 |
-
return _this.choice_destroy_link_click(evt);
|
991 |
-
});
|
992 |
-
choice.append(close_link);
|
993 |
-
}
|
994 |
-
return this.search_container.before(choice);
|
995 |
-
};
|
996 |
-
|
997 |
-
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
998 |
-
evt.preventDefault();
|
999 |
-
evt.stopPropagation();
|
1000 |
-
if (!this.is_disabled) {
|
1001 |
-
return this.choice_destroy($(evt.target));
|
1002 |
-
}
|
1003 |
-
};
|
1004 |
-
|
1005 |
-
Chosen.prototype.choice_destroy = function(link) {
|
1006 |
-
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
1007 |
-
this.show_search_field_default();
|
1008 |
-
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
1009 |
-
this.results_hide();
|
1010 |
-
}
|
1011 |
-
link.parents('li').first().remove();
|
1012 |
-
return this.search_field_scale();
|
1013 |
-
}
|
1014 |
-
};
|
1015 |
-
|
1016 |
-
Chosen.prototype.results_reset = function() {
|
1017 |
-
this.reset_single_select_options();
|
1018 |
-
this.form_field.options[0].selected = true;
|
1019 |
-
this.single_set_selected_text();
|
1020 |
-
this.show_search_field_default();
|
1021 |
-
this.results_reset_cleanup();
|
1022 |
-
this.form_field_jq.trigger("change");
|
1023 |
-
if (this.active_field) {
|
1024 |
-
return this.results_hide();
|
1025 |
-
}
|
1026 |
-
};
|
1027 |
-
|
1028 |
-
Chosen.prototype.results_reset_cleanup = function() {
|
1029 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1030 |
-
return this.selected_item.find("abbr").remove();
|
1031 |
-
};
|
1032 |
-
|
1033 |
-
Chosen.prototype.result_select = function(evt) {
|
1034 |
-
var high, item;
|
1035 |
-
if (this.result_highlight) {
|
1036 |
-
high = this.result_highlight;
|
1037 |
-
this.result_clear_highlight();
|
1038 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1039 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
1040 |
-
chosen: this
|
1041 |
-
});
|
1042 |
-
return false;
|
1043 |
-
}
|
1044 |
-
if (this.is_multiple) {
|
1045 |
-
high.removeClass("active-result");
|
1046 |
-
} else {
|
1047 |
-
this.reset_single_select_options();
|
1048 |
-
}
|
1049 |
-
high.addClass("result-selected");
|
1050 |
-
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1051 |
-
item.selected = true;
|
1052 |
-
this.form_field.options[item.options_index].selected = true;
|
1053 |
-
this.selected_option_count = null;
|
1054 |
-
if (this.is_multiple) {
|
1055 |
-
this.choice_build(item);
|
1056 |
-
} else {
|
1057 |
-
this.single_set_selected_text(this.choice_label(item));
|
1058 |
-
}
|
1059 |
-
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1060 |
-
this.results_hide();
|
1061 |
-
}
|
1062 |
-
this.search_field.val("");
|
1063 |
-
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1064 |
-
this.form_field_jq.trigger("change", {
|
1065 |
-
'selected': this.form_field.options[item.options_index].value
|
1066 |
-
});
|
1067 |
-
}
|
1068 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1069 |
-
evt.preventDefault();
|
1070 |
-
return this.search_field_scale();
|
1071 |
-
}
|
1072 |
-
};
|
1073 |
-
|
1074 |
-
Chosen.prototype.single_set_selected_text = function(text) {
|
1075 |
-
if (text == null) {
|
1076 |
-
text = this.default_text;
|
1077 |
-
}
|
1078 |
-
if (text === this.default_text) {
|
1079 |
-
this.selected_item.addClass("chosen-default");
|
1080 |
-
} else {
|
1081 |
-
this.single_deselect_control_build();
|
1082 |
-
this.selected_item.removeClass("chosen-default");
|
1083 |
-
}
|
1084 |
-
return this.selected_item.find("span").html(text);
|
1085 |
-
};
|
1086 |
-
|
1087 |
-
Chosen.prototype.result_deselect = function(pos) {
|
1088 |
-
var result_data;
|
1089 |
-
result_data = this.results_data[pos];
|
1090 |
-
if (!this.form_field.options[result_data.options_index].disabled) {
|
1091 |
-
result_data.selected = false;
|
1092 |
-
this.form_field.options[result_data.options_index].selected = false;
|
1093 |
-
this.selected_option_count = null;
|
1094 |
-
this.result_clear_highlight();
|
1095 |
-
if (this.results_showing) {
|
1096 |
-
this.winnow_results();
|
1097 |
-
}
|
1098 |
-
this.form_field_jq.trigger("change", {
|
1099 |
-
deselected: this.form_field.options[result_data.options_index].value
|
1100 |
-
});
|
1101 |
-
this.search_field_scale();
|
1102 |
-
return true;
|
1103 |
-
} else {
|
1104 |
-
return false;
|
1105 |
-
}
|
1106 |
-
};
|
1107 |
-
|
1108 |
-
Chosen.prototype.single_deselect_control_build = function() {
|
1109 |
-
if (!this.allow_single_deselect) {
|
1110 |
-
return;
|
1111 |
-
}
|
1112 |
-
if (!this.selected_item.find("abbr").length) {
|
1113 |
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1114 |
-
}
|
1115 |
-
return this.selected_item.addClass("chosen-single-with-deselect");
|
1116 |
-
};
|
1117 |
-
|
1118 |
-
Chosen.prototype.get_search_text = function() {
|
1119 |
-
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1120 |
-
};
|
1121 |
-
|
1122 |
-
Chosen.prototype.winnow_results_set_highlight = function() {
|
1123 |
-
var do_high, selected_results;
|
1124 |
-
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1125 |
-
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1126 |
-
if (do_high != null) {
|
1127 |
-
return this.result_do_highlight(do_high);
|
1128 |
-
}
|
1129 |
-
};
|
1130 |
-
|
1131 |
-
Chosen.prototype.no_results = function(terms) {
|
1132 |
-
var no_results_html;
|
1133 |
-
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1134 |
-
no_results_html.find("span").first().html(terms);
|
1135 |
-
this.search_results.append(no_results_html);
|
1136 |
-
return this.form_field_jq.trigger("chosen:no_results", {
|
1137 |
-
chosen: this
|
1138 |
-
});
|
1139 |
-
};
|
1140 |
-
|
1141 |
-
Chosen.prototype.no_results_clear = function() {
|
1142 |
-
return this.search_results.find(".no-results").remove();
|
1143 |
-
};
|
1144 |
-
|
1145 |
-
Chosen.prototype.keydown_arrow = function() {
|
1146 |
-
var next_sib;
|
1147 |
-
if (this.results_showing && this.result_highlight) {
|
1148 |
-
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1149 |
-
if (next_sib) {
|
1150 |
-
return this.result_do_highlight(next_sib);
|
1151 |
-
}
|
1152 |
-
} else {
|
1153 |
-
return this.results_show();
|
1154 |
-
}
|
1155 |
-
};
|
1156 |
-
|
1157 |
-
Chosen.prototype.keyup_arrow = function() {
|
1158 |
-
var prev_sibs;
|
1159 |
-
if (!this.results_showing && !this.is_multiple) {
|
1160 |
-
return this.results_show();
|
1161 |
-
} else if (this.result_highlight) {
|
1162 |
-
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1163 |
-
if (prev_sibs.length) {
|
1164 |
-
return this.result_do_highlight(prev_sibs.first());
|
1165 |
-
} else {
|
1166 |
-
if (this.choices_count() > 0) {
|
1167 |
-
this.results_hide();
|
1168 |
-
}
|
1169 |
-
return this.result_clear_highlight();
|
1170 |
-
}
|
1171 |
-
}
|
1172 |
-
};
|
1173 |
-
|
1174 |
-
Chosen.prototype.keydown_backstroke = function() {
|
1175 |
-
var next_available_destroy;
|
1176 |
-
if (this.pending_backstroke) {
|
1177 |
-
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1178 |
-
return this.clear_backstroke();
|
1179 |
-
} else {
|
1180 |
-
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1181 |
-
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1182 |
-
this.pending_backstroke = next_available_destroy;
|
1183 |
-
if (this.single_backstroke_delete) {
|
1184 |
-
return this.keydown_backstroke();
|
1185 |
-
} else {
|
1186 |
-
return this.pending_backstroke.addClass("search-choice-focus");
|
1187 |
-
}
|
1188 |
-
}
|
1189 |
-
}
|
1190 |
-
};
|
1191 |
-
|
1192 |
-
Chosen.prototype.clear_backstroke = function() {
|
1193 |
-
if (this.pending_backstroke) {
|
1194 |
-
this.pending_backstroke.removeClass("search-choice-focus");
|
1195 |
-
}
|
1196 |
-
return this.pending_backstroke = null;
|
1197 |
-
};
|
1198 |
-
|
1199 |
-
Chosen.prototype.keydown_checker = function(evt) {
|
1200 |
-
var stroke, _ref1;
|
1201 |
-
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1202 |
-
this.search_field_scale();
|
1203 |
-
if (stroke !== 8 && this.pending_backstroke) {
|
1204 |
-
this.clear_backstroke();
|
1205 |
-
}
|
1206 |
-
switch (stroke) {
|
1207 |
-
case 8:
|
1208 |
-
this.backstroke_length = this.search_field.val().length;
|
1209 |
-
break;
|
1210 |
-
case 9:
|
1211 |
-
if (this.results_showing && !this.is_multiple) {
|
1212 |
-
this.result_select(evt);
|
1213 |
-
}
|
1214 |
-
this.mouse_on_container = false;
|
1215 |
-
break;
|
1216 |
-
case 13:
|
1217 |
-
if (this.results_showing) {
|
1218 |
-
evt.preventDefault();
|
1219 |
-
}
|
1220 |
-
break;
|
1221 |
-
case 32:
|
1222 |
-
if (this.disable_search) {
|
1223 |
-
evt.preventDefault();
|
1224 |
-
}
|
1225 |
-
break;
|
1226 |
-
case 38:
|
1227 |
-
evt.preventDefault();
|
1228 |
-
this.keyup_arrow();
|
1229 |
-
break;
|
1230 |
-
case 40:
|
1231 |
-
evt.preventDefault();
|
1232 |
-
this.keydown_arrow();
|
1233 |
-
break;
|
1234 |
-
}
|
1235 |
-
};
|
1236 |
-
|
1237 |
-
Chosen.prototype.search_field_scale = function() {
|
1238 |
-
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1239 |
-
if (this.is_multiple) {
|
1240 |
-
h = 0;
|
1241 |
-
w = 0;
|
1242 |
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1243 |
-
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1244 |
-
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1245 |
-
style = styles[_i];
|
1246 |
-
style_block += style + ":" + this.search_field.css(style) + ";";
|
1247 |
-
}
|
1248 |
-
div = $('<div />', {
|
1249 |
-
'style': style_block
|
1250 |
-
});
|
1251 |
-
div.text(this.search_field.val());
|
1252 |
-
$('body').append(div);
|
1253 |
-
w = div.width() + 25;
|
1254 |
-
div.remove();
|
1255 |
-
f_width = this.container.outerWidth();
|
1256 |
-
if (w > f_width - 10) {
|
1257 |
-
w = f_width - 10;
|
1258 |
-
}
|
1259 |
-
return this.search_field.css({
|
1260 |
-
'width': w + 'px'
|
1261 |
-
});
|
1262 |
-
}
|
1263 |
-
};
|
1264 |
-
|
1265 |
-
return Chosen;
|
1266 |
-
|
1267 |
-
})(AbstractChosen);
|
1268 |
-
|
1269 |
-
}).call(this);
|
1270 |
-
/* End Chosen Selectbox */
|
22 |
/* End ipCheckbox */
|
23 |
|
24 |
/* Begin Chosen Selectbox */
|
25 |
+
/*! Chosen v1.8.2 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
26 |
+
(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s<i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&&!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&&!n.group&&(c+=1),n.search_match?(o.length&&(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(e)+"</em>"+this.escape_html(d)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
|
27 |
+
/* End Chosen Selectbox */
|
28 |
+
|
29 |
+
/* Begin jQuery TE */
|
30 |
+
/*!
|
31 |
+
*
|
32 |
+
* jQuery TE 1.4.0 , http://jqueryte.com/
|
33 |
+
* Copyright (C) 2013, Fatih Koca (fattih@fattih.com), (http://jqueryte.com/about)
|
34 |
+
|
35 |
+
* jQuery TE is provided under the MIT LICENSE.
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
(function(e){e.fn.jqte=function(t){function l(e,t,n,r,i){var s=f.length+1;return f.push({name:e,cls:s,command:t,key:n,tag:r,emphasis:i})}var n=[{title:"Text Format"},{title:"Font Size"},{title:"Color"},{title:"Bold",hotkey:"B"},{title:"Italic",hotkey:"I"},{title:"Underline",hotkey:"U"},{title:"Ordered List",hotkey:"."},{title:"Unordered List",hotkey:","},{title:"Subscript",hotkey:"down arrow"},{title:"Superscript",hotkey:"up arrow"},{title:"Outdent",hotkey:"left arrow"},{title:"Indent",hotkey:"right arrow"},{title:"Justify Left"},{title:"Justify Center"},{title:"Justify Right"},{title:"Strike Through",hotkey:"K"},{title:"Add Link",hotkey:"L"},{title:"Remove Link"},{title:"Cleaner Style",hotkey:"Delete"},{title:"Horizontal Rule",hotkey:"H"},{title:"Source"}];var r=[["p","Normal"],["h1","Header 1"],["h2","Header 2"],["h3","Header 3"],["h4","Header 4"],["h5","Header 5"],["h6","Header 6"],["pre","Preformatted"]];var i=["10","12","16","18","20","24","28"];var s=["0,0,0","68,68,68","102,102,102","153,153,153","204,204,204","238,238,238","243,243,243","255,255,255",null,"255,0,0","255,153,0","255,255,0","0,255,0","0,255,255","0,0,255","153,0,255","255,0,255",null,"244,204,204","252,229,205","255,242,204","217,234,211","208,224,227","207,226,243","217,210,233","234,209,220","234,153,153","249,203,156","255,229,153","182,215,168","162,196,201","159,197,232","180,167,214","213,166,189","224,102,102","246,178,107","255,217,102","147,196,125","118,165,175","111,168,220","142,124,195","194,123,160","204,0,0","230,145,56","241,194,50","106,168,79","69,129,142","61,133,198","103,78,167","166,77,121","153,0,0","180,95,6","191,144,0","56,118,29","19,79,92","11,83,148","53,28,117","116,27,71","102,0,0","120,63,4","127,96,0","39,78,19","12,52,61","7,55,99","32,18,77","76,17,48"];var o=["Web Address","E-mail Address","Picture URL"];var u=e.extend({status:true,css:"jqte",title:true,titletext:n,button:"OK",format:true,formats:r,fsize:true,fsizes:i,funit:"px",color:true,linktypes:o,b:true,i:true,u:true,ol:true,ul:true,sub:true,sup:true,outdent:true,indent:true,left:true,center:true,right:true,strike:true,link:true,unlink:true,remove:true,rule:true,source:true,placeholder:false,br:true,p:true,change:"",focus:"",blur:""},t);e.fn.jqteVal=function(t){e(this).closest("."+u.css).find("."+u.css+"_editor").html(t)};var a=navigator.userAgent.toLowerCase();if(/msie [1-7]./.test(a))u.title=false;var f=[];l("format","formats","","",false);l("fsize","fSize","","",false);l("color","colors","","",false);l("b","Bold","B",["b","strong"],true);l("i","Italic","I",["i","em"],true);l("u","Underline","U",["u"],true);l("ol","insertorderedlist","¾",["ol"],true);l("ul","insertunorderedlist","¼",["ul"],true);l("sub","subscript","(",["sub"],true);l("sup","superscript","&",["sup"],true);l("outdent","outdent","%",["blockquote"],false);l("indent","indent","'",["blockquote"],true);l("left","justifyLeft","","",false);l("center","justifyCenter","","",false);l("right","justifyRight","","",false);l("strike","strikeThrough","K",["strike"],true);l("link","linkcreator","L",["a"],true);l("unlink","unlink","",["a"],false);l("remove","removeformat",".","",false);l("rule","inserthorizontalrule","H",["hr"],false);l("source","displaysource","","",false);return this.each(function(){function B(){if(window.getSelection)return window.getSelection();else if(document.selection&&document.selection.createRange&&document.selection.type!="None")return document.selection.createRange()}function j(e,t){var n,r=B();if(window.getSelection){if(r.anchorNode&&r.getRangeAt)n=r.getRangeAt(0);if(n){r.removeAllRanges();r.addRange(n)}if(!a.match(/msie/))document.execCommand("StyleWithCSS",false,false);document.execCommand(e,false,t)}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection.createRange();n.execCommand(e,false,t)}q(false,false)}function F(t,n,r){if(v.not(":focus"))v.focus();if(window.getSelection){var i=B(),s,o,u;if(i.anchorNode&&i.getRangeAt){s=i.getRangeAt(0);o=document.createElement(t);e(o).attr(n,r);u=s.extractContents();o.appendChild(u);s.insertNode(o);i.removeAllRanges();if(n=="style")q(e(o),r);else q(e(o),false)}}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){var a=document.selection.createRange();var f=a.htmlText;var l="<"+t+" "+n+'="'+r+'">'+f+"</"+t+">";document.selection.createRange().pasteHTML(l)}}function q(e,t){var n=I();n=n?n:e;if(n&&t==false){if(n.parent().is("[style]"))n.attr("style",n.parent().attr("style"));if(n.is("[style]"))n.find("*").attr("style",n.attr("style"))}else if(e&&t&&e.is("[style]")){var r=t.split(";");r=r[0].split(":");if(e.is("[style*="+r[0]+"]"))e.find("*").css(r[0],r[1]);R(e)}}function R(t){if(t){var t=t[0];if(document.body.createTextRange){var n=document.body.createTextRange();n.moveToElementText(t);n.select()}else if(window.getSelection){var r=window.getSelection();var n=document.createRange();if(t!="undefined"&&t!=null){n.selectNodeContents(t);r.removeAllRanges();r.addRange(n);if(e(t).is(":empty")){e(t).append(" ");R(e(t))}}}}}function U(){if(!p.data("sourceOpened")){var t=I();var n="http://";W(true);if(t){var r=t.prop("tagName").toLowerCase();if(r=="a"&&t.is("[href]")){n=t.attr("href");t.attr(S,"")}else F("a",S,"")}else y.val(n).focus();g.click(function(t){if(e(t.target).hasClass(u.css+"_linktypetext")||e(t.target).hasClass(u.css+"_linktypearrow"))X(true)});w.find("a").click(function(){var t=e(this).attr(u.css+"-linktype");w.data("linktype",t);E.find("."+u.css+"_linktypetext").html(w.find("a:eq("+w.data("linktype")+")").text());V(n);X()});V(n);y.focus().val(n).bind("keypress keyup",function(e){if(e.keyCode==13){z(h.find("["+S+"]"));return false}});b.click(function(){z(h.find("["+S+"]"))})}else W(false)}function z(t){y.focus();R(t);t.removeAttr(S);if(w.data("linktype")!="2")j("createlink",y.val());else{j("insertImage",y.val());v.find("img").each(function(){var t=e(this).prev("a");var n=e(this).next("a");if(t.length>0&&t.html()=="")t.remove();else if(n.length>0&&n.html()=="")n.remove()})}W();v.trigger("change")}function W(e){Q("["+S+"]:not([href])");h.find("["+S+"][href]").removeAttr(S);if(e){p.data("linkOpened",true);d.show()}else{p.data("linkOpened",false);d.hide()}X()}function X(e){if(e)w.show();else w.hide()}function V(e){var t=w.data("linktype");if(t=="1"&&(y.val()=="http://"||y.is("[value^=http://]")||!y.is("[value^=mailto]")))y.val("mailto:");else if(t!="1"&&!y.is("[value^=http://]"))y.val("http://");else y.val(e)}function J(t){if(!p.data("sourceOpened")){if(t=="fSize")styleField=P;else if(t=="colors")styleField=H;K(styleField,true);styleField.find("a").unbind("click").click(function(){var n=e(this).attr(u.css+"-styleval");if(t=="fSize"){styleType="font-size";n=n+u.funit}else if(t=="colors"){styleType="color";n="rgb("+n+")"}var r=G(styleType);F("span","style",styleType+":"+n+";"+r);K("",false);e("."+u.css+"_title").remove();v.trigger("change")})}else K(styleField,false);W(false)}function K(e,t){var n="",r=[{d:"fsizeOpened",f:P},{d:"cpallOpened",f:H}];if(e!=""){for(var i=0;i<r.length;i++){if(e==r[i]["f"])n=r[i]}}if(t){p.data(n["d"],true);n["f"].slideDown(100);for(var i=0;i<r.length;i++){if(n["d"]!=r[i]["d"]){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}else{for(var i=0;i<r.length;i++){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}function Q(t){h.find(t).each(function(){e(this).before(e(this).html()).remove()})}function G(e){var t=I();if(t&&t.is("[style]")&&t.css(e)!=""){var n=t.css(e);t.css(e,"");var r=t.attr("style");t.css(e,n);return r}else return""}function Y(){Z(true);D.find("a").click(function(){e("*",this).click(function(e){e.preventDefault();return false});et(e(this).text());var t=e(this).attr(u.css+"-formatval");j("formatBlock","<"+t+">");Z(false)})}function Z(e){var t=e?true:false;t=e&&D.data("status")?true:false;if(t||!e)D.data("status",false).slideUp(200);else D.data("status",true).slideDown(200)}function et(e){var t=D.closest("."+u.css+"_tool").find("."+u.css+"_tool_label").find("."+u.css+"_tool_text");if(e.length>10)e=e.substr(0,7)+"...";t.html(e)}function tt(e){var t,n,r;t=e.replace(/\n/gim,"").replace(/\r/gim,"").replace(/\t/gim,"").replace(/ /gim," ");n=[/\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/span><\/span>/gim,/<(\w*[^p])\s*[^\/>]*>\s*<\/\1>/gim,/\<div(|\s+.*?)>(.*?)\<\/div>/gim,/\<strong(|\s+.*?)>(.*?)\<\/strong>/gim,/\<em(|\s+.*?)>(.*?)\<\/em>/gim];r=["<span$2>$3</span>","","<p$1>$2</p>","<b$1>$2</b>","<i$1>$2</i>"];for(A=0;A<5;A++){for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p)t=t.replace(/\<p(|\s+.*?)>(.*?)\<\/p>/ig,"<br/>$2");if(!u.br){n=[/\<br>(.*?)/ig,/\<br\/>(.*?)/ig];r=["<p>$1</p>","<p>$1</p>"];for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p&&!u.br)t=t.replace(/\<p>(.*?)\<\/p>/ig,"<div>$1</div>");return t}function nt(){var e=v.text()==""&&v.html().length<12?"":v.html();l.val(tt(e))}function rt(){v.html(tt(l.val()))}function it(t){var n=false,r=I(),i;if(r){e.each(t,function(t,s){i=r.prop("tagName").toLowerCase();if(i==s)n=true;else{r.parents().each(function(){i=e(this).prop("tagName").toLowerCase();if(i==s)n=true})}});return n}else return false}function st(t){for(var n=0;n<f.length;n++){if(u[f[n].name]&&f[n].emphasis&&f[n].tag!="")it(f[n].tag)?p.find("."+u.css+"_tool_"+f[n].cls).addClass(m):e("."+u.css+"_tool_"+f[n].cls).removeClass(m)}if(u.format&&e.isArray(u.formats)){var r=false;for(var i=0;i<u.formats.length;i++){var s=[];s[0]=u.formats[i][0];if(u.formats[i][0].length>0&&it(s)){et(u.formats[i][1]);r=true;break}}if(!r)et(u.formats[0][1])}K("",false);Z(false)}if(!e(this).data("jqte")||e(this).data("jqte")==null||e(this).data("jqte")=="undefined")e(this).data("jqte",true);else e(this).data("jqte",false);if(!u.status||!e(this).data("jqte")){if(e(this).closest("."+u.css).length>0){var t=e(this).closest("."+u.css).find("."+u.css+"_editor").html();var n="";e(e(this)[0].attributes).each(function(){if(this.nodeName!="style")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});var r=e(this).is("[data-origin]")&&e(this).attr("data-origin")!=""?e(this).attr("data-origin"):"textarea";var i=">"+t;if(r=="input"||r=="option"){t=t.replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">");i='value="'+t+'">'}var o=e(this).clone();e(this).data("jqte",false).closest("."+u.css).before(o).remove();o.replaceWith("<"+r+n+i+"</"+r+">")}return}var l=e(this);var r=e(this).prop("tagName").toLowerCase();e(this).attr("data-origin",r);var c=e(this).is("[value]")||r=="textarea"?e(this).val():e(this).html();c=c.replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");e(this).after('<div class="'+u.css+'"></div>');var h=e(this).next("."+u.css);h.html('<div class="'+u.css+"_toolbar"+'" role="toolbar" unselectable></div><div class="'+u.css+'_linkform" style="display:none" role="dialog"></div><div class="'+u.css+"_editor"+'"></div>');var p=h.find("."+u.css+"_toolbar");var d=h.find("."+u.css+"_linkform");var v=h.find("."+u.css+"_editor");var m=u.css+"_tool_depressed";d.append('<div class="'+u.css+'_linktypeselect" unselectable></div><input class="'+u.css+'_linkinput" type="text/css" value=""><div class="'+u.css+'_linkbutton" unselectable>'+u.button+'</div> <div style="height:1px;float:none;clear:both"></div>');var g=d.find("."+u.css+"_linktypeselect");var y=d.find("."+u.css+"_linkinput");var b=d.find("."+u.css+"_linkbutton");g.append('<div class="'+u.css+'_linktypeview" unselectable></div><div class="'+u.css+'_linktypes" role="menu" unselectable></div>');var w=g.find("."+u.css+"_linktypes");var E=g.find("."+u.css+"_linktypeview");var S=u.css+"-setlink";v.after('<div class="'+u.css+"_source "+u.css+'_hiddenField"></div>');var x=h.find("."+u.css+"_source");l.appendTo(x);if(r!="textarea"){var n="";e(l[0].attributes).each(function(){if(this.nodeName!="type"&&this.nodeName!="value")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});l.replaceWith("<textarea "+n+">"+c+"</textarea>");l=x.find("textarea")}v.attr("contenteditable","true").html(c);for(var T=0;T<f.length;T++){if(u[f[T].name]){var N=f[T].key.length>0?u.titletext[T].hotkey!=null&&u.titletext[T].hotkey!="undefined"&&u.titletext[T].hotkey!=""?" (Ctrl+"+u.titletext[T].hotkey+")":"":"";var C=u.titletext[T].title!=null&&u.titletext[T].title!="undefined"&&u.titletext[T].title!=""?u.titletext[T].title+N:"";p.append('<div class="'+u.css+"_tool "+u.css+"_tool_"+f[T].cls+'" role="button" data-tool="'+T+'" unselectable><a class="'+u.css+'_tool_icon" unselectable></a></div>');p.find("."+u.css+"_tool[data-tool="+T+"]").data({tag:f[T].tag,command:f[T].command,emphasis:f[T].emphasis,title:C});if(f[T].name=="format"&&e.isArray(u.formats)){var k=u.formats[0][1].length>0&&u.formats[0][1]!="undefined"?u.formats[0][1]:"";p.find("."+u.css+"_tool_"+f[T].cls).find("."+u.css+"_tool_icon").replaceWith('<a class="'+u.css+'_tool_label" unselectable><span class="'+u.css+'_tool_text" unselectable>'+k+'</span><span class="'+u.css+'_tool_icon" unselectable></span></a>');p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_formats" unselectable></div>');for(var L=0;L<u.formats.length;L++){p.find("."+u.css+"_formats").append("<a "+u.css+'-formatval="'+u.formats[L][0]+'" class="'+u.css+"_format"+" "+u.css+"_format_"+L+'" role="menuitem" unselectable>'+u.formats[L][1]+"</a>")}p.find("."+u.css+"_formats").data("status",false)}else if(f[T].name=="fsize"&&e.isArray(u.fsizes)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_fontsizes" unselectable></div>');for(var L=0;L<u.fsizes.length;L++){p.find("."+u.css+"_fontsizes").append("<a "+u.css+'-styleval="'+u.fsizes[L]+'" class="'+u.css+"_fontsize"+'" style="font-size:'+u.fsizes[L]+u.funit+'" role="menuitem" unselectable>Abcdefgh...</a>')}}else if(f[T].name=="color"&&e.isArray(s)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_cpalette" unselectable></div>');for(var A=0;A<s.length;A++){if(s[A]!=null)p.find("."+u.css+"_cpalette").append("<a "+u.css+'-styleval="'+s[A]+'" class="'+u.css+"_color"+'" style="background-color: rgb('+s[A]+')" role="gridcell" unselectable></a>');else p.find("."+u.css+"_cpalette").append('<div class="'+u.css+"_colorSeperator"+'"></div>')}}}}w.data("linktype","0");for(var T=0;T<3;T++){w.append("<a "+u.css+'-linktype="'+T+'" unselectable>'+u.linktypes[T]+"</a>");E.html('<div class="'+u.css+'_linktypearrow" unselectable></div><div class="'+u.css+'_linktypetext">'+w.find("a:eq("+w.data("linktype")+")").text()+"</div>")}var O="";if(/msie/.test(a))O="-ms-";else if(/chrome/.test(a)||/safari/.test(a)||/yandex/.test(a))O="-webkit-";else if(/mozilla/.test(a))O="-moz-";else if(/opera/.test(a))O="-o-";else if(/konqueror/.test(a))O="-khtml-";else O="";if(u.placeholder&&u.placeholder!=""){h.prepend('<div class="'+u.css+'_placeholder" unselectable><div class="'+u.css+'_placeholder_text">'+u.placeholder+"</div></div>");var M=h.find("."+u.css+"_placeholder");M.click(function(){v.focus()})}h.find("[unselectable]").css(O+"user-select","none").addClass("unselectable").attr("unselectable","on").on("selectstart mousedown",false);var _=p.find("."+u.css+"_tool");var D=p.find("."+u.css+"_formats");var P=p.find("."+u.css+"_fontsizes");var H=p.find("."+u.css+"_cpalette");var I=function(){var t,n;if(window.getSelection){n=getSelection();t=n.anchorNode}if(!t&&document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection;var r=n.getRangeAt?n.getRangeAt(0):n.createRange();t=r.commonAncestorContainer?r.commonAncestorContainer:r.parentElement?r.parentElement():r.item(0)}if(t){return t.nodeName=="#text"?e(t.parentNode):e(t)}else return false};_.unbind("click").click(function(t){if(e(this).data("command")=="displaysource"&&!p.data("sourceOpened")){p.find("."+u.css+"_tool").addClass(u.css+"_hiddenField");e(this).removeClass(u.css+"_hiddenField");p.data("sourceOpened",true);l.css("height",v.outerHeight());x.removeClass(u.css+"_hiddenField");v.addClass(u.css+"_hiddenField");l.focus();W(false);K("",false);Z();if(u.placeholder&&u.placeholder!="")M.hide()}else{if(!p.data("sourceOpened")){if(e(this).data("command")=="linkcreator"){if(!p.data("linkOpened"))U();else{W(false);Z(false)}}else if(e(this).data("command")=="formats"){if(e(this).data("command")=="formats"&&!e(t.target).hasClass(u.css+"_format"))Y();K("",false);if(v.not(":focus"))v.focus()}else if(e(this).data("command")=="fSize"||e(this).data("command")=="colors"){if(e(this).data("command")=="fSize"&&!e(t.target).hasClass(u.css+"_fontsize")||e(this).data("command")=="colors"&&!e(t.target).hasClass(u.css+"_color"))J(e(this).data("command"));Z(false);if(v.not(":focus"))v.focus()}else{if(v.not(":focus"))v.focus();j(e(this).data("command"),null);K("",false);Z(false);X();e(this).data("emphasis")==true&&!e(this).hasClass(m)?e(this).addClass(m):e(this).removeClass(m);x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}}else{p.data("sourceOpened",false);p.find("."+u.css+"_tool").removeClass(u.css+"_hiddenField");x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}if(u.placeholder&&u.placeholder!="")v.html()!=""?M.hide():M.show()}v.trigger("change")}).hover(function(t){if(u.title&&e(this).data("title")!=""&&(e(t.target).hasClass(u.css+"_tool")||e(t.target).hasClass(u.css+"_tool_icon"))){e("."+u.css+"_title").remove();h.append('<div class="'+u.css+'_title"><div class="'+u.css+'_titleArrow"><div class="'+u.css+'_titleArrowIcon"></div></div><div class="'+u.css+'_titleText">'+e(this).data("title")+"</div></div>");var n=e("."+u.css+"_title:first");var r=n.find("."+u.css+"_titleArrowIcon");var i=e(this).position();var s=i.left+e(this).outerWidth()-n.outerWidth()/2-e(this).outerWidth()/2;var o=i.top+e(this).outerHeight()+5;n.delay(400).css({top:o,left:s}).fadeIn(200)}},function(){e("."+u.css+"_title").remove()});var ot=null;v.bind("keypress keyup keydown drop cut copy paste DOMCharacterDataModified DOMSubtreeModified",function(){if(!p.data("sourceOpened"))e(this).trigger("change");X();if(e.isFunction(u.change))u.change();if(u.placeholder&&u.placeholder!="")e(this).text()!=""?M.hide():M.show()}).bind("change",function(){if(!p.data("sourceOpened")){clearTimeout(ot);ot=setTimeout(nt,10)}}).keydown(function(e){if(e.ctrlKey){for(var t=0;t<f.length;t++){if(u[f[t].name]&&e.keyCode==f[t].key.charCodeAt(0)){if(f[t].command!=""&&f[t].command!="linkcreator")j(f[t].command,null);else if(f[t].command=="linkcreator")U();return false}}}}).bind("mouseup keyup",st).focus(function(){if(e.isFunction(u.focus))u.focus();h.addClass(u.css+"_focused");if(/opera/.test(a)){var t=document.createRange();t.selectNodeContents(v[0]);t.collapse(false);var n=window.getSelection();n.removeAllRanges();n.addRange(t)}}).focusout(function(){_.removeClass(m);K("",false);Z(false);X();if(e.isFunction(u.blur))u.blur();h.removeClass(u.css+"_focused");if(e.isArray(u.formats))et(u.formats[0][1])});l.bind("keydown keyup",function(){setTimeout(rt,0);e(this).height(e(this)[0].scrollHeight);if(e(this).val()=="")e(this).height(0)}).focus(function(){h.addClass(u.css+"_focused")}).focusout(function(){h.removeClass(u.css+"_focused")})})}})(jQuery)
|
39 |
+
/* End jQuery TE */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/controls/controls.php
CHANGED
@@ -341,6 +341,14 @@ class smartlogixControls {
|
|
341 |
if($args['useParagraph']) { $HTML .= '</p>'; }
|
342 |
$JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").ipCheckbox();';
|
343 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
case 'checkbox-button':
|
345 |
if($args['useParagraph']) { $HTML .= '<p>'; }
|
346 |
if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
|
341 |
if($args['useParagraph']) { $HTML .= '</p>'; }
|
342 |
$JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").ipCheckbox();';
|
343 |
break;
|
344 |
+
case 'textarea-wysiwyg':
|
345 |
+
if($args['useParagraph']) { $HTML .= '<p>'; }
|
346 |
+
if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
|
347 |
+
$HTML .= '<textarea '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>'.stripslashes((($args['value'] != '')?$args['value']:'')).'</textarea>';
|
348 |
+
if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
|
349 |
+
if($args['useParagraph']) { $HTML .= '</p>'; }
|
350 |
+
$JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").jqte();';
|
351 |
+
break;
|
352 |
case 'checkbox-button':
|
353 |
if($args['useParagraph']) { $HTML .= '<p>'; }
|
354 |
if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
|
includes/legal-pages.php
CHANGED
@@ -1,4 +1,23 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/* Begin Privacy Policy */
|
3 |
add_action('wp_ajax_wp_insert_legalpages_privacy_policy_form_get_content', 'wp_insert_legalpages_privacy_policy_form_get_content');
|
4 |
function wp_insert_legalpages_privacy_policy_form_get_content() {
|
@@ -6,17 +25,16 @@ function wp_insert_legalpages_privacy_policy_form_get_content() {
|
|
6 |
|
7 |
$legalPages = get_option('wp_insert_legalpages');
|
8 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
|
|
|
|
|
|
9 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[privacy_policy]', 'values' => $legalPages['privacy_policy']));
|
10 |
echo '<div id="wp_insert_legalpages_privacy_policy_accordion">';
|
11 |
echo '<h3>Content</h3>';
|
12 |
-
echo '<div>';
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
(($legalPages['privacy_policy']['content'] != '')?$legalPages['privacy_policy']['content']:wp_insert_legalpages_get_default_data('privacy_policy')),
|
17 |
-
'wp_insert_legalpages_privacy_policy_content',
|
18 |
-
array('media_buttons' => false, 'textarea_name' => 'wp_insert_legalpages[privacy_policy][content]', 'teeny' => true, 'quicktags' => array('buttons' => ','), 'drag_drop_upload' => false, 'textarea_rows' => '15', 'tinymce' => array('wp_skip_init' => false), 'editor_height' => 225)
|
19 |
-
);
|
20 |
echo '</div>';
|
21 |
echo '<h3>Assign Pages(s)</h3>';
|
22 |
echo '<div>';
|
@@ -29,7 +47,6 @@ function wp_insert_legalpages_privacy_policy_form_get_content() {
|
|
29 |
echo $control->HTML;
|
30 |
echo '</div>';
|
31 |
echo '</div>';
|
32 |
-
\_WP_Editors::editor_js();
|
33 |
echo '<script type="text/javascript">';
|
34 |
echo $control->JS;
|
35 |
echo 'jQuery("#wp_insert_legalpages_privacy_policy_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
@@ -79,17 +96,16 @@ function wp_insert_legalpages_terms_conditions_form_get_content() {
|
|
79 |
|
80 |
$legalPages = get_option('wp_insert_legalpages');
|
81 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
|
|
|
|
|
|
82 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[terms_conditions]', 'values' => $legalPages['terms_conditions']));
|
83 |
echo '<div id="wp_insert_legalpages_terms_conditions_accordion">';
|
84 |
echo '<h3>Content</h3>';
|
85 |
-
echo '<div>';
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
(($legalPages['terms_conditions']['content'] != '')?$legalPages['terms_conditions']['content']:wp_insert_legalpages_get_default_data('terms_conditions')),
|
90 |
-
'wp_insert_legalpages_terms_conditions_content',
|
91 |
-
array('media_buttons' => false, 'textarea_name' => 'wp_insert_legalpages[terms_conditions][content]', 'teeny' => true, 'quicktags' => array('buttons' => ','), 'drag_drop_upload' => false, 'textarea_rows' => '15', 'tinymce' => array('wp_skip_init' => false), 'editor_height' => 225)
|
92 |
-
);
|
93 |
echo '</div>';
|
94 |
echo '<h3>Assign Pages(s)</h3>';
|
95 |
echo '<div>';
|
@@ -102,7 +118,6 @@ function wp_insert_legalpages_terms_conditions_form_get_content() {
|
|
102 |
echo $control->HTML;
|
103 |
echo '</div>';
|
104 |
echo '</div>';
|
105 |
-
\_WP_Editors::editor_js();
|
106 |
echo '<script type="text/javascript">';
|
107 |
echo $control->JS;
|
108 |
echo 'jQuery("#wp_insert_legalpages_terms_conditions_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
@@ -152,17 +167,16 @@ function wp_insert_legalpages_disclaimer_form_get_content() {
|
|
152 |
|
153 |
$legalPages = get_option('wp_insert_legalpages');
|
154 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
|
|
|
|
|
|
155 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[disclaimer]', 'values' => $legalPages['disclaimer']));
|
156 |
echo '<div id="wp_insert_legalpages_disclaimer_accordion">';
|
157 |
echo '<h3>Content</h3>';
|
158 |
-
echo '<div>';
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
(($legalPages['disclaimer']['content'] != '')?$legalPages['disclaimer']['content']:wp_insert_legalpages_get_default_data('disclaimer')),
|
163 |
-
'wp_insert_legalpages_disclaimer_content',
|
164 |
-
array('media_buttons' => false, 'textarea_name' => 'wp_insert_legalpages[disclaimer][content]', 'teeny' => true, 'quicktags' => array('buttons' => ','), 'drag_drop_upload' => false, 'textarea_rows' => '15', 'tinymce' => array('wp_skip_init' => false), 'editor_height' => 225)
|
165 |
-
);
|
166 |
echo '</div>';
|
167 |
echo '<h3>Assign Pages(s)</h3>';
|
168 |
echo '<div>';
|
@@ -175,7 +189,6 @@ function wp_insert_legalpages_disclaimer_form_get_content() {
|
|
175 |
echo $control->HTML;
|
176 |
echo '</div>';
|
177 |
echo '</div>';
|
178 |
-
\_WP_Editors::editor_js();
|
179 |
echo '<script type="text/javascript">';
|
180 |
echo $control->JS;
|
181 |
echo 'jQuery("#wp_insert_legalpages_disclaimer_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
@@ -225,17 +238,16 @@ function wp_insert_legalpages_copyright_form_get_content() {
|
|
225 |
|
226 |
$legalPages = get_option('wp_insert_legalpages');
|
227 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
|
|
|
|
|
|
228 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[copyright]', 'values' => $legalPages['copyright']));
|
229 |
echo '<div id="wp_insert_legalpages_copyright_accordion">';
|
230 |
echo '<h3>Content</h3>';
|
231 |
-
echo '<div>';
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
(($legalPages['copyright']['content'] != '')?$legalPages['copyright']['content']:wp_insert_legalpages_get_default_data('copyright')),
|
236 |
-
'wp_insert_legalpages_copyright_content',
|
237 |
-
array('media_buttons' => false, 'textarea_name' => 'wp_insert_legalpages[copyright][content]', 'teeny' => true, 'quicktags' => array('buttons' => ','), 'drag_drop_upload' => false, 'textarea_rows' => '15', 'tinymce' => array('wp_skip_init' => false), 'editor_height' => 225)
|
238 |
-
);
|
239 |
echo '</div>';
|
240 |
echo '<h3>Assign Pages(s)</h3>';
|
241 |
echo '<div>';
|
@@ -248,7 +260,6 @@ function wp_insert_legalpages_copyright_form_get_content() {
|
|
248 |
echo $control->HTML;
|
249 |
echo '</div>';
|
250 |
echo '</div>';
|
251 |
-
\_WP_Editors::editor_js();
|
252 |
echo '<script type="text/javascript">';
|
253 |
echo $control->JS;
|
254 |
echo 'jQuery("#wp_insert_legalpages_copyright_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
1 |
<?php
|
2 |
+
/* Begin Add Card in Admin Panel */
|
3 |
+
add_action('wp_insert_plugin_card', 'wp_insert_legalpages_plugin_card', 40);
|
4 |
+
function wp_insert_legalpages_plugin_card() {
|
5 |
+
echo '<div class="plugin-card">';
|
6 |
+
echo '<div class="plugin-card-top">';
|
7 |
+
echo '<h4>Legal Pages</h4>';
|
8 |
+
echo '<p>Legal Page Templates to kick start your Legal Notices.</p>';
|
9 |
+
echo '</div>';
|
10 |
+
echo '<div class="plugin-card-bottom">';
|
11 |
+
echo '<p><a id="wp_insert_legalpages_privacy_policy" href="javascript:;">Privacy Policy</a></p>';
|
12 |
+
echo '<p><a id="wp_insert_legalpages_terms_conditions" href="javascript:;">Terms and Conditions</a></p>';
|
13 |
+
echo '<p><a id="wp_insert_legalpages_disclaimer" href="javascript:;">Disclaimer</a></p>';
|
14 |
+
echo '<p><a id="wp_insert_legalpages_copyright" href="javascript:;">Copyright Notice</a></p>';
|
15 |
+
echo '<!--<p><a href="#">EU Cookie Compliance</a></p>-->';
|
16 |
+
echo '</div>';
|
17 |
+
echo '</div>';
|
18 |
+
}
|
19 |
+
/* End Add Card in Admin Panel */
|
20 |
+
|
21 |
/* Begin Privacy Policy */
|
22 |
add_action('wp_ajax_wp_insert_legalpages_privacy_policy_form_get_content', 'wp_insert_legalpages_privacy_policy_form_get_content');
|
23 |
function wp_insert_legalpages_privacy_policy_form_get_content() {
|
25 |
|
26 |
$legalPages = get_option('wp_insert_legalpages');
|
27 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
28 |
+
if(!(isset($legalPages['privacy_policy']['content']) && ($legalPages['privacy_policy']['content'] != ''))) {
|
29 |
+
$legalPages['privacy_policy']['content'] = wp_insert_legalpages_get_default_data('privacy_policy');
|
30 |
+
}
|
31 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[privacy_policy]', 'values' => $legalPages['privacy_policy']));
|
32 |
echo '<div id="wp_insert_legalpages_privacy_policy_accordion">';
|
33 |
echo '<h3>Content</h3>';
|
34 |
+
echo '<div style="max-height: 320px;">';
|
35 |
+
$control->add_control(array('type' => 'textarea-wysiwyg', 'style' => 'height: 220px;', 'optionName' => 'content'));
|
36 |
+
echo $control->HTML;
|
37 |
+
$control->clear_controls();
|
|
|
|
|
|
|
|
|
38 |
echo '</div>';
|
39 |
echo '<h3>Assign Pages(s)</h3>';
|
40 |
echo '<div>';
|
47 |
echo $control->HTML;
|
48 |
echo '</div>';
|
49 |
echo '</div>';
|
|
|
50 |
echo '<script type="text/javascript">';
|
51 |
echo $control->JS;
|
52 |
echo 'jQuery("#wp_insert_legalpages_privacy_policy_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
96 |
|
97 |
$legalPages = get_option('wp_insert_legalpages');
|
98 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
99 |
+
if(!(isset($legalPages['terms_conditions']['content']) && ($legalPages['terms_conditions']['content'] != ''))) {
|
100 |
+
$legalPages['terms_conditions']['content'] = wp_insert_legalpages_get_default_data('terms_conditions');
|
101 |
+
}
|
102 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[terms_conditions]', 'values' => $legalPages['terms_conditions']));
|
103 |
echo '<div id="wp_insert_legalpages_terms_conditions_accordion">';
|
104 |
echo '<h3>Content</h3>';
|
105 |
+
echo '<div style="max-height: 320px;">';
|
106 |
+
$control->add_control(array('type' => 'textarea-wysiwyg', 'style' => 'height: 220px;', 'optionName' => 'content'));
|
107 |
+
echo $control->HTML;
|
108 |
+
$control->clear_controls();
|
|
|
|
|
|
|
|
|
109 |
echo '</div>';
|
110 |
echo '<h3>Assign Pages(s)</h3>';
|
111 |
echo '<div>';
|
118 |
echo $control->HTML;
|
119 |
echo '</div>';
|
120 |
echo '</div>';
|
|
|
121 |
echo '<script type="text/javascript">';
|
122 |
echo $control->JS;
|
123 |
echo 'jQuery("#wp_insert_legalpages_terms_conditions_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
167 |
|
168 |
$legalPages = get_option('wp_insert_legalpages');
|
169 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
170 |
+
if(!(isset($legalPages['disclaimer']['content']) && ($legalPages['disclaimer']['content'] != ''))) {
|
171 |
+
$legalPages['disclaimer']['content'] = wp_insert_legalpages_get_default_data('disclaimer');
|
172 |
+
}
|
173 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[disclaimer]', 'values' => $legalPages['disclaimer']));
|
174 |
echo '<div id="wp_insert_legalpages_disclaimer_accordion">';
|
175 |
echo '<h3>Content</h3>';
|
176 |
+
echo '<div style="max-height: 320px;">';
|
177 |
+
$control->add_control(array('type' => 'textarea-wysiwyg', 'style' => 'height: 220px;', 'optionName' => 'content'));
|
178 |
+
echo $control->HTML;
|
179 |
+
$control->clear_controls();
|
|
|
|
|
|
|
|
|
180 |
echo '</div>';
|
181 |
echo '<h3>Assign Pages(s)</h3>';
|
182 |
echo '<div>';
|
189 |
echo $control->HTML;
|
190 |
echo '</div>';
|
191 |
echo '</div>';
|
|
|
192 |
echo '<script type="text/javascript">';
|
193 |
echo $control->JS;
|
194 |
echo 'jQuery("#wp_insert_legalpages_disclaimer_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
238 |
|
239 |
$legalPages = get_option('wp_insert_legalpages');
|
240 |
echo '<div class="wp_insert_popup_content_wrapper">';
|
241 |
+
if(!(isset($legalPages['copyright']['content']) && ($legalPages['copyright']['content'] != ''))) {
|
242 |
+
$legalPages['copyright']['content'] = wp_insert_legalpages_get_default_data('copyright');
|
243 |
+
}
|
244 |
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_legalpages[copyright]', 'values' => $legalPages['copyright']));
|
245 |
echo '<div id="wp_insert_legalpages_copyright_accordion">';
|
246 |
echo '<h3>Content</h3>';
|
247 |
+
echo '<div style="max-height: 320px;">';
|
248 |
+
$control->add_control(array('type' => 'textarea-wysiwyg', 'style' => 'height: 220px;', 'optionName' => 'content'));
|
249 |
+
echo $control->HTML;
|
250 |
+
$control->clear_controls();
|
|
|
|
|
|
|
|
|
251 |
echo '</div>';
|
252 |
echo '<h3>Assign Pages(s)</h3>';
|
253 |
echo '<div>';
|
260 |
echo $control->HTML;
|
261 |
echo '</div>';
|
262 |
echo '</div>';
|
|
|
263 |
echo '<script type="text/javascript">';
|
264 |
echo $control->JS;
|
265 |
echo 'jQuery("#wp_insert_legalpages_copyright_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "fill" });';
|
includes/tracking-codes.php
CHANGED
@@ -31,7 +31,7 @@ function wp_insert_trackingcodes_google_analytics_form_save_action() {
|
|
31 |
add_action('wp_footer', 'wp_insert_trackingcodes_google_analytics_wp_footer');
|
32 |
function wp_insert_trackingcodes_google_analytics_wp_footer() {
|
33 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
34 |
-
if(isset($trackingCodes['analytics']['status']) && isset($trackingCodes['analytics']['code']) && !empty($trackingCodes['analytics']['code'])) {
|
35 |
echo '<script type="text/javascript">';
|
36 |
echo 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");';
|
37 |
echo 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
|
@@ -77,7 +77,7 @@ function wp_insert_trackingcodes_header_form_save_action() {
|
|
77 |
add_action('wp_head', 'wp_insert_trackingcodes_header_wp_head');
|
78 |
function wp_insert_trackingcodes_header_wp_head() {
|
79 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
80 |
-
if(isset($trackingCodes['header']['status']) && isset($trackingCodes['header']['code']) && !empty($trackingCodes['header']['code'])) {
|
81 |
echo stripslashes($trackingCodes['header']['code']);
|
82 |
}
|
83 |
}
|
@@ -115,7 +115,7 @@ function wp_insert_trackingcodes_footer_form_save_action() {
|
|
115 |
add_action('wp_footer', 'wp_insert_trackingcodes_footer_wp_footer');
|
116 |
function wp_insert_trackingcodes_footer_wp_footer() {
|
117 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
118 |
-
if(isset($trackingCodes['footer']['status']) && isset($trackingCodes['footer']['code']) && !empty($trackingCodes['footer']['code'])) {
|
119 |
echo stripslashes($trackingCodes['footer']['code']);
|
120 |
}
|
121 |
}
|
31 |
add_action('wp_footer', 'wp_insert_trackingcodes_google_analytics_wp_footer');
|
32 |
function wp_insert_trackingcodes_google_analytics_wp_footer() {
|
33 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
34 |
+
if(isset($trackingCodes['analytics']['status']) && wp_validate_boolean($trackingCodes['analytics']['status']) && isset($trackingCodes['analytics']['code']) && !empty($trackingCodes['analytics']['code'])) {
|
35 |
echo '<script type="text/javascript">';
|
36 |
echo 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");';
|
37 |
echo 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
|
77 |
add_action('wp_head', 'wp_insert_trackingcodes_header_wp_head');
|
78 |
function wp_insert_trackingcodes_header_wp_head() {
|
79 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
80 |
+
if(isset($trackingCodes['header']['status']) && wp_validate_boolean($trackingCodes['header']['status']) && isset($trackingCodes['header']['code']) && !empty($trackingCodes['header']['code'])) {
|
81 |
echo stripslashes($trackingCodes['header']['code']);
|
82 |
}
|
83 |
}
|
115 |
add_action('wp_footer', 'wp_insert_trackingcodes_footer_wp_footer');
|
116 |
function wp_insert_trackingcodes_footer_wp_footer() {
|
117 |
$trackingCodes = get_option('wp_insert_trackingcodes');
|
118 |
+
if(isset($trackingCodes['footer']['status']) && wp_validate_boolean($trackingCodes['footer']['status']) && isset($trackingCodes['footer']['code']) && !empty($trackingCodes['footer']['code'])) {
|
119 |
echo stripslashes($trackingCodes['footer']['code']);
|
120 |
}
|
121 |
}
|
readme.txt
CHANGED
@@ -4,14 +4,14 @@ Tags: ads,adsense,ad manager,advertisement,google ads,ad widget,analytics,google
|
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
Tested up to: 4.8.1
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
The Ultimate Adsense / Ad-Management Plugin for Wordpress
|
12 |
|
13 |
== Description ==
|
14 |
-
**WP-INSERT by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a> : The Ultimate
|
15 |
|
16 |
Wp-Insert is the most powerful yet easiest to use wordpress ad management plugin which does a lot more than ad management.
|
17 |
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
Tested up to: 4.8.1
|
7 |
+
Stable tag: 2.1.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
The Ultimate Adsense / Ad-Management Plugin for Wordpress
|
12 |
|
13 |
== Description ==
|
14 |
+
**WP-INSERT by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a> : The Ultimate Adsense / Ad-Management Plugin for Wordpress (Optimized for Adsense)**
|
15 |
|
16 |
Wp-Insert is the most powerful yet easiest to use wordpress ad management plugin which does a lot more than ad management.
|
17 |
|
wp-insert.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
-
Version: 2.1.
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
@@ -31,7 +31,7 @@ if(!defined('WP_INSERT_URL'))
|
|
31 |
if(!defined('WP_INSERT_DIR'))
|
32 |
define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
|
33 |
if(!defined('WP_INSERT_VERSION'))
|
34 |
-
define('WP_INSERT_VERSION', '2.1.
|
35 |
/*Includes*/
|
36 |
require_once(dirname(__FILE__).'/includes/common/common.php');
|
37 |
require_once(dirname(__FILE__).'/includes/controls/controls.php');
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
+
Version: 2.1.8
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
31 |
if(!defined('WP_INSERT_DIR'))
|
32 |
define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
|
33 |
if(!defined('WP_INSERT_VERSION'))
|
34 |
+
define('WP_INSERT_VERSION', '2.1.8');
|
35 |
/*Includes*/
|
36 |
require_once(dirname(__FILE__).'/includes/common/common.php');
|
37 |
require_once(dirname(__FILE__).'/includes/controls/controls.php');
|