User:Beleg Tâl/Datafy.js

/** * My intention with this is to somewhat automate the linking and information in my Sandbox. * *  In the end, I hope to be able to specify only a link to a work on Wikisource, and the script will retrieve and display the following: * - All subpages of the work, in order * - For each subpage and the main page, the relevant author pages (including translators, editors, etc) * - For each subpage and the main page, the relevant versions/translations/disambig pages * - The Wikidata items for all of the above, along with label, description, and instanceOf data * And then it will save this to my sandbox in a nice structured page :) */ $.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function { pathoschild.TemplateScript.add({		name: 'Get Wikidata links',		category: 'DATAFY',   	script: function(editor) {		editor			.replace(/\n/g, ' \n')		}	}); });

$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function {	pathoschild.TemplateScript.add({ name: 'Get Subpages', category: 'DATAFY', script: function(editor) { var text = editor.get; var work = text.match(/==::WORK::\[\[(.*?)\]\]==/g).map(s => s.slice(12,-4)); editor.append(work); }	}); });