Skip to content

Instantly share code, notes, and snippets.

@MinecraftPublisher
Last active September 29, 2021 11:56
Show Gist options
  • Select an option

  • Save MinecraftPublisher/48e605aa758269450277914bc89242af to your computer and use it in GitHub Desktop.

Select an option

Save MinecraftPublisher/48e605aa758269450277914bc89242af to your computer and use it in GitHub Desktop.
PlugCord

PlugCord

A custom discord mod that updates automatically.

How to install PlugCord?

Installation steps coming soon!

/*
* How to install PlugCord
* Coming soon
*
* What is PlugCord
* PlugCord is a custom discord mod/plugin.
*/
function httpGetAsync(theUrl, callback)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
const PlugCord = {
version: 'v1.0.1-2',
element: {},
init: function(){
console.log('Attaching element...')
let element = document.createElement('div')
element.classList.add('PlugCord')
element.innerHTML = 'PlugCord ' + PlugCord.version
element.style = 'position: fixed; border-radius: 5px; padding: 10px; bottom: 75px; right: 16px; background-color: #2f3137; color: white; border: 3px solid #141516; min-width: 80px; min-height: 16px; z-index: 100000;'
document.body.appendChild(element)
PlugCord.element = element
console.log('Element attached.')
setInterval(PlugCord.update, 10000)
},
update: function() {
console.log('Checking for updates...')
httpGetAsync('https://gist.github.com/MinecraftPublisher/48e605aa758269450277914bc89242af/raw/version', function(res) {
if(res == PlugCord.version) {
console.log('PlugCord is up to date.')
} else {
PlugCord.element.innerHTML = '<a style="text-decoration: none;" onclick="location.reload()" style="color: yellow;">Outdated PlugCord version, Click here to update.</a>'
}
})
}
}
PlugCord.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment