3.2.0

help with this script not quite working

I think it cant identify users???

<script type="text/javascript">
var blocklist

function block()
{
 getlist()
 var span = document.getElementsByTagName('span')
 if (span == null || blocklist.length <= 0) return false
 blocklist = blocklist.split(', ')
 for (x=0; x<blocklist.length; x++)
 {
  for (i=0; i<span.length; i++)
  {
   if (span[i].className == "normalname" && span[i].innerHTML.toLowerCase().match(blocklist[x].toLowerCase()))
   {
    var tempid = span[i]
    var found = 0
    for (a=0; found!=1; a++)
    {
     var parenttable = tempid.parentNode
     if (parenttable.tagName == "TABLE") var found = 1
     tempid = parenttable
    }
    if (found == 0) return false
    
    var div = parenttable.getElementsByTagName('div')
    if (div == null) return false
    var found2 = 0
    for (b=0; b<div.length; b++)
    {
     if (div[b].className == "postcolor" && found2 != 1)
     {
      div[b].innerHTML = "<CENTER><FONT color='red'><B>Post Blocked</B></FONT><BR><A href='" + loc.substring(0,loc.indexOf('showtopic=')) + "act=UserCP&amp;CODE=rblocker'>Manage Block List</A></CENTER>"
      found2 = 1
     }
     else if (div[b].className == "postcolor" && found2 == 1) div[b].style.display = 'none'
    }
   }
  }
 }
}

function getlist()
{
 var allcookies = document.cookie
 if (allcookies == ""){ blocklist = ""; return false }
 var pos = allcookies.indexOf("rblocker=")
 if (pos == -1){ blocklist = ""; return false }
 start = pos + 9
 var end = allcookies.indexOf(";", start)
 if (end == -1) end = allcookies.length
 var value = allcookies.substring(start, end)
 
 value = unescape(value)
 blocklist = value
}

function setblocklist()
{
 if (loc.match('act=UserCP&CODE=rblocker'))
 {
  getlist()
  var e = document.getElementById('ucpcontent')
  e.innerHTML = "<div class='maintitle'>Welcome to your control panel </div>" + "<div class='pformstrip'>Reply-Blocker List</div>"
  e.innerHTML += ("\n<div align='center'><p>" + 
        "\nType in the names of the users whose posts you want to block<BR>" + 
        "\n<b>Separate each name with a comma and a space (e.g. billy, bob, joe)</b><BR>&nbsp;<BR>" + 
        "\n<form name='rblockerpage'><textarea cols='65' rows='7' name='userlist' class='forminput'>" + blocklist + "</textarea><BR>" + 
        "\n<input type='button' value='Update Reply-Blocker' class='forminput' onClick='writecookie()'></form></p></div>")
 }
 var ucpsection = document.getElementById('ucpmenu').getElementsByTagName('P')
 for (x=0; x<ucpsection.length; x++)
 {
  if (ucpsection[x].innerHTML.match("Change Password"))
  {
   ucpsection[x].innerHTML += "<BR>ยท <a href='" + loc.substring(0,loc.indexOf('act=')) + "act=UserCP&amp;CODE=rblocker'>Set Reply-Blocker</a>"
  }
 }
}

function writecookie()
{
 var exp = new Date()
 exp.setFullYear(exp.getFullYear() + 1)
 var val = document.rblockerpage.userlist.value
 document.cookie = "rblocker=" + escape(val) + "; expires=" + exp.toGMTString()
 window.location = loc
}



var loc = window.location.toString()
if (loc.match('showtopic=')) window.onload=block
else if (loc.match('act=UserCP') || loc.match('act=Msg')) window.onload=setblocklist
</script>
CH
April 20,

This topic is archived.

See also:


Back to support forum