Procházet zdrojové kódy

Sort content based on type

Carlos Hernandez před 2 roky
rodič
revize
c7f755c93a
2 změnil soubory, kde provedl 79 přidání a 120 odebrání
  1. 54
    120
      app_template/www/home.html
  2. 25
    0
      app_template/www/sortposts.js

+ 54
- 120
app_template/www/home.html
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 25
- 0
app_template/www/sortposts.js Zobrazit soubor

@@ -0,0 +1,25 @@
1
+function sort_posts(id) {
2
+    console.log("Executing function.");
3
+    var value = document.getElementById("my-selection").value;
4
+    console.log(value);
5
+
6
+    var parentNode = document.getElementById("rows-parent");
7
+    var instagramRow = document.getElementById("instagram-row");
8
+    var podcastsRow = document.getElementById("podcasts-row");
9
+    var articlesRow = document.getElementById("articles-row");
10
+    if (value == 1) {
11
+        parentNode.appendChild(podcastsRow);
12
+        parentNode.appendChild(instagramRow);
13
+        parentNode.appendChild(articlesRow);
14
+    }
15
+    else if (value == 2) {
16
+        parentNode.appendChild(instagramRow);
17
+        parentNode.append(articlesRow);
18
+        parentNode.appendChild(podcastsRow);
19
+    }
20
+    else if (value == 3) {
21
+        parentNode.append(articlesRow);
22
+        parentNode.appendChild(podcastsRow);
23
+        parentNode.appendChild(instagramRow);
24
+    }
25
+}