1/*! jquery.cookie v1.4.1 | MIT */ 2!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))}});; 3(function ($) { 4 5/** 6 * Prevents consecutive form submissions of identical form values. 7 * 8 * Repetitive form submissions that would submit the identical form values are 9 * prevented, unless the form values are different from the previously 10 * submitted values. 11 * 12 * This is a simplified re-implementation of a user-agent behavior that should 13 * be natively supported by major web browsers, but at this time, only Firefox 14 * has a built-in protection. 15 * 16 * A form value-based approach ensures that the constraint is triggered for 17 * consecutive, identical form submissions only. Compared to that, a form 18 * button-based approach would (1) rely on [visible] buttons to exist where 19 * technically not required and (2) require more complex state management if 20 * there are multiple buttons in a form. 21 * 22 * This implementation is based on form-level submit events only and relies on 23 * jQuery's serialize() method to determine submitted form values. As such, the 24 * following limitations exist: 25 * 26 * - Event handlers on form buttons that preventDefault() do not receive a 27 * double-submit protection. That is deemed to be fine, since such button 28 * events typically trigger reversible client-side or server-side operations 29 * that are local to the context of a form only. 30 * - Changed values in advanced form controls, such as file inputs, are not part 31 * of the form values being compared between consecutive form submits (due to 32 * limitations of jQuery.serialize()). That is deemed to be acceptable, 33 * because if the user forgot to attach a file, then the size of HTTP payload 34 * will most likely be small enough to be fully passed to the server endpoint 35 * within (milli)seconds. If a user mistakenly attached a wrong file and is 36 * technically versed enough to cancel the form submission (and HTTP payload) 37 * in order to attach a different file, then that edge-case is not supported 38 * here. 39 * 40 * Lastly, all forms submitted via HTTP GET are idempotent by definition of HTTP 41 * standards, so excluded in this implementation. 42 */ 43Drupal.behaviors.formSingleSubmit = { 44 attach: function () { 45 function onFormSubmit (e) { 46 var $form = $(e.currentTarget); 47 var formValues = $form.serialize(); 48 var previousValues = $form.attr('data-drupal-form-submit-last'); 49 if (previousValues === formValues) { 50 e.preventDefault(); 51 } 52 else { 53 $form.attr('data-drupal-form-submit-last', formValues); 54 } 55 } 56 57 $('body').once('form-single-submit') 58 .delegate('form:not([method~="GET"])', 'submit.singleSubmit', onFormSubmit); 59 } 60}; 61 62})(jQuery); 63;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.