Renbow h4x

Provide an alert when a user appears to have gained a level

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Renbow h4x
// @namespace   sophie
// @description Provide an alert when a user appears to have gained a level
// @include     https://www.wanikani.com/chat/*
// @include     http://www.wanikani.com/chat/*
// @version     0.1
// @grant       none
// @license     GPL version 3 or later: http://www.gnu.org/copyleft/gpl.html
// ==/UserScript==

function parse( ) {
  var names = window.localStorage.renbow ?
	JSON.parse(window.localStorage.renbow)
	: { };
  var authors = document.querySelectorAll('.forum-post-author > div');
  var nameExpr = /([^\/]*)$/;
  for(var i=0;i<authors.length;++i) {
    var name = nameExpr.exec(authors[i].children[0].href)[1];
    var level = parseInt(authors[i].children[1].textContent,10);
    if(names[name] && names[name] < level)
      alert(name + " has gained a level!");
    names[name] = level;
  }
  window.localStorage.renbow = JSON.stringify(names);
}
window.onload = parse( );