Sha256: 066b4392deaa0d6f353e886e091180c9d7295761ef3d2dcab980f043485e140a

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

/*
 category.js: javascript for category.rb plugin of tDiary

 Copyright (C) 2011 by TADA Tadashi <t@tdtds.jp>
 You can redistribute it and/or modify it under GPL2 or any later version.
 */

$(function(){
	// insert clicked category item into textarea of update form
	function insertCategoryItem(item) {
		$('#body').insertAtCaret( '[' + item.text() + ']' );
	}

	$('.category-item')
	.hover(function(){
		$(this).css('cursor', 'pointer');
	}, function(){
		$(this).css('cursor', 'default');
	})
	.click(function(){
		insertCategoryItem($(this));
	});

	$('#category-candidate').change(function(){
		$('option:selected', this).each(function(){
			insertCategoryItem($(this));
		});
	});

	// reverse list of category
	var list = $('ul.category li').toArray().reverse();
	$('ul.category').empty().append(list);
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tdiary-5.1.2 js/category.js
tdiary-5.1.1 js/category.js