geke hand
E Z B O A R D
Personal Emoticon / Code Manager

<< updated: 7/11/2003

Summary: Enable your users to keep their own personal library of emoticons/text snippets.

Details:

The data used to store the emoticons is stored in a cookie. For this reason, the emoticons/text snippets will cross boards.

PEMs are limited to 6 in this version, since extremely long cookies can cause a problem with viewing pages.

It also makes the data vulnerable to "attack" by an unscrupulous administrator, etc. Please keep a backup of your emoticons/text snippets in a text file!

To use the manager, enter the URL of an image you want to use as an emoticon in the first text box and click on "Add PE".

If you want to use the PEM to manage other kinds of text snippets (besides emoticons), add an emoticon to represent the text and then use the "Get PEs" and "Edit PEs" features to substitute your own code for the regular [img] stuff.

HEAD: (box #1)

<script type="text/javascript">
/* BEGIN EZURL */
ezURL = document.location.href.match("http:\/\/((?:pub|b|p)([0-9]+)|beta|vanchau|inbox)\.ezboard\.com\/(b|f)([a-zA-Z0-9]+(?=frm[0-9]+)|[a-zA-Z0-9]+(?!frm[0-9]+))(frm[0-9]+|)(?:(?:[\.]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:(?:[\x3F]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:.*)");
try {
if (ezURL.length > 0) {
ezPub = ezURL[2].length > 0 ? ezURL[2] : ezURL[1];
ezFullPub = ezURL[1];
ezIsBoard = ezURL[3] == "b" ? true : false;
ezBoardID = ezURL[4];
ezForum = ezURL[5];
ezPage = ezURL[6];
ezQuery = ezURL[7];
}
} catch (e) { }
ezURL = null;
/* END EZURL */
</script>

HEAD Notes:

This script is used in many of the other scripts offered here. Only one copy should be installed.

HEAD: (box #1)

<script type="text/javascript">
/* PERSONAL EMOTICON MANAGER */

function setPEMCookie(value) {
maxPEM = 6;
if ( value.split("|").length > (maxPEM * 2)) {
v = value.split("|");
value = "";
eat = v.length - (maxPEM * 2);
for (vx = 0; vx < eat; vx++) {
v.shift();
}
value = v.join("|");
}
var expire = new Date("9/9/2050");
document.cookie = "emoticons=" + value + ";domain=.ezboard.com;expires=" + expire.toUTCString() + ";";
}
function readPEMCookie() {
if (document.cookie.indexOf("emoticons") != -1) {
iStart = document.cookie.indexOf("emoticons=");
iEnd = document.cookie.indexOf(";", iStart);
if ( iEnd == -1 ) { iEnd = document.cookie.length; }
return document.cookie.substr(iStart, iEnd - iStart).split("=") [1];
} else {
return "";
}
}

function addemoticon(sE, bOverwrite) {
if (!bOverwrite) {
var sExist = readPEMCookie();
} else {
var sExist = "";
}
setPEMCookie((sExist != "" ? sExist + "|" : "") + sE + (!bOverwrite ? "|" + "[img]" + sE + "[/img]" : ""));
}

function clearemoticons() {
var expire = new Date("1/1/1900");
document.cookie = "emoticons=;domain=.ezboard.com;expires=" + expire.toUTCString() + ";";
}

function writeEmoteManager() {
document.write("<div id=\"emotemanager\" style=\"display: none; width: 700px; margin-top: 5px;\">\n");
document.write("<h5 style=\"line-height: 20px;\"><a href=\"http://www.geke.net/\">G E K E . N E T</a> Personal Emoticon Manager <a style=\"font-size: 80%;\" name=\"emotemanage\" href=\"java\script:showEl(\'emotemanager\', '')\">(Hide Personal Emoticon Manager)</a></h5>\n");
document.write("<input type=\"text\" id=\"addemote\" size=\"60\"> <input type=\"button\" class=\"inputbutton\" name=\"emoteadd\" onClick=\"addemoticon(document.getElementById(\'addemote\').value, false)\" value=\"Add PE\" title=\"enter the url of the emoticon\">\n");
document.write("<text\area title=\"the first line is the image, the second line is the code inserted\" wrap=off id=\"editemote\" rows=\"10\" cols=\"80\"></text\area><br>\n");
document.write("<input type=\"button\" class=\"inputbutton\" name=\"emoteedit\" onClick=\'document.getElementById(\"editemote\").value=readPEMCookie().replace(/\\_\\|/ig,\"\\n\").replace(/\\|/ig,\"\\n\")\' value=\"Get PEs\">\n");
document.write(" <input type=\"button\" class=\"inputbutton\" name=\"emoteedit\" onClick=\'addemoticon(document.getElementById(\"editemote\").value.replace(/\\n/ig,\"|\"), true)\' value=\"Edit PEs\">\n");
document.write(" <input type=\"button\" class=\"inputbutton\" name=\"emoteclear\" onClick=\'clearemoticons()\' value=\"Clear PEs\">\n");
document.write("</div>");

if (document.getElementById("emoticonbox")) {
emt = document.createElement("a");
emt.innerHTML = "Show PEM";
emt.href = "javascript:showEl('emotemanager','show')";
document.getElementById("emoticonbox").parentNode.appendChild(document.createElement("br"));
document.getElementById("emoticonbox").parentNode.appendChild(emt);
}
}

if ( ezPage.match("showAddPollScreenFromWeb|addPollFromWeb|showAddTopicScreenFromWeb|addTopicFromWeb|showAddReplyScreenFromWeb|.addReplyFromWeb|showEditScreen|.editMessageFromWeb")) {
if (readPEMCookie()) {
semote = readPEMCookie();
if ( semote.indexOf("_|") != -1 ) {
semote = semote.replace(/\_\|/ig, "|");
}
bemote = semote.split("|");
for (be=0; be < bemote.length; be++) {
eList.push(bemote[be]);
}
}
}
/* END PERSONAL EMOTICON MANAGER */
</script>

FOOTER: (box #4)

<script type="text/javascript">
/* PERSONAL EMOTICON MANAGER FOOTER */
if (document.getElementById("emoticonbox")) {
writeEmoteManager();
}
/* END PERSONAL EMOTICON MANAGER FOOTER */
</script>

FOOTER Notes:

Place this script where you want the PEM box to appear.

History:

7/11/2003 - updated to limit to 6 PEMs, fix clear PE function
6/6/2003 - problem with cookie parsing fixed
6/5/2003 - written by phalen180

Credits:

written by phalen180
suggested by JeffJr23/others

E Z B O A R D

design by G E K E . N E T
best viewed in 1024x768 screen resolution using a standards compliant browser
logo based on a public domain drawing of a hand making the sign of the cross, no disrespect is intended
all other contents and code copyright © 2002-2005 jonathan cook

Valid HTML 4.01! Valid CSS!