More logging to wrapper

This commit is contained in:
shortcutme 2020-01-04 16:52:51 +01:00
parent 995d87c167
commit 820346c98d
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 10 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class Loading
$(".progressbar").css("transform": "scaleX(#{parseInt(percent*100)/100})").css("opacity", "1").css("display", "block")
hideProgress: ->
console.log "hideProgress"
@log "hideProgress"
@timer_hide = setTimeout ( =>
$(".progressbar").css("transform": "scaleX(1)").css("opacity", "0").hideLater(1000)
), 300
@ -23,6 +23,7 @@ class Loading
showTooLarge: (site_info) ->
@log "Displaying large site confirmation"
if $(".console .button-setlimit").length == 0 # Not displaying it yet
line = @printLine("Site size: <b>#{parseInt(site_info.settings.size/1024/1024)}MB</b> is larger than default allowed #{parseInt(site_info.size_limit)}MB", "warning")
button = $("<a href='#Set+limit' class='button button-setlimit'>" + "Open site and set size limit to #{site_info.next_size_limit}MB" + "</a>")
@ -52,7 +53,7 @@ class Loading
# We dont need loadingscreen anymore
hideScreen: ->
console.log "hideScreen"
@log "hideScreen"
if not $(".loadingscreen").hasClass("done") # Only if its not animating already
if @screen_visible # Hide with animate
$(".loadingscreen").addClass("done").removeLater(2000)
@ -80,6 +81,8 @@ class Loading
if type == "warning" then line.addClass("console-warning")
return line
log: (args...) ->
console.log "[Loading]", args...
window.Loading = Loading

View File

@ -417,6 +417,7 @@ class Wrapper
@reload(message.params[0])
reload: (url_post="") ->
@log "Reload"
current_url = window.location.toString().replace(/#.*/g, "")
if url_post
if current_url.indexOf("?") > 0
@ -492,6 +493,7 @@ class Wrapper
# Iframe loaded
onPageLoad: (e) =>
@log "onPageLoad"
@inner_loaded = true
if not @inner_ready then @sendInner {"cmd": "wrapperReady"} # Inner frame loaded before wrapper
#if not @site_error then @loading.hideScreen() # Hide loading screen
@ -553,8 +555,8 @@ class Wrapper
@loading.hideScreen()
if not @site_info then @reloadSiteInfo()
if site_info.content
window.document.title = site_info.content.title+" - ZeroNet"
@log "Required file done, setting title to", window.document.title
window.document.title = site_info.content.title + " - ZeroNet"
@log "Required file #{window.file_inner_path} done, setting title to", window.document.title
if not window.show_loadingscreen
@notifications.add("modified", "info", "New version of this page has just released.<br>Reload to see the modified content.")
# File failed downloading
@ -675,6 +677,7 @@ class Wrapper
setSizeLimit: (size_limit, reload=true) =>
@log "setSizeLimit: #{size_limit}, reload: #{reload}"
@ws.cmd "siteSetLimit", [size_limit], (res) =>
if res != "ok"
return false