1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name DamageDone by default for fflogs
// @version 2024-11-24
// @description Let "Damage Done" page be the default page for a fight log
// @author Afrie
// @match https://*.fflogs.com/reports/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==

function IsValidUrl()
{
var isReport = window.location.href.indexOf('fflogs.com/reports/') >= 0;
var isFight = window.location.href.indexOf('#fight=') >= 0;
var hasType = window.location.href.indexOf('&type=') >= 0;
return isReport && isFight && !hasType;
}


if (IsValidUrl())
{
window.location.replace(window.location.toString() + "&type=damage-done");
}

var redirecting = false;
var mo = new MutationObserver(
function(mutations){
var isReport = window.location.href.indexOf('fflogs.com/reports/') >= 0;
var isFight = window.location.href.indexOf('#fight=') >= 0;
var hasType = window.location.href.indexOf('&type=') >= 0;
if (IsValidUrl())
{
if (redirecting) { return; }
window.location.replace(window.location.toString() + "&type=damage-done");
redirecting = true;
}
}
);

function watchUrlForChange(e)
{
mo.observe(document.body,
{
childList: true,
subtree: true,
});
}

window.addEventListener('load', watchUrlForChange, true);