Skip to content

Instantly share code, notes, and snippets.

@scips
Last active June 19, 2020 07:46
Show Gist options
  • Save scips/e4673e4b12dd05e2010842578925954c to your computer and use it in GitHub Desktop.
Save scips/e4673e4b12dd05e2010842578925954c to your computer and use it in GitHub Desktop.
Count Media on Auvio by page
// ==UserScript==
// @name Count Media on Auvio Page
// @version 1
// @include https://*.rtbf.be/auvio/*
// @author Sébastien Barbieri
// ==/UserScript==
var counter = document.createElement("div");
counter.innerHTML = '<div id="myCounter" style="margin: 0 auto 0 auto; ' +
'border-bottom: 1px solid red; margin-bottom: 5px; ' +
'font-size: small; background-color: #000000; ' +
'z-index: 5000; position: fixed; top: 40px; left: 40px;' +
'color: #ffffff;"><p style="margin: 2px 0 1px 0;"> ' +
'Scroll down then click me' +
'</p>' +
'</div>';
document.body.insertBefore(counter, document.body.firstChild);
document.getElementById('myCounter').onclick = function changeContent() {
totalCount = document.querySelectorAll('article.col-xxs-6').length;
document.querySelector('#myCounter > p').innerHTML = "Medias: "+totalCount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment