Wikia


// console.log("Begin of http://recepten.wikia.com/wiki/Service Desk.js"); /*************************************************************************************************** Add-on: Service Desk This add-on replaces the content of a page named: * "Service Desk Front Page" (English) * "Service Balie Start Pagina" (Dutch) with a help navigator (=Service Desk Front Page) in the same language. For documentation refer to http://documentalists-sandbox.wikia.com/wiki/Service Desk. ***************************************************************************************************/ /*--Dependencies------------------------------------------------------------------------------------ These files shall be included before including this file: [[:Localization.js]] /*************************************************************************************************** HTML elements, includes styles to get control over the style used. A cascading stylesheet that defines a style for a class of elements wasn't good enough. ***************************************************************************************************/ function A(href, onclick, innerHTML) { console.log("Begin of A()."); var HTML = "<a href=\"" + href + "\" onclick=\"" + onclick + "\" style=\"margin: 0; padding: 0;" + " font-size: 14; line_height: 22px; \">" + innerHTML + "</a>"; console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function Button(onclick, innerHTML) { console.log("Begin of Button()."); var HTML = "<button onclick=\"" + onclick + "\" style=\"width: 100%; \">" + innerHTML + "</butt" + "on>"; console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function InputText(id, value) { console.log("Begin of InputText()."); var HTML = "<input id=\"" + id + "\" value=\"" + value +"\" style=\"width: 98%; \" type=\"text" + "\"/>"; console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function P(innerHTML) { console.log("Begin of P()."); var HTML = "<p style=\"margin: 0; padding: 0; font-size: 14; line_height: 22px; \">" + innerHTML + "</p>"; console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function Table(innerHTML) { console.log("Begin of Table()."); var HTML = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin: 0; border: 0px solid red" + "; padding: 0; font-size: 14; line_height: 22px; \">\n" + innerHTML + "</table>\n"; console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function td(colspan, innerHTML) { console.log("Begin of td()."); var HTML = "<td colspan=\"" + colspan + "\" style=\"height: 22px; margin: 0; border: 0px solid " + "red; padding: 0; font-size: 14; line_height: 22px; \">" + innerHTML + "</td>" console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function th(width, innerHTML) { console.log("Begin of th()."); var HTML = "<th scope=\"col\" style=\"margin: 0 0 0 10px; border: 0px solid red; padding: 0; fo" + "nt-size: 14; line_height: 22px; width: " + width + "px; \">" + innerHTML + "</th>" console.log("Returning: " + HTML); return HTML; } /*------------------------------------------------------------------------------------------------*/ function tr(innerHTML) { console.log("Begin of tr()."); var HTML = "<tr style=\"margin: 0; padding: 0; font-size: 14; line_height: 22px; vertical-align" + ": top; \">\n" + innerHTML + "\n</tr>\n"; console.log("Returning: " + HTML); return HTML; } /*************************************************************************************************** User-defined object: ServiceDeskFrontPage ***************************************************************************************************/ function ServiceDeskFrontPage(control) { console.log("Begin of ServiceDeskFrontPage()."); var mControl = control; var mPath = ""; var mNewPageName = ""; /*------------------------------------------------------------------------------------------------ * GetHTML * In this function the controls have a postfix number of 2 or 3 digits. The first 2 digit is the * row, the second, if present, the column index of this control in the table. Example button032 * is a button that will be displayed on the second column of the third row in the table. */ function getHTML() { console.log("Begin of getHTML()"); console.log("mPath: \"" + mPath + "\""); /*Common part for all paths.------------------------------------------------------------------*/ var HTML = "<!--Style attributes are used to get control over the style used. A cascading " + "stylesheet that defines a style for a class of elements wasn't good enough.-->\n"; var p01 = P(localization.translate("Welcome to the Service Desk.")) + "\n"; var tr01 = tr(td(3, p01)); var p02 = P(localization.translate("This is the place to ask for help from other members of t" + "his wiki's community.")) + "\n"; var tr02 = tr(td(3, p02)); var p03 = P(localization.translate("To create a new Service Request, answer these questions.")) + "\n"; var tr03 = tr(td(3, p03)); var tr04 = tr(td(3, "")); var tr05 = tr(th(275, localization.translate("Questions")) + th(250, localization.translate( "Answers")) + th(75, " ")); var p061 = P(localization.translate("What can we do for you?")); if (mPath == "") { var p062 = P("☐ " + localization.translate("Create a new recipe page.")); var td062 = "<td colspan=\"1\" onclick=\"setPath("1.")\" style=\"height: 22px; ma" + "rgin: 0; border: 0px solid red; padding: 0; font-size: 14; line_height: 22px; \">" + p062 + "</td>"; var tr06 = tr(td(1, p061) + td062 + td(1, "")); var p072 = P("☐ " + localization.translate("Something else.")); var td072 = "<td colspan=\"1\" onclick=\"setPath("2.")\" style=\"height: 22px; ma" + "rgin: 0; border: 0px solid red; padding: 0; font-size: 14; line_height: 22px; \">" + p072 + "</td>"; var tr07 = tr(td(1, "") + td072 + td(1, "")); HTML += Table(tr01 + tr02 + tr03 + tr04 + tr05 + tr06 + tr07); return HTML; } /*Branch: 1."Create a new recipe page."-------------------------------------------------------*/ if (mPath.substr(0,2) == "1.") { var p062 = P("☑ " + localization.translate("Create a new page.")); var button063 = Button("setPath()", "<div style=\"position: relative; float: left; \"><img " + "src=\"http://static1.wikia.nocookie.net/recepten/nl/images/5/57/Transparent_pencil.png\"" + "/></div> Edit"); var tr06 = tr(td(1, p061) + td(1, p062) + td(1, button063)); var p071 = P("What shall be the name of the new page?"); if (mPath == "1.") { var i072 = InputText(localization.translate("What shall be the name of the new page?"), mNewPageName); var button073 = Button("setNewPageName()", localization.translate("OK")); var tr07 = tr(td(1, p071) + td(1, i072) + td(1, button073)); HTML += Table(tr01 + tr02 + tr03 + tr04 + tr05 + tr06 + tr07); return HTML; } var p072 = P(mNewPageName); var button073 = Button("setPath("1.")", "<div style=\"position: relative; float" + ": left; \"><img src=\"http://static1.wikia.nocookie.net/recepten/nl/images/5/57/Transp" + "arent_pencil.png\"/></div> Edit"); var tr07 = tr(td(1, p071) + td(1, p072) + td(1, button073)); var h08 = "<h2>" + localization.translate("Dispatch") + "</h2>\n"; var tr08 = tr(td(3, h08)); var p091 = P(localization.translate("Your request will be handled by the Service Desk Wizard.") + localization.translate(" If you click the OK-button, this page will close and you'll land on the newly created page.")); var button093 = Button("setDocumentLocation("http://recepten.wikia.com/wiki/" + mNewPageName + "?action=edit&redlink=1")", localization.translate("OK")); var tr09 = tr(td(2, p091) + td(1, button093)); var p10 = P(localization.translate("Thank you for using the Service Desk Front Page.")); var tr10 = tr(td(3, p10)); HTML += Table(tr01 + tr02 + tr03 + tr04 + tr05 + tr06 + tr07 + tr08 + tr09 + tr10); return HTML; } /*Branch: 2."Something else."---------------------------------------------------------------*/ if (SDPath.substr(0,2) == "2.") { var p062 = P(localization.translate("Something else.")); var button063 = Button("setPath()", "<div style=\"position: relative; float: left; \"><im" + "g src=\"http://static1.wikia.nocookie.net/recepten/nl/images/5/57/Transparent_pencil.p" + "ng\"/></div>" + localization.translate(" Edit")); var tr06 = tr(td(1, p061) + td(1, p062) + td(1, button063)); var h07 = "<h2>" + localization.translate("Dispatch") + "</h2>\n"; var tr07 = tr(td(3, h07)); var p08 = P("The Board: Help for users of the Recepten Wikia is the best spot to file your" + " request. Click here and start a discussion."); var tr08 = tr(td(3, p08)); var p09 = P(localization.translate("Thank you for using the Service Desk Front Page.")); var tr09 = tr(td(3, p09)); HTML += Table(tr01 + tr02 + tr03 + tr04 + tr05 + tr06 + tr07 + tr08 + tr09); return HTML; } } /*----------------------------------------------------------------------------------------------*/ this.setNewPageName = function(newPageName) { console.log("Begin of setNewPageName (" + newPageName+ ")"); mNewPageName= newPageName; console.log("End of setNewPageName ()"); } /*----------------------------------------------------------------------------------------------*/ this.setPath = function(path) { console.log("Begin of setPath(" + path + ")"); mPath = path; mControl.innerHTML = getHTML(); console.log("End of setPath()"); } this.setPath(""); console.log("End of ServiceDeskFrontPage()."); } var serviceDeskFrontPage; /*************************************************************************************************** event-handlers ***************************************************************************************************/ function setDocumentLocation(url) { document.location = url; } /*------------------------------------------------------------------------------------------------*/ function setPath(path) { serviceDeskFrontPage.setPath(path); } /*------------------------------------------------------------------------------------------------*/ function setNewPageName() { var i = document.getElementById("What shall be the name of the new page?"); serviceDeskFrontPage.setNewPageName(i.value); serviceDeskFrontPage.setPath("1.1."); } /*************************************************************************************************** main ***************************************************************************************************/ function main() { console.log("Begin of main()."); // console.log("User: " + mw.config.get('wgUserName')); // console.log("UserLanguage: " + mw.config.get('wgUserLanguage')); var url = document.URL; if (url.substr(url.length - 26) == "Service_Balie_Start_Pagina") { localization.setLanguage("Dutch"); console.log("URL matches."); var Content = document.getElementById("mw-content-text"); Content.innerHTML = "<div></div>"; var ServiceDeskPlaceholder = document.getElementById("ServiceDeskPlaceholder"); serviceDeskFrontPage = new ServiceDeskFrontPage(Content.firstChild); } if (url.substr(url.length - 22) == "?action=edit&redlink=1") { var textBox = document.getElementById("wpTextbox1"); textBox.innerHTML = "{{Gerecht\n" + "<!--Vul op de regel hieronder, in plaats van het vraagteken, het aantal porties in, dat met dit recept gemaakt wordt.-->\n" + "| aantal personen = ?\n" + "<!--Vul op de regel hieronder, in plaats van het vraagteken, het aantal minuten in dat de bereiding van dit gerecht duurt. Dit is inclusief eventuele voorbereidingstijd en wachttijd.-->\n" + "| bereidingstijd = ?\n" + "<!--Vul na de regel hieronder de ingrediënten in, elk op een eigen regel. Begin elke regel met een sterretje.-->\n" + "| ingrediënten = \n" + "*\n" + "<!--Vul na de regel hieronder de bereidingsstappen in, elk op een eigen regel. Begin elke regel met een hekje.-->\n" + "| bereidingswijze = \n" + "#\n" + "| serveertips = \n" + "*\n" + "}}"; } console.log("End of main()."); } main(); console.log("End of http://recepten.wikia.com/wiki/Service Desk.js");//

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Around Wikia's network

Random Wiki