summaryrefslogtreecommitdiff
path: root/lib/tpl/dokuwiki/script.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
commit04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch)
treed83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /lib/tpl/dokuwiki/script.js
parent1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff)
parenta731ed1d6736ca405b3559adfd9500affcc59412 (diff)
downloadrpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz
rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2
Merge branch 'master' into proxyconnect
* master: (169 commits) added PCRE UTF-8 checks to do=check FS#2636 avoid multiple paralell update checks fix regression bug in HTTPClient FS#2621 changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER TarLib code cleanup TarLib: fixed appending in non-dynamic mode fixed third method of adding files in TarLib fix lone zero block in TarLib created archives fix use of constructor in TarLib Slovak language update Korean language update Latvian language update added event PAGEUTILS_ID_HIDEPAGE added test for isHiddenPage() removed redundant variables in tpl_include_page() (because of 3ff8773b) added cut off points for mobile devices as parameters to style.ini Corrected typo: ruke -> rule Persian language update Spanish language update russian language update ...
Diffstat (limited to 'lib/tpl/dokuwiki/script.js')
-rw-r--r--lib/tpl/dokuwiki/script.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js
index d858bda89..3ed8dbabe 100644
--- a/lib/tpl/dokuwiki/script.js
+++ b/lib/tpl/dokuwiki/script.js
@@ -12,18 +12,23 @@ var device_classes = 'desktop mobile tablet phone';
function tpl_dokuwiki_mobile(){
+ // the z-index in mobile.css is (mis-)used purely for detecting the screen mode here
+ var screen_mode = jQuery('#screen__mode').css('z-index');
+
// determine our device pattern
// TODO: consider moving into dokuwiki core
- var w = document.body.clientWidth;
- if (w > 979) {
- if (device_class == 'desktop') return;
- device_class = 'desktop';
- } else if (w > 480) {
- if (device_class.match(/tablet/)) return;
- device_class = 'mobile tablet';
- } else {
- if (device_class.match(/phone/)) return;
- device_class = 'mobile phone';
+ switch (screen_mode) {
+ case '1':
+ if (device_class.match(/tablet/)) return;
+ device_class = 'mobile tablet';
+ break;
+ case '2':
+ if (device_class.match(/phone/)) return;
+ device_class = 'mobile phone';
+ break;
+ default:
+ if (device_class == 'desktop') return;
+ device_class = 'desktop';
}
jQuery('html').removeClass(device_classes).addClass(device_class);