diff options
author | jimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003> | 2005-11-25 22:38:23 +0000 |
---|---|---|
committer | jimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003> | 2005-11-25 22:38:23 +0000 |
commit | 98da8161892e297930bc1386809456064abe5154 (patch) | |
tree | d69f0240dde86a16ddf28859696bf7be6617003c /www/inc/global.js | |
parent | f8469b7a50be618f9b2c3e031a2a9ab2ee3052aa (diff) | |
download | original-98da8161892e297930bc1386809456064abe5154.tar.gz original-98da8161892e297930bc1386809456064abe5154.tar.bz2 |
this is 0.11 actually
git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@4 4fa712ea-3c06-0410-9261-c11b4c06c003
Diffstat (limited to 'www/inc/global.js')
-rw-r--r-- | www/inc/global.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/www/inc/global.js b/www/inc/global.js new file mode 100644 index 0000000..ff8ec21 --- /dev/null +++ b/www/inc/global.js @@ -0,0 +1,79 @@ +function setActiveStyleSheet(title) { + var i, a, main; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) { + a.disabled = true; + if(a.getAttribute("title") == title) a.disabled = false; + } + } + if (title!="") { + writeCookie(title); + } +} + +function getInactiveStyleSheet() { + var i, a; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { + if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && a.disabled) return a.getAttribute("title"); + } + return null; +} + +function readCookie() { + var theme = document.cookie; + var theme = unescape(theme); + + return theme; +} + +function writeCookie(theme) { + //FIXME - set expires + var original_cookie = "theme=" + escape(theme); + document.cookie = original_cookie; +} + +function checkForTheme() { + var theme = readCookie(); + //alert(theme); + if (theme=="undefined") { + var theme = "none"; + } +} + +// what a kludge. Luckily I found a clean way +function alignForGorilla() { +var image_preview = document.getElementById('preview'); +image_preview.style.marginLeft = "-" + (image_preview.width/2 + 16) + "px"; +} + +// to hide and show the comment block +// inspired by www.wikipedia.org +function toggle_comment() { + var comment_form = document.getElementById('comment_form'); + var showlink=document.getElementById('showlink'); + var hidelink=document.getElementById('hidelink'); + if(comment_form.style.display == 'none') { + comment_was = comment_form.style.display; + comment_form.style.display = ''; + hidelink.style.display=''; + showlink.style.display='none'; + } else { + comment_form.style.display = comment_was; + hidelink.style.display='none'; + showlink.style.display=''; + } +} + +function toggle_exif() { + var exif_table = document.getElementById('exif_table'); + var exif_line = document.getElementById('exif_line'); + if(exif_table.style.display == 'none') { + exif_table.style.display = 'block'; + exif_line.style.display = 'none'; + } else { + exif_table.style.display = 'none'; + exif_line.style.display = 'block'; + } +} + |