Created
May 20, 2013 08:09
-
-
Save gwokae/5610978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name getWin | |
// @namespace my.util | |
// @include http://kunghc.pixnet.net/blog/post/30967503 | |
// @version 1 | |
// ==/UserScript== | |
function createCookie(name,value,days) { | |
if (days) { | |
var date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
var expires = "; expires="+date.toGMTString(); | |
} | |
else var expires = ""; | |
document.cookie = name+"="+value+expires+"; path=/"; | |
} | |
function eraseCookie(name) { | |
createCookie(name,"",-1); | |
} | |
var cookies = document.cookie.split(";"); | |
//console.log(cookies); | |
for (var i = 0; i < cookies.length; i++) | |
eraseCookie(cookies[i].split("=")[0]); | |
function waitNreload(sec){ | |
console.log("diff:" + diff + " wait for:" + sec + " @now:" + new Date()); | |
setTimeout("document.location.reload()", sec * 1000); | |
} | |
var curr = parseInt( document.getElementById("blog_hit_total").innerHTML ), diff = 16000000-curr; | |
if( diff > 10000){ | |
waitNreload(900); | |
}else if( diff > 2000){ | |
waitNreload( ( (diff-2000) * (899/8000)) ) ; | |
}else if(diff < 10){ | |
alert('stop::' + diff ); | |
console.log(new Date()); | |
} else { | |
waitNreload(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment