| 1456 | 
           ariadna | 
           1 | 
           //
  | 
        
        
            | 
            | 
           2 | 
           // This file is part of universe theme for moodle
  | 
        
        
            | 
            | 
           3 | 
           //
  | 
        
        
            | 
            | 
           4 | 
           // Moodle is free software: you can redistribute it and/or modify
  | 
        
        
            | 
            | 
           5 | 
           // it under the terms of the GNU General Public License as published by
  | 
        
        
            | 
            | 
           6 | 
           // the Free Software Foundation, either version 3 of the License, or
  | 
        
        
            | 
            | 
           7 | 
           // (at your option) any later version.
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Moodle is distributed in the hope that it will be useful,
  | 
        
        
            | 
            | 
           10 | 
           // but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
        
        
            | 
            | 
           11 | 
           // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
        
        
            | 
            | 
           12 | 
           // GNU General Public License for more details.
  | 
        
        
            | 
            | 
           13 | 
           //
  | 
        
        
            | 
            | 
           14 | 
           // You should have received a copy of the GNU General Public License
  | 
        
        
            | 
            | 
           15 | 
           // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  | 
        
        
            | 
            | 
           16 | 
           //
  | 
        
        
            | 
            | 
           17 | 
           //
  | 
        
        
            | 
            | 
           18 | 
           // universe main JS file
  | 
        
        
            | 
            | 
           19 | 
           //
  | 
        
        
            | 
            | 
           20 | 
           // @package    theme_universe
  | 
        
        
            | 
            | 
           21 | 
           // @copyright  Copyright © 2021 onwards Marcin Czaja Rosea Themes
  | 
        
        
            | 
            | 
           22 | 
           //
  | 
        
        
            | 
            | 
           23 | 
           // @license    Commercial
  | 
        
        
            | 
            | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
           /* jshint ignore:start */
  | 
        
        
            | 
            | 
           26 | 
           define(['jquery', 'core/aria', 'core_user/repository'], function ($, setUserPreference, UserRepository) {
  | 
        
        
            | 
            | 
           27 | 
               "use strict"; // ...jshint ;_; !!!
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
            | 
            | 
           29 | 
               return {
  | 
        
        
            | 
            | 
           30 | 
                   init: function () {
  | 
        
        
            | 
            | 
           31 | 
                       $(document).ready(function ($) {
  | 
        
        
            | 
            | 
           32 | 
                           var trigger = $(document.getElementById("darkModeBtn"));
  | 
        
        
            | 
            | 
           33 | 
                           var preference = trigger.attr('data-preference');
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
                           $('#darkModeBtn').click(function () {
  | 
        
        
            | 
            | 
           36 | 
                               if ($('body').hasClass('theme-dark')) {
  | 
        
        
            | 
            | 
           37 | 
                                   $('body').removeClass('theme-dark');
  | 
        
        
            | 
            | 
           38 | 
                                   $('html').removeClass('dark-mode');
  | 
        
        
            | 
            | 
           39 | 
                                   trigger.attr('aria-checked', 'false');
  | 
        
        
            | 
            | 
           40 | 
                                   UserRepository.setUserPreference(preference, false);
  | 
        
        
            | 
            | 
           41 | 
                               } else {
  | 
        
        
            | 
            | 
           42 | 
                                   $('body').addClass('theme-dark');
  | 
        
        
            | 
            | 
           43 | 
                                   $('html').addClass('dark-mode');
  | 
        
        
            | 
            | 
           44 | 
                                   trigger.attr('aria-checked', 'true');
  | 
        
        
            | 
            | 
           45 | 
                                   UserRepository.setUserPreference(preference, true);
  | 
        
        
            | 
            | 
           46 | 
                               }
  | 
        
        
            | 
            | 
           47 | 
                           });
  | 
        
        
            | 
            | 
           48 | 
              | 
        
        
            | 
            | 
           49 | 
                           $('.btn-drawer--left').click(function () {
  | 
        
        
            | 
            | 
           50 | 
                               if ($('body').hasClass('drawer-open-index--open')) {
  | 
        
        
            | 
            | 
           51 | 
                                   $('body').removeClass('drawer-courseindex--open');
  | 
        
        
            | 
            | 
           52 | 
                                   $('body').removeClass('drawer-open-index--open');
  | 
        
        
            | 
            | 
           53 | 
                               } else {
  | 
        
        
            | 
            | 
           54 | 
                                   $('body').toggleClass('drawer-courseindex--open');
  | 
        
        
            | 
            | 
           55 | 
                               }
  | 
        
        
            | 
            | 
           56 | 
                           });
  | 
        
        
            | 
            | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
                           $('.drawertoggle').click(function () {
  | 
        
        
            | 
            | 
           59 | 
                               if ($('body').hasClass('drawer-open-index--open')) {
  | 
        
        
            | 
            | 
           60 | 
                                   $('body').removeClass('drawer-courseindex--open');
  | 
        
        
            | 
            | 
           61 | 
                                   $('body').removeClass('drawer-open-index--open');
  | 
        
        
            | 
            | 
           62 | 
                               } else {
  | 
        
        
            | 
            | 
           63 | 
                                   $('body').toggleClass('drawer-courseindex--open');
  | 
        
        
            | 
            | 
           64 | 
                               }
  | 
        
        
            | 
            | 
           65 | 
                           });
  | 
        
        
            | 
            | 
           66 | 
              | 
        
        
            | 
            | 
           67 | 
                           $('#courseindexbtn, .bulkEnable').click(function () {
  | 
        
        
            | 
            | 
           68 | 
                               $(function () {
  | 
        
        
            | 
            | 
           69 | 
                                   $('#course-tab2').tab('show');
  | 
        
        
            | 
            | 
           70 | 
                               });
  | 
        
        
            | 
            | 
           71 | 
                           });
  | 
        
        
            | 
            | 
           72 | 
              | 
        
        
            | 
            | 
           73 | 
                           $( document ).ready(function() {
  | 
        
        
            | 
            | 
           74 | 
                               if ($("body.drawer-open-index--open, body.drawer-courseindex--open").length) {
  | 
        
        
            | 
            | 
           75 | 
                                   $('#course-tab2').tab('show');
  | 
        
        
            | 
            | 
           76 | 
                               }
  | 
        
        
            | 
            | 
           77 | 
                           });
  | 
        
        
            | 
            | 
           78 | 
              | 
        
        
            | 
            | 
           79 | 
                           $('#mobileNav, .rui-mobile-nav-btn-close').click(function () {
  | 
        
        
            | 
            | 
           80 | 
                               $('#topBar').toggleClass('opened');
  | 
        
        
            | 
            | 
           81 | 
                           });
  | 
        
        
            | 
            | 
           82 | 
              | 
        
        
            | 
            | 
           83 | 
                           $("#showBlockArea").on("click", function () {
  | 
        
        
            | 
            | 
           84 | 
                               $('body').toggleClass('rui-edit-areas');
  | 
        
        
            | 
            | 
           85 | 
                               $('#showBlockArea').toggleClass('active');
  | 
        
        
            | 
            | 
           86 | 
                           });
  | 
        
        
            | 
            | 
           87 | 
              | 
        
        
            | 
            | 
           88 | 
                           $('.rui-nav--admin .nav-link').each(function () {
  | 
        
        
            | 
            | 
           89 | 
                               var text = $(this).html();
  | 
        
        
            | 
            | 
           90 | 
                               $(this).html(text.replace('(', '<span class="mt-1 small d-block">'));
  | 
        
        
            | 
            | 
           91 | 
                           });
  | 
        
        
            | 
            | 
           92 | 
                           $('.rui-nav--admin .nav-link').each(function () {
  | 
        
        
            | 
            | 
           93 | 
                               var text = $(this).html();
  | 
        
        
            | 
            | 
           94 | 
                               $(this).html(text.replace(')', '</span>'));
  | 
        
        
            | 
            | 
           95 | 
                           });
  | 
        
        
            | 
            | 
           96 | 
                       });
  | 
        
        
            | 
            | 
           97 | 
              | 
        
        
            | 
            | 
           98 | 
                   }
  | 
        
        
            | 
            | 
           99 | 
               };
  | 
        
        
            | 
            | 
           100 | 
           });
  | 
        
        
            | 
            | 
           101 | 
           /* jshint ignore:end */
  |