2015-08-16 11:51:00 +02:00
|
|
|
class Sidebar extends Class
|
|
|
|
constructor: ->
|
|
|
|
@tag = null
|
|
|
|
@container = null
|
|
|
|
@opened = false
|
|
|
|
@width = 410
|
|
|
|
@fixbutton = $(".fixbutton")
|
|
|
|
@fixbutton_addx = 0
|
|
|
|
@fixbutton_initx = 0
|
|
|
|
@fixbutton_targetx = 0
|
2016-01-09 18:49:34 +01:00
|
|
|
@page_width = $(window).width()
|
2015-08-16 11:51:00 +02:00
|
|
|
@frame = $("#inner-iframe")
|
|
|
|
@initFixbutton()
|
|
|
|
@dragStarted = 0
|
|
|
|
@globe = null
|
|
|
|
|
|
|
|
@original_set_site_info = wrapper.setSiteInfo # We going to override this, save the original
|
|
|
|
|
|
|
|
# Start in opened state for debugging
|
|
|
|
if false
|
|
|
|
@startDrag()
|
|
|
|
@moved()
|
|
|
|
@fixbutton_targetx = @fixbutton_initx - @width
|
|
|
|
@stopDrag()
|
|
|
|
|
|
|
|
|
|
|
|
initFixbutton: ->
|
|
|
|
# Detect dragging
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.on "mousedown touchstart", (e) =>
|
2015-08-16 11:51:00 +02:00
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
# Disable previous listeners
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.off "click touchstop touchcancel"
|
|
|
|
@fixbutton.off "mousemove touchmove"
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
# Make sure its not a click
|
|
|
|
@dragStarted = (+ new Date)
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.one "mousemove touchmove", (e) =>
|
|
|
|
mousex = e.pageX
|
|
|
|
if not mousex
|
|
|
|
mousex = e.originalEvent.touches[0].pageX
|
|
|
|
|
|
|
|
@fixbutton_addx = @fixbutton.offset().left-mousex
|
2015-08-16 11:51:00 +02:00
|
|
|
@startDrag()
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.parent().on "click touchstop touchcancel", (e) =>
|
2015-08-16 11:51:00 +02:00
|
|
|
@stopDrag()
|
2016-01-09 18:49:34 +01:00
|
|
|
@resized()
|
|
|
|
$(window).on "resize", @resized
|
|
|
|
|
|
|
|
resized: =>
|
|
|
|
@page_width = $(window).width()
|
|
|
|
@fixbutton_initx = @page_width - 75 # Initial x position
|
|
|
|
if @opened
|
|
|
|
@fixbutton.css
|
|
|
|
left: @fixbutton_initx - @width
|
|
|
|
else
|
|
|
|
@fixbutton.css
|
|
|
|
left: @fixbutton_initx
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
# Start dragging the fixbutton
|
|
|
|
startDrag: ->
|
|
|
|
@log "startDrag"
|
|
|
|
@fixbutton_targetx = @fixbutton_initx # Fallback x position
|
|
|
|
|
|
|
|
@fixbutton.addClass("dragging")
|
|
|
|
|
|
|
|
# Fullscreen drag bg to capture mouse events over iframe
|
|
|
|
$("<div class='drag-bg'></div>").appendTo(document.body)
|
|
|
|
|
|
|
|
# IE position wrap fix
|
|
|
|
if navigator.userAgent.indexOf('MSIE') != -1 or navigator.appVersion.indexOf('Trident/') > 0
|
|
|
|
@fixbutton.css("pointer-events", "none")
|
|
|
|
|
|
|
|
# Don't go to homepage
|
|
|
|
@fixbutton.one "click", (e) =>
|
|
|
|
@stopDrag()
|
|
|
|
@fixbutton.removeClass("dragging")
|
|
|
|
if Math.abs(@fixbutton.offset().left - @fixbutton_initx) > 5
|
|
|
|
# If moved more than some pixel the button then don't go to homepage
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
# Animate drag
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.parents().on "mousemove touchmove", @animDrag
|
|
|
|
@fixbutton.parents().on "mousemove touchmove" ,@waitMove
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
# Stop dragging listener
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.parents().on "mouseup touchstop touchend touchcancel", (e) =>
|
2015-08-16 11:51:00 +02:00
|
|
|
e.preventDefault()
|
|
|
|
@stopDrag()
|
|
|
|
|
|
|
|
|
|
|
|
# Wait for moving the fixbutton
|
|
|
|
waitMove: (e) =>
|
|
|
|
if Math.abs(@fixbutton.offset().left - @fixbutton_targetx) > 10 and (+ new Date)-@dragStarted > 100
|
|
|
|
@moved()
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.parents().off "mousemove touchmove" ,@waitMove
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
moved: ->
|
|
|
|
@log "Moved"
|
|
|
|
@createHtmltag()
|
|
|
|
$(document.body).css("perspective", "1000px").addClass("body-sidebar")
|
|
|
|
$(window).off "resize"
|
|
|
|
$(window).on "resize", =>
|
|
|
|
$(document.body).css "height", $(window).height()
|
|
|
|
@scrollable()
|
2016-01-09 18:49:34 +01:00
|
|
|
@resized()
|
2015-08-16 11:51:00 +02:00
|
|
|
$(window).trigger "resize"
|
|
|
|
|
|
|
|
# Override setsiteinfo to catch changes
|
|
|
|
wrapper.setSiteInfo = (site_info) =>
|
|
|
|
@setSiteInfo(site_info)
|
|
|
|
@original_set_site_info.apply(wrapper, arguments)
|
|
|
|
|
2016-03-16 00:35:36 +01:00
|
|
|
# Preload world.jpg
|
|
|
|
img = new Image();
|
|
|
|
img.src = "/uimedia/globe/world.jpg";
|
|
|
|
|
2015-08-16 11:51:00 +02:00
|
|
|
setSiteInfo: (site_info) ->
|
2016-04-18 02:23:28 +02:00
|
|
|
RateLimit 1500, =>
|
Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages
2016-03-09 00:48:57 +01:00
|
|
|
@updateHtmlTag()
|
2016-03-16 00:35:36 +01:00
|
|
|
RateLimit 30000, =>
|
|
|
|
@displayGlobe()
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
# Create the sidebar html tag
|
|
|
|
createHtmltag: ->
|
2016-03-06 19:28:22 +01:00
|
|
|
@when_loaded = $.Deferred()
|
2015-08-16 11:51:00 +02:00
|
|
|
if not @container
|
|
|
|
@container = $("""
|
|
|
|
<div class="sidebar-container"><div class="sidebar scrollable"><div class="content-wrapper"><div class="content">
|
|
|
|
</div></div></div></div>
|
|
|
|
""")
|
|
|
|
@container.appendTo(document.body)
|
|
|
|
@tag = @container.find(".sidebar")
|
|
|
|
@updateHtmlTag()
|
|
|
|
@scrollable = window.initScrollable()
|
|
|
|
|
|
|
|
|
|
|
|
updateHtmlTag: ->
|
|
|
|
wrapper.ws.cmd "sidebarGetHtmlTag", {}, (res) =>
|
|
|
|
if @tag.find(".content").children().length == 0 # First update
|
|
|
|
@log "Creating content"
|
|
|
|
morphdom(@tag.find(".content")[0], '<div class="content">'+res+'</div>')
|
2016-02-05 00:34:58 +01:00
|
|
|
# @scrollable()
|
2016-03-16 00:35:36 +01:00
|
|
|
@when_loaded.resolve()
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
else # Not first update, patch the html to keep unchanged dom elements
|
|
|
|
@log "Patching content"
|
|
|
|
morphdom @tag.find(".content")[0], '<div class="content">'+res+'</div>', {
|
|
|
|
onBeforeMorphEl: (from_el, to_el) -> # Ignore globe loaded state
|
Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages
2016-03-09 00:48:57 +01:00
|
|
|
if from_el.className == "globe" or from_el.className.indexOf("noupdate") >= 0
|
2015-08-16 11:51:00 +02:00
|
|
|
return false
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
animDrag: (e) =>
|
|
|
|
mousex = e.pageX
|
2016-05-02 00:28:23 +02:00
|
|
|
if not mousex
|
|
|
|
mousex = e.originalEvent.touches[0].pageX
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
overdrag = @fixbutton_initx-@width-mousex
|
|
|
|
if overdrag > 0 # Overdragged
|
|
|
|
overdrag_percent = 1+overdrag/300
|
2016-05-02 00:28:23 +02:00
|
|
|
mousex = (mousex + (@fixbutton_initx-@width)*overdrag_percent)/(1+overdrag_percent)
|
2015-08-16 11:51:00 +02:00
|
|
|
targetx = @fixbutton_initx-mousex-@fixbutton_addx
|
|
|
|
|
2016-02-05 00:34:58 +01:00
|
|
|
@fixbutton[0].style.left = (mousex+@fixbutton_addx)+"px"
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
if @tag
|
2016-02-05 00:34:58 +01:00
|
|
|
@tag[0].style.transform = "translateX(#{0-targetx}px)"
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
# Check if opened
|
|
|
|
if (not @opened and targetx > @width/3) or (@opened and targetx > @width*0.9)
|
|
|
|
@fixbutton_targetx = @fixbutton_initx - @width # Make it opened
|
|
|
|
else
|
|
|
|
@fixbutton_targetx = @fixbutton_initx
|
|
|
|
|
|
|
|
|
|
|
|
# Stop dragging the fixbutton
|
|
|
|
stopDrag: ->
|
2016-05-02 00:28:23 +02:00
|
|
|
@fixbutton.parents().off "mousemove touchmove"
|
|
|
|
@fixbutton.off "mousemove touchmove"
|
2015-08-16 11:51:00 +02:00
|
|
|
@fixbutton.css("pointer-events", "")
|
|
|
|
$(".drag-bg").remove()
|
|
|
|
if not @fixbutton.hasClass("dragging")
|
|
|
|
return
|
|
|
|
@fixbutton.removeClass("dragging")
|
|
|
|
|
|
|
|
# Move back to initial position
|
|
|
|
if @fixbutton_targetx != @fixbutton.offset().left
|
|
|
|
# Animate fixbutton
|
|
|
|
@fixbutton.stop().animate {"left": @fixbutton_targetx}, 500, "easeOutBack", =>
|
|
|
|
# Switch back to auto align
|
|
|
|
if @fixbutton_targetx == @fixbutton_initx # Closed
|
|
|
|
@fixbutton.css("left", "auto")
|
|
|
|
else # Opened
|
|
|
|
@fixbutton.css("left", @fixbutton_targetx)
|
|
|
|
|
|
|
|
$(".fixbutton-bg").trigger "mouseout" # Switch fixbutton back to normal status
|
|
|
|
|
|
|
|
# Animate sidebar and iframe
|
|
|
|
if @fixbutton_targetx == @fixbutton_initx
|
|
|
|
# Closed
|
|
|
|
targetx = 0
|
|
|
|
@opened = false
|
|
|
|
else
|
|
|
|
# Opened
|
|
|
|
targetx = @width
|
|
|
|
if not @opened
|
2016-03-06 19:28:22 +01:00
|
|
|
@when_loaded.done =>
|
|
|
|
@onOpened()
|
2015-08-16 11:51:00 +02:00
|
|
|
@opened = true
|
|
|
|
|
|
|
|
# Revent sidebar transitions
|
|
|
|
@tag.css("transition", "0.4s ease-out")
|
|
|
|
@tag.css("transform", "translateX(-#{targetx}px)").one transitionEnd, =>
|
|
|
|
@tag.css("transition", "")
|
|
|
|
if not @opened
|
|
|
|
@container.remove()
|
|
|
|
@container = null
|
|
|
|
@tag.remove()
|
|
|
|
@tag = null
|
|
|
|
|
|
|
|
# Revert body transformations
|
|
|
|
@log "stopdrag", "opened:", @opened
|
|
|
|
if not @opened
|
|
|
|
@onClosed()
|
|
|
|
|
|
|
|
|
|
|
|
onOpened: ->
|
|
|
|
@log "Opened"
|
|
|
|
@scrollable()
|
|
|
|
|
|
|
|
# Re-calculate height when site admin opened or closed
|
|
|
|
@tag.find("#checkbox-owned").off("click").on "click", =>
|
|
|
|
setTimeout (=>
|
|
|
|
@scrollable()
|
|
|
|
), 300
|
|
|
|
|
|
|
|
# Site limit button
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#button-sitelimit").off("click").on "click", =>
|
2015-08-16 11:51:00 +02:00
|
|
|
wrapper.ws.cmd "siteSetLimit", $("#input-sitelimit").val(), =>
|
|
|
|
wrapper.notifications.add "done-sitelimit", "done", "Site storage limit modified!", 5000
|
|
|
|
@updateHtmlTag()
|
|
|
|
return false
|
2016-04-18 02:24:14 +02:00
|
|
|
|
|
|
|
# Database reload
|
|
|
|
@tag.find("#button-dbreload").off("click").on "click", =>
|
|
|
|
wrapper.ws.cmd "dbReload", [], =>
|
|
|
|
wrapper.notifications.add "done-sitelimit", "done", "Database schema reloaded", 5000
|
|
|
|
@updateHtmlTag()
|
|
|
|
return false
|
2015-08-16 11:51:00 +02:00
|
|
|
|
Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages
2016-03-09 00:48:57 +01:00
|
|
|
# Update site
|
|
|
|
@tag.find("#button-update").off("click").on "click", =>
|
|
|
|
@tag.find("#button-update").addClass("loading")
|
|
|
|
wrapper.ws.cmd "siteUpdate", wrapper.site_info.address, =>
|
|
|
|
wrapper.notifications.add "done-updated", "done", "Site updated!", 5000
|
|
|
|
@tag.find("#button-update").removeClass("loading")
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Pause site
|
|
|
|
@tag.find("#button-pause").off("click").on "click", =>
|
|
|
|
@tag.find("#button-pause").addClass("hidden")
|
|
|
|
wrapper.ws.cmd "sitePause", wrapper.site_info.address
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Resume site
|
|
|
|
@tag.find("#button-resume").off("click").on "click", =>
|
|
|
|
@tag.find("#button-resume").addClass("hidden")
|
|
|
|
wrapper.ws.cmd "siteResume", wrapper.site_info.address
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Delete site
|
|
|
|
@tag.find("#button-delete").off("click").on "click", =>
|
|
|
|
wrapper.displayConfirm "Are you sure?", "Delete this site", =>
|
|
|
|
@tag.find("#button-delete").addClass("loading")
|
|
|
|
wrapper.ws.cmd "siteDelete", wrapper.site_info.address, ->
|
|
|
|
document.location = $(".fixbutton-bg").attr("href")
|
|
|
|
return false
|
|
|
|
|
Rev571, Optional file sizes to sidebar, Download all optional files option in sidebar, Optional file number in peer stats, Delete removed or changed optional files, Auto download optional files if autodownloadoptional checked, SiteReload command, Peer use global file server if no site defined, Allow browser cache video files, Allow more keepalive connections, Gevent 1.1 ranged request bugfix, Dont sent optional files details on websocket, Remove files from workermanager tasks if no longer in bad_files, Notify local client about changes on external siteSign
2015-11-09 00:44:03 +01:00
|
|
|
# Owned checkbox
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#checkbox-owned").off("click").on "click", =>
|
Rev571, Optional file sizes to sidebar, Download all optional files option in sidebar, Optional file number in peer stats, Delete removed or changed optional files, Auto download optional files if autodownloadoptional checked, SiteReload command, Peer use global file server if no site defined, Allow browser cache video files, Allow more keepalive connections, Gevent 1.1 ranged request bugfix, Dont sent optional files details on websocket, Remove files from workermanager tasks if no longer in bad_files, Notify local client about changes on external siteSign
2015-11-09 00:44:03 +01:00
|
|
|
wrapper.ws.cmd "siteSetOwned", [@tag.find("#checkbox-owned").is(":checked")]
|
|
|
|
|
|
|
|
# Owned checkbox
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#checkbox-autodownloadoptional").off("click").on "click", =>
|
Rev571, Optional file sizes to sidebar, Download all optional files option in sidebar, Optional file number in peer stats, Delete removed or changed optional files, Auto download optional files if autodownloadoptional checked, SiteReload command, Peer use global file server if no site defined, Allow browser cache video files, Allow more keepalive connections, Gevent 1.1 ranged request bugfix, Dont sent optional files details on websocket, Remove files from workermanager tasks if no longer in bad_files, Notify local client about changes on external siteSign
2015-11-09 00:44:03 +01:00
|
|
|
wrapper.ws.cmd "siteSetAutodownloadoptional", [@tag.find("#checkbox-autodownloadoptional").is(":checked")]
|
|
|
|
|
2015-08-16 11:51:00 +02:00
|
|
|
# Change identity button
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#button-identity").off("click").on "click", =>
|
2015-08-16 11:51:00 +02:00
|
|
|
wrapper.ws.cmd "certSelect"
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Owned checkbox
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#checkbox-owned").off("click").on "click", =>
|
2015-08-16 11:51:00 +02:00
|
|
|
wrapper.ws.cmd "siteSetOwned", [@tag.find("#checkbox-owned").is(":checked")]
|
|
|
|
|
|
|
|
# Save settings
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#button-settings").off("click").on "click", =>
|
2015-08-16 11:51:00 +02:00
|
|
|
wrapper.ws.cmd "fileGet", "content.json", (res) =>
|
|
|
|
data = JSON.parse(res)
|
|
|
|
data["title"] = $("#settings-title").val()
|
|
|
|
data["description"] = $("#settings-description").val()
|
|
|
|
json_raw = unescape(encodeURIComponent(JSON.stringify(data, undefined, '\t')))
|
|
|
|
wrapper.ws.cmd "fileWrite", ["content.json", btoa(json_raw)], (res) =>
|
|
|
|
if res != "ok" # fileWrite failed
|
|
|
|
wrapper.notifications.add "file-write", "error", "File write error: #{res}"
|
|
|
|
else
|
|
|
|
wrapper.notifications.add "file-write", "done", "Site settings saved!", 5000
|
|
|
|
@updateHtmlTag()
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Sign content.json
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#button-sign").off("click").on "click", =>
|
2016-03-06 19:28:22 +01:00
|
|
|
inner_path = @tag.find("#input-contents").val()
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
if wrapper.site_info.privatekey
|
|
|
|
# Privatekey stored in users.json
|
2016-05-16 22:26:40 +02:00
|
|
|
wrapper.ws.cmd "siteSign", {privatekey: "stored", inner_path: inner_path, update_changed_files: true}, (res) =>
|
2015-08-16 11:51:00 +02:00
|
|
|
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
|
|
|
|
|
|
|
else
|
|
|
|
# Ask the user for privatekey
|
|
|
|
wrapper.displayPrompt "Enter your private key:", "password", "Sign", (privatekey) => # Prompt the private key
|
2016-05-16 22:26:40 +02:00
|
|
|
wrapper.ws.cmd "siteSign", {privatekey: privatekey, inner_path: inner_path, update_changed_files: true}, (res) =>
|
2015-08-16 11:51:00 +02:00
|
|
|
if res == "ok"
|
|
|
|
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
# Publish content.json
|
2016-03-03 21:12:16 +01:00
|
|
|
@tag.find("#button-publish").off("click").on "click", =>
|
2016-03-09 15:30:04 +01:00
|
|
|
inner_path = @tag.find("#input-contents").val()
|
2015-08-16 11:51:00 +02:00
|
|
|
@tag.find("#button-publish").addClass "loading"
|
|
|
|
wrapper.ws.cmd "sitePublish", {"inner_path": inner_path, "sign": false}, =>
|
|
|
|
@tag.find("#button-publish").removeClass "loading"
|
|
|
|
|
|
|
|
@loadGlobe()
|
|
|
|
|
|
|
|
|
|
|
|
onClosed: ->
|
|
|
|
$(window).off "resize"
|
2016-01-09 18:49:34 +01:00
|
|
|
$(window).on "resize", @resized
|
2015-08-16 11:51:00 +02:00
|
|
|
$(document.body).css("transition", "0.6s ease-in-out").removeClass("body-sidebar").on transitionEnd, (e) =>
|
|
|
|
if e.target == document.body
|
|
|
|
$(document.body).css("height", "auto").css("perspective", "").css("transition", "").off transitionEnd
|
|
|
|
@unloadGlobe()
|
|
|
|
|
|
|
|
# We dont need site info anymore
|
|
|
|
wrapper.setSiteInfo = @original_set_site_info
|
|
|
|
|
|
|
|
|
|
|
|
loadGlobe: =>
|
2016-03-06 19:28:22 +01:00
|
|
|
console.log "loadGlobe", @tag.find(".globe").hasClass("loading")
|
2015-08-16 11:51:00 +02:00
|
|
|
if @tag.find(".globe").hasClass("loading")
|
|
|
|
setTimeout (=>
|
|
|
|
if typeof(DAT) == "undefined" # Globe script not loaded, do it first
|
|
|
|
$.getScript("/uimedia/globe/all.js", @displayGlobe)
|
|
|
|
else
|
2016-03-16 00:35:36 +01:00
|
|
|
@displayGlobe()
|
2015-08-16 11:51:00 +02:00
|
|
|
), 600
|
|
|
|
|
|
|
|
|
|
|
|
displayGlobe: =>
|
2016-03-18 19:20:49 +01:00
|
|
|
img = new Image();
|
|
|
|
img.src = "/uimedia/globe/world.jpg";
|
|
|
|
img.onload = =>
|
|
|
|
wrapper.ws.cmd "sidebarGetPeers", [], (globe_data) =>
|
|
|
|
if @globe
|
|
|
|
@globe.scene.remove(@globe.points)
|
|
|
|
@globe.addData( globe_data, {format: 'magnitude', name: "hello", animated: false} )
|
Rev900, Sidebar filestats bar width round fix, Sidebar WebGL not supported error, Sidebar optimalizations, Trayicon gray shadow, Trim end of line whitespace from json files, Fix testweb testcase, Implement experimental postMessage nonce security, Return None when testing external ip, Window opener security check and message, Increase timeout for large files
2016-02-10 02:30:04 +01:00
|
|
|
@globe.createPoints()
|
2016-03-18 19:20:49 +01:00
|
|
|
else
|
|
|
|
try
|
|
|
|
@globe = new DAT.Globe( @tag.find(".globe")[0], {"imgDir": "/uimedia/globe/"} )
|
|
|
|
@globe.addData( globe_data, {format: 'magnitude', name: "hello"} )
|
|
|
|
@globe.createPoints()
|
|
|
|
@globe.animate()
|
|
|
|
catch e
|
|
|
|
console.log "WebGL error", e
|
|
|
|
@tag.find(".globe").addClass("error").text("WebGL not supported")
|
|
|
|
|
|
|
|
@tag.find(".globe").removeClass("loading")
|
2015-08-16 11:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
unloadGlobe: =>
|
|
|
|
if not @globe
|
|
|
|
return false
|
|
|
|
@globe.unload()
|
|
|
|
@globe = null
|
|
|
|
|
|
|
|
|
Rev900, Sidebar filestats bar width round fix, Sidebar WebGL not supported error, Sidebar optimalizations, Trayicon gray shadow, Trim end of line whitespace from json files, Fix testweb testcase, Implement experimental postMessage nonce security, Return None when testing external ip, Window opener security check and message, Increase timeout for large files
2016-02-10 02:30:04 +01:00
|
|
|
setTimeout ( ->
|
|
|
|
window.sidebar = new Sidebar()
|
|
|
|
), 500
|
2015-08-16 11:51:00 +02:00
|
|
|
window.transitionEnd = 'transitionend webkitTransitionEnd oTransitionEnd otransitionend'
|