Merge pull request #1899 from thelounge/astorije/improve-init

Improve a bit window loading on init
This commit is contained in:
Jérémie Astori 2017-12-27 13:31:25 -05:00 committed by GitHub
commit c17d7bddae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -174,7 +174,7 @@ $(function() {
});
viewport.on("click", "#chat .menu", function(e) {
e.currentTarget = $(e.currentTarget).closest(".chan")[0];
e.currentTarget = $(`#sidebar .chan[data-id="${$(this).closest(".chan").data("id")}"]`)[0];
return showContextMenu(this, e);
});

View File

@ -64,8 +64,7 @@ function openCorrectChannel(clientActive, serverActive) {
// Open window provided in location.hash
if (target.length === 0 && window.location.hash) {
target = $("#footer, #sidebar, #help")
.find(`[data-target="${escape(window.location.hash)}"]`);
target = $(`[data-target="${escape(window.location.hash)}"]`).first();
}
// Open last active channel according to the server

View File

@ -1,5 +1,11 @@
{{#each channels}}
<div id="chan-{{id}}" data-title="{{name}}" data-id="{{id}}" data-type="{{type}}" data-target="#chan-{{id}}" class="chan {{type}}">
<div
id="chan-{{id}}"
class="chan {{type}}"
data-id="{{id}}"
data-title="{{name}}"
data-type="{{type}}"
>
<div class="header">
<button class="lt" aria-label="Toggle channel list"></button>
{{#equal type "channel"}}