Skip to content

Instantly share code, notes, and snippets.

@isaacramthal
Forked from lgh06/refresh.user.js
Last active June 5, 2018 14:36
Show Gist options
  • Save isaacramthal/9c52a845ac6a0cb70d106e6a4ec6a2c8 to your computer and use it in GitHub Desktop.
Save isaacramthal/9c52a845ac6a0cb70d106e6a4ec6a2c8 to your computer and use it in GitHub Desktop.
auto refresh with Tampermonkey
// ==UserScript==
// @name css-refresh
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @require http://cdn.bootcss.com/crypto-js/3.1.2/rollups/sha1.js
// @match http://m.kankan.com/v/*
// @match http://127.0.0.1:8083/*
// @match http://192.168.28.52:8083/*
// @run-at document-idle
// @grant GM_xmlhttpRequest
// ==/UserScript==
/* eslint-disable */
(function (){
'use strict';
setInterval(()=>{
GM_xmlhttpRequest({
method: "GET",
url: 'http://192.168.1.1/Main_LogStatus_Content.asp' + "?" + Math.random(),
onload: function (response){
var last = localStorage.getItem('lastscript');
var str = response.responseText;
var sha = CryptoJS.SHA1(str).toString();
//console.log(sha);
localStorage.setItem('lastscript', sha + '');
if( last != sha )
window.location.reload();
}
});
}, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment