From 2df1ebd88c266d984cbaa6c26917c2ea89c2ae0e Mon Sep 17 00:00:00 2001 From: Michael Save Date: Thu, 29 Mar 2012 22:16:59 +1100 Subject: [PATCH] smartphone-spoiler.js --- js/smartphone-spoiler.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js/smartphone-spoiler.js diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js new file mode 100644 index 00000000..5dca82b7 --- /dev/null +++ b/js/smartphone-spoiler.js @@ -0,0 +1,28 @@ +/* + * smartphone-spoiler.js + * https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/smartphone-spoiler.js + * + * Released under the MIT license + * Copyright (c) 2012 Michael Save + * + * Usage: + * $config['additional_javascript'][] = 'js/smartphone-spoiler.js'; + * + */ + +$(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'); + }); + }); + } +}); +