aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template/styleswitcher.js
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-04-01 22:05:42 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-04-01 22:05:42 +0000
commitf610ed82cbf0df2b5f8afd6ca3f88b9313281036 (patch)
tree22eee242b76b4a75bfa2efff1169e90637858982 /phpBB/styles/prosilver/template/styleswitcher.js
parentc78c82123e6876541320ad4ebf2ba1e85a582fd0 (diff)
downloadforums-f610ed82cbf0df2b5f8afd6ca3f88b9313281036.tar
forums-f610ed82cbf0df2b5f8afd6ca3f88b9313281036.tar.gz
forums-f610ed82cbf0df2b5f8afd6ca3f88b9313281036.tar.bz2
forums-f610ed82cbf0df2b5f8afd6ca3f88b9313281036.tar.xz
forums-f610ed82cbf0df2b5f8afd6ca3f88b9313281036.zip
say hello to prosilver... YAAAYEEEE
git-svn-id: file:///svn/phpbb/trunk@7260 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/styles/prosilver/template/styleswitcher.js')
-rw-r--r--phpBB/styles/prosilver/template/styleswitcher.js158
1 files changed, 158 insertions, 0 deletions
diff --git a/phpBB/styles/prosilver/template/styleswitcher.js b/phpBB/styles/prosilver/template/styleswitcher.js
new file mode 100644
index 0000000000..8768ac365b
--- /dev/null
+++ b/phpBB/styles/prosilver/template/styleswitcher.js
@@ -0,0 +1,158 @@
+
+function fontsizeup()
+{
+ var active = getActiveStyleSheet();
+
+ switch (active)
+ {
+ case 'A--':
+ setActiveStyleSheet('A-');
+ break;
+
+ case 'A-':
+ setActiveStyleSheet('A');
+ break;
+
+ case 'A':
+ setActiveStyleSheet('A+');
+ break;
+
+ case 'A+':
+ setActiveStyleSheet('A++');
+ break;
+
+ case 'A++':
+ setActiveStyleSheet('A');
+ break;
+
+ default:
+ setActiveStyleSheet('A');
+ break;
+ }
+}
+
+function fontsizedown()
+{
+ active = getActiveStyleSheet();
+
+ switch (active)
+ {
+ case 'A++' :
+ setActiveStyleSheet('A+');
+ break;
+
+ case 'A+' :
+ setActiveStyleSheet('A');
+ break;
+
+ case 'A' :
+ setActiveStyleSheet('A-');
+ break;
+
+ case 'A-' :
+ setActiveStyleSheet('A--');
+ break;
+
+ case 'A--' :
+ break;
+
+ default :
+ setActiveStyleSheet('A--');
+ break;
+ }
+}
+
+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;
+ }
+ }
+ }
+}
+
+function getActiveStyleSheet()
+{
+ 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 getPreferredStyleSheet()
+{
+ return ('A-');
+}
+
+function createCookie(name, value, days)
+{
+ if (days)
+ {
+ var date = new Date();
+ date.setTime(date.getTime() + (days*24*60*60*1000));
+ var expires = '; expires=' + date.toGMTString();
+ }
+ else
+ {
+ expires = '';
+ }
+
+ document.cookie = name + '=' + value + expires + '; path=/';
+}
+
+function readCookie(name)
+{
+ var nameEQ = name + '=';
+ var ca = document.cookie.split(';');
+
+ for (var i = 0; i < ca.length; i++)
+ {
+ var c = ca[i];
+
+ while (c.charAt(0) == ' ')
+ {
+ c = c.substring(1, c.length);
+ }
+
+ if (c.indexOf(nameEQ) == 0)
+ {
+ return c.substring(nameEQ.length, c.length);
+ }
+ }
+
+ return null;
+}
+
+window.onload = function(e)
+{
+ var cookie = readCookie('style_cookie');
+ var title = cookie ? cookie : getPreferredStyleSheet();
+ setActiveStyleSheet(title);
+}
+
+window.onunload = function(e)
+{
+ var title = getActiveStyleSheet();
+ createCookie('style_cookie', title, 365);
+}
+
+/*
+var cookie = readCookie("style");
+var title = cookie ? cookie : getPreferredStyleSheet();
+setActiveStyleSheet(title);
+*/ \ No newline at end of file