NewLayoutForSpecials

New layout for better view

目前為 2018-10-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         NewLayoutForSpecials
// @namespace    SpecialMunzees
// @version      1.0
// @description  New layout for better view
// @author       CzPeet
// @match        https://www.munzee.com/m/*/specials/
// ==/UserScript==

var UL_container = document.getElementById("specials-listing");
var IL_items = UL_container.getElementsByTagName("li");

for (var i = 0; i < IL_items.length; ++i)
{
    //OLD PART
    var oldIL = IL_items[i];
    var spanElement = oldIL.children[0].children[0];
    var imgElement = oldIL.children[1].children[0];
    var brElement = oldIL.children[1].children[1];
    var pElementText = oldIL.children[1].children[2].innerText;
    var href_x = oldIL.children[1].href;

    //NEW PART
    var newIL = document.createElement("li");

    var textElement = document.createTextNode(" - "+pElementText);
    var pElement = document.createElement("p");
    pElement.appendChild(spanElement);
    pElement.appendChild(textElement);

    var aElement = document.createElement("a");
    aElement.href = href_x;
    aElement.appendChild(pElement);

    newIL.appendChild(imgElement);
    newIL.appendChild(brElement);
    newIL.appendChild(aElement);

    //REPLACE
    UL_container.replaceChild(newIL, oldIL);
}