projetFER

projetFER Timer à resu

当前为 2014-08-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name projetFER
  3. // @namespace projetFER
  4. // @description projetFER Timer à resu
  5. // @include http://www.worldofstargate.fr/*
  6. // @version 1.5
  7. // ==/UserScript==
  8.  
  9. $(document).keyup(function (event) {
  10. if(event.keyCode == 82 ){
  11. var tabResu = $('div[class^="resu_bar_"]');
  12. var j = 0;
  13. var h = 0;
  14. var m = 0;
  15. var s = 0;
  16. var globalTime = 0;
  17. var timeAfficher = "";
  18. if(tabResu.length > 0){
  19. tabResu.each(function(res){
  20. globalTime += parseInt($(this).find("span:nth-child(4)").text());
  21. });
  22. console.log(globalTime);
  23. var tmp = 0;
  24. j = (globalTime - globalTime % 86400)/86400;
  25. tmp += j*86400;
  26. h = (globalTime - tmp - ((globalTime-tmp)%3600))/3600;
  27. tmp += h*3600;
  28. m = (globalTime - tmp - ((globalTime-tmp)%60))/60;
  29. tmp += m*60;
  30. s = globalTime - tmp;
  31. }
  32. if($("#timerresu").size() > 0){
  33. timeAfficher = "Temps résurrection : "+j+"j"+h+"h"+m+"m"+s+"s";
  34. $("#timerresu").text(timeAfficher);
  35. }
  36. else{
  37. timeAfficher += "\t<p id=\"timerresu\" class=\"awesome\"> Temps résurrection : "+j+"j"+h+"h"+m+"m"+s+"s" +"</p>";
  38. var lien = $(".medium.lightblue.awesome");
  39. if(lien.text().indexOf("planification") != -1){
  40. lien.after(timeAfficher);
  41. }
  42. }
  43. }
  44. });