1/* 2* jQuery Form Plugin; v20130523 3* http://jquery.malsup.com/form/ 4* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL 5* https://github.com/malsup/form#copyright-and-license 6*/ 7;(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(this).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;a.length>i;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;o.length>i;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var e=jQuery.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(100*(a/n))),t.uploadProgress(e,a,n,r)},!1),e}),s.data=null;var l=s.beforeSend;return s.beforeSend=function(e,t){t.data=n,l&&l.call(this,e,t)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(D),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action");w.setAttribute("target",d),u||w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(k)},m.timeout));var o=[];try{if(m.extraData)for(var l in m.extraData)m.extraData.hasOwnProperty(l)&&(e.isPlainObject(m.extraData[l])&&m.extraData[l].hasOwnProperty("name")&&m.extraData[l].hasOwnProperty("value")?o.push(e('<input type="hidden" name="'+m.extraData[l].name+'">').val(m.extraData[l].value).appendTo(w)[0]):o.push(e('<input type="hidden" name="'+l+'">').val(m.extraData[l]).appendTo(w)[0]));m.iframeTarget||(v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1)),setTimeout(t,15);try{w.submit()}catch(c){var p=document.createElement("form").submit;p.apply(w)}}finally{w.setAttribute("action",i),r?w.setAttribute("target",r):f.removeAttr("target"),e(o).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=D),t===k&&x)return x.abort("timeout"),S.reject(x,"timeout"),void 0;if(t==D&&x)return x.abort("server abort"),S.reject(x,"error","server abort"),void 0;if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),setTimeout(s,250),void 0;var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);
7var l=(m.dataType||"").toLowerCase(),c=/(json|script|text)/.test(l);if(c||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(c){var d=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];d?x.responseText=d.textContent?d.textContent:d.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==l&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{L=_(x,l,m)}catch(b){i="parsererror",x.error=r=b||i}}catch(b){a("error caught: ",b),i="error",x.error=r=b||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&300>x.status||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,L,"success",x),S.resolve(x.responseText,"success",x),p&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),p&&e.event.trigger("ajaxError",[x,m,r])),p&&e.event.trigger("ajaxComplete",[x,m]),p&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget||v.remove(),x.responseXML=null},100)}}}var l,c,m,p,d,v,g,x,b,y,T,j,w=f[0],S=e.Deferred();if(r)for(c=0;h.length>c;c++)l=e(h[c]),i?l.prop("disabled",!1):l.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,d="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),y=v.attr2("name"),y?d=y:v.attr2("name",d)):(v=e('<iframe name="'+d+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),p&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},p=m.global,p&&0===e.active++&&e.event.trigger("ajaxStart"),p&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;b=w.clk,b&&(y=b.name,y&&!b.disabled&&(m.extraData=m.extraData||{},m.extraData[y]=b.value,"image"==b.type&&(m.extraData[y+".x"]=w.clk_x,m.extraData[y+".y"]=w.clk_y)));var k=1,D=2,A=e("meta[name=csrf-token]").attr("content"),E=e("meta[name=csrf-param]").attr("content");E&&A&&(m.extraData=m.extraData||{},m.extraData[E]=A),m.forceSync?o():setTimeout(o,10);var L,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,l,c,f=this;"function"==typeof t&&(t={success:t}),u=t.type||this.attr2("method"),l=t.url||this.attr2("action"),c="string"==typeof l?e.trim(l):"",c=c||window.location.href||"",c&&(c=(c.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:c,success:e.ajaxSettings.success,type:u||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=t.traditional;void 0===p&&(p=e.ajaxSettings.traditional);var d,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,d=e.param(t.data,p)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,p);d&&(g=g?g+"&"+d:d),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var b=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(b,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var y=t.error;t.error=function(e,r,a){var n=t.context||this;y.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e('input[type=file]:enabled[value!=""]',this),w=j.length>0,S="multipart/form-data",k=f.attr("enctype")==S||f.attr("encoding")==S,D=n.fileapi&&n.formdata;a("fileAPI :"+D);var A,E=(w||k)&&!D;t.iframe!==!1&&(t.iframe||E)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||k)&&D?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var L=0;h.length>L;L++)h[L]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i=this[0],o=t?i.getElementsByTagName("*"):i.elements;if(!o)return a;var s,u,l,c,f,m,p;for(s=0,m=o.length;m>s;s++)if(f=o[s],l=f.name,l&&!f.disabled)if(t&&i.clk&&"image"==f.type)i.clk==f&&(a.push({name:l,value:e(f).val(),type:f.type}),a.push({name:l+".x",value:i.clk_x},{name:l+".y",value:i.clk_y}));else if(c=e.fieldValue(f,!0),c&&c.constructor==Array)for(r&&r.push(f),u=0,p=c.length;p>u;u++)a.push({name:l,value:c[u]});else if(n.fileapi&&"file"==f.type){r&&r.push(f);var d=f.files;if(d.length)for(u=0;d.length>u;u++)a.push({name:l,value:d[u],type:f.type});else a.push({name:l,value:"",type:f.type})}else null!==c&&c!==void 0&&(r&&r.push(f),a.push({name:l,value:c,type:f.type,required:f.required}));if(!t&&i.clk){var h=e(i.clk),v=h[0];l=v.name,l&&!v.disabled&&"image"==v.type&&(a.push({name:l,value:h.val()}),a.push({name:l+".x",value:i.clk_x},{name:l+".y",value:i.clk_y}))}return a}
7,e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&n!==void 0&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||void 0===o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,l="select-one"==n,c=l?o+1:u.length,f=l?o:0;c>f;f++){var m=u[f];if(m.selected){var p=m.value;if(p||(p=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),l)return p;s.push(p)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1})(jQuery); 8 9/*! 10 * jQuery blockUI plugin 11 * Version 2.59.0-2013.04.05 12 * @requires jQuery v1.7 or later 13 * 14 * Examples at: http://malsup.com/jquery/block/ 15 * Copyright (c) 2007-2013 M. Alsup 16 * Dual licensed under the MIT and GPL licenses: 17 * http://www.opensource.org/licenses/mit-license.php 18 * http://www.gnu.org/licenses/gpl.html 19 * 20 * Thanks to Amir-Hossein Sobhi for some excellent contributions! 21 */ 22 23;(function() { 24/*jshint eqeqeq:false curly:false latedef:false */ 25"use strict"; 26 27 function setup($) { 28 $.fn._fadeIn = $.fn.fadeIn; 29 30 var noOp = $.noop || function() {}; 31 32 // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle 33 // retarded userAgent strings on Vista) 34 var msie = /MSIE/.test(navigator.userAgent); 35 var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); 36 var mode = document.documentMode || 0; 37 var setExpr = $.isFunction( document.createElement('div').style.setExpression ); 38 39 // global $ methods for blocking/unblocking the entire page 40 $.blockUI = function(opts) { install(window, opts); }; 41 $.unblockUI = function(opts) { remove(window, opts); }; 42 43 // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) 44 $.growlUI = function(title, message, timeout, onClose) { 45 var $m = $('<div class="growlUI"></div>'); 46 if (title) $m.append('<h1>'+title+'</h1>'); 47 if (message) $m.append('<h2>'+message+'</h2>'); 48 if (timeout === undefined) timeout = 3000; 49 $.blockUI({ 50 message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, 51 timeout: timeout, showOverlay: false, 52 onUnblock: onClose, 53 css: $.blockUI.defaults.growlCSS 54 }); 55 }; 56 57 // plugin method for blocking element content 58 $.fn.block = function(opts) { 59 if ( this[0] === window ) { 60 $.blockUI( opts ); 61 return this; 62 } 63 var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); 64 this.each(function() { 65 var $el = $(this); 66 if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) 67 return; 68 $el.unblock({ fadeOut: 0 }); 69 }); 70 71 return this.each(function() { 72 if ($.css(this,'position') == 'static') { 73 this.style.position = 'relative'; 74 $(this).data('blockUI.static', true); 75 } 76 this.style.zoom = 1; // force 'hasLayout' in ie 77 install(this, opts); 78 }); 79 }; 80 81 // plugin method for unblocking element content 82 $.fn.unblock = function(opts) { 83 if ( this[0] === window ) { 84 $.unblockUI( opts ); 85 return this; 86 } 87 return this.each(function() { 88 remove(this, opts); 89 }); 90 }; 91 92 $.blockUI.version = 2.59; // 2nd generation blocking at no extra cost! 93 94 // override these in your code to change the default behavior and style 95 $.blockUI.defaults = { 96 // message displayed when blocking (use null for no message) 97 message: '<h1>Please wait...</h1>', 98 99 title: null, // title string; only used when theme == true 100 draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) 101 102 theme: false, // set to true to use with jQuery UI themes 103 104 // styles for the message when blocking; if you wish to disable 105 // these and use an external stylesheet then do this in your code: 106 // $.blockUI.defaults.css = {}; 107 css: { 108 padding: 0, 109 margin: 0, 110 width: '30%', 111 top: '40%', 112 left: '35%', 113 textAlign: 'center', 114 color: '#000', 115 border: '3px solid #aaa', 116 backgroundColor:'#fff', 117 cursor: 'wait' 118 }, 119 120 // minimal style set used when themes are used 121 themedCSS: { 122 width: '30%', 123 top: '40%', 124 left: '35%' 125 }, 126 127 // styles for the overlay 128 overlayCSS: { 129 backgroundColor: '#000', 130 opacity: 0.6, 131 cursor: 'wait' 132 }, 133 134 // style to replace wait cursor before unblocking to correct issue 135 // of lingering wait cursor 136 cursorReset: 'default', 137 138 // styles applied when using $.growlUI 139 growlCSS: { 140 width: '350px', 141 top: '10px', 142 left: '', 143 right: '10px', 144 border: 'none', 145 padding: '5px', 146 opacity: 0.6, 147 cursor: 'default', 148 color: '#fff', 149 backgroundColor: '#000',
vendor: 10,148 bytes, lines 150-410
150 '-webkit-border-radius':'10px', 151 '-moz-border-radius': '10px', 152 'border-radius': '10px' 153 }, 154 155 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w 156 // (hat tip to Jorge H. N. de Vasconcelos) 157 /*jshint scripturl:true */ 158 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', 159 160 // force usage of iframe in non-IE browsers (handy for blocking applets) 161 forceIframe: false, 162 163 // z-index for the blocking overlay 164 baseZ: 1000, 165 166 // set these to true to have the message automatically centered 167 centerX: true, // <-- only effects element blocking (page block controlled via css above) 168 centerY: true, 169 170 // allow body element to be stetched in ie6; this makes blocking look better 171 // on "short" pages. disable if you wish to prevent changes to the body height 172 allowBodyStretch: true, 173 174 // enable if you want key and mouse events to be disabled for content that is blocked 175 bindEvents: true, 176 177 // be default blockUI will supress tab navigation from leaving blocking content 178 // (if bindEvents is true) 179 constrainTabKey: true, 180 181 // fadeIn time in millis; set to 0 to disable fadeIn on block 182 fadeIn: 200, 183 184 // fadeOut time in millis; set to 0 to disable fadeOut on unblock 185 fadeOut: 400, 186 187 // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock 188 timeout: 0, 189 190 // disable if you don't want to show the overlay 191 showOverlay: true, 192 193 // if true, focus will be placed in the first available input field when 194 // page blocking 195 focusInput: true, 196 197 // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) 198 // no longer needed in 2012 199 // applyPlatformOpacityRules: true, 200 201 // callback method invoked when fadeIn has completed and blocking message is visible 202 onBlock: null, 203 204 // callback method invoked when unblocking has completed; the callback is 205 // passed the element that has been unblocked (which is the window object for page 206 // blocks) and the options that were passed to the unblock call: 207 // onUnblock(element, options) 208 onUnblock: null, 209 210 // callback method invoked when the overlay area is clicked. 211 // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. 212 onOverlayClick: null, 213 214 // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 215 quirksmodeOffsetHack: 4, 216 217 // class name of the message block 218 blockMsgClass: 'blockMsg', 219 220 // if it is already blocked, then ignore it (don't unblock and reblock) 221 ignoreIfBlocked: false 222 }; 223 224 // private data and functions follow... 225 226 var pageBlock = null; 227 var pageBlockEls = []; 228 229 function install(el, opts) { 230 var css, themedCSS; 231 var full = (el == window); 232 var msg = (opts && opts.message !== undefined ? opts.message : undefined); 233 opts = $.extend({}, $.blockUI.defaults, opts || {}); 234 235 if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) 236 return; 237 238 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); 239 css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); 240 if (opts.onOverlayClick) 241 opts.overlayCSS.cursor = 'pointer'; 242 243 themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); 244 msg = msg === undefined ? opts.message : msg; 245 246 // remove the current block (if there is one) 247 if (full && pageBlock) 248 remove(window, {fadeOut:0}); 249 250 // if an existing element is being used as the blocking content then we capture 251 // its current place in the DOM (and current display style) so we can restore 252 // it when we unblock 253 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { 254 var node = msg.jquery ? msg[0] : msg; 255 var data = {}; 256 $(el).data('blockUI.history', data); 257 data.el = node; 258 data.parent = node.parentNode; 259 data.display = node.style.display; 260 data.position = node.style.position; 261 if (data.parent) 262 data.parent.removeChild(node); 263 } 264 265 $(el).data('blockUI.onUnblock', opts.onUnblock); 266 var z = opts.baseZ; 267 268 // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; 269 // layer1 is the iframe layer which is used to supress bleed through of underlying content 270 // layer2 is the overlay layer which has opacity and a wait cursor (by default) 271 // layer3 is the message content that is displayed while blocking 272 var lyr1, lyr2, lyr3, s; 273 if (msie || opts.forceIframe) 274 lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'); 275 else 276 lyr1 = $('<div class="blockUI" style="display:none"></div>'); 277 278 if (opts.theme) 279 lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>'); 280 else 281 lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); 282 283 if (opts.theme && full) { 284 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">'; 285 if ( opts.title ) { 286 s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; 287 } 288 s += '<div class="ui-widget-content ui-dialog-content"></div>'; 289 s += '</div>'; 290 } 291 else if (opts.theme) { 292 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">'; 293 if ( opts.title ) { 294 s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; 295 } 296 s += '<div class="ui-widget-content ui-dialog-content"></div>'; 297 s += '</div>'; 298 } 299 else if (full) { 300 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>'; 301 } 302 else { 303 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>'; 304 } 305 lyr3 = $(s); 306 307 // if we have a message, style it 308 if (msg) { 309 if (opts.theme) { 310 lyr3.css(themedCSS); 311 lyr3.addClass('ui-widget-content'); 312 } 313 else 314 lyr3.css(css); 315 } 316 317 // style the overlay 318 if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) 319 lyr2.css(opts.overlayCSS); 320 lyr2.css('position', full ? 'fixed' : 'absolute'); 321 322 // make iframe layer transparent in IE 323 if (msie || opts.forceIframe) 324 lyr1.css('opacity',0.0); 325 326 //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); 327 var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); 328 $.each(layers, function() { 329 this.appendTo($par); 330 }); 331 332 if (opts.theme && opts.draggable && $.fn.draggable) { 333 lyr3.draggable({ 334 handle: '.ui-dialog-titlebar', 335 cancel: 'li' 336 }); 337 } 338 339 // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) 340 var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); 341 if (ie6 || expr) { 342 // give body 100% height 343 if (full && opts.allowBodyStretch && $.support.boxModel) 344 $('html,body').css('height','100%'); 345 346 // fix ie6 issue when blocked element has a border width 347 if ((ie6 || !$.support.boxModel) && !full) { 348 var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); 349 var fixT = t ? '(0 - '+t+')' : 0; 350 var fixL = l ? '(0 - '+l+')' : 0; 351 } 352 353 // simulate fixed position 354 $.each(layers, function(i,o) { 355 var s = o[0].style; 356 s.position = 'absolute'; 357 if (i < 2) { 358 if (full) 359 s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); 360 else 361 s.setExpression('height','this.parentNode.offsetHeight + "px"'); 362 if (full) 363 s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); 364 else 365 s.setExpression('width','this.parentNode.offsetWidth + "px"'); 366 if (fixL) s.setExpression('left', fixL); 367 if (fixT) s.setExpression('top', fixT); 368 } 369 else if (opts.centerY) { 370 if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); 371 s.marginTop = 0; 372 } 373 else if (!opts.centerY && full) { 374 var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; 375 var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; 376 s.setExpression('top',expression); 377 } 378 }); 379 } 380 381 // show the message 382 if (msg) { 383 if (opts.theme) 384 lyr3.find('.ui-widget-content').append(msg); 385 else 386 lyr3.append(msg); 387 if (msg.jquery || msg.nodeType) 388 $(msg).show(); 389 } 390 391 if ((msie || opts.forceIframe) && opts.showOverlay) 392 lyr1.show(); // opacity is zero 393 if (opts.fadeIn) { 394 var cb = opts.onBlock ? opts.onBlock : noOp; 395 var cb1 = (opts.showOverlay && !msg) ? cb : noOp; 396 var cb2 = msg ? cb : noOp; 397 if (opts.showOverlay) 398 lyr2._fadeIn(opts.fadeIn, cb1); 399 if (msg) 400 lyr3._fadeIn(opts.fadeIn, cb2); 401 } 402 else { 403 if (opts.showOverlay) 404 lyr2.show(); 405 if (msg) 406 lyr3.show(); 407 if (opts.onBlock) 408 opts.onBlock(); 409 } 410
vendor: 5,063 bytes, lines 411-590
411 // bind key and mouse events 412 bind(1, el, opts); 413 414 if (full) { 415 pageBlock = lyr3[0]; 416 pageBlockEls = $(':input:enabled:visible',pageBlock); 417 if (opts.focusInput) 418 setTimeout(focus, 20); 419 } 420 else 421 center(lyr3[0], opts.centerX, opts.centerY); 422 423 if (opts.timeout) { 424 // auto-unblock 425 var to = setTimeout(function() { 426 if (full) 427 $.unblockUI(opts); 428 else 429 $(el).unblock(opts); 430 }, opts.timeout); 431 $(el).data('blockUI.timeout', to); 432 } 433 } 434 435 // remove the block 436 function remove(el, opts) { 437 var count; 438 var full = (el == window); 439 var $el = $(el); 440 var data = $el.data('blockUI.history'); 441 var to = $el.data('blockUI.timeout'); 442 if (to) { 443 clearTimeout(to); 444 $el.removeData('blockUI.timeout'); 445 } 446 opts = $.extend({}, $.blockUI.defaults, opts || {}); 447 bind(0, el, opts); // unbind events 448 449 if (opts.onUnblock === null) { 450 opts.onUnblock = $el.data('blockUI.onUnblock'); 451 $el.removeData('blockUI.onUnblock'); 452 } 453 454 var els; 455 if (full) // crazy selector to handle odd field errors in ie6/7 456 els = $('body').children().filter('.blockUI').add('body > .blockUI'); 457 else 458 els = $el.find('>.blockUI'); 459 460 // fix cursor issue 461 if ( opts.cursorReset ) { 462 if ( els.length > 1 ) 463 els[1].style.cursor = opts.cursorReset; 464 if ( els.length > 2 ) 465 els[2].style.cursor = opts.cursorReset; 466 } 467 468 if (full) 469 pageBlock = pageBlockEls = null; 470 471 if (opts.fadeOut) { 472 count = els.length; 473 els.fadeOut(opts.fadeOut, function() { 474 if ( --count === 0) 475 reset(els,data,opts,el); 476 }); 477 } 478 else 479 reset(els, data, opts, el); 480 } 481 482 // move blocking element back into the DOM where it started 483 function reset(els,data,opts,el) { 484 var $el = $(el); 485 els.each(function(i,o) { 486 // remove via DOM calls so we don't lose event handlers 487 if (this.parentNode) 488 this.parentNode.removeChild(this); 489 }); 490 491 if (data && data.el) { 492 data.el.style.display = data.display; 493 data.el.style.position = data.position; 494 if (data.parent) 495 data.parent.appendChild(data.el); 496 $el.removeData('blockUI.history'); 497 } 498 499 if ($el.data('blockUI.static')) { 500 $el.css('position', 'static'); // #22 501 } 502 503 if (typeof opts.onUnblock == 'function') 504 opts.onUnblock(el,opts); 505 506 // fix issue in Safari 6 where block artifacts remain until reflow 507 var body = $(document.body), w = body.width(), cssW = body[0].style.width; 508 body.width(w-1).width(w); 509 body[0].style.width = cssW; 510 } 511 512 // bind/unbind the handler 513 function bind(b, el, opts) { 514 var full = el == window, $el = $(el); 515 516 // don't bother unbinding if there is nothing to unbind 517 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) 518 return; 519 520 $el.data('blockUI.isBlocked', b); 521 522 // don't bind events when overlay is not in use or if bindEvents is false 523 if (!full || !opts.bindEvents || (b && !opts.showOverlay)) 524 return; 525 526 // bind anchors and inputs for mouse and key events 527 var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; 528 if (b) 529 $(document).bind(events, opts, handler); 530 else 531 $(document).unbind(events, handler); 532 533 // former impl... 534 // var $e = $('a,:input'); 535 // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); 536 } 537 538 // event handler to suppress keyboard/mouse events when blocking 539 function handler(e) { 540 // allow tab navigation (conditionally) 541 if (e.keyCode && e.keyCode == 9) { 542 if (pageBlock && e.data.constrainTabKey) { 543 var els = pageBlockEls; 544 var fwd = !e.shiftKey && e.target === els[els.length-1]; 545 var back = e.shiftKey && e.target === els[0]; 546 if (fwd || back) { 547 setTimeout(function(){focus(back);},10); 548 return false; 549 } 550 } 551 } 552 var opts = e.data; 553 var target = $(e.target); 554 if (target.hasClass('blockOverlay') && opts.onOverlayClick) 555 opts.onOverlayClick(); 556 557 // allow events within the message content 558 if (target.parents('div.' + opts.blockMsgClass).length > 0) 559 return true; 560 561 // allow events for content that is not being blocked 562 return target.parents().children().filter('div.blockUI').length === 0; 563 } 564 565 function focus(back) { 566 if (!pageBlockEls) 567 return; 568 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; 569 if (e) 570 e.focus(); 571 } 572 573 function center(el, x, y) { 574 var p = el.parentNode, s = el.style; 575 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); 576 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); 577 if (x) s.left = l > 0 ? (l+'px') : '0'; 578 if (y) s.top = t > 0 ? (t+'px') : '0'; 579 } 580 581 function sz(el, p) { 582 return parseInt($.css(el,p),10)||0; 583 } 584 585 } 586 587 588 /*global define:true */ 589 if (typeof define === 'function' && define.amd && define.amd.jQuery) { 590 define(['jquery'], setup);
591 } else { 592 setup(jQuery); 593 } 594 595})();
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.