Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Margonem Klany Online
- // @version 1.1
- // @author adi wilk
- // @include https://www.margonem.pl/?task=clanpage*
- // @include http://www.margonem.pl/?task=clanpage*
- // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
- // @grant GM_xmlhttpRequest
- // @connect margonem.pl
- // @run-at document-start
- // ==/UserScript==
- (function() {
- function a() {
- 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({
- name: l.children[o].children[1].textContent,
- world: n
- });
- k = !0, b()
- }
- function b() {
- k && j && c()
- }
- function c() {
- document.getElementById("ranking").children[0].children[0].innerHTML += "<th>Online</th>";
- var l = 0;
- 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>");
- var n = document.getElementById("ranking").rows.length - 1,
- o = "Klanowicze online: " + l + "/" + n;
- $("<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")
- }
- function d(l) {
- h[l] = g.find("#online_" + l + " p").text().trim().split(", ")
- }
- function e(l, m) {
- return 0 <= h[m].indexOf(l)
- }
- var f = [],
- g = null,
- h = {},
- j = !1,
- k = !1;
- GM_xmlhttpRequest({
- method: "GET",
- url: "http://margonem.pl/?task=stats",
- onload: function(l) {
- g = $(l.responseText), j = !0, b()
- }
- }), document.addEventListener("DOMContentLoaded", function() {
- a()
- })
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement