1;(function($){ 2 $.unobtrusivelib = function (enabled_modules) { 3 4 var modules = { 5 popup: function () { 6 $("a[rel^=popup]").each(function (i) { 7 var popupName = 'popup_' + i + '_' + new Date().getTime(); 8 9 $(this).click(function (e) { 10 e.preventDefault(); 11 var dims = this.getAttribute('rel').match(/.*\[([0-9]+)-([0-9]+)\].*/); 12 window.open(this.getAttribute('href'), popupName, 'width=' + dims[1] + ',height=' + dims[2] + ',resizable,scrollbars'); 13 }); 14 }); 15 }, 16 17 external: function () { 18 $("a[rel~=external]").click(function(e){ 19 e.preventDefault(); 20 window.open(this.href); 21 }); 22 }, 23 24 maxLength: function () { 25 $("textarea[maxlength]").each(function(){ 26 var jThis = $(this); 27 var sMaxLimit = jThis.attr("maxlength")-0; 28 29 if (jThis.hasClass("counter")) { 30 var jCount = $('<span class="counter">' + sMaxLimit + '</span>'); 31 jThis.after(jCount); 32 } 33 34 jThis.keyup(function(e) { 35 var charCount = sMaxLimit - jThis.val().length; 36 if ( charCount < 1 ) {
37 jThis.val( jThis.val().slice(0, sMaxLimit) ); 38 } 39 if ( !!jCount ) { 40 jCount.text(charCount); 41 } 42 }); 43 }); 44 }, 45 46 autoClearInput: function () { 47 48 var defaultClass = "autoclear-default"; 49 50 $("input.autoclear:text, input.autoclear:password, textarea.autoclear").each(function(){ 51 52 var $this = $(this); 53 54 if ($this.is(":password") && !$.browser.msie) { 55 56 var $original = $this; 57 58 $this = $this.clone().attr("type", "text").removeAttr("name"); 59 $original.after($this).hide(); 60 61 $this.focus(function(){ 62 $this.hide(); 63 $original.show().focus(); 64 }); 65 66 if ( $this.val() == this.defaultValue ) { 67 $this.addClass(defaultClass); 68 } 69 70 $original 71 .focus(function () { 72 if ( this.defaultValue == $original.val() ) { 73 $original.removeClass(defaultClass).val(""); 74 } 75 }) 76 .blur(function () { 77 if ( $original.val() == "" ) { 78 $original.hide(); 79 $this.show().addClass(defaultClass).val( this.defaultValue ); 80 } 81 }); 82 83 } else { 84 85 if ( $this.val() == this.defaultValue ) { 86 $this.addClass(defaultClass); 87 } 88 89 $this 90 .focus(function () { 91 if ( this.defaultValue == $this.val() ) { 92 $this.removeClass(defaultClass).val(""); 93 } 94 }) 95 .blur(function () { 96 if ( $this.val() == "" ) { 97 $this.addClass(defaultClass).val( this.defaultValue ); 98 } 99 }); 100 } 101 102 }); 103 }, 104 105 autoFocusInput: function () { 106 var focusElmts = $("input.autofocus"); 107 if (focusElmts.length != 0){ 108 focusElmts.get(0).focus(); 109 } 110 } 111 }; 112 113 if (!!enabled_modules) { 114 $.each(enabled_modules,function(i,n){ 115 if(modules[n]){ 116 modules[n](); 117 } 118 }); 119 } 120 else { 121 $.each(modules,function(i,n){n();}); 122 } 123 124 }; 125})(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.