PageSourceSearch

https://kirovgma.ru/sites/all/themes/n_kirovgma/js/foundation/foundation.reveal.js?tlv7bt

js kirovgma.ru collected 2026-09-24 20:27:47 UTC 15,070 bytes, 471 lines download raw bytes

vendor: 15,070 bytes, lines 1-471
1;(function ($, window, document, undefined) {
2  'use strict';
3
4  Foundation.libs.reveal = {
5    name : 'reveal',
6
7    version : '5.5.1',
8
9    locked : false,
10
11    settings : {
12      animation : 'fadeAndPop',
13      animation_speed : 250,
14      close_on_background_click : true,
15      close_on_esc : true,
16      dismiss_modal_class : 'close-reveal-modal',
17      multiple_opened : false,
18      bg_class : 'reveal-modal-bg',
19      root_element : 'body',
20      open : function(){},
21      opened : function(){},
22      close : function(){},
23      closed : function(){},
24      bg : $('.reveal-modal-bg'),
25      css : {
26        open : {
27          'opacity' : 0,
28          'visibility' : 'visible',
29          'display' : 'block'
30        },
31        close : {
32          'opacity' : 1,
33          'visibility' : 'hidden',
34          'display' : 'none'
35        }
36      }
37    },
38
39    init : function (scope, method, options) {
40      $.extend(true, this.settings, method, options);
41      this.bindings(method, options);
42    },
43
44    events : function (scope) {
45      var self = this,
46          S = self.S;
47
48      S(this.scope)
49        .off('.reveal')
50        .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
51          e.preventDefault();
52
53          if (!self.locked) {
54            var element = S(this),
55                ajax = element.data(self.data_attr('reveal-ajax'));
56
57            self.locked = true;
58
59            if (typeof ajax === 'undefined') {
60              self.open.call(self, element);
61            } else {
62              var url = ajax === true ? element.attr('href') : ajax;
63
64              self.open.call(self, element, {url : url});
65            }
66          }
67        });
68
69      S(document)
70        .on('click.fndtn.reveal', this.close_targets(), function (e) {
71          e.preventDefault();
72          if (!self.locked) {
73            var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
74                bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
75
76            if (bg_clicked) {
77              if (settings.close_on_background_click) {
78                e.stopPropagation();
79              } else {
80                return;
81              }
82            }
83
84            self.locked = true;
85            self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
86          }
87        });
88
89      if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
90        S(this.scope)
91          // .off('.reveal')
92          .on('open.fndtn.reveal', this.settings.open)
93          .on('opened.fndtn.reveal', this.settings.opened)
94          .on('opened.fndtn.reveal', this.open_video)
95          .on('close.fndtn.reveal', this.settings.close)
96          .on('closed.fndtn.reveal', this.settings.closed)
97          .on('closed.fndtn.reveal', this.close_video);
98      } else {
99        S(this.scope)
100          // .off('.reveal')
101          .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
102          .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
103          .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
104          .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
105          .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
106          .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
107      }
108
109      return true;
110    },
111
112    // PATCH #3: turning on key up capture only when a reveal window is open
113    key_up_on : function (scope) {
114      var self = this;
115
116      // PATCH #1: fixing multiple keyup event trigger from single key press
117      self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
118        var open_modal = self.S('[' + self.attr_name() + '].open'),
119            settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
120        // PATCH #2: making sure that the close event can be called only while unlocked,
121        //           so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
122        if ( settings && event.which === 27  && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
123          self.close.call(self, open_modal);
124        }
125      });
126
127      return true;
128    },
129
130    // PATCH #3: turning on key up capture only when a reveal window is open
131    key_up_off : function (scope) {
132      this.S('body').off('keyup.fndtn.reveal');
133      return true;
134    },
135
136    open : function (target, ajax_settings) {
137      var self = this,
138          modal;
139
140      if (target) {
141        if (typeof target.selector !== 'undefined') {
142          // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
143          modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
144        } else {
145          modal = self.S(this.scope);
146
147          ajax_settings = target;
148        }
149      } else {
150        modal = self.S(this.scope);
151      }
152
153      var settings = modal.data(self.attr_name(true) + '-init');
154      settings = settings || this.settings;
155
156      if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
157        return self.close(modal);
158      }
159
160      if (!modal.hasClass('open')) {
161        var open_modal = self.S('[' + self.attr_name() + '].open');
162
163        if (typeof modal.data('css-top') === 'undefined') {
164          modal.data('css-top', parseInt(modal.css('top'), 10))
165            .data('offset', this.cache_offset(modal));
166        }
167
168        this.key_up_on(modal);    // PATCH #3: turning on key up capture only when a reveal window is open
169
170        modal.on('open.fndtn.reveal').trigger('open.fndtn.reveal');
171
172        if (open_modal.length < 1) {
173          this.toggle_bg(modal, true);
174        }
175
176        if (typeof ajax_settings === 'string') {
177          ajax_settings = {
178            url : ajax_settings
179          };
180        }
181
182        if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
183          if (open_modal.length > 0) {
184            if (settings.multiple_opened) {
185              this.to_back(open_modal);
186            } else {
187              this.hide(open_modal, settings.css.close);
188            }
189          }
190
191          this.show(modal, settings.css.open);
192        } else {
193          var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
194
195          $.extend(ajax_settings, {
196            success : function (data, textStatus, jqXHR) {
197              if ( $.isFunction(old_success) ) {
198                var result = old_success(data, textStatus, jqXHR);
199                if (typeof result == 'string') {
200                  data = result;
201                }
202              }
203
204              modal.html(data);
205              self.S(modal).foundation('section', 'reflow');
206              self.S(modal).children().foundation();
207
208              if (open_modal.length > 0) {
209                if (settings.multiple_opened) {
210                  this.to_back(open_modal);
211                } else {
212                  this.hide(open_modal, settings.css.close);
213                }
214              }
215              self.show(modal, settings.css.open);
216            }
217          });
218
219          $.ajax(ajax_settings);
220        }
221      }
222      self.S(window).trigger('resize');
223    },
224
225    close : function (modal) {
226      var modal = modal && modal.length ? modal : this.S(this.scope),
227          open_modals = this.S('[' + this.attr_name() + '].open'),
228          settings = modal.data(this.attr_name(true) + '-init') || this.settings;
229
230      if (open_modals.length > 0) {
231        this.locked = true;
232        this.key_up_off(modal);   // PATCH #3: turning on key up capture only when a reveal window is open
233        modal.trigger('close').trigger('close.fndtn.reveal');
234        
235        if ((settings.multiple_opened && open_modals.length === 1) || !settings.multiple_opened || modal.length > 1) {
236          this.toggle_bg(modal, false);
237          this.to_front(modal);
238        }
239        
240        if (settings.multiple_opened) {
241          this.hide(modal, settings.css.close, settings);
242          this.to_front($($.makeArray(open_modals).reverse()[1]));
243        } else {
244          this.hide(open_modals, settings.css.close, settings);
245        }
246      }
247    },
248
249    close_targets : function () {
250      var base = '.' + this.settings.dismiss_modal_class;
251
252      if (this.settings.close_on_background_click) {
253        return base + ', .' + this.settings.bg_class;
254      }
255
256      return base;
257    },
258
259    toggle_bg : function (modal, state) {
260      if (this.S('.' + this.settings.bg_class).length === 0) {
261        this.settings.bg = $('<div />', {'class': this.settings.bg_class})
262          .appendTo('body').hide();
263      }
264
265      var visible = this.settings.bg.filter(':visible').length > 0;
266      if ( state != visible ) {
267        if ( state == undefined ? visible : !state ) {
268          this.hide(this.settings.bg);
269        } else {
270          this.show(this.settings.bg);
271        }
272      }
273    },
274
275    show : function (el, css) {
276      // is modal
277      if (css) {
278        var settings = el.data(this.attr_name(true) + '-init') || this.settings,
279            root_element = settings.root_element;
280
281        if (el.parent(root_element).length === 0) {
282          var placeholder = el.wrap('<div style="display: none;" />').parent();
283
284          el.on('closed.fndtn.reveal.wrapped', function () {
285            el.detach().appendTo(placeholder);
286            el.unwrap().unbind('closed.fndtn.reveal.wrapped');
287          });
288
289          el.detach().appendTo(root_element);
290        }
291
292        var animData = getAnimationData(settings.animation);
293        if (!animData.animate) {
294          this.locked = false;
295        }
296        if (animData.pop) {
297          css.top = $(window).scrollTop() - el.data('offset') + 'px';
298          var end_css = {
299            top: $(window).scrollTop() + el.data('css-top') + 'px',
300            opacity: 1
301          };
302
303          return setTimeout(function () {
304            return el
305              .css(css)
306              .animate(end_css, settings.animation_speed, 'linear', function () {
307                this.locked = false;
308                el.trigger('opened').trigger('opened.fndtn.reveal');
309              }.bind(this))
310              .addClass('open');
311          }.bind(this), settings.animation_speed / 2);
312        }
313
314        if (animData.fade) {
315          css.top = $(window).scrollTop() + el.data('css-top') + 'px';
316          var end_css = {opacity: 1};
317
318          return setTimeout(function () {
319            return el
320              .css(css)
321              .animate(end_css, settings.animation_speed, 'linear', function () {
322                this.locked = false;
323                el.trigger('opened').trigger('opened.fndtn.reveal');
324              }.bind(this))
325              .addClass('open');
326          }.bind(this), settings.animation_speed / 2);
327        }
328
329        return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
330      }
331
332      var settings = this.settings;
333
334      // should we animate the background?
335      if (getAnimationData(settings.animation).fade) {
336        return el.fadeIn(settings.animation_speed / 2);
337      }
338
339      this.locked = false;
340
341      return el.show();
342    },
343    
344    to_back : function(el) {
345      el.addClass('toback');
346    },
347    
348    to_front : function(el) {
349      el.removeClass('toback');
350    },
351
352    hide : function (el, css) {
353      // is modal
354      if (css) {
355        var settings = el.data(this.attr_name(true) + '-init');
356        settings = settings || this.settings;
357
358        var animData = getAnimationData(settings.animation);
359        if (!animData.animate) {
360          this.locked = false;
361        }
362        if (animData.pop) {
363          var end_css = {
364            top: - $(window).scrollTop() - el.data('offset') + 'px',
365            opacity: 0
366          };
367
368          return setTimeout(function () {
369            return el
370              .animate(end_css, settings.animation_speed, 'linear', function () {
371                this.locked = false;
372                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
373              }.bind(this))
374              .removeClass('open');
375          }.bind(this), settings.animation_speed / 2);
376        }
377
378        if (animData.fade) {
379          var end_css = {opacity : 0};
380
381          return setTimeout(function () {
382            return el
383              .animate(end_css, settings.animation_speed, 'linear', function () {
384                this.locked = false;
385                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
386              }.bind(this))
387              .removeClass('open');
388          }.bind(this), settings.animation_speed / 2);
389        }
390
391        return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
392      }
393
394      var settings = this.settings;
395
396      // should we animate the background?
397      if (getAnimationData(settings.animation).fade) {
398        return el.fadeOut(settings.animation_speed / 2);
399      }
400
401      return el.hide();
402    },
403
404    close_video : function (e) {
405      var video = $('.flex-video', e.target),
406          iframe = $('iframe', video);
407
408      if (iframe.length > 0) {
409        iframe.attr('data-src', iframe[0].src);
410        iframe.attr('src', iframe.attr('src'));
411        video.hide();
412      }
413    },
414
415    open_video : function (e) {
416      var video = $('.flex-video', e.target),
417          iframe = video.find('iframe');
418
419      if (iframe.length > 0) {
420        var data_src = iframe.attr('data-src');
421        if (typeof data_src === 'string') {
422          iframe[0].src = iframe.attr('data-src');
423        } else {
424          var src = iframe[0].src;
425          iframe[0].src = undefined;
426          iframe[0].src = src;
427        }
428        video.show();
429      }
430    },
431
432    data_attr : function (str) {
433      if (this.namespace.length > 0) {
434        return this.namespace + '-' + str;
435      }
436
437      return str;
438    },
439
440    cache_offset : function (modal) {
441      var offset = modal.show().height() + parseInt(modal.css('top'), 10);
442
443      modal.hide();
444
445      return offset;
446    },
447
448    off : function () {
449      $(this.scope).off('.fndtn.reveal');
450    },
451
452    reflow : function () {}
453  };
454
455  /*
456   * getAnimationData('popAndFade') // {animate: true,  pop: true,  fade: true}
457   * getAnimationData('fade')       // {animate: true,  pop: false, fade: true}
458   * getAnimationData('pop')        // {animate: true,  pop: true,  fade: false}
459   * getAnimationData('foo')        // {animate: false, pop: false, fade: false}
460   * getAnimationData(null)         // {animate: false, pop: false, fade: false}
461   */
462  function getAnimationData(str) {
463    var fade = /fade/i.test(str);
464    var pop = /pop/i.test(str);
465    return {
466      animate : fade || pop,
467      pop : pop,
468      fade : fade
469    };
470  }
471}(jQuery, window, window.document));

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.