Skip to content

Instantly share code, notes, and snippets.

@mdtareque
Last active April 20, 2020 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdtareque/7c7976281efb698d014fcb7443ae2aa9 to your computer and use it in GitHub Desktop.
Save mdtareque/7c7976281efb698d014fcb7443ae2aa9 to your computer and use it in GitHub Desktop.
tamper monkey script coding
// ==UserScript==
// @name CF show lang
// @namespace mdtareque
// @version 0.4
// @description try to take over the world!
// @author Md Tareque Khan
// @match https://codeforces.com/contest/*standings*
// @grant none
// ==/UserScript==
/*
0.1 : show languages on standing page
0.2 : delete 'GNU' part to reduce noise for c++
0.3 : show languages during system testing
0.4 : handle locked submission
*/
(function() {
'use strict';
var getUpdatedTitle = function(lang) {
console.log("lang1 " + lang);
lang = lang.substring(lang.lastIndexOf(',')+2);
console.log("lang2 " + lang);
if(lang.startsWith("GNU"))
lang = lang.substring(4);
return lang;
};
var updateNode = function(node) {
var oldText = node.children[1].innerHTML;
var lang = getUpdatedTitle(node.title);
node.children[1].innerHTML = oldText + " " + lang;
};
$("[problemid][title] .cell-accepted").each(function() {
updateNode($(this).parent()[0]);
});
$("[problemid][title] .cell-passed-system-test").each(function() {
updateNode($(this).parent()[0]);
});
$("[problemid][title] .cell-accepted-locked").each(function() {
updateNode($(this).parent()[0]);
});
})();
// ==UserScript==
// @name me download solution cj
// @namespace mtk
// @version 0.1
// @description download solution cj
// @author You
// @match https://codingcompetitions.withgoogle.com/*/submissions/*
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var addHtml = function() {
$('<style type="text/css"> \
#mtk-download { \
cursor: pointer; \
position:fixed; \
z-index: 10;\
top: 200px;\
right: 10px;\
border: 1px solid black;\
padding: 15px;\
}\
</style>\
<button id="mtk-download">Download solutions</div>').appendTo('body');
};
addHtml();
$("#mtk-download").click(function() {
console.log("Clicked download...");
$(".download-button").each(function() {
var t = $(this);
console.log(t);
t.click();
} );
});
})();
@mdtareque
Copy link
Author

codejam langs/user
eatmore, how you lewin - java
cakewalk, epic_time - python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment