Misc Hide forum posts

File Not Found

Guest
Author
File Not Found
Contributors
N/A
Quickbar Entry
javascript: function getElementsByClass(searchClass, node, tag)
{var classElements = new Array();
if (node == null) node = document;
if (tag == null) tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
for (i = 0, j = 0;i < elsLen;i++)
{if (pattern.test(els[i].className))
{classElements[j] = els[i];
j++;
}
}
return classElements;
}

divs = getElementsByClass("igmline small");
posters = [];

for(i=0; i < divs.length; i++)
{posters[i] = divs[i].getElementsByTagName("a")[0].firstChild.nodeValue;

divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;<a href="javascript: hideVar_'+i+' = divs['+i+'].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar_'+i+'.style.display == \'inherit\'){hideVar_'+i+'.style.display = \'none\';} else {hideVar_'+i+'.style.display = \'inherit\';} void(0);"> Show / Hide this post</a>';

divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

divs[i].getElementsByTagName("span")[0].innerHTML += '<a href="javascript: butt_pirate = \''+posters[i]+'\'; for(i=0; i < divs.length; i++){if(posters[i] == butt_pirate){hideVar = divs[i].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar.style.display == \'inherit\'){hideVar.style.display = \'none\';} else {hideVar.style.display = \'inherit\';}}} void(0);">Show / Hide All posts by '+posters[i]+'</a>';
}

void(0);
Public?
Public
Given the recent request from players for a skype smiley script for the tribe forums, I've of late been doing quite a number of forum related scripts. The below is one such script.

Right, in it's current stage, you will need to use the "open forum in new window button", and as such, this script will need to be used as a browser bookmark, however, I will fix that, once I get over my irritation with iframes.

The below script, when run, will add two button to the header bar for posts on your tribe forum.

Those button are... Show/Hide post, and, Show/Hide all posts by USER_X

The script has been approved, so feel free to try it out, and let me know what you think, or if you can think of any improvements, or additional features of a similar nature you'd like.


[spoil]
Code:
javascript: function getElementsByClass(searchClass, node, tag)
   {var classElements = new Array();
    if (node == null) node = document;
    if (tag == null) tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
    for (i = 0, j = 0;i < elsLen;i++)
       {if (pattern.test(els[i].className))
           {classElements[j] = els[i];
            j++;
           }
       }
    return classElements;
   }

divs = getElementsByClass("igmline small");
posters = [];

for(i=0; i < divs.length; i++)
  {posters[i] = divs[i].getElementsByTagName("a")[0].firstChild.nodeValue;

   divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;<a href="javascript: hideVar_'+i+' = divs['+i+'].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar_'+i+'.style.display == \'inherit\'){hideVar_'+i+'.style.display = \'none\';} else {hideVar_'+i+'.style.display = \'inherit\';} void(0);">    Show / Hide this post</a>'; 

   divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

   divs[i].getElementsByTagName("span")[0].innerHTML += '<a href="javascript: butt_pirate = \''+posters[i]+'\'; for(i=0; i < divs.length; i++){if(posters[i] == butt_pirate){hideVar = divs[i].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar.style.display == \'inherit\'){hideVar.style.display = \'none\';} else {hideVar.style.display = \'inherit\';}}} void(0);">Show / Hide All posts by '+posters[i]+'</a>';
  }

void(0);
[/spoil]
 
Upvote 0

File Not Found

Guest
UPGRADES!

This should now work on the tribe forum, regardless of whether you've opened in a new window.

[spoil]
Code:
javascript: 

function getElementsByClass(searchClass, node, tag)
   {var classElements = new Array();
    if (node == null) node = document;
    if (tag == null) tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)' + searchClass + '(\\s|$)');
    for (i = 0, j = 0;i < elsLen;i++)
       {if (pattern.test(els[i].className))
           {classElements[j] = els[i];
            j++;
           }
       }
    return classElements;
   }

var doc = (window.frames.length > 1) ? window.main.document: document;
if (doc.getElementsByTagName("iframe").length > 0)
   {var iframes = doc.getElementsByTagName("iframe")[0];
    var frame = (iframes.src.match(/forum.php/)) ? iframes.contentWindow.document: doc;
    work =  frame;
   }
else
   {work = doc;
   }

divs = getElementsByClass("igmline small", work);
posters = [];

for(i=0; i < divs.length; i++)
  {posters[i] = divs[i].getElementsByTagName("a")[0].firstChild.nodeValue;

   divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;<a href="javascript: '+getElementsByClass+' divs = getElementsByClass(\'igmline small\'); hideVar_'+i+' = divs['+i+'].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar_'+i+'.style.display == \'inherit\'){hideVar_'+i+'.style.display = \'none\';} else {hideVar_'+i+'.style.display = \'inherit\';} void(0);">    Show / Hide this post</a>'; 

   divs[i].getElementsByTagName("span")[0].innerHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

   divs[i].getElementsByTagName("span")[0].innerHTML += '<a href="javascript: '+getElementsByClass+' divs = getElementsByClass(\'igmline small\'); butt_pirate = \''+posters[i]+'\'; for(i=0; i < divs.length; i++){if(\''+posters[i]+'\' == butt_pirate){hideVar = divs[i].parentNode.getElementsByTagName(\'div\')[1]; if(hideVar.style.display == \'inherit\'){hideVar.style.display = \'none\';} else {hideVar.style.display = \'inherit\';}}} void(0);">Show / Hide All posts by '+posters[i]+'</a>';
  }

void (0);
[/spoil]
 

DeletedUser

Guest
im guessing its for premium users only, because its not working for me.


*edit*
Nevermind, was just running it in the wrong place, though it was to actually hide the sub-topics in the tribes forums. if only if only
 
Last edited by a moderator:
Top