Last active
April 12, 2016 15:58
-
-
Save alisterscott/d4afc3c629a0eb74a1e77080894d2454 to your computer and use it in GitHub Desktop.
A UserScript to prompt on publish for the WordPress.com Calypso client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name WordPress Calypso Warn on Publish | |
// @version 0.1 | |
// @description Warn on publish | |
// @author Alister Scott | |
// @match https://wpcalypso.wordpress.com/* | |
// @match http://calypso.localhost:3000/* | |
// @match https://wordpress.com/* | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
console.log('WordPress Calypso Warn on Publish script loaded!'); | |
document.addEventListener('click', function(event) { | |
var classNames = event.target.className; | |
if ( ( typeof(classNames) === 'string') && ( ( classNames.indexOf( 'editor-ground-control__publish-button' ) > -1 ) || classNames.indexOf( 'editor-publish-button' ) > -1 ) ) { | |
var response = confirm("You are about to publish your post or page which will immediately send this to all your followers. Are you sure?"); | |
if (response === false) { | |
event.stopPropagation(); | |
event.preventDefault(); | |
} | |
} | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment