PageSourceSearch

https://moda.ru/wp-content/themes/venosa/js/affix.js

js moda.ru collected 2026-10-02 07:55:13 UTC 11,190 bytes, 204 lines download raw bytes

vendor: 6,316 bytes, lines 1-204
1/* ========================================================================
2 * <---! CUSTOMIZED !--->
3 * Bootstrap: affix.js v3.3.6  
4 * http://getbootstrap.com/javascript/#affix
5 * ========================================================================
6 * Copyright 2011-2016 Twitter, Inc.
7 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
8 * ======================================================================== */
9+ function($) {
10    'use strict';
11
12    // AFFIX CLASS DEFINITION
13    // ======================
14
15    var Affix = function(element, options) {
16        this.options = $.extend({}, Affix.DEFAULTS, options)
17
18        this.$target = $(this.options.target)
19            .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
20            // .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
21
22        this.$element = $(element)
23        this.affixed = null
24        this.unpin = null
25        this.pinnedOffset = null
26
27        this.checkPosition()
28    }
29
30    Affix.VERSION = '3.3.6'
31
32    Affix.RESET = 'affix affix-top affix-bottom'
33
34    Affix.DEFAULTS = {
35        offset: 0,
36        target: window
37
38    }
39
40    Affix.prototype.getState = function(scrollHeight, height, offsetTop, offsetBottom) {
41
42        var scrollTop = this.$target.scrollTop()
43        var position = this.$element.offset()
44        var targetHeight = this.$target.height()
45
46        if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
47
48        if (this.affixed == 'bottom') {
49            if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
50            return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
51        }
52
53        var initializing = this.affixed == null
54        var colliderTop = initializing ? scrollTop : position.top
55        var colliderHeight = initializing ? targetHeight : height
56
57        if (offsetTop != null && scrollTop <= offsetTop) return 'top'
58        if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
59
60        return false
61    }
62
63    Affix.prototype.getPinnedOffset = function() {
64        if (this.pinnedOffset) return this.pinnedOffset
65        this.$element.removeClass(Affix.RESET).addClass('affix')
66        var scrollTop = this.$target.scrollTop()
67        var position = this.$element.offset()
68        return (this.pinnedOffset = position.top - scrollTop)
69    }
70
71    Affix.prototype.checkPositionWithEventLoop = function() {
72        setTimeout($.proxy(this.checkPosition, this), 1)
73    }
74
75    Affix.prototype.checkPosition = function() {
76        if (!this.$element.is(':visible')) return
77
78        var height = this.$element.height()
79        var offset = this.options.offset
80        var offsetTop = offset.top
81        var offsetBottom = offset.bottom
82        var scrollHeight = Math.max($(document).height(), $(document.body).height())
83
84        if (typeof offset != 'object') offsetBottom = offsetTop = offset
85        if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
86        if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
87
88        var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
89
90        if (this.affixed != affix) {
91            if (this.unpin != null) this.$element.css('top', '')
92
93            var affixType = 'affix' + (affix ? '-' + affix : '')
94            var e = $.Event(affixType + '.bs.affix')
95
96            this.$element.trigger(e)
97
98            if (e.isDefaultPrevented()) return
99
100            this.affixed = affix
101            this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
102
103            this.$element
104                .removeClass(Affix.RESET)
105                .addClass(affixType)
106                .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
107
108            if ( !this.$element.hasClass('affixer') ) {
109
110                if (affixType == 'affix') {
111
112                    /*
113                     * Add placeholder for fixed row, to keep document height the same as if the div was not fixed.
114                     */
115                    this.$element.before('<div class="fix-row" style="height: ' + this.$element.outerHeight( true ) + 'px"></div>');
116
117                } else {
118
119                    /*
120                     * When row is being un-affixed, remove placeholder
121                     */
122
123                    this.$element.prev('.fix-row').remove();
124
125                }
126
127            }
128        }
129
130        if (affix == 'bottom') {
131
132            this.$element.offset({
133
134                top: scrollHeight - height - offsetBottom
135
136            })
137
138        }
139    }
140
141
142    // AFFIX PLUGIN DEFINITION
143    // =======================
144
145    function Plugin(option) {
146        return this.each(function() {
147            var $this = $(this)
148            var data = $this.data('bs.affix')
149            var options = typeof option == 'object' && option
150
151            if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
152            if (typeof option == 'string') data[option]()
153        })
154    }
155
156    var old = $.fn.affix
157
158    $.fn.affix = Plugin
159    $.fn.affix.Constructor = Affix
160
161
162    // AFFIX NO CONFLICT
163    // =================
164
165    $.fn.affix.noConflict = function() {
166        $.fn.affix = old
167        return this
168    }
169
170
171    // AFFIX DATA-API
172    // ==============
173
174    $(window).on('load', function() {
175        $('[data-spy="affix"]').each(function() {
176            var $spy = $(this)
177            var data = $spy.data()
178
179            data.offset = data.offset || {}
180
181            if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
182            if (data.offsetTop != null) data.offset.top = data.offsetTop
183
184            Plugin.call($spy, data)
185        })
186    })
187
188}(jQuery);
189/*
190 * Sticky sidebar plugin 
191 * URL https://github.com/WeCodePixels/theia-sticky-sidebar
192 */
193/*!
194 * Theia Sticky Sidebar v1.5.0
195 * https://github.com/WeCodePixels/theia-sticky-sidebar
196 *
197 * Glues your website's sidebars, making them permanently visible while scrolling.
198 *
199 * Copyright 2013-2016 WeCodePixels and other contributors
200 * Released under the MIT license
201 * modded o.container
202 */
203
204!function(a){a.fn.theiaStickySidebar=function(b){function d(b,c){var d=e(b,c);
204d||(console.log("TSS: Body width smaller than options.minWidth. Init is delayed."),a(document).scroll(function(b,c){return function(d){var f=e(b,c);f&&a(this).unbind(d)}}(b,c)),a(window).resize(function(b,c){return function(d){var f=e(b,c);f&&a(this).unbind(d)}}(b,c)))}function e(b,c){return b.initialized===!0||!(a("body").width()<b.minWidth)&&(f(b,c),!0)}function f(b,c){b.initialized=!0,a("head").append(a('<style>.theiaStickySidebar::after {content: ""; display: table; clear: both;}</style>')),c.each(function(){function h(){c.fixedScrollTop=0,c.sidebar.css({"min-height":"1px"}),c.stickySidebar.css({position:"static",width:"",transform:"none"})}function i(b){var c=b.height();return b.children().each(function(){c=Math.max(c,a(this).height())}),c}var c={};if(c.sidebar=a(this),c.options=b||{},c.container=c.sidebar.closest(c.options.containerSelector),0==c.container.length&&(c.container=c.sidebar.parent()),c.sidebar.parents().css("-webkit-transform","none"),c.sidebar.css({position:"relative",overflow:"visible","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"}),c.stickySidebar=c.sidebar.find(".theiaStickySidebar"),0==c.stickySidebar.length){var d=/(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;c.sidebar.find("script").filter(function(a,b){return 0===b.type.length||b.type.match(d)}).remove(),c.stickySidebar=a("<div>").addClass("theiaStickySidebar").append(c.sidebar.children()),c.sidebar.append(c.stickySidebar)}c.marginBottom=parseInt(c.sidebar.css("margin-bottom")),c.paddingTop=parseInt(c.sidebar.css("padding-top")),c.paddingBottom=parseInt(c.sidebar.css("padding-bottom"));var e=c.stickySidebar.offset().top,f=c.stickySidebar.outerHeight();c.stickySidebar.css("padding-top",1),c.stickySidebar.css("padding-bottom",1),e-=c.stickySidebar.offset().top,f=c.stickySidebar.outerHeight()-f-e,0==e?(c.stickySidebar.css("padding-top",0),c.stickySidebarPaddingTop=0):c.stickySidebarPaddingTop=1,0==f?(c.stickySidebar.css("padding-bottom",0),c.stickySidebarPaddingBottom=0):c.stickySidebarPaddingBottom=1,c.previousScrollTop=null,c.fixedScrollTop=0,h(),c.onScroll=function(c){if(c.stickySidebar.is(":visible")){if(a("body").width()<c.options.minWidth)return void h();if(c.options.disableOnResponsiveLayouts){var d=c.sidebar.outerWidth("none"==c.sidebar.css("float"));if(d+50>c.container.width())return void h()}var e=a(document).scrollTop(),f="static";if(e>=c.sidebar.offset().top+(c.paddingTop-c.options.additionalMarginTop)){var o,j=c.paddingTop+b.additionalMarginTop,k=c.paddingBottom+c.marginBottom+b.additionalMarginBottom,l=c.sidebar.offset().top,m=c.sidebar.offset().top+i(c.container),n=0+b.additionalMarginTop,p=c.stickySidebar.outerHeight()+j+k<a(window).height();o=p?n+c.stickySidebar.outerHeight():a(window).height()-c.marginBottom-c.paddingBottom-b.additionalMarginBottom;var q=l-e+c.paddingTop,r=m-e-c.paddingBottom-c.marginBottom,s=c.stickySidebar.offset().top-e,t=c.previousScrollTop-e;"fixed"==c.stickySidebar.css("position")&&"modern"==c.options.sidebarBehavior&&(s+=t),"stick-to-top"==c.options.sidebarBehavior&&(s=b.additionalMarginTop),"stick-to-bottom"==c.options.sidebarBehavior&&(s=o-c.stickySidebar.outerHeight()),s=t>0?Math.min(s,n):Math.max(s,o-c.stickySidebar.outerHeight()),s=Math.max(s,q),s=Math.min(s,r-c.stickySidebar.outerHeight());var u=c.container.height()==c.stickySidebar.outerHeight();f=(u||s!=n)&&(u||s!=o-c.stickySidebar.outerHeight())?e+s-c.sidebar.offset().top-c.paddingTop<=b.additionalMarginTop?"static":"absolute":"fixed"}if("fixed"==f)c.stickySidebar.css({position:"fixed",width:g(c.stickySidebar)+"px",transform:"translateY("+s+"px)",left:c.sidebar.offset().left+parseInt(c.sidebar.css("padding-left"))+"px",top:"0px"});else if("absolute"==f){var v={};"absolute"!=c.stickySidebar.css("position")&&(v.position="absolute",v.transform="translateY("+(e+s-c.sidebar.offset().top-c.stickySidebarPaddingTop-c.stickySidebarPaddingBottom)+"px)",v.top="0px"),v.width=g(c.stickySidebar)+"px",v.left="",c.stickySidebar.css(v)}else"static"==f&&h();"static"!=f&&1==c.options.updateSidebarHeight&&c.sidebar.css({"min-height":c.stickySidebar.outerHeight()+c.stickySidebar.offset().top-c.sidebar.offset().top+c.paddingBottom}),c.previousScrollTop=e}},c.onScroll(c),a(document).scroll(function(a){return function(){a.onScroll(a)}}(c)),a(window).resize(function(a){return function(){a.stickySidebar.css({position:"static"}),a.onScroll(a)}}(c))})}
204function g(a){var b;try{b=a[0].getBoundingClientRect().width}catch(a){}return"undefined"==typeof b&&(b=a.width()),b}var c={containerSelector:"",additionalMarginTop:0,additionalMarginBottom:0,updateSidebarHeight:!0,minWidth:0,disableOnResponsiveLayouts:!0,sidebarBehavior:"modern"};b=a.extend(c,b),b.additionalMarginTop=parseInt(b.additionalMarginTop)||0,b.additionalMarginBottom=parseInt(b.additionalMarginBottom)||0,d(b,this)}}(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.