Sha256: 2a7cb87f505a5ae9a154576679251e77a81be15f4f71bbb1b55e2b8efc556ec5

Contents?: true

Size: 1.05 KB

Versions: 25

Compression:

Stored size: 1.05 KB

Contents

/*
 * show_and_hide.js : javascript for show_and_hide.rb plugin of tDiary
 *
 * Copyright (C) 2011 by tamoot <tamoot+tdiary@gmail.com>
 * You can distribute it under GPL.
 */

$( function() {
	
	function show_and_hide(target) {
		$('.show_and_hide_toggle', target).each( function() {
			$(this).click( function() {
				$('.show_and_hide#'+$(this).attr('data-showandhideid')).slideToggle(400);
			});
		});
	};
	
	// for AutoPagerize
	$(window).bind('AutoPagerize_DOMNodeInserted', function(event) {
		show_and_hide(event.target);
	});
	
	// for AuthPatchWork
	// NOTE: jQuery.bind() cannot handle an event that include a dot charactor.
	// see http://todayspython.blogspot.com/2011/06/autopager-autopagerize.html
	if(window.addEventListener) {
		window.addEventListener('AutoPatchWork.DOMNodeInserted', function(event) {
			show_and_hide(event.target);
		}, false);
	} else if(window.attachEvent) {
		window.attachEvent('onAutoPatchWork.DOMNodeInserted', function(event) {
			show_and_hide(event.target);
		});
	};
	
	show_and_hide(document)
	$('.show_and_hide').hide();
});

Version data entries

25 entries across 21 versions & 2 rubygems

Version Path
tdiary-contrib-4.0.3 js/show_and_hide.js
tdiary-contrib-4.0.2.1 js/show_and_hide.js
tdiary-contrib-4.0.2 js/show_and_hide.js
tdiary-contrib-3.2.2.20130614 js/show_and_hide.js
tdiary-contrib-3.2.2.20130518 js/show_and_hide.js