Torn City - Attack Logs extension

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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;
}