User:Proteins/editingtips.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Proteins/editingtips. |
//<pre>
// Adds box of editing tips just before the editbox textarea
//
// To use this script, add "importScript('User:Proteins/editingtips.js');" to your monobook.js subpage
// under your user page, as you can see at User:Proteins/monobook.js
// Global variables
var navcontent;
var navtoggle_text;
// Event handler for editing tips box
function toggleEditingTips() {
var alert_string = "";
// alert_string = "This function toggles the Editing Tips box.";
// window.alert(alert_string);
if (navcontent.style.display == "none") {
navcontent.style.display = "block";
navtoggle_text.data = "[hide]";
} else {
navcontent.style.display = "none";
navtoggle_text.data = "[show]";
}
return;
} // closes function toggleEditingTips()
// The main function
function editingTips() {
var alert_string = "";
var boldface_element;
var list_item;
var list_item_text;
var list_item_link;
var list_item_link2;
var list_item_image;
var body_content;
var toolbar;
var editform;
var wiki_preview;
var navframe;
var navhead;
var navhead_text;
var navtoggle;
var markup_link;
var markup_link_text;
var markup_link_span;
var navcontent_text;
var navcontent_table;
var navcontent_tbody;
var navcontent_trow;
var navcontent_tcolumn1;
var navcontent_tcolumn2;
var navcontent_tcolumn3;
var navcontent_tcolumn4;
var navcontent_tcolumn5;
var navcontent_tcolumn6;
var navcontent_tcolumn1_text;
var navcontent_tcolumn2_text;
var navcontent_tcolumn3_text;
var navcontent_tcolumn4_text;
var navcontent_tcolumn5_text;
var navcontent_tcolumn6_text;
var unordered_list_col1;
var unordered_list_col2;
var unordered_list_col3;
var unordered_list_col4;
var unordered_list_col5;
var unordered_list_col6;
var magnifying_glass_image = "/media/wikipedia/commons/thumb/e/ef/Crystal_Clear_app_xmag.png/15px-Crystal_Clear_app_xmag.png";
// Get the bodyContent node
body_content = document.getElementById('bodyContent');
if (!body_content) {
window.alert("There is no bodyContent node in this article.");
return;
}
// Get the wikiPreview node
wiki_preview = document.getElementById('wikiPreview');
if (!wiki_preview) {
window.alert("ERROR: There is no wikiPreview node in this article.");
return;
}
// Get the toolbar node
toolbar = document.getElementById('toolbar');
if (!toolbar) {
window.alert("ERROR: There is no toolbar node in this article.");
return;
}
// Get the editform node
editform = document.getElementById('editform');
if (!editform) {
window.alert("ERROR: There is no editform node in this article.");
return;
}
// Create the DIV elements
navframe = document.createElement("DIV");
navhead = document.createElement("DIV");
navcontent = document.createElement("DIV");
navframe.appendChild(navhead);
navframe.appendChild(navcontent);
body_content.insertBefore(navframe, editform);
// Assign basic properties to the new DIV elements
navframe.id = "helpbox navframe";
navhead.id = "helpbox navhead";
navcontent.id = "helpbox navcontent";
navframe.className = "NavFrame collapsed";
navhead.className = "NavHead";
navcontent.className = "NavContent";
// Set the CSS properties
navframe.style.border = "2px solid #44aa44";
navhead.style.background = "#66ff66";
navhead.style.textAlign = "center";
navcontent.style.display = "none";
// Add text and toggle to navhead
markup_link = document.createElement("A");
navhead.appendChild(markup_link);
markup_link.className = "mw-redirect";
markup_link.title = "Reference page for wiki-markup";
markup_link.style.float = "left";
markup_link.style.cursor = "help";
markup_link.href = "/wiki/User:Proteins/Wiki_markup";
markup_link.target = "_blank";
markup_link_text = document.createTextNode("Full list");
markup_link.appendChild(markup_link_text);
cheatsheet_link = document.createElement("A");
navhead.appendChild(cheatsheet_link);
cheatsheet_link.className = "mw-redirect";
cheatsheet_link.title = "Wiki-markup cheatsheet";
// cheatsheet_link.style.float = "left";
cheatsheet_link.style.cursor = "help";
cheatsheet_link.href = "/wiki/Wikipedia:Cheatsheet";
cheatsheet_link.target = "_blank";
cheatsheet_link_text = document.createTextNode("Cheatsheet");
cheatsheet_link.appendChild(cheatsheet_link_text);
navhead_text = document.createTextNode("Editing tips");
navhead.appendChild(navhead_text);
navtoggle = document.createElement("A");
navhead.appendChild(navtoggle);
navtoggle.id = "NavToggle2";
navtoggle.className = "NavToggle";
navtoggle.style.cursor = "help";
navtoggle.onclick = toggleEditingTips;
navtoggle_text = document.createTextNode("[show]");
navtoggle.appendChild(navtoggle_text);
// Add content to navcontent
// navcontent_text = document.createTextNode("Put general instructions here.");
// navcontent.appendChild(navcontent_text);
navcontent_table = document.createElement("TABLE");
navcontent.appendChild(navcontent_table);
navcontent_table.className = "multicol";
navcontent_table.style.width = "100%";
navcontent_tbody = document.createElement("TBODY");
navcontent_table.appendChild(navcontent_tbody);
navcontent_trow = document.createElement("TR");
navcontent_tbody.appendChild(navcontent_trow);
navcontent_tcolumn1 = document.createElement("TD");
navcontent_tcolumn1.width = "16%";
navcontent_tcolumn1.align = "left";
navcontent_tcolumn1.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn1);
boldface_element = document.createElement("B");
navcontent_tcolumn1_text = document.createTextNode("Article basics");
boldface_element.appendChild(navcontent_tcolumn1_text);
navcontent_tcolumn1.appendChild(boldface_element);
unordered_list_col1 = document.createElement("UL");
navcontent_tcolumn1.appendChild(unordered_list_col1);
list_item = document.createElement("LI");
unordered_list_col1.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.target = "_blank";
list_item_link.title = "Paragraphs: Exactly one blank line";
list_item_link.href = "/wiki/User:Proteins/Wiki_markup#paragraphs";
list_item_text = document.createTextNode("Paragraphs ");
list_item_link.appendChild(list_item_text);
list_item = document.createElement("LI");
unordered_list_col1.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.target = "_blank";
list_item_link.title = "Wikilinks: Enclose in double square brackets, e.g., [[DNA]]. Wikilinks can be renamed, e.g., [[nucleosome]]s or [[nucleosome|nucleosomal]]";
list_item_link.href = "/wiki/User:Proteins/Wiki_markup#wikilinks";
list_item_text = document.createTextNode("Wikilinks ");
list_item_link.appendChild(list_item_text);
list_item_link2 = document.createElement("A");
list_item.appendChild(list_item_link2);
list_item_link2.target = "_blank";
list_item_link2.title = "Cheatsheet:Internal links";
list_item_link2.href = "/wiki/Wikipedia:Cheatsheet#Internal_link";
list_item_image = document.createElement("IMG");
list_item_image.src = magnifying_glass_image;
list_item_image.width=15;
list_item_image.height=15;
list_item_link2.appendChild(list_item_image);
list_item = document.createElement("LI");
unordered_list_col1.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.target = "_blank";
list_item_link.title = "Headings: Enclose in two or more equal signs, e.g., ==Section heading==";
list_item_link.href = "/wiki/User:Proteins/Wiki_markup#headings";
list_item_text = document.createTextNode("Headings ");
list_item_link.appendChild(list_item_text);
list_item_link2 = document.createElement("A");
list_item.appendChild(list_item_link2);
list_item_link2.target = "_blank";
list_item_link2.title = "Cheatsheet:Section headings";
list_item_link2.href = "/wiki/Wikipedia:Cheatsheet#Section_headings";
list_item_image = document.createElement("IMG");
list_item_image.src = magnifying_glass_image;
list_item_image.width=15;
list_item_image.height=15;
list_item_link2.appendChild(list_item_image);
list_item = document.createElement("LI");
unordered_list_col1.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.target = "_blank";
list_item_link.title = "Images: Enclose in double square brackets, with added parameters, e.g., [[File:DNA_replication.svg|thumb|left|250px|Diagram of DNA replication]]";
list_item_link.href = "/wiki/User:Proteins/Wiki_markup#images";
list_item_text = document.createTextNode("Images ");
list_item_link.appendChild(list_item_text);
list_item_link2 = document.createElement("A");
list_item.appendChild(list_item_link2);
list_item_link2.target = "_blank";
list_item_link2.title = "Cheatsheet:Images";
list_item_link2.href = "/wiki/Wikipedia:Cheatsheet#Thumbnail_image";
list_item_image = document.createElement("IMG");
list_item_image.src = magnifying_glass_image;
list_item_image.width=15;
list_item_image.height=15;
list_item_link2.appendChild(list_item_image);
list_item = document.createElement("LI");
unordered_list_col1.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.target = "_blank";
list_item_link.title = "References: Enclose between <ref>...</ref> tags. The enclosed material is usually a citation template.";
list_item_link.href = "/wiki/User:Proteins/Wiki_markup#references";
list_item_text = document.createTextNode("References ");
list_item_link.appendChild(list_item_text);
list_item_link2 = document.createElement("A");
list_item.appendChild(list_item_link2);
list_item_link2.target = "_blank";
list_item_link2.title = "Cheatsheet:References";
list_item_link2.href = "/wiki/Wikipedia:Cheatsheet#Footnotes/References";
list_item_image = document.createElement("IMG");
list_item_image.src = magnifying_glass_image;
list_item_image.width=15;
list_item_image.height=15;
list_item_link2.appendChild(list_item_image);
navcontent_tcolumn2 = document.createElement("TD");
navcontent_tcolumn2.width = "16%";
navcontent_tcolumn2.align = "left";
navcontent_tcolumn2.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn2);
boldface_element = document.createElement("B");
navcontent_tcolumn2_text = document.createTextNode("Talk basics");
boldface_element.appendChild(navcontent_tcolumn2_text);
navcontent_tcolumn2.appendChild(boldface_element);
unordered_list_col2 = document.createElement("UL");
navcontent_tcolumn2.appendChild(unordered_list_col2);
list_item = document.createElement("LI");
unordered_list_col2.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.title = "Italics: blahblahblah";
list_item_text = document.createTextNode("Italics");
list_item_link.appendChild(list_item_text);
navcontent_tcolumn3 = document.createElement("TD");
navcontent_tcolumn3.width = "16%";
navcontent_tcolumn3.align = "left";
navcontent_tcolumn3.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn3);
boldface_element = document.createElement("B");
navcontent_tcolumn3_text = document.createTextNode("Font effects");
boldface_element.appendChild(navcontent_tcolumn3_text);
navcontent_tcolumn3.appendChild(boldface_element);
unordered_list_col3 = document.createElement("UL");
navcontent_tcolumn3.appendChild(unordered_list_col3);
list_item = document.createElement("LI");
unordered_list_col3.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.title = "Italics: blahblahblah";
list_item_text = document.createTextNode("Italics");
list_item_link.appendChild(list_item_text);
navcontent_tcolumn4 = document.createElement("TD");
navcontent_tcolumn4.width = "16%";
navcontent_tcolumn4.align = "left";
navcontent_tcolumn4.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn4);
boldface_element = document.createElement("B");
navcontent_tcolumn4_text = document.createTextNode("Lists & links");
boldface_element.appendChild(navcontent_tcolumn4_text);
navcontent_tcolumn4.appendChild(boldface_element);
unordered_list_col4 = document.createElement("UL");
navcontent_tcolumn4.appendChild(unordered_list_col4);
list_item = document.createElement("LI");
unordered_list_col4.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.title = "Italics: blahblahblah";
list_item_text = document.createTextNode("Italics");
list_item_link.appendChild(list_item_text);
navcontent_tcolumn5 = document.createElement("TD");
navcontent_tcolumn5.width = "16%";
navcontent_tcolumn5.align = "left";
navcontent_tcolumn5.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn5);
boldface_element = document.createElement("B");
navcontent_tcolumn5_text = document.createTextNode("Miscellany");
boldface_element.appendChild(navcontent_tcolumn5_text);
navcontent_tcolumn5.appendChild(boldface_element);
unordered_list_col5 = document.createElement("UL");
navcontent_tcolumn5.appendChild(unordered_list_col5);
list_item = document.createElement("LI");
unordered_list_col5.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.title = "Italics: blahblahblah";
list_item_text = document.createTextNode("Italics");
list_item_link.appendChild(list_item_text);
navcontent_tcolumn6 = document.createElement("TD");
navcontent_tcolumn6.width = "16%";
navcontent_tcolumn6.align = "left";
navcontent_tcolumn6.valign = "top";
navcontent_trow.appendChild(navcontent_tcolumn6);
boldface_element = document.createElement("B");
navcontent_tcolumn6_text = document.createTextNode("Special");
boldface_element.appendChild(navcontent_tcolumn6_text);
navcontent_tcolumn6.appendChild(boldface_element);
unordered_list_col6 = document.createElement("UL");
navcontent_tcolumn6.appendChild(unordered_list_col6);
list_item = document.createElement("LI");
unordered_list_col6.appendChild(list_item);
list_item_link = document.createElement("A");
list_item.appendChild(list_item_link);
list_item_link.title = "Italics: blahblahblah";
list_item_text = document.createTextNode("Italics");
list_item_link.appendChild(list_item_text);
// Print acknowledgment
// alert_string = "Added box of editing tips.";
// window.alert(alert_string);
} // closes function editingTips()
addOnloadHook(function () {
// Add button only on editing pages
if ((document.URL.match("\&action=edit")) && (document.getElementById('editform'))) {
addPortletLink('p-cactions', 'javascript:editingTips()', 'editing tips', 'ca-edittips', 'Add box of editing tips as a quick reference', 'e', '');
}
});
//</pre>