Skip to content

Instantly share code, notes, and snippets.

@kikislater
Forked from samtay/better_surfline.js
Created October 14, 2020 05:02
Show Gist options
  • Save kikislater/f9c30223f7154b625d781293c9c12dbe to your computer and use it in GitHub Desktop.
Save kikislater/f9c30223f7154b625d781293c9c12dbe 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 : '';
});
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment