Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
Fix: enable on the spot edit for updated message refs #157
Browse files Browse the repository at this point in the history
  • Loading branch information
mzp committed Dec 22, 2013
1 parent 59b4bd3 commit 4c40b82
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
7 changes: 7 additions & 0 deletions app/assets/javascripts/jquery-append-hack.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ $.fn.before = function(value){
return ret;
};

$.fn.__replaceWith = $.fn.replaceWith;
$.fn.replaceWith = function(value){
var ret = this.__replaceWith.apply(this, arguments);
value.trigger("as::replaceWith", Array.prototype.slice.call(arguments));
return ret;
};

})(jQuery, document);
21 changes: 8 additions & 13 deletions app/assets/javascripts/jquery-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,17 @@
target.find(selector).each(function(_, e){
f($(e));
});
target.bind("as::append",function(_,elems){
$(elems).filter(selector).each(function(_, e){
f($(e));
});
});
target.bind("as::prepend",function(_,elems){
$(elems).filter(selector).each(function(_, e){
f($(e));
});
});
target.bind("as::before",function(_,elems){

var handler = function(_,elems){
$(elems).filter(selector).each(function(_, e){
f($(e));
});
});
})
};

target.bind("as::append" ,handler);
target.bind("as::prepend" ,handler);
target.bind("as::before" ,handler);
target.bind("as::replaceWith",handler);
return this;
}
})(jQuery, document);

0 comments on commit 4c40b82

Please sign in to comment.