night mode

This commit is contained in:
postautistic 2016-12-10 22:31:56 -05:00
parent 0eddd81699
commit 5bd64b1784
12 changed files with 102 additions and 16 deletions

View File

@ -112,6 +112,6 @@
<p>If you followed the instructions and it still does not work, manually add a new card to your mining deck and try again.</p>
<script src="assets/script.js"></script>
</body>
</html>

53
assets/script.js Normal file
View File

@ -0,0 +1,53 @@
var div = document.createElement('div');
div.innerHTML = '☽';
div.id = 'night';
div.title = 'night mode';
document.body.appendChild(div);
div.onclick = toggleNight;
if(checkCookie() == true) {
nightMode();
}
function toggleNight() {
if(checkCookie() == false) {
nightMode();
} else {
document.getElementsByTagName('head')[0].removeChild(document.getElementById('nightcss'));
setCookie('0');
}
}
function nightMode() {
link = document.createElement('link');
link.href = 'style/night.css';
link.rel = 'stylesheet';
link.type = 'text/css';
link.id = 'nightcss';
document.getElementsByTagName('head')[0].appendChild(link);
setCookie('1');
}
function checkCookie() {
var name = 'night=';
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
if(c.substring(name.length,c.length) === '1') {
return true;
}
}
}
return false;
}
function setCookie(val) {
document.cookie = "night=" + val + "; expires=Thu, 18 Dec 2044 12:00:00 UTC";
}

View File

@ -1499,7 +1499,7 @@ Vocabulary deck: Front: word (kanji). Back: translation, reading, component kanj
<input id="tab-5" type="radio" name="tabs" aria-h idden="true">
<h2>fonts</h2>
<div>
<p>Many of these fonts have slight inconsistencies with the official standard; see <a href="http://i.imgur.com/51LNqBX.png">this image</a> for a detailed comparison. "Suggested" fonts have a green background.</p>
<p>Many of these fonts have slight inconsistencies with the official standard; see <a href="http://i.imgur.com/51LNqBX.png">this image</a> for a detailed comparison. "Suggested" fonts have a colored background.</p>
<table><tbody>
<tr class="heading"><td> Name </td><td> Sample </td><td> Notes </td><td> Download </td></tr>
<tr><td>Anzu</td><td><img src="assets/samples/Anzu/!APJapanesefont.ttf.png" /></td><td></td><td><a href="https://mega.nz/#F!uogyEL5B!lehhDWk1R5Kdjdm3hB6NRw">Download</a></td></tr>
@ -2730,7 +2730,7 @@ Vocabulary deck: Front: word (kanji). Back: translation, reading, component kanj
<script src="assets/script.js"></script>
</div>
</body>
</html>

View File

@ -277,6 +277,6 @@
<p>WaniKani is a paid website which teaches you 6000 words and 2000 kanji. This may seem like a nice prospect, but reality is that the free open source software Anki will accomplish exactly the same for you. WaniKani limits your potential by providing you with a fixed schedule that you cannot exceed. With Anki, you can learn at whatever pace you wish and it does not cost you anything. Anki is also highly modular and can be adjusted to suit your preferences, while WaniKani offers next to no customization. If you still want to use WaniKana's content, there is a free Anki deck in the <a href="cor.html">CoR</a>.</p>
<script src="assets/script.js"></script>
</body>
</html>

View File

@ -28,6 +28,6 @@
<img src="assets/back0.png" id="image"><script>document.getElementById('image').src = 'assets/back' + Math.floor(Math.random() * 5) +'.png';</script>
<!--<p id="notice"></p>-->
<script src="assets/script.js"></script>
</body>
</html>

View File

@ -201,6 +201,8 @@ Four years after the creation of the super strong cardboard, in AD 2050, Ban Yam
</tbody></table>
</div>
</div>
<script src="assets/script.js"></script
</body>
</html>

View File

@ -392,5 +392,6 @@ Protip: Type in kaomoji and hit space. Alternatively: read <a href="http://nihon
<p><a href="http://www.hiragana.jp/en/">Hiragana Megane</a> - This site adds furigana to kanji on websites.</p>
<script src="assets/script.js"></script>
</body>
</html>

View File

@ -1,3 +1,13 @@
#night {
position:absolute;
top:.1em;
right:.6em;
font-size:120%;
text-decoration:none;
color: #F44D54;
cursor:pointer;
}
html {
max-height: 999999px;
}

View File

@ -1,3 +1,14 @@
#night {
position:absolute;
top:2px;
right:.6em;
font-size:120%;
font-weight:bold;
text-decoration:none;
color: #F44D54;
cursor:pointer;
}
body {
font-family: "Noto Sans", "Noto Sans CJK JP", sans-serif;
margin:0px auto;

7
style/night.css Normal file
View File

@ -0,0 +1,7 @@
html {
filter: invert(100%);
}
body {
background-color:#000;
}

View File

@ -1,3 +1,13 @@
#night {
position:absolute;
top:.4em;
right:.6em;
font-size:200%;
text-decoration:none;
color: #F44D54;
cursor:pointer;
}
body {
font-family: "Noto Sans", "Noto Sans CJK JP", sans-serif;
margin:40px auto;
@ -31,11 +41,7 @@ float:left;
margin-top:2.1em;
}
a.one:link {
color: black;
text-decoration: none;
}
a.one:visited {
a.one {
color: black;
text-decoration: none;
}
@ -43,10 +49,6 @@ a.one:hover {
color: #F44D54;
text-decoration:underline;
}
a.one:active {
color: black;
text-decoration: none;
}
.threadsred {
margin-top: 4em;

View File

@ -41,6 +41,6 @@
</tr>
</table>
<script src="assets/script.js"></script>
</body>
</html>