您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
open unread threads in separates tab
当前为
// SkyscraperCity new threads opener // version 1.0.4 // 2018-08-30 // // -------------------------------------------------------------------- // // This is a Greasemonkey user script. // // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/ // Then restart Firefox and revisit this script. // Under Tools, there will be a new menu item to "Install User Script". // Accept the default configuration and install. // // To uninstall, go to Tools/Manage User Scripts, // select "SkyscraperCity new threads opener", and click Uninstall. // // -------------------------------------------------------------------- // // ==UserScript== // @name skyscrapercity unread threads opener // @description open unread threads in separates tab // @include https://www.skyscrapercity.com/tags.php* // @include https://www.skyscrapercity.com/subscription.php* // @include https://www.skyscrapercity.com/watched/ // @version 1.0.5 // @namespace http://broman.pl/gmscripts/skyscraper-opener // @grant GM.openInTab // ==/UserScript== console.log('Start of GM script'); (function() { console.log ('script start'); var threadTable = getTable(); if (getAllUnread() > 0) { var openAllLinks = document.createElement('a'); openAllLinks.href = '#'; openAllLinks.id = 'link-opener'; openAllLinks.addEventListener('click', openAllUnread, false); openAllLinks.appendChild(document.createTextNode(' Open All unread threads')); var divLink = document.createElement('div'); divLink.appendChild(openAllLinks); var menuDiv = threadTable.previousElementSibling; var otherButton = menuDiv.querySelector('div.block-outer-opposite'); //menuDiv.insertBefore(divLink,otherButton); menuDiv.appendChild(divLink); } })(); function getAllUnread() { return openAllUnread(1) } function openAllUnread(callType) { var toOpen = 0; var threadTable = getTable(); var url = window.location.href; var expectedColumnNumber = -1 if (url.indexOf('subscription.php') > 0) { expectedColumnNumber = 6; } else if(url.indexOf('tags.php') > 0) { expectedColumnNumber = 7; } if (threadTable !== null) { console.log ('threadTable exist'); var rows = threadTable.querySelectorAll("div.is-unread[qid='thread-item']"); var rowsCount = rows.length; for(var i=0; i<rowsCount;i++){ var row = rows[i]; var titleLink = row.querySelector("a[qid='thread-item-title']"); if(callType != 1) { //console.log ('[open start'); //console.log ("link " + links[links.length-1]); try { GM.openInTab(titleLink.href, true); } catch(err) { console.log(err.message); } //console.log ('open end]'); titleLink.style.color=""; } else { titleLink.style.color="magenta"; } } if (callType == 1) { console.log ('links to open'); return rowsCount; } } if (callType == 1) { console.log ('links to open'); return toOpen; } else { document.getElementById('link-opener').outerHTML = ""; return false; } } function getTable() { var threadTable = document.querySelector("div[qid='followed-discussions-section']"); return threadTable; } console.log('End of GM script');