12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- (function($){
- $.fn.isRTL = function(str){
- if(typeof str != typeof "" || str.length<1)
- return false;
- var cc = str.charCodeAt(0);
- if(cc>=1536 && cc<=1791)
- return true;
- if(cc>=65136 && cc<=65279)
- return true;
- if(cc>=64336 && cc<=65023)
- return true;
- if(cc>=1424 && cc<=1535)
- return true;
- if(cc>=64256 && cc<=64335)
- return true;
- if(cc>=1792 && cc<=1871)
- return true;
- if(cc>=1920 && cc<=1983)
- return true;
- if(cc>=1984 && cc<=2047)
- return true;
- if(cc>=11568 && cc<=11647)
- return true;
- return false;
- };
- var origInit = SN.Init.NoticeFormSetup;
- SN.Init.NoticeFormSetup = function(form) {
- origInit(form);
- var tArea = form.find(".notice_data-text:first");
- if (tArea.length > 0) {
- var tCleaner = new RegExp('@[^ ]+|![^ ]+|#[^ ]+|^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]+', 'g')
- var ping = function(){
- var cleaned = tArea.val().replace(tCleaner, '').replace(/^[ ]+/, '');
- if($().isRTL(cleaned))
- tArea.css('direction', 'rtl');
- else
- tArea.css('direction', 'ltr');
- };
- tArea.bind('keyup cut paste', function() {
-
- window.setTimeout(ping, 0);
- });
- form.bind('reset', function() {
- tArea.css('direction', 'ltr');
- });
- }
- };
- })(jQuery);
|