PageSourceSearch

https://www.glossopdalefurniture.co.uk/js/responsive.js

js glossopdalefurniture.co.uk collected 2026-10-04 01:33:56 UTC 7,367 bytes, 254 lines download raw bytes

1$(function() {
2
3    var $body = $('body')
4
5    var side_nav = new function(){
6        var self = this
7
8        var $side_nav = $('div#side_nav_wrap')
9        if($side_nav.length == 0){
10            return
11        }
12
13        var $side_nav, $side_nav_ul, start_margin, side_nav_width, direction, $side_nav_button, floating
14
15        self.reset = function(){
16            $side_nav = $('div#side_nav_wrap')
17            $side_nav.width('')
18            $side_nav_ul = $side_nav.find('ul')
19            start_margin = $side_nav.css('margin-top') || ''
20            side_nav_width = $side_nav.width()
21            direction = $("#site_wrap").hasClass('vert_nav_left') ? 'left' : 'right'
22
23            $side_nav_button = $('<div />')
24                .addClass('side-nav-button fa')
25                .appendTo($side_nav)
26            $side_nav.width(side_nav_width)
27
28            floating = false
29
30        }
31
32        self.reposition = function(){
33            $side_nav.css('margin-top', start_margin)
34            var $window = $(window)
35            var window_height = $window.height()
36
37            var desired_nav_max_height = window_height * 0.8;
38            var breakpoint = (window_height < $(document).height() ? 876 : 892) + 20
39
40            if ($window.width() <= breakpoint) {
41                $side_nav_ul.css('max-height', desired_nav_max_height)
42                $side_nav.css('margin-top', "-"+($side_nav.outerHeight() > desired_nav_max_height ? desired_nav_max_height : $side_nav.outerHeight()) / 2+"px")
43                var new_floating = true
44            } else {
45                var new_floating = false
46            }
47
48            if(floating != new_floating){
49                $body.toggleClass('nav_floating', new_floating)
50                floating = new_floating
51            }
52        }
53
54        self.reset()
55        self.reposition()
56        $(window).on('load resize', function(){
57            self.reposition();
58        })
59
60        var toggled_on = true
61        self.toggle = function(){
62            toggled_on = !toggled_on
63
64            $side_nav_button.toggleClass('open', toggled_on)
65
66            var css = {}
67            var pos = 0
68            if(!toggled_on){
69                pos -= side_nav_width
70            }
71            css[direction] = pos + 'px'
72            $side_nav.animate(css, 200)
73        }
74        $side_nav_button.click(function() {
75            self.toggle()
76        })
77
78        self.toggle()
79
80        return self
81    }()
82
83    window.side_nav = side_nav
84
85    var skyscrapers = new function(){
86        var self = this
87
88        var $skyscrapers = $('#skyscraper_left, #skyscraper_right')
89
90        if($skyscrapers.length == 0){
91            return
92        }
93
94        var $side_container = $('#container_01b')
95        var $bottom_container = $('#container_04')
96        var $body = $('body')
97
98        // 702 +20 for padding and +20 for scroll
99        var skyscraper_breakpoint = 742
100        if($body.hasClass('body892')){
101            skyscraper_breakpoint += 190
102        }
103        $skyscrapers.each(function(){
104            skyscraper_breakpoint += $(this).width()
105        })
106        var responsive_skyscrapers = $body.hasClass('responsive-skyscrapers')
107
108        var skyscrapers = []
109        var skyscraper = function(element){
110            var self = this
111            skyscrapers.push(self)
112
113            var $element = $(element)
114            var id = element.id
115            var side = id='skyscraper_left' ? 'left' : 'right'
116            var bottom = false
117
118            self.move_to_bottom = function(){
119                $element
120                    .appendTo($bottom_container)
121                    .removeAttr('id', '')
122                    .addClass('skyscraper-bottom')
123            }
124
125            self.move_to_side = function(){
126                $element
127                    .prependTo($side_container)
128                    .attr('id', id)
129                    .removeClass('skyscraper-bottom')
130            }
131
132            return self
133        }
134
135        $skyscrapers.each(function(){
136            new skyscraper(this)
137        })
138
139        var skyscrapers_bottom = false
140
141        var check_position = function(){
142            if($(window).width() <= skyscraper_breakpoint) {
143                if(!skyscrapers_bottom){
144                    if(responsive_skyscrapers){
145                        for(var i in skyscrapers){
146                            skyscrapers[i].move_to_bottom()
147                        }
148                    }
149                    skyscrapers_bottom = true
150                    $body.addClass('skyscrapers-hidden')
151                }
152            } else {
153                if(skyscrapers_bottom){
154                    if(responsive_skyscrapers){
155                        for(var i in skyscrapers){
156                            skyscrapers[i].move_to_side()
157                        }
158                    }
159                    skyscrapers_bottom = false
160                    $body.removeClass('skyscrapers-hidden')
161                }
162            }
163        }
164
165        check_position()
166        $(window).on('load resize', function(){
167            check_position()
168        })
169
170    }()
171
172    $('.page-item-type-media .page-item-content>iframe').each(function(){
173        var $this = $(this)
174        var height = $this.attr('height')
175        var width = $this.attr('width')
176
177        if(!height || !width){
178            return
179        }
180
181        var ratio = height / width
182
183        var check_ratio = function(){
184            var new_width = $this.width()
185            if(new_width != width){
186                width = new_width
187                height = width * ratio
188                $this.height(height)
189            }
190        }
191        check_ratio()
192
193        $(window).on('load resize', function(){
194            check_ratio()
195        })
196    })
197
198    var original_tables = new function(){
199
200        var tables = []
201
202        $('.page-standard-original table').each(function(){
203            var $table = $(this)
204            var style = $table.attr('style')
205            var convert = style && style.match(/6\d\dpx/)
206            if(!convert){
207                style = $table.attr('width')
208                if(style && style.match(/6\d\d/)){
209                    convert = true
210                }
211            }
212
213            convert && tables.push($table)
214        })
215
216        $('#footer_text>table').each(function(){
217            var $table = $(this)
218            tables.push($table)
219        })
220
221
222        $.each(tables, function(){
223            var $table = this
224            $table.addClass('original-table-layout')
225
226            $table.removeAttr('width')
227                .css({
228                    'width':'100%'
229                })
230
231            $table.find('tr').each(function(){
232                var $tr = $(this)
233                if(!$tr.closest('table').is($table)){
234                    // Not immediate table's tr
235                    return
236                }
237                var $tds = $tr.children('td')
238                if($tds.length == 2){
239                    $tds.each(function(){
240                        var $td = $(this)
241                        $td.addClass('original-table-cell')
242                        var $children = $td.children()
243                        if($children.length == 1 && $children.is('img')){
244                            $td.addClass('original-table-cell-image')
245                        }
246                    })
247                }
248            })
249
250        })
251    }()
252
253
254})

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.