Last active
August 29, 2015 14:04
-
-
Save glukki/d9d61709dc9c1f4354d8 to your computer and use it in GitHub Desktop.
Revisions
-
glukki revised this gist
Aug 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ var Logic = function(options){ Logic.prototype.CHECK_URL = "http://www.apple.com/library/test/success.html"; Logic.prototype.SUCCESS = "Success"; Logic.prototype.INTERVAL = 30 * 1000; // 30 seconds Logic.prototype.reload = function() { this._window.location = this.CHECK_URL; -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // @name Free WiFi Reconnect // @namespace http://glukki.ru/ // @description Detects free Wi-Fi timelimit expiration and logs you back in // @version 0.0.5 // @updateURL https://gist.githubusercontent.com/glukki/d9d61709dc9c1f4354d8/raw/FreeWifiReconnect.js // @match http://www.apple.com/library/test/success.html // @match *://login.connectum.ru/* @@ -54,7 +54,7 @@ Logic.prototype.connect = function() { if (type === "#") { element = this._window.document.getElementById(strategy); } else if (type === ".") { element = this._window.document.getElementsByClassName(strategy)[0] } else { return alert("Selector not supported"); } -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // @name Free WiFi Reconnect // @namespace http://glukki.ru/ // @description Detects free Wi-Fi timelimit expiration and logs you back in // @version 0.0.4 // @updateURL https://gist.githubusercontent.com/glukki/d9d61709dc9c1f4354d8/raw/FreeWifiReconnect.js // @match http://www.apple.com/library/test/success.html // @match *://login.connectum.ru/* @@ -51,9 +51,9 @@ Logic.prototype.connect = function() { var element; var type = strategy[0]; strategy = strategy.substr(1); if (type === "#") { element = this._window.document.getElementById(strategy); } else if (type === ".") { element = this._window.document.getElementByClassName(strategy)[0] } else { return alert("Selector not supported"); -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,10 @@ // @name Free WiFi Reconnect // @namespace http://glukki.ru/ // @description Detects free Wi-Fi timelimit expiration and logs you back in // @version 0.0.3 // @updateURL https://gist.githubusercontent.com/glukki/d9d61709dc9c1f4354d8/raw/FreeWifiReconnect.js // @match http://www.apple.com/library/test/success.html // @match *://login.connectum.ru/* // @grant unsafeWindow // @copyright 2014+, Vitaliy Meschaninov // ==/UserScript== -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // @name Free WiFi Reconnect // @namespace http://glukki.ru/ // @description Detects free Wi-Fi timelimit expiration and logs you back in // @version 0.0.2 // @updateURL https://gist.githubusercontent.com/glukki/d9d61709dc9c1f4354d8/raw/FreeWifiReconnect.js // @match http://www.apple.com/library/test/success.html // @match http://login.connectum.ru @@ -16,7 +16,7 @@ var Logic = function(options){ Logic.prototype.CHECK_URL = "http://www.apple.com/library/test/success.html"; Logic.prototype.SUCCESS = "Success"; Logic.prototype.INTERVAL = 30 * 1000; // 1 minute Logic.prototype.reload = function() { this._window.location = this.CHECK_URL; -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ var Logic = function(options){ Logic.prototype.CHECK_URL = "http://www.apple.com/library/test/success.html"; Logic.prototype.SUCCESS = "Success"; LOGIC.prototype.INTERVAL = 30 * 1000; // 1 minute Logic.prototype.reload = function() { this._window.location = this.CHECK_URL; @@ -82,4 +82,13 @@ Logic.prototype.run = function() { */ Logic.prototype.strategy = { "login.connectum.ru": ".connectbutton" }; (function() { var instance = new Logic({ window: unsafeWindow }); instance.run(); })(); -
glukki revised this gist
Aug 2, 2014 . 1 changed file with 85 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,85 @@ // ==UserScript== // @name Free WiFi Reconnect // @namespace http://glukki.ru/ // @description Detects free Wi-Fi timelimit expiration and logs you back in // @version 0.0.1 // @updateURL https://gist.githubusercontent.com/glukki/d9d61709dc9c1f4354d8/raw/FreeWifiReconnect.js // @match http://www.apple.com/library/test/success.html // @match http://login.connectum.ru // @grant unsafeWindow // @copyright 2014+, Vitaliy Meschaninov // ==/UserScript== var Logic = function(options){ this._window = options.window; }; Logic.prototype.CHECK_URL = "http://www.apple.com/library/test/success.html"; Logic.prototype.SUCCESS = "Success"; LOGIC.prototype.INTERVAL = 1 * 60 * 1000; // 1 minute Logic.prototype.reload = function() { this._window.location = this.CHECK_URL; }; Logic.prototype.checkSuccess = function() { if (this._window && this._window.document && this._window.document.title === this.SUCCESS) { return true; } return false; }; Logic.prototype.connect = function() { var strategy = this.strategy[this._window.location.hostname]; if (!strategy) { return alert("We have no strategy for this network"); } if (typeof strategy === "object") { var keys = Object.keys(strategy); for (var i = 0; i < keys.length; i += 1) { if (this._window.location.pathname.indexOf(strategy[keys[i]]) !== -1){ strategy = strategy[keys[i]]; break; } } if(typeof strategy !== "string") { return alert("We have no matching strategy for this network"); } } var element; var type = strategy[0]; strategy = strategy.substr(1); if (type === ".") { element = this._window.document.getElementById(strategy); } else if (type === "#") { element = this._window.document.getElementByClassName(strategy)[0] } else { return alert("Selector not supported"); } if (!element) { return alert("Cant get required element"); } element.click(); }; Logic.prototype.run = function() { if (!this.checkSuccess()) { return this.connect(); } setTimeout(this.reload.bind(this), this.INTERVAL); }; /** * Click rules * hostname : selector * OR * hostname : pathname (substring) : selector */ Logic.prototype.strategy = { "login.connectum.ru": ".connectbutton" }; -
glukki created this gist
Aug 2, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ //