Difference between revisions of "MediaWiki:Common.js"

From VoWi
Jump to navigation Jump to search
(+Downloadlinks für <pre data-filename=Foo.txt>)
(No difference)

Revision as of 23:03, 15 May 2019

/* Das folgende JavaScript wird für alle Benutzer geladen. */

/* Downloadlinks für <pre data-filename=Foo.txt> */
$('div[data-filename]').each(function(){
  var link = $('<a>Download</a>');
  link.attr('href', 'data:text/plain;base64,' + btoa(this.textContent));
  link.attr('download', $(this).attr('data-filename'))
  $(this).prepend(link);
})