From 6292baab99a83fcd36f725d37d3902f88f949499 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Sun, 2 Apr 2017 11:37:36 +0700 Subject: [PATCH] Fixed goBack and normaliseTabs, updated git links --- package.json | 6 +++--- src/markdown.coffee | 4 +++- src/salet.coffee | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 33426b7..e3f4f4c 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "salet", - "version": "1.6.16", + "version": "1.6.17", "description": "A general client-side framework for cybertext interactive fiction games.", "keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"], "homepage": "http://salet.oreolek.ru", "bugs": { - "url" : "https://git.oreolek.ru/oreolek/salet-module/issues" + "url" : "https://gitlab.com/oreolek/salet-module/issues" }, "license" : "MIT", "dependencies": {}, @@ -21,6 +21,6 @@ "main": "lib/index.min.js", "repository": { "type" : "git", - "url" : "https://git.oreolek.ru/oreolek/salet-module" + "url" : "https://gitlab.com/oreolek/salet-module" } } diff --git a/src/markdown.coffee b/src/markdown.coffee index 518d2ba..a0ae717 100644 --- a/src/markdown.coffee +++ b/src/markdown.coffee @@ -6,7 +6,9 @@ Copyright 2015 Bruno Dias normaliseTabs = (text) -> if not text? or typeof(text) != "string" or text == "" return "" - lines = text.split('\n'); + lines = text.split('\n') + if not lines? + lines = text indents = lines .filter((l) => l != '') .map((l) => l.match(/^\s+/)) diff --git a/src/salet.coffee b/src/salet.coffee index 949a981..ba78d5d 100644 --- a/src/salet.coffee +++ b/src/salet.coffee @@ -61,14 +61,14 @@ class Salet on to the room. Note that this is the only one of these global handlers that can consume the event. ### - @beforeAction = (situationId, actionId) -> + @beforeAction = (roomId, actionId) -> ### This function is called after carrying out any action in any room. It is called after the corresponding room has its `act` method called. ### - @afterAction = (situationId, actionId) -> + @afterAction = (roomId, actionId) -> ### This function is called after leaving any room. It is @@ -306,13 +306,14 @@ class Salet # Also, steps = 1 is the current room @goBack = (steps = 2) -> window.history.back() - if @progress.path.length == 1 + if @progress.path.length <= 1 location = @start else if @progress.path.length > steps location = @progress.path[@progress.path.length - steps] else return @goBack(steps - 1) - @processClick(location) + if location? + @processClick(location) # Transition between rooms. @doTransitionTo = (newRoomId, force = false) ->