Browse Source

add js device_type variable (mobile-style.js) and make smartphone-spoiler.js use it

pull/40/head
Marcin Łabanowski 12 years ago
parent
commit
839854ffc4
  1. 16
      js/mobile-style.js
  2. 3
      js/smartphone-spoiler.js

16
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";
}

3
js/smartphone-spoiler.js

@ -6,12 +6,13 @@
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
*
* 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() {

Loading…
Cancel
Save