Skip to content

Instantly share code, notes, and snippets.

@Sitethief
Last active Jun 15, 2022
Embed
What would you like to do?
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