PageSourceSearch

https://myplaza.xyz/white/dynamic.js

js myplaza.xyz collected 2026-10-07 19:04:12 UTC 4,660 bytes, 152 lines download raw bytes

1var articleList;
2var titleList = new Object();
3
4String.prototype.noSpecials = function() {
5    var i, c;
6    var outstring = new String();
7
8    for (i = 0; i < this.length; i++) {
9        c = this.charAt(i);
10        if (c.match(/\w/)) {
11            outstring += c;
12        }
13    }
14    return outstring;
15}
16
17function setThingsUp() {
18    var titleName;
19    // Get list of all articles
20    articleList = $("div.article");
21
22    $(window).on('hashchange', function () {
23        // In Chrome (at least), clicking the back button after following a
24        // link to an internal anchor was not correctly scrolling back to the
25        // article.
26        //
27        // This event handler is called any time the location hash changes, so
28        // we can ensure that the anchor in question is visible.
29
30        showArticleForHash()        
31    });
32
33    function clickCallBack(elem, num) {
34        var scrolltime = 350; // ms
35        if (articleList.eq(num).css("display") != "none") {
36            $('html, body').animate({scrollTop: $(elem).offset().top}, scrolltime);
37            if (elem.closest != undefined) {
38                location = elem.closest("A").href;
39            } else if (elem.href) {
40                location = elem.href;
41            }
42        }
43    }
44
45    function showArticleForAnchor(id) {
46        target = $("a[id='" + id + "']");
47        target.closest("div.article").show()
48    }
49
50    // Make sure whichever article is needed for location.hash is visible
51    function showArticleForHash() {
52        var hashStr = location.hash.substring(1)
53        if (!hashStr) { return }
54        
55        articleList.each(function(num) {
56            if (titleList[hashStr] == num) {
57                $(this).show();
58            }
59        });
60        // Show article for internal anchor ID (if any)
61        showArticleForAnchor(hashStr)
62
63        // Scroll to anchor
64        var anchorTop = $(location.hash).offset().top;
65        $("html, body").animate({scrollTop: anchorTop}, 0);
66    }
67
68    // Add click events to title links
69    $("li > article > h2 > a").each(function(num) {
70        titleName = $(this).text().noSpecials();
71        titleList[titleName] = num;
72
73        $(this).click(function(clickevent) {
74            var elem;
75            clickevent = clickevent || window.event; // IE model
76            elem = clickevent.target || clickevent.srcElement; // IE
77
78            if (clickevent) {
79                clickevent.preventDefault();
80                articleList.eq(num).slideToggle(700, function() {
81                    clickCallBack(elem, num);
82                });
83            }
84        })
85        .attr("href", "#" + titleName)
86        .wrap("<a id='" + titleName + "'></a>");
87    });
88
89    // Add click events to internal anchor links
90    // and also add id to each commentbox div
91    $("article").each(function() {
92        var link = $(this).find("a[href^='#']")[0]
93        var cb = $(this).find("div.commentbox[id='replaceme']")[0]
94        if (link.target == "_blank") { return }
95        var idStr = link.hash.split("#")[1];
96
97        $(link).click(function(clickevent) {
98            //clickevent.preventDefault()
99            // get target ID
100            // Show its containing article
101            showArticleForAnchor(idStr)
102        })
103
104        // commentbox
105        if (cb == null) { return }
106        $(cb).attr("id", idStr);
107    });
108
109    // Add 'collapse all' link
110    $("p.dynamicintro").hide();
111    $("#onlytitle").append("<a href='javascript:collapse_all()' id='collapseall'>Show Only Titles</a>");
112    $("p.dynamicintro").show();
113    
114        // Add 'show all' link
115    $("p.dynamicintro").hide();
116    $("#alltext").append("<a href='javascript:show_all()' id='showall'>Show All Text</a>&nbsp;|&nbsp;");
117    $("p.dynamicintro").show();
118
119    // Hide all article paragraphs initially - Louis changes it from ".hide" to ".show"
120    articleList.each(function() {
121        $(this).show();
122    });
123
124    // Show article associated with location.hash
125    showArticleForHash()
126
127    // populate commentbox.io boxes
128    commentBox('5728762075283456-proj');
129    // make commentboxes scrollable
130    $("div.commentbox > iframe").each(function() {$(this).attr("scrolling", "yes")});
131    // make commentboxes a bit taller
132    $("div.commentbox > iframe").each(function() {$(this).height(250)});
133}
134
135function collapse_all() {
136    // Hide all article paragraphs
137    articleList.each(function () {
138        $(this).hide();
139    });
140    window.location.hash=""
141}
142
143function show_all() {
144    // Show all article paragraphs
145    articleList.each(function () {
146        $(this).show();
147    });
148}
149
150// This is called as soon as the DOM is ready
151$(document).ready(setThingsUp);
152

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.