summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorctrlcctrlv <wizardchan@hush.com>2013-08-08 19:07:22 +0000
committerctrlcctrlv <wizardchan@hush.com>2013-08-08 19:07:22 +0000
commit4a8fbb5f6dd9fd8bae1abc7fb2b6249770eb4f7f (patch)
tree69f4f31e93b72d0e369df976a210d8f09ce4eaec
parentb8921508fe32c259fd48837af1e92488c89d7966 (diff)
Catalog link script to be used with catalog theme
-rw-r--r--js/catalog-link.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/catalog-link.js b/js/catalog-link.js
new file mode 100644
index 00000000..cc55eb52
--- /dev/null
+++ b/js/catalog-link.js
@@ -0,0 +1,44 @@
+// This script puts a link to the catalog below the board subtitle, and next to the board list.
+
+function catalog() {
+var board = $("input[name='board']");
+
+if (board) {
+var catalog_url = 'catalog.html';
+var pages = document.getElementsByClassName('pages')[0];
+var bottom = document.getElementsByClassName('boardlist bottom')[0]
+var subtitle = document.getElementsByClassName('subtitle')[0];
+
+var link = document.createElement('a');
+link.href = catalog_url;
+
+if (pages) {
+ link.textContent = 'Catalog';
+ link.style.color = '#F10000';
+ link.style.padding = '4px';
+ link.style.paddingLeft = '9px';
+ link.style.borderLeft = '1px solid'
+ link.style.borderLeftColor = '#A8A8A8';
+ link.style.textDecoration = "underline";
+
+ pages.appendChild(link)
+}
+else {
+ link.textContent = '[Catalog]';
+ link.style.paddingLeft = '10px';
+ link.style.textDecoration = "underline";
+ document.body.insertBefore(link, bottom);
+}
+
+if (subtitle) {
+ var link2 = document.createElement('a');
+ link2.textContent = 'Catalog';
+ link2.href = catalog_url;
+
+ var br = document.createElement('br');
+ subtitle.appendChild(br);
+ subtitle.appendChild(link2);
+}
+}
+}
+$(document).ready(catalog);