Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.

Commit 105eb88

Browse files
committed
Add christmas()
1 parent 3c2a202 commit 105eb88

4 files changed

Lines changed: 135 additions & 1 deletion

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h2 data-l10n-id="other"></h2>
129129
<button data-click="nav" data-click-location="create" data-l10n-title="create"><span class="icon icon-pencil"></span></button>
130130
<button data-click="sidebar" data-click-id="welcome" class="drawerEnabled" data-l10n-title="menu"><span class="icon icon-menu"></span></button>
131131
</menu>
132-
<h1 class="firetext icon-"><img src="style/icons/app/firetext.svg" alt="Firetext"></h1>
132+
<h1 class="firetext icon-"><img src="style/icons/app/firetext.svg" alt="Firetext" id="welcome-wordmark"></h1>
133133
</header>
134134
<div role="main" class="header-only" id="welcome-main-area">
135135
<menu type="toolbar" class="desktop-only mainButtons">

scripts/firetext.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ function initModules(callback) {
158158
};
159159
rate.init("firetext", version, config);
160160
rate.promptRequired();
161+
162+
// Initialize Christmas
163+
christmas();
161164
}
162165

163166
function initElementTitles() {
@@ -1630,3 +1633,30 @@ function setDocumentTitle() {
16301633
}
16311634
}
16321635
}
1636+
1637+
function christmas() {
1638+
var testDate = new Date(),
1639+
testMonth = testDate.getMonth()+1,
1640+
testDay = testDate.getDate();
1641+
if (testMonth === 12 && (testDay >= 13 && testDay <= 31)) {
1642+
doChristmas();
1643+
window.addEventListener('night.changed', doChristmas);
1644+
}
1645+
1646+
function doChristmas() {
1647+
var wordmark = document.getElementById('welcome-wordmark');
1648+
if (html.classList.contains('night') != true) {
1649+
if (!wordmark.hasAttribute('data-original-src')) {
1650+
wordmark.setAttribute('data-original-src',wordmark.src);
1651+
}
1652+
wordmark.src = 'style/icons/app/firetext_christmas.svg';
1653+
} else {
1654+
if (wordmark.hasAttribute('data-original-src')) {
1655+
wordmark.src = wordmark.getAttribute('data-original-src');
1656+
}
1657+
}
1658+
1659+
// Override theme color
1660+
themeColor.setAttribute('content', '#034f20');
1661+
}
1662+
}

scripts/night.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
------------------------*/
1111
var ncss, dcss = document.getElementsByTagName("link")[25];
1212
var nightTheme = '#111', dayTheme = '#fff';
13+
var nightChangeEvent = new CustomEvent('night.changed');
1314

1415
function night() {
1516
if (firetext.settings.get('nightmode') == 'true') {
@@ -72,4 +73,7 @@ function startNight(start) {
7273
}
7374
}
7475
updatePreviewNightModes(document.querySelectorAll('[data-type="list"] li.fileListItem .fileItemDescription iframe'));
76+
77+
// Notify app
78+
window.dispatchEvent(nightChangeEvent);
7579
}

0 commit comments

Comments
 (0)