diff -r 82ce842da661 -r 645f4de26f99 app/jquery/jquery-editable-1.3.3.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/jquery/jquery-editable-1.3.3.js Tue Jun 23 20:54:03 2009 +0200 @@ -0,0 +1,161 @@ +(function($){ +/* + * Editable 1.3.3 + * + * Copyright (c) 2009 Arash Karimzadeh (arashkarimzadeh.com) + * Licensed under the MIT (MIT-LICENSE.txt) + * http://www.opensource.org/licenses/mit-license.php + * + * Date: Mar 02 2009 + */ +$.fn.editable = function(options){ + var defaults = { + onEdit: null, + onSubmit: null, + onCancel: null, + editClass: null, + submit: null, + cancel: null, + type: 'text', //text, textarea or select + submitBy: 'blur', //blur,change,dblclick,click + editBy: 'click', + options: null +} + if(options=='disable') + return this.unbind(this.data('editable.options').editBy,this.data('editable.options').toEditable); + if(options=='enable') + return this.bind(this.data('editable.options').editBy,this.data('editable.options').toEditable); + if(options=='destroy') + return this.unbind(this.data('editable.options').editBy,this.data('editable.options').toEditable) + .data('editable.previous',null) + .data('editable.current',null) + .data('editable.options',null); + + var options = $.extend(defaults, options); + + options.toEditable = function(){ + $this = $(this); + $this.data('editable.current',$this.html()); + opts = $this.data('editable.options'); + $.editableFactory[opts.type].toEditable($this.empty(),opts); + // Configure events,styles for changed content + $this.data('editable.previous',$this.data('editable.current')) + .children() + .focus() + .addClass(opts.editClass); + // Submit Event + if(opts.submit){ + $('