Button to place [spoiler] tags in Post - Postet den (1334 Views)
Starting Member
ChasLaser
Innlegg: 9
9
I'd like to add a button that when clicked adds the [ spoiler][ /spoiler] Tags to the message area. I want to use this as a way of Tagging a post with keywords by placing keywords inside the spoiler tags.
I have the icon set up....

Const strIconEditorTags = "icon_editor_tag.gif|23|22"

...but the rest eludes me. blush




<
   
 Sidestørrelse 
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
In inc_post_buttons.asp look for and add the part in red:

Code:
"<a href=""Javascript:list();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorList,"Insert List","align=""top""") & "</a>" & vbNewLine & _
Then below that add:

Code:
"<a href=""Javascript:spoiler();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorTags,"Insert Spoiler","align=""top""") & "</a>" & vbNewLine
Then in inc_func_common.asp look for:

Code:
function strike() {
var text = getText();
if (helpstat) {
alert("Strike-Through Tag Makes the enclosed text have a line through it.\n\nUSE: This is some stricken text");
} else if (basic) {
AddTxt="[s]" + text + "[ /s]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be stricken.",text);
} else {
txt=prompt("Text to be stricken.","Text");
}
if (txt!=null) {
AddTxt="[s]"+txt+"[ /s]";
AddText(AddTxt);
}
}
}

Below that add (Notice the three green spots. Remove the space in them for your code - I had to but them there for them to show up here.):
Code:
function spoiler() {
var text = getText();
if (helpstat) {
alert("The Spoiler Tag makes the enclosed text HIDDEN.\n\nUSE: [spoiler]This is some hidden text[ /spoiler]");
} else if (basic) {
AddTxt="[spoiler]" + text + "[ /spoiler]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be made hidden.",text);
} else {
txt=prompt("Text to be made hidden.","Text");
}
if (txt!=null) {
AddTxt="[spoiler]"+txt+"[/ spoiler]";
AddText(AddTxt);
}
}
}
<
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
Originally posted by leatherlips
In inc_post_buttons.asp look for and add the part in red:

Then in inc_func_common.asp look for:

Code:
function strike() {
var text = getText();
if (helpstat) {
alert("Strike-Through Tag Makes the enclosed text have a line through it.\n\nUSE: This is some stricken text");
} else if (basic) {
AddTxt="[s]" + text + "[ /s]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be stricken.",text);
} else {
txt=prompt("Text to be stricken.","Text");
}
if (txt!=null) {
AddTxt="[s]"+txt+"[ /s]";
AddText(AddTxt);
}
}
}

If you do not find this bit of code in "inc_func_common.asp", look in the javascript folder (js\) for a file titled "inc_code.js". Then just copy/paste where it belongs in that file instead.<
Postet den
Starting Member
ChasLaser
Innlegg: 9
9
Thanks Guys for your time! And thanks for incuding the .js bit!!

Besides the obivious changes to these files, are you aware of where I might change 'sploiler' to 'tag' and have the same hidden text effect?<
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
Change the code I told you to add from this:

Code:
function spoiler() {
var text = getText();
if (helpstat) {
alert("The Spoiler Tag makes the enclosed text HIDDEN.\n\nUSE: [spoiler]This is some hidden text[ /spoiler]");
} else if (basic) {
AddTxt="[spoiler]" + text + "[ /spoiler]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be made hidden.",text);
} else {
txt=prompt("Text to be made hidden.","Text");
}
if (txt!=null) {
AddTxt="[spoiler]"+txt+"[/ spoiler]";
AddText(AddTxt);
}
}
}

To this:

Code:
function tag() {
var text = getText();
if (helpstat) {
alert("The tag function makes the enclosed text HIDDEN.\n\nUSE: [tag]This is some hidden text[/tag]");
} else if (basic) {
AddTxt="[tag]" + text + "[/tag]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Text to be made hidden.",text);
} else {
txt=prompt("Text to be made hidden.","Text");
}
if (txt!=null) {
AddTxt="[tag]"+txt+"[/tag]";
AddText(AddTxt);
}
}
}
<
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
You'll also need to add this to inc_func_common.asp: (I had to add the space in the green text below so it would show. Yours won't have the space.)

Look for:

Code:
fString = doCode(fString, "[spoiler]", "[/ spoiler]", "<font color=""" & CColor & """>", "</font id=""" & CColor & """>")
Below that add:

Code:
fString = doCode(fString, "[tag]", "[/tag]", "<font color=""" & CColor & """>", "</font id=""" & CColor & """>")
[/code]<
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
I forgot one more thing...
In inc_post_buttons.asp where you added:

Code:
"<a href=""Javascript:spoiler();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorTags,"Insert Spoiler","align=""top""") & "</a>" & vbNewLine

Change it to:

Code:
"<a href=""Javascript:tag();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorTags,"Insert Tags","align=""top""") & "</a>" & vbNewLine
<
 
Du må legge inn en melding