User:Yivan000/common.js

var filename = mw.config.get("wgTitle").replace("/code", "");

$("#code-lrc").before(addDownload($("#code-lrc").text, filename)); $("#code-lrc-2").before(addDownload($("#code-lrc-2").text, filename));

function addDownload(text, name){ var download = $("Download"); download.html("Download directly as "+name+""); download.css("padding-left", "4em"); download.click(function{		var textFile = null;		var data = new Blob([text], {type: 'text/plain'});	   if (textFile !== null) {	      window.URL.revokeObjectURL(textFile);	    }	    textFile = window.URL.createObjectURL(data);	    download.attr("target", "_blank");	    download.attr("href", textFile);	    download.attr("download", filename);	}); return download; }