QR-Plugins.TextFliper

plugins for Kaskus-QR TextFliper generator

  1. // ==UserScript==
  2. // @name QR-Plugins.TextFliper
  3. // @namespace http://userscripts.org/scripts/show/111440
  4. // @include *.kaskus.co.id/thread/*
  5. // @include *.kaskus.co.id/lastpost/*
  6. // @include *.kaskus.co.id/post/*
  7. // @include *.kaskus.co.id/group/discussion/*
  8. // @include *.kaskus.co.id/show_post/*
  9. // @version 0.2
  10. // @dtversion 1210300002
  11. // @timestamp 1351547543977
  12. // @qrversion 4.0.9
  13. // @description plugins for Kaskus-QR TextFliper generator
  14. // @author tuxie.forte;
  15. // @license (CC) by-nc-sa 3.0
  16. //
  17. // -!--latestupdate
  18. //
  19. // v0.2 - 2012-10-30
  20. // include new-kaskus (co.id)
  21. //
  22. // v0.1 - 2011-08-27
  23. // init
  24. //
  25. // -/!latestupdate---
  26. // ==/UserScript==
  27. //
  28.  
  29. (function(){
  30. // Initialize Global Variables
  31. var gvar=function() {};
  32.  
  33. /*
  34. window.alert(new Date().getTime());
  35. */
  36. //========-=-=-=-=--=========
  37. gvar.__DEBUG__ = false; // development
  38. //========-=-=-=-=--=========
  39.  
  40.  
  41. // this is where we re-initialize before we trigger start_Main()
  42. // any huge global var or loading any saved value may start in here too
  43. function init_start(){
  44. gvar.B = rSRC.getSetOf('button');
  45. gvar.tID = "reply-messsage";
  46. start_Main();
  47. }
  48. // =====
  49. // START
  50. function start_Main(){
  51. var par = gID(gvar.qr_identity);
  52. var el, inp, divs, span;
  53. var text_mecs = {
  54. 'UpDown' : 'Flip Upside Down'
  55. ,'FlipWord' : 'Flip Wording'
  56. ,'FlipText' : 'Flip Text'
  57. ,'RevWord' : 'Reverse Ea(Word)'
  58. };
  59. if( par ){
  60. // this span container needed if we have to wrap popup menu with absolute position
  61. span = createEl('span', {style:'display:inline-block'});
  62. Dom.add(span, par);
  63. inp = createEl('img', {id:'btn_txtflip', 'src':gvar.B.txtflip_gif, style:'vertical-align:bottom;', alt:'[txtflip]', title:'Text Flip Generator'});
  64. _o('click', inp, function(e){return toggle_txtflip_menu(e)} );
  65. Dom.add(inp, span);
  66. // fake input for lost focus (blured)
  67. inp = createEl('input', {id:'txtflip_fake_focus', 'value':'', style:'border:0; width:0; position:absolute; margin:-99px 0 0 -99999px;'});
  68. _o('blur', inp, function(e){ var c=gID('popup_txtflip_menu'); if(c) window.setTimeout(function() { gID('popup_txtflip_menu').style.display='none' }, 500); });
  69. Dom.add(inp, span);
  70. divs = createEl('div', {id:'popup_txtflip_menu', 'class':'vbmenu_popup', 'style':'width:110px; overflow:hidden; display:none;'});
  71. for(var tipe in text_mecs){
  72. el = createEl('div', {style:'text-align:left;', 'class':'osize', rel:tipe, title:text_mecs[tipe]}, text_mecs[tipe]);
  73. _o('click', el, function(e){ return handleClick(e) });
  74. Dom.add(el, divs);
  75. }
  76. Dom.add(divs, span);
  77. }
  78. }
  79. function handleClick(e){
  80. var vBText = _TEXT.init();
  81. if(!vBText) return;
  82. e=e.target||e;
  83. var endFocus=function(){ _TEXT.focus(); return false};
  84. var selected = _TEXT.getSelectedText(), todo = e.getAttribute('rel'), ret='', prehead, text;
  85. text=(selected!= '' ? selected : prompt('Please enter Text to Flip:', 'text flipper') );
  86. if(text==null) return endFocus();
  87. ret = textFlip(text, todo);
  88. if(!ret) return endFocus();
  89. prehead = [0, ret.length];
  90. if(selected=='')
  91. _TEXT.setValue( ret, prehead );
  92. else
  93. _TEXT.replaceSelected( ret, prehead );
  94. }
  95.  
  96. function toggle_txtflip_menu(e){
  97. e=e.target||e;
  98. var tgt = gID('popup_txtflip_menu'), showed=(tgt.style.display!='none');
  99. tgt.style.display=(showed ? 'none' : '');
  100. if(!showed && gID('txtflip_fake_focus'))
  101. window.setTimeout(function() { gID('txtflip_fake_focus').focus() }, 200);
  102. }
  103.  
  104.  
  105. /*=========
  106. # Both main functionality
  107. # >Reverse Text Generator
  108. # Copyright 2011 TextMechanic.com All Rights Reserved
  109. # sources: http://textmechanic.com
  110. # =========
  111. */
  112. function textFlip(text, todo){
  113. var MISC={
  114. getTable: function(){var fT = {a: '\u0250',b: 'q',c: '\u0254',d: 'p',e: '\u01DD',f: '\u025F',g: '\u0183',h: '\u0265',i: '\u0131',j: '\u027E',k: '\u029E',l: '\u05DF',m: '\u026F',n: 'u',r: '\u0279',t:'\u0287',v: '\u028C',w: '\u028D',y: '\u028E','.': '\u02D9','[': ']','(': ')','{': '}','?': '\u00BF','!': '\u00A1',"\'": ',','<': '>','_': '\u203E','"': '\u201E','\\': '\\',';':'\u061B','\u203F': '\u2040','\u2045': '\u2046','\u2234': '\u2235'};for(i in fT)fT[ fT[i] ]=i;return fT}
  115. ,_swapcase: function(a){var b=a.length,c,d,e,f,g;var h,i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",j="abcdefghijklmnopqrstuvwxyz";e=a.split("");h=e.length;c=e[0];d=e[h-1];f=i.indexOf(c)==-1?0:1;g=j.indexOf(d)==-1?0:1;if(f+g==2){a=a.split("");a=a.slice(1,b-1);a.unshift(c.toLowerCase());a.push(d.toUpperCase());a=a.join("")}return a}
  116. };
  117. var PROC={
  118. do_UpDown: function(text){
  119. var result=text, overload;
  120. text = text.replace(/\r\n/gi, '\n');
  121. var len = text.split('').length;
  122. if (len > 50001){
  123. overload = confirm("WARNING: You have entered over 50,000 characters of text which could slow down or even lock-up your computer! Please click \"Cancel\" to stop flip text upside down or click \"OK\" to proceed with flip text upside down at your own risk.");
  124. if(!overload) return false;
  125. } else result = PROC.flipString(text.toLowerCase());
  126. return result;
  127. }
  128. ,flipString: function(a){var b=a.length-1,c=new Array(a.length),d,e;var f=MISC.getTable();for(var g=b;g>=0;--g){d=a.charAt(g);e=f[d];c[b-g]=e!=undefined?e:d}return c.join("")}
  129. ,do_FlipWord: function(text){ return PROC.flipwords(text) }
  130. ,flipwords: function(a){a=a.replace(/\r\n/g,"\n");a=a.replace(/\./g," . ");a=a.replace(/\,/g," , ");a=a.replace(/\?/g," ? ");a=a.replace(/\!/g," ! ");a=a.replace(/\:/g," : ");a=a.replace(/\;/g," ; ");a=a.replace(/\(/g," ( ");a=a.replace(/\)/g," ) ");a=a.replace(/\[/g," [ ");a=a.replace(/\]/g," ] ");a=a.replace(/\{/g," { ");a=a.replace(/\}/g," } ");a=a.replace(/\</g," < ");a=a.replace(/\>/g," > ");a=a.replace(/\"/g,' " ');a=a.replace(/\|/g," | ");a=a.split("\n").reverse().join("\n");a=a.replace(/\n/g," \n ").split(" ").reverse().join(" ").replace(/ \n /g,"\n");a=a.replace(/ \. /g,".");a=a.replace(/ \, /g,",");a=a.replace(/ \? /g,"?");a=a.replace(/ \! /g,"!");a=a.replace(/ \: /g,":");a=a.replace(/ \; /g,";");a=a.replace(/ \( /g,")");a=a.replace(/ \) /g,"(");a=a.replace(/ \[ /g,"]");a=a.replace(/ \] /g,"[");a=a.replace(/ \{ /g,"}");a=a.replace(/ \} /g,"{");a=a.replace(/ \< /g,">");a=a.replace(/ \> /g,"<");a=a.replace(/ \" /g,'"');a=a.replace(/ \| /g,"|");return a}
  131. ,do_FlipText: function(text){ return PROC.fliptext(text) }
  132. ,fliptext: function(a){a=a.replace(/\r\n/g,"\n");a=a.replace(/\(/g," ( ");a=a.replace(/\)/g," ) ");a=a.replace(/\[/g," [ ");a=a.replace(/\]/g," ] ");a=a.replace(/\{/g," { ");a=a.replace(/\}/g," } ");a=a.replace(/\</g," < ");a=a.replace(/\>/g," > ");a=a.split("\n").reverse().join("\n");a=a.split("").reverse().join("");a=a.replace(/ \( /g,")");a=a.replace(/ \) /g,"(");a=a.replace(/ \[ /g,"]");a=a.replace(/ \] /g,"[");a=a.replace(/ \{ /g,"}");a=a.replace(/ \} /g,"{");a=a.replace(/ \< /g,">");a=a.replace(/ \> /g,"<");return a}
  133. ,do_RevWord: function(text){ return PROC.reversewordletters(text) }
  134. ,reversewordletters: function(a){a=a.replace(/\r\n/g,"\n");a=a.replace(/\./g," . ");a=a.replace(/\,/g," , ");a=a.replace(/\?/g," ? ");a=a.replace(/\!/g," ! ");a=a.replace(/\:/g," : ");a=a.replace(/\;/g," ; ");a=a.replace(/\(/g," ( ");a=a.replace(/\)/g," ) ");a=a.replace(/\[/g," [ ");a=a.replace(/\]/g," ] ");a=a.replace(/\{/g," { ");a=a.replace(/\}/g," } ");a=a.replace(/\</g," < ");a=a.replace(/\>/g," > ");a=a.replace(/\'/g," ' ");a=a.replace(/\"/g,' " ');a=a.replace(/\%/g," % ");a=a.replace(/\$/g," $ ");a=a.replace(/\#/g," # ");a=a.replace(/\@/g," @ ");a=a.replace(/\*/g," * ");a=a.replace(/\+/g," + ");a=a.replace(/\-/g," - ");a=a.replace(/\=/g," = ");a=a.replace(/\_/g," _ ");a=a.replace(/\|/g," | ");a=a.replace(/\&/g," & ");a=a.replace(/\//g," / ");a=a.replace(/\\/g," \\ ");a=a.replace(/\n/g," \n ");a=a.split(" ");var b=a.length,c=[],d;for(var e=0;e<b;e++){d=MISC._swapcase(a[e]);d=d.split("").reverse().join("");c[e]=d}a=c.join(" ");a=a.replace(/ \n /g,"\n");a=a.replace(/ \. /g,".");a=a.replace(/ \, /g,",");a=a.replace(/ \? /g,"?");a=a.replace(/ \! /g,"!");a=a.replace(/ \: /g,":");a=a.replace(/ \; /g,";");a=a.replace(/ \( /g,"(");a=a.replace(/ \) /g,")");a=a.replace(/ \[ /g,"[");a=a.replace(/ \] /g,"]");a=a.replace(/ \{ /g,"{");a=a.replace(/ \} /g,"}");a=a.replace(/ \< /g,"<");a=a.replace(/ \> /g,">");a=a.replace(/ \' /g,"'");a=a.replace(/ \" /g,'"');a=a.replace(/ \% /g,"%");a=a.replace(/ \$ /g,"$");a=a.replace(/ \# /g,"#");a=a.replace(/ \@ /g,"@");a=a.replace(/ \* /g,"*");a=a.replace(/ \+ /g,"+");a=a.replace(/ \- /g,"-");a=a.replace(/ \= /g,"=");a=a.replace(/ \_ /g,"_");a=a.replace(/ \| /g,"|");a=a.replace(/ \& /g,"&");a=a.replace(/ \/ /g,"/");a=a.replace(/ \\ /g,"\\");return a}
  135. }
  136. // end PROC
  137. /*
  138. 'UpDown' : 'Flip Upside Down'
  139. ,'FlipWord' : 'Flip Wording'
  140. ,'FlipText' : 'Flip Text'
  141. ,'RevWord' : 'Reverse Each Word'
  142. */
  143. switch(todo){
  144. case "UpDown":
  145. return PROC.do_UpDown(text);
  146. break;
  147. case "FlipWord":
  148. return PROC.do_FlipWord(text);
  149. break;
  150. case "FlipText":
  151. return PROC.do_FlipText(text);
  152. break;
  153. case "RevWord":
  154. return PROC.do_RevWord(text);
  155. break;
  156. default:
  157. return text;
  158. break;
  159. }
  160. }
  161.  
  162.  
  163.  
  164. // -
  165. // -
  166. // -
  167. // -
  168. //=========
  169. // code below should adapting current QR Engine for this plugins works
  170. // leave code below as wot it is, as long you know what todo
  171. //========= Common Functions && Global Var Init ====
  172. // static routine
  173. function isDefined(x) { return !(x == null && x !== null); }
  174. function isUndefined(x) { return x == null && x !== null; }
  175. function isString(x) { return (typeof(x)!='object' && typeof(x)!='function'); }
  176. function trimStr(x) { return x.replace(/^\s+|\s+$/g,""); };
  177.  
  178. function _o(m,e,f){Dom.Ev(e,m,function(e){typeof(f)=='function'?f(e):void(0)});}
  179. function gID(x) { return document.getElementById(x) }
  180. function addClass(cName, Obj){
  181. if(cName=="") return;
  182. var neocls = (Obj.className ? Obj.className : '');
  183. if(neocls.indexOf(cName)!=-1) return;
  184. neocls+=(neocls!=''?' ':'')+cName;
  185. Obj.setAttribute('class', neocls);
  186. }
  187. function removeClass(cName, Obj){
  188. if(cName=="") return;
  189. var neocls = (Obj.className ? Obj.className : '');
  190. neocls = trimStr ( neocls.replace(cName,"") ); // replace and trim
  191. Obj.setAttribute('class', neocls);
  192. }
  193. function SimulateMouse(elem,event,preventDef) {
  194. if(typeof(elem)!='object') return;
  195. var evObj = document.createEvent('MouseEvents');
  196. preventDef=(isDefined(preventDef) && preventDef ? true : false);
  197. evObj.initEvent(event, preventDef, true);
  198. try{elem.dispatchEvent(evObj);}
  199. catch(e){}
  200. }
  201. function createEl(type, attrArray, html){
  202. var node = document.createElement(type);
  203. for (var attr in attrArray)
  204. if (attrArray.hasOwnProperty(attr))
  205. node.setAttribute(attr, attrArray[attr]);
  206. if(html) node.innerHTML = html;
  207. return node;
  208. }
  209.  
  210. // Get Elements
  211. var $D=function (q, root, single) {
  212. if (root && typeof root == 'string') {
  213. root = $D(root, null, true);
  214. if (!root) { return null; }
  215. }
  216. if( !q ) return false;
  217. if ( typeof q == 'object') return q;
  218. root = root || document;
  219. if (q[0]=='/' || (q[0]=='.' && q[1]=='/')) {
  220. if (single) { return document.evaluate(q, root, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }
  221. return document.evaluate(q, root, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  222. }
  223. else if (q[0]=='.') { return root.getElementsByClassName(q.substr(1)); }
  224. else { return root.getElementById( (q[0]=='#' ? q.substr(1):q.substr(0)) ); }
  225. return root.getElementsByTagName(q);
  226. };
  227. // utk add - remove element
  228. var Dom = {
  229. g: function(el) {
  230. if(!el) return false;
  231. return ( isString(el) ? document.getElementById(el) : el );
  232. },
  233. add: function(el, dest) {
  234. var el = this.g(el);
  235. var dest = this.g(dest);
  236. if(el && dest) dest.appendChild(el);
  237. },
  238. remove: function(el) {
  239. var el = this.g(el);
  240. if(el && el.parentNode)
  241. el.parentNode.removeChild(el);
  242. },
  243. Ev: function() {
  244. if (window.addEventListener) {
  245. return function(el, type, fn, ph) {
  246. if(typeof(el)=='object')
  247. this.g(el).addEventListener(type, function(e){fn(e);}, (isUndefined(ph) ? false : ph));
  248. };
  249. }else if (window.attachEvent) {
  250. return function(el, type, fn) {
  251. var f = function() { fn.call(this.g(el), window.event); };
  252. this.g(el).attachEvent('on' + type, f);
  253. };
  254. }
  255. }()
  256. };
  257.  
  258. var _TEXT = {
  259. e : null, eNat : null,
  260. content : "",
  261. cursorPos : [],
  262. last_scrollTop: 0,
  263. init: function() {
  264. this.eNat = gID(gvar.tID);
  265. this.content = this.eNat.value;
  266. this.cursorPos = _TEXT.rearmPos(); // [start, end]
  267. this.last_scrollTop = gID(gvar.tID).scrollTop; // last scrolltop pos
  268. return this;
  269. },
  270. rearmPos: function(){ return [this.getCaretPos(), gID(gvar.tID).selectionEnd]; },
  271. subStr: function(start, end){ return this.content.substring(start, end);},
  272. set: function(value){
  273. gID(gvar.tID).value = this.content = value;
  274. _TEXT.setRows_Elastic();
  275. _TEXT.init();
  276.  
  277. },
  278. wrapValue : function(tag, title){
  279. var st2, start=this.cursorPos[0], end=this.cursorPos[1],bufValue;
  280. tag = tag.toUpperCase();
  281. bufValue = this.subStr(0, start) +
  282. '['+tag+(title?'='+title:'')+']' +
  283. (start==end ? '' : this.subStr(start, end)) +
  284. '[/'+tag+']' + this.subStr(end, this.content.length);
  285. this.set(bufValue);
  286. st2 = (start + ('['+tag+(title?'='+title:'')+']').length);
  287. this.setCaretPos( st2, st2 + this.subStr(start, end).length );
  288. if(this.overflow!='hidden') gID(gvar.tID).scrollTop = (this.last_scrollTop+1);
  289. return bufValue;
  290. },
  291. add: function(text){ // used on fetch post only
  292. var newline = '\n\n';
  293. if( gID(gvar.tID).value != "" )
  294. this.content+= newline;
  295. gID(gvar.tID).value = ( this.content + text );
  296. setTimeout(function(){
  297. _TEXT.lastfocus();
  298. }, 200);
  299. },
  300. // ptpos stand to puretext position [start, end]
  301. setValue : function(text, ptpos){
  302. var start=this.cursorPos[0], end=this.cursorPos[1];
  303. if(isUndefined(ptpos)) ptpos=[text.length,text.length];
  304. if(start!=end) {
  305. this.replaceSelected(text,ptpos);
  306. return;
  307. }
  308. var bufValue = this.subStr(0, start) + text + this.subStr(start, this.content.length);
  309. this.set(bufValue);
  310. // fix chrome weird
  311. this.setCaretPos( (start + ptpos[0]), (start+ptpos[1]) );
  312. if(_TEXT.overflow!='hidden') gID(gvar.tID).scrollTop = (this.last_scrollTop+1);
  313. return bufValue;
  314. },
  315. replaceSelected : function(text, ptpos){
  316. var start=this.cursorPos[0], end=this.cursorPos[1];
  317. if(start==end) return;
  318. var bufValue = this.subStr(0, start) + text + this.subStr(end, this.content.length);
  319. this.set(bufValue);
  320. this.setCaretPos( (start + ptpos[0]), (start+ptpos[1]) );
  321. if( _TEXT.overflow!='hidden') gID(gvar.tID).scrollTop = (this.last_scrollTop+1);
  322. },
  323. pracheck: function(foc){
  324. if( isUndefined(foc) )
  325. foc = true;
  326. _TEXT.setElastic(gvar.maxH_editor);
  327. if( gID(gvar.tID).value !="" )
  328. gID('clear_text').style.setProperty('display', 'block');
  329. else
  330. gID('clear_text').style.setProperty('display', 'none');
  331. if(foc) setTimeout(function(){
  332. _TEXT.focus();
  333. }, 200);
  334. },
  335. focus: function(){
  336. gID(gvar.tID).focus()
  337. },
  338. lastfocus: function (){
  339. var eText, nl, pos, txt = String(gID(gvar.tID).value); // use the actual content
  340. pos = txt.length;
  341. nl = txt.split('\n');
  342. nl = nl.length;
  343. pos+= (nl * 2);
  344. eText = gID(gvar.tID);
  345. if( eText.setSelectionRange ) {
  346. _TEXT.focus();
  347. eText.setSelectionRange(pos,pos);
  348. }
  349. setTimeout(function(){ _TEXT.focus() } , 310);
  350. },
  351. getSelectedText : function() {
  352. return (this.cursorPos[0]==this.cursorPos[1]? '': this.subStr(this.cursorPos[0], this.cursorPos[1]) );
  353. },
  354. getCaretPos : function() {
  355. var CaretPos = 0;
  356. //Mozilla/Firefox/Netscape 7+ support
  357. if(gID(gvar.tID))
  358. if (gID(gvar.tID).selectionStart || gID(gvar.tID).selectionStart == '0')
  359. CaretPos = gID(gvar.tID).selectionStart;
  360. return CaretPos;
  361. },
  362. setCaretPos : function (pos,end){
  363. if(isUndefined(end)) end = pos;
  364. if(gID(gvar.tID).setSelectionRange) { // Firefox, Opera and Safari
  365. this.focus();
  366. gID(gvar.tID).setSelectionRange(pos,end);
  367. }
  368. },
  369. setElastic: function(max,winrez){
  370. var a, tid=gvar.tID;
  371. function setCols_Elastic(max){
  372. var a=gID(tid); a.setAttribute("cols", Math.floor(a.clientWidth/7));
  373. var w = Math.floor(a.clientWidth/7);
  374. _TEXT.setRows_Elastic(max)
  375. }
  376. a= gID(tid) || gID(gvar.tID);
  377. _TEXT.oflow='hidden';
  378. a.setAttribute('style','visibility:hidden; overflow:'+_TEXT.oflow+';letter-spacing:0;line-height:14pt;'+(max?'max-height:'+(max-130)+'pt;':''));
  379. if( !winrez ) gID(gvar.tID).keyup(function(){ setCols_Elastic(max) });
  380. setCols_Elastic(max);
  381. },
  382. setRows_Elastic: function(max){
  383. var a = gID(gvar.tID), c=a.cols, b=a.value.toString(), h;
  384. b=b.replace(/(?:\r\n|\r|\n)/g,"\n");
  385. for(var d=2,e=0,f=0;f<b.length;f++){
  386. var g=b.charAt(f);e++;if(g=="\n"||e==c){d++;e=0}
  387. }
  388. h=(d*14); a.setAttribute("rows",d); a.style.height=h+"pt";
  389. _TEXT.oflow = (max && (d*14>(max-130)) ? 'auto':'hidden');
  390. a.style.setProperty('overflow', _TEXT.oflow, 'important');
  391. gID(gvar.tID).style.setProperty('visibility', 'visible');
  392. }
  393. };
  394.  
  395.  
  396. // ----my ge-debug--------
  397. function show_alert(msg, force) {
  398. if(arguments.callee.counter) { arguments.callee.counter++; } else { arguments.callee.counter=1; }
  399. GM_log('('+arguments.callee.counter+') '+msg);
  400. if(force==0) { return; }
  401. }
  402. function clog(msg) {
  403. if(!gvar.__DEBUG__) return;
  404. show_alert(msg);
  405. }
  406.  
  407.  
  408.  
  409. // main resource
  410. var rSRC = {
  411. getSetOf: function(type){
  412. if(isUndefined(type)) return false;
  413. switch(type){
  414. case "button":
  415. return {
  416. txtflip_gif : ""
  417. +"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sIGhQ4Bccj+a4AAAIOSURBVDjL1ZTNTuswEIVPGhcSmiqw4QVZ8xY8BmLLgh0rXgSWbKqqCNEfQpPYidPvrmzRm8vdcyRL47/jmTMzln4TODs7QxJpmiIpjul0iiQuLi7i2mw2QxLn5+dhbUwI0DQNzjkA9vs9AO/v7wBYa6nr+mjv+fkZYExYliXDMNB1HUAkXSwW/I3dbhcfDxgRGmNo25bT09MYVlmWSGK73UaPJDGfz48kaZrm3yE75zgcDgAYY6InAW9vbwzDAMBkMjnaCySTYOR5LmOMkiRR0zTy3qsoCt3d3enl5UXee7Vtq4eHB1lrdTgc5L2XtfbnLAcMw0CY933P1dUVy+WS6+trhmHg8/OTy8vLIz1HbCcnJ7RtG0nyPGe73QLw+vqKJBaLRUyEpBh+VVWR0ASj6zplWSZAxhilaaokSSRJ6/VakmStVZ7nUY6u6yRJ8/lcIw2LopD3XkmSaLVaablcqixLSdLt7a1Wq5Xu7++12+202Wz09fWlLMuUZZnattU/y8Z7z8fHR9Syqipubm5iLT49PfH4+BiL3Hv/cx2GJDjncM4dHe77Ptqha/q+p67r2DkjtiRJYlIAptMpVVUBsNlscM6xXq9jIoqiAMB7j/f+Zw/Dhe/dkmUZaZoym82OuiSgrusxYZ7nsSRCGCHE8Mh+v8dai7U26vhfDcPHEDQL84Cg63dNgyy/55f+A7hO02wbgND6AAAAAElFTkSuQmCC"
  418. };
  419. break;
  420. }
  421. }
  422.  
  423. };
  424. // -end static
  425. //=========
  426.  
  427. function init(){
  428. gvar.qr_identity= 'qr_plugins_container';
  429. gvar.try_wait = 0;
  430. gvar.try_max = 20;
  431. gvar.sITry_wait= null;
  432.  
  433. wait_for_qr();
  434. }
  435.  
  436. // make sure QR DOM is finished loaded
  437. function wait_for_qr(){
  438. if( gvar.try_wait<gvar.try_max ){
  439. if( !gID(gvar.qr_identity) ){
  440. clog(' TextMechanic waiting..');
  441. gvar.try_wait++;
  442. gvar.sITry_wait = window.setTimeout(function() { wait_for_qr() }, 500);
  443. }else{
  444. clearTimeout( gvar.sITry_wait );
  445. init_start();
  446. }
  447. }
  448. }
  449.  
  450. // ------
  451. init();
  452. // ------
  453.  
  454. })()
  455. /* tF. */

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址