From 3c13286ad053bbf3f9eefb7f6d26b5fb92414f4c Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Fri, 16 Sep 2016 03:25:09 +0200 Subject: [PATCH] Fixed some minor UI issues --- res/search.css | 6 +++--- res/search.js | 43 ++++++++++++++++++++++++------------------ templates/search.phtml | 1 + 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/res/search.css b/res/search.css index ce60df4..41cbbc0 100644 --- a/res/search.css +++ b/res/search.css @@ -91,7 +91,7 @@ nav { right: 0; top: 0; height: 56px; - z-index: 1; + z-index: 2; } nav .wrapper { @@ -159,7 +159,7 @@ nav input[type=text] { } #no_more img { - margin: 8rem auto 0px; + margin: 8rem auto 0; display: block; } @@ -174,7 +174,7 @@ nav input[type=text] { inline-button { display: block; - background: rgb(255, 255, 255) none repeat scroll 0% 0%; + background: rgb(255, 255, 255) none repeat scroll 0 0; font-size: 16px; height: 48px; line-height: 48px; diff --git a/res/search.js b/res/search.js index a932eb3..4cebbe4 100644 --- a/res/search.js +++ b/res/search.js @@ -20,12 +20,8 @@ var get_history = function () { var wrap_click_handler = function (fun) { return function (event) { - var sel = getSelection().toString(); - if (sel) { - event.stopPropagation(); - } else if (fun) { - fun(event); - } + event.stopPropagation(); + fun(event); } }; @@ -52,14 +48,6 @@ $("#q").keypress(function (e) { } }); -$("body").click(function (e) { - open[open.length-1](e); -}); - -$("nav").click(function (e) { - e.stopPropagation(); -}); - $("#q").focus(function (){ $("#autocomplete").addClass("active"); $("#results").addClass("hidden"); @@ -175,7 +163,9 @@ var attach_buffer = function (elem) { e.stopPropagation(); })); buffers[id].contexts.forEach(function (context) { - attach_context(elem.find("#context" + context.id)); + var context = elem.find("#context" + context.id); + if (context.length) + attach_context(context); }) }; @@ -239,6 +229,10 @@ var attach_context = function (elem) { elem.unbind(); var id = elem.data("contextid"); var bufferid = elem.data("bufferid"); + if (buffers[bufferid] === undefined) { + console.log("Undefined buffer: " + bufferid); + } + elem.click(wrap_click_handler(function (e) {e.stopPropagation(); })); $("#message"+buffers[bufferid].contexts[id].original.messageid).click(wrap_click_handler(make_toggle_context(bufferid, id))); elem.find(".load_before").click(wrap_click_handler(function (e) { @@ -393,6 +387,7 @@ var make_toggle_buffer = function (id) { var select_buffer = function (id) { deselect_buffers(id); + open.push(make_toggle_buffer(id)); buffers[id].selected = true; update_buffer(id); }; @@ -411,9 +406,10 @@ var make_toggle_context = function (buffer, id) { open.pop(); } else { unselect_contexts(buffer); - if (!buffers[buffer].selected) + if (!buffers[buffer].selected) { open.push(make_toggle_buffer(buffer)); - buffers[buffer].selected = true; + buffers[buffer].selected = true; + } context.selected = true; open.push(make_toggle_context(buffer, id)); if (context.before.length === 0) earlier(buffer, id, 5); @@ -462,4 +458,15 @@ var sort_messages = function (arr) { }); }; -update_history(); \ No newline at end of file +update_history(); + + + +$("body").click(function (e) { + if (open.length) + open[open.length - 1](e); +}); + +$("nav").click(function (e) { + e.stopPropagation(); +}); \ No newline at end of file diff --git a/templates/search.phtml b/templates/search.phtml index bbdad90..fe77ea0 100644 --- a/templates/search.phtml +++ b/templates/search.phtml @@ -29,6 +29,7 @@ </section> <div id="modal-background"></div> +<div id="bg"></div> <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> <script src="res/search.js"></script> -- GitLab