PageSourceSearch

https://handballisr.co.il/js/foundation/foundation.reveal.js

js handballisr.co.il collected 2026-10-02 22:26:28 UTC 10,551 bytes, 353 lines download raw bytes

1/*jslint unparam: true, browser: true, indent: 2 */
2
3;(function ($, window, document, undefined) {
4  'use strict';
5
6  Foundation.libs.reveal = {
7    name : 'reveal',
8
9    version : '4.3.2',
10
11    locked : false,
12
13    settings : {
14      animation: 'fadeAndPop',
15      animationSpeed: 250,
16      closeOnBackgroundClick: true,
17      closeOnEsc: true,
18      dismissModalClass: 'close-reveal-modal',
19      bgClass: 'reveal-modal-bg',
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      Foundation.inherit(this, 'data_options delay');
41
42      if (typeof method === 'object') {
43        $.extend(true, this.settings, method);
44      } else if (typeof options !== 'undefined') {
45        $.extend(true, this.settings, options);
46      }
47
48      if (typeof method !== 'string') {
49        this.events();
50
51        return this.settings.init;
52      } else {
53        return this[method].call(this, options);
54      }
55    },
56
57    events : function () {
58      var self = this;
59
60      $(this.scope)
61        .off('.fndtn.reveal')
62        .on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
63          e.preventDefault();
64
65          if (!self.locked) {
66            var element = $(this),
67                ajax = element.data('reveal-ajax');
68
69            self.locked = true;
70
71            if (typeof ajax === 'undefined') {
72              self.open.call(self, element);
73            } else {
74              var url = ajax === true ? element.attr('href') : ajax;
75
76              self.open.call(self, element, {url: url});
77            }
78          }
79        })
80        .on('click.fndtn.reveal touchend', this.close_targets(), function (e) {
81          e.preventDefault();
82          if (!self.locked) {
83            var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open'))),
84              bgClicked = $(e.target)[0] === $('.' + settings.bgClass)[0];
85            if (bgClicked && !settings.closeOnBackgroundClick) {
86              return;
87            }
88
89            self.locked = true;
90            self.close.call(self, bgClicked ? $('.reveal-modal.open') : $(this).closest('.reveal-modal'));
91          }
92        });
93
94      if($(this.scope).hasClass('reveal-modal')) {
95        $(this.scope)
96          .on('open.fndtn.reveal', this.settings.open)
97          .on('opened.fndtn.reveal', this.settings.opened)
98          .on('opened.fndtn.reveal', this.open_video)
99          .on('close.fndtn.reveal', this.settings.close)
100          .on('closed.fndtn.reveal', this.settings.closed)
101          .on('closed.fndtn.reveal', this.close_video);
102      } else {
103        $(this.scope)
104          .on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
105          .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
106          .on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
107          .on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
108          .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
109          .on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
110      }
111
112      $( 'body' ).bind( 'keyup.reveal', function ( event ) {
113        var open_modal = $('.reveal-modal.open'),
114            settings = $.extend({}, self.settings, self.data_options(open_modal));
115        if ( event.which === 27  && settings.closeOnEsc) { // 27 is the keycode for the Escape key
116          open_modal.foundation('reveal', 'close');
117        }
118      });
119
120      return true;
121    },
122
123    open : function (target, ajax_settings) {
124      if (target) {
125        if (typeof target.selector !== 'undefined') {
126          var modal = $('#' + target.data('reveal-id'));
127        } else {
128          var modal = $(this.scope);
129
130          ajax_settings = target;
131        }
132      } else {
133        var modal = $(this.scope);
134      }
135
136      if (!modal.hasClass('open')) {
137        var open_modal = $('.reveal-modal.open');
138
139        if (typeof modal.data('css-top') === 'undefined') {
140          modal.data('css-top', parseInt(modal.css('top'), 10))
141            .data('offset', this.cache_offset(modal));
142        }
143
144        modal.trigger('open');
145
146        if (open_modal.length < 1) {
147          this.toggle_bg();
148        }
149
150        if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
151          this.hide(open_modal, this.settings.css.close);
152          this.show(modal, this.settings.css.open);
153        } else {
154          var self = this,
155              old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
156
157          $.extend(ajax_settings, {
158            success: function (data, textStatus, jqXHR) {
159              if ( $.isFunction(old_success) ) {
160                old_success(data, textStatus, jqXHR);
161              }
162
163              modal.html(data);
164              $(modal).foundation('section', 'reflow');
165
166              self.hide(open_modal, self.settings.css.close);
167              self.show(modal, self.settings.css.open);
168            }
169          });
170
171          $.ajax(ajax_settings);
172        }
173      }
174    },
175
176    close : function (modal) {
177
178      var modal = modal && modal.length ? modal : $(this.scope),
179          open_modals = $('.reveal-modal.open');
180
181      if (open_modals.length > 0) {
182        this.locked = true;
183        modal.trigger('close');
184        this.toggle_bg();
185        this.hide(open_modals, this.settings.css.close);
186      }
187    },
188
189    close_targets : function () {
190      var base = '.' + this.settings.dismissModalClass;
191
192      if (this.settings.closeOnBackgroundClick) {
193        return base + ', .' + this.settings.bgClass;
194      }
195
196      return base;
197    },
198
199    toggle_bg : function () {
200      if ($('.' + this.settings.bgClass).length === 0) {
201        this.settings.bg = $('<div />', {'class': this.settings.bgClass})
202          .appendTo('body');
203      }
204
205      if (this.settings.bg.filter(':visible').length > 0) {
206        this.hide(this.settings.bg);
207      } else {
208        this.show(this.settings.bg);
209      }
210    },
211
212    show : function (el, css) {
213      // is modal
214      if (css) {
215        if (el.parent('body').length === 0) {
216          var placeholder = el.wrap('<div style="display: none;" />').parent();
217          el.on('closed.fndtn.reveal.wrapped', function() {
218            el.detach().appendTo(placeholder);
219            el.unwrap().unbind('closed.fndtn.reveal.wrapped');
220          });
221
222          el.detach().appendTo('body');
223        }
224
225        if (/pop/i.test(this.settings.animation)) {
226          css.top = $(window).scrollTop() - el.data('offset') + 'px';
227          var end_css = {
228            top: $(window).scrollTop() + el.data('css-top') + 'px',
229            opacity: 1
230          };
231
232          return this.delay(function () {
233            return el
234              .css(css)
235              .animate(end_css, this.settings.animationSpeed, 'linear', function () {
236                this.locked = false;
237                el.trigger('opened');
238              }.bind(this))
239              .addClass('open');
240          }.bind(this), this.settings.animationSpeed / 2);
241        }
242
243        if (/fade/i.test(this.settings.animation)) {
244          var end_css = {opacity: 1};
245
246          return this.delay(function () {
247            return el
248              .css(css)
249              .animate(end_css, this.settings.animationSpeed, 'linear', function () {
250                this.locked = false;
251                el.trigger('opened');
252              }.bind(this))
253              .addClass('open');
254          }.bind(this), this.settings.animationSpeed / 2);
255        }
256
257        return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
258      }
259
260      // should we animate the background?
261      if (/fade/i.test(this.settings.animation)) {
262        return el.fadeIn(this.settings.animationSpeed / 2);
263      }
264
265      return el.show();
266    },
267
268    hide : function (el, css) {
269      // is modal
270      if (css) {
271        if (/pop/i.test(this.settings.animation)) {
272          var end_css = {
273            top: - $(window).scrollTop() - el.data('offset') + 'px',
274            opacity: 0
275          };
276
277          return this.delay(function () {
278            return el
279              .animate(end_css, this.settings.animationSpeed, 'linear', function () {
280                this.locked = false;
281                el.css(css).trigger('closed');
282              }.bind(this))
283              .removeClass('open');
284          }.bind(this), this.settings.animationSpeed / 2);
285        }
286
287        if (/fade/i.test(this.settings.animation)) {
288          var end_css = {opacity: 0};
289
290          return this.delay(function () {
291            return el
292              .animate(end_css, this.settings.animationSpeed, 'linear', function () {
293                this.locked = false;
294                el.css(css).trigger('closed');
295              }.bind(this))
296              .removeClass('open');
297          }.bind(this), this.settings.animationSpeed / 2);
298        }
299
300        return el.hide().css(css).removeClass('open').trigger('closed');
301      }
302
303      // should we animate the background?
304      if (/fade/i.test(this.settings.animation)) {
305        return el.fadeOut(this.settings.animationSpeed / 2);
306      }
307
308      return el.hide();
309    },
310
311    close_video : function (e) {
312      var video = $(this).find('.flex-video'),
313          iframe = video.find('iframe');
314
315      if (iframe.length > 0) {
316        iframe.attr('data-src', iframe[0].src);
317        iframe.attr('src', 'about:blank');
318        video.hide();
319      }
320    },
321
322    open_video : function (e) {
323      var video = $(this).find('.flex-video'),
324          iframe = video.find('iframe');
325
326      if (iframe.length > 0) {
327        var data_src = iframe.attr('data-src');
328        if (typeof data_src === 'string') {
329          iframe[0].src = iframe.attr('data-src');
330        } else {
331          var src = iframe[0].src;
332          iframe[0].src = undefined;
333          iframe[0].src = src;
334        }
335        video.show();
336      }
337    },
338
339    cache_offset : function (modal) {
340      var offset = modal.show().height() + parseInt(modal.css('top'), 10);
341
342      modal.hide();
343
344      return offset;
345    },
346
347    off : function () {
348      $(this.scope).off('.fndtn.reveal');
349    },
350
351    reflow : function () {}
352  };
353}(Foundation.zj, this, this.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.