Created
January 14, 2018 07:32
-
-
Save rithvikvibhu/5fa9addc04d098d64b144f0be9099e01 to your computer and use it in GitHub Desktop.
Greasemonkey script to inject link into Entrar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DPS Canteen for Entrar | |
// @version 1 | |
// @include https://entrar.in/* | |
// @grant none | |
// ==/UserScript== | |
// Get admission number | |
var admid = document.getElementById("welcome-user").innerText.split('\n')[2].replace('/', '') | |
// Insert form | |
var f = document.createElement("form"); | |
f.setAttribute('method',"post"); | |
f.style.display = 'none'; | |
f.setAttribute('action',"https://api.dpscanteen.ml/entrar/login"); | |
var i = document.createElement("input"); | |
i.setAttribute('type',"text"); | |
i.setAttribute('value', admid); | |
i.setAttribute('name',"admid"); | |
f.appendChild(i); | |
var s = document.createElement("input"); | |
s.setAttribute('type',"submit"); | |
s.setAttribute('value',"Submit"); | |
f.appendChild(s); | |
document.getElementsByTagName('body')[0].appendChild(f); | |
// Insert link | |
var li = document.getElementById("smoothmenu1").children[0].lastElementChild; | |
var clone = li.cloneNode(true); | |
clone.text = 'Canteen'; | |
clone.firstChild.innerText = 'Canteen Portal' | |
clone.firstChild.setAttribute('target', '_self'); | |
clone.firstChild.href = 'javascript:{}' | |
clone.onclick = function() { f.submit() } | |
document.getElementById("smoothmenu1").children[0].appendChild(clone); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment