Skip to content

Instantly share code, notes, and snippets.

@xtream1101
Last active November 16, 2016 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xtream1101/211332c4cb2062a77010f623796a6431 to your computer and use it in GitHub Desktop.
Save xtream1101/211332c4cb2062a77010f623796a6431 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Periscope Auto refresh all
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Refresh all table on an interval
// @author xtream1101
// @match https://www.periscopedata.com/app/*
// @grant none
// @downloadURL https://gist.githubusercontent.com/xtream1101/211332c4cb2062a77010f623796a6431/raw/periscope_auto_refresh.js
// @updateURL https://gist.githubusercontent.com/xtream1101/211332c4cb2062a77010f623796a6431/raw/periscope_auto_refresh.js
// ==/UserScript==
window.onload = function () {
// Get the more menu
var $menu_bar = $('.left-controls');
// Menu item to set auto refresh time
// Fake the class so we do not need to add our own styles
var $auto_el = $('<span>', {'class': 'full-screen auto-refresh-all'}).text("Auto Refresh");
var $auto_input = $('<input>', {'id': 'auto-refresh-value', 'value': 0});
// Add input box into menu item
$auto_el.append($auto_input);
// Add item to more menu
$menu_bar.append($auto_el);
$auto_input.on("change", function(){
// Clear current interval
clearInterval(refresh_interval);
var value = $('#auto-refresh-value').val();
set_interval(value);
});
function set_interval(){
var value = $('#auto-refresh-value').val();
if($.isNumeric(value) && value !== "0"){
clearInterval(refresh_interval);
// Create interval
refresh_interval = setInterval(function(){
// Click the refresh button
$('.more').find('.refresh-all').click();
// Make the menu go away
$('.more').click();
console.log($('#auto-refresh-value').val());
}, value*1000);
}
}
// Start
// global interval
var refresh_interval = setInterval(null, 0);
set_interval();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment