Skip to content

Instantly share code, notes, and snippets.

@megamit
Forked from noodlebox/tempfix.plugin.js
Last active January 8, 2017 14:54
Show Gist options
  • Save megamit/90326e98ff45f86d24f526d18bcffc58 to your computer and use it in GitHub Desktop.
Save megamit/90326e98ff45f86d24f526d18bcffc58 to your computer and use it in GitHub Desktop.
Temporary BD Fix
//META{"name":"tempFix"}*//
/*@cc_on
@if (@_jscript)
// Offer to self-install for clueless users that try to run this directly.
var shell = WScript.CreateObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
var pathPlugins = shell.ExpandEnvironmentStrings("%APPDATA%\\BetterDiscord\\plugins");
var pathSelf = WScript.ScriptFullName;
// Put the user at ease by addressing them in the first person
shell.Popup("It looks like you mistakenly tried to run me directly. (don't do that!)", 0, "I'm a plugin for BetterDiscord", 0x30);
if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) {
shell.Popup("I'm in the correct folder already.\nJust reload Discord with Ctrl+R.", 0, "I'm already installed", 0x40);
} else if (!fs.FolderExists(pathPlugins)) {
shell.Popup("I can't find the BetterDiscord plugins folder.\nAre you sure it's even installed?", 0, "Can't install myself", 0x10);
} else if (shell.Popup("Should I copy myself to BetterDiscord's plugins folder for you?", 0, "Do you need some help?", 0x34) === 6) {
fs.CopyFile(pathSelf, fs.BuildPath(pathPlugins, fs.GetFileName(pathSelf)), true);
// Show the user where to put plugins in the future
shell.Exec("explorer " + pathPlugins);
shell.Popup("I'm installed!\nJust reload Discord with Ctrl+R.", 0, "Successfully installed", 0x40);
}
WScript.Quit();
@else @*/
var tempFix = function () {};
(function () {
"use strict";
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
window.localStorage = iframe.contentWindow.localStorage
tempFix.prototype.start = function () {};
tempFix.prototype.stop = function () {};
tempFix.prototype.load = function () {};
tempFix.prototype.unload = function () {};
tempFix.prototype.getName = function () {
return "tempfix";
};
tempFix.prototype.getDescription = function () {
return "Temporary BD Fix";
};
tempFix.prototype.getVersion = function () {
return "0.1.0";
};
tempFix.prototype.getAuthor = function () {
return "noodlebox";
};
})();
/*@end @*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment