// ==UserScript== // @name hwm_auction_back // @namespace Demin // @description HWM mod - Auction back (by Demin) // @homepage http://userscripts.org/scripts/show/124527 // @version 2.00 // @include http://*heroeswm.*/auction*new_lot.php* // @include http://178.248.235.15/auction*new_lot.php* // @include http://*.lordswm.*/auction*new_lot.php* // @include http://*герои.рф/?15091 // @downloadURL https://update.greasyfork.icu/scripts/1241/hwm_auction_back.user.js // @updateURL https://update.greasyfork.icu/scripts/1241/hwm_auction_back.meta.js // ==/UserScript== // (c) 2012, demin (http://www.heroeswm.ru/pl_info.php?id=15091) var version = '2.00'; var only_back = '0'; var delay = '3000'; // milli seconds var url_cur = location.href; var url = 'http://'+location.hostname+'/'; if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) { this.GM_getValue=function (key,def) { return localStorage[key] || def; }; this.GM_setValue=function (key,value) { return localStorage[key]=value; }; this.GM_deleteValue=function (key) { return delete localStorage[key]; }; } if ( Number(delay) && Number(delay)>450 ) { delay = Number(delay) } else { delay = 3000 } var accept_lot = '\u041B\u043E\u0442 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0432\u044B\u0441\u0442\u0430\u0432\u043B\u0435\u043D'; var to_auction = 'Возврат на рынок'; if (url.match('lordswm')) { accept_lot = 'Lot posted successfully'; to_auction = 'Return to market'; } if ( (tag('body'))[0] ) { if ( location.pathname=='/auction_new_lot.php' && document.referrer && only_back=='0' ) { if ( !document.referrer.match('auction_new_lot.php') ) { GM_setValue("referrer", ''); } if ( document.referrer.split('?')[1] ) { GM_setValue("referrer", document.referrer.split('?')[1]); } } if ( location.pathname=='/auction_accept_new_lot.php' ) { var b = (tag('body'))[0]; if ( b.innerHTML.match( accept_lot ) ) { var all_a = tag('a'); var a_len = all_a.length; for (var i=a_len; i--;) { var a_i = all_a[i]; if ( a_i.href.match('auction.php') && a_i.parentNode.innerHTML.match(accept_lot) ) { var bt = document.createElement('span'); bt.innerHTML = ''; a_i.parentNode.insertBefore(bt, a_i.nextSibling); bt.id = Math.round(delay/1000); var st = document.createElement('span'); if ( only_back=='0' && GM_getValue("referrer") ) { var aa = url+'auction.php?'+GM_getValue("referrer"); } else { var aa = url+'auction.php'; } st.innerHTML = '

'+to_auction+' '+loaderr()+' '; a_i.parentNode.insertBefore(st, a_i.nextSibling); reload_time(bt); break; } } } } } function reload_time(res) { var id = res.id; if ( id > 0 ) { res.innerHTML += ' '+id+'..'; res.id = Number(id-1); } if ( id == 1) { if ( only_back=='0' && GM_getValue("referrer") ) { setTimeout(function() { window.location=url+'auction.php?'+GM_getValue("referrer"); }, 999); } else { setTimeout(function() { window.location=url+'auction.php'; }, 999); } return; } setTimeout(function() { reload_time(res); }, 999); } function loaderr() { return ''; } function $( id ) { return document.getElementById( id ); } function tag( id ) { return document.getElementsByTagName( id ); }