Last active
November 22, 2021 00:01
-
-
Save helloimbernardo/e785074ac480316a0d365ca678ba1832 to your computer and use it in GitHub Desktop.
MoodleNoDownload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Moodle No Download | |
// @version 1.0 | |
// @description Open files from moodle directly on your browser without being forced to download them | |
// @author helloimbernardo (https://github.com/helloimbernardo) | |
// @homepage https://gist.github.com/helloimbernardo/e785074ac480316a0d365ca678ba1832 | |
// @updateURL https://gist.githubusercontent.com/helloimbernardo/e785074ac480316a0d365ca678ba1832/raw/moodleNoDownload.js | |
// @downloadURL https://gist.githubusercontent.com/helloimbernardo/e785074ac480316a0d365ca678ba1832/raw/moodleNoDownload.js | |
// @icon https://www.google.com/s2/favicons?domain=moodle.org | |
// @icon64 https://www.google.com/s2/favicons?sz=64&domain=moodle.org | |
// @grant none | |
// Change this URL to your moodle URL if you are having issues | |
// @include https://moodle* | |
// @include http://moodle* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let links = document.getElementsByTagName('a'); | |
for (var i = 0, l = links.length; i < l; i++) { | |
let current; | |
current = links[i].href; | |
if (current.includes('\?forcedownload=1')) { | |
current = current.replace('?forcedownload=1', '?forcedownload=0'); | |
console.log(current); | |
links[i].href = current; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MoodleNoDownload
How to use