Skip to content

Commit

Permalink
finished brightness toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
RuikangRPI committed Dec 5, 2023
1 parent 84066d7 commit 321489e
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</div>
</div>
<div id="dropdown_profile_y" class="absolute w-full h-full invisible">
{% if isAdmin %}
{% if user.is_superuser %}
<div id="dropdown_profile_Y" onmouseover="rotate()"
class="absolute left-1/2 top-0 -translate-x-1/2 -translate-y-1/2 w-10 h-10 rounded-full invisible flex justify-center items-center bg-gray-300 hover:bg-gray-400 opacity-0 transition-all duration-200 ease-in-out cursor-pointer"
data-tooltip-target="tooltip-y" data-tooltip-placement="top">
Expand All @@ -85,7 +85,7 @@
class="absolute left-1/2 top-0 -translate-x-1/2 -translate-y-1/2 w-10 h-10 rounded-full invisible flex justify-center items-center bg-gray-300 hover:bg-gray-400 opacity-0 transition-all duration-200 ease-in-out cursor-pointer"
data-tooltip-target="tooltip-y" data-tooltip-placement="top">
{% endif %}
{% if isAdmin %}
{% if user.is_superuser %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round"
Expand All @@ -94,16 +94,16 @@
</svg>
{% else %}
<svg id="brightness_toggle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 light_mode">
stroke="currentColor" class="w-6 h-6 light_toggle">
<path d="M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM18.894 6.166a.75.75 0 00-1.06-1.06l-1.591 1.59a.75.75 0 101.06 1.061l1.591-1.59zM21.75 12a.75.75 0 01-.75.75h-2.25a.75.75 0 010-1.5H21a.75.75 0 01.75.75zM17.834 18.894a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 10-1.061 1.06l1.59 1.591zM12 18a.75.75 0 01.75.75V21a.75.75 0 01-1.5 0v-2.25A.75.75 0 0112 18zM7.758 17.303a.75.75 0 00-1.061-1.06l-1.591 1.59a.75.75 0 001.06 1.061l1.591-1.59zM6 12a.75.75 0 01-.75.75H3a.75.75 0 010-1.5h2.25A.75.75 0 016 12zM6.697 7.757a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 00-1.061 1.06l1.59 1.591z" />
</svg>
{% endif %}
<div id="tooltip-y" role="tooltip" onmouseover="reset()"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
{% if isAdmin %}
{% if user.is_superuser %}
<p class="rotate-180">Setting</p>
{% else %}
<p class="rotate-180">Brightness Toggle</p>
<p class="rotate-180">Toggle</p>
{% endif %}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
Expand Down Expand Up @@ -175,13 +175,13 @@

function toggleBrightness() {
var elem = document.getElementById("brightness_toggle");
if(elem.classList.contains("light_mode")) {
elem.classList.remove("light_mode");
elem.classList.add("dark_mode");
if(elem.classList.contains("light_toggle")) {
elem.classList.remove("light_toggle");
elem.classList.add("dark_toggle");
elem.innerHTML = '<path fill-rule="evenodd" d="M9.528 1.718a.75.75 0 01.162.819A8.97 8.97 0 009 6a9 9 0 009 9 8.97 8.97 0 003.463-.69.75.75 0 01.981.98 10.503 10.503 0 01-9.694 6.46c-5.799 0-10.5-4.701-10.5-10.5 0-4.368 2.667-8.112 6.46-9.694a.75.75 0 01.818.162z" clip-rule="evenodd" />';
} else {
elem.classList.remove("dark_mode");
elem.classList.add("light_mode");
elem.classList.remove("dark_toggle");
elem.classList.add("light_toggle");
elem.innerHTML = '<path d="M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM18.894 6.166a.75.75 0 00-1.06-1.06l-1.591 1.59a.75.75 0 101.06 1.061l1.591-1.59zM21.75 12a.75.75 0 01-.75.75h-2.25a.75.75 0 010-1.5H21a.75.75 0 01.75.75zM17.834 18.894a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 10-1.061 1.06l1.59 1.591zM12 18a.75.75 0 01.75.75V21a.75.75 0 01-1.5 0v-2.25A.75.75 0 0112 18zM7.758 17.303a.75.75 0 00-1.061-1.06l-1.591 1.59a.75.75 0 001.06 1.061l1.591-1.59zM6 12a.75.75 0 01-.75.75H3a.75.75 0 010-1.5h2.25A.75.75 0 016 12zM6.697 7.757a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 00-1.061 1.06l1.59 1.591z" />';
}
}
Expand Down

0 comments on commit 321489e

Please sign in to comment.