Simplify the code for add_new_orderby a little bit.

This commit is contained in:
voussoir 2019-08-23 13:24:47 -07:00
parent 94140a5a88
commit a7d93b7223

View file

@ -436,17 +436,15 @@ function add_new_orderby()
{ {
/* Called by the green + button */ /* Called by the green + button */
var ul = document.getElementById("search_builder_orderby_ul"); var ul = document.getElementById("search_builder_orderby_ul");
if (ul.children.length >= 9) var lis = ul.children;
if (lis.length >= 9)
{ {
/* 9 because there are only 9 sortable properties */ /* 9 because there are only 9 sortable properties */
return; return;
} }
var li = ul.children; prev_li = lis[lis.length - 2];
li = li[li.length - 2]; var new_li = prev_li.cloneNode(true);
var clone_children = true; ul.insertBefore(new_li, prev_li.nextSibling);
var new_li = li.cloneNode(clone_children)
var button = document.getElementById("search_builder_orderby_newrow");
ul.insertBefore(new_li, button);
} }
function orderby_remove_hook(button) function orderby_remove_hook(button)
{ {