diff --git a/js/mobile-style.js b/js/mobile-style.js index 9a171da9..89e01b73 100644 --- a/js/mobile-style.js +++ b/js/mobile-style.js @@ -1,8 +1,8 @@ -onready(function(){ - if(navigator.userAgent.match(/iPhone|iPod|iPad|Android|Opera Mini|Blackberry|PlayBook|Windows Phone|Tablet PC|Windows CE|IEMobile/i)) { - $('html').addClass("mobile-style"); - } - else { - $('html').addClass("desktop-style"); - } -}) +if(navigator.userAgent.match(/iPhone|iPod|iPad|Android|Opera Mini|Blackberry|PlayBook|Windows Phone|Tablet PC|Windows CE|IEMobile/i)) { + $('html').addClass("mobile-style"); + device_type = "mobile"; +} +else { + $('html').addClass("desktop-style"); + device_type = "desktop"; +} diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index 54c7a9a1..67b9c789 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -6,12 +6,13 @@ * Copyright (c) 2012 Michael Save * * Usage: + * $config['additional_javascript'][] = 'js/mobile-style.js'; * $config['additional_javascript'][] = 'js/smartphone-spoiler.js'; * */ onready(function(){ - if(navigator.userAgent.match(/iPhone|iPod|iPad|Android|Opera Mini|Blackberry|PlayBook|Windows Phone|Tablet PC|Windows CE|IEMobile/i)) { + if(device_type == 'mobile') { var spoilers = document.getElementsByClassName('spoiler'); for(var i = 0; i < spoilers.length; i++) { spoilers[i].onmousedown = function() {