-
Notifications
You must be signed in to change notification settings - Fork 0
/
osuNoVideoDownloads.js
36 lines (32 loc) · 1.03 KB
/
osuNoVideoDownloads.js
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
// ==UserScript==
// @name Osu No Video downloads
// @namespace http://tampermonkey.net/
// @version 0.1
// @author You
// @match *://osu.ppy.sh/beatmapsets*
// @grant GM_webRequest
// @webRequest [{"selector":"*://osu.ppy.sh/beatmapsets/*", "action":"cancel"}
// ==/UserScript==
//var filter = {urls: ["*://osu.ppy.sh/beatmapsets/*/download"]};
/*
GM_webRequest();
GM_webRequest.onBeforeRequest.addListener(
function(url){
var noVidLink = url + "?noVideo=1";
alert("no vid link: " + noVidLink);
},
filter
);
*/
//Alternative method to modify page links
window.addEventListener('load', function(event) {
var downloadButtons = document.querySelectorAll('a.js-beatmapset-download-link');
for (var button of downloadButtons) {
var originalUrl = button.getAttribute('href');
if (originalUrl.endsWith('download')) {
var url = button.getAttribute('href') + "?noVideo=1";
button.setAttribute('href', url);
console.log("replaced url with novid");
}
}
});