Skip to content

Instantly share code, notes, and snippets.

@Klaster1
Last active July 27, 2020 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Klaster1/5bc6aa18e7be6f194ee6260cc392ed1f to your computer and use it in GitHub Desktop.
Save Klaster1/5bc6aa18e7be6f194ee6260cc392ed1f to your computer and use it in GitHub Desktop.
Weight Weenies fast unreads
// ==UserScript==
// @name Weight Weenies fast unreads
// @description Adds a button to open all unreads in new tabs
// @version 1.0
// @author Klaster_1
// @match https://weightweenies.starbike.com/forum*
// @grant none
// @icon http://weightweenies.starbike.com/images/weenie.gif
// @downloadURL https://gist.githubusercontent.com/Klaster1/5bc6aa18e7be6f194ee6260cc392ed1f/raw/ww_fast_unreads.user.js
// @updateURL https://gist.githubusercontent.com/Klaster1/5bc6aa18e7be6f194ee6260cc392ed1f/raw/ww_fast_unreads.user.js
// ==/UserScript==
const unread = document.querySelectorAll('a[href*="#unread"]')
const openUnread = (e) => {
e.preventDefault()
unread.forEach(a => {
window.open(a.href)
})
}
if (unread.length) document.querySelectorAll('span[title="Post new topic"]').forEach(el => {
const a = document.createElement('a')
a.innerText = 'Open unread in new window'
a.onclick = openUnread
a.href = ''
const td = document.createElement('td')
td.appendChild(a)
td.classList.add('gensmall')
td.setAttribute('nowrap', 'nowrap')
el.closest('tr').querySelector('td:nth-of-type(3)')?.insertAdjacentElement('afterend', td)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment