User:Guarapiranga/scriptsPanel.js

const params = { action: 'parse', page: 'Special:MyPage/common.js', format: 'text/plain' };

const api = new mw.Api; var scripts;

api.get(params).done(data => {	scripts = data.parse.match(/^\s*\/\/\s*importScript\([\'\"](.+)\.js[\'\"]\)/g); });

(function {	var $html;	if(mw.loader.getState('mobile.init.styles') !== 'ready') {		$html = $(" ");		$html.append(" Scripts ");		$html.append("  ");	} else {		$html = $(" ");		$html.append(" Scripts ");		$html.append("  ");	}	var loadScript = function(e) {		mw.loader.load(e.data.src);		$(e.target).parent.remove;	}; 	if(scripts) {		$.each(scripts, function(script) { var scriptName = script.replace(/ /g,"_"); $html.find("ul").append(""+script+""); $(mw.loader.getState('mobile.init.styles') !== 'ready' ? "#mw-panel" : "#column-one").append($html); $("#t-script-"+scriptName).click({		 	script: script.replace(/_/g," "),		  	src: "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title="+scriptName+".js"		  }, loadScript); }); 	} /* else { 		$html.find("ul").append("No scripts registered!"); 		$(mw.loader.getState('mobile.init.styles') !== 'ready' ? "#mw-panel" : "#column-one").append($html); 	} */ });