[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_contenthistory/js/ -> admin-history-modal-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 (document, Joomla) {
   9      if (!Joomla || typeof Joomla.Text._ !== 'function') {
  10        throw new Error('core.js was not properly initialised');
  11      }
  12  
  13      document.addEventListener('DOMContentLoaded', function () {
  14        document.getElementById('toolbar-load').addEventListener('click', function () {
  15          var toolbarLoad = document.getElementById('toolbar-load');
  16  
  17          if (!toolbarLoad.disabled) {
  18            var ids = document.querySelectorAll('input[id*="cb"]:checked');
  19  
  20            if (ids.length === 1) {
  21              // Add version item id to URL
  22              var url = toolbarLoad.childNodes[1].getAttribute('data-url') + "&version_id=" + ids[0].value;
  23  
  24              if (window.parent && url) {
  25                window.parent.location = url;
  26              }
  27            } else {
  28              // @todo use the CE Modal here
  29              alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION'));
  30            }
  31          }
  32  
  33          return false;
  34        });
  35        document.getElementById('toolbar-preview').addEventListener('click', function () {
  36          var toolbarPreview = document.getElementById('toolbar-preview');
  37  
  38          if (!toolbarPreview.disabled) {
  39            var windowSizeArray = ['width=800, height=600, resizable=yes, scrollbars=yes'];
  40            var ids = document.querySelectorAll('input[id*="cb"]:checked');
  41  
  42            if (ids.length === 1) {
  43              // Add version item id to URL
  44              var url = toolbarPreview.childNodes[1].getAttribute('data-url') + "&version_id=" + ids[0].value;
  45  
  46              if (window.parent && url) {
  47                window.open(url, '', windowSizeArray.toString());
  48              }
  49            } else {
  50              // @todo use the CE Modal here
  51              alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION'));
  52            }
  53          }
  54  
  55          return false;
  56        });
  57        document.getElementById('toolbar-compare').addEventListener('click', function () {
  58          var toolbarCompare = document.getElementById('toolbar-compare');
  59  
  60          if (!toolbarCompare.disabled) {
  61            var windowSizeArray = ['width=1000, height=600, resizable=yes, scrollbars=yes'];
  62            var ids = document.querySelectorAll('input[id*="cb"]:checked');
  63  
  64            if (ids.length === 0) {
  65              // @todo use the CE Modal here
  66              alert(Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));
  67            } else if (ids.length === 2) {
  68              // Add version item ids to URL
  69              var url = toolbarCompare.childNodes[1].getAttribute('data-url') + "&id1=" + ids[0].value + "&id2=" + ids[1].value;
  70  
  71              if (window.parent && url) {
  72                window.open(url, '', windowSizeArray.toString());
  73              }
  74            } else {
  75              // @todo use the CE Modal here
  76              alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_TWO_VERSIONS'));
  77            }
  78          }
  79  
  80          return false;
  81        });
  82      });
  83    })(document, Joomla);
  84  
  85  })();


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