PageSourceSearch

https://jainsite.com/wp-content/plugins/really-simple-popup/js/hs_rsp_popup.min.js?ver=6.8.10

js jainsite.com collected 2026-09-24 10:17:51 UTC 25,239 bytes, 605 lines download raw bytes

1var hsRspOrigImgWidth = null;
2var hsRspOrigImgHeight = null;
3var hsRspDefaultAnimation = "fade";
4var hsRspMinImgWidth = 150;
5var hsRspMinImgHeight = 150;
6var hsRspIframeWidth = -1;
7var hsRspIframeHeight = -1;
8var hsRspDivWidth = -1;
9var hsRspDivHeight = -1;
10var hsRspModalMarginTop = 90;
11var hsRspMaxModalWidth = 90;
12var hsRspMaxModalHeight = 90;
13var hsRspSetWidth = null;
14var hsRspSetHeight = null;
15var hsRspResizeTimer;
16var hsRspCurrentType = null;
17var hsRspImgGallery = [];
18var hsRspIsPopupOpen = false;
19var hsRspDisableResizeOnWindowChange = false;
20jQuery(document).ready(function() {
21    if (jQuery("#hs-rsp-popup-bg").length == 0) {
22        _hsRspSetupThumbnails();
23        _hsRspSetupGallery();
24        _hsRspSetupEventHandlers();
25    }
26});
27
28function hsRspShowLoader() {
29    _hsRspSetupPopup();
30    jQuery("#hs-rsp-image-wrap").css("visibility", "hidden");
31    if (jQuery("#hs-rsp-image-wrap p").length == 1) {
32        jQuery("#hs-rsp-image-wrap p").remove();
33    }
34    if (jQuery("#hs-rsp-image-loader").length == 0) {
35        jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-loader"></div>');
36    }
37    jQuery("#hs-rsp-image-loader").css({
38        left: _hsRspCalcLeftMargin(32),
39        top: _hsRspCalcTopMargin(32)
40    });
41}
42
43function hsRspCloseLoader() {
44    if (jQuery("#hs-rsp-image-loader").length == 1) {
45        jQuery("#hs-rsp-image-loader").remove();
46    }
47}
48
49function hsRspLoadImage(imgurl, title) {
50    hsRspDisableResizeOnWindowChange = false;
51    if (jQuery("#hs-rs-big-img").length == 1) {
52        jQuery("#hs-rs-big-img").remove();
53    }
54    if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
55        jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="' + imgurl + '" alt="' + imgurl + '"/>');
56        jQuery("#hs-rsp-image-wrap img").load(function() {
57            jQuery(this).after('<p class="popup-title pimage">' + title + "</p>");
58        });
59    } else {
60        jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="' + imgurl + '" alt="' + imgurl + '"/>');
61    }
62    jQuery("#hs-rs-big-img").load(function() {
63        hsRspOrigImgWidth = jQuery("#hs-rs-big-img").width();
64        hsRspOrigImgHeight = jQuery("#hs-rs-big-img").height();
65        var img = {};
66        img = _hsRspScalePopup(jQuery("#hs-rs-big-img"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspOrigImgWidth, hsRspOrigImgHeight);
67        if (hsRspImgGallery.length > 1) {
68            if (jQuery("#hsrsp-leftarrow").length == 0) {
69                jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');
70                jQuery("#hsrsp-leftarrow").click(function(event) {
71                    event.preventDefault();
72                    _hsRspPreviousImg();
73                });
74            }
75            if (jQuery("#hsrsp-rightarrow").length == 0) {
76                jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');
77                jQuery("#hsrsp-rightarrow").click(function(event) {
78                    event.preventDefault();
79                    _hsRspNextImg();
80                });
81            }
82            jQuery("#hsrsp-leftarrow").css({
83                top: parseInt((img.iheight / 2) - ((64 - 10) / 2)),
84                left: 10
85            });
86            jQuery("#hsrsp-rightarrow").css({
87                top: parseInt((img.iheight / 2) - ((64 - 10) / 2)),
88                left: parseInt((img.iwidth) - 54)
89            });
90        }
91        _hsRspShowPopup(img.iwidth, img.iheight);
92    });
93}
94
95function hsRspLoadFixedImage(imgurl, title, height, width) {
96    hsRspDisableResizeOnWindowChange = true;
97    hsRspSetWidth = width;
98    hsRspSetHeight = height;
99    if (jQuery("#hs-rs-big-img").length == 1) {
100        jQuery("#hs-rs-big-img").remove();
101    }
102    if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
103        jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="' + imgurl + '" alt="' + imgurl + '"/>');
104        jQuery("#hs-rsp-image-wrap img").load(function() {
105            jQuery(this).after('<p class="popup-title pimagef">' + title + "</p>");
106        });
107    } else {
108        jQuery("#hs-rsp-image-wrap").append('<img id="hs-rs-big-img" src="' + imgurl + '" alt="' + imgurl + '"/>');
109    }
110    jQuery("#hs-rs-big-img").load(function() {
111        hsRspOrigImgWidth = jQuery("#hs-rs-big-img").width();
112        hsRspOrigImgHeight = jQuery("#hs-rs-big-img").height();
113        var img = {};
114        if (hsRspImgGallery.length > 1) {
115            if (jQuery("#hsrsp-leftarrow").length == 0) {
116                jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-leftarrow" href="#hsrsp-left">Previous</a>');
117                jQuery("#hsrsp-leftarrow").click(function(event) {
118                    event.preventDefault();
119                    _hsRspPreviousImg();
120                });
121            }
122            if (jQuery("#hsrsp-rightarrow").length == 0) {
123                jQuery("#hs-rsp-image-wrap").append('<a id="hsrsp-rightarrow" href="#hsrsp-right">Next</a>');
124                jQuery("#hsrsp-rightarrow").click(function(event) {
125                    event.preventDefault();
126                    _hsRspNextImg();
127                });
128            }
129            jQuery("#hsrsp-leftarrow").css({
130                top: parseInt((height / 2) - ((64 - 10) / 2)),
131                left: 10
132            });
133            jQuery("#hsrsp-rightarrow").css({
134                top: parseInt((height / 2) - ((64 - 10) / 2)),
135                left: parseInt((width) - 54)
136            });
137        }
138        _hsRspShowPopup(width, height);
139    });
140}
141
142function hsRspLoadIframe(iframurl, title) {
143    hsRspDisableResizeOnWindowChange = false;
144    jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="' + iframurl + '" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');
145    if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
146        jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">' + title + "</p>");
147    }
148    var ifr = {};
149    ifr = _hsRspScalePopup(jQuery("#hs-rsp-iframe"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspIframeWidth, hsRspIframeHeight);
150    jQuery("#hs-rsp-iframe").attr({
151        width: ifr.iwidth,
152        height: ifr.iheight
153    });
154    jQuery("#hs-rsp-iframe").load(iframurl, function() {
155        _hsRspShowPopup(ifr.iwidth, ifr.iheight);
156    });
157}
158
159function hsRspLoadIframeFixedWidth(iframurl, title, height, width) {
160    hsRspDisableResizeOnWindowChange = true;
161    hsRspSetWidth = width;
162    hsRspSetHeight = height;
163    jQuery("#hs-rsp-image-wrap").append('<iframe frameborder="0" id="hs-rsp-iframe" src="' + iframurl + '" name="hs-rsp-iframe" vspace="0" hspace="0" allowtransparency="true"></iframe>');
164    if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
165        jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">' + title + "</p>");
166    }
167    jQuery("#hs-rsp-iframe").attr({
168        width: width,
169        height: height
170    });
171    jQuery("#hs-rsp-iframe").load(iframurl, function() {
172        _hsRspShowPopup(width, height);
173    });
174}
175
176function hsRspLoadDiv(linktarget, title) {
177    hsRspDisableResizeOnWindowChange = false;
178    if (/\#.*/.test(linktarget)) {
179        jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">' + jQuery(linktarget).html() + "</div>");
180        if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
181            jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">' + title + "</p>");
182        }
183        var div = {};
184        div = _hsRspScalePopup(jQuery("#hs-rsp-div"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspDivWidth, hsRspDivHeight);
185        jQuery("#hs-rsp-div").css({
186            width: div.iwidth,
187            height: div.iheight
188        });
189        _hsRspShowPopup(div.iwidth, div.iheight);
190    } else {
191        this.hsRspCurrentType = "iframe";
192        hsRspLoadIframe(linktarget, title);
193    }
194}
195
196function hsRspLoadFixedWidthDiv(linktarget, title, height, width) {
197    hsRspDisableResizeOnWindowChange = true;
198    hsRspSetWidth = width;
199    hsRspSetHeight = height;
200    if (/\#.*/.test(linktarget)) {
201        jQuery("#hs-rsp-image-wrap").append('<div id="hs-rsp-div">' + jQuery(linktarget).html() + "</div>");
202        if (title !== undefined && title !== "" && jQuery("#hs-rsp-image-wrap .popup-title").length == 0) {
203            jQuery("#hs-rsp-image-wrap").append('<p class="popup-title">' + title + "</p>");
204        }
205        _hsRspShowPopup(width, height);
206    } else {
207        this.hsRspCurrentType = "iframe";
208        hsRspLoadIframeFixedWidth(linktarget, title, height, width);
209    }
210}
211
212function hsRspClosePopup() {
213    if (jQuery("#hs-rsp-popup-bg").length == 1) {
214        jQuery("#hs-rsp-popup-bg").fadeOut("fast", function() {
215            jQuery(this).remove();
216        });
217        hsRspCurrentType = null;
218        hsRspOrigImgWidth = null;
219        hsRspOrigImgHeight = null;
220        hsRspIsPopupOpen = false;
221    }
222}
223
224function _hsRspSetupPopup() {
225    if (jQuery("#hs-rsp-popup-bg").length == 0) {
226        jQuery("body").append('<div id="hs-rsp-popup-bg"></div>');
227    }
228    if (jQuery("#hs-rsp-image-wrap").length == 0) {
229        jQuery("#hs-rsp-popup-bg").append('<div id="hs-rsp-image-wrap"></div>');
230    }
231    if (jQuery("#hs-rsp-close").length == 0) {
232        jQuery("#hs-rsp-image-wrap").append('<a id="hs-rsp-close" href="#hs-rsp-close" title="click to close">Close</a>');
233       
234
235        // jQuery("#hs-rsp-image-wrap").append('<a id="instagram_follow" href="https://www.instagram.com/jainsite/?hl=en" target="_blank" title="Instagram follow">Instagram follow</a>');
236    }
237}
238
239function _hsRspShowPopup(imgWidth, imgHeight) {
240    if (jQuery("#hs-rsp-image-wrap").length == 1) {
241        jQuery("#hs-rsp-image-wrap").css({
242            left: _hsRspCalcLeftMargin(imgWidth) + "px"
243        });
244        jQuery("#hs-rsp-image-wrap img").prop({
245            width: imgWidth,
246            height: imgHeight
247        });
248        if (hsRspIsPopupOpen) {
249            jQuery("#hs-rsp-image-wrap").css({
250                marginTop: hsRspModalMarginTop
251            });
252        } else {
253            jQuery("#hs-rsp-image-wrap").css({
254                marginTop: ((imgHeight + 60) * -1)
255            });
256        }
257        hsRspCloseLoader();
258        if (hsRspDefaultAnimation == "slide-down") {
259            jQuery("#hs-rsp-image-wrap").fadeIn(100, function() {
260                jQuery("#hs-rsp-image-wrap").css("visibility", "visible");
261                if (!hsRspIsPopupOpen) {
262                    jQuery("#hs-rsp-image-wrap").animate({
263                        marginTop: hsRspModalMarginTop
264                    }, 200);
265                }
266                hsRspIsPopupOpen = true;
267            });
268        } else {
269            jQuery("#hs-rsp-image-wrap").css({
270                "display": "none",
271                "visibility": "visible",
272                "marginTop": hsRspModalMarginTop
273            }).fadeIn(200, function() {
274                hsRspIsPopupOpen = true;
275            });
276        }
277    }
278}
279
280function _hsRspSetupThumbnails() {
281    var thumbnails = jQuery("a:has(img)").not(".no-hsrsp-popup").filter(function() {
282        if (jQuery(this).find("img.no-hsrsp-popup").length == 1) {
283            return false;
284        } else {
285            return /\.(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr("href"));
286        }
287    });
288    thumbnails.addClass("hs-rsp-popup");
289}
290
291function _hsRspSetupGallery() {
292    hsRspImgGallery = jQuery(".hs-rsp-popup").not(".iframe, .hiddendiv, .hs-rsp-nogallery");
293    if (jQuery(".hs-rsp-nogallery").length >= 1) {
294        hsRspImgGallery = [];
295    }
296}
297
298function _hsRspSetupEventHandlers() {
299    jQuery(window).resize(function() {
300        if (jQuery("#hs-rsp-image-wrap").length == 1) {
301            clearTimeout(hsRspResizeTimer);
302            hsRspResizeTimer = setTimeout(_hsRspAnimateResize, 100);
303        }
304    });
305    jQuery(".hs-rsp-popup").click(function(event) {
306        event.preventDefault();
307        if (jQuery(this).hasClass("iframe")) {
308            hsRspCurrentType = "iframe";
309            hsRspShowLoader();
310            var iframeTitle = jQuery(this).attr("title");
311            if (jQuery(this).attr("data-popupheight") !== undefined && jQuery(this).attr("data-popupheight") !== undefined) {
312                hsRspLoadIframeFixedWidth(jQuery(this).attr("href"), iframeTitle, jQuery(this).attr("data-popupheight"), jQuery(this).attr("data-popupwidth"));
313            } else {
314                hsRspLoadIframe(jQuery(this).attr("href"), iframeTitle);
315            }
316        } else {
317            if (jQuery(this).hasClass("hiddendiv")) {
318                hsRspCurrentType = "div";
319                hsRspShowLoader();
320                var divTitle = jQuery(this).attr("title");
321                if (jQuery(this).attr("data-popupheight") !== undefined && jQuery(this).attr("data-popupheight") !== undefined) {
322                    hsRspLoadFixedWidthDiv(jQuery(this).attr("href"), divTitle, jQuery(this).attr("data-popupheight"), jQuery(this).attr("data-popupwidth"));
323                } else {
324                    hsRspLoadDiv(jQuery(this).attr("href"), divTitle);
325                }
326            } else {
327                hsRspCurrentType = "image";
328                hsRspShowLoader();
329                var imgTitle = jQuery(this).find("img").attr("alt");
330                hsRspLoadImage(jQuery(this).attr("href"), imgTitle);
331                if (jQuery(this).attr("data-popupheight") !== undefined && jQuery(this).attr("data-popupheight") !== undefined) {
332                    hsRspLoadFixedImage(jQuery(this).attr("href"), imgTitle, jQuery(this).attr("data-popupheight"), jQuery(this).attr("data-popupwidth"));
333                } else {
334                    hsRspLoadImage(jQuery(this).attr("href"), imgTitle);
335                }
336            }
337        }
338    });
339    jQuery("body").on("click", "#hs-rsp-popup-bg, #hs-rsp-image-wrap", function(event) {
340        if (event.srcElement == event.currentTarget) {
341            event.preventDefault();
342            hsRspClosePopup();
343        }
344    });
345    jQuery("body").on("click", "#hs-rsp-close", function(event) {
346        event.preventDefault();
347        hsRspClosePopup();
348    });
349    jQuery(document).keyup(function(e) {
350        if (e.which == 37 || e.which == 39) {
351            var img = jQuery("#hs-rs-big-img");
352            if (hsRspImgGallery.length > 1 && e.which == 37 && img.length == 1) {
353                _hsRspPreviousImg();
354            }
355            if (hsRspImgGallery.length > 1 && e.which == 39 && img.length == 1) {
356                _hsRspNextImg();
357            }
358        }
359        if (e.which == 27) {
360            hsRspClosePopup();
361        }
362    });
363}
364
365function _hsRspPreviousImg() {
366    var img = jQuery("#hs-rs-big-img");
367    var curIndex = -1;
368    var newImgIndex = -1;
369    var newImg = null;
370    var prevImageLink = null;
371    for (var i = 0; i < hsRspImgGallery.length; i++) {
372        if (jQuery(hsRspImgGallery[i]).attr("href") == img.attr("src")) {
373            curIndex = i;
374        }
375    }
376    if (curIndex == 0) {
377        newImgIndex = hsRspImgGallery.length - 1;
378    } else {
379        if (curIndex > 0) {
380            newImgIndex = --curIndex;
381        }
382    }
383    newImg = jQuery(hsRspImgGallery[newImgIndex]).attr("href");
384    jQuery("#hs-rsp-image-wrap").fadeOut("fast", function() {
385        jQuery(this).css({
386            visibility: "hidden",
387            display: "block"
388        });
389        hsRspShowLoader();
390        prevImageLink = jQuery('a[href="' + newImg + '"]');
391        if (jQuery(prevImageLink).attr("data-popupheight") !== undefined && jQuery(prevImageLink).attr("data-popupheight") !== undefined) {
392            hsRspLoadFixedImage(newImg, jQuery(prevImageLink).find("img").attr("alt"), jQuery(prevImageLink).attr("data-popupheight"), jQuery(prevImageLink).attr("data-popupwidth"));
393        } else {
394            hsRspLoadImage(newImg, jQuery(prevImageLink).find("img").attr("alt"));
395        }
396    });
397}
398
399function _hsRspNextImg() {
400    var img = jQuery("#hs-rs-big-img");
401    var curIndex = -1;
402    var newImgIndex = -1;
403    var newImg = null;
404    var nextImgLink = null;
405    for (var i = 0; i < hsRspImgGallery.length; i++) {
406        if (jQuery(hsRspImgGallery[i]).attr("href") == img.attr("src")) {
407            curIndex = i;
408        }
409    }
410    if (curIndex == hsRspImgGallery.length - 1) {
411        newImgIndex = 0;
412    } else {
413        if (curIndex < hsRspImgGallery.length - 1) {
414            newImgIndex = ++curIndex;
415        }
416    }
417    newImg = jQuery(hsRspImgGallery[newImgIndex]).attr("href");
418    jQuery("#hs-rsp-image-wrap").fadeOut("fast", function() {
419        jQuery(this).css({
420            visibility: "hidden",
421            display: "block"
422        });
423        hsRspShowLoader();
424        nextImgLink = jQuery('a[href="' + newImg + '"]');
425        if (jQuery(nextImgLink).attr("data-popupheight") !== undefined && jQuery(nextImgLink).attr("data-popupheight") !== undefined) {
426            hsRspLoadFixedImage(newImg, jQuery(nextImgLink).find("img").attr("alt"), jQuery(nextImgLink).attr("data-popupheight"), jQuery(nextImgLink).attr("data-popupwidth"));
427        } else {
428            hsRspLoadImage(newImg, jQuery(nextImgLink).find("img").attr("alt"));
429        }
430    });
431}
432
433function _hsRspAnimateResize() {
434    switch (hsRspCurrentType) {
435        case "image":
436            if (hsRspDisableResizeOnWindowChange) {
437                var img = {
438                    "iwidth": hsRspSetWidth,
439                    "iheight": hsRspSetHeight
440                };
441            } else {
442                var img = _hsRspScalePopup(jQuery("#hs-rs-big-img"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspOrigImgWidth, hsRspOrigImgHeight);
443            }
444            jQuery("#hs-rs-big-img").animate({
445                width: img.iwidth,
446                height: img.iheight
447            }, 100, function() {
448                jQuery("#hs-rsp-image-wrap").animate({
449                    left: _hsRspCalcLeftMargin(jQuery(this).width())
450                }, 50, function() {
451                    if (jQuery("#hsrsp-leftarrow").length == 1) {
452                        jQuery("#hsrsp-leftarrow").css({
453                            top: parseInt((img.iheight / 2) - ((64 - 10) / 2)),
454                            left: 10
455                        });
456                    }
457                    if (jQuery("#hsrsp-rightarrow").length == 1) {
458                        jQuery("#hsrsp-rightarrow").css({
459                            top: parseInt((img.iheight / 2) - ((64 - 10) / 2)),
460                            left: parseInt((img.iwidth) - 54)
461                        });
462                    }
463                });
464            });
465            break;
466        case "iframe":
467            if (hsRspDisableResizeOnWindowChange) {
468                var img = {
469                    "iwidth": hsRspSetWidth,
470                    "iheight": hsRspSetHeight
471                };
472            } else {
473                var img = _hsRspScalePopup(jQuery("#hs-rsp-iframe"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspIframeWidth, hsRspIframeHeight);
474            }
475            jQuery("#hs-rsp-iframe").animate({
476                width: img.iwidth,
477                height: img.iheight
478            }, 100, function() {
479                jQuery("#hs-rsp-image-wrap").animate({
480                    left: _hsRspCalcLeftMargin(jQuery(this).width())
481                }, 50, function() {});
482            });
483            break;
484        case "div":
485            if (hsRspDisableResizeOnWindowChange) {
486                var div = {
487                    "iwidth": hsRspSetWidth,
488                    "iheight": hsRspSetHeight
489                };
490            } else {
491                var div = _hsRspScalePopup(jQuery("#hs-rsp-div"), hsRspMinImgWidth, hsRspMinImgHeight, hsRspDivWidth, hsRspDivHeight);
492            }
493            jQuery("#hs-rsp-div").animate({
494                width: div.iwidth,
495                height: div.iheight
496            }, 100, function() {
497                jQuery("#hs-rsp-image-wrap").animate({
498                    left: _hsRspCalcLeftMargin(jQuery(this).width())
499                }, 50, function() {});
500            });
501            break;
502    }
503}
504
505function _hsRspCalcLeftMargin(imgWidth) {
506    var halfScreenPoint = parseInt(parseInt(jQuery(window).width()) / 2);
507    var leftStartPoint = parseInt(halfScreenPoint - (imgWidth / 2));
508    return leftStartPoint;
509}
510
511function _hsRspCalcTopMargin(imgHeight) {
512    var halfScreenPoint = parseInt(parseInt(jQuery(window).height()) / 2);
513    var topStartPoint = parseInt(halfScreenPoint - (imgHeight / 2));
514    return topStartPoint;
515}
516
517function _hsRspScalePopup(elem, minWidth, minHeight, defaultWidth, defaultHeight) {
518    var popupWidth, popupWidth = 0;
519    var maxPopupWidth, maxPopupHeight = 0;
520    var pageWidth, pageHeight = 0;
521    var newWidth, newHeight = 0;
522    var resizeFactor = 0;
523    pageWidth = jQuery(window).width();
524    pageHeight = jQuery(window).height();
525    popupWidth = elem.width();
526    popupHeight = elem.height();
527    maxPopupWidth = parseInt(pageWidth * (hsRspMaxModalWidth / 100));
528    maxPopupHeight = parseInt((pageHeight - hsRspModalMarginTop) * (hsRspMaxModalHeight / 100));
529    if (defaultWidth == -1 && defaultHeight == -1) {
530        newHeight = maxPopupHeight;
531        newWidth = maxPopupWidth;
532    } else {
533        if (popupWidth > maxPopupWidth || popupHeight > maxPopupHeight) {
534            if (popupHeight > popupWidth || popupHeight > maxPopupHeight) {
535                newHeight = maxPopupHeight;
536                if (newHeight < hsRspMinImgHeight) {
537                    newHeight = hsRspMinImgHeight;
538                }
539                resizeFactor = parseFloat(newHeight / popupHeight);
540                newWidth = parseFloat(resizeFactor * popupWidth);
541                newWidth = parseInt(Math.ceil(newWidth));
542            } else {
543                newWidth = maxPopupWidth;
544                if (newHeight < hsRspMinImgWidth) {
545                    newHeight = hsRspMinImgWidth;
546                }
547                resizeFactor = parseFloat(newWidth / popupWidth);
548                newHeight = parseFloat(resizeFactor * popupHeight);
549                newHeight = parseInt(Math.ceil(newHeight));
550            }
551        } else {
552            if (defaultHeight != null || defaultWidth != null) {
553                if (popupHeight > popupWidth && popupHeight < maxPopupHeight) {
554                    newHeight = maxPopupHeight;
555                    if (newHeight > defaultHeight) {
556                        newHeight = defaultHeight;
557                    }
558                    resizeFactor = parseFloat(newHeight / popupHeight);
559                    newWidth = parseFloat(resizeFactor * popupWidth);
560                    newWidth = parseInt(Math.ceil(newWidth));
561                } else {
562                    newWidth = maxPopupWidth;
563                    if (newWidth > defaultWidth) {
564                        newWidth = defaultWidth;
565                    }
566                    resizeFactor = parseFloat(newWidth / popupWidth);
567                    newHeight = parseFloat(resizeFactor * popupHeight);
568                    newHeight = parseInt(Math.ceil(newHeight));
569                }
570            } else {
571                newWidth = popupWidth;
572                newHeight = popupHeight;
573            }
574        }
575    }
576    if (jQuery(elem).attr("id") == "hs-rsp-div") {
577        newWidth = elem.width();
578        newHeight = elem.height();
579        if (popupWidth > maxPopupWidth || popupHeight > maxPopupHeight) {
580            if (popupHeight > popupWidth || popupHeight > maxPopupHeight) {
581                newHeight = maxPopupHeight;
582                if (newHeight < maxPopupHeight) {
583                    newHeight = maxPopupHeight;
584                }
585                resizeFactor = parseFloat(newHeight / popupHeight);
586                newWidth = parseFloat(resizeFactor * popupWidth);
587                newWidth = parseInt(Math.ceil(newWidth));
588            } else {
589                newWidth = maxPopupWidth;
590                if (elem.height() < maxPopupHeight) {
591                    newHeight = maxPopupHeight;
592                } else {
593                    resizeFactor = parseFloat(newWidth / popupWidth);
594                    newHeight = parseFloat(resizeFactor * popupHeight);
595                    newHeight = parseInt(Math.ceil(newHeight));
596                }
597                elem.css("overflow", "scroll");
598            }
599        }
600    }
601    var popup = {};
602    popup.iwidth = newWidth;
603    popup.iheight = newHeight;
604    return popup;
605}

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.