Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. function sabTasks() {
  2. var inputs = $("input[name=id_ukolu]");
  3. if (inputs.length > 1) {
  4. var taskID = inputs.get(1).value;
  5. console.log("TASK ID: " + taskID);
  6. $(".zmena-tabule-container").append('<div class="btn-sm btnOrange" style="width: 60px; margin-top: 10px;" id="gdrive-search">Vyhledat UD</div>');
  7. $("#gdrive-search").on("click", function (e) {
  8. e.preventDefault();
  9. window.open("https://drive.google.com/drive/search?q=" + taskID);
  10. });
  11.  
  12. var solverI = "";
  13. var nextIsSolver = false;
  14. var branch = "";
  15. var nextIsBranch = false;
  16. $("td").each(function(index) {
  17. if (nextIsSolver) {
  18. var solver = $(this).text();
  19. var solverSplit = solver.split(" ");
  20. solverI = solverSplit[0].substring(0, 1) + solverSplit[1].substring(0, 1);
  21. nextIsSolver = false;
  22. }
  23.  
  24. if (nextIsBranch) {
  25. branch = $(this).text();
  26. var newB = branch.replace(taskID, taskID + "_" + solverI);
  27. $(this).html($(this).text() + "<br><br>" + newB);
  28. nextIsBranch = false;
  29. }
  30.  
  31. if ($(this).text() === "Řešitel:") {
  32. nextIsSolver = true;
  33. }
  34.  
  35. if ($(this).text() === "ID:") {
  36. nextIsBranch = true;
  37. }
  38.  
  39. });
  40. }
  41. }
  42.  
  43. $(function(){
  44. /* SAB */
  45. var timer = true;
  46. var STrun = true;
  47.  
  48. /*setTimeout(function(){
  49. sabTasks();
  50. timer = true;
  51. STrun = true;
  52. }, 500);*/
  53.  
  54. $('#ajaxcontent').bind("DOMSubtreeModified",function(){
  55. if (timer) {
  56. timer = false;
  57. setTimeout(function(){
  58. if (STrun) {
  59. STrun = false;
  60. sabTasks();
  61. STrun = true;
  62. }
  63. }, 1000 + Math.round(Math.random() * 500));
  64. }
  65. });
  66.  
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement