Jump from FFlogs fight to respective xivanalysis page with a button. Redirects to selected player and pull (if any), or to the report page per default.
当前为
// ==UserScript==
// @name xivanalysis Button
// @namespace dansa#5509
// @version 1.0
// @description Jump from FFlogs fight to respective xivanalysis page with a button. Redirects to selected player and pull (if any), or to the report page per default.
// @author dansa
// @match https://*.fflogs.com/reports/*
// @match https://fflogs.com/reports/*
// @run-at document-idle
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(".xivabtn { position: fixed; z-index: 2000; bottom:0; right:0; background-color: #202020;}");
GM_addStyle(".xivaimg { height:33px;width:33px;margin:5px;background-image: url(https://xivanalysis.com/logo.png);background-size: contain;}");
function xivaurl() {
const re = /\/(?<id>[A-Za-z0-9]{16})(\#fight=(?<fight>\d{1,3}))?(.+source=(?<src>\d{1,3}))?/g;
let result = re.exec($(location).attr('pathname')+$(location).attr('hash'));
let goto = "https://xivanalysis.com/fflogs/" +
(result.groups.id ? result.groups.id + "/" : "") +
(result.groups.fight ? result.groups.fight + "/" : "") +
(result.groups.src ? result.groups.src + "/" : "");
return goto;
}
(function () {
$("body").append("<div class='report-overview-boss-box xivabtn'><a id='xivabtn' href='"+ xivaurl() +"'><div class='xivaimg'></div></a></div>");
})();
window.onhashchange = function() {
$("#xivabtn").attr("href", xivaurl());
};