From b3ae75ed141bff95d97f996eab9a802acd7b2d92 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Sat, 31 Mar 2012 19:51:25 +1100 Subject: [PATCH] smartphone-spoiler.js: don't use jQuery --- js/smartphone-spoiler.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index fbe5bafd..262215c8 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -10,19 +10,14 @@ * */ -$(document).ready(function(){ - /* This needs to be expanded upon: */ - var is_mobile = navigator.userAgent.match(/iPhone|iPod|iPad|Android/i); - - if(is_mobile) { - $('span.spoiler').each(function() { - $(this).click(function() { - if($(this).hasClass('show')) - $(this).css('color', 'black').removeClass('show'); - else - $(this).css('color', 'white').addClass('show'); - }); - }); +onready(function(){ + if(navigator.userAgent.match(/iPhone|iPod|iPad|Android/i)) { + var spoilers = document.getElementsByClassName('spoiler'); + for(var i = 0; i < spoilers.length; i++) { + spoilers[i].onmousedown = function() { + this.style.color = 'white'; + }; + } } });