Odkop zakopane

odkopuje zakopane znaleziska

当前为 2017-12-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         Odkop zakopane
// @namespace    *
// @version      0.2
// @description  odkopuje zakopane znaleziska 
// @author       Arkatch
// @match        *://www.wykop.pl/ludzie/buried/*
// @grant  none
// ==/UserScript==
function ajax(url){
	var request = new XMLHttpRequest();
	request.open("POST", url, true);
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	request.send();
}
function getAjaxLink(x){
	return x.getElementsByTagName('a')[0].href;
}
function getElem(){
	var x = document.getElementsByClassName('diggbox digout burried');
	var j = x.length;
	var i;
	var tab = [];
	for(i = 0;i<j;i++){
		let temp = x[i];
		tab.push( getAjaxLink(temp) );
	}
	return tab;
}
function ajaxRequest(){
	var ajaxLink = getElem();
	for(var i of ajaxLink){
		ajax(i);
	}
	return true;
}
function next(){
	var x = document.querySelector('.wblock.rbl-block.pager > p');
	x.lastElementChild.click();
}
window.onload = (function(){
	setTimeout(ajaxRequest, 1000);
	setTimeout(next, 6000);
})();