ffLogs2Xivanalysis

open ffxiv xivanalysis

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name ffLogs2Xivanalysis
// @version 1.2
// @description open ffxiv xivanalysis
// @match https://*.fflogs.com/reports/*
// @run-at document-idle
// @namespace com.ffxiv.police
// ==/UserScript==
(function() {
    var openPolice = function(){
        var r = new RegExp(`^http.://.*fflogs.com/reports/(?<id>[^\/]*)\/?#.*fight=(?<fight>[^&]*)`).exec(location.href);
        var fightId = r.groups.fight;
        if( fightId== "last"){
            var last = $("div.report-overview-boss-box:nth-child(2)>div>div>div>a.all-fights-entry:last").attr("onmousedown");
            fightId = /changeFightByIDAndIndex\((?<index>\d*), 0, this, true\)/.exec(last).groups.index;
        }
        var toUrl =`https://xivanalysis.com/fflogs/`+r.groups.id+"/"+ fightId +"/";

        var s = new RegExp(`source=(?<source>[^&]*)`).exec(location.href);
        if(s!= undefined){
            toUrl += s.groups.source;
        }
        window.open(toUrl,"_blank");
    }


    $("#filter-components-tab").remove();
    //"#filter-casts-tab").after(`<a  class="filter-type-tab" id="ffxiv-police"  >出警</a>`);
    //"#top-level-view-tabs").prepend(`<a class="big-tab view-type-tab" id="ffxiv-police"><span class="zmdi zmdi-help"></span> <span class="big-tab-text"><br>出警</span></a>`);
    $("#view-type-tabs").prepend(`<a class="big-tab view-type-tab" id="ffxiv-police"  ><span class="zmdi zmdi-help"></span><span class="big-tab-text"><br>出警</span></a>`);


     $("#ffxiv-police").on('click',(e)=>{

                openPolice()
     })


})();