Greasy Fork 还支持 简体中文。

Torn City - Attack Logs extension

This script adds a Next and Previous button to the Attack Logs page.

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

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

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==
// @author        Xiphias[187717]
// @name          Torn City - Attack Logs extension
// @description   This script adds a Next and Previous button to the Attack Logs page.
// @include       http://www.torn.com/attacklogs.php*
// @include       http://torn.com/attacklogs.php*
// @include       https://www.torn.com/attacklogs.php*
// @include       https://torn.com/attacklogs.php*
// @version       1.0.0
// @namespace https://greasyfork.org/users/3898
// ==/UserScript==

$(document).ready(function() {
    runScript();
});

function addButtons(currentUserID) {

    var prevUserID = Number(currentUserID) - 1;
    var nextUserID = Number(currentUserID) + 1;
    
    var before = '<a href="/attacklogs.php?ID=' + (prevUserID) + 
    '" style="float: left;"> &lt; Previous</a>';
    
    var after = '<a href="/attacklogs.php?ID=' + (nextUserID) + '" style="float: right;">Next &gt; </a>';

    $('center > a[href="events.php"]').before(before);
    $('center > a[href="events.php"]').after(after);
}

function runScript() {
    var currentUserID  = getUserID();
    addButtons(currentUserID);
}

function getUserID() {
    var path = window.location;
    var search = path.search;
    var userID = search.substring(search.indexOf('ID=')+3);

    return userID;
}