Skip to content

Instantly share code, notes, and snippets.

@12944qwerty
Last active October 19, 2023 22:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 12944qwerty/0803a840748049300d225358439b6789 to your computer and use it in GitHub Desktop.
Save 12944qwerty/0803a840748049300d225358439b6789 to your computer and use it in GitHub Desktop.
Revert to legacy voting buttons on stack exchange sites
// ==UserScript==
// @name Legacy Voting Buttons
// @version 0.2
// @description Revert to legacy voting buttons on stack exchange sites
// @author 12944qwerty
// @match https://stackexchange.com/*
// @match https://meta.stackexchange.com/*
// @match https://*.stackexchange.com/*
// @match https://*.meta.stackexchange.com/*
// @match https://stackoverflow.com/*
// @match https://meta.stackoverflow.com/*
// @match https://superuser.com/*
// @match https://meta.superuser.com/*
// @match https://askubuntu.com/*
// @match https://meta.askubuntu.com/*
// @updateURL https://gist.github.com/12944qwerty/0803a840748049300d225358439b6789/raw/e37b96615e657e0985bd3218864700246a9b51ed/SE-legacy-voting.user.js
// @downloadURL https://gist.github.com/12944qwerty/0803a840748049300d225358439b6789/raw/e37b96615e657e0985bd3218864700246a9b51ed/SE-legacy-voting.user.js
// ==/UserScript==
const containers = document.getElementsByClassName("js-voting-container");
for (const container of containers) {
const voteup = container.getElementsByClassName("js-vote-up-btn")[0];
const votedown = container.getElementsByClassName("js-vote-down-btn")[0];
const votecount = container.getElementsByClassName("js-vote-count")[0];
votecount.classList.remove("fc-theme-body-font");
votecount.classList.remove("fw-bold");
votecount.classList.remove("fs-subheading");
votecount.classList.remove("py4");
votecount.classList.remove("c-pointer");
votecount.classList.add("fc-black-500");
votecount.classList.add("fs-title");
voteup.dataset.selectedClasses = "fc-theme-primary";
votedown.dataset.selectedClasses = "fc-theme-primary";
voteup.dataset.unselectedClasses = "";
votedown.dataset.unselectedClasses = "";
voteup.classList.remove("fc-black-700");
votedown.classList.remove("fc-black-700");
voteup.classList.remove("bc-black-100");
votedown.classList.remove("bc-black-100");
voteup.classList.remove("as-center");
votedown.classList.remove("as-center");
voteup.classList.remove("bar-pill");
votedown.classList.remove("bar-pill");
voteup.classList.remove("ba");
votedown.classList.remove("ba");
voteup.classList.add("s-btn__unset");
votedown.classList.add("s-btn__unset");
const voteupsvg = voteup.children[0];
const votedownsvg = votedown.children[0];
voteupsvg.classList.remove("iconArrowUp");
voteupsvg.classList.add("iconArrowUpLg");
votedownsvg.classList.remove("iconArrowUp");
votedownsvg.classList.add("iconArrowUpLg");
voteupsvg.setAttribute("width", "36");
voteupsvg.setAttribute("height", "36");
voteupsvg.setAttribute("viewBox", "0 0 36 36");
votedownsvg.setAttribute("width", "36");
votedownsvg.setAttribute("height", "36");
votedownsvg.setAttribute("viewBox", "0 0 36 36");
voteupsvg.children[0].setAttribute("d", "M2 25h32L18 9 2 25Z");
votedownsvg.children[0].setAttribute("d", "M2 11h32L18 27 2 11Z");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment