From 30ec330be93e84dffebc286484094bc8e66421cb Mon Sep 17 00:00:00 2001 From: Nardog Date: Wed, 21 Dec 2022 17:50:42 +0900 Subject: [PATCH] Add preventDefault to rollback links --- modules/twinklefluff.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/twinklefluff.js b/modules/twinklefluff.js index 1acb77819..adc692140 100644 --- a/modules/twinklefluff.js +++ b/modules/twinklefluff.js @@ -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); }); @@ -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 }); @@ -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); });