PageSourceSearch

https://goodwillinc.org/wp-content/themes/business-times/js/jquery.sidr.js?ver=2.2.1

js goodwillinc.org collected 2026-10-08 16:16:17 UTC 18,872 bytes, 657 lines download raw bytes

1(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2'use strict';
3
4var _sidr = require('./js/sidr');
5
6var _sidr2 = _interopRequireDefault(_sidr);
7
8var _fnSidr = require('./js/fnSidr');
9
10var _fnSidr2 = _interopRequireDefault(_fnSidr);
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14/*
15 * Sidr
16 * https://github.com/artberri/sidr
17 *
18 * Copyright (c) 2013-2016 Alberto Varela
19 * Licensed under the MIT license.
20 */
21
22var $ = jQuery;
23
24$.sidr = _sidr2.default;
25$.fn.sidr = _fnSidr2.default;
26
27},{"./js/fnSidr":3,"./js/sidr":6}],2:[function(require,module,exports){
28'use strict';
29
30Object.defineProperty(exports, "__esModule", {
31  value: true
32});
33
34var _menu = require('./menu');
35
36var _menu2 = _interopRequireDefault(_menu);
37
38function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
40var $ = jQuery;
41
42function execute(action, name, callback) {
43  var sidr = new _menu2.default(name);
44
45  switch (action) {
46    case 'open':
47      sidr.open(callback);
48      break;
49    case 'close':
50      sidr.close(callback);
51      break;
52    case 'toggle':
53      sidr.toggle(callback);
54      break;
55    default:
56      $.error('Method ' + action + ' does not exist on jQuery.sidr');
57      break;
58  }
59}
60
61exports.default = execute;
62
63},{"./menu":5}],3:[function(require,module,exports){
64'use strict';
65
66Object.defineProperty(exports, "__esModule", {
67  value: true
68});
69
70var _helper = require('./helper');
71
72var _helper2 = _interopRequireDefault(_helper);
73
74var _status = require('./status');
75
76var _status2 = _interopRequireDefault(_status);
77
78var _sidr = require('./sidr');
79
80var _sidr2 = _interopRequireDefault(_sidr);
81
82function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
83
84var $ = jQuery;
85
86function fillContent($sideMenu, settings) {
87  // The menu content
88  if (typeof settings.source === 'function') {
89    var newContent = settings.source(name);
90
91    $sideMenu.html(newContent);
92  } else if (typeof settings.source === 'string' && _helper2.default.isUrl(settings.source)) {
93    $.get(settings.source, function (data) {
94      $sideMenu.html(data);
95    });
96  } else if (typeof settings.source === 'string') {
97    var htmlContent = '',
98        selectors = settings.source.split(',');
99
100    $.each(selectors, function (index, element) {
101      htmlContent += '<div class="sidr-inner">' + $(element).html() + '</div>';
102    });
103
104    // Renaming ids and classes
105    if (settings.renaming) {
106      var $htmlContent = $('<div />').html(htmlContent);
107
108      $htmlContent.find('*').each(function (index, element) {
109        var $element = $(element);
110
111        _helper2.default.addPrefixes($element);
112      });
113      htmlContent = $htmlContent.html();
114    }
115
116    $sideMenu.html(htmlContent);
117  } else if (settings.source !== null) {
118    $.error('Invalid Sidr Source');
119  }
120
121  return $sideMenu;
122}
123
124function fnSidr(options) {
125  var transitions = _helper2.default.transitions,
126      settings = $.extend({
127    name: 'sidr', // Name for the 'sidr'
128    speed: 200, // Accepts standard jQuery effects speeds (i.e. fast, normal or milliseconds)
129    side: 'left', // Accepts 'left' or 'right'
130    source: null, // Override the source of the content.
131    renaming: true, // The ids and classes will be prepended with a prefix when loading existent content
132    body: 'body', // Page container selector,
133    displace: true, // Displace the body content or not
134    timing: 'ease', // Timing function for CSS transitions
135    method: 'toggle', // The method to call when element is clicked
136    onOpen: function onOpen() {},
137    // Callback when sidr start opening
138    onClose: function onClose() {},
139    // Callback when sidr start closing
140    onOpenEnd: function onOpenEnd() {},
141    // Callback when sidr end opening
142    onCloseEnd: function onCloseEnd() {} // Callback when sidr end closing
143
144  }, options),
145      name = settings.name,
146      $sideMenu = $('#' + name);
147
148  // If the side menu do not exist create it
149  if ($sideMenu.length === 0) {
150    $sideMenu = $('<div />').attr('id', name).appendTo($('body'));
151  }
152
153  // Add transition to menu if are supported
154  if (transitions.supported) {
155    $sideMenu.css(transitions.property, settings.side + ' ' + settings.speed / 1000 + 's ' + settings.timing);
156  }
157
158  // Adding styles and options
159  $sideMenu.addClass('sidr').addClass(settings.side).data({
160    speed: settings.speed,
161    side: settings.side,
162    body: settings.body,
163    displace: settings.displace,
164    timing: settings.timing,
165    method: settings.method,
166    onOpen: settings.onOpen,
167    onClose: settings.onClose,
168    onOpenEnd: settings.onOpenEnd,
169    onCloseEnd: settings.onCloseEnd
170  });
171
172  $sideMenu = fillContent($sideMenu, settings);
173
174  return this.each(function () {
175    var $this = $(this),
176        data = $this.data('sidr'),
177        flag = false;
178
179    // If the plugin hasn't been initialized yet
180    if (!data) {
181      _status2.default.moving = false;
182      _status2.default.opened = false;
183
184      $this.data('sidr', name);
185
186      $this.bind('touchstart click', function (event) {
187        event.preventDefault();
188
189        if (!flag) {
190          flag = true;
191          (0, _sidr2.default)(settings.method, name);
192
193          setTimeout(function () {
194            flag = false;
195          }, 100);
196        }
197      });
198    }
199  });
200}
201
202exports.default = fnSidr;
203
204},{"./helper":4,"./sidr":6,"./status":7}],4:[function(require,module,exports){
205'use strict';
206
207Object.defineProperty(exports, "__esModule", {
208  value: true
209});
210var helper = {
211  // Check for valids urls
212  // From : http://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-an-url
213
214  isUrl: function isUrl(str) {
215    var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
216    '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' + // domain name
217    '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
218    '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
219    '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
220    '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
221
222    if (pattern.test(str)) {
223      return true;
224    } else {
225      return false;
226    }
227  },
228
229  // Add sidr prefixes
230  addPrefixes: function addPrefixes($element) {
231    this.addPrefix($element, 'id');
232    this.addPrefix($element, 'class');
233    $element.removeAttr('style');
234  },
235  addPrefix: function addPrefix($element, attribute) {
236    var toReplace = $element.attr(attribute);
237
238    if (typeof toReplace === 'string' && toReplace !== '' && toReplace !== 'sidr-inner') {
239      $element.attr(attribute, toReplace.replace(/([A-Za-z0-9_.\-]+)/g, 'sidr-' + attribute + '-$1'));
240    }
241  },
242
243  // Check if transitions is supported
244  transitions: function () {
245    var body = document.body || document.documentElement,
246        style = body.style,
247        supported = false,
248        property = 'transition';
249
250    if (property in style) {
251      supported = true;
252    } else {
253      (function () {
254        var prefixes = ['moz', 'webkit', 'o', 'ms'],
255            prefix = undefined,
256            i = undefined;
257
258        property = property.charAt(0).toUpperCase() + property.substr(1);
259        supported = function () {
260          for (i = 0; i < prefixes.length; i++) {
261            prefix = prefixes[i];
262            if (prefix + property in style) {
263              return true;
264            }
265          }
266
267          return false;
268        }();
269        property = supported ? '-' + prefix.toLowerCase() + '-' + property.toLowerCase() : null;
270      })();
271    }
272
273    return {
274      supported: supported,
275      property: property
276    };
277  }()
278};
279
280exports.default = helper;
281
282},{}],5:[function(require,module,exports){
283'use strict';
284
285var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*eslint callback-return: 0*/
286
287Object.defineProperty(exports, "__esModule", {
288  value: true
289});
290
291var _status = require('./status');
292
293var _status2 = _interopRequireDefault(_status);
294
295var _helper = require('./helper');
296
297var _helper2 = _interopRequireDefault(_helper);
298
299function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
300
301function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
302
303var $ = jQuery;
304
305var bodyAnimationClass = 'sidr-animating',
306    openAction = 'open',
307    closeAction = 'close',
308    transitionEndEvent = 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend';
309
310var Menu = function () {
311  function Menu(name) {
312    _classCallCheck(this, Menu);
313
314    this.name = name;
vendor: 7,461 bytes, lines 315-589
315    this.item = $('#' + name);
316    this.openClass = name === 'sidr' ? 'sidr-open' : 'sidr-open ' + name + '-open';
317    this.menuWidth = this.item.outerWidth(true);
318    this.speed = this.item.data('speed');
319    this.side = this.item.data('side');
320    this.displace = this.item.data('displace');
321    this.timing = this.item.data('timing');
322    this.method = this.item.data('method');
323    this.onOpenCallback = this.item.data('onOpen');
324    this.onCloseCallback = this.item.data('onClose');
325    this.onOpenEndCallback = this.item.data('onOpenEnd');
326    this.onCloseEndCallback = this.item.data('onCloseEnd');
327    this.body = $(this.item.data('body'));
328  }
329
330  _createClass(Menu, [{
331    key: 'getAnimation',
332    value: function getAnimation(action, element) {
333      var animation = {},
334          prop = this.side;
335
336      if (action === 'open' && element === 'body') {
337        animation[prop] = this.menuWidth + 'px';
338      } else if (action === 'close' && element === 'menu') {
339        animation[prop] = '-' + this.menuWidth + 'px';
340      } else {
341        animation[prop] = 0;
342      }
343
344      return animation;
345    }
346  }, {
347    key: 'prepareBody',
348    value: function prepareBody(action) {
349      var prop = action === 'open' ? 'hidden' : '';
350
351      // Prepare page if container is body
352      if (this.body.is('body')) {
353        var $html = $('html'),
354            scrollTop = $html.scrollTop();
355
356        $html.css('overflow-x', prop).scrollTop(scrollTop);
357      }
358    }
359  }, {
360    key: 'openBody',
361    value: function openBody() {
362      if (this.displace) {
363        var transitions = _helper2.default.transitions,
364            $body = this.body;
365
366        if (transitions.supported) {
367          $body.css(transitions.property, this.side + ' ' + this.speed / 1000 + 's ' + this.timing).css(this.side, 0).css({
368            width: $body.width(),
369            position: 'absolute'
370          });
371          $body.css(this.side, this.menuWidth + 'px');
372        } else {
373          var bodyAnimation = this.getAnimation(openAction, 'body');
374
375          $body.css({
376            width: $body.width(),
377            position: 'absolute'
378          }).animate(bodyAnimation, {
379            queue: false,
380            duration: this.speed
381          });
382        }
383      }
384    }
385  }, {
386    key: 'onCloseBody',
387    value: function onCloseBody() {
388      var transitions = _helper2.default.transitions,
389          resetStyles = {
390        width: '',
391        position: '',
392        right: '',
393        left: ''
394      };
395
396      if (transitions.supported) {
397        resetStyles[transitions.property] = '';
398      }
399
400      this.body.css(resetStyles).unbind(transitionEndEvent);
401    }
402  }, {
403    key: 'closeBody',
404    value: function closeBody() {
405      var _this = this;
406
407      if (this.displace) {
408        if (_helper2.default.transitions.supported) {
409          this.body.css(this.side, 0).one(transitionEndEvent, function () {
410            _this.onCloseBody();
411          });
412        } else {
413          var bodyAnimation = this.getAnimation(closeAction, 'body');
414
415          this.body.animate(bodyAnimation, {
416            queue: false,
417            duration: this.speed,
418            complete: function complete() {
419              _this.onCloseBody();
420            }
421          });
422        }
423      }
424    }
425  }, {
426    key: 'moveBody',
427    value: function moveBody(action) {
428      if (action === openAction) {
429        this.openBody();
430      } else {
431        this.closeBody();
432      }
433    }
434  }, {
435    key: 'onOpenMenu',
436    value: function onOpenMenu(callback) {
437      var name = this.name;
438
439      _status2.default.moving = false;
440      _status2.default.opened = name;
441
442      this.item.unbind(transitionEndEvent);
443
444      this.body.removeClass(bodyAnimationClass).addClass(this.openClass);
445
446      this.onOpenEndCallback();
447
448      if (typeof callback === 'function') {
449        callback(name);
450      }
451    }
452  }, {
453    key: 'openMenu',
454    value: function openMenu(callback) {
455      var _this2 = this;
456
457      var $item = this.item;
458
459      if (_helper2.default.transitions.supported) {
460        $item.css(this.side, 0).one(transitionEndEvent, function () {
461          _this2.onOpenMenu(callback);
462        });
463      } else {
464        var menuAnimation = this.getAnimation(openAction, 'menu');
465
466        $item.css('display', 'block').animate(menuAnimation, {
467          queue: false,
468          duration: this.speed,
469          complete: function complete() {
470            _this2.onOpenMenu(callback);
471          }
472        });
473      }
474    }
475  }, {
476    key: 'onCloseMenu',
477    value: function onCloseMenu(callback) {
478      this.item.css({
479        left: '',
480        right: ''
481      }).unbind(transitionEndEvent);
482      $('html').css('overflow-x', '');
483
484      _status2.default.moving = false;
485      _status2.default.opened = false;
486
487      this.body.removeClass(bodyAnimationClass).removeClass(this.openClass);
488
489      this.onCloseEndCallback();
490
491      // Callback
492      if (typeof callback === 'function') {
493        callback(name);
494      }
495    }
496  }, {
497    key: 'closeMenu',
498    value: function closeMenu(callback) {
499      var _this3 = this;
500
501      var item = this.item;
502
503      if (_helper2.default.transitions.supported) {
504        item.css(this.side, '').one(transitionEndEvent, function () {
505          _this3.onCloseMenu(callback);
506        });
507      } else {
508        var menuAnimation = this.getAnimation(closeAction, 'menu');
509
510        item.animate(menuAnimation, {
511          queue: false,
512          duration: this.speed,
513          complete: function complete() {
514            _this3.onCloseMenu();
515          }
516        });
517      }
518    }
519  }, {
520    key: 'moveMenu',
521    value: function moveMenu(action, callback) {
522      this.body.addClass(bodyAnimationClass);
523
524      if (action === openAction) {
525        this.openMenu(callback);
526      } else {
527        this.closeMenu(callback);
528      }
529    }
530  }, {
531    key: 'move',
532    value: function move(action, callback) {
533      // Lock sidr
534      _status2.default.moving = true;
535
536      this.prepareBody(action);
537      this.moveBody(action);
538      this.moveMenu(action, callback);
539    }
540  }, {
541    key: 'open',
542    value: function open(callback) {
543      var _this4 = this;
544
545      // Check if is already opened or moving
546      if (_status2.default.opened === this.name || _status2.default.moving) {
547        return;
548      }
549
550      // If another menu opened close first
551      if (_status2.default.opened !== false) {
552        var alreadyOpenedMenu = new Menu(_status2.default.opened);
553
554        alreadyOpenedMenu.close(function () {
555          _this4.open(callback);
556        });
557
558        return;
559      }
560
561      this.move('open', callback);
562
563      // onOpen callback
564      this.onOpenCallback();
565    }
566  }, {
567    key: 'close',
568    value: function close(callback) {
569      // Check if is already closed or moving
570      if (_status2.default.opened !== this.name || _status2.default.moving) {
571        return;
572      }
573
574      this.move('close', callback);
575
576      // onClose callback
577      this.onCloseCallback();
578    }
579  }, {
580    key: 'toggle',
581    value: function toggle(callback) {
582      if (_status2.default.opened === this.name) {
583        this.close(callback);
584      } else {
585        this.open(callback);
586      }
587    }
588  }]);
589
590  return Menu;
591}();
592
593exports.default = Menu;
594
595},{"./helper":4,"./status":7}],6:[function(require,module,exports){
596'use strict';
597
598Object.defineProperty(exports, "__esModule", {
599  value: true
600});
601
602var _execute = require('./execute');
603
604var _execute2 = _interopRequireDefault(_execute);
605
606function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
607
608var i,
609    $ = jQuery,
610    publicMethods = ['open', 'close', 'toggle'],
611    methodName,
612    methods = {},
613    getMethod = function getMethod(methodName) {
614  return function (name, callback) {
615    // Check arguments
616    if (typeof name === 'function') {
617      callback = name;
618      name = 'sidr';
619    } else if (!name) {
620      name = 'sidr';
621    }
622
623    (0, _execute2.default)(methodName, name, callback);
624  };
625};
626
627for (i = 0; i < publicMethods.length; i++) {
628  methodName = publicMethods[i];
629  methods[methodName] = getMethod(methodName);
630}
631
632function sidr(method) {
633  if (methods[method]) {
634    return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
635  } else if (typeof method === 'function' || typeof method === 'string' || !method) {
636    return methods.toggle.apply(this, arguments);
637  } else {
638    $.error('Method ' + method + ' does not exist on jQuery.sidr');
639  }
640}
641
642exports.default = sidr;
643
644},{"./execute":2}],7:[function(require,module,exports){
645"use strict";
646
647Object.defineProperty(exports, "__esModule", {
648    value: true
649});
650var sidrStatus = {
651    moving: false,
652    opened: false
653};
654
655exports.default = sidrStatus;
656
657},{}]},{},[1]);

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.