The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

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

3 posters

Go down

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

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

the topic link
https://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
Michael_vx
Forumember

Male Posts : 659
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 September 22nd 2014, 8:24 pm

Did you translate the whole code into Arabic?


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

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

Male Posts : 51555
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Ange Tuteur 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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

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

Post by Michael_vx 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
Michael_vx
Forumember

Male Posts : 659
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 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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

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