Allow link to console tabs
This commit is contained in:
parent
c4f8c0177e
commit
49f8e0bc3a
2 changed files with 16 additions and 3 deletions
|
@ -20,10 +20,10 @@ class Console extends Class
|
||||||
handleMessageWebsocket_original(message)
|
handleMessageWebsocket_original(message)
|
||||||
|
|
||||||
$(window).on "hashchange", =>
|
$(window).on "hashchange", =>
|
||||||
if window.top.location.hash == "#ZeroNet:Console"
|
if window.top.location.hash.startsWith("#ZeroNet:Console")
|
||||||
@open()
|
@open()
|
||||||
|
|
||||||
if window.top.location.hash == "#ZeroNet:Console"
|
if window.top.location.hash.startsWith("#ZeroNet:Console")
|
||||||
setTimeout (=> @open()), 10
|
setTimeout (=> @open()), 10
|
||||||
|
|
||||||
createHtmltag: ->
|
createHtmltag: ->
|
||||||
|
@ -58,10 +58,13 @@ class Console extends Class
|
||||||
@container.appendTo(document.body)
|
@container.appendTo(document.body)
|
||||||
@tag = @container.find(".console")
|
@tag = @container.find(".console")
|
||||||
for tab_type in @tab_types
|
for tab_type in @tab_types
|
||||||
tab = $("<a></a>", {href: "#", "data-filter": tab_type.filter}).text(tab_type.title)
|
tab = $("<a></a>", {href: "#", "data-filter": tab_type.filter, "data-title": tab_type.title}).text(tab_type.title)
|
||||||
if tab_type.filter == @tab_active
|
if tab_type.filter == @tab_active
|
||||||
tab.addClass("active")
|
tab.addClass("active")
|
||||||
tab.on("click", @handleTabClick)
|
tab.on("click", @handleTabClick)
|
||||||
|
if window.top.location.hash.endsWith(tab_type.title)
|
||||||
|
@log "Triggering click on", tab
|
||||||
|
tab.trigger("click")
|
||||||
@tabs.append(tab)
|
@tabs.append(tab)
|
||||||
|
|
||||||
@container.on "mousedown touchend touchcancel", (e) =>
|
@container.on "mousedown touchend touchcancel", (e) =>
|
||||||
|
@ -192,6 +195,7 @@ class Console extends Class
|
||||||
$("a", @tabs).removeClass("active")
|
$("a", @tabs).removeClass("active")
|
||||||
elem.addClass("active")
|
elem.addClass("active")
|
||||||
@changeFilter(@tab_active)
|
@changeFilter(@tab_active)
|
||||||
|
window.top.location.hash = "#ZeroNet:Console:" + elem.data("title")
|
||||||
return false
|
return false
|
||||||
|
|
||||||
window.Console = Console
|
window.Console = Console
|
||||||
|
|
9
plugins/Sidebar/media/Prototypes.coffee
Normal file
9
plugins/Sidebar/media/Prototypes.coffee
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
String::startsWith = (s) -> @[...s.length] is s
|
||||||
|
String::endsWith = (s) -> s is '' or @[-s.length..] is s
|
||||||
|
String::capitalize = -> if @.length then @[0].toUpperCase() + @.slice(1) else ""
|
||||||
|
String::repeat = (count) -> new Array( count + 1 ).join(@)
|
||||||
|
|
||||||
|
window.isEmpty = (obj) ->
|
||||||
|
for key of obj
|
||||||
|
return false
|
||||||
|
return true
|
Loading…
Reference in a new issue