From af306014da4a5c9e363a170cf86a742ffcb87862 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sun, 9 Jan 2011 23:22:19 +0000 Subject: Editable tab titles --- jarmon/jarmon.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index b4bd6e4..431e08b 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -992,8 +992,6 @@ jarmon.TabbedInterface = function($tpl, recipe) { } } - this.setup(); - this.newTab('+').append( $('
').append( $('
').append( @@ -1018,6 +1016,33 @@ jarmon.TabbedInterface = function($tpl, recipe) { ); this.setup(); + + $('ul.css-tabs > li > a', $tpl[0]).live( + 'dblclick', + function(e) { + var $originalLink = $(this); + var $input = $('', { + type: 'text', + name: 'tabTitle', + value: $originalLink.text() + }); + $originalLink.replaceWith($input); + $input.focus(); + } + ); + + $('ul.css-tabs > li > input', $tpl[0]).live( + 'blur', + {self: this}, + function(e) { + var self = e.data.self; + $(this).replaceWith( + $('', {href: ['#', this.value].join('')}).text(this.value) + ); + self.setup(); + self.$tabBar.data("tabs").click(this.value); + } + ); }; jarmon.TabbedInterface.prototype.newTab = function(tabName) { -- cgit v1.2.3