Post by Ross on Oct 2, 2005 4:42:09 GMT -8
I have improved upon the previous version to give the ability to check boxes from different pages. For example I can go to 'View Letter B' and select to PM 'Bob', 'Bill' and 'Ben'. Then, if I click on 'View Staff' I can add 'Peter', 'Alan' and 'ASE' to the list. So when I click 'Send PM' it will add all 6 usernames to the 'To' box.
Note: All names were random and have nothing to do with who you may or may not want to PM
Main Footer
<script type="text/javascript">
<!--
/*
send pm from members list by ross
support.proboards.com
do not redistribute without permission
*/
var admin = '1'; //Set to '1' to only let Administrators use this feature
// No need to Edit Below
if(location.href.match(/ion=members/) && (admin != '1' || document.getElementsByTagName('table')[0].innerHTML.match(/ion=admin/)))
{
var a = document.getElementsByTagName('a');
for(i=0;i<a.length;i++)
{
if(a.href.match(/ion=member/))
{
a.onclick=function()
{
this.href += '&checked=' + checkIt();
}
}
}
var select = document.getElementsByTagName('select');
for(s=0; s<select.length; s++)
if(select.options[0].value.match(/ion=member/i))
{
select.onchange = "location.href = this.options[this.selectedIndex].value +'&checked=' + checkIt();";
}
var tt = document.getElementsByTagName("td");
for(i=0; i<tt.length; i++)
{
if(tt.className == 'windowbg' && tt.innerHTML.match(/action=viewprofile/))
{
user = tt.getElementsByTagName('a')[0].href.split('user=')[1];
tt.parentNode.insertCell(6);
tt.parentNode.lastChild.className = 'windowbg';
tt.parentNode.lastChild.innerHTML = '<font size=2><input type="checkbox" name="pm-'+ user +'"></font>';
if(location.href.match(user)){ tt.parentNode.lastChild.firstChild.firstChild.checked=true; }
}
else if(tt.colSpan == '6' && tt.height == '18')
{
if(!tt.parentNode.nextSibling)
{
tt.colSpan = '7';
tt.innerHTML = '<table><tr><td width=100%>'+ tt.innerHTML +'</td><td><font size=2><input type="button" value="Send PM" onClick="pmIt()" ></font></td></tr></table>';
}
else
{
tt.colSpan = '7';
if(location.href.match(/view=letter/))
{
tt.parentNode.nextSibling.nextSibling.firstChild.colSpan = '7';
}
}
}
else if(tt.className == 'catbg' && tt.innerHTML.match(/Extras/))
{
tt.parentNode.insertCell(6);
tt.parentNode.lastChild.className = 'catbg';
tt.parentNode.lastChild.innerHTML = '<font size=2 class="cattext" color="'+ tt.firstChild.color +'">PM</font>';
}
}
function checkIt()
{
var checked = (location.href.match(/&checked=(.+)/))? RegExp.$1 : '';
var pm = document.getElementsByTagName('input');
for(j=0; j<pm.length; j++)
{
if(pm[j].name.match(/pm-/))
{
user = pm[j].name.split('pm-')[1];
if(pm[j].checked && !checked.match(user))
{
checked += user + ',';
}
else if(checked.match(user) && !pm[j].checked)
{
checked = checked.replace(user+',','');
}
}
}
return checked;
}
function pmIt()
{
location.href = '/index.cgi?&action=pmsend&to=' + checkIt();
}
}
//-->
</script>
Note: All names were random and have nothing to do with who you may or may not want to PM
Main Footer
<script type="text/javascript">
<!--
/*
send pm from members list by ross
support.proboards.com
do not redistribute without permission
*/
var admin = '1'; //Set to '1' to only let Administrators use this feature
// No need to Edit Below
if(location.href.match(/ion=members/) && (admin != '1' || document.getElementsByTagName('table')[0].innerHTML.match(/ion=admin/)))
{
var a = document.getElementsByTagName('a');
for(i=0;i<a.length;i++)
{
if(a.href.match(/ion=member/))
{
a.onclick=function()
{
this.href += '&checked=' + checkIt();
}
}
}
var select = document.getElementsByTagName('select');
for(s=0; s<select.length; s++)
if(select
{
select
}
var tt = document.getElementsByTagName("td");
for(i=0; i<tt.length; i++)
{
if(tt.className == 'windowbg' && tt.innerHTML.match(/action=viewprofile/))
{
user = tt.getElementsByTagName('a')[0].href.split('user=')[1];
tt.parentNode.insertCell(6);
tt.parentNode.lastChild.className = 'windowbg';
tt.parentNode.lastChild.innerHTML = '<font size=2><input type="checkbox" name="pm-'+ user +'"></font>';
if(location.href.match(user)){ tt.parentNode.lastChild.firstChild.firstChild.checked=true; }
}
else if(tt.colSpan == '6' && tt.height == '18')
{
if(!tt.parentNode.nextSibling)
{
tt.colSpan = '7';
tt.innerHTML = '<table><tr><td width=100%>'+ tt.innerHTML +'</td><td><font size=2><input type="button" value="Send PM" onClick="pmIt()" ></font></td></tr></table>';
}
else
{
tt.colSpan = '7';
if(location.href.match(/view=letter/))
{
tt.parentNode.nextSibling.nextSibling.firstChild.colSpan = '7';
}
}
}
else if(tt.className == 'catbg' && tt.innerHTML.match(/Extras/))
{
tt.parentNode.insertCell(6);
tt.parentNode.lastChild.className = 'catbg';
tt.parentNode.lastChild.innerHTML = '<font size=2 class="cattext" color="'+ tt.firstChild.color +'">PM</font>';
}
}
function checkIt()
{
var checked = (location.href.match(/&checked=(.+)/))? RegExp.$1 : '';
var pm = document.getElementsByTagName('input');
for(j=0; j<pm.length; j++)
{
if(pm[j].name.match(/pm-/))
{
user = pm[j].name.split('pm-')[1];
if(pm[j].checked && !checked.match(user))
{
checked += user + ',';
}
else if(checked.match(user) && !pm[j].checked)
{
checked = checked.replace(user+',','');
}
}
}
return checked;
}
function pmIt()
{
location.href = '/index.cgi?&action=pmsend&to=' + checkIt();
}
}
//-->
</script>