Skip to content

Commit

Permalink
Merge pull request #904 from matheod/viewSourceFixed
Browse files Browse the repository at this point in the history
Correct issue #882 (viewSource parent toggling problem)
  • Loading branch information
jewel-andraia committed Apr 12, 2014
2 parents 5c778ab + a3c993f commit d52e46d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/modules/commentTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ modules['commentTools'] = {
},
viewSource: function(button) {
var buttonList = $(button).parent().parent();
var sourceDiv = $(button).closest('.thing').find(".usertext-edit.viewSource:first");
if (sourceDiv.length !== 0) {
if ($(button).data('source-open')) {
var sourceDiv = $(button).closest('.thing').find(".usertext-edit.viewSource:first");
sourceDiv.toggle();
} else {
var permaLink = buttonList.find(".first a");
Expand Down Expand Up @@ -334,6 +334,7 @@ modules['commentTools'] = {
userTextForm.find("textarea[name=text]").html(sourceText);
}
buttonList.before(userTextForm);
$(button).data('source-open',true);
}
});
}
Expand Down

0 comments on commit d52e46d

Please sign in to comment.