PageSourceSearch

https://wp.wpi.edu/beyondthesetowers/wp-content/plugins/blogtempla…/assets/js/front.js?ver=2.6.8.2

js wpi.edu collected 2026-10-01 08:41:28 UTC 4,039 bytes, 122 lines download raw bytes

1jQuery(document).ready(function($) {
2    var position_top = 0;
3    var position_left = 0;
4    var hovering_out = true;
5    var container = null;
6    var pointer = null;
7    var params = window.blog_templates_params || {};
8    var paramsType = typeof params.type === 'string' ? params.type : '';
9
10    function normalizeSafeUrl(rawUrl) {
11        if (typeof rawUrl !== 'string' || rawUrl.trim() === '') {
12            return null;
13        }
14
15        try {
16            var parsed = new URL(rawUrl, window.location.href);
17            if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
18                return parsed.href;
19            }
20        } catch (err) {
21            return null;
22        }
23
24        return null;
25    }
26
27    function openSafeUrl(rawUrl) {
28        var safeUrl = normalizeSafeUrl(rawUrl);
29        if (!safeUrl) {
30            return;
31        }
32
33        var newWindow = window.open(safeUrl, '_blank', 'noopener,noreferrer');
34        if (newWindow) {
35            newWindow.opener = null;
36        }
37    }
38
39    function redirectSafeUrl(rawUrl) {
40        var safeUrl = normalizeSafeUrl(rawUrl);
41        if (safeUrl) {
42            window.location.href = safeUrl;
43        }
44    }
45
46    $('.nbt-desc-pointer').appendTo($('body'));
47    $(document).mousemove(function(e) {
48        position_top = e.pageY;
49        position_left = e.pageX;
50    });
51    $('.template-signup-item').hover(
52        function(e) {
53            hovering_out = false;
54            container = $(this);
55            var tkey = container.data('tkey');
56
57            pointer = $('#nbt-desc-pointer-' + tkey);
58            setTimeout(function() {
59                if ( hovering_out )
60                    return;
61                var margin_top = position_top;
62                var margin_left = position_left;
63                pointer.css({
64                    left: margin_left - 15 + 'px',
65                    top: margin_top + 25,
66                    width: container.outerWidth() / 2 + 'px'
67                }).stop(true,true).fadeIn()
68            }, 200);
69        },
70        function(e) {
71            hovering_out = true;
72
73            var tkey = container.data('tkey');
74
75            pointer = $('#nbt-desc-pointer-' + tkey).stop().fadeOut();
76        }
77    );
78
79    if (paramsType === 'previewer') {
80
81        $(document).on('click', '.view-demo-button, .select-theme-button', function (e) {
82            e.preventDefault();
83            var theme_key = $(this).data('theme-key');
84
85            var wrap = $('#theme-previewer-wrap-' + theme_key);
86            $('.theme-previewer-wrap').removeClass('blog_template-default_item');
87            wrap.addClass('blog_template-default_item');
88
89            $('input[name=blog_template]').prop('checked', false);
90            $('#blog-template-radio-' + theme_key).prop('checked', true);
91        });
92        $(document).on('click', '.view-demo-button', function (e) {
93            e.preventDefault();
94            openSafeUrl($(this).data('blog-url'));
95        });
96    } else if (paramsType === 'page_showcase') {
97
98        $(document).on( 'click', '.select-theme-button', function(e) {
99            e.preventDefault();
100            var signup_url = $(this).data('signup-url');
101            redirectSafeUrl(signup_url);
102        });
103        $(document).on('click', '.view-demo-button', function(e) {
104            e.preventDefault();
105            openSafeUrl($(this).data('blog-url'));
106        });
107    } else if (
108        paramsType === 'screenshot' ||
109        paramsType === 'screenshot_plus'
110    ) {
111        $(document).on('click', '.blog_template-item_selector', function (e) {
112            e.preventDefault();
113            var theme_key = $(this).data('theme-key');
114            var wrap = $('#theme-screenshot-wrap-' + theme_key);
115            $('.theme-screenshot-wrap').removeClass('blog_template-default_item');
116            wrap.addClass('blog_template-default_item');
117
118            $('input[name=blog_template]').prop('checked', false);
119            $('#blog-template-radio-' + theme_key).prop('checked', true);
120        });
121    }
122});

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.