From d17337b3927a40fbeda467a78e9a2307ac255906 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 13 Apr 2021 00:14:51 +0100 Subject: [PATCH 1/2] Add confirmation dialog for Cloudinary only storage --- js/src/deactivate.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/js/src/deactivate.js b/js/src/deactivate.js index 8478b178c..8745f45ef 100644 --- a/js/src/deactivate.js +++ b/js/src/deactivate.js @@ -7,6 +7,8 @@ const Deactivate = { pluginListLinks: document.querySelectorAll( '.cld-deactivate-link, .cld-deactivate' ), + // The deactivation links when Cloudinary only is set for storage. + triggers: document.getElementsByClassName( 'cld-deactivate' ), // The reasons. options: document.querySelectorAll( '.cloudinary-deactivation input[type="radio"]' @@ -53,6 +55,24 @@ const Deactivate = { } ); } ); + // Add it a trigger watch to stop deactivation. + [ ...context.triggers ].forEach( ( trigger ) => { + trigger.addEventListener( 'click', function ( ev ) { + if ( + ! confirm( + wp.i18n.__( + 'Caution: Your storage setting is currently set to "Cloudinary only", disabling the plugin will result in broken links to media assets. Are you sure you want to continue?', + 'cloudinary' + ) + ) + ) { + ev.preventDefault(); + // Close the feedback form. + document.getElementById( 'TB_closeWindowButton' ).click(); + } + } ); + } ); + // Add event listener to skip feedback. context.skipButton.addEventListener( 'click', function () { window.location.href = context.deactivationUrl; From 5940cbc5f39fc03c5b8f6be871d9030eccd2634c Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 13 Apr 2021 00:15:29 +0100 Subject: [PATCH 2/2] Update compiled assets --- js/deactivate.asset.php | 2 +- js/deactivate.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/deactivate.asset.php b/js/deactivate.asset.php index 0a0003ca9..04b8d790a 100644 --- a/js/deactivate.asset.php +++ b/js/deactivate.asset.php @@ -1 +1 @@ - array('wp-polyfill'), 'version' => '88e240911a2b640cef23c165ef78879b'); \ No newline at end of file + array('wp-polyfill'), 'version' => 'e862bb5e9c2155662e26dab8ad582baa'); \ No newline at end of file diff --git a/js/deactivate.js b/js/deactivate.js index 1d6ac9523..c5c4f14b3 100644 --- a/js/deactivate.js +++ b/js/deactivate.js @@ -1 +1 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){var r=n(3),o=n(4),i=n(5),c=n(6);t.exports=function(t){return r(t)||o(t)||i(t)||c()}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n