PageSourceSearch

https://castings.plc.uk/scripts/owner/core/HeightAdjustments.js?d=2

js castings.plc.uk collected 2026-10-07 01:17:51 UTC 9,802 bytes, 265 lines download raw bytes

1
2_heightAdjustments = {
3
4    initializeConsistentHeight: function ()
5    {
6        var viewportWidth = $(window).outerWidth(true);
7        
8        // Re-sets any elements previosuly set with consistent height back to 0
9        $('[class*="consistent-height-"]').css("min-height", "auto");
10
11        // Checks if the width of the viewport is more than 768px
12        if (viewportWidth > 768) {
13
14            for (ii = 1; ii < 10; ii++) {
15                // Sets max height to 0
16                var max_height = 0;
17
18                // Resets the min-height and height when screen is resized
19                if ($(".consistent-height-" + ii).css("min-height") != "0px") {
20                    $(".consistent-height-" + ii).css({
21                        "min-height": 0
22                    });
23                }
24
25                // Detects the largest element which is to be resized
26                $(".consistent-height-" + ii).each(function () {
27                    if ($(this).outerHeight(false) > max_height) {
28                        max_height = $(this).outerHeight(false);
29                    }
30                });
31
32                // Applies the largest height of the all elements
33                $(".consistent-height-" + ii).css({
34                    "min-height": max_height
35                });
36            }
37        }
38
39    },
40
41    initializePageMinHeight: function ()
42    {
43        // Detect height and width of the viewport
44        var viewportHeight = $(window).outerHeight(true);
45        var viewportWidth = $(window).outerWidth(true);
46        console.log("tytytytytytytytyruru")
47
48        // Checks if the width of the viewport is more than 768px
49        if (viewportWidth > 768) {
50
51            // Resets the min-height when screen is resized
52            if ($('#page-middle').css("min-height") != "0px") {
53                $('#page-middle').css("min-height", 0);
54            }
55
56            // Detect height of body
57            var bodySize = $('#body-wrapper').height();
58
59            // Only fires when the body height is smaller then the viewport
60            if (viewportHeight > bodySize) {
61                // Detects the height of the footer
62                var footerHeight = $('#page-bottom').outerHeight();
63
64                // Detects the available space within the viewport
65                var availableSpace = viewportHeight - footerHeight;
66
67                // Checks if the width of the viewport is smaller than 992px
68                if (viewportWidth < 992) {
69                    // Detects the height of the header
70                    var headerHeight = $('#page-top').outerHeight();
71
72                    // Removes the height of the header from the available space
73                    availableSpace = availableSpace - headerHeight;
74                }
75
76                // Applies the available space as a minimum height to the page-content element
77                $('#page-middle').css("min-height", availableSpace);
78            }
79        }
80    },
81
82
83    //=== Consistent height applied to the list items ===//
84    initializeListItemMinHeight: function ()
85    {
86        var viewportWidth = $(window).outerWidth(true);
87
88        var list = $(".list");
89
90        // Checks if the width of the viewport is more than 768px
91        if (viewportWidth > 768 || list.hasClass('conveyor-carousel')) {
92
93            list.each(function () {
94                var max_height = 0;
95
96                var itemContentWrapper = $(this).find(".consistent-height-list-item");
97
98                // Resets the min-height and height when screen is resized
99                if ($(itemContentWrapper).css("min-height") != "0px") {
100                    $(itemContentWrapper).css({
101                        "min-height": 0
102                    });
103                }
104
105                $(itemContentWrapper).each(function () {
106                    if ($(this).outerHeight() > max_height) {
107                        max_height = $(this).outerHeight();
108                    }
109                });
110
111                // Applies the largest height of the all elements
112                $(itemContentWrapper).css({
113                    // Both min-height and height is applied to counter act over sizing due to padding 
114                    "min-height": max_height
115                });
116            });
117        }
118    },
119
120    //=== Consistent height applied to the chart titles ===//
121    initializeChartTitleMinHeight: function () {
122        var viewportWidth = $(window).outerWidth(true);
123
124        // Checks if the width of the viewport is more than 768px
125        if (viewportWidth > 768) {
126
127            var chartContainer = $(".umb-grid-row");
128
129            chartContainer.each(function () {
130                var max_height = 0;
131
132                var itemContentWrapper = $(this).find(".consistent-height-chart-title");
133
134                // Resets the min-height and height when screen is resized
135                if ($(itemContentWrapper).css("min-height") != "0px") {
136                    $(itemContentWrapper).css({
137                        "min-height": 0
138                    });
139                }
140
141                $(itemContentWrapper).each(function () {
142                    if ($(this).outerHeight() > max_height) {
143                        max_height = $(this).outerHeight();
144                    }
145                });
146
147                // Applies the largest height of the all elements
148                $(itemContentWrapper).css({
149                    // Both min-height and height is applied to counter act over sizing due to padding 
150                    "min-height": max_height
151                });
152            });
153        }
154    },
155
156    //=== Slider height relative to the largest item ===//
157    initializeSliderAdjustment: function () {
158        var viewportWidth = $(window).outerWidth(true);
159
160        // Checks if the width of the viewport is more than 768px
161        if (viewportWidth > 768) {
162
163            // Detects sliders
164            var slider = $('.carousel');
165
166            // Iterates over each slider
167            slider.each(function () {
168                var slider = $(this);
169
170                // Resets the min-height when the viewport is resized
171                if (slider.css("min-height") != "0px") {
172                    slider.css("min-height", 0);
173                }
174
175                // Detects each item within the slider 
176                var eachItem = slider.find('.carousel-slide ');
177
178                // Defaults the largest height to 0
179                var largestHeight = 0;
180
181                // Iterates over each item
182                eachItem.each(function () {
183
184                    var item = $(this);
185
186                    // Removes class if already applied on previous load
187                    if (item.hasClass("concealed")) {
188                        // Removes the display:none style
189                        item.removeClass("concealed");
190                    }
191
192                    // Detects the items height
193                    var itemHeight = item.find('.slick-slide').outerHeight(true);
194
195                    // Compares the item height to the current largest item height
196                    if (itemHeight > largestHeight) {
197                        // If the item height is larger then the current largest item height, the largest height updates to match the item height. 
198                        largestHeight = itemHeight;
199                    }
200
201                    // Applies display:none; to the item
202                    item.addClass("concealed");
203
204                    // Applies the largest item height to the slider
205                    item.css("min-height", largestHeight);
206                });
207
208                // Applies the largest item height to the slider
209                slider.css("min-height", largestHeight);
210            });
211        }
212    },
213    initializeFeedAutoHeight: function () {
214
215        // Detects the feeds
216        var interactiveChart = $('#interactive-chart');
217        var investmentCalculator = $('#investment-calculator');
218        var historicalSharePriceLookUp = $('#historical-share-price-look-up');
219        var emailAlerts = $('#email-alerts');
220
221        // Interactive chart
222        if (interactiveChart.length) {
223            EurolandToolIntegrationObject.set("interactive-chart");
224        }
225
226        // Investment calculator
227        if (investmentCalculator.length) {
228            EurolandToolIntegrationObject.set("investment-calculator");
229        }
230
231        // Historical share price look up
232        if (historicalSharePriceLookUp.length) {
233            EurolandToolIntegrationObject.set("historical-share-price-look-up");
234        }
235
236        // Email alerts
237        if (emailAlerts.length) {
238            EurolandToolIntegrationObject.set("email-alerts");
239        }
240    }
241};
242
243
244// Initializers
245$(window).on("load", function () {
246    _heightAdjustments.initializeChartTitleMinHeight();
247    _heightAdjustments.initializeListItemMinHeight();
248    _heightAdjustments.initializeSliderAdjustment();
249    _heightAdjustments.initializeConsistentHeight();
250    _heightAdjustments.initializePageMinHeight();
251    _heightAdjustments.initializeFeedAutoHeight();
252});
253
254$(window).on("resize", function () {
255    _heightAdjustments.initializeChartTitleMinHeight();
256    _heightAdjustments.initializeListItemMinHeight();
257    _heightAdjustments.initializeSliderAdjustment();
258    _heightAdjustments.initializeConsistentHeight();
259    _heightAdjustments.initializePageMinHeight();
260    _heightAdjustments.initializeFeedAutoHeight();
261});
262
263$(document).on("shown.bs.tab", function () {
264    _heightAdjustments.initializeChartTitleMinHeight();
265});

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.