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.

problem with Personalize the titles of quote, spoiler, and code

View previous topic View next topic Go down

Solved problem with Personalize the titles of quote, spoiler, and code

Post by Michael_vx on September 22nd 2014, 8:08 pm

the topic link
http://help.forumotion.com/t135638-personalize-the-titles-of-quote-spoiler-and-code
my roblem is the code works on English forum only i tried to add it on Arabiv forum but it didnt work
i want also replace
like this

what i need wrote:code - نص برمجى
spoiler - اظهار/اخفاء المحتوى
Quote - مقتبس
wrote - قد كتب
i used colors in Qoute just to show the text needed to be replaced
blue should replace the red
Hello

Michael_vx
Forumember

Male Posts : 655
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: problem with Personalize the titles of quote, spoiler, and code

Post by SLGray on September 22nd 2014, 8:24 pm

Did you translate the whole code into Arabic?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35641
Reputation : 2374
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: problem with Personalize the titles of quote, spoiler, and code

Post by Ange Tuteur on September 22nd 2014, 9:53 pm

See if this works :
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 == "اظهار/اخفاء المحتوى:" && (c.nodeValue = spoiler_text) ||
    t == "مقتبس :" && (c.nodeValue = quote_text) ||
    t == "نص برمجى:" && (c.nodeValue = code_text) ||
    t.substr(-6) == " قد كتب:" && (c.nodeValue = t.substr(0, t.length - 6) + wrote_text);
  });
});

The translations above are what the titles of your boxes say, correct ?

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: problem with Personalize the titles of quote, spoiler, and code

Post by Michael_vx on September 23rd 2014, 1:45 am

@Ange Tuteur wrote:See if this works :
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 == "اظهار/اخفاء المحتوى:" && (c.nodeValue = spoiler_text) ||
  t == "مقتبس :" && (c.nodeValue = quote_text) ||
  t == "نص برمجى:" && (c.nodeValue = code_text) ||
  t.substr(-6) == " قد كتب:" && (c.nodeValue = t.substr(0, t.length - 6) + wrote_text);
 });
});

The translations above are what the titles of your boxes say, correct ?
yes it is the text i want
after a test both English and Arabic not working on that and as i understand my forum use windows-1256 as a charset the Arabic one
the English i dont know yet

SLgey wrote:Did you translate the whole code into Arabic?

i changed the that part
Code:
var spoiler_text = "Click to view the content :",
 quote_text = "This is a quote :",
 code_text = "This is a code :",
 wrote_text = " previously wrote :";

this what i translate

Edit

i find ot something
the part of the code
Code:
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);

needs the oroignal text in the Arabic forum i manged to do the code text
and ill try the rest by my self thanks for the tip Ange
Mark the topic as solved Very Happy


Last edited by Michael_vx on September 23rd 2014, 2:01 am; edited 1 time in total (Reason for editing : add good news)

Michael_vx
Forumember

Male Posts : 655
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: problem with Personalize the titles of quote, spoiler, and code

Post by Ange Tuteur on September 23rd 2014, 4:57 am

You're welcome Smile

For wrote you should see t.substr(-7) that is the number of characters in " wrote:" (including the space) to be replaced.

Topic archived

If you have anymore questions do not hesitate to open a new topic.

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