[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_templates/js/ -> admin-template-toggle-switch-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license    GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8    (function () {
   9      var showDiffChangedOff = function showDiffChangedOff() {
  10        var diffMain = document.getElementById('diff-main');
  11  
  12        if (diffMain) {
  13          diffMain.classList.remove('active');
  14  
  15          if (typeof Storage !== 'undefined') {
  16            localStorage.removeItem('diffSwitchState');
  17          }
  18        }
  19      };
  20  
  21      var showDiffChangedOn = function showDiffChangedOn() {
  22        var diffMain = document.getElementById('diff-main');
  23  
  24        if (diffMain) {
  25          diffMain.classList.add('active');
  26  
  27          if (typeof Storage !== 'undefined') {
  28            localStorage.setItem('diffSwitchState', 'checked');
  29          }
  30        }
  31      };
  32  
  33      var showCoreChangedOff = function showCoreChangedOff() {
  34        var override = document.getElementById('override-pane');
  35        var corePane = document.getElementById('core-pane');
  36        var fieldset = override.parentElement.parentElement;
  37  
  38        if (corePane && override) {
  39          corePane.classList.remove('active');
  40  
  41          if (fieldset.classList.contains('options-grid-form-half')) {
  42            fieldset.classList.remove('options-grid-form-half');
  43            fieldset.classList.add('options-grid-form-full');
  44          }
  45  
  46          if (typeof Storage !== 'undefined') {
  47            localStorage.removeItem('coreSwitchState');
  48          }
  49        }
  50      };
  51  
  52      var showCoreChangedOn = function showCoreChangedOn() {
  53        var override = document.getElementById('override-pane');
  54        var corePane = document.getElementById('core-pane');
  55        var fieldset = override.parentElement.parentElement;
  56  
  57        if (corePane && override) {
  58          corePane.classList.add('active');
  59  
  60          if (fieldset.classList.contains('options-grid-form-full')) {
  61            fieldset.classList.remove('options-grid-form-full');
  62            fieldset.classList.add('options-grid-form-half');
  63          }
  64  
  65          if (Joomla.editors.instances.jform_core) {
  66            Joomla.editors.instances.jform_core.refresh();
  67          }
  68  
  69          if (typeof Storage !== 'undefined') {
  70            localStorage.setItem('coreSwitchState', 'checked');
  71          }
  72        }
  73      };
  74  
  75      document.addEventListener('DOMContentLoaded', function () {
  76        var JformShowDiffOn = document.getElementById('jform_show_diff1');
  77        var JformShowDiffOff = document.getElementById('jform_show_diff0');
  78        var JformShowCoreOn = document.getElementById('jform_show_core1');
  79        var JformShowCoreOff = document.getElementById('jform_show_core0');
  80  
  81        if (JformShowDiffOn && JformShowDiffOff) {
  82          JformShowDiffOn.addEventListener('click', showDiffChangedOn);
  83          JformShowDiffOff.addEventListener('click', showDiffChangedOff);
  84        }
  85  
  86        if (JformShowCoreOn && JformShowCoreOff) {
  87          JformShowCoreOn.addEventListener('click', showCoreChangedOn);
  88          JformShowCoreOff.addEventListener('click', showCoreChangedOff);
  89        }
  90  
  91        if (typeof Storage !== 'undefined' && localStorage.getItem('coreSwitchState') && JformShowCoreOn) {
  92          JformShowCoreOn.checked = true;
  93          JformShowCoreOff.checked = false;
  94          showCoreChangedOn();
  95        }
  96  
  97        if (typeof Storage !== 'undefined' && localStorage.getItem('diffSwitchState') && JformShowDiffOn) {
  98          JformShowDiffOn.checked = true;
  99          JformShowDiffOff.checked = false;
 100          showDiffChangedOn();
 101        }
 102      });
 103    })();
 104  
 105  })();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer