Post by sueb on Jun 21, 2005 10:56:53 GMT -8
I want to make sure that this is right. I goofed it up earlier and shut my whole board down. Yiks!
I want to use different smileys then the standard ones.
Here is the code that I got:
Adds the smileys in the quick reply box.
Simple to change, just read the comments
<script type="text/javascript">
<!--
/*
Smileys with quick reply - global footers
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Base url for the smileys folder
var sBaseImg = "http://www.websmileys.com/";
// List of smileys - [SMILEY FILE, CODE, TITLE]
var iSmileys = [
["sm/happy/768.gif", "", "Smiley"],
["sm/happy/044.gif", "", "Wink"],
["sm/happy/1405.gif", "", Cheesy
["sm/happy/028.gif", ";D", "Grin"],
["sm/mad/482.gif", "", "Angry"],
["sm/sad/787.gif", "", "Sad"],
["sm/mad/158.gif", "", "Shocked"],
["sm/angels/teu09.gif", "", "Cool"],
["sm/evil/teu19.gif", ")", "huh"],
["sm/happy/042.gif", "", "Roll Eyes"],
["sm/happy/443.gif", "", "Tongue"],
["sm/happy/1277.gif", "", "Embarassed"],
["sm/sleep/schla19.gif", "", "Lips Sealed"],
["sm/love/246.gif", "", "Undecided"],
["sm/love/640.gif", "", "Kiss"],
["sm/sad/310.gif", "", "Cry"]
];
var iTable = document.getElementsByTagName("table");
function addSmiley(smiley){
var isIE = (document.all)? true : false;
var mArea = document.getElementById("qrform").message;
if(isIE){
mArea.focus();
var iCurSelect = document.selection.createRange();
iCurSelect.text = smiley + iCurSelect.text
} else if(!isIE){
var selStart = mArea.value.substr(0, mArea.selectionStart);
var selEnd = mArea.value.substr(mArea.selectionEnd, mArea.value.length);
var curSelection = mArea.value.replace(selStart, '').replace(selEnd, '');
mArea.value = selStart + smiley + curSelection + selEnd;
} else {
mArea.value += smiley;
}
mArea.focus();
}
for(t = 0; t < iTable.length; t ++){
var iBR = document.createElement("br");
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1" && iTable.item(t).rows.item(0).innerHTML.match(/>Quick Reply</)){
var iMCell = iTable.item(t).rows.item(1).cells.item(0);
iTable.item(t).getElementsByTagName("form").item(0).id = "qrform";
iMCell.insertBefore(iBR, iMCell.firstChild);
iSmileys.reverse();
for(s = 0; s < iSmileys.length; s ++){
var sLink = document.createElement("a");
var sImg = document.createElement("img");
sImg.border = "0";
sImg.src = sBaseImg + iSmileys[0];
sImg.title = iSmileys[2];
sLink.href = "javascript: addSmiley(\" " + iSmileys[1] + "\")";
sLink.appendChild(sImg);
iMCell.insertBefore(sLink, iMCell.firstChild);
iMCell.insertBefore(document.createTextNode(" "), iMCell.firstChild);
}
}
}
//-->
</script>
~~~~~~
This is what they look like in order and the way they are on my main boards:
www.websmileys.com/sm/happy/768.gif
[/img]
www.websmileys.com/sm/sad/310.gif[/img
I want to use different smileys then the standard ones.
Here is the code that I got:
Adds the smileys in the quick reply box.
Simple to change, just read the comments
<script type="text/javascript">
<!--
/*
Smileys with quick reply - global footers
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Base url for the smileys folder
var sBaseImg = "http://www.websmileys.com/";
// List of smileys - [SMILEY FILE, CODE, TITLE]
var iSmileys = [
["sm/happy/768.gif", "", "Smiley"],
["sm/happy/044.gif", "", "Wink"],
["sm/happy/1405.gif", "", Cheesy
["sm/happy/028.gif", ";D", "Grin"],
["sm/mad/482.gif", "", "Angry"],
["sm/sad/787.gif", "", "Sad"],
["sm/mad/158.gif", "", "Shocked"],
["sm/angels/teu09.gif", "", "Cool"],
["sm/evil/teu19.gif", ")", "huh"],
["sm/happy/042.gif", "", "Roll Eyes"],
["sm/happy/443.gif", "", "Tongue"],
["sm/happy/1277.gif", "", "Embarassed"],
["sm/sleep/schla19.gif", "", "Lips Sealed"],
["sm/love/246.gif", "", "Undecided"],
["sm/love/640.gif", "", "Kiss"],
["sm/sad/310.gif", "", "Cry"]
];
var iTable = document.getElementsByTagName("table");
function addSmiley(smiley){
var isIE = (document.all)? true : false;
var mArea = document.getElementById("qrform").message;
if(isIE){
mArea.focus();
var iCurSelect = document.selection.createRange();
iCurSelect.text = smiley + iCurSelect.text
} else if(!isIE){
var selStart = mArea.value.substr(0, mArea.selectionStart);
var selEnd = mArea.value.substr(mArea.selectionEnd, mArea.value.length);
var curSelection = mArea.value.replace(selStart, '').replace(selEnd, '');
mArea.value = selStart + smiley + curSelection + selEnd;
} else {
mArea.value += smiley;
}
mArea.focus();
}
for(t = 0; t < iTable.length; t ++){
var iBR = document.createElement("br");
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1" && iTable.item(t).rows.item(0).innerHTML.match(/>Quick Reply</)){
var iMCell = iTable.item(t).rows.item(1).cells.item(0);
iTable.item(t).getElementsByTagName("form").item(0).id = "qrform";
iMCell.insertBefore(iBR, iMCell.firstChild);
iSmileys.reverse();
for(s = 0; s < iSmileys.length; s ++){
var sLink = document.createElement("a");
var sImg = document.createElement("img");
sImg.border = "0";
sImg.src = sBaseImg + iSmileys
sImg.title = iSmileys
sLink.href = "javascript: addSmiley(\" " + iSmileys
sLink.appendChild(sImg);
iMCell.insertBefore(sLink, iMCell.firstChild);
iMCell.insertBefore(document.createTextNode(" "), iMCell.firstChild);
}
}
}
//-->
</script>
~~~~~~
This is what they look like in order and the way they are on my main boards:
www.websmileys.com/sm/happy/768.gif
www.websmileys.com/sm/sad/310.gif[/img