codemirror
3 years ago
datatables
3 years ago
admin-page.js
3 years ago
custom-admin-menu.js
3 years ago
hide-admin-notices.js
3 years ago
jBox.all.min.js
3 years ago
jquery.jsticky.mod.js
3 years ago
jquery.jsticky.mod.min.js
3 years ago
js.cookie.min.js
3 years ago
media-replace.js
3 years ago
public.js
3 years ago
toggle-hidden-menu.js
3 years ago
admin-page.js
772 lines
| 1 | (function( $ ) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | $(document).ready( function() { |
| 5 | |
| 6 | // Make page header sticky on scroll. Using https://github.com/AndrewHenderson/jSticky |
| 7 | $('#asenha-header').sticky({ |
| 8 | topSpacing: 0, // Space between element and top of the viewport (in pixels) |
| 9 | zIndex: 100, // z-index |
| 10 | stopper: '', // Id, class, or number value |
| 11 | stickyClass: 'asenha-sticky' // Class applied to element when it's stuck. Class name or false. |
| 12 | }) |
| 13 | |
| 14 | // Clicking on header save button triggers click of the hidden form submit button |
| 15 | $('.asenha-save-button').click( function(e) { |
| 16 | |
| 17 | e.preventDefault(); |
| 18 | |
| 19 | // Get current tab's URL hash and save it in cookie |
| 20 | var hash = decodeURI(window.location.hash).substr(1); // get hash without the # character |
| 21 | Cookies.set('asenha_tab', hash, { expires: 1 }); // expires in 1 day |
| 22 | |
| 23 | // Submit the settings form |
| 24 | $('input[type="submit"]').click(); |
| 25 | |
| 26 | }); |
| 27 | |
| 28 | // Show all / less toggler for field options | Modified from https://codepen.io/symonsays/pen/rzgEgY |
| 29 | $('.asenha-field-with-options.field-show-more > .show-more').click(function(e) { |
| 30 | |
| 31 | e.preventDefault(); |
| 32 | |
| 33 | var $this = $(this); |
| 34 | $this.toggleClass('show-more'); |
| 35 | |
| 36 | if ($this.hasClass('show-more')) { |
| 37 | $this.next().removeClass('opened',0); |
| 38 | $this.html('Expand ▼'); |
| 39 | } else { |
| 40 | $this.next().addClass('opened',0); |
| 41 | $this.html('Collapse ▲'); |
| 42 | } |
| 43 | |
| 44 | }); |
| 45 | |
| 46 | // Initialize data tables |
| 47 | var table = $("#login-attempts-log").DataTable({ |
| 48 | pageLength: 10 |
| 49 | }); |
| 50 | |
| 51 | // Place fields into the "Content Management" tab |
| 52 | $('.enable-duplication').appendTo('.fields-content-management > table > tbody'); |
| 53 | $('.enable-media-replacement').appendTo('.fields-content-management > table > tbody'); |
| 54 | $('.enable-svg-upload').appendTo('.fields-content-management > table > tbody'); |
| 55 | $('.enable-svg-upload-for').appendTo('.fields-content-management .enable-svg-upload .asenha-subfields'); |
| 56 | $('.enable-external-permalinks').appendTo('.fields-content-management > table > tbody'); |
| 57 | $('.enable-external-permalinks-for').appendTo('.fields-content-management .enable-external-permalinks .asenha-subfields'); |
| 58 | $('.enable-revisions-control').appendTo('.fields-content-management > table > tbody'); |
| 59 | $('.revisions-max-number').appendTo('.fields-content-management .enable-revisions-control .asenha-subfields'); |
| 60 | $('.enable-revisions-control-for').appendTo('.fields-content-management .enable-revisions-control .asenha-subfields'); |
| 61 | $('.enable-missed-schedule-posts-auto-publish').appendTo('.fields-content-management > table > tbody'); |
| 62 | $('.enhance-list-tables').appendTo('.fields-content-management > table > tbody'); |
| 63 | $('.show-featured-image-column').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 64 | $('.show-excerpt-column').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 65 | $('.show-id-column').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 66 | $('.hide-comments-column').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 67 | $('.hide-post-tags-column').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 68 | $('.show-custom-taxonomy-filters').appendTo('.fields-content-management .enhance-list-tables .asenha-subfields'); |
| 69 | |
| 70 | // Place fields into "Admin Interface" tab |
| 71 | $('.hide-admin-notices').appendTo('.fields-admin-interface > table > tbody'); |
| 72 | $('.view-admin-as-role').appendTo('.fields-admin-interface > table > tbody'); |
| 73 | $('.customize-admin-menu').appendTo('.fields-admin-interface > table > tbody'); |
| 74 | $('.custom-menu-order').appendTo('.fields-admin-interface .customize-admin-menu .asenha-subfields'); |
| 75 | $('.disable-dashboard-widgets').appendTo('.fields-admin-interface > table > tbody'); |
| 76 | $('.disabled-dashboard-widgets').appendTo('.fields-admin-interface .disable-dashboard-widgets .asenha-subfields'); |
| 77 | $('.hide-modify-elements').appendTo('.fields-admin-interface > table > tbody'); |
| 78 | $('.hide-ab-wp-logo-menu').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 79 | $('.hide-ab-customize-menu').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 80 | $('.hide-ab-updates-menu').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 81 | $('.hide-ab-comments-menu').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 82 | $('.hide-ab-new-content-menu').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 83 | $('.hide-ab-howdy').appendTo('.fields-admin-interface .hide-modify-elements .asenha-subfields'); |
| 84 | $('.hide-admin-bar').appendTo('.fields-admin-interface > table > tbody'); |
| 85 | $('.hide-admin-bar-for').appendTo('.fields-admin-interface .hide-admin-bar .asenha-subfields'); |
| 86 | |
| 87 | // Place fields into "Log In | Log Out" tab |
| 88 | $('.change-login-url').appendTo('.fields-login-logout > table > tbody'); |
| 89 | $('.custom-login-slug').appendTo('.fields-login-logout .change-login-url .asenha-subfields'); |
| 90 | $('.enable-login-logout-menu').appendTo('.fields-login-logout > table > tbody'); |
| 91 | $('.enable-last-login-column').appendTo('.fields-login-logout > table > tbody'); |
| 92 | $('.redirect-after-login').appendTo('.fields-login-logout > table > tbody'); |
| 93 | $('.redirect-after-login-to-slug').appendTo('.fields-login-logout .redirect-after-login .asenha-subfields'); |
| 94 | $('.redirect-after-login-for').appendTo('.fields-login-logout .redirect-after-login .asenha-subfields'); |
| 95 | $('.redirect-after-logout').appendTo('.fields-login-logout > table > tbody'); |
| 96 | $('.redirect-after-logout-to-slug').appendTo('.fields-login-logout .redirect-after-logout .asenha-subfields'); |
| 97 | $('.redirect-after-logout-for').appendTo('.fields-login-logout .redirect-after-logout .asenha-subfields'); |
| 98 | |
| 99 | // Place fields into "Custom Code" tab |
| 100 | $('.enable-custom-admin-css').appendTo('.fields-custom-code > table > tbody'); |
| 101 | $('.custom-admin-css').appendTo('.fields-custom-code .enable-custom-admin-css .asenha-subfields'); |
| 102 | $('.enable-custom-frontend-css').appendTo('.fields-custom-code > table > tbody'); |
| 103 | $('.custom-frontend-css').appendTo('.fields-custom-code .enable-custom-frontend-css .asenha-subfields'); |
| 104 | $('.insert-head-body-footer-code').appendTo('.fields-custom-code > table > tbody'); |
| 105 | $('.head-code-priority').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 106 | $('.head-code').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 107 | $('.body-code-priority').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 108 | $('.body-code').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 109 | $('.footer-code-priority').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 110 | $('.footer-code').appendTo('.fields-custom-code .insert-head-body-footer-code .asenha-subfields'); |
| 111 | $('.manage-ads-appads-txt').appendTo('.fields-custom-code > table > tbody'); |
| 112 | $('.ads-txt-content').appendTo('.fields-custom-code .manage-ads-appads-txt .asenha-subfields'); |
| 113 | $('.app-ads-txt-content').appendTo('.fields-custom-code .manage-ads-appads-txt .asenha-subfields'); |
| 114 | $('.manage-robots-txt').appendTo('.fields-custom-code > table > tbody'); |
| 115 | $('.robots-txt-content').appendTo('.fields-custom-code .manage-robots-txt .asenha-subfields'); |
| 116 | |
| 117 | // Place fields into the "Disable Components" tab |
| 118 | $('.disable-gutenberg').appendTo('.fields-disable-components > table > tbody'); |
| 119 | $('.disable-gutenberg-for').appendTo('.fields-disable-components .disable-gutenberg .asenha-subfields'); |
| 120 | $('.disable-gutenberg-frontend-styles').appendTo('.fields-disable-components .disable-gutenberg .asenha-subfields'); |
| 121 | $('.disable-comments').appendTo('.fields-disable-components > table > tbody'); |
| 122 | $('.disable-comments-for').appendTo('.fields-disable-components .disable-comments .asenha-subfields'); |
| 123 | $('.disable-rest-api').appendTo('.fields-disable-components > table > tbody'); |
| 124 | $('.disable-feeds').appendTo('.fields-disable-components > table > tbody'); |
| 125 | $('.disable-all-updates').appendTo('.fields-disable-components > table > tbody'); |
| 126 | |
| 127 | // Place fields into "Security" tab |
| 128 | $('.limit-login-attempts').appendTo('.fields-security > table > tbody'); |
| 129 | $('.login-fails-allowed').appendTo('.fields-security .limit-login-attempts .asenha-subfields'); |
| 130 | $('.login-lockout-maxcount').appendTo('.fields-security .limit-login-attempts .asenha-subfields'); |
| 131 | $('.login-attempts-log-table').appendTo('.fields-security .limit-login-attempts .asenha-subfields'); |
| 132 | $('.obfuscate-author-slugs').appendTo('.fields-security > table > tbody'); |
| 133 | $('.disable-xmlrpc').appendTo('.fields-security > table > tbody'); |
| 134 | |
| 135 | // Place fields into "Optimizations" tab |
| 136 | $('.enable-heartbeat-control').appendTo('.fields-optimizations > table > tbody'); |
| 137 | $('.heartbeat-control-for-admin-pages').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 138 | $('.heartbeat-interval-for-admin-pages').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 139 | $('.heartbeat-control-for-post-edit').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 140 | $('.heartbeat-interval-for-post-edit').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 141 | $('.heartbeat-control-for-frontend').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 142 | $('.heartbeat-interval-for-frontend').appendTo('.fields-optimizations .enable-heartbeat-control .asenha-subfields'); |
| 143 | |
| 144 | // Place fields into "Utilities" tab |
| 145 | $('.enable-password-protection').appendTo('.fields-utilities > table > tbody'); |
| 146 | $('.password-protection-password').appendTo('.fields-utilities .enable-password-protection .asenha-subfields'); |
| 147 | $('.redirect-404-to-homepage').appendTo('.fields-utilities > table > tbody'); |
| 148 | |
| 149 | // Remove empty .form-table that originally holds the fields |
| 150 | const formTableCount = $('.form-table').length; |
| 151 | // $('.form-table')[formTableCount-1].remove(); |
| 152 | |
| 153 | // Enable Custom Admin CSS => Initialize CodeMirror |
| 154 | var adminCssTextarea = document.getElementById("admin_site_enhancements[custom_admin_css]"); |
| 155 | var adminCssEditor = CodeMirror.fromTextArea(adminCssTextarea, { |
| 156 | mode: "css", |
| 157 | lineNumbers: true, |
| 158 | lineWrapping: true |
| 159 | }); |
| 160 | |
| 161 | adminCssEditor.setSize("100%",600); |
| 162 | |
| 163 | // Enable Custom Frontend CSS => Initialize CodeMirror |
| 164 | var frontendCssTextarea = document.getElementById("admin_site_enhancements[custom_frontend_css]"); |
| 165 | var frontendCssEditor = CodeMirror.fromTextArea(frontendCssTextarea, { |
| 166 | mode: "css", |
| 167 | lineNumbers: true, |
| 168 | lineWrapping: true |
| 169 | }); |
| 170 | |
| 171 | frontendCssEditor.setSize("100%",600); |
| 172 | |
| 173 | // Manage ads.txt and app-ads.txt=> Initialize CodeMirror |
| 174 | var adsTxtTextarea = document.getElementById("admin_site_enhancements[ads_txt_content]"); |
| 175 | var adsTxtEditor = CodeMirror.fromTextArea(adsTxtTextarea, { |
| 176 | mode: "markdown", |
| 177 | lineNumbers: true, |
| 178 | lineWrapping: true |
| 179 | }); |
| 180 | |
| 181 | adsTxtEditor.setSize("100%",300); |
| 182 | |
| 183 | var appAdsTxtTextarea = document.getElementById("admin_site_enhancements[app_ads_txt_content]"); |
| 184 | var appAdsTxtEditor = CodeMirror.fromTextArea(appAdsTxtTextarea, { |
| 185 | mode: "markdown", |
| 186 | lineNumbers: true, |
| 187 | lineWrapping: true |
| 188 | }); |
| 189 | |
| 190 | appAdsTxtEditor.setSize("100%",300); |
| 191 | |
| 192 | // Manage robots.txt => Initialize CodeMirror |
| 193 | var robotsTxtTextarea = document.getElementById("admin_site_enhancements[robots_txt_content]"); |
| 194 | var robotsTxtEditor = CodeMirror.fromTextArea(robotsTxtTextarea, { |
| 195 | mode: "markdown", |
| 196 | lineNumbers: true, |
| 197 | lineWrapping: true |
| 198 | }); |
| 199 | |
| 200 | robotsTxtEditor.setSize("100%",400); |
| 201 | |
| 202 | // Insert <head>, <body> and <footer> code => Initialize CodeMirror |
| 203 | var headCodeTextarea = document.getElementById("admin_site_enhancements[head_code]"); |
| 204 | var headCodeEditor = CodeMirror.fromTextArea(headCodeTextarea, { |
| 205 | mode: "htmlmixed", |
| 206 | lineNumbers: true, |
| 207 | lineWrapping: true |
| 208 | }); |
| 209 | headCodeEditor.setSize("100%",300); |
| 210 | |
| 211 | var bodyCodeTextarea = document.getElementById("admin_site_enhancements[body_code]"); |
| 212 | var bodyCodeEditor = CodeMirror.fromTextArea(bodyCodeTextarea, { |
| 213 | mode: "htmlmixed", |
| 214 | lineNumbers: true, |
| 215 | lineWrapping: true |
| 216 | }); |
| 217 | bodyCodeEditor.setSize("100%",300); |
| 218 | |
| 219 | var footerCodeTextarea = document.getElementById("admin_site_enhancements[footer_code]"); |
| 220 | var footerCodeEditor = CodeMirror.fromTextArea(footerCodeTextarea, { |
| 221 | mode: "htmlmixed", |
| 222 | lineNumbers: true, |
| 223 | lineWrapping: true |
| 224 | }); |
| 225 | footerCodeEditor.setSize("100%",300); |
| 226 | |
| 227 | // Show and hide corresponding fields on tab clicks |
| 228 | |
| 229 | $('#tab-content-management + label').click( function() { |
| 230 | $('.fields-content-management').show(); |
| 231 | $('.asenha-fields:not(.fields-content-management)').hide(); |
| 232 | window.location.hash = 'content-management'; |
| 233 | Cookies.set('asenha_tab', 'content-management', { expires: 1 }); // expires in 1 day |
| 234 | }); |
| 235 | |
| 236 | $('#tab-admin-interface + label').click( function() { |
| 237 | $('.fields-admin-interface').show(); |
| 238 | $('.asenha-fields:not(.fields-admin-interface)').hide(); |
| 239 | window.location.hash = 'admin-interface'; |
| 240 | Cookies.set('asenha_tab', 'admin-interface', { expires: 1 }); // expires in 1 day |
| 241 | }); |
| 242 | |
| 243 | $('#tab-login-logout + label').click( function() { |
| 244 | $('.fields-login-logout').show(); |
| 245 | $('.asenha-fields:not(.fields-login-logout)').hide(); |
| 246 | window.location.hash = 'login-logout'; |
| 247 | Cookies.set('asenha_tab', 'login-logout', { expires: 1 }); // expires in 1 day |
| 248 | }); |
| 249 | |
| 250 | $('#tab-custom-code + label').click( function() { |
| 251 | $('.fields-custom-code').show(); |
| 252 | $('.asenha-fields:not(.fields-custom-code)').hide(); |
| 253 | window.location.hash = 'custom-code'; |
| 254 | Cookies.set('asenha_tab', 'custom-code', { expires: 1 }); // expires in 1 day |
| 255 | adminCssEditor.refresh(); // Custom Admin CSS >> CodeMirror |
| 256 | frontendCssEditor.refresh(); // Custom Fronend CSS >> CodeMirror |
| 257 | adsTxtEditor.refresh(); // Manage ads.txt >> CodeMirror |
| 258 | appAdsTxtEditor.refresh(); // Manage app-ads.txt >> CodeMirror |
| 259 | headCodeEditor.refresh(); // Insert <head>, <body> and <footer> code >> CodeMirror |
| 260 | bodyCodeEditor.refresh(); // Insert <head>, <body> and <footer> code >> CodeMirror |
| 261 | footerCodeEditor.refresh(); // Insert <head>, <body> and <footer> code >> CodeMirror |
| 262 | robotsTxtEditor.refresh(); // Manage robots.txt >> CodeMirror |
| 263 | }); |
| 264 | |
| 265 | $('#tab-disable-components + label').click( function() { |
| 266 | $('.fields-disable-components').show(); |
| 267 | $('.asenha-fields:not(.fields-disable-components)').hide(); |
| 268 | window.location.hash = 'disable-components'; |
| 269 | Cookies.set('asenha_tab', 'disable-components', { expires: 1 }); // expires in 1 day |
| 270 | }); |
| 271 | |
| 272 | $('#tab-security + label').click( function() { |
| 273 | $('.fields-security').show(); |
| 274 | $('.asenha-fields:not(.fields-security)').hide(); |
| 275 | window.location.hash = 'security'; |
| 276 | Cookies.set('asenha_tab', 'security', { expires: 1 }); // expires in 1 day |
| 277 | }); |
| 278 | |
| 279 | $('#tab-optimizations + label').click( function() { |
| 280 | $('.fields-optimizations').show(); |
| 281 | $('.asenha-fields:not(.fields-optimizations)').hide(); |
| 282 | window.location.hash = 'optimizations'; |
| 283 | Cookies.set('asenha_tab', 'optimizations', { expires: 1 }); // expires in 1 day |
| 284 | }); |
| 285 | |
| 286 | $('#tab-utilities + label').click( function() { |
| 287 | $('.fields-utilities').show(); |
| 288 | $('.asenha-fields:not(.fields-utilities)').hide(); |
| 289 | window.location.hash = 'utilities'; |
| 290 | Cookies.set('asenha_tab', 'utilities', { expires: 1 }); // expires in 1 day |
| 291 | }); |
| 292 | |
| 293 | // Open tab set in 'asenha_tab' cookie set on saving changes. Defaults to content-management tab when cookie is empty |
| 294 | var asenhaTabHash = Cookies.get('asenha_tab'); |
| 295 | |
| 296 | if (typeof asenhaTabHash === 'undefined') { |
| 297 | $('#tab-content-management + label').trigger('click'); |
| 298 | } else { |
| 299 | $('#tab-' + asenhaTabHash + ' + label').trigger('click'); |
| 300 | } |
| 301 | |
| 302 | // Enable SVG Upload => show/hide roles checkboxes on document ready |
| 303 | if ( document.getElementById('admin_site_enhancements[enable_svg_upload]').checked ) { |
| 304 | $('.enable-svg-upload .asenha-subfields').show(); |
| 305 | $('.asenha-toggle.enable-svg-upload td .asenha-field-with-options').addClass('is-enabled'); |
| 306 | } else { |
| 307 | $('.enable-svg-upload .asenha-subfields').hide(); |
| 308 | } |
| 309 | |
| 310 | // Enable SVG Upload => show/hide roles checkboxes on toggle click |
| 311 | document.getElementById('admin_site_enhancements[enable_svg_upload]').addEventListener('click', event => { |
| 312 | if (event.target.checked) { |
| 313 | $('.enable-svg-upload .asenha-subfields').fadeIn(); |
| 314 | $('.enable-svg-upload .asenha-field-with-options').toggleClass('is-enabled'); |
| 315 | } else { |
| 316 | $('.enable-svg-upload .asenha-subfields').hide(); |
| 317 | $('.enable-svg-upload .asenha-field-with-options').toggleClass('is-enabled'); |
| 318 | } |
| 319 | }); |
| 320 | |
| 321 | // Enable External Permalinks => show/hide post types checkboxes on document ready |
| 322 | if ( document.getElementById('admin_site_enhancements[enable_external_permalinks]').checked ) { |
| 323 | $('.enable-external-permalinks .asenha-subfields').show(); |
| 324 | $('.asenha-toggle.enable-external-permalinks td .asenha-field-with-options').addClass('is-enabled'); |
| 325 | } else { |
| 326 | $('.enable-external-permalinks .asenha-subfields').hide(); |
| 327 | } |
| 328 | |
| 329 | // Enable External Permalinks => show/hide post types checkboxes on toggle click |
| 330 | document.getElementById('admin_site_enhancements[enable_external_permalinks]').addEventListener('click', event => { |
| 331 | if (event.target.checked) { |
| 332 | $('.enable-external-permalinks .asenha-subfields').fadeIn(); |
| 333 | $('.enable-external-permalinks .asenha-field-with-options').toggleClass('is-enabled'); |
| 334 | } else { |
| 335 | $('.enable-external-permalinks .asenha-subfields').hide(); |
| 336 | $('.enable-external-permalinks .asenha-field-with-options').toggleClass('is-enabled'); |
| 337 | } |
| 338 | }); |
| 339 | |
| 340 | // Enable Revisions Control => show/hide roles checkboxes on document ready |
| 341 | if ( document.getElementById('admin_site_enhancements[enable_revisions_control]').checked ) { |
| 342 | $('.enable-revisions-control .asenha-subfields').show(); |
| 343 | $('.asenha-toggle.enable-revisions-control td .asenha-field-with-options').addClass('is-enabled'); |
| 344 | } else { |
| 345 | $('.enable-revisions-control .asenha-subfields').hide(); |
| 346 | } |
| 347 | |
| 348 | // Enable SVG Upload => show/hide roles checkboxes on toggle click |
| 349 | document.getElementById('admin_site_enhancements[enable_revisions_control]').addEventListener('click', event => { |
| 350 | if (event.target.checked) { |
| 351 | $('.enable-revisions-control .asenha-subfields').fadeIn(); |
| 352 | $('.enable-revisions-control .asenha-field-with-options').toggleClass('is-enabled'); |
| 353 | } else { |
| 354 | $('.enable-revisions-control .asenha-subfields').hide(); |
| 355 | $('.enable-revisions-control .asenha-field-with-options').toggleClass('is-enabled'); |
| 356 | } |
| 357 | }); |
| 358 | |
| 359 | // Enhance List Tables => show/hide subfields on document ready |
| 360 | if ( document.getElementById('admin_site_enhancements[enhance_list_tables]').checked ) { |
| 361 | $('.enhance-list-tables .asenha-subfields').show(); |
| 362 | $('.asenha-toggle.enhance-list-tables td .asenha-field-with-options').addClass('is-enabled'); |
| 363 | } else { |
| 364 | $('.enhance-list-tables .asenha-subfields').hide(); |
| 365 | } |
| 366 | |
| 367 | // Enhance List Tables => show/hide subfields on toggle click |
| 368 | document.getElementById('admin_site_enhancements[enhance_list_tables]').addEventListener('click', event => { |
| 369 | if (event.target.checked) { |
| 370 | $('.enhance-list-tables .asenha-subfields').fadeIn(); |
| 371 | $('.enhance-list-tables .asenha-field-with-options').toggleClass('is-enabled'); |
| 372 | } else { |
| 373 | $('.enhance-list-tables .asenha-subfields').hide(); |
| 374 | $('.enhance-list-tables .asenha-field-with-options').toggleClass('is-enabled'); |
| 375 | } |
| 376 | }); |
| 377 | |
| 378 | // Hide Admin Bar => show/hide roles checkboxes on document ready |
| 379 | if ( document.getElementById('admin_site_enhancements[hide_admin_bar]').checked ) { |
| 380 | $('.hide-admin-bar .asenha-subfields').show(); |
| 381 | $('.asenha-toggle.hide-admin-bar td .asenha-field-with-options').addClass('is-enabled'); |
| 382 | } else { |
| 383 | $('.hide-admin-bar .asenha-subfields').hide(); |
| 384 | } |
| 385 | |
| 386 | // Hide Admin Bar => show/hide roles checkboxes on toggle click |
| 387 | document.getElementById('admin_site_enhancements[hide_admin_bar]').addEventListener('click', event => { |
| 388 | if (event.target.checked) { |
| 389 | $('.hide-admin-bar .asenha-subfields').fadeIn(); |
| 390 | $('.hide-admin-bar .asenha-field-with-options').toggleClass('is-enabled'); |
| 391 | } else { |
| 392 | $('.hide-admin-bar .asenha-subfields').hide(); |
| 393 | $('.hide-admin-bar .asenha-field-with-options').toggleClass('is-enabled'); |
| 394 | } |
| 395 | }); |
| 396 | |
| 397 | // Disable Dashboard Widgets => show/hide subfields on document ready |
| 398 | if ( document.getElementById('admin_site_enhancements[disable_dashboard_widgets]').checked ) { |
| 399 | $('.disable-dashboard-widgets .asenha-subfields').show(); |
| 400 | $('.asenha-toggle.disable-dashboard-widgets td .asenha-field-with-options').addClass('is-enabled'); |
| 401 | } else { |
| 402 | $('.disable-dashboard-widgets .asenha-subfields').hide(); |
| 403 | } |
| 404 | |
| 405 | // Disable Dashboard Widgets => show/hide subfields on toggle click |
| 406 | document.getElementById('admin_site_enhancements[disable_dashboard_widgets]').addEventListener('click', event => { |
| 407 | if (event.target.checked) { |
| 408 | $('.disable-dashboard-widgets .asenha-subfields').fadeIn(); |
| 409 | $('.disable-dashboard-widgets .asenha-field-with-options').toggleClass('is-enabled'); |
| 410 | } else { |
| 411 | $('.disable-dashboard-widgets .asenha-subfields').hide(); |
| 412 | $('.disable-dashboard-widgets .asenha-field-with-options').toggleClass('is-enabled'); |
| 413 | } |
| 414 | }); |
| 415 | |
| 416 | // Hide or Modify Elements => show/hide subfields on document ready |
| 417 | if ( document.getElementById('admin_site_enhancements[hide_modify_elements]').checked ) { |
| 418 | $('.hide-modify-elements .asenha-subfields').show(); |
| 419 | $('.asenha-toggle.hide-modify-elements td .asenha-field-with-options').addClass('is-enabled'); |
| 420 | } else { |
| 421 | $('.hide-modify-elements .asenha-subfields').hide(); |
| 422 | } |
| 423 | |
| 424 | // Hide or Modify Elements => show/hide subfields on toggle click |
| 425 | document.getElementById('admin_site_enhancements[hide_modify_elements]').addEventListener('click', event => { |
| 426 | if (event.target.checked) { |
| 427 | $('.hide-modify-elements .asenha-subfields').fadeIn(); |
| 428 | $('.hide-modify-elements .asenha-field-with-options').toggleClass('is-enabled'); |
| 429 | } else { |
| 430 | $('.hide-modify-elements .asenha-subfields').hide(); |
| 431 | $('.hide-modify-elements .asenha-field-with-options').toggleClass('is-enabled'); |
| 432 | } |
| 433 | }); |
| 434 | |
| 435 | // Customize Admin Menu => show/hide subfields on document ready |
| 436 | if ( document.getElementById('admin_site_enhancements[customize_admin_menu]').checked ) { |
| 437 | $('.customize-admin-menu .asenha-subfields').show(); |
| 438 | $('.asenha-toggle.customize-admin-menu td .asenha-field-with-options').addClass('is-enabled'); |
| 439 | } else { |
| 440 | $('.customize-admin-menu .asenha-subfields').hide(); |
| 441 | } |
| 442 | |
| 443 | // Customize Admin Menu => show/hide subfields on toggle click |
| 444 | document.getElementById('admin_site_enhancements[customize_admin_menu]').addEventListener('click', event => { |
| 445 | if (event.target.checked) { |
| 446 | $('.customize-admin-menu .asenha-subfields').fadeIn(); |
| 447 | $('.customize-admin-menu .asenha-field-with-options').toggleClass('is-enabled'); |
| 448 | |
| 449 | // Initialize sortable elements: https://api.jqueryui.com/sortable/ |
| 450 | $('#custom-admin-menu').sortable(); |
| 451 | |
| 452 | } else { |
| 453 | $('.customize-admin-menu .asenha-subfields').hide(); |
| 454 | $('.customize-admin-menu .asenha-field-with-options').toggleClass('is-enabled'); |
| 455 | } |
| 456 | }); |
| 457 | |
| 458 | // Disable Gutenberg => show/hide post type checkboxes on document ready |
| 459 | if ( document.getElementById('admin_site_enhancements[disable_gutenberg]').checked ) { |
| 460 | $('.disable-gutenberg .asenha-subfields').show(); |
| 461 | $('.asenha-toggle.disable-gutenberg td .asenha-field-with-options').addClass('is-enabled'); |
| 462 | } else { |
| 463 | $('.disable-gutenberg .asenha-subfields').hide(); |
| 464 | } |
| 465 | |
| 466 | // Disable Gutenberg => show/hide post type checkboxes on toggle click |
| 467 | document.getElementById('admin_site_enhancements[disable_gutenberg]').addEventListener('click', event => { |
| 468 | if (event.target.checked) { |
| 469 | $('.disable-gutenberg .asenha-subfields').fadeIn(); |
| 470 | $('.disable-gutenberg .asenha-field-with-options').toggleClass('is-enabled'); |
| 471 | } else { |
| 472 | $('.disable-gutenberg .asenha-subfields').hide(); |
| 473 | $('.disable-gutenberg .asenha-field-with-options').toggleClass('is-enabled'); |
| 474 | } |
| 475 | }); |
| 476 | |
| 477 | // Disable Comments => show/hide post type checkboxes on document ready |
| 478 | if ( document.getElementById('admin_site_enhancements[disable_comments]').checked ) { |
| 479 | $('.disable-comments .asenha-subfields').show(); |
| 480 | $('.asenha-toggle.disable-comments td .asenha-field-with-options').addClass('is-enabled'); |
| 481 | } else { |
| 482 | $('.disable-comments .asenha-subfields').hide(); |
| 483 | } |
| 484 | |
| 485 | // Disable Comments => show/hide post type checkboxes on toggle click |
| 486 | document.getElementById('admin_site_enhancements[disable_comments]').addEventListener('click', event => { |
| 487 | if (event.target.checked) { |
| 488 | $('.disable-comments .asenha-subfields').fadeIn(); |
| 489 | $('.disable-comments .asenha-field-with-options').toggleClass('is-enabled'); |
| 490 | } else { |
| 491 | $('.disable-comments .asenha-subfields').hide(); |
| 492 | $('.disable-comments .asenha-field-with-options').toggleClass('is-enabled'); |
| 493 | } |
| 494 | }); |
| 495 | |
| 496 | // Change Login URL => show/hide custom slug input on document ready |
| 497 | if ( document.getElementById('admin_site_enhancements[change_login_url]').checked ) { |
| 498 | $('.change-login-url .asenha-subfields').show(); |
| 499 | $('.asenha-toggle.change-login-url td .asenha-field-with-options').addClass('is-enabled'); |
| 500 | } else { |
| 501 | $('.change-login-url .asenha-subfields').hide(); |
| 502 | } |
| 503 | |
| 504 | // Change Login URL => show/hide custom slug input on toggle click |
| 505 | document.getElementById('admin_site_enhancements[change_login_url]').addEventListener('click', event => { |
| 506 | if (event.target.checked) { |
| 507 | $('.change-login-url .asenha-subfields').fadeIn(); |
| 508 | $('.change-login-url .asenha-field-with-options').toggleClass('is-enabled'); |
| 509 | } else { |
| 510 | $('.change-login-url .asenha-subfields').hide(); |
| 511 | $('.change-login-url .asenha-field-with-options').toggleClass('is-enabled'); |
| 512 | } |
| 513 | }); |
| 514 | |
| 515 | // Limit Login Attempts => show/hide custom slug input on document ready |
| 516 | if ( document.getElementById('admin_site_enhancements[limit_login_attempts]').checked ) { |
| 517 | $('.limit-login-attempts .asenha-subfields').show(); |
| 518 | $('.asenha-toggle.limit-login-attempts td .asenha-field-with-options').addClass('is-enabled'); |
| 519 | } else { |
| 520 | $('.limit-login-attempts .asenha-subfields').hide(); |
| 521 | } |
| 522 | |
| 523 | // Limit Login Attempts => show/hide custom slug input on toggle click |
| 524 | document.getElementById('admin_site_enhancements[limit_login_attempts]').addEventListener('click', event => { |
| 525 | if (event.target.checked) { |
| 526 | $('.limit-login-attempts .asenha-subfields').fadeIn(); |
| 527 | $('.limit-login-attempts .asenha-field-with-options').toggleClass('is-enabled'); |
| 528 | } else { |
| 529 | $('.limit-login-attempts .asenha-subfields').hide(); |
| 530 | $('.limit-login-attempts .asenha-field-with-options').toggleClass('is-enabled'); |
| 531 | } |
| 532 | }); |
| 533 | // Redirect After Login => show/hide roles checkboxes on document ready |
| 534 | if ( document.getElementById('admin_site_enhancements[redirect_after_login]').checked ) { |
| 535 | $('.redirect-after-login .asenha-subfields').show(); |
| 536 | $('.asenha-toggle.redirect-after-login td .asenha-field-with-options').addClass('is-enabled'); |
| 537 | } else { |
| 538 | $('.redirect-after-login .asenha-subfields').hide(); |
| 539 | } |
| 540 | |
| 541 | // Redirect After Login => show/hide roles checkboxes on toggle click |
| 542 | document.getElementById('admin_site_enhancements[redirect_after_login]').addEventListener('click', event => { |
| 543 | if (event.target.checked) { |
| 544 | $('.redirect-after-login .asenha-subfields').fadeIn(); |
| 545 | $('.redirect-after-login .asenha-field-with-options').toggleClass('is-enabled'); |
| 546 | } else { |
| 547 | $('.redirect-after-login .asenha-subfields').hide(); |
| 548 | $('.redirect-after-login .asenha-field-with-options').toggleClass('is-enabled'); |
| 549 | } |
| 550 | }); |
| 551 | |
| 552 | // Redirect After Logout => show/hide roles checkboxes on document ready |
| 553 | if ( document.getElementById('admin_site_enhancements[redirect_after_logout]').checked ) { |
| 554 | $('.redirect-after-logout .asenha-subfields').show(); |
| 555 | $('.asenha-toggle.redirect-after-logout td .asenha-field-with-options').addClass('is-enabled'); |
| 556 | } else { |
| 557 | $('.redirect-after-logout .asenha-subfields').hide(); |
| 558 | } |
| 559 | |
| 560 | // Redirect After Logout => show/hide roles checkboxes on toggle click |
| 561 | document.getElementById('admin_site_enhancements[redirect_after_logout]').addEventListener('click', event => { |
| 562 | if (event.target.checked) { |
| 563 | $('.redirect-after-logout .asenha-subfields').fadeIn(); |
| 564 | $('.redirect-after-logout .asenha-field-with-options').toggleClass('is-enabled'); |
| 565 | } else { |
| 566 | $('.redirect-after-logout .asenha-subfields').hide(); |
| 567 | $('.redirect-after-logout .asenha-field-with-options').toggleClass('is-enabled'); |
| 568 | } |
| 569 | }); |
| 570 | |
| 571 | // Enable Custom Admin CSS => show/hide CSS textarea on document ready |
| 572 | if ( document.getElementById('admin_site_enhancements[enable_custom_admin_css]').checked ) { |
| 573 | $('.enable-custom-admin-css .asenha-subfields').show(); |
| 574 | $('.asenha-toggle.enable-custom-admin-css td .asenha-field-with-options').addClass('is-enabled'); |
| 575 | adminCssEditor.refresh(); |
| 576 | } else { |
| 577 | $('.enable-custom-admin-css .asenha-subfields').hide(); |
| 578 | } |
| 579 | |
| 580 | // Enable Custom Admin CSS => show/hide CSS textarea on toggle click |
| 581 | document.getElementById('admin_site_enhancements[enable_custom_admin_css]').addEventListener('click', event => { |
| 582 | if (event.target.checked) { |
| 583 | $('.enable-custom-admin-css .asenha-subfields').fadeIn(); |
| 584 | $('.enable-custom-admin-css .asenha-field-with-options').toggleClass('is-enabled'); |
| 585 | adminCssEditor.refresh(); |
| 586 | } else { |
| 587 | $('.enable-custom-admin-css .asenha-subfields').hide(); |
| 588 | $('.enable-custom-admin-css .asenha-field-with-options').toggleClass('is-enabled'); |
| 589 | } |
| 590 | }); |
| 591 | |
| 592 | // Enable Custom Frontend CSS => show/hide CSS textarea on document ready |
| 593 | if ( document.getElementById('admin_site_enhancements[enable_custom_frontend_css]').checked ) { |
| 594 | $('.enable-custom-frontend-css .asenha-subfields').show(); |
| 595 | $('.asenha-toggle.enable-custom-frontend-css td .asenha-field-with-options').addClass('is-enabled'); |
| 596 | frontendCssEditor.refresh(); |
| 597 | } else { |
| 598 | $('.enable-custom-frontend-css .asenha-subfields').hide(); |
| 599 | } |
| 600 | |
| 601 | // Enable Custom Frontend CSS => show/hide CSS textarea on toggle click |
| 602 | document.getElementById('admin_site_enhancements[enable_custom_frontend_css]').addEventListener('click', event => { |
| 603 | if (event.target.checked) { |
| 604 | $('.enable-custom-frontend-css .asenha-subfields').fadeIn(); |
| 605 | $('.enable-custom-frontend-css .asenha-field-with-options').toggleClass('is-enabled'); |
| 606 | frontendCssEditor.refresh(); |
| 607 | } else { |
| 608 | $('.enable-custom-frontend-css .asenha-subfields').hide(); |
| 609 | $('.enable-custom-frontend-css .asenha-field-with-options').toggleClass('is-enabled'); |
| 610 | } |
| 611 | }); |
| 612 | |
| 613 | // Manage ads.txt and app-ads.txt => show/hide CodeMirror textarea on document ready |
| 614 | if ( document.getElementById('admin_site_enhancements[manage_ads_appads_txt]').checked ) { |
| 615 | $('.manage-ads-appads-txt .asenha-subfields').show(); |
| 616 | $('.asenha-toggle.manage-ads-appads-txt td .asenha-field-with-options').addClass('is-enabled'); |
| 617 | adsTxtEditor.refresh(); |
| 618 | appAdsTxtEditor.refresh(); |
| 619 | } else { |
| 620 | $('.manage-ads-appads-txt .asenha-subfields').hide(); |
| 621 | } |
| 622 | |
| 623 | // Manage ads.txt and app-ads.txt => show/hide CodeMirror textarea on toggle click |
| 624 | document.getElementById('admin_site_enhancements[manage_ads_appads_txt]').addEventListener('click', event => { |
| 625 | if (event.target.checked) { |
| 626 | $('.manage-ads-appads-txt .asenha-subfields').fadeIn(); |
| 627 | $('.manage-ads-appads-txt .asenha-field-with-options').toggleClass('is-enabled'); |
| 628 | adsTxtEditor.refresh(); |
| 629 | appAdsTxtEditor.refresh(); |
| 630 | } else { |
| 631 | $('.manage-ads-appads-txt .asenha-subfields').hide(); |
| 632 | $('.manage-ads-appads-txt .asenha-field-with-options').toggleClass('is-enabled'); |
| 633 | } |
| 634 | }); |
| 635 | |
| 636 | // Manage ads.txt and app-ads.txt => show/hide CodeMirror textarea on document ready |
| 637 | if ( document.getElementById('admin_site_enhancements[manage_robots_txt]').checked ) { |
| 638 | $('.manage-robots-txt .asenha-subfields').show(); |
| 639 | $('.asenha-toggle.manage-robots-txt td .asenha-field-with-options').addClass('is-enabled'); |
| 640 | robotsTxtEditor.refresh(); |
| 641 | } else { |
| 642 | $('.manage-robots-txt .asenha-subfields').hide(); |
| 643 | } |
| 644 | |
| 645 | // Manage ads.txt and app-ads.txt => show/hide CodeMirror textarea on toggle click |
| 646 | document.getElementById('admin_site_enhancements[manage_robots_txt]').addEventListener('click', event => { |
| 647 | if (event.target.checked) { |
| 648 | $('.manage-robots-txt .asenha-subfields').fadeIn(); |
| 649 | $('.manage-robots-txt .asenha-field-with-options').toggleClass('is-enabled'); |
| 650 | robotsTxtEditor.refresh(); |
| 651 | } else { |
| 652 | $('.manage-robots-txt .asenha-subfields').hide(); |
| 653 | $('.manage-robots-txt .asenha-field-with-options').toggleClass('is-enabled'); |
| 654 | } |
| 655 | }); |
| 656 | |
| 657 | // Insert <head>, <body> and <footer> code => show/hide CSS textarea on document ready |
| 658 | if ( document.getElementById('admin_site_enhancements[insert_head_body_footer_code]').checked ) { |
| 659 | $('.insert-head-body-footer-code .asenha-subfields').show(); |
| 660 | $('.asenha-toggle.insert-head-body-footer-code td .asenha-field-with-options').addClass('is-enabled'); |
| 661 | headCodeEditor.refresh(); |
| 662 | bodyCodeEditor.refresh(); |
| 663 | footerCodeEditor.refresh(); |
| 664 | } else { |
| 665 | $('.manage-app-ads-txt .asenha-subfields').hide(); |
| 666 | } |
| 667 | |
| 668 | // Insert <head>, <body> and <footer> code => show/hide CSS textarea on toggle click |
| 669 | document.getElementById('admin_site_enhancements[insert_head_body_footer_code]').addEventListener('click', event => { |
| 670 | if (event.target.checked) { |
| 671 | $('.insert-head-body-footer-code .asenha-subfields').fadeIn(); |
| 672 | $('.insert-head-body-footer-code .asenha-field-with-options').toggleClass('is-enabled'); |
| 673 | headCodeEditor.refresh(); |
| 674 | bodyCodeEditor.refresh(); |
| 675 | footerCodeEditor.refresh(); |
| 676 | } else { |
| 677 | $('.insert-head-body-footer-code .asenha-subfields').hide(); |
| 678 | $('.insert-head-body-footer-code .asenha-field-with-options').toggleClass('is-enabled'); |
| 679 | } |
| 680 | }); |
| 681 | |
| 682 | // Enable Heartbeat Control => show/hide subfields on document ready |
| 683 | if ( document.getElementById('admin_site_enhancements[enable_heartbeat_control]').checked ) { |
| 684 | $('.enable-heartbeat-control .asenha-subfields').show(); |
| 685 | $('.asenha-toggle.enable-heartbeat-control td .asenha-field-with-options').addClass('is-enabled'); |
| 686 | } else { |
| 687 | $('.enable-heartbeat-control .asenha-subfields').hide(); |
| 688 | } |
| 689 | |
| 690 | // Enable Heartbeat Control => show/hide subfields on toggle click |
| 691 | document.getElementById('admin_site_enhancements[enable_heartbeat_control]').addEventListener('click', event => { |
| 692 | if (event.target.checked) { |
| 693 | $('.enable-heartbeat-control .asenha-subfields').fadeIn(); |
| 694 | $('.enable-heartbeat-control .asenha-field-with-options').toggleClass('is-enabled'); |
| 695 | } else { |
| 696 | $('.enable-heartbeat-control .asenha-subfields').hide(); |
| 697 | $('.enable-heartbeat-control .asenha-field-with-options').toggleClass('is-enabled'); |
| 698 | } |
| 699 | }); |
| 700 | |
| 701 | // Enable Heartbeat Control => Check if "Modify interval" is chosen/clicked and show/hide the corresponding select field |
| 702 | if ( $('input[name="admin_site_enhancements[heartbeat_control_for_admin_pages]"]:checked').val() == 'modify' ) { |
| 703 | $('.heartbeat-interval-for-admin-pages .asenha-subfield-select-inner').show(); |
| 704 | } |
| 705 | $('input[name="admin_site_enhancements[heartbeat_control_for_admin_pages]"]').click(function() { |
| 706 | var radioValue = $(this).attr('value'); |
| 707 | if ( radioValue == 'modify' ) { |
| 708 | $('.heartbeat-interval-for-admin-pages .asenha-subfield-select-inner').show(); |
| 709 | } else { |
| 710 | $('.heartbeat-interval-for-admin-pages .asenha-subfield-select-inner').hide(); |
| 711 | } |
| 712 | }); |
| 713 | |
| 714 | if ( $('input[name="admin_site_enhancements[heartbeat_control_for_post_edit]"]:checked').val() == 'modify' ) { |
| 715 | $('.heartbeat-interval-for-post-edit .asenha-subfield-select-inner').show(); |
| 716 | } |
| 717 | $('input[name="admin_site_enhancements[heartbeat_control_for_post_edit]"]').click(function() { |
| 718 | var radioValue = $(this).attr('value'); |
| 719 | if ( radioValue == 'modify' ) { |
| 720 | $('.heartbeat-interval-for-post-edit .asenha-subfield-select-inner').show(); |
| 721 | } else { |
| 722 | $('.heartbeat-interval-for-post-edit .asenha-subfield-select-inner').hide(); |
| 723 | } |
| 724 | }); |
| 725 | |
| 726 | if ( $('input[name="admin_site_enhancements[heartbeat_control_for_frontend]"]:checked').val() == 'modify' ) { |
| 727 | $('.heartbeat-interval-for-frontend .asenha-subfield-select-inner').show(); |
| 728 | } |
| 729 | $('input[name="admin_site_enhancements[heartbeat_control_for_frontend]"]').click(function() { |
| 730 | var radioValue = $(this).attr('value'); |
| 731 | if ( radioValue == 'modify' ) { |
| 732 | $('.heartbeat-interval-for-frontend .asenha-subfield-select-inner').show(); |
| 733 | } else { |
| 734 | $('.heartbeat-interval-for-frontend .asenha-subfield-select-inner').hide(); |
| 735 | } |
| 736 | }); |
| 737 | |
| 738 | // Enable Password Protection => show/hide password input on document ready |
| 739 | if ( document.getElementById('admin_site_enhancements[enable_password_protection]').checked ) { |
| 740 | $('.enable-password-protection .asenha-subfields').show(); |
| 741 | $('.asenha-toggle.enable-password-protection td .asenha-field-with-options').addClass('is-enabled'); |
| 742 | } else { |
| 743 | $('.enable-password-protection .asenha-subfields').hide(); |
| 744 | } |
| 745 | |
| 746 | // Enable Password Protection => show/hide password input input on toggle click |
| 747 | document.getElementById('admin_site_enhancements[enable_password_protection]').addEventListener('click', event => { |
| 748 | if (event.target.checked) { |
| 749 | $('.enable-password-protection .asenha-subfields').fadeIn(); |
| 750 | $('.enable-password-protection .asenha-field-with-options').toggleClass('is-enabled'); |
| 751 | } else { |
| 752 | $('.enable-password-protection .asenha-subfields').hide(); |
| 753 | $('.enable-password-protection .asenha-field-with-options').toggleClass('is-enabled'); |
| 754 | } |
| 755 | }); |
| 756 | |
| 757 | // Enable Password protection => Empty field value on click, so new password can be easily entered |
| 758 | var oldValue = ''; |
| 759 | $('input[name="admin_site_enhancements[password_protection_password]"]').focusin(function() { |
| 760 | oldValue = $(this).val(); |
| 761 | $(this).val(''); |
| 762 | }); |
| 763 | |
| 764 | $('input[name="admin_site_enhancements[password_protection_password]"]').focusout(function() { |
| 765 | if ( $(this).val() == '' ) { |
| 766 | $(this).val(oldValue); |
| 767 | } |
| 768 | }); |
| 769 | |
| 770 | }); |
| 771 | |
| 772 | })( jQuery ); |