Created
August 28, 2018 16:14
-
-
Save prahladyeri/b66ba873106474520577ff744aa1ed46 to your computer and use it in GitHub Desktop.
Userscript to add auto-refresh functionality to GMail Classic
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 GMail Classic | |
// @namespace https://prahladyeri.com | |
// @version 0.1 | |
// @description Add refresh timer to GMail Classic | |
// @author Prahlad Yeri | |
// @match https://mail.google.com/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var seconds = 300; //5 mins | |
var interval = seconds * 1000; | |
var remaining = interval; | |
var btn = document.createElement("button"); | |
btn.id = 'btnRefresh'; | |
btn.textContent = "Refresh (" + (remaining/1000) + " seconds)"; | |
btn.onclick = function() { | |
window.location = location; | |
} | |
$("div#gbar").append(btn); | |
setInterval(refreshMe, interval); | |
setInterval(function(){ | |
remaining = remaining - 1000; | |
btn.textContent = "Refresh (" + (remaining/1000) + " seconds)"; | |
}, 1000); | |
// | |
function refreshMe() { | |
window.location = window.location; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment