summaryrefslogtreecommitdiff
path: root/js/smartphone-spoiler.js
blob: fbe5bafd44f635c88dd27804ba0fbd1626ca7dc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * smartphone-spoiler.js
 * https://github.com/savetheinternet/Tinyboard/blob/master/js/smartphone-spoiler.js
 *
 * Released under the MIT license
 * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
 *
 * 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');
			});
		});
	}
});