瀏覽代碼

refactor web

Thomas Hanika 3 年之前
父節點
當前提交
696817a866
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      ycast/static/script.js

+ 18 - 1
ycast/static/script.js

@@ -9,6 +9,20 @@ window.onload = function () {
     setBookmarkTopicList();
     setBookmarkTopicList();
 }
 }
 
 
+function searchTree(element, id) {
+    if (element.id === id) {
+        return element;
+    } else if (element.children != null) {
+        var i;
+        var result = null;
+        for (i = 0; result == null && i < element.children.length; i++) {
+            result = searchTree(element.children[i], id);
+        }
+        return result;
+    }
+    return null;
+}
+
 
 
 function createItem(name, icon, description) {
 function createItem(name, icon, description) {
 
 
@@ -99,7 +113,10 @@ function requestStationList(category, param, isbookmarklist) {
                 myList.appendChild(listItem);
                 myList.appendChild(listItem);
                 if (listItemEmpty) listItemEmpty.hidden = true;
                 if (listItemEmpty) listItemEmpty.hidden = true;
             }
             }
-            //            if (listItemEmpty) listItemEmpty.getElementById('name').textContent = '<empty>';
+            if (listItemEmpty) {
+                textElem = searchTree(listItemEmpty, 'name');
+                if (textElem) textElem.textContent = '';
+            }
             if (isbookmarklist) {
             if (isbookmarklist) {
                 setBookmarkTopicList();
                 setBookmarkTopicList();
             } else {
             } else {