This commit is contained in:
libccy 2016-04-27 23:01:25 +08:00
parent 49d66436d1
commit 61768a64a3
1 changed files with 19 additions and 37 deletions

View File

@ -1,38 +1,20 @@
var reload=function(){
if(!lib.node||!lib.node.clients||!lib.node.clients.length){
game.reload();
}
};
var load=function(id){
var page = require('webpage').create();
page.settings.userAgent = 'SpecialAgent';
page.open('file:///Users/widget/Documents/noname/index.html?server='+id, function(status) {
if(status !== 'success') {
console.log('Unable to access network');
}
setInterval(function(){
page.evaluate(function(){
if(!lib.node||!lib.node.clients||!lib.node.clients.length){
game.reload();
}
});
},3600000);
});
}
var page1 = require('webpage').create();
page1.settings.userAgent = 'SpecialAgent';
page1.open('http://localhost/index.html?server=1', function(status) {
if(status !== 'success') {
console.log('Unable to access network');
}
setInterval(function(){
page1.evaluate(reload);
},3600000);
});
var page2 = require('webpage').create();
page2.settings.userAgent = 'SpecialAgent';
page2.open('http://localhost/index.html?server=2', function(status) {
if(status !== 'success') {
console.log('Unable to access network');
}
setInterval(function(){
page2.evaluate(reload);
},3600000);
});
var page3 = require('webpage').create();
page3.settings.userAgent = 'SpecialAgent';
page3.open('http://localhost/index.html?server=3', function(status) {
if(status !== 'success') {
console.log('Unable to access network');
}
setInterval(function(){
page3.evaluate(reload);
},3600000);
});
load(1);
load(2);
load(3);