From f04699115cf9b75e4b43188981f26ced271e4308 Mon Sep 17 00:00:00 2001 From: Vasileios Pasialiokis <whiterocket@outlook.com> Date: Mon, 2 Apr 2018 17:34:36 +0300 Subject: [PATCH] move properTitle to global scope --- src/js/assayJS.tw | 8 ++++++++ src/js/rulesAssistantOptions.tw | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/js/assayJS.tw b/src/js/assayJS.tw index ea7b8e6c484..3638873b6ef 100644 --- a/src/js/assayJS.tw +++ b/src/js/assayJS.tw @@ -224,3 +224,11 @@ window.isLeaderP = function isLeaderP(slave) { } return false }; + +// helper function returning PC's title +window.properTitle = function properTitle() { + const PC = State.variables.PC + if (PC.customTitle) return PC.customTitle; + else if (V.PC.title !== 0) return "Sir"; + else return "Ma'am"; +}; diff --git a/src/js/rulesAssistantOptions.tw b/src/js/rulesAssistantOptions.tw index a35ea6f15c4..1da76e1cdbe 100644 --- a/src/js/rulesAssistantOptions.tw +++ b/src/js/rulesAssistantOptions.tw @@ -4,7 +4,7 @@ // uses an object-oriented widget pattern // wrapped in a closure so as not to polute the global namespace // the widgets are generic enough to be reusable; if similar user interfaces are ported to JS, we could move the classes to the global scope - +j window.rulesAssistantOptions = (function() { "use strict" @@ -26,13 +26,6 @@ window.rulesAssistantOptions = (function() { root.appendChild(new Element(tmp)) } - // helper function returning PC's title - function properTitle() { - if (V.PC.customTitle) return V.PC.customTitle - else if (V.PC.title !== 0) return "Sir" - else return "Ma'am" - } - // the Element class wraps around a DOM element and adds extra functionality // this is safer than extending DOM objects directly // it also turns DOM manipulation into an implementation detail -- GitLab