Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disqus background in dark mode. #732

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@
- [Daniel Nduati](https://github.com/DanNduati)
- [Simon Hollingshead](https://github.com/simonhollingshead)
- [yangyangdaji](https://github.com/yangyangdaji)
- [xiaotianxt](https://github.com/xiaotianxt)
3 changes: 3 additions & 0 deletions assets/js/coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function setTheme(theme) {

}

// Create and send event
const event = new Event('themeChanged');
document.dispatchEvent(event);
luizdepra marked this conversation as resolved.
Show resolved Hide resolved
}

function rememberTheme(theme) {
Expand Down
4 changes: 4 additions & 0 deletions assets/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ body {
}
}

iframe[src*=disqus] {
color-scheme: light;
}

a {
font-weight: 500;
color: $link-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3050,6 +3050,9 @@ body {
body {
font-size: 1.6em;
line-height: 1.6em; } }
iframe[src*=disqus] {
color-scheme: light; }

a {
font-weight: 500;
color: #1565c0;
Expand Down
25 changes: 24 additions & 1 deletion layouts/partials/posts/disqus.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
{{- if and (not (eq (.Site.DisqusShortname | default "") "")) (eq (.Params.disableComments | default false) false) -}}
{{ template "_internal/disqus.html" . }}
<div id="disqus_thread"></div>
<script>
window.disqus_config = function () {
{{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
{{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}}
{{with .Params.disqus_url }}this.page.url = '{{ . | html }}';{{end}}
};
(function() {
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
return;
}
var d = document, s = d.createElement('script'); s.async = true;
s.src = '//' + {{ .Site.DisqusShortname }} + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
// Disqus theme switching
document.addEventListener('themeChanged', function (e) {
if (document.readyState == 'complete') {
DISQUS.reset({ reload: true, config: disqus_config });
}
});
</script>
{{- end -}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"css/coder.min.c4d7e93a158eda5a65b3df343745d2092a0a1e2170feeec909b8a89443903c6a.css","MediaType":"text/css","Data":{"Integrity":"sha256-xNfpOhWO2lpls980N0XSCSoKHiFw/u7JCbiolEOQPGo="}}
{"Target":"css/coder.min.7f9d180e3b3bebba9ba80d55eed1255c35e00764872854736d6ad7db38884ffc.css","MediaType":"text/css","Data":{"Integrity":"sha256-f50YDjs767qbqA1V7tElXDXgB2SHKFRzbWrX2ziIT/w="}}
Original file line number Diff line number Diff line change
Expand Up @@ -3050,6 +3050,9 @@ body {
body {
font-size: 1.6em;
line-height: 1.6em; } }
iframe[src*=disqus] {
color-scheme: light; }

a {
font-weight: 500;
color: #1565c0;
Expand Down