Skip to content

Commit ffa9d73

Browse files
committed
Add emoji favicons
1 parent b584b71 commit ffa9d73

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

emoji-favicon-toolkit.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.xhtml

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
</ul>
150150
</footer>
151151
</div>
152+
<script type="application/ecmascript" async="" defer="" src="/emoji-favicon-toolkit.min.js"/>
152153
<script type="application/ecmascript" src="js/oftn/site.js"/>
153154
</body>
154155
</html>

js/oftn/site.js

+13
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ if (!/bot\b/.test(navigator.userAgent)) {
1111
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1212
ga('create', 'UA-20491376-1');
1313
ga('send', 'pageview');
14+
15+
(function() { // randomized per-tab emoji favicons
16+
var favicon_emoji = "👨‍🔬 👩‍🔬 👨‍💻 👩‍💻 👨‍🚀 👩‍🚀 🤯 🤖 ⚡ 🌧️ 🚀 💻 🧠 👻 📜 ☄️ 🛸 🌌 🌠 🛰️ ✨ 🔥".split(" ");
17+
if (navigator.platform === "Win32") { // only Microsoft implements hacker cat
18+
favicon_emoji.push("🐱‍💻");
19+
}
20+
var favicon = sessionStorage.favicon = sessionStorage.favicon || favicon_emoji[crypto.getRandomValues(new Uint8Array(1))[0] % favicon_emoji.length];
21+
addEventListener("load", function() {
22+
if (typeof set_emoji_favicon !== "undefined") {
23+
set_emoji_favicon(favicon);
24+
}
25+
});
26+
}());

0 commit comments

Comments
 (0)