Last active
August 4, 2021 00:24
-
-
Save Basicprogrammer10/c75f18d75db56df9d313b540debf0230 to your computer and use it in GitHub Desktop.
Add a View / Like ratio to the stats bar on any instructable
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 Instructables View Like Ratio | |
// @namespace https://www.instructables.com | |
// @version 0.2 | |
// @description Add a V/L ratio to the stats bar on any instructable | |
// @author Connor Slade | |
// @match http*://www.instructables.com/* | |
// @icon https://www.instructables.com/assets/img/siteassets/favicon.ico | |
// @updateURL https://gist.githubusercontent.com/Basicprogrammer10/c75f18d75db56df9d313b540debf0230/raw/a9b540195b3161572d5242e927109e907f96d1a2/Instructables-VL_Ratio.js | |
// ==/UserScript== | |
(() => { | |
let views = parseInt(document.getElementsByClassName("view-count")[0].innerHTML.replace(",", "")); | |
let likes = parseInt(document.getElementsByClassName("favorite-count")[0].innerHTML.replace(",", "")); | |
let node = document.createElement("p"); | |
node.style.paddingLeft = "0"; | |
node.append(`V/L: ${Math.round((views / likes) * 100) / 100}`); | |
document.getElementsByClassName("header-stats")[0].appendChild(node); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What it looks like ↗