From d3a7de247055784f847b288bb084d71eb97a88d2 Mon Sep 17 00:00:00 2001 From: x <okp57855@psoxs.com> Date: Fri, 29 Jun 2018 19:17:22 +1200 Subject: [PATCH] code moving --- src/js/PenthouseNaming.tw | 65 +++++++++++++++++++++++++++++++++++++ src/js/displayVariables.tw | 66 -------------------------------------- 2 files changed, 65 insertions(+), 66 deletions(-) create mode 100644 src/js/PenthouseNaming.tw diff --git a/src/js/PenthouseNaming.tw b/src/js/PenthouseNaming.tw new file mode 100644 index 00000000000..dc084faf450 --- /dev/null +++ b/src/js/PenthouseNaming.tw @@ -0,0 +1,65 @@ +:: PenthouseNaming [script] +window.MS = function() { + const V = State.variables; + var name = ""; + if (V.masterSuiteNameCaps === "The Master Suite") + name = "Master Suite" + else + name = V.masterSuiteNameCaps; + return `<<link "${name}""Master Suite">><</link>> `} +window.HS = function() { + const V = State.variables; + var name = ""; + if (V.HGSuiteNameCaps === "The Head Girl Suite") + name = "Head Girl Suite" + else + name = V.HGSuiteNameCaps; + return `<<link "${name}""Head Girl Suite">><</link>> `} +window.SQ = function() { + const V = State.variables; + var name = ""; + if (V.servantsQuartersNameCaps === "The Servants' Quarters") + name = "Servants' Quarters" + else + name = V.servantsQuartersNameCaps; + return `<<link "${name}""Servants' Quarters">><</link>> `} +window.S = function() { + const V = State.variables; + var name = ""; + if (V.spaNameCaps === "The Spa") + name = "Spa" + else + name = V.spaNameCaps; + return `<<link "${name}""Spa">><</link>> `} +window.CI = function() { + const V = State.variables; + var name = ""; + if (V.clinicNameCaps === "The Clinic") + name = "Clinic" + else + name = V.clinicNameCaps; + return `<<link "${name}""Clinic">><</link>> `} +window.SC = function() { + const V = State.variables; + var name = ""; + if (V.schoolroomNameCaps === "The Schoolroom") + name = "Schoolroom" + else + name = V.schoolroomNameCaps; + return `<<link "${name}""Schoolroom">><</link>> `} +window.CB = function() { + const V = State.variables; + var name = ""; + if (V.cellblockNameCaps === "The Cellblock") + name = "Cellblock" + else + name = V.cellblockNameCaps; + return `<<link "${name}""Cellblock">><</link>> `} +window.I = function() { + const V = State.variables; + var name = ""; + if (V.incubatorNameCaps === "The Incubator") + name = "Incubator" + else + name = V.incubatorNameCaps; + return `<<link "${name}""Incubator">><</link>> `} diff --git a/src/js/displayVariables.tw b/src/js/displayVariables.tw index 4393e1d1e21..0876395eaaa 100644 --- a/src/js/displayVariables.tw +++ b/src/js/displayVariables.tw @@ -2,69 +2,3 @@ /*! <<checkvars>> macro for SugarCube 2.x */ !function(){"use strict";if("undefined"==typeof version||"undefined"==typeof version.title||"SugarCube"!==version.title||"undefined"==typeof version.major||version.major<2)throw new Error("<<checkvars>> macro requires SugarCube 2.0 or greater, aborting load");Macro.add("checkvars",{handler:function(){function toString(value,indent){var baseType=typeof value;switch(baseType){case"number":return isNaN(value)?"NaN":isFinite(value)?String(value):"Infinity";case"string":return JSON.stringify(value);case"function":return"(function)";default:if("object"!==baseType||null==value)return String(value);var objType=Object.prototype.toString.call(value);if("[object Date]"===objType)return'(object: Date, value: "'+value.toISOString()+'")';if("[object RegExp]"===objType)return"(object: RegExp, value: "+value.toString()+")";var opener,closer,result=[],indentText=" ";return indent||(indent=""),("[object Set]"===objType||value instanceof Set)&&(value=Array.from(value)),Array.isArray(value)?(opener="[\n",closer="\n"+indent+"]",value.forEach(function(p,i){result.push(indent+indentText+i+" ⇒ "+toString(value[i],indent+indentText))}),Object.keys(value).forEach(function(p){/^\d+$/.test(p)||result.push(indent+indentText+toString(p)+" ⇒ "+toString(value[p],indent+indentText))})):"[object Map]"===objType||value instanceof Map?(opener="{\n",closer="\n"+indent+"}",Array.from(value).map(function(kv){result.push(indent+indentText+toString(kv[0],indent+indentText)+" ⇒ "+toString(kv[1],indent+indentText))})):(opener="{\n",closer="\n"+indent+"}",Object.keys(value).forEach(function(p){result.push(indent+indentText+toString(p)+" ⇒ "+toString(value[p],indent+indentText))})),opener+result.join(",\n")+closer}}var dialog,sv=State.variables,names=Object.keys(sv);if(dialog=UI.setup("Story $variables","checkvars"),0===names.length)return dialog.innerHTML="<h1>Story $variables (<code>State.variables</code>):</h1><p><em>No $variables currently set…</em></p>",void UI.open();dialog.innerHTML="<h1>Story $variables (<code>State.variables</code>):</h1><table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody></tbody></table>"+(/applewebkit|chrome/.test(Browser.userAgent)?"":'<div class="scroll-pad"> </div>');var tbody=dialog.querySelector("tbody");names.sort(function(a,b){return Util.isNumeric(a)&&Util.isNumeric(b)?Number(a)-Number(b):a.localeCompare(b)});for(var i=0;i<names.length;i++){var tr=document.createElement("tr"),tdName=document.createElement("td"),tdValue=document.createElement("td");tdName.textContent="$"+names[i],tdValue.textContent = toString(sv[names[i]]),tr.appendChild(tdName),tr.appendChild(tdValue),tbody.appendChild(tr)}UI.open()}})}(); - -window.MS = function() { - const V = State.variables; - var name = ""; - if (V.masterSuiteNameCaps === "The Master Suite") - name = "Master Suite" - else - name = V.masterSuiteNameCaps; - return `<<link "${name}""Master Suite">><</link>> `} -window.HS = function() { - const V = State.variables; - var name = ""; - if (V.HGSuiteNameCaps === "The Head Girl Suite") - name = "Head Girl Suite" - else - name = V.HGSuiteNameCaps; - return `<<link "${name}""Head Girl Suite">><</link>> `} -window.SQ = function() { - const V = State.variables; - var name = ""; - if (V.servantsQuartersNameCaps === "The Servants' Quarters") - name = "Servants' Quarters" - else - name = V.servantsQuartersNameCaps; - return `<<link "${name}""Servants' Quarters">><</link>> `} -window.S = function() { - const V = State.variables; - var name = ""; - if (V.spaNameCaps === "The Spa") - name = "Spa" - else - name = V.spaNameCaps; - return `<<link "${name}""Spa">><</link>> `} -window.CI = function() { - const V = State.variables; - var name = ""; - if (V.clinicNameCaps === "The Clinic") - name = "Clinic" - else - name = V.clinicNameCaps; - return `<<link "${name}""Clinic">><</link>> `} -window.SC = function() { - const V = State.variables; - var name = ""; - if (V.schoolroomNameCaps === "The Schoolroom") - name = "Schoolroom" - else - name = V.schoolroomNameCaps; - return `<<link "${name}""Schoolroom">><</link>> `} -window.CB = function() { - const V = State.variables; - var name = ""; - if (V.cellblockNameCaps === "The Cellblock") - name = "Cellblock" - else - name = V.cellblockNameCaps; - return `<<link "${name}""Cellblock">><</link>> `} -window.I = function() { - const V = State.variables; - var name = ""; - if (V.incubatorNameCaps === "The Incubator") - name = "Incubator" - else - name = V.incubatorNameCaps; - return `<<link "${name}""Incubator">><</link>> `} - -- GitLab