mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-29 11:48:52 +00:00
1419 lines
146 KiB
Text
1419 lines
146 KiB
Text
![]() |
/*!
|
||
|
* domready (c) Dustin Diaz 2014 - License MIT
|
||
|
*/
|
||
|
!function(e,t){typeof module!="undefined"?module.exports=t():typeof define=="function"&&typeof define.amd=="object"?define(t):this[e]=t()}("domready",function(){var e=[],t,n=document,r=n.documentElement.doScroll,i="DOMContentLoaded",s=(r?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return s||n.addEventListener(i,t=function(){n.removeEventListener(i,t),s=1;while(t=e.shift())t()}),function(t){s?setTimeout(t,0):e.push(t)}});
|
||
|
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||
|
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*
|
||
|
a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Z,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")
|
||
|
null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.
|
||
|
;
|
||
|
/*!
|
||
|
* jQuery Once v2.2.0 - http://github.com/robloach/jquery-once
|
||
|
* @license MIT, GPL-2.0
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
* http://opensource.org/licenses/GPL-2.0
|
||
|
*/
|
||
|
(function(e){"use strict";if(typeof exports==="object"){e(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){"use strict";var n=function(e){e=e||"once";if(typeof e!=="string"){throw new TypeError("The jQuery Once id parameter must be a string")}return e};e.fn.once=function(t){var r="jquery-once-"+n(t);return this.filter(function(){return e(this).data(r)!==true}).data(r,true)};e.fn.removeOnce=function(e){return this.findOnce(e).removeData("jquery-once-"+n(e))};e.fn.findOnce=function(t){var r="jquery-once-"+n(t);return this.filter(function(){return e(this).data(r)===true})}});
|
||
|
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function () {
|
||
|
var settingsElement = document.querySelector('head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"]');
|
||
|
|
||
|
window.drupalSettings = {};
|
||
|
|
||
|
if (settingsElement !== null) {
|
||
|
window.drupalSettings = JSON.parse(settingsElement.textContent);
|
||
|
}
|
||
|
})();;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
window.Drupal = { behaviors: {}, locale: {} };
|
||
|
|
||
|
(function (Drupal, drupalSettings, drupalTranslations) {
|
||
|
Drupal.throwError = function (error) {
|
||
|
setTimeout(function () {
|
||
|
throw error;
|
||
|
}, 0);
|
||
|
};
|
||
|
|
||
|
Drupal.attachBehaviors = function (context, settings) {
|
||
|
context = context || document;
|
||
|
settings = settings || drupalSettings;
|
||
|
var behaviors = Drupal.behaviors;
|
||
|
|
||
|
Object.keys(behaviors || {}).forEach(function (i) {
|
||
|
if (typeof behaviors[i].attach === 'function') {
|
||
|
try {
|
||
|
behaviors[i].attach(context, settings);
|
||
|
} catch (e) {
|
||
|
Drupal.throwError(e);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
Drupal.detachBehaviors = function (context, settings, trigger) {
|
||
|
context = context || document;
|
||
|
settings = settings || drupalSettings;
|
||
|
trigger = trigger || 'unload';
|
||
|
var behaviors = Drupal.behaviors;
|
||
|
|
||
|
Object.keys(behaviors || {}).forEach(function (i) {
|
||
|
if (typeof behaviors[i].detach === 'function') {
|
||
|
try {
|
||
|
behaviors[i].detach(context, settings, trigger);
|
||
|
} catch (e) {
|
||
|
Drupal.throwError(e);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
Drupal.checkPlain = function (str) {
|
||
|
str = str.toString().replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||
|
return str;
|
||
|
};
|
||
|
|
||
|
Drupal.formatString = function (str, args) {
|
||
|
var processedArgs = {};
|
||
|
|
||
|
Object.keys(args || {}).forEach(function (key) {
|
||
|
switch (key.charAt(0)) {
|
||
|
case '@':
|
||
|
processedArgs[key] = Drupal.checkPlain(args[key]);
|
||
|
break;
|
||
|
|
||
|
case '!':
|
||
|
processedArgs[key] = args[key];
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
processedArgs[key] = Drupal.theme('placeholder', args[key]);
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
return Drupal.stringReplace(str, processedArgs, null);
|
||
|
};
|
||
|
|
||
|
Drupal.stringReplace = function (str, args, keys) {
|
||
|
if (str.length === 0) {
|
||
|
return str;
|
||
|
}
|
||
|
|
||
|
if (!Array.isArray(keys)) {
|
||
|
keys = Object.keys(args || {});
|
||
|
|
||
|
keys.sort(function (a, b) {
|
||
|
return a.length - b.length;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (keys.length === 0) {
|
||
|
return str;
|
||
|
}
|
||
|
|
||
|
var key = keys.pop();
|
||
|
var fragments = str.split(key);
|
||
|
|
||
|
if (keys.length) {
|
||
|
for (var i = 0; i < fragments.length; i++) {
|
||
|
fragments[i] = Drupal.stringReplace(fragments[i], args, keys.slice(0));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return fragments.join(args[key]);
|
||
|
};
|
||
|
|
||
|
Drupal.t = function (str, args, options) {
|
||
|
options = options || {};
|
||
|
options.context = options.context || '';
|
||
|
|
||
|
if (typeof drupalTranslations !== 'undefined' && drupalTranslations.strings && drupalTranslations.strings[options.context] && drupalTranslations.strings[options.context][str]) {
|
||
|
str = drupalTranslations.strings[options.context][str];
|
||
|
}
|
||
|
|
||
|
if (args) {
|
||
|
str = Drupal.formatString(str, args);
|
||
|
}
|
||
|
return str;
|
||
|
};
|
||
|
|
||
|
Drupal.url = function (path) {
|
||
|
return drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix + path;
|
||
|
};
|
||
|
|
||
|
Drupal.url.toAbsolute = function (url) {
|
||
|
var urlParsingNode = document.createElement('a');
|
||
|
|
||
|
try {
|
||
|
url = decodeURIComponent(url);
|
||
|
} catch (e) {}
|
||
|
|
||
|
urlParsingNode.setAttribute('href', url);
|
||
|
|
||
|
return urlParsingNode.cloneNode(false).href;
|
||
|
};
|
||
|
|
||
|
Drupal.url.isLocal = function (url) {
|
||
|
var absoluteUrl = Drupal.url.toAbsolute(url);
|
||
|
var protocol = location.protocol;
|
||
|
|
||
|
if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) {
|
||
|
protocol = 'https:';
|
||
|
}
|
||
|
var baseUrl = protocol + '//' + location.host + drupalSettings.path.baseUrl.slice(0, -1);
|
||
|
|
||
|
try {
|
||
|
absoluteUrl = decodeURIComponent(absoluteUrl);
|
||
|
} catch (e) {}
|
||
|
try {
|
||
|
baseUrl = decodeURIComponent(baseUrl);
|
||
|
} catch (e) {}
|
||
|
|
||
|
return absoluteUrl === baseUrl || absoluteUrl.indexOf(baseUrl + '/') === 0;
|
||
|
};
|
||
|
|
||
|
Drupal.formatPlural = function (count, singular, plural, args, options) {
|
||
|
args = args || {};
|
||
|
args['@count'] = count;
|
||
|
|
||
|
var pluralDelimiter = drupalSettings.pluralDelimiter;
|
||
|
var translations = Drupal.t(singular + pluralDelimiter + plural, args, options).split(pluralDelimiter);
|
||
|
var index = 0;
|
||
|
|
||
|
if (typeof drupalTranslations !== 'undefined' && drupalTranslations.pluralFormula) {
|
||
|
index = count in drupalTranslations.pluralFormula ? drupalTranslations.pluralFormula[count] : drupalTranslations.pluralFormula.default;
|
||
|
} else if (args['@count'] !== 1) {
|
||
|
index = 1;
|
||
|
}
|
||
|
|
||
|
return translations[index];
|
||
|
};
|
||
|
|
||
|
Drupal.encodePath = function (item) {
|
||
|
return window.encodeURIComponent(item).replace(/%2F/g, '/');
|
||
|
};
|
||
|
|
||
|
Drupal.theme = function (func) {
|
||
|
if (func in Drupal.theme) {
|
||
|
var _Drupal$theme;
|
||
|
|
||
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||
|
args[_key - 1] = arguments[_key];
|
||
|
}
|
||
|
|
||
|
return (_Drupal$theme = Drupal.theme)[func].apply(_Drupal$theme, args);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.theme.placeholder = function (str) {
|
||
|
return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>';
|
||
|
};
|
||
|
})(Drupal, window.drupalSettings, window.drupalTranslations);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
if (window.jQuery) {
|
||
|
jQuery.noConflict();
|
||
|
}
|
||
|
|
||
|
document.documentElement.className += ' js';
|
||
|
|
||
|
(function (domready, Drupal, drupalSettings) {
|
||
|
domready(function () {
|
||
|
Drupal.attachBehaviors(document, drupalSettings);
|
||
|
});
|
||
|
})(domready, Drupal, window.drupalSettings);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
Drupal.debounce = function (func, wait, immediate) {
|
||
|
var timeout = void 0;
|
||
|
var result = void 0;
|
||
|
return function () {
|
||
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||
|
args[_key] = arguments[_key];
|
||
|
}
|
||
|
|
||
|
var context = this;
|
||
|
var later = function later() {
|
||
|
timeout = null;
|
||
|
if (!immediate) {
|
||
|
result = func.apply(context, args);
|
||
|
}
|
||
|
};
|
||
|
var callNow = immediate && !timeout;
|
||
|
clearTimeout(timeout);
|
||
|
timeout = setTimeout(later, wait);
|
||
|
if (callNow) {
|
||
|
result = func.apply(context, args);
|
||
|
}
|
||
|
return result;
|
||
|
};
|
||
|
};;
|
||
|
/*! jquery.cookie v1.4.1 | MIT */
|
||
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Drupal, debounce) {
|
||
|
$.fn.drupalGetSummary = function () {
|
||
|
var callback = this.data('summaryCallback');
|
||
|
return this[0] && callback ? $.trim(callback(this[0])) : '';
|
||
|
};
|
||
|
|
||
|
$.fn.drupalSetSummary = function (callback) {
|
||
|
var self = this;
|
||
|
|
||
|
if (typeof callback !== 'function') {
|
||
|
var val = callback;
|
||
|
callback = function callback() {
|
||
|
return val;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return this.data('summaryCallback', callback).off('formUpdated.summary').on('formUpdated.summary', function () {
|
||
|
self.trigger('summaryUpdated');
|
||
|
}).trigger('summaryUpdated');
|
||
|
};
|
||
|
|
||
|
Drupal.behaviors.formSingleSubmit = {
|
||
|
attach: function attach() {
|
||
|
function onFormSubmit(e) {
|
||
|
var $form = $(e.currentTarget);
|
||
|
var formValues = $form.serialize();
|
||
|
var previousValues = $form.attr('data-drupal-form-submit-last');
|
||
|
if (previousValues === formValues) {
|
||
|
e.preventDefault();
|
||
|
} else {
|
||
|
$form.attr('data-drupal-form-submit-last', formValues);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$('body').once('form-single-submit').on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function triggerFormUpdated(element) {
|
||
|
$(element).trigger('formUpdated');
|
||
|
}
|
||
|
|
||
|
function fieldsList(form) {
|
||
|
var $fieldList = $(form).find('[name]').map(function (index, element) {
|
||
|
return element.getAttribute('id');
|
||
|
});
|
||
|
|
||
|
return $.makeArray($fieldList);
|
||
|
}
|
||
|
|
||
|
Drupal.behaviors.formUpdated = {
|
||
|
attach: function attach(context) {
|
||
|
var $context = $(context);
|
||
|
var contextIsForm = $context.is('form');
|
||
|
var $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated');
|
||
|
var formFields = void 0;
|
||
|
|
||
|
if ($forms.length) {
|
||
|
$.makeArray($forms).forEach(function (form) {
|
||
|
var events = 'change.formUpdated input.formUpdated ';
|
||
|
var eventHandler = debounce(function (event) {
|
||
|
triggerFormUpdated(event.target);
|
||
|
}, 300);
|
||
|
formFields = fieldsList(form).join(',');
|
||
|
|
||
|
form.setAttribute('data-drupal-form-fields', formFields);
|
||
|
$(form).on(events, eventHandler);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (contextIsForm) {
|
||
|
formFields = fieldsList(context).join(',');
|
||
|
|
||
|
var currentFields = $(context).attr('data-drupal-form-fields');
|
||
|
|
||
|
if (formFields !== currentFields) {
|
||
|
triggerFormUpdated(context);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
detach: function detach(context, settings, trigger) {
|
||
|
var $context = $(context);
|
||
|
var contextIsForm = $context.is('form');
|
||
|
if (trigger === 'unload') {
|
||
|
var $forms = (contextIsForm ? $context : $context.find('form')).removeOnce('form-updated');
|
||
|
if ($forms.length) {
|
||
|
$.makeArray($forms).forEach(function (form) {
|
||
|
form.removeAttribute('data-drupal-form-fields');
|
||
|
$(form).off('.formUpdated');
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.behaviors.fillUserInfoFromBrowser = {
|
||
|
attach: function attach(context, settings) {
|
||
|
var userInfo = ['name', 'mail', 'homepage'];
|
||
|
var $forms = $('[data-user-info-from-browser]').once('user-info-from-browser');
|
||
|
if ($forms.length) {
|
||
|
userInfo.forEach(function (info) {
|
||
|
var $element = $forms.find('[name=' + info + ']');
|
||
|
var browserData = localStorage.getItem('Drupal.visitor.' + info);
|
||
|
var emptyOrDefault = $element.val() === '' || $element.attr('data-drupal-default-value') === $element.val();
|
||
|
if ($element.length && emptyOrDefault && browserData) {
|
||
|
$element.val(browserData);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
$forms.on('submit', function () {
|
||
|
userInfo.forEach(function (info) {
|
||
|
var $element = $forms.find('[name=' + info + ']');
|
||
|
if ($element.length) {
|
||
|
localStorage.setItem('Drupal.visitor.' + info, $element.val());
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e) {
|
||
|
var url = void 0;
|
||
|
if (e.type === 'click') {
|
||
|
url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget;
|
||
|
} else {
|
||
|
url = location;
|
||
|
}
|
||
|
var hash = url.hash.substr(1);
|
||
|
if (hash) {
|
||
|
var $target = $('#' + hash);
|
||
|
$('body').trigger('formFragmentLinkClickOrHashChange', [$target]);
|
||
|
|
||
|
setTimeout(function () {
|
||
|
return $target.trigger('focus');
|
||
|
}, 300);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var debouncedHandleFragmentLinkClickOrHashChange = debounce(handleFragmentLinkClickOrHashChange, 300, true);
|
||
|
|
||
|
$(window).on('hashchange.form-fragment', debouncedHandleFragmentLinkClickOrHashChange);
|
||
|
|
||
|
$(document).on('click.form-fragment', 'a[href*="#"]', debouncedHandleFragmentLinkClickOrHashChange);
|
||
|
})(jQuery, Drupal, Drupal.debounce);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Drupal) {
|
||
|
Drupal.behaviors.setTimezone = {
|
||
|
attach: function attach(context, settings) {
|
||
|
var $timezone = $(context).find('.timezone-detect').once('timezone');
|
||
|
if ($timezone.length) {
|
||
|
var dateString = Date();
|
||
|
|
||
|
var matches = dateString.match(/\(([A-Z]{3,5})\)/);
|
||
|
var abbreviation = matches ? matches[1] : 0;
|
||
|
|
||
|
var dateNow = new Date();
|
||
|
var offsetNow = dateNow.getTimezoneOffset() * -60;
|
||
|
|
||
|
var dateJan = new Date(dateNow.getFullYear(), 0, 1, 12, 0, 0, 0);
|
||
|
var dateJul = new Date(dateNow.getFullYear(), 6, 1, 12, 0, 0, 0);
|
||
|
var offsetJan = dateJan.getTimezoneOffset() * -60;
|
||
|
var offsetJul = dateJul.getTimezoneOffset() * -60;
|
||
|
|
||
|
var isDaylightSavingTime = void 0;
|
||
|
|
||
|
if (offsetJan === offsetJul) {
|
||
|
isDaylightSavingTime = '';
|
||
|
} else if (Math.max(offsetJan, offsetJul) === offsetNow) {
|
||
|
isDaylightSavingTime = 1;
|
||
|
} else {
|
||
|
isDaylightSavingTime = 0;
|
||
|
}
|
||
|
|
||
|
var path = 'system/timezone/' + abbreviation + '/' + offsetNow + '/' + isDaylightSavingTime;
|
||
|
$.ajax({
|
||
|
async: false,
|
||
|
url: Drupal.url(path),
|
||
|
data: { date: dateString },
|
||
|
dataType: 'json',
|
||
|
success: function success(data) {
|
||
|
if (data) {
|
||
|
$timezone.val(data);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
})(jQuery, Drupal);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Drupal) {
|
||
|
Drupal.behaviors.detailsAria = {
|
||
|
attach: function attach() {
|
||
|
$('body').once('detailsAria').on('click.detailsAria', 'summary', function (event) {
|
||
|
var $summary = $(event.currentTarget);
|
||
|
var open = $(event.currentTarget.parentNode).attr('open') === 'open' ? 'false' : 'true';
|
||
|
|
||
|
$summary.attr({
|
||
|
'aria-expanded': open,
|
||
|
'aria-pressed': open
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
})(jQuery, Drupal);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Modernizr, Drupal) {
|
||
|
function CollapsibleDetails(node) {
|
||
|
this.$node = $(node);
|
||
|
this.$node.data('details', this);
|
||
|
|
||
|
var anchor = location.hash && location.hash !== '#' ? ', ' + location.hash : '';
|
||
|
if (this.$node.find('.error' + anchor).length) {
|
||
|
this.$node.attr('open', true);
|
||
|
}
|
||
|
|
||
|
this.setupSummary();
|
||
|
|
||
|
this.setupLegend();
|
||
|
}
|
||
|
|
||
|
$.extend(CollapsibleDetails, {
|
||
|
instances: []
|
||
|
});
|
||
|
|
||
|
$.extend(CollapsibleDetails.prototype, {
|
||
|
setupSummary: function setupSummary() {
|
||
|
this.$summary = $('<span class="summary"></span>');
|
||
|
this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated');
|
||
|
},
|
||
|
setupLegend: function setupLegend() {
|
||
|
var $legend = this.$node.find('> summary');
|
||
|
|
||
|
$('<span class="details-summary-prefix visually-hidden"></span>').append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show')).prependTo($legend).after(document.createTextNode(' '));
|
||
|
|
||
|
$('<a class="details-title"></a>').attr('href', '#' + this.$node.attr('id')).prepend($legend.contents()).appendTo($legend);
|
||
|
|
||
|
$legend.append(this.$summary).on('click', $.proxy(this.onLegendClick, this));
|
||
|
},
|
||
|
onLegendClick: function onLegendClick(e) {
|
||
|
this.toggle();
|
||
|
e.preventDefault();
|
||
|
},
|
||
|
onSummaryUpdated: function onSummaryUpdated() {
|
||
|
var text = $.trim(this.$node.drupalGetSummary());
|
||
|
this.$summary.html(text ? ' (' + text + ')' : '');
|
||
|
},
|
||
|
toggle: function toggle() {
|
||
|
var _this = this;
|
||
|
|
||
|
var isOpen = !!this.$node.attr('open');
|
||
|
var $summaryPrefix = this.$node.find('> summary span.details-summary-prefix');
|
||
|
if (isOpen) {
|
||
|
$summaryPrefix.html(Drupal.t('Show'));
|
||
|
} else {
|
||
|
$summaryPrefix.html(Drupal.t('Hide'));
|
||
|
}
|
||
|
|
||
|
setTimeout(function () {
|
||
|
_this.$node.attr('open', !isOpen);
|
||
|
}, 0);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Drupal.behaviors.collapse = {
|
||
|
attach: function attach(context) {
|
||
|
if (Modernizr.details) {
|
||
|
return;
|
||
|
}
|
||
|
var $collapsibleDetails = $(context).find('details').once('collapse').addClass('collapse-processed');
|
||
|
if ($collapsibleDetails.length) {
|
||
|
for (var i = 0; i < $collapsibleDetails.length; i++) {
|
||
|
CollapsibleDetails.instances.push(new CollapsibleDetails($collapsibleDetails[i]));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) {
|
||
|
$target.parents('details').not('[open]').find('> summary').trigger('click');
|
||
|
};
|
||
|
|
||
|
$('body').on('formFragmentLinkClickOrHashChange.details', handleFragmentLinkClickOrHashChange);
|
||
|
|
||
|
Drupal.CollapsibleDetails = CollapsibleDetails;
|
||
|
})(jQuery, Modernizr, Drupal);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Drupal) {
|
||
|
Drupal.behaviors.fileValidateAutoAttach = {
|
||
|
attach: function attach(context, settings) {
|
||
|
var $context = $(context);
|
||
|
var elements = void 0;
|
||
|
|
||
|
function initFileValidation(selector) {
|
||
|
$context.find(selector).once('fileValidate').on('change.fileValidate', { extensions: elements[selector] }, Drupal.file.validateExtension);
|
||
|
}
|
||
|
|
||
|
if (settings.file && settings.file.elements) {
|
||
|
elements = settings.file.elements;
|
||
|
Object.keys(elements).forEach(initFileValidation);
|
||
|
}
|
||
|
},
|
||
|
detach: function detach(context, settings, trigger) {
|
||
|
var $context = $(context);
|
||
|
var elements = void 0;
|
||
|
|
||
|
function removeFileValidation(selector) {
|
||
|
$context.find(selector).removeOnce('fileValidate').off('change.fileValidate', Drupal.file.validateExtension);
|
||
|
}
|
||
|
|
||
|
if (trigger === 'unload' && settings.file && settings.file.elements) {
|
||
|
elements = settings.file.elements;
|
||
|
Object.keys(elements).forEach(removeFileValidation);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.behaviors.fileAutoUpload = {
|
||
|
attach: function attach(context) {
|
||
|
$(context).find('input[type="file"]').once('auto-file-upload').on('change.autoFileUpload', Drupal.file.triggerUploadButton);
|
||
|
},
|
||
|
detach: function detach(context, setting, trigger) {
|
||
|
if (trigger === 'unload') {
|
||
|
$(context).find('input[type="file"]').removeOnce('auto-file-upload').off('.autoFileUpload');
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.behaviors.fileButtons = {
|
||
|
attach: function attach(context) {
|
||
|
var $context = $(context);
|
||
|
$context.find('.js-form-submit').on('mousedown', Drupal.file.disableFields);
|
||
|
$context.find('.js-form-managed-file .js-form-submit').on('mousedown', Drupal.file.progressBar);
|
||
|
},
|
||
|
detach: function detach(context) {
|
||
|
var $context = $(context);
|
||
|
$context.find('.js-form-submit').off('mousedown', Drupal.file.disableFields);
|
||
|
$context.find('.js-form-managed-file .js-form-submit').off('mousedown', Drupal.file.progressBar);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.behaviors.filePreviewLinks = {
|
||
|
attach: function attach(context) {
|
||
|
$(context).find('div.js-form-managed-file .file a').on('click', Drupal.file.openInNewWindow);
|
||
|
},
|
||
|
detach: function detach(context) {
|
||
|
$(context).find('div.js-form-managed-file .file a').off('click', Drupal.file.openInNewWindow);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.file = Drupal.file || {
|
||
|
validateExtension: function validateExtension(event) {
|
||
|
event.preventDefault();
|
||
|
|
||
|
$('.file-upload-js-error').remove();
|
||
|
|
||
|
var extensionPattern = event.data.extensions.replace(/,\s*/g, '|');
|
||
|
if (extensionPattern.length > 1 && this.value.length > 0) {
|
||
|
var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi');
|
||
|
if (!acceptableMatch.test(this.value)) {
|
||
|
var error = Drupal.t('The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.', {
|
||
|
'%filename': this.value.replace('C:\\fakepath\\', ''),
|
||
|
'%extensions': extensionPattern.replace(/\|/g, ', ')
|
||
|
});
|
||
|
$(this).closest('div.js-form-managed-file').prepend('<div class="messages messages--error file-upload-js-error" aria-live="polite">' + error + '</div>');
|
||
|
this.value = '';
|
||
|
|
||
|
event.stopImmediatePropagation();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
triggerUploadButton: function triggerUploadButton(event) {
|
||
|
$(event.target).closest('.js-form-managed-file').find('.js-form-submit').trigger('mousedown');
|
||
|
},
|
||
|
disableFields: function disableFields(event) {
|
||
|
var $clickedButton = $(this);
|
||
|
|
||
|
var $enabledFields = [];
|
||
|
if ($clickedButton.closest('div.js-form-managed-file').length > 0) {
|
||
|
$enabledFields = $clickedButton.closest('div.js-form-managed-file').find('input.js-form-file');
|
||
|
}
|
||
|
|
||
|
var $fieldsToTemporarilyDisable = $('div.js-form-managed-file input.js-form-file').not($enabledFields).not(':disabled');
|
||
|
$fieldsToTemporarilyDisable.prop('disabled', true);
|
||
|
setTimeout(function () {
|
||
|
$fieldsToTemporarilyDisable.prop('disabled', false);
|
||
|
}, 1000);
|
||
|
},
|
||
|
progressBar: function progressBar(event) {
|
||
|
var $clickedButton = $(this);
|
||
|
var $progressId = $clickedButton.closest('div.js-form-managed-file').find('input.file-progress');
|
||
|
if ($progressId.length) {
|
||
|
var originalName = $progressId.attr('name');
|
||
|
|
||
|
$progressId.attr('name', originalName.match(/APC_UPLOAD_PROGRESS|UPLOAD_IDENTIFIER/)[0]);
|
||
|
|
||
|
setTimeout(function () {
|
||
|
$progressId.attr('name', originalName);
|
||
|
}, 1000);
|
||
|
}
|
||
|
|
||
|
setTimeout(function () {
|
||
|
$clickedButton.closest('div.js-form-managed-file').find('div.ajax-progress-bar').slideDown();
|
||
|
}, 500);
|
||
|
},
|
||
|
openInNewWindow: function openInNewWindow(event) {
|
||
|
event.preventDefault();
|
||
|
$(this).attr('target', '_blank');
|
||
|
window.open(this.href, 'filePreview', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=500,height=550');
|
||
|
}
|
||
|
};
|
||
|
})(jQuery, Drupal);;
|
||
|
/*!
|
||
|
* jQuery Form Plugin
|
||
|
* version: 3.51.0-2014.06.20
|
||
|
* Requires jQuery v1.5 or later
|
||
|
* Copyright (c) 2014 M. Alsup
|
||
|
* Examples and documentation at: http://malsup.com/jquery/form/
|
||
|
* Project repository: https://github.com/malsup/form
|
||
|
* Dual licensed under the MIT and GPL licenses.
|
||
|
* https://github.com/malsup/form#copyright-and-license
|
||
|
*/
|
||
|
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).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;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;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 r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},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(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(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(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).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(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);va
|
||
|
;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
|
||
|
(function ($, Drupal) {
|
||
|
Drupal.theme.progressBar = function (id) {
|
||
|
return '<div id="' + id + '" class="progress" aria-live="polite">' + '<div class="progress__label"> </div>' + '<div class="progress__track"><div class="progress__bar"></div></div>' + '<div class="progress__percentage"></div>' + '<div class="progress__description"> </div>' + '</div>';
|
||
|
};
|
||
|
|
||
|
Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) {
|
||
|
this.id = id;
|
||
|
this.method = method || 'GET';
|
||
|
this.updateCallback = updateCallback;
|
||
|
this.errorCallback = errorCallback;
|
||
|
|
||
|
this.element = $(Drupal.theme('progressBar', id));
|
||
|
};
|
||
|
|
||
|
$.extend(Drupal.ProgressBar.prototype, {
|
||
|
setProgress: function setProgress(percentage, message, label) {
|
||
|
if (percentage >= 0 && percentage <= 100) {
|
||
|
$(this.element).find('div.progress__bar').css('width', percentage + '%');
|
||
|
$(this.element).find('div.progress__percentage').html(percentage + '%');
|
||
|
}
|
||
|
$('div.progress__description', this.element).html(message);
|
||
|
$('div.progress__label', this.element).html(label);
|
||
|
if (this.updateCallback) {
|
||
|
this.updateCallback(percentage, message, this);
|
||
|
}
|
||
|
},
|
||
|
startMonitoring: function startMonitoring(uri, delay) {
|
||
|
this.delay = delay;
|
||
|
this.uri = uri;
|
||
|
this.sendPing();
|
||
|
},
|
||
|
stopMonitoring: function stopMonitoring() {
|
||
|
clearTimeout(this.timer);
|
||
|
|
||
|
this.uri = null;
|
||
|
},
|
||
|
sendPing: function sendPing() {
|
||
|
if (this.timer) {
|
||
|
clearTimeout(this.timer);
|
||
|
}
|
||
|
if (this.uri) {
|
||
|
var pb = this;
|
||
|
|
||
|
var uri = this.uri;
|
||
|
if (uri.indexOf('?') === -1) {
|
||
|
uri += '?';
|
||
|
} else {
|
||
|
uri += '&';
|
||
|
}
|
||
|
uri += '_format=json';
|
||
|
$.ajax({
|
||
|
type: this.method,
|
||
|
url: uri,
|
||
|
data: '',
|
||
|
dataType: 'json',
|
||
|
success: function success(progress) {
|
||
|
if (progress.status === 0) {
|
||
|
pb.displayError(progress.data);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
pb.setProgress(progress.percentage, progress.message, progress.label);
|
||
|
|
||
|
pb.timer = setTimeout(function () {
|
||
|
pb.sendPing();
|
||
|
}, pb.delay);
|
||
|
},
|
||
|
error: function error(xmlhttp) {
|
||
|
var e = new Drupal.AjaxError(xmlhttp, pb.uri);
|
||
|
pb.displayError('<pre>' + e.message + '</pre>');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
displayError: function displayError(string) {
|
||
|
var error = $('<div class="messages messages--error"></div>').html(string);
|
||
|
$(this.element).before(error).hide();
|
||
|
|
||
|
if (this.errorCallback) {
|
||
|
this.errorCallback(this);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
})(jQuery, Drupal);;
|
||
|
/**
|
||
|
* DO NOT EDIT THIS FILE.
|
||
|
* See the following change record for more information,
|
||
|
* https://www.drupal.org/node/2815083
|
||
|
* @preserve
|
||
|
**/
|
||
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||
|
|
||
|
(function ($, window, Drupal, drupalSettings) {
|
||
|
Drupal.behaviors.AJAX = {
|
||
|
attach: function attach(context, settings) {
|
||
|
function loadAjaxBehavior(base) {
|
||
|
var elementSettings = settings.ajax[base];
|
||
|
if (typeof elementSettings.selector === 'undefined') {
|
||
|
elementSettings.selector = '#' + base;
|
||
|
}
|
||
|
$(elementSettings.selector).once('drupal-ajax').each(function () {
|
||
|
elementSettings.element = this;
|
||
|
elementSettings.base = base;
|
||
|
Drupal.ajax(elementSettings);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
Object.keys(settings.ajax || {}).forEach(function (base) {
|
||
|
return loadAjaxBehavior(base);
|
||
|
});
|
||
|
|
||
|
Drupal.ajax.bindAjaxLinks(document.body);
|
||
|
|
||
|
$('.use-ajax-submit').once('ajax').each(function () {
|
||
|
var elementSettings = {};
|
||
|
|
||
|
elementSettings.url = $(this.form).attr('action');
|
||
|
|
||
|
elementSettings.setClick = true;
|
||
|
|
||
|
elementSettings.event = 'click';
|
||
|
|
||
|
elementSettings.progress = { type: 'throbber' };
|
||
|
elementSettings.base = $(this).attr('id');
|
||
|
elementSettings.element = this;
|
||
|
|
||
|
Drupal.ajax(elementSettings);
|
||
|
});
|
||
|
},
|
||
|
detach: function detach(context, settings, trigger) {
|
||
|
if (trigger === 'unload') {
|
||
|
Drupal.ajax.expired().forEach(function (instance) {
|
||
|
Drupal.ajax.instances[instance.instanceIndex] = null;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.AjaxError = function (xmlhttp, uri, customMessage) {
|
||
|
var statusCode = void 0;
|
||
|
var statusText = void 0;
|
||
|
var responseText = void 0;
|
||
|
if (xmlhttp.status) {
|
||
|
statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { '!status': xmlhttp.status });
|
||
|
} else {
|
||
|
statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.');
|
||
|
}
|
||
|
statusCode += '\n' + Drupal.t('Debugging information follows.');
|
||
|
var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri });
|
||
|
statusText = '';
|
||
|
|
||
|
try {
|
||
|
statusText = '\n' + Drupal.t('StatusText: !statusText', { '!statusText': $.trim(xmlhttp.statusText) });
|
||
|
} catch (e) {}
|
||
|
|
||
|
responseText = '';
|
||
|
|
||
|
try {
|
||
|
responseText = '\n' + Drupal.t('ResponseText: !responseText', { '!responseText': $.trim(xmlhttp.responseText) });
|
||
|
} catch (e) {}
|
||
|
|
||
|
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
|
||
|
responseText = responseText.replace(/[\n]+\s+/g, '\n');
|
||
|
|
||
|
var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState }) : '';
|
||
|
|
||
|
customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { '!customMessage': customMessage }) : '';
|
||
|
|
||
|
this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText;
|
||
|
|
||
|
this.name = 'AjaxError';
|
||
|
};
|
||
|
|
||
|
Drupal.AjaxError.prototype = new Error();
|
||
|
Drupal.AjaxError.prototype.constructor = Drupal.AjaxError;
|
||
|
|
||
|
Drupal.ajax = function (settings) {
|
||
|
if (arguments.length !== 1) {
|
||
|
throw new Error('Drupal.ajax() function must be called with one configuration object only');
|
||
|
}
|
||
|
|
||
|
var base = settings.base || false;
|
||
|
var element = settings.element || false;
|
||
|
delete settings.base;
|
||
|
delete settings.element;
|
||
|
|
||
|
if (!settings.progress && !element) {
|
||
|
settings.progress = false;
|
||
|
}
|
||
|
|
||
|
var ajax = new Drupal.Ajax(base, element, settings);
|
||
|
ajax.instanceIndex = Drupal.ajax.instances.length;
|
||
|
Drupal.ajax.instances.push(ajax);
|
||
|
|
||
|
return ajax;
|
||
|
};
|
||
|
|
||
|
Drupal.ajax.instances = [];
|
||
|
|
||
|
Drupal.ajax.expired = function () {
|
||
|
return Drupal.ajax.instances.filter(function (instance) {
|
||
|
return instance && instance.element !== false && !document.body.contains(instance.element);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
Drupal.ajax.bindAjaxLinks = function (element) {
|
||
|
$(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) {
|
||
|
var $linkElement = $(ajaxLink);
|
||
|
|
||
|
var elementSettings = {
|
||
|
progress: { type: 'throbber' },
|
||
|
dialogType: $linkElement.data('dialog-type'),
|
||
|
dialog: $linkElement.data('dialog-options'),
|
||
|
dialogRenderer: $linkElement.data('dialog-renderer'),
|
||
|
base: $linkElement.attr('id'),
|
||
|
element: ajaxLink
|
||
|
};
|
||
|
var href = $linkElement.attr('href');
|
||
|
|
||
|
if (href) {
|
||
|
elementSettings.url = href;
|
||
|
elementSettings.event = 'click';
|
||
|
}
|
||
|
Drupal.ajax(elementSettings);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax = function (base, element, elementSettings) {
|
||
|
var defaults = {
|
||
|
event: element ? 'mousedown' : null,
|
||
|
keypress: true,
|
||
|
selector: base ? '#' + base : null,
|
||
|
effect: 'none',
|
||
|
speed: 'none',
|
||
|
method: 'replaceWith',
|
||
|
progress: {
|
||
|
type: 'throbber',
|
||
|
message: Drupal.t('Please wait...')
|
||
|
},
|
||
|
submit: {
|
||
|
js: true
|
||
|
}
|
||
|
};
|
||
|
|
||
|
$.extend(this, defaults, elementSettings);
|
||
|
|
||
|
this.commands = new Drupal.AjaxCommands();
|
||
|
|
||
|
this.instanceIndex = false;
|
||
|
|
||
|
if (this.wrapper) {
|
||
|
this.wrapper = '#' + this.wrapper;
|
||
|
}
|
||
|
|
||
|
this.element = element;
|
||
|
|
||
|
this.element_settings = elementSettings;
|
||
|
|
||
|
this.elementSettings = elementSettings;
|
||
|
|
||
|
if (this.element && this.element.form) {
|
||
|
this.$form = $(this.element.form);
|
||
|
}
|
||
|
|
||
|
if (!this.url) {
|
||
|
var $element = $(this.element);
|
||
|
if ($element.is('a')) {
|
||
|
this.url = $element.attr('href');
|
||
|
} else if (this.element && element.form) {
|
||
|
this.url = this.$form.attr('action');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var originalUrl = this.url;
|
||
|
|
||
|
this.url = this.url.replace(/\/nojs(\/|$|\?|#)/g, '/ajax$1');
|
||
|
|
||
|
if (drupalSettings.ajaxTrustedUrl[originalUrl]) {
|
||
|
drupalSettings.ajaxTrustedUrl[this.url] = true;
|
||
|
}
|
||
|
|
||
|
var ajax = this;
|
||
|
|
||
|
ajax.options = {
|
||
|
url: ajax.url,
|
||
|
data: ajax.submit,
|
||
|
beforeSerialize: function beforeSerialize(elementSettings, options) {
|
||
|
return ajax.beforeSerialize(elementSettings, options);
|
||
|
},
|
||
|
beforeSubmit: function beforeSubmit(formValues, elementSettings, options) {
|
||
|
ajax.ajaxing = true;
|
||
|
return ajax.beforeSubmit(formValues, elementSettings, options);
|
||
|
},
|
||
|
beforeSend: function beforeSend(xmlhttprequest, options) {
|
||
|
ajax.ajaxing = true;
|
||
|
return ajax.beforeSend(xmlhttprequest, options);
|
||
|
},
|
||
|
success: function success(response, status, xmlhttprequest) {
|
||
|
if (typeof response === 'string') {
|
||
|
response = $.parseJSON(response);
|
||
|
}
|
||
|
|
||
|
if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) {
|
||
|
if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') {
|
||
|
var customMessage = Drupal.t('The response failed verification so will not be processed.');
|
||
|
return ajax.error(xmlhttprequest, ajax.url, customMessage);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return ajax.success(response, status);
|
||
|
},
|
||
|
complete: function complete(xmlhttprequest, status) {
|
||
|
ajax.ajaxing = false;
|
||
|
if (status === 'error' || status === 'parsererror') {
|
||
|
return ajax.error(xmlhttprequest, ajax.url);
|
||
|
}
|
||
|
},
|
||
|
|
||
|
dataType: 'json',
|
||
|
type: 'POST'
|
||
|
};
|
||
|
|
||
|
if (elementSettings.dialog) {
|
||
|
ajax.options.data.dialogOptions = elementSettings.dialog;
|
||
|
}
|
||
|
|
||
|
if (ajax.options.url.indexOf('?') === -1) {
|
||
|
ajax.options.url += '?';
|
||
|
} else {
|
||
|
ajax.options.url += '&';
|
||
|
}
|
||
|
|
||
|
var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax');
|
||
|
if (elementSettings.dialogRenderer) {
|
||
|
wrapper += '.' + elementSettings.dialogRenderer;
|
||
|
}
|
||
|
ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper;
|
||
|
|
||
|
$(ajax.element).on(elementSettings.event, function (event) {
|
||
|
if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) {
|
||
|
throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', { '!url': ajax.url }));
|
||
|
}
|
||
|
return ajax.eventResponse(this, event);
|
||
|
});
|
||
|
|
||
|
if (elementSettings.keypress) {
|
||
|
$(ajax.element).on('keypress', function (event) {
|
||
|
return ajax.keypressResponse(this, event);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (elementSettings.prevent) {
|
||
|
$(ajax.element).on(elementSettings.prevent, false);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format';
|
||
|
|
||
|
Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax';
|
||
|
|
||
|
Drupal.Ajax.prototype.execute = function () {
|
||
|
if (this.ajaxing) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
this.beforeSerialize(this.element, this.options);
|
||
|
|
||
|
return $.ajax(this.options);
|
||
|
} catch (e) {
|
||
|
this.ajaxing = false;
|
||
|
window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message);
|
||
|
|
||
|
return $.Deferred().reject();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.keypressResponse = function (element, event) {
|
||
|
var ajax = this;
|
||
|
|
||
|
if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') {
|
||
|
event.preventDefault();
|
||
|
event.stopPropagation();
|
||
|
$(element).trigger(ajax.elementSettings.event);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.eventResponse = function (element, event) {
|
||
|
event.preventDefault();
|
||
|
event.stopPropagation();
|
||
|
|
||
|
var ajax = this;
|
||
|
|
||
|
if (ajax.ajaxing) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
if (ajax.$form) {
|
||
|
if (ajax.setClick) {
|
||
|
element.form.clk = element;
|
||
|
}
|
||
|
|
||
|
ajax.$form.ajaxSubmit(ajax.options);
|
||
|
} else {
|
||
|
ajax.beforeSerialize(ajax.element, ajax.options);
|
||
|
$.ajax(ajax.options);
|
||
|
}
|
||
|
} catch (e) {
|
||
|
ajax.ajaxing = false;
|
||
|
window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.beforeSerialize = function (element, options) {
|
||
|
if (this.$form) {
|
||
|
var settings = this.settings || drupalSettings;
|
||
|
Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize');
|
||
|
}
|
||
|
|
||
|
options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1;
|
||
|
|
||
|
var pageState = drupalSettings.ajaxPageState;
|
||
|
options.data['ajax_page_state[theme]'] = pageState.theme;
|
||
|
options.data['ajax_page_state[theme_token]'] = pageState.theme_token;
|
||
|
options.data['ajax_page_state[libraries]'] = pageState.libraries;
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {};
|
||
|
|
||
|
Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) {
|
||
|
if (this.$form) {
|
||
|
options.extraData = options.extraData || {};
|
||
|
|
||
|
options.extraData.ajax_iframe_upload = '1';
|
||
|
|
||
|
var v = $.fieldValue(this.element);
|
||
|
if (v !== null) {
|
||
|
options.extraData[this.element.name] = v;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$(this.element).prop('disabled', true);
|
||
|
|
||
|
if (!this.progress || !this.progress.type) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase();
|
||
|
if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') {
|
||
|
this[progressIndicatorMethod].call(this);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.setProgressIndicatorBar = function () {
|
||
|
var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop);
|
||
|
if (this.progress.message) {
|
||
|
progressBar.setProgress(-1, this.progress.message);
|
||
|
}
|
||
|
if (this.progress.url) {
|
||
|
progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
|
||
|
}
|
||
|
this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar');
|
||
|
this.progress.object = progressBar;
|
||
|
$(this.element).after(this.progress.element);
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () {
|
||
|
this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>');
|
||
|
if (this.progress.message) {
|
||
|
this.progress.element.find('.throbber').after('<div class="message">' + this.progress.message + '</div>');
|
||
|
}
|
||
|
$(this.element).after(this.progress.element);
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () {
|
||
|
this.progress.element = $('<div class="ajax-progress ajax-progress-fullscreen"> </div>');
|
||
|
$('body').after(this.progress.element);
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.success = function (response, status) {
|
||
|
var _this = this;
|
||
|
|
||
|
if (this.progress.element) {
|
||
|
$(this.progress.element).remove();
|
||
|
}
|
||
|
if (this.progress.object) {
|
||
|
this.progress.object.stopMonitoring();
|
||
|
}
|
||
|
$(this.element).prop('disabled', false);
|
||
|
|
||
|
var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray();
|
||
|
|
||
|
var focusChanged = false;
|
||
|
Object.keys(response || {}).forEach(function (i) {
|
||
|
if (response[i].command && _this.commands[response[i].command]) {
|
||
|
_this.commands[response[i].command](_this, response[i], status);
|
||
|
if (response[i].command === 'invoke' && response[i].method === 'focus') {
|
||
|
focusChanged = true;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) {
|
||
|
var target = false;
|
||
|
|
||
|
for (var n = elementParents.length - 1; !target && n > 0; n--) {
|
||
|
target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]');
|
||
|
}
|
||
|
|
||
|
if (target) {
|
||
|
$(target).trigger('focus');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (this.$form) {
|
||
|
var settings = this.settings || drupalSettings;
|
||
|
Drupal.attachBehaviors(this.$form.get(0), settings);
|
||
|
}
|
||
|
|
||
|
this.settings = null;
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.getEffect = function (response) {
|
||
|
var type = response.effect || this.effect;
|
||
|
var speed = response.speed || this.speed;
|
||
|
|
||
|
var effect = {};
|
||
|
if (type === 'none') {
|
||
|
effect.showEffect = 'show';
|
||
|
effect.hideEffect = 'hide';
|
||
|
effect.showSpeed = '';
|
||
|
} else if (type === 'fade') {
|
||
|
effect.showEffect = 'fadeIn';
|
||
|
effect.hideEffect = 'fadeOut';
|
||
|
effect.showSpeed = speed;
|
||
|
} else {
|
||
|
effect.showEffect = type + 'Toggle';
|
||
|
effect.hideEffect = type + 'Toggle';
|
||
|
effect.showSpeed = speed;
|
||
|
}
|
||
|
|
||
|
return effect;
|
||
|
};
|
||
|
|
||
|
Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) {
|
||
|
if (this.progress.element) {
|
||
|
$(this.progress.element).remove();
|
||
|
}
|
||
|
if (this.progress.object) {
|
||
|
this.progress.object.stopMonitoring();
|
||
|
}
|
||
|
|
||
|
$(this.wrapper).show();
|
||
|
|
||
|
$(this.element).prop('disabled', false);
|
||
|
|
||
|
if (this.$form) {
|
||
|
var settings = this.settings || drupalSettings;
|
||
|
Drupal.attachBehaviors(this.$form.get(0), settings);
|
||
|
}
|
||
|
throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage);
|
||
|
};
|
||
|
|
||
|
Drupal.AjaxCommands = function () {};
|
||
|
Drupal.AjaxCommands.prototype = {
|
||
|
insert: function insert(ajax, response, status) {
|
||
|
var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper);
|
||
|
var method = response.method || ajax.method;
|
||
|
var effect = ajax.getEffect(response);
|
||
|
var settings = void 0;
|
||
|
|
||
|
var $newContentWrapped = $('<div></div>').html(response.data);
|
||
|
var $newContent = $newContentWrapped.contents();
|
||
|
|
||
|
if ($newContent.length !== 1 || $newContent.get(0).nodeType !== 1) {
|
||
|
$newContent = $newContentWrapped;
|
||
|
}
|
||
|
|
||
|
switch (method) {
|
||
|
case 'html':
|
||
|
case 'replaceWith':
|
||
|
case 'replaceAll':
|
||
|
case 'empty':
|
||
|
case 'remove':
|
||
|
settings = response.settings || ajax.settings || drupalSettings;
|
||
|
Drupal.detachBehaviors($wrapper.get(0), settings);
|
||
|
}
|
||
|
|
||
|
$wrapper[method]($newContent);
|
||
|
|
||
|
if (effect.showEffect !== 'show') {
|
||
|
$newContent.hide();
|
||
|
}
|
||
|
|
||
|
if ($newContent.find('.ajax-new-content').length > 0) {
|
||
|
$newContent.find('.ajax-new-content').hide();
|
||
|
$newContent.show();
|
||
|
$newContent.find('.ajax-new-content')[effect.showEffect](effect.showSpeed);
|
||
|
} else if (effect.showEffect !== 'show') {
|
||
|
$newContent[effect.showEffect](effect.showSpeed);
|
||
|
}
|
||
|
|
||
|
if ($newContent.parents('html').length > 0) {
|
||
|
settings = response.settings || ajax.settings || drupalSettings;
|
||
|
Drupal.attachBehaviors($newContent.get(0), settings);
|
||
|
}
|
||
|
},
|
||
|
remove: function remove(ajax, response, status) {
|
||
|
var settings = response.settings || ajax.settings || drupalSettings;
|
||
|
$(response.selector).each(function () {
|
||
|
Drupal.detachBehaviors(this, settings);
|
||
|
}).remove();
|
||
|
},
|
||
|
changed: function changed(ajax, response, status) {
|
||
|
var $element = $(response.selector);
|
||
|
if (!$element.hasClass('ajax-changed')) {
|
||
|
$element.addClass('ajax-changed');
|
||
|
if (response.asterisk) {
|
||
|
$element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> ');
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
alert: function alert(ajax, response, status) {
|
||
|
window.alert(response.text, response.title);
|
||
|
},
|
||
|
redirect: function redirect(ajax, response, status) {
|
||
|
window.location = response.url;
|
||
|
},
|
||
|
css: function css(ajax, response, status) {
|
||
|
$(response.selector).css(response.argument);
|
||
|
},
|
||
|
settings: function settings(ajax, response, status) {
|
||
|
var ajaxSettings = drupalSettings.ajax;
|
||
|
|
||
|
if (ajaxSettings) {
|
||
|
Drupal.ajax.expired().forEach(function (instance) {
|
||
|
|
||
|
if (instance.selector) {
|
||
|
var selector = instance.selector.replace('#', '');
|
||
|
if (selector in ajaxSettings) {
|
||
|
delete ajaxSettings[selector];
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (response.merge) {
|
||
|
$.extend(true, drupalSettings, response.settings);
|
||
|
} else {
|
||
|
ajax.settings = response.settings;
|
||
|
}
|
||
|
},
|
||
|
data: function data(ajax, response, status) {
|
||
|
$(response.selector).data(response.name, response.value);
|
||
|
},
|
||
|
invoke: function invoke(ajax, response, status) {
|
||
|
var $element = $(response.selector);
|
||
|
$element[response.method].apply($element, _toConsumableArray(response.args));
|
||
|
},
|
||
|
restripe: function restripe(ajax, response, status) {
|
||
|
$(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even');
|
||
|
},
|
||
|
update_build_id: function update_build_id(ajax, response, status) {
|
||
|
$('input[name="form_build_id"][value="' + response.old + '"]').val(response.new);
|
||
|
},
|
||
|
add_css: function add_css(ajax, response, status) {
|
||
|
$('head').prepend(response.data);
|
||
|
|
||
|
var match = void 0;
|
||
|
var importMatch = /^@import url\("(.*)"\);$/igm;
|
||
|
if (document.styleSheets[0].addImport && importMatch.test(response.data)) {
|
||
|
importMatch.lastIndex = 0;
|
||
|
do {
|
||
|
match = importMatch.exec(response.data);
|
||
|
document.styleSheets[0].addImport(match[1]);
|
||
|
} while (match);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
})(jQuery, window, Drupal, drupalSettings);;
|