, , jQuery - GreaseMonkey/Tampermonkey Chrome. , , , - , .
, , , . -, dev tampermonkey. "z". , , .
z(), z.ProcessWaitList() ZWaitList z script.
//BEGIN_INJECTION////END_INJECTION//, /... .../. , . , script GreaseMonkey, .
(function ZInjectionContainer() {
if(!document.querySelector('script[id="ZInjectionContainer"]')){
function SubstrBetween(s, start,end){ return s.substring(s.indexOf(start) + start.length, s.lastIndexOf(end));}
function AppendScript(id, src, callback){
var js = document.querySelector('script[id="'+ id +'"]');
if(!js){
js = document.createElement('script'); js.id = id; js.type = 'text/javascript';
document.getElementsByTagName('body')[0].appendChild(js);
}
if(callback) js.onload = callback;
if(src && String(src).endsWith('.js')) js.src = src;
else if(src)js.text += "\n" + String(src);
return js;
}
function ProcessWaitList(){
function process(){ console.log(' Processing WaitList.'); while(ZWaitList.length > 0){ ZWaitList.shift().call(); } }
if(typeof ZWaitList == 'undefined') ZWaitList = [];
if(Array.isArray(ZWaitList) && ZWaitList.length > 0){
if(!IsInitialized()) {
console.log('ZWaitList sizeof ' + ZWaitList.length + ' detected. Auto Initializing');
ZInitialize(process);
}
else{ process(); }
}
}
function ZInitialize(callback) {
var _version = 'jquery-2.2.0.min';
AppendScript(_version, 'https://code.jquery.com/'+ _version +'.js',function(){
z = jQuery.noConflict(true);
jQuery = _jQuery; $ = _$;
z.extend(createLocalInstance());
console.log(' Loaded jQuery-' + z().jquery + ' as z. Page Version is jQuery-' + (_jQuery ? _jQuery().jquery : 'undefined'));
z(document).ready(function(){
console.log(' document loaded');
if(callback) z(callback);
if(callback != ProcessWaitList){ ProcessWaitList();}
});
});
};
function IsInitialized(){
return (typeof z !== 'undefined' && typeof z=== 'function' && !String(z).startsWith(ZInitialize.toString()));
}
function createLocalInstance(){
var local = ZInitialize;
local.IsInitialized = IsInitialized;
local.SubstrBetween = SubstrBetween;
local.AppendScript = AppendScript;
local.ProcessWaitList = ProcessWaitList;
return local;
}
var inject = SubstrBetween(ZInjectionContainer.toString(),"//BEGIN_INJECTION//", "/"+"/END_INJECTION//");
inject = inject.split('/*...').join('').split('...*/').join('');
AppendScript("ZInjectionContainer", inject);
}
})();
, , :
function RemoveStupidStuff(){
z('td.logo1').parents('table').remove();
z('#bodyarea').prev().remove();
z('#bodyarea').css('padding','0')
z('#bodyarea #mcol').prev().remove();
}
function FixIndexPage(){
console.log('making the index page less crappy');
z('#bodyarea #mcol table[width="75%"] tr td table.lista').attr('id','thegoods').css('width','100%');;
z('#thegoods tr:not(:first-child)').addClass('listing');
var listings = z('.listing')
for(var i=0; i < listings.length; i++){
var row = listings[i];
var thumb = z(row.children[0]).find('a')[0];
var hoverimg = z(row.children[1]).find('a')[0];
var link = z.SubstrBetween(hoverimg.onmouseover.toString(), "<img src=", " width=");
thumb.href = hoverimg.href;
z(thumb).find('img').attr('src', link).attr('width','350px');
}
}
var operations = [RemoveStupidStuff];
if(location.search.indexOf('page=index')>=0){
operations.push(FixIndexPage);
}
console.log('pushin site fixes to waitlist');
if(typeof ZWaitList === 'undefined')
ZWaitList = operations;
else {
ZWaitList = ZWaitList.concat(operations);
z.ProcessWaitList();
}
Chrome Dev . , .
VM300:59 pushin site fixes to waitlist
VM298:24 ZWaitList sizeof 2 detected. Auto Initializing
VM298:35 Loaded jQuery-2.2.0 as z. Page Version is jQuery-1.6.4
VM298:37 document loaded
VM298:20 Processing WaitList.
VM300:30 making the index page less crappy
VM298:20 Processing WaitList.