Proyectos de Subversion Moodle

Rev

Rev 737 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

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