Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] text direction switcher - (button)  (Read 7998 times)

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 78
  • Posts: 522
  • Awesome day :)
[MOD] text direction switcher - (button)
« on: March 13, 2007, 03:28:05 PM »

hi all :)

this is a small addon buttons i use (im no code master lol ) to switch RTL - LTR
direction in the snews textarea when editing (without changing the rest of the layout).

i needed that for be able to use RTL text with the tags(LTR).

install: edit the file sNews.php and add the follow: [/color]

Code: [Select]
// ADD TO // ARTICLES FORM PART
html_input('button', '', '', 'RTL', '', '', 'onclick="right_to_left()"');
html_input('button', '', '', 'LTR', '', '', 'onclick="left_to_right()"');
Code: [Select]
// ADD TO // JAVASCRIPT PART
function right_to_left(){
document.getElementById("txt").style.direction = "RTL";
}
function left_to_right(){
document.getElementById("txt").style.direction = "LTR";
}
if any one has any improvment or a correct way  in terms of coding  to do it, i'll be intrested  :D

note: it will not change your content it self, just the display in the editor.  :)

edit by bakercad added "[MOD]" to subject title
Logged

Jeny Elkind

  • Newbie
  • *
  • Karma: 0
  • Posts: 12
    • http://elkind.net
[MOD] text direction switcher - (button)
« Reply #1 on: March 18, 2007, 03:24:09 PM »

Very useful
Toda Mo  :cool:

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 78
  • Posts: 522
  • Awesome day :)
[MOD] text direction switcher - (button)
« Reply #2 on: March 18, 2007, 09:53:54 PM »

you very welcome jeny   :D
enjoy the snews ride  :cool:
Logged