Board Logo

 Username:    Password:    Stay logged in: Welcome Guest. Please Login or Register.  Oct 23rd, 2017, 10:30am


Board Hacks
Important News
Please read the notes posted with any codes carefully, as they will usually tell you where they need to go.
Welcome to the Conforums Hacks Board!

All codes here have been tested but we accept no responsibility if these codes do not work on your board, or have an adverse effect when used in combination with other codes.

This board is read only. Any queries or requests for codes should be made on the Coding Forum

Helpful sites
Google
Dynamic Drive

The Staff
Roger
Dave
GIzzy



« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Moderator Default Messages  (Read 5475 times)
Dalton
Ex-Shiny Gold Star Club Member
Conforums Administrator


member is offline

Avatar



AIM
Homepage PM

Gender: Male
Posts: 1766
xx Moderator Default Messages
« Thread started on: Aug 8th, 2012, 09:16am »

This script adds a dropdown for admins and mods allowing them to add a default message to their post, explaining if a request has been completed, or a topic locked or whatever you want it to say.

Code:
<script language="javascript" type="text/javascript">
/* Original concept by Hechizero, rewritten as a conforums code by Dalton */

var DefaultMessages=[];
DefaultMessages[0]=[];

DefaultMessages[1]=['Thread Against TOS','This thread is against Conforums TOS.\nLocked','yes'];
DefaultMessages[2]=['Request Done','This request has been finished.\nIf you do not like the product please pm the creator.','yes'];
DefaultMessages[3]=['Off Topic','This thread is off topic.\nLocked','yes'];
DefaultMessages[4]=['Edit Me','Edit me.\nLocked','yes/no']
if (document.postmodify && document.postmodify.lock) {
var the_table=document.postmodify.lock.parentNode.parentNode.parentNode;
var newR=the_table.insertRow(the_table.rows.length);
newR.insertCell(0).innerHTML='<font size="2"><b>Default Message:</b></font>';
newR.cells[0].className='windowbg';
var newInput=document.createElement('input');
newInput.type='checkbox';
newInput.id='defaultMessageCheck';
newInput.onclick=function () {
var selectedNum=document.getElementById('defaultMessage').selectedIndex;
if (this.checked && selectedNum>0) {
document.postmodify.message.value+=DefaultMessages[selectedNum][1];
DefaultMessages[0][DefaultMessages[0].length]=DefaultMessages[selectedNum][1];
if (!document.postmodify.lock.checked && DefaultMessages[selectedNum][2].match(/^yes$/i)) {
document.postmodify.lock.checked=true;
}
} else {
for (var h=0;h<DefaultMessages[0].length;h++) {
document.postmodify.message.value=document.postmodify.message.value.replace(DefaultMessages[0][h],'');
}
DefaultMessages[0].length=0;
if (document.postmodify.lock.checked) {
document.postmodify.lock.checked=false;
}
}
};
var newSelect=document.createElement('select');
newSelect.id='defaultMessage';
newSelect.options[0]=new Option('---------','',false,false);
for (var h=1;h<DefaultMessages.length;h++) {
newSelect.options[h]=new Option(DefaultMessages[h][0],'',false,false);
}
newSelect.onchange=function () {
if (document.getElementById('defaultMessageCheck').checked && this.selectedIndex>0) {
document.postmodify.message.value+=DefaultMessages[this.selectedIndex][1];
DefaultMessages[0][DefaultMessages[0].length]=DefaultMessages[this.selectedIndex][1];
if (!document.postmodify.lock.checked && DefaultMessages[this.selectedIndex][2].match(/^yes$/i)) {
document.postmodify.lock.checked=true;
}
}
};
newC=newR.insertCell(1); newC.appendChild(newInput); newC.appendChild(document.createTextNode(' ')); newC.appendChild(newSelect);
}
</script> 
User IP Logged

User Image
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Back To Top
Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls