PageSourceSearch

https://www.mysafetylabels.com/js/department_responsive.js?v=2026-38

js mysafetylabels.com collected 2026-09-24 21:29:05 UTC 9,757 bytes, 239 lines download raw bytes

1function equalheight(container) {
2    var currentTallest = 0,
3        currentRowStart = 0,
4        rowDivs = new Array(),
5        getCurrentHeight = 0,
6        $el,
7        topPosition = 0;
8    $(container).each(function () {
9        $el = $(this);
10        $($el).height('auto');
11        topPostion = $el.offset().top;
12        getCurrentHeight = $($el).parents(".ss_reponsive_cell").height() + 7;
13        if (currentRowStart != topPostion) {
14            for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
15                rowDivs[currentDiv].height(currentTallest);
16            }
17            rowDivs.length = 0; // empty the array
18            currentRowStart = topPostion;
19            currentTallest = $el.height();
20            rowDivs.push($el);
21        } else {
22            rowDivs.push($el);
23            currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
24
25        }
26        for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
27            rowDivs[currentDiv].height(currentTallest);
28            //if (container == ".ss_grid_title_cont" && currentTallest > 0) {
29            //  rowDivs[currentDiv].parents(".ss_reponsive_cell").css("height", (currentTallest + getCurrentHeight) + "px");
30            //}
31        }
32    });
33}
34
35function setDepartmentWidth() {
36    $(".Department_grid").each(function () {
37        var currentGridId = $(this).attr("id");
38        var ColContDept = $("#" + currentGridId).width() / 220;
39        var TotalCellDept = ColContDept.toString().split(".")[0];
40        var TotalCellSizeDept = 100 / TotalCellDept;
41
42        var cols = $("#" + currentGridId).data("cols");
43        var count = $("#" + currentGridId).data("count");
44
45        if ($("#" + currentGridId + " .videoGrid_body").length > 0) {
46            cols = 6;
47        }
48
49        if ($(this).attr('data-asseenlive') == "0") {
50            ColContDept = $("#" + currentGridId).width() / 300;
51            TotalCellDept = ColContDept.toString().split(".")[0];
52            TotalCellSizeDept = 100 / TotalCellDept;
53            cols = 4;
54        }
55
56        if (count < 6 && $(window).width() >= 1390) {
57            TotalCellSizeDept = 100 / cols;
58        }
59        $("#" + currentGridId + " .deptProduct_content").not(".dept_2x").removeAttr("style").css("width", TotalCellSizeDept + "%");
60        $("#" + currentGridId + " .deptProduct_content.dept_2x").removeAttr("style").css("width", (TotalCellSizeDept * 2) + "%");
61    });
62}
63
64function setDepartmentHeightWidth() {
65    $(".Department_grid").each(function () {
66        var currentGridId = $(this).attr("id");
67        var ColContDept = $("#" + currentGridId).width() / 220;
68        var TotalCellDept = ColContDept.toString().split(".")[0];
69        var TotalCellSizeDept = 100 / TotalCellDept;
70
71        var cols = $("#" + currentGridId).data("cols");
72        var count = $("#" + currentGridId).data("count");
73        if (count < 6 && $(window).width() >= 1390) {
74            TotalCellSizeDept = 100 / cols;
75        }
76        if (currentGridId == "department_grid_109918" && cols == 2 && $(window).width() >= 1390) {
77            $("#department_grid_109918 .deptProduct_content.dept_2x").removeAttr("style").css("width", TotalCellSizeDept + "%");
78            $(".deptProductBody").css("height", "auto");
79        }
80        else if (currentGridId == "department_grid_109918" && cols == 2) {
81            $(".deptProductBody").css("height", "auto");
82        }
83    });
84}
85
86function setSkuCellWidth() {
87    $(".ss_responsive_table").each(function () {
88        var ScreenSize = $(".ss_dept_mid_main").width();
89        var cols = $(this).data("cols");
90        var count = $(this).data("count");
91
92        var ColCont = ScreenSize / 168;
93        var TotalCell = ColCont.toString().split(".")[0];
94        if (count < 8 && $(window).width() >= 1390) {
95            TotalCell = cols;
96        }
97        var TotalCellSize = 100 / TotalCell;
98
99        if ($(this).hasClass("show_med_res")) {
100            if (typeof (flagSiteTuner) != "undefined" && flagSiteTuner == true) {
101                ColCont = ScreenSize / 260;
102                TotalCell = ColCont.toString().split(".")[0];
103                if (count < 5 && $(window).width() >= 1390) {
104                    TotalCell = cols;
105                }
106            }
107            else {
108                ColCont = ScreenSize / 220;
109                TotalCell = ColCont.toString().split(".")[0];
110                if (count < 6 && $(window).width() >= 1390) {
111                    TotalCell = cols;
112                }
113
114            }
115          
116            TotalCellSize = 100 / TotalCell;
117        }
118        if ($(this).attr('data-asseenlive') == "0" || $(this).hasClass("four-column")) {
119            ColCont = ScreenSize / 300;
120            TotalCell = ColCont.toString().split(".")[0];
121            if (count < 6 && $(window).width() >= 1390) {
122                TotalCell = cols;
123                if ($(this).hasClass("four-column") && count < 5) {
124                    TotalCell = count;
125                } else if ($(this).hasClass("four-column") && count == 5) {
126                    TotalCell = 4;
127                }
128            }
129            TotalCellSize = 100 / TotalCell;
130        }
131
132        $(this).find(".ss_reponsive_cell").removeClass().addClass("ss_reponsive_cell").removeAttr("style").css("width", TotalCellSize + "%");
133        if (!$(this).hasClass("four-column")) {
134            $(this).find(".ss_reponsive_cell:nth-child( " + TotalCell + 'n+' + TotalCell + ")").addClass("gridLast");
135        }        
136        $(this).find(".ss_reponsive_cell:nth-child(-n+" + TotalCell + ")").addClass("grayBorderTop");
137    });
138}
139
140//for department product cell
141$(window).on("load", function (j) {
142    setSkuCellWidth();
143    setDepartmentWidth();
144    equalheight(".deptProduct_content .product_heading");
145    equalheight(".deptProduct_content .deptProductBody");
146    if (typeof (flagSiteTuner) != "undefined" && flagSiteTuner == true) {
147        equalheight(".ss_reponsive_cell .ss-text-cont");
148    }
149    setDepartmentHeightWidth();
150});
151
152$(window).on("resize", function (k) {
153    setSkuCellWidth();
154    setDepartmentWidth();
155    equalheight(".deptProduct_content .product_heading");
156    equalheight(".deptProduct_content .deptProductBody");
157    if (typeof (flagSiteTuner) != "undefined" && flagSiteTuner == true) {
158        equalheight(".ss_reponsive_cell .ss-text-cont");
159    }
160});
161//$(window).scroll(function (k) {
162//    setSkuCellWidth();
163//    setDepartmentWidth();
164//    equalheight(".deptProduct_content .product_heading");
165//    equalheight(".deptProduct_content .deptProductBody");
166//});
167
168//udated code on 11/09/2024 by vijay sharma due to detect touch devices 
169//if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
170//if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.ontouchstart !== undefined) {
171//  //for all product box equal height
172//  $(window).on("load", function(e) {
173//    //$('.ss_reponsive_cell').parent().addClass('ss-product-detail-view');
174//    equalheight('.ss-product-detail-view .ss_reponsive_cell');
175//  });
176//  $(window).on("resize", function(f) {
177//    //$('.ss_reponsive_cell').parent().addClass('ss-product-detail-view');
178//    equalheight('.ss-product-detail-view .ss_reponsive_cell');
179//  });
180//} else {
181
182//    /*$(".ss_responsive_table").each(function () {*/
183
184//        /*if ($(this).find(".ss-product-thumb").length == $(this).find(".ss_nocellbody").length || $(this).attr('data-asseenlive') == "0") {*/
185//            // condition added on 3/8/23 for stop render in search result page typeof($(".az-search")) == "undefined"
186//            //if ($("#resultssection").length <= 0) {
187//            //    $(this).addClass('ss-product-detail-view ss_no_description');
188//            //}
189
190//            //} else {
191//            //    var currentGridId = $(this).parents(".ss_responsive_grid").attr("id");
192//            //    if (!$("#" + currentGridId + " .ss_responsive_table").hasClass("ss-product-detail-view")) {
193//            //        $("#" + currentGridId + " .ss_reponsive_cell").mouseover(function () {
194//            //            $(this).addClass("on");
195//            //        });
196
197//            //        $("#" + currentGridId + " .ss_reponsive_cell  a").on('blur', function () {
198//            //            $(this).parents('.ss_reponsive_cell').removeClass("on");
199//            //        }).on('focus', function () {
200//            //            $(this).parents('.ss_reponsive_cell').addClass("on");
201//            //        });
202//            //        $("#" + currentGridId + " .ss_reponsive_cell").mouseout(function () {
203//            //            $(this).removeClass("on");
204//            //        });
205//            //    }
206//            //}
207//        //});
208
209//  $(window).on("load", function(e) {
210//    equalheight(".ss_grid_title_cont");
211//    equalheight('.ss-product-detail-view .ss_reponsive_cell');
212//  });
213//  $(window).on("resize", function (f) {        
214//    equalheight(".ss_grid_title_cont");
215//    equalheight('.ss-product-detail-view .ss_reponsive_cell');
216//  });
217//    /*
218//    $(window).scroll(function (k) {
219//    setTimeout(function () {
220//        equalheight(".deptProduct_content .product_heading");
221//        equalheight(".deptProduct_content .deptProductBody");
222//    }, 750);
223//    });
224//    */
225//}
226$(window).on("load", function (e) {
227    equalheight(".ss_grid_title_cont");
228});
229$(window).on("resize", function (f) {
230    equalheight(".ss_grid_title_cont");
231});
232
233function dep_res_doequalheight() {
234    setTimeout(function () {
235        equalheight(".deptProduct_content .product_heading");
236        equalheight(".deptProduct_content .deptProductBody");
237        dep_res_equalheight = false;
238    }, 500);
239}

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.