Last active
October 14, 2020 05:02
-
-
Save samtay/44b4348665b765a3378d4ed95d329af4 to your computer and use it in GitHub Desktop.
Reveal more forecast data
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 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 : ''; | |
}); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refresh is present now