Reputation: 117
So basically I have the web page (which is not mine)
https://leaderboards.guildwars2.com/en/na/achievements/guild/The%20Eternal%20Wind
The link is pretty much a table.
I currently have a bookmark which adds two more columns to that table as well as other info.
javascript: (function () {
if (!window.jQuery) {
var s = document.createElement("script");
s.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
s.setAttribute("type", "text/javascript");
s.onload = function () {
var e = document.createElement("script");
e.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.0.0/moment.min.js");
e.setAttribute("type", "text/javascript");
e.onload = function () {
var e = document.createElement("script");
e.setAttribute("src", "https://raw.github.com/padolsey/jQuery-Plugins/master/sortElements/jquery.sortElements.js");
e.setAttribute("type", "text/javascript");
e.onload = function () {
jQuery("tr td.achievements .additional").each(function () {
var e = moment(jQuery(this).text().replace(/[\S\s]*?Since/g, "").trim(), "M/D/YY h:mmA");
jQuery(this).parents("tr").append('<td data-time="' + e.unix() + '">' + e.format("YYYY-MMM-DD HH:mm") + "</td>");
jQuery(this).parents("tr").append("<td>" + Math.round(((new Date).getTime() - e.unix() * 1e3) / (1e3 * 60 * 60 * 24)) + "</td>")
});
jQuery("table.real.achievements td[data-time]").sortElements(function (e, t) {
return jQuery(e).data("time") - jQuery(t).data("time")
}, function () {
return this.parentNode
})
};
document.getElementsByTagName("head")[0].appendChild(e)
};
document.getElementsByTagName("head")[0].appendChild(e)
};
document.getElementsByTagName("head")[0].appendChild(s)
};
void(null);
})();
Basically, I go to that link click the bookmark, and it works just fine. However, is there anyway that I can have that script run everytime a page is loaded? So I dont have to click it everytime I want it to take effect?
Upvotes: 1
Views: 3438
Reputation: 59336
For Firefox, use Greasemonkey. It will allow you to write scripts to alter particular pages automatically on startup.
Here is a good starting point: Looking for Greasemonkey Scriptwriting basics/tutorial
Upvotes: 1