PluginProbe ʕ •ᴥ•ʔ
Email Encoder – Protect Email Addresses and Phone Numbers / 2.5.1
Email Encoder – Protect Email Addresses and Phone Numbers v2.5.1
2.5.2 2.5.1 2.5.0 2.4.8 trunk 0.10 0.11 0.12 0.20 0.21 0.22 0.30 0.31 0.32 0.40 0.41 0.42 0.50 0.60 0.70 0.71 0.80 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5 1.5.2 1.51 1.53 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7
email-encoder-bundle / assets / js / custom-admin.js
email-encoder-bundle / assets / js Last commit date
custom-admin.js 2 months ago custom.js 6 months ago encoder-form.js 6 months ago
custom-admin.js
112 lines
1 /* Email Encoder Admin */
2 (function () {
3
4 'use strict';
5
6 jQuery(function ($) {
7
8 // (Encoder form table styling now lives in style-admin.css; the
9 // previous form-table class was inheriting WP-admin spacing that
10 // fought our redesigned look.)
11
12 // Make the whole bool/option row clickable (not just the toggle + text label).
13 // The inner <label for=X> still handles its own clicks; we only fire on
14 // "dead zone" clicks (gaps + the row container itself), and we skip the
15 // (i) tooltip so that doesn't accidentally toggle the setting.
16 $(document).on('click', '.eeb-option-row, .eeb-setting--bool', function (e) {
17 if ($(e.target).closest('label, input, .eeb-tooltip').length) {
18 return;
19 }
20 var input = this.querySelector('input[type="checkbox"], input[type="radio"]');
21 if (input) {
22 input.click();
23 }
24 });
25
26 // Copy support info to clipboard. On success, swap the clipboard
27 // dashicon for a check (no text fallback) and tint the button so the
28 // click registers visually; revert after 2s.
29 var $btn = $('#eeb-copy-support-info');
30 if ($btn.length) {
31 var copying = false;
32
33 $btn.on('click', function (e) {
34 e.preventDefault();
35 if (copying) return;
36 copying = true;
37
38 var text = $btn.data('support-text');
39
40 var onCopied = function () {
41 var $icon = $btn.find('.dashicons');
42 $icon.removeClass('dashicons-clipboard').addClass('dashicons-yes-alt');
43 $btn.addClass('eeb-action-btn--copied');
44 setTimeout(function () {
45 $icon.removeClass('dashicons-yes-alt').addClass('dashicons-clipboard');
46 $btn.removeClass('eeb-action-btn--copied');
47 copying = false;
48 }, 2000);
49 };
50
51 if (navigator.clipboard && navigator.clipboard.writeText) {
52 navigator.clipboard.writeText(text).then(onCopied).catch(function () {
53 prompt((window.eebAdmin && window.eebAdmin.copyFallbackPrompt) || 'Copy this text:', text);
54 copying = false;
55 });
56 } else {
57 prompt((window.eebAdmin && window.eebAdmin.copyFallbackPrompt) || 'Copy this text:', text);
58 copying = false;
59 }
60 });
61 }
62
63 });
64
65 document.addEventListener('DOMContentLoaded', function () {
66
67 var tabs = document.querySelectorAll('.eeb-tab');
68 var panels = document.querySelectorAll('.eeb-panel');
69
70 if (!tabs.length) {
71 return;
72 }
73
74 function switchTab(tabKey, updateUrl) {
75 tabs.forEach(function (t) {
76 t.classList.remove('eeb-tab-active');
77 });
78 panels.forEach(function (p) {
79 p.style.display = 'none';
80 });
81
82 var activeTab = document.querySelector('.eeb-tab[data-tab="' + tabKey + '"]');
83 var activePanel = document.getElementById('eeb-tab-' + tabKey);
84
85 if (!activeTab || !activePanel) {
86 return;
87 }
88
89 activeTab.classList.add('eeb-tab-active');
90 activePanel.style.display = 'block';
91
92 // Sync the URL so reloads, back/forward, and bookmarking land
93 // on the same tab. replaceState (not pushState) avoids piling up
94 // history entries for every tab click.
95 if (updateUrl !== false) {
96 var url = new URL(window.location.href);
97 url.searchParams.set('tab', tabKey);
98 window.history.replaceState(null, '', url.toString());
99 }
100 }
101
102 tabs.forEach(function (tab) {
103 tab.addEventListener('click', function (e) {
104 e.preventDefault();
105 switchTab(this.getAttribute('data-tab'), true);
106 });
107 });
108
109 });
110
111 })();
112