Skip to content

Instantly share code, notes, and snippets.

@Sitethief
Last active June 15, 2022 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sitethief/265c6f0b2365015c61c497b5d3d8de85 to your computer and use it in GitHub Desktop.
Save Sitethief/265c6f0b2365015c61c497b5d3d8de85 to your computer and use it in GitHub Desktop.
NSEndorse
// ==UserScript==
// @name NSEndorse
// @namespace sitethiefs-ns-scripts
// @version 0.1.1
// @description Adss keybind to endorse button
// @author Sitehief of Vylixan
// @copyright GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
// @match *www.nationstates.net/*
// @grant none
// @require https://craig.global.ssl.fastly.net/js/mousetrap/mousetrap.min.js?a4098
// ==/UserScript==
(function() {
'use strict';
function noinput_mousetrap(event) {
if (event.target.classList.contains("mousetrap")) {
event.preventDefault();
event.stopPropagation();
}
}
if (window.location.href.includes('nation=')) {
Mousetrap.bind(['e'], function(ev) {
noinput_mousetrap(ev);
let button = document.querySelector('button.endorse:not(.danger)');
if (button) {
button.click();
}
}, 'keyup');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment