Board Game Arena - Skip last replay

This script skips the last moves replay of turn-based game of boardgamearena.com

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Board Game Arena - Skip last replay
// @namespace   http://pazziaumana.blogspot.it/
// @description This script skips the last moves replay of turn-based game of boardgamearena.com
// @match       http://*.boardgamearena.com/*
// @match       https://*.boardgamearena.com/*
// @version     1
// @grant       none
// ==/UserScript==

"use strict";

var url = window.location.href;
var rerepl = /(&|\?)replayLastTurn=1/i;
var retbl = /(&|\?)table=(\d+)/i;
var retbl_res;
var reurl = /(https?:\/\/([\w\d-]+\.)*boardgamearena\.com\/[^\?]+)\?/i;
var reurl_res;

if (rerepl.test(url))
{
    retbl_res = retbl.exec(url);
    if (retbl_res.length > 2)
    {
        reurl_res = reurl.exec(url);
        if (retbl_res.length > 1)
        {
           window.location = reurl_res[1] + "?table=" + retbl_res[2];
        }
    }
}