PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / assets / js / scripts.js

scripts.js in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at assets/js/scripts.js

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 window.Defender = window.Defender || {};
2
3 //Added extra parameter to allow for some actions to keep modal open
4 Defender.showNotification = function (type, message, autoClose = false) {
5 var jq = jQuery;
6 var html = '<div class="sui-floating-notices"><div role="alert" id="defender-notification" class="sui-notice" aria-live="assertive"></div></div>';
7 if (jq('body').find('#defender-notification').size() === 0) {
8 jq('.sui-wrap').prepend(html);
9 }else{
10 jq('#defender-notification').closest('.sui-floating-notices').replaceWith(jQuery(html));
11 }
12 var options = {
13 type: 'green',
14 icon: 'info'
15 }
16
17 if (type === 'error') {
18 options.type = 'red';
19 } else if (type === 'warning') {
20 options.type = 'warning';
21 } else if (type === 'info') {
22 options.type = 'blue';
23 }
24
25 if (true === autoClose) {
26 options.autoclose = {
27 show: true,
28 timeout: 5000
29 };
30 } else {
31 options.dismiss = {
32 show: true,
33 label: 'Click to close',
34 tooltip: 'Dismiss'
35 };
36 }
37
38 SUI.openNotice('defender-notification', '<p>' + message + '</p>', options);
39 }
40
41 /**
42 * Filter default wp.i18n.__ function
43 * `defender-security` is our domain
44 */
45 wp.hooks.addFilter( 'i18n.gettext_defender-security', 'defender', function ( translation, text ) {
46 if ( defenderGetText && defenderGetText[ text ] ) {
47 return defenderGetText[ text ];
48 }
49
50 return translation;
51 }, 20 );
52