User:Nardog/TemplatePreviewGuard

TemplatePreviewGuard
DescriptionWarns when you try to use "Preview page with this template" with a page that doesn't transclude the template
UpdatedSeptember 8, 2023
    (7 months ago)
Browser supportChrome, Firefox, etc.
SourceUser:Nardog/TemplatePreviewGuard.js

Have you ever used the "Preview page with this template" feature and wondered why your changes weren't being reflected in the preview only to realize you were editing the wrong template? If you have, this script is for you. It'll show you a confirmation dialog if you click "Show preview" under "Preview page with this template" and the entered page doesn't transclude the page being edited.

Installation edit

Add the following to your common.js or global.js:

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/TemplatePreviewGuard.js&action=raw&ctype=text/javascript');

Or you may enable the script installer in Preferences → Gadgets and click "Install" in the infobox on this page.

See also edit