User:Proteins/helpmessages.js

// // Rudimentary help service for newbie Wikipedians // May be more convenient than a cheat-sheet and faster than browsing Help:Contents // // To use this script, add "importScript('User:Proteins/helpmessages.js');" to your monobook.js subpage // under your user page, as you can see at User:Proteins/monobook.js

// To-do list: internal links, external links, hatnotes, sections, subsections, images, references, footnotes, //            tables, lists, math, superscript, subscript, redirects, disambiguations, sounds, blockquote, gallery, //            categories, links to sections and other anchors, template messages, AfD, namespaces, //            search box, sidebar, history, diffs, talk page, edit toolbar, editing, citation needed, //            merge, move, tagging, redlink, article creation, incoming links, orphan, vandalism & countervandalism, //            edit wars, administrators, watchlist, NPOV, V, NOR, COPY, acronyms, magic words

//****************** // The Main Function //****************** function wikiHelpMessages { var url_string = ""; var error_string = ""; var alert_string = ""; var search_string = "";

// Initial greeting alert_string = "Hello " + wgUserName + "! What would you like help with?\n\n"; alert_string += "Examples include \"boldface text\", etc.\n"; search_string = window.prompt(alert_string);

if (search_string.match(/glossary/ig)) { // check for GLOSSARY request alert_string = "If I understand you correctly, you'd like to see the Wikipedia glossary?\n\n"; alert_string += "I'll open it up for you right after you click \"OK\"; thanks!";

url_string = "http://en.wikipedia.org/wiki/Wikipedia:Glossary"; window.open(url_string);

} else if ((search_string.match(/cheatsheet/ig)) || (search_string.match(/cheat\-sheet/ig)) || (search_string.match(/cheat\s+sheet/ig))) { // check for CHEATSHEET request alert_string = "If I understand you correctly, you'd like to see the editing \"cheat-sheet\"?\n\n"; alert_string += "I'll open one up for you right after you click \"OK\"; thanks!"; url_string = "http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet"; window.open(url_string);

} else if (search_string.match(/boldface/ig)) { // check for BOLDFACE request alert_string = "To show words in boldface type, enclose them in three single quotes, like this: \'\'\'bold words\'\'\'\n\n "; alert_string += "You might be able to do this enclosing more quickly by highlighting the words with your mouse and blick on the \"B\" button. Note that reverse does not work: if you highlight words enclosed in three single quotes and click on \"B\", the text is not un-bolded.\n\n" alert_string += "For your convenience, I'll open a window for you that describes the typical uses of boldface type on Wikipedia. It's mainly used in the first sentence to highlight the article title.  Please don't use it in section headings or for emphasis - thanks!" window.alert(alert_string); url_string = "http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style_(text_formatting)#Boldface"; window.open(url_string);

} else if (search_string.match(/italic/ig)) { // check for ITALIC request alert_string = "To show words in italics, enclose them in two single quotes, like this: \'\'words in italics\'\'\n\n"; alert_string += "You might be able to do this enclosing more quickly by highlighting the words with your mouse and blick on the \"I\" button. Note that reverse does not work: if you highlight words enclosed in two single quotes and click on \"I\", the text is not un-italicized.\n\n" alert_string += "For your convenience, I'll open a window for you that describes the typical uses of italics on Wikipedia. It's mainly used for the titles of longer works, such as \'\'Romeo and Juliet\'\', although it may be used (sparingly) for emphasis or to highlight a parallel construction.  It's also used for non-English terms, for genus and species names in taxonomy, for mathematical variables, and for words being cited as words." window.alert(alert_string); url_string = "http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style_(text_formatting)#Italic_face"; window.open(url_string);

} else { alert_string = "I'm so sorry, " + wgUserName + ", I don't understand your request; perhaps try re-wording it?\n\n" alert_string += "If that doesn't work, please write to User_talk:Proteins to explain what you were looking for.\n\n"; alert_string += "I'll open a general Help page for you; perhaps you'll find what you're looking for there?\n\n"; alert_string += "Good luck and thank you!"; window.alert(alert_string);

url_string = "http://en.wikipedia.org/wiki/Help:Contents/Editing_Wikipedia"; window.open(url_string); } } // closes wikiHelpMessages

$(function { mw.util.addPortletLink('p-cactions', 'javascript:wikiHelpMessages', 'help', 'ca-help', 'Help for various topics', , ); }); //