Skip to content

Instantly share code, notes, and snippets.

@Zod-
Last active August 29, 2015 14:14
Show Gist options
  • Save Zod-/fda2aaacb401b68438e1 to your computer and use it in GitHub Desktop.
Save Zod-/fda2aaacb401b68438e1 to your computer and use it in GitHub Desktop.
All your hats are belong to us - Gaben
// ==UserScript==
// @name InstaSynchP Hat Stealer
// @namespace InstaSynchP
// @description All your hats are belong to us - Gaben
// @version 1.0.1
// @author Zod-
// @source https://gist.github.com/Zod-/fda2aaacb401b68438e1
// @license MIT
// @include http://*.instasynch.com/*
// @include http://instasynch.com/*
// @include http://*.instasync.com/*
// @include http://instasync.com/*
// @grant none
// @run-at document-start
// @require https://greasyfork.org/scripts/5647-instasynchp-library/code/code.js?version=49210
// ==/UserScript==
function HatStealer() {
"use strict";
this.version = '1.0.1';
this.enabled = true;
this.name = 'InstaSynchP Hat Stealer';
this.settings = [{
'label': 'Steal hats with random emote',
'id': 'random-hat-emote',
'type': 'checkbox',
'default': true,
'section': ['Steal Hats']
}, {
'label': 'Steal hats with fixed emote',
'id': 'fixed-hat-emote',
'type': 'text',
'default': '',
'size': 10,
'section': ['Steal Hats']
}, {
'label': 'Steal hats',
'id': 'enabled-hat-stealer',
'type': 'checkbox',
'default': true,
'section': ['Steal Hats']
}];
}
HatStealer.prototype.executeOnce = function () {
var th = this;
events.on(th, 'AddMessage', function (user, message) {
if ((message.trim() !== '/jpb' && message.trim() !== '/fed') || !gmc.get('enabled-hat-stealer') ||
(gmc.get('enabled-anti-hat-stealer') && user.username === thisUser().username)) {
return;
}
var oldInput = $('#cin').val(),
emotes = Object.keys(window.$codes),
e = $.Event("keypress"),
emote = gmc.get('fixed-hat-emote');
if (gmc.get('random-hat-emote')) {
emote = '/' + emotes[Math.floor(Math.random() * emotes.length)]
}
e.which = e.keyCode = 13;
$('#cin').val(emote).trigger(e);
$('#cin').val(oldInput);
});
};
window.plugins = window.plugins || {};
window.plugins.hatStealer = new HatStealer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment