Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

HackerRank Shortcuts TamperMonkey

// ==UserScript==
// @name HackerRank
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.hackerrank.com/*
// @grant unsafeWindow
// @grant GM_addStyle
// ==/UserScript==
var i=1;
function sleep(s) {
return new Promise(resolve => setTimeout(resolve, 1000*s));
}

unsafeWindow.onkeydown=(async function(e){
//console.log(e.key);
if((e.altKey || e.ctrlKey) && e.key=='Enter' ) {
$('button')[6].click();
await sleep(2);$('.submission-status')[0].scrollIntoView();
}
else if (e.altKey && e.key=='r') {//run numpad
$('button')[5].click();
console.log('SIV');
await sleep(3);$('.code-compile-test-view')[0].scrollIntoView();
}
else if((e.ctrlKey|| e.altKey )&& 'n.'.indexOf(e.key)>-1 ) {//next
$('.mlL')[0].click();
a();
}
else if (e.altKey && 'a'.indexOf(e.key)>-1){
$('textarea:not([id])').focus();
}
else if( e.altKey && e.ctrlKey && e.key=='f' ) {//full
document.querySelectorAll('a[class*=fullscreen]')[i].click();i++;i%=2;
}
else if( e.altKey && e.key=='c' ) {// challenge forum
//console.log(3);
window.open(window.location.href.split('?')[0]+'/../forum');
}
else if( e.altKey && e.key=='x' ) {//practice forum
window.open(window.location.href.split('?')[0]+'/forum');
}
});
var a=(async function(){
await sleep(2);
document.querySelectorAll('a[class*=fullscreen]')[1].click();
})
a();


This post first appeared on SMARTMANOJ, please read the originial post: here

Share the post

HackerRank Shortcuts TamperMonkey

×

Subscribe to Smartmanoj

Get updates delivered right to your inbox!

Thank you for your subscription

×