Guest User

Untitled

a guest
Dec 9th, 2016
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @id             rthirtyfimgpgadj
  3. // @name           Rule34.xxx: Image Page Adjustments
  4. // @version        1.4
  5. // @include        *rule34.xxx/*
  6. // @domain         rule34.xxx
  7. // @run-at         document-start
  8. // @grant          none
  9. // ==/UserScript==
  10.  
  11. /* -------------------------------------------------------------------------- */
  12.  
  13. `use strict`;
  14.  
  15. let move_childnodes = function(Src, Dst) {
  16.     while (Src.hasChildNodes()) {Dst.appendChild(Src.firstChild);};
  17. };
  18.  
  19. let insert_style_rules = function(Rules) {
  20.     let Style = document.createElement(`style`);
  21.     document.head.appendChild(Style);
  22.     for (let Rule of Rules) {
  23.         Style.sheet.insertRule(Rule, Style.sheet.cssRules.length);
  24.     };
  25. };
  26.  
  27. let GlobalStyleRules = [
  28.     `* {color : #c0c0c0 !important;}`,
  29.     `a:link, a:visited {color : #b0e0b0 !important;}`,
  30.     `.tag-type-copyright > a {color : #f0a0f0 !important;}`,
  31.     `.tag-type-artist > a {color : #f0a0a0 !important;}`,
  32.     `.tag-type-character > a {color : #f0f0a0 !important;}`,
  33.  
  34.     `body {
  35.         background-image : none !important;
  36.         background-color : #303a30 !important;
  37.     }`,
  38.  
  39.     "#header * {color : #88a088 !important;}",
  40.     "#header, #header > * {"+
  41.         "background-image : none !important;"+
  42.         "background-color : #303030 !important;"+
  43.     "}",
  44.     "#header #subnavbar * {color : #878787 !important;}",
  45.  
  46.     "li.current-page,"+
  47.     "tr.tableheader, tr[style=\"background-image: url(topban00.jpg);\"],"+
  48.     "table.highlightable > tbody > tr[style=\"background: #006ffa;\"] {"+
  49.         "background-image : none !important;"+
  50.         "background-color : #505a50 !important;"+
  51.     "}",
  52.  
  53.     "table tr.pending-tag {"+
  54.         "background-color : #445644 !important;"+
  55.     "}",
  56.  
  57.     "#header #site-title {display : none !important;}",
  58.  
  59.     "div.quote {background-color : #505a50 !important;}",
  60.  
  61.     "div.has-mail {background-color : #303030 !important;}",
  62.  
  63.     `.status-notice,
  64.     #post-view > div [ /* child posts banner */
  65.         style="background: #f0f0f0; padding: 10px; `+
  66.         `text-align: center; border: 3px solid #dadada;"
  67.     ] {
  68.         background-color : #303030 !important;
  69.         border-width : 1px !important;
  70.         border-color : #505a50 !important;
  71.         border-style : solid !important;
  72.     }`,
  73.  
  74.     `.status-notice {margin : 0px 0px 1em 0px !important;}`,
  75.  
  76.     `table.highlightable > tbody >
  77.     tr:not([style="background: #006ffa;"]):not(.tableheader):hover {
  78.         background-color : initial !important;
  79.     }`,
  80.  
  81.     `img[src*="icame.png"][alt="I came!"] {
  82.         display : none !important;
  83.     }`,
  84.  
  85.     "input[type=text], textarea, select, select {"+
  86.         "background-color : #303030 !important;"+
  87.         "border-width : 1px !important;"+
  88.         "border-color : #505a50 !important;"+
  89.         "border-style : solid !important;"+
  90.     "}",
  91.     `input[type=submit], input[type=button], button {
  92.         padding : 0 0.3em !important;
  93.         color : #303a30 !important;
  94.         font-weight : bold !important;
  95.         background-color : #88a088 !important;
  96.         border-width : 1px !important;
  97.         border-style : solid !important;
  98.         border-color : #505a50 !important;
  99.         text-align : center;
  100.     }`,
  101.     `input[type=submit]:active, input[type=button]:active, button:active {
  102.         filter : invert(100%) hue-rotate(180deg);
  103.     }`,
  104.     "input[value=Search] {display : none !important;}",
  105.  
  106.     `iframe {display : none !important;}`,
  107.     `#blacklisted-sidebar {display : none !important;}`,
  108.  
  109.     `#tag-sidebar img {padding : 10px 0px;}`,
  110.     `#taglinks-container {margin-top : 10px;}`,
  111.     `img[src="//rule34.xxx/images/r34chibi.png"] {
  112.         opacity : 0.5;
  113.     }`
  114. ];
  115.  
  116. let adjust_image_page = function() {
  117.     insert_style_rules([
  118.         "#header li {display : block;}",
  119.         "#content {"+
  120.             "padding : 0px !important;"+
  121.             "text-align : center;"+
  122.         "}",
  123.  
  124.         `.fit-viewport {
  125.             max-width : 100vw;
  126.             max-height : 100vh;
  127.         }`,
  128.  
  129.         ".centre-box {"+
  130.             "display : inline-block;"+
  131.             "position : relative;"+
  132.             "text-align : initial;"+
  133.         "}",
  134.  
  135.         ".side-box {position : absolute; top : 0px;}",
  136.         ".side-box li {list-style-type : none;}",
  137.  
  138.         ".left-box {width : 135px; left : -155px;}",
  139.  
  140.         ".right-box {"+
  141.             "width : 250px;"+
  142.             "right : -300px;"+
  143.             "padding : 7px 10px 7px 20px;"+
  144.             "background-color : rgba(0, 0, 0, 0.15);"+
  145.         "}",
  146.  
  147.         "#note-container {position : absolute;}",
  148.         "#note-container > .note-body {"+
  149.             "position : absolute;"+
  150.             "padding : 5px;"+
  151.             "border : 1px solid black;"+
  152.             "max-width : 300px;"+
  153.             "min-height : 10px;"+
  154.             "min-width : 140px;"+
  155.             "overflow : auto;"+
  156.             "cursor : pointer;"+
  157.             "background-color : rgba(0, 0, 0, 0.7);"+
  158.         "}",
  159.         "#note-container > .note-body > p.tn {color: gray; font-size: 0.8em;}",
  160.         "#note-container > .note-box {"+
  161.             "position : absolute;"+
  162.             "height : 150px;"+
  163.             "width : 150px;"+
  164.             "background-color : #FFF;"+
  165.             "border : 1px solid black;"+
  166.             "cursor : move;"+
  167.         "}",
  168.         "#note-container > .note-box > .note-corner {"+
  169.             "position : absolute;"+
  170.             "height : 7px;"+
  171.             "width : 7px;"+
  172.             "right : 0;"+
  173.             "bottom : 0;"+
  174.             "background-color : black;"+
  175.             "cursor : se-resize;"+
  176.         "}",
  177.         "#note-container > .unsaved {"+
  178.             "border : 1px solid red;"+
  179.             "background-color : #FFF;"+
  180.         "}",
  181.         "#note-container > .unsaved > .note-corner {background-color : red;}",
  182.  
  183.         `#ci ~ div[style="display:inline;"] {/* comments */
  184.             display : block !important;
  185.             max-width : 1000px;
  186.             margin : 0px 10px;
  187.         }`,
  188.  
  189.         `.image-container {
  190.             display : flex;
  191.             flex-direction : column;
  192.         }`,
  193.         `.image-container .edit-overlay {
  194.             align-self : flex-start;
  195.         }`,
  196.         `.image-container.fit-viewport .edit-overlay {
  197.             align-self : center;
  198.         }`,
  199.  
  200.         `.edit-overlay {
  201.             display : flex;
  202.             position : relative;
  203.             flex-direction : column;
  204.             order : 1;
  205.             justify-content : flex-end;
  206.             max-height : 0px;
  207.             opacity : 0.85;
  208.             z-index : 1;
  209.             text-align : initial;
  210.         }`,
  211.         `.image-container.fullsize .edit-overlay {
  212.             order : -1;
  213.             justify-content : flex-start;
  214.         }`,
  215.         /* convert the table to divs */
  216.         `.edit-overlay table, .edit-overlay tbody,
  217.             .edit-overlay tr, .edit-overlay td
  218.         {
  219.             display : block;
  220.         }`,
  221.         `.edit-overlay > table {
  222.             position : relative;
  223.             max-width : 100vw;
  224.             min-width : -moz-available;
  225.             width : -moz-min-content;
  226.             margin : 0px;
  227.             padding : 7px 5px;
  228.             background-color : rgb(41, 49, 41);
  229.         }`,
  230.         `.edit-overlay #tags, .edit-overlay #source {
  231.             width : -moz-available;
  232.             color : white !important;
  233.             text-shadow: 0px 0px 2px black;
  234.         }`,
  235.         `.edit-overlay #tags {
  236.             padding : 4px;
  237.         }`,
  238.         `.edit-overlay .button-container {
  239.             position : absolute;
  240.             top : 10px;
  241.             right : 7px;
  242.         }`
  243.     ]);
  244.  
  245.     /* find "original image" link */
  246.     let OrigLink = (() => {
  247.         let Sidebar = document.getElementsByClassName(`sidebar`)[0];
  248.         if (!Sidebar) {return null;};
  249.         let LinkNode = Array.from(Sidebar.getElementsByTagName(`a`)).find(
  250.             function(Elem) {
  251.                 if (Elem.childNodes.length !== 1) {return false;};
  252.                 let Fc = Elem.firstChild;
  253.                 if (
  254.                     Fc && Fc.nodeType === Node.TEXT_NODE &&
  255.                     Fc.textContent === `Original image`
  256.                 ) {
  257.                     return true;
  258.                 };
  259.                 return false;
  260.             }
  261.         );
  262.         if (!LinkNode) {return null;};
  263.         return LinkNode;
  264.     })();
  265.     if (!OrigLink) {return;};
  266.  
  267.     /* find original image dimensions */
  268.     let ImgWh = (() => {
  269.         let TxtNode = document.evaluate(
  270.             `.//text()[contains(., 'Size:')]`, document.getElementById(`stats`),
  271.             null, XPathResult.ANY_TYPE, null
  272.         ).iterateNext();
  273.         if (TxtNode === null) {return [NaN, NaN];};
  274.         let RexResult = TxtNode.textContent.match(/(\d+)x(\d+)/);
  275.         if (RexResult === null) {return [NaN, NaN];};
  276.         return [parseInt(RexResult[1]), parseInt(RexResult[2])];
  277.     })();
  278.  
  279.     let NoteBox = document.getElementById(`note-container`);
  280.     if (!NoteBox) {
  281.         NoteBox = document.createElement(`div`);
  282.         NoteBox.setAttribute(`id`, `note-container`);
  283.     };
  284.  
  285.     /* find or create the image element */
  286.     let Img = document.getElementById(`image`);
  287.     if (Img) {
  288.         Img.removeAttribute(`width`);
  289.         Img.removeAttribute(`height`);
  290.     } else {
  291.         Img = document.createElement(`img`);
  292.         Img.setAttribute(`id`, `image`);
  293.  
  294.         let insert = E => {
  295.             NoteBox.parentNode.insertBefore(E, NoteBox.nextSibling);
  296.         };
  297.  
  298.         let Div = document.createElement(`div`);
  299.         Div.setAttribute(`style`, `margin-bottom: 1em;`);
  300.         insert(Div);
  301.         insert(document.createElement(`br`));
  302.         insert(Img);
  303.     };
  304.     Img.setAttribute(`src`, OrigLink.getAttribute(`href`));
  305.     Img.removeAttribute(`onclick`);
  306.     Img.classList.add(`fit-viewport`);
  307.     Img.addEventListener(`click`, () => {
  308.         Img.classList.toggle(`fit-viewport`);
  309.         let X = document.querySelector(`.image-container`);
  310.         X.classList.toggle(`fit-viewport`);
  311.         X.classList.toggle(`fullsize`);
  312.     });
  313.  
  314.     {/* ? */
  315.         let E = document.querySelector(`#tag-sidebar`).parentNode;
  316.         E.setAttribute(`id`, `taglinks-container`);
  317.     };
  318.  
  319.     {/* move status notice into sidebar */
  320.         let StatusNotice = document.querySelector(`#content .status-notice`);
  321.         if (StatusNotice) {
  322.             let E = document.querySelector(`#taglinks-container`);
  323.             E.parentNode.insertBefore(StatusNotice, E);
  324.         };
  325.     };
  326.  
  327.     {/* remove the 'cum on this' section */
  328.         let E = document.evaluate(
  329.             `.//h5//text()[contains(., 'Cum on this')]/../..`, document.body,
  330.             null, XPathResult.ANY_TYPE, null
  331.         ).iterateNext();
  332.         E.parentNode.removeChild(E);
  333.     };
  334.  
  335.     let RightBox = document.createElement(`div`);
  336.     RightBox.setAttribute(`class`, `right-box side-box`);
  337.     move_childnodes(document.querySelector(`#post-view > .sidebar`), RightBox);
  338.  
  339.     let LeftBox = document.createElement(`div`);
  340.     LeftBox.setAttribute(`class`, `left-box side-box`);
  341.     LeftBox.appendChild(document.getElementById(`header`));
  342.  
  343.     let CentreBox = document.createElement(`div`);
  344.     CentreBox.setAttribute(`class`, `centre-box`);
  345.     move_childnodes(document.getElementById(`image`).parentNode, CentreBox);
  346.  
  347.     {
  348.         let ContentBox = document.getElementById(`content`);
  349.         while (ContentBox.hasChildNodes()) {
  350.             ContentBox.removeChild(ContentBox.lastChild);
  351.         };
  352.         CentreBox.appendChild(RightBox);
  353.         CentreBox.appendChild(LeftBox);
  354.         ContentBox.appendChild(CentreBox);
  355.     };
  356.  
  357.     {/* put #image and #note-container in some boxes */
  358.         let OuterBox = document.createElement(`div`);
  359.         OuterBox.setAttribute(`style`, `text-align : center;`);
  360.         Img.parentNode.insertBefore(OuterBox, Img);
  361.  
  362.         let InnerBox = document.createElement(`div`);
  363.         InnerBox.setAttribute(
  364.             `style`, `display : inline-block; position : relative;`
  365.         );
  366.         InnerBox.appendChild(NoteBox);
  367.         InnerBox.appendChild(Img);
  368.  
  369.         OuterBox.appendChild(InnerBox);
  370.     };
  371.  
  372.     {/* ? */
  373.         let E = document.getElementById(`image`).parentNode.parentNode;
  374.         E.classList.add(`image-container`);
  375.         E.classList.add(`fit-viewport`);
  376.     };
  377.  
  378.     {/* widen the searchbar */
  379.         let Bar = document.getElementById(`stags`);
  380.         Bar.removeAttribute(`size`);
  381.         Bar.setAttribute(`style`, `width : -moz-available;`);
  382.     };
  383.  
  384.     if (!isNaN(ImgWh[0]+ImgWh[1])) {/* image top margin */
  385.         let adjust_margin = function() {
  386.             let WinH = window.innerHeight;
  387.             let ImgH = ImgWh[1];
  388.             if (WinH <= ImgH) {Img.setAttribute(`style`, ``); return;};
  389.             let V = Math.min(Math.pow((WinH - ImgH)/60, 2), WinH/2 - ImgH/2);
  390.             Img.setAttribute(`style`, `margin-top : `+Math.floor(V)+`px;`);
  391.             NoteBox.setAttribute(`style`, `margin-top : `+Math.floor(V)+`px;`);
  392.         };
  393.         window.addEventListener(`resize`, adjust_margin, false);
  394.         adjust_margin();
  395.     };
  396.  
  397.     {/* overlay edit controls */
  398.         let E = document.getElementById(`edit_form`);
  399.         E.classList.add(`edit-overlay`);
  400.         E.parentNode.insertBefore(E, E.parentNode.firstChild);
  401.  
  402.         document.querySelector(`.image-container`).insertBefore(E, null);
  403.  
  404.         for (let X of [
  405.             `#title`, `input[name="parent"]`, `#next_post`, `#previous_post`
  406.         ]) {
  407.             E.querySelector(X).parentNode.style.display = `none`;
  408.         };
  409.  
  410.         {/* removing 'Rating' text */
  411.             let Cont = E.querySelector(`input[name="rating"]`).parentNode;
  412.             for (let X of [...Cont.childNodes]) {
  413.                 if (X instanceof Text && X.textContent === `Rating`) {
  414.                     X.remove();
  415.                 } else if (X instanceof HTMLBRElement) {
  416.                     X.remove();
  417.                 };
  418.             };
  419.         };
  420.  
  421.         let Submit = E.querySelector(`input[name="submit"]`);
  422.         let Cancel = document.createElement(`button`);
  423.         Cancel.setAttribute(`form`, ` `);
  424.         Cancel.textContent = `Cancel`;
  425.         Submit.parentNode.classList.add(`button-container`);
  426.         Submit.parentNode.insertBefore(Cancel, null);
  427.  
  428.         Cancel.addEventListener(`click`, Ev => {
  429.             E.style.display = `none`;
  430.         });
  431.     };
  432.  
  433.     {/* tag editor button */
  434.         let E = document.getElementById(`taglinks-container`);
  435.         let Btn = document.createElement(`button`);
  436.         Btn.setAttribute(`form`, ` `);
  437.         Btn.textContent = `Edit`;
  438.         Btn.style.marginLeft = `0.5em`;
  439.         E.firstChild.insertBefore(Btn, null);
  440.  
  441.         let Ed = document.getElementById(`edit_form`);
  442.         Btn.addEventListener(`click`, Ev => {
  443.             Ed.style.display = Ed.style.display === `none` ? `` : `none`;
  444.         });
  445.  
  446.         (new MutationObserver(() => {
  447.             let Txt = Ed.style.display === `none` ? `Edit` : `Cancel editing`;
  448.             if (Btn.textContent !== Txt) {Btn.textContent = Txt;};
  449.         })).observe(Ed, {attributes : true});
  450.     };
  451.  
  452.     /* ad space */
  453.     document.getElementById(`bottom`).remove();
  454.  
  455.     {/* correct note positioning */
  456.         let Txt = document.createTextNode(`(function() {
  457.             "use strict";
  458.             if (Note === undefined) {return;};
  459.             let adjust_all = function() {
  460.                 let Idx = 0; let Arr = Note.all; let Len = Arr.length;
  461.                 for (; Idx < Len; Idx += 1) {Arr[Idx].adjustScale();};
  462.             };
  463.             window.addEventListener("resize", adjust_all, false);
  464.             adjust_all();
  465.         })()`);
  466.         let Script = document.createElement(`script`);
  467.         Script.setAttribute(`type`, `application/javascript;version=1.8`);
  468.         Script.appendChild(Txt);
  469.         if (Img.complete) {
  470.             document.body.appendChild(Script);
  471.         } else {
  472.             Img.addEventListener(`load`, function f() {
  473.                 Img.removeEventListener(`load`, f);
  474.                 document.body.appendChild(Script);
  475.             }, false);
  476.         };
  477.     };
  478. };
  479.  
  480. let adjust_gallery_page = function() {
  481.     insert_style_rules([
  482.         `#content {padding : 0px !important;}`,
  483.         `#post-list {display : flex !important; align-items : flex-start;}`,
  484.         `#post-list > * {float : none !important;}`,
  485.         `#post-list > .sidebar {
  486.             width : auto !important;
  487.             max-width : 19em !important;
  488.             margin-right : auto !important;
  489.             padding : 7px 10px 7px 20px;
  490.             flex-shrink : 0;
  491.             align-self : stretch;
  492.             background-color : rgba(0, 0, 0, 0.15);
  493.         }`,
  494.         `#post-list > .content {
  495.             display : flex;
  496.             flex-direction : column;
  497.             justify-content : center;
  498.             align-items : center;
  499.             min-height : calc(100vh - 14px);
  500.             width : auto !important;
  501.             flex-grow : 1;
  502.             text-align : center;
  503.             padding : 7px 0px;
  504.         }`,
  505.         `#post-list .image-container {
  506.             display : inline-block;
  507.             width : -moz-fit-content;
  508.         }`,
  509.         `#header li {display : block !important;}`,
  510.         `#header {
  511.             height : 7em;
  512.             overflow : hidden;
  513.             position : relative;
  514.             border-width : 1px;
  515.             border-color : #505a50;
  516.             border-style : solid;
  517.         }`,
  518.         `#header.open {height : auto !important;}`,
  519.         `#header > .more {
  520.             display : block;
  521.             position : absolute;
  522.             bottom : 0px;
  523.             width : 100%;
  524.             text-align : center;
  525.             background-color : #505a50 !important;
  526.             color : #303030 !important;
  527.         }`,
  528.         `#header.open > .more {position : relative;}`,
  529.         `#header > * {margin : 0px !important;}`,
  530.         `.blacklisted-image {background : unset !important;}`,
  531.         `.blacklisted-image > a {display : block !important;}`,
  532.         `.blacklisted-image > a > img {
  533.             display : block; border : 2px solid black;
  534.         }`,
  535.         `.blacklisted-image > a:after {
  536.             content : "[blacklisted]";
  537.             color : #aaa;
  538.             background-color : black;
  539.         }`,
  540.         `.thumb > a > img.preview {
  541.             vertical-align : unset !important;
  542.         }`,
  543.         `.thumb > a {
  544.             border-bottom : 1px dotted #B0E0B0 !important;
  545.         }`,
  546.         `.thumb > a:visited {
  547.             border-bottom-color : #303a30 !important;
  548.         }`,
  549.     ]);
  550.  
  551.     let Header = document.querySelector(`#header`);
  552.     if (Header) {
  553.         let E = document.createElement(`a`);
  554.         E.setAttribute(`href`, `#`);
  555.         E.addEventListener(`click`, () => Header.classList.toggle(`open`));
  556.         E.setAttribute(`class`, `more`);
  557.         E.appendChild(document.createTextNode(`• • •`));
  558.         Header.appendChild(E);
  559.     };
  560.  
  561.     let Sidebar = document.querySelector(`#post-list > .sidebar`);
  562.     Sidebar.insertBefore(Header, Sidebar.firstChild);
  563.  
  564.     let Content = document.querySelector(`#post-list > .content`);
  565.     let ImageContainer = Content.querySelector(
  566.         `#post-list > .content > div:not([id])`
  567.     );
  568.     ImageContainer.classList.add(`image-container`);
  569.     let Paginator = Content.querySelector(`#paginator`);
  570.  
  571.     while (Content.lastChild) {Content.removeChild(Content.lastChild);};
  572.     Content.appendChild(ImageContainer);
  573.     if (Paginator) {Content.appendChild(Paginator);};
  574.     let Tips = document.querySelector(`#header > div.tips`);
  575.     if (Tips) {
  576.         Tips.setAttribute(`style`, (
  577.             `background-image : none !important; text-align : center;`
  578.         ));
  579.         Content.appendChild(Tips);
  580.     };
  581.  
  582.     {/* ? */
  583.         let E = document.querySelector(`#tag-sidebar`).parentNode;
  584.         E.setAttribute(`id`, `taglinks-container`);
  585.         E.querySelector(`h5`).setAttribute(`style`, `display : none;`);
  586.     };
  587.  
  588.     {/* widen the searchbar */
  589.         let Bar = document.getElementById(`tags`);
  590.         Bar.removeAttribute(`size`);
  591.         Bar.setAttribute(`style`, `width : -moz-available;`);
  592.     };
  593. };
  594.  
  595. /* --- --- */
  596.  
  597. let on_document_head_loaded = function() {
  598.     if (document.location.pathname === `/`) {
  599.         document.location.pathname = `/index.php?page=post&s=list`
  600.         return;
  601.     };
  602.  
  603.     if (RegExp(
  604.         `/(index.php|chat.php|icameout.php|(stats(/[^?]*)?))?(\\?.*)?$`
  605.     ).test(document.location.pathname+document.location.search)) {
  606.         insert_style_rules(GlobalStyleRules);
  607.     };
  608. };
  609.  
  610. /* delay until document fully loaded */
  611. document.addEventListener(`DOMContentLoaded`, function() {
  612.     /* only apply to …/index.php?page=post… */
  613.     if (document.location.pathname !== `/index.php`) {return;};
  614.     let QueryTbl = {};
  615.     document.location.search.substring(1).split(`&`).forEach(function(Txt) {
  616.         let Arr = Txt.split(`=`);
  617.         QueryTbl[Arr[0]] = Arr[1];
  618.     });
  619.     if (QueryTbl[`page`] !== `post`) {return;};
  620.     if (QueryTbl[`s`] === `view`) {return adjust_image_page();};
  621.     if (QueryTbl[`s`] === `list`) {return adjust_gallery_page();};
  622. });
  623.  
  624. {/* delay until document.head exists */
  625.     let on_root_append = function(_, Obs) {
  626.         if (!document.head) {return;};
  627.         Obs.disconnect();
  628.         on_document_head_loaded();
  629.     };
  630.  
  631.     let on_document_append = function(_, Obs) {
  632.         if (!document.documentElement) {return;};
  633.         Obs.disconnect();
  634.         let NextObs = new MutationObserver(on_root_append)
  635.         NextObs.observe(document.documentElement, {childList : true});
  636.         on_root_append(null, NextObs);
  637.     };
  638.  
  639.     let Obs = new MutationObserver(on_document_append);
  640.     Obs.observe(document, {childList : true});
  641.     on_document_append(null, Obs);
  642. };
  643.  
  644. /* -------------------------------------------------------------------------- */
  645.  
  646. /*
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690. */
  691.  
  692. /* -------------------------------------------------------------------------- */
Add Comment
Please, Sign In to add comment