0
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet-module.git synced 2024-06-16 15:10:52 +03:00

Fixed goBack and normaliseTabs, updated git links

This commit is contained in:
Alexander Yakovlev 2017-04-02 11:37:36 +07:00
parent 7b1d1cd2b4
commit 6292baab99
3 changed files with 11 additions and 8 deletions

View file

@ -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"
}
}

View file

@ -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+/))

View file

@ -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) ->