HP-FC:Punkteabstand

ein Skript zur Anzeige der Punkteabstände im Forum

目前為 2014-06-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        HP-FC:Punkteabstand
// @author      Nugorra
// @namespace   hpfcpunkteabstand
// @description ein Skript zur Anzeige der Punkteabstände im Forum
// @include     http://www.hp-fc.de/hpfc/board/*
// @version     1.1
// @grant       none
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==

var house = [];
var points = [];

$(document).ready(function(){
    $('#inforight').css("width","330px");
    $('#punktglaeser li').each(function(){
        house.push($(this).attr('class'));
        points.push($(this).find('.punktzahl').html().replace(".",""));
    });

    var i = 0;
    var speicher = 0;
    
    while(points[i+1] > 0){
        speicher = points[i] - points[i+1];
        $('#punktglaeser li.'+house[i]).append('<span class="punktzahl">(+' + komma(speicher) + ')</span>')
        i++;
    }
    
    
});
function komma(nummer) {
    var nummer = '' + nummer;
    var laenge = nummer.length;
    
    if (laenge >3) {
       var mod = laenge % 3;
       var output = (mod > 0 ? (nummer.substring(0,mod)) : '');
       
       for (i=0 ; i < Math.floor(laenge / 3); i++) {
          if ((mod == 0)&& (i == 0)){
             output += nummer.substring(mod+ 3 * i,mod + 3 * i + 3); 
          }else{
             output+= '.' + nummer.substring(mod + 3 * i,mod + 3 * i + 3); 
          }
       } 
       return (output); 
    }else{
       return nummer; 
    }
}