mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-06-26 03:50:49 +03:00
no DOM changes in the middle of effects
This commit is contained in:
parent
1dced7b54c
commit
268808bb4f
|
@ -388,18 +388,17 @@ class Salet
|
|||
|
||||
# Run through all the player's history.
|
||||
@interactive = false
|
||||
|
||||
for step in @progress.sequence
|
||||
# The action must be done at the recorded time.
|
||||
@time = step.when
|
||||
@processLink(step.link)
|
||||
|
||||
$("body").promise().done(() =>
|
||||
@interactive = true
|
||||
@interactive = true
|
||||
|
||||
# Reverse engineer the start time.
|
||||
now = new Date().getTime() * 0.001
|
||||
startTime = now - @progress.saveTime
|
||||
)
|
||||
# Reverse engineer the start time.
|
||||
now = new Date().getTime() * 0.001
|
||||
startTime = now - @progress.saveTime
|
||||
|
||||
@view = new SaletView
|
||||
|
||||
|
|
|
@ -91,14 +91,18 @@ class SaletView
|
|||
if not content? or content == ""
|
||||
return
|
||||
content = @prepareContent(content)
|
||||
block = document.querySelector(elementSelector)
|
||||
block = $(elementSelector)
|
||||
if block
|
||||
block.innerHTML = block.innerHTML + markdown(content)
|
||||
newhtml = block.html() + markdown(content)
|
||||
block.promise().done(() ->
|
||||
block.html(newhtml)
|
||||
)
|
||||
return newhtml
|
||||
else
|
||||
# most likely this is the starting room
|
||||
block = document.getElementById("content")
|
||||
block.innerHTML = content
|
||||
return block.innerHTML
|
||||
block = $("#content")
|
||||
block.html(content)
|
||||
return block.html()
|
||||
|
||||
# Replaces the text in the given block with the given text.
|
||||
# !! Does not call markdown on the provided text. !!
|
||||
|
@ -106,8 +110,10 @@ class SaletView
|
|||
if content == ""
|
||||
return
|
||||
content = @prepareContent(content)
|
||||
block = document.querySelector(elementSelector)
|
||||
block.innerHTML = content
|
||||
block = $(elementSelector)
|
||||
block.promise().done(() ->
|
||||
block.html(content)
|
||||
)
|
||||
|
||||
###
|
||||
Turns any links that target the given href into plain
|
||||
|
@ -229,7 +235,9 @@ class SaletView
|
|||
|
||||
@showBlock = (block) ->
|
||||
if salet.interactive
|
||||
$(block).slideDown('slow').fadeTo(500, 1)
|
||||
$(block).slideDown('slow', () ->
|
||||
$(block).fadeTo(500, 1)
|
||||
)
|
||||
else
|
||||
$(block).show()
|
||||
|
||||
|
@ -244,12 +252,14 @@ class SaletView
|
|||
else
|
||||
return block.hide()
|
||||
|
||||
block.fadeTo(500, 0).slideUp()
|
||||
if remove
|
||||
block.promise().done(() ->
|
||||
$(this).remove()
|
||||
)
|
||||
|
||||
callback = () ->
|
||||
block.remove()
|
||||
if remove == false
|
||||
callback = undefined
|
||||
block.finish().fadeTo(500, 0, () ->
|
||||
block.slideUp(250, callback)
|
||||
)
|
||||
|
||||
return
|
||||
@updateWays = (ways, name) ->
|
||||
if document.getElementById("ways") == null
|
||||
|
|
Loading…
Reference in a new issue