Greasy Fork

Ynet expand all talkbacks

expand all talkbacks

目前为 2020-12-22 提交的版本。查看 最新版本

// ==UserScript==
// @name        Ynet expand all talkbacks
// @namespace   http://tampermonkey.net/
// @match       http*://*.ynet.co.il/*article*/*
// @grant       none
// @version     1.0
// @author      elig0n
// @description  expand all talkbacks
// ==/UserScript==

window.addEventListener("load", function(event) {
    console.log("Ynet open : load event listener running");

    var section = document.querySelector("#SiteArticleComments > div:nth-child(1) > div > div.topPanel > div")
    var ourspan = document.createElement("span")
    ourspan.setAttribute("class", "selectLabel")
    var ourbutton = document.createElement("button")
    ourbutton.setAttribute("title", "open all")
    ourbutton.setAttribute("onclick", "javascript:toggle_all_talkbacks()")
    ourbutton.innerText = "פתח הכל"

    ourspan.appendChild(ourbutton)
    section.insertBefore(ourspan, section.childNodes[0])
});

window.toggle_all_talkbacks = function () {
    var y = document.querySelector(".showMoreCommentsButton")
    y.click()
    setTimeout(() => { 
        var x = document.querySelectorAll(".commentTitle") ;
        x.forEach((el) => { el.click() ; }); 
    } , 1000);    
}