b2636fe5 by Jeff Balicki

plugins

1 parent e45e48f5
Showing 189 changed files with 3705 additions and 0 deletions
1 #c2p-factory-post h2 {
2 display: inline-block;
3 margin-top: 0 !important;
4 }
5 #c2p-factory-post .toggle {
6 float: right;
7 margin-top: 1px;
8 width: 75px;
9 height: 25px;
10 }
11 #c2p-factory-post .toggle-on {
12 background: #007cba;
13 color: white;
14 }
15 #c2p-factory-post .toggle-on, #c2p-factory-post .toggle-off {
16 font-weight: bold;
17 font-size: 16px;
18 }
19 .add-more-field::before {
20 padding-right: 2px;
21 }
22 .nice-select ul.list {
23 max-height: 300px;
24 overflow-y: auto;
25 }
26 ol.helper-list {
27 padding-left: 13px;
28 }
29 #cf7-2-post .cf7-2-post-map-labels:hover {
30 width: auto;
31 }
32 #cf7-2-post #custom-meta-fields.mapping-published .post-meta-field:hover .cf7-2-post-map-labels {
33 width: auto;
34 min-width: 200px;
35 }
36 #cf7-2-post .select2{
37 min-width: 120px;
38 }
39 .misc-pub-section {
40 padding: 6px 0px 8px;
41 }
42 .select2-container:not(.select2-container--disabled):hover {
43 width: auto !important;
44 }
45 #cf7-2-post .default-meta-field select:disabled {
46 width: max-content;
47 max-width: 400px;
48 }
49 .hybrid-option.system-taxonomy {
50 color: #0015ff;
51 }
52 #c2p-default-post-fields{
53 padding: 0 12px 12px 12px;
54 }
55 #c2p-default-post-fields .cf7-2-post-map-labels {
56 display: inline-block;
57 font-size: 1.1em;
58 min-width: 7rem;
59 text-align: right;
60 margin-right: 5px;
61 }
62 #c2p-default-post-fields .nice-select.field-options.post-options {
63 display: inline-block;
64 float: none;
65 margin-left: 5px;
66 vertical-align: middle;
67 }
68 #c2p-mapped-fields .cf7-post-msg {
69 display: inline-block;
70 margin: 0 5px;
71 /* width: calc(100% - 325px); */
72 line-height: 15px;
73 vertical-align: middle;
74 position: relative;
75 }
76 label{
77 cursor: default;
78 }
79 .nice-select .current {
80 display: block;
81 overflow: hidden;
82 }
83 .nice-select.disabled {
84 float: none;
85 clear: unset;
86 display: inline-block;
87 vertical-align: middle;
88 }
89 #postbox-container-1 .nice-select {
90 float: none;
91 display: inline-block;
92 vertical-align: middle;
93 clear: unset;
94 }
95 .post_type_labels {
96 font-size: 1.1em;
97 }
98 .display-none,.display-none+.hybrid-select-js,
99 #c2p-mapped-fields .display-none:not(.custom-taxonomy-input-fields) + .cf7-post-msg,
100 #cf7-2-post .cf7-2-post-map-labels.hide{
101 display:none;
102 }
103 #adminmenu ul.wp-submenu li a[href="admin.php?page=map_cf7_2_post"] {
104 display: none;
105 }
106 #save_post {
107 float: right;
108 margin-bottom: 10px;
109 }
110 #creation-action{
111 display: inline-block;
112 float: right;
113 }
114 #ajax-response{
115 display: inline-block;
116 padding: 0 5px;
117 width: 57%;
118 }
119 #save-draft-actions {
120 display: inline-block;
121 float: right;
122 margin-bottom: 5px;
123 }
124 #save-draft-action .spinner{
125 margin: 4px 5px;
126 }
127 #post-creation-actions .spinner{
128 float: left;
129 }
130 label[for="post_type"] {
131 min-width: 90px;
132 display: inline-block;
133 }
134 .add-more-field {
135 color: blue;
136 font-size: 1.4rem;
137 vertical-align: middle;
138 display: inline-block;
139 margin-left: -1px;
140 }
141 .remove-field {
142 color: red;
143 font-size: 1.5em;
144 vertical-align: middle;
145 display: inline-block;
146 margin-left: -1px;
147 margin-bottom: 3px;
148 }
149 .remove-field:hover,.add-more-field:hover { cursor: pointer; }
150 #cf7-2-post .cf7-post-error-msg{
151 display: inline-block;
152 margin: 0 5px;
153 width: calc(100% - 435px);
154 line-height: 15px;
155 vertical-align: middle;
156 position: relative;
157 }
158 #cf7-2-post #c2p-post-meta-fields .cf7-post-error-msg,
159 #cf7-2-post .taxonomy-fields .cf7-post-error-msg{
160 width: calc(100% - 480px);
161 min-width: 200px;
162 margin-left: 2px;
163 vertical-align: middle;
164 line-height: 15px;
165 }
166 #c2p-mapped-fields li > div:not(.display-none) {
167 display: inline-block;
168 margin-right: 10px;
169 box-sizing: border-box;
170 }
171 #cf7-2-post .cf7-post-error-msg a {
172 overflow: hidden;
173 text-overflow: ellipsis;
174 white-space: nowrap;
175 width: calc(100% - 50px);
176 vertical-align: middle;
177 margin-left: 0;
178 padding-right: 0;
179 }
180 #cf7-2-post .cf7-post-error-msg a.code:hover {
181 position: absolute;
182 width: auto;
183 top: -5px;
184 }
185 .custom-taxonomy-input-fields p {
186 margin-top: 0;
187 }
188 .custom-taxonomy-input-fields > p > em {
189 color: blue;
190 font-weight: bold;
191 }
192 .custom-meta-field select.field-options {
193 width: 200px;
194 padding: 3px 0;
195 }
196 /* #cf7-2-post .post-meta-field, */
197 #cf7-2-post .custom-taxonomy-field{
198 min-width: 460px;
199 }
200
201 #cf7-2-post #custom-meta-fields.mapping-published .custom-meta-field,
202 #cf7-2-post #post_taxonomy_map.mapping-published .custom-taxonomy-field {
203 max-width: 80%;
204 width: auto;
205 }
206 #cf7-2-post #custom-meta-fields.mapping-published .cf7-post-error-msg,
207 #cf7-2-post #post_taxonomy_map.mapping-published .cf7-post-error-msg{
208 width: auto;
209 min-width: 0;
210 max-width: calc(100% - 475px);
211 margin-right: 0;
212 }
213 #cf7-2-post #custom-meta-fields.mapping-published .cf7-post-error-msg .cf7-2-post-map-labels {
214 min-width: 0;
215 width: auto;
216 }
217 #cf7-2-post .mapping-published .cf7-2-post-map-labels:disabled {
218 max-width: 260px;
219 width: auto;
220 }
221 #cf7-2-post .custom-taxonomy-input-fields input {
222 width: 100px;
223 }
224 #cf7-2-post .cf7-2-post-map-labels.taxonomy-slug {
225 width: 170px;
226 }
227 .custom-taxonomy-input-fields label {
228 margin: 0 5px;
229 }
230 .misc-pub-section.misc-pub-post-type label[for="post_type"]::before{
231 font-family: "dashicons";
232 content: "\f537";
233 }
234 #post-type-display, p.post-type-display{
235 font-weight: 600;
236 margin-top:0;
237 margin-bottom:0;
238 }
239 #post-type-select input[type="text"],
240 select#post_type_source,
241 select#system-post-type {
242 /* width: calc(50% - 5px); */
243 }
244 #system-poststuff span.code {
245 background-color: #eaeaea;
246 display: inline-block;
247 padding: 5px 10px;
248 }
249 .post_type_labels {
250 min-width: 90px;
251 display: inline-block;
252 /* width: calc(50% - 5px); */
253 }
254 #c2p-factory-post {
255 background: white;
256 padding: 5px 10px;
257 border: solid 1px #d2d2d2;
258 }
259 #post_type_is_menu_position{
260 display: none;
261 }
262 input[name="mapped_post_type_show_in_menu"]:checked ~ div#post_type_is_menu_position{
263 display: block;
264 }
265 select.field-options option{
266 text-align: right;
267 }
268 select.field-options option.filter-option{
269 color: red;
270 }
271 p.cf7-post-error-msg span.code{
272 font-size: 1.1em;
273 }
274 #c2p-mapped-fields span.animate-color,
275 #c2p-mapped-fields span.animate-change{
276 -webkit-animation: color-change 1s 3;
277 -moz-animation: color-change 1s 3;
278 -o-animation: color-change 1s 3;
279 -ms-animation: color-change 1s 3;
280 animation: color-change 1s 3;
281 }
282 #c2p-default-post-fields, #c2p-post-meta-fields, #c2p-taxonomy-fields {
283 background-color: white;
284 padding: 10px 5px;
285 border-radius: 3px;
286 border: solid 1px #dddada;
287 }
288 #menu-position {
289 display: inline-block;
290 }
291 .post-field-name {display: inline-block;}
292 #c2p-post-meta-fields > li {margin: 0;}
293 label.post_type_cb_labels {
294 border-bottom: blue 1px dotted;
295 padding: 2px 4px;
296 margin-right: 8px;
297 display: inline-block;
298 background-color: #ececec;
299 border-radius: 6px;
300 }
301 @-webkit-keyframes color-change {
302 0% { background-color: red; }
303 50% { background-color: inherit; }
304 100% { background-color: red; }
305 }
306 @-moz-keyframes color-change {
307 0% { background-color: red; }
308 50% { background-color: inherit; }
309 100% { background-color: red; }
310 }
311 @-ms-keyframes color-change {
312 0% { background-color: red; }
313 50% { background-color: inherit; }
314 100% { background-color: red; }
315 }
316 @-o-keyframes color-change {
317 0% { background-color: red; }
318 50% { background-color: inherit; }
319 100% { background-color: red; }
320 }
321 @keyframes color-change {
322 0% { background-color: red; }
323 50% { background-color: inherit; }
324 100% { background-color: red; }
325 }
326
327 span.link-button.disabled{
328 color: grey;
329 cursor: not-allowed;
330 }
331 span.link-button.enabled{
332 color: blue;
333 cursor: pointer;
334 text-decoration: underline;
335 }
336 button.button-link.close-details {
337 vertical-align: middle;
338 }
339 .error-msg{
340 color:red;
341 }
342 #c2p-filter-clipboard {
343 position: relative;
344 }
345 .popup {
346 display: none;
347 position: absolute;
348 top: -38px;
349 left: 38px;
350 background: #515151;
351 color: white;
352 padding: 5px;
353 font-weight: bold;
354 border-radius: 3px;
355 }
356 #c2p-filter-clipboard .popup {
357 top: auto;
358 bottom: 23px;
359 }
360 .cf7-post-msg a.code:hover + span.popup{
361 display:block;
362 width: max-content;
363 }
364 .popup span {
365 display: block;
366 font-weight: normal;
367 }
368 .spinner.meta-label {
369 float: none;
370 margin: 4px 57px;
371 display:none;
372 visibility: visible;
373 }
374 .code {
375 padding: 5px;
376 display: inline-block;
377 background: #efefef;
378 margin-left: 10px;
379 }
380 .code >.code {
381 padding:0px;
382 background:none;
383 margin-left: 0;
384 }
385 select.hybridddised.display-none + .hybrid-dropdown {
386 display: none;
387 }
388 .custom-meta-field .nice-select, #post_taxonomy_map .nice-select {
389 float: none;
390 clear: unset;
391 display: inline-block;
392 vertical-align: middle;
393 }
394 #c2p-tax-notes, #cf7-2-post p,#c2p-tax-notes li {
395 margin: 0;
396 }
397 #c2p-tax-notes li {
398 list-style: inside;
399 }
400 .custom-taxonomy-field span.php-filter-button {
401 background-image: url('./image/php-sprite.png');
402 width: 22px;
403 display: inline-block;
404 height: 11px;
405 background-size: 200%;
406 vertical-align: text-bottom;
407 margin-left: 4px;
408 border: solid 1px blue;
409 border-radius: 3px;
410 padding: 1px 2px;
411 display: none;
412 }
413 .dashicons.remove-field + .php-filter-button {
414 display: inline-block;
415 }
416 .hooked .dashicons.remove-field + .php-filter-button {
417 display: none;
418 }
419 .custom-taxonomy-field span.php-filter-button:hover {
420 cursor: pointer;
421 color: blue;
422 background-position-x: 26px;
423 }
424 #c2p-taxonomy-fields ul.helper-list > li {
425 display: block;
426 }
427 #c2p-taxonomy-fields{
428 position: relative;
429 }
430 #c2p-taxonomy-fields ul.helper-list:not(.display-none) {
431 display: inline-block;
432 position: absolute;
433 border: solid 1px;
434 border-radius: 3px;
435 padding: 3px;
436 list-style: none;
437 margin: -22px 0 0 3px;
438 background-color: white;
439 z-index: 108;
440 }
441 #c2p-taxonomy-fields ul.helper-list .dashicons {
442 position: absolute;
443 top: -13px;
444 right: -6px;
445 width: 14px;
446 height: 14px;
447 background: white;
448 transform: rotate(45deg);
449 }
1 #wpbody-content .inline-edit-row-page .inline-edit-col-right {
2 margin-top: 0;
3 }
4 .c2p-post-type {
5 font-weight: bold;
6 }
7 .display-none, .inline-edit-col .display-none.c2p-delete-mapping{display:none}
8 .c2p-delete-warning {
9 line-height: normal;
10 clear: both;
11 }
12 a:hover + .popup {
13 display: block;
14 position: absolute;
15 background: black;
16 color: white;
17 padding: 2px 5px;
18 margin-left: 5px;
19 }
20 .c2p-delete-data a span {
21 font-weight: bold;
22 }
1 .cf72post-field label {
2 font-weight: bold;
3 min-width: 175px;
4 display: inline-block;
5 }
6 .cf72post-field label + div {
7 display: inline-block;
8 }
9 field-value {
10 vertical-align: middle;
11 display: inline-block;
12 }
13 .cf72post-field {
14 padding: 1px 0;
15 }
1 .default-post-fields label {
2 width: 8em;
3 display: inline-block;
4 text-align: right;
5 }
6 .default-post-fields li {
7 margin: 0;
8 }
1 <?php // Silence is golden
...\ No newline at end of file ...\ No newline at end of file
1 (function($) {
2 //obtained from wordpress codex: https://codex.wordpress.org/Plugin_API/Action_Reference/quick_edit_custom_box
3 // we create a copy of the WP inline edit post function
4 var $wp_quick_edit = inlineEditPost.edit;
5 // and then we overwrite the function with our own code
6 inlineEditPost.edit = function( id ) {
7
8 // "call" the original WP edit function
9 // we don't want to leave WordPress hanging
10 $wp_quick_edit.apply( this, arguments );
11
12 // now we take care of our business
13
14 // get the post ID
15 var $post_id = 0;
16 if ( typeof( id ) == 'object' ) {
17 $post_id = parseInt( this.getId( id ) );
18 }
19
20 if ( $post_id > 0 ) {
21 // define the edit row
22 var $edit_row = $( '#edit-' + $post_id );
23 var $post_row = $( '#post-' + $post_id );
24 // get the status
25 var $submit = $('.cf7-2-post-submit', $post_row);
26 if($submit.length>0 && 'yes'==$submit.text()){
27 $('input[name="cf7_2_post_submit"]', $edit_row).prop('checked', true);
28 }
29 }
30 }
31
32 })(jQuery);
1 (function($) {
2 //obtained from wordpress codex: https://codex.wordpress.org/Plugin_API/Action_Reference/quick_edit_custom_box
3 // we create a copy of the WP inline edit post function
4 let $wp_quick_edit = inlineEditPost.edit;
5 // and then we overwrite the function with our own code
6 inlineEditPost.edit = function( id ) {
7
8 // "call" the original WP edit function
9 // we don't want to leave WordPress hanging
10 $wp_quick_edit.apply( this, arguments );
11
12 // now we take care of our business
13
14 // get the post ID
15 let postId = 0;
16 if ( typeof( id ) == 'object' ) {
17 postId = parseInt( this.getId( id ) );
18 }
19
20 if ( postId > 0 ) {
21 // define the edit row
22 let $editRow = $( '#edit-' + postId ),
23 $postRow = $( '#post-' + postId ),
24 $type = $('.cf7-2-post-type', $postRow);
25 if($type.length>0){
26 let $warn = $('.c2p-delete-warning',$editRow),
27 $delete = $('.c2p-delete-mapping',$editRow);
28
29 $('.c2p-post-type', $delete).text($type.val());
30 $('.title>input', $delete).val(postId).on('change',function(){
31 if(this.checked){
32 $warn.show();
33 if($type.is('.c2p-factory')){
34 let $data = $('.c2p-delete-data',$delete),
35 $filter = $('span', $data).not('.popup'), $clip, text;
36 if($filter.length>0){
37 $clip = $('a',$data).remove(),
38 text = $clip.data('clipboard-text').replace('${post_type}',$type.val());
39 $clip.attr('data-clipboard-text', text).text($filter.text());
40 $filter.after($clip);
41 $filter.remove();
42 $data.show();
43 new Clipboard($clip[0]);
44 }
45 }
46 }else{
47 $warn.hide();
48 }
49 });
50 $delete.show();
51 }
52 }
53 }
54
55 })(jQuery);
1 (function($) {
2
3 $(document).ready(function(){
4 $('#toplevel_page_wpcf7 li a[href="admin.php?page=map_cf7_2_post"]').parent().remove();
5 });
6
7 })(jQuery);
1 <?php
2 /**
3 * Display quickedit options in table of wpcf7 form posts.
4 * @since 5.3.0
5 */
6 wp_nonce_field( 'c2p_quickedit_nonce', 'c2p_nonce' );
7 ?>
8 <fieldset class="inline-edit-col-right">
9 <div class="inline-edit-col">
10 <div class="inline-edit-group wp-clearfix">
11 <label class="alignright display-none c2p-delete-mapping">
12 <span class="title"><input type="checkbox" name="delete_c2p_map" value="0"><?= __('Delete mapping:','post-my-cf7-form')?><span class="c2p-post-type"></span></span>
13 <div class="c2p-delete-warning display-none">
14 <em><?= __('This will reset the mapping')?></em>
15 <div class="c2p-delete-data display-none"><a class="code" data-clipboard-text="
16 add_filter('c2p_delete_all_submitted_posts','delete_all_submissions',10,3);
17 /**
18 * this filter controls wether or not to delete all submissions saved to the custom post type in the dashboard.
19 * @param Boolean $delete_all default is false
20 * @param String $post_type the custom post type that is mapped.
21 * @param String $cf7_key the current form key of which the mapping is being deleted.
22 * @return Boolean .
23 */
24 function delete_all_submissions($delete_all, $post_type, $cf7_key){
25 if('${post_type}'!=$post_type) return $delete_all;
26 return true;
27 }
28 add_filter('c2p_delete_all_submitted_posts_query','delete_post_submissions',10,3);
29 /**
30 * In case the above filter return true, this filter controls the query to retrive the posts which get deleted.
31 * @param Array $post_query query to retrieve posts to be deleted (all by default), set codex get_posts() documention.
32 * @param String $post_type the custom post type that is mapped.
33 * @param String $cf7_key the current form key of which the mapping is being deleted.
34 * @return Boolean .
35 */
36 function delete_all_submissions($post_query, $post_type, $cf7_key){
37 if('${post_type}'!=$post_type) return $post_query;
38 //modify the query such as to delete posts by a certain author or a perticular date...
39 return $post_query;
40 }" href="javascript:void(0);"></a><?= __('WARNING: this will also delete all saved submissions! Use this <span>filter</span> in your <code>functions.php</code> file to control the deletion of saved submissions.','post-my-cf7-form')?><span class="popup display-none">Click to Copy!</span></div>
41
42 </div>
43 </label>
44 </div>
45 </div>
46 </fieldset>
1 <?php
2
3
4 if(!empty($mapped_fields)){
5 foreach( $mapped_fields as $cf7_field => $post_field ){
6 ?>
7 <div class="cf72post-field">
8 <label><?=$cf7_field?></label>
9 <?php if(false && current_user_can('edit_others_posts',$post->ID)):?>
10 <input type="text" class="field-value" name="<?= $post_field?>" value="<?= get_post_meta($post->ID, $post_field , true)?>" />
11 <?php else:
12 $value = get_post_meta($post->ID, $post_field , true);
13 if(is_array($value)){
14 echo '<div>';
15 foreach($value as $key=>$avalue){
16 if(is_array($avalue)){
17 echo $key.":";
18 foreach($avalue as $row=>$rvalue){
19 $out = '';
20 if(!empty($rvalue)) $out = implode(',', $rvalue);
21 output_cf72post_field($out);
22 }
23 echo '</div><div>';
24 }else{
25 echo $avalue.',';
26 }
27 }
28 echo '</div>';
29 }else{
30 output_cf72post_field($value);
31 }
32 endif;?>
33 </div>
34 <?php
35 }
36 }
37
38 function output_cf72post_field($value){
39 echo '<span class="field-value">'.$value.'</span>';
40 }
1 <fieldset class="inline-edit-col-left">
2 <div class="inline-edit-col">
3 <label><span class="title"><?=__('CF7 >> Post', 'post-my-contact-form-7' )?></span><input class="cf72post-submit" type="checkbox" name="cf7_2_post_submit"/><? _e('Form Submitted', 'post-my-contact-form-7' )?></label>
4 <p><em><?=__('Uncheck to reload post in form', 'post-my-contact-form-7' )?></em></p>
5 </div>
6 </fieldset>
1 <?php
2 // require_once plugin_dir_path( dirname( __DIR__ ) ) . 'includes/class-cf7-2-post-factory.php' ;
3 // $is_new_mapping = true;
4 $select_form_fields='<select %4$s name="cf7_2_post_map_meta_value%1$s" value="%2$s" class="field-options post-options select-hybrid">
5 <option class="default-option" selected="true" value="">'. __('Select a form field', 'post-my-contact-form-7' ). '</option>
6 <option class="filter-option" value="cf7_2_post_filter%3$s%1$s">'.__('Hook with a filter', 'post-my-contact-form-7' ). '</option>
7 </select>';
8 //%1 - post-field name.
9 //%2 - form-field name.
10 //%3 - post type.
11 //%4 - disabled attr.
12
13 $mapped_fields = $post_mapper->get_mapped_meta_fields();
14 // debug_msg($mapped_fields, "meta fields...");
15 // debug_msg($post_mapper);
16 foreach( $mapped_fields as $cf7_field => $post_field ):
17 ?>
18 <li>
19 <div class="post-meta-field cf7-2-post-field">
20 <div class="post-field-name">
21 <?php
22 if('system' == $source){
23 echo $factory->get_metafield_menu($post_mapper->get('type'),$post_field);
24 }else{
25 echo $post_mapper->get_metafield_input($post_field);
26 }
27 ?>
28 </div>
29 <?php
30 //display the meta-field's form field dropdown.
31 echo sprintf( $select_form_fields, "-$post_field", $cf7_field, "-{$post_mapper->get('type')}", '');
32 ?>
33 <span class="dashicons dashicons-remove remove-field"></span>
34 </div><span class="cf7-post-msg"></span>
35 </li>
36 <?php endforeach;?>
37 <li class="default-meta-field">
38 <div class="post-meta-field cf7-2-post-field">
39 <span class="spinner meta-label"></span>
40 <div class="post-field-name">
41 <?php
42 if('system' == $source){
43 echo $factory->get_metafield_menu($post_mapper->get('type'),'');
44 }else{
45 echo $post_mapper->get_metafield_input('');
46 }
47 ?>
48 </div>
49 <?= sprintf( $select_form_fields, '-meta_key_1','','', 'disabled="true"'); //display the form field selevt.?>
50 <span class="dashicons dashicons-insert add-more-field"></span>
51 </div>
52 </li>
1 <?php
2
3
4 /**
5 * Loop taxonomies
6 */
7 $mapped_taxonomy = $post_mapper->get_mapped_taxonomy();
8 foreach( $mapped_taxonomy as $cf7_field => $post_taxonomy ) :
9 $taxonomy = $post_mapper->get_taxonomy($post_taxonomy);
10 $val = $cf7_field;
11 if(strpos($cf7_field,'cf7_2_post_filter-')===0) $val = '';
12 ?>
13 <li>
14 <div class="custom-taxonomy-field cf7-2-post-field<?= empty($val)?' hooked':'';?>">
15 <label class="taxonomy-label-field cf7-2-post-map-labels">
16 <span class="taxonomy-name">
17 <strong><?= $taxonomy['name']; ?></strong>
18 </span>&nbsp;
19 (<span class="enabled link-button edit-taxonomy"><?= __('Edit', 'post-my-contact-form-7')?></span>)
20 </label>
21 <select class="select-hybrid field-options taxonomy-options" name="cf7_2_post_map_taxonomy_value-<?=$post_taxonomy;?>/<?=$val?>" value="<?=$cf7_field?>">
22 <option class="default-option" selected="true" value="">
23 <?= __('Select a form field', 'post-my-contact-form-7' )?>
24 </option>
25 <option class="filter-option" value="cf7_2_post_filter-<?=$post_taxonomy?>">
26 <?=__('Hook with a filter', 'post-my-contact-form-7' )?>
27 </option>
28 </select>
29 <span class="dashicons dashicons-remove remove-field"></span>
30 <span class="php-filter-button"></span>
31 </div>
32 <span class="cf7-post-msg"></span>
33 <div class="custom-taxonomy-input-fields display-none">
34 <p>
35 <?= __('Choose a taxonomy, in blue are existing public taxonomies', 'post-my-contact-form-7'); ?>
36 </p>
37 <?= $post_mapper->get_taxonomy_listing($post_taxonomy); ?>
38 <label for="cf7_2_post_map_taxonomy_names-<?=$post_taxonomy; ?>">
39 <strong><?= __('Plural Name', 'post-my-contact-form-7')?></strong>
40 </label>
41 <?php $readonly = ('system'==$taxonomy['source']) ? 'readonly="true"' : '';?>
42 <input class="c2p-tax-labels plural-name" type="text" <?=$readonly?> name="cf7_2_post_map_taxonomy_names-<?= $post_taxonomy; ?>" value="<?= $taxonomy['name']?>" />
43 <label for="cf7_2_post_map_taxonomy_name-<?= $post_taxonomy; ?>">
44 <strong><?=__('Singular Name', 'post-my-contact-form-7'); ?></strong>
45 </label>
46 <input class="c2p-tax-labels singular-name" type="text" name="cf7_2_post_map_taxonomy_name-<?=$post_taxonomy; ?>" <?=$readonly?> value="<?=$taxonomy['singular_name']; ?>">
47 <label for="cf7_2_post_map_taxonomy_slug-<?=$post_taxonomy; ?>">
48 <strong><?=__('Slug', 'post-my-contact-form-7'); ?></strong>
49 </label>
50 <input class="c2p-tax-labels taxonomy-slug" type="text" name="cf7_2_post_map_taxonomy_slug-<?=$post_taxonomy; ?>" <?=$readonly?> value="<?=$post_taxonomy; ?>" />
51 <input type="hidden" class="taxonomy-source" name="cf7_2_post_map_taxonomy_source-<?=$post_taxonomy; ?>" value="<?=$taxonomy['source']; ?>" />
52 <button class="button-link close-details">
53 <span class="screen-reader-text">
54 <?=__('Toggle panel: Taxonomy details', 'post-my-contact-form-7'); ?>
55 </span>
56 <span class="focus button save-taxonomy">
57 <?= __('Save', 'post-my-contact-form-7')?>
58 </span>
59 </button>
60 </div>
61 </li>
62
63 <?php endforeach; // ENDFOREACH $mapped_taxonomy as $cf7_field => $post_taxonomy ?>
64 <?php
65 /**
66 * Default new taxonomy slug
67 */
68 $taxonomy_slug = sanitize_title($post_mapper->get('singular_name')) . '_categories';
69 ?>
70 <li>
71 <div class="custom-taxonomy-field cf7-2-post-field">
72 <label class="taxonomy-label-field cf7-2-post-map-labels">
73 <span class="taxonomy-name">
74 <strong><?=__('New Categories', 'post-my-contact-form-7' )?></strong>
75 </span>&nbsp;(<span class="link-button edit-taxonomy disabled"><?= __('Edit', 'post-my-contact-form-7')?></span>)
76 </label>
77 <select disabled="true" class="field-options taxonomy-options" name="cf7_2_post_map_taxonomy_value-<?=$taxonomy_slug;?>" value="">
78 <option class="default-option" selected="true" value="">
79 <?= __('Select a form field', 'post-my-contact-form-7' )?>
80 </option>
81 <option class="filter-option" value="cf7_2_post_filter-<?=$taxonomy_slug?>">
82 <?=__('Hook with a filter', 'post-my-contact-form-7' )?>
83 </option>
84 </select>
85 <span class="dashicons dashicons-insert add-more-field"></span>
86 <span class="php-filter-button"></span>
87 </div>
88 <span class="cf7-post-msg"></span>
89 <div class="display-none custom-taxonomy-input-fields">
90 <p>
91 <?= __('Choose a taxonomy, in <em>blue</em> are existing public taxonomies', 'post-my-contact-form-7'); ?>
92 </p>
93 <?= $post_mapper->get_taxonomy_listing(); ?>
94 <label for="cf7_2_post_map_taxonomy_names-<?=$taxonomy_slug; ?>">
95 <strong><?= __('Plural Name', 'post-my-contact-form-7')?></strong>
96 </label>
97 <input type="hidden" class="taxonomy-source" name="cf7_2_post_map_taxonomy_source-<?= $taxonomy_slug;?>" disabled="disabled" value="factory"/>
98 <input disabled="disabled" class="c2p-tax-labels plural-name" type="text" name="cf7_2_post_map_taxonomy_names-<?= $taxonomy_slug;?>" value="<?=__('New Categories', 'post-my-contact-form-7' )?>">
99 <label for="cf7_2_post_map_taxonomy_name-<?= $taxonomy_slug;?>">
100 <strong><?=__('Singular Name', 'post-my-contact-form-7' )?></strong>
101 </label>
102 <input disabled="disabled" class="c2p-tax-labels singular-name" type="text" name="cf7_2_post_map_taxonomy_name-<?= $taxonomy_slug;?>" value="New Category">
103 <label for="cf7_2_post_map_taxonomy_slug-<?= $taxonomy_slug;?>">
104 <strong><?=__('Slug', 'post-my-contact-form-7' )?></strong>
105 </label>
106 <input disabled="disabled" class="c2p-tax-labels taxonomy-slug" type="text" name="cf7_2_post_map_taxonomy_slug-<?= $taxonomy_slug;?>" value="<?= $taxonomy_slug;?>" />
107 <button class="button-link close-details">
108 <span class="focus button save-taxonomy">
109 <?= __('Save', 'post-my-contact-form-7')?>
110 </span>
111 </button>
112 </div>
113 </li>
1 <?php
2
3 /**
4 * Display C2P admin tab for filtered mappings.
5 *
6 * @link https://profiles.wordpress.org/aurovrata/
7 * @since 5.4.3
8 *
9 * @package Cf7_2_Post
10 * @subpackage Cf7_2_Post/admin/partials
11 */
12 $cf7_key_flat = str_replace('-','_',$cf7_key);
13 ?>
14 <h1><?= esc_html('Save submissions as ','post-my-contact-form-7' ); ?><span id="custom-post-title">filter</span></h1>
15 <!-- $form = get_post($cf7_post_id); ?> -->
16 <input type="hidden" id="c2p-cf7-key" value="<?=$cf7_key?>"/>
17 <input type="hidden" id="c2p-mapping-changed" name="c2p_mapping_changes" value="0"/>
18 <input type="hidden" id="c2p-active-tab" name="c2p_active_tab" value="0"/>
19 <input type="hidden" id="c2p-mapping-status" name="mapped_post_map" value="<?=$status?>"/>
20 <input type="hidden" name="mapped_post_default" value="0"/>
21 <input type="hidden" name="mapped_post_type_source" value="filter"/>
22
23 <?php wp_nonce_field('cf7_2_post_mapping', 'cf7_2_post_nonce', false, true);?>
24
25 <div id="c2p-factory-post">
26 <div class="c2p-title-header">
27 <h2><?=__('Map form to...','post-my-contact-form-7' )?></h2>
28 <div class="toggle toggle-light"></div>
29 </div>
30 <p>
31 <?= __("This form's submissions saved using an action callback, hook ",'post-my-contact-form-7');?>
32 <span id="c2p-filter-clipboard" class="cf7-post-msg animate-color">
33 <a class="code" data-clipboard-text="add_action('cf7_2_post_save_submission','c2p_save_<?=$cf7_key_flat?>',10,3);<?=PHP_EOL?>function c2p_save_<?=$cf7_key_flat?>($form_key, $form_data, $form_files){<?=PHP_EOL?> //$form_key is the unique form key.<?=PHP_EOL?> // $form_data is the submitted form data.<?=PHP_EOL?> //$form_files are submitted files if any.<?=PHP_EOL?>}" href="javascript:void(0);">cf7_2_post_save_submission</a>
34 <span class="popup"><?= __('Click to copy!', 'post-my-contact-form-7')?>
35 <span>
36 <?=__('Paste helper code into your theme functions.php file.', 'post-my-contact-form-7')?>
37 </span>
38 </span>
39 </span>
40 </p>
41 </div>
42 <script type="text/javascript">
43 (function($){
44 $(document).ready(function(){
45 new Clipboard(document.querySelector('#c2p-filter-clipboard a.code'));
46 })
47 })( jQuery )
48 </script>
49 <div class="c2p-filter">
50 <?php if(!defined('CF7_GRID_VERSION')){
51 $closed ='';
52 echo '<h2>'.__('Hooks & Filters to customise the mapping', 'post-my-contact-form-7').'</h2>';
53 include_once 'cf7-2-post-helper-metabox.php';
54 }?>
55 </div>
1 <?php
2
3 /**
4 * Provide a admin area view for the plugin
5 *
6 * This file is used to markup the admin-facing aspects of the plugin.
7 *
8 * @link http://syllogic.in
9 * @since 1.0.0
10 *
11 * @package Cf7_2_Post
12 * @subpackage Cf7_2_Post/admin/partials
13 */
14 //TODO: add a check box to include or not address fields
15 ?>
16
17 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
18
19 <div class="control-box cf7_2_post-save">
20 <fieldset>
21 <legend><?=__('Save button for Post My CF7 Form extension', 'post-my-contact-form-7')?></legend>
22 <table id="cf7_2_post-tag-generator" class="form-table">
23 <tbody>
24 <tr>
25 <th scope="row"><label for="tag-generator-panel-submit-values"><?=__('Label', 'post-my-contact-form-7')?></label></th>
26 <td><input name="values" class="oneline" id="tag-generator-panel-save-values" type="text"></td>
27 </tr>
28 <tr>
29 <th scope="row"><label for="tag-generator-panel-submit-id"><?=__('Id attribute', 'post-my-contact-form-7')?></label></th>
30 <td><input name="id" class="idvalue oneline option" id="tag-generator-panel-save-id" type="text"></td>
31 </tr>
32 <tr>
33 <th scope="row"><label for="tag-generator-panel-submit-class"><?=__('Class attribute', 'post-my-contact-form-7')?></label></th>
34 <td><input name="class" class="classvalue oneline option" id="tag-generator-panel-save-class" type="text"></td>
35 </tr>
36 </tbody>
37 </table>
38 </fieldset>
39 </div>
40 <div class="insert-box">
41 <input type="hidden" name="values" value="" />
42 <input type="text" name="save" class="tag code" readonly="readonly" onfocus="this.select()" />
43
44 <div class="submitbox">
45 <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
46 </div>
47
48 <br class="clear" />
49 </div>
1 <script type="text/javascript">
2 (function( $ ) {
3 'use strict';
4 $(document).ready(function() {
5 $('#adminmenu ul.wp-submenu li a[href="admin.php?page=cf7_post"]').parent().hide();
6 });
7 })( jQuery );
8 </script>
1 /**
2 * All of the CSS for your admin-specific functionality should be
3 * included in this file.
4 */
5 .display-none {
6 display: none;
7 }
8 #wpbody-content .inline-edit-row-page fieldset.hide-element,
9 #wpbody-content .inline-edit-row-page fieldset.hide-element *{
10 height: 0;
11 width: 0;
12 overflow: hidden;
13 margin:0;
14 }
15 .cf7-2-post-key-error {
16 color: red;
17 display: none;
18 }
19 .cf7-help-tip{
20 position: relative;
21 }
22 .cf7-help-tip span {
23 display: none;
24 }
25 .cf7-help-tip:hover > span {
26 display: block;
27 position: absolute;
28 width: 210px;
29 bottom: -18px;
30 line-height: 1.2em;
31 font-size: 90%;
32 left: 90px;
33 background: #e7e7e7;
34 padding: 5px;
35 border: 1px solid grey;
36 border-radius: 3px;
37 }
38 .cf7-help-tip a {
39 font-size: 95%;
40 font-style: italic;
41 }
42 #shortcode {
43 line-height: 1.2em;
44 }
45 .display-none{display: none;}
46 span.cf7sg-popup {
47 background: rgba(227, 224, 224, 0.81);
48 border-radius: 5px;
49 top: -2.2em;
50 left: 10px;
51 position: absolute;
52 transition: 500ms ease;
53 padding: .4em;
54 white-space: nowrap;
55 line-height: normal;
56 border: solid 1px;
57 }
58 .row-title.cf7-errors:hover+span.cf7sg-popup {display: block;}
59
60 .row-title.cf7-errors::after {
61 content: '\2731';
62 color: #d10000;
63 position: absolute;
64 top: -5px;
65 }
66 fieldset label.c2p-delete-mapping span.title {
67 width: 100%;
68 }
69 .c2p-delete-warning {
70 max-width: 26em;
71 }
1 (function($) {
2 $(document).ready(function(){
3 $('table.wp-list-table').on('click','.editinline',function(e){
4 const $post = $(e.target).closest('tr'),
5 post_id = $post.attr('id').replace('post-',''),
6 $edit = $('#edit-'+post_id, $post.parent());
7 $('fieldset.inline-edit-col-left',$edit).first().children('.inline-edit-col').children(':not(label)').hide();
8 $('fieldset.inline-edit-col-right',$edit).first().children().hide();
9 })
10 })
11 })(jQuery);
1 <?php
2 require_once plugin_dir_path( __FILE__ ) . 'admin/cf7-post-admin-table.php';
3
4
5 //reset the cf7 admin table
6 $cf7_admin = Cf7_WP_Post_Table::set_table();
7 if(!$cf7_admin->hooks()){
8 add_action( 'admin_enqueue_scripts', array($cf7_admin , 'enqueue_styles'));
9 add_action( 'admin_enqueue_scripts', array($cf7_admin , 'enqueue_script'));
10 //add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') ));
11 //modify the CF7 post type
12 add_action('init', array( $cf7_admin, 'modify_cf7_post_type' ) , 20 );
13 //cf7 sub-menu
14 add_action('admin_menu', array( $cf7_admin, 'add_cf7_sub_menu' ));
15 add_filter( 'custom_menu_order', array( $cf7_admin, 'change_cf7_submenu_order' ));
16 //modify the cf7 list table columns
17 add_filter('manage_wpcf7_contact_form_posts_columns' , array( $cf7_admin, 'modify_cf7_list_columns' ),1,1);
18 add_action('manage_wpcf7_contact_form_posts_custom_column', array( $cf7_admin, 'populate_custom_column') ,1,2 );
19 add_filter('post_row_actions', array( $cf7_admin, 'modify_cf7_list_row_actions') , 1, 2 );
20 //change the 'Add New' button link.
21 add_action('admin_print_footer_scripts', array( $cf7_admin, 'change_add_new_button' ),1);
22 //catch cf7 delete redirection
23 add_filter('wp_redirect', array( $cf7_admin, 'filter_cf7_redirect'),1,2 );
24 /** @since 4.1.8 edit edit link for form posts. */
25 add_filter('get_edit_post_link', array($cf7_admin, 'edit_form_link'),10,2 );
26 //add quick edit
27 //add_action( 'quick_edit_custom_box', array( $cf7_admin, 'quick_edit_box'), 100, 2 );
28 //cf7-form shortcode
29 add_shortcode( 'cf7-form', array( $cf7_admin, 'shortcode') );
30 add_shortcode( 'cf7form', array( $cf7_admin, 'shortcode') );
31 /** @since 5.3.2 */
32 add_action('admin_footer', array($cf7_admin, 'update_form_highlight'));
33 }
1 .hybrid-dropdown{position:relative;width:max-content;min-width:30px;min-height:2.5em;display:inline-block;vertical-align:baseline;font-size:1em;border:1px solid #6f6f6f;border-radius:.25em;padding:0 30px 0 18px;cursor:pointer;background:inherit}.hybriddd-none{width:unset;padding:0}select.hybridddised{visibility:hidden!important;width:0!important;height:0!important}.hybrid-dropdown:focus{box-shadow:1px 1px 3px}.hybriddd-option::before,.hybriddd-group::before{display:none!important;content:none;margin:0;padding:0}.hybridddised:disabled+.hybrid-dropdown{background:#ccc;color:grey}.hybrid-dropdown .hybriddd-wrapper{overflow:hidden;z-index:7777;position:absolute;left:0;max-height:34vh;min-width:max-content;display:none;background-color:inherit}.hybrid-dropdown.hybriddd-none .hybriddd-wrapper{display:block;position:static;max-width:100%;max-height:none;min-width:auto}.hybriddd-wrapper.hybriddd-grid{width:calc(max-content * var(--hybriddd-col))}.hybrid-dropdown .hybriddd-grid ul.hybriddd-options{display:grid;grid-template-columns:repeat(var(--hybriddd-col),1fr)}.hybrid-dropdown.hybriddd-none .hybriddd-options>li{display:inline-block}.hybrid-dropdown .hybriddd-grid .hybriddd-options>li{display:flex;line-height:0}.hybrid-dropdown .hybriddd-grid .hybridddl{line-height:normal;width:max-content}.hybrid-dropdown.hybriddd-top .hybriddd-wrapper{bottom:var(--hybriddd-top)}.hybrid-dropdown.hybriddd-right .hybriddd-wrapper{right:0;left:auto}.hybrid-dropdown ul.hybriddd-options{border:1px solid #6f6f6f;border-radius:.25em;overflow:hidden auto;scrollbar-width:thin;height:100%;background-color:inherit;overscroll-behavior:contain;position:relative;z-index:18}.hybrid-dropdown:not(.hybriddd-none) ul.hybriddd-options{list-style:none!important;margin:0!important;padding:0!important}.hybrid-dropdown.hybriddd-none .hybriddd-options{display:block;width:auto;margin:0;padding:0;overflow:unset}.hybrid-dropdown.active>.hybriddd-wrapper{display:block}.hybrid-dropdown *,.hybrid-dropdown .hybriddd-options .hybriddd-option,.hybrid-dropdown .hybriddd-options .hybriddd-option ul,.hybrid-dropdown .hybriddd-options .hybriddd-group,.hybrid-dropdown .hybriddd-options .hybriddd-group ul{box-sizing:border-box;cursor:default;margin:0}.hybriddd-selected{position:relative;width:auto;height:100%;padding:.4em 3px;cursor:pointer;min-width:100%;max-width:inherit;display:inline-block;z-index:7}.hybriddd-none .hybriddd-selected{display:none}.hybriddd-selected::after{border-bottom:2px solid #90a1b5;border-right:2px solid #90a1b5;content:'';display:block;height:5px;margin-top:-4px;pointer-events:none;position:absolute;right:-12px;top:50%;-webkit-transform-origin:66% 66%;-ms-transform-origin:66% 66%;transform-origin:66% 66%;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);-webkit-transition:all 0.15s ease-in-out;transition:all 0.15s ease-in-out;width:5px}.hybriddd-landscape .hybriddd-options>.hybriddd-option,.hybriddd-landscape .hybriddd-options>.hybriddd-group>ul>.hybriddd-option{display:inline-block}.hybriddd-landscape .hybriddd-options .hybridddl:dir(rtl){float:right}.hybriddd-landscape .hybriddd-options .hybriddd-group{clear:both;border-top:none;padding:0}.hybriddd-landscape .hybriddd-option>label{padding:.1em}ul.hybriddd-options::-webkit-scrollbar{width:6px}ul.hybriddd-options::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgb(1 1 1 / 35%)}.hybriddd-options ul{list-style:none;padding:0}.hybriddd-group>span{font-weight:700}.hybriddd-l0{padding:0 .5em}.hybriddd-l1{padding:0 1em 0 1em}.hybriddd-l2{padding:0 1em 0 1.5em}.hybriddd-l3{padding:0 1em 0 2em}.hybriddd-l4{padding:0 1em 0 2.5em}.hybriddd-l5{padding:0 1em 0 3em}.hybriddd-group>span{padding:0 .5em}.hybriddd-options ul .hybriddd-group>span{padding:0 1em}.hybriddd-option label{user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none;display:block}.hybriddd-none .hybriddd-option label{padding:0;position:relative;width:100%}.hybriddd-option label>*{display:inline-block}.hybridddcb{width:0;height:0;vertical-align:middle;display:inline-block;visibility:hidden}.hybrid-dropdown.show-cb .hybridddcb{visibility:visible;width:16px;height:16px;border:solid 1px;margin:0 3px 3px 2px}.hybriddd-option>label>input{opacity:0;position:absolute;width:0;height:0}.hybridddcb::before{content:'';display:block;width:10px;height:10px;margin:2px auto}.hybriddd-option input[type="radio"] .hybridddcb{border-radius:50%}.hybriddd-option input:checked .hybridddcb::before{border:solid 3px;padding:1px}.hybriddd-option.active>label{background:#0466ff;color:#fff}input:checked+.hybridddcb::before{background:#fff}.hybriddd-option.partial>label .hybridddcb::before{background:#a5a5a5}
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4 <svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:xlink="http://www.w3.org/1999/xlink"
11 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13 width="421.79376mm"
14 height="440.0788mm"
15 viewBox="0 0 421.79376 440.0788"
16 version="1.1"
17 id="svg8"
18 inkscape:export-filename="/home/vrata/Documents/WordPress/Repo/post-my-contact-form-7/assets/screenshot-9.png"
19 inkscape:export-xdpi="90.029999"
20 inkscape:export-ydpi="90.029999"
21 inkscape:version="0.92.3 (2405546, 2018-03-11)"
22 sodipodi:docname="screenshot-9.svg">
23 <defs
24 id="defs2" />
25 <sodipodi:namedview
26 id="base"
27 pagecolor="#ffffff"
28 bordercolor="#666666"
29 borderopacity="1.0"
30 inkscape:pageopacity="0.0"
31 inkscape:pageshadow="2"
32 inkscape:zoom="0.49497475"
33 inkscape:cx="598.89035"
34 inkscape:cy="993.24656"
35 inkscape:document-units="mm"
36 inkscape:current-layer="layer1"
37 showgrid="false"
38 showguides="false"
39 inkscape:guide-bbox="true"
40 fit-margin-top="20"
41 fit-margin-left="20"
42 fit-margin-right="20"
43 fit-margin-bottom="20"
44 inkscape:window-width="1920"
45 inkscape:window-height="998"
46 inkscape:window-x="0"
47 inkscape:window-y="45"
48 inkscape:window-maximized="1">
49 <sodipodi:guide
50 position="20.000001,275.73051"
51 orientation="1,0"
52 id="guide5054"
53 inkscape:locked="false" />
54 <sodipodi:guide
55 position="45.123332,264.50519"
56 orientation="1,0"
57 id="guide5056"
58 inkscape:locked="false" />
59 </sodipodi:namedview>
60 <metadata
61 id="metadata5">
62 <rdf:RDF>
63 <cc:Work
64 rdf:about="">
65 <dc:format>image/svg+xml</dc:format>
66 <dc:type
67 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
68 <dc:title></dc:title>
69 </cc:Work>
70 </rdf:RDF>
71 </metadata>
72 <g
73 inkscape:label="Layer 1"
74 inkscape:groupmode="layer"
75 id="layer1"
76 transform="translate(269.62973,-11.845862)">
77 <rect
78 style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.78199995;stroke-miterlimit:3.70000005;stroke-dasharray:none;stroke-opacity:1"
79 id="rect5058"
80 width="392.78674"
81 height="411.37302"
82 x="-254.44058"
83 y="26.966103"
84 inkscape:export-xdpi="90.029999"
85 inkscape:export-ydpi="90.029999" />
86 <image
87 sodipodi:absref="/home/vrata/Desktop/Screenshots/Screenshot-20181205095337-643x555.png"
88 xlink:href="/home/vrata/Desktop/Screenshots/Screenshot-20181205095337-643x555.png"
89 width="170.12709"
90 height="146.84375"
91 preserveAspectRatio="none"
92 id="image4825"
93 x="-120.37301"
94 y="59.223335" />
95 <image
96 sodipodi:absref="/home/vrata/Desktop/Screenshots/Screenshot-20181205095231-1430x183.png"
97 xlink:href="/home/vrata/Desktop/Screenshots/Screenshot-20181205095231-1430x183.png"
98 width="378.35416"
99 height="48.418751"
100 preserveAspectRatio="none"
101 id="image4887"
102 x="-249.62973"
103 y="383.50592" />
104 <image
105 sodipodi:absref="/home/vrata/Pictures/Screenshot from 2018-12-05 09-51-35.png"
106 xlink:href="/home/vrata/Pictures/Screenshot from 2018-12-05 09-51-35.png"
107 width="381.79376"
108 height="101.07083"
109 preserveAspectRatio="none"
110 id="image4984"
111 x="-249.62973"
112 y="259.8031" />
113 <text
114 xml:space="preserve"
115 style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
116 x="-250.16426"
117 y="39.886715"
118 id="text4989"><tspan
119 sodipodi:role="line"
120 id="tspan4987"
121 x="-250.16426"
122 y="39.886715"
123 style="stroke-width:0.26458332">how to map a field to a taxonomy?</tspan></text>
124 <text
125 xml:space="preserve"
126 style="font-style:normal;font-weight:normal;font-size:7.76111126px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
127 x="-223.97185"
128 y="74.631752"
129 id="text4993"><tspan
130 sodipodi:role="line"
131 id="tspan4991"
132 x="-223.97185"
133 y="74.631752"
134 style="stroke-width:0.26458332">In your form create</tspan><tspan
135 sodipodi:role="line"
136 x="-223.97185"
137 y="84.333138"
138 style="stroke-width:0.26458332"
139 id="tspan4995">a new field, this can </tspan><tspan
140 sodipodi:role="line"
141 x="-223.97185"
142 y="94.034531"
143 style="stroke-width:0.26458332"
144 id="tspan4997">be either a checkbox</tspan><tspan
145 sodipodi:role="line"
146 x="-223.97185"
147 y="103.73592"
148 style="stroke-width:0.26458332"
149 id="tspan4999">a radio field, or a </tspan><tspan
150 sodipodi:role="line"
151 x="-223.97185"
152 y="113.43731"
153 style="stroke-width:0.26458332"
154 id="tspan5001">dropdown select field.</tspan><tspan
155 sodipodi:role="line"
156 x="-223.97185"
157 y="123.13869"
158 style="stroke-width:0.26458332"
159 id="tspan5003" /><tspan
160 sodipodi:role="line"
161 x="-223.97185"
162 y="132.84009"
163 style="stroke-width:0.26458332"
164 id="tspan5005">Make sure you leave</tspan><tspan
165 sodipodi:role="line"
166 x="-223.97185"
167 y="142.54147"
168 style="stroke-width:0.26458332"
169 id="tspan5007">the options section </tspan><tspan
170 sodipodi:role="line"
171 x="-223.97185"
172 y="152.24286"
173 style="stroke-width:0.26458332"
174 id="tspan5009">blank as all options </tspan><tspan
175 sodipodi:role="line"
176 x="-223.97185"
177 y="161.94426"
178 style="stroke-width:0.26458332"
179 id="tspan5011">will automatically be f</tspan><tspan
180 sodipodi:role="line"
181 x="-223.97185"
182 y="171.64565"
183 style="stroke-width:0.26458332"
184 id="tspan5013">filled with the mapped</tspan><tspan
185 sodipodi:role="line"
186 x="-223.97185"
187 y="181.34703"
188 style="stroke-width:0.26458332"
189 id="tspan5015">taxonomy terms by </tspan><tspan
190 sodipodi:role="line"
191 x="-223.97185"
192 y="191.04842"
193 style="stroke-width:0.26458332"
194 id="tspan5017">the plugin </tspan></text>
195 <text
196 xml:space="preserve"
197 style="font-style:normal;font-weight:normal;font-size:8.46666622px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
198 x="-225.04094"
199 y="221.62999"
200 id="text5040"><tspan
201 sodipodi:role="line"
202 id="tspan5038"
203 x="-225.04094"
204 y="221.62999"
205 style="stroke-width:0.26458332">In your form mapping edit page (at the bottom), you can select a</tspan><tspan
206 sodipodi:role="line"
207 x="-225.04094"
208 y="232.21332"
209 style="stroke-width:0.26458332"
210 id="tspan5042">taxonomy field. add a new field (blue + button) and edit your </tspan><tspan
211 sodipodi:role="line"
212 x="-225.04094"
213 y="242.79666"
214 style="stroke-width:0.26458332"
215 id="tspan5044">taxonomy, either select an existing one or create new one, then save</tspan><tspan
216 sodipodi:role="line"
217 x="-225.04094"
218 y="253.37999"
219 style="stroke-width:0.26458332"
220 id="tspan5050">your selection.</tspan></text>
221 <text
222 xml:space="preserve"
223 style="font-style:normal;font-weight:normal;font-size:8.46666622px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
224 x="-223.43733"
225 y="369.6973"
226 id="text5048"><tspan
227 sodipodi:role="line"
228 id="tspan5046"
229 x="-223.43733"
230 y="369.6973"
231 style="stroke-width:0.26458332">Once you have selected the taxonomy, you need to map it to the field</tspan><tspan
232 sodipodi:role="line"
233 x="-223.43733"
234 y="380.28064"
235 style="stroke-width:0.26458332"
236 id="tspan5052">you created in the first step. </tspan></text>
237 </g>
238 </svg>
1 .nice-select {
2 -webkit-tap-highlight-color: transparent;
3 background-color: #fff;
4 border-radius: 5px;
5 border: solid 1px #e8e8e8;
6 box-sizing: border-box;
7 clear: both;
8 cursor: pointer;
9 display: block;
10 float: left;
11 font-family: inherit;
12 font-size: 14px;
13 font-weight: normal;
14 height: 42px;
15 line-height: 40px;
16 outline: none;
17 padding-left: 18px;
18 padding-right: 30px;
19 position: relative;
20 text-align: left !important;
21 -webkit-transition: all 0.2s ease-in-out;
22 transition: all 0.2s ease-in-out;
23 -webkit-user-select: none;
24 -moz-user-select: none;
25 -ms-user-select: none;
26 user-select: none;
27 white-space: nowrap;
28 width: auto; }
29 .nice-select:hover {
30 border-color: #dbdbdb; }
31 .nice-select:active, .nice-select.open, .nice-select:focus {
32 border-color: #999; }
33 .nice-select:after {
34 border-bottom: 2px solid #999;
35 border-right: 2px solid #999;
36 content: '';
37 display: block;
38 height: 5px;
39 margin-top: -4px;
40 pointer-events: none;
41 position: absolute;
42 right: 12px;
43 top: 50%;
44 -webkit-transform-origin: 66% 66%;
45 -ms-transform-origin: 66% 66%;
46 transform-origin: 66% 66%;
47 -webkit-transform: rotate(45deg);
48 -ms-transform: rotate(45deg);
49 transform: rotate(45deg);
50 -webkit-transition: all 0.15s ease-in-out;
51 transition: all 0.15s ease-in-out;
52 width: 5px; }
53 .nice-select.open:after {
54 -webkit-transform: rotate(-135deg);
55 -ms-transform: rotate(-135deg);
56 transform: rotate(-135deg); }
57 .nice-select.open .list {
58 opacity: 1;
59 pointer-events: auto;
60 -webkit-transform: scale(1) translateY(0);
61 -ms-transform: scale(1) translateY(0);
62 transform: scale(1) translateY(0); }
63 .nice-select.disabled {
64 border-color: #ededed;
65 color: #999;
66 pointer-events: none; }
67 .nice-select.disabled:after {
68 border-color: #cccccc; }
69 .nice-select.wide {
70 width: 100%; }
71 .nice-select.wide .list {
72 left: 0 !important;
73 right: 0 !important; }
74 .nice-select.right {
75 float: right; }
76 .nice-select.right .list {
77 left: auto;
78 right: 0; }
79 .nice-select.small {
80 font-size: 12px;
81 height: 36px;
82 line-height: 34px; }
83 .nice-select.small:after {
84 height: 4px;
85 width: 4px; }
86 .nice-select.small .option {
87 line-height: 34px;
88 min-height: 34px; }
89 .nice-select .list {
90 background-color: #fff;
91 border-radius: 5px;
92 box-shadow: 0 0 0 1px rgba(68, 68, 68, 0.11);
93 box-sizing: border-box;
94 margin-top: 4px;
95 opacity: 0;
96 overflow: hidden;
97 padding: 0;
98 pointer-events: none;
99 position: absolute;
100 top: 100%;
101 left: 0;
102 -webkit-transform-origin: 50% 0;
103 -ms-transform-origin: 50% 0;
104 transform-origin: 50% 0;
105 -webkit-transform: scale(0.75) translateY(-21px);
106 -ms-transform: scale(0.75) translateY(-21px);
107 transform: scale(0.75) translateY(-21px);
108 -webkit-transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
109 transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
110 z-index: 9; }
111 .nice-select .list:hover .option:not(:hover) {
112 background-color: transparent !important; }
113 .nice-select .option {
114 cursor: pointer;
115 font-weight: 400;
116 line-height: 40px;
117 list-style: none;
118 min-height: 40px;
119 outline: none;
120 padding-left: 18px;
121 padding-right: 29px;
122 text-align: left;
123 -webkit-transition: all 0.2s;
124 transition: all 0.2s; }
125 .nice-select .option:hover, .nice-select .option.focus, .nice-select .option.selected.focus {
126 background-color: #f6f6f6; }
127 .nice-select .option.selected {
128 font-weight: bold; }
129 .nice-select .option.disabled {
130 background-color: transparent;
131 color: #999;
132 cursor: default; }
133
134 .no-csspointerevents .nice-select .list {
135 display: none; }
136
137 .no-csspointerevents .nice-select.open .list {
138 display: block; }
1 .nice-select {
2 -webkit-tap-highlight-color: transparent;
3 background-color: #fff;
4 border-radius: 5px;
5 border: solid 1px #e0e7ee;
6 box-sizing: border-box;
7 clear: both;
8 cursor: pointer;
9 display: block;
10 float: left;
11 font-family: inherit;
12 font-size: 14px;
13 font-weight: normal;
14 height: 42px;
15 line-height: 40px;
16 outline: none;
17 padding-left: 18px;
18 padding-right: 30px;
19 position: relative;
20 text-align: left !important;
21 -webkit-transition: all 0.2s ease-in-out;
22 transition: all 0.2s ease-in-out;
23 -webkit-user-select: none;
24 -moz-user-select: none;
25 -ms-user-select: none;
26 user-select: none;
27 white-space: nowrap;
28 width: auto; }
29 .nice-select:hover {
30 border-color: #d0dae5; }
31 .nice-select:active, .nice-select.open, .nice-select:focus {
32 border-color: #88bfff; }
33 .nice-select:after {
34 border-bottom: 2px solid #90a1b5;
35 border-right: 2px solid #90a1b5;
36 content: '';
37 display: block;
38 height: 5px;
39 margin-top: -4px;
40 pointer-events: none;
41 position: absolute;
42 right: 12px;
43 top: 50%;
44 -webkit-transform-origin: 66% 66%;
45 -ms-transform-origin: 66% 66%;
46 transform-origin: 66% 66%;
47 -webkit-transform: rotate(45deg);
48 -ms-transform: rotate(45deg);
49 transform: rotate(45deg);
50 -webkit-transition: all 0.15s ease-in-out;
51 transition: all 0.15s ease-in-out;
52 width: 5px; }
53 .nice-select.open:after {
54 -webkit-transform: rotate(-135deg);
55 -ms-transform: rotate(-135deg);
56 transform: rotate(-135deg); }
57 .nice-select.open .list {
58 opacity: 1;
59 pointer-events: auto;
60 -webkit-transform: scale(1) translateY(0);
61 -ms-transform: scale(1) translateY(0);
62 transform: scale(1) translateY(0); }
63 .nice-select.disabled {
64 border-color: #e7ecf2;
65 color: #90a1b5;
66 pointer-events: none; }
67 .nice-select.disabled:after {
68 border-color: #cdd5de; }
69 .nice-select.wide {
70 width: 100%; }
71 .nice-select.wide .list {
72 left: 0 !important;
73 right: 0 !important; }
74 .nice-select.right {
75 float: right; }
76 .nice-select.right .list {
77 left: auto;
78 right: 0; }
79 .nice-select.small {
80 font-size: 12px;
81 height: 36px;
82 line-height: 34px; }
83 .nice-select.small:after {
84 height: 4px;
85 width: 4px; }
86 .nice-select.small .option {
87 line-height: 34px;
88 min-height: 34px; }
89 .nice-select .list {
90 background-color: #fff;
91 border-radius: 5px;
92 box-shadow: 0 0 0 1px rgba(68, 88, 112, 0.11);
93 box-sizing: border-box;
94 margin-top: 4px;
95 opacity: 0;
96 overflow: hidden;
97 padding: 0;
98 pointer-events: none;
99 position: absolute;
100 top: 100%;
101 left: 0;
102 -webkit-transform-origin: 50% 0;
103 -ms-transform-origin: 50% 0;
104 transform-origin: 50% 0;
105 -webkit-transform: scale(0.75) translateY(-21px);
106 -ms-transform: scale(0.75) translateY(-21px);
107 transform: scale(0.75) translateY(-21px);
108 -webkit-transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
109 transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
110 z-index: 9; }
111 .nice-select .list:hover .option:not(:hover) {
112 background-color: transparent !important; }
113 .nice-select .option {
114 cursor: pointer;
115 font-weight: 400;
116 line-height: 40px;
117 list-style: none;
118 min-height: 40px;
119 outline: none;
120 padding-left: 18px;
121 padding-right: 29px;
122 text-align: left;
123 -webkit-transition: all 0.2s;
124 transition: all 0.2s; }
125 .nice-select .option:hover, .nice-select .option.focus, .nice-select .option.selected.focus {
126 background-color: #f6f7f9; }
127 .nice-select .option.selected {
128 font-weight: bold; }
129 .nice-select .option.disabled {
130 background-color: transparent;
131 color: #90a1b5;
132 cursor: default; }
133
134 .no-csspointerevents .nice-select .list {
135 display: none; }
136
137 .no-csspointerevents .nice-select.open .list {
138 display: block; }
139
140 code[class*="language-"],
141 pre[class*="language-"] {
142 border-radius: 2px;
143 color: #445870;
144 -webkit-hyphens: none;
145 -ms-hyphens: none;
146 hyphens: none;
147 line-height: 1.5;
148 -moz-tab-size: 4;
149 -o-tab-size: 4;
150 tab-size: 4;
151 text-align: left;
152 white-space: pre;
153 word-break: normal;
154 word-spacing: normal;
155 word-wrap: normal;
156 direction: ltr;
157 font-family: Inconsolata, monospace;
158 font-size: 13px;
159 letter-spacing: 0; }
160
161 /* Code blocks */
162 pre[class*="language-"] {
163 padding: 18px 24px;
164 margin: 0 0 24px;
165 overflow: auto; }
166
167 :not(pre) > code[class*="language-"],
168 pre[class*="language-"] {
169 background: #f6f7f9; }
170
171 /* Inline code */
172 :not(pre) > code[class*="language-"] {
173 padding: 0 2px 1px; }
174
175 .token.comment,
176 .token.prolog,
177 .token.doctype,
178 .token.cdata {
179 color: #90a1b5; }
180
181 .token.punctuation {
182 color: #999; }
183
184 .namespace {
185 opacity: .7; }
186
187 .token.property,
188 .token.tag,
189 .token.boolean,
190 .token.number,
191 .token.constant,
192 .token.symbol,
193 .token.deleted {
194 color: #EC4444; }
195
196 .token.selector,
197 .token.attr-name,
198 .token.string,
199 .token.char,
200 .token.builtin,
201 .token.inserted {
202 color: #4ABF60; }
203
204 .token.operator,
205 .token.entity,
206 .token.url,
207 .language-css .token.string,
208 .style .token.string {
209 color: #a67f59;
210 background: rgba(255, 255, 255, 0.5); }
211
212 .token.atrule,
213 .token.attr-value,
214 .token.keyword {
215 color: #55a1fb; }
216
217 .token.function {
218 color: #DD4A68; }
219
220 .token.regex,
221 .token.important,
222 .token.variable {
223 color: #e90; }
224
225 .token.important,
226 .token.bold {
227 font-weight: bold; }
228
229 .token.italic {
230 font-style: italic; }
231
232 .token.entity {
233 cursor: help; }
234
235 body {
236 -webkit-font-smoothing: antialiased;
237 -moz-osx-font-smoothing: grayscale;
238 color: #445870;
239 font-family: 'Work Sans', sans-serif;
240 font-size: 14px;
241 font-weight: normal;
242 letter-spacing: -0.25px;
243 margin: 0;
244 padding: 0 18px; }
245
246 p {
247 line-height: 1.6;
248 margin: 0 0 1.6em; }
249
250 h1 {
251 font-size: 36px;
252 font-weight: 300;
253 letter-spacing: -2px;
254 margin: 0 0 24px; }
255
256 h2 {
257 font-size: 22px;
258 font-weight: 400;
259 margin: 0 0 12px;
260 padding-top: 48px; }
261
262 h3 {
263 font-size: 18px;
264 font-weight: 400;
265 margin: 0 0 12px;
266 padding-top: 12px; }
267
268 ul {
269 margin: 0;
270 padding-left: 16px; }
271
272 a:not(.button) {
273 color: #55a1fb;
274 outline: none;
275 text-decoration: none;
276 -webkit-transition: all 0.2s ease-in-out;
277 transition: all 0.2s ease-in-out;
278 border-bottom: 1px solid transparent; }
279 a:not(.button):hover, a:not(.button):focus {
280 border-bottom: 1px solid #88bfff; }
281
282 ::-moz-selection {
283 background: #f3f4f7; }
284
285 ::selection {
286 background: #f3f4f7; }
287
288 .container {
289 margin: 96px auto 60px;
290 max-width: 40em; }
291
292 .box {
293 background-color: #f6f7f9;
294 border-radius: 2px;
295 margin-bottom: 30px;
296 padding: 24px 30px; }
297 .box:before, .box:after {
298 content: "";
299 display: table; }
300 .box:after {
301 clear: both; }
302
303 label {
304 color: #90a1b5;
305 font-size: 11px;
306 margin: 0 2px 4px;
307 text-transform: uppercase;
308 float: left; }
309 label.right {
310 float: right; }
311
312 .button {
313 -webkit-tap-highlight-color: transparent;
314 background-color: #55a1fb;
315 border-radius: 5px;
316 border: none;
317 box-sizing: border-box;
318 color: #fff;
319 cursor: pointer;
320 display: inline-block;
321 font-weight: 600;
322 height: 42px;
323 line-height: 42px;
324 outline: none;
325 padding: 0 24px;
326 text-align: center;
327 text-decoration: none;
328 -webkit-transition: all 0.2s ease-in-out;
329 transition: all 0.2s ease-in-out;
330 white-space: nowrap;
331 width: auto; }
332 .button:hover, .button:focus {
333 background-color: #4196fb; }
334 .button:active, .button.nice-select.open {
335 background-color: #2d8bfa; }
336 .button.light {
337 background-color: #fff;
338 border: 1px solid #e0e7ee;
339 color: #55a1fb;
340 line-height: 40px;
341 margin-left: 24px; }
342 .button.light:hover {
343 border-color: #d0dae5; }
344 .button.light:active, .button.light.nice-select.open, .button.light:focus {
345 border-color: #88bfff; }
346 @media screen and (max-width: 360px) {
347 .button {
348 width: 100%; }
349 .button.light {
350 margin: 18px 0 0; } }
351
352 .header {
353 text-align: center;
354 margin-bottom: 60px; }
355 @media screen and (min-width: 600px) {
356 .header {
357 padding: 0 18px; } }
358 .header p {
359 color: #90a1b5;
360 font-size: 18px;
361 margin-bottom: 36px; }
362
363 .footer {
364 text-align: center; }
365 .footer p {
366 margin-bottom: 90px; }
367
368 .credit {
369 color: #90a1b5;
370 clear: both;
371 font-size: 12px;
372 margin-top: 90px; }
1 /* jQuery Nice Select - v1.1.0
2 https://github.com/hernansartorio/jquery-nice-select
3 Made by Hernán Sartorio */
4
5 (function($) {
6
7 $.fn.niceSelect = function(method) {
8
9 // Methods
10 if (typeof method == 'string') {
11 if (method == 'update') {
12 this.each(function() {
13 var $select = $(this);
14 var $dropdown = $(this).next('.nice-select');
15 var open = $dropdown.hasClass('open');
16
17 if ($dropdown.length) {
18 $dropdown.remove();
19 create_nice_select($select);
20
21 if (open) {
22 $select.next().trigger('click');
23 }
24 }
25 });
26 } else if (method == 'destroy') {
27 this.each(function() {
28 var $select = $(this);
29 var $dropdown = $(this).next('.nice-select');
30
31 if ($dropdown.length) {
32 $dropdown.remove();
33 $select.css('display', '');
34 }
35 });
36 if ($('.nice-select').length == 0) {
37 $(document).off('.nice_select');
38 }
39 } else {
40 console.log('Method "' + method + '" does not exist.')
41 }
42 return this;
43 }
44
45 // Hide native select
46 this.hide();
47
48 // Create custom markup
49 this.each(function() {
50 var $select = $(this);
51
52 if (!$select.next().hasClass('nice-select')) {
53 create_nice_select($select);
54 }
55 });
56
57 function create_nice_select($select) {
58 $select.after($('<div></div>')
59 .addClass('nice-select')
60 .addClass($select.attr('class') || '')
61 .addClass($select.attr('disabled') ? 'disabled' : '')
62 .attr('tabindex', $select.attr('disabled') ? null : '0')
63 .html('<span class="current"></span><ul class="list"></ul>')
64 );
65
66 var $dropdown = $select.next();
67 var $options = $select.find('option');
68 var $selected = $select.find('option:selected');
69
70 $dropdown.find('.current').html($selected.data('display') || $selected.text());
71
72 $options.each(function(i) {
73 var $option = $(this);
74 var display = $option.data('display');
75
76 $dropdown.find('ul').append($('<li></li>')
77 .attr('data-value', $option.val())
78 .attr('data-display', (display || null))
79 .addClass('option' +
80 ($option.is(':selected') ? ' selected' : '') +
81 ($option.is(':disabled') ? ' disabled' : ''))
82 .html($option.text())
83 );
84 });
85 }
86
87 /* Event listeners */
88
89 // Unbind existing events in case that the plugin has been initialized before
90 $(document).off('.nice_select');
91
92 // Open/close
93 $(document).on('click.nice_select', '.nice-select', function(event) {
94 var $dropdown = $(this);
95
96 $('.nice-select').not($dropdown).removeClass('open');
97 $dropdown.toggleClass('open');
98
99 if ($dropdown.hasClass('open')) {
100 $dropdown.find('.option');
101 $dropdown.find('.focus').removeClass('focus');
102 $dropdown.find('.selected').addClass('focus');
103 } else {
104 $dropdown.focus();
105 }
106 });
107
108 // Close when clicking outside
109 $(document).on('click.nice_select', function(event) {
110 if ($(event.target).closest('.nice-select').length === 0) {
111 $('.nice-select').removeClass('open').find('.option');
112 }
113 });
114
115 // Option click
116 $(document).on('click.nice_select', '.nice-select .option:not(.disabled)', function(event) {
117 var $option = $(this);
118 var $dropdown = $option.closest('.nice-select');
119
120 $dropdown.find('.selected').removeClass('selected');
121 $option.addClass('selected');
122
123 var text = $option.data('display') || $option.text();
124 $dropdown.find('.current').text(text);
125
126 $dropdown.prev('select').val($option.data('value')).trigger('change');
127 });
128
129 // Keyboard events
130 $(document).on('keydown.nice_select', '.nice-select', function(event) {
131 var $dropdown = $(this);
132 var $focused_option = $($dropdown.find('.focus') || $dropdown.find('.list .option.selected'));
133
134 // Space or Enter
135 if (event.keyCode == 32 || event.keyCode == 13) {
136 if ($dropdown.hasClass('open')) {
137 $focused_option.trigger('click');
138 } else {
139 $dropdown.trigger('click');
140 }
141 return false;
142 // Down
143 } else if (event.keyCode == 40) {
144 if (!$dropdown.hasClass('open')) {
145 $dropdown.trigger('click');
146 } else {
147 var $next = $focused_option.nextAll('.option:not(.disabled)').first();
148 if ($next.length > 0) {
149 $dropdown.find('.focus').removeClass('focus');
150 $next.addClass('focus');
151 }
152 }
153 return false;
154 // Up
155 } else if (event.keyCode == 38) {
156 if (!$dropdown.hasClass('open')) {
157 $dropdown.trigger('click');
158 } else {
159 var $prev = $focused_option.prevAll('.option:not(.disabled)').first();
160 if ($prev.length > 0) {
161 $dropdown.find('.focus').removeClass('focus');
162 $prev.addClass('focus');
163 }
164 }
165 return false;
166 // Esc
167 } else if (event.keyCode == 27) {
168 if ($dropdown.hasClass('open')) {
169 $dropdown.trigger('click');
170 }
171 // Tab
172 } else if (event.keyCode == 9) {
173 if ($dropdown.hasClass('open')) {
174 return false;
175 }
176 }
177 });
178
179 // Detect CSS pointer-events support, for IE <= 10. From Modernizr.
180 var style = document.createElement('a').style;
181 style.cssText = 'pointer-events:auto';
182 if (style.pointerEvents !== 'auto') {
183 $('html').addClass('no-csspointerevents');
184 }
185
186 return this;
187
188 };
189
190 }(jQuery));
...\ No newline at end of file ...\ No newline at end of file
1 /* jQuery Nice Select - v1.0
2 https://github.com/hernansartorio/jquery-nice-select
3 Made by Hernán Sartorio */
4 !function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("<div></div>").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html('<span class="current"></span><ul class="list"></ul>'));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("<li></li>").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery);
...\ No newline at end of file ...\ No newline at end of file
1 /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss */
2 var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==n)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)t.highlightElement(a,e===!0,n)},highlightElement:function(a,r,i){for(var l,o,s=a;s&&!e.test(s.className);)s=s.parentNode;s&&(l=(s.className.match(e)||[,""])[1],o=t.languages[l]),a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,s=a.parentNode,/pre/i.test(s.nodeName)&&(s.className=s.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var u=a.textContent,g={element:a,language:l,grammar:o,code:u};if(!u||!o)return t.hooks.run("complete",g),void 0;if(t.hooks.run("before-highlight",g),r&&_self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){g.highlightedCode=n.stringify(JSON.parse(e.data),l),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(g.element),t.hooks.run("after-highlight",g),t.hooks.run("complete",g)},c.postMessage(JSON.stringify({language:g.language,code:g.code,immediateClose:!0}))}else g.highlightedCode=t.highlight(g.code,g.grammar,g.language),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",g),t.hooks.run("complete",g)},highlight:function(e,a,r){var i=t.tokenize(e,a);return n.stringify(t.util.encode(i),r)},tokenize:function(e,n){var a=t.Token,r=[e],i=n.rest;if(i){for(var l in i)n[l]=i[l];delete n.rest}e:for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var o=n[l];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),N=[p,1];b&&N.push(b);var O=new a(l,g?t.tokenize(m,g):m,h);N.push(O),w&&N.push(w),Array.prototype.splice.apply(r,N)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=(o?" ":"")+s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+o+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,i=n.immediateClose;_self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),i&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3 Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4 Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/i,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
5 Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
6 Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
7 Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)*url(?=\()/i,selector:{pattern:/(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,inside:{placeholder:/%[-_\w]+/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,{pattern:/( +)(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","property",{variable:/\$[-_\w]+|#\{\$[-_\w]+\}/}),Prism.languages.insertBefore("scss","function",{placeholder:{pattern:/%[-_\w]+/,alias:"selector"},statement:/\B!(?:default|optional)\b/i,"boolean":/\b(?:true|false)\b/,"null":/\bnull\b/,operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.util.clone(Prism.languages.scss);
...\ No newline at end of file ...\ No newline at end of file
1 Copyright (C) 2012 - 2015 Simon Tabor
2
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 # jQuery Toggles
2
3 [![Dependencies](https://david-dm.org/simontabor/jquery-toggles.svg)](https://david-dm.org/simontabor/jquery-toggles)
4 [![Dev Dependencies](https://david-dm.org/simontabor/jquery-toggles/dev-status.svg)](https://david-dm.org/simontabor/jquery-toggles)
5 ![Bower](https://img.shields.io/bower/v/jquery-toggles.svg)
6 [![Join the chat at https://gitter.im/simontabor/jquery-toggles](https://img.shields.io/badge/gitter-join%20chat-blue.svg)](https://gitter.im/simontabor/jquery-toggles)
7
8 [![NPM](https://nodei.co/npm/jquery-toggles.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/jquery-toggles)
9
10 Want to create easy toggle buttons that you can click, drag, animate, use to toggle checkboxes and more? Yeah.
11
12 Examples can be seen [here](http://simontabor.com/toggles/).
13
14 ## Usage
15
16 ### Step 1: Include it in your page
17
18 Include the CSS at the start:
19
20 ```html
21 <head>
22 <title>My cool page</title>
23
24 <link rel="stylesheet" href="css/toggles.css">
25 <link rel="stylesheet" href="css/toggles-modern.css">
26
27 <!-- ALL OF THE THEMES -->
28 <!-- <link rel="stylesheet" href="css/toggles-all.css"> -->
29
30 <!-- ALL OF THE CSS AND THEMES IN ONE FILE -->
31 <!-- <link rel="stylesheet" href="css/toggles-full.css"> -->
32 ```
33
34 And the JS at the end:
35
36 ```html
37 <script src="js/toggles.js" type="text/javascript"></script>
38 <!-- MINIFIED JS - recommended for production -->
39 <!-- <script src="js/toggles.min.js" type="text/javascript"></script> -->
40 </body>
41 </html>
42 ```
43
44 ### Step 2: Create your element
45
46 You need to specify the class for the specific theme you want to use. In this case we are using `toggle-modern`. The `toggle` class is simply what we will use as our selector to initialize it.
47
48 ```html
49 <div class="toggle toggle-modern">
50 ```
51
52 The themes we could have used are:
53
54 * soft
55 * light
56 * dark
57 * iphone
58 * modern
59
60 Of course, you can write your own themes/tweak the styling.
61
62 ### Step 3: Initialize!
63
64 Now we just need to initialize the element we made to make it toggleable!
65
66 ```javascript
67
68 // Simplest way:
69 $('.toggle').toggles();
70
71
72 // With options (defaults shown below)
73 $('.toggle').toggles({
74 drag: true, // allow dragging the toggle between positions
75 click: true, // allow clicking on the toggle
76 text: {
77 on: 'ON', // text for the ON position
78 off: 'OFF' // and off
79 },
80 on: true, // is the toggle ON on init
81 animate: 250, // animation time (ms)
82 easing: 'swing', // animation transition easing function
83 checkbox: null, // the checkbox to toggle (for use in forms)
84 clicker: null, // element that can be clicked on to toggle. removes binding from the toggle itself (use nesting)
85 width: 50, // width used if not set in css
86 height: 20, // height if not set in css
87 type: 'compact' // if this is set to 'select' then the select style toggle will be used
88 });
89
90
91 // Getting notified of changes, and the new state:
92 $('.toggle').on('toggle', function(e, active) {
93 if (active) {
94 console.log('Toggle is now ON!');
95 } else {
96 console.log('Toggle is now OFF!');
97 }
98 });
99
100 ```
101
102 ## Advanced Usage
103
104 ### Setting toggle states
105
106 ```javascript
107 // initiate a new Toggles class
108 $('.toggles').toggles({
109 on: true
110 });
111
112 // the underlying Toggles class can be accessed
113 var myToggle = $('.toggles').data('toggles');
114
115 console.log(myToggle.active); // true
116 myToggle.toggle();
117 console.log(myToggle.active); // false
118
119 // set the state to 'false'
120 // will not do anything if the state is already false
121 myToggle.toggle(false);
122 console.log(myToggle.active); // false
123
124 // passing a boolean in place of options on an active toggle element
125 // will set the state
126 $('.toggles').toggles(true);
127 console.log(myToggle.active); // true
128
129 // the toggle-active data attribute stores the state too
130 console.log($('.toggles').data('toggle-active')); // true
131
132 // myToggle.toggle(state, noAnimate, noEvent)
133
134 // don't animate the change
135 myToggle.toggle(false, true);
136
137 // change the state without triggering an event
138 myToggle.toggle(true, false, true);
139 ```
140
141 ### Using data-toggle-\* attributes on the element
142
143 Any of the following options can be set using data-toggle attributes: `on`, `drag`, `click`, `width`, `height`, `animate`, `easing`, `type`, `checkbox`
144 ```html
145 <div class="toggles" data-toggle-on="true" data-toggle-height="20" data-toggle-width="60"></div>
146 ```
147 ```javascript
148 $('.toggles').toggles();
149 ```
150
151 ### Disabling user interaction
152
153 It can be useful to disable the toggle to stop users from changing the state. Set the `disabled` attribute on the toggle element to do this. Alternatively, you could use CSS to set `pointer-events: none`
154
155 ```js
156 // your toggle element
157 var toggle = $('.toggle');
158
159 // initialise it
160 toggle.toggles();
161
162 // disable the toggle element (click + drag will no longer work)
163 toggle.toggleClass('disabled', true);
164
165 // setting the state via JS is NOT disabled, only user input
166 // toggle the toggle on
167 toggle.toggles(true);
168
169 // re-enable the toggle
170 toggle.toggleClass('disabled', false);
171 ```
172
173 ## Contributing
174
175 Make your JavaScript edits to `js/Toggles.js`. Any styling edits should be made to the relevent files in the `less` folder. JS edits must be compatible with Closure Compiler advanced optimisations - if you aren't able to code in this style then I'll happily tweak any pull requests/help out.
176
177 To build the files for release, run `make`. Again, if you struggle then I'll be able to build the files for you. (Note: use node v5)
1 {
2 "name": "simontabor/jquery-toggles",
3 "version": "4.0.0",
4 "main": "toggles.min.js",
5 "description": "Toggles is a lightweight jQuery plugin that creates easily-styleable toggle buttons.",
6 "license": "MIT",
7 "ignore": [
8 "lib/*"
9 ]
10 }
1 .toggle-dark .toggle-slide {
2 border-radius: 5px;
3 box-shadow: 0 0 0 1px #242529, 0 1px 0 1px #666;
4 }
5 .toggle-dark .toggle-on,
6 .toggle-dark .toggle-off,
7 .toggle-dark .toggle-blob {
8 color: rgba(255, 255, 255, 0.7);
9 font-size: 11px;
10 }
11 .toggle-dark .toggle-on,
12 .toggle-dark .toggle-select .toggle-inner .active {
13 background: -webkit-linear-gradient(#1A70BE, #31A2E1);
14 background: linear-gradient(#1A70BE, #31A2E1);
15 }
16 .toggle-dark .toggle-off,
17 .toggle-dark .toggle-select .toggle-on {
18 background: -webkit-linear-gradient(#242529, #34363B);
19 background: linear-gradient(#242529, #34363B);
20 }
21 .toggle-dark .toggle-blob {
22 border-radius: 4px;
23 background: -webkit-linear-gradient(#CFCFCF, whiteSmoke);
24 background: linear-gradient(#CFCFCF, whiteSmoke);
25 box-shadow: inset 0 0 0 1px #888, inset 0 0 0 2px white;
26 }
27 .toggle-dark .toggle-blob:hover {
28 background: -webkit-linear-gradient(#c0c0c0, #dadada);
29 background: linear-gradient(#c0c0c0, #dadada);
30 box-shadow: inset 0 0 0 1px #888,inset 0 0 0 2px #ddd;
31 }
32 .toggle-iphone .toggle-slide {
33 border-radius: 9999px;
34 box-shadow: 0 0 0 1px #999;
35 }
36 .toggle-iphone .toggle-on,
37 .toggle-iphone .toggle-off {
38 color: white;
39 font-size: 18px;
40 font-weight: bold;
41 text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
42 }
43 .toggle-iphone .toggle-on {
44 border-radius: 9999px 0 0 9999px;
45 background: #037bda;
46 box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
47 }
48 .toggle-iphone .toggle-on:after {
49 background: -webkit-linear-gradient(#1189f1, #3797ef);
50 background: linear-gradient(#1189f1, #3797ef);
51 height: 50%;
52 content: '';
53 margin-top: -19%;
54 display: block;
55 border-radius: 9999px;
56 margin-left: 10%;
57 }
58 .toggle-iphone .toggle-off {
59 box-shadow: inset -2px 2px 5px rgba(0, 0, 0, 0.4);
60 border-radius: 0 9999px 9999px 0;
61 color: #828282;
62 background: #ECECEC;
63 text-shadow: 0 0 1px white;
64 }
65 .toggle-iphone .toggle-off:after {
66 background: -webkit-linear-gradient(#fafafa, #fdfdfd);
67 background: linear-gradient(#fafafa, #fdfdfd);
68 height: 50%;
69 content: '';
70 margin-top: -19%;
71 display: block;
72 margin-right: 10%;
73 border-radius: 9999px;
74 }
75 .toggle-iphone .toggle-blob {
76 border-radius: 50px;
77 background: -webkit-linear-gradient(#d1d1d1, #fafafa);
78 background: linear-gradient(#d1d1d1, #fafafa);
79 box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 2px white, 0 0 3px rgba(0, 0, 0, 0.6);
80 }
81 .toggle-light .toggle-slide {
82 border-radius: 9999px;
83 box-shadow: 0 0 0 1px #999;
84 }
85 .toggle-light .toggle-on,
86 .toggle-light .toggle-off {
87 font-size: 11px;
88 font-weight: 500;
89 }
90 .toggle-light .toggle-on,
91 .toggle-light .toggle-select .toggle-inner .active {
92 background: #45a31f;
93 box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.2);
94 text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
95 color: rgba(255, 255, 255, 0.8);
96 }
97 .toggle-light .toggle-off,
98 .toggle-light .toggle-select .toggle-on {
99 color: rgba(0, 0, 0, 0.6);
100 text-shadow: 0 1px rgba(255, 255, 255, 0.2);
101 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
102 background: linear-gradient(#cfcfcf, #f5f5f5);
103 }
104 .toggle-light .toggle-blob {
105 border-radius: 50px;
106 background: -webkit-linear-gradient(#f5f5f5, #cfcfcf);
107 background: linear-gradient(#f5f5f5, #cfcfcf);
108 box-shadow: 1px 1px 2px #888;
109 }
110 .toggle-light .toggle-blob:hover {
111 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
112 background: linear-gradient(#e4e4e4, #f9f9f9);
113 }
114 .toggle-modern .toggle-slide {
115 border-radius: 4px;
116 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.2);
117 background: -webkit-linear-gradient(#c0c5c9, #a1a9af);
118 background: linear-gradient(#c0c5c9, #a1a9af);
119 box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255, 255, 255, 0.15);
120 }
121 .toggle-modern .toggle-on,
122 .toggle-modern .toggle-off {
123 -webkit-transition: all 0.1s ease-out;
124 transition: all 0.1s ease-out;
125 color: white;
126 text-shadow: 1px 1px rgba(0, 0, 0, 0.1);
127 font-size: 11px;
128 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
129 }
130 .toggle-modern .toggle-select .toggle-off,
131 .toggle-modern .toggle-select .toggle-on {
132 background: none;
133 }
134 .toggle-modern .toggle-off,
135 .toggle-modern .toggle-off.active {
136 background: -webkit-linear-gradient(#737e8d, #3f454e);
137 background: linear-gradient(#737e8d, #3f454e);
138 }
139 .toggle-modern .toggle-on,
140 .toggle-modern .toggle-on.active {
141 background: -webkit-linear-gradient(#4894cd, #2852a6);
142 background: linear-gradient(#4894cd, #2852a6);
143 }
144 .toggle-modern .toggle-blob {
145 background: -webkit-linear-gradient(#c0c6c9, #81898f);
146 background: linear-gradient(#c0c6c9, #81898f);
147 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 1px 1px 2px rgba(0, 0, 0, 0.2);
148 border-radius: 3px;
149 }
150 .toggle-modern .toggle-blob:hover {
151 background-image: -webkit-linear-gradient(#a1a9af, #a1a9af);
152 background-image: linear-gradient(#a1a9af, #a1a9af);
153 }
154 .toggle-soft .toggle-slide {
155 border-radius: 5px;
156 box-shadow: 0 0 0 1px #999;
157 }
158 .toggle-soft .toggle-on,
159 .toggle-soft .toggle-off {
160 color: rgba(0, 0, 0, 0.7);
161 font-size: 11px;
162 text-shadow: 1px 1px white;
163 }
164 .toggle-soft .toggle-on,
165 .toggle-soft .toggle-select .toggle-inner .active {
166 background: -webkit-linear-gradient(#d2ff52, #91e842);
167 background: linear-gradient(#d2ff52, #91e842);
168 }
169 .toggle-soft .toggle-off,
170 .toggle-soft .toggle-select .toggle-on {
171 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
172 background: linear-gradient(#cfcfcf, #f5f5f5);
173 }
174 .toggle-soft .toggle-blob {
175 border-radius: 4px;
176 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
177 background: linear-gradient(#cfcfcf, #f5f5f5);
178 box-shadow: inset 0 0 0 1px #bbb, inset 0 0 0 2px white;
179 }
180 .toggle-soft .toggle-blob:hover {
181 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
182 background: linear-gradient(#e4e4e4, #f9f9f9);
183 box-shadow: inset 0 0 0 1px #ddd,inset 0 0 0 2px #ddd;
184 }
1 .toggle-dark .toggle-slide {
2 border-radius: 5px;
3 box-shadow: 0 0 0 1px #242529, 0 1px 0 1px #666;
4 }
5 .toggle-dark .toggle-on,
6 .toggle-dark .toggle-off,
7 .toggle-dark .toggle-blob {
8 color: rgba(255, 255, 255, 0.7);
9 font-size: 11px;
10 }
11 .toggle-dark .toggle-on,
12 .toggle-dark .toggle-select .toggle-inner .active {
13 background: -webkit-linear-gradient(#1A70BE, #31A2E1);
14 background: linear-gradient(#1A70BE, #31A2E1);
15 }
16 .toggle-dark .toggle-off,
17 .toggle-dark .toggle-select .toggle-on {
18 background: -webkit-linear-gradient(#242529, #34363B);
19 background: linear-gradient(#242529, #34363B);
20 }
21 .toggle-dark .toggle-blob {
22 border-radius: 4px;
23 background: -webkit-linear-gradient(#CFCFCF, whiteSmoke);
24 background: linear-gradient(#CFCFCF, whiteSmoke);
25 box-shadow: inset 0 0 0 1px #888, inset 0 0 0 2px white;
26 }
27 .toggle-dark .toggle-blob:hover {
28 background: -webkit-linear-gradient(#c0c0c0, #dadada);
29 background: linear-gradient(#c0c0c0, #dadada);
30 box-shadow: inset 0 0 0 1px #888,inset 0 0 0 2px #ddd;
31 }
1 .toggle-iphone .toggle-slide {
2 border-radius: 9999px;
3 box-shadow: 0 0 0 1px #999;
4 }
5 .toggle-iphone .toggle-on,
6 .toggle-iphone .toggle-off {
7 color: white;
8 font-size: 18px;
9 font-weight: bold;
10 text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
11 }
12 .toggle-iphone .toggle-on {
13 border-radius: 9999px 0 0 9999px;
14 background: #037bda;
15 box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
16 }
17 .toggle-iphone .toggle-on:after {
18 background: -webkit-linear-gradient(#1189f1, #3797ef);
19 background: linear-gradient(#1189f1, #3797ef);
20 height: 50%;
21 content: '';
22 margin-top: -19%;
23 display: block;
24 border-radius: 9999px;
25 margin-left: 10%;
26 }
27 .toggle-iphone .toggle-off {
28 box-shadow: inset -2px 2px 5px rgba(0, 0, 0, 0.4);
29 border-radius: 0 9999px 9999px 0;
30 color: #828282;
31 background: #ECECEC;
32 text-shadow: 0 0 1px white;
33 }
34 .toggle-iphone .toggle-off:after {
35 background: -webkit-linear-gradient(#fafafa, #fdfdfd);
36 background: linear-gradient(#fafafa, #fdfdfd);
37 height: 50%;
38 content: '';
39 margin-top: -19%;
40 display: block;
41 margin-right: 10%;
42 border-radius: 9999px;
43 }
44 .toggle-iphone .toggle-blob {
45 border-radius: 50px;
46 background: -webkit-linear-gradient(#d1d1d1, #fafafa);
47 background: linear-gradient(#d1d1d1, #fafafa);
48 box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 2px white, 0 0 3px rgba(0, 0, 0, 0.6);
49 }
1 .toggle-light .toggle-slide {
2 border-radius: 9999px;
3 box-shadow: 0 0 0 1px #999;
4 }
5 .toggle-light .toggle-on,
6 .toggle-light .toggle-off {
7 font-size: 11px;
8 font-weight: 500;
9 }
10 .toggle-light .toggle-on,
11 .toggle-light .toggle-select .toggle-inner .active {
12 background: #45a31f;
13 box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.2);
14 text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
15 color: rgba(255, 255, 255, 0.8);
16 }
17 .toggle-light .toggle-off,
18 .toggle-light .toggle-select .toggle-on {
19 color: rgba(0, 0, 0, 0.6);
20 text-shadow: 0 1px rgba(255, 255, 255, 0.2);
21 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
22 background: linear-gradient(#cfcfcf, #f5f5f5);
23 }
24 .toggle-light .toggle-blob {
25 border-radius: 50px;
26 background: -webkit-linear-gradient(#f5f5f5, #cfcfcf);
27 background: linear-gradient(#f5f5f5, #cfcfcf);
28 box-shadow: 1px 1px 2px #888;
29 }
30 .toggle-light .toggle-blob:hover {
31 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
32 background: linear-gradient(#e4e4e4, #f9f9f9);
33 }
1 .toggle-light .toggle-slide{border-radius:9999px;box-shadow:0 0 0 1px #999}.toggle-light .toggle-off,.toggle-light .toggle-on{font-size:11px;font-weight:500}.toggle-light .toggle-on,.toggle-light .toggle-select .toggle-inner .active{background:#45a31f;box-shadow:inset 2px 2px 6px rgba(0,0,0,.2);text-shadow:1px 1px rgba(0,0,0,.2);color:rgba(255,255,255,.8)}.toggle-light .toggle-off,.toggle-light .toggle-select .toggle-on{color:rgba(0,0,0,.6);text-shadow:0 1px rgba(255,255,255,.2);background:-webkit-linear-gradient(#cfcfcf,#f5f5f5);background:linear-gradient(#cfcfcf,#f5f5f5)}.toggle-light .toggle-blob{border-radius:50px;background:-webkit-linear-gradient(#f5f5f5,#cfcfcf);background:linear-gradient(#f5f5f5,#cfcfcf);box-shadow:1px 1px 2px #888}.toggle-light .toggle-blob:hover{background:-webkit-linear-gradient(#e4e4e4,#f9f9f9);background:linear-gradient(#e4e4e4,#f9f9f9)}
1 .toggle-modern .toggle-slide {
2 border-radius: 4px;
3 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.2);
4 background: -webkit-linear-gradient(#c0c5c9, #a1a9af);
5 background: linear-gradient(#c0c5c9, #a1a9af);
6 box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255, 255, 255, 0.15);
7 }
8 .toggle-modern .toggle-on,
9 .toggle-modern .toggle-off {
10 -webkit-transition: all 0.1s ease-out;
11 transition: all 0.1s ease-out;
12 color: white;
13 text-shadow: 1px 1px rgba(0, 0, 0, 0.1);
14 font-size: 11px;
15 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
16 }
17 .toggle-modern .toggle-select .toggle-off,
18 .toggle-modern .toggle-select .toggle-on {
19 background: none;
20 }
21 .toggle-modern .toggle-off,
22 .toggle-modern .toggle-off.active {
23 background: -webkit-linear-gradient(#737e8d, #3f454e);
24 background: linear-gradient(#737e8d, #3f454e);
25 }
26 .toggle-modern .toggle-on,
27 .toggle-modern .toggle-on.active {
28 background: -webkit-linear-gradient(#4894cd, #2852a6);
29 background: linear-gradient(#4894cd, #2852a6);
30 }
31 .toggle-modern .toggle-blob {
32 background: -webkit-linear-gradient(#c0c6c9, #81898f);
33 background: linear-gradient(#c0c6c9, #81898f);
34 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 1px 1px 2px rgba(0, 0, 0, 0.2);
35 border-radius: 3px;
36 }
37 .toggle-modern .toggle-blob:hover {
38 background-image: -webkit-linear-gradient(#a1a9af, #a1a9af);
39 background-image: linear-gradient(#a1a9af, #a1a9af);
40 }
1 .toggle-soft .toggle-slide {
2 border-radius: 5px;
3 box-shadow: 0 0 0 1px #999;
4 }
5 .toggle-soft .toggle-on,
6 .toggle-soft .toggle-off {
7 color: rgba(0, 0, 0, 0.7);
8 font-size: 11px;
9 text-shadow: 1px 1px white;
10 }
11 .toggle-soft .toggle-on,
12 .toggle-soft .toggle-select .toggle-inner .active {
13 background: -webkit-linear-gradient(#d2ff52, #91e842);
14 background: linear-gradient(#d2ff52, #91e842);
15 }
16 .toggle-soft .toggle-off,
17 .toggle-soft .toggle-select .toggle-on {
18 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
19 background: linear-gradient(#cfcfcf, #f5f5f5);
20 }
21 .toggle-soft .toggle-blob {
22 border-radius: 4px;
23 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
24 background: linear-gradient(#cfcfcf, #f5f5f5);
25 box-shadow: inset 0 0 0 1px #bbb, inset 0 0 0 2px white;
26 }
27 .toggle-soft .toggle-blob:hover {
28 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
29 background: linear-gradient(#e4e4e4, #f9f9f9);
30 box-shadow: inset 0 0 0 1px #ddd,inset 0 0 0 2px #ddd;
31 }
1 .toggle-slide {
2 overflow: hidden;
3 cursor: pointer;
4 -webkit-user-select: none;
5 -moz-user-select: none;
6 -ms-user-select: none;
7 user-select: none;
8 direction: ltr;
9 text-align: center;
10 }
11 div.disabled > .toggle-slide {
12 opacity: 0.7;
13 pointer-events: none;
14 }
15 .toggle-slide .toggle-on,
16 .toggle-slide .toggle-off,
17 .toggle-slide .toggle-blob {
18 float: left;
19 }
20 .toggle-slide .toggle-blob {
21 position: relative;
22 z-index: 99;
23 cursor: hand;
24 cursor: grab;
25 }
26 .toggle-dark .toggle-slide {
27 border-radius: 5px;
28 box-shadow: 0 0 0 1px #242529, 0 1px 0 1px #666;
29 }
30 .toggle-dark .toggle-on,
31 .toggle-dark .toggle-off,
32 .toggle-dark .toggle-blob {
33 color: rgba(255, 255, 255, 0.7);
34 font-size: 11px;
35 }
36 .toggle-dark .toggle-on,
37 .toggle-dark .toggle-select .toggle-inner .active {
38 background: -webkit-linear-gradient(#1A70BE, #31A2E1);
39 background: linear-gradient(#1A70BE, #31A2E1);
40 }
41 .toggle-dark .toggle-off,
42 .toggle-dark .toggle-select .toggle-on {
43 background: -webkit-linear-gradient(#242529, #34363B);
44 background: linear-gradient(#242529, #34363B);
45 }
46 .toggle-dark .toggle-blob {
47 border-radius: 4px;
48 background: -webkit-linear-gradient(#CFCFCF, whiteSmoke);
49 background: linear-gradient(#CFCFCF, whiteSmoke);
50 box-shadow: inset 0 0 0 1px #888, inset 0 0 0 2px white;
51 }
52 .toggle-dark .toggle-blob:hover {
53 background: -webkit-linear-gradient(#c0c0c0, #dadada);
54 background: linear-gradient(#c0c0c0, #dadada);
55 box-shadow: inset 0 0 0 1px #888,inset 0 0 0 2px #ddd;
56 }
57 .toggle-iphone .toggle-slide {
58 border-radius: 9999px;
59 box-shadow: 0 0 0 1px #999;
60 }
61 .toggle-iphone .toggle-on,
62 .toggle-iphone .toggle-off {
63 color: white;
64 font-size: 18px;
65 font-weight: bold;
66 text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
67 }
68 .toggle-iphone .toggle-on {
69 border-radius: 9999px 0 0 9999px;
70 background: #037bda;
71 box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
72 }
73 .toggle-iphone .toggle-on:after {
74 background: -webkit-linear-gradient(#1189f1, #3797ef);
75 background: linear-gradient(#1189f1, #3797ef);
76 height: 50%;
77 content: '';
78 margin-top: -19%;
79 display: block;
80 border-radius: 9999px;
81 margin-left: 10%;
82 }
83 .toggle-iphone .toggle-off {
84 box-shadow: inset -2px 2px 5px rgba(0, 0, 0, 0.4);
85 border-radius: 0 9999px 9999px 0;
86 color: #828282;
87 background: #ECECEC;
88 text-shadow: 0 0 1px white;
89 }
90 .toggle-iphone .toggle-off:after {
91 background: -webkit-linear-gradient(#fafafa, #fdfdfd);
92 background: linear-gradient(#fafafa, #fdfdfd);
93 height: 50%;
94 content: '';
95 margin-top: -19%;
96 display: block;
97 margin-right: 10%;
98 border-radius: 9999px;
99 }
100 .toggle-iphone .toggle-blob {
101 border-radius: 50px;
102 background: -webkit-linear-gradient(#d1d1d1, #fafafa);
103 background: linear-gradient(#d1d1d1, #fafafa);
104 box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 2px white, 0 0 3px rgba(0, 0, 0, 0.6);
105 }
106 .toggle-light .toggle-slide {
107 border-radius: 9999px;
108 box-shadow: 0 0 0 1px #999;
109 }
110 .toggle-light .toggle-on,
111 .toggle-light .toggle-off {
112 font-size: 11px;
113 font-weight: 500;
114 }
115 .toggle-light .toggle-on,
116 .toggle-light .toggle-select .toggle-inner .active {
117 background: #45a31f;
118 box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.2);
119 text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
120 color: rgba(255, 255, 255, 0.8);
121 }
122 .toggle-light .toggle-off,
123 .toggle-light .toggle-select .toggle-on {
124 color: rgba(0, 0, 0, 0.6);
125 text-shadow: 0 1px rgba(255, 255, 255, 0.2);
126 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
127 background: linear-gradient(#cfcfcf, #f5f5f5);
128 }
129 .toggle-light .toggle-blob {
130 border-radius: 50px;
131 background: -webkit-linear-gradient(#f5f5f5, #cfcfcf);
132 background: linear-gradient(#f5f5f5, #cfcfcf);
133 box-shadow: 1px 1px 2px #888;
134 }
135 .toggle-light .toggle-blob:hover {
136 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
137 background: linear-gradient(#e4e4e4, #f9f9f9);
138 }
139 .toggle-modern .toggle-slide {
140 border-radius: 4px;
141 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.2);
142 background: -webkit-linear-gradient(#c0c5c9, #a1a9af);
143 background: linear-gradient(#c0c5c9, #a1a9af);
144 box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255, 255, 255, 0.15);
145 }
146 .toggle-modern .toggle-on,
147 .toggle-modern .toggle-off {
148 -webkit-transition: all 0.1s ease-out;
149 transition: all 0.1s ease-out;
150 color: white;
151 text-shadow: 1px 1px rgba(0, 0, 0, 0.1);
152 font-size: 11px;
153 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
154 }
155 .toggle-modern .toggle-select .toggle-off,
156 .toggle-modern .toggle-select .toggle-on {
157 background: none;
158 }
159 .toggle-modern .toggle-off,
160 .toggle-modern .toggle-off.active {
161 background: -webkit-linear-gradient(#737e8d, #3f454e);
162 background: linear-gradient(#737e8d, #3f454e);
163 }
164 .toggle-modern .toggle-on,
165 .toggle-modern .toggle-on.active {
166 background: -webkit-linear-gradient(#4894cd, #2852a6);
167 background: linear-gradient(#4894cd, #2852a6);
168 }
169 .toggle-modern .toggle-blob {
170 background: -webkit-linear-gradient(#c0c6c9, #81898f);
171 background: linear-gradient(#c0c6c9, #81898f);
172 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 1px 1px 2px rgba(0, 0, 0, 0.2);
173 border-radius: 3px;
174 }
175 .toggle-modern .toggle-blob:hover {
176 background-image: -webkit-linear-gradient(#a1a9af, #a1a9af);
177 background-image: linear-gradient(#a1a9af, #a1a9af);
178 }
179 .toggle-soft .toggle-slide {
180 border-radius: 5px;
181 box-shadow: 0 0 0 1px #999;
182 }
183 .toggle-soft .toggle-on,
184 .toggle-soft .toggle-off {
185 color: rgba(0, 0, 0, 0.7);
186 font-size: 11px;
187 text-shadow: 1px 1px white;
188 }
189 .toggle-soft .toggle-on,
190 .toggle-soft .toggle-select .toggle-inner .active {
191 background: -webkit-linear-gradient(#d2ff52, #91e842);
192 background: linear-gradient(#d2ff52, #91e842);
193 }
194 .toggle-soft .toggle-off,
195 .toggle-soft .toggle-select .toggle-on {
196 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
197 background: linear-gradient(#cfcfcf, #f5f5f5);
198 }
199 .toggle-soft .toggle-blob {
200 border-radius: 4px;
201 background: -webkit-linear-gradient(#cfcfcf, #f5f5f5);
202 background: linear-gradient(#cfcfcf, #f5f5f5);
203 box-shadow: inset 0 0 0 1px #bbb, inset 0 0 0 2px white;
204 }
205 .toggle-soft .toggle-blob:hover {
206 background: -webkit-linear-gradient(#e4e4e4, #f9f9f9);
207 background: linear-gradient(#e4e4e4, #f9f9f9);
208 box-shadow: inset 0 0 0 1px #ddd,inset 0 0 0 2px #ddd;
209 }
1 .toggle-slide {
2 overflow: hidden;
3 cursor: pointer;
4 -webkit-user-select: none;
5 -moz-user-select: none;
6 -ms-user-select: none;
7 user-select: none;
8 direction: ltr;
9 text-align: center;
10 }
11 div.disabled > .toggle-slide {
12 opacity: 0.7;
13 pointer-events: none;
14 }
15 .toggle-slide .toggle-on,
16 .toggle-slide .toggle-off,
17 .toggle-slide .toggle-blob {
18 float: left;
19 }
20 .toggle-slide .toggle-blob {
21 position: relative;
22 z-index: 99;
23 cursor: hand;
24 cursor: grab;
25 }
1 .toggle-slide{overflow:hidden;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr;text-align:center}div.disabled>.toggle-slide{opacity:.7;pointer-events:none}.toggle-slide .toggle-blob,.toggle-slide .toggle-off,.toggle-slide .toggle-on{float:left}.toggle-slide .toggle-blob{position:relative;z-index:99;cursor:hand;cursor:grab}
1 var Toggles = root['Toggles'] = function(el, opts) {
2 var self = this;
3
4 if (typeof opts === 'boolean' && el.data('toggles')) {
5 el.data('toggles').toggle(opts);
6 return;
7 }
8
9 var dataAttr = [
10 'on',
11 'drag',
12 'click',
13 'width',
14 'height',
15 'animate',
16 'easing',
17 'type',
18 'checkbox'
19 ];
20 var dataOpts = {};
21 for (var i = 0; i < dataAttr.length; i++) {
22 var opt = el.data('toggle-' + dataAttr[i]);
23 if (typeof opt !== 'undefined') dataOpts[dataAttr[i]] = opt;
24 }
25
26 // extend default opts with the users options
27 opts = $.extend({
28 // can the toggle be dragged
29 'drag': true,
30 // can it be clicked to toggle
31 'click': true,
32 'text': {
33 // text for the ON/OFF position
34 'on': 'ON',
35 'off': 'OFF'
36 },
37 // is the toggle ON on init
38 'on': false,
39 // animation time (ms)
40 'animate': 250,
41 // animation transition easing function,
42 'easing': 'swing',
43 // the checkbox to toggle (for use in forms)
44 'checkbox': null,
45 // element that can be clicked on to toggle. removes binding from the toggle itself (use nesting)
46 'clicker': null,
47 // width (falls back to 50px)
48 'width': 0,
49 // height (falls back to 20px)
50 'height': 0,
51 // defaults to a compact toggle, other option is 'select' where both options are shown at once
52 'type': 'compact',
53 // the event name to fire when we toggle
54 'event': 'toggle'
55 }, opts || {}, dataOpts);
56
57 el.data('toggles', self);
58
59 // set active to the opposite of what we want, so toggle will run properly
60 var active = !opts['on'];
61
62 var selectType = opts['type'] === 'select';
63
64 // make checkbox a jquery element
65 var checkbox = $(opts['checkbox']);
66
67 var clicker = opts['clicker'] && $(opts['clicker']);
68
69 var height = opts['height'] || el.height() || 20;
70 var width = opts['width'] || el.width() || 50;
71
72 el.height(height);
73 el.width(width);
74
75 var div = function(name) {
76 return $('<div class="toggle-' + name + '">');
77 };
78
79 // wrapper inside toggle
80 var elSlide = div('slide');
81 // inside slide, this bit moves
82 var elInner = div('inner');
83 // the on/off divs
84 var elOn = div('on');
85 var elOff = div('off');
86 // the grip to drag the toggle
87 var elBlob = div('blob');
88
89 var halfHeight = height / 2;
90 var onOffWidth = width - halfHeight;
91
92 var text = opts['text'];
93
94 // set up the CSS for the individual elements
95 elOn
96 .css({
97 height: height,
98 width: onOffWidth,
99 textIndent: selectType ? '' : -height / 3,
100 lineHeight: height + 'px'
101 })
102 .html(text['on']);
103
104 elOff
105 .css({
106 height: height,
107 width: onOffWidth,
108 marginLeft: selectType ? '' : -halfHeight,
109 textIndent: selectType ? '' : height / 3,
110 lineHeight: height + 'px'
111 })
112 .html(text['off']);
113
114 elBlob.css({
115 height: height,
116 width: height,
117 marginLeft: -halfHeight
118 });
119
120 elInner.css({
121 width: width * 2 - height,
122 marginLeft: selectType ? 0 : -width + height
123 });
124
125 if (selectType) {
126 elSlide.addClass('toggle-select');
127 el.css('width', onOffWidth * 2);
128 elBlob.hide();
129 }
130
131 // construct the toggle
132 elInner.append(elOn, elBlob, elOff);
133 elSlide.html(elInner);
134 el.html(elSlide);
135
136 var doToggle = self.toggle = function(state, noAnimate, noEvent) {
137 // check we arent already in the desired state
138 if (active === state) return;
139
140 active = self['active'] = !active;
141
142 el.data('toggle-active', active);
143
144 elOff.toggleClass('active', !active);
145 elOn.toggleClass('active', active);
146 checkbox.prop('checked', active);
147
148 if (!noEvent) el.trigger(opts['event'], active);
149
150 if (selectType) return;
151
152 var margin = active ? 0 : -width + height;
153
154 // move the toggle!
155 elInner.stop().animate({
156 'marginLeft': margin
157 }, noAnimate ? 0 : opts['animate'], opts['easing']);
158 };
159
160
161 // evt handler for click events
162 var clickHandler = function(e) {
163 // if the target isn't the blob or dragging is disabled, toggle!
164 if (!el.hasClass('disabled') && (e['target'] !== elBlob[0] || !opts['drag'])) {
165 doToggle();
166 }
167 };
168
169 // if click is enabled and toggle isn't within the clicker element (stops double binding)
170 if (opts['click'] && (!clicker || !clicker.has(el).length)) {
171 el.on('click', clickHandler);
172 }
173
174 // setup the clicker element
175 if (clicker) {
176 clicker.on('click', clickHandler);
177 }
178
179 // bind up dragging stuff
180 if (opts['drag'] && !selectType) {
181 // time to begin the dragging parts/blob clicks
182 var diff;
183 var slideLimit = (width - height) / 4;
184
185 // fired on mouseup and mouseleave events
186 var upLeave = function(e) {
187 el.off('mousemove');
188 elSlide.off('mouseleave');
189 elBlob.off('mouseup');
190
191 if (!diff && opts['click'] && e.type !== 'mouseleave') {
192 doToggle();
193 return;
194 }
195
196 var overBound = active ? diff < -slideLimit : diff > slideLimit;
197 if (overBound) {
198 // dragged far enough, toggle
199 doToggle();
200 } else {
201 // reset to previous state
202 elInner.stop().animate({
203 marginLeft: active ? 0 : -width + height
204 }, opts['animate'] / 2, opts['easing']);
205 }
206 };
207
208 var wh = -width + height;
209
210 elBlob.on('mousedown', function(e) {
211
212 if (el.hasClass('disabled')) return;
213
214 // reset diff
215 diff = 0;
216
217 elBlob.off('mouseup');
218 elSlide.off('mouseleave');
219 var cursor = e.pageX;
220
221 el.on('mousemove', elBlob, function(e) {
222 diff = e.pageX - cursor;
223 var marginLeft;
224
225 if (active) {
226 marginLeft = diff;
227
228 // keep it within the limits
229 if (diff > 0) marginLeft = 0;
230 if (diff < wh) marginLeft = wh;
231 } else {
232 marginLeft = diff + wh;
233
234 if (diff < 0) marginLeft = wh;
235 if (diff > -wh) marginLeft = 0;
236 }
237
238 elInner.css('margin-left', marginLeft);
239 });
240
241 elBlob.on('mouseup', upLeave);
242 elSlide.on('mouseleave', upLeave);
243 });
244 }
245
246 // toggle the toggle to the correct state with no animation and no event
247 doToggle(opts['on'], true, true);
248 };
1 /**
2 @license jQuery Toggles v4.0.0
3 Copyright 2012 - 2015 Simon Tabor - MIT License
4 https://github.com/simontabor/jquery-toggles / http://simontabor.com/labs/toggles
5 */
6 (function(root) {
7
8 var factory = function($) {
9
10 <<Toggles>>
11
12 $.fn['toggles'] = function(opts) {
13 return this.each(function() {
14 new Toggles($(this), opts);
15 });
16 };
17 };
18
19 if (typeof define === 'function' && define['amd']) {
20 define(['jquery'], factory);
21 } else {
22 factory(root['jQuery'] || root['Zepto'] || root['ender'] || root['$'] || $);
23 }
24
25 })(this);
1 .toggle-dark {
2 .toggle-slide {
3 border-radius: 5px;
4 box-shadow: 0 0 0 1px #242529, 0 1px 0 1px #666;
5 }
6
7 .toggle-on, .toggle-off, .toggle-blob {
8 color: rgba(255, 255, 255, 0.7);
9 font-size: 11px;
10 }
11
12 .toggle-on, .toggle-select .toggle-inner .active {
13 background: linear-gradient(#1A70BE, #31A2E1);
14 }
15
16 .toggle-off, .toggle-select .toggle-on {
17 background: linear-gradient(#242529, #34363B);
18 }
19
20 .toggle-blob {
21 border-radius: 4px;
22 background: linear-gradient(#CFCFCF, whiteSmoke);
23 box-shadow: inset 0 0 0 1px #888, inset 0 0 0 2px white;
24
25 &:hover {
26 background: linear-gradient(#c0c0c0, #dadada);
27 box-shadow: inset 0 0 0 1px #888,inset 0 0 0 2px #ddd;
28 }
29 }
30 }
1 .toggle-iphone {
2 .toggle-slide {
3 border-radius: 9999px;
4 box-shadow: 0 0 0 1px #999;
5 }
6
7 .toggle-on, .toggle-off {
8 color: white;
9 font-size: 18px;
10 font-weight: bold;
11 text-shadow: 0 0 8px rgba(0,0,0,0.5);
12 }
13
14 .toggle-on {
15 border-radius: 9999px 0 0 9999px;
16 background: #037bda;
17 box-shadow: inset 2px 2px 5px rgba(0,0,0,0.4);
18
19 &:after {
20 background: linear-gradient(#1189f1, #3797ef);
21 height: 50%;
22 content: '';
23 margin-top: -19%;
24 display: block;
25 border-radius: 9999px;
26 margin-left: 10%;
27 }
28 }
29
30 .toggle-off {
31 box-shadow: inset -2px 2px 5px rgba(0,0,0,0.4);
32 border-radius: 0 9999px 9999px 0;
33 color: rgb(130,130,130);
34 background: #ECECEC;
35 text-shadow: 0 0 1px white;
36
37 &:after {
38 background: linear-gradient(#fafafa, #fdfdfd);
39 height: 50%;
40 content: '';
41 margin-top: -19%;
42 display: block;
43 margin-right: 10%;
44 border-radius: 9999px;
45 }
46 }
47
48 .toggle-blob {
49 border-radius: 50px;
50 background: linear-gradient(#d1d1d1, #fafafa);
51 box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), inset 0 0 0 2px white, 0 0 3px rgba(0,0,0,0.6);
52 }
53 }
1 .toggle-light {
2 .toggle-slide {
3 border-radius: 9999px;
4 box-shadow: 0 0 0 1px #999;
5 }
6
7 .toggle-on, .toggle-off {
8 font-size: 11px;
9 font-weight: 500;
10 }
11
12 .toggle-on, .toggle-select .toggle-inner .active {
13 background: rgb(69,163,31);
14 box-shadow: inset 2px 2px 6px rgba(0,0,0,0.2);
15 text-shadow: 1px 1px rgba(0,0,0,0.2);
16 color: rgba(255,255,255, 0.8);
17 }
18
19 .toggle-off, .toggle-select .toggle-on {
20 color: rgba(0,0,0,0.6);
21 text-shadow: 0 1px rgba(255,255,255,0.2);
22 background: linear-gradient(#cfcfcf ,#f5f5f5);
23 }
24
25 .toggle-blob {
26 border-radius: 50px;
27 background: linear-gradient(#f5f5f5, #cfcfcf);
28 box-shadow: 1px 1px 2px #888;
29 &:hover {
30 background: linear-gradient(#e4e4e4, #f9f9f9);
31 }
32 }
33 }
1 .toggle-modern {
2 .toggle-slide {
3 border-radius: 4px;
4 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.2);
5 background: linear-gradient(#c0c5c9, #a1a9af);
6 box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255, 255, 255, 0.15);
7 }
8
9 .toggle-on, .toggle-off {
10 transition: all 0.1s ease-out;
11 color: white;
12 text-shadow: 1px 1px rgba(0, 0, 0, 0.1);
13 font-size: 11px;
14 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
15 }
16
17 .toggle-select {
18 .toggle-off, .toggle-on {
19 background: none;
20 }
21 }
22
23 .toggle-off, .toggle-off.active {
24 background: linear-gradient(#737e8d, #3f454e);
25 }
26
27 .toggle-on, .toggle-on.active {
28 background: linear-gradient(#4894cd, #2852a6);
29 }
30
31 .toggle-blob {
32 background: linear-gradient(#c0c6c9, #81898f);
33 box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(0, 0, 0, 0.1), 1px 1px 2px rgba(0,0,0,0.2);
34 border-radius: 3px;
35
36 &:hover {
37 background-image: linear-gradient(#a1a9af, #a1a9af);
38 }
39 }
40 }
1 .toggle-soft {
2 .toggle-slide {
3 border-radius: 5px;
4 box-shadow: 0 0 0 1px #999;
5 }
6
7 .toggle-on, .toggle-off {
8 color: rgba(0, 0, 0, 0.7);
9 font-size: 11px;
10 text-shadow: 1px 1px white;
11 }
12
13 .toggle-on, .toggle-select .toggle-inner .active {
14 background: linear-gradient(#d2ff52, #91e842);
15 }
16
17 .toggle-off, .toggle-select .toggle-on {
18 background: linear-gradient(#cfcfcf, #f5f5f5);
19 }
20
21 .toggle-blob {
22 border-radius: 4px;
23 background: linear-gradient(#cfcfcf, #f5f5f5);
24 box-shadow: inset 0 0 0 1px #bbb, inset 0 0 0 2px white;
25
26 &:hover {
27 background: linear-gradient(#e4e4e4, #f9f9f9);
28 box-shadow: inset 0 0 0 1px #ddd,inset 0 0 0 2px #ddd;
29 }
30 }
31 }
1 .toggle-slide {
2 overflow: hidden;
3 cursor: pointer;
4 user-select: none;
5 direction: ltr;
6 text-align: center;
7
8 div.disabled > & {
9 opacity: 0.7;
10 pointer-events: none;
11 }
12
13 .toggle-on, .toggle-off, .toggle-blob {
14 float: left;
15 }
16
17 .toggle-blob {
18 position: relative;
19 z-index: 99;
20 cursor: hand;
21 cursor: grab;
22 }
23 }
1 {
2 "name": "jquery-toggles",
3 "version": "4.0.0",
4 "description": "Toggles is a lightweight jQuery plugin that creates easily-styleable toggle buttons.",
5 "main": "toggles.min.js",
6 "author": "Simon Tabor <me@simontabor.com> (http://simontabor.com/)",
7 "homepage": "http://simontabor.com/labs/toggles/",
8 "license": "MIT",
9 "repository": {
10 "type": "git",
11 "url": "https://github.com/simontabor/jquery-toggles.git"
12 },
13 "keywords": [
14 "toggles",
15 "checkbox",
16 "jquery-plugin",
17 "ecosystem:jquery"
18 ],
19 "bugs": {
20 "url": "https://github.com/simontabor/jquery-toggles/issues"
21 },
22 "scripts": {
23 "test": "echo \"Error: no test specified\" && exit 1"
24 },
25 "dependencies": {},
26 "devDependencies": {
27 "autoprefixer": "^6.0.3",
28 "js-beautify": "^1.5.10",
29 "less": "^2.5.3",
30 "postcss-cli": "^2.3.2"
31 }
32 }
1 /**
2 @license jQuery Toggles v4.0.0
3 Copyright 2012 - 2015 Simon Tabor - MIT License
4 https://github.com/simontabor/jquery-toggles / http://simontabor.com/labs/toggles
5 */
6 (function(root) {
7
8 var factory = function($) {
9
10 var Toggles = root['Toggles'] = function(el, opts) {
11 var self = this;
12
13 if (typeof opts === 'boolean' && el.data('toggles')) {
14 el.data('toggles').toggle(opts);
15 return;
16 }
17
18 var dataAttr = [
19 'on',
20 'drag',
21 'click',
22 'width',
23 'height',
24 'animate',
25 'easing',
26 'type',
27 'checkbox'
28 ];
29 var dataOpts = {};
30 for (var i = 0; i < dataAttr.length; i++) {
31 var opt = el.data('toggle-' + dataAttr[i]);
32 if (typeof opt !== 'undefined') dataOpts[dataAttr[i]] = opt;
33 }
34
35 // extend default opts with the users options
36 opts = $.extend({
37 // can the toggle be dragged
38 'drag': true,
39 // can it be clicked to toggle
40 'click': true,
41 'text': {
42 // text for the ON/OFF position
43 'on': 'ON',
44 'off': 'OFF'
45 },
46 // is the toggle ON on init
47 'on': false,
48 // animation time (ms)
49 'animate': 250,
50 // animation transition easing function,
51 'easing': 'swing',
52 // the checkbox to toggle (for use in forms)
53 'checkbox': null,
54 // element that can be clicked on to toggle. removes binding from the toggle itself (use nesting)
55 'clicker': null,
56 // width (falls back to 50px)
57 'width': 0,
58 // height (falls back to 20px)
59 'height': 0,
60 // defaults to a compact toggle, other option is 'select' where both options are shown at once
61 'type': 'compact',
62 // the event name to fire when we toggle
63 'event': 'toggle'
64 }, opts || {}, dataOpts);
65
66 el.data('toggles', self);
67
68 // set active to the opposite of what we want, so toggle will run properly
69 var active = !opts['on'];
70
71 var selectType = opts['type'] === 'select';
72
73 // make checkbox a jquery element
74 var checkbox = $(opts['checkbox']);
75
76 var clicker = opts['clicker'] && $(opts['clicker']);
77
78 var height = opts['height'] || el.height() || 20;
79 var width = opts['width'] || el.width() || 50;
80
81 el.height(height);
82 el.width(width);
83
84 var div = function(name) {
85 return $('<div class="toggle-' + name + '">');
86 };
87
88 // wrapper inside toggle
89 var elSlide = div('slide');
90 // inside slide, this bit moves
91 var elInner = div('inner');
92 // the on/off divs
93 var elOn = div('on');
94 var elOff = div('off');
95 // the grip to drag the toggle
96 var elBlob = div('blob');
97
98 var halfHeight = height / 2;
99 var onOffWidth = width - halfHeight;
100
101 var text = opts['text'];
102
103 // set up the CSS for the individual elements
104 elOn
105 .css({
106 height: height,
107 width: onOffWidth,
108 textIndent: selectType ? '' : -height / 3,
109 lineHeight: height + 'px'
110 })
111 .html(text['on']);
112
113 elOff
114 .css({
115 height: height,
116 width: onOffWidth,
117 marginLeft: selectType ? '' : -halfHeight,
118 textIndent: selectType ? '' : height / 3,
119 lineHeight: height + 'px'
120 })
121 .html(text['off']);
122
123 elBlob.css({
124 height: height,
125 width: height,
126 marginLeft: -halfHeight
127 });
128
129 elInner.css({
130 width: width * 2 - height,
131 marginLeft: selectType ? 0 : -width + height
132 });
133
134 if (selectType) {
135 elSlide.addClass('toggle-select');
136 el.css('width', onOffWidth * 2);
137 elBlob.hide();
138 }
139
140 // construct the toggle
141 elInner.append(elOn, elBlob, elOff);
142 elSlide.html(elInner);
143 el.html(elSlide);
144
145 var doToggle = self.toggle = function(state, noAnimate, noEvent) {
146 // check we arent already in the desired state
147 if (active === state) return;
148
149 active = self['active'] = !active;
150
151 el.data('toggle-active', active);
152
153 elOff.toggleClass('active', !active);
154 elOn.toggleClass('active', active);
155 checkbox.prop('checked', active);
156
157 if (!noEvent) el.trigger(opts['event'], active);
158
159 if (selectType) return;
160
161 var margin = active ? 0 : -width + height;
162
163 // move the toggle!
164 elInner.stop().animate({
165 'marginLeft': margin
166 }, noAnimate ? 0 : opts['animate'], opts['easing']);
167 };
168
169
170 // evt handler for click events
171 var clickHandler = function(e) {
172 // if the target isn't the blob or dragging is disabled, toggle!
173 if (!el.hasClass('disabled') && (e['target'] !== elBlob[0] || !opts['drag'])) {
174 doToggle();
175 }
176 };
177
178 // if click is enabled and toggle isn't within the clicker element (stops double binding)
179 if (opts['click'] && (!clicker || !clicker.has(el).length)) {
180 el.on('click', clickHandler);
181 }
182
183 // setup the clicker element
184 if (clicker) {
185 clicker.on('click', clickHandler);
186 }
187
188 // bind up dragging stuff
189 if (opts['drag'] && !selectType) {
190 // time to begin the dragging parts/blob clicks
191 var diff;
192 var slideLimit = (width - height) / 4;
193
194 // fired on mouseup and mouseleave events
195 var upLeave = function(e) {
196 el.off('mousemove');
197 elSlide.off('mouseleave');
198 elBlob.off('mouseup');
199
200 if (!diff && opts['click'] && e.type !== 'mouseleave') {
201 doToggle();
202 return;
203 }
204
205 var overBound = active ? diff < -slideLimit : diff > slideLimit;
206 if (overBound) {
207 // dragged far enough, toggle
208 doToggle();
209 } else {
210 // reset to previous state
211 elInner.stop().animate({
212 marginLeft: active ? 0 : -width + height
213 }, opts['animate'] / 2, opts['easing']);
214 }
215 };
216
217 var wh = -width + height;
218
219 elBlob.on('mousedown', function(e) {
220
221 if (el.hasClass('disabled')) return;
222
223 // reset diff
224 diff = 0;
225
226 elBlob.off('mouseup');
227 elSlide.off('mouseleave');
228 var cursor = e.pageX;
229
230 el.on('mousemove', elBlob, function(e) {
231 diff = e.pageX - cursor;
232 var marginLeft;
233
234 if (active) {
235 marginLeft = diff;
236
237 // keep it within the limits
238 if (diff > 0) marginLeft = 0;
239 if (diff < wh) marginLeft = wh;
240 } else {
241 marginLeft = diff + wh;
242
243 if (diff < 0) marginLeft = wh;
244 if (diff > -wh) marginLeft = 0;
245 }
246
247 elInner.css('margin-left', marginLeft);
248 });
249
250 elBlob.on('mouseup', upLeave);
251 elSlide.on('mouseleave', upLeave);
252 });
253 }
254
255 // toggle the toggle to the correct state with no animation and no event
256 doToggle(opts['on'], true, true);
257 };
258
259 $.fn['toggles'] = function(opts) {
260 return this.each(function() {
261 new Toggles($(this), opts);
262 });
263 };
264 };
265
266 if (typeof define === 'function' && define['amd']) {
267 define(['jquery'], factory);
268 } else {
269 factory(root['jQuery'] || root['Zepto'] || root['ender'] || root['$'] || $);
270 }
271
272 })(this);
1 /*
2 jQuery Toggles v4.0.0
3 Copyright 2012 - 2015 Simon Tabor - MIT License
4 https://github.com/simontabor/jquery-toggles / http://simontabor.com/labs/toggles
5 */
6 (function(g){function p(q){var p=g.Toggles=function(c,a){var g=this;if("boolean"===typeof a&&c.data("toggles"))c.data("toggles").toggle(a);else{for(var k="on drag click width height animate easing type checkbox".split(" "),b={},l=0;l<k.length;l++){var t=c.data("toggle-"+k[l]);"undefined"!==typeof t&&(b[k[l]]=t)}a=q.extend({drag:!0,click:!0,text:{on:"ON",off:"OFF"},on:!1,animate:250,easing:"swing",checkbox:null,clicker:null,width:0,height:0,type:"compact",event:"toggle"},a||{},b);c.data("toggles",
7 g);var f=!a.on,n="select"===a.type,p=q(a.checkbox),k=a.clicker&&q(a.clicker),d=a.height||c.height()||20,m=a.width||c.width()||50;c.height(d);c.width(m);var b=function(a){return q('<div class="toggle-'+a+'">')},r=b("slide"),s=b("inner"),w=b("on"),x=b("off"),h=b("blob"),b=d/2,l=m-b,t=a.text;w.css({height:d,width:l,textIndent:n?"":-d/3,lineHeight:d+"px"}).html(t.on);x.css({height:d,width:l,marginLeft:n?"":-b,textIndent:n?"":d/3,lineHeight:d+"px"}).html(t.off);h.css({height:d,width:d,marginLeft:-b});
8 s.css({width:2*m-d,marginLeft:n?0:-m+d});n&&(r.addClass("toggle-select"),c.css("width",2*l),h.hide());s.append(w,h,x);r.html(s);c.html(r);var v=g.toggle=function(b,e,A){f!==b&&(f=g.active=!f,c.data("toggle-active",f),x.toggleClass("active",!f),w.toggleClass("active",f),p.prop("checked",f),A||c.trigger(a.event,f),n||(b=f?0:-m+d,s.stop().animate({marginLeft:b},e?0:a.animate,a.easing)))},b=function(b){c.hasClass("disabled")||b.target===h[0]&&a.drag||v()};if(a.click&&(!k||!k.has(c).length))c.on("click",
9 b);if(k)k.on("click",b);if(a.drag&&!n){var e,y=(m-d)/4,z=function(b){c.off("mousemove");r.off("mouseleave");h.off("mouseup");!e&&a.click&&"mouseleave"!==b.type?v():(f?e<-y:e>y)?v():s.stop().animate({marginLeft:f?0:-m+d},a.animate/2,a.easing)},u=-m+d;h.on("mousedown",function(a){if(!c.hasClass("disabled")){e=0;h.off("mouseup");r.off("mouseleave");var b=a.pageX;c.on("mousemove",h,function(a){e=a.pageX-b;f?(a=e,0<e&&(a=0),e<u&&(a=u)):(a=e+u,0>e&&(a=u),e>-u&&(a=0));s.css("margin-left",a)});h.on("mouseup",
10 z);r.on("mouseleave",z)}})}v(a.on,!0,!0)}};q.fn.toggles=function(c){return this.each(function(){new p(q(this),c)})}}"function"===typeof define&&define.amd?define(["jquery"],p):p(g.jQuery||g.Zepto||g.ender||g.$||$)})(this);
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
3 (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.