1/** 2 * @file 3 * Drupal Bootstrap object. 4 */ 5 6/** 7 * All Drupal Bootstrap JavaScript APIs are contained in this namespace. 8 * 9 * @param {underscore} _ 10 * @param {jQuery} $ 11 * @param {Drupal} Drupal 12 * @param {drupalSettings} drupalSettings 13 */ 14(function (_, $, Drupal, drupalSettings) { 15 'use strict'; 16 17 /** 18 * @typedef Drupal.bootstrap 19 */ 20 var Bootstrap = { 21 processedOnce: {}, 22 settings: drupalSettings.bootstrap || {} 23 }; 24 25 /** 26 * Wraps Drupal.checkPlain() to ensure value passed isn't empty. 27 * 28 * Encodes special characters in a plain-text string for display as HTML. 29 * 30 * @param {string} str 31 * The string to be encoded. 32 * 33 * @return {string} 34 * The encoded string. 35 * 36 * @ingroup sanitization 37 */ 38 Bootstrap.checkPlain = function (str) { 39 return str && Drupal.checkPlain(str) || ''; 40 }; 41 42 /** 43 * Creates a jQuery plugin. 44 * 45 * @param {String} id 46 * A jQuery plugin identifier located in $.fn. 47 * @param {Function} plugin 48 * A constructor function used to initialize the for the jQuery plugin. 49 * @param {Boolean} [noConflict] 50 * Flag indicating whether or not to create a ".noConflict()" helper method 51 * for the plugin. 52 */ 53 Bootstrap.createPlugin = function (id, plugin, noConflict) { 54 // Immediately return if plugin doesn't exist. 55 if ($.fn[id] !== void 0) { 56 return this.fatal('Specified jQuery plugin identifier already exists: @id. Use Drupal.bootstrap.replacePlugin() instead.', {'@id': id}); 57 } 58 59 // Immediately return if plugin isn't a function. 60 if (typeof plugin !== 'function') { 61 return this.fatal('You must provide a constructor function to create a jQuery plugin "@id": @plugin', {'@id': id, '@plugin': plugin}); 62 } 63 64 // Add a ".noConflict()" helper method. 65 this.pluginNoConflict(id, plugin, noConflict); 66 67 $.fn[id] = plugin; 68 }; 69 70 /** 71 * Diff object properties. 72 * 73 * @param {...Object} objects 74 * Two or more objects. The first object will be used to return properties 75 * values. 76 * 77 * @return {Object} 78 * Returns the properties of the first passed object that are not present 79 * in all other passed objects. 80 */ 81 Bootstrap.diffObjects = function (objects) { 82 var args = Array.prototype.slice.call(arguments); 83 return _.pick(args[0], _.difference.apply(_, _.map(args, function (obj) { 84 return Object.keys(obj); 85 }))); 86 }; 87 88 /** 89 * Map of supported events by regular expression. 90 * 91 * @type {Object<Event|MouseEvent|KeyboardEvent|TouchEvent,RegExp>} 92 */ 93 Bootstrap.eventMap = { 94 Event: /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, 95 MouseEvent: /^(?:click|dblclick|mouse(?:down|enter|leave|up|over|move|out))$/, 96 KeyboardEvent: /^(?:key(?:down|press|up))$/, 97 TouchEvent: /^(?:touch(?:start|end|move|cancel))$/ 98 }; 99 100 /** 101 * Extends a jQuery Plugin. 102 * 103 * @param {String} id 104 * A jQuery plugin identifier located in $.fn. 105 * @param {Function} callback 106 * A constructor function used to initialize the for the jQuery plugin. 107 * 108 * @return {Function|Boolean} 109 * The jQuery plugin constructor or FALSE if the plugin does not exist. 110 */ 111 Bootstrap.extendPlugin = function (id, callback) { 112 // Immediately return if plugin doesn't exist. 113 if (typeof $.fn[id] !== 'function') { 114 return this.fatal('Specified jQuery plugin identifier does not exist: @id', {'@id': id}); 115 } 116 117 // Immediately return if callback isn't a function. 118 if (typeof callback !== 'function') { 119 return this.fatal('You must provide a callback function to extend the jQuery plugin "@id": @callback', {'@id': id, '@callback': callback}); 120 } 121 122 // Determine existing plugin constructor. 123 var constructor = $.fn[id] && $.fn[id].Constructor || $.fn[id]; 124 var plugin = callback.apply(constructor, [this.settings]); 125 if (!$.isPlainObject(plugin)) { 126 return this.fatal('Returned value from callback is not a plain object that can be used to extend the jQuery plugin "@id": @obj', {'@obj': plugin}); 127 } 128 129 this.wrapPluginConstructor(constructor, plugin, true); 130 131 return $.fn[id]; 132 }; 133 134 Bootstrap.superWrapper = function (parent, fn) { 135 return function () { 136 var previousSuper = this.super; 137 this.super = parent; 138 var ret = fn.apply(this, arguments); 139 if (previousSuper) { 140 this.super = previousSuper; 141 } 142 else { 143 delete this.super; 144 } 145 return ret; 146 }; 147 }; 148 149 /** 150 * Provide a helper method for displaying when something is went wrong. 151 * 152 * @param {String} message 153 * The message to display. 154 * @param {Object} [args] 155 * An arguments to use in message. 156 * 157 * @return {Boolean} 158 * Always returns FALSE. 159 */
160 Bootstrap.fatal = function (message, args) { 161 if (this.settings.dev && console.warn) { 162 for (var name in args) { 163 if (args.hasOwnProperty(name) && typeof args[name] === 'object') { 164 args[name] = JSON.stringify(args[name]); 165 } 166 } 167 Drupal.throwError(new Error(Drupal.formatString(message, args))); 168 } 169 return false; 170 }; 171 172 /** 173 * Intersects object properties. 174 * 175 * @param {...Object} objects 176 * Two or more objects. The first object will be used to return properties 177 * values. 178 * 179 * @return {Object} 180 * Returns the properties of first passed object that intersects with all 181 * other passed objects. 182 */ 183 Bootstrap.intersectObjects = function (objects) { 184 var args = Array.prototype.slice.call(arguments); 185 return _.pick(args[0], _.intersection.apply(_, _.map(args, function (obj) { 186 return Object.keys(obj); 187 }))); 188 }; 189 190 /** 191 * Normalizes an object's values. 192 * 193 * @param {Object} obj 194 * The object to normalize. 195 * 196 * @return {Object} 197 * The normalized object. 198 */ 199 Bootstrap.normalizeObject = function (obj) { 200 if (!$.isPlainObject(obj)) { 201 return obj; 202 } 203 204 for (var k in obj) { 205 if (typeof obj[k] === 'string') { 206 if (obj[k] === 'true') { 207 obj[k] = true; 208 } 209 else if (obj[k] === 'false') { 210 obj[k] = false; 211 } 212 else if (obj[k].match(/^[\d-.]$/)) { 213 obj[k] = parseFloat(obj[k]); 214 } 215 } 216 else if ($.isPlainObject(obj[k])) { 217 obj[k] = Bootstrap.normalizeObject(obj[k]); 218 } 219 } 220 221 return obj; 222 }; 223 224 /** 225 * An object based once plugin (similar to jquery.once, but without the DOM). 226 * 227 * @param {String} id 228 * A unique identifier. 229 * @param {Function} callback 230 * The callback to invoke if the identifier has not yet been seen. 231 * 232 * @return {Bootstrap} 233 */ 234 Bootstrap.once = function (id, callback) { 235 // Immediately return if identifier has already been processed. 236 if (this.processedOnce[id]) { 237 return this; 238 } 239 callback.call(this, this.settings); 240 this.processedOnce[id] = true; 241 return this; 242 }; 243 244 /** 245 * Provide jQuery UI like ability to get/set options for Bootstrap plugins. 246 * 247 * @param {string|object} key 248 * A string value of the option to set, can be dot like to a nested key. 249 * An object of key/value pairs. 250 * @param {*} [value] 251 * (optional) A value to set for key. 252 * 253 * @returns {*} 254 * - Returns nothing if key is an object or both key and value parameters 255 * were provided to set an option. 256 * - Returns the a value for a specific setting if key was provided. 257 * - Returns an object of key/value pairs of all the options if no key or 258 * value parameter was provided. 259 * 260 * @see https://github.com/jquery/jquery-ui/blob/master/ui/widget.js 261 */ 262 Bootstrap.option = function (key, value) { 263 var options = $.isPlainObject(key) ? $.extend({}, key) : {}; 264 265 // Get all options (clone so it doesn't reference the internal object). 266 if (arguments.length === 0) { 267 return $.extend({}, this.options); 268 } 269 270 // Get/set single option. 271 if (typeof key === "string") { 272 // Handle nested keys in dot notation. 273 // e.g., "foo.bar" => { foo: { bar: true } } 274 var parts = key.split('.'); 275 key = parts.shift(); 276 var obj = options; 277 if (parts.length) { 278 for (var i = 0; i < parts.length - 1; i++) { 279 obj[parts[i]] = obj[parts[i]] || {}; 280 obj = obj[parts[i]]; 281 } 282 key = parts.pop(); 283 } 284 285 // Get. 286 if (arguments.length === 1) { 287 return obj[key] === void 0 ? null : obj[key]; 288 } 289 290 // Set. 291 obj[key] = value; 292 } 293 294 // Set multiple options. 295 $.extend(true, this.options, options); 296 }; 297 298 /** 299 * Adds a ".noConflict()" helper method if needed. 300 * 301 * @param {String} id 302 * A jQuery plugin identifier located in $.fn. 303 * @param {Function} plugin 304 * @param {Function} plugin 305 * A constructor function used to initialize the for the jQuery plugin. 306 * @param {Boolean} [noConflict]
307 * Flag indicating whether or not to create a ".noConflict()" helper method 308 * for the plugin. 309 */ 310 Bootstrap.pluginNoConflict = function (id, plugin, noConflict) { 311 if (plugin.noConflict === void 0 && (noConflict === void 0 || noConflict)) { 312 var old = $.fn[id]; 313 plugin.noConflict = function () { 314 $.fn[id] = old; 315 return this; 316 }; 317 } 318 }; 319 320 /** 321 * Creates a handler that relays to another event name. 322 * 323 * @param {HTMLElement|jQuery} target 324 * A target element. 325 * @param {String} name 326 * The name of the event to trigger. 327 * @param {Boolean} [stopPropagation=true] 328 * Flag indicating whether to stop the propagation of the event, defaults 329 * to true. 330 * 331 * @return {Function} 332 * An even handler callback function. 333 */ 334 Bootstrap.relayEvent = function (target, name, stopPropagation) { 335 return function (e) { 336 if (stopPropagation === void 0 || stopPropagation) { 337 e.stopPropagation(); 338 } 339 var $target = $(target); 340 var parts = name.split('.').filter(Boolean); 341 var type = parts.shift(); 342 e.target = $target[0]; 343 e.currentTarget = $target[0]; 344 e.namespace = parts.join('.'); 345 e.type = type; 346 $target.trigger(e); 347 }; 348 }; 349 350 /** 351 * Replaces a Bootstrap jQuery plugin definition. 352 * 353 * @param {String} id 354 * A jQuery plugin identifier located in $.fn. 355 * @param {Function} callback 356 * A callback function that is immediately invoked and must return a 357 * function that will be used as the plugin constructor. 358 * @param {Boolean} [noConflict] 359 * Flag indicating whether or not to create a ".noConflict()" helper method 360 * for the plugin. 361 */ 362 Bootstrap.replacePlugin = function (id, callback, noConflict) { 363 // Immediately return if plugin doesn't exist. 364 if (typeof $.fn[id] !== 'function') { 365 return this.fatal('Specified jQuery plugin identifier does not exist: @id', {'@id': id}); 366 } 367 368 // Immediately return if callback isn't a function. 369 if (typeof callback !== 'function') { 370 return this.fatal('You must provide a valid callback function to replace a jQuery plugin: @callback', {'@callback': callback}); 371 } 372 373 // Determine existing plugin constructor. 374 var constructor = $.fn[id] && $.fn[id].Constructor || $.fn[id]; 375 var plugin = callback.apply(constructor, [this.settings]); 376 377 // Immediately return if plugin isn't a function. 378 if (typeof plugin !== 'function') { 379 return this.fatal('Returned value from callback is not a usable function to replace a jQuery plugin "@id": @plugin', {'@id': id, '@plugin': plugin}); 380 } 381 382 this.wrapPluginConstructor(constructor, plugin); 383 384 // Add a ".noConflict()" helper method. 385 this.pluginNoConflict(id, plugin, noConflict); 386 387 $.fn[id] = plugin; 388 }; 389 390 /** 391 * Simulates a native event on an element in the browser. 392 * 393 * Note: This is a fairly complete modern implementation. If things aren't 394 * working quite the way you intend (in older browsers), you may wish to use 395 * the jQuery.simulate plugin. If it's available, this method will defer to 396 * that plugin. 397 * 398 * @see https://github.com/jquery/jquery-simulate 399 * 400 * @param {HTMLElement|jQuery} element 401 * A DOM element to dispatch event on. Note: this may be a jQuery object, 402 * however be aware that this will trigger the same event for each element 403 * inside the jQuery collection; use with caution. 404 * @param {String|String[]} type 405 * The type(s) of event to simulate. 406 * @param {Object} [options] 407 * An object of options to pass to the event constructor. Typically, if 408 * an event is being proxied, you should just pass the original event 409 * object here. This allows, if the browser supports it, to be a truly 410 * simulated event. 411 * 412 * @return {Boolean} 413 * The return value is false if event is cancelable and at least one of the 414 * event handlers which handled this event called Event.preventDefault(). 415 * Otherwise it returns true. 416 */ 417 Bootstrap.simulate = function (element, type, options) { 418 // Handle jQuery object wrappers so it triggers on each element. 419 var ret = true; 420 if (element instanceof $) { 421 element.each(function () { 422 if (!Bootstrap.simulate(this, type, options)) { 423 ret = false;
424 } 425 }); 426 return ret; 427 } 428 429 if (!(element instanceof HTMLElement)) { 430 this.fatal('Passed element must be an instance of HTMLElement, got "@type" instead.', { 431 '@type': typeof element, 432 }); 433 } 434 435 // Defer to the jQuery.simulate plugin, if it's available. 436 if (typeof $.simulate === 'function') { 437 new $.simulate(element, type, options); 438 return true; 439 } 440 441 var event; 442 var ctor; 443 var types = [].concat(type); 444 for (var i = 0, l = types.length; i < l; i++) { 445 type = types[i]; 446 for (var name in this.eventMap) { 447 if (this.eventMap[name].test(type)) { 448 ctor = name; 449 break; 450 } 451 } 452 if (!ctor) { 453 throw new SyntaxError('Only rudimentary HTMLEvents, KeyboardEvents and MouseEvents are supported: ' + type); 454 } 455 var opts = {bubbles: true, cancelable: true}; 456 if (ctor === 'KeyboardEvent' || ctor === 'MouseEvent') { 457 $.extend(opts, {ctrlKey: !1, altKey: !1, shiftKey: !1, metaKey: !1}); 458 } 459 if (ctor === 'MouseEvent') { 460 $.extend(opts, {button: 0, pointerX: 0, pointerY: 0, view: window}); 461 } 462 if (options) { 463 $.extend(opts, options); 464 } 465 if (typeof window[ctor] === 'function') { 466 event = new window[ctor](type, opts); 467 if (!element.dispatchEvent(event)) { 468 ret = false;
469 } 470 } 471 else if (document.createEvent) { 472 event = document.createEvent(ctor); 473 event.initEvent(type, opts.bubbles, opts.cancelable); 474 if (!element.dispatchEvent(event)) { 475 ret = false; 476 } 477 } 478 else if (typeof element.fireEvent === 'function') { 479 event = $.extend(document.createEventObject(), opts); 480 if (!element.fireEvent('on' + type, event)) { 481 ret = false; 482 } 483 } 484 else if (typeof element[type]) { 485 element[type](); 486 } 487 } 488 return ret; 489 }; 490 491 /** 492 * Strips HTML and returns just text. 493 * 494 * @param {String|Element|jQuery} html 495 * A string of HTML content, an Element DOM object or a jQuery object. 496 * 497 * @return {String} 498 * The text without HTML tags. 499 * 500 * @todo Replace with http://locutus.io/php/strings/strip_tags/ 501 */ 502 Bootstrap.stripHtml = function (html) { 503 if (html instanceof $) { 504 html = html.html(); 505 } 506 else if (html instanceof Element) { 507 html = html.innerHTML; 508 } 509 var tmp = document.createElement('DIV'); 510 tmp.innerHTML = html; 511 return (tmp.textContent || tmp.innerText || '').replace(/^[\s\n\t]*|[\s\n\t]*$/, ''); 512 }; 513 514 /** 515 * Provide a helper method for displaying when something is unsupported. 516 * 517 * @param {String} type 518 * The type of unsupported object, e.g. method or option. 519 * @param {String} name 520 * The name of the unsupported object. 521 * @param {*} [value] 522 * The value of the unsupported object. 523 */ 524 Bootstrap.unsupported = function (type, name, value) { 525 Bootstrap.warn('Unsupported by Drupal Bootstrap: (@type) @name -> @value', { 526 '@type': type, 527 '@name': name, 528 '@value': typeof value === 'object' ? JSON.stringify(value) : value 529 }); 530 }; 531 532 /** 533 * Provide a helper method to display a warning. 534 * 535 * @param {String} message 536 * The message to display. 537 * @param {Object} [args] 538 * Arguments to use as replacements in Drupal.formatString. 539 */ 540 Bootstrap.warn = function (message, args) { 541 if (this.settings.dev && console.warn) { 542 console.warn(Drupal.formatString(message, args)); 543 } 544 }; 545 546 /** 547 * Wraps a plugin with common functionality. 548 * 549 * @param {Function} constructor 550 * A plugin constructor being wrapped. 551 * @param {Object|Function} plugin 552 * The plugin being wrapped. 553 * @param {Boolean} [extend = false] 554 * Whether to add super extensibility. 555 */ 556 Bootstrap.wrapPluginConstructor = function (constructor, plugin, extend) { 557 var proto = constructor.prototype; 558 559 // Add a jQuery UI like option getter/setter method. 560 var option = this.option; 561 if (proto.option === void(0)) { 562 proto.option = function () { 563 return option.apply(this, arguments); 564 }; 565 } 566 567 if (extend) { 568 // Handle prototype properties separately. 569 if (plugin.prototype !== void 0) { 570 for (var key in plugin.prototype) { 571 if (!plugin.prototype.hasOwnProperty(key)) continue; 572 var value = plugin.prototype[key]; 573 if (typeof value === 'function') { 574 proto[key] = this.superWrapper(proto[key] || function () {}, value); 575 } 576 else { 577 proto[key] = $.isPlainObject(value) ? $.extend(true, {}, proto[key], value) : value; 578 } 579 } 580 } 581 delete plugin.prototype; 582 583 // Handle static properties. 584 for (key in plugin) { 585 if (!plugin.hasOwnProperty(key)) continue; 586 value = plugin[key]; 587 if (typeof value === 'function') { 588 constructor[key] = this.superWrapper(constructor[key] || function () {}, value); 589 } 590 else { 591 constructor[key] = $.isPlainObject(value) ? $.extend(true, {}, constructor[key], value) : value; 592 } 593 } 594 } 595 }; 596 597 // Add Bootstrap to the global Drupal object. 598 Drupal.bootstrap = Drupal.bootstrap || Bootstrap; 599 600})(window._, window.jQuery, window.Drupal, window.drupalSettings); 601; 602(function ($, _) { 603 604 /** 605 * @class Attributes 606 * 607 * Modifies attributes. 608 * 609 * @param {Object|Attributes} attributes 610 * An object to initialize attributes with. 611 */ 612 var Attributes = function (attributes) { 613 this.data = {}; 614 this.data['class'] = [];
615 this.merge(attributes); 616 }; 617 618 /** 619 * Renders the attributes object as a string to inject into an HTML element. 620 * 621 * @return {String} 622 * A rendered string suitable for inclusion in HTML markup. 623 */ 624 Attributes.prototype.toString = function () { 625 var output = ''; 626 var name, value; 627 var checkPlain = function (str) { 628 return str && str.toString().replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>') || ''; 629 }; 630 var data = this.getData(); 631 for (name in data) { 632 if (!data.hasOwnProperty(name)) continue; 633 value = data[name]; 634 if (_.isFunction(value)) value = value(); 635 if (_.isObject(value)) value = _.values(value); 636 if (_.isArray(value)) value = value.join(' '); 637 output += ' ' + checkPlain(name) + '="' + checkPlain(value) + '"'; 638 } 639 return output; 640 }; 641 642 /** 643 * Renders the Attributes object as a plain object. 644 * 645 * @return {Object} 646 * A plain object suitable for inclusion in DOM elements. 647 */ 648 Attributes.prototype.toPlainObject = function () { 649 var object = {}; 650 var name, value; 651 var data = this.getData(); 652 for (name in data) { 653 if (!data.hasOwnProperty(name)) continue; 654 value = data[name]; 655 if (_.isFunction(value)) value = value(); 656 if (_.isObject(value)) value = _.values(value); 657 if (_.isArray(value)) value = value.join(' '); 658 object[name] = value; 659 } 660 return object; 661 }; 662 663 /** 664 * Add class(es) to the array. 665 * 666 * @param {string|Array} value 667 * An individual class or an array of classes to add. 668 * 669 * @return {Attributes} 670 * 671 * @chainable 672 */ 673 Attributes.prototype.addClass = function (value) { 674 var args = Array.prototype.slice.call(arguments); 675 this.data['class'] = this.sanitizeClasses(this.data['class'].concat(args)); 676 return this; 677 }; 678 679 /** 680 * Returns whether the requested attribute exists. 681 * 682 * @param {string} name 683 * An attribute name to check. 684 * 685 * @return {boolean} 686 * TRUE or FALSE 687 */ 688 Attributes.prototype.exists = function (name) { 689 return this.data[name] !== void(0) && this.data[name] !== null; 690 }; 691 692 /** 693 * Retrieve a specific attribute from the array. 694 * 695 * @param {string} name 696 * The specific attribute to retrieve. 697 * @param {*} defaultValue 698 * (optional) The default value to set if the attribute does not exist. 699 * 700 * @return {*} 701 * A specific attribute value, passed by reference. 702 */ 703 Attributes.prototype.get = function (name, defaultValue) { 704 if (!this.exists(name)) this.data[name] = defaultValue; 705 return this.data[name]; 706 }; 707 708 /** 709 * Retrieves a cloned copy of the internal attributes data object. 710 * 711 * @return {Object} 712 */ 713 Attributes.prototype.getData = function () { 714 return _.extend({}, this.data); 715 }; 716 717 /** 718 * Retrieves classes from the array. 719 * 720 * @return {Array} 721 * The classes array. 722 */ 723 Attributes.prototype.getClasses = function () { 724 return this.get('class', []); 725 }; 726 727 /** 728 * Indicates whether a class is present in the array. 729 * 730 * @param {string|Array} className 731 * The class(es) to search for. 732 * 733 * @return {boolean} 734 * TRUE or FALSE 735 */ 736 Attributes.prototype.hasClass = function (className) { 737 className = this.sanitizeClasses(Array.prototype.slice.call(arguments)); 738 var classes = this.getClasses(); 739 for (var i = 0, l = className.length; i < l; i++) { 740 // If one of the classes fails, immediately return false. 741 if (_.indexOf(classes, className[i]) === -1) { 742 return false; 743 } 744 } 745 return true; 746 }; 747 748 /** 749 * Merges multiple values into the array. 750 * 751 * @param {Attributes|Node|jQuery|Object} object 752 * An Attributes object with existing data, a Node DOM element, a jQuery 753 * instance or a plain object where the key is the attribute name and the 754 * value is the attribute value. 755 * @param {boolean} [recursive] 756 * Flag determining whether or not to recursively merge key/value pairs. 757 * 758 * @return {Attributes} 759 * 760 * @chainable 761 */ 762 Attributes.prototype.merge = function (object, recursive) { 763 // Immediately return if there is nothing to merge. 764 if (!object) { 765 return this; 766 } 767 768 // Get attributes from a jQuery element. 769 if (object instanceof $) { 770 object = object[0]; 771 } 772 773 // Get attributes from a DOM element. 774 if (object instanceof Node) { 775 object = Array.prototype.slice.call(object.attributes).reduce(function (attributes, attribute) { 776 attributes[attribute.name] = attribute.value; 777 return attributes; 778 }, {}); 779 } 780 // Get attributes from an Attributes instance. 781 else if (object instanceof Attributes) { 782 object = object.getData(); 783 } 784 // Otherwise, clone the object. 785 else { 786 object = _.extend({}, object); 787 } 788 789 // By this point, there should be a valid plain object. 790 if (!$.isPlainObject(object)) { 791 setTimeout(function () { 792 throw new Error('Passed object is not supported: ' + object); 793 }); 794 return this; 795 } 796 797 // Handle classes separately. 798 if (object && object['class'] !== void 0) { 799 this.addClass(object['class']); 800 delete object['class']; 801 } 802 803 if (recursive === void 0 || recursive) { 804 this.data = $.extend(true, {}, this.data, object); 805 } 806 else { 807 this.data = $.extend({}, this.data, object); 808 } 809 810 return this; 811 }; 812 813 /** 814 * Removes an attribute from the array. 815 * 816 * @param {string} name 817 * The name of the attribute to remove. 818 * 819 * @return {Attributes} 820 * 821 * @chainable 822 */ 823 Attributes.prototype.remove = function (name) { 824 if (this.exists(name)) delete this.data[name]; 825 return this; 826 }; 827 828 /** 829 * Removes a class from the attributes array. 830 * 831 * @param {...string|Array} className 832 * An individual class or an array of classes to remove. 833 * 834 * @return {Attributes} 835 * 836 * @chainable 837 */ 838 Attributes.prototype.removeClass = function (className) { 839 var remove = this.sanitizeClasses(Array.prototype.slice.apply(arguments)); 840 this.data['class'] = _.without(this.getClasses(), remove); 841 return this; 842 }; 843 844 /** 845 * Replaces a class in the attributes array. 846 * 847 * @param {string} oldValue 848 * The old class to remove. 849 * @param {string} newValue 850 * The new class. It will not be added if the old class does not exist. 851 * 852 * @return {Attributes} 853 * 854 * @chainable 855 */ 856 Attributes.prototype.replaceClass = function (oldValue, newValue) { 857 var classes = this.getClasses(); 858 var i = _.indexOf(this.sanitizeClasses(oldValue), classes); 859 if (i >= 0) { 860 classes[i] = newValue; 861 this.set('class', classes); 862 } 863 return this; 864 }; 865 866 /** 867 * Ensures classes are flattened into a single is an array and sanitized. 868 * 869 * @param {...String|Array} classes 870 * The class or classes to sanitize. 871 * 872 * @return {Array} 873 * A sanitized array of classes. 874 */ 875 Attributes.prototype.sanitizeClasses = function (classes) { 876 return _.chain(Array.prototype.slice.call(arguments)) 877 // Flatten in case there's a mix of strings and arrays. 878 .flatten() 879 880 // Split classes that may have been added with a space as a separator. 881 .map(function (string) { 882 return string.split(' '); 883 }) 884 885 // Flatten again since it was just split into arrays. 886 .flatten() 887 888 // Filter out empty items. 889 .filter() 890
891 // Clean the class to ensure it's a valid class name. 892 .map(function (value) { 893 return Attributes.cleanClass(value); 894 }) 895 896 // Ensure classes are unique. 897 .uniq() 898 899 // Retrieve the final value. 900 .value(); 901 }; 902 903 /** 904 * Sets an attribute on the array. 905 * 906 * @param {string} name 907 * The name of the attribute to set. 908 * @param {*} value 909 * The value of the attribute to set. 910 * 911 * @return {Attributes} 912 * 913 * @chainable 914 */ 915 Attributes.prototype.set = function (name, value) { 916 var obj = $.isPlainObject(name) ? name : {}; 917 if (typeof name === 'string') { 918 obj[name] = value; 919 } 920 return this.merge(obj); 921 }; 922 923 /** 924 * Prepares a string for use as a CSS identifier (element, class, or ID name). 925 * 926 * Note: this is essentially a direct copy from 927 * \Drupal\Component\Utility\Html::cleanCssIdentifier 928 * 929 * @param {string} identifier 930 * The identifier to clean. 931 * @param {Object} [filter] 932 * An object of string replacements to use on the identifier. 933 * 934 * @return {string} 935 * The cleaned identifier. 936 */ 937 Attributes.cleanClass = function (identifier, filter) { 938 filter = filter || { 939 ' ': '-', 940 '_': '-', 941 '/': '-', 942 '[': '-', 943 ']': '' 944 }; 945 946 identifier = identifier.toLowerCase(); 947 948 if (filter['__'] === void 0) { 949 identifier = identifier.replace('__', '#DOUBLE_UNDERSCORE#'); 950 } 951 952 identifier = identifier.replace(Object.keys(filter), Object.keys(filter).map(function(key) { return filter[key]; })); 953 954 if (filter['__'] === void 0) { 955 identifier = identifier.replace('#DOUBLE_UNDERSCORE#', '__'); 956 } 957
958 identifier = identifier.replace(/[^\u002D\u0030-\u0039\u0041-\u005A\u005F\u0061-\u007A\u00A1-\uFFFF]/g, ''); 959 identifier = identifier.replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__']); 960 961 return identifier; 962 }; 963 964 /** 965 * Creates an Attributes instance. 966 * 967 * @param {object|Attributes} [attributes] 968 * An object to initialize attributes with. 969 * 970 * @return {Attributes} 971 * An Attributes instance. 972 * 973 * @constructor 974 */ 975 Attributes.create = function (attributes) { 976 return new Attributes(attributes); 977 }; 978 979 window.Attributes = Attributes; 980 981})(window.jQuery, window._); 982; 983/** 984 * @file 985 * Theme hooks for the Drupal Bootstrap base theme. 986 */ 987(function ($, Drupal, Bootstrap, Attributes) { 988 989 /** 990 * Fallback for theming an icon if the Icon API module is not installed. 991 */ 992 if (!Drupal.icon) Drupal.icon = { bundles: {} }; 993 if (!Drupal.theme.icon || Drupal.theme.prototype.icon) { 994 $.extend(Drupal.theme, /** @lends Drupal.theme */ { 995 /** 996 * Renders an icon. 997 * 998 * @param {string} bundle 999 * The bundle which the icon belongs to. 1000 * @param {string} icon 1001 * The name of the icon to render. 1002 * @param {object|Attributes} [attributes] 1003 * An object of attributes to also apply to the icon. 1004 * 1005 * @returns {string} 1006 */ 1007 icon: function (bundle, icon, attributes) { 1008 if (!Drupal.icon.bundles[bundle]) return ''; 1009 attributes = Attributes.create(attributes).addClass('icon').set('aria-hidden', 'true'); 1010 icon = Drupal.icon.bundles[bundle](icon, attributes); 1011 return '<span' + attributes + '></span>'; 1012 } 1013 }); 1014 } 1015 1016 /** 1017 * Callback for modifying an icon in the "bootstrap" icon bundle. 1018 * 1019 * @param {string} icon 1020 * The icon being rendered. 1021 * @param {Attributes} attributes 1022 * Attributes object for the icon. 1023 */ 1024 Drupal.icon.bundles.bootstrap = function (icon, attributes) { 1025 attributes.addClass(['glyphicon', 'glyphicon-' + icon]); 1026 }; 1027 1028 /** 1029 * Add necessary theming hooks. 1030 */ 1031 $.extend(Drupal.theme, /** @lends Drupal.theme */ { 1032 1033 /** 1034 * Renders a Bootstrap AJAX glyphicon throbber. 1035 * 1036 * @returns {string} 1037 */ 1038 ajaxThrobber: function () { 1039 return Drupal.theme('bootstrapIcon', 'refresh', {'class': ['ajax-throbber', 'glyphicon-spin'] }); 1040 }, 1041 1042 /** 1043 * Renders a button element. 1044 * 1045 * @param {object|Attributes} attributes 1046 * An object of attributes to apply to the button. If it contains one of: 1047 * - value: The label of the button. 1048 * - context: The context type of Bootstrap button, can be one of: 1049 * - default 1050 * - primary 1051 * - success 1052 * - info 1053 * - warning 1054 * - danger 1055 * - link 1056 * 1057 * @returns {string} 1058 */ 1059 button: function (attributes) { 1060 attributes = Attributes.create(attributes).addClass('btn'); 1061 var context = attributes.get('context', 'default'); 1062 var label = attributes.get('value', ''); 1063 attributes.remove('context').remove('value'); 1064 if (!attributes.hasClass(['btn-default', 'btn-primary', 'btn-success', 'btn-info', 'btn-warning', 'btn-danger', 'btn-link'])) { 1065 attributes.addClass('btn-' + Bootstrap.checkPlain(context)); 1066 } 1067 1068 // Attempt to, intelligently, provide a default button "type". 1069 if (!attributes.exists('type')) { 1070 attributes.set('type', attributes.hasClass('form-submit') ? 'submit' : 'button'); 1071 } 1072 1073 return '<button' + attributes + '>' + label + '</button>'; 1074 }, 1075 1076 /** 1077 * Alias for "button" theme hook. 1078 * 1079 * @param {object|Attributes} attributes 1080 * An object of attributes to apply to the button. 1081 * 1082 * @see Drupal.theme.button() 1083 * 1084 * @returns {string} 1085 */ 1086 btn: function (attributes) { 1087 return Drupal.theme('button', attributes); 1088 }, 1089 1090 /** 1091 * Renders a button block element. 1092 * 1093 * @param {object|Attributes} attributes 1094 * An object of attributes to apply to the button. 1095 * 1096 * @see Drupal.theme.button() 1097 * 1098 * @returns {string} 1099 */ 1100 'btn-block': function (attributes) { 1101 return Drupal.theme('button', Attributes.create(attributes).addClass('btn-block')); 1102 }, 1103 1104 /**
1105 * Renders a large button element. 1106 * 1107 * @param {object|Attributes} attributes 1108 * An object of attributes to apply to the button. 1109 * 1110 * @see Drupal.theme.button() 1111 * 1112 * @returns {string} 1113 */ 1114 'btn-lg': function (attributes) { 1115 return Drupal.theme('button', Attributes.create(attributes).addClass('btn-lg')); 1116 }, 1117 1118 /** 1119 * Renders a small button element. 1120 * 1121 * @param {object|Attributes} attributes 1122 * An object of attributes to apply to the button. 1123 * 1124 * @see Drupal.theme.button() 1125 * 1126 * @returns {string} 1127 */ 1128 'btn-sm': function (attributes) { 1129 return Drupal.theme('button', Attributes.create(attributes).addClass('btn-sm')); 1130 }, 1131 1132 /** 1133 * Renders an extra small button element. 1134 * 1135 * @param {object|Attributes} attributes 1136 * An object of attributes to apply to the button. 1137 * 1138 * @see Drupal.theme.button() 1139 * 1140 * @returns {string} 1141 */ 1142 'btn-xs': function (attributes) { 1143 return Drupal.theme('button', Attributes.create(attributes).addClass('btn-xs')); 1144 }, 1145 1146 /** 1147 * Renders a glyphicon. 1148 * 1149 * @param {string} name 1150 * The name of the glyphicon. 1151 * @param {object|Attributes} [attributes] 1152 * An object of attributes to apply to the icon. 1153 * 1154 * @returns {string} 1155 */ 1156 bootstrapIcon: function (name, attributes) { 1157 return Drupal.theme('icon', 'bootstrap', name, attributes); 1158 } 1159 1160 }); 1161 1162})(window.jQuery, window.Drupal, window.Drupal.bootstrap, window.Attributes); 1163; 1164(function ($) { 1165 $(document).ready(function () { 1166 $('.front .console-container .last a').on('click', function (e) { 1167 e.preventDefault(); 1168 $('body, html').animate({scrollTop: 0}, 'slow'); 1169 }); 1170 $(document).ajaxComplete(function () { 1171 $('input[type=\"checkbox\"], .form-select, select').uniform(); 1172 }); 1173 // print 1174 $('.share-print').click(function () { 1175 window.print(); 1176 }); 1177 1178 }); 1179 /* 1180 $('.form-select').uniform(); 1181 1182 $(window).resize(function () { 1183 if ($('.navbar-header').width() > 1024) { 1184 $('.menu-principale .nav-collapse a.dropdown-toggle').click(function (f) { 1185 f.preventDefault(); 1186 }); 1187 } 1188 }); */ 1189 1190 Drupal.behaviors.refreshpage_responsive = { 1191 attach: function (context, settings) { 1192 1193 function reload_page() { 1194 /*$.ajax({ 1195 type: 'GET', 1196 url: Drupal.settings.basePath + Drupal.settings.pathPrefix + 'ajax/clearcache', 1197 dataType: 'html', 1198 success: function (response) { 1199 if (typeof response !== 'undefined') { 1200 location.reload(); 1201 } 1202 }, 1203 });*/ 1204 // location.reload(); 1205 } 1206 var width = $(window).width(); 1207 if (width < 951 && !$('body', context).hasClass('mobile-footer')) { 1208 reload_page(); 1209 } else if (width > 950 && !$('body', context).hasClass('tablet-footer')) { 1210 reload_page(); 1211 } 1212 $(window).resize(function () { 1213 width = $(window).width(); 1214 if (width < 951 && !$('body', context).hasClass('mobile-footer')) { 1215 reload_page(); 1216 } else if (width > 950 && !$('body', context).hasClass('tablet-footer')) { 1217 reload_page(); 1218 } 1219 1220 }); 1221 } 1222 }; 1223 1224 1225})(jQuery); 1226 1227(function ($, Drupal, drupalSettings) { 1228 1229 'use strict'; 1230 1231 Drupal.behaviors.consent_custom_improvements = { 1232 attach: function (context, settings) { 1233 1234 // Fix a bug on clicking the withdraw/decline button 1235 // Maybe fixed in a next release of the EU Cookie Compliance module 1236 jQuery(document).ready(function () { 1237 1238 jQuery('.eu-cookie-withdraw-button').removeClass('hidden').css('float', 'left'); 1239 jQuery('.eu-cookie-withdraw-button').click(Drupal.eu_cookie_compliance.declineAction); 1240 }); 1241 1242 // // Bind the event triggered by EU Cookie Compliance JS script when the popup is ready 1243 // // @see eu_cookie_compliance/js/eu_cookie_compliance.js 1244 // $(document).on('eu_cookie_compliance_popup_open', '#sliding-popup', function() { 1245 1246 // if ($('#eu-cookie-compliance-categories').length == 1) { 1247 1248 // $('.eu-cookie-compliance-categories-buttons').append('<button type="button" class="ecc-hide-categories">Annuler</button>'); 1249 // $('button.ecc-hide-categories').click(function() { 1250 // $('#eu-cookie-compliance-categories').hide(); 1251 // $('#popup-text, #popup-buttons').show(); 1252 // }); 1253 1254 // $('#popup-buttons').append('<button type="button" class="ecc-show-categories">Options de cookies</button>'); 1255 // $('button.ecc-show-categories').click(function() { 1256 // $('#popup-text, #popup-buttons').hide(); 1257 // $('#eu-cookie-compliance-categories').show(); 1258 // }); 1259 1260 // } 1261 1262 // }); 1263 1264 1265 1266 } 1267 }; 1268 1269})(jQuery, Drupal, drupalSettings); 1270 1271 1272 1273 1274 1275;
1276!function(t,e,i){!function(){var s,a,n,h="2.2.3",o="datepicker",r=".datepicker-here",c=!1,d='<div class="datepicker"><i class="datepicker--pointer"></i><nav class="datepicker--nav"></nav><div class="datepicker--content"></div></div>',l={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",range:!1,todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsField:"monthsShort",prevHtml:'<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>',nextHtml:'<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>',navTitles:{days:"MM, <i>yyyy</i>",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,onlyTimepicker:!1,dateTimeSeparator:" ",timeFormat:"",minHours:0,maxHours:24,minMinutes:0,maxMinutes:59,hoursStep:1,minutesStep:1,onSelect:"",onShow:"",onHide:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},u={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]},m=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},l,a,this.$el.data()),s==i&&(s=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this._prevOnSelectValue="",this.init()};n=m,n.prototype={VERSION:h,viewIndexes:["days","months","years"],init:function(){c||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents()),this.opts.keyboardNav&&!this.opts.onlyTimepicker&&this._bindKeyboardEvents(),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this))),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.opts.timepicker&&(this.timepicker=new e.fn.datepicker.Timepicker(this,this.opts),this._bindTimepickerEvents()),this.opts.onlyTimepicker&&this.$datepicker.addClass("-only-timepicker-"),this.views[this.currentView]=new e.fn.datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new e.fn.datepicker.Navigation(this,this.opts),this.view=this.currentView,this.$el.on("clickCell.adp",this._onClickCell.bind(this)),this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent+".adp",this._onShowEvent.bind(this)),this.$el.on("mouseup.adp",this._onMouseUpEl.bind(this)),this.$el.on("blur.adp",this._onBlur.bind(this)),this.$el.on("keyup.adp",this._onKeyUpGeneral.bind(this)),e(t).on("resize.adp",this._onResize.bind(this)),e("body").on("mouseup.adp",this._onMouseUpBody.bind(this))},_bindKeyboardEvents:function(){this.$el.on("keydown.adp",this._onKeyDown.bind(this)),this.$el.on("keyup.adp",this._onKeyUp.bind(this)),this.$el.on("hotKey.adp",this._onHotKey.bind(this))},_bindTimepickerEvents:function(){this.$el.on("timeChange.adp",this._onTimeChange.bind(this))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=e.fn.datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},e.fn.datepicker.language.ru)),this.loc=e.extend(!0,{},e.fn.datepicker.language.ru,e.fn.datepicker.language[t])):this.loc=e.extend(!0,{},e.fn.datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.timeFormat&&(this.loc.timeFormat=this.opts.timeFormat),""!==this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay),this.opts.timepicker&&(this.loc.dateFormat=[this.loc.dateFormat,this.loc.timeFormat].join(this.opts.dateTimeSeparator)),this.opts.onlyTimepicker&&(this.loc.dateFormat=this.loc.timeFormat);var i=this._getWordBoundaryRegExp;(this.loc.timeFormat.match(i("aa"))||this.loc.timeFormat.match(i("AA")))&&(this.ampm=!0)},_buildDatepickersContainer:function(){c=!0,s.append('<div class="datepickers-container" id="datepickers-container"></div>'),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,i=e('<div class="datepicker-inline">');t="INPUT"==this.el.nodeName?this.opts.inline?i.insertAfter(this.$el):a:i.appendTo(this.$el),this.$datepicker=e(d).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length){if(""===this._prevOnSelectValue)return;return this._prevOnSelectValue="",this.opts.onSelect("","",this)}var t,e=this.selectedDates,i=n.getParsedDate(e[0]),s=this,a=new Date(i.year,i.month,i.date,i.hours,i.minutes);t=e.map(function(t){return s.formatDate(s.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),(this.opts.multipleDates||this.opts.range)&&(a=e.map(function(t){var e=n.getParsedDate(t);return new Date(e.year,e.month,e.date,e.hours,e.minutes)})),this._prevOnSelectValue=t,this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var i,s=t,a=this._getWordBoundaryRegExp,h=this.loc,o=n.getLeadingZeroNum,r=n.getDecade(e),c=n.getParsedDate(e),d=c.fullHours,l=c.hours,u=t.match(a("aa"))||t.match(a("AA")),m="am",p=this._replacer;switch(this.opts.timepicker&&this.timepicker&&u&&(i=this.timepicker._getValidHoursFromDate(e,u),d=o(i.hours),l=i.hours,m=i.dayPeriod),!0){case/@/.test(s):s=s.replace(/@/,e.getTime());case/aa/.test(s):s=p(s,a("aa"),m);case/AA/.test(s):s=p(s,a("AA"),m.toUpperCase());case/dd/.test(s):s=p(s,a("dd"),c.fullDate);case/d/.test(s):s=p(s,a("d"),c.date);case/DD/.test(s):s=p(s,a("DD"),h.days[c.day]);case/D/.test(s):s=p(s,a("D"),h.daysShort[c.day]);case/mm/.test(s):s=p(s,a("mm"),c.fullMonth);case/m/.test(s):s=p(s,a("m"),c.month+1);case/MM/.test(s):s=p(s,a("MM"),this.loc.months[c.month]);case/M/.test(s):s=p(s,a("M"),h.monthsShort[c.month]);case/ii/.test(s):s=p(s,a("ii"),c.fullMinutes);case/i/.test(s):s=p(s,a("i"),c.minutes);case/hh/.test(s):s=p(s,a("hh"),d);case/h/.test(s):s=p(s,a("h"),l);case/yyyy/.test(s):s=p(s,a("yyyy"),c.year);case/yyyy1/.test(s):s=p(s,a("yyyy1"),r[0]);case/yyyy2/.test(s):s=p(s,a("yyyy2"),r[1]);case/yy/.test(s):s=p(s,a("yy"),c.year.toString().slice(-2))}return s}
1276,_replacer:function(t,e,i){return t.replace(e,function(t,e,s,a){return e+i+a})},_getWordBoundaryRegExp:function(t){var e="\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";return new RegExp("(^|>|"+e+")("+t+")($|<|"+e+")","g")},selectDate:function(t){var e=this,i=e.opts,s=e.parsedDate,a=e.selectedDates,h=a.length,o="";if(Array.isArray(t))return void t.forEach(function(t){e.selectDate(t)});if(t instanceof Date){if(this.lastSelectedDate=t,this.timepicker&&this.timepicker._setTime(t),e._trigger("selectDate",t),this.timepicker&&(t.setHours(this.timepicker.hours),t.setMinutes(this.timepicker.minutes)),"days"==e.view&&t.getMonth()!=s.month&&i.moveToOtherMonthsOnSelect&&(o=new Date(t.getFullYear(),t.getMonth(),1)),"years"==e.view&&t.getFullYear()!=s.year&&i.moveToOtherYearsOnSelect&&(o=new Date(t.getFullYear(),0,1)),o&&(e.silent=!0,e.date=o,e.silent=!1,e.nav._render()),i.multipleDates&&!i.range){if(h===i.multipleDates)return;e._isSelected(t)||e.selectedDates.push(t)}else i.range?2==h?(e.selectedDates=[t],e.minRange=t,e.maxRange=""):1==h?(e.selectedDates.push(t),e.maxRange?e.minRange=t:e.maxRange=t,n.bigger(e.maxRange,e.minRange)&&(e.maxRange=e.minRange,e.minRange=t),e.selectedDates=[e.minRange,e.maxRange]):(e.selectedDates=[t],e.minRange=t):e.selectedDates=[t];e._setInputValue(),i.onSelect&&e._triggerOnChange(),i.autoClose&&!this.timepickerIsActive&&(i.multipleDates||i.range?i.range&&2==e.selectedDates.length&&e.hide():e.hide()),e.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,i=this;if(t instanceof Date)return e.some(function(s,a){return n.isSame(s,t)?(e.splice(a,1),i.selectedDates.length?i.lastSelectedDate=i.selectedDates[i.selectedDates.length-1]:(i.minRange="",i.maxRange="",i.lastSelectedDate=""),i.views[i.currentView]._render(),i._setInputValue(),i.opts.onSelect&&i._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date,this.opts.todayButton instanceof Date&&this.selectDate(this.opts.todayButton)},clear:function(){this.selectedDates=[],this.minRange="",this.maxRange="",this.views[this.currentView]._render(),this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,i){var s=arguments.length,a=this.lastSelectedDate;return 2==s?this.opts[t]=i:1==s&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.opts.onlyTimepicker||this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.opts.onlyTimepicker&&this.$datepicker.addClass("-only-timepicker-"),this.opts.timepicker&&(a&&this.timepicker._handleDate(a),this.timepicker._updateRanges(),this.timepicker._updateCurrentTime(),a&&(a.setHours(this.timepicker.hours),a.setMinutes(this.timepicker.minutes))),this._setInputValue(),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime<t&&(this.date=this.maxDate),this.silent=!1},_isSelected:function(t,e){var i=!1;return this.selectedDates.some(function(s){return n.isSame(s,t,e)?(i=s,!0):void 0}),i},_setInputValue:function(){var t,e=this,i=e.opts,s=e.loc.dateFormat,a=i.altFieldDateFormat,n=e.selectedDates.map(function(t){return e.formatDate(s,t)});i.altField&&e.$altField.length&&(t=this.selectedDates.map(function(t){return e.formatDate(a,t)}),t=t.join(this.opts.multipleDatesSeparator),this.$altField.val(t)),n=n.join(this.opts.multipleDatesSeparator),this.$el.val(n)},_isInRange:function(t,e){var i=t.getTime(),s=n.getParsedDate(t),a=n.getParsedDate(this.minDate),h=n.getParsedDate(this.maxDate),o=new Date(s.year,s.month,a.date).getTime(),r=new Date(s.year,s.month,h.date).getTime(),c={day:i>=this.minTime&&i<=this.maxTime,month:o>=this.minTime&&r<=this.maxTime,year:s.year>=a.year&&s.year<=h.year};return e?c[e]:c.day},_getDimensions:function(t){var e=t.offset();
1276return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_getDateFromCell:function(t){var e=this.parsedDate,s=t.data("year")||e.year,a=t.data("month")==i?e.month:t.data("month"),n=t.data("date")||1;return new Date(s,a,n)},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],i=t[1],s="datepicker -"+e+"-"+i+"- -from-"+e+"-";this.visible&&(s+=" active"),this.$datepicker.removeAttr("class").addClass(s)},setPosition:function(t){t=t||this.opts.position;var e,i,s=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,o=n[0],r=n[1];switch(o){case"top":e=s.top-a.height-h;break;case"right":i=s.left+s.width+h;break;case"bottom":e=s.top+s.height+h;break;case"left":i=s.left-a.width-h}switch(r){case"top":e=s.top;break;case"right":i=s.left+s.width-a.width;break;case"bottom":e=s.top+s.height-a.height;break;case"left":i=s.left;break;case"center":/left|right/.test(o)?e=s.top+s.height/2-a.height/2:i=s.left+s.width/2-a.width/2}this.$datepicker.css({left:i,top:e})},show:function(){var t=this.opts.onShow;this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0,t&&this._bindVisionEvents(t)},hide:function(){var t=this.opts.onHide;this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur(),t&&this._bindVisionEvents(t)},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_bindVisionEvents:function(t){this.$datepicker.off("transitionend.dp"),t(this,!1),this.$datepicker.one("transitionend.dp",t.bind(this,this,!0))},_changeView:function(t,e){t=t||this.focused||this.date;var i="up"==e?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),0>i&&(i=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[i]},_handleHotKey:function(t){var e,i,s,a=n.getParsedDate(this._getFocusedDate()),h=this.opts,o=!1,r=!1,c=!1,d=a.year,l=a.month,u=a.date;switch(t){case"ctrlRight":case"ctrlUp":l+=1,o=!0;break;case"ctrlLeft":case"ctrlDown":l-=1,o=!0;break;case"shiftRight":case"shiftUp":r=!0,d+=1;break;case"shiftLeft":case"shiftDown":r=!0,d-=1;break;case"altRight":case"altUp":c=!0,d+=10;break;case"altLeft":case"altDown":c=!0,d-=10;break;case"ctrlShiftUp":this.up()}s=n.getDaysCount(new Date(d,l)),i=new Date(d,l,u),u>s&&(u=s),i.getTime()<this.minTime?i=this.minDate:i.getTime()>this.maxTime&&(i=this.maxDate),this.focused=i,e=n.getParsedDate(i),o&&h.onChangeMonth&&h.onChangeMonth(e.month,e.year),r&&h.onChangeYear&&h.onChangeYear(e.year),c&&h.onChangeDecade&&h.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,i=this,s=this.keys.sort();for(var a in u)t=u[a],s.length==t.length&&t.every(function(t,e){return t==s[e]})&&(i._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var i=n.getParsedDate(this._getFocusedDate()),s=i.year,a=i.month,h=i.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?h-=1:"","month"==e?a-=1:"","year"==e?s-=1:"";break;case 38:"day"==e?h-=7:"","month"==e?a-=3:"","year"==e?s-=4:"";break;case 39:"day"==e?h+=1:"","month"==e?a+=1:"","year"==e?s+=1:"";break;case 40:"day"==e?h+=7:"","month"==e?a+=3:"","year"==e?s+=4:""}var o=new Date(s,a,h);o.getTime()<this.minTime?o=this.minDate:o.getTime()>this.maxTime&&(o=this.maxDate),this.focused=o}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,i){i=i||this.cellType;var s,a=n.getParsedDate(t),h='.datepicker--cell[data-year="'+a.year+'"]';switch(i){case"month":h='[data-month="'+a.month+'"]';break;case"day":h+='[data-month="'+a.month+'"][data-date="'+a.date+'"]'}return s=this.views[this.currentView].$el.find(h),s.length?s:e("")},destroy:function(){var t=this;t.$el.off(".adp").data("datepicker",""),t.selectedDates=[],t.focu
1276sed="",t.views={},t.keys=[],t.minRange="",t.maxRange="",t.opts.inline||!t.elIsInput?t.$datepicker.closest(".datepicker-inline").remove():t.$datepicker.remove()},_handleAlreadySelectedDates:function(t,e){this.opts.range?this.opts.toggleSelected?this.removeDate(e):2!=this.selectedDates.length&&this._trigger("clickCell",e):this.opts.toggleSelected&&this.removeDate(e),this.opts.toggleSelected||(this.lastSelectedDate=t,this.opts.timepicker&&(this.timepicker._setTime(t),this.timepicker.update()))},_onShowEvent:function(t){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,t.originalEvent.inFocus=!0,t.originalEvent.timepickerFocus||this.$el.focus()},_onKeyUpGeneral:function(t){var e=this.$el.val();e||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onMouseUpBody:function(t){t.originalEvent.inFocus||this.visible&&!this.inFocus&&this.hide()},_onMouseUpEl:function(t){t.originalEvent.inFocus=!0,setTimeout(this._onKeyUpGeneral.bind(this),4)},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var i=this._isSelected(this.focused,this.cellType);if(!i)return this.timepicker&&(this.focused.setHours(this.timepicker.hours),this.focused.setMinutes(this.timepicker.minutes)),void this.selectDate(this.focused);this._handleAlreadySelectedDates(i,this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},_onMouseEnterCell:function(t){var i=e(t.target).closest(".datepicker--cell"),s=this._getDateFromCell(i);this.silent=!0,this.focused&&(this.focused=""),i.addClass("-focus-"),this.focused=s,this.silent=!1,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this.focused)&&(this.maxRange=this.minRange,this.minRange=""),this.views[this.currentView]._update())},_onMouseLeaveCell:function(t){var i=e(t.target).closest(".datepicker--cell");i.removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},_onTimeChange:function(t,e,i){var s=new Date,a=this.selectedDates,n=!1;a.length&&(n=!0,s=this.lastSelectedDate),s.setHours(e),s.setMinutes(i),n||this._getCell(s).hasClass("-disabled-")?(this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()):this.selectDate(s)},_onClickCell:function(t,e){this.timepicker&&(e.setHours(this.timepicker.hours),e.setMinutes(this.timepicker.minutes)),this.selectDate(e)},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this._focused)&&(this.maxRange=this.minRange,this.minRange="")),this.silent||(this.date=t)},get focused(){return this._focused},get parsedDate(){return n.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new e.fn.datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=n.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=n.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return n.getDecade(this.date)}},n.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},n.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay(),hours:t.getHours(),fullHours:t.getHours()<10?"0"+t.getHours():t.getHours(),minutes:t.getMinutes(),fullMinutes:t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}}
1276,n.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},n.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,i){return e[i]||0===e[i]?e[i]:void 0})},n.isSame=function(t,e,i){if(!t||!e)return!1;var s=n.getParsedDate(t),a=n.getParsedDate(e),h=i?i:"day",o={day:s.date==a.date&&s.month==a.month&&s.year==a.year,month:s.month==a.month&&s.year==a.year,year:s.year==a.year};return o[h]},n.less=function(t,e,i){return t&&e?e.getTime()<t.getTime():!1},n.bigger=function(t,e,i){return t&&e?e.getTime()>t.getTime():!1},n.getLeadingZeroNum=function(t){return parseInt(t)<10?"0"+t:t},n.resetTime=function(t){return"object"==typeof t?(t=n.getParsedDate(t),new Date(t.year,t.month,t.date)):void 0},e.fn.datepicker=function(t){return this.each(function(){if(e.data(this,o)){var i=e.data(this,o);i.opts=e.extend(!0,i.opts,t),i.update()}else e.data(this,o,new m(this,t))})},e.fn.datepicker.Constructor=m,e.fn.datepicker.language={ru:{days:["ÐоÑкÑеÑенÑе","ÐонеделÑник","ÐÑоÑник","СÑеда","ЧеÑвеÑг","ÐÑÑниÑа","СÑббоÑа"],daysShort:["ÐоÑ","Ðон","ÐÑо","СÑе","ЧеÑ","ÐÑÑ","СÑб"],daysMin:["ÐÑ","Ðн","ÐÑ","СÑ","ЧÑ","ÐÑ","Сб"],months:["ЯнваÑÑ","ФевÑалÑ","ÐаÑÑ","ÐпÑелÑ","Ðай","ÐÑнÑ","ÐÑлÑ","ÐвгÑÑÑ","СенÑÑбÑÑ","ÐкÑÑбÑÑ","ÐоÑбÑÑ","ÐекабÑÑ"],monthsShort:["Янв","Фев","ÐаÑ","ÐпÑ","Ðай","ÐÑн","ÐÑл","Ðвг","Сен","ÐкÑ","ÐоÑ","Ðек"],today:"СегоднÑ",clear:"ÐÑиÑÑиÑÑ",dateFormat:"dd.mm.yyyy",timeFormat:"hh:ii",firstDay:1}},e(function(){e(r).datepicker()})}(),function(){var t={days:'<div class="datepicker--days datepicker--body"><div class="datepicker--days-names"></div><div class="datepicker--cells datepicker--cells-days"></div></div>',months:'<div class="datepicker--months datepicker--body"><div class="datepicker--cells datepicker--cells-months"></div></div>',years:'<div class="datepicker--years datepicker--body"><div class="datepicker--cells datepicker--cells-years"></div></div>'},s=e.fn.datepicker,a=s.Constructor;s.Body=function(t,i,s){this.d=t,this.type=i,this.opts=s,this.$el=e(""),this.opts.onlyTimepicker||this.init()},s.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",e.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=e(t[this.type]).appendTo(this.d.$content),this.$names=e(".datepicker--days-names",this.$el),this.$cells=e(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,s,a){return e=e!=i?e:t,s=s?s:"",a=a!=i?a:0,a>7?s:7==e?this._getDayNamesHtml(t,0,s,++a):(s+='<div class="datepicker--day-name'+(this.d.isWeekend(e)?" -weekend-":"")+'">'+this.d.loc.daysMin[e]+"</div>",this._getDayNamesHtml(t,++e,s,++a))},_getCellContents:function(t,e){var i="datepicker--cell datepicker--cell-"+e,s=new Date,n=this.d,h=a.resetTime(n.minRange),o=a.resetTime(n.maxRange),r=n.opts,c=a.getParsedDate(t),d={},l=c.date;switch(e){case"day":n.isWeekend(c.day)&&(i+=" -weekend-"),c.month!=this.d.parsedDate.month&&(i+=" -other-month-",r.selectOtherMonths||(i+=" -disabled-"),r.showOtherMonths||(l=""));break;case"month":l=n.loc[n.opts.monthsField][c.month];break;case"year":var u=n.curDecade;l=c.year,(c.year<u[0]||c.year>u[1])&&(i+=" -other-decade-",r.selectOtherYears||(i+=" -disabled-"),r.showOtherYears||(l=""))}return r.onRenderCell&&(d=r.onRenderCell(t,e)||{},l=d.html?d.html:l,i+=d.classes?" "+d.classes:""),r.range&&(a.isSame(h,t,e)&&(i+=" -range-from-"),a.isSame(o,t,e)&&(i+=" -range-to-"),1==n.selectedDates.length&&n.focused?((a.bigger(h,t)&&a.less(n.focused,t)||a.less(o,t)&&a.bigger(n.focused,t))&&(i+=" -in-range-"),a.less(o,t)&&a.isSame(n.focused,t)&&(i+=" -range-from-"),a.bigger(h,t)&&a.isSame(n.focused,t)&&(i+=" -range-to-")):2==n.selectedDates.length&&a.bigger(h,t)&&a.less(o,t)&&(i+=" -in-range-")),a.isSame(s,t,e)&&(i+=" -current-"),n.focused&&a.isSame(t,n.focused,e)&&(i+=" -focus-"),n._isSelected(t,e)&&(i+=" -selected-"),(!n._isInRange(t,e)||d.disabled)&&(i+=" -disabled-"),{html:l,classes:i}},_getDaysHtml:function(t){var e=a.getDaysCount(t),i=new Date(t.getFullYear(),t.getMonth(),1).getDay(),s=new Date(t.getFullYear(),t.getMonth(),e).getDay(),n=i-this.d.loc.firstDay,h=6-s+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var o,r,c=-n+1,d="",l=c,u=e+h;u>=l;l++)r=t.getFullYear(),o=t.getMonth(),d+=this._getDayHtml(new Date(r,o,l));return d},_getDayHtml:function(t){var e=this._getCellContents(t,"day");return'<div class="'+e.classes+'" data-date="'+t.getDate()+'" data-month="'+t.getMonth()+'" data-year="'+t.getFullYear()+'">'+e.html+"</div>"},_getMonthsHtml:function(t){for(var e="",i=a.getParsedDate(t),s=0;12>s;)e+=this._getMonthHtml(new Date(i.year,s)),s++;return e},_getMonthHtml:function(t){var e=this._getCellContents(t,"month");return'<div class="'+e.classes+'" data-month="'+t.getMonth()+'">'+e.html+"</div>"},_getYearsHtml:function(t){var e=(a.getParsedDate(t),a.getDecade(t)),i=e[0]-1,s="",n=i;for(n;n<=e[1]+1;n++)s+=this._getYearHtml(new Date(n,0));return s},_getYearHtml:function(t){var e=this._getCellContents(t,"year");return'<div class="'+e.classes+'" data-year="'+t.getFullYear()+'">'+e.html+"</div>"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){this.opts.onlyTimepicker||this._renderTypes[this.type].bind(this)()},_update:function(){var t,i,s,a=e(".datepicker--cell",this.$cells),n=this;
1276a.each(function(a,h){i=e(this),s=n.d._getDateFromCell(e(this)),t=n._getCellContents(s,n.d.cellType),i.attr("class",t.classes)})},show:function(){this.opts.onlyTimepicker||(this.$el.addClass("active"),this.acitve=!0)},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,i=t.data("month")||0,s=t.data("year")||this.d.parsedDate.year,a=this.d;if(a.view!=this.opts.minView)return void a.down(new Date(s,i,e));var n=new Date(s,i,e),h=this.d._isSelected(n,this.d.cellType);return h?void a._handleAlreadySelectedDates.bind(a,h,n)():void a._trigger("clickCell",n)},_onClickCell:function(t){var i=e(t.target).closest(".datepicker--cell");i.hasClass("-disabled-")||this._handleClick.bind(this)(i)}}}(),function(){var t='<div class="datepicker--nav-action" data-action="prev">#{prevHtml}</div><div class="datepicker--nav-title">#{title}</div><div class="datepicker--nav-action" data-action="next">#{nextHtml}</div>',i='<div class="datepicker--buttons"></div>',s='<span class="datepicker--button" data-action="#{action}">#{label}</span>',a=e.fn.datepicker,n=a.Constructor;a.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},a.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",e.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",e.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",e.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this.opts.onlyTimepicker||this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var i=this._getTitle(this.d.currentDate),s=n.template(t,e.extend({title:i},this.opts));this.d.$nav.html(s),"years"==this.d.view&&e(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var i={action:t,label:this.d.loc[t]},a=n.template(s,i);e("[data-action="+t+"]",this.$buttonsContainer).length||this.$buttonsContainer.append(a)},_addButtonsContainer:function(){this.d.$datepicker.append(i),this.$buttonsContainer=e(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,i=t.year,s=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(i,e-1,1),"month")||this._disableNav("prev"),this.d._isInRange(new Date(i,e+1,1),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(i-1,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+1,e,s),"year")||this._disableNav("next");break;case"years":var a=n.getDecade(this.d.date);this.d._isInRange(new Date(a[0]-1,0,1),"year")||this._disableNav("prev"),this.d._isInRange(new Date(a[1]+1,0,1),"year")||this._disableNav("next")}}},_disableNav:function(t){e('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){e('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var i=e(t.target).closest("[data-action]"),s=i.data("action");this.d[s]()},_onClickNavTitle:function(t){return e(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}(),function(){var t='<div class="datepicker--time"><div class="datepicker--time-current"> <span class="datepicker--time-current-hours">#{hourVisible}</span> <span class="datepicker--time-current-colon">:</span> <span class="datepicker--time-current-minutes">#{minValue}</span></div><div class="datepicker--time-sliders"> <div class="datepicker--time-row"> <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/> </div> <div class="datepicker--time-row"> <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/> </div></div></div>',i=e.fn.datepicker,s=i.Constructor;i.Timepicker=function(t,e){this.d=t,this.opts=e,this.init()},i.Timepicker.prototype={init:function(){var t="input";this._setTime(this.d.date),this._buildHTML(),navigator.userAgent.match(/trident/gi)&&(t="change"),this.d.$el.on("selectDate",this._onSelectDate.bind(this)),this.$ranges.on(t,this._onChangeRange.bind(this)),this.$ranges.on("mouseup",this._onMouseUpRange.bind(this)),this.$ranges.on("mousemove focus ",this._onMouseEnterRange.bind(this)),this.$ranges.on("mouseout blur",this._onMouseOutRange.bind(this))},_setTime:function(t){var e=s.getParsedDate(t);this._handleDate(t),this.hours=e.hours<this.minHours?this.minHours:e.hours,this.minutes=e.minutes<this.minMinutes?this.minMinutes:e.minutes},_setMinTimeFromDate:function(t){this.minHours=t.getHours(),this.minMinutes=t.getMinutes(),this.d.lastSelectedDate&&this.d.lastSelectedDate.getHours()>t.getHours()&&(this.minMinutes=this.opts.minMinutes)}
1276,_setMaxTimeFromDate:function(t){ 1277 this.maxHours=t.getHours(),this.maxMinutes=t.getMinutes(),this.d.lastSelectedDate&&this.d.lastSelectedDate.getHours()<t.getHours()&&(this.maxMinutes=this.opts.maxMinutes)},_setDefaultMinMaxTime:function(){var t=23,e=59,i=this.opts;this.minHours=i.minHours<0||i.minHours>t?0:i.minHours,this.minMinutes=i.minMinutes<0||i.minMinutes>e?0:i.minMinutes,this.maxHours=i.maxHours<0||i.maxHours>t?t:i.maxHours,this.maxMinutes=i.maxMinutes<0||i.maxMinutes>e?e:i.maxMinutes},_validateHoursMinutes:function(t){this.hours<this.minHours?this.hours=this.minHours:this.hours>this.maxHours&&(this.hours=this.maxHours),this.minutes<this.minMinutes?this.minutes=this.minMinutes:this.minutes>this.maxMinutes&&(this.minutes=this.maxMinutes)},_buildHTML:function(){var i=s.getLeadingZeroNum,a={hourMin:this.minHours,hourMax:i(this.maxHours),hourStep:this.opts.hoursStep,hourValue:this.hours,hourVisible:i(this.displayHours),minMin:this.minMinutes,minMax:i(this.maxMinutes),minStep:this.opts.minutesStep,minValue:i(this.minutes)},n=s.template(t,a);this.$timepicker=e(n).appendTo(this.d.$datepicker),this.$ranges=e('[type="range"]',this.$timepicker),this.$hours=e('[name="hours"]',this.$timepicker),this.$minutes=e('[name="minutes"]',this.$timepicker),this.$hoursText=e(".datepicker--time-current-hours",this.$timepicker),this.$minutesText=e(".datepicker--time-current-minutes",this.$timepicker),this.d.ampm&&(this.$ampm=e('<span class="datepicker--time-current-ampm">').appendTo(e(".datepicker--time-current",this.$timepicker)).html(this.dayPeriod),this.$timepicker.addClass("-am-pm-"))},_updateCurrentTime:function(){var t=s.getLeadingZeroNum(this.displayHours),e=s.getLeadingZeroNum(this.minutes);this.$hoursText.html(t),this.$minutesText.html(e),this.d.ampm&&this.$ampm.html(this.dayPeriod)},_updateRanges:function(){this.$hours.attr({min:this.minHours,max:this.maxHours}).val(this.hours),this.$minutes.attr({min:this.minMinutes,max:this.maxMinutes}).val(this.minutes)},_handleDate:function(t){this._setDefaultMinMaxTime(),t&&(s.isSame(t,this.d.opts.minDate)?this._setMinTimeFromDate(this.d.opts.minDate):s.isSame(t,this.d.opts.maxDate)&&this._setMaxTimeFromDate(this.d.opts.maxDate)),this._validateHoursMinutes(t)},update:function(){this._updateRanges(),this._updateCurrentTime()},_getValidHoursFromDate:function(t,e){var i=t,a=t;t instanceof Date&&(i=s.getParsedDate(t),a=i.hours);var n=e||this.d.ampm,h="am";if(n)switch(!0){case 0==a:a=12;break;case 12==a:h="pm";break;case a>11:a-=12,h="pm"}return{hours:a,dayPeriod:h}},set hours(t){this._hours=t;var e=this._getValidHoursFromDate(t);this.displayHours=e.hours,this.dayPeriod=e.dayPeriod},get hours(){return this._hours},_onChangeRange:function(t){var i=e(t.target),s=i.attr("name");this.d.timepickerIsActive=!0,this[s]=i.val(),this._updateCurrentTime(),this.d._trigger("timeChange",[this.hours,this.minutes]),this._handleDate(this.d.lastSelectedDate),this.update()},_onSelectDate:function(t,e){this._handleDate(e),this.update()},_onMouseEnterRange:function(t){var i=e(t.target).attr("name");e(".datepicker--time-current-"+i,this.$timepicker).addClass("-focus-")},_onMouseOutRange:function(t){var i=e(t.target).attr("name");this.d.inFocus||e(".datepicker--time-current-"+i,this.$timepicker).removeClass("-focus-")},_onMouseUpRange:function(t){this.d.timepickerIsActive=!1}}}()}(window,jQuery);; 1278;(function ($) { $.fn.datepicker.language['en'] = { 1279 days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 1280 daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 1281 daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], 1282 months: ['January','February','March','April','May','June', 'July','August','September','October','November','December'], 1283 monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1284 today: 'Today', 1285 clear: 'Clear', 1286 dateFormat: 'mm/dd/yyyy', 1287 timeFormat: 'hh:ii aa', 1288 firstDay: 0 1289}; })(jQuery);; 1290;(function ($) { $.fn.datepicker.language['fr'] = { 1291 days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 1292 daysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], 1293 daysMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 1294 months: ['Janvier','Février','Mars','Avril','Mai','Juin', 'Juillet','Août','Septembre','Octobre','N
1294ovembre','Decembre'], 1295 monthsShort: ['Jan', 'Fév', 'Mars', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Dec'], 1296 today: "Aujourd'hui", 1297 clear: 'Effacer', 1298 dateFormat: 'dd/mm/yyyy', 1299 timeFormat: 'hh:ii', 1300 firstDay: 1 1301}; })(jQuery);; 1302/* ======================================================================== 1303 * Bootstrap: alert.js v3.3.4 1304 * http://getbootstrap.com/javascript/#alerts 1305 * ======================================================================== 1306 * Copyright 2011-2015 Twitter, Inc. 1307 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1308 * ======================================================================== */ 1309 1310 1311+function ($) { 1312 'use strict'; 1313 1314 // ALERT CLASS DEFINITION 1315 // ====================== 1316 1317 var dismiss = '[data-dismiss="alert"]' 1318 var Alert = function (el) { 1319 $(el).on('click', dismiss, this.close) 1320 } 1321 1322 Alert.VERSION = '3.3.4' 1323 1324 Alert.TRANSITION_DURATION = 150 1325 1326 Alert.prototype.close = function (e) { 1327 var $this = $(this) 1328 var selector = $this.attr('data-target') 1329 1330 if (!selector) { 1331 selector = $this.attr('href') 1332 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 1333 } 1334 1335 var $parent = $(selector) 1336 1337 if (e) e.preventDefault() 1338 1339 if (!$parent.length) { 1340 $parent = $this.closest('.alert') 1341 } 1342 1343 $parent.trigger(e = $.Event('close.bs.alert')) 1344 1345 if (e.isDefaultPrevented()) return 1346 1347 $parent.removeClass('in') 1348 1349 function removeElement() { 1350 // detach from parent, fire event then clean up data 1351 $parent.detach().trigger('closed.bs.alert').remove() 1352 } 1353 1354 $.support.transition && $parent.hasClass('fade') ? 1355 $parent 1356 .one('bsTransitionEnd', removeElement) 1357 .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 1358 removeElement() 1359 } 1360 1361 1362 // ALERT PLUGIN DEFINITION 1363 // ======================= 1364 1365 function Plugin(option) { 1366 return this.each(function () { 1367 var $this = $(this) 1368 var data = $this.data('bs.alert') 1369 1370 if (!data) $this.data('bs.alert', (data = new Alert(this))) 1371 if (typeof option == 'string') data[option].call($this) 1372 }) 1373 } 1374 1375 var old = $.fn.alert 1376 1377 $.fn.alert = Plugin 1378 $.fn.alert.Constructor = Alert 1379 1380 1381 // ALERT NO CONFLICT 1382 // ================= 1383 1384 $.fn.alert.noConflict = function () { 1385 $.fn.alert = old 1386 return this 1387 } 1388 1389 1390 // ALERT DATA-API 1391 // ============== 1392 1393 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 1394 1395}(jQuery); 1396; 1397/** 1398 * @file 1399 * Bootstrap Popovers. 1400 */ 1401 1402var Drupal = Drupal || {}; 1403 1404(function ($, Drupal, Bootstrap) { 1405 "use strict"; 1406 1407 var $document = $(document); 1408 1409 /** 1410 * Extend the Bootstrap Popover plugin constructor class. 1411 */ 1412 Bootstrap.extendPlugin('popover', function (settings) { 1413 return { 1414 DEFAULTS: { 1415 animation: !!settings.popover_animation, 1416 autoClose: !!settings.popover_auto_close, 1417 enabled: settings.popover_enabled, 1418 html: !!settings.popover_html, 1419 placement: settings.popover_placement, 1420 selector: settings.popover_selector, 1421 trigger: settings.popover_trigger, 1422 title: settings.popover_title, 1423 content: settings.popover_content, 1424 delay: parseInt(settings.popover_delay, 10), 1425 container: settings.popover_container 1426 } 1427 }; 1428 }); 1429 1430 /** 1431 * Bootstrap Popovers. 1432 * 1433 * @todo This should really be properly delegated if selector option is set. 1434 */ 1435 Drupal.behaviors.bootstrapPopovers = { 1436 $activePopover: null, 1437 attach: function (context) { 1438 // Immediately return if popovers are not available. 1439 if (!$.fn.popover || !$.fn.popover.Constructor.DEFAULTS.enabled) { 1440 return; 1441 } 1442 1443 var _this = this; 1444 1445 $document 1446 .on('show.bs.popover', '[data-toggle=popover]', function () { 1447 var $trigger = $(this); 1448 var popover = $trigger.data('bs.popover'); 1449 1450 // Only keep track of clicked triggers that we're manually handling. 1451 if (popover.options.originalTrigger === 'click') { 1452 if (_this.$activePopover && _this.getOption('autoClose') && !_this.$activePopover.is($trigger)) { 1453 _this.$activePopover.popover('hide'); 1454 } 1455 _this.$activePopover = $trigger; 1456 } 1457 }) 1458 // Unfortunately, :focusable is only made available when using jQuery 1459 // UI. While this would be the most semantic pseudo selector to use 1460 // here, jQuery UI may not always be loaded. Instead, just use :visible 1461 // here as this just needs some sort of selector here. This activates 1462 // delegate binding to elements in jQuery so it can work it's bubbling 1463 // focus magic since elements don't really propagate their focus events. 1464 // @see https://www.drupal.org/project/bootstrap/issues/3013236 1465 .on('focus.bs.popover', ':visible', function (e) { 1466 var $target = $(e.target); 1467 if (_this.$activePopover && _this.getOption('autoClose') && !_this.$activePopover.is($target) && !$target.closest('.popover.in')[0]) { 1468 _this.$activePopover.popover('hide'); 1469 _this.$activePopover = null; 1470 } 1471 }) 1472 .on('click.bs.popover', function (e) { 1473 var $target = $(e.target); 1474 if (_this.$activePopover && _this.getOption('autoClose') && !$target.is('[data-toggle=popover]') && !$target.closest('.popover.in')[0]) { 1475 _this.$activePopover.popover('hide'); 1476 _this.$activePopover = null; 1477 } 1478 }) 1479 .on('keyup.bs.popover', function (e) { 1480 if (_this.$activePopover && _this.getOption('autoClose') && e.which === 27) { 1481 _this.$activePopover.popover('hide'); 1482 _this.$activePopover = null; 1483 } 1484 }) 1485 ; 1486 1487 var elements = $(context).find('[data-toggle=popover]').toArray(); 1488 for (var i = 0; i < elements.length; i++) { 1489 var $element = $(elements[i]); 1490 var options = $.extend({}, $.fn.popover.Constructor.DEFAULTS, $element.data()); 1491 1492 // Store the original trigger. 1493 options.originalTrigger = options.trigger; 1494 1495 // If the trigger is "click", then we'll handle it manually here. 1496 if (options.trigger === 'click') { 1497 options.trigger = 'manual'; 1498 } 1499 1500 // Retrieve content from a target element. 1501 var target = options.target || $element.is('a[href^="#"]') && $element.attr('href'); 1502 var $target = $document.find(target).clone(); 1503 if (!options.content && $target[0]) { 1504 $target.removeClass('visually-hidden hidden').removeAttr('aria-hidden'); 1505 options.content = $target.wrap('<div/>').parent()[options.html ? 'html' : 'text']() || ''; 1506 } 1507 1508 // Initialize the popover. 1509 $element.popover(options); 1510 1511 // Handle clicks manually. 1512 if (options.originalTrigger === 'click') { 1513 // To ensure the element is bound multiple times, remove any 1514 // previously set event handler before adding another one. 1515 $element 1516 .off('click.drupal.bootstrap.popover') 1517 .on('click.drupal.bootstrap.popover', function (e) { 1518 $(this).popover('toggle'); 1519 e.preventDefault(); 1520 e.stopPropagation(); 1521 }) 1522 ; 1523 } 1524 } 1525 }, 1526 detach: function (context) { 1527 // Immediately return if popovers are not available. 1528 if (!$.fn.popover || !$.fn.popover.Constructor.DEFAULTS.enabled) { 1529 return; 1530 } 1531 1532 // Destroy all popovers. 1533 $(context).find('[data-toggle="popover"]') 1534 .off('click.drupal.bootstrap.popover') 1535 .popover('destroy') 1536 ; 1537 }, 1538 getOption: function(name, defaultValue, element) { 1539 var $element = element ? $(element) : this.$activePopover; 1540 var options = $.extend(true, {}, $.fn.popover.Constructor.DEFAULTS, ($element && $element.data('bs.popover') || {}).options); 1541 if (options[name] !== void 0) { 1542 return options[name]; 1543 } 1544 return defaultValue !== void 0 ? defaultValue : void 0; 1545 } 1546 }; 1547 1548})(window.jQuery, window.Drupal, window.Drupal.bootstrap); 1549; 1550/** 1551 * @file 1552 * Bootstrap Tooltips. 1553 */ 1554 1555var Drupal = Drupal || {}; 1556 1557(function ($, Drupal, Bootstrap) { 1558 "use strict"; 1559 1560 /** 1561 * Extend the Bootstrap Tooltip plugin constructor class. 1562 */ 1563 Bootstrap.extendPlugin('tooltip', function (settings) { 1564 return { 1565 DEFAULTS: { 1566 animation: !!settings.tooltip_animation, 1567 enabled: settings.tooltip_enabled, 1568 html: !!settings.tooltip_html, 1569 placement: settings.tooltip_placement, 1570 selector: settings.tooltip_selector, 1571 trigger: settings.tooltip_trigger, 1572 delay: parseInt(settings.tooltip_delay, 10), 1573 container: settings.tooltip_container 1574 } 1575 }; 1576 }); 1577 1578 /** 1579 * Bootstrap Tooltips. 1580 * 1581 * @todo This should really be properly delegated if selector option is set. 1582 */ 1583 Drupal.behaviors.bootstrapTooltips = { 1584 attach: function (context) { 1585 // Immediately return if tooltips are not available. 1586 if (!$.fn.tooltip || !$.fn.tooltip.Constructor.DEFAULTS.enabled) { 1587 return; 1588 } 1589 1590 var elements = $(context).find('[data-toggle="tooltip"]').toArray(); 1591 for (var i = 0; i < elements.length; i++) { 1592 var $element = $(elements[i]); 1593 var options = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, $element.data()); 1594 $element.tooltip(options); 1595 } 1596 }, 1597 detach: function (context) { 1598 // Immediately return if tooltips are not available. 1599 if (!$.fn.tooltip || !$.fn.tooltip.Constructor.DEFAULTS.enabled) { 1600 return; 1601 } 1602 1603 // Destroy all tooltips. 1604 $(context).find('[data-toggle="tooltip"]').tooltip('destroy'); 1605 } 1606 }; 1607 1608})(window.jQuery, window.Drupal, window.Drupal.bootstrap); 1609; 1610/** 1611* DO NOT EDIT THIS FILE. 1612* See the following change record for more information, 1613* https://www.drupal.org/node/2815083 1614* @preserve 1615**/ 1616 1617Drupal.debounce = function (func, wait, immediate) { 1618 var timeout = void 0; 1619 var result = void 0; 1620 return function () { 1621 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 1622 args[_key] = arguments[_key]; 1623 } 1624 1625 var context = this; 1626 var later = function later() { 1627 timeout = null; 1628 if (!immediate) {
1629 result = func.apply(context, args); 1630 } 1631 }; 1632 var callNow = immediate && !timeout; 1633 clearTimeout(timeout); 1634 timeout = setTimeout(later, wait); 1635 if (callNow) { 1636 result = func.apply(context, args); 1637 } 1638 return result; 1639 }; 1640};; 1641/** 1642* DO NOT EDIT THIS FILE. 1643* See the following change record for more information, 1644* https://www.drupal.org/node/2815083 1645* @preserve 1646**/ 1647 1648(function ($, Drupal, debounce) { 1649 $.fn.drupalGetSummary = function () { 1650 var callback = this.data('summaryCallback'); 1651 return this[0] && callback ? $.trim(callback(this[0])) : ''; 1652 }; 1653 1654 $.fn.drupalSetSummary = function (callback) { 1655 var self = this; 1656 1657 if (typeof callback !== 'function') { 1658 var val = callback; 1659 callback = function callback() { 1660 return val; 1661 }; 1662 } 1663 1664 return this.data('summaryCallback', callback).off('formUpdated.summary').on('formUpdated.summary', function () { 1665 self.trigger('summaryUpdated'); 1666 }).trigger('summaryUpdated'); 1667 }; 1668 1669 Drupal.behaviors.formSingleSubmit = { 1670 attach: function attach() { 1671 function onFormSubmit(e) { 1672 var $form = $(e.currentTarget); 1673 var formValues = $form.serialize(); 1674 var previousValues = $form.attr('data-drupal-form-submit-last'); 1675 if (previousValues === formValues) { 1676 e.preventDefault(); 1677 } else { 1678 $form.attr('data-drupal-form-submit-last', formValues); 1679 } 1680 } 1681 1682 $('body').once('form-single-submit').on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit); 1683 } 1684 }; 1685 1686 function triggerFormUpdated(element) { 1687 $(element).trigger('formUpdated'); 1688 } 1689 1690 function fieldsList(form) { 1691 var $fieldList = $(form).find('[name]').map(function (index, element) { 1692 return element.getAttribute('id'); 1693 }); 1694 1695 return $.makeArray($fieldList); 1696 } 1697 1698 Drupal.behaviors.formUpdated = { 1699 attach: function attach(context) { 1700 var $context = $(context); 1701 var contextIsForm = $context.is('form'); 1702 var $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated'); 1703 var formFields = void 0; 1704 1705 if ($forms.length) { 1706 $.makeArray($forms).forEach(function (form) { 1707 var events = 'change.formUpdated input.formUpdated '; 1708 var eventHandler = debounce(function (event) { 1709 triggerFormUpdated(event.target); 1710 }, 300); 1711 formFields = fieldsList(form).join(','); 1712 1713 form.setAttribute('data-drupal-form-fields', formFields); 1714 $(form).on(events, eventHandler); 1715 }); 1716 } 1717 1718 if (contextIsForm) { 1719 formFields = fieldsList(context).join(','); 1720 1721 var currentFields = $(context).attr('data-drupal-form-fields'); 1722 1723 if (formFields !== currentFields) { 1724 triggerFormUpdated(context); 1725 } 1726 } 1727 }, 1728 detach: function detach(context, settings, trigger) { 1729 var $context = $(context); 1730 var contextIsForm = $context.is('form'); 1731 if (trigger === 'unload') { 1732 var $forms = (contextIsForm ? $context : $context.find('form')).removeOnce('form-updated'); 1733 if ($forms.length) { 1734 $.makeArray($forms).forEach(function (form) { 1735 form.removeAttribute('data-drupal-form-fields'); 1736 $(form).off('.formUpdated'); 1737 }); 1738 } 1739 } 1740 } 1741 }; 1742 1743 Drupal.behaviors.fillUserInfoFromBrowser = { 1744 attach: function attach(context, settings) { 1745 var userInfo = ['name', 'mail', 'homepage']; 1746 var $forms = $('[data-user-info-from-browser]').once('user-info-from-browser'); 1747 if ($forms.length) { 1748 userInfo.forEach(function (info) { 1749 var $element = $forms.find('[name=' + info + ']'); 1750 var browserData = localStorage.getItem('Drupal.visitor.' + info); 1751 var emptyOrDefault = $element.val() === '' || $element.attr('data-drupal-default-value') === $element.val(); 1752 if ($element.length && emptyOrDefault && browserData) { 1753 $element.val(browserData); 1754 } 1755 }); 1756 } 1757 $forms.on('submit', function () { 1758 userInfo.forEach(function (info) { 1759 var $element = $forms.find('[name=' + info + ']'); 1760 if ($element.length) { 1761 localStorage.setItem('Drupal.visitor.' + info, $element.val()); 1762 } 1763 }); 1764 }); 1765 } 1766 }; 1767 1768 var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e) { 1769 var url = void 0; 1770 if (e.type === 'click') { 1771 url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget; 1772 } else { 1773 url = window.location; 1774 } 1775 var hash = url.hash.substr(1); 1776 if (hash) { 1777 var $target = $('#' + hash); 1778 $('body').trigger('formFragmentLinkClickOrHashChange', [$target]); 1779 1780 setTimeout(function () { 1781 return $target.trigger('focus'); 1782 }, 300); 1783 } 1784 }; 1785 1786 var debouncedHandleFragmentLinkClickOrHashChange = debounce(handleFragmentLinkClickOrHashChange, 300, true); 1787 1788 $(window).on('hashchange.form-fragment', debouncedHandleFragmentLinkClickOrHashChange); 1789 1790 $(document).on('click.form-fragment', 'a[href*="#"]', debouncedHandleFragmentLinkClickOrHashChange); 1791})(jQuery, Drupal, Drupal.debounce);; 1792/** 1793 * @file 1794 * Extends methods from core/misc/form.js. 1795 */ 1796 1797(function ($, window, Drupal, drupalSettings) { 1798 1799 /** 1800 * Behavior for "forms_has_error_value_toggle" theme setting. 1801 */ 1802 Drupal.behaviors.bootstrapForm = { 1803 attach: function (context) { 1804 if (drupalSettings.bootstrap && drupalSettings.bootstrap.forms_has_error_value_toggle) { 1805 var $context = $(context); 1806 $context.find('.form-item.has-error:not(.form-type-password.has-feedback)').once('error').each(function () { 1807 var $formItem = $(this); 1808 var $input = $formItem.find(':input'); 1809 $input.on('keyup focus blur', function () { 1810 if (this.defaultValue !== void 0) { 1811 $formItem[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('has-error'); 1812 $input[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('error'); 1813 } 1814 }); 1815 }); 1816 } 1817 } 1818 }; 1819 1820 1821})(jQuery, this, Drupal, drupalSettings); 1822; 1823/** 1824 * @file 1825 * JavaScript file for the Text Resize module. 1826 */ 1827 1828(function ($, Drupal, drupalSettings) { 1829 Drupal.behaviors.textResize = { 1830 attach: function (context, settings) { 1831 // Which div or page element are we resizing? 1832 var textResizeScope = drupalSettings.text_resize.text_resize_scope; 1833 var textResizeMaximum = drupalSettings.text_resize.text_resize_maximum; 1834 var textResizeMinimum = drupalSettings.text_resize.text_resize_minimum; 1835 var textResizeLineHeightAllow = drupalSettings.text_resize.text_resize_line_height_allow; 1836 var textResizeLineHeightMin = drupalSettings.text_resize.text_resize_line_height_min; 1837 var textResizeLineHeightMax = drupalSettings.text_resize.text_resize_line_height_max; 1838 if (textResizeScope) { 1839 var elementToResize = {}; 1840 if ($('#' + textResizeScope).length > 0) { 1841 elementToResize = $('#' + textResizeScope); 1842 } 1843 else if ($('.' + textResizeScope).length > 0) { 1844 elementToResize = $('.' + textResizeScope); // CLASS specified by admin 1845 } 1846 else { 1847 elementToResize = $(textResizeScope); // It's just a tag specified by admin 1848 } 1849 } 1850 else { // Look for some default scopes that might exist. 1851 if ($('#page').length > 0) { 1852 var elementToResize = $('#page'); // Main body div for Bartik 1853 } 1854 else if ($('#content-inner').length > 0) { 1855 var elementToResize = $('#content-inner'); // Main body div for Zen-based themes 1856 } 1857 else if ($('#squeeze > #content').length > 0) { 1858 var elementToResize = $('#squeeze > #content'); // Main body div for Zen Classic 1859 } 1860 } 1861 // Set the initial font size if necessary 1862 if ($.cookie('text_resize') != null) { 1863 elementToResize.css('font-size', parseFloat($.cookie('text_resize')) + 'px'); 1864 } 1865 if (textResizeLineHeightAllow) { 1866 // Set the initial line height if necessary 1867 if ($.cookie('text_resize_line_height') != null) { 1868 elementToResize.css('line-height', parseFloat($.cookie('text_resize_line_height')) + 'px'); 1869 } 1870 } 1871 // Changer links will change the text size when clicked 1872 $('a.changer').click(function () { 1873 // Set the current font size of the specified section as a variable 1874 var currentFontSize = parseFloat(elementToResize.css('font-size'), 10); 1875 // Set the current line-height 1876 var current_line_height = parseFloat(elementToResize.css('line-height'), 10); 1877 // javascript lets us choose which link was clicked, by ID 1878 if (this.id == 'text_resize_increase') { 1879 var new_font_size = currentFontSize * 1.2; 1880 if (textResizeLineHeightAllow) { 1881 var new_line_height = current_line_height * 1.2; 1882 } 1883 // Allow resizing as long as font size doesn't go above textResizeMaximum. 1884 if (new_font_size <= textResizeMaximum) { 1885 $.cookie('text_resize', new_font_size, {path: '/'}); 1886 if (textResizeLineHeightAllow) { 1887 $.cookie('text_resize_line_height', new_line_height, {path: '/'}); 1888 } 1889 var allow_change = true; 1890 } 1891 else { 1892 $.cookie('text_resize', textResizeMaximum, {path: '/'}); 1893 if (textResizeLineHeightAllow) { 1894 $.cookie('text_resize_line_height', textResizeLineHeightMax, {path: '/'}); 1895 } 1896 var reset_size_max = true; 1897 } 1898 } 1899 else if (this.id == 'text_resize_decrease') { 1900 var new_font_size = currentFontSize / 1.2;
1901 if (textResizeLineHeightAllow) { 1902 var new_line_height = current_line_height / 1.2; 1903 } 1904 if (new_font_size >= textResizeMinimum) { 1905 // Allow resizing as long as font size doesn't go below textResizeMinimum. 1906 $.cookie('text_resize', new_font_size, {path: '/'}); 1907 if (textResizeLineHeightAllow) { 1908 $.cookie('text_resize_line_height', new_line_height, {path: '/'}); 1909 } 1910 var allow_change = true; 1911 } 1912 else { 1913 // If it goes below textResizeMinimum, just leave it at textResizeMinimum. 1914 $.cookie('text_resize', textResizeMinimum, {path: '/'}); 1915 if (textResizeLineHeightAllow) { 1916 $.cookie('text_resize_line_height', textResizeLineHeightMin, {path: '/'}); 1917 } 1918 var reset_size_min = true; 1919 } 1920 } 1921 else if (this.id == 'text_resize_reset') { 1922 $.cookie('text_resize', null, {path: '/'}); 1923 if (textResizeLineHeightAllow) { 1924 $.cookie('text_resize_line_height', null, {path: '/'}); 1925 } 1926 var reset_size_original = true; 1927 } 1928 // jQuery lets us set the font size value of the main text div 1929 if (allow_change == true) { 1930 elementToResize.css('font-size', new_font_size + 'px'); // Add 'px' onto the end, otherwise ems are used as units by default 1931 if (textResizeLineHeightAllow) { 1932 elementToResize.css('line-height', new_line_height + 'px'); 1933 } 1934 return false; 1935 } 1936 else if (reset_size_min == true) { 1937 elementToResize.css('font-size', textResizeMinimum + 'px'); 1938 if (textResizeLineHeightAllow) { 1939 elementToResize.css('line-height', textResizeLineHeightMin + 'px'); 1940 } 1941 return false; 1942 } 1943 else if (reset_size_max == true) { 1944 elementToResize.css('font-size', textResizeMaximum + 'px'); 1945 if (textResizeLineHeightAllow) { 1946 elementToResize.css('line-height', textResizeLineHeightMax + 'px'); 1947 } 1948 return false; 1949 } 1950 else if (reset_size_original == true) { 1951 elementToResize.css('font-size', ''); 1952 if (textResizeLineHeightAllow) { 1953 elementToResize.css('line-height', ''); 1954 } 1955 return false; 1956 } 1957 }); 1958 } 1959 }; 1960})(jQuery, Drupal, drupalSettings); 1961; 1962/** 1963 * @file 1964 * Javascript for the geolocation module. 1965 */ 1966 1967/** 1968 * @typedef {Object} GeolocationSettings 1969 * 1970 * @property {GeolocationMapSettings[]} maps 1971 * @property {Object} mapCenter 1972 */ 1973 1974/** 1975 * @type {GeolocationSettings} drupalSettings.geolocation 1976 */ 1977 1978/** 1979 * @typedef {Object} GeolocationMapSettings 1980 * 1981 * @property {String} [type] Map type 1982 * @property {String} id 1983 * @property {Object} settings 1984 * @property {Number} lat 1985 * @property {Number} lng 1986 * @property {Object[]} map_center 1987 * @property {jQuery} wrapper 1988 * @property {GeolocationMapMarker[]} mapMarkers 1989 * @property {GeolocationShape[]} mapShapes 1990 */ 1991 1992/** 1993 * Callback when map is clicked. 1994 * 1995 * @callback GeolocationMapClickCallback 1996 * 1997 * @param {GeolocationCoordinates} location - Click location. 1998 */ 1999 2000/** 2001 * Callback when a marker is added or removed. 2002 * 2003 * @callback GeolocationMarkerCallback 2004 * 2005 * @param {GeolocationMapMarker} marker - Map marker. 2006 */ 2007 2008/** 2009 * Callback when map is right-clicked. 2010 * 2011 * @callback GeolocationMapContextClickCallback 2012 * 2013 * @param {GeolocationCoordinates} location - Click location. 2014 */ 2015 2016/**
2017 * Callback when map provider becomes available. 2018 * 2019 * @callback GeolocationMapInitializedCallback 2020 * 2021 * @param {GeolocationMapInterface} map - Geolocation map. 2022 */ 2023 2024/** 2025 * Callback when map bounds changed. 2026 * 2027 * @callback GeolocationBoundsChangedCallback 2028 * 2029 * @param object bounds - New bounds. 2030 */ 2031 2032/** 2033 * Callback when map fully loaded. 2034 * 2035 * @callback GeolocationMapPopulatedCallback 2036 * 2037 * @param {GeolocationMapInterface} map - Geolocation map. 2038 */ 2039 2040/** 2041 * Callback when and only when map is updated. 2042 * 2043 * @callback GeolocationMapUpdatedCallback 2044 * 2045 * @param {GeolocationMapInterface, GeolocationMapSettings} map - Geolocation map. 2046 */ 2047 2048/** 2049 * @typedef {Object} GeolocationCoordinates 2050 * 2051 * @property {Number} lat 2052 * @property {Number} lng 2053 */ 2054 2055/** 2056 * @typedef {Object} GeolocationCenterOption 2057 * 2058 * @property {Object} map_center_id 2059 * @property {Object} option_id 2060 * @property {Object} settings 2061 */ 2062 2063/** 2064 * @typedef {Object} GeolocationMapMarker 2065 * 2066 * @property {GeolocationCoordinates} position 2067 * @property {string} title 2068 * @property {boolean} [setMarker] 2069 * @property {string} [icon] 2070 * @property {string} [label] 2071 * @property {jQuery} locationWrapper 2072 */ 2073 2074/** 2075 * @typedef {Object} GeolocationShape 2076 * 2077 * @property {GeolocationCoordinates[]} coordinates 2078 * @property {jQuery} shapeWrapper 2079 * @property {string} shape 2080 * @property {string} [title] 2081 * @property {string} [strokeColor] 2082 * @property {int} [strokeWidth] 2083 * @property {number} [strokeOpacity] 2084 * @property {string} [fillColor] 2085 * @property {number} [fillOpacity] 2086 */ 2087 2088/** 2089 * Interface for classes that represent a color. 2090 * 2091 * @interface GeolocationMapInterface 2092 * 2093 * @property {Boolean} initialized - True when map provider available and initializedCallbacks executed. 2094 * @property {Boolean} loaded - True when map fully loaded and all loadCallbacks executed. 2095 * @property {String} id 2096 * @property {GeolocationMapSettings} settings 2097 * @property {Number} lat 2098 * @property {Number} lng 2099 * @property {Object[]} mapCenter 2100 * @property {jQuery} wrapper 2101 * @property {jQuery} container 2102 * @property {Object[]} mapMarkers 2103 * 2104 * @property {function({jQuery}):{jQuery}} addControl - Add control to map, identified by classes. 2105 * @property {function()} removeControls - Remove controls from map. 2106 * 2107 * @property {function()} populatedCallback - Executes {GeolocationMapPopulatedCallback[]} for this map. 2108 * @property {function({GeolocationMapPopulatedCallback})} addPopulatedCallback - Adds a callback that will be called when map is fully loaded. 2109 * @property {function()} initializedCallback - Executes {GeolocationMapInitializedCallbacks[]} for this map. 2110 * @property {function({GeolocationMapInitializedCallback})} addInitializedCallback - Adds a callback that will be called when map provider be
2110comes available. 2111 * @property {function({GeolocationMapSettings})} updatedCallback - Executes {GeolocationMapUpdatedCallbacks[]} for this map. 2112 * @property {function({GeolocationMapUpdatedCallbacks})} addUpdatedCallback - Adds a callback that will be called when and only when an already existing map is updated. 2113 * 2114 * @property {function({GeolocationMapMarker}):{GeolocationMapMarker}} setMapMarker - Set marker on map. 2115 * @property {function({GeolocationMapMarker})} removeMapMarker - Remove single marker. 2116 * @property {function()} removeMapMarkers - Remove all markers from map. 2117 * 2118 * @property {function({GeolocationShape})} addShape - Add shape to map. 2119 * @property {function({GeolocationShape})} removeShape - Remove shape from map. 2120 * @property {function()} removeShapes - Remove all shapes from map. 2121 * 2122 * @property {function():{Promise}} getZoom - Get zoom. 2123 * @property {function({string}?, {Boolean}?)} setZoom - Set zoom. 2124 * @property {function():{GeolocationCoordinates}} getCenter - Get map center coordinates. 2125 * @property {function({string})} setCenter - Center map by plugin. 2126 * @property {function({GeolocationCoordinates}, {Number}?, {string}?)} setCenterByCoordinates - Center map on coordinates. 2127 * @property {function({GeolocationMapMarker[]}?, {String}?)} fitMapToMarkers - Fit map to markers. 2128 * @property {function({GeolocationMapMarker[]}?):{Object}} getMarkerBoundaries - Get marker boundaries. 2129 * @property {function({Object}, {String}?)} fitBoundaries - Fit map to bounds. 2130 * 2131 * @property {function({Event})} clickCallback - Executes {GeolocationMapClickCallbacks} for this map. 2132 * @property {function({GeolocationMapClickCallback})} addClickCallback - Adds a callback that will be called when map is clicked. 2133 * 2134 * @property {function({Event})} doubleClickCallback - Executes {GeolocationMapClickCallbacks} for this map. 2135 * @property {function({GeolocationMapClickCallback})} addDoubleClickCallback - Adds a callback that will be called on double click. 2136 * 2137 * @property {function({Event})} contextClickCallback - Executes {GeolocationMapContextClickCallbacks} for this map. 2138 * @property {function({GeolocationMapContextClickCallback})} addContextClickCallback - Adds a callback that will be called when map is clicked. 2139 * 2140 * @property {function({GeolocationMapMarker})} markerAddedCallback - Executes {GeolocationMarkerCallback} for this map. 2141 * @property {function({GeolocationMarkerCallback})} addMarkerAddedCallback - Adds a callback that will be called on marker(s) being added. 2142 * 2143 * @property {function({GeolocationMapMarker})} markerRemoveCallback - Executes {GeolocationMarkerCallback} for this map. 2144 * @property {function({GeolocationMarkerCallback})} addMarkerRemoveCallback - Adds a callback that will be called before marker is removed. 2145 * 2146 * @property {function()} boundsChangedCallback - Executes {GeolocationBoundsChangedCallback} for this map. 2147 * @property {function({GeolocationBoundsChangedCallback})} addBoundsChangedCallback - Adds a callback that will be called when map bounds changed. 2148 */ 2149 2150/** 2151 * Geolocation map API. 2152 * 2153 * @implements {GeolocationMapInterface} 2154 */ 2155(function ($, Drupal) { 2156 2157 'use strict'; 2158 2159 /** 2160 * @namespace 2161 * @prop {Object} Drupal.geolocation 2162 */ 2163 Drupal.geolocation = Drupal.geolocation || {}; 2164 2165 /** 2166 * @type {GeolocationMapInterface[]} 2167 * @prop {GeolocationMapSettings} settings The map settings. 2168 */ 2169 Drupal.geolocation.maps = Drupal.geolocation.maps || []; 2170 2171 Drupal.geolocation.mapCenter = Drupal.geolocation.mapCenter || {}; 2172 2173 /** 2174 * Geolocation map. 2175 * 2176 * @constructor 2177 * @abstract 2178 * @implements {GeolocationMapInterface} 2179 * 2180 * @param {GeolocationMapSettings} mapSettings Setting to create map. 2181 */ 2182 function GeolocationMapBase(mapSettings) { 2183 this.settings = mapSettings.settings || {}; 2184 this.wrapper = mapSettings.wrapper; 2185 this.container = mapSettings.wrapper.find('.geolocation-map-container').first(); 2186 2187 if (this.container.length !== 1) { 2188 throw "Geolocation - Map container not found"; 2189 } 2190 2191 this.initialized = false; 2192 this.populated = false; 2193 this.lat = mapSettings.lat; 2194 this.lng = mapSettings.lng; 2195 2196 if (typeof mapSettings.id === 'undefined') { 2197 this.id = 'map' + Math.floor(Math.random() * 10000); 2198 } 2199 else { 2200 this.id = mapSettings.id; 2201 } 2202 2203 this.mapCenter = mapSettings.map_center; 2204 this.mapMarkers = this.mapMarkers || []; 2205 this.mapShapes = this.mapShapes || []; 2206 2207 return this; 2208 } 2209 2210 GeolocationMapBase.prototype = { 2211 addControl: function (element) { 2212 // Stub. 2213 }, 2214 removeControls: function () { 2215 // Stub. 2216 }, 2217 getZoom: function () { 2218 // Stub. 2219 }, 2220 setZoom: function (zoom, defer) { 2221 // Stub. 2222 }, 2223 getCenter: function () { 2224 // Stub. 2225 }, 2226 setCenter: function () { 2227 if (typeof this.wrapper.data('preserve-map-center') !== 'undefined') { 2228 return; 2229 } 2230 2231 this.setZoom(); 2232 this.setCenterByCoordinates({lat: this.lat, lng: this.lng}); 2233 2234 if (typeof this.mapCenter !== 'undefined') { 2235 2236 var that = this; 2237 2238 var centerOptions = Object 2239 // .values(this.mapCenter) // Reenable once IE11 is dead. Hopefully soon. 2240 .keys(that.mapCenter).map(function (item) { 2241 return that.mapCenter[item]; 2242 }) // IE11 fix from #3046802. 2243 .sort(function (a, b) { 2244 return a.weight - b.weight; 2245 }); 2246 2247 centerOptions.some( 2248 /** 2249 * @param {GeolocationCenterOption} centerOption 2250 */ 2251 function (centerOption) { 2252 if (typeof Drupal.geolocation.mapCenter[centerOption.map_center_id] === 'function') { 2253 return Drupal.geolocation.mapCenter[centerOption.map_center_id](that, centerOption); 2254 } 2255 } 2256 ); 2257 } 2258 }, 2259 setCenterByCoordinates: function (coordinates, accuracy, identifier) { 2260 this.centerUpdatedCallback(coordinates, accuracy, identifier); 2261 }, 2262 setMapMarker: function (marker) { 2263 this.mapMarkers.push(marker); 2264 this.markerAddedCallback(marker); 2265 }, 2266 removeMapMarker: function (marker) { 2267 var that = this; 2268 $.each( 2269 this.mapMarkers, 2270 2271 /** 2272 * @param {integer} index - Current index. 2273 * @param {GeolocationMapMarker} item - Current marker. 2274 */ 2275 function (index, item) { 2276 if (item === marker) { 2277 that.markerRemoveCallback(marker); 2278 that.mapMarkers.splice(Number(index), 1); 2279 } 2280 } 2281 ); 2282 }, 2283 removeMapMarkers: function () { 2284 var that = this; 2285 var shallowCopy = $.extend({}, this.mapMarkers); 2286 $.each( 2287 shallowCopy, 2288 2289 /** 2290 * @param {integer} index - Current index. 2291 * @param {GeolocationMapMarker} item - Current marker. 2292 */ 2293 function (index, item) { 2294 if (typeof item === 'undefined') { 2295 return; 2296 } 2297 that.removeMapMarker(item); 2298 } 2299 ); 2300 }, 2301 addShape: function (shape) { 2302 this.mapShapes.push(shape); 2303 }, 2304 removeShape: function (shape) { 2305 var that = this; 2306 $.each( 2307 this.mapShapes, 2308 2309 /** 2310 * @param {integer} index - Current index. 2311 * @param {GeolocationShape} item - Current shape. 2312 */ 2313 function (index, item) { 2314 if (item === shape) { 2315 that.mapShapes.splice(Number(index), 1); 2316 } 2317 } 2318 ); 2319 }, 2320 removeShapes: function () { 2321 var that = this; 2322 var shallowCopy = $.extend({}, this.mapShapes); 2323 $.each( 2324 shallowCopy, 2325 2326 /** 2327 * @param {integer} index - Current index. 2328 * @param {GeolocationShape} item - Current shape. 2329 */ 2330 function (index, item) { 2331 if (typeof item === 'undefined') { 2332 return; 2333 } 2334 that.removeShape(item); 2335 } 2336 ); 2337 }, 2338 fitMapToMarkers: function (markers, identifier) { 2339 var boundaries = this.getMarkerBoundaries(); 2340 if (boundaries === false) { 2341 return false;
2342 } 2343 2344 this.fitBoundaries(boundaries, identifier); 2345 }, 2346 getMarkerBoundaries: function (markers) { 2347 // Stub. 2348 }, 2349 fitBoundaries: function (boundaries, identifier) { 2350 this.centerUpdatedCallback(this.getCenter(), null, identifier); 2351 }, 2352 clickCallback: function (location) { 2353 this.clickCallbacks = this.clickCallbacks || []; 2354 $.each(this.clickCallbacks, function (index, callback) { 2355 callback(location); 2356 }); 2357 }, 2358 addClickCallback: function (callback) { 2359 this.clickCallbacks = this.clickCallbacks || []; 2360 this.clickCallbacks.push(callback); 2361 }, 2362 doubleClickCallback: function (location) { 2363 this.doubleClickCallbacks = this.doubleClickCallbacks || []; 2364 $.each(this.doubleClickCallbacks, function (index, callback) { 2365 callback(location); 2366 }); 2367 }, 2368 addDoubleClickCallback: function (callback) { 2369 this.doubleClickCallbacks = this.doubleClickCallbacks || []; 2370 this.doubleClickCallbacks.push(callback); 2371 }, 2372 contextClickCallback: function (location) { 2373 this.contextClickCallbacks = this.contextClickCallbacks || []; 2374 $.each(this.contextClickCallbacks, function (index, callback) { 2375 callback(location); 2376 }); 2377 }, 2378 addContextClickCallback: function (callback) { 2379 this.contextClickCallbacks = this.contextClickCallbacks || []; 2380 this.contextClickCallbacks.push(callback); 2381 }, 2382 initializedCallback: function () { 2383 this.initializedCallbacks = this.initializedCallbacks || []; 2384 while (this.initializedCallbacks.length > 0) { 2385 this.initializedCallbacks.shift()(this); 2386 } 2387 this.initialized = true; 2388 }, 2389 addInitializedCallback: function (callback) { 2390 if (this.initialized) { 2391 callback(this); 2392 } 2393 else { 2394 this.initializedCallbacks = this.initializedCallbacks || []; 2395 this.initializedCallbacks.push(callback); 2396 } 2397 }, 2398 updatedCallback: function (mapSettings) { 2399 var that = this; 2400 this.updatedCallbacks = this.updatedCallbacks || []; 2401 this.updatedCallbacks.forEach(function (callback) { 2402 callback(that, mapSettings); 2403 }); 2404 }, 2405 addUpdatedCallback: function (callback) { 2406 this.updatedCallbacks = this.updatedCallbacks || []; 2407 this.updatedCallbacks.push(callback); 2408 }, 2409 boundsChangedCallback: function (bounds) { 2410 this.boundsChangedCallbacks = this.boundsChangedCallbacks || []; 2411 $.each(this.boundsChangedCallbacks, function (index, callback) { 2412 callback(bounds); 2413 }); 2414 }, 2415 addBoundsChangedCallback: function (callback) { 2416 this.boundsChangedCallbacks = this.boundsChangedCallbacks || []; 2417 this.boundsChangedCallbacks.push(callback); 2418 }, 2419 centerUpdatedCallback: function (coordinates, accuracy, identifier) { 2420 this.centerUpdatedCallbacks = this.centerUpdatedCallbacks || []; 2421 $.each(this.centerUpdatedCallbacks, function (index, callback) { 2422 callback(coordinates, accuracy, identifier); 2423 }); 2424 }, 2425 addCenterUpdatedCallback: function (callback) { 2426 this.centerUpdatedCallbacks = this.centerUpdatedCallbacks || []; 2427 this.centerUpdatedCallbacks.push(callback); 2428 }, 2429 markerAddedCallback: function (marker) { 2430 this.markerAddedCallbacks = this.markerAddedCallbacks || []; 2431 $.each(this.markerAddedCallbacks, function (index, callback) { 2432 callback(marker); 2433 }); 2434 }, 2435 addMarkerAddedCallback: function (callback, existing) { 2436 existing = existing || true; 2437 if (existing) { 2438 $.each(this.mapMarkers, function (index, marker) { 2439 callback(marker); 2440 }); 2441 } 2442 this.markerAddedCallbacks = this.markerAddedCallbacks || []; 2443 this.markerAddedCallbacks.push(callback); 2444 }, 2445 markerRemoveCallback: function (marker) { 2446 this.markerRemoveCallbacks = this.markerRemoveCallbacks || []; 2447 $.each(this.markerRemoveCallbacks, function (index, callback) { 2448 callback(marker); 2449 }); 2450 }, 2451 addMarkerRemoveCallback: function (callback) { 2452 this.markerRemoveCallbacks = this.markerRemoveCallbacks || []; 2453 this.markerRemoveCallbacks.push(callback); 2454 }, 2455 populatedCallback: function () { 2456 this.populatedCallbacks = this.populatedCallbacks || []; 2457 while (this.populatedCallbacks.length > 0) { 2458 this.populatedCallbacks.shift()(this); 2459 } 2460 this.populated = true; 2461 }, 2462 addPopulatedCallback: function (callback) { 2463 if (this.populated) { 2464 callback(this); 2465 } 2466 else { 2467 this.populatedCallbacks = this.populatedCallbacks || []; 2468 this.populatedCallbacks.push(callback); 2469 } 2470 }, 2471 loadMarkersFromContainer: function () { 2472 var locations = []; 2473 this.wrapper.find('.geolocation-location').each(function (index, locationWrapperElement) { 2474 2475 var locationWrapper = $(locationWrapperElement); 2476 2477 var position = { 2478 lat: Number(locationWrapper.data('lat')), 2479 lng: Number(locationWrapper.data('lng')) 2480 }; 2481 2482 /** @type {GeolocationMapMarker} */ 2483 var location = { 2484 position: position, 2485 title: locationWrapper.find('.location-title').text().trim(), 2486 setMarker: true, 2487 locationWrapper: locationWrapper 2488 }; 2489 2490 if (typeof locationWrapper.data('icon') !== 'undefined') { 2491 location.icon = locationWrapper.data('icon').toString(); 2492 } 2493 2494 if (typeof locationWrapper.data('label') !== 'undefined') { 2495 location.label = locationWrapper.data('label').toString(); 2496 } 2497 2498 if (locationWrapper.data('set-marker') === 'false') { 2499 location.setMarker = false;
2500 } 2501 2502 locations.push(location); 2503 }); 2504 2505 return locations; 2506 }, 2507 loadShapesFromContainer: function () { 2508 var shapes = []; 2509 this.wrapper.find('.geolocation-shape').each(function (index, shapeWrapperElement) { 2510 2511 var shapeWrapper = $(shapeWrapperElement); 2512 var meta = shapeWrapper.find('span[typeof="GeoShape"] meta').first(); 2513 if (meta.length === 0) { 2514 return; 2515 } 2516 2517 var type = meta.attr('property').toString(); 2518 2519 var coordinates = []; 2520 $.each(meta.attr('content').toString().split(' '), function (index, rawCoordinate) { 2521 var coordinate = rawCoordinate.split(','); 2522 if ( 2523 coordinate[0].length === 0 2524 || coordinate[1].length === 0 2525 ) { 2526 return; 2527 } 2528 coordinates.push({ 2529 lat: parseFloat(coordinate[0]), 2530 lng: parseFloat(coordinate[1]) 2531 }); 2532 }); 2533 2534 /** @type {GeolocationShape} */ 2535 var shape = { 2536 coordinates: coordinates, 2537 shape: type, 2538 shapeWrapper: shapeWrapper 2539 }; 2540 2541 switch (type) { 2542 case 'line': 2543 shape.title = shapeWrapper.find('.polyline-title').text().trim(); 2544 break; 2545 2546 case 'polygon': 2547 shape.title = shapeWrapper.find('.polygon-title').text().trim(); 2548 2549 if (typeof shapeWrapper.data('fillColor') !== 'undefined') { 2550 shape.fillColor = shapeWrapper.data('fillColor').toString(); 2551 } 2552 if (typeof shapeWrapper.data('fillOpacity') !== 'undefined') { 2553 shape.fillOpacity = parseFloat(shapeWrapper.data('fillOpacity').toString()); 2554 } 2555 break; 2556 } 2557 2558 if (typeof shapeWrapper.data('strokeColor') !== 'undefined') { 2559 shape.strokeColor = shapeWrapper.data('strokeColor').toString(); 2560 } 2561 if (typeof shapeWrapper.data('strokeWidth') !== 'undefined') { 2562 shape.strokeWidth = parseInt(shapeWrapper.data('strokeWidth').toString()); 2563 } 2564 if (typeof shapeWrapper.data('strokeOpacity') !== 'undefined') { 2565 shape.strokeOpacity = parseFloat(shapeWrapper.data('strokeOpacity').toString()); 2566 } 2567 2568 shapes.push(shape); 2569 }); 2570 2571 return shapes; 2572 }, 2573 boundariesNormalized: function (boundaries) { 2574 if (typeof boundaries.north === 'number' 2575 && typeof boundaries.east === 'number' 2576 && typeof boundaries.south === 'number' 2577 && typeof boundaries.west === 'number' 2578 ) { 2579 return true; 2580 } 2581 2582 return false; 2583 }, 2584 normalizeBoundaries: function (boundaries) { 2585 var that = this; 2586 2587 if (that.boundariesNormalized(boundaries)) { 2588 return boundaries; 2589 } 2590 2591 if ( 2592 typeof boundaries.north !== 'undefined' 2593 && typeof boundaries.south !== 'undefined' 2594 && typeof boundaries.east !== 'undefined' 2595 && typeof boundaries.west !== 'undefined' 2596 ) { 2597 var castBoundaries = { 2598 north: Number(boundaries.north), 2599 east: Number(boundaries.east), 2600 south: Number(boundaries.south), 2601 west: Number(boundaries.west) 2602 }; 2603 2604 if (that.boundariesNormalized(castBoundaries)) { 2605 return castBoundaries; 2606 } 2607 } 2608 2609 $.each(Drupal.geolocation.MapProviders, function (type, name) { 2610 if (typeof Drupal.geolocation[name].prototype.normalizeBoundaries !== 'undefined') { 2611 var normalizedBoundaries = Drupal.geolocation[name].prototype.normalizeBoundaries.call(null, boundaries); 2612 } 2613 2614 if (that.boundariesNormalized(normalizedBoundaries)) { 2615 boundaries = normalizedBoundaries; 2616 return false; 2617 } 2618 }); 2619 2620 if (that.boundariesNormalized(boundaries)) { 2621 return boundaries; 2622 } 2623 2624 return false; 2625 } 2626 }; 2627 2628 Drupal.geolocation.GeolocationMapBase = GeolocationMapBase; 2629 2630 /** 2631 * Factory creating map instances. 2632 * 2633 * @constructor 2634 * 2635 * @param {GeolocationMapSettings} mapSettings The map settings. 2636 * @param {Boolean} [reset] Force creation of new map. 2637 * 2638 * @return {GeolocationMapInterface|boolean} Un-initialized map. 2639 */ 2640 function Factory(mapSettings, reset) { 2641 reset = reset || false; 2642 mapSettings.type = mapSettings.type || 'google_maps'; 2643 2644 var map = null; 2645 2646 /** 2647 * Previously stored map. 2648 * @type {boolean|GeolocationMapInterface} 2649 */ 2650 var existingMap = Drupal.geolocation.getMapById(mapSettings.id); 2651 2652 if (reset === true || !existingMap) {
2653 if (typeof Drupal.geolocation[Drupal.geolocation.MapProviders[mapSettings.type]] !== 'undefined') { 2654 var mapProvider = Drupal.geolocation[Drupal.geolocation.MapProviders[mapSettings.type]]; 2655 map = new mapProvider(mapSettings); 2656 Drupal.geolocation.maps.push(map); 2657 } 2658 } 2659 else { 2660 map = existingMap; 2661 map.updatedCallback(mapSettings); 2662 } 2663 2664 if (!map) { 2665 console.error("Map could not be initialized."); // eslint-disable-line no-console . 2666 return false; 2667 } 2668 2669 if (typeof map.container === 'undefined') { 2670 console.error("Map container not set."); // eslint-disable-line no-console . 2671 return false; 2672 } 2673 2674 if (map.container.length !== 1) { 2675 console.error("Map container not unique."); // eslint-disable-line no-console . 2676 return false; 2677 } 2678 2679 return map; 2680 } 2681 2682 Drupal.geolocation.Factory = Factory; 2683 2684 /** 2685 * @type {Object} 2686 */ 2687 Drupal.geolocation.MapProviders = {}; 2688 2689 Drupal.geolocation.addMapProvider = function (type, name) { 2690 Drupal.geolocation.MapProviders[type] = name; 2691 }; 2692 2693 /** 2694 * Get map by ID. 2695 * 2696 * @param {String} id - Map ID to retrieve. 2697 * 2698 * @return {GeolocationMapInterface|boolean} - Retrieved map or false. 2699 */ 2700 Drupal.geolocation.getMapById = function (id) { 2701 var map = false; 2702 $.each(Drupal.geolocation.maps, function (index, currentMap) { 2703 if (currentMap.id === id) { 2704 map = currentMap; 2705 } 2706 }); 2707 2708 if (!map) { 2709 return false; 2710 } 2711 2712 if (typeof map.container === 'undefined') { 2713 console.error("Existing map container not set."); // eslint-disable-line no-console . 2714 return false; 2715 } 2716 2717 if (map.container.length !== 1) { 2718 console.error("Existing map container not unique."); // eslint-disable-line no-console . 2719 return false; 2720 } 2721 2722 return map; 2723 }; 2724 2725 /** 2726 * @typedef {Object} GeolocationMapFeatureSettings 2727 * 2728 * @property {String} id 2729 * @property {boolean} enabled 2730 * @property {boolean} executed 2731 */ 2732 2733 /** 2734 * Callback when map is clicked. 2735 * 2736 * @callback GeolocationMapFeatureCallback 2737 * 2738 * @param {GeolocationMapInterface} map - Map. 2739 * @param {GeolocationMapFeatureSettings} featureSettings - Settings. 2740 * 2741 * @return {boolean} - Executed successfully. 2742 */ 2743 2744 /** 2745 * Get map by ID. 2746 * 2747 * @param {String} featureId - Map ID to retrieve. 2748 * @param {GeolocationMapFeatureCallback} callback - Retrieved map or false. 2749 * @param {Object} drupalSettings - Drupal settings. 2750 */ 2751 Drupal.geolocation.executeFeatureOnAllMaps = function (featureId, callback, drupalSettings) { 2752 if (typeof drupalSettings.geolocation === 'undefined') { 2753 return false; 2754 } 2755 2756 $.each( 2757 drupalSettings.geolocation.maps, 2758 2759 /** 2760 * @param {String} mapId - ID of current map 2761 * @param {Object} mapSettings - settings for current map 2762 * @param {GeolocationMapFeatureSettings} mapSettings[featureId] - Feature settings for current map 2763 */ 2764 function (mapId, mapSettings) { 2765 if (typeof mapSettings[featureId] === 'undefined') { 2766 return; 2767 } 2768 if (!mapSettings[featureId].enable) { 2769 return; 2770 } 2771 var map = Drupal.geolocation.getMapById(mapId); 2772 if (!map) { 2773 return; 2774 } 2775 2776 map.features = map.features || {}; 2777 map.features[featureId] = map.features[featureId] || {}; 2778 if (typeof map.features[featureId].executed === 'undefined') { 2779 map.features[featureId].executed = false; 2780 } 2781 2782 if (map.features[featureId].executed) { 2783 return; 2784 } 2785 2786 map.addPopulatedCallback(function (map) { 2787 if (map.features[featureId].executed) { 2788 return; 2789 } 2790 var result = callback(map, mapSettings[featureId]); 2791 2792 if (result === true) { 2793 map.features[featureId].executed = true; 2794 } 2795 }); 2796 } 2797 ); 2798 }; 2799 2800})(jQuery, Drupal); 2801; 2802/** 2803* DO NOT EDIT THIS FILE. 2804* See the following change record for more information, 2805* https://www.drupal.org/node/2815083 2806* @preserve 2807**/ 2808 2809(function ($, Drupal) { 2810 Drupal.theme.progressBar = function (id) {
2811 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>'; 2812 }; 2813 2814 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 2815 this.id = id; 2816 this.method = method || 'GET'; 2817 this.updateCallback = updateCallback; 2818 this.errorCallback = errorCallback; 2819 2820 this.element = $(Drupal.theme('progressBar', id)); 2821 }; 2822 2823 $.extend(Drupal.ProgressBar.prototype, { 2824 setProgress: function setProgress(percentage, message, label) { 2825 if (percentage >= 0 && percentage <= 100) { 2826 $(this.element).find('div.progress__bar').css('width', percentage + '%'); 2827 $(this.element).find('div.progress__percentage').html(percentage + '%'); 2828 } 2829 $('div.progress__description', this.element).html(message); 2830 $('div.progress__label', this.element).html(label); 2831 if (this.updateCallback) { 2832 this.updateCallback(percentage, message, this); 2833 } 2834 }, 2835 startMonitoring: function startMonitoring(uri, delay) { 2836 this.delay = delay; 2837 this.uri = uri; 2838 this.sendPing(); 2839 }, 2840 stopMonitoring: function stopMonitoring() { 2841 clearTimeout(this.timer); 2842 2843 this.uri = null; 2844 }, 2845 sendPing: function sendPing() { 2846 if (this.timer) { 2847 clearTimeout(this.timer); 2848 } 2849 if (this.uri) { 2850 var pb = this; 2851 2852 var uri = this.uri; 2853 if (uri.indexOf('?') === -1) { 2854 uri += '?'; 2855 } else { 2856 uri += '&'; 2857 } 2858 uri += '_format=json'; 2859 $.ajax({ 2860 type: this.method, 2861 url: uri, 2862 data: '', 2863 dataType: 'json', 2864 success: function success(progress) { 2865 if (progress.status === 0) { 2866 pb.displayError(progress.data); 2867 return; 2868 } 2869 2870 pb.setProgress(progress.percentage, progress.message, progress.label); 2871 2872 pb.timer = setTimeout(function () { 2873 pb.sendPing(); 2874 }, pb.delay); 2875 }, 2876 error: function error(xmlhttp) { 2877 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 2878 pb.displayError('<pre>' + e.message + '</pre>'); 2879 } 2880 }); 2881 } 2882 }, 2883 displayError: function displayError(string) { 2884 var error = $('<div class="messages messages--error"></div>').html(string); 2885 $(this.element).before(error).hide(); 2886 2887 if (this.errorCallback) { 2888 this.errorCallback(this); 2889 } 2890 } 2891 }); 2892})(jQuery, Drupal);; 2893/** 2894 * @file 2895 * Extends methods from core/misc/progress.js. 2896 */ 2897 2898(function ($, Drupal) { 2899 2900 'use strict'; 2901 2902 /** 2903 * Theme function for the progress bar. 2904 * 2905 * @param {string} id 2906 * 2907 * @return {string} 2908 * The HTML for the progress bar. 2909 */ 2910 Drupal.theme.progressBar = function (id) { 2911 return '<div class="progress-wrapper" aria-live="polite">' + 2912 '<div class="message"></div>'+ 2913 '<div id ="' + id + '" class="progress progress-striped active">' + 2914 '<div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">' + 2915 '<span class="percentage"></span>' + 2916 '</div>' + 2917 '</div>' + 2918 '<div class="progress-label"></div>' + 2919 '</div>'; 2920 }; 2921 2922 $.extend(Drupal.ProgressBar.prototype, /** @lends Drupal.ProgressBar */{ 2923 2924 /** 2925 * Set the percentage and status message for the progressbar. 2926 * 2927 * @param {number} percentage 2928 * @param {string} message 2929 * @param {string} label 2930 */ 2931 setProgress: function (percentage, message, label) { 2932 if (percentage >= 0 && percentage <= 100) { 2933 $(this.element).find('.progress-bar').css('width', percentage + '%').attr('aria-valuenow', percentage); 2934 $(this.element).find('.percentage').html(percentage + '%'); 2935 } 2936 if (message) { 2937 // Remove the unnecessary whitespace at the end of the message. 2938 message = message.replace(/<br\/> |\s*$/, ''); 2939 2940 $('.message', this.element).html(message); 2941 } 2942 if (label) { 2943 $('.progress-label', this.element).html(label); 2944 } 2945 if (this.updateCallback) { 2946 this.updateCallback(percentage, message, this); 2947 } 2948 }, 2949 2950 /**
2951 * Display errors on the page. 2952 * 2953 * @param {string} string 2954 */ 2955 displayError: function (string) { 2956 var error = $('<div class="alert alert-block alert-error"><button class="close" data-dismiss="alert">×</button><h4>' + Drupal.t('Error message') + '</h4></div>').append(string); 2957 $(this.element).before(error).hide(); 2958 2959 if (this.errorCallback) { 2960 this.errorCallback(this); 2961 } 2962 } 2963 }); 2964 2965})(jQuery, Drupal); 2966; 2967/** 2968* DO NOT EDIT THIS FILE. 2969* See the following change record for more information, 2970* https://www.drupal.org/node/2815083 2971* @preserve 2972**/ 2973 2974(function (Drupal) { 2975 Drupal.behaviors.responsiveImageAJAX = { 2976 attach: function attach() { 2977 if (window.picturefill) { 2978 window.picturefill(); 2979 } 2980 } 2981 }; 2982})(Drupal);; 2983/** 2984* DO NOT EDIT THIS FILE. 2985* See the following change record for more information, 2986* https://www.drupal.org/node/2815083 2987* @preserve 2988**/ 2989function _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); } } 2990 2991(function ($, window, Drupal, drupalSettings) { 2992 Drupal.behaviors.AJAX = { 2993 attach: function attach(context, settings) { 2994 function loadAjaxBehavior(base) { 2995 var elementSettings = settings.ajax[base]; 2996 if (typeof elementSettings.selector === 'undefined') { 2997 elementSettings.selector = '#' + base; 2998 } 2999 $(elementSettings.selector).once('drupal-ajax').each(function () { 3000 elementSettings.element = this; 3001 elementSettings.base = base; 3002 Drupal.ajax(elementSettings); 3003 }); 3004 } 3005 3006 Object.keys(settings.ajax || {}).forEach(function (base) { 3007 return loadAjaxBehavior(base); 3008 }); 3009 3010 Drupal.ajax.bindAjaxLinks(document.body); 3011 3012 $('.use-ajax-submit').once('ajax').each(function () { 3013 var elementSettings = {}; 3014 3015 elementSettings.url = $(this.form).attr('action'); 3016 3017 elementSettings.setClick = true; 3018 3019 elementSettings.event = 'click'; 3020 3021 elementSettings.progress = { type: 'throbber' }; 3022 elementSettings.base = $(this).attr('id'); 3023 elementSettings.element = this; 3024 3025 Drupal.ajax(elementSettings); 3026 }); 3027 }, 3028 detach: function detach(context, settings, trigger) { 3029 if (trigger === 'unload') { 3030 Drupal.ajax.expired().forEach(function (instance) { 3031 Drupal.ajax.instances[instance.instanceIndex] = null; 3032 }); 3033 } 3034 } 3035 }; 3036 3037 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 3038 var statusCode = void 0; 3039 var statusText = void 0; 3040 var responseText = void 0; 3041 if (xmlhttp.status) { 3042 statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { 3043 '!status': xmlhttp.status 3044 }); 3045 } else { 3046 statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); 3047 } 3048 statusCode += '\n' + Drupal.t('Debugging information follows.'); 3049 var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri }); 3050 statusText = ''; 3051 3052 try { 3053 statusText = '\n' + Drupal.t('StatusText: !statusText', { 3054 '!statusText': $.trim(xmlhttp.statusText) 3055 }); 3056 } catch (e) {} 3057 3058 responseText = ''; 3059 3060 try { 3061 responseText = '\n' + Drupal.t('ResponseText: !responseText', { 3062 '!responseText': $.trim(xmlhttp.responseText) 3063 }); 3064 } catch (e) {} 3065 3066 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 3067 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 3068 3069 var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { 3070 '!readyState': xmlhttp.readyState 3071 }) : ''; 3072 3073 customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { 3074 '!customMessage': customMessage 3075 }) : ''; 3076 3077 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 3078 3079 this.name = 'AjaxError'; 3080 }; 3081 3082 Drupal.AjaxError.prototype = new Error(); 3083 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 3084 3085 Drupal.ajax = function (settings) { 3086 if (arguments.length !== 1) { 3087 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 3088 } 3089 3090 var base = settings.base || false; 3091 var element = settings.element || false; 3092 delete settings.base; 3093 delete settings.element; 3094 3095 if (!settings.progress && !element) { 3096 settings.progress = false;
3097 } 3098 3099 var ajax = new Drupal.Ajax(base, element, settings); 3100 ajax.instanceIndex = Drupal.ajax.instances.length; 3101 Drupal.ajax.instances.push(ajax); 3102 3103 return ajax; 3104 }; 3105 3106 Drupal.ajax.instances = []; 3107 3108 Drupal.ajax.expired = function () { 3109 return Drupal.ajax.instances.filter(function (instance) { 3110 return instance && instance.element !== false && !document.body.contains(instance.element); 3111 }); 3112 }; 3113 3114 Drupal.ajax.bindAjaxLinks = function (element) { 3115 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 3116 var $linkElement = $(ajaxLink); 3117 3118 var elementSettings = { 3119 progress: { type: 'throbber' }, 3120 dialogType: $linkElement.data('dialog-type'), 3121 dialog: $linkElement.data('dialog-options'), 3122 dialogRenderer: $linkElement.data('dialog-renderer'), 3123 base: $linkElement.attr('id'), 3124 element: ajaxLink 3125 }; 3126 var href = $linkElement.attr('href'); 3127 3128 if (href) { 3129 elementSettings.url = href; 3130 elementSettings.event = 'click'; 3131 } 3132 Drupal.ajax(elementSettings); 3133 }); 3134 }; 3135 3136 Drupal.Ajax = function (base, element, elementSettings) { 3137 var defaults = { 3138 event: element ? 'mousedown' : null, 3139 keypress: true, 3140 selector: base ? '#' + base : null, 3141 effect: 'none', 3142 speed: 'none', 3143 method: 'replaceWith', 3144 progress: { 3145 type: 'throbber', 3146 message: Drupal.t('Please wait...') 3147 }, 3148 submit: { 3149 js: true 3150 } 3151 }; 3152 3153 $.extend(this, defaults, elementSettings); 3154 3155 this.commands = new Drupal.AjaxCommands(); 3156 3157 this.instanceIndex = false; 3158 3159 if (this.wrapper) { 3160 this.wrapper = '#' + this.wrapper; 3161 } 3162 3163 this.element = element; 3164 3165 this.element_settings = elementSettings; 3166 3167 this.elementSettings = elementSettings; 3168 3169 if (this.element && this.element.form) { 3170 this.$form = $(this.element.form); 3171 } 3172 3173 if (!this.url) { 3174 var $element = $(this.element); 3175 if ($element.is('a')) { 3176 this.url = $element.attr('href'); 3177 } else if (this.element && element.form) { 3178 this.url = this.$form.attr('action'); 3179 } 3180 } 3181 3182 var originalUrl = this.url; 3183 3184 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 3185 3186 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 3187 drupalSettings.ajaxTrustedUrl[this.url] = true; 3188 } 3189 3190 var ajax = this; 3191 3192 ajax.options = { 3193 url: ajax.url, 3194 data: ajax.submit, 3195 beforeSerialize: function beforeSerialize(elementSettings, options) { 3196 return ajax.beforeSerialize(elementSettings, options); 3197 }, 3198 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 3199 ajax.ajaxing = true; 3200 return ajax.beforeSubmit(formValues, elementSettings, options); 3201 }, 3202 beforeSend: function beforeSend(xmlhttprequest, options) { 3203 ajax.ajaxing = true; 3204 return ajax.beforeSend(xmlhttprequest, options); 3205 }, 3206 success: function success(response, status, xmlhttprequest) { 3207 if (typeof response === 'string') { 3208 response = $.parseJSON(response); 3209 } 3210 3211 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 3212 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 3213 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 3214 return ajax.error(xmlhttprequest, ajax.url, customMessage); 3215 } 3216 } 3217 3218 return ajax.success(response, status); 3219 }, 3220 complete: function complete(xmlhttprequest, status) { 3221 ajax.ajaxing = false; 3222 if (status === 'error' || status === 'parsererror') { 3223 return ajax.error(xmlhttprequest, ajax.url); 3224 } 3225 }, 3226 3227 dataType: 'json', 3228 jsonp: false, 3229 type: 'POST' 3230 }; 3231 3232 if (elementSettings.dialog) { 3233 ajax.options.data.dialogOptions = elementSettings.dialog; 3234 } 3235 3236 if (ajax.options.url.indexOf('?') === -1) { 3237 ajax.options.url += '?'; 3238 } else { 3239 ajax.options.url += '&'; 3240 } 3241 3242 var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax'); 3243 if (elementSettings.dialogRenderer) { 3244 wrapper += '.' + elementSettings.dialogRenderer; 3245 } 3246 ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper; 3247 3248 $(ajax.element).on(elementSettings.event, function (event) { 3249 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 3250 throw new Error(Drupal.t('The callback URL is not local and n
3250ot trusted: !url', { 3251 '!url': ajax.url 3252 })); 3253 } 3254 return ajax.eventResponse(this, event); 3255 }); 3256 3257 if (elementSettings.keypress) { 3258 $(ajax.element).on('keypress', function (event) { 3259 return ajax.keypressResponse(this, event); 3260 }); 3261 } 3262 3263 if (elementSettings.prevent) { 3264 $(ajax.element).on(elementSettings.prevent, false); 3265 } 3266 }; 3267 3268 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 3269 3270 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 3271 3272 Drupal.Ajax.prototype.execute = function () { 3273 if (this.ajaxing) { 3274 return; 3275 } 3276 3277 try { 3278 this.beforeSerialize(this.element, this.options); 3279 3280 return $.ajax(this.options); 3281 } catch (e) { 3282 this.ajaxing = false; 3283 window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message); 3284 3285 return $.Deferred().reject(); 3286 } 3287 }; 3288 3289 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 3290 var ajax = this; 3291 3292 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 3293 event.preventDefault(); 3294 event.stopPropagation(); 3295 $(element).trigger(ajax.elementSettings.event); 3296 } 3297 }; 3298 3299 Drupal.Ajax.prototype.eventResponse = function (element, event) { 3300 event.preventDefault(); 3301 event.stopPropagation(); 3302 3303 var ajax = this; 3304 3305 if (ajax.ajaxing) { 3306 return; 3307 } 3308 3309 try { 3310 if (ajax.$form) { 3311 if (ajax.setClick) { 3312 element.form.clk = element; 3313 } 3314 3315 ajax.$form.ajaxSubmit(ajax.options); 3316 } else { 3317 ajax.beforeSerialize(ajax.element, ajax.options); 3318 $.ajax(ajax.options); 3319 } 3320 } catch (e) { 3321 ajax.ajaxing = false; 3322 window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message); 3323 } 3324 }; 3325 3326 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 3327 if (this.$form && document.body.contains(this.$form.get(0))) { 3328 var settings = this.settings || drupalSettings; 3329 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 3330 } 3331 3332 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 3333 3334 var pageState = drupalSettings.ajaxPageState; 3335 options.data['ajax_page_state[theme]'] = pageState.theme; 3336 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 3337 options.data['ajax_page_state[libraries]'] = pageState.libraries; 3338 }; 3339 3340 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 3341 3342 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 3343 if (this.$form) { 3344 options.extraData = options.extraData || {}; 3345 3346 options.extraData.ajax_iframe_upload = '1'; 3347 3348 var v = $.fieldValue(this.element); 3349 if (v !== null) { 3350 options.extraData[this.element.name] = v; 3351 } 3352 } 3353 3354 $(this.element).prop('disabled', true); 3355 3356 if (!this.progress || !this.progress.type) { 3357 return; 3358 } 3359 3360 var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase(); 3361 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 3362 this[progressIndicatorMethod].call(this); 3363 } 3364 }; 3365 3366 Drupal.theme.ajaxProgressThrobber = function (message) { 3367 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 3368 var throbber = '<div class="throbber"> </div>'; 3369 3370 return '<div class="ajax-progress ajax-progress-throbber">' + throbber + messageMarkup + '</div>'; 3371 }; 3372 3373 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 3374 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 3375 }; 3376 3377 Drupal.theme.ajaxProgressMessage = function (message) { 3378 return '<div class="message">' + message + '</div>'; 3379 }; 3380 3381 Drupal.theme.ajaxProgressBar = function ($element) { 3382 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 3383 }; 3384 3385 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 3386 var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.i
3386d, $.noop, this.progress.method, $.noop); 3387 if (this.progress.message) { 3388 progressBar.setProgress(-1, this.progress.message); 3389 } 3390 if (this.progress.url) { 3391 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 3392 } 3393 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 3394 this.progress.object = progressBar; 3395 $(this.element).after(this.progress.element); 3396 }; 3397 3398 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 3399 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 3400 $(this.element).after(this.progress.element); 3401 }; 3402 3403 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 3404 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 3405 $('body').append(this.progress.element); 3406 }; 3407 3408 Drupal.Ajax.prototype.success = function (response, status) { 3409 var _this = this; 3410 3411 if (this.progress.element) { 3412 $(this.progress.element).remove(); 3413 } 3414 if (this.progress.object) { 3415 this.progress.object.stopMonitoring(); 3416 } 3417 $(this.element).prop('disabled', false); 3418 3419 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 3420 3421 var focusChanged = false; 3422 Object.keys(response || {}).forEach(function (i) { 3423 if (response[i].command && _this.commands[response[i].command]) { 3424 _this.commands[response[i].command](_this, response[i], status); 3425 if (response[i].command === 'invoke' && response[i].method === 'focus') { 3426 focusChanged = true; 3427 } 3428 } 3429 }); 3430 3431 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 3432 var target = false;
3433 3434 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 3435 target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); 3436 } 3437 3438 if (target) { 3439 $(target).trigger('focus'); 3440 } 3441 } 3442 3443 if (this.$form && document.body.contains(this.$form.get(0))) { 3444 var settings = this.settings || drupalSettings; 3445 Drupal.attachBehaviors(this.$form.get(0), settings); 3446 } 3447 3448 this.settings = null; 3449 }; 3450 3451 Drupal.Ajax.prototype.getEffect = function (response) { 3452 var type = response.effect || this.effect; 3453 var speed = response.speed || this.speed; 3454 3455 var effect = {}; 3456 if (type === 'none') { 3457 effect.showEffect = 'show'; 3458 effect.hideEffect = 'hide'; 3459 effect.showSpeed = ''; 3460 } else if (type === 'fade') { 3461 effect.showEffect = 'fadeIn'; 3462 effect.hideEffect = 'fadeOut'; 3463 effect.showSpeed = speed; 3464 } else { 3465 effect.showEffect = type + 'Toggle'; 3466 effect.hideEffect = type + 'Toggle'; 3467 effect.showSpeed = speed; 3468 } 3469 3470 return effect; 3471 }; 3472 3473 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 3474 if (this.progress.element) { 3475 $(this.progress.element).remove(); 3476 } 3477 if (this.progress.object) { 3478 this.progress.object.stopMonitoring(); 3479 } 3480 3481 $(this.wrapper).show(); 3482 3483 $(this.element).prop('disabled', false); 3484 3485 if (this.$form && document.body.contains(this.$form.get(0))) { 3486 var settings = this.settings || drupalSettings; 3487 Drupal.attachBehaviors(this.$form.get(0), settings); 3488 } 3489 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 3490 }; 3491 3492 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 3493 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 3494 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 3495 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 3496 }; 3497 3498 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 3499 return $('<div></div>').append($elements); 3500 }; 3501 3502 Drupal.AjaxCommands = function () {}; 3503 Drupal.AjaxCommands.prototype = { 3504 insert: function insert(ajax, response) { 3505 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 3506 var method = response.method || ajax.method; 3507 var effect = ajax.getEffect(response); 3508 3509 var settings = response.settings || ajax.settings || drupalSettings; 3510 3511 var $newContent = $($.parseHTML(response.data, document, true)); 3512 3513 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 3514 3515 switch (method) { 3516 case 'html': 3517 case 'replaceWith': 3518 case 'replaceAll': 3519 case 'empty': 3520 case 'remove': 3521 Drupal.detachBehaviors($wrapper.get(0), settings); 3522 break; 3523 default: 3524 break; 3525 } 3526 3527 $wrapper[method]($newContent); 3528 3529 if (effect.showEffect !== 'show') { 3530 $newContent.hide(); 3531 } 3532 3533 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 3534 if ($ajaxNewContent.length) { 3535 $ajaxNewContent.hide(); 3536 $newContent.show(); 3537 $ajaxNewContent[effect.showEffect](effect.showSpeed); 3538 } else if (effect.showEffect !== 'show') { 3539 $newContent[effect.showEffect](effect.showSpeed); 3540 } 3541 3542 if ($newContent.parents('html').length) { 3543 $newContent.each(function (index, element) { 3544 if (element.nodeType === Node.ELEMENT_NODE) { 3545 Drupal.attachBehaviors(element, settings); 3546 } 3547 }); 3548 } 3549 }, 3550 remove: function remove(ajax, response, status) { 3551 var settings = response.settings || ajax.settings || drupalSettings; 3552 $(response.selector).each(function () { 3553 Drupal.detachBehaviors(this, settings); 3554 }).remove(); 3555 }, 3556 changed: function changed(ajax, response, status) { 3557 var $element = $(response.selector); 3558 if (!$element.hasClass('ajax-changed')) { 3559 $element.addClass('ajax-changed'); 3560 if (response.asterisk) { 3561 $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> '); 3562 } 3563 } 3564 }, 3565 alert: function alert(ajax, response, status) { 3566 window.alert(response.text, response.title); 3567 }, 3568 announce: function announce(ajax, response) { 3569 if (response.priority) { 3570 Drupal.announce(response.text, response.priority); 3571 } else { 3572 Drupal.announce(response.text); 3573 } 3574 }, 3575 redirect: function redirect(ajax, response, status) { 3576 window.location = response.url; 3577 }, 3578 css: function css(ajax, response, status) { 3579 $(response.selector).css(response.argument); 3580 }, 3581 settings: function settings(ajax, response, status) { 3582 var ajaxSettings = drupalSettings.ajax; 3583 3584 if (ajaxSettings) {
3585 Drupal.ajax.expired().forEach(function (instance) { 3586 3587 if (instance.selector) { 3588 var selector = instance.selector.replace('#', ''); 3589 if (selector in ajaxSettings) { 3590 delete ajaxSettings[selector]; 3591 } 3592 } 3593 }); 3594 } 3595 3596 if (response.merge) { 3597 $.extend(true, drupalSettings, response.settings); 3598 } else { 3599 ajax.settings = response.settings; 3600 } 3601 }, 3602 data: function data(ajax, response, status) { 3603 $(response.selector).data(response.name, response.value); 3604 }, 3605 invoke: function invoke(ajax, response, status) { 3606 var $element = $(response.selector); 3607 $element[response.method].apply($element, _toConsumableArray(response.args)); 3608 }, 3609 restripe: function restripe(ajax, response, status) { 3610 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 3611 }, 3612 update_build_id: function update_build_id(ajax, response, status) { 3613 $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); 3614 }, 3615 add_css: function add_css(ajax, response, status) { 3616 $('head').prepend(response.data); 3617 }, 3618 message: function message(ajax, response) { 3619 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 3620 if (response.clearPrevious) { 3621 messages.clear(); 3622 } 3623 messages.add(response.message, response.messageOptions); 3624 } 3625 }; 3626})(jQuery, window, Drupal, drupalSettings);; 3627/** 3628 * @file 3629 * Extends methods from core/misc/ajax.js. 3630 */ 3631 3632(function ($, window, Drupal, drupalSettings) { 3633 3634 /** 3635 * Attempts to find the closest glyphicon progress indicator. 3636 * 3637 * @param {jQuery|Element} element 3638 * A DOM element. 3639 * 3640 * @returns {jQuery} 3641 * A jQuery object. 3642 */ 3643 Drupal.Ajax.prototype.findGlyphicon = function (element) { 3644 return $(element).closest('.form-item').find('.ajax-progress.glyphicon') 3645 }; 3646 3647 /** 3648 * Starts the spinning of the glyphicon progress indicator. 3649 * 3650 * @param {jQuery|Element} element 3651 * A DOM element. 3652 * @param {string} [message] 3653 * An optional message to display (tooltip) for the progress. 3654 * 3655 * @returns {jQuery} 3656 * A jQuery object. 3657 */ 3658 Drupal.Ajax.prototype.glyphiconStart = function (element, message) { 3659 var $glyphicon = this.findGlyphicon(element); 3660 if ($glyphicon[0]) { 3661 $glyphicon.addClass('glyphicon-spin'); 3662 3663 // Add any message as a tooltip to the glyphicon. 3664 if ($.fn.tooltip && drupalSettings.bootstrap.tooltip_enabled) { 3665 $glyphicon 3666 .removeAttr('data-toggle') 3667 .removeAttr('data-original-title') 3668 .removeAttr('title') 3669 .tooltip('destroy') 3670 ; 3671 3672 if (message) { 3673 $glyphicon.attr('data-toggle', 'tooltip').attr('title', message).tooltip(); 3674 } 3675 } 3676 3677 // Append a message for screen readers. 3678 if (message) { 3679 $glyphicon.parent().append('<div class="sr-only message">' + message + '</div>'); 3680 } 3681 } 3682 return $glyphicon; 3683 }; 3684 3685 /** 3686 * Stop the spinning of a glyphicon progress indicator. 3687 * 3688 * @param {jQuery|Element} element 3689 * A DOM element. 3690 */ 3691 Drupal.Ajax.prototype.glyphiconStop = function (element) { 3692 var $glyphicon = this.findGlyphicon(element); 3693 if ($glyphicon[0]) { 3694 $glyphicon.removeClass('glyphicon-spin'); 3695 if ($.fn.tooltip && drupalSettings.bootstrap.tooltip_enabled) { 3696 $glyphicon 3697 .removeAttr('data-toggle') 3698 .removeAttr('data-original-title') 3699 .removeAttr('title') 3700 .tooltip('destroy') 3701 ; 3702 } 3703 } 3704 }; 3705 3706 /** 3707 * Sets the throbber progress indicator. 3708 */ 3709 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 3710 var $element = $(this.element); 3711 3712 // Find an existing glyphicon progress indicator. 3713 var $glyphicon = this.glyphiconStart($element, this.progress.message); 3714 if ($glyphicon[0]) { 3715 this.progress.element = $glyphicon.parent(); 3716 this.progress.glyphicon = true; 3717 return; 3718 } 3719 3720 // Otherwise, add a glyphicon throbber after the element. 3721 if (!this.progress.element) { 3722 this.progress.element = $(Drupal.theme('ajaxThrobber')); 3723 } 3724 if (this.progress.message) { 3725 this.progress.element.after('<div class="message">' + this.progress.message + '</div>'); 3726 } 3727 3728 // If element is an input DOM element type (not :input), append after. 3729 if ($element.is('input')) { 3730 $element.after(this.progress.element); 3731 } 3732 // Otherwise append the throbber inside the element. 3733 else { 3734 $element.append(this.progress.element); 3735 } 3736 }; 3737 3738 3739 /** 3740 * Handler for the form redirection completion. 3741 * 3742 * @param {Array.<Drupal.AjaxCommands~commandDefinition>} response 3743 * @param {number} status 3744 */ 3745 var success = Drupal.Ajax.prototype.success; 3746 Drupal.Ajax.prototype.success = function (response, status) { 3747 if (this.progress.element) { 3748 3749 // Stop a glyphicon throbber. 3750 if (this.progress.glyphicon) { 3751 this.glyphiconStop(this.progress.element); 3752 } 3753 // Remove the progress element. 3754 else { 3755 this.progress.element.remove(); 3756 } 3757 3758 // Remove any message set. 3759 this.progress.element.parent().find('.message').remove(); 3760 } 3761 3762 // Invoke the original success handler. 3763 return success.apply(this, [response, status]); 3764 }; 3765 3766})(jQuery, this, Drupal, drupalSettings); 3767; 3768/** 3769 * @file 3770 * Javascript for the Geolocation map formatter. 3771 */ 3772 3773(function ($, Drupal) { 3774 3775 'use strict'; 3776 3777 /** 3778 * Find and display all maps. 3779 * 3780 * @type {Drupal~behavior} 3781 * 3782 * @prop {Drupal~behaviorAttach} attach 3783 * Attaches Geolocation Maps formatter functionality to relevant elements. 3784 */ 3785 Drupal.behaviors.geolocationMap = { 3786 3787 /** 3788 * @param context 3789 * @param drupalSettings 3790 * @param {Object} drupalSettings.geolocation 3791 */ 3792 attach: function (context, drupalSettings) { 3793 $('.geolocation-map-wrapper').once('geolocation-map-processed').each(function (index, item) { 3794 var mapWrapper = $(item); 3795 var mapSettings = {}; 3796 var reset = false;
3797 mapSettings.id = mapWrapper.attr('id'); 3798 mapSettings.wrapper = mapWrapper; 3799 3800 if (mapWrapper.length === 0) { 3801 return; 3802 } 3803 3804 mapSettings.lat = 0; 3805 mapSettings.lng = 0; 3806 3807 if ( 3808 mapWrapper.data('centre-lat') 3809 && mapWrapper.data('centre-lng') 3810 ) { 3811 mapSettings.lat = Number(mapWrapper.data('centre-lat')); 3812 mapSettings.lng = Number(mapWrapper.data('centre-lng')); 3813 } 3814 3815 if (mapWrapper.data('map-type')) { 3816 mapSettings.type = mapWrapper.data('map-type'); 3817 } 3818 3819 if (typeof drupalSettings.geolocation === 'undefined') { 3820 console.error("Bailing out for lack of settings."); // eslint-disable-line no-console . 3821 return; 3822 } 3823 3824 $.each(drupalSettings.geolocation.maps, function (mapId, currentSettings) { 3825 if (mapId === mapSettings.id) { 3826 mapSettings = $.extend(currentSettings, mapSettings); 3827 } 3828 }); 3829 3830 if (mapWrapper.parent().hasClass('preview-section')) { 3831 if (mapWrapper.parentsUntil('#views-live-preview').length) { 3832 reset = true; 3833 } 3834 } 3835 3836 var map = Drupal.geolocation.Factory(mapSettings, reset); 3837 3838 if (!map) { 3839 mapWrapper.removeOnce('geolocation-map-processed'); 3840 return; 3841 } 3842 3843 map.addInitializedCallback(function (map) { 3844 map.removeControls(); 3845 $('.geolocation-map-controls > *', map.wrapper).each(function (index, control) { 3846 map.addControl(control); 3847 }); 3848 3849 map.removeMapMarkers(); 3850 var locations = map.loadMarkersFromContainer(); 3851 $.each(locations, function (index, location) { 3852 map.setMapMarker(location); 3853 }); 3854 3855 map.removeShapes(); 3856 var shapes = map.loadShapesFromContainer(); 3857 $.each(shapes, function (index, shape) { 3858 map.addShape(shape); 3859 }); 3860 3861 map.setCenter(); 3862 3863 map.wrapper.find('.geolocation-location').hide(); 3864 }); 3865 3866 map.addUpdatedCallback(function (map, mapSettings) { 3867 map.settings = $.extend(map.settings, mapSettings.settings); 3868 map.wrapper = mapSettings.wrapper; 3869 mapSettings.wrapper.find('.geolocation-map-container').replaceWith(map.container); 3870 map.lat = mapSettings.lat; 3871 map.lng = mapSettings.lng; 3872 if (typeof mapSettings.map_center !== 'undefined') { 3873 map.mapCenter = mapSettings.map_center; 3874 } 3875 }); 3876 }); 3877 }, 3878 detach: function (context, drupalSettings) {} 3879 }; 3880 3881})(jQuery, Drupal); 3882; 3883/** 3884 * @file 3885 * Fit locations. 3886 */ 3887 3888(function (Drupal) { 3889 3890 'use strict'; 3891 3892 Drupal.geolocation = Drupal.geolocation || {}; 3893 Drupal.geolocation.mapCenter = Drupal.geolocation.mapCenter || {}; 3894 3895 /** 3896 * @param {GeolocationMapInterface} map 3897 * @param {GeolocationCenterOption} centerOption 3898 * @param {Boolean} centerOption.settings.reset_zoom 3899 * @param {Boolean} centerOption.settings.min_zoom 3900 */ 3901 Drupal.geolocation.mapCenter.fit_bounds = function (map, centerOption) { 3902 if (typeof map.mapMarkers === "undefined") { 3903 return false; 3904 } 3905 3906 if (map.mapMarkers.length === 0) { 3907 return false; 3908 } 3909 3910 map.fitMapToMarkers(); 3911 3912 if (centerOption.settings.reset_zoom) { 3913 map.setZoom(undefined, true); 3914 } 3915 else if (centerOption.settings.min_zoom) { 3916 map.getZoom().then(function (zoom) { 3917 if (centerOption.settings.min_zoom < zoom) { 3918 map.setZoom(centerOption.settings.min_zoom); 3919 } 3920 }); 3921 } 3922 3923 return true; 3924 } 3925 3926})(Drupal); 3927; 3928/** 3929 * @file 3930 * Javascript for leaflet integration. 3931 */ 3932 3933(function ($, Drupal) { 3934 'use strict'; 3935 3936 /** 3937 * GeolocationLeafletMap element. 3938 * 3939 * @constructor 3940 * @augments {GeolocationMapBase} 3941 * @implements {GeolocationMapInterface} 3942 * @inheritDoc 3943 * 3944 * @prop {Map} leafletMap 3945 * @prop {L.LayerGroup} markerLayer 3946 * @prop {TileLayer} tileLayer 3947 * @prop {Object} settings.leaflet_settings - Leaflet specific settings. 3948 */ 3949 function GeolocationLeafletMap(mapSettings) { 3950 var leafletPromise = new Promise(function (resolve, reject) { 3951 if (typeof L === 'undefined') { 3952 setTimeout(function () { 3953 if (typeof L === 'undefined') { 3954 reject(); 3955 } 3956 else { 3957 resolve(); 3958 } 3959 }, 1000); 3960 } 3961 else { 3962 resolve(); 3963 } 3964 }); 3965 3966 this.type = 'leaflet'; 3967 3968 Drupal.geolocation.GeolocationMapBase.call(this, mapSettings); 3969 3970 /** 3971 * 3972 * @type {MapOptions} 3973 */ 3974 var defaultLeafletSettings = { 3975 zoom: 10 3976 }; 3977 3978 // Add any missing settings. 3979 this.settings.leaflet_settings = $.extend(defaultLeafletSettings, this.settings.leaflet_settings); 3980 3981 // Set the container size. 3982 this.container.css({ 3983 height: this.settings.leaflet_settings.height, 3984 width: this.settings.leaflet_settings.width 3985 }); 3986 3987 var that = this; 3988 3989 leafletPromise.then(function () { 3990 3991 var leafletMapSettings = that.settings.leaflet_settings; 3992 leafletMapSettings.center = [that.lat, that.lng]; 3993 leafletMapSettings.zoomControl = false;
3994 leafletMapSettings.attributionControl = false; 3995 leafletMapSettings.crs = L.CRS[that.settings.leaflet_settings.crs]; 3996 3997 /** @type {Map} */ 3998 var leafletMap = L.map(that.container.get(0), leafletMapSettings); 3999 4000 var markerLayer = L.layerGroup().addTo(leafletMap); 4001 4002 // Set the tile layer. 4003 var tileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(leafletMap); 4004 4005 that.leafletMap = leafletMap; 4006 that.markerLayer = markerLayer; 4007 that.tileLayer = tileLayer; 4008 4009 that.addPopulatedCallback(function (map) { 4010 var singleClick; 4011 map.leafletMap.on('click', /** @param {LeafletMouseEvent} e */ function (e) { 4012 singleClick = setTimeout(function () { 4013 map.clickCallback({lat: e.latlng.lat, lng: e.latlng.lng}); 4014 }, 500); 4015 }); 4016 4017 map.leafletMap.on('dblclick', /** @param {LeafletMouseEvent} e */ function (e) { 4018 clearTimeout(singleClick); 4019 map.doubleClickCallback({lat: e.latlng.lat, lng: e.latlng.lng}); 4020 }); 4021 4022 map.leafletMap.on('contextmenu', /** @param {LeafletMouseEvent} e */ function (e) { 4023 map.contextClickCallback({lat: e.latlng.lat, lng: e.latlng.lng}); 4024 }); 4025 4026 map.leafletMap.on('moveend', /** @param {LeafletEvent} e */ function (e) { 4027 map.boundsChangedCallback(map.leafletMap.getBounds()); 4028 }); 4029 }); 4030 4031 that.initializedCallback(); 4032 that.populatedCallback(); 4033 }) 4034 .catch(function (error) { 4035 console.error('Leaflet library not loaded. Bailing out. Error:'); // eslint-disable-line no-console. 4036 console.error(error); 4037 }); 4038 } 4039 GeolocationLeafletMap.prototype = Object.create(Drupal.geolocation.GeolocationMapBase.prototype); 4040 GeolocationLeafletMap.prototype.constructor = GeolocationLeafletMap; 4041 GeolocationLeafletMap.prototype.getZoom = function () { 4042 var that = this; 4043 return new Promise(function (resolve, reject) { 4044 resolve(that.leafletMap.getZoom()); 4045 }); 4046 }; 4047 GeolocationLeafletMap.prototype.setZoom = function (zoom, defer) { 4048 if (typeof zoom === 'undefined') { 4049 zoom = this.settings.leaflet_settings.zoom; 4050 } 4051 zoom = parseInt(zoom); 4052 this.leafletMap.setZoom(zoom); 4053 }; 4054 GeolocationLeafletMap.prototype.setCenterByCoordinates = function (coordinates, accuracy, identifier) { 4055 Drupal.geolocation.GeolocationMapBase.prototype.setCenterByCoordinates.call(this, coordinates, accuracy, identifier); 4056 4057 if (typeof accuracy === 'undefined') { 4058 this.leafletMap.panTo(coordinates); 4059 return; 4060 } 4061 4062 var circle = this.addAccuracyIndicatorCircle(coordinates, accuracy); 4063 4064 this.leafletMap.fitBounds(circle.getBounds()); 4065 4066 setInterval(fadeCityCircles, 300); 4067 4068 function fadeCityCircles() { 4069 var fillOpacity = circle.options.fillOpacity; 4070 fillOpacity -= 0.03; 4071 4072 var opacity = circle.options.opacity; 4073 opacity -= 0.06; 4074 4075 if ( 4076 opacity > 0 4077 && fillOpacity > 0 4078 ) { 4079 circle.setStyle({ 4080 fillOpacity: fillOpacity, 4081 stroke: opacity 4082 }); 4083 } 4084 else { 4085 circle.remove() 4086 } 4087 } 4088 }; 4089 GeolocationLeafletMap.prototype.addAccuracyIndicatorCircle = function (location, accuracy) { 4090 return L.circle(location, accuracy, { 4091 interactive: false, 4092 color: '#4285F4', 4093 opacity: 0.3, 4094 fillColor: '#4285F4', 4095 fillOpacity: 0.15 4096 }).addTo(this.leafletMap); 4097 }; 4098 GeolocationLeafletMap.prototype.setMapMarker = function (markerSettings) { 4099 if (typeof markerSettings.setMarker !== 'undefined') { 4100 if (markerSettings.setMarker === false) { 4101 return; 4102 } 4103 } 4104 4105 if (typeof markerSettings.icon === 'string') { 4106 markerSettings.icon = L.icon({ 4107 iconUrl: markerSettings.icon 4108 }); 4109 } 4110 4111 /** @type {Marker} */ 4112 var currentMarker = L.marker([parseFloat(markerSettings.position.lat), parseFloat(markerSettings.position.lng)], markerSettings).addTo(this.markerLayer); 4113 4114 currentMarker.locationWrapper = markerSettings.locationWrapper; 4115 4116 if (typeof markerSettings.label === 'string') { 4117 currentMarker.bindTooltip(markerSettings.label, { 4118 permanent: true, 4119 direction: 'top' 4120 }); 4121 } 4122 4123 Drupal.geolocation.GeolocationMapBase.prototype.setMapMarker.call(this, currentMarker); 4124 4125 return currentMarker; 4126 }; 4127 GeolocationLeafletMap.prototype.removeMapMarker = function (marker) { 4128 Drupal.geolocation.GeolocationMapBase.prototype.removeMapMarker.call(this, marker); 4129 this.markerLayer.removeLayer(marker); 4130 }; 4131 GeolocationLeafletMap.prototype.addShape = function (shapeSettings) { 4132 if (typeof shapeSettings === 'undefined') { 4133 return; 4134 } 4135 4136 var coordinates = []; 4137 4138 $.each(shapeSettings.coordinates, function (index, coordinate) {
4139 coordinates.push([coordinate.lat, coordinate.lng]); 4140 }); 4141 4142 var shape; 4143 4144 switch (shapeSettings.shape) { 4145 case 'line': 4146 shape = L.polyline(coordinates, { 4147 color: shapeSettings.strokeColor, 4148 opacity: shapeSettings.strokeOpacity, 4149 weight: shapeSettings.strokeWidth 4150 }); 4151 if (shapeSettings.title) { 4152 shape.bindTooltip(shapeSettings.title); 4153 } 4154 break; 4155 4156 case 'polygon': 4157 shape = L.polygon(coordinates, { 4158 color: shapeSettings.strokeColor, 4159 opacity: shapeSettings.strokeOpacity, 4160 weight: shapeSettings.strokeWidth, 4161 fillColor: shapeSettings.fillColor, 4162 fillOpacity: shapeSettings.fillOpacity 4163 }); 4164 if (shapeSettings.title) { 4165 shape.bindTooltip(shapeSettings.title); 4166 } 4167 break; 4168 } 4169 4170 shape.addTo(this.leafletMap); 4171 4172 Drupal.geolocation.GeolocationMapBase.prototype.addShape.call(this, shape); 4173 4174 return shape; 4175 4176 }; 4177 GeolocationLeafletMap.prototype.removeShape = function (shape) { 4178 if (typeof shape === 'undefined') { 4179 return; 4180 } 4181 Drupal.geolocation.GeolocationMapBase.prototype.removeShape.call(this, shape); 4182 shape.remove(); 4183 }; 4184 GeolocationLeafletMap.prototype.getMarkerBoundaries = function (locations) { 4185 4186 locations = locations || this.mapMarkers; 4187 if (locations.length === 0) { 4188 return; 4189 } 4190 4191 var group = new L.featureGroup(locations); 4192 4193 return group.getBounds(); 4194 }; 4195 GeolocationLeafletMap.prototype.getCenter = function () { 4196 var center = this.leafletMap.getCenter(); 4197 return {lat: center.lat, lng: center.lng}; 4198 }; 4199 GeolocationLeafletMap.prototype.normalizeBoundaries = function (boundaries) { 4200 if (boundaries instanceof L.LatLngBounds) { 4201 return { 4202 north: boundaries.getNorth(), 4203 east: boundaries.getEast(), 4204 south: boundaries.getSouth(), 4205 west: boundaries.getWest() 4206 }; 4207 } 4208 4209 return false; 4210 }; 4211 GeolocationLeafletMap.prototype.denormalizeBoundaries = function (boundaries) { 4212 if (typeof boundaries === 'undefined') { 4213 return false; 4214 } 4215 4216 if (boundaries instanceof L.LatLngBounds) { 4217 return boundaries; 4218 } 4219 4220 if (Drupal.geolocation.GeolocationMapBase.prototype.boundariesNormalized.call(this, boundaries)) { 4221 return L.latLngBounds([ 4222 [boundaries.south, boundaries.west], 4223 [boundaries.north, boundaries.east] 4224 ]); 4225 } 4226 else { 4227 boundaries = Drupal.geolocation.GeolocationMapBase.prototype.normalizeBoundaries.call(this, boundaries); 4228 if (boundaries) { 4229 return L.latLngBounds([ 4230 [boundaries.south, boundaries.west], 4231 [boundaries.north, boundaries.east] 4232 ]); 4233 } 4234 } 4235 4236 return false; 4237 }; 4238 GeolocationLeafletMap.prototype.fitBoundaries = function (boundaries, identifier) { 4239 boundaries = this.denormalizeBoundaries(boundaries); 4240 if (!boundaries) { 4241 return; 4242 } 4243 4244 if (!this.leafletMap.getBounds().equals(boundaries)) { 4245 this.leafletMap.fitBounds(boundaries); 4246 Drupal.geolocation.GeolocationMapBase.prototype.fitBoundaries.call(this, boundaries, identifier); 4247 } 4248 }; 4249 GeolocationLeafletMap.prototype.addControl = function (element) { 4250 this.leafletMap.controls = this.leafletMap.controls || []; 4251 var controlElement = new(L.Control.extend({ 4252 options: { 4253 position: typeof element.dataset.controlPosition === 'undefined' ? 'topleft' : element.dataset.controlPosition 4254 }, 4255 onAdd: function (map) { 4256 element.style.display = 'block'; 4257 L.DomEvent.disableClickPropagation(element); 4258 return element; 4259 } 4260 })); 4261 controlElement.addTo(this.leafletMap); 4262 this.leafletMap.controls.push(controlElement); 4263 }; 4264 GeolocationLeafletMap.prototype.removeControls = function () { 4265 this.leafletMap.controls = this.leafletMap.controls || []; 4266 var that = this; 4267 $.each(this.leafletMap.controls, function (index, control) { 4268 that.leafletMap.removeControl(control); 4269 }); 4270 }; 4271 4272 Drupal.geolocation.GeolocationLeafletMap = GeolocationLeafletMap; 4273 Drupal.geolocation.addMapProvider('leaflet', 'GeolocationLeafletMap'); 4274 4275})(jQuery, Drupal); 4276; 4277/** 4278 * @file 4279 * Control Zoom. 4280 */ 4281 4282/** 4283 * @typedef {Object} ControlAttributionSettings 4284 * 4285 * @extends {GeolocationMapFeatureSettings} 4286 * 4287 * @property {String} prefix 4288 * @property {String} position 4289 */ 4290 4291(function (Drupal) { 4292 4293 'use strict'; 4294 4295 /** 4296 * Zoom control. 4297 * 4298 * @type {Drupal~behavior} 4299 * 4300 * @prop {Drupal~behaviorAttach} attach 4301 * Attaches common map zoom functionality to relevant elements. 4302 */ 4303 Drupal.behaviors.leafletControlAttribution = { 4304 attach: function (context, drupalSettings) { 4305 Drupal.geolocation.executeFeatureOnAllMaps( 4306 'leaflet_control_attribution', 4307 4308 /** 4309 * @param {GeolocationLeafletMap} map - Current map. 4310 * @param {ControlAttributionSettings} featureSettings - Settings for current feature. 4311 */ 4312 function (map, featureSettings) { 4313 L.control.attribution({ 4314 prefix: featureSettings.prefix + ' | © <a href="https://osm.org/copyright">OpenStreetMap</a> contributors', 4315 position: featureSettings.position 4316 }).addTo(map.leafletMap); 4317 4318 return true; 4319 }, 4320 drupalSettings 4321 ); 4322 }, 4323 detach: function (context, drupalSettings) {} 4324 }; 4325 4326})(Drupal); 4327; 4328/** 4329 * @file 4330 * Marker Popup. 4331 */ 4332 4333/** 4334 * @typedef {Object} LeafletMarkerPopupSettings 4335 * 4336 * @extends {GeolocationMapFeatureSettings} 4337 * 4338 * @property {Boolean} infoAutoDisplay 4339 * @property {Number} maxWidth 4340 * @property {Number} minWidth 4341 * @property {Number} maxHeight 4342 * @property {Boolean} autoPan 4343 * @property {Boolean} keepInView 4344 * @property {Boolean} closeButton 4345 * @property {Boolean} autoClose 4346 * @property {Boolean} closeOnEscapeKey 4347 * @property {String} className 4348 */ 4349 4350(function ($, Drupal) { 4351 4352 'use strict'; 4353 4354 /** 4355 * Marker Popup. 4356 * 4357 * @type {Drupal~behavior} 4358 * 4359 * @prop {Drupal~behaviorAttach} attach 4360 * Attaches common map marker popup functionality to relevant elements. 4361 */ 4362 Drupal.behaviors.leafletMarkerPopup = { 4363 attach: function (context, drupalSettings) { 4364 Drupal.geolocation.executeFeatureOnAllMaps( 4365 'leaflet_marker_popup', 4366 4367 /** 4368 * @param {GeolocationLeafletMap} map - Current map. 4369 * @param {LeafletMarkerPopupSettings} featureSettings - Settings for current feature. 4370 */ 4371 function (map, featureSettings) { 4372 var geolocationLeafletPopupHandler = function (currentMarker) { 4373 if (typeof (currentMarker.locationWrapper) === 'undefined') { 4374 return; 4375 } 4376 4377 var content = currentMarker.locationWrapper.find('.location-content'); 4378 4379 if (content.length < 1) { 4380 return; 4381 } 4382 var popupOptions = {}; 4383 /** 4384 * 'maxWidth' => $feature_settings['max_width'], 4385 'minWidth' =>
4385 $feature_settings['min_width'], 4386 'maxHeight' => $feature_settings['max_height'], 4387 'autoPan' => $feature_settings['auto_pan'], 4388 'keepInView' => $feature_settings['keep_in_view'], 4389 'closeButton' => $feature_settings['close_button'], 4390 'autoClose' => $feature_settings['auto_close'], 4391 'closeOnEscapeKey' => $feature_settings['close_on_escape_key'], 4392 'className' => $feature_settings['class_name'], 4393 */ 4394 if (featureSettings.maxWidth) { 4395 popupOptions.maxWidth = Math.round(featureSettings.maxWidth); 4396 } 4397 if (featureSettings.minWidth) { 4398 popupOptions.minWidth = Math.round(featureSettings.minWidth); 4399 } 4400 if (featureSettings.maxHeight) { 4401 popupOptions.maxHeight = Math.round(featureSettings.maxHeight); 4402 } 4403 if (typeof featureSettings.autoPan !== "undefined") { 4404 popupOptions.autoPan = featureSettings.autoPan; 4405 } 4406 if (typeof featureSettings.keepInView !== "undefined") { 4407 popupOptions.keepInView = featureSettings.keepInView; 4408 } 4409 if (typeof featureSettings.closeButton !== "undefined") { 4410 popupOptions.closeButton = featureSettings.closeButton; 4411 } 4412 if (typeof featureSettings.autoClose !== "undefined") { 4413 popupOptions.autoClose = featureSettings.autoClose; 4414 } 4415 if (typeof featureSettings.closeOnEscapeKey !== "undefined") { 4416 popupOptions.closeOnEscapeKey = featureSettings.closeOnEscapeKey; 4417 } 4418 if (featureSettings.className) { 4419 popupOptions.className = featureSettings.className; 4420 } 4421 4422 currentMarker.bindPopup(content.html(), popupOptions); 4423 4424 if (featureSettings.infoAutoDisplay) { 4425 currentMarker.openPopup(); 4426 } 4427 }; 4428 4429 map.addPopulatedCallback(function (map) { 4430 $.each(map.mapMarkers, function (index, currentMarker) { 4431 geolocationLeafletPopupHandler(currentMarker); 4432 }); 4433 }); 4434 4435 map.addMarkerAddedCallback(function (currentMarker) { 4436 geolocationLeafletPopupHandler(currentMarker); 4437 }); 4438 4439 return true; 4440 }, 4441 drupalSettings 4442 ); 4443 }, 4444 detach: function (context, drupalSettings) {} 4445 }; 4446})(jQuery, Drupal); 4447; 4448/** 4449 * @file 4450 * Webform behaviors. 4451 */ 4452 4453(function ($, Drupal) { 4454 4455 'use strict'; 4456 4457 // Trigger Drupal's attaching of behaviors after the page is 4458 // completely loaded. 4459 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 4460 // @see https://stackoverflow.com/questions/20899274/how-to-refresh-page-on-back-button-click/20899422#20899422 4461 var isChrome = (/chrom(e|ium)/.test(window.navigator.userAgent.toLowerCase())); 4462 if (isChrome) { 4463 // Track back button in navigation. 4464 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 4465 var backButton = false; 4466 if (window.performance) { 4467 var navEntries = window.performance.getEntriesByType('navigation'); 4468 if (navEntries.length > 0 && navEntries[0].type === 'back_forward') { 4469 backButton = true; 4470 } 4471 else if (window.performance.navigation 4472 && window.performance.navigation.type === window.performance.navigation.TYPE_BACK_FORWARD) { 4473 backButton = true; 4474 } 4475 } 4476 4477 // If the back button is pressed, delay Drupal's attaching of behaviors. 4478 if (backButton) { 4479 var attachBehaviors = Drupal.attachBehaviors; 4480 Drupal.attachBehaviors = function (context, settings) { 4481 setTimeout(function (context, settings) { 4482 attachBehaviors(context, settings); 4483 }, 300); 4484 }; 4485 } 4486 } 4487 4488})(jQuery, Drupal); 4489; 4490/** 4491* DO NOT EDIT THIS FILE. 4492* See the following change record for more information, 4493* https://www.drupal.org/node/2815083 4494* @preserve 4495**/ 4496 4497(function ($, Drupal) { 4498 var states = { 4499 postponed: [] 4500 }; 4501 4502 Drupal.states = states; 4503 4504 function invert(a, invertState) { 4505 return invertState && typeof a !== 'undefined' ? !a : a; 4506 } 4507 4508 function _compare2(a, b) { 4509 if (a === b) { 4510 return typeof a === 'undefined' ? a : true; 4511 } 4512 4513 return typeof a === 'undefined' || typeof b === 'undefined'; 4514 } 4515 4516 function ternary(a, b) { 4517 if (typeof a === 'undefined') { 4518 return b; 4519 } 4520 if (typeof b === 'undefined') { 4521 return a; 4522 } 4523 4524 return a && b; 4525 } 4526 4527 Drupal.behaviors.states = { 4528 attach: function attach(context, settings) { 4529 var $states = $(context).find('[data-drupal-states]'); 4530 var il = $states.length; 4531 4532 var _loop = function _loop(i) { 4533 var config = JSON.parse($states[i].getAttribute('data-drupal-states')); 4534 Object.keys(config || {}
4534).forEach(function (state) { 4535 new states.Dependent({ 4536 element: $($states[i]), 4537 state: states.State.sanitize(state), 4538 constraints: config[state] 4539 }); 4540 }); 4541 }; 4542 4543 for (var i = 0; i < il; i++) { 4544 _loop(i); 4545 } 4546 4547 while (states.postponed.length) { 4548 states.postponed.shift()(); 4549 } 4550 } 4551 }; 4552 4553 states.Dependent = function (args) { 4554 var _this = this; 4555 4556 $.extend(this, { values: {}, oldValue: null }, args); 4557 4558 this.dependees = this.getDependees(); 4559 Object.keys(this.dependees || {}).forEach(function (selector) { 4560 _this.initializeDependee(selector, _this.dependees[selector]); 4561 }); 4562 }; 4563 4564 states.Dependent.comparisons = { 4565 RegExp: function RegExp(reference, value) { 4566 return reference.test(value); 4567 }, 4568 Function: function Function(reference, value) { 4569 return reference(value); 4570 }, 4571 Number: function Number(reference, value) { 4572 return typeof value === 'string' ? _compare2(reference.toString(), value) : _compare2(reference, value); 4573 } 4574 }; 4575 4576 states.Dependent.prototype = { 4577 initializeDependee: function initializeDependee(selector, dependeeStates) { 4578 var _this2 = this; 4579 4580 this.values[selector] = {}; 4581 4582 Object.keys(dependeeStates).forEach(function (i) { 4583 var state = dependeeStates[i]; 4584 4585 if ($.inArray(state, dependeeStates) === -1) { 4586 return; 4587 } 4588 4589 state = states.State.sanitize(state); 4590 4591 _this2.values[selector][state.name] = null; 4592 4593 $(selector).on('state:' + state, { selector: selector, state: state }, function (e) { 4594 _this2.update(e.data.selector, e.data.state, e.value); 4595 }); 4596 4597 new states.Trigger({ selector: selector, state: state }); 4598 }); 4599 }, 4600 compare: function compare(reference, selector, state) { 4601 var value = this.values[selector][state.name]; 4602 if (reference.constructor.name in states.Dependent.comparisons) { 4603 return states.Dependent.comparisons[reference.constructor.name](reference, value); 4604 } 4605 4606 return _compare2(reference, value); 4607 }, 4608 update: function update(selector, state, value) { 4609 if (value !== this.values[selector][state.name]) { 4610 this.values[selector][state.name] = value; 4611 this.reevaluate(); 4612 } 4613 }, 4614 reevaluate: function reevaluate() { 4615 var value = this.verifyConstraints(this.constraints); 4616 4617 if (value !== this.oldValue) { 4618 this.oldValue = value; 4619 4620 value = invert(value, this.state.invert); 4621 4622 this.element.trigger({ 4623 type: 'state:' + this.state, 4624 value: value, 4625 trigger: true 4626 }); 4627 } 4628 }, 4629 verifyConstraints: function verifyConstraints(constraints, selector) { 4630 var result = void 0; 4631 if ($.isArray(constraints)) { 4632 var hasXor = $.inArray('xor', constraints) === -1; 4633 var len = constraints.length; 4634 for (var i = 0; i < len; i++) { 4635 if (constraints[i] !== 'xor') { 4636 var constraint = this.checkConstraints(constraints[i], selector, i); 4637 4638 if (constraint && (hasXor || result)) { 4639 return hasXor; 4640 } 4641 result = result || constraint; 4642 } 4643 } 4644 } else if ($.isPlainObject(constraints)) { 4645 for (var n in constraints) { 4646 if (constraints.hasOwnProperty(n)) { 4647 result = ternary(result, this.checkConstraints(constraints[n], selector, n)); 4648 4649 if (result === false) { 4650 return false; 4651 } 4652 } 4653 } 4654 } 4655 return result; 4656 }, 4657 checkConstraints: function checkConstraints(value, selector, state) { 4658 if (typeof state !== 'string' || /[0-9]/.test(state[0])) { 4659 state = null; 4660 } else if (typeof selector === 'undefined') { 4661 selector = state; 4662 state = null; 4663 } 4664 4665 if (state !== null) { 4666 state = states.State.sanitize(state); 4667 return invert(this.compare(value, selector, state), state.invert); 4668 } 4669 4670 return this.verifyConstraints(value, selector); 4671 }, 4672 getDependees: function getDependees() { 4673 var cache = {}; 4674 4675 var _compare = this.compare; 4676 this.compare = function (reference, selector, state) { 4677 (cache[selector] || (cache[selector] = [])).push(state.name); 4678 }; 4679 4680 this.verifyConstraints(this.constraints); 4681 4682 this.compare = _compare; 4683 4684 return cache; 4685 } 4686 }; 4687 4688 states.Trigger = function (args) { 4689 $.extend(this, args); 4690 4691 if (this.state in states.Trigger.states) { 4692 this.element = $(this.selector); 4693 4694 if (!this.element.data('trigger:' + this.state)) { 4695 this.initialize(); 4696 } 4697 } 4698 }; 4699 4700 states.Trigger.prototype = { 4701 initialize: function initialize() { 4702 var _this3 = this; 4703 4704 var trigger = states.Trigger.states[this.state]; 4705 4706 if (typeof trigger === 'function') { 4707 trigger.call(window, this.element); 4708 } else { 4709 Object.keys(trigger || {}
4709).forEach(function (event) { 4710 _this3.defaultTrigger(event, trigger[event]); 4711 }); 4712 } 4713 4714 this.element.data('trigger:' + this.state, true); 4715 }, 4716 defaultTrigger: function defaultTrigger(event, valueFn) { 4717 var oldValue = valueFn.call(this.element); 4718 4719 this.element.on(event, $.proxy(function (e) { 4720 var value = valueFn.call(this.element, e); 4721 4722 if (oldValue !== value) { 4723 this.element.trigger({ 4724 type: 'state:' + this.state, 4725 value: value, 4726 oldValue: oldValue 4727 }); 4728 oldValue = value; 4729 } 4730 }, this)); 4731 4732 states.postponed.push($.proxy(function () { 4733 this.element.trigger({ 4734 type: 'state:' + this.state, 4735 value: oldValue, 4736 oldValue: null 4737 }); 4738 }, this)); 4739 } 4740 }; 4741 4742 states.Trigger.states = { 4743 empty: { 4744 keyup: function keyup() { 4745 return this.val() === ''; 4746 } 4747 }, 4748 4749 checked: { 4750 change: function change() { 4751 var checked = false; 4752 this.each(function () { 4753 checked = $(this).prop('checked'); 4754 4755 return !checked; 4756 }); 4757 return checked; 4758 } 4759 }, 4760 4761 value: { 4762 keyup: function keyup() { 4763 if (this.length > 1) { 4764 return this.filter(':checked').val() || false; 4765 } 4766 return this.val(); 4767 }, 4768 change: function change() { 4769 if (this.length > 1) { 4770 return this.filter(':checked').val() || false; 4771 } 4772 return this.val(); 4773 } 4774 }, 4775 4776 collapsed: { 4777 collapsed: function collapsed(e) { 4778 return typeof e !== 'undefined' && 'value' in e ? e.value : !this.is('[open]'); 4779 } 4780 } 4781 }; 4782 4783 states.State = function (state) { 4784 this.pristine = state; 4785 this.name = state; 4786 4787 var process = true; 4788 do { 4789 while (this.name.charAt(0) === '!') { 4790 this.name = this.name.substring(1); 4791 this.invert = !this.invert; 4792 } 4793 4794 if (this.name in states.State.aliases) { 4795 this.name = states.State.aliases[this.name]; 4796 } else { 4797 process = false; 4798 } 4799 } while (process); 4800 }; 4801 4802 states.State.sanitize = function (state) { 4803 if (state instanceof states.State) { 4804 return state; 4805 } 4806 4807 return new states.State(state); 4808 }; 4809 4810 states.State.aliases = { 4811 enabled: '!disabled', 4812 invisible: '!visible', 4813 invalid: '!valid', 4814 untouched: '!touched', 4815 optional: '!required', 4816 filled: '!empty', 4817 unchecked: '!checked', 4818 irrelevant: '!relevant', 4819 expanded: '!collapsed', 4820 open: '!collapsed', 4821 closed: 'collapsed', 4822 readwrite: '!readonly' 4823 }; 4824 4825 states.State.prototype = { 4826 invert: false, 4827 4828 toString: function toString() { 4829 return this.name; 4830 } 4831 }; 4832 4833 var $document = $(document); 4834 $document.on('state:disabled', function (e) { 4835 if (e.trigger) { 4836 $(e.target).prop('disabled', e.value).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value).find('select, input, textarea').prop('disabled', e.value); 4837 } 4838 }); 4839 4840 $document.on('state:required', function (e) { 4841 if (e.trigger) { 4842 if (e.value) { 4843 var label = 'label' + (e.target.id ? '[for=' + e.target.id + ']' : ''); 4844 var $label = $(e.target).attr({ required: 'required', 'aria-required': 'true' }).closest('.js-form-item, .js-form-wrapper').find(label); 4845 4846 if (!$label.hasClass('js-form-required').length) { 4847 $label.addClass('js-form-required form-required'); 4848 } 4849 } else { 4850 $(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required'); 4851 } 4852 } 4853 }); 4854 4855 $document.on('state:visible', function (e) { 4856 if (e.trigger) { 4857 $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value); 4858 } 4859 }); 4860 4861 $document.on('state:checked', function (e) { 4862 if (e.trigger) { 4863 $(e.target).prop('checked', e.value); 4864 } 4865 }); 4866 4867 $document.on('state:collapsed', function (e) { 4868 if (e.trigger) { 4869 if ($(e.target).is('[open]') === e.value) { 4870 $(e.target).find('> summary').trigger('click'); 4871 } 4872 } 4873 }); 4874})(jQuery, Drupal);; 4875/** 4876 * @file 4877 * Extends core/misc/states.js. 4878 */ 4879(function($) { 4880 4881 // Unbind core state.js from document first so we can then override below. 4882 $(document).unbind('state:disabled'); 4883 4884 /** 4885 * Global state change handlers. These are bound to "document" to cover all 4886 * elements whose state changes. Events sent to elements within the page 4887 * bubble up to these handlers. We use this system so that themes and modules 4888 * can override these state change handlers for particular parts of a page. 4889 */ 4890 $(document).bind('state:disabled', function(e) { 4891 // Only act when this change was triggered by a dependency and not by the 4892 // element monitoring itself. 4893 if (e.trigger) { 4894 $(e.target) 4895 .attr('disabled', e.value) 4896 .closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value) 4897 .find(':input').attr('disabled', e.value); 4898 4899 // Note: WebKit nightlies don't reflect that change correctly. 4900 // See https://bugs.webkit.org/show_bug.cgi?id=23789 4901 } 4902 }); 4903 4904})(jQuery); 4905; 4906/** 4907 * @file 4908 * JavaScript behaviors for custom webform #states. 4909 */ 4910 4911(function ($, Drupal) { 4912 4913 'use strict'; 4914 4915 Drupal.webform = Drupal.webform || {}; 4916 Drupal.webform.states = Drupal.webform.states || {}; 4917 Drupal.webform.states.slideDown = Drupal.webform.states.slideDown || {}; 4918 Drupal.webform.states.slideDown.duration = 'slow'; 4919 Drupal.webform.states.slideUp = Drupal.webform.states.slideUp || {}; 4920 Drupal.webform.states.slideUp.duration = 'fast'; 4921 4922 /* ************************************************************************ */ 4923 // jQuery functions. 4924 /* ************************************************************************ */ 4925 4926 /** 4927 * Check if an element has a specified data attribute. 4928 * 4929 * @param {string} data 4930 * The data attribute name. 4931 * 4932 * @return {boolean} 4933 * TRUE if an element has a specified data attribute. 4934 */ 4935 $.fn.hasData = function (data) { 4936 return (typeof this.data(data) !== 'undefined'); 4937 }; 4938 4939 /**
4940 * Check if element is within the webform or not. 4941 * 4942 * @return {boolean} 4943 * TRUE if element is within the webform. 4944 */ 4945 $.fn.isWebform = function () { 4946 return $(this).closest('form.webform-submission-form, form[id^="webform"], form[data-is-webform]').length ? true : false; 4947 }; 4948 4949 /** 4950 * Check if element is to be treated as a webform element. 4951 * 4952 * @return {boolean} 4953 * TRUE if element is to be treated as a webform element. 4954 */ 4955 $.fn.isWebformElement = function () { 4956 return ($(this).isWebform() || $(this).closest('[data-is-webform-element]').length) ? true : false; 4957 }; 4958 4959 /* ************************************************************************ */ 4960 // Trigger. 4961 /* ************************************************************************ */ 4962 4963 // The change event is triggered by cut-n-paste and select menus. 4964 // Issue #2445271: #states element empty check not triggered on mouse 4965 // based paste. 4966 // @see https://www.drupal.org/node/2445271 4967 Drupal.states.Trigger.states.empty.change = function change() { 4968 return this.val() === ''; 4969 }; 4970 4971 /* ************************************************************************ */ 4972 // Dependents. 4973 /* ************************************************************************ */ 4974 4975 4976 // Apply solution included in #1962800 patch. 4977 // Issue #1962800: Form #states not working with literal integers as 4978 // values in IE11. 4979 // @see https://www.drupal.org/project/drupal/issues/1962800 4980 // @see https://www.drupal.org/files/issues/core-states-not-working-with-integers-ie11_1962800_46.patch 4981 // 4982 // This issue causes pattern, less than, and greater than support to break. 4983 // @see https://www.drupal.org/project/webform/issues/2981724 4984 var states = Drupal.states; 4985 Drupal.states.Dependent.prototype.compare = function compare(reference, selector, state) { 4986 var value = this.values[selector][state.name]; 4987 4988 var name = reference.constructor.name; 4989 if (!name) { 4990 name = $.type(reference); 4991 4992 name = name.charAt(0).toUpperCase() + name.slice(1); 4993 } 4994 if (name in states.Dependent.comparisons) { 4995 return states.Dependent.comparisons[name](reference, value); 4996 } 4997 4998 if (reference.constructor.name in states.Dependent.comparisons) { 4999 return states.Dependent.comparisons[reference.constructor.name](reference, value); 5000 } 5001 5002 return _compare2(reference, value); 5003 }; 5004 function _compare2(a, b) { 5005 if (a === b) { 5006 return typeof a === 'undefined' ? a : true; 5007 } 5008 5009 return typeof a === 'undefined' || typeof b === 'undefined'; 5010 } 5011 5012 // Adds pattern, less than, and greater than support to #state API. 5013 // @see http://drupalsun.com/julia-evans/2012/03/09/extending-form-api-states-regular-expressions 5014 Drupal.states.Dependent.comparisons.Object = function (reference, value) { 5015 if ('pattern' in reference) { 5016 return (new RegExp(reference['pattern'])).test(value); 5017 } 5018 else if ('!pattern' in reference) { 5019 return !((new RegExp(reference['!pattern'])).test(value)); 5020 } 5021 else if ('less' in reference) { 5022 return (value !== '' && parseFloat(reference['less']) > parseFloat(value)); 5023 } 5024 else if ('less_equal' in reference) { 5025 return (value !== '' && parseFloat(reference['less_equal']) >= parseFloat(value)); 5026 } 5027 else if ('greater' in reference) { 5028 return (value !== '' && parseFloat(reference['greater']) < parseFloat(value)); 5029 } 5030 else if ('greater_equal' in reference) { 5031 return (value !== '' && parseFloat(reference['greater_equal']) <= parseFloat(value)); 5032 } 5033 else if ('between' in reference || '!between' in reference) { 5034 if (value === '') { 5035 return false; 5036 } 5037 5038 var between = reference['between'] || reference['!between']; 5039 var betweenParts = between.split(':'); 5040 var greater = betweenParts[0]; 5041 var less = (typeof betweenParts[1] !== 'undefined') ? betweenParts[1] : null; 5042 var isGreaterThan = (greater === null || greater === '' || parseFloat(value) >= parseFloat(greater)); 5043 var isLessThan = (less === null || less === '' || parseFloat(value) <= parseFloat(less)); 5044 var result = (isGreaterThan && isLessThan); 5045 return (reference['!between']) ? !result : result; 5046 } 5047 else { 5048 return reference.indexOf(value) !== false; 5049 } 5050 }; 5051 5052 /* ************************************************************************ */ 5053 // States events. 5054 /* ************************************************************************ */ 5055 5056 var $document = $(document); 5057 5058 $document.on('state:required', function (e) { 5059 if (e.trigger && $(e.target).isWebformElement()) { 5060 var $target = $(e.target); 5061 // Fix #required file upload. 5062 // @see Issue #2860529: Conditional required File upload field don't work. 5063 toggleRequired($target.find('input[type="file"]'), e.value); 5064 5065 // Fix #required for radios and likert. 5066 // @see Issue #2856795: If radio buttons are required but not filled form is nevertheless submitted. 5067 if ($target.is('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other, .js-webform-type-webform-entity-radios, .webform-likert-table')) { 5068 $target.toggleClass('required', e.value); 5069 toggleRequired($target.find('input[type="radio"]'), e.value); 5070 } 5071 5072 // Fix #required for checkboxes. 5073 // @see Issue #2938414: Checkboxes don't support #states required. 5074 // @see checkboxRequiredhandler 5075 if ($target.is('.js-form-type-checkboxes, .js-form-type-webform-checkboxes-other, .js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other')) { 5076 $target.toggleClass('required', e.value); 5077 var $checkboxes = $target.find('input[type="checkbox"]'); 5078 if (e.value) { 5079 // Add event handler. 5080 $checkboxes.on('click', statesCheckboxesRequiredEventHandler); 5081 // Initialize and add required attribute. 5082 checkboxesRequired($target); 5083 } 5084 else { 5085 // Remove event handler. 5086 $checkboxes.off('click', statesCheckboxesRequiredEventHandler); 5087 // Remove required attribute. 5088 toggleRequired($checkboxes, false); 5089 } 5090 } 5091 5092 // Fix #required for tableselect. 5093 // @see Issue #3212581: Table select does not trigger client side validation 5094 if ($target.is('.js-webform-tableselect')) { 5095 $target.toggleClass('required', e.value); 5096 var isMultiple = $target.is('[multiple]'); 5097 if (isMultiple) { 5098 // Checkboxes. 5099 var $tbody = $target.find('tbody'); 5100 var $checkboxes = $tbody.find('input[type="checkbox"]'); 5101 copyRequireMessage($target, $checkboxes); 5102 if (e.value) { 5103 $checkboxes.on('click change', statesCheckboxesRequiredEventHandler); 5104 checkboxesRequired($tbody); 5105 } 5106 else { 5107 $checkboxes.off('click change ', statesCheckboxesRequiredEventHandler); 5108 toggleRequired($tbody, false); 5109 } 5110 } 5111 else { 5112 // Radios. 5113 var $radios = $target.find('input[type="radio"]'); 5114 copyRequireMessage($target, $radios); 5115 toggleRequired($radios, e.value); 5116 } 5117 } 5118 5119 // Fix required label for elements without the for attribute. 5120 // @see Issue #3145300: Conditional Visible Select Other not working. 5121 if ($target.is('.js-form-type-webform-select-other, .js-webform-type-webform-select-other')) { 5122 var $select = $target.find('select'); 5123 toggleRequired($select, e.value); 5124 copyRequireMessage($target, $select); 5125 } 5126 if ($target.find('> label:not([for])').length) { 5127 $target.find('> label').toggleClass('js-form-required form-required', e.value); 5128 } 5129 5130 // Fix required label for checkboxes and radios. 5131 // @see Issue #2938414: Checkboxes don't support #states required 5132 // @see Issue #2731991: Setting required on radios marks all options required. 5133 // @see Issue #2856315: Conditional Logic - Requiring Radios in a Fieldset. 5134 // Fix #required for fieldsets. 5135 // @see Issue #2977569: Hidden fieldsets that become visible with conditional logic cannot be made required. 5136 if ($target.is('.js-webform-type-radios, .js-webform-type-checkboxes, fieldset')) { 5137 $target.find('legend span.fieldset-legend:not(.visually-hidden)').toggleClass('js-form-required form-required', e.value); 5138 } 5139 5140 // Issue #2986017: Fieldsets shouldn't have required attribute. 5141 if ($target.is('fieldset')) { 5142 $target.removeAttr('required aria-required'); 5143 } 5144 } 5145 }); 5146 5147 $document.on('state:checked', function (e) { 5148 if (e.trigger) { 5149 $(e.target).trigger('change'); 5150 } 5151 }); 5152 5153 $document.on('state:readonly', function (e) { 5154 if (e.trigger && $(e.target).isWebformElement()) { 5155 $(e.target).prop('readonly', e.value).closest('.js-form-item, .js-form-wrapper').toggleClass('webform-readonly', e.value).find('input, textarea').prop('readonly', e.value); 5156 5157 // Trigger webform:readonly. 5158 $(e.target).trigger('webform:readonly') 5159 .find('select, input, textarea, button').trigger('webform:readonly'); 5160 } 5161 }); 5162 5163 $document.on('state:visible state:visible-slide', function (e) { 5164 if (e.trigger && $(e.target).isWebformElement()) { 5165 if (e.value) { 5166 $(':input', e.target).addBack().each(function () { 5167 restoreValueAndRequired(this); 5168 triggerEventHandlers(this); 5169 }); 5170 } 5171 else { 5172 // @see https://www.sitepoint.com/jquery-function-clear-form-data/ 5173 $(':input', e.target).addBack().each(function () { 5174 backupValueAndRequired(this); 5175 clearValueAndRequired(this); 5176 triggerEventHandlers(this); 5177 }); 5178 } 5179 } 5180 }); 5181 5182 $document.on('state:visible-slide', function (e) { 5183 if (e.trigger && $(e.target).isWebformElement()) { 5184 var effect = e.value ? 'slideDown' : 'slideUp'; 5185 var duration = Drupal.webform.states[effect].duration; 5186 $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper')[effect](duration); 5187 } 5188 }); 5189 Drupal.states.State.aliases['invisible-slide'] = '!visible-slide'; 5190 5191 $document.on('state:disabled', function (e) { 5192 if (e.trigger && $(e.target).isWebformElement()) { 5193 // Make sure disabled property is set before triggering webform:disabled. 5194 // Copied from: core/misc/states.js 5195 $(e.target) 5196 .prop('disabled', e.value) 5197 .closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value) 5198 .find('select, input, textarea, button').prop('disabled', e.value); 5199 5200 // Never disable hidden file[fids] because the existing values will 5201 // be completely lost when the webform is submitted. 5202 var fileElements = $(e.target) 5203 .find(':input[type="hidden"][name$="[fids]"]'); 5204 if (fileElements.length) { 5205 // Remove 'disabled' attribute from fieldset which will block 5206 // all disabled elements from being submitted. 5207 if ($(e.target).is('fieldset')) { 5208 $(e.target).prop('disabled', false); 5209 } 5210 fileElements.removeAttr('disabled'); 5211 } 5212 5213 // Trigger webform:disabled. 5214 $(e.target).trigger('webform:disabled') 5215 .find('select, input, textarea, button').trigger('webform:disabled'); 5216 } 5217 }); 5218 5219 /* ************************************************************************ */ 5220 // Behaviors. 5221 /* ************************************************************************ */ 5222 5223 /** 5224 * Adds HTML5 validation to required checkboxes. 5225 * 5226 * @type {Drupal~behavior} 5227 * 5228 * @see https://www.drupal.org/project/webform/issues/3068998 5229 */ 5230 Drupal.behaviors.webformCheckboxesRequired = { 5231 attach: function (context) { 5232 $('.js-form-type-checkboxes.required, .js-form-type-webform-checkboxes-other.required, .js-webform-type-checkboxes.required, .js-webform-type-webform-checkboxes-other.required, .js-webform-type-webform-radios-other.checkboxes', context) 5233 .once('webform-checkboxes-required') 5234 .each(function () { 5235 var $element = $(this); 5236 $element.find('input[type="checkbox"]').on('click', statesCheckboxesRequiredEventHandler); 5237 setTimeout(function () {checkboxesRequired($element);}); 5238 }); 5239 } 5240 }; 5241 5242 /** 5243 * Adds HTML5 validation to required radios. 5244 * 5245 * @type {Drupal~behavior} 5246 * 5247 * @see https://www.drupal.org/project/webform/issues/2856795 5248 */ 5249 Drupal.behaviors.webformRadiosRequired = { 5250 attach: function (context) { 5251 $('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other, .js-webform-type-webform-entity-radios, .js-webform-type-webform-scale', context) 5252 .once('webform-radios-required') 5253 .each(function () { 5254 var $element = $(this); 5255 setTimeout(function () {radiosRequired($element);}); 5256 }); 5257 } 5258 }; 5259 5260 /** 5261 * Adds HTML5 validation to required table select. 5262 * 5263 * @type {Drupal~behavior} 5264 * 5265 * @see https://www.drupal.org/project/webform/issues/2856795 5266 */ 5267 Drupal.behaviors.webformTableSelectRequired = { 5268 attach: function (context) { 5269 $('.js-webform-tableselect.required', context) 5270 .once('webform-tableselect-required') 5271 .each(function () { 5272 var $element = $(this); 5273 var $tbody = $element.find('tbody'); 5274 var isMultiple = $element.is('[multiple]'); 5275 5276 if (isMultiple) { 5277 // Check all checkbox triggers checkbox 'change' event on 5278 // select and deselect all. 5279 // @see Drupal.tableSelect 5280 $tbody.find('input[type="checkbox"]').on('click change', function () { 5281 checkboxesRequired($tbody); 5282 }); 5283 } 5284 5285 setTimeout(function () { 5286 isMultiple ? checkboxesRequired($tbody) : radiosRequired($element); 5287 }); 5288 }); 5289 } 5290 }; 5291 5292 /** 5293 * Add HTML5 multiple checkboxes required validation. 5294 * 5295 * @param {jQuery} $element
5296 * An jQuery object containing HTML5 radios. 5297 * 5298 * @see https://stackoverflow.com/a/37825072/145846 5299 */ 5300 function checkboxesRequired($element) { 5301 var $firstCheckbox = $element.find('input[type="checkbox"]').first(); 5302 var isChecked = $element.find('input[type="checkbox"]').is(':checked'); 5303 toggleRequired($firstCheckbox, !isChecked); 5304 copyRequireMessage($element, $firstCheckbox); 5305 } 5306 5307 /** 5308 * Add HTML5 radios required validation. 5309 * 5310 * @param {jQuery} $element 5311 * An jQuery object containing HTML5 radios. 5312 * 5313 * @see https://www.drupal.org/project/webform/issues/2856795 5314 */ 5315 function radiosRequired($element) { 5316 var $radios = $element.find('input[type="radio"]'); 5317 var isRequired = $element.hasClass('required'); 5318 toggleRequired($radios, isRequired); 5319 copyRequireMessage($element, $radios); 5320 } 5321 5322 /* ************************************************************************ */ 5323 // Event handlers. 5324 /* ************************************************************************ */ 5325 5326 /** 5327 * Trigger #states API HTML5 multiple checkboxes required validation. 5328 * 5329 * @see https://stackoverflow.com/a/37825072/145846 5330 */ 5331 function statesCheckboxesRequiredEventHandler() { 5332 var $element = $(this).closest('.js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other'); 5333 checkboxesRequired($element); 5334 } 5335 5336 /** 5337 * Trigger an input's event handlers. 5338 * 5339 * @param {element} input 5340 * An input. 5341 */ 5342 function triggerEventHandlers(input) { 5343 var $input = $(input); 5344 var type = input.type; 5345 var tag = input.tagName.toLowerCase(); 5346 // Add 'webform.states' as extra parameter to event handlers. 5347 // @see Drupal.behaviors.webformUnsaved 5348 var extraParameters = ['webform.states']; 5349 if (type === 'checkbox' || type === 'radio') { 5350 $input 5351 .trigger('change', extraParameters) 5352 .trigger('blur', extraParameters); 5353 } 5354 else if (tag === 'select') { 5355 // Do not trigger the onchange event for Address element's country code 5356 // when it is initialized. 5357 // @see \Drupal\address\Element\Country 5358 if ($input.closest('.webform-type-address').length) { 5359 if (!$input.data('webform-states-address-initialized') 5360 && $input.attr('autocomplete') === 'country' 5361 && $input.val() === $input.find("option[selected]").attr('value')) { 5362 return; 5363 } 5364 $input.data('webform-states-address-initialized', true); 5365 } 5366 5367 $input 5368 .trigger('change', extraParameters) 5369 .trigger('blur', extraParameters); 5370 } 5371 else if (type !== 'submit' && type !== 'button' && type !== 'file') { 5372 // Make sure input mask is removed and then reset when value is restored. 5373 // @see https://www.drupal.org/project/webform/issues/3124155 5374 // @see https://www.drupal.org/project/webform/issues/3202795 5375 var hasInputMask = ($.fn.inputmask && $input.hasClass('js-webform-input-mask')); 5376 hasInputMask && $input.inputmask('remove'); 5377 5378 $input 5379 .trigger('input', extraParameters) 5380 .trigger('change', extraParameters) 5381 .trigger('keydown', extraParameters) 5382 .trigger('keyup', extraParameters) 5383 .trigger('blur', extraParameters); 5384 5385 hasInputMask && $input.inputmask(); 5386 } 5387 } 5388 5389 /* ************************************************************************ */ 5390 // Backup and restore value functions. 5391 /* ************************************************************************ */ 5392 5393 /** 5394 * Backup an input's current value and required attribute 5395 * 5396 * @param {element} input 5397 * An input. 5398 */ 5399 function backupValueAndRequired(input) { 5400 var $input = $(input); 5401 var type = input.type; 5402 var tag = input.tagName.toLowerCase(); // Normalize case. 5403 5404 // Backup required. 5405 if ($input.prop('required') && !$input.hasData('webform-required')) { 5406 $input.data('webform-required', true); 5407 } 5408 5409 // Backup value. 5410 if (!$input.hasData('webform-value')) { 5411 if (type === 'checkbox' || type === 'radio') { 5412 $input.data('webform-value', $input.prop('checked')); 5413 } 5414 else if (tag === 'select') { 5415 var values = []; 5416 $input.find('option:selected').each(function (i, option) { 5417 values[i] = option.value; 5418 }); 5419 $input.data('webform-value', values); 5420 } 5421 else if (type !== 'submit' && type !== 'button') { 5422 $input.data('webform-value', input.value); 5423 } 5424 } 5425 } 5426 5427 /** 5428 * Restore an input's value and required attribute. 5429 * 5430 * @param {element} input 5431 * An input. 5432 */ 5433 function restoreValueAndRequired(input) { 5434 var $input = $(input); 5435 5436 // Restore value. 5437 var value = $input.data('webform-value'); 5438 if (typeof value !== 'undefined') { 5439 var type = input.type; 5440 var tag = input.tagName.toLowerCase(); // Normalize case. 5441 5442 if (type === 'checkbox' || type === 'radio') { 5443 $input.prop('checked', value); 5444 } 5445 else if (tag === 'select') { 5446 $.each(value, function (i, option_value) { 5447 // Prevent "Syntax error, unrecognized expression" error by 5448 // escaping single quotes. 5449 // @see https://forum.jquery.com/topic/escape-characters-prior-to-using-selector 5450 option_value = option_value.replace(/'/g, "\\\'"); 5451 $input.find("option[value='" + option_value + "']").prop('selected', true); 5452 }); 5453 } 5454 else if (type !== 'submit' && type !== 'button') { 5455 input.value = value; 5456 } 5457 $input.removeData('webform-value'); 5458 } 5459 5460 // Restore required. 5461 var required = $input.data('webform-required'); 5462 if (typeof required !== 'undefined') { 5463 if (required) { 5464 $input.prop('required', true); 5465 } 5466 $input.removeData('webform-required'); 5467 } 5468 } 5469 5470 /** 5471 * Clear an input's value and required attributes. 5472 * 5473 * @param {element} input 5474 * An input. 5475 */ 5476 function clearValueAndRequired(input) { 5477 var $input = $(input); 5478 5479 // Check for #states no clear attribute.
5480 // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/ 5481 if ($input.closest('[data-webform-states-no-clear]').length) { 5482 return; 5483 } 5484 5485 // Clear value. 5486 var type = input.type; 5487 var tag = input.tagName.toLowerCase(); // Normalize case. 5488 if (type === 'checkbox' || type === 'radio') { 5489 $input.prop('checked', false); 5490 } 5491 else if (tag === 'select') { 5492 if ($input.find('option[value=""]').length) { 5493 $input.val(''); 5494 } 5495 else { 5496 input.selectedIndex = -1; 5497 } 5498 } 5499 else if (type !== 'submit' && type !== 'button') { 5500 input.value = (type === 'color') ? '#000000' : ''; 5501 } 5502 5503 // Clear required. 5504 $input.prop('required', false); 5505 } 5506 5507 /* ************************************************************************ */ 5508 // Helper functions. 5509 /* ************************************************************************ */ 5510 5511 /** 5512 * Toggle an input's required attributes. 5513 * 5514 * @param {element} $input 5515 * An input. 5516 * @param {boolean} required 5517 * Is input required. 5518 */ 5519 function toggleRequired($input, required) { 5520 var isCheckboxOrRadio = ($input.attr('type') === 'radio' || $input.attr('type') === 'checkbox'); 5521 if (required) { 5522 if (isCheckboxOrRadio) { 5523 $input.attr({'required': 'required'}); 5524 } 5525 else { 5526 $input.attr({'required': 'required', 'aria-required': 'true'}); 5527 } 5528 } 5529 else { 5530 if (isCheckboxOrRadio) { 5531 $input.removeAttr('required'); 5532 } 5533 else { 5534 $input.removeAttr('required aria-required'); 5535 } 5536 } 5537 } 5538 5539 /** 5540 * Copy the clientside_validation.module's message. 5541 * 5542 * @param {jQuery} $source 5543 * The source element. 5544 * @param {jQuery} $destination 5545 * The destination element. 5546 */ 5547 function copyRequireMessage($source, $destination) { 5548 if ($source.attr('data-msg-required')) { 5549 $destination.attr('data-msg-required', $source.attr('data-msg-required')); 5550 } 5551 } 5552 5553})(jQuery, Drupal); 5554; 5555/** 5556 * @file 5557 * JavaScript behaviors for webforms. 5558 */ 5559 5560(function ($, Drupal) { 5561 5562 'use strict'; 5563 5564 /** 5565 * Remove single submit event listener. 5566 * 5567 * @type {Drupal~behavior} 5568 * 5569 * @prop {Drupal~behaviorAttach} attach 5570 * Attaches the behavior for removing single submit event listener. 5571 * 5572 * @see Drupal.behaviors.formSingleSubmit 5573 */ 5574 Drupal.behaviors.webformRemoveFormSingleSubmit = { 5575 attach: function attach() { 5576 function onFormSubmit(e) { 5577 var $form = $(e.currentTarget); 5578 $form.removeAttr('data-drupal-form-submit-last'); 5579 } 5580 $('body') 5581 .once('webform-single-submit') 5582 .on('submit.singleSubmit', 'form.webform-remove-single-submit', onFormSubmit); 5583 } 5584 }; 5585 5586 /** 5587 * Prevent webform autosubmit on wizard pages. 5588 * 5589 * @type {Drupal~behavior} 5590 * 5591 * @prop {Drupal~behaviorAttach} attach 5592 * Attaches the behavior for disabling webform autosubmit. 5593 * Wizard pages need to be progressed with the Previous or Next buttons, 5594 * not by pressing Enter. 5595 */ 5596 Drupal.behaviors.webformDisableAutoSubmit = { 5597 attach: function (context) { 5598 // Not using context so that inputs loaded via Ajax will have autosubmit 5599 // disabled. 5600 // @see http://stackoverflow.com/questions/11235622/jquery-disable-form-submit-on-enter 5601 $('.js-webform-disable-autosubmit input') 5602 .not(':button, :submit, :reset, :image, :file') 5603 .once('webform-disable-autosubmit') 5604 .on('keyup keypress', function (e) { 5605 if (e.which === 13) { 5606 e.preventDefault(); 5607 return false; 5608 } 5609 }); 5610 } 5611 }; 5612 5613 /** 5614 * Custom required and pattern validation error messages. 5615 * 5616 * @type {Drupal~behavior} 5617 * 5618 * @prop {Drupal~behaviorAttach} attach 5619 * Attaches the behavior for the webform custom required and pattern 5620 * validation error messages. 5621 * 5622 * @see http://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message 5623 **/ 5624 Drupal.behaviors.webformRequiredError = { 5625 attach: function (context) { 5626 $(context).find(':input[data-webform-required-error], :input[data-webform-pattern-error]').once('webform-required-error') 5627 .on('invalid', function () { 5628 this.setCustomValidity(''); 5629 if (this.valid) { 5630 return; 5631 } 5632 5633 if (this.validity.patternMismatch && $(this).attr('data-webform-pattern-error')) { 5634 this.setCustomValidity($(this).attr('data-webform-pattern-error')); 5635 } 5636 else if (this.validity.valueMissing && $(this).attr('data-webform-required-error')) { 5637 this.setCustomValidity($(this).attr('data-webform-required-error')); 5638 } 5639 }) 5640 .on('input change', function () { 5641 // Find all related elements by name and reset custom validity. 5642 // This specifically applies to required radios and checkboxes. 5643 var name = $(this).attr('name'); 5644 $(this.form).find(':input[name="' + name + '"]').each(function () { 5645 this.setCustomValidity(''); 5646 }); 5647 }); 5648 } 5649 }; 5650 5651 // When #state:required is triggered we need to reset the target elements 5652 // custom validity. 5653 $(document).on('state:required', function (e) { 5654 $(e.target).filter('[data-webform-required-error]') 5655 .each(function () {this.setCustomValidity('');}); 5656 }); 5657 5658})(jQuery, Drupal); 5659; 5660/** 5661 * @file 5662 * JavaScript behaviors for details element. 5663 */ 5664 5665(function ($, Drupal) { 5666 5667 'use strict'; 5668 5669 // Determine if local storage exists and is enabled. 5670 // This approach is copied from Modernizr. 5671 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 5672 var hasLocalStorage = (function () { 5673 try { 5674 localStorage.setItem('webform', 'webform'); 5675 localStorage.removeItem('webform'); 5676 return true; 5677 } 5678 catch (e) { 5679 return false;
5680 } 5681 }()); 5682 5683 /** 5684 * Attach handler to save details open/close state. 5685 * 5686 * @type {Drupal~behavior} 5687 */ 5688 Drupal.behaviors.webformDetailsSave = { 5689 attach: function (context) { 5690 if (!hasLocalStorage) { 5691 return; 5692 } 5693 5694 // Summary click event handler. 5695 $('details > summary', context).once('webform-details-summary-save').on('click', function () { 5696 var $details = $(this).parent(); 5697 5698 // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/ 5699 if ($details[0].hasAttribute('data-webform-details-nosave')) { 5700 return; 5701 } 5702 5703 var name = Drupal.webformDetailsSaveGetName($details); 5704 if (!name) { 5705 return; 5706 } 5707 5708 var open = ($details.attr('open') !== 'open') ? '1' : '0'; 5709 localStorage.setItem(name, open); 5710 }); 5711 5712 // Initialize details open state via local storage. 5713 $('details', context).once('webform-details-save').each(function () { 5714 var $details = $(this); 5715 5716 var name = Drupal.webformDetailsSaveGetName($details); 5717 if (!name) { 5718 return; 5719 } 5720 5721 var open = localStorage.getItem(name); 5722 if (open === null) { 5723 return; 5724 } 5725 5726 if (open === '1') { 5727 $details.attr('open', 'open'); 5728 } 5729 else { 5730 $details.removeAttr('open'); 5731 } 5732 }); 5733 } 5734 5735 }; 5736 5737 /** 5738 * Get the name used to store the state of details element. 5739 * 5740 * @param {jQuery} $details 5741 * A details element. 5742 * 5743 * @return {string} 5744 * The name used to store the state of details element. 5745 */ 5746 Drupal.webformDetailsSaveGetName = function ($details) { 5747 if (!hasLocalStorage) { 5748 return ''; 5749 } 5750 5751 // Ignore details that are vertical tabs pane. 5752 if ($details.hasClass('vertical-tabs__pane')) { 5753 return ''; 5754 } 5755 5756 // Any details element not included a webform must have define its own id. 5757 var webformId = $details.attr('data-webform-element-id'); 5758 if (webformId) { 5759 return 'Drupal.webform.' + webformId.replace('--', '.'); 5760 } 5761 5762 var detailsId = $details.attr('id'); 5763 if (!detailsId) { 5764 return ''; 5765 } 5766 5767 var $form = $details.parents('form'); 5768 if (!$form.length || !$form.attr('id')) { 5769 return ''; 5770 } 5771 5772 var formId = $form.attr('id'); 5773 if (!formId) { 5774 return ''; 5775 } 5776 5777 // ISSUE: When Drupal renders a webform in a modal dialog it appends a unique 5778 // identifier to webform ids and details ids. (i.e. my-form--FeSFISegTUI) 5779 // WORKAROUND: Remove the unique id that delimited using double dashes. 5780 formId = formId.replace(/--.+?$/, '').replace(/-/g, '_'); 5781 detailsId = detailsId.replace(/--.+?$/, '').replace(/-/g, '_'); 5782 return 'Drupal.webform.' + formId + '.' + detailsId; 5783 }; 5784 5785})(jQuery, Drupal); 5786; 5787/** 5788* DO NOT EDIT THIS FILE. 5789* See the following change record for more information, 5790* https://www.drupal.org/node/2815083 5791* @preserve 5792**/ 5793 5794(function (Drupal, debounce) { 5795 var liveElement = void 0; 5796 var announcements = []; 5797 5798 Drupal.behaviors.drupalAnnounce = { 5799 attach: function attach(context) { 5800 if (!liveElement) { 5801 liveElement = document.createElement('div'); 5802 liveElement.id = 'drupal-live-announce'; 5803 liveElement.className = 'visually-hidden'; 5804 liveElement.setAttribute('aria-live', 'polite'); 5805 liveElement.setAttribute('aria-busy', 'false'); 5806 document.body.appendChild(liveElement); 5807 } 5808 } 5809 }; 5810 5811 function announce() { 5812 var text = []; 5813 var priority = 'polite'; 5814 var announcement = void 0; 5815 5816 var il = announcements.length; 5817 for (var i = 0; i < il; i++) { 5818 announcement = announcements.pop(); 5819 text.unshift(announcement.text); 5820 5821 if (announcement.priority === 'assertive') { 5822 priority = 'assertive'; 5823 } 5824 } 5825 5826 if (text.length) { 5827 liveElement.innerHTML = ''; 5828 5829 liveElement.setAttribute('aria-busy', 'true'); 5830 5831 liveElement.setAttribute('aria-live', priority); 5832 5833 liveElement.innerHTML = text.join('\n'); 5834 5835 liveElement.setAttribute('aria-busy', 'false'); 5836 } 5837 } 5838 5839 Drupal.announce = function (text, priority) { 5840 announcements.push({ 5841 text: text, 5842 priority: priority 5843 }); 5844 5845 return debounce(announce, 200)(); 5846 }; 5847})(Drupal, Drupal.debounce);; 5848/** 5849 * @file 5850 * JavaScript behaviors for details element. 5851 */ 5852 5853(function ($, Drupal) { 5854 5855 'use strict'; 5856 5857 Drupal.webform = Drupal.webform || {}; 5858 Drupal.webform.detailsToggle = Drupal.webform.detailsToggle || {}; 5859 Drupal.webform.detailsToggle.options = Drupal.webform.detailsToggle.options || {}; 5860 5861 /** 5862 * Attach handler to toggle details open/close state. 5863 * 5864 * @type {Drupal~behavior} 5865 */ 5866 Drupal.behaviors.webformDetailsToggle = { 5867 attach: function (context) { 5868 $('.js-webform-details-toggle', context).once('webform-details-toggle').each(function () { 5869 var $form = $(this); 5870 var $tabs = $form.find('.webform-tabs'); 5871 5872 // Get only the main details elements and ignore all nested details. 5873 var selector = ($tabs.length) ? '.webform-tab' : '.js-webform-details-toggle, .webform-elements'; 5874 var $details = $form.find('details').filter(function () { 5875 var $parents = $(this).parentsUntil(selector); 5876 return ($parents.find('details').length === 0); 5877 }); 5878 5879 // Toggle is only useful when there are two or more details elements. 5880 if ($details.length < 2) { 5881 return; 5882 } 5883 5884 var options = $.extend({ 5885 button: '<button type="button" class="webform-details-toggle-state"></button>' 5886 }, Drupal.webform.detailsToggle.options); 5887 5888 // Create toggle buttons. 5889 var $toggle = $(options.button) 5890 .attr('title', Drupal.t('Toggle details widget state.')) 5891 .on('click', function (e) { 5892 // Get details that are not vertical tabs pane. 5893 var $details = $form.find('details:not(.vertical-tabs__pane)'); 5894 var open; 5895 if (Drupal.webform.detailsToggle.isFormDetailsOpen($form)) { 5896 $details.removeAttr('open'); 5897 open = 0; 5898 } 5899 else { 5900 $details.attr('open', 'open'); 5901 open = 1; 5902 } 5903 Drupal.webform.detailsToggle.setDetailsToggleLabel($form); 5904 5905 // Set the saved states for all the details elements. 5906 // @see webform.element.details.save.js 5907 if (Drupal.webformDetailsSaveGetName) { 5908 $details.each(function () { 5909 // Note: Drupal.webformDetailsSaveGetName checks if localStorage 5910 // exists and is enabled. 5911 // @see webform.element.details.save.js 5912 var name = Drupal.webformDetailsSaveGetName($(this)); 5913 if (name) {
5914 localStorage.setItem(name, open); 5915 } 5916 }); 5917 } 5918 }) 5919 .wrap('<div class="webform-details-toggle-state-wrapper"></div>') 5920 .parent(); 5921 5922 if ($tabs.length) { 5923 // Add toggle state before the tabs. 5924 $tabs.find('.item-list:first-child').eq(0).before($toggle); 5925 } 5926 else { 5927 // Add toggle state link to first details element. 5928 $details.eq(0).before($toggle); 5929 } 5930 5931 Drupal.webform.detailsToggle.setDetailsToggleLabel($form); 5932 }); 5933 } 5934 }; 5935 5936 /** 5937 * Determine if a webform's details are all opened. 5938 * 5939 * @param {jQuery} $form 5940 * A webform. 5941 * 5942 * @return {boolean} 5943 * TRUE if a webform's details are all opened. 5944 */ 5945 Drupal.webform.detailsToggle.isFormDetailsOpen = function ($form) { 5946 return ($form.find('details[open]').length === $form.find('details').length); 5947 }; 5948 5949 /** 5950 * Set a webform's details toggle state widget label. 5951 * 5952 * @param {jQuery} $form 5953 * A webform. 5954 */ 5955 Drupal.webform.detailsToggle.setDetailsToggleLabel = function ($form) { 5956 var isOpen = Drupal.webform.detailsToggle.isFormDetailsOpen($form); 5957 5958 var label = (isOpen) ? Drupal.t('Collapse all') : Drupal.t('Expand all'); 5959 $form.find('.webform-details-toggle-state').html(label); 5960 5961 var text = (isOpen) ? Drupal.t('All details have been expanded.') : Drupal.t('All details have been collapsed.'); 5962 Drupal.announce(text); 5963 }; 5964 5965})(jQuery, Drupal); 5966; 5967/** 5968 * @file 5969 * JavaScript behaviors for message element integration. 5970 */ 5971 5972(function ($, Drupal) { 5973 5974 'use strict'; 5975 5976 // Determine if local storage exists and is enabled. 5977 // This approach is copied from Modernizr. 5978 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 5979 var hasLocalStorage = (function () { 5980 try { 5981 localStorage.setItem('webform', 'webform'); 5982 localStorage.removeItem('webform'); 5983 return true; 5984 } 5985 catch (e) { 5986 return false; 5987 } 5988 }()); 5989 5990 // Determine if session storage exists and is enabled. 5991 // This approach is copied from Modernizr. 5992 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 5993 var hasSessionStorage = (function () { 5994 try { 5995 sessionStorage.setItem('webform', 'webform'); 5996 sessionStorage.removeItem('webform'); 5997 return true; 5998 } 5999 catch (e) { 6000 return false; 6001 } 6002 }()); 6003 6004 /** 6005 * Behavior for handler message close. 6006 * 6007 * @type {Drupal~behavior} 6008 */ 6009 Drupal.behaviors.webformMessageClose = { 6010 attach: function (context) { 6011 $(context).find('.js-webform-message--close').once('webform-message--close').each(function () { 6012 var $element = $(this); 6013 6014 var id = $element.attr('data-message-id'); 6015 var storage = $element.attr('data-message-storage'); 6016 var effect = $element.attr('data-message-close-effect') || 'hide'; 6017 switch (effect) { 6018 case 'slide': effect = 'slideUp'; break; 6019 6020 case 'fade': effect = 'fadeOut'; break; 6021 } 6022 6023 // Check storage status. 6024 if (isClosed($element, storage, id)) { 6025 return; 6026 } 6027 6028 // Only show element if it's style is not set to 'display: none'. 6029 if ($element.attr('style') !== 'display: none;') { 6030 $element.show(); 6031 } 6032 6033 $element.find('.js-webform-message__link').on('click', function (event) { 6034 $element[effect](); 6035 setClosed($element, storage, id); 6036 $element.trigger('close'); 6037 event.preventDefault(); 6038 }); 6039 }); 6040 } 6041 }; 6042 6043 function isClosed($element, storage, id) { 6044 if (!id || !storage) { 6045 return false; 6046 } 6047 6048 switch (storage) { 6049 case 'local': 6050 if (hasLocalStorage) { 6051 return localStorage.getItem('Drupal.webform.message.' + id) || false; 6052 } 6053 return false; 6054 6055 case 'session': 6056 if (hasSessionStorage) { 6057 return sessionStorage.getItem('Drupal.webform.message.' + id) || false; 6058 } 6059 return false;
6060 6061 default: 6062 return false; 6063 } 6064 } 6065 6066 function setClosed($element, storage, id) { 6067 if (!id || !storage) { 6068 return; 6069 } 6070 6071 switch (storage) { 6072 case 'local': 6073 if (hasLocalStorage) { 6074 localStorage.setItem('Drupal.webform.message.' + id, true); 6075 } 6076 break; 6077 6078 case 'session': 6079 if (hasSessionStorage) { 6080 sessionStorage.setItem('Drupal.webform.message.' + id, true); 6081 } 6082 break; 6083 6084 case 'user': 6085 case 'state': 6086 case 'custom': 6087 $.get($element.find('.js-webform-message__link').attr('href')); 6088 return true; 6089 } 6090 } 6091 6092})(jQuery, Drupal); 6093; 6094/** 6095* DO NOT EDIT THIS FILE. 6096* See the following change record for more information, 6097* https://www.drupal.org/node/2815083 6098* @preserve 6099**/ 6100 6101(function ($, Drupal) { 6102 Drupal.behaviors.detailsAria = { 6103 attach: function attach() { 6104 $('body').once('detailsAria').on('click.detailsAria', 'summary', function (event) { 6105 var $summary = $(event.currentTarget); 6106 var open = $(event.currentTarget.parentNode).attr('open') === 'open' ? 'false' : 'true'; 6107 6108 $summary.attr({ 6109 'aria-expanded': open, 6110 'aria-pressed': open 6111 }); 6112 }); 6113 } 6114 }; 6115})(jQuery, Drupal);; 6116/** 6117* DO NOT EDIT THIS FILE. 6118* See the following change record for more information, 6119* https://www.drupal.org/node/2815083 6120* @preserve 6121**/ 6122 6123(function ($, Modernizr, Drupal) { 6124 function CollapsibleDetails(node) { 6125 this.$node = $(node); 6126 this.$node.data('details', this); 6127 6128 var anchor = window.location.hash && window.location.hash !== '#' ? ', ' + window.location.hash : ''; 6129 if (this.$node.find('.error' + anchor).length) { 6130 this.$node.attr('open', true); 6131 } 6132 6133 this.setupSummary(); 6134 6135 this.setupLegend(); 6136 } 6137 6138 $.extend(CollapsibleDetails, { 6139 instances: [] 6140 }); 6141 6142 $.extend(CollapsibleDetails.prototype, { 6143 setupSummary: function setupSummary() { 6144 this.$summary = $('<span class="summary"></span>'); 6145 this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated'); 6146 }, 6147 setupLegend: function setupLegend() { 6148 var $legend = this.$node.find('> summary'); 6149 6150 $('<span class="details-summary-prefix visually-hidden"></span>').append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show')).prependTo($legend).after(document.createTextNode(' ')); 6151 6152 $('<a class="details-title"></a>').attr('href', '#' + this.$node.attr('id')).prepend($legend.contents()).appendTo($legend); 6153 6154 $legend.append(this.$summary).on('click', $.proxy(this.onLegendClick, this)); 6155 }, 6156 onLegendClick: function onLegendClick(e) { 6157 this.toggle(); 6158 e.preventDefault(); 6159 }, 6160 onSummaryUpdated: function onSummaryUpdated() { 6161 var text = $.trim(this.$node.drupalGetSummary()); 6162 this.$summary.html(text ? ' (' + text + ')' : ''); 6163 }, 6164 toggle: function toggle() { 6165 var _this = this; 6166 6167 var isOpen = !!this.$node.attr('open'); 6168 var $summaryPrefix = this.$node.find('> summary span.details-summary-prefix'); 6169 if (isOpen) { 6170 $summaryPrefix.html(Drupal.t('Show')); 6171 } else { 6172 $summaryPrefix.html(Drupal.t('Hide')); 6173 } 6174 6175 setTimeout(function () { 6176 _this.$node.attr('open', !isOpen); 6177 }, 0); 6178 } 6179 }); 6180 6181 Drupal.behaviors.collapse = { 6182 attach: function attach(context) { 6183 if (Modernizr.details) { 6184 return; 6185 } 6186 var $collapsibleDetails = $(context).find('details').once('collapse').addClass('collapse-processed'); 6187 if ($collapsibleDetails.length) { 6188 for (var i = 0; i < $collapsibleDetails.length; i++) { 6189 CollapsibleDetails.instances.push(new CollapsibleDetails($collapsibleDetails[i])); 6190 } 6191 } 6192 } 6193 }; 6194 6195 var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) { 6196 $target.parents('details').not('[open]').find('> summary').trigger('click'); 6197 }; 6198 6199 $('body').on('formFragmentLinkClickOrHashChange.details', handleFragmentLinkClickOrHashChange); 6200 6201 Drupal.CollapsibleDetails = CollapsibleDetails; 6202})(jQuery, Modernizr, Drupal);; 6203/** 6204 * @file 6205 * Attaches behaviors for the zipang captcha refresh module. 6206 */ 6207 6208(function ($) { 6209 'use strict'; 6210 6211 /** 6212 * Attaches jQuery validate behavoir to forms. 6213 * 6214 * @type {Drupal~behavior} 6215 * 6216 * @prop {Drupal~behaviorAttach} attach 6217 * Attaches the outline behavior to the right context. 6218 */ 6219 Drupal.behaviors.CaptchaRefresh = { 6220 6221 attach: function (context) { 6222 $('.reload-captcha', context).not('.processed').bind('click', function () { 6223 $(this).addClass('processed'); 6224 var $form = $(this).parents('form'); 6225 // Send post query for getting new captcha data. 6226 var date = new Date(); 6227 var baseUrl = document.location.origin; 6228 var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime(); 6229 // Adding loader. 6230 $('.captcha').append('<div class="image_captcha_refresh_loader"></div>'); 6231 $.get( 6232 url, 6233 {}, 6234 function (response) { 6235 if (response.status === 1) { 6236 $('.captcha', $form).find('img').attr('src', response.data.url); 6237 $('input[name=captcha_sid]', $form).val(response.data.sid); 6238 $('input[name=captcha_token]', $form).val(response.data.token); 6239 $('.captcha .image_captcha_refresh_loader').remove(); 6240 } 6241 else { 6242 alert(response.message); 6243 } 6244 }, 6245 'json' 6246 ); 6247 return false;
vendor: 4,838 bytes, lines 6248-6256
6248 }); 6249 } 6250 }; 6251})(jQuery); 6252; 6253/*! jQuery UI - v1.12.1 - 2017-03-31 6254* http://jqueryui.com 6255* Copyright jQuery Foundation and other contributors; Licensed */ 6256!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return function(){function b(a,b,c){return[parseFloat(a[0])*(l.test(a[0])?b/100:1),parseFloat(a[1])*(l.test(a[1])?c/100:1)]}function c(b,c){return parseInt(a.css(b,c),10)||0}function d(b){var c=b[0];return 9===c.nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:a.isWindow(c)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:c.preventDefault?{width:0,height:0,offset:{top:c.pageY,left:c.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()}}var e,f=Math.max,g=Math.abs,h=/left|center|right/,i=/top|center|bottom/,j=/[\+\-]\d+(\.[\d]+)?%?/,k=/^\w+/,l=/%$/,m=a.fn.position;a.position={scrollbarWidth:function(){if(void 0!==e)return e;var b,c,d=a("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),f=d.children()[0];return a("body").append(d),b=f.offsetWidth,d.css("overflow","scroll"),c=f.offsetWidth,b===c&&(c=d[0].clientWidth),d.remove(),e=b-c},getScrollInfo:function(b){var c=b.isWindow||b.isDocument?"":b.element.css("overflow-x"),d=b.isWindow||b.isDocument?"":b.element.css("overflow-y"),e="scroll"===c||"auto"===c&&b.width<b.element[0].scrollWidth,f="scroll"===d||"auto"===d&&b.height<b.element[0].scrollHeight;return{width:f?a.position.scrollbarWidth():0,height:e?a.position.scrollbarWidth():0}},getWithinInfo:function(b){var c=a(b||window),d=a.isWindow(c[0]),e=!!c[0]&&9===c[0].nodeType,f=!d&&!e;return{element:c,isWindow:d,isDocument:e,offset:f?a(b).offset():{left:0,top:0},scrollLeft:c.scrollLeft(),scrollTop:c.scrollTop(),width:c.outerWidth(),height:c.outerHeight()}}},a.fn.position=function(e){if(!e||!e.of)return m.apply(this,arguments);e=a.extend({},e);var l,n,o,p,q,r,s=a(e.of),t=a.position.getWithinInfo(e.within),u=a.position.getScrollInfo(t),v=(e.collision||"flip").split(" "),w={};return r=d(s),s[0].preventDefault&&(e.at="left top"),n=r.width,o=r.height,p=r.offset,q=a.extend({},p),a.each(["my","at"],function(){var a,b,c=(e[this]||"").split(" ");1===c.length&&(c=h.test(c[0])?c.concat(["center"]):i.test(c[0])?["center"].concat(c):["center","center"]),c[0]=h.test(c[0])?c[0]:"center",c[1]=i.test(c[1])?c[1]:"center",a=j.exec(c[0]),b=j.exec(c[1]),w[this]=[a?a[0]:0,b?b[0]:0],e[this]=[k.exec(c[0])[0],k.exec(c[1])[0]]}),1===v.length&&(v[1]=v[0]),"right"===e.at[0]?q.left+=n:"center"===e.at[0]&&(q.left+=n/2),"bottom"===e.at[1]?q.top+=o:"center"===e.at[1]&&(q.top+=o/2),l=b(w.at,n,o),q.left+=l[0],q.top+=l[1],this.each(function(){var d,h,i=a(this),j=i.outerWidth(),k=i.outerHeight(),m=c(this,"marginLeft"),r=c(this,"marginTop"),x=j+m+c(this,"marginRight")+u.width,y=k+r+c(this,"marginBottom")+u.height,z=a.extend({},q),A=b(w.my,i.outerWidth(),i.outerHeight());"right"===e.my[0]?z.left-=j:"center"===e.my[0]&&(z.left-=j/2),"bottom"===e.my[1]?z.top-=k:"center"===e.my[1]&&(z.top-=k/2),z.left+=A[0],z.top+=A[1],d={marginLeft:m,marginTop:r},a.each(["left","top"],function(b,c){a.ui.position[v[b]]&&a.ui.position[v[b]][c](z,{targetWidth:n,targetHeight:o,elemWidth:j,elemHeight:k,collisionPosition:d,collisionWidth:x,collisionHeight:y,offset:[l[0]+A[0],l[1]+A[1]],my:e.my,at:e.at,within:t,elem:i})}),e.using&&(h=function(a){var b=p.left-z.left,c=b+n-j,d=p.top-z.top,h=d+o-k,l={target:{element:s,left:p.left,top:p.top,width:n,height:o},element:{element:i,left:z.left,top:z.top,width:j,height:k},horizontal:c<0?"left":b>0?"right":"center",vertical:h<0?"top":d>0?"bottom":"middle"};n<j&&g(b+c)<n&&(l.horizontal="center"),o<k&&g(d+h)<o&&(l.vertical="middle"),f(g(b),g(c))>f(g(d),g(h))?l.important="horizontal":l.important="vertical",e.using.call(this,a,l)}),i.offset(a.extend(z,{using:h}))})},a.ui.position={fit:{left:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollLeft:d.offset.left,g=d.width,h=a.left-b.collisionPosition.marginLeft,i=e-h,j=h+b.collisionWidth-g-e;b.collisionWidth>g?i>0&&j<=0?(c=a.left+i+b.collisionWidth-g-e,a.left+=i-c):j>0&&i<=0?a.left=e:i>j?a.left=e+g-b.collisionWidth:a.left=e:i>0?a.left+=i:j>0?a.left-=j:a.left=f(a.left-h,a.left)},top:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollTop:d.offset.top,g=b.within.height,h=a.top-b.collisionPosition.marginTop,i=e-h,j=h+b.collisionHeight-g-e;b.collisionHeight>g?i>0&&j<=0?(c=a.top+i+b.collisionHeight-g-e,a.top+=i-c):j>0&&i<=0?a.top=e:i>j?a.top=e+g-b.collisionHeight:a.top=e:i>0?a.top+=i:j>0?a.top-=j:a.top=f(a.top-h,a.top)}},flip:{left:function(a,b){var c,d,e=b.within,f=e.offset.left+e.scrollLeft,h=e.width,i=e.isWindow?e.scrollLeft:e.offset.left,j=a.left-b.collisionPosition.marginLeft,k=j-i,l=j+b.collisionWidth-h-i,m="left"
vendor: 5,794 bytes, lines 6256-6260
6256===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,n="left"===b.at[0]?b.targetWidth:"right"===b.at[0]?-b.targetWidth:0,o=-2*b.offset[0];k<0?(c=a.left+m+n+o+b.collisionWidth-h-f,(c<0||c<g(k))&&(a.left+=m+n+o)):l>0&&(d=a.left-b.collisionPosition.marginLeft+m+n+o-i,(d>0||g(d)<l)&&(a.left+=m+n+o))},top:function(a,b){var c,d,e=b.within,f=e.offset.top+e.scrollTop,h=e.height,i=e.isWindow?e.scrollTop:e.offset.top,j=a.top-b.collisionPosition.marginTop,k=j-i,l=j+b.collisionHeight-h-i,m="top"===b.my[1],n=m?-b.elemHeight:"bottom"===b.my[1]?b.elemHeight:0,o="top"===b.at[1]?b.targetHeight:"bottom"===b.at[1]?-b.targetHeight:0,p=-2*b.offset[1];k<0?(d=a.top+n+o+p+b.collisionHeight-h-f,(d<0||d<g(k))&&(a.top+=n+o+p)):l>0&&(c=a.top-b.collisionPosition.marginTop+n+o+p-i,(c>0||g(c)<l)&&(a.top+=n+o+p))}},flipfit:{left:function(){a.ui.position.flip.left.apply(this,arguments),a.ui.position.fit.left.apply(this,arguments)},top:function(){a.ui.position.flip.top.apply(this,arguments),a.ui.position.fit.top.apply(this,arguments)}}}}(),a.ui.position});; 6257/*! jQuery UI - v1.12.1 - 2017-03-31 6258* http://jqueryui.com 6259* Copyright jQuery Foundation and other contributors; Licensed */ 6260!function(a){"function"==typeof define&&define.amd?define(["jquery","../keycode","../position","../safe-active-element","../unique-id","../version","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(a){a.preventDefault()},"click .ui-menu-item":function(b){var c=a(b.target),d=a(a.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&c.not(".ui-state-disabled").length&&(this.select(b),b.isPropagationStopped()||(this.mouseHandled=!0),c.has(".ui-menu").length?this.expand(b):!this.element.is(":focus")&&d.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(b){if(!this.previousFilter){var c=a(b.target).closest(".ui-menu-item"),d=a(b.currentTarget);c[0]===d[0]&&(this._removeClass(d.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(b,d))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(a,b){var c=this.active||this.element.find(this.options.items).eq(0);b||this.focus(a,c)},blur:function(b){this._delay(function(){var c=!a.contains(this.element[0],a.ui.safeActiveElement(this.document[0]));c&&this.collapseAll(b)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(a){this._closeOnDocumentClick(a)&&this.collapseAll(a),this.mouseHandled=!1}})},_destroy:function(){var b=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),c=b.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),c.children().each(function(){var b=a(this);b.data("ui-menu-submenu-caret")&&b.remove()})},_keydown:function(b){var c,d,e,f,g=!0;switch(b.keyCode){case a.ui.keyCode.PAGE_UP:this.previousPage(b);break;case a.ui.keyCode.PAGE_DOWN:this.nextPage(b);break;case a.ui.keyCode.HOME:this._move("first","first",b);break;case a.ui.keyCode.END:this._move("last","last",b);break;case a.ui.keyCode.UP:this.previous(b);break;case a.ui.keyCode.DOWN:this.next(b);break;case a.ui.keyCode.LEFT:this.collapse(b);break;case a.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(b);break;case a.ui.keyCode.ENTER:case a.ui.keyCode.SPACE:this._activate(b);break;case a.ui.keyCode.ESCAPE:this.collapse(b);break;default:g=!1,d=this.previousFilter||"",f=!1,e=b.keyCode>=96&&b.keyCode<=105?(b.keyCode-96).toString():String.fromCharCode(b.keyCode),clearTimeout(this.filterTimer),e===d?f=!0:e=d+e,c=this._filterMenuItems(e),c=f&&c.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):c,c.length||(e=String.fromCharCode(b.keyCode),c=this._filterMenuItems(e)),c.length?(this.focus(b,c),this.previousFilter=e,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}g&&b.preventDefault()},_activate:function(a){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(a):this.select(a))},refresh:function(){var b,c,d,e,f,g=this,h=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),d=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var b=a(this),c=b.prev(),d=a("<span>").data("ui-menu-submenu-caret",!0);g._addClass(d,"ui-menu-icon","ui-icon "+h),c.attr("aria-haspopup","true").prepend(d),b.attr("aria-labelledby",c.attr("id"))}),this._addClass(d,"ui-menu","ui-widget ui-widget-content ui-front"),b=i.add(this.element),c=b.find(this.options.items),c.not(".ui-menu-item").each(function(){var b=a(this);g._isDivider(b)&&g._addClass(b,"ui-menu-divider","ui-widget-content")}),e=c.not(".ui-menu-item, .ui-menu-divider"),f=e.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(f,"ui-menu-item-wrapper"),c.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!
vendor: 4,888 bytes, line 6260
6260a.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(a,b){if("icons"===a){var c=this.element.find(".ui-menu-icon");this._removeClass(c,null,this.options.icons.submenu)._addClass(c,null,b.submenu)}this._super(a,b)},_setOptionDisabled:function(a){this._super(a),this.element.attr("aria-disabled",String(a)),this._toggleClass(null,"ui-state-disabled",!!a)},focus:function(a,b){var c,d,e;this.blur(a,a&&"focus"===a.type),this._scrollIntoView(b),this.active=b.first(),d=this.active.children(".ui-menu-item-wrapper"),this._addClass(d,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",d.attr("id")),e=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(e,null,"ui-state-active"),a&&"keydown"===a.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),c=b.children(".ui-menu"),c.length&&a&&/^mouse/.test(a.type)&&this._startOpening(c),this.activeMenu=b.parent(),this._trigger("focus",a,{item:b})},_scrollIntoView:function(b){var c,d,e,f,g,h;this._hasScroll()&&(c=parseFloat(a.css(this.activeMenu[0],"borderTopWidth"))||0,d=parseFloat(a.css(this.activeMenu[0],"paddingTop"))||0,e=b.offset().top-this.activeMenu.offset().top-c-d,f=this.activeMenu.scrollTop(),g=this.activeMenu.height(),h=b.outerHeight(),e<0?this.activeMenu.scrollTop(f+e):e+h>g&&this.activeMenu.scrollTop(f+e-g+h))},blur:function(a,b){b||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",a,{item:this.active}),this.active=null)},_startOpening:function(a){clearTimeout(this.timer),"true"===a.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(a)},this.delay))},_open:function(b){var c=a.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(b.parents(".ui-menu")).hide().attr("aria-hidden","true"),b.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(c)},collapseAll:function(b,c){clearTimeout(this.timer),this.timer=this._delay(function(){var d=c?this.element:a(b&&b.target).closest(this.element.find(".ui-menu"));d.length||(d=this.element),this._close(d),this.blur(b),this._removeClass(d.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=d},this.delay)},_close:function(a){a||(a=this.active?this.active.parent():this.element),a.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(b){return!a(b.target).closest(".ui-menu").length},_isDivider:function(a){return!/[^\-\u2014\u2013\s]/.test(a.text())},collapse:function(a){var b=this.active&&this.active.parent().closest(".ui-menu-item",this.element);b&&b.length&&(this._close(),this.focus(a,b))},expand:function(a){var b=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();b&&b.length&&(this._open(b.parent()),this._delay(function(){this.focus(a,b)}))},next:function(a){this._move("next","first",a)},previous:function(a){this._move("prev","last",a)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,b,c){var d;this.active&&(d="first"===a||"last"===a?this.active["first"===a?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[a+"All"](".ui-menu-item").eq(0)),d&&d.length&&this.active||(d=this.activeMenu.find(this.options.items)[b]()),this.focus(c,d)},nextPage:function(b){var c,d,e;return this.active?void(this.isLastItem()||(this._hasScroll()?(d=this.active.offset().top,e=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return c=a(this),c.offset().top-d-e<0}),this.focus(b,c)):this.focus(b,this.activeMenu.find(this.options.items)[this.active?"last":"first"]()))):void this.next(b)},previousPage:function(b){var c,d,e;return this.active?void(this.isFirstItem()||(this._hasScroll()?(d=this.active.offset().top,e=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return c=a(this),c.offset().top-d+e>0}),this.focus(b,c)):this.focus(b,this.activeMenu.find(this.options.items).first()))):void this.next(b)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(b){this.active=this.active||a(b.target).closest(".ui-menu-item");var c={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(b,!0),this._trigger("select",b,c)},_filterMenuItems:function(b){var c=b.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),d=new RegExp("^"+c,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return d.test(a.trim(a(this).children(".ui-menu-item-wrapper").text()))})}})});;
vendor: 9,344 bytes, lines 6261-6287
6261/*! jQuery UI - v1.12.1 - 2017-03-31 6262* http://jqueryui.com 6263* Copyright jQuery Foundation and other contributors; Licensed */ 6264!function(a){"function"==typeof define&&define.amd?define(["jquery","./menu","../keycode","../position","../safe-active-element","../version","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var b,c,d,e=this.element[0].nodeName.toLowerCase(),f="textarea"===e,g="input"===e;this.isMultiLine=f||!g&&this._isContentEditable(this.element),this.valueMethod=this.element[f||g?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(e){if(this.element.prop("readOnly"))return b=!0,d=!0,void(c=!0);b=!1,d=!1,c=!1;var f=a.ui.keyCode;switch(e.keyCode){case f.PAGE_UP:b=!0,this._move("previousPage",e);break;case f.PAGE_DOWN:b=!0,this._move("nextPage",e);break;case f.UP:b=!0,this._keyEvent("previous",e);break;case f.DOWN:b=!0,this._keyEvent("next",e);break;case f.ENTER:this.menu.active&&(b=!0,e.preventDefault(),this.menu.select(e));break;case f.TAB:this.menu.active&&this.menu.select(e);break;case f.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(e),e.preventDefault());break;default:c=!0,this._searchTimeout(e)}},keypress:function(d){if(b)return b=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||d.preventDefault());if(!c){var e=a.ui.keyCode;switch(d.keyCode){case e.PAGE_UP:this._move("previousPage",d);break;case e.PAGE_DOWN:this._move("nextPage",d);break;case e.UP:this._keyEvent("previous",d);break;case e.DOWN:this._keyEvent("next",d)}}},input:function(a){return d?(d=!1,void a.preventDefault()):void this._searchTimeout(a)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(a){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(a),void this._change(a))}}),this._initSource(),this.menu=a("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(b){b.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==a.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(b,c){var d,e;return this.isNewMenu&&(this.isNewMenu=!1,b.originalEvent&&/^mouse/.test(b.originalEvent.type))?(this.menu.blur(),void this.document.one("mousemove",function(){a(b.target).trigger(b.originalEvent)})):(e=c.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",b,{item:e})&&b.originalEvent&&/^key/.test(b.originalEvent.type)&&this._value(e.value),d=c.item.attr("aria-label")||e.value,void(d&&a.trim(d).length&&(this.liveRegion.children().hide(),a("<div>").text(d).appendTo(this.liveRegion))))},menuselect:function(b,c){var d=c.item.data("ui-autocomplete-item"),e=this.previous;this.element[0]!==a.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e,this.selectedItem=d})),!1!==this._trigger("select",b,{item:d})&&this._value(d.value),this.term=this._value(),this.close(b),this.selectedItem=d}}),this.liveRegion=a("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(a,b){this._super(a,b),"source"===a&&this._initSource(),"appendTo"===a&&this.menu.element.appendTo(this._appendTo()),"disabled"===a&&b&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(b){var c=this.menu.element[0];return b.target===this.element[0]||b.target===c||a.contains(c,b.target)},_closeOnClickOutside:function(a){this._isEventTargetInWidget(a)||this.close()},_appendTo:function(){var b=this.options.appendTo;return b&&(b=b.jquery||b.nodeType?a(b):this.document.find(b).eq(0)),b&&b[0]||(b=this.element.closest(".ui-front, dialog")),b.length||(b=this.document[0].body),b},_initSource:function(){var b,c,d=this;a.isArray(this.options.source)?(b=this.options.source,this.source=function(c,d){d(a.ui.autocomplete.filter(b,c.term))}):"string"==typeof this.options.source?(c=this.options.source,this.source=function(b,e){d.xhr&&d.xhr.abort(),d.xhr=a.ajax({url:c,data:b,dataType:"json",success:function(a){e(a)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(a){clearTimeout(this.searching),this.searching=this._delay(function(){var b=this.term===this._value(),c=this.menu.element.is(":visible"),d=a.altKey||a.ctrlKey||a.metaKey||a.shiftKey;b&&(!b||c||d)||(this.selectedItem=null,this.search(null,a))},this.options.delay)},search:function(a,b){return a=null!=a?a:this._value(),this.term=this._value(),a.length<this.options.minLength?this.close(b):this._trigger("search",b)!==!1?this._search(a):void 0},_search:function(a){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:a},this._response())},_response:function(){var b=++this.requestIndex;return a.proxy(function(a){b===this.requestIndex&&this.__response(a),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(a){a&&(a=this._normalize(a)),this._trigger("response",null,{content:a}),!this.options.disabled&&a&&a.length&&!this.cancelSearch?(this._suggest(a),this._trigger("open")):this._close()},close:function(a){this.cancelSearch=!0,this._close(a)},_close:function(a){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",a))},_change:function(a){this.previous!==this._value()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return"string"==typeof b?{label:b,value:b}:a.extend({},b,{label:b.label||b.value,value:b.value||b.label})})},_suggest:function(b){var c=this.menu.element.empty();this._renderMenu(c,b),this.isNewMenu=!0,this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItemData(b,c)})},_renderItemData:function(a,b){return this._renderItem(a,b).data("ui-autocomplete-item",b)},_renderItem:function(b,c){return a("<li>").append(a("<div>").text(c.label)).appendTo(b)},_move:function(a,b){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(a)||this.menu.isLastItem()&&/^next/.test(a)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[a](b):void this.search(null,b)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(a,b){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(a,b),b.preventDefault())},_isContentEditable:function(a){if(!a.length)return!1;var b=a.prop("contentEditable");return"inherit"===b?this._isContentEditable(a.parent()):"true"===b}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}}),a.widget("ui.autocomplete",a.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(a){return a+(a>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(b){var c;this._superApply(arguments),this.options.disabled||this.cancelSearch||(c=b&&b.length?this.options.messages.results(b.length):this.options.messages.noResults,this.liveRegion.children().hide(),a("<div>").text(c).appendTo(this.liveRegion))}}),a.ui.autocomplete});; 6265/** 6266 * @file 6267 * Extends autocomplete based on jQuery UI. 6268 * 6269 * @todo Remove once jQuery UI is no longer used? 6270 */ 6271 6272(function ($, Drupal) { 6273 'use strict'; 6274 6275 // Ensure the input element has a "change" event triggered. This is important 6276 // so that summaries in vertical tabs can be updated properly. 6277 // @see Drupal.behaviors.formUpdated 6278 $(document).on('autocompleteselect', '.form-autocomplete', function (e) { 6279 $(e.target).trigger('change.formUpdated'); 6280 }); 6281 6282 // Extend ui.autocomplete widget so it triggers the glyphicon throbber. 6283 $.widget('ui.autocomplete', $.ui.autocomplete, { 6284 _search: function (value) { 6285 this.pending++; 6286 Drupal.Ajax.prototype.glyphiconStart(this.element); 6287 this.cancelSearch = false;
6288 this.source({term: value}, this._response()); 6289 }, 6290 _response: function () { 6291 var index = ++this.requestIndex; 6292 return $.proxy(function (content) { 6293 if (index === this.requestIndex) this.__response(content); 6294 this.pending--; 6295 if (!this.pending) Drupal.Ajax.prototype.glyphiconStop(this.element); 6296 }, this); 6297 } 6298 }); 6299 6300})(jQuery, Drupal); 6301; 6302/** 6303 * @file 6304 * Expands the behaviour of the default autocompletion. 6305 */ 6306 6307(function ($, Drupal, drupalSettings) { 6308 6309 'use strict'; 6310 6311 // As a safety precaution, bail if the Drupal Core autocomplete framework is 6312 // not present. 6313 if (!Drupal.autocomplete) { 6314 return; 6315 } 6316 6317 var autocomplete = {}; 6318 6319 /** 6320 * Retrieves the custom settings for an autocomplete-enabled input field. 6321 * 6322 * @param {HTMLElement} input 6323 * The input field. 6324 * @param {object} globalSettings 6325 * The object containing global settings. If none is passed, drupalSettings 6326 * is used instead. 6327 * 6328 * @return {object} 6329 * The effective settings for the given input fields, with defaults set if 6330 * applicable. 6331 */ 6332 autocomplete.getSettings = function (input, globalSettings) { 6333 globalSettings = globalSettings || drupalSettings || {}; 6334 // Set defaults for all known settings. 6335 var settings = { 6336 auto_submit: false, 6337 delay: 0, 6338 min_length: 1, 6339 selector: ':submit', 6340 }; 6341 var search = $(input).data('search-api-autocomplete-search'); 6342 if (search 6343 && globalSettings.search_api_autocomplete 6344 && globalSettings.search_api_autocomplete[search]) { 6345 $.extend(settings, globalSettings.search_api_autocomplete[search]); 6346 } 6347 return settings; 6348 }; 6349 6350 /** 6351 * Attaches our custom autocomplete settings to all affected fields. 6352 * 6353 * @type {Drupal~behavior} 6354 * 6355 * @prop {Drupal~behaviorAttach} attach 6356 * Attaches the autocomplete behaviors. 6357 */ 6358 Drupal.behaviors.searchApiAutocomplete = { 6359 attach: function (context, settings) { 6360 // Find all our fields with autocomplete settings. 6361 $(context) 6362 .find('.ui-autocomplete-input[data-search-api-autocomplete-search]') 6363 .once('search-api-autocomplete') 6364 .each(function () { 6365 var uiAutocomplete = $(this).data('ui-autocomplete'); 6366 if (!uiAutocomplete) { 6367 return; 6368 } 6369 var $element = uiAutocomplete.menu.element; 6370 $element.data('search-api-autocomplete-input-id', this.id); 6371 $element.addClass('search-api-autocomplete-search'); 6372 var elementSettings = autocomplete.getSettings(this, settings); 6373 if (elementSettings['delay']) { 6374 uiAutocomplete.options['delay'] = elementSettings['delay']; 6375 } 6376 if (elementSettings['min_length']) { 6377 uiAutocomplete.options['minLength'] = elementSettings['min_length']; 6378 } 6379 // Override the "select" callback of the jQuery UI autocomplete. 6380 var oldSelect = uiAutocomplete.options.select; 6381 uiAutocomplete.options.select = function (event, ui) { 6382 // If this is a URL suggestion, instead of autocompleting we 6383 // redirect the user to that URL. 6384 if (ui.item.url) { 6385 location.href = ui.item.url; 6386 return false; 6387 } 6388 6389 var ret = oldSelect.apply(this, arguments); 6390 6391 // If auto-submit is enabled, submit the form. 6392 if (elementSettings['auto_submit'] && elementSettings['selector']) { 6393 $(elementSettings['selector'], this.form).trigger('click'); 6394 } 6395 6396 return ret; 6397 }; 6398 }); 6399 } 6400 }; 6401 6402 Drupal.SearchApiAutocomplete = autocomplete; 6403 6404})(jQuery, Drupal, drupalSettings); 6405; 6406Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 6407 6408(function ($) { 6409 Drupal.TBMegaMenu.menuInstance = false; 6410 6411 Drupal.TBMegaMenu.supportedScreens = [768]; 6412 Drupal.TBMegaMenu.menuResponsive = function () { 6413 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 6414 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 6415 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 6416 navCollapse.addClass('collapse'); 6417 if (Drupal.TBMegaMenu.displayedMenuMobile) { 6418 navCollapse.css({height: 'auto', overflow: 'visible'}); 6419 } else { 6420 navCollapse.css({height: 0, overflow: 'hidden'}); 6421 } 6422 } else { 6423 /* If width of window is greater than 980 (supported screen). */ 6424 navCollapse.removeClass('collapse'); 6425 if (navCollapse.height() <= 0) { 6426 navCollapse.css({height: 'auto', overflow: 'visible'}); 6427 } 6428 } 6429 }; 6430 6431 Drupal.behaviors.tbMegaMenuAction = { 6432 attach: function(context) { 6433 $('.tb-megamenu-button').click(function() { 6434 if(parseInt($(this).parent().children('.nav-collapse').height())) { 6435 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 6436 } 6437 else { 6438 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 6439 } 6440 }); 6441 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 6442 if(!isTouch){ 6443 $(document).ready(function($){ 6444 var mm_duration = 0; 6445 $('.tb-megamenu').each (function(){ 6446 if ($(this).data('duration')) { 6447 mm_duration = $(this).data('duration'); 6448 } 6449 }); 6450 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 6451 $('#block-tb-megamenu-main-menu .nav > li, li.mega').hover(function(event) { 6452 var $this = $(this); 6453 if ($this.hasClass ('mega')) { 6454 /* $this.addClass ('animating'); */ 6455 clearTimeout ($this.data('animatingTimeout')); 6456 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 6457 clearTimeout ($this.data('hoverTimeout')); 6458 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 6459 } else { 6460 clearTimeout ($this.data('hoverTimeout')); 6461 $this.data('hoverTimeout', 6462 setTimeout(function(){$this.addClass ('open')}, 100)); 6463 } 6464 }, 6465 function(event) { 6466 var $this = $(this); 6467 if ($this.hasClass ('mega')) { 6468 /* $this.addClass ('animating'); */ 6469 clearTimeout ($this.data('animatingTimeout')); 6470 $this.data('animatingTimeout', 6471 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 6472 clearTimeout ($this.data('hoverTimeout')); 6473 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 6474 } else { 6475 clearTimeout ($this.data('hoverTimeout')); 6476 $this.data('hoverTimeout', 6477 setTimeout(function(){$this.removeClass ('open')}, 100)); 6478 } 6479 }); 6480 $('li.mega-align-justify > a.dropdown-toggle').click(function(e){ 6481 console.log('checl'); 6482 e.preventDefault(); 6483 }); 6484 }); 6485 } 6486 } 6487 } 6488})(jQuery); 6489 6490; 6491/* 6492 * jQuery FlexSlider v2.4.0 6493 * Copyright 2012 WooThemes 6494 * Contributing Author: Tyler Smith 6495 */!function($){$.flexslider=function(e,t){var a=$(e);a.vars=$.extend({},$.flexslider.defaults,t);var n=a.vars.namespace,i=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,s=("ontouchstart"in window||i||window.DocumentTouch&&document instanceof DocumentTouch)&&a.vars.touch,r="click touchend MSPointerUp keyup",o="",l,c="vertical"===a.vars.direction,d=a.vars.reverse,u=a.vars.itemWidth>0,v="fade"===a.vars.animation,p=""!==a.vars.asNavFor,m={},f=!0;$.data(e,"flexslider",a),m={init:function(){a.animating=!1,a.currentSlide=parseInt(a.vars.startAt?a.vars.startAt:0,10),isNaN(a.currentSlide)&&(a.currentSlide=0),a.animatingTo=a.currentSlide,a.atEnd=0===a.currentSlide||a.currentSlide===a.last,a.containerSelector=a.vars.selector.substr(0,a.vars.selector.search(" ")),a.slides=$(a.vars.selector,a),a.container=$(a.containerSelector,a),a.count=a.slides.length,a.syncExists=$(a.vars.sync).length>0,"slide"===a.vars.animation&&(a.vars.animation="swing"),a.prop=c?"top":"marginLeft",a.args={},a.manualPause=!1,a.stopped=!1,a.started=!1,a.startTimeout=null,a.transitions=!a.vars.video&&!v&&a.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t)if(void 0!==e.style[t[n]])return a.pfx=t[n].replace("Perspective","").toLowerCase(),a.prop="-"+a.pfx+"-transform",!0;return!1}(),a.ensureAnimationEnd="",""!==a.vars.controlsContainer&&(a.controlsContainer=$(a.vars.controlsContainer).length>0&&$(a.vars.controlsContainer)),""!==a.vars.manualControls&&(a.manualControls=$(a.vars.manualControls).length>0&&$(a.vars.manualControls)),a.vars.randomize&&(a.slides.sort(function(){return Math.round(Math.random())-.5}),a.container.empty().append(a.slides)),a.doMath(),a.setup("init"),a.vars.c
vendor: 4,153 bytes, line 6495
6495ontrolNav&&m.controlNav.setup(),a.vars.directionNav&&m.directionNav.setup(),a.vars.keyboard&&(1===$(a.containerSelector).length||a.vars.multipleKeyboard)&&$(document).bind("keyup",function(e){var t=e.keyCode;if(!a.animating&&(39===t||37===t)){var n=39===t?a.getTarget("next"):37===t?a.getTarget("prev"):!1;a.flexAnimate(n,a.vars.pauseOnAction)}}),a.vars.mousewheel&&a.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=a.getTarget(0>t?"next":"prev");a.flexAnimate(s,a.vars.pauseOnAction)}),a.vars.pausePlay&&m.pausePlay.setup(),a.vars.slideshow&&a.vars.pauseInvisible&&m.pauseInvisible.init(),a.vars.slideshow&&(a.vars.pauseOnHover&&a.hover(function(){a.manualPlay||a.manualPause||a.pause()},function(){a.manualPause||a.manualPlay||a.stopped||a.play()}),a.vars.pauseInvisible&&m.pauseInvisible.isHidden()||(a.vars.initDelay>0?a.startTimeout=setTimeout(a.play,a.vars.initDelay):a.play())),p&&m.asNav.setup(),s&&a.vars.touch&&m.touch(),(!v||v&&a.vars.smoothHeight)&&$(window).bind("resize orientationchange focus",m.resize),a.find("img").attr("draggable","false"),setTimeout(function(){a.vars.start(a)},200)},asNav:{setup:function(){a.asNav=!0,a.animatingTo=Math.floor(a.currentSlide/a.move),a.currentItem=a.currentSlide,a.slides.removeClass(n+"active-slide").eq(a.currentItem).addClass(n+"active-slide"),i?(e._slider=a,a.slides.each(function(){var e=this;e._gesture=new MSGesture,e._gesture.target=e,e.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),e.addEventListener("MSGestureTap",function(e){e.preventDefault();var t=$(this),n=t.index();$(a.vars.asNavFor).data("flexslider").animating||t.hasClass("active")||(a.direction=a.currentItem<n?"next":"prev",a.flexAnimate(n,a.vars.pauseOnAction,!1,!0,!0))})})):a.slides.on(r,function(e){e.preventDefault();var t=$(this),i=t.index(),s=t.offset().left-$(a).scrollLeft();0>=s&&t.hasClass(n+"active-slide")?a.flexAnimate(a.getTarget("prev"),!0):$(a.vars.asNavFor).data("flexslider").animating||t.hasClass(n+"active-slide")||(a.direction=a.currentItem<i?"next":"prev",a.flexAnimate(i,a.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){a.manualControls?m.controlNav.setupManual():m.controlNav.setupPaging()},setupPaging:function(){var e="thumbnails"===a.vars.controlNav?"control-thumbs":"control-paging",t=1,i,s;if(a.controlNavScaffold=$('<ol class="'+n+"control-nav "+n+e+'"></ol>'),a.pagingCount>1)for(var l=0;l<a.pagingCount;l++){if(s=a.slides.eq(l),i="thumbnails"===a.vars.controlNav?'<img src="'+s.attr("data-thumb")+'"/>':"<a>"+t+"</a>","thumbnails"===a.vars.controlNav&&!0===a.vars.thumbCaptions){var c=s.attr("data-thumbcaption");""!=c&&void 0!=c&&(i+='<span class="'+n+'caption">'+c+"</span>")}a.controlNavScaffold.append("<li>"+i+"</li>"),t++}a.controlsContainer?$(a.controlsContainer).append(a.controlNavScaffold):a.append(a.controlNavScaffold),m.controlNav.set(),m.controlNav.active(),a.controlNavScaffold.delegate("a, img",r,function(e){if(e.preventDefault(),""===o||o===e.type){var t=$(this),i=a.controlNav.index(t);t.hasClass(n+"active")||(a.direction=i>a.currentSlide?"next":"prev",a.flexAnimate(i,a.vars.pauseOnAction))}""===o&&(o=e.type),m.setToClearWatchedEvent()})},setupManual:function(){a.controlNav=a.manualControls,m.controlNav.active(),a.controlNav.bind(r,function(e){if(e.preventDefault(),""===o||o===e.type){var t=$(this),i=a.controlNav.index(t);t.hasClass(n+"active")||(a.direction=i>a.currentSlide?"next":"prev",a.flexAnimate(i,a.vars.pauseOnAction))}""===o&&(o=e.type),m.setToClearWatchedEvent()})},set:function(){var e="thumbnails"===a.vars.controlNav?"img":"a";a.controlNav=$("."+n+"control-nav li "+e,a.controlsContainer?a.controlsContainer:a)},active:function(){a.controlNav.removeClass(n+"active").eq(a.animatingTo).addClass(n+"active")},update:function(e,t){a.pagingCount>1&&"add"===e?a.controlNavScaffold.append($("<li><a>"+a.count+"</a></li>")):1===a.pagingCount?a.controlNavScaffold.find("li").remove():a.controlNav.eq(t).closest("li").remove(),m.controlNav.set(),a.pagingCount>1&&a.pagingCount!==a.controlNav.length?a.update(t,e):m.controlNav.active()}}
6495,directionNav:{setup:function(){var e=$('<ul class="'+n+'direction-nav"><li class="'+n+'nav-prev"><a class="'+n+'prev" href="#">'+a.vars.prevText+'</a></li><li class="'+n+'nav-next"><a class="'+n+'next" href="#">'+a.vars.nextText+"</a></li></ul>");a.controlsContainer?($(a.controlsContainer).append(e),a.directionNav=$("."+n+"direction-nav li a",a.controlsContainer)):(a.append(e),a.directionNav=$("."+n+"direction-nav li a",a)),m.directionNav.update(),a.directionNav.bind(r,function(e){e.preventDefault();var t;(""===o||o===e.type)&&(t=a.getTarget($(this).hasClass(n+"next")?"next":"prev"),a.flexAnimate(t,a.vars.pauseOnAction)),""===o&&(o=e.type),m.setToClearWatchedEvent()})},update:function(){var e=n+"disabled";1===a.pagingCount?a.directionNav.addClass(e).attr("tabindex","-1"):a.vars.animationLoop?a.directionNav.removeClass(e).removeAttr("tabindex"):0===a.animatingTo?a.directionNav.removeClass(e).filter("."+n+"prev").addClass(e).attr("tabindex","-1"):a.animatingTo===a.last?a.directionNav.removeClass(e).filter("."+n+"next").addClass(e).attr("tabindex","-1"):a.directionNav.removeClass(e).removeAttr("tabindex")}}
6495,pausePlay:{setup:function(){var e=$('<div class="'+n+'pauseplay"><a></a></div>');a.controlsContainer?(a.controlsContainer.append(e),a.pausePlay=$("."+n+"pauseplay a",a.controlsContainer)):(a.append(e),a.pausePlay=$("."+n+"pauseplay a",a)),m.pausePlay.update(a.vars.slideshow?n+"pause":n+"play"),a.pausePlay.bind(r,function(e){e.preventDefault(),(""===o||o===e.type)&&($(this).hasClass(n+"pause")?(a.manualPause=!0,a.manualPlay=!1,a.pause()):(a.manualPause=!1,a.manualPlay=!0,a.play())),""===o&&(o=e.type),m.setToClearWatchedEvent()})},update:function(e){"play"===e?a.pausePlay.removeClass(n+"pause").addClass(n+"play").html(a.vars.playText):a.pausePlay.removeClass(n+"play").addClass(n+"pause").html(a.vars.pauseText)}},touch:function(){function t(t){a.animating?t.preventDefault():(window.navigator.msPointerEnabled||1===t.touches.length)&&(a.pause(),g=c?a.h:a.w,S=Number(new Date),x=t.touches[0].pageX,b=t.touches[0].pageY,f=u&&d&&a.animatingTo===a.last?0:u&&d?a.limit-(a.itemW+a.vars.itemMargin)*a.move*a.animatingTo:u&&a.currentSlide===a.last?a.limit:u?(a.itemW+a.vars.itemMargin)*a.move*a.currentSlide:d?(a.last-a.currentSlide+a.cloneOffset)*g:(a.currentSlide+a.cloneOffset)*g,p=c?b:x,m=c?x:b,e.addEventListener("touchmove",n,!1),e.addEventListener("touchend",s,!1))}function n(e){x=e.touches[0].pageX,b=e.touches[0].pageY,h=c?p-b:p-x,y=c?Math.abs(h)<Math.abs(x-m):Math.abs(h)<Math.abs(b-m);var t=500;(!y||Number(new Date)-S>t)&&(e.preventDefault(),!v&&a.transitions&&(a.vars.animationLoop||(h/=0===a.currentSlide&&0>h||a.currentSlide===a.last&&h>0?Math.abs(h)/g+2:1),a.setProps(f+h,"setTouch")))}function s(t){if(e.removeEventListener("touchmove",n,!1),a.animatingTo===a.currentSlide&&!y&&null!==h){var i=d?-h:h,r=a.getTarget(i>0?"next":"prev");a.canAdvance(r)&&(Number(new Date)-S<550&&Math.abs(i)>50||Math.abs(i)>g/2)?a.flexAnimate(r,a.vars.pauseOnAction):v||a.flexAnimate(a.currentSlide,a.vars.pauseOnAction,!0)}e.removeEventListener("touchend",s,!1),p=null,m=null,h=null,f=null}function r(t){t.stopPropagation(),a.animating?t.preventDefault():(a.pause(),e._gesture.addPointer(t.pointerId),w=0,g=c?a.h:a.w,S=Number(new Date),f=u&&d&&a.animatingTo===a.last?0:u&&d?a.limit-(a.itemW+a.vars.itemMargin)*a.move*a.animatingTo:u&&a.currentSlide===a.last?a.limit:u?(a.itemW+a.vars.itemMargin)*a.move*a.currentSlide:d?(a.last-a.currentSlide+a.cloneOffset)*g:(a.currentSlide+a.cloneOffset)*g)}function o(t){t.stopPropagation();var a=t.target._slider;if(a){var n=-t.translationX,i=-t.translationY;return w+=c?i:n,h=w,y=c?Math.abs(w)<Math.abs(-n):Math.abs(w)<Math.abs(-i),t.detail===t.MSGESTURE_FLAG_INERTIA?void setImmediate(function(){e._gesture.stop()}):void((!y||Number(new Date)-S>500)&&(t.preventDefault(),!v&&a.transitions&&(a.vars.animationLoop||(h=w/(0===a.currentSlide&&0>w||a.currentSlide===a.last&&w>0?Math.abs(w)/g+2:1)),a.setProps(f+h,"setTouch"))))}}function l(e){e.stopPropagation();var t=e.target._slider;if(t){if(t.animatingTo===t.currentSlide&&!y&&null!==h){var a=d?-h:h,n=t.getTarget(a>0?"next":"prev");t.canAdvance(n)&&(Number(new Date)-S<550&&Math.abs(a)>50||Math.abs(a)>g/2)?t.flexAnimate(n,t.vars.pauseOnAction):v||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}p=null,m=null,h=null,f=null,w=0}}var p,m,f,g,h,S,y=!1,x=0,b=0,w=0;i?(e.style.msTouchAction="none",e._gesture=new MSGesture,e._gesture.target=e,e.addEventListener("MSPointerDown",r,!1),e._slider=a,e.addEventListener("MSGestureChange",o,!1),e.addEventListener("MSGestureEnd",l,!1)):e.addEventListener("touchstart",t,!1)},resize:function(){!a.animating&&a.is(":visible")&&(u||a.doMath(),v?m.smoothHeight():u?(a.slides.width(a.computedW),a.update(a.pagingCount),a.setProps()):c?(a.viewport.height(a.h),a.setProps(a.h,"setTotal")):(a.vars.smoothHeight&&m.smoothHeight(),a.newSlides.width(a.computedW),a.setProps(a.computedW,"setTotal")))},smoothHeight:function(e){if(!c||v){var t=v?a:a.viewport;e?t.animate({height:a.slides.eq(a.animatingTo).height()},e):t.height(a.slides.eq(a.animatingTo).height())}},sync:function(e){var t=$(a.vars.sync).data("flexslider"),n=a.animatingTo;switch(e){case"animate":t.flexAnimate(n,a.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=$
vendor: 12,425 bytes, lines 6495-6570
6495(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=m.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){m.pauseInvisible.isHidden()?a.startTimeout?clearTimeout(a.startTimeout):a.pause():a.started?a.play():a.vars.initDelay>0?setTimeout(a.play,a.vars.initDelay):a.play()})}},isHidden:function(){var e=m.pauseInvisible.getHiddenProp();return e?document[e]:!1},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}},setToClearWatchedEvent:function(){clearTimeout(l),l=setTimeout(function(){o=""},3e3)}},a.flexAnimate=function(e,t,i,r,o){if(a.vars.animationLoop||e===a.currentSlide||(a.direction=e>a.currentSlide?"next":"prev"),p&&1===a.pagingCount&&(a.direction=a.currentItem<e?"next":"prev"),!a.animating&&(a.canAdvance(e,o)||i)&&a.is(":visible")){if(p&&r){var l=$(a.vars.asNavFor).data("flexslider");if(a.atEnd=0===e||e===a.count-1,l.flexAnimate(e,!0,!1,!0,o),a.direction=a.currentItem<e?"next":"prev",l.direction=a.direction,Math.ceil((e+1)/a.visible)-1===a.currentSlide||0===e)return a.currentItem=e,a.slides.removeClass(n+"active-slide").eq(e).addClass(n+"active-slide"),!1;a.currentItem=e,a.slides.removeClass(n+"active-slide").eq(e).addClass(n+"active-slide"),e=Math.floor(e/a.visible)}if(a.animating=!0,a.animatingTo=e,t&&a.pause(),a.vars.before(a),a.syncExists&&!o&&m.sync("animate"),a.vars.controlNav&&m.controlNav.active(),u||a.slides.removeClass(n+"active-slide").eq(e).addClass(n+"active-slide"),a.atEnd=0===e||e===a.last,a.vars.directionNav&&m.directionNav.update(),e===a.last&&(a.vars.end(a),a.vars.animationLoop||a.pause()),v)s?(a.slides.eq(a.currentSlide).css({opacity:0,zIndex:1}),a.slides.eq(e).css({opacity:1,zIndex:2}),a.wrapup(f)):(a.slides.eq(a.currentSlide).css({zIndex:1}).animate({opacity:0},a.vars.animationSpeed,a.vars.easing),a.slides.eq(e).css({zIndex:2}).animate({opacity:1},a.vars.animationSpeed,a.vars.easing,a.wrapup));else{var f=c?a.slides.filter(":first").height():a.computedW,g,h,S;u?(g=a.vars.itemMargin,S=(a.itemW+g)*a.move*a.animatingTo,h=S>a.limit&&1!==a.visible?a.limit:S):h=0===a.currentSlide&&e===a.count-1&&a.vars.animationLoop&&"next"!==a.direction?d?(a.count+a.cloneOffset)*f:0:a.currentSlide===a.last&&0===e&&a.vars.animationLoop&&"prev"!==a.direction?d?0:(a.count+1)*f:d?(a.count-1-e+a.cloneOffset)*f:(e+a.cloneOffset)*f,a.setProps(h,"",a.vars.animationSpeed),a.transitions?(a.vars.animationLoop&&a.atEnd||(a.animating=!1,a.currentSlide=a.animatingTo),a.container.unbind("webkitTransitionEnd transitionend"),a.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(a.ensureAnimationEnd),a.wrapup(f)}),clearTimeout(a.ensureAnimationEnd),a.ensureAnimationEnd=setTimeout(function(){a.wrapup(f)},a.vars.animationSpeed+100)):a.container.animate(a.args,a.vars.animationSpeed,a.vars.easing,function(){a.wrapup(f)})}a.vars.smoothHeight&&m.smoothHeight(a.vars.animationSpeed)}},a.wrapup=function(e){v||u||(0===a.currentSlide&&a.animatingTo===a.last&&a.vars.animationLoop?a.setProps(e,"jumpEnd"):a.currentSlide===a.last&&0===a.animatingTo&&a.vars.animationLoop&&a.setProps(e,"jumpStart")),a.animating=!1,a.currentSlide=a.animatingTo,a.vars.after(a)},a.animateSlides=function(){!a.animating&&f&&a.flexAnimate(a.getTarget("next"))},a.pause=function(){clearInterval(a.animatedSlides),a.animatedSlides=null,a.playing=!1,a.vars.pausePlay&&m.pausePlay.update("play"),a.syncExists&&m.sync("pause")},a.play=function(){a.playing&&clearInterval(a.animatedSlides),a.animatedSlides=a.animatedSlides||setInterval(a.animateSlides,a.vars.slideshowSpeed),a.started=a.playing=!0,a.vars.pausePlay&&m.pausePlay.update("pause"),a.syncExists&&m.sync("play")},a.stop=function(){a.pause(),a.stopped=!0},a.canAdvance=function(e,t){var n=p?a.pagingCount-1:a.last;return t?!0:p&&a.currentItem===a.count-1&&0===e&&"prev"===a.direction?!0:p&&0===a.currentItem&&e===a.pagingCount-1&&"next"!==a.direction?!1:e!==a.currentSlide||p?a.vars.animationLoop?!0:a.atEnd&&0===a.currentSlide&&e===n&&"next"!==a.direction?!1:a.atEnd&&a.currentSlide===n&&0===e&&"next"===a.direction?!1:!0:!1},a.getTarget=function(e){return a.direction=e,"next"===e?a.currentSlide===a.last?0:a.currentSlide+1:0===a.currentSlide?a.last:a.currentSlide-1},a.setProps=function(e,t,n){var i=function(){var n=e?e:(a.itemW+a.vars.itemMargin)*a.move*a.animatingTo,i=function(){if(u)return"setTouch"===t?e:d&&a.animatingTo===a.last?0:d?a.limit-(a.itemW+a.vars.itemMargin)*a.move*a.animatingTo:a.animatingTo===a.last?a.limit:n;switch(t){case"setTotal":return d?(a.count-1-a.currentSlide+a.cloneOffset)*e:(a.currentSlide+a.cloneOffset)*e;case"setTouch":return d?e:e;case"jumpEnd":return d?e:a.count*e;case"jumpStart":return d?a.count*e:e;default:return e}}();return-1*i+"px"}();a.transitions&&(i=c?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",n=void 0!==n?n/1e3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",n),a.container.css("transition-duration",n)),a.args[a.prop]=i,(a.transitions||void 0===n)&&a.container.css(a.args),a.container.css("transform",i)},a.setup=function(e){if(v)a.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===e&&(s?a.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+a.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(a.currentSlide).css({opacity:1,zIndex:2}):0==a.vars.fadeFirstSlide?a.slides.css({opacity:0,display:"block",zIndex:1}).eq(a.currentSlide).css({zIndex:2}).css({opacity:1}):a.slides.css({opacity:0,display:"block",zIndex:1}).eq(a.currentSlide).css({zIndex:2}).animate({opacity:1},a.vars.animationSpeed,a.vars.easing)),a.vars.smoothHeight&&m.smoothHeight();else{var t,i;"init"===e&&(a.viewport=$('<div class="'+n+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(a).append(a.container),a.cloneCount=0,a.cloneOffset=0,d&&(i=$.makeArray(a.slides).reverse(),a.slides=$(i),a.container.empty().append(a.slides))),a.vars.animationLoop&&!u&&(a.cloneCount=2,a.cloneOffset=1,"init"!==e&&a.container.find(".clone").remove(),a.container.append(m.uniqueID(a.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(m.uniqueID(a.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),a.newSlides=$(a.vars.selector,a),t=d?a.count-1-a.currentSlide+a.cloneOffset:a.currentSlide+a.cloneOffset,c&&!u?(a.container.height(200*(a.count+a.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){a.newSlides.css({display:"block"}),a.doMath(),a.viewport.height(a.h),a.setProps(t*a.h,"init")},"init"===e?100:0)):(a.container.width(200*(a.count+a.cloneCount)+"%"),a.setProps(t*a.computedW,"init"),setTimeout(function(){a.doMath(),a.newSlides.css({width:a.computedW,"float":"left",display:"block"}),a.vars.smoothHeight&&m.smoothHeight()},"init"===e?100:0))}u||a.slides.removeClass(n+"active-slide").eq(a.currentSlide).addClass(n+"active-slide"),a.vars.init(a)},a.doMath=function(){var e=a.slides.first(),t=a.vars.itemMargin,n=a.vars.minItems,i=a.vars.maxItems;a.w=void 0===a.viewport?a.width():a.viewport.width(),a.h=e.height(),a.boxPadding=e.outerWidth()-e.width(),u?(a.itemT=a.vars.itemWidth+t,a.minW=n?n*a.itemT:a.w,a.maxW=i?i*a.itemT-t:a.w,a.itemW=a.minW>a.w?(a.w-t*(n-1))/n:a.maxW<a.w?(a.w-t*(i-1))/i:a.vars.itemWidth>a.w?a.w:a.vars.itemWidth,a.visible=Math.floor(a.w/a.itemW),a.move=a.vars.move>0&&a.vars.move<a.visible?a.vars.move:a.visible,a.pagingCount=Math.ceil((a.count-a.visible)/a.move+1),a.last=a.pagingCount-1,a.limit=1===a.pagingCount?0:a.vars.itemWidth>a.w?a.itemW*(a.count-1)+t*(a.count-1):(a.itemW+t)*a.count-a.w-t):(a.itemW=a.w,a.pagingCount=a.count,a.last=a.count-1),a.computedW=a.itemW-a.boxPadding},a.update=function(e,t){a.doMath(),u||(e<a.currentSlide?a.currentSlide+=1:e<=a.currentSlide&&0!==e&&(a.currentSlide-=1),a.animatingTo=a.currentSlide),a.vars.controlNav&&!a.manualControls&&("add"===t&&!u||a.pagingCount>a.controlNav.length?m.controlNav.update("add"):("remove"===t&&!u||a.pagingCount<a.controlNav.length)&&(u&&a.currentSlide>a.last&&(a.currentSlide-=1,a.animatingTo-=1),m.controlNav.update("remove",a.last))),a.vars.directionNav&&m.directionNav.update()},a.addSlide=function(e,t){var n=$(e);a.count+=1,a.last=a.count-1,c&&d?void 0!==t?a.slides.eq(a.count-t).after(n):a.container.prepend(n):void 0!==t?a.slides.eq(t).before(n):a.container.append(n),a.update(t,"add"),a.slides=$(a.vars.selector+":not(.clone)",a),a.setup(),a.vars.added(a)},a.removeSlide=function(e){var t=isNaN(e)?a.slides.index($(e)):e;a.count-=1,a.last=a.count-1,isNaN(e)?$(e,a.slides).remove():c&&d?a.slides.eq(a.last).remove():a.slides.eq(e).remove(),a.doMath(),a.update(t,"remove"),a.slides=$(a.vars.selector+":not(.clone)",a),a.setup(),a.vars.removed(a)},m.init()},$(window).blur(function(e){focused=!1}).focus(function(e){focused=!0}),$.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},$.fn.flexslider=function(e){if(void 0===e&&(e={}),"object"==typeof e)return this.each(function(){var t=$(this),a=e.selector?e.selector:".slides > li",n=t.find(a);1===n.length&&e.allowOneSlide===!0||0===n.length?(n.fadeIn(400),e.start&&e.start(t)):void 0===t.data("flexslider")&&new $.flexslider(this,e)});var t=$(this).data("flexslider");switch(e){case"play":t.play();break;case"pause":t.pause();break;case"stop":t.stop();break;case"next":t.flexAnimate(t.getTarget("next"),!0);break;case"prev":case"previous":t.flexAnimate(t.getTarget("prev"),!0);break;default:"number"==typeof e&&t.flexAnimate(e,!0)}}}(jQuery);; 6496/* 6497 6498Uniform v2.1.0 6499Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC 6500http://pixelmatrixdesign.com 6501 6502Requires jQuery 1.3 or newer 6503 6504Much thanks to Thomas Reynolds and Buck Wilson for their help and advice on 6505this. 6506 6507Disabling text selection is made possible by Mathias Bynens 6508<http://mathiasbynens.be/> and his noSelect plugin. 6509<https://github.com/mathiasbynens/jquery-noselect>, which is embedded. 6510 6511Also, thanks to David Kaneda and Eugene Bond for their contributions to the 6512plugin. 6513 6514Tyler Akins has also rewritten chunks of the plugin, helped close many issues, 6515and ensured version 2 got out the door. 6516 6517License: 6518MIT License - http://www.opensource.org/licenses/mit-license.php 6519 6520Enjoy! 6521 6522*/ 6523/*global jQuery, window, document, navigator*/ 6524 6525(function ($, undef) { 6526 "use strict"; 6527 6528 /** 6529 * Use .prop() if jQuery supports it, otherwise fall back to .attr() 6530 * 6531 * @param jQuery $el jQuery'd element on which we're calling attr/prop 6532 * @param ... All other parameters are passed to jQuery's function 6533 * @return The result from jQuery 6534 */ 6535 function attrOrProp($el) { 6536 var args = Array.prototype.slice.call(arguments, 1); 6537 6538 if ($el.prop) { 6539 /* jQuery 1.6+ */ 6540 return $el.prop.apply($el, args); 6541 } 6542 6543 /* jQuery 1.5 and below */ 6544 return $el.attr.apply($el, args); 6545 } 6546 6547 /** 6548 * For backwards compatibility with older jQuery libraries, only bind 6549 * one thing at a time. Also, this function adds our namespace to 6550 * events in one consistent location, shrinking the minified code. 6551 * 6552 * The properties on the events object are the names of the events 6553 * that we are supposed to add to. It can be a space separated list. 6554 * The namespace will be added automatically. 6555 * 6556 * @param jQuery $el 6557 * @param Object options Uniform options for this element 6558 * @param Object events Events to bind, properties are event names 6559 */ 6560 function bindMany($el, options, events) { 6561 var name, namespaced; 6562 6563 for (name in events) { 6564 if (events.hasOwnProperty(name)) { 6565 namespaced = name.replace(/ |$/g, options.eventNamespace); 6566 $el.bind(namespaced, events[name]); 6567 } 6568 } 6569 } 6570
6571 /** 6572 * Bind the hover, active, focus, and blur UI updates 6573 * 6574 * @param jQuery $el Original element 6575 * @param jQuery $target Target for the events (our div/span) 6576 * @param Object options Uniform options for the element $target 6577 */ 6578 function bindUi($el, $target, options) { 6579 bindMany($el, options, { 6580 focus: function () { 6581 $target.addClass(options.focusClass); 6582 }, 6583 blur: function () { 6584 $target.removeClass(options.focusClass); 6585 $target.removeClass(options.activeClass); 6586 }, 6587 mouseenter: function () { 6588 $target.addClass(options.hoverClass); 6589 }, 6590 mouseleave: function () { 6591 $target.removeClass(options.hoverClass); 6592 $target.removeClass(options.activeClass); 6593 }, 6594 "mousedown touchbegin": function () { 6595 if (!$el.is(":disabled")) { 6596 $target.addClass(options.activeClass); 6597 } 6598 }, 6599 "mouseup touchend": function () { 6600 $target.removeClass(options.activeClass); 6601 } 6602 }); 6603 } 6604 6605 /** 6606 * Remove the hover, focus, active classes. 6607 * 6608 * @param jQuery $el Element with classes 6609 * @param Object options Uniform options for the element 6610 */ 6611 function classClearStandard($el, options) { 6612 $el.removeClass(options.hoverClass + " " + options.focusClass + " " + options.activeClass); 6613 } 6614 6615 /** 6616 * Add or remove a class, depending on if it's "enabled" 6617 * 6618 * @param jQuery $el Element that has the class added/removed 6619 * @param String className Class or classes to add/remove 6620 * @param Boolean enabled True to add the class, false to remove 6621 */ 6622 function classUpdate($el, className, enabled) { 6623 if (enabled) { 6624 $el.addClass(className); 6625 } else { 6626 $el.removeClass(className); 6627 } 6628 } 6629 6630 /** 6631 * Updating the "checked" property can be a little tricky. This 6632 * changed in jQuery 1.6 and now we can pass booleans to .prop(). 6633 * Prior to that, one either adds an attribute ("checked=checked") or 6634 * removes the attribute. 6635 * 6636 * @param jQuery $tag Our Uniform span/div 6637 * @param jQuery $el Original form element 6638 * @param Object options Uniform options for this element 6639 */ 6640 function classUpdateChecked($tag, $el, options) { 6641 var c = "checked", 6642 isChecked = $el.is(":" + c); 6643 6644 if ($el.prop) { 6645 /* jQuery 1.6+ */ 6646 $el.prop(c, isChecked); 6647 } else { 6648 /* jQuery 1.5 and below */ 6649 if (isChecked) { 6650 $el.attr(c, c); 6651 } else { 6652 $el.removeAttr(c); 6653 } 6654 } 6655 6656 classUpdate($tag, options.checkedClass, isChecked); 6657 } 6658 6659 /** 6660 * Set or remove the "disabled" class for disabled elements, based on 6661 * if the 6662 * 6663 * @param jQuery $tag Our Uniform span/div 6664 * @param jQuery $el Original form element 6665 * @param Object options Uniform options for this element 6666 */ 6667 function classUpdateDisabled($tag, $el, options) { 6668 classUpdate($tag, options.disabledClass, $el.is(":disabled")); 6669 } 6670 6671 /** 6672 * Wrap an element inside of a container or put the container next 6673 * to the element. See the code for examples of the different methods. 6674 * 6675 * Returns the container that was added to the HTML. 6676 * 6677 * @param jQuery $el Element to wrap 6678 * @param jQuery $container Add this new container around/near $el 6679 * @param String method One of "after", "before" or "wrap" 6680 * @return $container after it has been cloned for adding to $el 6681 */ 6682 function divSpanWrap($el, $container, method) { 6683 switch (method) { 6684 case "after": 6685 /* Result: <element /> <container /> */ 6686 $el.after($container); 6687 return $el.next(); 6688 case "before": 6689 /* Result: <container /> <element /> */ 6690 $el.before($container); 6691 return $el.prev(); 6692 case "wrap": 6693 /* Result: <container> <element /> </container> */ 6694 $el.wrap($container); 6695 return $el.parent(); 6696 } 6697 6698 return null; 6699 } 6700 6701 6702 /** 6703 * Create a div/span combo for uniforming an element 6704 * 6705 * @param jQuery $el Element to wrap 6706 * @param Object options Options for the element, set by the user 6707 * @param Object divSpanConfig Options for how we wrap the div/span 6708 * @return Object Contains the div and span as properties 6709 */ 6710 function divSpan($el, options, divSpanConfig) { 6711 var $div, $span, id; 6712 6713 if (!divSpanConfig) { 6714 divSpanConfig = {}; 6715 } 6716 6717 divSpanConfig = $.extend({ 6718 bind: {}, 6719 divClass: null, 6720 divWrap: "wrap", 6721 spanClass: null, 6722 spanHtml: null, 6723 spanWrap: "wrap" 6724 }, divSpanConfig); 6725
6726 $div = $('<div />'); 6727 $span = $('<span />'); 6728 6729 /* Automatically hide this div/span if the element is hidden. */ 6730 /* Do not hide if the element is hidden because a parent is hidden. */ 6731 if (options.autoHide && $el.is(':hidden') && $el.css('display') === 'none') { 6732 $div.hide(); 6733 } 6734 6735 if (divSpanConfig.divClass) { 6736 $div.addClass(divSpanConfig.divClass); 6737 } 6738 6739 if (options.wrapperClass) { 6740 $div.addClass(options.wrapperClass); 6741 } 6742 6743 if (divSpanConfig.spanClass) { 6744 $span.addClass(divSpanConfig.spanClass); 6745 } 6746 6747 id = attrOrProp($el, 'id'); 6748 6749 if (options.useID && id) { 6750 attrOrProp($div, 'id', options.idPrefix + '-' + id); 6751 } 6752 6753 if (divSpanConfig.spanHtml) { 6754 $span.html(divSpanConfig.spanHtml); 6755 } 6756 6757 $div = divSpanWrap($el, $div, divSpanConfig.divWrap); 6758 $span = divSpanWrap($el, $span, divSpanConfig.spanWrap); 6759 classUpdateDisabled($div, $el, options); 6760 return { 6761 div: $div, 6762 span: $span 6763 }; 6764 } 6765 6766 6767 /** 6768 * Wrap an element with a span to apply a global wrapper class 6769 * 6770 * @param jQuery $el Element to wrap 6771 * @param object options 6772 * @return jQuery Wrapper element 6773 */ 6774 function wrapWithWrapperClass($el, options) { 6775 var $span; 6776 6777 if (!options.wrapperClass) { 6778 return null; 6779 } 6780 6781 $span = $('<span />').addClass(options.wrapperClass); 6782 $span = divSpanWrap($el, $span, "wrap"); 6783 return $span; 6784 } 6785 6786 6787 /** 6788 * Test if high contrast mode is enabled. 6789 * 6790 * In high contrast mode, background images can not be set and 6791 * they are always returned as 'none'. 6792 * 6793 * @return boolean True if in high contrast mode 6794 */ 6795 function highContrast() { 6796 var c, $div, el, rgb; 6797 6798 /* High contrast mode deals with white and black */ 6799 rgb = 'rgb(120,2,153)'; 6800 $div = $('<div style="width:0;height:0;color:' + rgb + '">'); 6801 $('body').append($div); 6802 el = $div.get(0); 6803 6804 /* $div.css() will get the style definition, not 6805 the actually displaying style */ 6806 if (window.getComputedStyle) { 6807 c = window.getComputedStyle(el, '').color; 6808 } else { 6809 c = (el.currentStyle || el.style || {}).color; 6810 } 6811 6812 $div.remove(); 6813 return c.replace(/ /g, '') !== rgb; 6814 } 6815 6816 6817 /** 6818 * Change text into safe HTML 6819 * 6820 * @param String text 6821 * @return String HTML version 6822 */ 6823 function htmlify(text) { 6824 if (!text) { 6825 return ""; 6826 } 6827 6828 return $('<span />').text(text).html(); 6829 } 6830 6831 /** 6832 * If not MSIE, return false. 6833 * If it is, return the version number. 6834 * 6835 * @return false|number 6836 */ 6837 function isMsie() { 6838 return navigator.cpuClass && !navigator.product; 6839 } 6840 6841 /** 6842 * Return true if this version of IE allows styling 6843 * 6844 * @return boolean 6845 */ 6846 function isMsieSevenOrNewer() { 6847 if (typeof window.XMLHttpRequest !== 'undefined') { 6848 return true; 6849 } 6850 6851 return false; 6852 } 6853 6854 /** 6855 * Test if the element is a multiselect 6856 * 6857 * @param jQuery $el Element 6858 * @return boolean true/false 6859 */ 6860 function isMultiselect($el) { 6861 var elSize; 6862 6863 if ($el[0].multiple) { 6864 return true; 6865 } 6866 6867 elSize = attrOrProp($el, "size"); 6868 6869 if (!elSize || elSize <= 1) { 6870 return false; 6871 } 6872 6873 return true; 6874 } 6875 6876 /** 6877 * Meaningless utility function. Used mostly for improving minification. 6878 * 6879 * @return false 6880 */ 6881 function returnFalse() { 6882 return false; 6883 } 6884 6885 /** 6886 * noSelect plugin, very slightly modified 6887 * http://mths.be/noselect v1.0.3 6888 * 6889 * @param jQuery $elem Element that we don't want to select 6890 * @param Object options Uniform options for the element 6891 */ 6892 function noSelect($elem, options) { 6893 var none = 'none'; 6894 bindMany($elem, options, { 6895 'selectstart dragstart mousedown': returnFalse 6896 }); 6897 6898 $elem.css({ 6899 MozUserSelect: none, 6900 msUserSelect: none, 6901 webkitUserSelect: none, 6902 userSelect: none 6903 }); 6904 } 6905 6906 /** 6907 * Updates the filename tag based on the value of the real input 6908 * element. 6909 * 6910 * @param jQuery $el Actual form element 6911 * @param jQuery $filenameTag Span/div to update 6912 * @param Object options Uniform options for this element 6913 */ 6914 function setFilename($el, $filenameTag, options) { 6915 var filename = $el.val(); 6916 6917 if (filename === "") { 6918 filename = options.fileDefaultHtml; 6919 } else { 6920 filename = filename.split(/[\/\\]+/); 6921 filename = filename[(filename.length - 1)]; 6922 } 6923 6924 $filenameTag.text(filename); 6925 } 6926 6927 6928 /** 6929 * Function from jQuery to swap some CSS values, run a callback, 6930 * then restore the CSS. Modified to pass JSLint and handle undefined 6931 * values with 'use strict'. 6932 * 6933 * @param jQuery $el Element 6934 * @param object newCss CSS values to swap out 6935 * @param Function callback Function to run 6936 */ 6937 function swap($elements, newCss, callback) { 6938 var restore, item; 6939 6940 restore = []; 6941 6942 $elements.each(function () { 6943 var name; 6944 6945 for (name in newCss) { 6946 if (Object.prototype.hasOwnProperty.call(newCss, name)) { 6947 restore.push({ 6948 el: this, 6949 name: name, 6950 old: this.style[name] 6951 }); 6952 6953 this.style[name] = newCss[name]; 6954 } 6955 } 6956 }); 6957 6958 callback(); 6959 6960 while (restore.length) { 6961 item = restore.pop(); 6962 item.el.style[item.name] = item.old; 6963 } 6964 } 6965 6966 6967 /** 6968 * The browser doesn't provide sizes of elements that are not visible. 6969 * This will clone an element and add it to the DOM for calculations. 6970 * 6971 * @param jQuery $el 6972 * @param String method 6973 */ 6974 function sizingInvisible($el, callback) { 6975 var targets; 6976 6977 /* We wish to target ourselves and any parents as long as 6978 they are not visible */ 6979 targets = $el.parents(); 6980 targets.push($el[0]); 6981 targets = targets.not(':visible'); 6982 swap(targets, { 6983 visibility: "hidden", 6984 display: "block", 6985 position: "absolute" 6986 }, callback); 6987 } 6988 6989 6990 /** 6991 * Standard way to unwrap the div/span combination from an element 6992 * 6993 * @param jQuery $el Element that we wish to preserve 6994 * @param Object options Uniform options for the element 6995 * @return Function This generated function will perform the given work 6996 */ 6997 function unwrapUnwrapUnbindFunction($el, options) { 6998 return function () { 6999 $el.unwrap().unwrap().unbind(options.eventNamespace); 7000 }; 7001 } 7002 7003 var allowStyling = true, /* False if IE6 or other unsupported browsers */ 7004 highContrastTest = false, /* Was the high contrast test ran? */ 7005 uniformHandlers = [ /* Objects that take care of "unification" */ 7006 { 7007 /* Buttons */ 7008 match: function ($el) { 7009 return $el.is("a, button, :submit, :reset, input[type='button']"); 7010 }, 7011 apply: function ($el, options) { 7012 var $div, defaultSpanHtml, ds, getHtml, doingClickEvent; 7013 defaultSpanHtml = options.submitDefaultHtml; 7014
7015 if ($el.is(":reset")) { 7016 defaultSpanHtml = options.resetDefaultHtml; 7017 } 7018 7019 if ($el.is("a, button")) { 7020 /* Use the HTML inside the tag */ 7021 getHtml = function () { 7022 return $el.html() || defaultSpanHtml; 7023 }; 7024 } else { 7025 /* Use the value property of the element */ 7026 getHtml = function () { 7027 return htmlify(attrOrProp($el, "value")) || defaultSpanHtml; 7028 }; 7029 } 7030 7031 ds = divSpan($el, options, { 7032 divClass: options.buttonClass, 7033 spanHtml: getHtml(), 7034 }); 7035 $div = ds.div; 7036 bindUi($el, $div, options); 7037 doingClickEvent = false; 7038 bindMany($div, options, { 7039 "click touchend": function () { 7040 var ev, res, target, href; 7041 7042 if (doingClickEvent) { 7043 return; 7044 } 7045 7046 if ($el.is(':disabled')) { 7047 return; 7048 } 7049 7050 doingClickEvent = true; 7051 7052 if ($el[0].dispatchEvent) { 7053 ev = document.createEvent("MouseEvents"); 7054 ev.initEvent("click", true, true); 7055 res = $el[0].dispatchEvent(ev); 7056 7057 if ($el.is('a') && res) { 7058 target = attrOrProp($el, 'target'); 7059 href = attrOrProp($el, 'href'); 7060 7061 if (!target || target === '_self') { 7062 document.location.href = href; 7063 } else { 7064 window.open(href, target); 7065 } 7066 } 7067 } else { 7068 $el.click(); 7069 } 7070 7071 doingClickEvent = false; 7072 } 7073 }); 7074 noSelect($div, options); 7075 return { 7076 remove: function () { 7077 /* Move $el out */ 7078 $div.after($el); 7079 7080 /* Remove div and span */ 7081 $div.remove(); 7082 7083 /* Unbind events */ 7084 $el.unbind(options.eventNamespace); 7085 return $el; 7086 }, 7087 update: function () { 7088 classClearStandard($div, options); 7089 classUpdateDisabled($div, $el, options); 7090 $el.detach(); 7091 ds.span.html(getHtml()).append($el); 7092 } 7093 }; 7094 } 7095 }, 7096 { 7097 /* Checkboxes */ 7098 match: function ($el) { 7099 return $el.is(":checkbox"); 7100 }, 7101 apply: function ($el, options) { 7102 var ds, $div, $span; 7103 ds = divSpan($el, options, { 7104 divClass: options.checkboxClass 7105 }); 7106 $div = ds.div; 7107 $span = ds.span; 7108 7109 /* Add focus classes, toggling, active, etc. */ 7110 bindUi($el, $div, options); 7111 bindMany($el, options, { 7112 "click touchend": function () { 7113 classUpdateChecked($span, $el, options); 7114 } 7115 }); 7116 classUpdateChecked($span, $el, options); 7117 return { 7118 remove: unwrapUnwrapUnbindFunction($el, options), 7119 update: function () { 7120 classClearStandard($div, options); 7121 $span.removeClass(options.checkedClass); 7122 classUpdateChecked($span, $el, options); 7123 classUpdateDisabled($div, $el, options); 7124 } 7125 }; 7126 } 7127 }, 7128 { 7129 /* File selection / uploads */ 7130 match: function ($el) { 7131 return $el.is(":file"); 7132 }, 7133 apply: function ($el, options) { 7134 var ds, $div, $filename, $button; 7135 7136 /* The "span" is the button */ 7137 ds = divSpan($el, options, { 7138 divClass: options.fileClass, 7139 spanClass: options.fileButtonClass, 7140 spanHtml: options.fileButtonHtml, 7141 spanWrap: "before" 7142 }); 7143 $div = ds.div; 7144 $button = ds.span; 7145 $filename = $("<span />").html(options.fileDefaultHtml); 7146 $filename.addClass(options.filenameClass); 7147 $filename = divSpanWrap($el, $filename, "before"); 7148 7149 /* Set the size */ 7150 if (!attrOrProp($el, "size")) { 7151 attrOrProp($el, "size", $div.width() / 10); 7152 } 7153 7154 /* Actions */ 7155 function filenameUpdate() { 7156 setFilename($el, $filename, options); 7157 } 7158 7159 bindUi($el, $div, options); 7160 7161 /* Account for input saved across refreshes */ 7162 filenameUpdate(); 7163 7164 /* IE7 doesn't fire onChange until blur or second fire. */ 7165 if (isMsie()) { 7166 /* IE considers browser chrome blocking I/O, so it 7167 suspends tiemouts until after the file has 7168 been selected. */ 7169 bindMany($el, options, { 7170 click: function () { 7171 $el.trigger("change"); 7172 setTimeout(filenameUpdate, 0); 7173 } 7174 }); 7175 } else { 7176 /* All other browsers behave properly */ 7177 bindMany($el, options, { 7178 change: filenameUpdate 7179 }); 7180 } 7181 7182 noSelect($filename, options); 7183 noSelect($button, options); 7184 return { 7185 remove: function () { 7186 /* Remove filename and button */ 7187 $filename.remove(); 7188 $button.remove(); 7189 7190 /* Unwrap parent div, remove events */ 7191 return $el.unwrap().unbind(options.eventNamespace); 7192 }, 7193 update: function () { 7194 classClearStandard($div, options); 7195 setFilename($el, $filename, options); 7196 classUpdateDisabled($div, $el, options); 7197 } 7198 }; 7199 } 7200 }, 7201 { 7202 /* Input fields (text) */ 7203 match: function ($el) {
7204 if ($el.is("input")) { 7205 var t = (" " + attrOrProp($el, "type") + " ").toLowerCase(), 7206 allowed = " color date datetime datetime-local email month number password search tel text time url week "; 7207 return allowed.indexOf(t) >= 0; 7208 } 7209 7210 return false; 7211 }, 7212 apply: function ($el, options) { 7213 var elType, $wrapper; 7214 7215 elType = attrOrProp($el, "type"); 7216 $el.addClass(options.inputClass); 7217 $wrapper = wrapWithWrapperClass($el, options); 7218 bindUi($el, $el, options); 7219 7220 if (options.inputAddTypeAsClass) { 7221 $el.addClass(elType); 7222 } 7223 7224 return { 7225 remove: function () { 7226 $el.removeClass(options.inputClass); 7227 7228 if (options.inputAddTypeAsClass) { 7229 $el.removeClass(elType); 7230 } 7231 7232 if ($wrapper) { 7233 $el.unwrap(); 7234 } 7235 }, 7236 update: returnFalse 7237 }; 7238 } 7239 }, 7240 { 7241 /* Radio buttons */ 7242 match: function ($el) { 7243 return $el.is(":radio"); 7244 }, 7245 apply: function ($el, options) { 7246 var ds, $div, $span; 7247 ds = divSpan($el, options, { 7248 divClass: options.radioClass 7249 }); 7250 $div = ds.div; 7251 $span = ds.span; 7252 7253 /* Add classes for focus, handle active, checked */ 7254 bindUi($el, $div, options); 7255 bindMany($el, options, { 7256 "click touchend": function () { 7257 /* Find all radios with the same name, then update 7258 them with $.uniform.update() so the right 7259 per-element options are used */ 7260 $.uniform.update($(':radio[name="' + attrOrProp($el, "name") + '"]')); 7261 } 7262 }); 7263 classUpdateChecked($span, $el, options); 7264 return { 7265 remove: unwrapUnwrapUnbindFunction($el, options), 7266 update: function () { 7267 classClearStandard($div, options); 7268 classUpdateChecked($span, $el, options); 7269 classUpdateDisabled($div, $el, options); 7270 } 7271 }; 7272 } 7273 }, 7274 { 7275 /* Select lists, but do not style multiselects here */ 7276 7277 match: function ($el) { 7278 if ($el.is("select") && !isMultiselect($el)) { 7279 return true; 7280 } 7281 7282 return false; 7283 }, 7284 apply: function ($el, options) { 7285 var ds, $div, $span, origElemWidth; 7286 7287 if (options.selectAutoWidth) { 7288 sizingInvisible($el, function () { 7289 origElemWidth = $el.width(); 7290 }); 7291 } 7292 7293 ds = divSpan($el, options, { 7294 divClass: options.selectClass, 7295 spanHtml: ($el.find(":selected:first") || $el.find("option:first")).html(), 7296 spanWrap: "before" 7297 }); 7298 $div = ds.div; 7299 $span = ds.span; 7300 7301 if (options.selectAutoWidth) { 7302 /* Use the width of the select and adjust the 7303 span and div accordingly */ 7304 sizingInvisible($el, function () { 7305 /* Force "display: block" - related to bug #287 */ 7306 swap($([ $span[0], $div[0] ]), { 7307 display: "block" 7308 }, function () { 7309 var spanPad; 7310 spanPad = $span.outerWidth() - $span.width(); 7311 $div.width(origElemWidth + spanPad); 7312 $span.width(origElemWidth); 7313 }); 7314 }); 7315 } else { 7316 /* Force the select to fill the size of the div */ 7317 $div.addClass('fixedWidth'); 7318 } 7319 7320 /* Take care of events */ 7321 bindUi($el, $div, options); 7322 bindMany($el, options, { 7323 change: function () { 7324 $span.html($el.find(":selected").html()); 7325 $div.removeClass(options.activeClass); 7326 }, 7327 "click touchend": function () { 7328 /* IE7 and IE8 may not update the value right 7329 until after click event - issue #238 */ 7330 var selHtml = $el.find(":selected").html(); 7331 7332 if ($span.html() !== selHtml) { 7333 /* Change was detected 7334 Fire the change event on the select tag */ 7335 $el.trigger('change'); 7336 } 7337 }, 7338 keyup: function () { 7339 $span.html($el.find(":selected").html()); 7340 } 7341 }); 7342 noSelect($span, options); 7343 return { 7344 remove: function () { 7345 /* Remove sibling span */ 7346 $span.remove(); 7347 7348 /* Unwrap parent div */ 7349 $el.unwrap().unbind(options.eventNamespace); 7350 return $el; 7351 }, 7352 update: function () { 7353 if (options.selectAutoWidth) { 7354 /* Easier to remove and reapply formatting */ 7355 $.uniform.restore($el); 7356 $el.uniform(options); 7357 } else { 7358 classClearStandard($div, options); 7359 7360 /* Reset current selected text */ 7361 $span.html($el.find(":selected").html()); 7362 classUpdateDisabled($div, $el, options); 7363 } 7364 } 7365 }; 7366 } 7367 }, 7368 { 7369 /* Select lists - multiselect lists only */ 7370 match: function ($el) {
7371 if ($el.is("select") && isMultiselect($el)) { 7372 return true; 7373 } 7374 7375 return false; 7376 }, 7377 apply: function ($el, options) { 7378 var $wrapper; 7379 7380 $el.addClass(options.selectMultiClass); 7381 $wrapper = wrapWithWrapperClass($el, options); 7382 bindUi($el, $el, options); 7383 7384 return { 7385 remove: function () { 7386 $el.removeClass(options.selectMultiClass); 7387 7388 if ($wrapper) { 7389 $el.unwrap(); 7390 } 7391 }, 7392 update: returnFalse 7393 }; 7394 } 7395 }, 7396 { 7397 /* Textareas */ 7398 match: function ($el) { 7399 return $el.is("textarea"); 7400 }, 7401 apply: function ($el, options) { 7402 var $wrapper; 7403 7404 $el.addClass(options.textareaClass); 7405 $wrapper = wrapWithWrapperClass($el, options); 7406 bindUi($el, $el, options); 7407 7408 return { 7409 remove: function () { 7410 $el.removeClass(options.textareaClass); 7411 7412 if ($wrapper) { 7413 $el.unwrap(); 7414 } 7415 }, 7416 update: returnFalse 7417 }; 7418 } 7419 } 7420 ]; 7421 7422 /* IE6 can't be styled - can't set opacity on select */ 7423 if (isMsie() && !isMsieSevenOrNewer()) { 7424 allowStyling = false; 7425 } 7426 7427 $.uniform = { 7428 /* Default options that can be overridden globally or when uniformed 7429 // globally: $.uniform.defaults.fileButtonHtml = "Pick A File"; 7430 // on uniform: $('input').uniform({fileButtonHtml: "Pick a File"}); */ 7431 defaults: { 7432 activeClass: "active", 7433 autoHide: true, 7434 buttonClass: "button", 7435 checkboxClass: "checker", 7436 checkedClass: "checked", 7437 disabledClass: "disabled", 7438 eventNamespace: ".uniform", 7439 fileButtonClass: "action", 7440 fileButtonHtml: "Choose File", 7441 fileClass: "uploader", 7442 fileDefaultHtml: "", 7443 filenameClass: "filename", 7444 focusClass: "focus", 7445 hoverClass: "hover", 7446 idPrefix: "uniform", 7447 inputAddTypeAsClass: true, 7448 inputClass: "uniform-input", 7449 radioClass: "radio", 7450 resetDefaultHtml: "Reset", 7451 resetSelector: false, /* We'll use our own function when you don't specify one */ 7452 selectAutoWidth: true, 7453 selectClass: "selector", 7454 selectMultiClass: "uniform-multiselect", 7455 submitDefaultHtml: "Submit", /* Only text allowed */ 7456 textareaClass: "uniform", 7457 useID: true, 7458 wrapperClass: null 7459 }, 7460 7461 /* All uniformed elements - DOM objects */ 7462 elements: [] 7463 }; 7464 7465 $.fn.uniform = function (options) { 7466 var el = this; 7467 options = $.extend({}, $.uniform.defaults, options); 7468 7469 /* If we are in high contrast mode, do not allow styling */ 7470 if (!highContrastTest) { 7471 highContrastTest = true; 7472 7473 if (highContrast()) { 7474 allowStyling = false; 7475 } 7476 } 7477 7478 /* Only uniform on browsers that work */ 7479 if (!allowStyling) { 7480 return this; 7481 } 7482 7483 /* Code for specifying a reset button */ 7484 if (options.resetSelector) { 7485 $(options.resetSelector).mouseup(function () { 7486 window.setTimeout(function () { 7487 $.uniform.update(el); 7488 }, 10); 7489 }); 7490 } 7491 7492 return this.each(function () { 7493 var $el = $(this), i, handler, callbacks; 7494 7495 /* Avoid uniforming elements already uniformed - just update */ 7496 if ($el.data("uniformed")) { 7497 $.uniform.update($el); 7498 return; 7499 } 7500 7501 /* See if we have any handler for this type of element */ 7502 for (i = 0; i < uniformHandlers.length; i = i + 1) { 7503 handler = uniformHandlers[i]; 7504 7505 if (handler.match($el, options)) { 7506 callbacks = handler.apply($el, options); 7507 $el.data("uniformed", callbacks); 7508 7509 /* Store element in our global array */ 7510 $.uniform.elements.push($el.get(0)); 7511 return; 7512 } 7513 } 7514 7515 /* Could not style this element */ 7516 }); 7517 }; 7518 7519 $.uniform.restore = $.fn.uniform.restore = function (elem) { 7520 if (elem === undef) { 7521 elem = $.uniform.elements; 7522 } 7523 7524 $(elem).each(function () { 7525 var $el = $(this), index, elementData; 7526 elementData = $el.data("uniformed"); 7527 7528 /* Skip elements that are not uniformed */ 7529 if (!elementData) { 7530 return; 7531 } 7532 7533 /* Unbind events, remove additional markup that was added */ 7534 elementData.remove(); 7535 7536 /* Remove item from list of uniformed elements */ 7537 index = $.inArray(this, $.uniform.elements); 7538 7539 if (index >= 0) { 7540 $.uniform.elements.splice(index, 1); 7541 } 7542 7543 $el.removeData("uniformed"); 7544 }); 7545 }; 7546 7547 $.uniform.update = $.fn.uniform.update = function (elem) { 7548 if (elem === undef) { 7549 elem = $.uniform.elements; 7550 } 7551 7552 $(elem).each(function () { 7553 var $el = $(this), elementData; 7554 elementData = $el.data("uniformed"); 7555 7556 /* Skip elements that are not uniformed */ 7557 if (!elementData) { 7558 return; 7559 } 7560 7561 elementData.update($el, elementData.options); 7562 }); 7563 }; 7564}(jQuery)); 7565; 7566(function ($, Drupal) { 7567 'use strict'; 7568 Drupal.behaviors.helloWorld = { 7569 attach: function (context, settings) { 7570 $('.hasDatepicker').datepicker(); 7571 $('.block-views-blockslider-partenaires-block').flexslider({ 7572 animation: "slide", 7573 animationLoop: true, 7574 slideshow: true, 7575 controlNav: false, 7576 itemMargin: 0, 7577 touch: true, 7578 maxItems: 1, 7579 move: 1, 7580 slideshowSpeed: 5000, 7581 animationSpeed: 600 7582 }); 7583 7584 $('.block-views-blockslider-partenaires-block-1').flexslider({ 7585 animation: "slide", 7586 animationLoop: true, 7587 slideshow: true, 7588 controlNav: false, 7589 itemMargin: 0, 7590 touch: true, 7591 maxItems: 1, 7592 move: 1, 7593 slideshowSpeed: 5000, 7594 animationSpeed: 600 7595 }); 7596
7597 $('#block-views-slider-hp-block').flexslider({ 7598 animation: "slide", 7599 animationLoop: true, 7600 maxItems: 1, 7601 move: 1, 7602 controlNav: false, 7603 slideshow: true, 7604 slideshowSpeed: 8000, 7605 animationSpeed: 600, 7606 before: function (slider) { 7607 $('#block-views-slider-hp-block-1').flexslider(slider.animatingTo); 7608 } 7609 }); 7610 7611 $('#block-views-slider-hp-block-1').flexslider({ 7612 animation: "fade", 7613 animationLoop: true, 7614 animationSpeed: 0, 7615 slideshow: true, 7616 slideshowSpeed: 8000, 7617 controlNav: false, 7618 maxItems: 1, 7619 move: 1, 7620 directionNav: false, 7621 before: function (slider) { 7622 $('#block-views-slider-hp-block').flexslider(slider.animatingTo); 7623 } 7624 }); 7625 7626 $('#block-views-profil-block').flexslider({ 7627 animation: "slide", 7628 animationLoop: true, 7629 slideshow: true, 7630 controlNav: false, 7631 itemMargin: 0, 7632 touch: true, 7633 maxItems: 1, 7634 move: 1, 7635 slideshowSpeed: 8000, 7636 animationSpeed: 600 7637 }); 7638 7639 $('#block-views-a-la-une-block').flexslider({ 7640 animation: "slide", 7641 animationLoop: true, 7642 slideshow: true, 7643 controlNav: false, 7644 itemMargin: 0, 7645 touch: true, 7646 maxItems: 1, 7647 move: 1, 7648 slideshowSpeed: 6000, 7649 animationSpeed: 600, 7650 directionNav: true 7651 }); 7652 7653 /* 7654 * Block Chiffres pour desktop, tablet & mobile 7655 * 7656 */ 7657 7658 $('.homepage #block-views-chiffres-block').flexslider({ 7659 animation: "slide", 7660 animationLoop: true, 7661 slideshow: true, 7662 controlNav: false, 7663 itemWidth: 202, 7664 itemMargin: 0, 7665 touch: true, 7666 maxItems: 4, 7667 move: 1, 7668 slideshowSpeed: 5000, 7669 animationSpeed: 600 7670 }); 7671 7672 7673 7674 $('.tablet-home #block-views-chiffres-block').flexslider({ 7675 animation: "slide", 7676 animationLoop: true, 7677 slideshow: true, 7678 controlNav: false, 7679 startAt: 0, 7680 itemWidth: 190, 7681 itemMargin: 0, 7682 touch: true, 7683 maxItems: 4, 7684 move: 1, 7685 slideshowSpeed: 5000, 7686 animationSpeed: 600 7687 }); 7688 7689 $('.mobile #block-views-chiffres-block').flexslider({ 7690 animation: "slide", 7691 animationLoop: true, 7692 slideshow: true, 7693 controlNav: false, 7694 itemWidth: 20, 7695 itemHeight: 20, 7696 itemMargin: 0, 7697 touch: true, 7698 maxItems: 1, 7699 move: 1, 7700 slideshowSpeed: 5000, 7701 animationSpeed: 600 7702 }); 7703 7704 7705 7706 /* 7707 * Block twitter 7708 * 7709 */ 7710 $('#block-enac-main-enac-block-twitter').flexslider({ 7711 animation: "slide", 7712 animationLoop: true, 7713 slideshow: true, 7714 controlNav: false, 7715 itemMargin: 0, 7716 touch: true, 7717 maxItems: 1, 7718 move: 1, 7719 slideshowSpeed: 6000, 7720 animationSpeed: 600 7721 }); 7722 7723 $('#wrapper-backgroundimage').flexslider({ 7724 animation: "fade", 7725 animationLoop: false, 7726 slideshow: false, 7727 controlNav: true, 7728 manualControls: ".controls-slide li", 7729 itemMargin: 0, 7730 touch: false, 7731 maxItems: 1, 7732 move: 1, 7733 slideshowSpeed: 150000, 7734 animationSpeed: 0, 7735 directionNav: false, 7736 sync: "#inner-gmap" 7737 }); 7738 7739 $('#inner-gmap').flexslider({ 7740 animation: "fade", 7741 animationLoop: false, 7742 slideshow: false, 7743 controlNav: false, 7744 manualControls: ".controls-slide li", 7745 itemMargin: 0, 7746 touch: true, 7747 maxItems: 1, 7748 move: 1, 7749 slideshowSpeed: 15000, 7750 animationSpeed: 1000, 7751 directionNav: false 7752 }); 7753 7754 7755 $('#block-menu-menu-menu-header-2 ul li.dropdown >a').click(function (e) { 7756 e.preventDefault(); 7757 if ($(this).parent().hasClass('open')) { 7758 $(this).parent().removeClass('open'); 7759 } 7760 else { 7761 $('#block-menu-menu-menu-header-2 ul li.dropdown').removeClass('open'); 7762 $(this).parent().addClass('open'); 7763 } 7764 }); 7765 7766 7767 /* 7768 7769 $('#block-menu-block-1 ul li.dropdown >a').click(function (f) { 7770 f.preventDefault(); 7771 if ($(this).parent().hasClass('open')) { 7772 $(this).parent().removeClass('open'); 7773 } 7774 else { 7775 $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 7776 $(this).parent().addClass('open'); 7777 } 7778 }); 7779 */ 7780 /* 7781 * Js pour menu-block-1 7782 */ 7783 7784 $('#block-menu-block-1 ul li.dropdown >a .caret').click(function (f) { 7785 f.preventDefault(); 7786 if ($(this).parent().parent().hasClass('open')) { 7787 $(this).parent().parent().removeClass('open'); 7788 } 7789 else { 7790 $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 7791 $(this).parent().parent().addClass('open'); 7792 } 7793 }); 7794 7795 7796 // $.ajax({ 7797 // url: Drupal.settings.basePath + 'ajax/blocks/flicker-block', 7798 // dataType: 'json', 7799 // success: function (obj) { 7800 // $('.gallerie-photo').html(obj.block); 7801 // } 7802 // }); 7803 7804 7805 /* 7806 * Js pour page organigramme 7807 * 7808 */ 7809 $('.field-collection-container .field-type-text-with-summary').hide(); 7810 $('.field-collection-container .field-type-text').click(function (e) { 7811 e.preventDefault(); 7812 $(this).next('.field-collection-container div.field-type-text-with-summary').toggle(); 7813 $('.field-collection-container .field-type-text').not($(this)).removeClass('ouvert'); 7814 $(this).toggleClass('ouvert'); 7815 $('.field-collection-container .field-type-text-with-summary').not($(this).next(' .field-collection-container div.field-type-text-with-summary')).hide(); 7816 }); 7817 7818 7819 /* 7820 * Page Offres demploi 7821 */ 7822 $('.offres-details').hide(); 7823 $('.offres-titre').click(function (k) { 7824 7825 k.preventDefault(); 7826 7827 $(this).next('div.offres-details').toggle(); 7828 7829 $('.offres-titre').not($(this)).removeClass('ouvert'); 7830 $(this).toggleClass('ouvert'); 7831 7832 $('.offres-details').not($(this).next('div.offres-details')).hide(); 7833 7834 }); 7835 7836 7837 // $(".text").hide(); 7838 // $('.view-content h3').click(function (k) { 7839 // var text = $(this).text(); 7840 // var text = text.replace("'", '039'); 7841 // var text = text.replace(/\s+/g, '-'); 7842 // $(".text").not($('.'+text).parent().parent()).hide(); 7843 // $('.'+text).parent().parent().toggle(); 7844 // $(this).toggleClass('ouvert'); 7845 // $('.view-content h3').not($(this)).removeClass('ouvert'); 7846 // }); 7847 7848 /* 7849 * Mobile: Select theme sur la page d'accueil 7850 */ 7851 7852 $('.mobile .click-content-theme').hide(); 7853 $('.mobile .click-theme').click(function (event) { 7854 7855 event.preventDefault(); 7856 7857 /* $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); */ 7858 $(this).next('.mobile div.click-content-theme').toggle(); 7859 $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); 7860 $('.mobile div.click-theme').not($(this)).show(); 7861 /* $('.mobile .click-theme').hide(); */ 7862 7863 /* $('.offres-titre').removeClass('ouvert'); */ 7864 $('.mobile .click-theme').not($(this)).removeClass('ouvert'); 7865 7866 $(this).toggleClass('ouvert'); 7867 /* $('.offres-titre').not($(this).next('div.offres-titre')).removeClass('ouvert'); */ 7868 7869 $('.mobile .click-content-theme').not($(this).next('.mobile div.click-content-theme')).hide(); 7870 7871 /* $(this).removeClass('ouvert'); */ 7872 }); 7873 7874 /* 7875 * JS pour page print: 7876 * hide title when fields in views are empty 7877 */ 7878 7879 $(" .content .view").each(function (index) { 7880 if ($.trim($(this).html()) == "") { 7881 $(this).parent().parent().find('.title').hide(); 7882 } 7883 }); 7884 7885 7886 /* 7887 * Recherche pour mobile 7888 */ 7889 7890 $('.search-logo .search-show #block-search-form').hide(); 7891 $('.search-logo .search-click').click(function (test) { 7892 7893 test.preventDefault(); 7894 7895 $('div.search-click').not($(this)).show(); 7896 $('.search-click').not($(this)).removeClass('ouvert'); 7897 $(this).toggleClass('ouvert'); 7898 7899 $('.search-logo .search-show #block-search-form').show(); 7900 7901 $('div.search-click').hide(); 7902 7903 }); 7904 7905 7906 /*resize tablet */ 7907 var isDesktop = window.matchMedia("(min-width: 993px)"); 7908 7909 if (isDesktop.matches) { 7910 /* Conditional script here */ 7911 7912 7913 if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 18) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 22)) { 7914 7915 $('#block-menu-block-1 .block-title > a').css('font-size', '20px'); 7916 7917 } else if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 21) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 32)) { 7918 7919 $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 7920 7921 } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 31) { 7922 7923 $('#block-menu-block-1 .block-title > a').css('font-size', '16px'); 7924 7925 } else { 7926 7927 $('#block-menu-block-1 .block-title > a').css('font-size', '24px'); 7928 } 7929 7930 } 7931 7932 7933 /* resize tablet */ 7934 var isTablet = window.matchMedia("(min-width: 768px) and (max-width: 992px)"); 7935 7936 if (isTablet.matches) { 7937 7938 7939 if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 18) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 22)) { 7940 7941 $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 7942 7943 } else if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 21) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 31)) { 7944 7945 $('#block-menu-block-1 .block-title > a').css('font-size', '15px'); 7946 7947 } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 30) { 7948 7949 $('#block-menu-block-1 .block-title > a').css('font-size', '12px'); 7950 7951 } else { 7952 7953 $('#block-menu-block-1 .block-title > a').css('font-size', '19px'); 7954 } 7955 7956 } 7957 7958 7959 7960 if ($('#back-top').height('98')) { 7961 $('#back-top').hide(); 7962 } 7963 7964 7965 /* bloc-contact */ 7966 var x = $('.image-email').parent(); 7967 7968 if ($(x).find('.field-content > a').length > 0) { 7969 var target = $(x).find('.field-content > a').attr("href"); 7970 if (target.length <= 7) { 7971 $('.image-email').remove(); 7972 } 7973 } 7974 7975 var y = $('.image-phone').parent(); 7976 if ($(y).find('.field-content > span').length > 0) { 7977 var target_2 = $(y).find('.field-content > span').text(); 7978 if (target_2.length <= 0) { 7979 $('.image-phone').remove(); 7980 } 7981 } 7982 var z = $('.image-phone').parent(); 7983 if ($(z).find('.field-content .tel-mobile > a').length > 0) { 7984 var target_3 = $(z).find('.field-content .tel-mobile > a').attr("href"); 7985 if (target_3.length <= 4) { 7986 $('.image-phone').remove(); 7987 } 7988 } 7989 7990 /* scroll body to 0px on click */ 7991 $('#back-top a').click(function () { 7992 $("html, body").animate({ scrollTop: 0 }, "slow"); 7993 return false;
7994 }); 7995 7996 7997 7998 $(window).scroll(function () { 7999 if ($(this).scrollTop() > 100) { 8000 $('#back-top').fadeIn(); 8001 } else { 8002 $('#back-top').fadeOut(); 8003 } 8004 }); 8005 8006 } 8007 } 8008}(jQuery, Drupal)); 8009 8010// $('#block-menu-menu-menu-header-2 ul li.dropdown >a').click(function (e) { 8011// e.preventDefault(); 8012// if ($(this).parent().hasClass('open')) { 8013// $(this).parent().removeClass('open'); 8014// } 8015// else { 8016// $('#block-menu-menu-menu-header-2 ul li.dropdown').removeClass('open'); 8017// $(this).parent().addClass('open'); 8018// } 8019// }); 8020// 8021// } 8022// /* 8023// 8024// $('#block-menu-block-1 ul li.dropdown >a').click(function (f) { 8025// f.preventDefault(); 8026// if ($(this).parent().hasClass('open')) { 8027// $(this).parent().removeClass('open'); 8028// } 8029// else { 8030// $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 8031// $(this).parent().addClass('open'); 8032// } 8033// }); 8034// */ 8035// /* 8036// * Js pour menu-block-1 8037// */ 8038// 8039// $('#block-menu-block-1 ul li.dropdown >a .caret').click(function (f) { 8040// f.preventDefault(); 8041// if ($(this).parent().parent().hasClass('open')) { 8042// $(this).parent().parent().removeClass('open'); 8043// } 8044// else { 8045// $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 8046// $(this).parent().parent().addClass('open'); 8047// } 8048// }); 8049// 8050// 8051// $.ajax({ 8052// url: Drupal.settings.basePath + 'ajax/blocks/flicker-block', 8053// dataType: 'json', 8054// success: function (obj) { 8055// $('.gallerie-photo').html(obj.block); 8056// } 8057// }); 8058// 8059// 8060// /* 8061// * Js pour page organigramme 8062// * 8063// */ 8064// $('.field-collection-container .field-type-text-with-summary').hide(); 8065// $('.field-collection-container .field-type-text').click(function (e) { 8066// e.preventDefault(); 8067// $(this).next('.field-collection-container div.field-type-text-with-summary').toggle(); 8068// $('.field-collection-container .field-type-text').not($(this)).removeClass('ouvert'); 8069// $(this).toggleClass('ouvert'); 8070// $('.field-collection-container .field-type-text-with-summary').not($(this).next(' .field-collection-container div.field-type-text-with-summary')).hide(); 8071// }); 8072// 8073// 8074// /* 8075// * Page Offres demploi 8076// */ 8077// 8078// $('.offres-details').hide(); 8079// $('.offres-titre').click(function (k) { 8080// 8081// k.preventDefault(); 8082// 8083// $(this).next('div.offres-details').toggle(); 8084// 8085// $('.offres-titre').not($(this)).removeClass('ouvert'); 8086// $(this).toggleClass('ouvert'); 8087// 8088// $('.offres-details').not($(this).next('div.offres-details')).hide(); 8089// 8090// 8091// 8092// 8093// }); 8094// 8095// 8096// $(".text").hide(); 8097// $('.view-content h3').click(function (k) { 8098// var text = $(this).text(); 8099// var text = text.replace("'", '039'); 8100// var text = text.replace(/\s+/g, '-'); 8101// $(".text").not($('.'+text).parent().parent()).hide(); 8102// $('.'+text).parent().parent().toggle(); 8103// $(this).toggleClass('ouvert'); 8104// $('.view-content h3').not($(this)).removeClass('ouvert'); 8105// }); 8106// 8107// /* 8108// * Mobile: Select theme sur la page d'accueil 8109// */ 8110// 8111// $('.mobile .click-content-theme').hide(); 8112// $('.mobile .click-theme').click(function (event) { 8113// 8114// event.preventDefault(); 8115// 8116// /* $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); */ 8117// $(this).next('.mobile div.click-content-theme').toggle(); 8118// $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); 8119// $('.mobile div.click-theme').not($(this)).show(); 8120// /* $('.mobile .click-theme').hide(); */ 8121// 8122// /* $('.offres-titre').removeClass('ouvert'); */ 8123// $('.mobile .click-theme').not($(this)).removeClass('ouvert'); 8124// 8125// $(this).toggleClass('ouvert'); 8126// /* $('.offres-titre').not($(this).next('div.offres-titre')).removeClass('ouvert'); */ 8127// 8128// $('.mobile .click-content-theme').not($(this).next('.mobile div.click-content-theme')).hide(); 8129// 8130// /* $(this).removeClass('ouvert'); */ 8131// }); 8132// 8133// /* 8134// * JS pour page print: 8135// * hide title when fields in views are empty 8136// */ 8137// 8138// $(" .content .view").each(function (index) { 8139// if ($.trim($(this).html()) == "") { 8140// $(this).parent().parent().find('.title').hide(); 8141// } 8142// }); 8143// 8144// 8145// /* 8146// * Recherche pour mobile
8147// */ 8148// 8149// $('.search-logo .search-show #block-search-form').hide(); 8150// $('.search-logo .search-click').click(function (test) { 8151// 8152// test.preventDefault(); 8153// 8154// $('div.search-click').not($(this)).show(); 8155// $('.search-click').not($(this)).removeClass('ouvert'); 8156// $(this).toggleClass('ouvert'); 8157// 8158// $('.search-logo .search-show #block-search-form').show(); 8159// 8160// $('div.search-click').hide(); 8161// 8162// }); 8163// 8164// 8165// }); 8166// 8167// 8168// /* 8169// * Resize titre du menu-block 8170// */ 8171// 8172// $(document).ready(function () { 8173// 8174// /*resize tablet */ 8175// var isDesktop = window.matchMedia("(min-width: 993px)"); 8176// 8177// if (isDesktop.matches) { 8178// /* Conditional script here */ 8179// 8180// 8181// if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 18) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 22)) { 8182// 8183// $('#block-menu-block-1 .block-title > a').css('font-size', '20px'); 8184// 8185// } else if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 21) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 32)) { 8186// 8187// $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 8188// 8189// } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 31) { 8190// 8191// $('#block-menu-block-1 .block-title > a').css('font-size', '16px'); 8192// 8193// } else { 8194// 8195// $('#block-menu-block-1 .block-title > a').css('font-size', '24px'); 8196// } 8197// 8198// } 8199// 8200// 8201// /* resize tablet */ 8202// var isTablet = window.matchMedia("(min-width: 768px) and (max-width: 992px)"); 8203// 8204// if (isTablet.matches) { 8205// 8206// 8207// if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 18) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 22)) { 8208// 8209// $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 8210// 8211// } else if (($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 21) && ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length < 31)) { 8212// 8213// $('#block-menu-block-1 .block-title > a').css('font-size', '15px'); 8214// 8215// } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 30) { 8216// 8217// $('#block-menu-block-1 .block-title > a').css('font-size', '12px'); 8218// 8219// } else { 8220// 8221// $('#block-menu-block-1 .block-title > a').css('font-size', '19px'); 8222// } 8223// 8224// } 8225// 8226// 8227// }); 8228// 8229// $(document).ready(function () { 8230// if ($('#back-top').height('98')) { 8231// $('#back-top').hide(); 8232// } 8233// 8234// 8235// /* bloc-contact */ 8236// var x = $('.image-email').parent(); 8237// 8238// if ($(x).find('.field-content > a').length > 0) { 8239// var target = $(x).find('.field-content > a').attr("href"); 8240// if (target.length <= 7) { 8241// $('.image-email').remove(); 8242// } 8243// } 8244// 8245// var y = $('.image-phone').parent(); 8246// if ($(y).find('.field-content > span').length > 0) { 8247// var target_2 = $(y).find('.field-content > span').text(); 8248// if (target_2.length <= 0) { 8249// $('.image-phone').remove(); 8250// } 8251// } 8252// var z = $('.image-phone').parent(); 8253// if ($(z).find('.field-content .tel-mobile > a').length > 0) { 8254// var target_3 = $(z).find('.field-content .tel-mobile > a').attr("href"); 8255// if (target_3.length <= 4) { 8256// $('.image-phone').remove(); 8257// } 8258// } 8259// 8260// /* scroll body to 0px on click */ 8261// $('#back-top a').click(function () { 8262// $("html, body").animate({ scrollTop: 0 }, "slow"); 8263// return false;
8264// }); 8265// 8266// 8267// 8268// 8269// }); 8270// 8271// $(window).scroll(function () { 8272// if ($(this).scrollTop() > 100) { 8273// $('#back-top').fadeIn(); 8274// } else { 8275// $('#back-top').fadeOut(); 8276// } 8277// }); 8278// 8279// }(jQuery, Drupal); 8280;
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.