hwm_ecostat_adv

HWM mod - Ecostat advanced by Demin

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

  1. // ==UserScript==
  2. // @name hwm_ecostat_adv
  3. // @namespace Demin
  4. // @description HWM mod - Ecostat advanced by Demin
  5. // @homepage http://userscripts.org/scripts/show/92572
  6. // @version 3.00
  7. // @include http://*heroeswm.*/map.php*
  8. // @include http://*heroeswm.*/ecostat*
  9. // @include http://*heroeswm.*/object-info.php*
  10. // @include http://*heroeswm.*/mercenary_guild.php*
  11. // @include http://178.248.235.15/map.php*
  12. // @include http://178.248.235.15/ecostat*
  13. // @include http://178.248.235.15/object-info.php*
  14. // @include http://178.248.235.15/mercenary_guild.php*
  15. // @include http://*герои.рф/?15091
  16. // ==/UserScript==
  17.  
  18. // (c) 2009, LazyGreg http://www.heroeswm.ru/pl_info.php?id=160839
  19. // (c) 2010-2012, demin (http://www.heroeswm.ru/pl_info.php?id=15091)
  20.  
  21. var version = '3.00';
  22.  
  23. var script_num = 92572;
  24. var script_name = 'HWM mod - Ecostat advanced by Demin';
  25. var string_upd = /92572=(\d+\.\d+)/;
  26.  
  27. var url_cur = location.href;
  28. var url = 'http://'+location.hostname+'/';
  29.  
  30. try {
  31.  
  32. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  33. this.GM_getValue=function (key,def) {
  34. return localStorage[key] || def;
  35. };
  36. this.GM_setValue=function (key,value) {
  37. return localStorage[key]=value;
  38. };
  39. this.GM_deleteValue=function (key) {
  40. return delete localStorage[key];
  41. };
  42. }
  43.  
  44. // ===== ID - Location lookup table =====
  45. var id2loc = [];
  46. var o;
  47. // == create objects with loc info
  48. o = {};
  49. o.abbr = "EmC";
  50. o.name = "Empire Capital";
  51. o.colr = "#000000";
  52. o.ids = [3,4,5,6,7,8,9,10,11,12,32,34,38,165];
  53. id2loc.push(o);
  54. //
  55. o = {};
  56. o.abbr = "EsR";
  57. o.name = "East River";
  58. o.colr = "#000000";
  59. o.ids = [23,24,25,26,28,33,36,75,87,89,238,258,279,300,321,342];
  60. id2loc.push(o);
  61. //
  62. o = {};
  63. o.abbr = "PoR";
  64. o.name = "Portal's Ruins";
  65. o.colr = "#FF0000";
  66. o.ids = [92,93,99,100,102,118,163,211,217,228,245,266,287,308,329,350];
  67. id2loc.push(o);
  68. //
  69. o = {};
  70. o.abbr = "WoD";
  71. o.name = "Wolf's Dale";
  72. o.colr = "#000000";
  73. o.ids = [43,44,45,46,47,48,74,85,86,226,241,261,282,303,324,345];
  74. id2loc.push(o);
  75. //
  76. o = {};
  77. o.abbr = "LzL";
  78. o.name = "Lizard's Lowland";
  79. o.colr = "#009900";
  80. o.ids = [56,57,58,59,60,61,63,64,80,83,242,263,284,305,326,347];
  81. id2loc.push(o);
  82. //
  83. o = {};
  84. o.abbr = "GrW";
  85. o.name = "Green Wood";
  86. o.colr = "#009900";
  87. o.ids = [67,68,69,70,71,72,76,77,81,88,243,264,285,306,327,348];
  88. id2loc.push(o);
  89. //
  90. o = {};
  91. o.abbr = "SnC";
  92. o.name = "Sunny City";
  93. o.colr = "#009900";
  94. o.ids = [103,104,105,106,107,115,116,213,220,231,248,269,290,311,332,353];
  95. id2loc.push(o);
  96. //
  97. o = {};
  98. o.abbr = "ShS";
  99. o.name = "Shining Spring";
  100. o.colr = "#009900";
  101. o.ids = [108,109,110,111,112,113,114,117,219,230,247,268,289,310,331,352];
  102. id2loc.push(o);
  103. //
  104. o = {};
  105. o.abbr = "EgN";
  106. o.name = "Eagle's Nest";
  107. o.colr = "#FFCC33";
  108. o.ids = [94,95,97,98,101,119,120,139,140,227,244,265,286,307,328,349];
  109. id2loc.push(o);
  110. //
  111. o = {};
  112. o.abbr = "PcC";
  113. o.name = "Peaceful Camp";
  114. o.colr = "#FFCC33";
  115. o.ids = [49,50,51,52,53,54,55,73,79,82,141,262,283,304,325,346];
  116. id2loc.push(o);
  117. //
  118. o = {};
  119. o.abbr = "TgL";
  120. o.name = "Tiger's Lake";
  121. o.colr = "#000000";
  122. o.ids = [13,14,15,16,27,31,35,39,84,224,239,259,280,301,322,343];
  123. id2loc.push(o);
  124. //
  125. o = {};
  126. o.abbr = "RgW";
  127. o.name = "Rogue's Wood";
  128. o.colr = "#000000";
  129. o.ids = [18,19,20,21,22,30,37,78,90,225,240,260,281,302,323,344];
  130. id2loc.push(o);
  131. //
  132. //
  133. o = {};
  134. o.abbr = "MgM";
  135. o.name = "Magma Mines";
  136. o.colr = "#3300FF";
  137. o.ids = [121,122,135,142,143,144,145,164,216,232,249,270,291,312,333,354];
  138. id2loc.push(o);
  139. //
  140. o = {};
  141. o.abbr = "BrM";
  142. o.name = "Bear' Mountain";
  143. o.colr = "#3300FF";
  144. o.ids = [123,124,125,136,146,147,148,149,214,215,250,271,292,313,334,355];
  145. id2loc.push(o);
  146. //
  147. o = {};
  148. o.abbr = "FrT";
  149. o.name = "Fairy Trees";
  150. o.colr = "#3300FF";
  151. o.ids = [126,127,134,150,151,152,153,212,221,233,251,272,293,314,335,356];
  152. id2loc.push(o);
  153. //
  154. o = {};
  155. o.abbr = "MfC";
  156. o.name = "Mythril Coast";
  157. o.colr = "#3300FF";
  158. o.ids = [128,129,130,137,138,154,155,156,157,235,253,274,295,316,337,358];
  159. id2loc.push(o);
  160. //
  161. o = {};
  162. o.abbr = "PrC";
  163. o.name = "Port City";
  164. o.colr = "#3300FF";
  165. o.ids = [131,132,133,158,159,160,161,162,222,234,252,273,294,315,336,357];
  166. id2loc.push(o);
  167. //
  168. o = {};
  169. o.abbr = "FsV";
  170. o.name = "Fishing Village";
  171. o.colr = "#FF0000";
  172. o.ids = [166,174,175,196,197,198,199,200,223,236,256,277,298,319,340,361];
  173. id2loc.push(o);
  174. //
  175. o = {};
  176. o.abbr = "DrC";
  177. o.name = "Dragons's Caves";
  178. o.colr = "#000000";
  179. o.ids = [167,168,169,170,171,172,209,210,218,229,246,267,288,309,330,351];
  180. id2loc.push(o);
  181. //
  182. o = {};
  183. o.abbr = "GtW";
  184. o.name = "Great Wall";
  185. o.colr = "#FF0000";
  186. o.ids = [173,178,179,192,193,194,195,201,202,203,254,275,296,317,338,359];
  187. id2loc.push(o);
  188. //
  189. o = {};
  190. o.abbr = "TiV";
  191. o.name = "Titans' Valley";
  192. o.colr = "#FF0000";
  193. o.ids = [176,177,187,188,189,190,191,206,207,208,255,276,297,318,339,360];
  194. id2loc.push(o);
  195. //
  196. o = {};
  197. o.abbr = "KiC";
  198. o.name = "Kingdom Castle";
  199. o.colr = "#FF0000";
  200. o.ids = [180,181,182,183,184,185,186,204,205,237,257,278,299,320,341,362];
  201. id2loc.push(o);
  202. //
  203. o = {};
  204. o.abbr = "UnS";
  205. o.name = "Ungovernable Steppe";
  206. o.colr = "#FFCC33";
  207. o.ids = [363,364,365,366,369,370,371,372,373,374,375,376,377,378,379,380];
  208. id2loc.push(o);
  209. //
  210. o = {};
  211. o.abbr = "CrG";
  212. o.name = "Crystal Garden";
  213. o.colr = "#FFCC33";
  214. o.ids = [367,368,381,382,383,384,385,386,387,388,389,390,391,392,393,394];
  215. id2loc.push(o);
  216. //
  217.  
  218. if( !GM_getValue("hwm_ecost_adv_times") ) GM_setValue("hwm_ecost_adv_times", '|2000_00');
  219. var wtime_regexp = /: (\d+):(\d+)/;
  220. var id_regexp = /id=(\d+)/;
  221. var isEcostat = (url_cur.indexOf("/ecostat_details.php") != -1);
  222. var isMercenary = (url_cur.indexOf("/mercenary_guild.php") != -1);
  223. var times_str = GM_getValue("hwm_ecost_adv_times");
  224. var hwm_check_time = GM_getValue("hwm_check_time", '1'); // see time
  225. var hwm_check_del = GM_getValue("hwm_check_del", '1'); // delete vladelez
  226. var hwm_check_full = GM_getValue("hwm_check_full", '1'); // full name
  227.  
  228. var bt = document.createElement('b');
  229. bt.innerHTML = ' ▲';
  230. bt.title = "Настройки скрипта";
  231. addEvent(bt, "click", setting_ts);
  232.  
  233. var all_a = tag('b');
  234. var a_len = all_a.length;
  235. for (var i=a_len; i--;) {
  236. var a_i = all_a[i];
  237. if ( a_i.innerHTML.match(/татистика/) ) {
  238. if ( location.pathname=='/map.php' ) {
  239. a_i.parentNode.parentNode.insertBefore(bt, a_i.parentNode.nextSibling);
  240. } else {
  241. a_i.parentNode.insertBefore(bt, a_i.nextSibling);
  242. }
  243. break;
  244. }
  245. }
  246.  
  247. if (url_cur.indexOf("/object-info.php")!=-1) {
  248.  
  249. var obj_id = id_regexp.exec(url_cur)[1];
  250. var b_id = (tag('body'))[0].innerHTML;
  251. recordWorkTime(obj_id,b_id);
  252.  
  253. } else {
  254. makeLinks();
  255.  
  256. var d = document.createElement('iframe');
  257. d.setAttribute( 'style' , 'position:absolute; top:0; width:100; height:30; visibility:hidden;' );
  258. document.body.appendChild(d);
  259. }
  260.  
  261. } finally { update_n() }
  262.  
  263. function recordWorkTime(obj_id,text)
  264. {
  265. times_str = GM_getValue("hwm_ecost_adv_times");
  266. var ta = wtime_regexp.exec(text);
  267.  
  268. if (ta) {
  269.  
  270. var new_time = obj_id+"_"+ta[2];
  271. if (times_str.indexOf("|"+obj_id+"_")==-1) { // very 1st visit
  272. times_str += "|"+new_time;
  273. } else {
  274. var vt_regexp = obj_id+"_\(\\d\{2\}\)";
  275. var vtR = new RegExp( vt_regexp );
  276. times_str = times_str.replace(vtR, new_time);
  277. }
  278.  
  279. } else if (times_str.indexOf("|"+obj_id+"_")!=-1) {
  280. var vt_regexp = "\\|"+ obj_id+"_\(\\d\{2\}\)";
  281. var vtR = new RegExp( vt_regexp );
  282. times_str = times_str.replace(vtR, "");
  283. }
  284.  
  285. GM_setValue("hwm_ecost_adv_times", times_str);
  286. }
  287.  
  288. function makeLinks(){
  289. var sa;
  290. var loc;
  291. var loc_data;
  292. var ts = "";
  293. var ids_passed_str = "";
  294. var my_row;
  295. var id_regexp = /object-info.php\?id=(\d+)/;
  296. var my_id;
  297. var target_time;
  298. var target_time2;
  299.  
  300. var row_count = 0;
  301. var a_all = tag('a') ;
  302. var el;
  303. for (var i=0; i<a_all.length; i++) {
  304. el = a_all[i];
  305. if (el.href.indexOf('/object-info.php?')==-1) { continue; }
  306.  
  307. ts = "_"+el.href.split('/object-info.php?')[1]+"_";
  308. if (ids_passed_str.indexOf(ts)!=-1) { continue; } //workaround for last cell on map page (>>>)
  309. ids_passed_str += ts;
  310.  
  311. target_time = "n/a";
  312. my_id = id_regexp.exec(el.href)[1];
  313.  
  314. if ( hwm_check_time==1 ) {
  315.  
  316. target_time2 = get_time_id(my_id);
  317. if ( target_time2 ) target_time = target_time2;
  318.  
  319. sa = document.createElement( 'a' );
  320. sa.href = el.href;
  321. sa.style.fontSize = "11px";
  322. sa.innerHTML = "&nbsp;<b>["+target_time+"]</b>";
  323. }
  324.  
  325. if (isEcostat) { // add location only in Ecostat page
  326. if ( hwm_check_del == 1 ) {
  327. while (a_all[i].parentNode.childNodes[2]) a_all[i].parentNode.removeChild(a_all[i].parentNode.childNodes[2]);
  328. }
  329. loc_data = getLocData(my_id);
  330. loc = document.createElement( 'span' );
  331.  
  332. if ( hwm_check_full == 1 ) {
  333. loc.innerHTML = ",&nbsp;<b><font color="+loc_data.colr+">"+loc_data.name+"</font></b>";
  334. } else {
  335. loc.title = loc_data.name;
  336. loc.innerHTML = "&nbsp;<b><font color="+loc_data.colr+">"+loc_data.abbr+"</font></b>";
  337. }
  338. el.parentNode.insertBefore(loc, el.nextSibling);
  339. }
  340.  
  341. if (!isMercenary && sa) {
  342. el.parentNode.insertBefore(sa, el.nextSibling);
  343. addEvent(sa, "click", get_obj_time);
  344. }
  345.  
  346. if (isMercenary) { // add location only in Mercenary Guild page
  347. loc_data = getLocData(my_id);
  348. loc = document.createElement( 'span' );
  349. //loc.title = loc_data.name;
  350. //loc.title = "Wolf's Dale";
  351. //loc.innerHTML = "&nbsp;&nbsp;XXX";
  352. loc.innerHTML = "&nbsp;<b>(&nbsp;<font color="+loc_data.colr+">"+loc_data.name+"</font>&nbsp;)</b>";
  353. el.parentNode.insertBefore(loc, el.nextSibling);
  354. }
  355.  
  356. if (row_count%2 && isEcostat) {
  357. my_row = el.parentNode.parentNode;
  358. for(rn=0; rn<my_row.childNodes.length; rn++){
  359. my_row.childNodes[rn].style.backgroundColor = "#fff";
  360. }
  361. }
  362. row_count++;
  363. }
  364. }
  365.  
  366. function getLocData(n) {
  367. var loc_data = {};
  368. loc_data.abbr = "n/a";
  369. loc_data.name = "New Loc?";
  370. loc_data.colr = "#000000";
  371.  
  372. var o;
  373. var ids_str;
  374. for(var i=0; i<id2loc.length; i++) {
  375. o = id2loc[i];
  376. ids_str = "_" +o.ids.join("_")+ "_";
  377. if(ids_str.indexOf("_"+n+"_") != -1) {
  378. loc_data = o;
  379. }
  380. }
  381. return loc_data;
  382. }
  383.  
  384. function get_obj_time(event)
  385. {
  386. event = event || window.event;
  387. event.preventDefault ? event.preventDefault() : (event.returnValue=false);
  388. var sa = event.target || event.srcElement;
  389.  
  390. if ( !sa.href ) { sa = sa.parentNode }
  391. sa.innerHTML = loaderid();
  392. var objXMLHttpReqFrId = createXMLHttpReq(Math.random()* 1000000);
  393. objXMLHttpReqFrId.open('GET', sa.href + '&rand=' + (Math.random()* 1000000), true);
  394. objXMLHttpReqFrId.onreadystatechange = function() { handleHttpResponseFrId(objXMLHttpReqFrId,sa); }
  395. objXMLHttpReqFrId.send(null);
  396. }
  397.  
  398. function handleHttpResponseFrId(obj,sa) {
  399. if (obj.readyState == 4 && obj.status == 200) {
  400. var obj_id = id_regexp.exec(sa.href)[1];
  401. recordWorkTime(obj_id,obj.responseText);
  402.  
  403. var target_time = "n/a";
  404. var target_time2 = get_time_id(obj_id);
  405. if ( target_time2 ) target_time = target_time2;
  406.  
  407. sa.innerHTML = "&nbsp;<b>["+target_time+"]</b>";
  408. }
  409. }
  410.  
  411. function get_time_id(my_id)
  412. {
  413. if(times_str.indexOf("|"+my_id+"_")!=-1) {
  414.  
  415. var curDate = new Date();
  416. var curHour = curDate.getHours();
  417. var curMin = curDate.getMinutes();
  418. var vt_arr = [];
  419.  
  420. var vt_regexp = my_id+ "_\(\\d\{2\}\)";
  421. var vtR = new RegExp( vt_regexp );
  422. vt_arr = vtR.exec(times_str);
  423. //t_min = vt_arr.length? vtR.exec(times_str)[1] : "00"; // ?
  424. var t_min = vt_arr.length? vt_arr[1] : "00"; // ?
  425. //alert("t_min = "+t_min);
  426. var target_hr = (t_min > curMin)? curHour : curHour+1;
  427. target_hr = (target_hr==24)? "00" : target_hr;
  428. target_time2 = target_hr +":"+ t_min;
  429. return target_time2;
  430. }
  431. }
  432.  
  433. function form_close_ts()
  434. {
  435. bg = $('bgOverlay');
  436. bgc = $('bgCenter');
  437. if( bg )
  438. {
  439. bg.style.display = bgc.style.display = 'none';
  440. }
  441. }
  442.  
  443. function setting_ts()
  444. {
  445. bg = $('bgOverlay');
  446. bgc = $('bgCenter');
  447. if( !bg )
  448. {
  449. bg = document.createElement('div') ;
  450. bg.id = 'bgOverlay' ;
  451. document.body.appendChild( bg );
  452. bg.style.position = 'absolute' ;
  453. bg.style.left = '0';
  454. bg.style.width = '100%';
  455. bg.style.background = "#000000";
  456. bg.style.opacity = "0.5";
  457. addEvent(bg, "click", form_close_ts);
  458.  
  459. bgc = document.createElement('div') ;
  460. bgc.id = 'bgCenter' ;
  461. document.body.appendChild( bgc );
  462. bgc.style.position = 'absolute' ;
  463. bgc.style.width = '650px';
  464. bgc.style.background = "#F6F3EA";
  465. bgc.style.left = ( ( document.body.offsetWidth - 650 ) / 2 ) + 'px';
  466. }
  467.  
  468. 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_ts" title="Close">x</div><table>'+
  469. '<tr><td>Отображать время окончания смены: <input type=checkbox '+(hwm_check_time=="1"?"checked":"")+' id=hwm_check_time_id title=""></td></tr>'+
  470. '<tr><td>Удалять владельца предприятия в экономической статистике: <input type=checkbox '+(hwm_check_del=="1"?"checked":"")+' id=hwm_check_del_id title=""></td></tr>'+
  471. '<tr><td>Отображать полные названия секторов (иначе сокращенные): <input type=checkbox '+(hwm_check_full=="1"?"checked":"")+' id=hwm_check_full_id title=""><br><br></td></tr>'+
  472. '<tr><td><input type="submit" id="hwm_ecost_adv_times_id" value="Стереть окончания смен" title=""></td></tr>'+
  473. '</table></div>' ;
  474.  
  475. addEvent($("bt_close_ts"), "click", form_close_ts);
  476. addEvent($("hwm_check_time_id"), "click", hwm_check_time_f);
  477. addEvent($("hwm_check_del_id"), "click", hwm_check_del_f);
  478. addEvent($("hwm_check_full_id"), "click", hwm_check_full_f);
  479. addEvent($("hwm_ecost_adv_times_id"), "click", hwm_ecost_adv_times_f);
  480.  
  481. var height_v = getClientHeight_ts();
  482. if (height_v < document.body.offsetHeight) height_v = document.body.offsetHeight;
  483.  
  484. bg.style.top = (-document.body.scrollTop)+'px';
  485. bg.style.height = ( height_v + document.body.scrollTop ) +'px';
  486. bgc.style.top = ( document.body.scrollTop + 150 ) + 'px';
  487. bg.style.display = bgc.style.display = 'block';
  488. }
  489.  
  490. function hwm_check_time_f()
  491. {
  492. if( $('hwm_check_time_id').checked==true ) hwm_check_time='1'; else hwm_check_time='0';
  493. GM_setValue( "hwm_check_time", hwm_check_time );
  494. }
  495.  
  496. function hwm_check_del_f()
  497. {
  498. if( $('hwm_check_del_id').checked==true ) hwm_check_del='1'; else hwm_check_del='0';
  499. GM_setValue( "hwm_check_del", hwm_check_del );
  500. }
  501.  
  502. function hwm_check_full_f()
  503. {
  504. if( $('hwm_check_full_id').checked==true ) hwm_check_full='1'; else hwm_check_full='0';
  505. GM_setValue( "hwm_check_full", hwm_check_full );
  506. }
  507.  
  508. function hwm_ecost_adv_times_f()
  509. {
  510. GM_setValue("hwm_ecost_adv_times", "|2000_00");
  511. }
  512.  
  513. function loaderid() {
  514. return ' <img border="0" src="data:image/gif;base64,R0lGODlhEAAQAMQAAP///+7u7t3d3bu7u6qqqpmZmYi'+
  515. 'IiHd3d2ZmZlVVVURERDMzMyIiIhEREQAR'+
  516. 'AAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05F'+
  517. 'VFNDQVBFMi4wAwEAAAAh+QQFBwAQACwAAAAAEAAQAAAFdyAkQgGJJOWoQgIjBM8jkKsoPEzgyMGs'+
  518. 'CjPDw7ADpkQBxRDmSCRetpRA6Rj4kFBkgLC4IlUGhbNQIwXOYYWCXDufzYPDMaoKGBoKb886OjAK'+
  519. 'dgZAAgQkfCwzAgsDBAUCgl8jAQkHEAVkAoA1AgczlyIDczUDA2UhACH5BAUHABAALAAAAAAPABAA'+
  520. 'AAVjICSO0IGIATkqIiMKDaGKC8Q49jPMYsE0hQdrlABCGgvT45FKiRKQhWA0mPKGPAgBcTjsspBC'+
  521. 'AoH4gl+FmXNEUEBVAYHToJAVZK/XWoQQDAgBZioHaX8igigFKYYQVlkCjiMhACH5BAUHABAALAAA'+
  522. 'AAAQAA8AAAVgICSOUGGQqIiIChMESyo6CdQGdRqUENESI8FAdFgAFwqDISYwPB4CVSMnEhSej+Fo'+
  523. 'gNhtHyfRQFmIol5owmEta/fcKITB6y4choMBmk7yGgSAEAJ8JAVDgQFmKUCCZnwhACH5BAUHABAA'+
  524. 'LAAAAAAQABAAAAViICSOYkGe4hFAiSImAwotB+si6Co2QxvjAYHIgBAqDoWCK2Bq6A40iA4yYMgg'+
  525. 'NZKwGFgVCAQZotFwwJIF4QnxaC9IsZNgLtAJDKbraJCGzPVSIgEDXVNXA0JdgH6ChoCKKCEAIfkE'+
  526. 'BQcAEAAsAAAAABAADgAABUkgJI7QcZComIjPw6bs2kINLB5uW9Bo0gyQx8LkKgVHiccKVdyRlqjF'+
  527. 'SAApOKOtR810StVeU9RAmLqOxi0qRG3LptikAVQEh4UAACH5BAUHABAALAAAAAAQABAAAAVxICSO'+
  528. '0DCQKBQQonGIh5AGB2sYkMHIqYAIN0EDRxoQZIaC6bAoMRSiwMAwCIwCggRkwRMJWKSAomBVCc5l'+
  529. 'UiGRUBjO6FSBwWggwijBooDCdiFfIlBRAlYBZQ0PWRANaSkED1oQYHgjDA8nM3kPfCmejiEAIfkE'+
  530. 'BQcAEAAsAAAAABAAEAAABWAgJI6QIJCoOIhFwabsSbiFAotGMEMKgZoB3cBUQIgURpFgmEI0EqjA'+
  531. 'CYXwiYJBGAGBgGIDWsVicbiNEgSsGbKCIMCwA4IBCRgXt8bDACkvYQF6U1OADg8mDlaACQtwJCEA'+
  532. 'IfkEBQcAEAAsAAABABAADwAABV4gJEKCOAwiMa4Q2qIDwq4wiriBmItCCREHUsIwCgh2q8MiyEKO'+
  533. 'DK7ZbHCoqqSjWGKI1d2kRp+RAWGyHg+DQUEmKliGx4HBKECIMwG61AgssAQPKA19EAxRKz4QCVIh'+
  534. 'ACH5BAUHABAALAAAAAAQABAAAAVjICSOUBCQqHhCgiAOKyqcLVvEZOC2geGiK5NpQBAZCilgAYFM'+
  535. 'ogo/J0lgqEpHgoO2+GIMUL6p4vFojhQNg8rxWLgYBQJCASkwEKLC17hYFJtRIwwBfRAJDk4Obwsi'+
  536. 'dEkrWkkhACH5BAUHABAALAAAAQAQAA8AAAVcICSOUGAGAqmKpjis6vmuqSrUxQyPhDEEtpUOgmgY'+
  537. 'ETCCcrB4OBWwQsGHEhQatVFhB/mNAojFVsQgBhgKpSHRTRxEhGwhoRg0CCXYAkKHHPZCZRAKUERZ'+
  538. 'MAYGMCEAIfkEBQcAEAAsAAABABAADwAABV0gJI4kFJToGAilwKLCST6PUcrB8A70844CXenwILRk'+
  539. 'IoYyBRk4BQlHo3FIOQmvAEGBMpYSop/IgPBCFpCqIuEsIESHgkgoJxwQAjSzwb1DClwwgQhgAVVM'+
  540. 'IgVyKCEAIfkECQcAEAAsAAAAABAAEAAABWQgJI5kSQ6NYK7Dw6xr8hCw+ELC85hCIAq3Am0U6JUK'+
  541. 'jkHJNzIsFAqDqShQHRhY6bKqgvgGCZOSFDhAUiWCYQwJSxGHKqGAE/5EqIHBjOgyRQELCBB7EAQH'+
  542. 'fySDhGYQdDWGQyUhADs=">';
  543. }
  544.  
  545. function getClientHeight_ts()
  546. {
  547. return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
  548. }
  549.  
  550. function $( id ) { return document.getElementById( id ); }
  551.  
  552. function tag( id ) { return document.getElementsByTagName( id ); }
  553.  
  554. function addEvent(elem, evType, fn) {
  555. if (elem.addEventListener) {
  556. elem.addEventListener(evType, fn, false);
  557. }
  558. else if (elem.attachEvent) {
  559. elem.attachEvent("on" + evType, fn)
  560. }
  561. else {
  562. elem["on" + evType] = fn
  563. }
  564. }
  565.  
  566. function createXMLHttpReq(rndm)
  567. {
  568. var objXMLHttpReq;
  569. if (window.XMLHttpRequest)
  570. {
  571. // Real browsers ;)
  572. //
  573. objXMLHttpReq = new XMLHttpRequest();
  574. }
  575. else if (window.ActiveXObject)
  576. {
  577. // IE
  578. //
  579. objXMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  580. }
  581. return objXMLHttpReq;
  582. }
  583.  
  584. function update_n() {
  585. if ( (parseInt(GM_getValue('last_update', '0')) + 86400000 <= (new Date().getTime())) || (parseInt(GM_getValue('last_update', '0')) > (new Date().getTime())) ) {
  586. var objXMLHttpReqUpd = createXMLHttpReq(Math.random()* 1000000);
  587. objXMLHttpReqUpd.open('GET', url + 'photo_pl_photos.php?aid=1777' + '&rand=' + (Math.random()* 1000000), true);
  588. objXMLHttpReqUpd.onreadystatechange = function() { update(objXMLHttpReqUpd); }
  589. objXMLHttpReqUpd.send(null);
  590. }
  591. }
  592. function update(obj) {
  593. if (obj.readyState == 4 && obj.status == 200) {
  594. 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 "';
  595. 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?';
  596. 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) }}
  597. }