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' =>
vendor: 5,943 bytes, lines 4385-4451
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/*! jQuery UI - v1.12.1 - 2017-03-31 4449* http://jqueryui.com 4450* Copyright jQuery Foundation and other contributors; Licensed */ 4451!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.to
vendor: 1,339 bytes, line 4451
4451p,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 4451-4455
4451===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});; 4452/*! jQuery UI - v1.12.1 - 2017-03-31 4453* http://jqueryui.com 4454* Copyright jQuery Foundation and other contributors; Licensed */ 4455!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 4455
4455a.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: 5,092 bytes, lines 4456-4459
4456/*! jQuery UI - v1.12.1 - 2017-03-31 4457* http://jqueryui.com 4458* Copyright jQuery Foundation and other contributors; Licensed */ 4459!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(
4459),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});; 4460/** 4461 * @file 4462 * Extends autocomplete based on jQuery UI. 4463 * 4464 * @todo Remove once jQuery UI is no longer used? 4465 */ 4466 4467(function ($, Drupal) { 4468 'use strict'; 4469 4470 // Ensure the input element has a "change" event triggered. This is important 4471 // so that summaries in vertical tabs can be updated properly. 4472 // @see Drupal.behaviors.formUpdated 4473 $(document).on('autocompleteselect', '.form-autocomplete', function (e) { 4474 $(e.target).trigger('change.formUpdated'); 4475 }); 4476 4477 // Extend ui.autocomplete widget so it triggers the glyphicon throbber. 4478 $.widget('ui.autocomplete', $.ui.autocomplete, { 4479 _search: function (value) { 4480 this.pending++; 4481 Drupal.Ajax.prototype.glyphiconStart(this.element); 4482 this.cancelSearch = false;
4483 this.source({term: value}, this._response()); 4484 }, 4485 _response: function () { 4486 var index = ++this.requestIndex; 4487 return $.proxy(function (content) { 4488 if (index === this.requestIndex) this.__response(content); 4489 this.pending--; 4490 if (!this.pending) Drupal.Ajax.prototype.glyphiconStop(this.element); 4491 }, this); 4492 } 4493 }); 4494 4495})(jQuery, Drupal); 4496; 4497/** 4498 * @file 4499 * Expands the behaviour of the default autocompletion. 4500 */ 4501 4502(function ($, Drupal, drupalSettings) { 4503 4504 'use strict'; 4505 4506 // As a safety precaution, bail if the Drupal Core autocomplete framework is 4507 // not present. 4508 if (!Drupal.autocomplete) { 4509 return; 4510 } 4511 4512 var autocomplete = {}; 4513 4514 /** 4515 * Retrieves the custom settings for an autocomplete-enabled input field. 4516 * 4517 * @param {HTMLElement} input 4518 * The input field. 4519 * @param {object} globalSettings 4520 * The object containing global settings. If none is passed, drupalSettings 4521 * is used instead. 4522 * 4523 * @return {object} 4524 * The effective settings for the given input fields, with defaults set if 4525 * applicable. 4526 */ 4527 autocomplete.getSettings = function (input, globalSettings) { 4528 globalSettings = globalSettings || drupalSettings || {}; 4529 // Set defaults for all known settings. 4530 var settings = { 4531 auto_submit: false, 4532 delay: 0, 4533 min_length: 1, 4534 selector: ':submit', 4535 }; 4536 var search = $(input).data('search-api-autocomplete-search'); 4537 if (search 4538 && globalSettings.search_api_autocomplete 4539 && globalSettings.search_api_autocomplete[search]) { 4540 $.extend(settings, globalSettings.search_api_autocomplete[search]); 4541 } 4542 return settings; 4543 }; 4544 4545 /** 4546 * Attaches our custom autocomplete settings to all affected fields. 4547 * 4548 * @type {Drupal~behavior} 4549 * 4550 * @prop {Drupal~behaviorAttach} attach 4551 * Attaches the autocomplete behaviors. 4552 */ 4553 Drupal.behaviors.searchApiAutocomplete = { 4554 attach: function (context, settings) { 4555 // Find all our fields with autocomplete settings. 4556 $(context) 4557 .find('.ui-autocomplete-input[data-search-api-autocomplete-search]') 4558 .once('search-api-autocomplete') 4559 .each(function () { 4560 var uiAutocomplete = $(this).data('ui-autocomplete'); 4561 if (!uiAutocomplete) { 4562 return; 4563 } 4564 var $element = uiAutocomplete.menu.element; 4565 $element.data('search-api-autocomplete-input-id', this.id); 4566 $element.addClass('search-api-autocomplete-search'); 4567 var elementSettings = autocomplete.getSettings(this, settings); 4568 if (elementSettings['delay']) { 4569 uiAutocomplete.options['delay'] = elementSettings['delay']; 4570 } 4571 if (elementSettings['min_length']) { 4572 uiAutocomplete.options['minLength'] = elementSettings['min_length']; 4573 } 4574 // Override the "select" callback of the jQuery UI autocomplete. 4575 var oldSelect = uiAutocomplete.options.select; 4576 uiAutocomplete.options.select = function (event, ui) { 4577 // If this is a URL suggestion, instead of autocompleting we 4578 // redirect the user to that URL. 4579 if (ui.item.url) { 4580 location.href = ui.item.url; 4581 return false; 4582 } 4583 4584 var ret = oldSelect.apply(this, arguments); 4585 4586 // If auto-submit is enabled, submit the form. 4587 if (elementSettings['auto_submit'] && elementSettings['selector']) { 4588 $(elementSettings['selector'], this.form).trigger('click'); 4589 } 4590 4591 return ret; 4592 }; 4593 }); 4594 } 4595 }; 4596 4597 Drupal.SearchApiAutocomplete = autocomplete; 4598 4599})(jQuery, Drupal, drupalSettings); 4600; 4601Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 4602 4603(function ($) { 4604 Drupal.TBMegaMenu.menuInstance = false; 4605 4606 Drupal.TBMegaMenu.supportedScreens = [768]; 4607 Drupal.TBMegaMenu.menuResponsive = function () { 4608 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 4609 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 4610 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 4611 navCollapse.addClass('collapse'); 4612 if (Drupal.TBMegaMenu.displayedMenuMobile) { 4613 navCollapse.css({height: 'auto', overflow: 'visible'}); 4614 } else { 4615 navCollapse.css({height: 0, overflow: 'hidden'}); 4616 } 4617 } else { 4618 /* If width of window is greater than 980 (supported screen). */ 4619 navCollapse.removeClass('collapse'); 4620 if (navCollapse.height() <= 0) { 4621 navCollapse.css({height: 'auto', overflow: 'visible'}); 4622 } 4623 } 4624 }; 4625 4626 Drupal.behaviors.tbMegaMenuAction = { 4627 attach: function(context) { 4628 $('.tb-megamenu-button').click(function() { 4629 if(parseInt($(this).parent().children('.nav-collapse').height())) { 4630 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 4631 } 4632 else { 4633 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 4634 } 4635 }); 4636 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 4637 if(!isTouch){ 4638 $(document).ready(function($){ 4639 var mm_duration = 0; 4640 $('.tb-megamenu').each (function(){ 4641 if ($(this).data('duration')) { 4642 mm_duration = $(this).data('duration'); 4643 } 4644 }); 4645 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 4646 $('#block-tb-megamenu-main-menu .nav > li, li.mega').hover(function(event) { 4647 var $this = $(this); 4648 if ($this.hasClass ('mega')) { 4649 /* $this.addClass ('animating'); */ 4650 clearTimeout ($this.data('animatingTimeout')); 4651 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 4652 clearTimeout ($this.data('hoverTimeout')); 4653 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 4654 } else { 4655 clearTimeout ($this.data('hoverTimeout')); 4656 $this.data('hoverTimeout', 4657 setTimeout(function(){$this.addClass ('open')}, 100)); 4658 } 4659 }, 4660 function(event) { 4661 var $this = $(this); 4662 if ($this.hasClass ('mega')) { 4663 /* $this.addClass ('animating'); */ 4664 clearTimeout ($this.data('animatingTimeout')); 4665 $this.data('animatingTimeout', 4666 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 4667 clearTimeout ($this.data('hoverTimeout')); 4668 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 4669 } else { 4670 clearTimeout ($this.data('hoverTimeout')); 4671 $this.data('hoverTimeout', 4672 setTimeout(function(){$this.removeClass ('open')}, 100)); 4673 } 4674 }); 4675 $('li.mega-align-justify > a.dropdown-toggle').click(function(e){ 4676 console.log('checl'); 4677 e.preventDefault(); 4678 }); 4679 }); 4680 } 4681 } 4682 } 4683})(jQuery); 4684 4685; 4686/* 4687 * jQuery FlexSlider v2.4.0 4688 * Copyright 2012 WooThemes 4689 * Contributing Author: Tyler Smith 4690 */!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 4690
4690ontrolNav&&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()}}
4690,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")}}
vendor: 16,719 bytes, lines 4690-4765
4690,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=$(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);; 4691/* 4692 4693Uniform v2.1.0 4694Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC 4695http://pixelmatrixdesign.com 4696 4697Requires jQuery 1.3 or newer 4698 4699Much thanks to Thomas Reynolds and Buck Wilson for their help and advice on 4700this. 4701 4702Disabling text selection is made possible by Mathias Bynens 4703<http://mathiasbynens.be/> and his noSelect plugin. 4704<https://github.com/mathiasbynens/jquery-noselect>, which is embedded. 4705 4706Also, thanks to David Kaneda and Eugene Bond for their contributions to the 4707plugin. 4708 4709Tyler Akins has also rewritten chunks of the plugin, helped close many issues, 4710and ensured version 2 got out the door. 4711 4712License: 4713MIT License - http://www.opensource.org/licenses/mit-license.php 4714 4715Enjoy! 4716 4717*/ 4718/*global jQuery, window, document, navigator*/ 4719 4720(function ($, undef) { 4721 "use strict"; 4722 4723 /** 4724 * Use .prop() if jQuery supports it, otherwise fall back to .attr() 4725 * 4726 * @param jQuery $el jQuery'd element on which we're calling attr/prop 4727 * @param ... All other parameters are passed to jQuery's function 4728 * @return The result from jQuery 4729 */ 4730 function attrOrProp($el) { 4731 var args = Array.prototype.slice.call(arguments, 1); 4732 4733 if ($el.prop) { 4734 /* jQuery 1.6+ */ 4735 return $el.prop.apply($el, args); 4736 } 4737 4738 /* jQuery 1.5 and below */ 4739 return $el.attr.apply($el, args); 4740 } 4741 4742 /** 4743 * For backwards compatibility with older jQuery libraries, only bind 4744 * one thing at a time. Also, this function adds our namespace to 4745 * events in one consistent location, shrinking the minified code. 4746 * 4747 * The properties on the events object are the names of the events 4748 * that we are supposed to add to. It can be a space separated list. 4749 * The namespace will be added automatically. 4750 * 4751 * @param jQuery $el 4752 * @param Object options Uniform options for this element 4753 * @param Object events Events to bind, properties are event names 4754 */ 4755 function bindMany($el, options, events) { 4756 var name, namespaced; 4757 4758 for (name in events) { 4759 if (events.hasOwnProperty(name)) { 4760 namespaced = name.replace(/ |$/g, options.eventNamespace); 4761 $el.bind(namespaced, events[name]); 4762 } 4763 } 4764 } 4765
4766 /** 4767 * Bind the hover, active, focus, and blur UI updates 4768 * 4769 * @param jQuery $el Original element 4770 * @param jQuery $target Target for the events (our div/span) 4771 * @param Object options Uniform options for the element $target 4772 */ 4773 function bindUi($el, $target, options) { 4774 bindMany($el, options, { 4775 focus: function () { 4776 $target.addClass(options.focusClass); 4777 }, 4778 blur: function () { 4779 $target.removeClass(options.focusClass); 4780 $target.removeClass(options.activeClass); 4781 }, 4782 mouseenter: function () { 4783 $target.addClass(options.hoverClass); 4784 }, 4785 mouseleave: function () { 4786 $target.removeClass(options.hoverClass); 4787 $target.removeClass(options.activeClass); 4788 }, 4789 "mousedown touchbegin": function () { 4790 if (!$el.is(":disabled")) { 4791 $target.addClass(options.activeClass); 4792 } 4793 }, 4794 "mouseup touchend": function () { 4795 $target.removeClass(options.activeClass); 4796 } 4797 }); 4798 } 4799 4800 /** 4801 * Remove the hover, focus, active classes. 4802 * 4803 * @param jQuery $el Element with classes 4804 * @param Object options Uniform options for the element 4805 */ 4806 function classClearStandard($el, options) { 4807 $el.removeClass(options.hoverClass + " " + options.focusClass + " " + options.activeClass); 4808 } 4809 4810 /** 4811 * Add or remove a class, depending on if it's "enabled" 4812 * 4813 * @param jQuery $el Element that has the class added/removed 4814 * @param String className Class or classes to add/remove 4815 * @param Boolean enabled True to add the class, false to remove 4816 */ 4817 function classUpdate($el, className, enabled) { 4818 if (enabled) { 4819 $el.addClass(className); 4820 } else { 4821 $el.removeClass(className); 4822 } 4823 } 4824 4825 /** 4826 * Updating the "checked" property can be a little tricky. This 4827 * changed in jQuery 1.6 and now we can pass booleans to .prop(). 4828 * Prior to that, one either adds an attribute ("checked=checked") or 4829 * removes the attribute. 4830 * 4831 * @param jQuery $tag Our Uniform span/div 4832 * @param jQuery $el Original form element 4833 * @param Object options Uniform options for this element 4834 */ 4835 function classUpdateChecked($tag, $el, options) { 4836 var c = "checked", 4837 isChecked = $el.is(":" + c); 4838 4839 if ($el.prop) { 4840 /* jQuery 1.6+ */ 4841 $el.prop(c, isChecked); 4842 } else { 4843 /* jQuery 1.5 and below */ 4844 if (isChecked) { 4845 $el.attr(c, c); 4846 } else { 4847 $el.removeAttr(c); 4848 } 4849 } 4850 4851 classUpdate($tag, options.checkedClass, isChecked); 4852 } 4853 4854 /** 4855 * Set or remove the "disabled" class for disabled elements, based on 4856 * if the 4857 * 4858 * @param jQuery $tag Our Uniform span/div 4859 * @param jQuery $el Original form element 4860 * @param Object options Uniform options for this element 4861 */ 4862 function classUpdateDisabled($tag, $el, options) { 4863 classUpdate($tag, options.disabledClass, $el.is(":disabled")); 4864 } 4865 4866 /** 4867 * Wrap an element inside of a container or put the container next 4868 * to the element. See the code for examples of the different methods. 4869 * 4870 * Returns the container that was added to the HTML. 4871 * 4872 * @param jQuery $el Element to wrap 4873 * @param jQuery $container Add this new container around/near $el 4874 * @param String method One of "after", "before" or "wrap" 4875 * @return $container after it has been cloned for adding to $el 4876 */ 4877 function divSpanWrap($el, $container, method) { 4878 switch (method) { 4879 case "after": 4880 /* Result: <element /> <container /> */ 4881 $el.after($container); 4882 return $el.next(); 4883 case "before": 4884 /* Result: <container /> <element /> */ 4885 $el.before($container); 4886 return $el.prev(); 4887 case "wrap": 4888 /* Result: <container> <element /> </container> */ 4889 $el.wrap($container); 4890 return $el.parent(); 4891 } 4892 4893 return null; 4894 } 4895 4896 4897 /** 4898 * Create a div/span combo for uniforming an element 4899 * 4900 * @param jQuery $el Element to wrap 4901 * @param Object options Options for the element, set by the user 4902 * @param Object divSpanConfig Options for how we wrap the div/span 4903 * @return Object Contains the div and span as properties 4904 */ 4905 function divSpan($el, options, divSpanConfig) { 4906 var $div, $span, id; 4907 4908 if (!divSpanConfig) { 4909 divSpanConfig = {}; 4910 } 4911 4912 divSpanConfig = $.extend({ 4913 bind: {}, 4914 divClass: null, 4915 divWrap: "wrap", 4916 spanClass: null, 4917 spanHtml: null, 4918 spanWrap: "wrap" 4919 }, divSpanConfig); 4920
4921 $div = $('<div />'); 4922 $span = $('<span />'); 4923 4924 /* Automatically hide this div/span if the element is hidden. */ 4925 /* Do not hide if the element is hidden because a parent is hidden. */ 4926 if (options.autoHide && $el.is(':hidden') && $el.css('display') === 'none') { 4927 $div.hide(); 4928 } 4929 4930 if (divSpanConfig.divClass) { 4931 $div.addClass(divSpanConfig.divClass); 4932 } 4933 4934 if (options.wrapperClass) { 4935 $div.addClass(options.wrapperClass); 4936 } 4937 4938 if (divSpanConfig.spanClass) { 4939 $span.addClass(divSpanConfig.spanClass); 4940 } 4941 4942 id = attrOrProp($el, 'id'); 4943 4944 if (options.useID && id) { 4945 attrOrProp($div, 'id', options.idPrefix + '-' + id); 4946 } 4947 4948 if (divSpanConfig.spanHtml) { 4949 $span.html(divSpanConfig.spanHtml); 4950 } 4951 4952 $div = divSpanWrap($el, $div, divSpanConfig.divWrap); 4953 $span = divSpanWrap($el, $span, divSpanConfig.spanWrap); 4954 classUpdateDisabled($div, $el, options); 4955 return { 4956 div: $div, 4957 span: $span 4958 }; 4959 } 4960 4961 4962 /** 4963 * Wrap an element with a span to apply a global wrapper class 4964 * 4965 * @param jQuery $el Element to wrap 4966 * @param object options 4967 * @return jQuery Wrapper element 4968 */ 4969 function wrapWithWrapperClass($el, options) { 4970 var $span; 4971 4972 if (!options.wrapperClass) { 4973 return null; 4974 } 4975 4976 $span = $('<span />').addClass(options.wrapperClass); 4977 $span = divSpanWrap($el, $span, "wrap"); 4978 return $span; 4979 } 4980 4981 4982 /** 4983 * Test if high contrast mode is enabled. 4984 * 4985 * In high contrast mode, background images can not be set and 4986 * they are always returned as 'none'. 4987 * 4988 * @return boolean True if in high contrast mode 4989 */ 4990 function highContrast() { 4991 var c, $div, el, rgb; 4992 4993 /* High contrast mode deals with white and black */ 4994 rgb = 'rgb(120,2,153)'; 4995 $div = $('<div style="width:0;height:0;color:' + rgb + '">'); 4996 $('body').append($div); 4997 el = $div.get(0); 4998 4999 /* $div.css() will get the style definition, not 5000 the actually displaying style */ 5001 if (window.getComputedStyle) { 5002 c = window.getComputedStyle(el, '').color; 5003 } else { 5004 c = (el.currentStyle || el.style || {}).color; 5005 } 5006 5007 $div.remove(); 5008 return c.replace(/ /g, '') !== rgb; 5009 } 5010 5011 5012 /** 5013 * Change text into safe HTML 5014 * 5015 * @param String text 5016 * @return String HTML version 5017 */ 5018 function htmlify(text) { 5019 if (!text) { 5020 return ""; 5021 } 5022 5023 return $('<span />').text(text).html(); 5024 } 5025 5026 /** 5027 * If not MSIE, return false. 5028 * If it is, return the version number. 5029 * 5030 * @return false|number 5031 */ 5032 function isMsie() { 5033 return navigator.cpuClass && !navigator.product; 5034 } 5035 5036 /** 5037 * Return true if this version of IE allows styling 5038 * 5039 * @return boolean 5040 */ 5041 function isMsieSevenOrNewer() { 5042 if (typeof window.XMLHttpRequest !== 'undefined') { 5043 return true; 5044 } 5045 5046 return false; 5047 } 5048 5049 /** 5050 * Test if the element is a multiselect 5051 * 5052 * @param jQuery $el Element 5053 * @return boolean true/false 5054 */ 5055 function isMultiselect($el) { 5056 var elSize; 5057 5058 if ($el[0].multiple) { 5059 return true; 5060 } 5061 5062 elSize = attrOrProp($el, "size"); 5063 5064 if (!elSize || elSize <= 1) { 5065 return false; 5066 } 5067 5068 return true; 5069 } 5070 5071 /** 5072 * Meaningless utility function. Used mostly for improving minification. 5073 * 5074 * @return false 5075 */ 5076 function returnFalse() { 5077 return false; 5078 } 5079 5080 /** 5081 * noSelect plugin, very slightly modified 5082 * http://mths.be/noselect v1.0.3 5083 * 5084 * @param jQuery $elem Element that we don't want to select 5085 * @param Object options Uniform options for the element 5086 */ 5087 function noSelect($elem, options) { 5088 var none = 'none'; 5089 bindMany($elem, options, { 5090 'selectstart dragstart mousedown': returnFalse 5091 }); 5092 5093 $elem.css({ 5094 MozUserSelect: none, 5095 msUserSelect: none, 5096 webkitUserSelect: none, 5097 userSelect: none 5098 }); 5099 } 5100 5101 /** 5102 * Updates the filename tag based on the value of the real input 5103 * element. 5104 * 5105 * @param jQuery $el Actual form element 5106 * @param jQuery $filenameTag Span/div to update 5107 * @param Object options Uniform options for this element 5108 */ 5109 function setFilename($el, $filenameTag, options) { 5110 var filename = $el.val(); 5111 5112 if (filename === "") { 5113 filename = options.fileDefaultHtml; 5114 } else { 5115 filename = filename.split(/[\/\\]+/); 5116 filename = filename[(filename.length - 1)]; 5117 } 5118 5119 $filenameTag.text(filename); 5120 } 5121 5122 5123 /** 5124 * Function from jQuery to swap some CSS values, run a callback, 5125 * then restore the CSS. Modified to pass JSLint and handle undefined 5126 * values with 'use strict'. 5127 * 5128 * @param jQuery $el Element 5129 * @param object newCss CSS values to swap out 5130 * @param Function callback Function to run 5131 */ 5132 function swap($elements, newCss, callback) { 5133 var restore, item; 5134 5135 restore = []; 5136 5137 $elements.each(function () { 5138 var name; 5139 5140 for (name in newCss) { 5141 if (Object.prototype.hasOwnProperty.call(newCss, name)) { 5142 restore.push({ 5143 el: this, 5144 name: name, 5145 old: this.style[name] 5146 }); 5147 5148 this.style[name] = newCss[name]; 5149 } 5150 } 5151 }); 5152 5153 callback(); 5154 5155 while (restore.length) { 5156 item = restore.pop(); 5157 item.el.style[item.name] = item.old; 5158 } 5159 } 5160 5161 5162 /** 5163 * The browser doesn't provide sizes of elements that are not visible. 5164 * This will clone an element and add it to the DOM for calculations. 5165 * 5166 * @param jQuery $el 5167 * @param String method 5168 */ 5169 function sizingInvisible($el, callback) { 5170 var targets; 5171 5172 /* We wish to target ourselves and any parents as long as 5173 they are not visible */ 5174 targets = $el.parents(); 5175 targets.push($el[0]); 5176 targets = targets.not(':visible'); 5177 swap(targets, { 5178 visibility: "hidden", 5179 display: "block", 5180 position: "absolute" 5181 }, callback); 5182 } 5183 5184 5185 /** 5186 * Standard way to unwrap the div/span combination from an element 5187 * 5188 * @param jQuery $el Element that we wish to preserve 5189 * @param Object options Uniform options for the element 5190 * @return Function This generated function will perform the given work 5191 */ 5192 function unwrapUnwrapUnbindFunction($el, options) { 5193 return function () { 5194 $el.unwrap().unwrap().unbind(options.eventNamespace); 5195 }; 5196 } 5197 5198 var allowStyling = true, /* False if IE6 or other unsupported browsers */ 5199 highContrastTest = false, /* Was the high contrast test ran? */ 5200 uniformHandlers = [ /* Objects that take care of "unification" */ 5201 { 5202 /* Buttons */ 5203 match: function ($el) { 5204 return $el.is("a, button, :submit, :reset, input[type='button']"); 5205 }, 5206 apply: function ($el, options) { 5207 var $div, defaultSpanHtml, ds, getHtml, doingClickEvent; 5208 defaultSpanHtml = options.submitDefaultHtml; 5209
5210 if ($el.is(":reset")) { 5211 defaultSpanHtml = options.resetDefaultHtml; 5212 } 5213 5214 if ($el.is("a, button")) { 5215 /* Use the HTML inside the tag */ 5216 getHtml = function () { 5217 return $el.html() || defaultSpanHtml; 5218 }; 5219 } else { 5220 /* Use the value property of the element */ 5221 getHtml = function () { 5222 return htmlify(attrOrProp($el, "value")) || defaultSpanHtml; 5223 }; 5224 } 5225 5226 ds = divSpan($el, options, { 5227 divClass: options.buttonClass, 5228 spanHtml: getHtml(), 5229 }); 5230 $div = ds.div; 5231 bindUi($el, $div, options); 5232 doingClickEvent = false; 5233 bindMany($div, options, { 5234 "click touchend": function () { 5235 var ev, res, target, href; 5236 5237 if (doingClickEvent) { 5238 return; 5239 } 5240 5241 if ($el.is(':disabled')) { 5242 return; 5243 } 5244 5245 doingClickEvent = true; 5246 5247 if ($el[0].dispatchEvent) { 5248 ev = document.createEvent("MouseEvents"); 5249 ev.initEvent("click", true, true); 5250 res = $el[0].dispatchEvent(ev); 5251 5252 if ($el.is('a') && res) { 5253 target = attrOrProp($el, 'target'); 5254 href = attrOrProp($el, 'href'); 5255 5256 if (!target || target === '_self') { 5257 document.location.href = href; 5258 } else { 5259 window.open(href, target); 5260 } 5261 } 5262 } else { 5263 $el.click(); 5264 } 5265 5266 doingClickEvent = false; 5267 } 5268 }); 5269 noSelect($div, options); 5270 return { 5271 remove: function () { 5272 /* Move $el out */ 5273 $div.after($el); 5274 5275 /* Remove div and span */ 5276 $div.remove(); 5277 5278 /* Unbind events */ 5279 $el.unbind(options.eventNamespace); 5280 return $el; 5281 }, 5282 update: function () { 5283 classClearStandard($div, options); 5284 classUpdateDisabled($div, $el, options); 5285 $el.detach(); 5286 ds.span.html(getHtml()).append($el); 5287 } 5288 }; 5289 } 5290 }, 5291 { 5292 /* Checkboxes */ 5293 match: function ($el) { 5294 return $el.is(":checkbox"); 5295 }, 5296 apply: function ($el, options) { 5297 var ds, $div, $span; 5298 ds = divSpan($el, options, { 5299 divClass: options.checkboxClass 5300 }); 5301 $div = ds.div; 5302 $span = ds.span; 5303 5304 /* Add focus classes, toggling, active, etc. */ 5305 bindUi($el, $div, options); 5306 bindMany($el, options, { 5307 "click touchend": function () { 5308 classUpdateChecked($span, $el, options); 5309 } 5310 }); 5311 classUpdateChecked($span, $el, options); 5312 return { 5313 remove: unwrapUnwrapUnbindFunction($el, options), 5314 update: function () { 5315 classClearStandard($div, options); 5316 $span.removeClass(options.checkedClass); 5317 classUpdateChecked($span, $el, options); 5318 classUpdateDisabled($div, $el, options); 5319 } 5320 }; 5321 } 5322 }, 5323 { 5324 /* File selection / uploads */ 5325 match: function ($el) { 5326 return $el.is(":file"); 5327 }, 5328 apply: function ($el, options) { 5329 var ds, $div, $filename, $button; 5330 5331 /* The "span" is the button */ 5332 ds = divSpan($el, options, { 5333 divClass: options.fileClass, 5334 spanClass: options.fileButtonClass, 5335 spanHtml: options.fileButtonHtml, 5336 spanWrap: "before" 5337 }); 5338 $div = ds.div; 5339 $button = ds.span; 5340 $filename = $("<span />").html(options.fileDefaultHtml); 5341 $filename.addClass(options.filenameClass); 5342 $filename = divSpanWrap($el, $filename, "before"); 5343 5344 /* Set the size */ 5345 if (!attrOrProp($el, "size")) { 5346 attrOrProp($el, "size", $div.width() / 10); 5347 } 5348 5349 /* Actions */ 5350 function filenameUpdate() { 5351 setFilename($el, $filename, options); 5352 } 5353 5354 bindUi($el, $div, options); 5355 5356 /* Account for input saved across refreshes */ 5357 filenameUpdate(); 5358 5359 /* IE7 doesn't fire onChange until blur or second fire. */ 5360 if (isMsie()) { 5361 /* IE considers browser chrome blocking I/O, so it 5362 suspends tiemouts until after the file has 5363 been selected. */ 5364 bindMany($el, options, { 5365 click: function () { 5366 $el.trigger("change"); 5367 setTimeout(filenameUpdate, 0); 5368 } 5369 }); 5370 } else { 5371 /* All other browsers behave properly */ 5372 bindMany($el, options, { 5373 change: filenameUpdate 5374 }); 5375 } 5376 5377 noSelect($filename, options); 5378 noSelect($button, options); 5379 return { 5380 remove: function () { 5381 /* Remove filename and button */ 5382 $filename.remove(); 5383 $button.remove(); 5384 5385 /* Unwrap parent div, remove events */ 5386 return $el.unwrap().unbind(options.eventNamespace); 5387 }, 5388 update: function () { 5389 classClearStandard($div, options); 5390 setFilename($el, $filename, options); 5391 classUpdateDisabled($div, $el, options); 5392 } 5393 }; 5394 } 5395 }, 5396 { 5397 /* Input fields (text) */ 5398 match: function ($el) {
5399 if ($el.is("input")) { 5400 var t = (" " + attrOrProp($el, "type") + " ").toLowerCase(), 5401 allowed = " color date datetime datetime-local email month number password search tel text time url week "; 5402 return allowed.indexOf(t) >= 0; 5403 } 5404 5405 return false; 5406 }, 5407 apply: function ($el, options) { 5408 var elType, $wrapper; 5409 5410 elType = attrOrProp($el, "type"); 5411 $el.addClass(options.inputClass); 5412 $wrapper = wrapWithWrapperClass($el, options); 5413 bindUi($el, $el, options); 5414 5415 if (options.inputAddTypeAsClass) { 5416 $el.addClass(elType); 5417 } 5418 5419 return { 5420 remove: function () { 5421 $el.removeClass(options.inputClass); 5422 5423 if (options.inputAddTypeAsClass) { 5424 $el.removeClass(elType); 5425 } 5426 5427 if ($wrapper) { 5428 $el.unwrap(); 5429 } 5430 }, 5431 update: returnFalse 5432 }; 5433 } 5434 }, 5435 { 5436 /* Radio buttons */ 5437 match: function ($el) { 5438 return $el.is(":radio"); 5439 }, 5440 apply: function ($el, options) { 5441 var ds, $div, $span; 5442 ds = divSpan($el, options, { 5443 divClass: options.radioClass 5444 }); 5445 $div = ds.div; 5446 $span = ds.span; 5447 5448 /* Add classes for focus, handle active, checked */ 5449 bindUi($el, $div, options); 5450 bindMany($el, options, { 5451 "click touchend": function () { 5452 /* Find all radios with the same name, then update 5453 them with $.uniform.update() so the right 5454 per-element options are used */ 5455 $.uniform.update($(':radio[name="' + attrOrProp($el, "name") + '"]')); 5456 } 5457 }); 5458 classUpdateChecked($span, $el, options); 5459 return { 5460 remove: unwrapUnwrapUnbindFunction($el, options), 5461 update: function () { 5462 classClearStandard($div, options); 5463 classUpdateChecked($span, $el, options); 5464 classUpdateDisabled($div, $el, options); 5465 } 5466 }; 5467 } 5468 }, 5469 { 5470 /* Select lists, but do not style multiselects here */ 5471 5472 match: function ($el) { 5473 if ($el.is("select") && !isMultiselect($el)) { 5474 return true; 5475 } 5476 5477 return false; 5478 }, 5479 apply: function ($el, options) { 5480 var ds, $div, $span, origElemWidth; 5481 5482 if (options.selectAutoWidth) { 5483 sizingInvisible($el, function () { 5484 origElemWidth = $el.width(); 5485 }); 5486 } 5487 5488 ds = divSpan($el, options, { 5489 divClass: options.selectClass, 5490 spanHtml: ($el.find(":selected:first") || $el.find("option:first")).html(), 5491 spanWrap: "before" 5492 }); 5493 $div = ds.div; 5494 $span = ds.span; 5495 5496 if (options.selectAutoWidth) { 5497 /* Use the width of the select and adjust the 5498 span and div accordingly */ 5499 sizingInvisible($el, function () { 5500 /* Force "display: block" - related to bug #287 */ 5501 swap($([ $span[0], $div[0] ]), { 5502 display: "block" 5503 }, function () { 5504 var spanPad; 5505 spanPad = $span.outerWidth() - $span.width(); 5506 $div.width(origElemWidth + spanPad); 5507 $span.width(origElemWidth); 5508 }); 5509 }); 5510 } else { 5511 /* Force the select to fill the size of the div */ 5512 $div.addClass('fixedWidth'); 5513 } 5514 5515 /* Take care of events */ 5516 bindUi($el, $div, options); 5517 bindMany($el, options, { 5518 change: function () { 5519 $span.html($el.find(":selected").html()); 5520 $div.removeClass(options.activeClass); 5521 }, 5522 "click touchend": function () { 5523 /* IE7 and IE8 may not update the value right 5524 until after click event - issue #238 */ 5525 var selHtml = $el.find(":selected").html(); 5526 5527 if ($span.html() !== selHtml) { 5528 /* Change was detected 5529 Fire the change event on the select tag */ 5530 $el.trigger('change'); 5531 } 5532 }, 5533 keyup: function () { 5534 $span.html($el.find(":selected").html()); 5535 } 5536 }); 5537 noSelect($span, options); 5538 return { 5539 remove: function () { 5540 /* Remove sibling span */ 5541 $span.remove(); 5542 5543 /* Unwrap parent div */ 5544 $el.unwrap().unbind(options.eventNamespace); 5545 return $el; 5546 }, 5547 update: function () { 5548 if (options.selectAutoWidth) { 5549 /* Easier to remove and reapply formatting */ 5550 $.uniform.restore($el); 5551 $el.uniform(options); 5552 } else { 5553 classClearStandard($div, options); 5554 5555 /* Reset current selected text */ 5556 $span.html($el.find(":selected").html()); 5557 classUpdateDisabled($div, $el, options); 5558 } 5559 } 5560 }; 5561 } 5562 }, 5563 { 5564 /* Select lists - multiselect lists only */ 5565 match: function ($el) {
5566 if ($el.is("select") && isMultiselect($el)) { 5567 return true; 5568 } 5569 5570 return false; 5571 }, 5572 apply: function ($el, options) { 5573 var $wrapper; 5574 5575 $el.addClass(options.selectMultiClass); 5576 $wrapper = wrapWithWrapperClass($el, options); 5577 bindUi($el, $el, options); 5578 5579 return { 5580 remove: function () { 5581 $el.removeClass(options.selectMultiClass); 5582 5583 if ($wrapper) { 5584 $el.unwrap(); 5585 } 5586 }, 5587 update: returnFalse 5588 }; 5589 } 5590 }, 5591 { 5592 /* Textareas */ 5593 match: function ($el) { 5594 return $el.is("textarea"); 5595 }, 5596 apply: function ($el, options) { 5597 var $wrapper; 5598 5599 $el.addClass(options.textareaClass); 5600 $wrapper = wrapWithWrapperClass($el, options); 5601 bindUi($el, $el, options); 5602 5603 return { 5604 remove: function () { 5605 $el.removeClass(options.textareaClass); 5606 5607 if ($wrapper) { 5608 $el.unwrap(); 5609 } 5610 }, 5611 update: returnFalse 5612 }; 5613 } 5614 } 5615 ]; 5616 5617 /* IE6 can't be styled - can't set opacity on select */ 5618 if (isMsie() && !isMsieSevenOrNewer()) { 5619 allowStyling = false; 5620 } 5621 5622 $.uniform = { 5623 /* Default options that can be overridden globally or when uniformed 5624 // globally: $.uniform.defaults.fileButtonHtml = "Pick A File"; 5625 // on uniform: $('input').uniform({fileButtonHtml: "Pick a File"}); */ 5626 defaults: { 5627 activeClass: "active", 5628 autoHide: true, 5629 buttonClass: "button", 5630 checkboxClass: "checker", 5631 checkedClass: "checked", 5632 disabledClass: "disabled", 5633 eventNamespace: ".uniform", 5634 fileButtonClass: "action", 5635 fileButtonHtml: "Choose File", 5636 fileClass: "uploader", 5637 fileDefaultHtml: "", 5638 filenameClass: "filename", 5639 focusClass: "focus", 5640 hoverClass: "hover", 5641 idPrefix: "uniform", 5642 inputAddTypeAsClass: true, 5643 inputClass: "uniform-input", 5644 radioClass: "radio", 5645 resetDefaultHtml: "Reset", 5646 resetSelector: false, /* We'll use our own function when you don't specify one */ 5647 selectAutoWidth: true, 5648 selectClass: "selector", 5649 selectMultiClass: "uniform-multiselect", 5650 submitDefaultHtml: "Submit", /* Only text allowed */ 5651 textareaClass: "uniform", 5652 useID: true, 5653 wrapperClass: null 5654 }, 5655 5656 /* All uniformed elements - DOM objects */ 5657 elements: [] 5658 }; 5659 5660 $.fn.uniform = function (options) { 5661 var el = this; 5662 options = $.extend({}, $.uniform.defaults, options); 5663 5664 /* If we are in high contrast mode, do not allow styling */ 5665 if (!highContrastTest) { 5666 highContrastTest = true; 5667 5668 if (highContrast()) { 5669 allowStyling = false; 5670 } 5671 } 5672 5673 /* Only uniform on browsers that work */ 5674 if (!allowStyling) { 5675 return this; 5676 } 5677 5678 /* Code for specifying a reset button */ 5679 if (options.resetSelector) { 5680 $(options.resetSelector).mouseup(function () { 5681 window.setTimeout(function () { 5682 $.uniform.update(el); 5683 }, 10); 5684 }); 5685 } 5686 5687 return this.each(function () { 5688 var $el = $(this), i, handler, callbacks; 5689 5690 /* Avoid uniforming elements already uniformed - just update */ 5691 if ($el.data("uniformed")) { 5692 $.uniform.update($el); 5693 return; 5694 } 5695 5696 /* See if we have any handler for this type of element */ 5697 for (i = 0; i < uniformHandlers.length; i = i + 1) { 5698 handler = uniformHandlers[i]; 5699 5700 if (handler.match($el, options)) { 5701 callbacks = handler.apply($el, options); 5702 $el.data("uniformed", callbacks); 5703 5704 /* Store element in our global array */ 5705 $.uniform.elements.push($el.get(0)); 5706 return; 5707 } 5708 } 5709 5710 /* Could not style this element */ 5711 }); 5712 }; 5713 5714 $.uniform.restore = $.fn.uniform.restore = function (elem) { 5715 if (elem === undef) { 5716 elem = $.uniform.elements; 5717 } 5718 5719 $(elem).each(function () { 5720 var $el = $(this), index, elementData; 5721 elementData = $el.data("uniformed"); 5722 5723 /* Skip elements that are not uniformed */ 5724 if (!elementData) { 5725 return; 5726 } 5727 5728 /* Unbind events, remove additional markup that was added */ 5729 elementData.remove(); 5730 5731 /* Remove item from list of uniformed elements */ 5732 index = $.inArray(this, $.uniform.elements); 5733 5734 if (index >= 0) { 5735 $.uniform.elements.splice(index, 1); 5736 } 5737 5738 $el.removeData("uniformed"); 5739 }); 5740 }; 5741 5742 $.uniform.update = $.fn.uniform.update = function (elem) { 5743 if (elem === undef) { 5744 elem = $.uniform.elements; 5745 } 5746 5747 $(elem).each(function () { 5748 var $el = $(this), elementData; 5749 elementData = $el.data("uniformed"); 5750 5751 /* Skip elements that are not uniformed */ 5752 if (!elementData) { 5753 return; 5754 } 5755 5756 elementData.update($el, elementData.options); 5757 }); 5758 }; 5759}(jQuery)); 5760; 5761(function ($, Drupal) { 5762 'use strict'; 5763 Drupal.behaviors.helloWorld = { 5764 attach: function (context, settings) { 5765 $('.hasDatepicker').datepicker(); 5766 $('.block-views-blockslider-partenaires-block').flexslider({ 5767 animation: "slide", 5768 animationLoop: true, 5769 slideshow: true, 5770 controlNav: false, 5771 itemMargin: 0, 5772 touch: true, 5773 maxItems: 1, 5774 move: 1, 5775 slideshowSpeed: 5000, 5776 animationSpeed: 600 5777 }); 5778 5779 $('.block-views-blockslider-partenaires-block-1').flexslider({ 5780 animation: "slide", 5781 animationLoop: true, 5782 slideshow: true, 5783 controlNav: false, 5784 itemMargin: 0, 5785 touch: true, 5786 maxItems: 1, 5787 move: 1, 5788 slideshowSpeed: 5000, 5789 animationSpeed: 600 5790 }); 5791
5792 $('#block-views-slider-hp-block').flexslider({ 5793 animation: "slide", 5794 animationLoop: true, 5795 maxItems: 1, 5796 move: 1, 5797 controlNav: false, 5798 slideshow: true, 5799 slideshowSpeed: 8000, 5800 animationSpeed: 600, 5801 before: function (slider) { 5802 $('#block-views-slider-hp-block-1').flexslider(slider.animatingTo); 5803 } 5804 }); 5805 5806 $('#block-views-slider-hp-block-1').flexslider({ 5807 animation: "fade", 5808 animationLoop: true, 5809 animationSpeed: 0, 5810 slideshow: true, 5811 slideshowSpeed: 8000, 5812 controlNav: false, 5813 maxItems: 1, 5814 move: 1, 5815 directionNav: false, 5816 before: function (slider) { 5817 $('#block-views-slider-hp-block').flexslider(slider.animatingTo); 5818 } 5819 }); 5820 5821 $('#block-views-profil-block').flexslider({ 5822 animation: "slide", 5823 animationLoop: true, 5824 slideshow: true, 5825 controlNav: false, 5826 itemMargin: 0, 5827 touch: true, 5828 maxItems: 1, 5829 move: 1, 5830 slideshowSpeed: 8000, 5831 animationSpeed: 600 5832 }); 5833 5834 $('#block-views-a-la-une-block').flexslider({ 5835 animation: "slide", 5836 animationLoop: true, 5837 slideshow: true, 5838 controlNav: false, 5839 itemMargin: 0, 5840 touch: true, 5841 maxItems: 1, 5842 move: 1, 5843 slideshowSpeed: 6000, 5844 animationSpeed: 600, 5845 directionNav: true 5846 }); 5847 5848 /* 5849 * Block Chiffres pour desktop, tablet & mobile 5850 * 5851 */ 5852 5853 $('.homepage #block-views-chiffres-block').flexslider({ 5854 animation: "slide", 5855 animationLoop: true, 5856 slideshow: true, 5857 controlNav: false, 5858 itemWidth: 202, 5859 itemMargin: 0, 5860 touch: true, 5861 maxItems: 4, 5862 move: 1, 5863 slideshowSpeed: 5000, 5864 animationSpeed: 600 5865 }); 5866 5867 5868 5869 $('.tablet-home #block-views-chiffres-block').flexslider({ 5870 animation: "slide", 5871 animationLoop: true, 5872 slideshow: true, 5873 controlNav: false, 5874 startAt: 0, 5875 itemWidth: 190, 5876 itemMargin: 0, 5877 touch: true, 5878 maxItems: 4, 5879 move: 1, 5880 slideshowSpeed: 5000, 5881 animationSpeed: 600 5882 }); 5883 5884 $('.mobile #block-views-chiffres-block').flexslider({ 5885 animation: "slide", 5886 animationLoop: true, 5887 slideshow: true, 5888 controlNav: false, 5889 itemWidth: 20, 5890 itemHeight: 20, 5891 itemMargin: 0, 5892 touch: true, 5893 maxItems: 1, 5894 move: 1, 5895 slideshowSpeed: 5000, 5896 animationSpeed: 600 5897 }); 5898 5899 5900 5901 /* 5902 * Block twitter 5903 * 5904 */ 5905 $('#block-enac-main-enac-block-twitter').flexslider({ 5906 animation: "slide", 5907 animationLoop: true, 5908 slideshow: true, 5909 controlNav: false, 5910 itemMargin: 0, 5911 touch: true, 5912 maxItems: 1, 5913 move: 1, 5914 slideshowSpeed: 6000, 5915 animationSpeed: 600 5916 }); 5917 5918 $('#wrapper-backgroundimage').flexslider({ 5919 animation: "fade", 5920 animationLoop: false, 5921 slideshow: false, 5922 controlNav: true, 5923 manualControls: ".controls-slide li", 5924 itemMargin: 0, 5925 touch: false, 5926 maxItems: 1, 5927 move: 1, 5928 slideshowSpeed: 150000, 5929 animationSpeed: 0, 5930 directionNav: false, 5931 sync: "#inner-gmap" 5932 }); 5933 5934 $('#inner-gmap').flexslider({ 5935 animation: "fade", 5936 animationLoop: false, 5937 slideshow: false, 5938 controlNav: false, 5939 manualControls: ".controls-slide li", 5940 itemMargin: 0, 5941 touch: true, 5942 maxItems: 1, 5943 move: 1, 5944 slideshowSpeed: 15000, 5945 animationSpeed: 1000, 5946 directionNav: false 5947 }); 5948 5949 5950 $('#block-menu-menu-menu-header-2 ul li.dropdown >a').click(function (e) { 5951 e.preventDefault(); 5952 if ($(this).parent().hasClass('open')) { 5953 $(this).parent().removeClass('open'); 5954 } 5955 else { 5956 $('#block-menu-menu-menu-header-2 ul li.dropdown').removeClass('open'); 5957 $(this).parent().addClass('open'); 5958 } 5959 }); 5960 5961 5962 /* 5963 5964 $('#block-menu-block-1 ul li.dropdown >a').click(function (f) { 5965 f.preventDefault(); 5966 if ($(this).parent().hasClass('open')) { 5967 $(this).parent().removeClass('open'); 5968 } 5969 else { 5970 $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 5971 $(this).parent().addClass('open'); 5972 } 5973 }); 5974 */ 5975 /* 5976 * Js pour menu-block-1 5977 */ 5978 5979 $('#block-menu-block-1 ul li.dropdown >a .caret').click(function (f) { 5980 f.preventDefault(); 5981 if ($(this).parent().parent().hasClass('open')) { 5982 $(this).parent().parent().removeClass('open'); 5983 } 5984 else { 5985 $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 5986 $(this).parent().parent().addClass('open'); 5987 } 5988 }); 5989 5990 5991 // $.ajax({ 5992 // url: Drupal.settings.basePath + 'ajax/blocks/flicker-block', 5993 // dataType: 'json', 5994 // success: function (obj) { 5995 // $('.gallerie-photo').html(obj.block); 5996 // } 5997 // }); 5998 5999 6000 /* 6001 * Js pour page organigramme 6002 * 6003 */ 6004 $('.field-collection-container .field-type-text-with-summary').hide(); 6005 $('.field-collection-container .field-type-text').click(function (e) { 6006 e.preventDefault(); 6007 $(this).next('.field-collection-container div.field-type-text-with-summary').toggle(); 6008 $('.field-collection-container .field-type-text').not($(this)).removeClass('ouvert'); 6009 $(this).toggleClass('ouvert'); 6010 $('.field-collection-container .field-type-text-with-summary').not($(this).next(' .field-collection-container div.field-type-text-with-summary')).hide(); 6011 }); 6012 6013 6014 /* 6015 * Page Offres demploi 6016 */ 6017 $('.offres-details').hide(); 6018 $('.offres-titre').click(function (k) { 6019 6020 k.preventDefault(); 6021 6022 $(this).next('div.offres-details').toggle(); 6023 6024 $('.offres-titre').not($(this)).removeClass('ouvert'); 6025 $(this).toggleClass('ouvert'); 6026 6027 $('.offres-details').not($(this).next('div.offres-details')).hide(); 6028 6029 }); 6030 6031 6032 // $(".text").hide(); 6033 // $('.view-content h3').click(function (k) { 6034 // var text = $(this).text(); 6035 // var text = text.replace("'", '039'); 6036 // var text = text.replace(/\s+/g, '-'); 6037 // $(".text").not($('.'+text).parent().parent()).hide(); 6038 // $('.'+text).parent().parent().toggle(); 6039 // $(this).toggleClass('ouvert'); 6040 // $('.view-content h3').not($(this)).removeClass('ouvert'); 6041 // }); 6042 6043 /* 6044 * Mobile: Select theme sur la page d'accueil 6045 */ 6046 6047 $('.mobile .click-content-theme').hide(); 6048 $('.mobile .click-theme').click(function (event) { 6049 6050 event.preventDefault(); 6051 6052 /* $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); */ 6053 $(this).next('.mobile div.click-content-theme').toggle(); 6054 $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); 6055 $('.mobile div.click-theme').not($(this)).show(); 6056 /* $('.mobile .click-theme').hide(); */ 6057 6058 /* $('.offres-titre').removeClass('ouvert'); */ 6059 $('.mobile .click-theme').not($(this)).removeClass('ouvert'); 6060 6061 $(this).toggleClass('ouvert'); 6062 /* $('.offres-titre').not($(this).next('div.offres-titre')).removeClass('ouvert'); */ 6063 6064 $('.mobile .click-content-theme').not($(this).next('.mobile div.click-content-theme')).hide(); 6065 6066 /* $(this).removeClass('ouvert'); */ 6067 }); 6068 6069 /* 6070 * JS pour page print: 6071 * hide title when fields in views are empty 6072 */ 6073 6074 $(" .content .view").each(function (index) { 6075 if ($.trim($(this).html()) == "") { 6076 $(this).parent().parent().find('.title').hide(); 6077 } 6078 }); 6079 6080 6081 /* 6082 * Recherche pour mobile 6083 */ 6084 6085 $('.search-logo .search-show #block-search-form').hide(); 6086 $('.search-logo .search-click').click(function (test) { 6087 6088 test.preventDefault(); 6089 6090 $('div.search-click').not($(this)).show(); 6091 $('.search-click').not($(this)).removeClass('ouvert'); 6092 $(this).toggleClass('ouvert'); 6093 6094 $('.search-logo .search-show #block-search-form').show(); 6095 6096 $('div.search-click').hide(); 6097 6098 }); 6099 6100 6101 /*resize tablet */ 6102 var isDesktop = window.matchMedia("(min-width: 993px)"); 6103 6104 if (isDesktop.matches) { 6105 /* Conditional script here */ 6106 6107 6108 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)) { 6109 6110 $('#block-menu-block-1 .block-title > a').css('font-size', '20px'); 6111 6112 } 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)) { 6113 6114 $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 6115 6116 } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 31) { 6117 6118 $('#block-menu-block-1 .block-title > a').css('font-size', '16px'); 6119 6120 } else { 6121 6122 $('#block-menu-block-1 .block-title > a').css('font-size', '24px'); 6123 } 6124 6125 } 6126 6127 6128 /* resize tablet */ 6129 var isTablet = window.matchMedia("(min-width: 768px) and (max-width: 992px)"); 6130 6131 if (isTablet.matches) { 6132 6133 6134 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)) { 6135 6136 $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 6137 6138 } 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)) { 6139 6140 $('#block-menu-block-1 .block-title > a').css('font-size', '15px'); 6141 6142 } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 30) { 6143 6144 $('#block-menu-block-1 .block-title > a').css('font-size', '12px'); 6145 6146 } else { 6147 6148 $('#block-menu-block-1 .block-title > a').css('font-size', '19px'); 6149 } 6150 6151 } 6152 6153 6154 6155 if ($('#back-top').height('98')) { 6156 $('#back-top').hide(); 6157 } 6158 6159 6160 /* bloc-contact */ 6161 var x = $('.image-email').parent(); 6162 6163 if ($(x).find('.field-content > a').length > 0) { 6164 var target = $(x).find('.field-content > a').attr("href"); 6165 if (target.length <= 7) { 6166 $('.image-email').remove(); 6167 } 6168 } 6169 6170 var y = $('.image-phone').parent(); 6171 if ($(y).find('.field-content > span').length > 0) { 6172 var target_2 = $(y).find('.field-content > span').text(); 6173 if (target_2.length <= 0) { 6174 $('.image-phone').remove(); 6175 } 6176 } 6177 var z = $('.image-phone').parent(); 6178 if ($(z).find('.field-content .tel-mobile > a').length > 0) { 6179 var target_3 = $(z).find('.field-content .tel-mobile > a').attr("href"); 6180 if (target_3.length <= 4) { 6181 $('.image-phone').remove(); 6182 } 6183 } 6184 6185 /* scroll body to 0px on click */ 6186 $('#back-top a').click(function () { 6187 $("html, body").animate({ scrollTop: 0 }, "slow"); 6188 return false;
6189 }); 6190 6191 6192 6193 $(window).scroll(function () { 6194 if ($(this).scrollTop() > 100) { 6195 $('#back-top').fadeIn(); 6196 } else { 6197 $('#back-top').fadeOut(); 6198 } 6199 }); 6200 6201 } 6202 } 6203}(jQuery, Drupal)); 6204 6205// $('#block-menu-menu-menu-header-2 ul li.dropdown >a').click(function (e) { 6206// e.preventDefault(); 6207// if ($(this).parent().hasClass('open')) { 6208// $(this).parent().removeClass('open'); 6209// } 6210// else { 6211// $('#block-menu-menu-menu-header-2 ul li.dropdown').removeClass('open'); 6212// $(this).parent().addClass('open'); 6213// } 6214// }); 6215// 6216// } 6217// /* 6218// 6219// $('#block-menu-block-1 ul li.dropdown >a').click(function (f) { 6220// f.preventDefault(); 6221// if ($(this).parent().hasClass('open')) { 6222// $(this).parent().removeClass('open'); 6223// } 6224// else { 6225// $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 6226// $(this).parent().addClass('open'); 6227// } 6228// }); 6229// */ 6230// /* 6231// * Js pour menu-block-1 6232// */ 6233// 6234// $('#block-menu-block-1 ul li.dropdown >a .caret').click(function (f) { 6235// f.preventDefault(); 6236// if ($(this).parent().parent().hasClass('open')) { 6237// $(this).parent().parent().removeClass('open'); 6238// } 6239// else { 6240// $('#block-menu-block-1 ul li.dropdown').removeClass('open'); 6241// $(this).parent().parent().addClass('open'); 6242// } 6243// }); 6244// 6245// 6246// $.ajax({ 6247// url: Drupal.settings.basePath + 'ajax/blocks/flicker-block', 6248// dataType: 'json', 6249// success: function (obj) { 6250// $('.gallerie-photo').html(obj.block); 6251// } 6252// }); 6253// 6254// 6255// /* 6256// * Js pour page organigramme 6257// * 6258// */ 6259// $('.field-collection-container .field-type-text-with-summary').hide(); 6260// $('.field-collection-container .field-type-text').click(function (e) { 6261// e.preventDefault(); 6262// $(this).next('.field-collection-container div.field-type-text-with-summary').toggle(); 6263// $('.field-collection-container .field-type-text').not($(this)).removeClass('ouvert'); 6264// $(this).toggleClass('ouvert'); 6265// $('.field-collection-container .field-type-text-with-summary').not($(this).next(' .field-collection-container div.field-type-text-with-summary')).hide(); 6266// }); 6267// 6268// 6269// /* 6270// * Page Offres demploi 6271// */ 6272// 6273// $('.offres-details').hide(); 6274// $('.offres-titre').click(function (k) { 6275// 6276// k.preventDefault(); 6277// 6278// $(this).next('div.offres-details').toggle(); 6279// 6280// $('.offres-titre').not($(this)).removeClass('ouvert'); 6281// $(this).toggleClass('ouvert'); 6282// 6283// $('.offres-details').not($(this).next('div.offres-details')).hide(); 6284// 6285// 6286// 6287// 6288// }); 6289// 6290// 6291// $(".text").hide(); 6292// $('.view-content h3').click(function (k) { 6293// var text = $(this).text(); 6294// var text = text.replace("'", '039'); 6295// var text = text.replace(/\s+/g, '-'); 6296// $(".text").not($('.'+text).parent().parent()).hide(); 6297// $('.'+text).parent().parent().toggle(); 6298// $(this).toggleClass('ouvert'); 6299// $('.view-content h3').not($(this)).removeClass('ouvert'); 6300// }); 6301// 6302// /* 6303// * Mobile: Select theme sur la page d'accueil 6304// */ 6305// 6306// $('.mobile .click-content-theme').hide(); 6307// $('.mobile .click-theme').click(function (event) { 6308// 6309// event.preventDefault(); 6310// 6311// /* $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); */ 6312// $(this).next('.mobile div.click-content-theme').toggle(); 6313// $('.mobile .click-theme').not($(this).next('.mobile div.click-theme')).hide(); 6314// $('.mobile div.click-theme').not($(this)).show(); 6315// /* $('.mobile .click-theme').hide(); */ 6316// 6317// /* $('.offres-titre').removeClass('ouvert'); */ 6318// $('.mobile .click-theme').not($(this)).removeClass('ouvert'); 6319// 6320// $(this).toggleClass('ouvert'); 6321// /* $('.offres-titre').not($(this).next('div.offres-titre')).removeClass('ouvert'); */ 6322// 6323// $('.mobile .click-content-theme').not($(this).next('.mobile div.click-content-theme')).hide(); 6324// 6325// /* $(this).removeClass('ouvert'); */ 6326// }); 6327// 6328// /* 6329// * JS pour page print: 6330// * hide title when fields in views are empty 6331// */ 6332// 6333// $(" .content .view").each(function (index) { 6334// if ($.trim($(this).html()) == "") { 6335// $(this).parent().parent().find('.title').hide(); 6336// } 6337// }); 6338// 6339// 6340// /* 6341// * Recherche pour mobile
6342// */ 6343// 6344// $('.search-logo .search-show #block-search-form').hide(); 6345// $('.search-logo .search-click').click(function (test) { 6346// 6347// test.preventDefault(); 6348// 6349// $('div.search-click').not($(this)).show(); 6350// $('.search-click').not($(this)).removeClass('ouvert'); 6351// $(this).toggleClass('ouvert'); 6352// 6353// $('.search-logo .search-show #block-search-form').show(); 6354// 6355// $('div.search-click').hide(); 6356// 6357// }); 6358// 6359// 6360// }); 6361// 6362// 6363// /* 6364// * Resize titre du menu-block 6365// */ 6366// 6367// $(document).ready(function () { 6368// 6369// /*resize tablet */ 6370// var isDesktop = window.matchMedia("(min-width: 993px)"); 6371// 6372// if (isDesktop.matches) { 6373// /* Conditional script here */ 6374// 6375// 6376// 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)) { 6377// 6378// $('#block-menu-block-1 .block-title > a').css('font-size', '20px'); 6379// 6380// } 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)) { 6381// 6382// $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 6383// 6384// } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 31) { 6385// 6386// $('#block-menu-block-1 .block-title > a').css('font-size', '16px'); 6387// 6388// } else { 6389// 6390// $('#block-menu-block-1 .block-title > a').css('font-size', '24px'); 6391// } 6392// 6393// } 6394// 6395// 6396// /* resize tablet */ 6397// var isTablet = window.matchMedia("(min-width: 768px) and (max-width: 992px)"); 6398// 6399// if (isTablet.matches) { 6400// 6401// 6402// 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)) { 6403// 6404// $('#block-menu-block-1 .block-title > a').css('font-size', '17px'); 6405// 6406// } 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)) { 6407// 6408// $('#block-menu-block-1 .block-title > a').css('font-size', '15px'); 6409// 6410// } else if ($('.region-sidebar-second #block-menu-block-1 .block-title > a').text().length > 30) { 6411// 6412// $('#block-menu-block-1 .block-title > a').css('font-size', '12px'); 6413// 6414// } else { 6415// 6416// $('#block-menu-block-1 .block-title > a').css('font-size', '19px'); 6417// } 6418// 6419// } 6420// 6421// 6422// }); 6423// 6424// $(document).ready(function () { 6425// if ($('#back-top').height('98')) { 6426// $('#back-top').hide(); 6427// } 6428// 6429// 6430// /* bloc-contact */ 6431// var x = $('.image-email').parent(); 6432// 6433// if ($(x).find('.field-content > a').length > 0) { 6434// var target = $(x).find('.field-content > a').attr("href"); 6435// if (target.length <= 7) { 6436// $('.image-email').remove(); 6437// } 6438// } 6439// 6440// var y = $('.image-phone').parent(); 6441// if ($(y).find('.field-content > span').length > 0) { 6442// var target_2 = $(y).find('.field-content > span').text(); 6443// if (target_2.length <= 0) { 6444// $('.image-phone').remove(); 6445// } 6446// } 6447// var z = $('.image-phone').parent(); 6448// if ($(z).find('.field-content .tel-mobile > a').length > 0) { 6449// var target_3 = $(z).find('.field-content .tel-mobile > a').attr("href"); 6450// if (target_3.length <= 4) { 6451// $('.image-phone').remove(); 6452// } 6453// } 6454// 6455// /* scroll body to 0px on click */ 6456// $('#back-top a').click(function () { 6457// $("html, body").animate({ scrollTop: 0 }, "slow"); 6458// return false;
6459// }); 6460// 6461// 6462// 6463// 6464// }); 6465// 6466// $(window).scroll(function () { 6467// if ($(this).scrollTop() > 100) { 6468// $('#back-top').fadeIn(); 6469// } else { 6470// $('#back-top').fadeOut(); 6471// } 6472// }); 6473// 6474// }(jQuery, Drupal); 6475;
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.