Jump to content

User:Proteins/switchboard.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Proteins (talk | contribs) at 04:38, 9 July 2009 (begin sketch of script). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<pre>
// If you are a known user, this script connects you with someone who will help you.
//
// To use this script, add "importScript('User:Proteins/switchboard.js');" to your monobook.js subpage 
// under your user page, as you can see at User:Proteins/monobook.js

var known_users = [
	"Proteins", "Awadewit", "TimVickers", "John_Broughton", "SvHannibal"
];

var known_helpers = [
	"Proteins", "Awadewit", "TimVickers", "John_Broughton", "SvHannibal"
];

var helper_descriptions = {

}; 

function switchboard() {
	var alert_string = "";

// Initial diagnostics
	alert_string = "This is the switchboard function.";
	window.alert(alert_string);
	return;

// Check that the invoker is on the list of known users


// Select a random helper
	num_known_helpers = known_helpers.length;
 	random_double = num_known_helpers * Math.random();
	random_helper_index = Math.floor(random_double);
	if ((random_helper_index < 0) || (random_helper_index >= num_known_helpers)) { continue; }
 
	random_helper = known_helper[random_helper_index];

// Check that the user wishes to contact this helper

// Open the User talk page of the helper

} // closes function switchboard()

addOnloadHook(function () {
            addPortletLink('p-cactions', 'javascript:switchboard()', 'help me!', 'ca-switchboard', 'Contact someone who will help you and answer your questions', 'g', '');
});
 
//</pre>