Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sabTasks() {
- var inputs = $("input[name=id_ukolu]");
- if (inputs.length > 1) {
- var taskID = inputs.get(1).value;
- console.log("TASK ID: " + taskID);
- $(".zmena-tabule-container").append('<div class="btn-sm btnOrange" style="width: 60px; margin-top: 10px;" id="gdrive-search">Vyhledat UD</div>');
- $("#gdrive-search").on("click", function (e) {
- e.preventDefault();
- window.open("https://drive.google.com/drive/search?q=" + taskID);
- });
- var solverI = "";
- var nextIsSolver = false;
- var branch = "";
- var nextIsBranch = false;
- $("td").each(function(index) {
- if (nextIsSolver) {
- var solver = $(this).text();
- var solverSplit = solver.split(" ");
- solverI = solverSplit[0].substring(0, 1) + solverSplit[1].substring(0, 1);
- nextIsSolver = false;
- }
- if (nextIsBranch) {
- branch = $(this).text();
- var newB = branch.replace(taskID, taskID + "_" + solverI);
- $(this).html($(this).text() + "<br><br>" + newB);
- nextIsBranch = false;
- }
- if ($(this).text() === "Řešitel:") {
- nextIsSolver = true;
- }
- if ($(this).text() === "ID:") {
- nextIsBranch = true;
- }
- });
- }
- }
- $(function(){
- /* SAB */
- var timer = true;
- var STrun = true;
- /*setTimeout(function(){
- sabTasks();
- timer = true;
- STrun = true;
- }, 500);*/
- $('#ajaxcontent').bind("DOMSubtreeModified",function(){
- if (timer) {
- timer = false;
- setTimeout(function(){
- if (STrun) {
- STrun = false;
- sabTasks();
- STrun = true;
- }
- }, 1000 + Math.round(Math.random() * 500));
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement