Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ userscript

Name: Anonymous 2011-01-24 8:08

it occurs to me that it should be possible for userscripts to do "collaborative moderation" on a website:

* use a userscript to add an (ignore) link to the header of each post. clicking it will add the post to the localStorage ignore-list and thus hide it.

* use ignore >>1,3-4 reason to signal to others that you've ignored those posts (and why).

* clients can decide for themselves what do if ignore directives are found in a thread (tentatively use, pop up a dialog, check tripcode... whatever)

could someone write this for us?

Name: Anonymous 2011-01-24 9:45

// ==UserScript==
// @name          /prog/ commander
// @version       2011 PRO DELUXE
// @namespace     tag:killitwithFIRE
// @description   YOU'RE DEAD TO ME
// @include       http://dis.4chan.org/prog/*
// @include       http://dis.4chan.org/read/prog/*
// ==/UserScript==

function showThread(thread,a)
{
  delete localStorage['hide_' + threadID]
  a.onclick = function() { hideThread(this.parentNode.parentNode.parentNode,this) }
  a.innerHTML = 'hide '
 
  delete thread.style.height
  delete thread.style.overflow
}

function hideThread(thread,a)
{
  localStorage['hide_' + threadID] = true
  a.onclick = function() { showThread(this.parentNode.parentNode.parentNode,this) }
  a.innerHTML = 'show '
 
  thread.style.height = '2em'
  thread.style.overflow = 'hidden'
}

if ( window.location.pathname == '/prog/')
{
  var threads = document.getElementsByClassName('thread');
  for (var i = 0; i < threads.length; i++) {
    var thread = threads[i];
    var navLinks = thread.getElementsByClassName('navlinks')[0];
    var threadID = thread.
      getElementsByTagName('h2')[0].
      getElementsByTagName('a')[0].name;
   
    var a = document.createElement('a')
    a.href = window.location + "#"
    navLinks.insertBefore( a, navLinks.childNodes[0])
   
    if ( localStorage['hide_' + threadID] ) hideThread(thread,a)
    else showThread(thread,a)
  }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List