PageSourceSearch

https://hollywoodchamber.net/wp-content/plugins/print-o-matic/js/print_elements.js?ver=1.1

js hollywoodchamber.net collected 2026-10-02 05:18:46 UTC 2,626 bytes, 82 lines download raw bytes

1var PrintElements = (function () {
2    "use strict";
3
4    var hideFromPrintClass = "pe-no-print";
5    var preservePrintClass = "pe-preserve-print";
6    var preserveAncestorClass = "pe-preserve-ancestor";
7    var bodyElementName = "BODY";
8
9    var _hide = function (element) {
10        if (!element.classList.contains(preservePrintClass)) {
11            element.classList.add(hideFromPrintClass);
12        }
13    };
14
15    var _preserve = function (element, isStartingElement) {
16        element.classList.remove(hideFromPrintClass);
17        element.classList.add(preservePrintClass);
18        if (!isStartingElement) {
19            element.classList.add(preserveAncestorClass);
20        }
21    };
22
23    var _clean = function (element) {
24        element.classList.remove(hideFromPrintClass);
25        element.classList.remove(preservePrintClass);
26        element.classList.remove(preserveAncestorClass);
27    };
28
29    var _walkSiblings = function (element, callback) {
30        var sibling = element.previousElementSibling;
31        while (sibling) {
32            callback(sibling);
33            sibling = sibling.previousElementSibling;
34        }
35        sibling = element.nextElementSibling;
36        while (sibling) {
37            callback(sibling);
38            sibling = sibling.nextElementSibling;
39        }
40    };
41
42    var _attachPrintClasses = function (element, isStartingElement) {
43        _preserve(element, isStartingElement);
44        _walkSiblings(element, _hide);
45    };
46
47    var _cleanup = function (element) {
48        _clean(element);
49        _walkSiblings(element, _clean);
50    };
51
52    var _walkTree = function (element, callback) {
53        var currentElement = element;
54        callback(currentElement, true);
55        currentElement = currentElement.parentElement;
56        while (currentElement && currentElement.nodeName !== bodyElementName) {
57            callback(currentElement, false);
58            currentElement = currentElement.parentElement;
59        }
60    };
61
62    var _print = function (elements, has_top_html, has_bot_html) {
63        for (var i = 0; i < elements.length; i++) {
64            _walkTree(elements[i], _attachPrintClasses);
65        }
66  
67        window.addEventListener('afterprint', e => after_print_clean_up(elements, has_top_html, has_bot_html) );
68        window.print();
69    };
70
71    function after_print_clean_up(elements, has_top_html, has_bot_html){
72        //console.log('clean up on isle 5');
73        for (var i = 0; i < elements.length; i++) {
74            _walkTree(elements[i], _cleanup);
75        }
76        pom_cleanup(has_top_html, has_bot_html);
77    }
78
79    return {
80        print: _print
81    };
82})();

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.