Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Margonem Klany Online
  3. // @version 1.1
  4. // @author adi wilk
  5. // @include https://www.margonem.pl/?task=clanpage*
  6. // @include http://www.margonem.pl/?task=clanpage*
  7. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
  8. // @grant GM_xmlhttpRequest
  9. // @connect margonem.pl
  10. // @run-at document-start
  11. // ==/UserScript==
  12. (function() {
  13. function a() {
  14. for (var l = document.getElementById("ranking").children[0], m = document.getElementById("ranking").rows.length, n = window.location.href.substring(window.location.href.indexOf("&w=") + 3), o = 1; o < m; o++) f.push({
  15. name: l.children[o].children[1].textContent,
  16. world: n
  17. });
  18. k = !0, b()
  19. }
  20.  
  21. function b() {
  22. k && j && c()
  23. }
  24.  
  25. function c() {
  26. document.getElementById("ranking").children[0].children[0].innerHTML += "<th>Online</th>";
  27. var l = 0;
  28. for (var m in f) h[f[m].world] || d(f[m].world), e(f[m].name, f[m].world) ? (m++, l++, document.getElementById("ranking").children[0].children[m].innerHTML += "<td class=\"cen\" bgcolor=\"#0d9b0d\"></td>") : (m++, document.getElementById("ranking").children[0].children[m].innerHTML += "<td class=\"cen\"></td>");
  29. var n = document.getElementById("ranking").rows.length - 1,
  30. o = "Klanowicze online: " + l + "/" + n;
  31. $("<div style=\"width: 512px; display: block; position: fixed; top: 10px; color: gold; font: 18pxblood; background: #400; padding: 0px 20px border: 2px solid red; font-weight: bold; text-align: center; box-shadow: 0 0 2px 2px red;\">" + o + "</div>").appendTo("#clancontent")
  32. }
  33.  
  34. function d(l) {
  35. h[l] = g.find("#online_" + l + " p").text().trim().split(", ")
  36. }
  37.  
  38. function e(l, m) {
  39. return 0 <= h[m].indexOf(l)
  40. }
  41. var f = [],
  42. g = null,
  43. h = {},
  44. j = !1,
  45. k = !1;
  46. GM_xmlhttpRequest({
  47. method: "GET",
  48. url: "http://margonem.pl/?task=stats",
  49. onload: function(l) {
  50. g = $(l.responseText), j = !0, b()
  51. }
  52. }), document.addEventListener("DOMContentLoaded", function() {
  53. a()
  54. })
  55. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement