Changed the topic list filter label text when switching between sort orders.

You can now close the topic list filter drop-down.
This commit is contained in:
Azareal 2018-09-27 19:41:35 +10:00
parent 2e5256dd73
commit e9a9441e93
2 changed files with 9 additions and 3 deletions

View File

@ -361,7 +361,11 @@ function mainInit(){
$(".link_label").click(function(event) { $(".link_label").click(function(event) {
event.preventDefault(); event.preventDefault();
let forSelect = $(this).attr("data-for"); let forSelect = $(this).attr("data-for");
$('#'+forSelect).addClass("link_opened"); let linkSelect = $('#'+forSelect);
if(!linkSelect.hasClass("link_opened")) {
event.stopPropagation();
linkSelect.addClass("link_opened");
}
}); });
$(".open_edit").click((event) => { $(".open_edit").click((event) => {
@ -530,7 +534,9 @@ function mainInit(){
$(this).click(() => { $(this).click(() => {
$(".selectedAlert").removeClass("selectedAlert"); $(".selectedAlert").removeClass("selectedAlert");
$("#back").removeClass("alertActive"); $("#back").removeClass("alertActive");
$(".link_select").removeClass("link_opened");
}); });
$(".alert_bell").click(function(){ $(".alert_bell").click(function(){
var menuAlerts = $(this).parent(); var menuAlerts = $(this).parent();
if(menuAlerts.hasClass("selectedAlert")) { if(menuAlerts.hasClass("selectedAlert")) {
@ -539,7 +545,6 @@ function mainInit(){
$("#back").removeClass("alertActive"); $("#back").removeClass("alertActive");
} }
}); });
$(".menu_alerts").click(function(event) { $(".menu_alerts").click(function(event) {
event.stopPropagation(); event.stopPropagation();
if($(this).hasClass("selectedAlert")) return; if($(this).hasClass("selectedAlert")) return;
@ -547,6 +552,7 @@ function mainInit(){
this.className += " selectedAlert"; this.className += " selectedAlert";
document.getElementById("back").className += " alertActive" document.getElementById("back").className += " alertActive"
}); });
$(".link_select").click(event => event.stopPropagation());
$("input,textarea,select,option").keyup(event => event.stopPropagation()) $("input,textarea,select,option").keyup(event => event.stopPropagation())

View File

@ -7,7 +7,7 @@
<div class="optbox"> <div class="optbox">
{{if .ForumList}} {{if .ForumList}}
<div class="opt filter_opt"> <div class="opt filter_opt">
<a href="#" class="filter_opt_label link_label" data-for="topic_list_filter_select"> / {{lang "topic_list.most_recent_filter"}} <span class="filter_opt_pointy"></span></a> <a href="#" class="filter_opt_label link_label" data-for="topic_list_filter_select"> / {{if eq .Sort.SortBy "mostviewed" }}{{lang "topic_list.most_viewed_filter"}}{{else}}{{lang "topic_list.most_recent_filter"}}{{end}} <span class="filter_opt_pointy"></span></a>
<div id="topic_list_filter_select" class="link_select"> <div id="topic_list_filter_select" class="link_select">
<div class="link_option link_selected"> <div class="link_option link_selected">
<a href="/topics/">{{lang "topic_list.most_recent_filter"}}</a> <a href="/topics/">{{lang "topic_list.most_recent_filter"}}</a>