User:Bellezzasolo/Scripts/safeimport.js

/* var Safeimport = {}; ( function ( window, document, $, undefined ) { var scriptpathbefore = mw.util.wikiScript( "index" ) + "?title=",   scriptpathafter = "&action=raw&ctype=text/javascript&happy=yes";
 * safeimport.js - Safe Importer
 * Written by Bellezzasolo
 * Drop-in replacement for importScript

// Retrieve the user's Safe Importer daya $.ajax({	url: scriptpathbefore + "User:" + encodeURIComponent( mw.config.get("wgUserName")) + "/safeimport.js" + scriptpathafter,	dataType: "text" }) .fail(function {	mw.notify( "Could not load safeimport.js" ); }) .done(function ( optionsText ) {		// Quick pass if user has no options		if ( optionsText === "" ) {			return;		}

// Twinkle options are basically a JSON object with some comments. Strip those: optionsText = optionsText.replace( /(?:^(?:\/\/[^\n]*\n)*\n*|(?:\/\/[^\n]*(?:\n|$))*$)/g, "" );

try { var options = JSON.parse( optionsText ); if ( options ) { Safeimport.prefs = options; }		}		catch ( e ) { mw.notify("Could not parse safeimport.js"); }	});

function safeImportScript(name) {	if(name in Safeimport.prefs) {		var hashdata = Safeimport.prefs[name]; var salt = hashdata.salt; var hash = hashdata.hashval; }	else {	} }

});