1!function ($) { 2 3 /* CHECKBOX PUBLIC CLASS DEFINITION 4 * ============================== */ 5 6 var Checkbox = function (element, options) { 7 this.init(element, options); 8 } 9 10 Checkbox.prototype = { 11 12 constructor: Checkbox 13 14 , init: function (element, options) { 15 var $el = this.$element = $(element) 16 17 this.options = $.extend({}, $.fn.checkbox.defaults, options); 18 $el.before(this.options.template); 19 this.setState(); 20 } 21 22 , setState: function () { 23 var $el = this.$element 24 , $parent = $el.closest('.checkbox'); 25 26 $el.prop('disabled') && $parent.addClass('disabled'); 27 $el.prop('checked') && $parent.addClass('checked'); 28 } 29 30 , toggle: function () { 31 var ch = 'checked' 32 , $el = this.$element 33 , $parent = $el.closest('.checkbox') 34 , checked = $el.prop(ch) 35 , e = $.Event('toggle') 36 37 if ($el.prop('disabled') == false) { 38 $parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch); 39 $el.trigger(e).trigger('change'); 40 } 41 } 42 43 , setCheck: function (option) { 44 var d = 'disabled' 45 , ch = 'checked' 46 , $el = this.$element 47 , $parent = $el.closest('.checkbox') 48 , checkAction = option == 'check' ? true : false 49 , e = $.Event(option) 50 51 $parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch); 52 $el.trigger(e).trigger('change'); 53 } 54 55 } 56 57 58 /* CHECKBOX PLUGIN DEFINITION 59 * ======================== */ 60 61 var old = $.fn.checkbox 62 63 $.fn.checkbox = function (option) { 64 return this.each(function () { 65 var $this = $(this) 66 , data = $this.data('checkbox') 67 , options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option); 68 if (!data) $this.data('checkbox', (data = new Checkbox(this, options))); 69 if (option == 'toggle') data.toggle() 70 if (option == 'check' || option == 'uncheck') data.setCheck(option) 71 else if (option) data.setState(); 72 }); 73 } 74 75 $.fn.checkbox.defaults = { 76 template: '<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span>' 77 } 78 79 80 /* CHECKBOX NO CONFLICT 81 * ================== */ 82 83 $.fn.checkbox.noConflict = function () { 84 $.fn.checkbox = old; 85 return this; 86 } 87 88 89 /* CHECKBOX DATA-API 90 * =============== */ 91 92 $(document).on('click.checkbox.data-api', '.checkbox', function (e) { 93 var $checkbox = $(e.target); 94 if (e.target.tagName != "A") { 95 e && e.preventDefault() && e.stopPropagation(); 96 if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox'); 97 $checkbox.find(':checkbox').checkbox('toggle'); 98 } 99 }); 100 101 $(function () { 102 $('[data-toggle="checkbox"]').each(function () { 103 if($(this).data('toggle') == 'switch') return; 104 105 var $checkbox = $(this); 106 $checkbox.checkbox(); 107 }); 108 }); 109 110}(window.jQuery); 111 112 113 114 115!function ($) { 116 117 /* RADIO PUBLIC CLASS DEFINITION 118 * ============================== */ 119 120 var Radio = function (element, options) { 121 this.init(element, options); 122 } 123 124 Radio.prototype = { 125 126 constructor: Radio 127 128 , init: function (element, options) { 129 var $el = this.$element = $(element) 130 131 this.options = $.extend({}, $.fn.radio.defaults, options); 132 $el.before(this.options.template); 133 this.setState(); 134 } 135 136 , setState: function () { 137 var $el = this.$element 138 , $parent = $el.closest('.radio'); 139 140 $el.prop('disabled') && $parent.addClass('disabled'); 141 $el.prop('checked') && $parent.addClass('checked'); 142 } 143 144 , toggle: function () { 145 var d = 'disabled' 146 , ch = 'checked' 147 , $el = this.$element 148 , checked = $el.prop(ch) 149 , $parent = $el.closest('.radio') 150 , $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body') 151 , $elemGroup = $parentWrap.find(':radio[name="' + $el.attr('name') + '"]') 152 , e = $.Event('toggle') 153 154 if ($el.prop(d) == false) { 155 $elemGroup.not($el).each(function () { 156 var $el = $(this) 157 , $parent = $(this).closest('.radio'); 158 159 if ($el.prop(d) == false) { 160 $parent.removeClass(ch) && $el.removeAttr(ch).trigger('change'); 161 } 162 }); 163 164 if (checked == false) $parent.addClass(ch) && $el.prop(ch, true); 165 $el.trigger(e); 166 167 if (checked !== $el.prop(ch)) { 168 $el.trigger('change'); 169 } 170 } 171 } 172 173 , setCheck: function (option) { 174 var ch = 'checked' 175 , $el = this.$element 176 , $parent = $el.closest('.radio') 177 , checkAction = option == 'check' ? true : false 178 , checked = $el.prop(ch) 179 , $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body') 180 , $elemGroup = $parentWrap.find(':radio[name="' + $el['attr']('name') + '"]') 181 , e = $.Event(option) 182 183 $elemGroup.not($el).each(function () { 184 var $el = $(this) 185 , $parent = $(this).closest('.radio'); 186 187 $parent.removeClass(ch) && $el.removeAttr(ch); 188 }); 189 190 $parent[checkAction ? 'addClass' : 'removeClass'](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch); 191 $el.trigger(e); 192 193 if (checked !== $el.prop(ch)) { 194 $el.trigger('change'); 195 } 196 } 197 198 } 199 200 201 /* RADIO PLUGIN DEFINITION 202 * ======================== */ 203 204 var old = $.fn.radio 205 206 $.fn.radio = function (option) { 207 return this.each(function () { 208 var $this = $(this) 209 , data = $this.data('radio') 210 , options = $.extend({}, $.fn.radio.defaults, $this.data(), typeof option == 'object' && option); 211 if (!data) $this.data('radio', (data = new Radio(this, options))); 212 if (option == 'toggle') data.toggle() 213 if (option == 'check' || option == 'uncheck') data.setCheck(option) 214 else if (option) data.setState(); 215 }); 216 } 217 218 $.fn.radio.defaults = { 219 template: '<span class="icons"><span class="first-icon fa fa-circle-o"></span><span class="second-icon fa fa-dot-circle-o"></span></span>' 220 } 221 222 223 /* RADIO NO CONFLICT 224 * ================== */ 225 226 $.fn.radio.noConflict = function () { 227 $.fn.radio = old; 228 return this; 229 } 230 231 232 /* RADIO DATA-API 233 * =============== */ 234 235 $(document).on('click.radio.data-api', '.radio', function (e) { 236 var $radio = $(e.target); 237 e && e.preventDefault() && e.stopPropagation(); 238 if (!$radio.hasClass('radio')) $radio = $radio.closest('.radio'); 239 $radio.find(':radio').radio('toggle'); 240 }); 241 242 $(function () { 243 $('[data-toggle="radio"]').each(function () { 244 var $radio = $(this); 245 $radio.radio(); 246 }); 247 }); 248 249}(window.jQuery); 250 251 252 253/* ============================================================ 254 * bootstrapSwitch v1.3 by Larentis Mattia @spiritualGuru 255 * http://www.larentis.eu/switch/ 256 * ============================================================ 257 * Licensed under the Apache License, Version 2.0 258 * http://www.apache.org/licenses/LICENSE-2.0 259 * ============================================================ */ 260 261!function ($) { 262 "use strict"; 263 264 $.fn['bootstrapSwitch'] = function (method) { 265 var methods = { 266 init: function () { 267 return this.each(function () { 268 var $element = $(this) 269 , $div 270 , $switchLeft 271 , $switchRight 272 , $label 273 , myClasses = "" 274 , classes = $element.attr('class') 275 , color 276 , moving 277 , onLabel = "ON" 278 , offLabel = "OFF" 279 , icon = false;
280 281 $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) { 282 if (classes.indexOf(el) >= 0) 283 myClasses = el; 284 }); 285 286 $element.addClass('has-switch'); 287 288 if ($element.data('on') !== undefined) 289 color = "switch-" + $element.data('on'); 290 291 if ($element.data('on-label') !== undefined) 292 onLabel = $element.data('on-label'); 293 294 if ($element.data('off-label') !== undefined) 295 offLabel = $element.data('off-label'); 296 297 if ($element.data('icon') !== undefined) 298 icon = $element.data('icon'); 299 300 $switchLeft = $('<span>') 301 .addClass("switch-left") 302 .addClass(myClasses) 303 .addClass(color) 304 .html(onLabel); 305 306 color = ''; 307 if ($element.data('off') !== undefined) 308 color = "switch-" + $element.data('off'); 309 310 $switchRight = $('<span>') 311 .addClass("switch-right") 312 .addClass(myClasses) 313 .addClass(color) 314 .html(offLabel); 315 316 $label = $('<label>') 317 .html(" ") 318 .addClass(myClasses) 319 .attr('for', $element.find('input').attr('id')); 320 321 if (icon) { 322 $label.html('<i class="' + icon + '"></i>'); 323 } 324 325 $div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false); 326 327 if ($element.data('animated') !== false) 328 $div.addClass('switch-animate').data('animated', true); 329 330 $div 331 .append($switchLeft) 332 .append($label) 333 .append($switchRight); 334 335 $element.find('>div').addClass( 336 $element.find('input').is(':checked') ? 'switch-on' : 'switch-off' 337 ); 338 339 if ($element.find('input').is(':disabled')) 340 $(this).addClass('deactivate'); 341 342 var changeStatus = function ($this) { 343 $this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click'); 344 }; 345 346 $element.on('keydown', function (e) { 347 if (e.keyCode === 32) { 348 e.stopImmediatePropagation(); 349 e.preventDefault(); 350 changeStatus($(e.target).find('span:first')); 351 } 352 }); 353 354 $switchLeft.on('click', function (e) { 355 changeStatus($(this)); 356 }); 357 358 $switchRight.on('click', function (e) { 359 changeStatus($(this)); 360 }); 361 362 $element.find('input').on('change', function (e) { 363 var $this = $(this) 364 , $element = $this.parent() 365 , thisState = $this.is(':checked') 366 , state = $element.is('.switch-off'); 367 368 e.preventDefault(); 369 370 $element.css('left', ''); 371 372 if (state === thisState) { 373 374 if (thisState) 375 $element.removeClass('switch-off').addClass('switch-on'); 376 else $element.removeClass('switch-on').addClass('switch-off'); 377 378 if ($element.data('animated') !== false) 379 $element.addClass("switch-animate"); 380 381 $element.parent().trigger('switch-change', {'el': $this, 'value': thisState}) 382 } 383 }); 384 385 $element.find('label').on('mousedown touchstart', function (e) { 386 var $this = $(this); 387 moving = false; 388 389 e.preventDefault(); 390 e.stopImmediatePropagation(); 391 392 $this.closest('div').removeClass('switch-animate'); 393 394 if ($this.closest('.has-switch').is('.deactivate')) 395 $this.unbind('click'); 396 else { 397 $this.on('mousemove touchmove', function (e) { 398 var $element = $(this).closest('.switch') 399 , relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left 400 , percent = (relativeX / $element.width()) * 100 401 , left = 25 402 , right = 75; 403 404 moving = true; 405 406 if (percent < left) 407 percent = left; 408 else if (percent > right) 409 percent = right; 410 411 $element.find('>div').css('left', (percent - right) + "%") 412 }); 413 414 $this.on('click touchend', function (e) { 415 var $this = $(this) 416 , $target = $(e.target) 417 , $myCheckBox = $target.siblings('input'); 418 419 e.stopImmediatePropagation(); 420 e.preventDefault(); 421 422 $this.unbind('mouseleave'); 423 424 if (moving) 425 $myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)); 426 else $myCheckBox.prop("checked", !$myCheckBox.is(":checked")); 427 428 moving = false;
429 $myCheckBox.trigger('change'); 430 }); 431 432 $this.on('mouseleave', function (e) { 433 var $this = $(this) 434 , $myCheckBox = $this.siblings('input'); 435 436 e.preventDefault(); 437 e.stopImmediatePropagation(); 438 439 $this.unbind('mouseleave'); 440 $this.trigger('mouseup'); 441 442 $myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change'); 443 }); 444 445 $this.on('mouseup', function (e) { 446 e.stopImmediatePropagation(); 447 e.preventDefault(); 448 449 $(this).unbind('mousemove'); 450 }); 451 } 452 }); 453 } 454 ); 455 }, 456 toggleActivation: function () { 457 $(this).toggleClass('deactivate'); 458 }, 459 isActive: function () { 460 return !$(this).hasClass('deactivate'); 461 }, 462 setActive: function (active) { 463 if (active) 464 $(this).removeClass('deactivate'); 465 else $(this).addClass('deactivate'); 466 }, 467 toggleState: function (skipOnChange) { 468 var $input = $(this).find('input:checkbox'); 469 $input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange); 470 }, 471 setState: function (value, skipOnChange) { 472 $(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange); 473 }, 474 status: function () { 475 return $(this).find('input:checkbox').is(':checked'); 476 }, 477 destroy: function () { 478 var $div = $(this).find('div') 479 , $checkbox; 480 481 $div.find(':not(input:checkbox)').remove(); 482 483 $checkbox = $div.children(); 484 $checkbox.unwrap().unwrap(); 485 486 $checkbox.unbind('change'); 487 488 return $checkbox; 489 } 490 }; 491 492 if (methods[method]) 493 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 494 else if (typeof method === 'object' || !method) 495 return methods.init.apply(this, arguments); 496 else 497 $.error('Method ' + method + ' does not exist!'); 498 }; 499 500 $(function () { 501 $('.switch').each(function () { 502 $(this).bootstrapSwitch(); 503 }); 504 505 $('[data-toggle="switch"]').each(function (){ 506 $(this).wrap('<div class="switch" />').parent().bootstrapSwitch(); 507 }); 508 }); 509 510 511}(jQuery); 512 513 514 515/* 516 517 jQuery Tags Input Plugin 1.3.3 518 519 Copyright (c) 2011 XOXCO, Inc 520 521 Documentation for this plugin lives here: 522 http://xoxco.com/clickable/jquery-tags-input 523 524 Licensed under the MIT license: 525 http://www.opensource.org/licenses/mit-license.php 526 527 [email protected] 528 529*/ 530 531(function($) { 532 533 var delimiter = new Array(); 534 var tags_callbacks = new Array(); 535 $.fn.doAutosize = function(o){ 536 var minWidth = $(this).data('minwidth'), 537 maxWidth = $(this).data('maxwidth'), 538 val = '', 539 input = $(this), 540 testSubject = $('#'+$(this).data('tester_id')); 541 542 if (val === (val = input.val())) {return;} 543 544 // Enter new content into testSubject 545 var escaped = val.replace(/&/g, '&').replace(/\s/g,' ').replace(/</g, '<').replace(/>/g, '>'); 546 testSubject.html(escaped); 547 // Calculate new width + whether to change 548 var testerWidth = testSubject.width(), 549 newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth, 550 currentWidth = input.width(), 551 isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth) 552 || (newWidth > minWidth && newWidth < maxWidth); 553 554 // Animate width 555 if (isValidWidthChange) { 556 input.width(newWidth); 557 } 558 559 560 }; 561 $.fn.resetAutosize = function(options){ 562 // alert(JSON.stringify(options)); 563 var minWidth = $(this).data('minwidth') || options.minInputWidth || $(this).width(), 564 maxWidth = $(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width() - options.inputPadding), 565 val = '', 566 input = $(this), 567 testSubject = $('<tester/>').css({ 568 position: 'absolute', 569 top: -9999, 570 left: -9999, 571 width: 'auto', 572 fontSize: input.css('fontSize'), 573 fontFamily: input.css('fontFamily'), 574 fontWeight: input.css('fontWeight'), 575 letterSpacing: input.css('letterSpacing'), 576 whiteSpace: 'nowrap' 577 }), 578 testerId = $(this).attr('id')+'_autosize_tester'; 579 if(! $('#'+testerId).length > 0){ 580 testSubject.attr('id', testerId); 581 testSubject.appendTo('body'); 582 } 583 584 input.data('minwidth', minWidth); 585 input.data('maxwidth', maxWidth); 586 input.data('tester_id', testerId); 587 input.css('width', minWidth); 588 }; 589 590 $.fn.addTag = function(value,options) { 591 options = jQuery.extend({focus:false,callback:true},options); 592 this.each(function() { 593 var id = $(this).attr('id'); 594 595 var tagslist = $(this).val().split(delimiter[id]); 596 if (tagslist[0] == '') { 597 tagslist = new Array(); 598 } 599 600 value = jQuery.trim(value); 601 602 if (options.unique) { 603 var skipTag = $(this).tagExist(value); 604 if(skipTag == true) { 605 //Marks fake input as not_valid to let styling it
606 $('#'+id+'_tag').addClass('not_valid'); 607 } 608 } else { 609 var skipTag = false; 610 } 611 612 if (value !='' && skipTag != true) { 613 $('<span>').addClass('tag').append( 614 $('<span>').text(value).append(' '), 615 $('<a class="tagsinput-remove-link">', { 616 href : '#', 617 title : 'Remove tag', 618 text : '' 619 }).click(function () { 620 return $('#' + id).removeTag(escape(value)); 621 }) 622 ).insertBefore('#' + id + '_addTag'); 623 624 tagslist.push(value); 625 626 $('#'+id+'_tag').val(''); 627 if (options.focus) { 628 $('#'+id+'_tag').focus(); 629 } else { 630 $('#'+id+'_tag').blur(); 631 } 632 633 $.fn.tagsInput.updateTagsField(this,tagslist); 634 635 if (options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag']) { 636 var f = tags_callbacks[id]['onAddTag']; 637 f.call(this, value); 638 } 639 if(tags_callbacks[id] && tags_callbacks[id]['onChange']) 640 { 641 var i = tagslist.length; 642 var f = tags_callbacks[id]['onChange']; 643 f.call(this, $(this), tagslist[i-1]); 644 } 645 } 646 647 }); 648 649 return false; 650 }; 651 652 $.fn.removeTag = function(value) { 653 value = unescape(value); 654 this.each(function() { 655 var id = $(this).attr('id'); 656 657 var old = $(this).val().split(delimiter[id]); 658 659 $('#'+id+'_tagsinput .tag').remove(); 660 str = ''; 661 for (i=0; i< old.length; i++) { 662 if (old[i] != value.trim()) { 663 str = str + delimiter[id] +old[i]; 664 } 665 } 666 667 $.fn.tagsInput.importTags(this,str); 668 669 if (tags_callbacks[id] && tags_callbacks[id]['onRemoveTag']) { 670 var f = tags_callbacks[id]['onRemoveTag']; 671 f.call(this, value); 672 } 673 }); 674 675 return false; 676 }; 677 678 $.fn.tagExist = function(val) { 679 var id = $(this).attr('id'); 680 var tagslist = $(this).val().split(delimiter[id]); 681 return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not 682 }; 683 684 // clear all existing tags and import new ones from a string 685 $.fn.importTags = function(str) { 686 id = $(this).attr('id'); 687 $('#'+id+'_tagsinput .tag').remove(); 688 $.fn.tagsInput.importTags(this,str); 689 } 690 691 $.fn.tagsInput = function(options) { 692 var settings = jQuery.extend({ 693 interactive:true, 694 defaultText:'', 695 minChars:0, 696 width:'', 697 height:'', 698 autocomplete: {selectFirst: false }, 699 'hide':true, 700 'delimiter':',', 701 'unique':true, 702 removeWithBackspace:true, 703 placeholderColor:'#666666', 704 autosize: true, 705 comfortZone: 20, 706 inputPadding: 6*2 707 },options); 708 709 this.each(function() { 710 if (settings.hide) { 711 $(this).hide(); 712 } 713 var id = $(this).attr('id'); 714 if (!id || delimiter[$(this).attr('id')]) { 715 id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id'); 716 } 717 718 var data = jQuery.extend({ 719 pid:id, 720 real_input: '#'+id, 721 holder: '#'+id+'_tagsinput', 722 input_wrapper: '#'+id+'_addTag', 723 fake_input: '#'+id+'_tag' 724 },settings); 725 726 delimiter[id] = data.delimiter; 727 728 if (settings.onAddTag || settings.onRemoveTag || settings.onChange) { 729 tags_callbacks[id] = new Array(); 730 tags_callbacks[id]['onAddTag'] = settings.onAddTag; 731 tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag; 732 tags_callbacks[id]['onChange'] = settings.onChange; 733 } 734 735 var containerClass = $('#'+id).attr('class').replace('tagsinput', ''); 736 var markup = '<div id="'+id+'_tagsinput" class="tagsinput '+containerClass+'"><div class="tagsinput-add-container" id="'+id+'_addTag"><div class="tagsinput-add"></div>'; 737 738 if (settings.interactive) { 739 markup = markup + '<input id="'+id+'_tag" value="" data-default="'+settings.defaultText+'" />'; 740 } 741 742 markup = markup + '</div></div>'; 743 744 $(markup).insertAfter(this); 745 746 $(data.holder).css('width',settings.width); 747 $(data.holder).css('min-height',settings.height); 748 $(data.holder).css('height','100%'); 749 750 if ($(data.real_input).val()!='') { 751 $.fn.tagsInput.importTags($(data.real_input),$(data.real_input).val()); 752 } 753 if (settings.interactive) { 754 $(data.fake_input).val($(data.fake_input).attr('data-default')); 755 $(data.fake_input).css('color',settings.placeholderColor);
756 $(data.fake_input).resetAutosize(settings); 757 758 $(data.holder).bind('click',data,function(event) { 759 $(event.data.fake_input).focus(); 760 }); 761 762 $(data.fake_input).bind('focus',data,function(event) { 763 if ($(event.data.fake_input).val()==$(event.data.fake_input).attr('data-default')) { 764 $(event.data.fake_input).val(''); 765 } 766 $(event.data.fake_input).css('color','#000000'); 767 }); 768 769 if (settings.autocomplete_url != undefined) { 770 autocomplete_options = {source: settings.autocomplete_url}; 771 for (attrname in settings.autocomplete) { 772 autocomplete_options[attrname] = settings.autocomplete[attrname]; 773 } 774 775 if (jQuery.Autocompleter !== undefined) { 776 $(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete); 777 $(data.fake_input).bind('result',data,function(event,data,formatted) { 778 if (data) { 779 $('#'+id).addTag(data[0] + "",{focus:true,unique:(settings.unique)}); 780 } 781 }); 782 } else if (jQuery.ui.autocomplete !== undefined) { 783 $(data.fake_input).autocomplete(autocomplete_options); 784 $(data.fake_input).bind('autocompleteselect',data,function(event,ui) { 785 $(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)}); 786 return false; 787 }); 788 } 789 790 791 } else { 792 // if a user tabs out of the field, create a new tag 793 // this is only available if autocomplete is not used. 794 $(data.fake_input).bind('blur',data,function(event) { 795 var d = $(this).attr('data-default'); 796 if ($(event.data.fake_input).val()!='' && $(event.data.fake_input).val()!=d) { 797 if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) ) 798 $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)}); 799 } else { 800 $(event.data.fake_input).val($(event.data.fake_input).attr('data-default')); 801 $(event.data.fake_input).css('color',settings.placeholderColor); 802 } 803 return false; 804 }); 805 806 } 807 // if user types a comma, create a new tag 808 $(data.fake_input).bind('keypress',data,function(event) { 809 if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) { 810 event.preventDefault(); 811 if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) ) 812 $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)}); 813 $(event.data.fake_input).resetAutosize(settings); 814 return false; 815 } else if (event.data.autosize) { 816 $(event.data.fake_input).doAutosize(settings); 817 818 } 819 }); 820 //Delete last tag on backspace 821 data.removeWithBackspace && $(data.fake_input).bind('keydown', function(event) 822 { 823 if(event.keyCode == 8 && $(this).val() == '') 824 { 825 event.preventDefault(); 826 var last_tag = $(this).closest('.tagsinput').find('.tag:last').text(); 827 var id = $(this).attr('id').replace(/_tag$/, ''); 828 last_tag = last_tag.replace(/[\s\u00a0]+x$/, ''); 829 $('#' + id).removeTag(escape(last_tag)); 830 $(this).trigger('focus'); 831 } 832 }); 833 $(data.fake_input).blur(); 834 835 //Removes the not_valid class when user changes the value of the fake input 836 if(data.unique) { 837 $(data.fake_input).keydown(function(event){ 838 if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéÃóúÃÃÃÃÃñÃ,/]+/)) { 839 $(this).removeClass('not_valid'); 840 } 841 }); 842 } 843 } // if settings.interactive 844 }); 845 846 return this; 847 848 }; 849 850 $.fn.tagsInput.updateTagsField = function(obj,tagslist) { 851 var id = $(obj).attr('id'); 852 $(obj).val(tagslist.join(delimiter[id])); 853 }; 854 855 $.fn.tagsInput.importTags = function(obj,val) { 856 $(obj).val(''); 857 var id = $(obj).attr('id'); 858 var tags = val.split(delimiter[id]); 859 for (i=0; i<tags.length; i++) { 860 $(obj).addTag(tags[i],{focus:false,callback:false}); 861 } 862 if(tags_callbacks[id] && tags_callbacks[id]['onChange']) 863 { 864 var f = tags_callbacks[id]['onChange']; 865 f.call(obj, obj, tags[i]); 866 } 867 }; 868 869})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.