The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Personalize the titles of quote, spoiler, and code

View previous topic View next topic Go down

Personalize the titles of quote, spoiler, and code

Post by Ange Tuteur on September 17th 2014, 2:20 pm

Personalize the titles of quote, spoiler, and code

Getting tired of the standards "wrote:", "spoiler:", "quote:", or "code:" ??
Me too !

This tutorial will allow you to change those titles, and works on all versions of Forumotion forums.


Installing

Go to Administration Panel > Modules > JavaScript codes management, make sure JavaScript codes management is enabled, and create a new script.

Title : Your choice
Placement : In the topics
Paste the code below and submit :
Code:
$(function() {
 var spoiler_text = "Click to view the content :",
 quote_text = "This is a quote :",
 code_text = "This is a code :",
 wrote_text = " previously wrote :";
 
 $(".postbody").find("dl.spoiler dt, dl.codebox dt, dl.codebox dt span.genmed b, blockquote cite").each(function() {
  if (!this.hasChildNodes() || this.firstChild.nodeType != 3) return;
 
  var c = this.firstChild, t = c.nodeValue.trim();
 
  t == "Spoiler:" && (c.nodeValue = spoiler_text) ||
  t == "Quote :" && (c.nodeValue = quote_text) ||
  t == "Code:" && (c.nodeValue = code_text) ||
  t.substr(-7) == " wrote:" && (c.nodeValue = t.substr(0, t.length - 7) + wrote_text);
 });
});

:wouhou: Observe

The green expression replaces the red expression.

Click to view the content : replaces the text Spoiler:
This is a quote : replaces the text Quote:
This is a code : replaces the text Code:
previously wrote : replaces the text wrote:


Note :

  • This does not replace the custom spoiler text
  • It changes all quotes, spoilers, and codes, not yet personalized
  • Easily configurable according to your needs






Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum