hwmtakeoffon

Dressed arts + cost 1 batl

目前为 2014-08-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name hwmtakeoffon
  3. // @namespace Demin
  4. // @description Dressed arts + cost 1 batl
  5. // @homepage http://userscripts.org/scripts/show/92599
  6. // @version 0.15
  7. // @include http://*heroeswm.*/inventory.php*
  8. // @include http://178.248.235.15/inventory.php*
  9. // @include http://173.231.37.114/inventory.php*
  10. // @include http://*freebsd-help.org/inventory.php*
  11. // @include http://*heroes-wm.*/inventory.php*
  12. // @include http://*hommkingdoms.info/inventory.php*
  13. // @include http://*hmmkingdoms.com/inventory.php*
  14. // @include http://*герои.рф/inventory.php*
  15. // ==/UserScript==
  16.  
  17. var version = '0.15';
  18.  
  19. var script_num = 92599;
  20. var script_name = 'hwmtakeoffon by Demin';
  21. var string_upd = /92599=(\d+\.\d+)/;
  22.  
  23. var url_cur = location.href;
  24. var url = 'http://'+location.hostname+'/';
  25.  
  26. try {
  27.  
  28. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  29. this.GM_getValue=function (key,def) {
  30. return localStorage[key] || def;
  31. };
  32. this.GM_setValue=function (key,value) {
  33. return localStorage[key]=value;
  34. };
  35. this.GM_deleteValue=function (key) {
  36. return delete localStorage[key];
  37. };
  38. }
  39.  
  40. var unsafe = browserInit();
  41. var show_arts_by_cat_old = unsafe.show_arts_by_cat;
  42. var isInit = false;
  43. unsafe.show_arts_by_cat = function(cat, r) {
  44. show_arts_by_cat_old(cat, r);
  45. isInit = true;
  46. setTimeout(function() {
  47. if(isInit) {
  48. initAll(true);
  49. }
  50. isInit = false;
  51. }, 500);
  52. }
  53. unsafe.show_c();
  54.  
  55. dressid_regexp = /art_id=(\d+)/
  56. transed_regexp = /art_transfer.php\?id=(\d+)/
  57. returned_regexp = /inventory.php\?art_return=(\d+)/
  58. prochka_regexp = /<li>\u041f\u0440\u043e\u0447\u043d\u043ec\u0442\u044c: (\d+)\/(\d+)/
  59. prochka_regexp2 = /<li>\u041f\u0440\u043e\u0447\u043d\u043ec\u0442\u044c: <font color="red">(\d+)<\/font>\/(\d+)/
  60.  
  61. var trans=[];
  62. var snart=[];
  63. for(var i=0x410;i<=0x44F;i++)
  64. {
  65. trans[i]=i-0x350;
  66. snart[i-0x350] = i;
  67. }
  68. trans[0x401]= 0xA8;
  69. trans[0x451]= 0xB8;
  70. snart[0xA8] = 0x401;
  71. snart[0xB8] = 0x451;
  72.  
  73. urlencode = function(str)
  74. {
  75. var ret=[];
  76. for(var i=0;i<str.length;i++)
  77. {
  78. var n=str.charCodeAt(i);
  79. if(typeof trans[n]!='undefined')
  80. n = trans[n];
  81. if (n <= 0xFF)
  82. ret.push(n);
  83. }
  84.  
  85. return escape(String.fromCharCode.apply(null,ret));
  86. }
  87.  
  88. urldecode = function(str)
  89. {
  90. var ret=[];
  91. str = unescape(str);
  92. for(var i=0;i<str.length;i++)
  93. {
  94. var n=str.charCodeAt(i);
  95. if(typeof snart[n]!='undefined')
  96. n = snart[n];
  97. ret.push(n);
  98. }
  99. return String.fromCharCode.apply(null,ret);
  100. }
  101.  
  102.  
  103.  
  104. var sign_a = getI( "//a[contains(@href, 'sign=')]" ).snapshotItem(0) ;
  105. sign_regexp = /sign=(.+)/ ;
  106. if(sign_a) {
  107. sign = sign_regexp.exec( sign_a.href )[1] ;
  108. } else {
  109. sign_regexp = /&sign=([^']+)/;
  110. for(var i in unsafeWindow.arts1) {
  111. var sign = sign_regexp.exec( unsafeWindow.arts1[i] );
  112. if(sign) {
  113. sign = sign[1];
  114. break;
  115. }
  116. }
  117.  
  118. }
  119.  
  120. var trade_a = getI( "//a[contains(@href, 'trade_cancel.php')]" ).snapshotItem(0) ;
  121. if( trade_a )
  122. {
  123. trade_tr = document.createElement( 'tr' )
  124. trade_td = document.createElement( 'td' )
  125. trade_td.setAttribute( "colspan" , 2 ) ;
  126. trade_td.setAttribute( "align" , "right" ) ;
  127. trade_td.innerHTML = '<a href="javascript:void(0);" id="trade_cancel"><b>\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0412\u0441\u0435</b>'
  128. trade_tr.appendChild( trade_td )
  129. trade_a.parentNode.parentNode.parentNode.appendChild( trade_tr )
  130. $("trade_cancel").addEventListener( "click", trade_cancel , false );
  131. }
  132.  
  133. var kukla_tbl = getI( "//table[contains(@background, 'i/kukla')]" ).snapshotItem(0) ;
  134. if( kukla_tbl )
  135. {
  136. o1 = kukla_tbl.parentNode.parentNode.parentNode ;
  137.  
  138. tr = document.createElement( 'tr' );
  139. td = document.createElement( 'td' );
  140. td.className = 'wb' ;
  141. td.setAttribute( 'colspan' , 2 ) ;
  142. td.setAttribute( 'align' , 'center' ) ;
  143.  
  144. var btsend = '' ;
  145. if( GM_getValue( "setbtsend" ) && GM_getValue( "setbtsend" ) == 1 )
  146. {
  147. btsend = '<input type="submit" id="trans_send" value="\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c" title="\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 1 \u0437\u043e\u043b\u043e\u0442\u043e\u0439"> '
  148. }
  149.  
  150. td.innerHTML = '<style>#thistf A{text-decoration:none;font-size:10px;} #thistf A:hover{color:#00f;}</style><form action="" method="POST" onSubmit="return false;"><table width="100%"><tr><td colspan="8" style="font-size:10px;border-bottom:1px solid #592C08;" align="center" id="thistf"><div style="float:right;margin:0 5px;cursor:pointer;font-weight:bold;" title="\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438" id="jsset">?</div></td></tr><tr><td>\u0418\u043c\u044f</td><td>\u0414\u043d\u0438</td><td><a href="javascript:void(0);" id="day_1_battle">\u0411\u043e\u0438</a></td><td id="tsum0">1\u0437</td><td id="tsum1">\u04261</td><td id="tsum2">\u04262</td><td id="tsum3">\u04263</td><td id="tsum4">\u0412\u041f</td><td></td></tr><tr><td><input id="trans_nick" name="trans_nick" value="" size="15"></td><td><input id="trans_time" value=0 size="1"></td><td><input id="trans_count" value=1 size="1"></td><td><input type="radio" name="sum" checked="true" value="0" id="sum0"></td><td><input type="radio" name="sum" value="1" id="sum1"></td><td><input type="radio" name="sum" value="2" id="sum2"></td><td><input type="radio" name="sum" value="3" id="sum3"></td><td><input type="radio" name="sum" value="4" id="sum4"></td></tr><tr><td colspan="8" align="right"><span id="place4return"></span>'+btsend+'<input type="submit" id="trans_rem" value="\u0420\u0435\u043c\u043e\u043d\u0442" title="\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0430 \u0440\u0435\u043c\u043e\u043d\u0442 \u0437\u0430 1 \u0437\u043e\u043b\u043e\u0442\u043e\u0439"> <input type="submit" id="trans_a" value="\u0410\u0440\u0435\u043d\u0434\u0430" title="\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0435\u043d\u0434\u0443"></td></tr></table></form>' ;
  151. tr.appendChild( td ) ;
  152. o1.insertBefore( tr , o1.firstChild.nextSibling )
  153.  
  154. if( ( type_sum = GM_getValue( "hwm_takeoffon_type_sum" ) ) )
  155. {
  156. $('sum'+type_sum).setAttribute( "checked", "on" ) ;
  157. $('tsum'+type_sum).style.fontWeight = "bold"
  158. $('tsum'+type_sum).style.color = "#ff0000"
  159. if (type_sum==2 || type_sum==4) {$('trans_count').value=0}
  160. else {$('trans_count').value=1}
  161. }
  162.  
  163. $('sum0').addEventListener( "click", set_type_sum , false );
  164. $('sum1').addEventListener( "click", set_type_sum , false );
  165. $('sum2').addEventListener( "click", set_type_sum , false );
  166. $('sum3').addEventListener( "click", set_type_sum , false );
  167. $('sum4').addEventListener( "click", set_type_sum , false );
  168.  
  169. $("trans_a").addEventListener( "click", trans_on , false );
  170. $("trans_rem").addEventListener( "click", trans_rem , false );
  171. if( btsend != '' )
  172. $("trans_send").addEventListener( "click", trans_send , false );
  173. $("day_1_battle").addEventListener( "click", daybattle_form , false );
  174.  
  175. $("jsset").addEventListener( "click", setting , false );
  176.  
  177. //+ пїЅпїЅпїЅпїЅпїЅпїЅ "пїЅпїЅпїЅпїЅпїЅпїЅпїЅ"
  178. var return_a = getI( "//a[contains(@href, 'inventory.php?art_return=')]" ).snapshotItem(0);
  179. if( return_a )
  180. {
  181. $("place4return").innerHTML='<input type="button" id="return_inp" value="\u0412\u0435\u0440\u043d\u0443\u0442\u044c"> ';
  182. $("return_inp").addEventListener( "click", return_go , false );
  183. }
  184.  
  185. tr = document.createElement( 'tr' );
  186. td = document.createElement( 'td' );
  187. td.className = 'wb' ;
  188. td.setAttribute( 'colspan' , 2 ) ;
  189. td.setAttribute( 'align' , 'center' ) ;
  190. td.innerHTML = '<b>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438:</b>' ;
  191. tr.appendChild( td ) ;
  192. o1.insertBefore( tr , o1.firstChild.nextSibling )
  193. //-
  194.  
  195. }
  196.  
  197.  
  198. var price_List = new Array();
  199.  
  200. setInterval(function() {
  201. var anchors = document.getElementsByTagName('a');
  202. for( var i = 0; i < anchors.length; i++ )
  203. {
  204. var el = anchors[i];
  205. if( el.href.indexOf('art_transfer.php' ) > -1 )
  206. {
  207. params = transed_regexp.exec( el.href ) ;
  208. art_id = params[1] ;
  209.  
  210. if( ( price_art_id = GM_getValue( "hwm_takeoffon_price_"+art_id ) ) && price_art_id.indexOf( ';0;0;0;0;' ) < 0 )
  211. {
  212. price_List[art_id] = {fontWeight: 'bold', color: '#006400'};
  213. } else if( ( price_art_name = GM_getValue( "hwm_takeoffon_price_"+name ) ) && price_art_name.indexOf( ';0;0;0;0;' ) < 0 )
  214. {
  215. price_List[art_id] = {fontWeight: 'bold', color: '#4169E1'};
  216. } else
  217. {
  218. price_List[art_id] = {color: '#808080'};
  219. }
  220. }
  221. }
  222. }, 400);
  223.  
  224. var tables = document.getElementsByTagName('table');
  225. for( var i = 0; i < tables.length; i++ )
  226. {
  227. var tbl = tables[i];
  228. var bg = tbl.getAttribute("background") ;
  229. if( bg && bg.match( /i\/kukla/ ) )
  230. {
  231. var a = document.createElement( 'a' );
  232. a.href = 'javascript:void(0);' ;
  233. a.title = '\u041e\u0434\u0435\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0449\u0438' ;
  234. a.addEventListener( "click", pull_on , false );
  235. a.appendChild( document.createTextNode( '\u041d\u0430\u0434\u0435\u0442\u044c' ) ) ;
  236. tbl.parentNode.appendChild( a );
  237.  
  238. tbl.parentNode.appendChild( document.createTextNode( ' / ' ) ) ;
  239.  
  240. a1 = document.createElement( 'a' );
  241. a1.href = 'javascript: void(0)' ;
  242. a1.setAttribute( 'count' , 1 ) ;
  243. a1.title = '\u0426\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 \u0437\u0430 1 \u0431\u043e\u0439' ;
  244. a1.addEventListener( "click", pull_sum , false );
  245. a1.appendChild( document.createTextNode( '\u0426\u0435\u043d\u0430 1' ) ) ;
  246. tbl.parentNode.appendChild( a1 );
  247.  
  248. tbl.parentNode.appendChild( document.createTextNode( ' / ' ) ) ;
  249.  
  250. a0 = document.createElement( 'a' );
  251. a0.href = 'javascript: void(0)' ;
  252. a0.setAttribute( 'count' , 0 ) ;
  253. a0.title = '\u0426\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430' ;
  254. a0.addEventListener( "click", pull_sum , false );
  255. a0.appendChild( document.createTextNode( '\u0426\u0435\u043d\u0430' ) ) ;
  256. tbl.parentNode.appendChild( a0 )
  257. }
  258. }
  259.  
  260.  
  261.  
  262. var items =
  263. {
  264. // [ пїЅпїЅпїЅпїЅпїЅпїЅ , пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ, пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ ]
  265.  
  266. // пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  267. leatherhelm: [ 30 , 1860 , 1900 ] ,
  268. magehat: [ 35 , 4800 , 4945 ] ,
  269. knowledgehat: [ 25 , 5800 , 5880 ] ,
  270. chaincoif: [ 40 , 4620 , 4740 ] ,
  271. steel_helmet: [ 70 , 11040 , 11365 ] ,
  272. mage_helm: [ 50 , 17200 , 17475 ] ,
  273. mif_lhelmet: [ 70 , 15760 , 15760 ] ,
  274.  
  275. // пїЅпїЅ пїЅпїЅпїЅ
  276. braverymedal: [ 25 , 1660 , 1695 ] ,
  277. lucknecklace: [ 25 , 2860 , 2930 ] ,
  278. power_pendant: [ 60 , 22200 , 22200 ] ,
  279. warrior_pendant: [ 50 , 24200 , 24200 ] ,
  280. magic_amulet: [ 50 , 25200 , 25200 ] ,
  281.  
  282. // пїЅпїЅ пїЅпїЅпїЅпїЅ
  283. leathershield: [ 25 , 780 , 970 ] ,
  284. chainarmor: [ 40 , 6880 , 7140 ] ,
  285. ciras: [ 70 , 13400 , 13850 ] ,
  286. mage_armor: [ 50 , 27200 , 28210 ] ,
  287. mif_light: [ 70 , 18800 , 18800 ] ,
  288. full_plate: [ 75 , 27800 , 27800 ] ,
  289.  
  290. // пїЅпїЅпїЅпїЅпїЅ
  291. antifire_cape: [ 40 , 1000 , 40000 ] ,
  292. soulcape: [ 30 , 3580 , 4075 ] ,
  293. antiair_cape: [ 60 , 8800 , 9090 ] ,
  294. powercape: [ 40 , 24400 , 25470 ] ,
  295. antimagic_cape: [ 50 , 14880 , 14880 ] ,
  296.  
  297. // пїЅпїЅпїЅпїЅпїЅпїЅ
  298. woodensword: [ 7 , 400 , 400 ] ,
  299. onehandaxe: [ 25 , 860 , 850 ] ,
  300. steelsword: [ 30 , 1380 , 1550 ] ,
  301. def_sword: [ 40 , 3860 , 3890 ] ,
  302. dagger: [ 30 , 2720 , 2800 ] ,
  303. requitalsword: [ 40 , 7600 , 7880 ] ,
  304. staff: [ 40 , 9040 , 9350 ] ,
  305. broadsword: [ 60 , 14200 , 14680 ] ,
  306. long_bow: [ 50 , 19000 , 19000 ] ,
  307. power_sword: [ 80 , 29400 , 30570 ] ,
  308. sor_staff: [ 50 , 43400 , 43400 ] ,
  309. mif_sword: [ 70 , 49560 , 49560 ] ,
  310. mif_staff: [ 70 , 49280 , 49280 ] ,
  311. energy_scroll: [ 70 , 27200 , 27200 ] ,
  312.  
  313. // пїЅпїЅпїЅпїЅ
  314. roundshield: [ 7 , 300 , 300 ] ,
  315. protectshield: [ 40 , 3400 , 3445 ] ,
  316. dragon_shield: [ 70 , 26400 , 27450 ] ,
  317. large_shield: [ 70 , 28800 , 28800 ] ,
  318.  
  319. // пїЅпїЅпїЅпїЅпїЅ
  320. hunterboots: [ 30 , 2720 , 2800 ] ,
  321. initboots: [ 40 , 7160 , 7390 ] ,
  322. steel_boots: [ 70 , 17400 , 18045 ] ,
  323. mif_lboots: [ 55 , 21500 , 21500 ] ,
  324.  
  325. // пїЅпїЅ пїЅпїЅпїЅпїЅ
  326. eaglering: [ 18 , 4720 , 4890 ] ,
  327. necroring: [ 12 , 5720 , 5890 ] ,
  328. hastering: [ 30 , 5800 , 5890 ] ,
  329. circ_ring: [ 50 , 19560 , 20430 ] ,
  330. powerring: [ 40 , 21200 , 212000 ] ,
  331. darkring: [ 50 , 25200 , 25200 ] ,
  332. warriorring: [ 40 , 23100 , 23100 ] ,
  333.  
  334. // пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  335. bril_pendant: [ 50 , 70000 , 70000 ] ,
  336. flower_heart: [ 20 , 5000 , 5000 ] ,
  337. half_heart_m: [ 25 , 15000 , 15000 ] ,
  338. half_heart_w_b: [ 25 , 15000 , 15000 ] ,
  339. defender_dagger: [ 15 , 4000 , 4000 ] ,
  340. flowers1: [ 10 , 1000 , 1000 ] ,
  341. flowers2: [ 10 , 1000 , 1000 ] ,
  342. flowers3: [ 15 , 10000 , 10000 ] ,
  343. bril_ring: [ 40 , 100000 , 100000 ] ,
  344. d_spray: [ 15 , 10000 , 10000 ] ,
  345. protazan: [ 40 , 25000 , 25000 ] ,
  346. goldciras: [ 50 , 40000 , 40000 ] ,
  347. }
  348.  
  349. } finally { update_n() }
  350.  
  351. function pre() {
  352. if(unsafeWindow && unsafeWindow.console && unsafeWindow.console.log) {
  353. unsafeWindow.console.log(arguments);
  354. }
  355. }
  356. function browserInit() {
  357. var ua = navigator.userAgent.toLowerCase();
  358.  
  359. var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
  360. /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
  361. /(msie) ([\w.]+)/.exec( ua ) ||
  362. !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
  363. [];
  364.  
  365. if(match[1]!='mozilla') {
  366.  
  367. GM_xmlhttpRequest = function (details) {
  368. var xmlhttp = new XMLHttpRequest();
  369. xmlhttp.onreadystatechange = function() {
  370. var responseState = {
  371. responseXML:(xmlhttp.readyState==4 ? xmlhttp.responseXML : ''),
  372. responseText:(xmlhttp.readyState==4 ? xmlhttp.responseText : ''),
  373. readyState:xmlhttp.readyState,
  374. responseHeaders:(xmlhttp.readyState==4 ? xmlhttp.getAllResponseHeaders() : ''),
  375. status:(xmlhttp.readyState==4 ? xmlhttp.status : 0),
  376. statusText:(xmlhttp.readyState==4 ? xmlhttp.statusText : '')
  377. }
  378. if (details["onreadystatechange"]) {
  379. details["onreadystatechange"](responseState);
  380. }
  381. if (xmlhttp.readyState==4) {
  382. if (details["onload"] && xmlhttp.status>=200 && xmlhttp.status<300) {
  383. details["onload"](responseState);
  384. }
  385. if (details["onerror"] && (xmlhttp.status<200 || xmlhttp.status>=300)) {
  386. details["onerror"](responseState);
  387. }
  388. }
  389. }
  390. try {
  391. //cannot do cross domain
  392. xmlhttp.open(details.method, details.url);
  393. } catch(e) {
  394. if( details["onerror"] ) {
  395. //simulate a real error
  396. details["onerror"]({responseXML:'',responseText:'',readyState:4,responseHeaders:'',status:403,statusText:'Forbidden'});
  397. }
  398. return;
  399. }
  400. if (details.headers) {
  401. for (var prop in details.headers) {
  402. xmlhttp.setRequestHeader(prop, details.headers[prop]);
  403. }
  404. }
  405. xmlhttp.send((typeof(details.data)!='undefined')?details.data:null);
  406. }
  407. return window;
  408. } else {
  409. return unsafeWindow;
  410. }
  411. }//
  412.  
  413. function initAll(isTrue) {
  414. var anchors = document.getElementsByTagName('a');
  415. for( var i = 0; i < anchors.length; i++ )
  416. {
  417. var el = anchors[i];
  418.  
  419. if( el.href.indexOf('art_transfer.php' ) > -1 )
  420. //+ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ "пїЅпїЅпїЅпїЅ", пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅ
  421. {
  422. params = transed_regexp.exec( el.href ) ;
  423. art_id = params[1] ;
  424.  
  425. price_a = document.createElement( 'a' );
  426. price_a.innerHTML = '\u0446\u0435\u043d\u044b' ;
  427. price_a.setAttribute( "art_id" , art_id )
  428. price_a.id = "id_price_a"+art_id;
  429. price_a.href = 'javascript:void(0);' ;
  430. price_a.addEventListener( "click", price_form , false );
  431.  
  432. // пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ + пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  433. need = el.parentNode.parentNode.parentNode.parentNode.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild
  434. // пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  435. title = need.innerHTML.split('<b>')[1].split('</b>')[0] ;
  436. // пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ (пїЅпїЅпїЅ)
  437. name = need.innerHTML.split('id=')[1].split('"><b>')[0].split('&')[0]
  438.  
  439. price_a.setAttribute( "art_name" , name )
  440. price_a.setAttribute( "art_title" , title )
  441.  
  442. // пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  443. if (prochka_regexp.exec( el.parentNode.parentNode.parentNode.parentNode.firstChild.nextSibling.firstChild.innerHTML )){
  444. art_pr = prochka_regexp.exec( el.parentNode.parentNode.parentNode.parentNode.firstChild.nextSibling.firstChild.innerHTML )
  445. }
  446. else {
  447. art_pr = prochka_regexp2.exec( el.parentNode.parentNode.parentNode.parentNode.firstChild.nextSibling.firstChild.innerHTML )
  448. }
  449. price_a.setAttribute( "art_pr" , art_pr[2] )
  450.  
  451. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  452. need1 = el.parentNode.parentNode.parentNode.parentNode.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.lastChild;
  453. need1.style.cssText = 'white-space: nowrap;';
  454. //td = document.createElement( 'td' );
  455. //td.style.textAlign="right";
  456. //td.style.width="100%";
  457. //td.style.paddingRight="10px";
  458. //need1.insertBefore( td , need1.firstChild.nextSibling ) ;
  459.  
  460. sp = document.createElement( 'span' );
  461. sp.id = "span_dress_id_" + art_id ;
  462. need1.appendChild( sp ) ;
  463.  
  464. inp = document.createElement( 'input' );
  465. inp.type = "checkbox" ;
  466. inp.name = "dress_id" ;
  467. inp.value = art_id ;
  468. inp.id = "dress_id_" + art_id ;
  469. inp.setAttribute( 'art_pr' , art_pr[1] )
  470. inp.checked = false ;
  471. need1.insertBefore( inp , need1.firstChild.nextSibling ) ;
  472.  
  473. //- пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  474.  
  475. if( ( price_art_id = GM_getValue( "hwm_takeoffon_price_"+art_id ) ) && price_art_id.indexOf( ';0;0;0;0;' ) < 0 )
  476. {
  477. price_a.style.fontWeight = "bold"
  478. price_a.style.color = "#006400"
  479. } else if( ( price_art_name = GM_getValue( "hwm_takeoffon_price_"+name ) ) && price_art_name.indexOf( ';0;0;0;0;' ) < 0 )
  480. {
  481. price_a.style.fontWeight = "bold"
  482. price_a.style.color = "#4169E1"
  483. } else
  484. {
  485. price_a.style.color = "#808080"
  486. /*if(price_List[art_id] && price_List[art_id].color) {
  487. price_a.style.color = price_List[art_id].color;
  488. }
  489. if(price_List[art_id] && price_List[art_id].fontWeight) {
  490. price_a.style.fontWeight = price_List[art_id].fontWeight;
  491. }*/
  492. }
  493.  
  494. el.parentNode.insertBefore( price_a , el.nextSibling ) ;
  495. el.parentNode.insertBefore( document.createTextNode( ' : ' ) , el.nextSibling ) ;
  496. //-
  497. } else if( el.href.indexOf( 'art_return=' ) > -1 )
  498. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ
  499. {
  500. params = returned_regexp.exec( el.href ) ;
  501. art_id = params[1] ;
  502. need1 = el.parentNode.parentNode.parentNode.parentNode.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling
  503. td = document.createElement( 'td' );
  504. td.style.textAlign="right";
  505. td.style.width="100%";
  506. td.style.paddingRight="10px";
  507. need1.insertBefore( td , need1.firstChild.nextSibling ) ;
  508.  
  509. sp = document.createElement( 'span' );
  510. sp.id = "span_dress_id_" + art_id ;
  511. td.appendChild( sp ) ;
  512.  
  513. inp = document.createElement( 'input' );
  514. inp.type = "checkbox" ;
  515. inp.name = "dress_id" ;
  516. inp.value = art_id ;
  517. inp.id = "dress_id_" + art_id ;
  518. // inp.setAttribute( 'art_pr' , art_pr[1] )
  519. inp.checked = false ;
  520. td.appendChild( inp ) ;
  521. //-
  522. }
  523. }
  524. }
  525.  
  526. //+ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  527. function pull_sum()
  528. {
  529. var item_regexp = /\/(\w+)_s.jpg/ ;
  530. s = 0 ;
  531. for( var i = 0; i < anchors.length; i++ )
  532. {
  533. var el = anchors[i];
  534. if( el.href.match(/inventory.php\?pull_off=/) )
  535. {
  536. p = item_regexp.exec( el.innerHTML ) ;
  537. item = eval( 'items.' + p[1] ) ;
  538. // 35% пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ, пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 65%
  539. if( item ) s += Math.floor( this.getAttribute( 'count' ) == 1 ? ( item[2] - item[1]*0.65 ) / item[0] : item[2] ) ;
  540. }
  541. }
  542. alert( s ) ;
  543. return false;
  544. }
  545. //-
  546.  
  547. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  548. function set_type_sum()
  549. {
  550. if( ( old = GM_getValue( "hwm_takeoffon_type_sum" ) ) )
  551. {
  552. $("tsum"+old).style.fontWeight = "normal"
  553. $('tsum'+old).style.color = "#592C08"
  554. }
  555.  
  556. GM_setValue( "hwm_takeoffon_type_sum" , this.value );
  557. $("tsum"+this.value).style.fontWeight = "bold"
  558. $('tsum'+this.value).style.color = "#ff0000"
  559.  
  560. if (this.value==2 || this.value==4) {$('trans_count').value=0}
  561. else {$('trans_count').value=1}
  562. }
  563. //-
  564.  
  565. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  566. returned = false ;
  567. function return_go()
  568. {
  569. var need_a = getI( "//a[contains(@href, 'inventory.php?art_return=')]" ) ;
  570. returned_regexp = /art_return=(\d+)/
  571. for( var i=0; i<need_a.snapshotLength; i++)
  572. {
  573. var this_a = need_a.snapshotItem(i);
  574. var art_id = returned_regexp.exec( this_a.href ) ;
  575.  
  576. if( $("dress_id_"+art_id[1]) && $("dress_id_"+art_id[1]).type == "checkbox" && $("dress_id_"+art_id[1]).checked )
  577. {
  578. returned = true ;
  579. $("span_dress_id_"+art_id[1]).innerHTML = loader ;
  580. GM_xmlhttpRequest
  581. ({
  582. method:"GET",
  583. url: this_a.href ,
  584. onload:function(res)
  585. {
  586. $("dress_id_"+art_id[1]).type = "radio" ;
  587. $("dress_id_"+art_id[1]).selected = true ;
  588. return_go() ;
  589. }
  590. });
  591. return;
  592. }
  593. }
  594. if( returned ) window.location.href = url_cur ;
  595. }
  596. //-
  597.  
  598. //+ пїЅпїЅпїЅпїЅпїЅпїЅ
  599. dressed = false ;
  600. function pull_on()
  601. {
  602. var inputs = document.getElementsByTagName('input');
  603. for( var i = 0; i < inputs.length; i++ )
  604. {
  605. var inp = inputs[i];
  606. if( inp.type == "checkbox" && inp.name == "dress_id" && inp.checked )
  607. {
  608. dressed = true ;
  609. document.getElementById("span_dress_id_"+inp.value).innerHTML = loader ;
  610. GM_xmlhttpRequest
  611. ({
  612. method:"GET",
  613. url: url+"inventory.php?dress="+inp.value,
  614. onload:function(res)
  615. {
  616. inp.type = "radio" ;
  617. inp.selected = true ;
  618. document.getElementById("span_dress_id_"+inp.value).innerHTML = '' ;
  619. pull_on() ;
  620. }
  621. });
  622. return;
  623. }
  624. }
  625. if( dressed ) window.location.href = url_cur ;
  626. }
  627. //-
  628.  
  629. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  630. traded = false ;
  631. function trade_cancel()
  632. {
  633. var inputs = document.getElementsByTagName('a');
  634. for( var i = 0; i < inputs.length; i++ )
  635. {
  636. var inp = inputs[i];
  637. if( inp.href.indexOf( 'trade_cancel.php' ) > -1 )
  638. {
  639. traded = true ;
  640. inp.parentNode.innerHTML = loader ;
  641. GM_xmlhttpRequest
  642. ({
  643. method:"GET",
  644. url: inp.href ,
  645. onload:function(res)
  646. {
  647. trade_cancel() ;
  648. }
  649. });
  650. return;
  651. }
  652. }
  653. if( traded ) window.location.href = url_cur ;
  654. }
  655. //-
  656.  
  657. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  658. transed = false ;
  659. function trans_on()
  660. {
  661. var inputs = document.getElementsByTagName('input');
  662.  
  663. // пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  664. if( $('sum1') && $('sum1').checked )
  665. {
  666. gold = 1 ;
  667. } else if( $('sum2') && $('sum2').checked )
  668. {
  669. gold = 2 ;
  670. } else if( $('sum3') && $('sum3').checked )
  671. {
  672. gold = 3 ;
  673. } else if( $('sum4') && $('sum4').checked )
  674. {
  675. gold = 4 ;
  676. } else
  677. {
  678. gold = 0 ;
  679. }
  680.  
  681. // пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  682. var day_time = 0 ;
  683.  
  684. if( gold == 4 || gold == 2 )
  685. // пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ, пїЅпїЅ 30 пїЅпїЅпїЅпїЅ
  686. {
  687. day_time = 60 ;
  688. if( $('trans_time') && $('trans_time').value != 0 )
  689. {
  690. day_time = $('trans_time').value
  691. day_time = day_time.split(',').join('.')
  692. }
  693. } else if( $('trans_time') && $('trans_time').value != 0 )
  694. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅ
  695. {
  696. var day_time = $('trans_time').value
  697. day_time = day_time.split(',').join('.')
  698. } else if( ( day1battle = GM_getValue( "hwm_takeoffon_day1battle" ) ) )
  699. // пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  700. {
  701. var days = day1battle.split(';') ;
  702. if( days[$('trans_count').value] )
  703. {
  704. day_time = days[$('trans_count').value]
  705. day_time = day_time.split(',').join('.')
  706. }
  707. else
  708. day_time = 0
  709. }
  710. for( var i = 0; i < inputs.length; i++ )
  711. {
  712. var inp = inputs[i];
  713. if( inp.type == "checkbox" && inp.name == "dress_id" && inp.checked )
  714. {
  715. transed = true ;
  716. var art_id = inp.value ;
  717.  
  718. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  719. if( (gold == 4 || gold == 2) && $('trans_count').value==0 )
  720. // пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  721. {
  722. bcount = inp.getAttribute( 'art_pr' )
  723. } else
  724. {
  725. bcount = $('trans_count').value
  726. }
  727. //- пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  728.  
  729. if( gold == 0 )
  730. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ 1пїЅ
  731. {
  732. sum = 1
  733. } else
  734. {
  735. if( ( price = GM_getValue( "hwm_takeoffon_price_"+art_id ) ) && price.indexOf( ';0;0;0;0;' ) < 0 )
  736. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅ
  737. {
  738. price_arr = price.split(';');
  739. sum0 = price_arr[gold]
  740. } else if( $("id_price_a"+art_id) && ( art_name = $("id_price_a"+art_id).getAttribute( "art_name" ) ) && ( price = GM_getValue( "hwm_takeoffon_price_"+art_name ) ) && price.indexOf( ';0;0;0;0;' ) < 0 )
  741. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅ
  742. {
  743. price_arr = price.split(';');
  744. sum0 = price_arr[gold]
  745. } else
  746. {
  747. sum0 = 1
  748. }
  749. sumN = sum0 * ( bcount > 0 ? bcount : 1 )
  750.  
  751. // sum = sumN + Math.max( 1 , Math.round( sumN * 0.01 ) )
  752. if( GM_getValue( "setnalog" ) && GM_getValue( "setnalog" ) == 1 && sumN > 0 )
  753. sum = Math.max( 1 , Math.round( sumN / 0.99 ) )
  754. else
  755. sum = sumN
  756. }
  757. if (sum > 0) {
  758. $("span_dress_id_"+art_id).innerHTML = loader ;
  759.  
  760. GM_xmlhttpRequest
  761. ({
  762. method:"POST",
  763. url: url+"/art_transfer.php" ,
  764. headers:
  765. {
  766. 'Content-Type' : 'application/x-www-form-urlencoded' ,
  767. 'Referer' : url+'/art_transfer.php?id='+art_id ,
  768. },
  769. data: 'id='+art_id+'&nick='+urlencode($('trans_nick').value)+'&gold='+sum+'&wood=0&ore=0&mercury=0&sulphur=0&crystal=0&gem=0&sendtype=2&dtime='+day_time+'&bcount='+bcount+'&art_id=&sign='+sign ,
  770. onload:function(res)
  771. {
  772. inp.type = "radio" ;
  773. inp.selected = true ;
  774. $("span_dress_id_"+art_id).innerHTML = '' ;
  775. trans_on() ;
  776. }
  777. });
  778. return;
  779. }
  780. else
  781. {
  782. alert(art_name+' \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d');
  783. inp.type = "radio" ;
  784. inp.selected = true ;
  785. }
  786. }
  787. }
  788. if( transed ) window.location.href = url_cur ;
  789. }
  790. //-
  791.  
  792. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  793. function trans_rem()
  794. {
  795. var inputs = document.getElementsByTagName('input');
  796. for( var i = 0; i < inputs.length; i++ )
  797. {
  798. var inp = inputs[i];
  799. if( inp.type == "checkbox" && inp.name == "dress_id" && inp.checked )
  800. {
  801. transed = true ;
  802. var art_id = inp.value ;
  803. $("span_dress_id_"+art_id).innerHTML = loader ;
  804. GM_xmlhttpRequest
  805. ({
  806. method: "POST" ,
  807. url: url+"/art_transfer.php" ,
  808. headers:
  809. {
  810. 'Content-Type' : 'application/x-www-form-urlencoded' ,
  811. 'Referer' : url+'/art_transfer.php?id='+art_id ,
  812. },
  813.  
  814. data: 'id='+art_id+'&nick='+urlencode($('trans_nick').value)+'&gold=1&wood=0&ore=0&mercury=0&sulphur=0&crystal=0&gem=0&sendtype=2&dtime=0.004&bcount=0&rep=on&art_id=&sign='+sign ,
  815. onload:function(res)
  816. {
  817. inp.type = "radio" ;
  818. inp.selected = true ;
  819. $("span_dress_id_"+art_id).innerHTML = '' ;
  820. trans_rem() ;
  821. }
  822. });
  823. return;
  824. }
  825. }
  826. if( transed ) window.location.href = url_cur ;
  827. }
  828. //-
  829.  
  830. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ (1пїЅ)
  831. function trans_send()
  832. {
  833. var inputs = document.getElementsByTagName('input');
  834. for( var i = 0; i < inputs.length; i++ )
  835. {
  836. var inp = inputs[i];
  837. if( inp.type == "checkbox" && inp.name == "dress_id" && inp.checked )
  838. {
  839. transed = true ;
  840. var art_id = inp.value ;
  841. $("span_dress_id_"+art_id).innerHTML = loader ;
  842. GM_xmlhttpRequest
  843. ({
  844. method: "POST" ,
  845. url: url+"/art_transfer.php" ,
  846. headers:
  847. {
  848. 'Content-Type' : 'application/x-www-form-urlencoded' ,
  849. 'Referer' : url+'/art_transfer.php?id='+art_id ,
  850. },
  851.  
  852. data: 'id='+art_id+'&nick='+urlencode($('trans_nick').value)+'&gold=1&wood=0&ore=0&mercury=0&sulphur=0&crystal=0&gem=0&sendtype=1&dtime=0&bcount=0&art_id=&sign='+sign ,
  853. onload:function(res)
  854. {
  855. inp.type = "radio" ;
  856. inp.selected = true ;
  857. $("span_dress_id_"+art_id).innerHTML = '' ;
  858. trans_send() ;
  859. }
  860. });
  861. return;
  862. }
  863. }
  864. if( transed ) window.location.href = url_cur ;
  865. }
  866. //-
  867.  
  868. //+ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ
  869. function daybattle_form()
  870. {
  871. bg = $('bgOverlay') ;
  872. bgc = $('bgCenter') ;
  873. if( !bg )
  874. {
  875. bg = document.createElement('div') ;
  876. bg.id = 'bgOverlay' ;
  877. document.body.appendChild( bg );
  878. bg.style.position = 'absolute' ;
  879. bg.style.left = '0';
  880. bg.style.width = '100%';
  881. bg.style.background = "#000000";
  882. bg.style.opacity = "0.5";
  883. bg.addEventListener( "click", form_close , false );
  884.  
  885. bgc = document.createElement('div') ;
  886. bgc.id = 'bgCenter' ;
  887. document.body.appendChild( bgc );
  888. bgc.style.position = 'absolute' ;
  889. bgc.style.width = '400px';
  890. bgc.style.background = "#F6F3EA";
  891. bgc.style.left = ( ( document.body.offsetWidth - 400 ) / 2 ) + 'px' ;
  892. }
  893.  
  894. /*
  895. var day1battle = GM_getValue( "hwm_takeoffon_day1battle" ).split(';') ;
  896. if( !day1battle ) day1battle = new Array();
  897. */
  898. var day1battle_ = GM_getValue( "hwm_takeoffon_day1battle" ) ;
  899. if( !day1battle_ )
  900. day1battle = new Array();
  901. else
  902. day1battle = day1battle_.split(';')
  903.  
  904. var form = '<div style="border:1px solid #abc;padding:5px;margin:2px;"><div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_close" title="Close">x</div><center><table><tr><td colspan="4"><b>\u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0431\u043e\u0438 \u0432 \u0434\u043d\u044f\u0445 (1 \u0447\u0430\u0441 ~ 0,042 \u0434\u043d\u044f)</b></td></tr>'
  905. for( var i=1;i<11;i++)
  906. {
  907. form += '<tr>'+
  908. '<td>'+i+'</td><td><input id="day_cnt'+i+'" size="5" value="'+( day1battle[i] ? day1battle[i] : 0 )+'"></td>'+
  909. '<td>'+(10+i)+'</td><td><input id="day_cnt'+(10+i)+'" size="5" value="'+( day1battle[10+i] ? day1battle[10+i] : 0 )+'"></td>'+
  910. '</tr>'
  911. }
  912. form += '<tr><td colspan="4" align="center"><input type="button" id="form_o" value="\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c"></td></tr></table></center></div>' ;
  913.  
  914. bgc.innerHTML = form
  915.  
  916. $("bt_close").addEventListener( "click", form_close , false );
  917. $('form_o').addEventListener( "click", daybattle_set , false );
  918.  
  919. bg.style.top = (-document.body.scrollTop)+'px';
  920. bg.style.height = ( document.body.offsetHeight + document.body.scrollTop ) +'px';
  921. bgc.style.top = ( document.body.scrollTop + 150 ) + 'px';
  922.  
  923. bg.style.display = bgc.style.display = 'block' ;
  924. }
  925. //-
  926.  
  927. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ
  928. function daybattle_set()
  929. {
  930. day1battle = '0;'
  931. for(var i=1;i<21;i++)
  932. {
  933. day1battle += ''+$('day_cnt'+i).value+';'
  934. }
  935. GM_setValue( "hwm_takeoffon_day1battle" , day1battle ) ;
  936. form_close() ;
  937. }
  938. //-
  939.  
  940. //+ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ
  941. function price_form()
  942. {
  943. title = this.getAttribute( "art_title" )
  944. name = this.getAttribute( "art_name" )
  945. art_id = this.getAttribute( "art_id" )
  946. art_pr = this.getAttribute( "art_pr" )
  947.  
  948. bg = $('bgOverlay') ;
  949. bgc = $('bgCenter') ;
  950.  
  951. if( !bg )
  952. {
  953. bg = document.createElement('div') ;
  954. bg.id = 'bgOverlay' ;
  955. document.body.appendChild( bg );
  956. bg.style.position = 'absolute' ;
  957. bg.style.left = '0';
  958. bg.style.width = '100%';
  959. bg.style.background = "#000000";
  960. bg.style.opacity = "0.5";
  961. bg.addEventListener( "click", form_close , false );
  962.  
  963. bgc = document.createElement('div') ;
  964. bgc.id = 'bgCenter' ;
  965. document.body.appendChild( bgc );
  966. bgc.style.position = 'absolute' ;
  967. bgc.style.width = '400px';
  968. bgc.style.background = "#F6F3EA";
  969. bgc.style.left = ( ( document.body.offsetWidth - 400 ) / 2 ) + 'px' ;
  970. }
  971.  
  972. var price_c1 = price_c2 = price_c3 = price_c4 = 0 ;
  973. var st_i = st_n = '' ;
  974. if( ( price = GM_getValue( "hwm_takeoffon_price_"+art_id ) ) && price.indexOf( ';0;0;0;0;' ) < 0 )
  975. {
  976. st_i = ' style="color:#006400;"'
  977. price_arr = price.split(';');
  978. price_c1 = price_arr[1]
  979. price_c2 = price_arr[2]
  980. price_c3 = price_arr[3]
  981. price_c4 = price_arr[4]
  982. } else if( ( price = GM_getValue( "hwm_takeoffon_price_"+name ) ) && price.indexOf( ';0;0;0;0;' ) < 0 )
  983. {
  984. st_n = ' style="color:#6495ED;"'
  985. price_arr = price.split(';');
  986. price_c1 = price_arr[1]
  987. price_c2 = price_arr[2]
  988. price_c3 = price_arr[3]
  989. price_c4 = price_arr[4]
  990. }
  991.  
  992. bgc.innerHTML = '<div style="border:1px solid #abc;padding:5px;margin:2px;"><div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_close" title="Close">x</div><center><table><tr><td colspan="2"><b id="art_title"'+st_i+'>'+title+'</b> <i id="art_name"'+st_n+'>('+name+')'+'</i></td></tr><tr><td>[\u04261] 1 \u0431\u043e\u0439</td><td><input id="art_c1" value="'+price_c1+'"></td></tr><tr><td>[\u04262] \u041e\u043f\u0442</td><td><input id="art_c2" value="'+price_c2+'"></td></tr><tr><td>[\u04263] \u041e\u0441\u043e\u0431\u0430\u044f&nbsp;</td><td><input id="art_c3" value="'+price_c3+'"></td></tr><tr><td>[\u0412\u041f] \u0412\u0441\u044f \u043f\u0440\u043e\u0447\u043a\u0430&nbsp;</td><td><input id="art_c4" value="'+price_c4+'"></td></tr><tr><td colspan="2" align="center"><input type="button" art_id="'+art_id+'" id="form_oi" value="\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e"> <input type="button" art_name="'+name+'" id="form_on" value="\u0412\u0441\u0435\u043c \u0442\u0430\u043a\u0438\u043c"></td></tr></table></center></div>' ;
  993.  
  994. $("bt_close").addEventListener( "click", form_close , false );
  995. $('form_oi').addEventListener( "click", price_set_id , false );
  996. $('form_on').addEventListener( "click", price_set_name , false );
  997.  
  998. bg.style.top = (-document.body.scrollTop)+'px';
  999. bg.style.height = ( document.body.offsetHeight + document.body.scrollTop ) +'px';
  1000. bgc.style.top = ( document.body.scrollTop + 150 ) + 'px';
  1001. bg.style.display = bgc.style.display = 'block' ;
  1002. $('art_c1').focus();
  1003. }
  1004. //-
  1005.  
  1006. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  1007. function form_close()
  1008. {
  1009. bg = $('bgOverlay') ;
  1010. bgc = $('bgCenter') ;
  1011. if( bg )
  1012. {
  1013. bg.style.display = bgc.style.display = 'none' ;
  1014. }
  1015. }
  1016. //-
  1017.  
  1018. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  1019. function price_set_id()
  1020. {
  1021. var art_id = this.getAttribute( "art_id" ) ;
  1022. price = $('art_title').innerHTML+';'+$('art_c1').value+';'+$('art_c2').value+';'+$('art_c3').value+';'+$('art_c4').value+';'
  1023. var price_old = GM_getValue( "hwm_takeoffon_price" ) ;
  1024. if( !price_old || price_old.indexOf( ';' + art_id + ';' ) < 0 )
  1025. {
  1026. price_new = ( price_old ? price_old : '' ) + ';' + art_id + ';' ;
  1027. GM_setValue( "hwm_takeoffon_price" , price_new ) ;
  1028. }
  1029. GM_setValue( "hwm_takeoffon_price_"+art_id , price ) ;
  1030.  
  1031. var price_a_obj = $("id_price_a"+art_id) ;
  1032. if( price.indexOf( ';0;0;0;0;' ) < 0 )
  1033. {
  1034. price_a_obj.style.fontWeight = "bold"
  1035. price_a_obj.style.color = "#006400"
  1036. } else
  1037. {
  1038. if( ( this_name = price_a_obj.getAttribute( 'art_name' ) ) && ( this_price = GM_getValue( "hwm_takeoffon_price_"+this_name ) ) && this_price.indexOf( ';0;0;0;0;' ) < 0 )
  1039. {
  1040. price_a_obj.style.fontWeight = "bold"
  1041. price_a_obj.style.color = "#6495ED"
  1042.  
  1043. } else
  1044. {
  1045. price_a_obj.style.color = "#808080" ;
  1046. price_a_obj.style.fontWeight = "normal"
  1047. }
  1048. }
  1049.  
  1050. form_close() ;
  1051. }
  1052. //-
  1053.  
  1054. //+ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅ
  1055. function price_set_name()
  1056. {
  1057. var art_name = this.getAttribute( "art_name" ) ;
  1058. price = $('art_title').innerHTML+';'+$('art_c1').value+';'+$('art_c2').value+';'+$('art_c3').value+';'+$('art_c4').value+';'
  1059. var price_old = GM_getValue( "hwm_takeoffon_price_name" ) ;
  1060. if( !price_old || price_old.indexOf( ';' + art_name + ';' ) < 0 )
  1061. {
  1062. price_new = ( price_old ? price_old : '' ) + ';' + art_name + ';' ;
  1063. GM_setValue( "hwm_takeoffon_price_name" , price_new ) ;
  1064. }
  1065. GM_setValue( "hwm_takeoffon_price_"+art_name , price ) ;
  1066.  
  1067. var need_a = getI( "//a[contains(@href, 'javascript:void(0);')]" ) ;
  1068. if( price.indexOf( ';0;0;0;0;' ) < 0 )
  1069. // пїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ-пїЅпїЅ пїЅпїЅ 0
  1070. {
  1071. for(var i=0; i < need_a.snapshotLength; i++)
  1072. // пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
  1073. {
  1074. this_a = need_a.snapshotItem(i);
  1075. if( ( this_id = this_a.getAttribute( 'art_id' ) ) && ( this_price = GM_getValue( "hwm_takeoffon_price_"+this_id ) ) && this_price.indexOf( ';0;0;0;0;' ) < 0 )
  1076. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ, пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  1077. {
  1078. } else if( ( this_name = this_a.getAttribute( 'art_name' ) ) && this_name == art_name )
  1079. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ
  1080. {
  1081. this_a.style.fontWeight = "bold"
  1082. this_a.style.color = "#6495ED"
  1083. }
  1084. }
  1085.  
  1086. } else
  1087. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ 0
  1088. {
  1089. for(var i=0; i < need_a.snapshotLength; i++)
  1090. {
  1091. this_a = need_a.snapshotItem(i);
  1092. if( ( this_id = this_a.getAttribute( 'art_id' ) ) && ( this_price = GM_getValue( "hwm_takeoffon_price_"+this_id ) ) && this_price.indexOf( ';0;0;0;0;' ) < 0 )
  1093. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ, пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  1094. {
  1095. } else if( ( this_name = this_a.getAttribute( 'art_name' ) ) && this_name == art_name )
  1096. // пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ
  1097. {
  1098. this_a.style.fontWeight = "normal"
  1099. this_a.style.color = "#808080"
  1100. }
  1101. }
  1102. }
  1103. form_close() ;
  1104. }
  1105. //-
  1106.  
  1107.  
  1108. //+ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ
  1109. function setting()
  1110. {
  1111. bg = $('bgOverlay') ;
  1112. bgc = $('bgCenter') ;
  1113. if( !bg )
  1114. {
  1115. bg = document.createElement('div') ;
  1116. bg.id = 'bgOverlay' ;
  1117. document.body.appendChild( bg );
  1118. bg.style.position = 'absolute' ;
  1119. bg.style.left = '0';
  1120. bg.style.width = '100%';
  1121. bg.style.background = "#000000";
  1122. bg.style.opacity = "0.5";
  1123. bg.addEventListener( "click", form_close , false );
  1124.  
  1125. bgc = document.createElement('div') ;
  1126. bgc.id = 'bgCenter' ;
  1127. document.body.appendChild( bgc );
  1128. bgc.style.position = 'absolute' ;
  1129. bgc.style.width = '400px';
  1130. bgc.style.background = "#F6F3EA";
  1131. bgc.style.left = ( ( document.body.offsetWidth - 400 ) / 2 ) + 'px' ;
  1132. }
  1133.  
  1134. bgc.innerHTML = '<div style="border:1px solid #abc;padding:5px;margin:2px;"><div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_close" title="Close">x</div><center><table><tr><td>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438</td></tr><tr><td><label for="chsetnalog" style="cursor:pointer;"><input type="checkbox" id="chsetnalog"> \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u043b\u043e\u0433 \u0432 1% \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u0430\u0440\u0435\u043d\u0434\u0443</label></td></tr><tr><td><label for="chsetbtsend" style="cursor:pointer;"><input type="checkbox" id="chsetbtsend"> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 "\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c"</label></td></tr></table></center></div>' ;
  1135.  
  1136. $("bt_close").addEventListener( "click", form_close , false );
  1137.  
  1138. var chsetnalog = $('chsetnalog')
  1139. chsetnalog.checked = ( GM_getValue( "setnalog" ) && GM_getValue( "setnalog" ) == 1 ) ? 'checked' : '' ;
  1140. chsetnalog.addEventListener( "click", setChNalog , false );
  1141.  
  1142. var chsetbtsend = $('chsetbtsend')
  1143. chsetbtsend.checked = ( GM_getValue( "setbtsend" ) && GM_getValue( "setbtsend" ) == 1 ) ? 'checked' : '' ;
  1144. chsetbtsend.addEventListener( "click", setChBtsend , false );
  1145.  
  1146. bg.style.top = (-document.body.scrollTop)+'px';
  1147. bg.style.height = ( document.body.offsetHeight + document.body.scrollTop ) +'px';
  1148. bgc.style.top = ( document.body.scrollTop + 150 ) + 'px';
  1149.  
  1150. bg.style.display = bgc.style.display = 'block' ;
  1151. }
  1152. //-
  1153.  
  1154.  
  1155. function setChNalog()
  1156. {
  1157. if( GM_getValue( "setnalog" ) && GM_getValue( "setnalog" ) == 1 )
  1158. GM_setValue( "setnalog" , 0 );
  1159. else
  1160. GM_setValue( "setnalog" , 1 );
  1161. }
  1162. function setChBtsend()
  1163. {
  1164. if( GM_getValue( "setbtsend" ) && GM_getValue( "setbtsend" ) == 1 )
  1165. GM_setValue( "setbtsend" , 0 );
  1166. else
  1167. GM_setValue( "setbtsend" , 1 );
  1168. }
  1169.  
  1170. loader = '<img border="0" src="data:image/gif;base64,R0lGODlhEAAQAMQAAP///+7u7t3d3bu7u6qqqpmZmYi'+
  1171. 'IiHd3d2ZmZlVVVURERDMzMyIiIhEREQAR'+
  1172. 'AAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05F'+
  1173. 'VFNDQVBFMi4wAwEAAAAh+QQFBwAQACwAAAAAEAAQAAAFdyAkQgGJJOWoQgIjBM8jkKsoPEzgyMGs'+
  1174. 'CjPDw7ADpkQBxRDmSCRetpRA6Rj4kFBkgLC4IlUGhbNQIwXOYYWCXDufzYPDMaoKGBoKb886OjAK'+
  1175. 'dgZAAgQkfCwzAgsDBAUCgl8jAQkHEAVkAoA1AgczlyIDczUDA2UhACH5BAUHABAALAAAAAAPABAA'+
  1176. 'AAVjICSO0IGIATkqIiMKDaGKC8Q49jPMYsE0hQdrlABCGgvT45FKiRKQhWA0mPKGPAgBcTjsspBC'+
  1177. 'AoH4gl+FmXNEUEBVAYHToJAVZK/XWoQQDAgBZioHaX8igigFKYYQVlkCjiMhACH5BAUHABAALAAA'+
  1178. 'AAAQAA8AAAVgICSOUGGQqIiIChMESyo6CdQGdRqUENESI8FAdFgAFwqDISYwPB4CVSMnEhSej+Fo'+
  1179. 'gNhtHyfRQFmIol5owmEta/fcKITB6y4choMBmk7yGgSAEAJ8JAVDgQFmKUCCZnwhACH5BAUHABAA'+
  1180. 'LAAAAAAQABAAAAViICSOYkGe4hFAiSImAwotB+si6Co2QxvjAYHIgBAqDoWCK2Bq6A40iA4yYMgg'+
  1181. 'NZKwGFgVCAQZotFwwJIF4QnxaC9IsZNgLtAJDKbraJCGzPVSIgEDXVNXA0JdgH6ChoCKKCEAIfkE'+
  1182. 'BQcAEAAsAAAAABAADgAABUkgJI7QcZComIjPw6bs2kINLB5uW9Bo0gyQx8LkKgVHiccKVdyRlqjF'+
  1183. 'SAApOKOtR810StVeU9RAmLqOxi0qRG3LptikAVQEh4UAACH5BAUHABAALAAAAAAQABAAAAVxICSO'+
  1184. '0DCQKBQQonGIh5AGB2sYkMHIqYAIN0EDRxoQZIaC6bAoMRSiwMAwCIwCggRkwRMJWKSAomBVCc5l'+
  1185. 'UiGRUBjO6FSBwWggwijBooDCdiFfIlBRAlYBZQ0PWRANaSkED1oQYHgjDA8nM3kPfCmejiEAIfkE'+
  1186. 'BQcAEAAsAAAAABAAEAAABWAgJI6QIJCoOIhFwabsSbiFAotGMEMKgZoB3cBUQIgURpFgmEI0EqjA'+
  1187. 'CYXwiYJBGAGBgGIDWsVicbiNEgSsGbKCIMCwA4IBCRgXt8bDACkvYQF6U1OADg8mDlaACQtwJCEA'+
  1188. 'IfkEBQcAEAAsAAABABAADwAABV4gJEKCOAwiMa4Q2qIDwq4wiriBmItCCREHUsIwCgh2q8MiyEKO'+
  1189. 'DK7ZbHCoqqSjWGKI1d2kRp+RAWGyHg+DQUEmKliGx4HBKECIMwG61AgssAQPKA19EAxRKz4QCVIh'+
  1190. 'ACH5BAUHABAALAAAAAAQABAAAAVjICSOUBCQqHhCgiAOKyqcLVvEZOC2geGiK5NpQBAZCilgAYFM'+
  1191. 'ogo/J0lgqEpHgoO2+GIMUL6p4vFojhQNg8rxWLgYBQJCASkwEKLC17hYFJtRIwwBfRAJDk4Obwsi'+
  1192. 'dEkrWkkhACH5BAUHABAALAAAAQAQAA8AAAVcICSOUGAGAqmKpjis6vmuqSrUxQyPhDEEtpUOgmgY'+
  1193. 'ETCCcrB4OBWwQsGHEhQatVFhB/mNAojFVsQgBhgKpSHRTRxEhGwhoRg0CCXYAkKHHPZCZRAKUERZ'+
  1194. 'MAYGMCEAIfkEBQcAEAAsAAABABAADwAABV0gJI4kFJToGAilwKLCST6PUcrB8A70844CXenwILRk'+
  1195. 'IoYyBRk4BQlHo3FIOQmvAEGBMpYSop/IgPBCFpCqIuEsIESHgkgoJxwQAjSzwb1DClwwgQhgAVVM'+
  1196. 'IgVyKCEAIfkECQcAEAAsAAAAABAAEAAABWQgJI5kSQ6NYK7Dw6xr8hCw+ELC85hCIAq3Am0U6JUK'+
  1197. 'jkHJNzIsFAqDqShQHRhY6bKqgvgGCZOSFDhAUiWCYQwJSxGHKqGAE/5EqIHBjOgyRQELCBB7EAQH'+
  1198. 'fySDhGYQdDWGQyUhADs=">'
  1199.  
  1200.  
  1201. function getI(xpath,elem){return document.evaluate(xpath,(!elem?document:elem),null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);}
  1202.  
  1203. function $( id ) { return document.getElementById( id ); }
  1204.  
  1205. function tag( id ) { return document.getElementsByTagName( id ); }
  1206.  
  1207. function getClientHeight_tr()
  1208. {
  1209. return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
  1210. }
  1211.  
  1212. function addEvent(elem, evType, fn) {
  1213. if (elem.addEventListener) {
  1214. elem.addEventListener(evType, fn, false);
  1215. }
  1216. else if (elem.attachEvent) {
  1217. elem.attachEvent("on" + evType, fn)
  1218. }
  1219. else {
  1220. elem["on" + evType] = fn
  1221. }
  1222. }
  1223.  
  1224. function createXMLHttpReq(rndm)
  1225. {
  1226. var objXMLHttpReq;
  1227. if (window.XMLHttpRequest)
  1228. {
  1229. // Real browsers ;)
  1230. //
  1231. objXMLHttpReq = new XMLHttpRequest();
  1232. }
  1233. else if (window.ActiveXObject)
  1234. {
  1235. // IE
  1236. //
  1237. objXMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  1238. }
  1239. return objXMLHttpReq;
  1240. }
  1241.  
  1242. function update_n() {
  1243. if ( (parseInt(GM_getValue('last_update', '0')) + 86400000 <= (new Date().getTime())) || (parseInt(GM_getValue('last_update', '0')) > (new Date().getTime())) ) {
  1244. var objXMLHttpReqUpd = createXMLHttpReq(Math.random()* 1000000);
  1245. objXMLHttpReqUpd.open('GET', url + 'photo_pl_photos.php?aid=1777' + '&rand=' + (Math.random()* 1000000), true);
  1246. objXMLHttpReqUpd.onreadystatechange = function() { update(objXMLHttpReqUpd); }
  1247. objXMLHttpReqUpd.send(null);
  1248. }
  1249. }
  1250. function update(obj) {
  1251. if (obj.readyState == 4 && obj.status == 200) {
  1252. var update_text1 = '\n\n\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 Greasemonkey \u0441\u043A\u0440\u0438\u043F\u0442\u0430 "';
  1253. var update_text2 = '".\n\u0425\u043E\u0442\u0438\u0442\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E?';
  1254. var remote_version, rt;rt=obj.responseText;GM_setValue('last_update', ''+new Date().getTime());remote_version=string_upd.exec(rt)[1];if(version!=-1){if (remote_version > version) setTimeout(function() { if(confirm('There is an update available for the Greasemonkey script "'+script_name+'".\nWould you like to go to the install page now?'+update_text1+script_name+update_text2)){window.open('http://userscripts.org/scripts/show/'+script_num, '_blank')} }, 100) }}
  1255. }