Post by Ross on Jan 17, 2006 0:11:18 GMT
Individual Board Footer
What this code does is lets you choose an alternative name and avatar to use when posting a message. I'd strongly recommend only using it on one or two boards
<script type="text/javascript">
<!--
/* choose rpg character when posting
by ross - support.proboards.com */
var avatar = [];
avatar[0] = 'Avatar Url 1';
avatar[1] = 'Avatar Url 2';
var iRe = /\{name:(.+?)#\|#picture:(\d+)\}/;
if(location.href.match(/action=(display|gotopost)&/)) {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).innerHTML.match(iRe) && td.item(i-5).width == '20%') {
var iName = RegExp.$1;
var iAvatar = avatar[RegExp.$2];
var iUser = '';
if(!td.item(i-5).innerHTML.match(/Guest/))
iUser = td.item(i-5).getElementsByTagName('a').item(1).href;
var iMarker = td.item(i-5).getElementsByTagName('a').item(0).cloneNode(true);
var iHolder = document.createElement('div');
iHolder.appendChild(iMarker)
iHolder.appendChild(document.createElement('center'));
iHolder.lastChild.appendChild(document.createElement('a'));
iHolder.lastChild.lastChild.href = iUser;
iHolder.lastChild.lastChild.style.fontWeight = 'bold';
iHolder.lastChild.lastChild.appendChild(document.createTextNode(iName));
iHolder.lastChild.appendChild(document.createElement('br'));
iHolder.lastChild.appendChild(document.createElement('br'));
iHolder.lastChild.appendChild(document.createElement('img'));
iHolder.lastChild.lastChild.src = iAvatar;
iHolder.lastChild.lastChild.alt = '[avatar]';
td.item(i-5).innerHTML = iHolder.innerHTML
td.item(i).innerHTML = td.item(i).innerHTML.replace(iRe,'');
td.item(i).parentNode.nextSibling.getElementsByTagName('hr').item(0).parentNode.style.display = 'none';
}
else if(td.item(i).width == '100%' && td.item(i).className == 'titlebg' && td.item(i).firstChild.innerHTML.match(/^<b>quick reply<\/b>$/i)) {
var quickReplyTable= td.item(i-1).parentNode.parentNode.parentNode;
quickReplyTable.style.display = 'none';
quickReplyTable.previousSibling.style.display = 'none';
quickReplyTable.previousSibling.previousSibling.style.display = 'none';
break;
}
}
}
else if(document.postForm) {
var iAddName = document.createElement('input');
iAddName.size = 30;
iAddName.type= 'text';
iAddName.id = 'getName';
var iAddAvatar = document.createElement('select');
iAddAvatar.id = 'getPicture';
for(o=0; o<avatar.length; o++) {
iAddAvatar.appendChild(document.createElement('option'));
iAddAvatar.lastChild.innerHTML = (avatar[o].match(/http:\/\/.+\/(.+?).(png|gif|jpe?g)/i))? RegExp.$1 : 'Avatar '+(o+1);
iAddAvatar.lastChild.value = o;
}
if(document.postForm.message.value.match(iRe)) {
iAddName.value = RegExp.$1;
iAddAvatar.value = RegExp.$2;
document.postForm.message.value = document.postForm.message.value.replace(iRe,'');
}
var target = document.postForm.icon.parentNode.parentNode;
var z = target.rowIndex;
var row1 = target.parentNode.insertRow(z);
row1.className = 'windowbg';
row1.insertCell(0).appendChild(iAddAvatar);
row1.insertCell(0).appendChild(document.createElement('font'));
row1.cells[0].lastChild.size = '2';
row1.cells[0].lastChild.appendChild(document.createTextNode('Character Image:'));
var row2 = target.parentNode.insertRow(z);
row2.className = 'windowbg';
row2.insertCell(0).appendChild(iAddName);
row2.insertCell(0).appendChild(document.createElement('font'));
row2.cells[0].lastChild.size = '2';
row2.cells[0].lastChild.appendChild(document.createTextNode('Character Name:'));
document.postForm.onsubmit = function() {
var n = document.getElementById('getName').value;
var p = document.getElementById('getPicture').value;
if(n.length > 1)
document.postForm.message.value = '{name:'+ n +'#|#picture:'+ p +'}' + document.postForm.message.value;
return true;
}
}
//-->
</script>
Edit these lines:
avatar[0] = 'Avatar Url 1';
avatar[1] = 'Avatar Url 2';
where the green number insreases by one each time.
What this code does is lets you choose an alternative name and avatar to use when posting a message. I'd strongly recommend only using it on one or two boards
<script type="text/javascript">
<!--
/* choose rpg character when posting
by ross - support.proboards.com */
var avatar = [];
avatar[0] = 'Avatar Url 1';
avatar[1] = 'Avatar Url 2';
var iRe = /\{name:(.+?)#\|#picture:(\d+)\}/;
if(location.href.match(/action=(display|gotopost)&/)) {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).innerHTML.match(iRe) && td.item(i-5).width == '20%') {
var iName = RegExp.$1;
var iAvatar = avatar[RegExp.$2];
var iUser = '';
if(!td.item(i-5).innerHTML.match(/Guest/))
iUser = td.item(i-5).getElementsByTagName('a').item(1).href;
var iMarker = td.item(i-5).getElementsByTagName('a').item(0).cloneNode(true);
var iHolder = document.createElement('div');
iHolder.appendChild(iMarker)
iHolder.appendChild(document.createElement('center'));
iHolder.lastChild.appendChild(document.createElement('a'));
iHolder.lastChild.lastChild.href = iUser;
iHolder.lastChild.lastChild.style.fontWeight = 'bold';
iHolder.lastChild.lastChild.appendChild(document.createTextNode(iName));
iHolder.lastChild.appendChild(document.createElement('br'));
iHolder.lastChild.appendChild(document.createElement('br'));
iHolder.lastChild.appendChild(document.createElement('img'));
iHolder.lastChild.lastChild.src = iAvatar;
iHolder.lastChild.lastChild.alt = '[avatar]';
td.item(i-5).innerHTML = iHolder.innerHTML
td.item(i).innerHTML = td.item(i).innerHTML.replace(iRe,'');
td.item(i).parentNode.nextSibling.getElementsByTagName('hr').item(0).parentNode.style.display = 'none';
}
else if(td.item(i).width == '100%' && td.item(i).className == 'titlebg' && td.item(i).firstChild.innerHTML.match(/^<b>quick reply<\/b>$/i)) {
var quickReplyTable= td.item(i-1).parentNode.parentNode.parentNode;
quickReplyTable.style.display = 'none';
quickReplyTable.previousSibling.style.display = 'none';
quickReplyTable.previousSibling.previousSibling.style.display = 'none';
break;
}
}
}
else if(document.postForm) {
var iAddName = document.createElement('input');
iAddName.size = 30;
iAddName.type= 'text';
iAddName.id = 'getName';
var iAddAvatar = document.createElement('select');
iAddAvatar.id = 'getPicture';
for(o=0; o<avatar.length; o++) {
iAddAvatar.appendChild(document.createElement('option'));
iAddAvatar.lastChild.innerHTML = (avatar[o].match(/http:\/\/.+\/(.+?).(png|gif|jpe?g)/i))? RegExp.$1 : 'Avatar '+(o+1);
iAddAvatar.lastChild.value = o;
}
if(document.postForm.message.value.match(iRe)) {
iAddName.value = RegExp.$1;
iAddAvatar.value = RegExp.$2;
document.postForm.message.value = document.postForm.message.value.replace(iRe,'');
}
var target = document.postForm.icon.parentNode.parentNode;
var z = target.rowIndex;
var row1 = target.parentNode.insertRow(z);
row1.className = 'windowbg';
row1.insertCell(0).appendChild(iAddAvatar);
row1.insertCell(0).appendChild(document.createElement('font'));
row1.cells[0].lastChild.size = '2';
row1.cells[0].lastChild.appendChild(document.createTextNode('Character Image:'));
var row2 = target.parentNode.insertRow(z);
row2.className = 'windowbg';
row2.insertCell(0).appendChild(iAddName);
row2.insertCell(0).appendChild(document.createElement('font'));
row2.cells[0].lastChild.size = '2';
row2.cells[0].lastChild.appendChild(document.createTextNode('Character Name:'));
document.postForm.onsubmit = function() {
var n = document.getElementById('getName').value;
var p = document.getElementById('getPicture').value;
if(n.length > 1)
document.postForm.message.value = '{name:'+ n +'#|#picture:'+ p +'}' + document.postForm.message.value;
return true;
}
}
//-->
</script>
Edit these lines:
avatar[0] = 'Avatar Url 1';
avatar[1] = 'Avatar Url 2';
where the green number insreases by one each time.