diff --git a/CHANGES.rst b/CHANGES.rst index 8c8c1ad..715b094 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,17 +4,13 @@ Changelog 1.9.1 (unreleased) ------------------ -Breaking changes: - -- *add item here* - -New features: - -- *add item here* - Bug fixes: -- *add item here* +- Fix for dotted path form ids. + [malsup] + +- Fix initaliziation of minimum and maximum dates in dateinput. + [msom] 1.9.0 (2016-12-02) @@ -27,7 +23,6 @@ New features: [petri] - 1.8.0 (2016-08-12) ------------------ diff --git a/plone/app/jquerytools/browser/jquery.form.js b/plone/app/jquerytools/browser/jquery.form.js index 0a606c0..591ad6f 100644 --- a/plone/app/jquerytools/browser/jquery.form.js +++ b/plone/app/jquerytools/browser/jquery.form.js @@ -10,6 +10,21 @@ */ /*global ActiveXObject */ +// AMD support +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + // using AMD; register as anon module + define(['jquery'], factory); + } else { + // no AMD; invoke directly + factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); + } +} + +(function($) { +"use strict"; + /* Usage Note: ----------- @@ -47,8 +62,6 @@ at the appropriate time. */ -(function($) { - /** * Feature detection */ @@ -1261,4 +1274,4 @@ function log() { } } -}(jQuery)); +})); diff --git a/plone/app/jquerytools/browser/jquery.form.min.js b/plone/app/jquerytools/browser/jquery.form.min.js index c2e9cae..0b2bab8 100644 --- a/plone/app/jquerytools/browser/jquery.form.min.js +++ b/plone/app/jquerytools/browser/jquery.form.min.js @@ -1 +1 @@ -!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):factory("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function($){"use strict";function doAjaxSubmit(e){var options=e.data;e.isDefaultPrevented()||(e.preventDefault(),$(e.target).ajaxSubmit(options))}function captureSubmittingElement(e){var target=e.target,$el=$(target);if(!$el.is("[type=submit],[type=image]")){var t=$el.closest("[type=submit]");if(0===t.length)return;target=t[0]}var form=this;if(form.clk=target,"image"==target.type)if(void 0!==e.offsetX)form.clk_x=e.offsetX,form.clk_y=e.offsetY;else if("function"==typeof $.fn.offset){var offset=$el.offset();form.clk_x=e.pageX-offset.left,form.clk_y=e.pageY-offset.top}else form.clk_x=e.pageX-target.offsetLeft,form.clk_y=e.pageY-target.offsetTop;setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)}function log(){if($.fn.ajaxSubmit.debug){var msg="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(msg):window.opera&&window.opera.postError&&window.opera.postError(msg)}}var feature={};feature.fileapi=void 0!==$("").get(0).files,feature.formdata=void 0!==window.FormData;var hasProp=!!$.fn.prop;$.fn.attr2=function(){if(!hasProp)return this.attr.apply(this,arguments);var val=this.prop.apply(this,arguments);return val&&val.jquery||"string"==typeof val?val:this.attr.apply(this,arguments)},$.fn.ajaxSubmit=function(options){function deepSerialize(extraData){var i,part,serialized=$.param(extraData,options.traditional).split("&"),len=serialized.length,result=[];for(i=0;len>i;i++)serialized[i]=serialized[i].replace(/\+/g," "),part=serialized[i].split("="),result.push([decodeURIComponent(part[0]),decodeURIComponent(part[1])]);return result}function fileUploadXhr(a){for(var formdata=new FormData,i=0;i').val(s.extraData[n].value).appendTo(form)[0]:$('').val(s.extraData[n]).appendTo(form)[0]);s.iframeTarget||$io.appendTo("body"),io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,!1),setTimeout(checkState,15);try{form.submit()}catch(err){var submitFn=document.createElement("form").submit;submitFn.apply(form)}}finally{form.setAttribute("action",a),form.setAttribute("enctype",et),t?form.setAttribute("target",t):$form.removeAttr("target"),$(extraInputs).remove()}}function cb(e){if(!xhr.aborted&&!callbackProcessed){if(doc=getDoc(io),doc||(log("cannot access response document"),e=SERVER_ABORT),e===CLIENT_TIMEOUT_ABORT&&xhr)return xhr.abort("timeout"),void deferred.reject(xhr,"timeout");if(e==SERVER_ABORT&&xhr)return xhr.abort("server abort"),void deferred.reject(xhr,"error","server abort");if(doc&&doc.location.href!=s.iframeSrc||timedOut){io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,!1);var errMsg,status="success";try{if(timedOut)throw"timeout";var isXml="xml"==s.dataType||doc.XMLDocument||$.isXMLDoc(doc);if(log("isXml="+isXml),!isXml&&window.opera&&(null===doc.body||!doc.body.innerHTML)&&--domCheckCount)return log("requeing onLoad callback, DOM not available"),void setTimeout(cb,250);var docRoot=doc.body?doc.body:doc.documentElement;xhr.responseText=docRoot?docRoot.innerHTML:null,xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc,isXml&&(s.dataType="xml"),xhr.getResponseHeader=function(header){var headers={"content-type":s.dataType};return headers[header.toLowerCase()]},docRoot&&(xhr.status=Number(docRoot.getAttribute("status"))||xhr.status,xhr.statusText=docRoot.getAttribute("statusText")||xhr.statusText);var dt=(s.dataType||"").toLowerCase(),scr=/(json|script|text)/.test(dt);if(scr||s.textarea){var ta=doc.getElementsByTagName("textarea")[0];if(ta)xhr.responseText=ta.value,xhr.status=Number(ta.getAttribute("status"))||xhr.status,xhr.statusText=ta.getAttribute("statusText")||xhr.statusText;else if(scr){var pre=doc.getElementsByTagName("pre")[0],b=doc.getElementsByTagName("body")[0];pre?xhr.responseText=pre.textContent?pre.textContent:pre.innerText:b&&(xhr.responseText=b.textContent?b.textContent:b.innerText)}}else"xml"==dt&&!xhr.responseXML&&xhr.responseText&&(xhr.responseXML=toXml(xhr.responseText));try{data=httpData(xhr,dt,s)}catch(err){status="parsererror",xhr.error=errMsg=err||status}}catch(err){log("error caught: ",err),status="error",xhr.error=errMsg=err||status}xhr.aborted&&(log("upload aborted"),status=null),xhr.status&&(status=xhr.status>=200&&xhr.status<300||304===xhr.status?"success":"error"),"success"===status?(s.success&&s.success.call(s.context,data,"success",xhr),deferred.resolve(xhr.responseText,"success",xhr),g&&$.event.trigger("ajaxSuccess",[xhr,s])):status&&(void 0===errMsg&&(errMsg=xhr.statusText),s.error&&s.error.call(s.context,xhr,status,errMsg),deferred.reject(xhr,"error",errMsg),g&&$.event.trigger("ajaxError",[xhr,s,errMsg])),g&&$.event.trigger("ajaxComplete",[xhr,s]),g&&!--$.active&&$.event.trigger("ajaxStop"),s.complete&&s.complete.call(s.context,xhr,status),callbackProcessed=!0,s.timeout&&clearTimeout(timeoutHandle),setTimeout(function(){s.iframeTarget?$io.attr("src",s.iframeSrc):$io.remove(),xhr.responseXML=null},100)}}}var el,i,s,g,id,$io,io,xhr,sub,n,timedOut,timeoutHandle,form=$form[0],deferred=$.Deferred();if(deferred.abort=function(status){xhr.abort(status)},a)for(i=0;i'),$io.css({position:"absolute",top:"-1000px",left:"-1000px"})),io=$io[0],xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(status){var e="timeout"===status?"timeout":"aborted";log("aborting upload... "+e),this.aborted=1;try{io.contentWindow.document.execCommand&&io.contentWindow.document.execCommand("Stop")}catch(ignore){}$io.attr("src",s.iframeSrc),xhr.error=e,s.error&&s.error.call(s.context,xhr,e,status),g&&$.event.trigger("ajaxError",[xhr,s,e]),s.complete&&s.complete.call(s.context,xhr,e)}},g=s.global,g&&0===$.active++&&$.event.trigger("ajaxStart"),g&&$.event.trigger("ajaxSend",[xhr,s]),s.beforeSend&&s.beforeSend.call(s.context,xhr,s)===!1)return s.global&&$.active--,deferred.reject(),deferred;if(xhr.aborted)return deferred.reject(),deferred;sub=form.clk,sub&&(n=sub.name,n&&!sub.disabled&&(s.extraData=s.extraData||{},s.extraData[n]=sub.value,"image"==sub.type&&(s.extraData[n+".x"]=form.clk_x,s.extraData[n+".y"]=form.clk_y)));var CLIENT_TIMEOUT_ABORT=1,SERVER_ABORT=2,csrf_token=$("meta[name=csrf-token]").attr("content"),csrf_param=$("meta[name=csrf-param]").attr("content");csrf_param&&csrf_token&&(s.extraData=s.extraData||{},s.extraData[csrf_param]=csrf_token),s.forceSync?doSubmit():setTimeout(doSubmit,10);var data,doc,callbackProcessed,domCheckCount=50,toXml=$.parseXML||function(s,doc){return window.ActiveXObject?(doc=new ActiveXObject("Microsoft.XMLDOM"),doc.async="false",doc.loadXML(s)):doc=(new DOMParser).parseFromString(s,"text/xml"),doc&&doc.documentElement&&"parsererror"!=doc.documentElement.nodeName?doc:null},parseJSON=$.parseJSON||function(s){return window.eval("("+s+")")},httpData=function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml="xml"===type||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;return xml&&"parsererror"===data.documentElement.nodeName&&$.error&&$.error("parsererror"),s&&s.dataFilter&&(data=s.dataFilter(data,type)),"string"==typeof data&&("json"===type||!type&&ct.indexOf("json")>=0?data=parseJSON(data):("script"===type||!type&&ct.indexOf("javascript")>=0)&&$.globalEval(data)),data};return deferred}if(!this.length)return log("ajaxSubmit: skipping submit process - no element selected"),this;var method,action,url,$form=this;"function"==typeof options?options={success:options}:void 0===options&&(options={}),method=options.type||this.attr2("method"),action=options.url||this.attr2("action"),url="string"==typeof action?$.trim(action):"",url=url||window.location.href||"",url&&(url=(url.match(/^([^#]+)/)||[])[1]),options=$.extend(!0,{url:url,success:$.ajaxSettings.success,type:method||$.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},options);var veto={};if(this.trigger("form-pre-serialize",[this,options,veto]),veto.veto)return log("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(options.beforeSerialize&&options.beforeSerialize(this,options)===!1)return log("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var traditional=options.traditional;void 0===traditional&&(traditional=$.ajaxSettings.traditional);var qx,elements=[],a=this.formToArray(options.semantic,elements);if(options.data&&(options.extraData=options.data,qx=$.param(options.data,traditional)),options.beforeSubmit&&options.beforeSubmit(a,this,options)===!1)return log("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[a,this,options,veto]),veto.veto)return log("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var q=$.param(a,traditional);qx&&(q=q?q+"&"+qx:qx),"GET"==options.type.toUpperCase()?(options.url+=(options.url.indexOf("?")>=0?"&":"?")+q,options.data=null):options.data=q;var callbacks=[];if(options.resetForm&&callbacks.push(function(){$form.resetForm()}),options.clearForm&&callbacks.push(function(){$form.clearForm(options.includeHidden)}),!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?"replaceWith":"html";$(options.target)[fn](data).each(oldSuccess,arguments)})}else options.success&&callbacks.push(options.success);if(options.success=function(data,status,xhr){for(var context=options.context||this,i=0,max=callbacks.length;max>i;i++)callbacks[i].apply(context,[data,status,xhr||$form,$form])},options.error){var oldError=options.error;options.error=function(xhr,status,error){var context=options.context||this;oldError.apply(context,[xhr,status,error,$form])}}if(options.complete){var oldComplete=options.complete;options.complete=function(xhr,status){var context=options.context||this;oldComplete.apply(context,[xhr,status,$form])}}var fileInputs=$("input[type=file]:enabled",this).filter(function(){return""!==$(this).val()}),hasFileInputs=fileInputs.length>0,mp="multipart/form-data",multipart=$form.attr("enctype")==mp||$form.attr("encoding")==mp,fileAPI=feature.fileapi&&feature.formdata;log("fileAPI :"+fileAPI);var jqxhr,shouldUseFrame=(hasFileInputs||multipart)&&!fileAPI;options.iframe!==!1&&(options.iframe||shouldUseFrame)?options.closeKeepAlive?$.get(options.closeKeepAlive,function(){jqxhr=fileUploadIframe(a)}):jqxhr=fileUploadIframe(a):jqxhr=(hasFileInputs||multipart)&&fileAPI?fileUploadXhr(a):$.ajax(options),$form.removeData("jqxhr").data("jqxhr",jqxhr);for(var k=0;ki;i++)if(el=els[i],n=el.name,n&&!el.disabled)if(semantic&&form.clk&&"image"==el.type)form.clk==el&&(a.push({name:n,value:$(el).val(),type:el.type}),a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y}));else if(v=$.fieldValue(el,!0),v&&v.constructor==Array)for(elements&&elements.push(el),j=0,jmax=v.length;jmax>j;j++)a.push({name:n,value:v[j]});else if(feature.fileapi&&"file"==el.type){elements&&elements.push(el);var files=el.files;if(files.length)for(j=0;ji;i++)a.push({name:n,value:v[i]});else null!==v&&"undefined"!=typeof v&&a.push({name:this.name,value:v})}}),$.param(a)},$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;max>i;i++){var el=this[i],v=$.fieldValue(el,successful);null===v||"undefined"==typeof v||v.constructor==Array&&!v.length||(v.constructor==Array?$.merge(val,v):val.push(v))}return val},$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(void 0===successful&&(successful=!0),successful&&(!n||el.disabled||"reset"==t||"button"==t||("checkbox"==t||"radio"==t)&&!el.checked||("submit"==t||"image"==t)&&el.form&&el.form.clk!=el||"select"==tag&&-1==el.selectedIndex))return null;if("select"==tag){var index=el.selectedIndex;if(0>index)return null;for(var a=[],ops=el.options,one="select-one"==t,max=one?index+1:ops.length,i=one?index:0;max>i;i++){var op=ops[i];if(op.selected){var v=op.value;if(v||(v=op.attributes&&op.attributes.value&&!op.attributes.value.specified?op.text:op.value),one)return v;a.push(v)}}return a}return $(el).val()},$.fn.clearForm=function(includeHidden){return this.each(function(){$("input,select,textarea",this).clearFields(includeHidden)})},$.fn.clearFields=$.fn.clearInputs=function(includeHidden){var re=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();re.test(t)||"textarea"==tag?this.value="":"checkbox"==t||"radio"==t?this.checked=!1:"select"==tag?this.selectedIndex=-1:"file"==t?/MSIE/.test(navigator.userAgent)?$(this).replaceWith($(this).clone(!0)):$(this).val(""):includeHidden&&(includeHidden===!0&&/hidden/.test(t)||"string"==typeof includeHidden&&$(this).is(includeHidden))&&(this.value="")})},$.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},$.fn.enable=function(b){return void 0===b&&(b=!0),this.each(function(){this.disabled=!b})},$.fn.selected=function(select){return void 0===select&&(select=!0),this.each(function(){var t=this.type;if("checkbox"==t||"radio"==t)this.checked=select;else if("option"==this.tagName.toLowerCase()){var $sel=$(this).parent("select");select&&$sel[0]&&"select-one"==$sel[0].type&&$sel.find("option").selected(!1),this.selected=select}})},$.fn.ajaxSubmit.debug=!1}); \ No newline at end of file +!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):factory("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function($){"use strict";function doAjaxSubmit(e){var options=e.data;e.isDefaultPrevented()||(e.preventDefault(),$(e.target).ajaxSubmit(options))}function captureSubmittingElement(e){var target=e.target,$el=$(target);if(!$el.is("[type=submit],[type=image]")){var t=$el.closest("[type=submit]");if(0===t.length)return;target=t[0]}var form=this;if(form.clk=target,"image"==target.type)if(void 0!==e.offsetX)form.clk_x=e.offsetX,form.clk_y=e.offsetY;else if("function"==typeof $.fn.offset){var offset=$el.offset();form.clk_x=e.pageX-offset.left,form.clk_y=e.pageY-offset.top}else form.clk_x=e.pageX-target.offsetLeft,form.clk_y=e.pageY-target.offsetTop;setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)}function log(){if($.fn.ajaxSubmit.debug){var msg="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(msg):window.opera&&window.opera.postError&&window.opera.postError(msg)}}var feature={};feature.fileapi=void 0!==$("").get(0).files,feature.formdata=void 0!==window.FormData;var hasProp=!!$.fn.prop;$.fn.attr2=function(){if(!hasProp)return this.attr.apply(this,arguments);var val=this.prop.apply(this,arguments);return val&&val.jquery||"string"==typeof val?val:this.attr.apply(this,arguments)},$.fn.ajaxSubmit=function(options){function deepSerialize(extraData){var i,part,serialized=$.param(extraData,options.traditional).split("&"),len=serialized.length,result=[];for(i=0;i').val(s.extraData[n].value).appendTo(form)[0]):extraInputs.push($('').val(s.extraData[n]).appendTo(form)[0]));s.iframeTarget||$io.appendTo("body"),io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,!1),setTimeout(checkState,15);try{form.submit()}catch(err){var submitFn=document.createElement("form").submit;submitFn.apply(form)}}finally{form.setAttribute("action",a),form.setAttribute("enctype",et),t?form.setAttribute("target",t):$form.removeAttr("target"),$(extraInputs).remove()}}function cb(e){if(!xhr.aborted&&!callbackProcessed){if(doc=getDoc(io),doc||(log("cannot access response document"),e=SERVER_ABORT),e===CLIENT_TIMEOUT_ABORT&&xhr)return xhr.abort("timeout"),void deferred.reject(xhr,"timeout");if(e==SERVER_ABORT&&xhr)return xhr.abort("server abort"),void deferred.reject(xhr,"error","server abort");if(doc&&doc.location.href!=s.iframeSrc||timedOut){io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,!1);var errMsg,status="success";try{if(timedOut)throw"timeout";var isXml="xml"==s.dataType||doc.XMLDocument||$.isXMLDoc(doc);if(log("isXml="+isXml),!isXml&&window.opera&&(null===doc.body||!doc.body.innerHTML)&&--domCheckCount)return log("requeing onLoad callback, DOM not available"),void setTimeout(cb,250);var docRoot=doc.body?doc.body:doc.documentElement;xhr.responseText=docRoot?docRoot.innerHTML:null,xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc,isXml&&(s.dataType="xml"),xhr.getResponseHeader=function(header){var headers={"content-type":s.dataType};return headers[header.toLowerCase()]},docRoot&&(xhr.status=Number(docRoot.getAttribute("status"))||xhr.status,xhr.statusText=docRoot.getAttribute("statusText")||xhr.statusText);var dt=(s.dataType||"").toLowerCase(),scr=/(json|script|text)/.test(dt);if(scr||s.textarea){var ta=doc.getElementsByTagName("textarea")[0];if(ta)xhr.responseText=ta.value,xhr.status=Number(ta.getAttribute("status"))||xhr.status,xhr.statusText=ta.getAttribute("statusText")||xhr.statusText;else if(scr){var pre=doc.getElementsByTagName("pre")[0],b=doc.getElementsByTagName("body")[0];pre?xhr.responseText=pre.textContent?pre.textContent:pre.innerText:b&&(xhr.responseText=b.textContent?b.textContent:b.innerText)}}else"xml"==dt&&!xhr.responseXML&&xhr.responseText&&(xhr.responseXML=toXml(xhr.responseText));try{data=httpData(xhr,dt,s)}catch(err){status="parsererror",xhr.error=errMsg=err||status}}catch(err){log("error caught: ",err),status="error",xhr.error=errMsg=err||status}xhr.aborted&&(log("upload aborted"),status=null),xhr.status&&(status=xhr.status>=200&&xhr.status<300||304===xhr.status?"success":"error"),"success"===status?(s.success&&s.success.call(s.context,data,"success",xhr),deferred.resolve(xhr.responseText,"success",xhr),g&&$.event.trigger("ajaxSuccess",[xhr,s])):status&&(void 0===errMsg&&(errMsg=xhr.statusText),s.error&&s.error.call(s.context,xhr,status,errMsg),deferred.reject(xhr,"error",errMsg),g&&$.event.trigger("ajaxError",[xhr,s,errMsg])),g&&$.event.trigger("ajaxComplete",[xhr,s]),g&&!--$.active&&$.event.trigger("ajaxStop"),s.complete&&s.complete.call(s.context,xhr,status),callbackProcessed=!0,s.timeout&&clearTimeout(timeoutHandle),setTimeout(function(){s.iframeTarget?$io.attr("src",s.iframeSrc):$io.remove(),xhr.responseXML=null},100)}}}var el,i,s,g,id,$io,io,xhr,sub,n,timedOut,timeoutHandle,form=$form[0],deferred=$.Deferred();if(deferred.abort=function(status){xhr.abort(status)},a)for(i=0;i'),$io.css({position:"absolute",top:"-1000px",left:"-1000px"})),io=$io[0],xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(status){var e="timeout"===status?"timeout":"aborted";log("aborting upload... "+e),this.aborted=1;try{io.contentWindow.document.execCommand&&io.contentWindow.document.execCommand("Stop")}catch(ignore){}$io.attr("src",s.iframeSrc),xhr.error=e,s.error&&s.error.call(s.context,xhr,e,status),g&&$.event.trigger("ajaxError",[xhr,s,e]),s.complete&&s.complete.call(s.context,xhr,e)}},g=s.global,g&&0===$.active++&&$.event.trigger("ajaxStart"),g&&$.event.trigger("ajaxSend",[xhr,s]),s.beforeSend&&s.beforeSend.call(s.context,xhr,s)===!1)return s.global&&$.active--,deferred.reject(),deferred;if(xhr.aborted)return deferred.reject(),deferred;sub=form.clk,sub&&(n=sub.name,n&&!sub.disabled&&(s.extraData=s.extraData||{},s.extraData[n]=sub.value,"image"==sub.type&&(s.extraData[n+".x"]=form.clk_x,s.extraData[n+".y"]=form.clk_y)));var CLIENT_TIMEOUT_ABORT=1,SERVER_ABORT=2,csrf_token=$("meta[name=csrf-token]").attr("content"),csrf_param=$("meta[name=csrf-param]").attr("content");csrf_param&&csrf_token&&(s.extraData=s.extraData||{},s.extraData[csrf_param]=csrf_token),s.forceSync?doSubmit():setTimeout(doSubmit,10);var data,doc,callbackProcessed,domCheckCount=50,toXml=$.parseXML||function(s,doc){return window.ActiveXObject?(doc=new ActiveXObject("Microsoft.XMLDOM"),doc.async="false",doc.loadXML(s)):doc=(new DOMParser).parseFromString(s,"text/xml"),doc&&doc.documentElement&&"parsererror"!=doc.documentElement.nodeName?doc:null},parseJSON=$.parseJSON||function(s){return window.eval("("+s+")")},httpData=function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml="xml"===type||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;return xml&&"parsererror"===data.documentElement.nodeName&&$.error&&$.error("parsererror"),s&&s.dataFilter&&(data=s.dataFilter(data,type)),"string"==typeof data&&("json"===type||!type&&ct.indexOf("json")>=0?data=parseJSON(data):("script"===type||!type&&ct.indexOf("javascript")>=0)&&$.globalEval(data)),data};return deferred}if(!this.length)return log("ajaxSubmit: skipping submit process - no element selected"),this;var method,action,url,$form=this;"function"==typeof options?options={success:options}:void 0===options&&(options={}),method=options.type||this.attr2("method"),action=options.url||this.attr2("action"),url="string"==typeof action?$.trim(action):"",url=url||window.location.href||"",url&&(url=(url.match(/^([^#]+)/)||[])[1]),options=$.extend(!0,{url:url,success:$.ajaxSettings.success,type:method||$.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},options);var veto={};if(this.trigger("form-pre-serialize",[this,options,veto]),veto.veto)return log("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(options.beforeSerialize&&options.beforeSerialize(this,options)===!1)return log("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var traditional=options.traditional;void 0===traditional&&(traditional=$.ajaxSettings.traditional);var qx,elements=[],a=this.formToArray(options.semantic,elements);if(options.data&&(options.extraData=options.data,qx=$.param(options.data,traditional)),options.beforeSubmit&&options.beforeSubmit(a,this,options)===!1)return log("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[a,this,options,veto]),veto.veto)return log("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var q=$.param(a,traditional);qx&&(q=q?q+"&"+qx:qx),"GET"==options.type.toUpperCase()?(options.url+=(options.url.indexOf("?")>=0?"&":"?")+q,options.data=null):options.data=q;var callbacks=[];if(options.resetForm&&callbacks.push(function(){$form.resetForm()}),options.clearForm&&callbacks.push(function(){$form.clearForm(options.includeHidden)}),!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?"replaceWith":"html";$(options.target)[fn](data).each(oldSuccess,arguments)})}else options.success&&callbacks.push(options.success);if(options.success=function(data,status,xhr){for(var context=options.context||this,i=0,max=callbacks.length;i0,mp="multipart/form-data",multipart=$form.attr("enctype")==mp||$form.attr("encoding")==mp,fileAPI=feature.fileapi&&feature.formdata;log("fileAPI :"+fileAPI);var jqxhr,shouldUseFrame=(hasFileInputs||multipart)&&!fileAPI;options.iframe!==!1&&(options.iframe||shouldUseFrame)?options.closeKeepAlive?$.get(options.closeKeepAlive,function(){jqxhr=fileUploadIframe(a)}):jqxhr=fileUploadIframe(a):jqxhr=(hasFileInputs||multipart)&&fileAPI?fileUploadXhr(a):$.ajax(options),$form.removeData("jqxhr").data("jqxhr",jqxhr);for(var k=0;k=0){if(!opened)return self.show(e),e.preventDefault();var days=$("#"+css.weeks+" a"),el=$("."+css.focus),index=days.index(el);return el.removeClass(css.focus),74==key||40==key?index+=7:75==key||38==key?index-=7:76==key||39==key?index+=1:(72==key||37==key)&&(index-=1),index>41?(self.addMonth(),el=$("#"+css.weeks+" a:eq("+(index-42)+")")):0>index?(self.addMonth(-1),el=$("#"+css.weeks+" a:eq("+(index+42)+")")):el=days.eq(index),el.addClass(css.focus),e.preventDefault()}return 34==key?self.addMonth():33==key?self.addMonth(-1):36==key?self.today():(13==key&&($(e.target).is("select")||$("."+css.focus).click()),$([16,17,18,9]).index(key)>=0)}),$(document).on("click.d",function(e){var el=e.target;el.id==css.root||$(el).parents("#"+css.root).length||el==input[0]||trigger&&el==trigger[0]||self.hide(e)})}var trigger,pm,nm,currYear,currMonth,currDay,opened,original,self=this,now=new Date,yearNow=now.getFullYear(),css=conf.css,labels=LABELS[conf.lang],root=$("#"+css.root),title=root.find("#"+css.title),value=input.attr("data-value")||conf.value||input.val(),min=input.attr("min")||conf.min,max=input.attr("max")||conf.max;if(0===min&&(min="0"),value=parseDate(value)||now,min=parseDate(min||new Date(yearNow+conf.yearRange[0],1,1)),max=parseDate(max||new Date(yearNow+conf.yearRange[1]+1,1,-1)),!labels)throw"Dateinput: invalid language: "+conf.lang;if("date"==input.attr("type")){var original=input.clone(),def=original.wrap("
").parent().html(),clone=$(def.replace(/type/i,"type=text data-orig-type"));conf.value&&clone.val(conf.value),input.replaceWith(clone),input=clone}input.addClass(css.input);var fire=input.add(self);if(!root.length){if(root=$("
").hide().css({position:"absolute"}).attr("id",css.root),root.children().eq(0).attr("id",css.head).end().eq(1).attr("id",css.body).children().eq(0).attr("id",css.days).end().eq(1).attr("id",css.weeks).end().end().end().find("a").eq(0).attr("id",css.prev).end().eq(1).attr("id",css.next),title=root.find("#"+css.head).find("div").attr("id",css.title),conf.selectors){var monthSelector=$("").attr("id",css.year);title.html(monthSelector.add(yearSelector))}for(var days=root.find("#"+css.days),d=0;7>d;d++)days.append($("").text(labels.shortDays[(d+conf.firstDay)%7]));$("body").append(root)}conf.trigger&&(trigger=$("").attr("href","#").addClass(css.trigger).click(function(e){return conf.toggle?self.toggle():self.show(),e.preventDefault()}).insertAfter(input));var weeks=root.find("#"+css.weeks);yearSelector=root.find("#"+css.year),monthSelector=root.find("#"+css.month),$.extend(self,{show:function(e){if(!input.attr("disabled")&&!opened&&(e=e||$.Event(),e.type="onBeforeShow",fire.trigger(e),!e.isDefaultPrevented())){$.each(instances,function(){this.hide()}),opened=!0,monthSelector.off("change").change(function(){self.setValue(integer(yearSelector.val()),integer($(this).val()))}),yearSelector.off("change").change(function(){self.setValue(integer($(this).val()),integer(monthSelector.val()))}),pm=root.find("#"+css.prev).off("click").click(function(){return pm.hasClass(css.disabled)||self.addMonth(-1),!1}),nm=root.find("#"+css.next).off("click").click(function(){return nm.hasClass(css.disabled)||self.addMonth(),!1}),self.setValue(value);var pos=input.offset();return/iPad/i.test(navigator.userAgent)&&(pos.top-=$(window).scrollTop()),root.css({top:pos.top+input.outerHeight(!0)+conf.offset[0],left:pos.left+conf.offset[1]}),conf.speed?root.show(conf.speed,function(){onShow(e)}):(root.show(),onShow(e)),self}},setValue:function(year,month,day){var date=integer(month)>=-1?new Date(integer(year),integer(month),integer(day==undefined||isNaN(day)?1:day)):year||value;if(min>date?date=min:date>max&&(date=max),"string"==typeof year&&(date=parseDate(year)),year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),-1==month?(month=11,year--):12==month&&(month=0,year++),!opened)return select(date,conf),self;currMonth=month,currYear=year,currDay=day;var week,tmp=new Date(year,month,1-conf.firstDay),begin=tmp.getDay(),days=dayAm(year,month),prevDays=dayAm(year,month-1);if(conf.selectors){monthSelector.empty(),$.each(labels.months,function(i,m){minnew Date(year,i,0)&&monthSelector.append($(""),j%7===0&&(week=$("
").addClass(css.week),weeks.append(week)),begin>j?(a.addClass(css.off),num=prevDays-begin+j+1,date=new Date(year,month-1,num)):j>=begin+days?(a.addClass(css.off),num=j-days-begin+1,date=new Date(year,month+1,num)):(num=j-begin+1,date=new Date(year,month,num),isSameDay(value,date)?a.attr("id",css.current).addClass(css.focus):isSameDay(now,date)&&a.attr("id",css.today)),min&&min>date&&a.add(pm).addClass(css.disabled),max&&date>max&&a.add(nm).addClass(css.disabled),a.attr("href","#"+num).text(num).data("date",date),week.append(a);return weeks.find("a").click(function(e){var el=$(this);return el.hasClass(css.disabled)||($("#"+css.current).removeAttr("id"),el.attr("id",css.current),select(el.data("date"),conf,e)),!1}),css.sunday&&weeks.find("."+css.week).each(function(){var beg=conf.firstDay?7-conf.firstDay:0;$(this).children().slice(beg,beg+1).addClass(css.sunday)}),self},setMin:function(val,fit){return min=parseDate(val),fit&&min>value&&self.setValue(min),self},setMax:function(val,fit){return max=parseDate(val),fit&&value>max&&self.setValue(max),self},today:function(){return self.setValue(now)},addDay:function(amount){return this.setValue(currYear,currMonth,currDay+(amount||1))},addMonth:function(amount){var targetMonth=currMonth+(amount||1),daysInTargetMonth=dayAm(currYear,targetMonth),targetDay=daysInTargetMonth>=currDay?currDay:daysInTargetMonth;return this.setValue(currYear,targetMonth,targetDay)},addYear:function(amount){return this.setValue(currYear+(amount||1),currMonth,currDay)},destroy:function(){input.add(document).off("click.d keydown.d"),root.add(trigger).remove(),input.removeData("dateinput").removeClass(css.input),original&&input.replaceWith(original)},hide:function(e){if(opened){if(e=$.Event(),e.type="onHide",fire.trigger(e),e.isDefaultPrevented())return;$(document).off("click.d keydown.d"),root.hide(),opened=!1}return self},toggle:function(){return self.isOpen()?self.hide():self.show()},getConf:function(){return conf},getInput:function(){return input},getCalendar:function(){return root},getValue:function(dateFormat){return dateFormat?format(conf.formatter,value,dateFormat,conf.lang):value},isOpen:function(){return opened}}),$.each(["onBeforeShow","onShow","change","onHide"],function(i,name){$.isFunction(conf[name])&&$(self).on(name,conf[name]),self[name]=function(fn){return fn&&$(self).on(name,fn),self}}),conf.editable||input.on("focus.d click.d",self.show).keydown(function(e){var key=e.keyCode;return!opened&&$(KEYS).index(key)>=0?(self.show(e),e.preventDefault()):((8==key||46==key)&&input.val(""),e.shiftKey||e.ctrlKey||e.altKey||9==key?!0:e.preventDefault())}),parseDate(input.val())&&select(value,conf)}$.tools=$.tools||{version:"@VERSION"};var tool,instances=[],formatters={},KEYS=[75,76,38,39,74,72,40,37],LABELS={};tool=$.tools.dateinput={conf:{format:"mm/dd/yy",formatter:"default",selectors:!1,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:undefined,max:undefined,trigger:0,toggle:0,editable:0,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},addFormatter:function(name,fn){formatters[name]=fn},localize:function(language,labels){$.each(labels,function(key,val){labels[key]=val.split(",")}),LABELS[language]=labels}},tool.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var tmpTag=$("");tool.addFormatter("default",function(text,date,flags){return text.replace(/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,function($0){return $0 in flags?flags[$0]:$0})}),tool.addFormatter("prefixed",function(text,date,flags){return text.replace(/%(d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*')/g,function($0,$1){return $1 in flags?flags[$1]:$0})}),$.expr[":"].date=function(el){var type=el.getAttribute("type");return type&&"date"==type||!!$(el).data("dateinput")},$.fn.dateinput=function(conf){if(this.data("dateinput"))return this;conf=$.extend(!0,{},tool.conf,conf),$.each(conf.css,function(key,val){val||"prefix"==key||(conf.css[key]=(conf.css.prefix||"")+(val||key))});var els;return this.each(function(){var el=new Dateinput($(this),conf);instances.push(el);var input=el.getInput().data("dateinput",el);els=els?els.add(input):input}),els?els:this}}(jQuery); \ No newline at end of file +!function($,undefined){function dayAm(year,month){return new Date(year,month+1,0).getDate()}function zeropad(val,len){for(val=""+val,len=len||2;val.length=0){if(!opened)return self.show(e),e.preventDefault();var days=$("#"+css.weeks+" a"),el=$("."+css.focus),index=days.index(el);return el.removeClass(css.focus),74==key||40==key?index+=7:75==key||38==key?index-=7:76==key||39==key?index+=1:72!=key&&37!=key||(index-=1),index>41?(self.addMonth(),el=$("#"+css.weeks+" a:eq("+(index-42)+")")):index<0?(self.addMonth(-1),el=$("#"+css.weeks+" a:eq("+(index+42)+")")):el=days.eq(index),el.addClass(css.focus),e.preventDefault()}return 34==key?self.addMonth():33==key?self.addMonth(-1):36==key?self.today():(13==key&&($(e.target).is("select")||$("."+css.focus).click()),$([16,17,18,9]).index(key)>=0)}),$(document).on("click.d",function(e){var el=e.target;el.id==css.root||$(el).parents("#"+css.root).length||el==input[0]||trigger&&el==trigger[0]||self.hide(e)})}var trigger,pm,nm,currYear,currMonth,currDay,opened,original,self=this,now=new Date,yearNow=now.getFullYear(),css=conf.css,labels=LABELS[conf.lang],root=$("#"+css.root),title=root.find("#"+css.title),value=input.attr("data-value")||conf.value||input.val(),min=input.attr("min")||conf.min,max=input.attr("max")||conf.max;if(0===min&&(min="0"),value=parseDate(value)||now,min=parseDate(min||new Date(yearNow+conf.yearRange[0],0,1)),max=parseDate(max||new Date(yearNow+conf.yearRange[1]+1,0,0)),!labels)throw"Dateinput: invalid language: "+conf.lang;if("date"==input.attr("type")){var original=input.clone(),def=original.wrap("
").parent().html(),clone=$(def.replace(/type/i,"type=text data-orig-type"));conf.value&&clone.val(conf.value),input.replaceWith(clone),input=clone}input.addClass(css.input);var fire=input.add(self);if(!root.length){if(root=$("
").hide().css({position:"absolute"}).attr("id",css.root),root.children().eq(0).attr("id",css.head).end().eq(1).attr("id",css.body).children().eq(0).attr("id",css.days).end().eq(1).attr("id",css.weeks).end().end().end().find("a").eq(0).attr("id",css.prev).end().eq(1).attr("id",css.next),title=root.find("#"+css.head).find("div").attr("id",css.title),conf.selectors){var monthSelector=$("").attr("id",css.year);title.html(monthSelector.add(yearSelector))}for(var days=root.find("#"+css.days),d=0;d<7;d++)days.append($("").text(labels.shortDays[(d+conf.firstDay)%7]));$("body").append(root)}conf.trigger&&(trigger=$("").attr("href","#").addClass(css.trigger).click(function(e){return conf.toggle?self.toggle():self.show(),e.preventDefault()}).insertAfter(input));var weeks=root.find("#"+css.weeks);yearSelector=root.find("#"+css.year),monthSelector=root.find("#"+css.month),$.extend(self,{show:function(e){if(!input.attr("disabled")&&!opened&&(e=e||$.Event(),e.type="onBeforeShow",fire.trigger(e),!e.isDefaultPrevented())){$.each(instances,function(){this.hide()}),opened=!0,monthSelector.off("change").change(function(){self.setValue(integer(yearSelector.val()),integer($(this).val()))}),yearSelector.off("change").change(function(){self.setValue(integer($(this).val()),integer(monthSelector.val()))}),pm=root.find("#"+css.prev).off("click").click(function(e){return pm.hasClass(css.disabled)||self.addMonth(-1),!1}),nm=root.find("#"+css.next).off("click").click(function(e){return nm.hasClass(css.disabled)||self.addMonth(),!1}),self.setValue(value);var pos=input.offset();return/iPad/i.test(navigator.userAgent)&&(pos.top-=$(window).scrollTop()),root.css({top:pos.top+input.outerHeight(!0)+conf.offset[0],left:pos.left+conf.offset[1]}),conf.speed?root.show(conf.speed,function(){onShow(e)}):(root.show(),onShow(e)),self}},setValue:function(year,month,day){var date=integer(month)>=-1?new Date(integer(year),integer(month),integer(day==undefined||isNaN(day)?1:day)):year||value;if(datemax&&(date=max),"string"==typeof year&&(date=parseDate(year)),year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),month==-1?(month=11,year--):12==month&&(month=0,year++),!opened)return select(date,conf),self;currMonth=month,currYear=year,currDay=day;var week,tmp=new Date(year,month,1-conf.firstDay),begin=tmp.getDay(),days=dayAm(year,month),prevDays=dayAm(year,month-1);if(conf.selectors){monthSelector.empty(),$.each(labels.months,function(i,m){minnew Date(year,i,0)&&monthSelector.append($(""),j%7===0&&(week=$("
").addClass(css.week),weeks.append(week)),j=begin+days?(a.addClass(css.off),num=j-days-begin+1,date=new Date(year,month+1,num)):(num=j-begin+1,date=new Date(year,month,num),isSameDay(value,date)?a.attr("id",css.current).addClass(css.focus):isSameDay(now,date)&&a.attr("id",css.today)),min&&datemax&&a.add(nm).addClass(css.disabled),a.attr("href","#"+num).text(num).data("date",date),week.append(a);return weeks.find("a").click(function(e){var el=$(this);return el.hasClass(css.disabled)||($("#"+css.current).removeAttr("id"),el.attr("id",css.current),select(el.data("date"),conf,e)),!1}),css.sunday&&weeks.find("."+css.week).each(function(){var beg=conf.firstDay?7-conf.firstDay:0;$(this).children().slice(beg,beg+1).addClass(css.sunday)}),self},setMin:function(val,fit){return min=parseDate(val),fit&&valuemax&&self.setValue(max),self},today:function(){return self.setValue(now)},addDay:function(amount){return this.setValue(currYear,currMonth,currDay+(amount||1))},addMonth:function(amount){var targetMonth=currMonth+(amount||1),daysInTargetMonth=dayAm(currYear,targetMonth),targetDay=currDay<=daysInTargetMonth?currDay:daysInTargetMonth;return this.setValue(currYear,targetMonth,targetDay)},addYear:function(amount){return this.setValue(currYear+(amount||1),currMonth,currDay)},destroy:function(){input.add(document).off("click.d keydown.d"),root.add(trigger).remove(),input.removeData("dateinput").removeClass(css.input),original&&input.replaceWith(original)},hide:function(e){if(opened){if(e=$.Event(),e.type="onHide",fire.trigger(e),e.isDefaultPrevented())return;$(document).off("click.d keydown.d"),root.hide(),opened=!1}return self},toggle:function(){return self.isOpen()?self.hide():self.show()},getConf:function(){return conf},getInput:function(){return input},getCalendar:function(){return root},getValue:function(dateFormat){return dateFormat?format(conf.formatter,value,dateFormat,conf.lang):value},isOpen:function(){return opened}}),$.each(["onBeforeShow","onShow","change","onHide"],function(i,name){$.isFunction(conf[name])&&$(self).on(name,conf[name]),self[name]=function(fn){return fn&&$(self).on(name,fn),self}}),conf.editable||input.on("focus.d click.d",self.show).keydown(function(e){var key=e.keyCode;return!opened&&$(KEYS).index(key)>=0?(self.show(e),e.preventDefault()):(8!=key&&46!=key||input.val(""),!!(e.shiftKey||e.ctrlKey||e.altKey||9==key)||e.preventDefault())}),parseDate(input.val())&&select(value,conf)}$.tools=$.tools||{version:"@VERSION"};var tool,instances=[],formatters={},KEYS=[75,76,38,39,74,72,40,37],LABELS={};tool=$.tools.dateinput={conf:{format:"mm/dd/yy",formatter:"default",selectors:!1,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:undefined,max:undefined,trigger:0,toggle:0,editable:0,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},addFormatter:function(name,fn){formatters[name]=fn},localize:function(language,labels){$.each(labels,function(key,val){labels[key]=val.split(",")}),LABELS[language]=labels}},tool.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var tmpTag=$("");tool.addFormatter("default",function(text,date,flags,lang){return text.replace(/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,function($0){return $0 in flags?flags[$0]:$0})}),tool.addFormatter("prefixed",function(text,date,flags,lang){return text.replace(/%(d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*')/g,function($0,$1){return $1 in flags?flags[$1]:$0})}),$.expr[":"].date=function(el){var type=el.getAttribute("type");return type&&"date"==type||!!$(el).data("dateinput")},$.fn.dateinput=function(conf){if(this.data("dateinput"))return this;conf=$.extend(!0,{},tool.conf,conf),$.each(conf.css,function(key,val){val||"prefix"==key||(conf.css[key]=(conf.css.prefix||"")+(val||key))});var els;return this.each(function(){var el=new Dateinput($(this),conf);instances.push(el);var input=el.getInput().data("dateinput",el);els=els?els.add(input):input}),els?els:this}}(jQuery); \ No newline at end of file diff --git a/plone/app/jquerytools/browser/jquery.tools.min.js b/plone/app/jquerytools/browser/jquery.tools.min.js index b1d3242..7e5d60b 100644 --- a/plone/app/jquerytools/browser/jquery.tools.min.js +++ b/plone/app/jquerytools/browser/jquery.tools.min.js @@ -1 +1 @@ -!function($){function Overlay(trigger,conf){var closers,overlay,opened,self=this,fire=trigger.add(self),w=$(window),maskConf=$.tools.expose&&(conf.mask||conf.expose),uid=Math.random().toString().slice(10);maskConf&&("string"==typeof maskConf&&(maskConf={color:maskConf}),maskConf.closeOnClick=maskConf.closeOnEsc=!1);var jq=conf.target||trigger.attr("rel");if(overlay=jq?$(jq):null||trigger,!overlay.length)throw"Could not find Overlay: "+jq;trigger&&-1==trigger.index(overlay)&&trigger.click(function(e){return self.load(e),e.preventDefault()}),$.extend(self,{load:function(e){if(self.isOpened())return self;var eff=effects[conf.effect];if(!eff)throw'Overlay: cannot find effect : "'+conf.effect+'"';if(conf.oneInstance&&$.each(instances,function(){this.close(e)}),e=e||$.Event(),e.type="onBeforeLoad",fire.trigger(e),e.isDefaultPrevented())return self;opened=!0,maskConf&&$(overlay).expose(maskConf);var top=conf.top,left=conf.left,oWidth=overlay.outerWidth(!0),oHeight=overlay.outerHeight(!0);return"string"==typeof top&&(top="center"==top?Math.max((w.height()-oHeight)/2,0):parseInt(top,10)/100*w.height()),"center"==left&&(left=Math.max((w.width()-oWidth)/2,0)),eff[0].call(self,{top:top,left:left},function(){opened&&(e.type="onLoad",fire.trigger(e))}),maskConf&&conf.closeOnClick&&$.mask.getMask().one("click",self.close),conf.closeOnClick&&$(document).on("click."+uid,function(e){$(e.target).parents(overlay).length||self.close(e)}),conf.closeOnEsc&&$(document).on("keydown."+uid,function(e){27==e.keyCode&&self.close(e)}),self},close:function(e){return self.isOpened()?(e=e||$.Event(),e.type="onBeforeClose",fire.trigger(e),e.isDefaultPrevented()?void 0:(opened=!1,effects[conf.effect][1].call(self,function(){e.type="onClose",fire.trigger(e)}),$(document).off("click."+uid+" keydown."+uid),maskConf&&$.mask.close(),self)):self},getOverlay:function(){return overlay},getTrigger:function(){return trigger},getClosers:function(){return closers},isOpened:function(){return opened},getConf:function(){return conf}}),$.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(i,name){$.isFunction(conf[name])&&$(self).on(name,conf[name]),self[name]=function(fn){return fn&&$(self).on(name,fn),self}}),closers=overlay.find(conf.close||".close"),closers.length||conf.close||(closers=$(''),overlay.prepend(closers)),closers.click(function(e){self.close(e)}),conf.load&&self.load()}$.tools=$.tools||{version:"@VERSION"},$.tools.overlay={addEffect:function(name,loadFn,closeFn){effects[name]=[loadFn,closeFn]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!/msie/.test(navigator.userAgent.toLowerCase())||navigator.appVersion>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var instances=[],effects={};$.tools.overlay.addEffect("default",function(pos,onLoad){var conf=this.getConf(),w=$(window);conf.fixed||(pos.top+=w.scrollTop(),pos.left+=w.scrollLeft()),pos.position=conf.fixed?"fixed":"absolute",this.getOverlay().css(pos).fadeIn(conf.speed,onLoad)},function(onClose){this.getOverlay().fadeOut(this.getConf().closeSpeed,onClose)}),$.fn.overlay=function(conf){var el=this.data("overlay");return el?el:($.isFunction(conf)&&(conf={onBeforeLoad:conf}),conf=$.extend(!0,{},$.tools.overlay.conf,conf),this.each(function(){el=new Overlay($(this),conf),instances.push(el),$(this).data("overlay",el)}),conf.api?el:this)}}(jQuery),function($){function find(root,query){var el=$(query);return el.length<2?el:root.parent().find(query)}function Scrollable(root,conf){var self=this,fire=root.add(self),itemWrap=root.children(),index=0,vertical=conf.vertical;if(current||(current=self),itemWrap.length>1&&(itemWrap=$(conf.items,root)),conf.size>1&&(conf.circular=!1),$.extend(self,{getConf:function(){return conf},getIndex:function(){return index},getSize:function(){return self.getItems().size()},getNaviButtons:function(){return prev.add(next)},getRoot:function(){return root},getItemWrap:function(){return itemWrap},getItems:function(){return itemWrap.find(conf.item).not("."+conf.clonedClass)},move:function(offset,time){return self.seekTo(index+offset,time)},next:function(time){return self.move(conf.size,time)},prev:function(time){return self.move(-conf.size,time)},begin:function(time){return self.seekTo(0,time)},end:function(time){return self.seekTo(self.getSize()-1,time)},focus:function(){return current=self,self},addItem:function(item){return item=$(item),conf.circular?(itemWrap.children().last().before(item),itemWrap.children().first().replaceWith(item.clone().addClass(conf.clonedClass))):(itemWrap.append(item),next.removeClass("disabled")),fire.trigger("onAddItem",[item]),self},seekTo:function(i,time,fn){if(i.jquery||(i*=1),conf.circular&&0===i&&-1==index&&0!==time)return self;if(!conf.circular&&0>i||i>self.getSize()||-1>i)return self;var item=i;i.jquery?i=self.getItems().index(i):item=self.getItems().eq(i);var e=$.Event("onBeforeSeek");if(!fn&&(fire.trigger(e,[i,time]),e.isDefaultPrevented()||!item.length))return self;var props=vertical?{top:-item.position().top}:{left:-item.position().left};return index=i,current=self,void 0===time&&(time=conf.speed),itemWrap.animate(props,time,conf.easing,fn||function(){fire.trigger("onSeek",[i])}),self}}),$.each(["onBeforeSeek","onSeek","onAddItem"],function(i,name){$.isFunction(conf[name])&&$(self).on(name,conf[name]),self[name]=function(fn){return fn&&$(self).on(name,fn),self}}),conf.circular){var cloned1=self.getItems().slice(-1).clone().prependTo(itemWrap),cloned2=self.getItems().eq(1).clone().appendTo(itemWrap);cloned1.add(cloned2).addClass(conf.clonedClass),self.onBeforeSeek(function(e,i,time){return e.isDefaultPrevented()?void 0:-1==i?(self.seekTo(cloned1,time,function(){self.end(0)}),e.preventDefault()):void(i==self.getSize()&&self.seekTo(cloned2,time,function(){self.begin(0)}))});var hidden_parents=root.parents().add(root).filter(function(){return"none"===$(this).css("display")?!0:void 0});hidden_parents.length?(hidden_parents.show(),self.seekTo(0,0,function(){}),hidden_parents.hide()):self.seekTo(0,0,function(){})}var prev=find(root,conf.prev).click(function(e){e.stopPropagation(),self.prev()}),next=find(root,conf.next).click(function(e){e.stopPropagation(),self.next()});if(conf.circular||(self.onBeforeSeek(function(e,i){setTimeout(function(){e.isDefaultPrevented()||(prev.toggleClass(conf.disabledClass,0>=i),next.toggleClass(conf.disabledClass,i>=self.getSize()-1))},1)}),conf.initialIndex||prev.addClass(conf.disabledClass)),self.getSize()<2&&prev.add(next).addClass(conf.disabledClass),conf.mousewheel&&$.fn.mousewheel&&root.mousewheel(function(e,delta){return conf.mousewheel?(self.move(0>delta?1:-1,conf.wheelSpeed||50),!1):void 0}),conf.touch){var touch={};itemWrap[0].ontouchstart=function(e){var t=e.touches[0];touch.x=t.clientX,touch.y=t.clientY},itemWrap[0].ontouchmove=function(e){if(1==e.touches.length&&!itemWrap.is(":animated")){var t=e.touches[0],deltaX=touch.x-t.clientX,deltaY=touch.y-t.clientY;self[vertical&&deltaY>0||!vertical&&deltaX>0?"next":"prev"](),e.preventDefault()}}}conf.keyboard&&$(document).on("keydown.scrollable",function(evt){if(!(!conf.keyboard||evt.altKey||evt.ctrlKey||evt.metaKey||$(evt.target).is(":input")||"static"!=conf.keyboard&¤t!=self)){var key=evt.keyCode;return!vertical||38!=key&&40!=key?vertical||37!=key&&39!=key?void 0:(self.move(37==key?-1:1),evt.preventDefault()):(self.move(38==key?-1:1),evt.preventDefault())}}),conf.initialIndex&&self.seekTo(conf.initialIndex,0,function(){})}$.tools=$.tools||{version:"@VERSION"},$.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};var current;$.fn.scrollable=function(conf){var el=this.data("scrollable");return el?el:(conf=$.extend({},$.tools.scrollable.conf,conf),this.each(function(){el=new Scrollable($(this),conf),$(this).data("scrollable",el)}),conf.api?el:this)}}(jQuery),function($){function Tabs(root,paneSelector,conf){var current,self=this,trigger=root.add(this),tabs=root.find(conf.tabs),panes=paneSelector.jquery?paneSelector:root.children(paneSelector);tabs.length||(tabs=root.children()),panes.length||(panes=root.parent().find(paneSelector)),panes.length||(panes=$(paneSelector)),$.extend(this,{click:function(i,e){var tab=tabs.eq(i),firstRender=!root.data("tabs");if("string"==typeof i&&i.replace("#","")&&(tab=tabs.filter('[href*="'+i.replace("#","")+'"]'),i=Math.max(tabs.index(tab),0)),conf.rotate){var last=tabs.length-1;if(0>i)return self.click(last,e);if(i>last)return self.click(0,e)}if(!tab.length){if(current>=0)return self;i=conf.initialIndex,tab=tabs.eq(i)}if(i===current)return self;if(e=e||$.Event(),e.type="onBeforeClick",trigger.trigger(e,[i]),!e.isDefaultPrevented()){var effect=firstRender?conf.initialEffect&&conf.effect||"default":conf.effect;return effects[effect].call(self,i,function(){current=i,e.type="onClick",trigger.trigger(e,[i])}),tabs.removeClass(conf.current),tab.addClass(conf.current),self}},getConf:function(){return conf},getTabs:function(){return tabs},getPanes:function(){return panes},getCurrentPane:function(){return panes.eq(current)},getCurrentTab:function(){return tabs.eq(current)},getIndex:function(){return current},next:function(){return self.click(current+1)},prev:function(){return self.click(current-1)},destroy:function(){return tabs.off(conf.event).removeClass(conf.current),panes.find('a[href^="#"]').off("click.T"),self}}),$.each("onBeforeClick,onClick".split(","),function(i,name){$.isFunction(conf[name])&&$(self).on(name,conf[name]),self[name]=function(fn){return fn&&$(self).on(name,fn),self}}),conf.history&&$.fn.history&&($.tools.history.init(tabs),conf.event="history"),tabs.each(function(i){$(this).on(conf.event,function(e){return self.click(i,e),e.preventDefault()})}),panes.find('a[href^="#"]').on("click.T",function(e){self.click($(this).attr("href"),e)}),location.hash&&"a"==conf.tabs&&root.find('[href="'+location.hash+'"]').length?self.click(location.hash):(0===conf.initialIndex||conf.initialIndex>0)&&self.click(conf.initialIndex)}$.tools=$.tools||{version:"@VERSION"},$.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(name,fn){effects[name]=fn}};var animating,w,effects={"default":function(i,done){this.getPanes().hide().eq(i).show(),done.call()},fade:function(i,done){var conf=this.getConf(),speed=conf.fadeOutSpeed,panes=this.getPanes();speed?panes.fadeOut(speed):panes.hide(),panes.eq(i).fadeIn(conf.fadeInSpeed,done)},slide:function(i,done){var conf=this.getConf();this.getPanes().slideUp(conf.slideUpSpeed),this.getPanes().eq(i).slideDown(conf.slideDownSpeed,done)},ajax:function(i,done){this.getPanes().eq(0).load(this.getTabs().eq(i).attr("href"),done)}};$.tools.tabs.addEffect("horizontal",function(i,done){if(!animating){var nextPane=this.getPanes().eq(i),currentPane=this.getCurrentPane();w||(w=this.getPanes().eq(0).width()),animating=!0,nextPane.show(),currentPane.animate({width:0},{step:function(now){nextPane.css("width",w-now)},complete:function(){$(this).hide(),done.call(),animating=!1}}),currentPane.length||(done.call(),animating=!1)}}),$.fn.tabs=function(paneSelector,conf){var el=this.data("tabs");return el&&(el.destroy(),this.removeData("tabs")),$.isFunction(conf)&&(conf={onBeforeClick:conf}),conf=$.extend({},$.tools.tabs.conf,conf),this.each(function(){el=new Tabs($(this),paneSelector,conf),$(this).data("tabs",el)}),conf.api?el:this}}(jQuery),function($){function setIframeLocation(h){if(h){var doc=iframe.contentWindow.document;doc.open().close(),doc.location.hash=h}}var hash,iframe,links,inited;$.tools=$.tools||{version:"@VERSION"},$.tools.history={init:function(els){inited||($.browser.msie&&$.browser.version<"8"?iframe||(iframe=$("