Skip to content

Commit

Permalink
Add preventDefault to rollback links
Browse files Browse the repository at this point in the history
  • Loading branch information
nardog authored and siddharthvp committed Jan 26, 2023
1 parent 09c3e57 commit 30ec330
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/twinklefluff.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ Twinkle.fluff.linkBuilder = {
normLink.style.fontWeight = 'bold';
vandLink.style.fontWeight = 'bold';

$(normLink).click(function() {
$(normLink).click(function(e) {
e.preventDefault();
Twinkle.fluff.revert('norm', vandal, rev, page);
Twinkle.fluff.disableLinks(revNode);
});
$(vandLink).click(function() {
$(vandLink).click(function(e) {
e.preventDefault();
Twinkle.fluff.revert('vand', vandal, rev, page);
Twinkle.fluff.disableLinks(revNode);
});
Expand All @@ -141,7 +143,8 @@ Twinkle.fluff.linkBuilder = {
if (!inline) {
var agfNode = document.createElement('span');
var agfLink = Twinkle.fluff.linkBuilder.buildLink('DarkOliveGreen', 'rollback (AGF)');
$(agfLink).click(function() {
$(agfLink).click(function(e) {
e.preventDefault();
Twinkle.fluff.revert('agf', vandal, rev, page);
// Twinkle.fluff.disableLinks(revNode); // rollbackInPlace not relevant for any inline situations
});
Expand Down Expand Up @@ -169,7 +172,8 @@ Twinkle.fluff.linkBuilder = {
revertToRevisionNode.style.fontWeight = 'bold';

var revertToRevisionLink = Twinkle.fluff.linkBuilder.buildLink('SaddleBrown', 'restore this version');
$(revertToRevisionLink).click(function() {
$(revertToRevisionLink).click(function(e) {
e.preventDefault();
Twinkle.fluff.revertToRevision(revisionRef);
});

Expand Down

0 comments on commit 30ec330

Please sign in to comment.