今次改善左個page 有時d 錢冇update 到旣問題。 之前唔 refresh 個頁面, 因為有時click 左 button (即係 post) 之後, refresh 時 firefox 就會問你重新傳送過資料, 令到個script 停頓, 所以焗住用 get。
而家段 script 就會判斷個page 係唔係之前 click 過 button, 如果係就用 get, 否則就會用 post。要注意地方係段 script 唔會判斷人為旣 post。心水清旣相信會諗到解決辦法, 就係 post 存錢/提錢時個頁面會有段訊息, 用嗰段訊息就可以知道係唔係 post。
// ==UserScript== // @name auto bank-in // @namespace hk.orz // @include http://apps.facebook.com/street-wars/* // @description by neo@orz.hk, please visit http://orz.hk // ==/UserScript== var last_load = new Date(); // setup a count down box var htmlElement = document.createElement('div'); htmlElement.id = 'timer'; htmlElement.style.color = 'white'; htmlElement.style.position = 'fixed'; htmlElement.style.width = '50px'; htmlElement.style.height = '20px'; htmlElement.style.textAlign = 'center'; htmlElement.style.paddingTop = '4px'; htmlElement.style.paddingTop = '2px'; htmlElement.innerHTML = 'start'; window.parent.document.body.appendChild(htmlElement); window.setTimeout(function() { tick() }, 1); function tick() { current = new Date(); minutes = (current - last_load) / 1000 / 60; // click the deposit button if there is money to save if (document.getElementsByName("amount").length > 1) if (document.getElementsByName("amount")[1].value != '0') { GM_setValue('reload', 1); document.getElementsByName("deposit")[0].click(); } // display the minute htmlElement.innerHTML = minutes ; // we only refresh in first/last 5 minutes, as the revenue period if (current.getMinutes() < 10 || current.getMinutes() > 50) { htmlElement.style.background = 'red'; // check each minute if (minutes > 2) { if (GM_getValue('reload') == 0) { location.href='http://apps.facebook.com/street-wars/bank.php'; GM_setValue('reload', 1); } else { location.reload(); } } } else { htmlElement.style.background = 'green'; } // come back again every 10 seconds window.setTimeout(function() { tick()}, 10000); }





