Nutrocker
ezboard Moderator
ezSupporter
Posts: 7078
|
Posted: 3/28/03 4:10 pm
Quick reply by phalen180
This version of quick reply adds the following features/fixes:
[*]Changing the "Add Reply" button is no longer required.
[*]Option for HTML mode posts and for a dropdown to let the user select the posting mode
[*]Quick Reply appears (and works) from Prev/Next topic screens.
Please note the new support function that goes into the HEAD section and that you will still need ezURL installed if you want to use the emoticon list link.
Also please note that I'm soliciting donations, as I've just had to order a replacement server for GEKE.NET and am trying to offset the costs because I don't make any money from running any of the sites hosted on it, currently.
Summary: Add a form to reply to the topic from the topic page.
Details:
To use the "linkEmoticons" option, you must have the ezURL script in place on your board.
HEAD (box #1):
<script type="text/javascript">
/* FUNCTION TO GET ELEMENTS WITH TAG/ATTRIBUTE/VALUE */
function getElementsByAttribute (tag, attr, value, stopat) {
var re;
var foundels;
var iFound;
var sAttrValue;
checkels = document.getElementsByTagName(tag);
foundels = new Array();
for (el = 0; el < checkels.length; el++) {
sAttrValue = checkels[el].getAttribute(attr, 2);
re = new RegExp(value, "ig");
if (re.test(sAttrValue) != 0) {
iFound = foundels.push(checkels[el]);
if (stopat > 0 && iFound >= (stopat)) {
el = checkels.length;
}
}
}
return foundels;
}
/* END FUNCTION TO GET ELEMENTS WITH TAG/ATTRIBUTE/VALUE */
</script>
This is a new support function which gets the "add reply button" so that the Quick Reply can be placed where we want it.
FOOTER (box #4):
<script type="text/javascript">
/* QUICK REPLY by phalen180 */
/*
copyright 2005 phalen180
Please email serverfund at geke.net for info on how to donate to keep the
G E K E . N E T ezboard script archive going
*/
if ( document.location.href.indexOf(".showMessage") != -1 ||
document.location.href.indexOf(".showPrevMessage") != -1 ||
document.location.href.indexOf(".showNextMessage") != -1 ||
document.location.href.indexOf(".deleteSingle") != -1) {
/* Comment the lines below out or change the value to false
to assume that we will NOT include personal photo
or signature,
or use emoticons
or to show a link to the emoticon list
or to hide the subject box */
// For the following options
// use 0 for never,
// 1 for always,
// 2 to show checkbox (unchecked),
// 3 to show checkbox (checked)
includePersonalPhoto = 1;
includeSignature = 1;
useEmoticons = 3;
convertLinks = 3;
stayInTopic = 2;
showPreview = 2;
linkEmoticonList = false;
/*
use "text" for plain text,
"html" for HTML
and "choose" to show a dropdown */
// postType = "html";
// postType = "text";
// postType = "choose";
postType = "ezcodes";
showSubjectBox = true;
subjectSize = 60;
messageCols = 60;
messageRows = 4;
/* UNCOMMENT THIS ONE TO USE THE ORIGINAL STYLE */
// addReplyButton = document.getElementsByName("addreplybutton").item(1);
/* UNCOMMENT THIS ONE TO USE A TEXT ADD/REPLY BUTTON */
// foundels = getElementsByAttribute("a", "href", ".showAddReplyScreenFromWeb?", 0);
// addReplyButton = foundels[foundels.length - 1].childNodes[0];
/* UNCOMMENT THIS ONE TO USE AN IMAGE ADD/REPLY BUTTON */
addReplyButton = getElementsByAttribute("img", "alt", "Add Reply", 2)[1];
QRCell = addReplyButton.parentNode;
while ( QRCell.nodeName != "TR" ) {
QRCell = QRCell.parentNode;
}
QRCell = QRCell.getElementsByTagName("td").item(0);
QRForm = document.createElement("form");
QRForm.method = "post";
QRForm.action = addReplyButton.parentNode.href.replace(".showAddReplyScreenFromWeb", ".addReplyFromWeb");
QRForm.name = "PostMessage";
QRSubject = document.createElement("input");
QRSubject.value = document.title.replace(" - www.ezboard.com", "");
QRSubject.id = "quickreplysubject";
QRSubject.name = "subject";
if ( showSubjectBox ) {
QRSubject.type = "text";
QRSubject.className = "inputbox";
QRSubject.maxLength = 60;
QRSubject.size = subjectSize;
QRSubject.tabIndex = 3;
QRSubject.style.marginRight = "3px";
} else {
QRSubject.type = "hidden";
}
QRBody = document.createElement("textarea");
QRBody.rows = messageRows;
QRBody.cols = messageCols;
QRBody.id = "quickreplybody";
QRBody.className = "inputbox";
QRBody.value = "";
QRBody.name = "body";
QRBody.tabIndex = 4;
QRSubmit = document.createElement("input");
QRSubmit.type = "submit";
QRSubmit.className = "inputbutton";
QRSubmit.id = "quickreplysubmit";
QRSubmit.value = "Quick Reply";
QRSubmit.tabIndex = 5;
QRCell.align = "right";
QRCell.appendChild(QRForm);
/* Uncomment the commented lines to add labels for the two boxes */
// QRForm.appendChild(document.createTextNode("Subject: "));
QRForm.appendChild(QRSubject);
QRForm.appendChild(QRSubmit);
// QRForm.appendChild(document.createElement("br"));
// QRForm.appendChild(document.createTextNode("Message: "));
QRForm.appendChild(document.createElement("br"));
QRForm.appendChild(QRBody);
QRForm.appendChild(document.createElement("br"));
if (postType != "choose") {
QRpt = document.createElement("input");
QRpt.type = "hidden";
QRpt.name = "postType";
QRpt.value = postType;
QRForm.appendChild(QRpt);
}
else {
QRpt = document.createElement("select");
QRpt.name = "postType";
QRpt.appendChild(QRSelection("text", "Plain Text"));
QRpt.appendChild(QRSelection("ezcodes", "EZ Codes"));
QRpt.appendChild(QRSelection("html", "HTML"));
QRForm.appendChild(QRpt);
}
if ( includeSignature > 0) {
QRForm.appendChild(QROption("includeSignature","Include custom signature.", includeSignature));
}
if ( includePersonalPhoto > 0) {
QRForm.appendChild(QROption("includePersonalPhoto","Include personal photo.", includePersonalPhoto));
}
if ( useEmoticons > 0 ) {
QRForm.appendChild(QROption("emoticons","Use Emoticons.",useEmoticons));
}
if ( convertLinks > 0 ) {
QRForm.appendChild(QROption("convertLinks","Convert URL links.",convertLinks));
}
if ( stayInTopic > 0) {
QRForm.appendChild(QROption("stayInTopic","Stay in topic", stayInTopic));
}
if ( showPreview > 0) {
QRForm.appendChild(QROption('preview','Preview', showPreview));
}
if ( linkEmoticonList && ezFullPub != "") {
eListLink = document.createElement("a");
eListLink.href = "http://" + ezFullPub + ".ezboard.com/b" + ezBoardID + ".showEmoticonsHelp";
eListLink.target = "_blank";
eListLink.innerHTML = "complete emoticon list";
QRForm.appendChild(document.createElement("br"));
QRForm.appendChild(eListLink);
}
}
function QROption(sName, sLabel, iShowState) {
if ( iShowState > 0 ) {
QROpt = document.createElement("span");
QROpt.id = "span" + sName;
QRCheckBox = document.createElement("input");
QRCheckBox.name = sName;
QRCheckBox.id = sName;
QRCheckBox.value = "on";
if ( iShowState > 1 ) {
QRCheckBox.type = "checkbox";
// checkbox label
QRCheckBoxLabel = document.createElement("label");
QRCheckBoxLabel.htmlFor = sName;
QRCheckBoxLabel.innerHTML = sLabel;
if ( iShowState > 2 ) {
QRCheckBox.defaultChecked = true;
}
QROpt.appendChild(QRCheckBox);
QROpt.appendChild(QRCheckBoxLabel);
} else {
QRCheckBox.type = "hidden";
QROpt.appendChild(QRCheckBox);
}
return QROpt;
}
}
function QRSelection(sOption, sDisplay) {
QRSel = document.createElement("option");
QRSel.innerHTML = sDisplay;
QRSel.value = sOption;
return QRSel;
}
/* END QUICK REPLY */
</script>
You can comment out the includePersonalPhoto and includeSignature lines to turn those features on or off by default for quick replies.
There are some labels for the two boxes that are commented out by default. Uncomment them if you want labels on the boxes.
To add "Re: " to the subject, change the line:
QRSubject.value = document.title.replace(" - www.ezboard.com", "");
to:
QRSubject.value = "Re: " + document.title.replace(" - www.ezboard.com", "");
This script has not been confirmed to work with the following layouts:
- CLEAN
- PDA
These layouts don't show the addreply button
History:
2/11/2005 - added html style, removed requirement for changing add/reply image.
2/11/2005 - fixed Prev/Next issue
6/27/2004 - fixed Opera/Safari bug (innerText changed to innerHTML)
1/1/2004 - added more options, display of options
8/21/2003 - added plain text / ezcodes option
7/27/2003 - added option for emoticon list link
7/11/2003 - added info for "Re:" in subject line.
3/28/2003 - created
Credits:
written by phalen180
Prev/Next update help from Disco Deek
Edited by: ezGoalieAunt at: 1/7/07 9:17 pm
|