PageSourceSearch

https://sev-in.ru/themes/gavias_tico/js/custom.js?v=11.4.7

js sev-in.ru collected 2026-10-02 15:16:53 UTC 6,172 bytes, 281 lines download raw bytes

1// Toggle
2(function (theme, $) {
3
4  theme = theme || {}
5
6  var instanceName = '__toggle'
7
8  var PluginToggle = function ($el, opts) {
9    return this.initialize($el, opts)
10  }
11
12  PluginToggle.defaults = {
13    duration: 350,
14    isAccordion: false
15  }
16
17  PluginToggle.prototype = {
18    initialize: function ($el, opts) {
19      if ($el.data(instanceName)) {
20        return this
21      }
22
23      this.$el = $el
24
25      this
26        .setData()
27        .setOptions(opts)
28        .build()
29
30      return this
31    },
32
33    setData: function () {
34      this.$el.data(instanceName, this)
35
36      return this
37    },
38
39    setOptions: function (opts) {
40      this.options = $.extend(true, {}, PluginToggle.defaults, opts, {
41        wrapper: this.$el
42      })
43
44      return this
45    },
46
47    build: function () {
48      var self = this,
49        $wrapper = this.options.wrapper,
50        $items = $wrapper.find('.toggle'),
51        $el = null
52
53      $items.each(function () {
54        $el = $(this)
55
56        if ($el.hasClass('active')) {
57          $el.find('> p').addClass('preview-active')
58          $el.find('> .toggle-content').slideDown(self.options.duration)
59        }
60
61        self.events($el)
62      })
63
64      if (self.options.isAccordion) {
65        self.options.duration = self.options.duration / 2
66      }
67
68      return this
69    },
70
71    events: function ($el) {
72      var self = this,
73        previewParCurrentHeight = 0,
74        previewParAnimateHeight = 0,
75        toggleContent = null
76
77      $el.find('> label').click(function (e) {
78
79        var $this = $(this),
80          parentSection = $this.parent(),
81          parentWrapper = $this.parents('.toggle'),
82          previewPar = null,
83          closeElement = null
84
85        if (self.options.isAccordion && typeof (e.originalEvent) != 'undefined') {
86          closeElement = parentWrapper.find('.toggle.active > label')
87
88          if (closeElement[0] == $this[0]) {
89            return
90          }
91        }
92
93        parentSection.toggleClass('active')
94
95        // Preview Paragraph
96        if (parentSection.find('> p').get(0)) {
97
98          previewPar = parentSection.find('> p')
99          previewParCurrentHeight = previewPar.css('height')
100          previewPar.css('height', 'auto')
101          previewParAnimateHeight = previewPar.css('height')
102          previewPar.css('height', previewParCurrentHeight)
103
104        }
105
106        // Content
107        toggleContent = parentSection.find('> .toggle-content')
108
109        if (parentSection.hasClass('active')) {
110
111          $(previewPar).animate({
112            height: previewParAnimateHeight
113          }, self.options.duration, function () {
114            $(this).addClass('preview-active')
115          })
116
117          toggleContent.slideDown(self.options.duration, function () {
118            if (closeElement) {
119              closeElement.trigger('click')
120            }
121          })
122
123        } else {
124
125          $(previewPar).animate({
126            height: 0
127          }, self.options.duration, function () {
128            $(this).removeClass('preview-active')
129          })
130
131          toggleContent.slideUp(self.options.duration)
132
133        }
134
135      })
136    }
137  }
138
139  // expose to scope
140  $.extend(theme, {
141    PluginToggle: PluginToggle
142  })
143
144  // jquery plugin
145  $.fn.themePluginToggle = function (opts) {
146    return this.map(function () {
147      var $this = $(this)
148
149      if ($this.data(instanceName)) {
150        return $this.data(instanceName)
151      } else {
152        return new PluginToggle($this, opts)
153      }
154
155    })
156  }
157
158}).apply(this, [window.theme, jQuery]);
159
160// Toggle
161(function ($) {
162
163  'use strict'
164
165  if ($.isFunction($.fn['themePluginToggle'])) {
166
167    $(function () {
168      $('[data-plugin-toggle]:not(.manual)').each(function () {
169        var $this = $(this),
170          opts
171
172        var pluginOptions = $this.data('plugin-options')
173        if (pluginOptions)
174          opts = pluginOptions
175
176        $this.themePluginToggle(opts)
177      })
178    })
179
180  }
181
182}).apply(this, [jQuery]);
183
184// Lightbox
185(function(theme, $) {
186
187  theme = theme || {};
188
189  var instanceName = '__lightbox';
190
191  var PluginLightbox = function($el, opts) {
192    return this.initialize($el, opts);
193  };
194
195  PluginLightbox.defaults = {
196    tClose: 'Close (Esc)', // Alt text on close button
197    tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys
198    gallery: {
199      tPrev: 'Previous (Left arrow key)', // Alt text on left arrow
200      tNext: 'Next (Right arrow key)', // Alt text on right arrow
201      tCounter: '%curr% of %total%' // Markup for "1 of 7" counter
202    },
203    image: {
204      tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded
205    },
206    ajax: {
207      tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed
208    },
209    callbacks: {
210      open: function() {
211        $('html').addClass('lightbox-opened');
212      },
213      close: function() {
214        $('html').removeClass('lightbox-opened');
215      }
216    }
217  };
218
219  PluginLightbox.prototype = {
220    initialize: function($el, opts) {
221      if ($el.data(instanceName)) {
222        return this;
223      }
224
225      this.$el = $el;
226
227      this
228        .setData()
229        .setOptions(opts)
230        .build();
231
232      return this;
233    },
234
235    setData: function() {
236      this.$el.data(instanceName, this);
237
238      return this;
239    },
240
241    setOptions: function(opts) {
242      this.options = $.extend(true, {}, PluginLightbox.defaults, opts, {
243        wrapper: this.$el
244      });
245
246      return this;
247    },
248
249    build: function() {
250      if (!($.isFunction($.fn.magnificPopup))) {
251        return this;
252      }
253
254      this.options.wrapper.magnificPopup(this.options);
255
256      return this;
257    }
258  };
259
260  // expose to scope
261  $.extend(theme, {
262    PluginLightbox: PluginLightbox
263  });
264
265  // jquery plugin
266  $.fn.themePluginLightbox = function(opts) {
267    return this.map(function() {
268      var $this = $(this);
269
270      if ($this.data(instanceName)) {
271        return $this.data(instanceName);
272      } else {
273        return new PluginLightbox($this, opts);
274      }
275
276    });
277  }
278
279}).apply(this, [window.theme, jQuery]);
280
281console.log('is this working?')

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.