PageSourceSearch

https://sekuru.org/wp-content/themes/selkie/framework/assets/js/plugin.js?ver=6.9.9

js sekuru.org collected 2026-10-02 19:23:13 UTC 11,828 bytes, 401 lines download raw bytes

1/*global jQuery */
2/*jshint browser:true */
3/*!
4* FitVids 1.1
5*
6* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
7* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
8* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
9*
10*/
11
12(function( $ ){
13
14  "use strict";
15
16  $.fn.fitVids = function( options ) {
17    var settings = {
18      customSelector: null,
19      ignore: null
20    };
21
22    if(!document.getElementById('fit-vids-style')) {
23      // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
24      var head = document.head || document.getElementsByTagName('head')[0];
25      var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
26      var div = document.createElement('div');
27      div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
28      head.appendChild(div.childNodes[1]);
29    }
30
31    if ( options ) {
32      $.extend( settings, options );
33    }
34
35    return this.each(function(){
36      var selectors = [
37        "iframe[src*='player.vimeo.com']",
38        "iframe[src*='youtube.com']",
39        "iframe[src*='youtube-nocookie.com']",
40        "iframe[src*='kickstarter.com'][src*='video.html']",
41        "object",
42        "embed"
43      ];
44
45      if (settings.customSelector) {
46        selectors.push(settings.customSelector);
47      }
48
49      var ignoreList = '.fitvidsignore';
50
51      if(settings.ignore) {
52        ignoreList = ignoreList + ', ' + settings.ignore;
53      }
54
55      var $allVideos = $(this).find(selectors.join(','));
56      $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
57      $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
58
59      $allVideos.each(function(){
60        var $this = $(this);
61        if($this.parents(ignoreList).length > 0) {
62          return; // Disable FitVids on this video.
63        }
64        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
65        if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
66        {
67          $this.attr('height', 9);
68          $this.attr('width', 16);
69        }
70        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
71            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
72            aspectRatio = height / width;
73        if(!$this.attr('id')){
74          var videoID = 'fitvid' + Math.floor(Math.random()*999999);
75          $this.attr('id', videoID);
76        }
77        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
78        $this.removeAttr('height').removeAttr('width');
79      });
80    });
81  };
82// Works with either jQuery or Zepto
83})( window.jQuery || window.Zepto );
84
85
86
87/*
88 * === IG Menu mobile ===
89 * jQuery Navgoco Menus Plugin v0.2.1 (2014-04-11)
90 * https://github.com/tefra/navgoco
91 *
92 * Copyright (c) 2014 Chris T (@tefra)
93 * BSD - https://github.com/tefra/navgoco/blob/master/LICENSE-BSD
94 */
95(function($) {
96
97	"use strict";
98
99	/**
100	 * Plugin Constructor. Every menu must have a unique id which will either
101	 * be the actual id attribute or its index in the page.
102	 *
103	 * @param {Element} el
104	 * @param {Object} options
105	 * @param {Integer} idx
106	 * @returns {Object} Plugin Instance
107	 */
108	var Plugin = function(el, options, idx) {
109		this.el = el;
110		this.$el = $(el);
111		this.options = options;
112		this.uuid = this.$el.attr('id') ? this.$el.attr('id') : idx;
113		this.state = {};
114		this.init();
115		return this;
116	};
117
118	/**
119	 * Plugin methods
120	 */
121	Plugin.prototype = {
122		/**
123		 * Load cookie, assign a unique data-index attribute to
124		 * all sub-menus and show|hide them according to cookie
125		 * or based on the parent open class. Find all parent li > a
126		 * links add the carent if it's on and attach the event click
127		 * to them.
128		 */
129		init: function() {
130			var self = this;
131			self._load();
132			self.$el.find('ul').each(function(idx) {
133				var sub = $(this);
134				sub.attr('data-index', idx);
135				if (self.options.save && self.state.hasOwnProperty(idx)) {
136					sub.parent().addClass(self.options.openClass);
137					sub.show();
138				} else if (sub.parent().hasClass(self.options.openClass)) {
139					sub.show();
140					self.state[idx] = 1;
141				} else {
142					sub.hide();
143				}
144			});
145
146			var caret = $('<span></span>').prepend(self.options.caretHtml);
147			var links = self.$el.find("li > a");
148			self._trigger(caret, false);
149			self._trigger(links, true);
150			self.$el.find("li:has(ul) > a").prepend(caret);
151		},
152		/**
153		 * Add the main event trigger to toggle menu items to the given sources
154		 * @param {Element} sources
155		 * @param {Boolean} isLink
156		 */
157		_trigger: function(sources, isLink) {
158			var self = this;
159			sources.on('click', function(event) {
160				event.stopPropagation();
161				var sub = isLink ? $(this).next() : $(this).parent().next();
162				var isAnchor = false;
163				if (isLink) {
164					var href = $(this).attr('href');
165					isAnchor = href === undefined || href === '' || href === '#';
166				}
167				sub = sub.length > 0 ? sub : false;
168				self.options.onClickBefore.call(this, event, sub);
169
170				if (!isLink || sub && isAnchor) {
171					event.preventDefault();
172					self._toggle(sub, sub.is(":hidden"));
173					self._save();
174				} else if (self.options.accordion) {
175					var allowed = self.state = self._parents($(this));
176					self.$el.find('ul').filter(':visible').each(function() {
177						var sub = $(this),
178							idx = sub.attr('data-index');
179
180						if (!allowed.hasOwnProperty(idx)) {
181							self._toggle(sub, false);
182						}
183					});
184					self._save();
185				}
186				self.options.onClickAfter.call(this, event, sub);
187			});
188		},
189		/**
190		 * Accepts a JQuery Element and a boolean flag. If flag is false it removes the `open` css
191		 * class from the parent li and slides up the sub-menu. If flag is open it adds the `open`
192		 * css class to the parent li and slides down the menu. If accordion mode is on all
193		 * sub-menus except the direct parent tree will close. Internally an object with the menus
194		 * states is maintained for later save duty.
195		 *
196		 * @param {Element} sub
197		 * @param {Boolean} open
198		 */
199		_toggle: function(sub, open) {
200			var self = this,
201				idx = sub.attr('data-index'),
202				parent = sub.parent();
203
204			self.options.onToggleBefore.call(this, sub, open);
205			if (open) {
206				parent.addClass(self.options.openClass);
207				sub.slideDown(self.options.slide);
208				self.state[idx] = 1;
209
210				if (self.options.accordion) {
211					var allowed = self.state = self._parents(sub);
212					allowed[idx] = self.state[idx] = 1;
213
214					self.$el.find('ul').filter(':visible').each(function() {
215						var sub = $(this),
216							idx = sub.attr('data-index');
217
218						if (!allowed.hasOwnProperty(idx)) {
219							self._toggle(sub, false);
220						}
221					});
222				}
223			} else {
224				parent.removeClass(self.options.openClass);
225				sub.slideUp(self.options.slide);
226				self.state[idx] = 0;
227			}
228			self.options.onToggleAfter.call(this, sub, open);
229		},
230		/**
231		 * Returns all parents of a sub-menu. When obj is true It returns an object with indexes for
232		 * keys and the elements as values, if obj is false the object is filled with the value `1`.
233		 *
234		 * @since v0.1.2
235		 * @param {Element} sub
236		 * @param {Boolean} obj
237		 * @returns {Object}
238		 */
239		_parents: function(sub, obj) {
240			var result = {},
241				parent = sub.parent(),
242				parents = parent.parents('ul');
243
244			parents.each(function() {
245				var par = $(this),
246					idx = par.attr('data-index');
247
248				if (!idx) {
249					return false;
250				}
251				result[idx] = obj ? par : 1;
252			});
253			return result;
254		},
255		/**
256		 * If `save` option is on the internal object that keeps track of the sub-menus states is
257		 * saved with a cookie. For size reasons only the open sub-menus indexes are stored.		 *
258		 */
259		_save: function() {
260			if (this.options.save) {
261				var save = {};
262				for (var key in this.state) {
263					if (this.state[key] === 1) {
264						save[key] = 1;
265					}
266				}
267				cookie[this.uuid] = this.state = save;
268				$.cookie(this.options.cookie.name, JSON.stringify(cookie), this.options.cookie);
269			}
270		},
271		/**
272		 * If `save` option is on it reads the cookie data. The cookie contains data for all
273		 * navgoco menus so the read happens only once and stored in the global `cookie` var.
274		 */
275		_load: function() {
276			if (this.options.save) {
277				if (cookie === null) {
278					var data = $.cookie(this.options.cookie.name);
279					cookie = (data) ? JSON.parse(data) : {};
280				}
281				this.state = cookie.hasOwnProperty(this.uuid) ? cookie[this.uuid] : {};
282			}
283		},
284		/**
285		 * Public method toggle to manually show|hide sub-menus. If no indexes are provided all
286		 * items will be toggled. You can pass sub-menus indexes as regular params. eg:
287		 * navgoco('toggle', true, 1, 2, 3, 4, 5);
288		 *
289		 * Since v0.1.2 it will also open parents when providing sub-menu indexes.
290		 *
291		 * @param {Boolean} open
292		 */
293		toggle: function(open) {
294			var self = this,
295				length = arguments.length;
296
297			if (length <= 1) {
298				self.$el.find('ul').each(function() {
299					var sub = $(this);
300					self._toggle(sub, open);
301				});
302			} else {
303				var idx,
304					list = {},
305					args = Array.prototype.slice.call(arguments, 1);
306				length--;
307
308				for (var i = 0; i < length; i++) {
309					idx = args[i];
310					var sub = self.$el.find('ul[data-index="' + idx + '"]').first();
311					if (sub) {
312						list[idx] = sub;
313						if (open) {
314							var parents = self._parents(sub, true);
315							for (var pIdx in parents) {
316								if (!list.hasOwnProperty(pIdx)) {
317									list[pIdx] = parents[pIdx];
318								}
319							}
320						}
321					}
322				}
323
324				for (idx in list) {
325					self._toggle(list[idx], open);
326				}
327			}
328			self._save();
329		},
330		/**
331		 * Removes instance from JQuery data cache and unbinds events.
332		 */
333		destroy: function() {
334			$.removeData(this.$el);
335			this.$el.find("li:has(ul) > a").unbind('click');
336			this.$el.find("li:has(ul) > a > span").unbind('click');
337		}
338	};
339
340	/**
341	 * A JQuery plugin wrapper for navgoco. It prevents from multiple instances and also handles
342	 * public methods calls. If we attempt to call a public method on an element that doesn't have
343	 * a navgoco instance, one will be created for it with the default options.
344	 *
345	 * @param {Object|String} options
346	 */
347	$.fn.navgoco = function(options) {
348		if (typeof options === 'string' && options.charAt(0) !== '_' && options !== 'init') {
349			var callback = true,
350				args = Array.prototype.slice.call(arguments, 1);
351		} else {
352			options = $.extend({}, $.fn.navgoco.defaults, options || {});
353			if (!$.cookie) {
354				options.save = false;
355			}
356		}
357		return this.each(function(idx) {
358			var $this = $(this),
359				obj = $this.data('navgoco');
360
361			if (!obj) {
362				obj = new Plugin(this, callback ? $.fn.navgoco.defaults : options, idx);
363				$this.data('navgoco', obj);
364			}
365			if (callback) {
366				obj[options].apply(obj, args);
367			}
368		});
369	};
370	/**
371	 * Global var holding all navgoco menus open states
372	 *
373	 * @type {Object}
374	 */
375	var cookie = null;
376
377	/**
378	 * Default navgoco options
379	 *
380	 * @type {Object}
381	 */
382	$.fn.navgoco.defaults = {
383		caretHtml: '',
384		accordion: false,
385		openClass: 'open',
386		save: true,
387		cookie: {
388			name: 'navgoco',
389			expires: false,
390			path: '/'
391		},
392		slide: {
393			duration: 400,
394			easing: 'swing'
395		},
396		onClickBefore: $.noop,
397		onClickAfter: $.noop,
398		onToggleBefore: $.noop,
399		onToggleAfter: $.noop
400	};
401})(jQuery);

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.