Post by Peter on Oct 29, 2004 16:11:57 GMT
Code by Hechizero
Script Name: Smileys and Censored Words Manager
Description: Creates a manager that makes easier adding new censored words and smileys.
Hack Type: Admin-Area-Enable
Version: 1.1
Previews: Preview #1 || Preview #2 || Preview #3
First, before installing the script you must run the setup script. So add the following script to your Main Page Footer and save your Headers and Footers:
You will be guided by some alerts during the setup, so just read them and you should be ok. After runing the script go to your headers and footers, remove the setup script and replace it with the following script:
Now search for the following part of the script:
var defim=":";
var defur="http://myurl/";
And edit the blue part with the default link extension that you want to add to the "Smiley Url" input box. Also edit the red part with the default character that you want to appear in the "Smiley Word" input box.
How does it works?:
Go to the admin area and there you will see a new link below the Set Restriction category. Both the "Set Censored Words" and "Set Smileys" links, when pressed, will redirect you to the page where you can customize the censored words or smileys. This links can be accesed by any GMod or Admin that has the power to set censored words.
A. Set Censored Words
Look the preview #2 to get an idea of how the Manager looks and to see the different parts of it.
1. Adding a new censored word
Add the word that you want to change in the "Change this..." input box and type the result in the "To this..." input box. After pressing add the word will be added to the pre-existing ones, so you can perform the same actions with it as if it were there before.
2. Actions
As you can see to the side of each censored word is a dropdown list. It has two options: "Edit" and "Delete". If you want to edit a censored word you must change its values and select this option from the dropdown list. If you edit the word but you don't select the option edit it WON'T be edited when the page is updated. On the other hand if you want to delete a censored word just select the option.
After selecting an action from one or more censored words or after adding all the extra censored words remember to click in the "Update" button. If you don't do it the changes won't be saved.
3. Clear
The clear button can be used to remove all the censored words. After clicking it a confirm message will appear. If you press "OK" all the censored words will be deleted (but not any smiley that you had specified with the Smileys Manager).
4. Update
After doing all what you want (adding, editing, deleting, etc.) press the Update button to save the changes.
B. Set Smileys
Look the preview #3 to get an idea of how the Manager looks and to see the different parts of it.
1. Adding a new smiley
Add the word that you want for the smiley in the "Smiley Word" input box and type the url of the smiley in the "Smiley Url" input box. As you can see both input boxes have the default characters that you specified previously in the script. After pressing add the smiley will be added to the pre-existing ones, so you can perform the same actions with it as if it were there before.
2. Preview
After typing an url in the "Smiley Url" input box you can click the Preview button to make the image (smiley) appear at the left side.
3. Actions
As you can see to the side of each smiley is a dropdown list. It has two options: "Edit" and "Delete". If you want to edit a smiley you must change its values and select this option from the dropdown list. If you edit the smyley word or url but you don't select the option edit it WON'T be edited when the page is updated. On the other hand if you want to delete a smiley just select the option.
After selecting an action from one or more smileys or after adding all the extra smileys remember to click in the "Update" button. If you don't do it the changes won't be saved.
4. Clear
The clear button can be used to remove all the smileys. After clicking it a confirm message will appear. If you press "OK" all the smileys will be deleted (but not any censored word that you had specified with the Censored Words Manager).
5. Update
After doing all what you want (adding, editing, deleting, etc.) press the Update button to save the changes.
Location: The Setup Script goes in the Main Page Footer. The Script goes in the Main Page Footer (remember to remove the setup script before adding this one).
Script Name: Smileys and Censored Words Manager
Description: Creates a manager that makes easier adding new censored words and smileys.
Hack Type: Admin-Area-Enable
Version: 1.1
Previews: Preview #1 || Preview #2 || Preview #3
First, before installing the script you must run the setup script. So add the following script to your Main Page Footer and save your Headers and Footers:
<script language="javascript" type="text/javascript">
/* Created by Hechizero - http://www.hechizero.com
Smileys and Censored Words Manager v1.1 || Setup Script
This code may not redistributed without the express permission from its creator.
This header must stay intact at all times. */
if (location.href.indexOf("action=headersfooters2")!=-1) {alert('Smileys and Censored Words Manager v1.1\n\nSetup: Initializing\n\nPress "OK" to continue.'); window.location="index.cgi?action=setcensor";}
else {if (location.href.indexOf("action=headersfooters")!=-1) {alert('Smileys and Censored Words Manager v1.1\n\nRemember to replace the setup script!');}}
if (location.href.indexOf("action=setcensor2")!=-1) {if (confirm('Smileys and Censored Words Manager v1.1\n\nSetup: Completed\n\nPress "OK" to be redirected to the forum headers\nand footers or press "Cancel" to do it yourself.')==true) {
window.location="index.cgi?action=headersfooters";} else {document.write('<center><font size="2"><b>GO TO:</b></font><br/><a href="index.cgi?action=headersfooters">Headers and Footers</a></center><br/><br/><br/>');}}
else {if (location.href.indexOf("action=setcensor")!=-1) {
for (h=0;h<document.forms.length;h++) {if (document.forms[h].action=="index.cgi?action=setcensor2") {var censorval=document.forms[h].censored.value; var smileys=censorval.split("\r"); var formcen=h;}}
var censoredw=new Array(); var smileyw=new Array(); var cwi=0; var swi=0; var messageend="";
for (i=0;i<smileys.length-1;i++) {if (smileys[i].match(/=\[img\]/)) {smileyw[swi]=smileys[i]; swi++} else {censoredw[cwi]=smileys[i]; cwi++}}
for (e=0;e<censoredw.length;e++) {messageend+=censoredw[e]+'\r';}
messageend+='smileys=smileys\r';
for (c=0;c<smileyw.length;c++) {messageend+=smileyw[c]+'\r';}
document.forms[formcen].censored.value=messageend; document.forms[formcen].submit();}}
</script>
You will be guided by some alerts during the setup, so just read them and you should be ok. After runing the script go to your headers and footers, remove the setup script and replace it with the following script:
<script language="javascript" type="text/javascript">
/* Created by Hechizero - http://www.hechizero.com
Smileys and Censored Words Manager v1.1
This code may not redistributed without the express permission from its creator.
This header must stay intact at all times. */
var defim=":";
var defur="http://myurl/";
if (location.href.indexOf("action=admin")!=-1) {var tds=document.getElementsByTagName("td");
for (i=0;i<tds.length;i++) {if (tds[i].width=="50%" && tds[i].vAlign=="top" && tds[i].innerHTML.match('Set Censored Words')) {tds[i].innerHTML=tds[i].innerHTML.replace(/">Set Censored Words<\/a>/i,'&type=setcensor">Set Censored Words</a><br /><a href="index.cgi?action=setcensor&type=setsmileys">Set Smileys</a>');}}}
if (location.href.indexOf("\&type=setcensor")!=-1) {document.write('<script src="http://www.webpost.net/he/hechizero/scripts/setcensor.js"></sc'+'ript>');}
if (location.href.indexOf("\&type=setsmileys")!=-1) {document.write('<script src="http://www.webpost.net/he/hechizero/scripts/setsmileys.js"></sc'+'ript>');}
</script>
Now search for the following part of the script:
var defim=":";
var defur="http://myurl/";
And edit the blue part with the default link extension that you want to add to the "Smiley Url" input box. Also edit the red part with the default character that you want to appear in the "Smiley Word" input box.
How does it works?:
Go to the admin area and there you will see a new link below the Set Restriction category. Both the "Set Censored Words" and "Set Smileys" links, when pressed, will redirect you to the page where you can customize the censored words or smileys. This links can be accesed by any GMod or Admin that has the power to set censored words.
A. Set Censored Words
Look the preview #2 to get an idea of how the Manager looks and to see the different parts of it.
1. Adding a new censored word
Add the word that you want to change in the "Change this..." input box and type the result in the "To this..." input box. After pressing add the word will be added to the pre-existing ones, so you can perform the same actions with it as if it were there before.
2. Actions
As you can see to the side of each censored word is a dropdown list. It has two options: "Edit" and "Delete". If you want to edit a censored word you must change its values and select this option from the dropdown list. If you edit the word but you don't select the option edit it WON'T be edited when the page is updated. On the other hand if you want to delete a censored word just select the option.
After selecting an action from one or more censored words or after adding all the extra censored words remember to click in the "Update" button. If you don't do it the changes won't be saved.
3. Clear
The clear button can be used to remove all the censored words. After clicking it a confirm message will appear. If you press "OK" all the censored words will be deleted (but not any smiley that you had specified with the Smileys Manager).
4. Update
After doing all what you want (adding, editing, deleting, etc.) press the Update button to save the changes.
B. Set Smileys
Look the preview #3 to get an idea of how the Manager looks and to see the different parts of it.
1. Adding a new smiley
Add the word that you want for the smiley in the "Smiley Word" input box and type the url of the smiley in the "Smiley Url" input box. As you can see both input boxes have the default characters that you specified previously in the script. After pressing add the smiley will be added to the pre-existing ones, so you can perform the same actions with it as if it were there before.
2. Preview
After typing an url in the "Smiley Url" input box you can click the Preview button to make the image (smiley) appear at the left side.
3. Actions
As you can see to the side of each smiley is a dropdown list. It has two options: "Edit" and "Delete". If you want to edit a smiley you must change its values and select this option from the dropdown list. If you edit the smyley word or url but you don't select the option edit it WON'T be edited when the page is updated. On the other hand if you want to delete a smiley just select the option.
After selecting an action from one or more smileys or after adding all the extra smileys remember to click in the "Update" button. If you don't do it the changes won't be saved.
4. Clear
The clear button can be used to remove all the smileys. After clicking it a confirm message will appear. If you press "OK" all the smileys will be deleted (but not any censored word that you had specified with the Censored Words Manager).
5. Update
After doing all what you want (adding, editing, deleting, etc.) press the Update button to save the changes.
Location: The Setup Script goes in the Main Page Footer. The Script goes in the Main Page Footer (remember to remove the setup script before adding this one).