summary refs log tree commit diff stats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/assets/images/link_aporia.pngbin1585 -> 1526 bytes
-rw-r--r--web/assets/images/link_forum.pngbin1107 -> 1048 bytes
-rw-r--r--web/assets/images/link_nimbuild.pngbin955 -> 896 bytes
-rw-r--r--web/assets/images/logo.pngbin125152 -> 101053 bytes
-rw-r--r--web/assets/images/quote.pngbin1062 -> 1045 bytes
-rw-r--r--web/assets/images/sidebar.pngbin1029 -> 971 bytes
-rw-r--r--web/assets/images/sidebar_h2.pngbin2104 -> 2044 bytes
-rw-r--r--web/assets/images/sidebar_head.pngbin39194 -> 34993 bytes
-rw-r--r--web/assets/images/site_foot.pngbin4039 -> 3109 bytes
-rw-r--r--web/assets/images/site_neck.pngbin391 -> 317 bytes
-rw-r--r--web/babelpkglist.nim72
11 files changed, 72 insertions, 0 deletions
diff --git a/web/assets/images/link_aporia.png b/web/assets/images/link_aporia.png
index 6256792d7..145e5ddf2 100644
--- a/web/assets/images/link_aporia.png
+++ b/web/assets/images/link_aporia.png
Binary files differdiff --git a/web/assets/images/link_forum.png b/web/assets/images/link_forum.png
index d153231a7..2973b42bc 100644
--- a/web/assets/images/link_forum.png
+++ b/web/assets/images/link_forum.png
Binary files differdiff --git a/web/assets/images/link_nimbuild.png b/web/assets/images/link_nimbuild.png
index ad94f9c82..4b3f943fe 100644
--- a/web/assets/images/link_nimbuild.png
+++ b/web/assets/images/link_nimbuild.png
Binary files differdiff --git a/web/assets/images/logo.png b/web/assets/images/logo.png
index f6b95bf05..31ee0a6e1 100644
--- a/web/assets/images/logo.png
+++ b/web/assets/images/logo.png
Binary files differdiff --git a/web/assets/images/quote.png b/web/assets/images/quote.png
index 52d529284..e9426158c 100644
--- a/web/assets/images/quote.png
+++ b/web/assets/images/quote.png
Binary files differdiff --git a/web/assets/images/sidebar.png b/web/assets/images/sidebar.png
index 8488f8acf..77624480e 100644
--- a/web/assets/images/sidebar.png
+++ b/web/assets/images/sidebar.png
Binary files differdiff --git a/web/assets/images/sidebar_h2.png b/web/assets/images/sidebar_h2.png
index 5de3da291..d1409b57f 100644
--- a/web/assets/images/sidebar_h2.png
+++ b/web/assets/images/sidebar_h2.png
Binary files differdiff --git a/web/assets/images/sidebar_head.png b/web/assets/images/sidebar_head.png
index 734d5709b..05885d9f3 100644
--- a/web/assets/images/sidebar_head.png
+++ b/web/assets/images/sidebar_head.png
Binary files differdiff --git a/web/assets/images/site_foot.png b/web/assets/images/site_foot.png
index d94632b20..a2efa0460 100644
--- a/web/assets/images/site_foot.png
+++ b/web/assets/images/site_foot.png
Binary files differdiff --git a/web/assets/images/site_neck.png b/web/assets/images/site_neck.png
index cab3dc75a..d4f42c6b7 100644
--- a/web/assets/images/site_neck.png
+++ b/web/assets/images/site_neck.png
Binary files differdiff --git a/web/babelpkglist.nim b/web/babelpkglist.nim
new file mode 100644
index 000000000..378d4ce30
--- /dev/null
+++ b/web/babelpkglist.nim
@@ -0,0 +1,72 @@
+import base64, strutils, json, htmlgen, dom, algorithm
+
+type
+  TData = object
+    content {.importc.}: cstring
+
+proc decodeContent(content: string): string =
+  result = ""
+  for line in content.splitLines:
+    if line != "":
+      result.add decode(line)
+
+proc contains(x: seq[PJSonNode], s: string): bool =
+  for i in x:
+    assert i.kind == JString
+    if i.str == s: return true
+
+proc processContent(content: string) =
+  var jsonDoc = parseJson(content)
+  assert jsonDoc.kind == JArray
+  var jsonArr = jsonDoc.elems
+
+  jsonArr.sort do (x, y: PJsonNode) -> int:
+    system.cmp(x["name"].str, y["name"].str)
+
+  var
+    officialList = ""
+    officialCount = 0
+    unofficialList = ""
+    unofficialCount = 0
+
+  for pkg in jsonArr:
+    assert pkg.kind == JObject
+    let pkgWeb =
+      if pkg.hasKey("web"): pkg["web"].str
+      else: pkg["url"].str
+    let listItem = li(a(href=pkgWeb, pkg["name"].str), " ", pkg["description"].str)
+    if pkg["url"].str.startsWith("git://github.com/nimrod-code") or
+       "official" in pkg["tags"].elems:
+      officialCount.inc
+      officialList.add listItem & "\n"
+    else:
+      unofficialCount.inc
+      unofficialList.add listItem & "\n"
+
+  var officialPkgListDiv = document.getElementById("officialPkgList")
+
+  officialPkgListDiv.innerHTML.add(
+    p("There are currently " & $officialCount &
+      " official packages in the Babel package repository.") &
+    ul(officialList)
+  )
+
+  var unofficialPkgListDiv = document.getElementById("unofficialPkgList")
+
+  unofficialPkgListDiv.innerHTML.add(
+    p("There are currently " & $unofficialCount &
+      " unofficial packages in the Babel package repository.") &
+    ul(unofficialList)
+  )
+
+proc gotPackageList(apiReply: TData) {.exportc.} =
+  let decoded = decodeContent($apiReply.content)
+  try:
+    processContent(decoded)
+  except:
+    var officialPkgListDiv = document.getElementById("officialPkgList")
+    var unofficialPkgListDiv = document.getElementById("unofficialPkgList")
+    let msg = p("Unable to retrieve package list: ",
+      code(getCurrentExceptionMsg()))
+    officialPkgListDiv.innerHTML = msg
+    unofficialPkgListDiv.innerHTML = msg