cendoldarkbb-qrfixer

darkbb-fixer (phpBB)

  1. // ==UserScript==
  2. // @name cendoldarkbb-qrfixer
  3. // @namespace http://userscripts.org/scripts/show/101076
  4. // @description darkbb-fixer (phpBB)
  5. // @author idx (http://userscripts.org/users/idx)
  6. // @license (CC) by-nc-sa 3.0
  7. // @include http://*.darkbb.com/*
  8. // @match http://*.darkbb.com/*
  9. // @version 0.7
  10. // @timestamp 1309373780487
  11. // ==/UserScript==
  12. // -!--latestupdate
  13. //
  14. // v0.7 - 2011-06-30
  15. // Improve PM send-to like kaskus forum (vBulletin)
  16. //
  17. // v0.6 - 2011-04-26
  18. // Fix failed shortcut
  19. //
  20. // -/!latestupdate---
  21. (function(){
  22. // Initialize Global Variables
  23. var gvar=function(){};
  24.  
  25. gvar.__DEBUG__ = false;
  26. /*
  27. javascript:window.alert(new Date().getTime());
  28. */
  29.  
  30. function init(){
  31. gvar.img_path= "http://illiweb.com/fa/wysiwyg/";
  32. gvar.id_textarea= "text_editor_textarea";
  33. gvar.domain = location.protocol+'//'+location.host+'/';
  34. gvar.pathloc = location.pathname||'';
  35. gvar.search_path = '';
  36. gvar.pasangan= rSRC.getSetOf('pasangan');
  37. gvar.coloroptions= rSRC.getSetOf('color');
  38. gvar.fontoptions= rSRC.getSetOf('font');
  39. gvar.sizeoptions= rSRC.getSetOf('size');
  40. getAuth();
  41. // --------
  42. // let's roll
  43. if(gvar.auth)
  44. start_Main();
  45. if(gvar.pathloc=='/privmsg')
  46. event_txta();
  47. }
  48.  
  49. function start_Main(){
  50. var par,el, vB01='vB_Editor_001';
  51. // relayout current editor
  52. relayout_tpl();
  53. // place global style
  54. GM_addGlobalStyle( rSRC.getCSS(), 'css_darkbb', true );
  55.  
  56. if($D('#text_editor_controls'))
  57. $D('#text_editor_controls').innerHTML = rSRC.getTPL_qr_control();
  58.  
  59. if(Dom.g(gvar.id_textarea))
  60. on('keydown',Dom.g(gvar.id_textarea),function(e){return is_keypress_pressed(e)});
  61. // event for each element
  62. for(var id in gvar.pasangan){
  63. if(!isString(gvar.pasangan[id])) continue;
  64.  
  65. if(el=$D(id)) switch(gvar.pasangan[id]){
  66. case "Bold":case "Ital.":case "Underl.":case "Strike":case "Left":case "Center":case "Right":case "Justified":
  67. on('click',el,function(e){do_align_BIU(e)});
  68. break;
  69. case "Quote":case "Code":case "Image":case "Link":case "Video":
  70. on('click',el,function(e){do_btncustom(e)});
  71. break;
  72. case "line_break":
  73. on('click',el,function(e){do_btncustom_single(e)});
  74. break;
  75. case "dotlist":case "numberlist":
  76. on('click',el,function(e){do_btncustom_list(e)});
  77. break;
  78. default:
  79. break;
  80. }
  81. } // end for
  82. // event buat Other
  83. el = create_popup_other();
  84. par = $D('popup_btn_other');
  85. if(par) Dom.add(el,par);
  86. el = $D('#btn_other');
  87. if(el) on('click',el,function(e){clickpick(e,'popup_btn_other_menu')});
  88.  
  89. // fungsi click pick
  90. var clickpick = function(el,id){
  91. var ve=$D(id);
  92. ve.style.display=(ve.style.display==''?'none':'');
  93. if(ve.style.display!='none') try{Dom.g(id+'_dumy').focus();}catch(el){}
  94. };
  95. // event buat kolor
  96. par = $D(vB01+'_popup_forecolor'), el = create_popup_color();
  97. if(par) Dom.add(el,par);
  98. el = $D('#pick_kolor');
  99. if(el) on('click',el,function(e){clickpick(e, vB01+'_popup_forecolor_menu');});
  100. // event buat size
  101. el = create_popup_size();
  102. par = $D(vB01+'_popup_fontsize');
  103. if(par && el) Dom.add(el,par);
  104. el = $D('#pick_size');
  105. if(el) on('click',el,function(e){clickpick(e,vB01+'_popup_size_menu')});
  106. // event buat font
  107. el = create_popup_font();
  108. par = $D(vB01+'_popup_fontname');
  109. if(par) Dom.add(el,par);
  110. el = $D('#pick_font');
  111. if(el) on('click',el,function(e){clickpick(e,vB01+'_popup_fontname_menu')});
  112. // event buat clear
  113. el = $D('btn_clear');
  114. if(el) on('click',el,function(){vB_textarea.set('')});
  115. } // end start_main
  116.  
  117.  
  118. // event multiple send PM like kaskus.us (vBulletin)
  119. function event_txta(){
  120. var els = $D('//input[contains(@name,"username")]'), el, txta, leng, inp, par, Attr, tmpTxt;
  121. gvar.search_path = gvar.domain + 'search?mode=searchuser';
  122. // take one element & mae event for em
  123. if(leng = els.snapshotLength){
  124. inp = els.snapshotItem(0);
  125. par = inp.parentNode;
  126.  
  127. // get all value of username
  128. tmpTxt = '';
  129. for(var j=0; j<leng; j++){
  130. inp = els.snapshotItem(j);
  131. if(inp.value) tmpTxt+=inp.value + ' ; ';
  132. }
  133. // recreate with textarea
  134. Attr={id:'send_to','tabindex':'100',dir:'ltr',name:'send_to_username','style':'width:450px!important; height:50px!important;float:left;'};
  135. txta = createEl('textarea',Attr, tmpTxt);
  136. par.innerHTML = '';
  137. Dom.add(txta, par);
  138. // == POPUP username ==
  139. // create container of hidden username_list
  140. el = createEl('div',{id:'hidden_username_list', style:'position:absolute; left:-10000;'}, '');
  141. Dom.add(el, par);
  142. // create container popup_cont
  143. el = createEl('div',{style:'position:relative;'});
  144. par.insertBefore(el, par.firstChild);
  145. par = el;
  146. el = createEl('div',{id:'popup_cont', 'class':'vbmenu_popup',style:'overflow:hidden; margin-top:50px!important; display:none;'});
  147. Dom.add(el, par);
  148. // do event
  149. vB_dbb_AJAX_NameSuggest('username', 'send_to');
  150. // event for preview & send buttons
  151. els = ['btn_preview', 'btn_post'];
  152. for(var i=0; i<els.length; i++){
  153. el = $D('#'+els[i]);
  154. if(el)
  155. on('click', el, function(e){
  156. e= e.target||e;
  157. var vals, par = $D('#hidden_username_list'), txta=$D('#send_to'), el, Attr;
  158. if(txta && par){
  159. vals = txta.value.split(';');
  160. for(var i=0; i<vals.length; i++){
  161. Attr = {'name':'username[]', 'type':'hidden', 'value':vals[i].trim()};
  162. el = createEl('input', Attr);
  163. Dom.add(el, par);
  164. }
  165. }
  166. });
  167. }
  168. }
  169. }
  170.  
  171.  
  172. /*======================================================================*\
  173. || #################################################################### ||
  174. || # vBulletin 3.8.0
  175. || # ---------------------------------------------------------------- # ||
  176. || # Copyright ©2000-2009 Jelsoft Enterprises Ltd. All Rights Reserved. ||
  177. || # ---------------------------------------------------------------- # ||
  178. || # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
  179. || #################################################################### ||
  180. \*======================================================================*/
  181. function vB_dbb_AJAX_NameSuggest(varname, txta_id){
  182. this.textobj = $D('#'+txta_id);
  183. this.varname = varname;
  184. this.fragment = "";
  185. this.donenames = "";
  186. this.selected = 0;
  187. this.menuopen = false;
  188. this.timeout = null;
  189. this.names = new Array();
  190. this.active = false;
  191. this.allow_multiple = true;
  192. this.min_chars = 2;
  193. this.popupname = 'popup_cont';
  194. var that = this;
  195. this.get_text = function () {
  196. if (this.allow_multiple) {
  197. var E = this.textobj.value.lastIndexOf(";");
  198. if (E == -1) {
  199. this.donenames = new String("");
  200. this.fragment = new String(this.textobj.value);
  201. } else {
  202. this.donenames = new String(this.textobj.value.substring(0, E + 1));
  203. this.fragment = new String(this.textobj.value.substring(E + 1));
  204. }
  205. } else {
  206. this.fragment = new String(this.textobj.value);
  207. }
  208. this.fragment = this.fragment.trim();
  209. };
  210. this.set_text = function (E) {
  211. if (this.allow_multiple) {
  212. this.textobj.value = (this.donenames + " " + (this.names[E]).trim() + " ; ");
  213. } else {
  214. this.textobj.value = (this.names[E]).trim();
  215. }
  216. this.textobj.focus();
  217. this.menu_hide();
  218. return false;
  219. };
  220. this.move_row_selection = function (E) {
  221. var F = parseInt(this.selected, 10) + parseInt(E, 10);
  222. if (F < 0) {
  223. F = this.names.length - 1;
  224. } else {
  225. if (F >= this.names.length) {
  226. F = 0;
  227. }
  228. }
  229. this.set_row_selection(F);
  230. return false;
  231. };
  232. this.set_row_selection = function (E) {
  233. var P=$D('#'+this.popupname), F = getTag('div',P);
  234. F[this.selected].className = "vbmenu_option";
  235. this.selected = E;
  236. F[this.selected].className = "vbmenu_hilite";
  237. };
  238. this.key_event_handler = function (E) {
  239. E = E ? E : window.event;
  240. if (this.menuopen) {
  241. do_an_e(E);
  242. switch (E.keyCode) {
  243. case 38:
  244. this.move_row_selection(-1);
  245. return false;
  246. case 40:
  247. this.move_row_selection(1);
  248. return false;
  249. case 27:
  250. this.menu_hide();
  251. return false;
  252. case 13:
  253. this.set_text(this.selected);
  254. return false;
  255. }
  256. }
  257. this.get_text();
  258. if (this.fragment.length >= this.min_chars) {
  259. clearTimeout(this.timeout);
  260. if( this.fragment.indexOf('*')==-1 ) this.fragment+= '*';
  261. var that = this;
  262. this.timeout = window.setTimeout(function() { that.name_search(that.fragment); }, 500);
  263. } else {
  264. this.menu_hide();
  265. }
  266. };
  267. this.menu_build = function(){
  268. var el, that, upto=15, tgt=$D('#'+this.popupname), that=this;
  269. if(tgt){
  270. tgt.innerHTML = '';
  271. for(var i=0; i<this.names.length; i++){
  272. upto++;
  273. el = createEl('div', {'id':'mnu_el_'+i,'class':''+(i==0 ? 'vbmenu_hilite':'vbmenu_option'),'style':'text-align: left; font-size: 12px;'}, this.names[i]);
  274. on('click', el, function(e){
  275. e=e.target||e;
  276. var F=e.id.replace('mnu_el_', '');
  277. that.set_text(F);
  278. });
  279. Dom.add(el, tgt);
  280. if(i > upto) break;
  281. }
  282. this.active = true;
  283. this.menu_show();
  284. }
  285. };
  286. this.menu_show = function(){
  287. if (this.active) {
  288. $D('#'+this.popupname).style.display = '';
  289. this.menuopen = true;
  290. }
  291. };
  292. this.menu_hide = function(){
  293. var tgt=$D('#'+this.popupname);
  294. if(tgt){
  295. tgt.innerHTML = '';
  296. tgt.style.display = 'none';
  297. this.menuopen = false;
  298. this.selected = 0;
  299. }
  300. };
  301. this.name_search = function(q){
  302. var that = this, spost = '&search_username='+q + '&search=Search';
  303. GM_XHR.uri = gvar.search_path;
  304. GM_XHR.cached = true;
  305. GM_XHR.request(spost.toString(),'post', that.handle_ajax_request);
  306. };
  307. this.handle_ajax_request = function(reply_html){
  308. if( isUndefined(reply_html) ) return false;
  309. reply_html = reply_html.responseText;
  310. this.names = [];
  311. var ret, that=this, parser = function(S, $1){that.names.push($1)}
  312. ret = reply_html.replace(/>([^>]+)<\/option/gi, parser );
  313. this.menu_build();
  314. };
  315. on('click', this.textobj, function(){
  316. that.menu_hide();
  317. that.active=true;
  318. });
  319. on('blur', this.textobj, function(){
  320. that.active=false; var T=this;
  321. window.setTimeout(function() { T.menu_hide(); }, 300);
  322. });
  323. on('focus', this.textobj, function(){that.active=true});
  324. on('keyup', this.textobj, function(E){that.key_event_handler(E)});
  325. on('keypress', this.textobj, function(E){
  326. E = E ? E : window.event;
  327. if (E.keyCode == 13) {
  328. return (that.menuopen ? false : true)
  329. }
  330. });
  331. }
  332.  
  333. // relayout, prep everything before making change
  334. function relayout_tpl(){
  335. var tgt=Dom.g(gvar.id_textarea), par = tgt.parentNode, el, Attr, onc, cucok;
  336. var delAttr=function(o,at){
  337. if(isUndefined(at)) at='tabindex';
  338. o.removeAttribute(at);
  339. return o;
  340. };
  341. // recreate textarea to remove default event
  342. if(tgt) {
  343. gvar.isQR = $D('#quick_reply');
  344. var tmpTxt = tgt.value, lW=tgt.clientWidth;
  345. if( Dom.g(gvar.id_textarea) ) Dom.remove( Dom.g(gvar.id_textarea) );
  346. Attr={id:gvar.id_textarea,'tabindex':'102',dir:'ltr',name:'message',
  347. 'style':'width:'+(gvar.isQR?'575px':(lW-5)+'px')+'!important;'+(gvar.isQR?'height:125px!important;':'')};
  348. el=createEl('textarea',Attr,tmpTxt);
  349. par.insertBefore(el, par.firstChild);
  350. //resize textarea
  351. par.style.setProperty('height', '125px', 'important');
  352. if(gvar.isQR) par.style.setProperty('width', '580px', 'important');
  353. }
  354. // reorder tabindex [title,txtarea,preview,post]
  355. el=$D('.//input[@name="subject"]',null,true);
  356. if(el){
  357. el=delAttr(el);
  358. el.setAttribute('tabindex','101');
  359. }
  360. // redesign preview and post
  361. el=$D('.//input[@name="preview"]',null,true);
  362. if(el) {
  363. el.title="Preview (Alt+P)";
  364. el.id = "btn_preview";
  365. el=delAttr(el);
  366. el.setAttribute('tabindex','103');
  367. }
  368. el=$D('.//input[@name="post"]',null,true);
  369. if(el) {
  370. el.title="Post (Ctrl+Enter or Alt+X)";
  371. el.id = "btn_post";
  372. el=delAttr(el);
  373. el.setAttribute('tabindex','104');
  374. }
  375. // hide helpbox is available
  376. if(el=$D('helpbox'))
  377. el.style.display='none';
  378. }
  379.  
  380. // uploader auth
  381. function getAuth(){
  382. // collect uploader auth
  383. var el = $D('servimg'), onc=el.getAttribute('onclick').toString(), cucok;
  384. if(cucok=/([^\(]+).([^,]+).\s*['"]([^'"]+).,\s*['"]([^'"]+).,\s*['"]([^'"]+)/.exec(onc)){
  385. gvar.auth= {};
  386. gvar.auth.func = cucok[1];
  387. gvar.auth.obj = cucok[2];
  388. gvar.auth.email = cucok[3];
  389. gvar.auth.hash = cucok[4];
  390. gvar.auth.tid = cucok[5];
  391. }else{
  392. gvar.auth = false;
  393. }
  394. }
  395.  
  396. // event for every button
  397. function do_insertTag(tag, value){
  398. vB_textarea.init();
  399. vB_textarea.wrapValue(tag, (value ? value :null) ); // phpBB no need this: (isNaN(value)?'"':'')
  400. }
  401.  
  402. function tTagFromAlt(e){
  403. var tag=e;
  404. if(typeof(e)=='object'){
  405. el=e.target||e;
  406. e=el;
  407. if(el.nodeName!='IMG'){
  408. e = getTag('img',el);
  409. if(e.length) e=e[0];
  410. }
  411. return e.alt;
  412. }else if(typeof(e)=='string'){
  413. return e;
  414. }else{
  415. return false;
  416. }
  417. }
  418. function do_align_BIU(e){
  419. var el, tag=tTagFromAlt(e);
  420. var pTag={
  421. 'Bold' :'B', 'Ital.' :'I', 'Underl.':'U','Strike':'STRIKE',
  422. 'Left' :'LEFT', 'Center' :'CENTER', 'Right' :'RIGHT', 'Justified' :'JUSTIFIED',
  423. };
  424. if(tag && tag.indexOf('Align ')!=-1) tag = tag.replace('Align ','');
  425. if(isUndefined(pTag[tag])) return;
  426. vB_textarea.init();
  427. vB_textarea.wrapValue(pTag[tag],'');
  428. }
  429. function do_btncustom_list(e, nospace){
  430. var tag=tTagFromAlt(e), mode=(tag=='numberlist' ? 'number':'dot'), ins='1';
  431. //case "-List":case "Ordered List":
  432. // [LIST]
  433. do_insertTag('LIST', (mode=='number' ? 1:null) );
  434. //gvar.firstRec = 1;
  435. vB_textarea.focus();
  436. reInsert();
  437. }
  438. function reInsert(pass){
  439. var ins=prompt("Enter a list item.\nLeave the box empty or press 'Cancel' to complete the list:");
  440. vB_textarea.init();
  441. if(isUndefined(pass)) vB_textarea.setValue( '\n' );
  442. if(ins){
  443. vB_textarea.setValue( '\n' + '[*]' + ins + '');
  444. reInsert(true);
  445. }else{
  446. return;
  447. }
  448. }
  449.  
  450. function do_btncustom_single(e, nospace){
  451. var tag=tTagFromAlt(e);
  452. var pTag={
  453. 'line_break' :'HR'
  454. };
  455. vB_textarea.init();
  456. vB_textarea.setValue( '['+pTag[tag]+']' + (!nospace ? ' ':'') );
  457. }
  458. function do_btncustom(e){
  459. var tag=tTagFromAlt(e);
  460. var tagprop = '';
  461. if(tag) tag=tag.replace(/[\[\]]/g,'').replace('Insert ','').toLowerCase();
  462. var pTag={
  463. 'quote':'QUOTE','code' :'CODE'
  464. ,'link' :'URL', 'image':'IMG'
  465. ,'spoiler' :'SPOILER'
  466. //,'transparent':'COLOR','noparse' :'NOPARSE','youtube' :'YOUTUBE'
  467. ,'video' :'YOUTUBE'
  468. };
  469. var endFocus=function(){ vB_textarea.focus(); return};
  470. if(!tag || isUndefined(pTag[tag])) return endFocus();;
  471. vB_textarea.init();
  472. if(tag=='quote' || tag=='code'){
  473. vB_textarea.wrapValue( tag );
  474. }else if(tag=='spoiler'){
  475. var title = prompt('Please enter the TITLE of your Spoiler:', gvar.settings.lastused.sptitle );
  476. if(title==null) return endFocus();
  477. title = (title ? title : ' ');
  478. gvar.settings.lastused.sptitle = trimStr(title);
  479. //setValue(KS+'LAST_SPTITLE', title);
  480. vB_textarea.wrapValue( 'spoiler', title );
  481.  
  482. }else{
  483. var text, selected = vB_textarea.getSelectedText();
  484. var is_video_link = function(text){
  485. text = trimStr ( text ); //trim
  486. if( text.match(/youtube\.com\/watch\?v=[\w\d-]+/i) ){
  487. var rx = /youtube\.com\/watch\?v=([^&]+)/i.exec(text);
  488. text = ( rx ? rx[1] : '');
  489. pTag['video'] = 'YOUTUBE';
  490. }else if( /https?:\/\/(?:w{3}\.)?dailymotion\.com\/video\/.+/.test(text) ){
  491. pTag['video'] = 'DAILYMOTION';
  492. }else if(!/^[\d\w-]+$/.test(text))
  493. text = false;
  494. return text;
  495. };
  496. if(selected==''){
  497. switch(tag){
  498. case 'transparent':
  499. tagprop = tag;
  500. text = prompt('Please enter the Text to be transparent:', 'text hantu');
  501. break;
  502. case 'noparse':
  503. text = prompt('Please enter Text or/with Tags to be no parsed:', '[code]-CODE-[/code]');
  504. break;
  505. case 'link':
  506. text = prompt('Please enter the URL of your link:', 'http://');
  507. tagprop = text;
  508. break;
  509. case 'image':
  510. text = prompt('Please enter the URL of your image:', 'http://');
  511. break;
  512. case 'video':
  513. text = prompt('Please enter the Youtube or dailymotion URL', '');
  514. break;
  515. }
  516. if(text==null) return endFocus();
  517. if(tag=='video')
  518. text = is_video_link(text);
  519. if(tag=='link' || tag=='image')
  520. text = (isLink(text) ? text : null);
  521. if(!text)
  522. return endFocus();
  523. else{
  524. var prehead = [('['+pTag[tag]+(tagprop!=''?'='+tagprop:'')+']').length, 0];
  525. prehead[1] = (prehead[0]+text.length);
  526. vB_textarea.setValue( '['+pTag[tag]+(tagprop!=''?'='+tagprop:'')+']'+text+'[/'+pTag[tag]+']', prehead );
  527. }
  528. return endFocus();
  529. } // end selected==''
  530. tagprop = (tag=='transparent' ? 'transparent' : '');
  531. if(tag=='link'||tag=='image'||tag=='video'){
  532. var ptitle=(tag=='video' ? ['Please enter the Youtube or dailymotion URL','']:['Please enter the URL of your '+tag+':','http://']);
  533. text = prompt(ptitle[0], ptitle[1]);
  534. if(text==null) return endFocus();
  535. switch(tag){
  536. case 'link':
  537. tagprop = text;
  538. text = selected;
  539. break;
  540. case 'video':
  541. text = is_video_link(text);
  542. if(!text) return endFocus();
  543. break;
  544. }
  545. var prehead = [('['+pTag[tag]+(tagprop!=''?'='+tagprop:'')+']').length, 0];
  546. prehead[1] = (prehead[0]+text.length);
  547. vB_textarea.replaceSelected( '['+pTag[tag]+(tagprop!=''?'='+tagprop:'')+']'+text+'[/'+pTag[tag]+']', prehead );
  548. return endFocus();
  549. }
  550. vB_textarea.wrapValue( pTag[tag], (tagprop!='' ? tagprop:'') );
  551. }
  552. }
  553.  
  554. function create_popup_other(){
  555. var el, id = 'popup_btn_other_menu', Attr, tCont;
  556. Attr = {id:id,'class':'vbmenu_popup',
  557. style:'width:130px;overflow:hidden;display:none;'
  558. };
  559. el = createEl('div',Attr);
  560. var pasOther= {
  561. 'sub' : 'Index'
  562. ,'sup' : 'Exponent'
  563. ,'spoiler': 'Spoiler'
  564. ,'hide' : 'Hidden'
  565. ,'scroll' : 'Horizontal scrolling'
  566. ,'updown' : 'Vertical scrolling'
  567. ,'rand' : 'Random'
  568. ,'wow' : 'Wow'
  569. };
  570. for (var tag in pasOther) {
  571. Attr={title:pasOther[tag],rel:tag,'class':'osize',style:'text-align:left;font-size:12px;'};
  572. tCont = createEl('div',Attr,pasOther[tag]);
  573. on('click',tCont,function(e){
  574. e=e.target||e;
  575. var eTag=e.getAttribute('rel');
  576. var cont=Dom.g(id);
  577. cont.style.display='none';
  578. do_insertTag(eTag);
  579. });
  580. Dom.add(tCont,el);
  581. }
  582. create_dummy_input(el, id+'_dumy');
  583. return el;
  584. }
  585. function create_popup_size(){
  586. var id = 'vB_Editor_001_popup_size_menu';
  587. var Attr = {id:id,'class':'vbmenu_popup',
  588. style:'overflow:hidden;display:none;'
  589. };
  590. var el = createEl('div',Attr);
  591. var tCont,prop, tFont;
  592. for (var tipe in gvar.sizeoptions) {
  593. prop = gvar.sizeoptions[tipe]; // ['', ''] = [inner, value]
  594. Attr={title:prop[1],'class':'osize',style:'text-align:left;'};
  595. tCont = createEl('div',Attr);
  596. tFont = createEl('font',{size:prop[0]+'pt'},tipe);
  597. Dom.add(tFont,tCont);
  598. on('click',tCont,function(e){
  599. e=e.target||e;
  600. if(e.nodeName=='FONT') e=e.parentNode;
  601. var cont=Dom.g(id);
  602. cont.style.display='none';
  603. var eTitle = e.getAttribute('title');
  604. do_insertTag('size',eTitle);
  605. });
  606. Dom.add(tCont,el);
  607. }
  608. create_dummy_input(el, id+'_dumy');
  609. return el;
  610. }
  611. function create_popup_font(){
  612. var id = 'vB_Editor_001_popup_fontname_menu';
  613. var Attr = {id:id,'class':'vbmenu_popup',
  614. style:'width:200px;height:250px;overflow:auto;display:none;'
  615. };
  616. var el = createEl('div',Attr), oL=gvar.fontoptions.length;
  617. var tClr,tFont,font;
  618. for (var idx=0; idx<oL; idx++) {
  619. font = gvar.fontoptions[idx];
  620. if(!isString(font)) continue; // should do this, coz Opera lil weirdo
  621. Attr={'class':'ofont',title:font};
  622. tClr = createEl('div',Attr);
  623. tFont = createEl('font',{face:font},font);
  624. Dom.add(tFont,tClr);
  625. on('click',tClr,function(e){
  626. e=e.target||e;
  627. if(e.nodeName=='FONT') e=e.parentNode;
  628. var cont=Dom.g(id);
  629. cont.style.display='none';
  630. var sfont = e.getAttribute('title');
  631. do_insertTag('font',sfont);
  632. });
  633. Dom.add(tClr,el);
  634. }
  635. create_dummy_input(el, id+'_dumy');
  636. return el;
  637. }
  638. function create_popup_color(){
  639. var id = 'vB_Editor_001_popup_forecolor_menu';
  640. var Attr = {id:id,'class':'vbmenu_popup',
  641. style:'overflow:hidden;display:none;'
  642. };
  643. var el = createEl('div',Attr);
  644. Attr = {cellPadding:0,cellSpacing:0,border:0};
  645. var table = createEl('table', Attr);
  646. Dom.add(table,el);
  647. var i=0,tr,kolor,div,td;
  648. var pickColor = function(e){
  649. e=e.target||e;
  650. if(e.nodeName=='DIV') e=e.parentNode;
  651. var etitle = e.id.replace('pick_color_','');
  652. do_insertTag('color',etitle);
  653. Dom.g(id).style.display='none';
  654. };
  655. for (var hex in gvar.coloroptions) {
  656. if(!isString(gvar.coloroptions[hex])) continue; // should do this, coz Opera lil weirdo
  657. if (i % 8 == 0)
  658. tr = table.insertRow(-1);
  659. i++;
  660. kolor=gvar.coloroptions[hex];
  661. div = createEl('div',{style:'background-color:'+kolor},'&nbsp;');
  662. td = tr.insertCell(-1);
  663. td.className = "ocolor";
  664. Dom.add(div,td);
  665. td.title = td.colorname = kolor;
  666. td.id = "pick_color_"+td.colorname;
  667. on('click',td,function(e){ pickColor(e) });
  668. }
  669. // last row for transparent
  670. tr = table.insertRow(-1);
  671. kolor='transparent';
  672. div = createEl('div',{style:'background-color:'+kolor+';width:100%;','class':'gensmall'},'transparent');
  673. td = tr.insertCell(-1);
  674. td.setAttribute("colspan",8);
  675. Dom.add(div,td);
  676. td.title = td.colorname = kolor;
  677. td.id = "pick_color_"+td.colorname;
  678. on('click',td,function(e){ pickColor(e) });
  679. create_dummy_input(el, id+'_dumy');
  680. return el;
  681. }
  682. function create_dummy_input(parent, dumy_id){
  683. var dumyEl = createEl('input',{id:dumy_id,style:'width:0px;height:0px;line-height:0px;border:0px;margin-left:-999999px;',value:''});
  684. on('blur',dumyEl,function(ec){
  685. if( gvar.stillOnIt ){
  686. ec = ec.target||ec;
  687. if(ec && ec.nodeName=='INPUT') ec=ec.parentNode;
  688. window.setTimeout(function(){
  689. delete( gvar.stillOnIt );
  690. if( !gvar.stillOnIt && ec ) ec.style.setProperty('display', 'none', '');
  691. }, 200);
  692. }
  693. });
  694. on('focus',dumyEl,function(ec){gvar.stillOnIt=true});
  695. Dom.add(dumyEl,parent);
  696. }
  697.  
  698. // keydown on textarea
  699. // Ketika keydown tab dari textarea
  700. function is_keypress_pressed(C){
  701. var C = (!C ? window.event : C), asocKey={};
  702. if(C) {
  703. if(C.ctrlKey){ // mijit + Ctrl
  704. var B, A = C.keyCode ? C.keyCode : C.charCode;
  705. asocKey={
  706. '13':'btn_post' // Enter
  707. ,'66':'Bold' // B
  708. ,'73':'Ital.' // I
  709. ,'85':'Underl.' // U
  710. ,'69':'Center' // E
  711. ,'76':'Left' // L
  712. ,'82':'Right' // R
  713. ,'74':'Justified' // U
  714. };
  715. B = (isDefined(asocKey[A])? asocKey[A] : false);
  716. //alert('al;'+C + ' - ' + C.ctrlKey + ' - '+B);
  717. if(B===false) return false;
  718. if(A==13){
  719. if(C.shiftKey) B = 'btn_preview'; // preview
  720. if(Dom.g(B)) SimulateMouse(Dom.g(B), 'click', true);
  721. }else{
  722. do_align_BIU(B);
  723. }
  724. C = do_an_e(C);
  725.  
  726. }else
  727. if(C.altKey){ // mijit + Alt
  728. var B='', A = C.keyCode ? C.keyCode : C.charCode;
  729. asocKey={
  730. '83':'btn_post' // [S] Submit post
  731. ,'80':'btn_preview' // [P] Preview
  732. };
  733. B = (isDefined(asocKey[A])? asocKey[A] : false);
  734. if(B===false) return false;
  735. if(Dom.g(B)) SimulateMouse(Dom.g(B), 'click', true);
  736. C = do_an_e(C);
  737. }else
  738. if(C.keyCode==9){ // mijit tab
  739. C = do_an_e(C);
  740. if($D('#btn_preview')) $D('#btn_post').focus();
  741. } // end keyCode==9
  742. return false;
  743. } // end event C
  744. }
  745.  
  746.  
  747. // end event for every buttons
  748.  
  749.  
  750. function isThisThread(){ return $D('#text_editor_textarea') }
  751.  
  752. //=====
  753. // static routine
  754. function isDefined(x) { return !(x == null && x !== null); }
  755. function isUndefined(x) { return x == null && x !== null; }
  756. function isString(x) { return (typeof(x)!='object' && typeof(x)!='function'); }
  757. function trimStr(x) { return (typeof(x)=='string' && x ? x.replace(/^\s+|\s+$/g,"") : '') };
  758. function isLink(x) { return x.match(/((?:http(?:s|)|ftp):\/\/)(?:\w|\W)+(?:\.)(?:\w|\W)+/); }
  759.  
  760. function on(m,e,f,p){Dom.Ev(e,m,function(e){typeof(f)=='function'?f(e):void(0)},!p?false:true)}
  761. function do_an_e(A) {
  762. if (!A) {
  763. window.event.returnValue = false;
  764. window.event.cancelBubble = true;
  765. return window.event
  766. } else {
  767. A.stopPropagation();
  768. A.preventDefault();
  769. return A
  770. }
  771. }
  772. function createEl(type, attrArray, html){
  773. var node = document.createElement(type);
  774. for (var attr in attrArray)
  775. if (attrArray.hasOwnProperty(attr))
  776. node.setAttribute(attr, attrArray[attr]);
  777. if(html) node.innerHTML = html;
  778. return node;
  779. }
  780. function createTextEl(txt){
  781. return document.createTextNode(txt);
  782. }
  783. function getTag(name, parent){
  784. var ret = (typeof(parent)!='object' ? document.getElementsByTagName(name) : parent.getElementsByTagName(name) );
  785. return (isDefined(ret[0]) ? ret : false);
  786. }
  787. function addClass(cName, Obj){
  788. if(cName=="") return;
  789. var neocls = (Obj.className ? Obj.className : '');
  790. if(neocls.indexOf(cName)!=-1) return;
  791. neocls+=(neocls!=''?' ':'')+cName;
  792. Obj.setAttribute('class', neocls);
  793. }
  794. function removeClass(cName, Obj){
  795. if(cName=="") return;
  796. var neocls = (Obj.className ? Obj.className : '');
  797. neocls = trimStr ( neocls.replace(cName,"") ); // replace and trim
  798. Obj.setAttribute('class', neocls);
  799. }
  800. function SimulateMouse(elem,event,preventDef) {
  801. if(typeof(elem)!='object') return;
  802. var evObj = document.createEvent('MouseEvents');
  803. preventDef=(isDefined(preventDef) && preventDef ? true : false);
  804. evObj.initEvent(event, preventDef, true);
  805. try{elem.dispatchEvent(evObj);}
  806. catch(e){ clog('Error. elem.dispatchEvent is not function.'+e)}
  807. }
  808.  
  809.  
  810. // ----my ge-debug--------
  811. function show_alert(msg, force) {
  812. if(arguments.callee.counter) { arguments.callee.counter++; } else { arguments.callee.counter=1; }
  813. GM_log('('+arguments.callee.counter+') '+msg);
  814. if(force==0) { return; }
  815. }
  816. function clog(msg) {
  817. if(!gvar.__DEBUG__) return;
  818. show_alert(msg);
  819. }
  820.  
  821.  
  822. //========= Global Var Init ====
  823. var GM_addGlobalStyle=function(css, id, tobody) { // Redefine GM_addGlobalStyle with a better routine
  824. var sel=createEl('style',{type:'text/css'});
  825. if(isDefined(id) && isString(id)) sel.setAttribute('id', id);
  826. sel.appendChild(createTextEl(css));
  827. if(isDefined(tobody) && tobody){
  828. document.body.insertBefore(sel,document.body.firstChild);
  829. }else{
  830. var hds = getTag('head');
  831. if( isDefined(hds[0]) && hds[0].nodeName=='HEAD' )
  832. window.setTimeout(function() { hds[0].appendChild(sel); }, 100);
  833. else
  834. document.body.insertBefore(sel,document.body.firstChild);
  835. }
  836. return sel;
  837. };
  838. // Get Elements
  839. var $D=function (q, root, single) {
  840. if (root && typeof root == 'string') {
  841. root = $D(root, null, true);
  842. if (!root) { return null; }
  843. }
  844. if( !q ) return false;
  845. if ( typeof q == 'object') return q;
  846. root = root || document;
  847. if (q[0]=='/' || (q[0]=='.' && q[1]=='/')) {
  848. if (single) { return document.evaluate(q, root, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }
  849. return document.evaluate(q, root, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  850. }
  851. else if (q[0]=='.') { return root.getElementsByClassName(q.substr(1)); }
  852. else { return root.getElementById( (q[0]=='#' ? q.substr(1):q.substr(0)) ); }
  853. return root.getElementsByTagName(q);
  854. };
  855. // utk add - remove element
  856. var Dom = {
  857. g: function(el) {
  858. if(!el) return false;
  859. return ( isString(el) ? document.getElementById(el) : el );
  860. },
  861. add: function(el, dest) {
  862. var el = this.g(el);
  863. var dest = this.g(dest);
  864. if(el && dest) dest.appendChild(el);
  865. },
  866. remove: function(el) {
  867. var el = this.g(el);
  868. if(el && el.parentNode)
  869. el.parentNode.removeChild(el);
  870. },
  871. Ev: function() {
  872. if (window.addEventListener) {
  873. return function(el, type, fn, ph) {
  874. if(typeof(el)=='object')
  875. this.g(el).addEventListener(type, function(e){fn(e);}, (isUndefined(ph) ? false : ph));
  876. };
  877. }else if (window.attachEvent) {
  878. return function(el, type, fn) {
  879. var f = function() { fn.call(this.g(el), window.event); };
  880. this.g(el).attachEvent('on' + type, f);
  881. };
  882. }
  883. }()
  884. };
  885.  
  886. var GM_XHR = {
  887. uri:null,
  888. returned:null,
  889. forceGM:false, // force with GM-XHR & avoid using Native-XHR when with multifox
  890. cached:false,
  891. events:false,
  892. request: function(cdata,met,callback){
  893. if(!GM_XHR.uri) return;
  894. met=(isDefined(met) && met ? met:'GET');
  895. cdata=(isDefined(cdata) && cdata ? cdata:null);
  896. if(typeof(callback)!='function') callback=null;
  897. var pReq_xhr = {
  898. method:met,
  899. url:GM_XHR.uri + (GM_XHR.cached ? '':(GM_XHR.uri.indexOf('?')==-1?'?':'&rnd=') + Math.random().toString().replace('0.','')),
  900. headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  901. data:(isString(cdata) ? cdata : ''),
  902. onload: function(ret) {
  903. if(ret.status==503){
  904. show_alert('Reach 503, retrying...');
  905. setTimeout(GM_XHR.request(cdata,met,callback), 777);
  906. }else{
  907. var rets=ret;
  908. if(callback!=null)
  909. callback(rets);
  910. else
  911. GM_XHR.returned = rets;
  912. }
  913. }
  914. };
  915. if( !GM_XHR.forceGM ) // always use this native; except update checker
  916. NAT_xmlhttpRequest( pReq_xhr );
  917. else
  918. GM_xmlhttpRequest( pReq_xhr );
  919. }
  920. };
  921.  
  922. // native/generic XHR needed for Multifox, failed using GM_xmlhttpRequest.
  923. var NAT_xmlhttpRequest=function(obj) {
  924. var request=new XMLHttpRequest();
  925. request.onreadystatechange=function() { if(obj.onreadystatechange) { obj.onreadystatechange(request); }; if(request.readyState==4 && obj.onload) { obj.onload(request); } }
  926. request.onerror=function() { if(obj.onerror) { obj.onerror(request); } }
  927. try { request.open(obj.method,obj.url,true); } catch(e) { if(obj.onerror) { obj.onerror( {readyState:4,responseHeaders:'',responseText:'',responseXML:'',status:403,statusText:'Forbidden'} ); }; return; }
  928. if(obj.headers) { for(name in obj.headers) { request.setRequestHeader(name,obj.headers[name]); } }
  929. request.send(obj.data); return request;
  930. };
  931.  
  932. var vB_textarea = {
  933. init: function(id) {
  934. this.Obj = (isUndefined(id) ? Dom.g(gvar.id_textarea) : Dom.g(id));
  935. this.content = (this.Obj ? this.Obj.value : "");
  936. this.cursorPos = this.rearmPos(); // [start, end]
  937. this.last_scrollTop = this.Obj.scrollTop; // last scrolltop pos
  938. },
  939. rearmPos: function(){ return [this.getCaretPos(), this.Obj.selectionEnd]; },
  940. clear: function (id){
  941. if(!this.Obj) this.Obj = (isUndefined(id) ? Dom.g(gvar.id_textarea) : Dom.g(id));
  942. this.set('');
  943. this.Obj.style.height='1px'; // min-height should be set before
  944. this.enabled();
  945. this.focus();
  946. },
  947. disabled: function(){
  948. this.Obj.setAttribute('disabled','disabled');
  949. },
  950. readonly: function(id){
  951. this.Obj = (isUndefined(id) ? Dom.g(gvar.id_textarea) : Dom.g(id));
  952. removeClass('txa_enable', this.Obj);
  953. addClass('txa_readonly', this.Obj);
  954. this.Obj.setAttribute('readonly',true);
  955. },
  956. enabled: function(id){
  957. if(!this.Obj) this.Obj = (isUndefined(id) ? Dom.g(gvar.id_textarea) : Dom.g(id));
  958. this.Obj.removeAttribute('disabled');
  959. this.Obj.removeAttribute('readonly');
  960. removeClass('txa_readonly', this.Obj);
  961. addClass('txa_enable', this.Obj);
  962. },
  963. focus: function(){
  964. if(!this.Obj)
  965. this.Obj = Dom.g(gvar.id_textarea);
  966. this.Obj.focus();
  967. },
  968. set: function(value){
  969. if(!this.Obj)
  970. this.Obj = Dom.g(gvar.id_textarea);
  971. this.Obj.value = this.content = value;
  972. },
  973. lastfocus: function (){
  974. var pos = Dom.g(gvar.id_textarea).value.length; // use the actual content
  975. if(this.Obj.setSelectionRange) {
  976. this.focus();
  977. this.Obj.setSelectionRange(pos,pos);
  978. }
  979. this.focus();
  980. },
  981. add: function(text){ // used on fetch post only
  982. this.Obj.value+=text; this.enabled(); this.focus();
  983. // fix chrome weird
  984. var lastpos=(this.cursorPos[0] + text.length);
  985. this.setCaretPos( lastpos, lastpos );
  986. },
  987. subStr: function(start, end){ return this.content.substring(start, end);},
  988. getSelectedText : function() {
  989. return (this.cursorPos[0]==this.cursorPos[1]? '': this.subStr(this.cursorPos[0], this.cursorPos[1]) );
  990. },
  991. getCaretPos : function() {
  992. this.enabled(); /* this.focus();*/
  993. var CaretPos = 0;
  994. //Mozilla/Firefox/Netscape 7+ support
  995. if(this.Obj)
  996. if (this.Obj.selectionStart || this.Obj.selectionStart == '0')
  997. CaretPos = this.Obj.selectionStart;
  998. return CaretPos;
  999. },
  1000. setCaretPos : function (pos,end){
  1001. if(isUndefined(end)) end = pos;
  1002. if(this.Obj.setSelectionRange) { // Firefox, Opera and Safari
  1003. this.focus();
  1004. this.Obj.setSelectionRange(pos,end);
  1005. }
  1006. },
  1007. // ptpos stand to puretext position [start, end]
  1008. setValue : function(text, ptpos){
  1009. var start=this.cursorPos[0];
  1010. var end=this.cursorPos[1];
  1011. if(isUndefined(ptpos)) ptpos=[text.length,text.length];
  1012. if(start!=end) {
  1013. this.replaceSelected(text,ptpos);
  1014. return;
  1015. }
  1016. var bufValue = this.subStr(0, start) + text + this.subStr(start, this.content.length);
  1017. this.set(bufValue);
  1018. // fix chrome weird
  1019. this.setCaretPos( (start + ptpos[0]), (start+ptpos[1]) );
  1020. if(vB_textarea.overflow!='hidden') this.Obj.scrollTop = (this.last_scrollTop+1);
  1021. return bufValue;
  1022. },
  1023. wrapValue : function(tag, title){
  1024. var start=this.cursorPos[0], end=this.cursorPos[1],bufValue;
  1025. tag = tag.toUpperCase();
  1026. bufValue = this.subStr(0, start) +
  1027. '['+tag+(title?'='+title:'')+']' +
  1028. (start==end ? '' : this.subStr(start, end)) +
  1029. '[/'+tag+']' + this.subStr(end, this.content.length);
  1030. this.set(bufValue);
  1031. var st2 = (start + ('['+tag+(title?'='+title:'')+']').length);
  1032. this.setCaretPos( st2, st2+this.subStr(start, end).length );
  1033. if(vB_textarea.overflow!='hidden') this.Obj.scrollTop = (this.last_scrollTop+1);
  1034. return bufValue;
  1035. },
  1036. replaceSelected : function(text, ptpos){
  1037. var start=this.cursorPos[0];
  1038. var end=this.cursorPos[1];
  1039. if(start==end) return;
  1040. var bufValue = this.subStr(0, start) + text + this.subStr(end, this.content.length);
  1041. this.set(bufValue);
  1042. this.setCaretPos( (start + ptpos[0]), (start+ptpos[1]) );
  1043. if(vB_textarea.overflow!='hidden') this.Obj.scrollTop = (this.last_scrollTop+1);
  1044. },
  1045. };
  1046.  
  1047. var rSRC = {
  1048. getSetOf: function(type){
  1049. if(isUndefined(type)) return false;
  1050. switch(type){
  1051. case "color":
  1052. return {
  1053. "#000000": "Black",
  1054. "#A0522D": "Sienna",
  1055. "#556B2F": "DarkOliveGreen",
  1056. "#006400": "DarkGreen",
  1057. "#483D8B": "DarkSlateBlue",
  1058. "#000080": "Navy",
  1059. "#4B0082": "Indigo",
  1060. "#2F4F4F": "DarkSlateGray",
  1061. "#8B0000": "DarkRed",
  1062. "#FF8C00": "DarkOrange",
  1063. "#808000": "Olive",
  1064. "#008000": "Green",
  1065. "#008080": "Teal",
  1066. "#0000FF": "Blue",
  1067. "#708090": "SlateGray",
  1068. "#696969": "DimGray",
  1069. "#FF0000": "Red",
  1070. "#F4A460": "SandyBrown",
  1071. "#9ACD32": "YellowGreen",
  1072. "#2E8B57": "SeaGreen",
  1073. "#48D1CC": "MediumTurquoise",
  1074. "#4169E1": "RoyalBlue",
  1075. "#800080": "Purple",
  1076. "#808080": "Gray",
  1077. "#FF00FF": "Magenta",
  1078. "#FFA500": "Orange",
  1079. "#FFFF00": "Yellow",
  1080. "#00FF00": "Lime",
  1081. "#00FFFF": "Cyan",
  1082. "#00BFFF": "DeepSkyBlue",
  1083. "#9932CC": "DarkOrchid",
  1084. "#C0C0C0": "Silver",
  1085. "#FFC0CB": "Pink",
  1086. "#F5DEB3": "Wheat",
  1087. "#FFFACD": "LemonChiffon",
  1088. "#98FB98": "PaleGreen",
  1089. "#AFEEEE": "PaleTurquoise",
  1090. "#ADD8E6": "LightBlue",
  1091. "#DDA0DD": "Plum",
  1092. "#FFFFFF": "White"
  1093. };
  1094. break;
  1095. case "font":
  1096. return ["Arial","Arial Black","Arial Narrow","Book Antiqua","Century Gothic","Comic Sans MS","Courier New","Fixedsys","Franklin Gothic Medium","Garamond","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Microsoft Sans Serif","Palatino Linotype","System","Tahoma","Times New Roman","Trebuchet MS","Verdana"];
  1097. break;
  1098. case "size":
  1099. // name : [inner, value]
  1100. return {
  1101. 'tiny' : ["1","7"]
  1102. ,'small' : ["2","9"]
  1103. ,'normal' : ["3","12"]
  1104. ,'large' : ["5","18"]
  1105. ,'huge' : ["7","24"]
  1106. };
  1107. break;
  1108. case "pasangan":
  1109. return {
  1110. 'addbbcode0' : 'Bold'
  1111. ,'addbbcode2' : 'Ital.'
  1112. ,'addbbcode4' : 'Underl.'
  1113. ,'addbbcode34': 'Strike'
  1114. ,'addbbcode52': 'Left'
  1115. ,'addbbcode30': 'Center'
  1116. ,'addbbcode32': 'Right'
  1117. ,'addbbcode46': 'Justified'
  1118. ,'addbbcode6' : 'Quote'
  1119. ,'addbbcode8' : 'Code'
  1120. ,'addbbcode14': 'Image'
  1121. ,'addbbcode16': 'Link'
  1122. ,'btn_video' : 'Video'
  1123. ,'addbbcode10':'dotlist'
  1124. ,'addbbcode12':'numberlist'
  1125. ,'addbbcode99':'line_break'
  1126. };
  1127. break;
  1128. };
  1129. return false;
  1130. }
  1131.  
  1132. ,getCSS: function(){
  1133. return (''
  1134. +'#'+gvar.id_textarea+'{min-height:'+(gvar.isQR?'125':'250')+'px}'
  1135. +'.ofont:hover, .ocolor:hover, .osize:hover, .cdefault:hover {cursor:default!important;}'
  1136. +'.ofont:hover, .osize:hover{border:1px solid #2085C1!important;background-color:#B0DAF2!important;}'
  1137. +'.ofont, .osize, .ocolor {color:#000!important;background:#FFF!important;padding:1px!important;}'
  1138. +'.ofont, .osize{border:1px solid transparent}'
  1139. +'.ofont{text-align:left;}'
  1140. +'div.vbmenu_popup table td {line-height:10px;width:13px!important;border:1px solid transparent;}'
  1141. +'div.vbmenu_popup table td:hover {cursor:pointer!important;border:1px solid #2085C1;background-color:#B0DAF2;}'
  1142. +'div.vbmenu_popup table td div {width:10px}'
  1143. +'div.vbmenu_popup {z-index:99;position:absolute; background:#FFF; left:0; top:0; padding:3px; width:auto; height:auto; margin-top:21px!important;border:1px solid #DADADA;}'
  1144. +'#text_edit button.button2{margin:0 1.5px!important}'
  1145. +'.sepr{margin-left:1px;}'
  1146. +'.vbmenu_option, .vbmenu_hilite{padding:1px 3px;}'
  1147. +'.vbmenu_option:hover, .vbmenu_hilite:hover{background-color:#B0DAF2!important;color:blue;}'
  1148. +'.vbmenu_option{background: #BBC7CE;color: #000000;font: 11px verdana, arial;white-space: nowrap;cursor: pointer;}'
  1149. +'.vbmenu_hilite{background: #8A949E;color: #FFFFFF;font: 11px verdana, arial;white-space: nowrap;cursor: pointer;}'
  1150. +''
  1151. );
  1152. }
  1153. ,getTPL_qr_control: function(){
  1154. return (''
  1155. +'<table align="center" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td align="left"><span id="text_edit" style=""><button class="button2" type="button" id="addbbcode0" accesskey="b" title="Bold"><img title="Bold" src="'+gvar.img_path+'text_bold.png" alt="Bold"></button><button class="button2" type="button" id="addbbcode2" accesskey="i" title="Ital."><img title="Italic" src="'+gvar.img_path+'text_italic.png" alt="Ital."></button><button class="button2" type="button" id="addbbcode4" accesskey="u" title="Underline"><img title="Underl." src="'+gvar.img_path+'text_underline.png" alt="Underl."></button><button class="button2" type="button" id="addbbcode34" accesskey="x" title="Strike"><img title="Strike" src="'+gvar.img_path+'text_strikethrough.png" alt="Strike"></button>'
  1156. // [left,center,right,justified]
  1157. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1158. +'<button class="button2" type="button" id="addbbcode52" accesskey="m" title="Left"><img title="Left" src="'+gvar.img_path+'text_align_left.png" alt="Left"></button><button class="button2" type="button" id="addbbcode30" accesskey="t" title="Center"><img title="Center" src="'+gvar.img_path+'text_align_center.png" alt="Center"></button><button class="button2" type="button" id="addbbcode32" accesskey="g" title="Right"><img title="Right" src="'+gvar.img_path+'text_align_right.png" alt="Right"></button><button class="button2" type="button" id="addbbcode46" accesskey="jt" title="Justified"><img title="Justified" src="'+gvar.img_path+'text_align_justify.png" alt="Justified"></button>'
  1159. // [list,numberlist,hr]
  1160. +( !gvar.isQR ? ''
  1161. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1162. +'<button class="button2" type="button" id="addbbcode10" accesskey="l" title="dotlist"><img title="-List" src="'+gvar.img_path+'text_list_bullets.png" alt="-List"></button><button class="button2" type="button" id="addbbcode12" accesskey="o" title="Ordered List"><img title="Ordered List" src="'+gvar.img_path+'text_list_numbers.png" alt="numberlist"></button><button class="button2" type="button" id="addbbcode99" title="Insert a line break"><img title="Insert a line break" src="'+gvar.img_path+'text_horizontalrule.png" alt="line_break"></button>'
  1163. : '')
  1164. // [quote,code,table]
  1165. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1166. +'<button class="button2" type="button" id="addbbcode6" accesskey="q" title="Quote"><img title="Quote" src="'+gvar.img_path+'comments.png" alt="Quote"></button><button class="button2" type="button" id="addbbcode8" accesskey="c" title="Code"><img title="Code" src="'+gvar.img_path+'page_white_code.png" alt="Code"></button>'
  1167. // table
  1168. +( !gvar.isQR ? ''
  1169. +'<button class="button2" onclick="selectWysiwyg(this,\'table_gui\')" onmouseover="helpline(\'tab\')" type="button" id="addbbcodetable" accesskey="" title="Insert a table"><img title="Insert a table" src="'+gvar.img_path+'table.png" alt="insert_table"></button>'
  1170. :'')
  1171. // [upload,image,link, flash,video]
  1172. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1173. +'<button class="button2" type="button" id="servimg" accesskey="y" title="Host an image" onclick="'+gvar.auth.func+'('+gvar.auth.obj+',\''+gvar.auth.email+'\',\''+gvar.auth.hash+'\',\''+gvar.auth.tid+'\')"><img title="Host an image" src="'+gvar.img_path+'picture_save.png" alt="hostupload"></button><button class="button2" type="button" id="addbbcode14" accesskey="p" title="Image"><img title="Image" src="'+gvar.img_path+'picture.png" alt="Image"></button><button class="button2" type="button" id="addbbcode16" accesskey="w" title="Link"><img title="Link" src="'+gvar.img_path+'link.png" alt="Link"></button>'
  1174. +( !gvar.isQR ? ''
  1175. +'<button class="button2" onclick="selectWysiwyg(this,\'flash\')" onmouseover="helpline(\'fl\')" type="button" title="Flash"><img title="Flash" src="'+gvar.img_path+'page_white_flash.png" alt="Flash"></button><button id="btn_video" class="button2" type="button" title="Video"><img title="Video" src="'+gvar.img_path+'film.png" alt="Video"></button>'
  1176. :'')
  1177. // [size,color,font]
  1178. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1179. +'<div class="imagebutton_color" id="vB_Editor_001_popup_fontsize" style="display:inline-block;position:relative">'
  1180. +'<button id="pick_size" class="button2" type="button" title="Font size"><img title="Font size" src="'+gvar.img_path+'style.png" alt="Font size"></button>'
  1181. +'</div>' // #vB_Editor_001_popup_fontsize
  1182. +'<div class="imagebutton_color" id="vB_Editor_001_popup_forecolor" style="display:inline-block;position:relative">'
  1183. +'<button id="pick_kolor" class="button2" type="button" title="Font color"><img src="'+gvar.img_path+'color_swatch.png" alt="Font color"></button>'
  1184. +'</div>' // #vB_Editor_001_popup_forecolor
  1185. +'<div class="imagebutton_color" id="vB_Editor_001_popup_fontname" style="display:inline-block;position:relative">'
  1186. +'<button id="pick_font" class="button2" type="button" title="Font"><img title="Font" src="'+gvar.img_path+'font.png" alt="Font"></button>'
  1187. +'</div>' // #vB_Editor_001_popup_fontname
  1188. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1189. +'<div class="imagebutton_color" id="popup_btn_other" style="display:inline-block;position:relative">'
  1190. +'<input id="btn_other" class="button2" value="Others" style="height: 22px;" type="button">'
  1191. +'</div>' // #btn_other
  1192. +(gvar.isQR ? ''
  1193. +'<img src="'+gvar.img_path+'separator.png" style="vertical-align: middle;" alt="" class="sepr">'
  1194. +'<button class="button2" style="width: 20px;" type="button" onclick="selectWysiwyg(this, \'sel_smilies\')"><img src="http://illiweb.com/fa/i/smiles/icon_smile.gif" alt=""></button>'
  1195. :'')
  1196. +'</td>'
  1197. +'<td align="right"><span class="gensmall"><a id="btn_clear" href="javascript:;">reset</a></span></td></tr></tbody></table>'
  1198. +''
  1199. );
  1200. }
  1201. };
  1202.  
  1203. // -----------
  1204. if( isThisThread() ) init();
  1205. // -----------
  1206.  
  1207. })();
  1208. // script by ~Idx