Skip to content
Snippets Groups Projects
Commit a21b32d0 authored by klorpa's avatar klorpa
Browse files

RevertFix

parent 92219d7e
No related branches found
No related tags found
3 merge requests!11260Minor Fixes,!11186Spacing and Pronoun Fixes,!10975Typo Fixes
......@@ -47,21 +47,21 @@
# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit
# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:
# Using Unix Makefiles:
# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
# > make -j4 cefclient cefsimple
# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
# > make -j4 cefclient cefsimple
#
# Using Ninja:
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
# Using the Xcode IDE:
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
# Open build\cef.xcodeproj in Xcode and select Product > Build.
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
# Open build\cef.xcodeproj in Xcode and select Product > Build.
#
# Using Ninja:
# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Windows build using a 32-bit CEF binary distribution:
# Using the Visual Studio 2019 IDE:
......@@ -114,7 +114,7 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON)
# environment variable.
#
# Set the CEF_ROOT environment variable before executing CMake. For example:
# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
#
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......
......@@ -16,11 +16,11 @@ if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}")
else()
set(_ENV_CEF_ROOT "")
if(DEFINED ENV{CEF_ROOT})
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
endif()
if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}")
set(_CEF_ROOT "${_ENV_CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
set(_CEF_ROOT "${_ENV_CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
endif()
unset(_ENV_CEF_ROOT)
endif()
......
......@@ -146,12 +146,12 @@ endif()
if(OS_MACOSX)
option(OPTION_USE_ARC "Build with ARC (automatic Reference Counting) on macOS." ON)
if(OPTION_USE_ARC)
list(APPEND CEF_COMPILER_FLAGS
-fobjc-arc
)
set_target_properties(${target} PROPERTIES
CLANG_ENABLE_OBJC_ARC "YES"
)
list(APPEND CEF_COMPILER_FLAGS
-fobjc-arc
)
set_target_properties(${target} PROPERTIES
CLANG_ENABLE_OBJC_ARC "YES"
)
endif()
# Output paths for the app bundles.
......@@ -167,9 +167,9 @@ if(OS_MACOSX)
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME}
)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME}
)
# Main executable target.
target_sources(${CEF_TARGET} ${FCHOST_RESOURCES_SRCS})
......@@ -177,23 +177,23 @@ if(OS_MACOSX)
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
)
# Copy files into the main app bundle.
add_custom_command(
TARGET ${CEF_TARGET}
POST_BUILD
# Copy the helper app bundle into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_HELPER_APP}"
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_OUTPUT_NAME}.app"
# Copy the CEF framework into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
VERBATIM
)
TARGET ${CEF_TARGET}
POST_BUILD
# Copy the helper app bundle into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_HELPER_APP}"
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_OUTPUT_NAME}.app"
# Copy the CEF framework into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
VERBATIM
)
# Manually process and copy over resource files.
# The Xcode generator can support this via the set_target_properties RESOURCE
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
......@@ -4,17 +4,17 @@
<!--The compatibility section will be merged from build/win/compatibility.manifest -->
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
......@@ -41,21 +41,21 @@ IDI_FCHOST ICON "res\fchost.ico"
1 TEXTINCLUDE
BEGIN
"resource.h\0"
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
......
......@@ -28,15 +28,15 @@ namespace {
class SimpleWindowDelegate : public CefWindowDelegate {
public:
explicit SimpleWindowDelegate(CefRefPtr<CefBrowserView> browser_view)
: browser_view_(browser_view) {}
: browser_view_(browser_view) {}
void OnWindowCreated(CefRefPtr<CefWindow> window) override {
// Add the browser view and show the window.
window->AddChildView(browser_view_);
window->Show();
// Give keyboard focus to the browser view.
browser_view_->RequestFocus();
// Give keyboard focus to the browser view.
browser_view_->RequestFocus();
}
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
......@@ -100,7 +100,7 @@ void FCHostApp::OnContextInitialized() {
CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
CefCommandLine::GetGlobalCommandLine();
#if defined(OS_WIN) || defined(OS_LINUX)
// Create the browser using the Views framework if "--use-views" is specified
......@@ -135,16 +135,16 @@ void FCHostApp::OnContextInitialized() {
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
handler, url, browser_settings, nullptr, nullptr, nullptr);
// Create the Window. It will show itself after creation.
CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view));
// Create the Window. It will show itself after creation.
CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view));
} else {
// Information used when creating the native window.
CefWindowInfo window_info;
// Information used when creating the native window.
CefWindowInfo window_info;
#if defined(OS_WIN)
// On Windows we need to specify certain flags that will be passed to
// CreateWindowEx().
window_info.SetAsPopup(NULL, "FCHost");
// On Windows we need to specify certain flags that will be passed to
// CreateWindowEx().
window_info.SetAsPopup(NULL, "FCHost");
#endif
// Create the first browser window.
......
......@@ -31,7 +31,7 @@ std::string GetDataURI(const std::string& data, const std::string& mime_type) {
} // namespace
FCHostHandler::FCHostHandler(bool use_views)
: use_views_(use_views), is_closing_(false) {
: use_views_(use_views), is_closing_(false) {
DCHECK(!g_instance);
g_instance = this;
}
......@@ -46,21 +46,21 @@ FCHostHandler* FCHostHandler::GetInstance() {
}
void FCHostHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) {
const CefString& title) {
CEF_REQUIRE_UI_THREAD();
if (use_views_) {
// Set the title of the window using the Views framework.
CefRefPtr<CefBrowserView> browser_view =
CefBrowserView::GetForBrowser(browser);
if (browser_view) {
CefRefPtr<CefWindow> window = browser_view->GetWindow();
if (window)
window->SetTitle(title);
}
// Set the title of the window using the Views framework.
CefRefPtr<CefBrowserView> browser_view =
CefBrowserView::GetForBrowser(browser);
if (browser_view) {
CefRefPtr<CefWindow> window = browser_view->GetWindow();
if (window)
window->SetTitle(title);
}
} else {
// Set the title of the window using platform APIs.
PlatformTitleChange(browser, title);
// Set the title of the window using platform APIs.
PlatformTitleChange(browser, title);
}
}
......@@ -107,8 +107,8 @@ bool FCHostHandler::DoClose(CefRefPtr<CefBrowser> browser) {
// documentation in the CEF header for a detailed destription of this
// process.
if (browser_list_.size() == 1) {
// Set a flag to indicate that the window close should be allowed.
is_closing_ = true;
// Set a flag to indicate that the window close should be allowed.
is_closing_ = true;
}
// Allow the close. For windowed browsers this will result in the OS close
......@@ -122,28 +122,28 @@ void FCHostHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
// Remove from the list of existing browsers.
BrowserList::iterator bit = browser_list_.begin();
for (; bit != browser_list_.end(); ++bit) {
if ((*bit)->IsSame(browser)) {
browser_list_.erase(bit);
break;
}
if ((*bit)->IsSame(browser)) {
browser_list_.erase(bit);
break;
}
}
if (browser_list_.empty()) {
// All browser windows have closed. Quit the application message loop.
CefQuitMessageLoop();
// All browser windows have closed. Quit the application message loop.
CefQuitMessageLoop();
}
}
void FCHostHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) {
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) {
CEF_REQUIRE_UI_THREAD();
// Don't display an error for downloaded files.
if (errorCode == ERR_ABORTED)
return;
return;
// Display a load error message.
std::stringstream ss;
......@@ -251,9 +251,9 @@ void FCHostHandler::CloseAllBrowsers(bool force_close) {
}
if (browser_list_.empty())
return;
return;
BrowserList::const_iterator it = browser_list_.begin();
for (; it != browser_list_.end(); ++it)
(*it)->GetHost()->CloseBrowser(force_close);
(*it)->GetHost()->CloseBrowser(force_close);
}
......@@ -9,9 +9,9 @@
#include <list>
class FCHostHandler : public CefClient,
public CefDisplayHandler,
public CefLifeSpanHandler,
public CefLoadHandler,
public CefDisplayHandler,
public CefLifeSpanHandler,
public CefLoadHandler,
public CefDownloadHandler,
public CefKeyboardHandler,
private CefDialogHandler {
......@@ -42,7 +42,7 @@ class FCHostHandler : public CefClient,
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) override;
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
cef_log_severity_t level,
cef_log_severity_t level,
const CefString& message,
const CefString& source,
int line) override;
......@@ -82,7 +82,7 @@ class FCHostHandler : public CefClient,
private:
// Platform-specific implementation.
void PlatformTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title);
const CefString& title);
// True if the application is using the Views framework.
const bool use_views_;
......
......@@ -11,7 +11,7 @@
#include "resource.h"
void FCHostHandler::PlatformTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) {
const CefString& title) {
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
static bool haveSetIcon = false;
......
......@@ -19,9 +19,9 @@ std::filesystem::path FCHostApp::GetLocalStorePath()
// Entry point function for all processes.
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow) {
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow) {
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
......@@ -40,8 +40,8 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
// if this is a sub-process, executes the appropriate logic.
int exit_code = CefExecuteProcess(main_args, app, nullptr);
if (exit_code >= 0) {
// The sub-process has completed so return here.
return exit_code;
// The sub-process has completed so return here.
return exit_code;
}
CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
......
......@@ -103,7 +103,7 @@ index 914d9a5..a82d423 100644
@@ -43,14 +43,9 @@
return function () {
const $this = jQuery(this);
- // Exit if the element is disabled.
- //
- // NOTE: This should only be necessary for elements which are not disableable
......@@ -115,11 +115,11 @@ index 914d9a5..a82d423 100644
+ const dataPassage = $this.attr('data-passage');
+ const initialDataPassage = window && window.SugarCube && window.SugarCube.State && window.SugarCube.State.passage;
+ const savedYOffset = window.pageYOffset;
// Toggle "aria-pressed" status, if the attribute exists.
if ($this.is('[aria-pressed]')) {
@@ -59,6 +54,11 @@
// Call the true handler.
fn.apply(this, arguments);
+
......@@ -129,7 +129,7 @@ index 914d9a5..a82d423 100644
+ window.lastDataPassageLink = dataPassage;
};
}
diff --git a/src/lib/simplestore/adapters/FCHost.Storage.js b/src/lib/simplestore/adapters/FCHost.Storage.js
new file mode 100644
index 0000000..34581b1
......@@ -155,7 +155,7 @@ index 0000000..34581b1
+
+ /*******************************************************************************************************************
+ _FCHostStorageAdapter Class.
+ Note that FCHost is only intended for a single document, so we ignore both prefixing and storageID
+ Note that FCHost is only intended for a single document, so we ignore both prefixing and storageID
+ *******************************************************************************************************************/
+ class _FCHostStorageAdapter {
+ constructor(persistent) {
......@@ -167,7 +167,7 @@ index 0000000..34581b1
+ name = 'FCHostPersistent';
+ }
+ else {
+ engine = window.FCHostSession;
+ engine = window.FCHostSession;
+ name = 'FCHostSession';
+ }
+
......@@ -175,7 +175,7 @@ index 0000000..34581b1
+ _engine : {
+ value : engine
+ },
+
+
+ name : {
+ value : name
+ },
......@@ -277,8 +277,8 @@ index 0000000..34581b1
+ // FCHost feature test.
+ function hasFCHostStorage() {
+ try {
+ if (typeof window.FCHostPersistent !== 'undefined')
+ return true;
+ if (typeof window.FCHostPersistent !== 'undefined')
+ return true;
+ }
+ catch (ex) { /* no-op */ }
+
......@@ -286,7 +286,7 @@ index 0000000..34581b1
+ }
+
+ _ok = hasFCHostStorage();
+
+
+ return _ok;
+ }
+
......@@ -333,13 +333,8 @@ index 27d3801..4c689bc 100644
@@ -188,12 +189,15 @@ SimpleStore.adapters.push((() => {
return true;
}
<<<<<<< HEAD
static _serialize(obj) {
=======
- static _serialize(obj) {
>>>>>>> bec791bd964ac3ca5db9403ac786baaa7c6866da
- return LZString.compressToUTF16(JSON.stringify(obj));
+ static _serialize(obj, compression) {
+ if (compression) {
......@@ -347,13 +342,13 @@ index 27d3801..4c689bc 100644
+ }
+ return JSON.stringify(obj);
}
static _deserialize(str) {
- return JSON.parse(LZString.decompressFromUTF16(str));
+ return JSON.parse((!str || str[0] == "{") ? str : LZString.decompressFromUTF16(str));
}
}
diff --git a/src/macros/macrocontext.js b/src/macros/macrocontext.js
index df25bb4..9272ede 100644
--- a/src/macros/macrocontext.js
......@@ -361,14 +356,14 @@ index df25bb4..9272ede 100644
@@ -277,8 +277,8 @@ var MacroContext = (() => { // eslint-disable-line no-unused-vars, no-var
this._debugViewEnabled = false;
}
- error(message, source) {
- return throwError(this._output, `<<${this.displayName}>>: ${message}`, source ? source : this.source);
+ error(message, source, stack) {
+ return throwError(this._output, `<<${this.displayName}>>: ${message}`, source ? source : this.source, stack);
}
}
diff --git a/src/macros/macrolib.js b/src/macros/macrolib.js
index 3d2ea94..8f4dd7a 100644
--- a/src/macros/macrolib.js
......@@ -380,7 +375,7 @@ index 3d2ea94..8f4dd7a 100644
- return this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`);
+ return this.error(`bad evaluation: ${typeof ex === 'object' ? `${ex.name}: ${ex.message}` : ex}`, null, ex.stack);
}
// Custom debug view setup.
@@ -351,7 +351,7 @@
}
......@@ -406,12 +401,12 @@ index 2f3b07d..eaeac6b 100644
+++ b/src/markup/wikifier.js
@@ -222,7 +222,7 @@ var Wikifier = (() => { // eslint-disable-line no-unused-vars, no-var
}
outputText(destination, startPos, endPos) {
- jQuery(destination).append(document.createTextNode(this.source.substring(startPos, endPos)));
+ destination.appendChild(document.createTextNode(this.source.substring(startPos, endPos)));
}
/*
diff --git a/src/passage.js b/src/passage.js
index 4835633..6e2c6e1 100644
......@@ -420,14 +415,14 @@ index 4835633..6e2c6e1 100644
@@ -212,8 +212,10 @@ var Passage = (() => { // eslint-disable-line no-unused-vars, no-var
const frag = document.createDocumentFragment();
new Wikifier(frag, this.processText(), options);
- // Update the excerpt cache to reflect the rendered text.
- this._excerpt = Passage.getExcerptFromNode(frag);
+ // Update the excerpt cache to reflect the rendered text, if we need it for the passage description
+ if (Config.passages.descriptions == null) {
+ this._excerpt = Passage.getExcerptFromNode(frag);
+ }
return frag;
}
diff --git a/src/save.js b/src/save.js
......@@ -888,12 +883,12 @@ index e21149c..ecef60f 100644
+++ b/src/state.js
@@ -104,7 +104,7 @@ var State = (() => { // eslint-disable-line no-unused-vars, no-var
}
if (_expired.length > 0) {
- stateObj.expired = [..._expired];
+ stateObj.expired = [];
}
if (_prng !== null) {
@@ -224,8 +224,8 @@ var State = (() => { // eslint-disable-line no-unused-vars, no-var
*/
......
:: building widgets [nobr widget]
/%
Call as <<DisplayBuilding>>
Displays the arcology as a table.
Yes, I am aware this is horrible. If anyone can figure out how to get widgets to play nice with tables, or otherwise unfuck this, tell me and I'll implement it.
%/
<<widget "DisplayBuilding">>
<<set _Pass = passage()>>
<style>
table.arcology {
table-layout: fixed;
text-align: center;
border-collapse: separate;
border-spacing: 5px;
border-style: hidden;
empty-cells: hide;
width: 70%;
}
table.arcology td {
margin: 1px;
}
table.arcology col {
width: 8%;
}
table.arcology td {
border: 5px solid transparent;
}
td#Empty { border-color: lightgray; }
td#Private { border-color: red; }
td#Shops { border-color: thistle; }
td#FSShops { border-color: mediumpurple; }
td#Brothel { border-color: violet; }
td#Club { border-color: orchid; }
td#Apartments { border-color: limegreen; }
td#DenseApartments { border-color: seagreen; }
td#LuxuryApartments { border-color: palegreen; }
td#Markets { border-color: mediumorchid; }
td#CorporateMarket { border-color: purple; }
td#Arcade { border-color: deeppink; }
td#Pens { border-color: goldenrod; }
td#Pit { border-color: orangered; }
td#Manufacturing { border-color: slategray; }
td#transportHub { border-color: magenta; }
td#weapManu { border-color: springgreen; }
td#Sweatshops { border-color: gray; }
td#Barracks { border-color: olivedrab; }
td#Penthouse { border-color: teal; }
td#Dairy { border-color: white; }
td#Farmyard { border-color: brown; }
td#Nursery { border-color: deepskyblue; }
.arcology .penthouse {
display: inline-block;
}
.arcology .penthouse .info:before { content: "("; }
.arcology .penthouse .info:after { content: ")"; }
.arcology .penthouseWrapper {
display: inline-block;
}
.arcology.verticalLinks .penthouse{
display:block;
}
.arcology.griddedLinks .penthouseWrapper {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
}
.arcology.griddedLinks .penthouse .info:before,
.arcology.griddedLinks .penthouse .info:after {
content: "";
}
.arcology.griddedLinks .penthouse .info {
display: block;
line-height: 0.75;
margin-top: -0.2em;
margin-bottom: 0.2em;
}
.arcology.griddedLinks .penthouseWrapper .penthouse {
flex-grow: 1;
box-sizing: border-box;
justify-content: space-between;
}
.arcology.grid2 .penthouseWrapper .penthouse {
width: 45%;
}
.arcology.grid3 .penthouseWrapper .penthouse {
width: 30%;
}
</style>
<<script>>
/* This code only runs once per page load */
if(!Macro.has('sectorblock')) {
/* Usage: <<sectorblock sector index "other text (optional)">> */
Macro.add('sectorblock', {
/*
* Add sector metadata here
*
* base: Which passage the sector link goes to if owned. Defaults to the sector type. Unowned go to "Private"
* name: The sector name. Defaults to the sector type, with spaces inserted in case of WordsLikeThis
* cls: The CSS id to use for styling if owned; else uses "Private"
* extra: Some (SugarCube-style) extra text to add after the link
*/
sectors: {
LuxuryApartments: { base: 'Apartments' },
DenseApartments: { base: 'Apartments' },
Club: { extra: ' <<if $clubNameCaps != "The Club">>$clubNameCaps<</if>> ($ClubiIDs.length/<<print $club>><<if $DJ>>, L<</if>>)' },
Brothel: { extra: ' <<if $brothelNameCaps != "The Brothel">>$brothelNameCaps<</if>> ($BrothiIDs.length/<<print $brothel>><<if $Madam>>,L<</if>>)' },
CorporateMarket: { base: 'Corporate Market' },
Pit: { extra: ' <<if $pitNameCaps != "The Pit">>$pitNameCaps<</if>> ($fighterIDs.length)'},
Arcade: { extra: ' <<if $arcadeNameCaps != "The Arcade">>$arcadeNameCaps<</if>> ($ArcadeiIDs.length/<<print $arcade>>)'},
Dairy: { extra: ' <<if $dairyNameCaps != "The Dairy">>$dairyNameCaps<</if>> <<set _SCapT9 = $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>> ($DairyiIDs.length<<if _SCapT9>>+_SCapT9<</if>>/<<print $dairy>><<if $Milkmaid>>,L<</if>>)' },
Sweatshops: { base: 'Manufacturing' },
weapManu: { base: 'weaponsManufacturing', name: 'Weapons Manufacturing', cls: 'weapManu' },
transportHub: { base: 'transportHub', name: 'Transport Hub', cls: 'transportHub' },
Barracks: { base: 'Barracks', name: 'Garrison', extra: ' of $mercenariesTitle' },
Farmyard: { extra: ' <<if $farmyardNameCaps != "The Farmyard">>$farmyardNameCaps<</if>> ($FarmyardiIDs.length/<<print $farmyard>><<if $Farmer>>, L<</if>>)'},
Nursery: { extra: ' <<if $nurseryNameCaps != "The Nursery">>$nurseryNameCaps<</if>> ($nurseryBabies babies, $NurseryiIDs.length/<<print $nurseryNannies>><<if $Matron>>,L<</if>>)'},
/* speciality shop types */
'Subjugationist': { base: 'Shops', name: 'Subjugationist Shops', cls: 'FSShops' },
'Supremacist': { base: 'Shops', name: 'Supremacist Shops', cls: 'FSShops' },
'Gender Radicalist': { base: 'Shops', name: 'Gender Radicalist Shops', cls: 'FSShops' },
'Gender Fundamentalist': { base: 'Shops', name: 'Gender Fundamentalist Shops', cls: 'FSShops' },
'Paternalist': { base: 'Shops', name: 'Paternalist Shops', cls: 'FSShops' },
'Degradationist': { base: 'Shops', name: 'Degradationist Shops', cls: 'FSShops' },
'Body Purist': { base: 'Shops', name: 'Body Purist Shops', cls: 'FSShops' },
'Transformation Fetishist': { base: 'Shops', name: 'Transformation Fetishist Shops', cls: 'FSShops' },
'Youth Preferentialist': { base: 'Shops', name: 'Youth Preferentialist Shops', cls: 'FSShops' },
'Maturity Preferentialist': { base: 'Shops', name: 'Maturity Preferentialist Shops', cls: 'FSShops' },
'Slimness Enthusiast': { base: 'Shops', name: 'Slimness Enthusiast Shops', cls: 'FSShops' },
'Asset Expansionist': { base: 'Shops', name: 'Asset Expansionist Shops', cls: 'FSShops' },
'Pastoralist': { base: 'Shops', name: 'Pastoralist Shops', cls: 'FSShops' },
'Physical Idealist': { base: 'Shops', name: 'Physical Idealist Shops', cls: 'FSShops' },
'Chattel Religionist': { base: 'Shops', name: 'Chattel Religionist Shops', cls: 'FSShops' },
'Roman Revivalist': { base: 'Shops', name: 'Roman Revivalist Shops', cls: 'FSShops' },
'Aztec Revivalist': { base: 'Shops', name: 'Aztec Revivalist Shops', cls: 'FSShops' },
'Egyptian Revivalist': { base: 'Shops', name: 'Egyptian Revivalist Shops', cls: 'FSShops' },
'Edo Revivalist': { base: 'Shops', name: 'Edo Revivalist Shops', cls: 'FSShops' },
'Arabian Revivalist': { base: 'Shops', name: 'Arabian Revivalist Shops', cls: 'FSShops' },
'Chinese Revivalist': { base: 'Shops', name: 'Chinese Revivalist Shops', cls: 'FSShops' },
'Repopulationist': { base: 'Shops', name: 'Repopulationist Shops', cls: 'FSShops' },
'Eugenics': { base: 'Shops', name: 'Eugenics Shops', cls: 'FSShops' },
'Hedonism': { base: 'Shops', name: 'Hedonistic Shops', cls: 'FSShops' },
'Intellectual Dependency': { base: 'Shops', name: 'Intellectual Dependency Shops', cls: 'FSShops' },
'Slave Professionalism': { base: 'Shops', name: 'Slave Professionalism Shops', cls: 'FSShops' },
'Petite Admiration': { base: 'Shops', name: 'Petite Admiration Shops', cls: 'FSShops' },
'Statuesque Glorification': { base: 'Shops', name: 'Statuesque Glorification Shops', cls: 'FSShops' },
},
handler() {
let sec = this.args[0];
if(!sec || !sec.type) {
return;
}
let meta = this.self.sectors[sec.type] || {};
let type = sec.ownership === 1 ? (meta.cls || sec.type) : 'Private';
let basetype = sec.ownership === 1 ? (meta.base || sec.type) : 'Private';
let name = meta.name || sec.type.replace(/([a-z])([A-Z])/g, '$1 $2');
let text =
'<td colspan="2" id="' + type + '">'
+ '[[' + name + '|' + basetype + '][$AS=' + this.args[1] + ']]'
+ (meta.extra || '') + (this.args[2] || '')
+ '</td>';
new Wikifier(this.output, text);
},
});
}
<</script>>
<center>
<<set _arcologyTableClass = "arcology">>
<<switch $verticalizeArcologyLinks>>
<<case 1>>
<<set _arcologyTableClass += " verticalLinks">>
<<case 2>>
<<set _arcologyTableClass += " griddedLinks grid2">>
<<case 3>>
<<set _arcologyTableClass += " griddedLinks grid3">>
<</switch>>
<table @class="_arcologyTableClass">
<tr> /* Level 9, penthouse, sector 0 */
<td colspan="3"></td>
<td id="Penthouse" colspan="4">
<span class="penthouse">
<<link "Penthouse">><<set $nextButton = "Back", $nextLink = _Pass>><<goto "Manage Penthouse">><</link>> @@.cyan;[P]@@
</span>
<div class="penthouseWrapper">
<<if $masterSuite>>
<span class="penthouse masterSuite">
<span class="name"><<print MasterSuiteUIName()>></span><span class="info">$MastSiIDs.length/$masterSuite<<if $Concubine>>, C<</if>></span>
</span>
<</if>>
<<if $HGSuite>>
<span class="penthouse headGirlSuite">
<span class="name"><<print HeadGirlSuiteUIName()>></span><<if $HeadGirl != 0>><span class="info">HG<<if $HGSuiteiIDs.length > 0>>, 1<</if>></span><</if>>
</span>
<</if>>
<<if $dojo > 1>>
<span class="penthouse armory">
<span class="name">[[Armory|BG Select]]</span><<if $Bodyguard != 0>> <span class="info">BG</span><</if>>
</span>
<</if>>
<<if $servantsQuarters>>
<span class="penthouse servantsQuarters">
<span class="name"><<print ServantQuartersUIName()>></span><span class="info">$ServQiIDs.length/$servantsQuarters<<if $Stewardess>>, L<</if>></span>
</span>
<</if>>
<<if $spa>>
<span class="penthouse spa">
<span class="name"><<print SpaUIName()>></span><span class="info">$SpaiIDs.length/$spa<<if $Attendant>>, L<</if>></span>
</span>
<</if>>
<<if $nursery>>
<span class="penthouse nursery">
<span class="name"><<print NurseryUIName()>></span><span class="info"><<= numberWithPluralOne($nursery-$nurseryBabies, "empty room")>>, $NurseryiIDs.length/$nurseryNannies<<if $Matron>>, L<</if>></span> <<if $readyChildren > 0>>@@.yellow;[!]@@<</if>>
</span>
<</if>>
<<if $clinic>>
<span class="penthouse clinic">
<span class="name"><<print ClinicUIName()>></span><span class="info">$CliniciIDs.length/$clinic<<if $Nurse>>, L<</if>></span>
</span>
<</if>>
<<if $schoolroom>>
<span class="penthouse schoolroom">
<span class="name"><<print SchoolRoomUIName()>></span><span class="info">$SchlRiIDs.length/$schoolroom<<if $Schoolteacher>>, L<</if>></span>
</span>
<</if>>
<<if $cellblock>>
<span class="penthouse cellblock">
<span class="name"><<print CellblockUIName()>></span><span class="info">$CellBiIDs.length/$cellblock<<if $Wardeness>>, L<</if>></span>
</span>
<</if>>
<<if $incubator>>
<span class="penthouse incubator">
<span class="name"><<print IncubatorUIName()>></span><span class="info"><<=numberWithPluralOne($incubator-$tanks.length, "empty tank")>></span> <<if $readySlaves > 0>>@@.yellow;[!]@@<</if>>
</span>
<</if>>
<<if $researchLab.level > 0>>
<span class="penthouse researchLab">
<span class="name">[[Prosthetic Lab]]</span>
</span>
<</if>>
</div>
</td>
<td colspan="3"></td>
</tr>
<<if $arcologyUpgrade.spire == 1>>
<tr> /* Level 8, spire, sectors 1-2 */
<td colspan="3"></td>
<<for _i = 1; _i <= 2; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td colspan="3"></td>
</tr>
<tr> /* Level 7, spire, sectors 3-4 */
<td colspan="3"></td>
<<for _i = 3; _i <= 4; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td colspan="3"></td>
</tr>
<</if>>
<tr> /* Level 6, promenade, sectors 5-7 */
<td colspan="2"></td>
<<for _i = 5; _i <= 7; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td colspan="2"></td>
</tr>
<tr> /* Level 5, apartments, sectors 8-11 */
<td></td>
<<for _i = 8; _i <= 11; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td></td>
</tr>
<tr> /* Level 4, apartments, sectors 12-15 */
<td></td>
<<for _i = 12; _i <= 15; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td></td>
</tr>
<tr> /* Level 3, apartments, sectors 16-19 */
<td></td>
<<for _i = 16; _i <= 19; _i++>><<sectorblock $sectors[_i] _i>><</for>>
<td></td>
</tr>
<tr> /* Level 2, concourse, sectors 20-24 */
<<for _i = 20; _i <= 24; _i++>><<sectorblock $sectors[_i] _i>><</for>>
</tr>
<tr> /* Level 1, service area, sectors 25-29 */
<<for _i = 25; _i <= 29; _i++>><<sectorblock $sectors[_i] _i>><</for>>
</tr>
</table>
</center>
<</widget>>
<<widget "SectorSell">>
<<set $price = 1000*Math.trunc($arcologies[0].prosperity*(1+($arcologies[0].demandFactor/100)))>>
Selling this sector would relinquish a 4% interest in $arcologies[0].name. Such an interest is worth <<print cashFormat($price)>>.
<<if $arcologies[0].ownership >= 4>>
[[Sell|Main][cashX($price, "capEx"), $arcologies[0].ownership -= 4, $arcologies[0].demandFactor -= 20, $sectors[$AS].ownership = 0]]
<</if>>
<</widget>>
/%
Call as <<SectorCounts>>
Updates $AProsperityCap, $Sweatshops.
%/
<<widget "SectorCounts">>
<<if $arcologyUpgrade.drones != 1>>
<<set $AProsperityCap = 0>>
<<elseif $arcologyUpgrade.hydro != 1>>
<<set $AProsperityCap = 10>>
<<elseif $arcologyUpgrade.apron != 1>>
<<set $AProsperityCap = 30>>
<<elseif $arcologyUpgrade.grid != 1>>
<<set $AProsperityCap = 60>>
<<elseif $arcologyUpgrade.spire != 1>>
<<set $AProsperityCap = 100>>
<<else>>
<<set $AProsperityCap = 150>>
<</if>>
<<set $Sweatshops = 0>>
<<if $arcologyUpgrade.spire == 1>>
<<for _i = 1; _i <= 4; _i++>>
<<if $sectors[_i].type == "DenseApartments">>
<<set $AProsperityCap += 10>>
<<elseif $sectors[_i].type == "LuxuryApartments">>
<<set $AProsperityCap += 15>>
<<else>>
<<set $AProsperityCap += 10>>
<</if>>
<</for>>
<</if>>
<<for _i = 8; _i <= 19; _i++>>
<<if $sectors[_i].type == "LuxuryApartments">>
<<set $AProsperityCap += 15>>
<<else>>
<<set $AProsperityCap += 10>>
<</if>>
<</for>>
<<for _i = 25; _i <= 29; _i++>>
<<if $sectors[_i].type == "Sweatshops">>
<<set $Sweatshops++>>
<</if>>
<</for>>
<</widget>>
/%
Call as <<UpdateOwnership>>
Updates $arcologies[0].ownership.
%/
<<widget "UpdateOwnership">>
<<set $arcologies[0].ownership = 0>>
<<if $arcologyUpgrade.spire == 1>>
<<for _i = 1; _i <= 29; _i++>>
<<if $sectors[_i].ownership == 1>><<set $arcologies[0].ownership += 3.45>><</if>>
<</for>>
<<set $arcologies[0].ownership = Math.trunc($arcologies[0].ownership)>>
<<else>>
<<for _i = 5; _i <= 29; _i++>>
<<if $sectors[_i].ownership == 1>><<set $arcologies[0].ownership += 4>><</if>>
<</for>>
<</if>>
<</widget>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment