// ==UserScript==

// @name osu! Beatmap Mirror

// @version 1503

// @description Adds a mirror link to osu! download pages

// @include https://osu.ppy.sh/p/*

// @include https://osu.ppy.sh/s/*

// @include https://osu.ppy.sh/b/*

// @copyright Ace3DF, 2014, some random guy

// @namespace https://greasyfork.org/users/5056

// ==/UserScript==

// Beatmap search page

// Search for each beatmap element

var search = document.getElementsByClassName("beatmap_download_link")[0];

// Get beatmap ID from download link

var BeatmapID = search.getAttribute("href");

// split the /d/#### link, take the second part

BeatmapID = BeatmapID.split( '/' )[2];

// Find the header HTML to edit and add the links

var html = document.getElementsByTagName("h1")[0]; // Get location to add the link to the site

html.innerHTML = html.innerHTML + "<br>Mirror Links »<a href='http://bloodcat.com/osu/m/" + BeatmapID + "'> Bloodcat</a>"; //Add Bloodcat

html.innerHTML = html.innerHTML + " - <a href='http://loli.al/s/" + BeatmapID + "'> loli</a>"; //Add loli