Proyectos de Subversion Moodle

Rev

Rev 1 | Rev 737 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 736
Línea 21... Línea 21...
21
// @copyright  Copyright © 2021 onwards Marcin Czaja Rosea Themes
21
// @copyright  Copyright © 2021 onwards Marcin Czaja Rosea Themes
22
//
22
//
23
// @license    Commercial
23
// @license    Commercial
Línea 24... Línea 24...
24
 
24
 
25
/* jshint ignore:start */
25
/* jshint ignore:start */
-
 
26
define(["jquery", "core/aria", "core_user/repository"], function (
-
 
27
  $,
-
 
28
  setUserPreference,
-
 
29
  UserRepository
26
define(['jquery', 'core/aria', 'core_user/repository'], function ($, setUserPreference, UserRepository) {
30
) {
27
    "use strict"; // ...jshint ;_; !!!
31
  "use strict"; // ...jshint ;_; !!!
28
 
32
 
29
    return {
33
  return {
30
        init: function () {
34
    init: function () {
31
            $(document).ready(function ($) {
35
      $(document).ready(function ($) {
32
                var trigger = $(document.getElementById("darkModeBtn"));
36
        var trigger = $(document.getElementById("darkModeBtn"));
33
                var preference = trigger.attr('data-preference');
37
        var preference = trigger.attr("data-preference");
34
 
38
 
35
                $('#darkModeBtn').click(function () {
39
        $("#darkModeBtn").click(function () {
36
                    if ($('body').hasClass('theme-dark')) {
40
          if ($("body").hasClass("theme-dark")) {
37
                        $('body').removeClass('theme-dark');
41
            $("body").removeClass("theme-dark");
38
                        $('html').removeClass('dark-mode');
42
            $("html").removeClass("dark-mode");
39
                        trigger.attr('aria-checked', 'false');
43
            trigger.attr("aria-checked", "false");
40
                        UserRepository.setUserPreference(preference, false);
44
            UserRepository.setUserPreference(preference, false);
41
                    } else {
45
          } else {
42
                        $('body').addClass('theme-dark');
46
            $("body").addClass("theme-dark");
43
                        $('html').addClass('dark-mode');
47
            $("html").addClass("dark-mode");
44
                        trigger.attr('aria-checked', 'true');
48
            trigger.attr("aria-checked", "true");
45
                        UserRepository.setUserPreference(preference, true);
49
            UserRepository.setUserPreference(preference, true);
46
                    }
50
          }
47
                });
51
        });
48
 
52
 
49
                $('.btn-drawer--left').click(function () {
53
        $(".btn-drawer--left").click(function () {
50
                    if ($('body').hasClass('drawer-open-index--open')) {
54
          if ($("body").hasClass("drawer-open-index--open")) {
51
                        $('body').removeClass('drawer-courseindex--open');
55
            $("body").removeClass("drawer-courseindex--open");
52
                        $('body').removeClass('drawer-open-index--open');
56
            $("body").removeClass("drawer-open-index--open");
53
                    } else {
57
          } else {
54
                        $('body').toggleClass('drawer-courseindex--open');
58
            $("body").toggleClass("drawer-courseindex--open");
55
                    }
59
          }
56
                });
60
        });
57
 
61
 
58
                $('.drawertoggle').click(function () {
62
        $(".drawertoggle").click(function () {
59
                    if ($('body').hasClass('drawer-open-index--open')) {
63
          if ($("body").hasClass("drawer-open-index--open")) {
60
                        $('body').removeClass('drawer-courseindex--open');
64
            $("body").removeClass("drawer-courseindex--open");
61
                        $('body').removeClass('drawer-open-index--open');
65
            $("body").removeClass("drawer-open-index--open");
62
                    } else {
66
          } else {
63
                        $('body').toggleClass('drawer-courseindex--open');
67
            $("body").toggleClass("drawer-courseindex--open");
64
                    }
68
          }
65
                });
69
        });
66
 
70
 
67
                $('#courseindexbtn, .bulkEnable').click(function () {
71
        $("#courseindexbtn, .bulkEnable").click(function () {
-
 
72
          $(function () {
68
                    $(function () {
73
            var coursetab = $("#course-tab2");
69
                        $('#course-tab2').tab('show');
74
            if (coursetab) coursetab.tab("show");
70
                    });                    
75
          });
71
                });
76
        });
72
 
77
 
-
 
78
        $(document).ready(function () {
73
                $( document ).ready(function() {
79
          if (
-
 
80
            $("body.drawer-open-index--open, body.drawer-courseindex--open")
-
 
81
              .length
-
 
82
          ) {
74
                    if ($("body.drawer-open-index--open, body.drawer-courseindex--open").length) {
83
            var coursetab = $("#course-tab2");
75
                        $('#course-tab2').tab('show');
84
            if (coursetab) coursetab.tab("show");
76
                    }
85
          }
77
                });
86
        });
78
 
87
 
79
                $('#mobileNav, .rui-mobile-nav-btn-close').click(function () {
88
        $("#mobileNav, .rui-mobile-nav-btn-close").click(function () {
80
                    $('#topBar').toggleClass('opened');
89
          $("#topBar").toggleClass("opened");
81
                });
90
        });
82
 
91
 
83
                $("#showBlockArea").on("click", function () {
92
        $("#showBlockArea").on("click", function () {
84
                    $('body').toggleClass('rui-edit-areas');
93
          $("body").toggleClass("rui-edit-areas");
85
                    $('#showBlockArea').toggleClass('active');
94
          $("#showBlockArea").toggleClass("active");
86
                });
95
        });
87
 
96
 
88
                $('.rui-nav--admin .nav-link').each(function () {
97
        $(".rui-nav--admin .nav-link").each(function () {
89
                    var text = $(this).html();
98
          var text = $(this).html();
90
                    $(this).html(text.replace('(', '<span class="mt-1 small d-block">'));
99
          $(this).html(text.replace("(", '<span class="mt-1 small d-block">'));
91
                });
100
        });
92
                $('.rui-nav--admin .nav-link').each(function () {
101
        $(".rui-nav--admin .nav-link").each(function () {
93
                    var text = $(this).html();
102
          var text = $(this).html();
94
                    $(this).html(text.replace(')', '</span>'));
103
          $(this).html(text.replace(")", "</span>"));
95
                });
104
        });
96
            });
-
 
97
 
105
      });
98
        }
106
    },
99
    };
107
  };
100
});
108
});