-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabled dormant dark theme, and made it work with the new skin
- Loading branch information
Showing
13 changed files
with
119 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,38 @@ | ||
const $ = require('jquery'); | ||
|
||
import Cookies from "js-cookie"; | ||
import axios from "axios"; | ||
|
||
class DarkMode { | ||
constructor() { | ||
this.getDarkMode(); | ||
|
||
this.addListener(); | ||
}; | ||
|
||
getDarkMode() { | ||
let dm = Cookies.get("dm"); | ||
|
||
if (dm == true) { | ||
let body = $("body"); | ||
body.addClass('dark-mode'); | ||
console.info("We are in dark mode"); | ||
} else { | ||
Cookies.set("dm", false); | ||
console.info("We are in light mode"); | ||
} | ||
}; | ||
|
||
addListener() { | ||
$(function() { | ||
$('.dark-mode-toggle').click(function (event) { | ||
$('#blackhole').click(function (event) { | ||
console.log("dark mode clicked"); | ||
event.preventDefault(); | ||
|
||
let dm = Cookies.get("dm"); | ||
|
||
if (dm == true) { | ||
let body = $("body"); | ||
body.removeClass('dark-mode'); | ||
Cookies.set("dm", false); | ||
} else { | ||
let body = $("body"); | ||
body.addClass('dark-mode'); | ||
Cookies.set("dm", true); | ||
} | ||
// Call the endpoint | ||
axios.post('/dark.json', {}) | ||
.then(function (res) { | ||
if (!res.data.darkmode) { | ||
$('#blackhole svg.darkmode').removeClass('d-none') | ||
$('#blackhole svg.lightmode').addClass('d-none') | ||
$('body').removeClass('dark') | ||
} else { | ||
$('#blackhole svg.darkmode').addClass('d-none') | ||
$('#blackhole svg.lightmode').removeClass('d-none') | ||
$('body').addClass('dark') | ||
} | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
|
||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
new DarkMode(); | ||
new DarkMode(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,4 @@ class ExplorerApi { | |
} | ||
} | ||
|
||
export default new ExplorerApi() | ||
export default new ExplorerApi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ twig: | |
api: | ||
url: '%explorer.api.url%' | ||
|
||
exception_controller: null | ||
exception_controller: null |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.