Skip to content

Instantly share code, notes, and snippets.

@samtay
Last active October 14, 2020 05:02
Show Gist options
  • Save samtay/44b4348665b765a3378d4ed95d329af4 to your computer and use it in GitHub Desktop.
Save samtay/44b4348665b765a3378d4ed95d329af4 to your computer and use it in GitHub Desktop.
Reveal more forecast data
// ==UserScript==
// @name Free Surfline Forecasts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Unblurr restricted forecast data. They are dumb enough to actually put the real data in the DOM.
// @author samtay
// @match http*://www.surfline.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.onload = function () {
improveAllThings();
document.querySelectorAll('.sl-forecast-data-view-toggle__button').forEach(function(btn) {
btn.addEventListener('click', function() {
for (var i = 1; i < 5; i++) {
setTimeout(improveAllThings, i*1000);
};
});
});
};
var improveAllThings = function () {
// unblur hidden items
document.querySelectorAll('[class$=blurred]').forEach(function(el) {
el.className -= '--blurred';
});
// remove blocking advertisement callouts
document.querySelectorAll('.sl-forecast-graphs-cta').forEach(function(el){el.remove();});
document.querySelectorAll('.sl-forecast-table-cta').forEach(function(el){el.remove();});
// fix styling on unblurred items
document.querySelectorAll('.NaN').forEach(function(el){
el.className = el.previousElementSibling ? el.previousElementSibling.className : '';
});
};
})();
@kikislater
Copy link

Refresh is present now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment