Added favico.js

This commit is contained in:
Mattias Erming 2014-06-17 02:01:58 +02:00
parent 7e0672e035
commit 250995adbe
4 changed files with 33 additions and 7 deletions

View File

@ -168,7 +168,7 @@ button {
}
#sidebar .pulse {
color: #fff;
transition: color 0s;
transition: color 0.2s;
}
#sidebar .network {
margin-top: 30px;

View File

@ -157,6 +157,7 @@
<script src="/socket.io/socket.io.js"></script>
<script src="/js/jquery.js"></script>
<script src="/js/jquery.plugins.js"></script>
<script src="/js/favico.js"></script>
<script src="/js/uri.js"></script>
<script src="/js/handlebars.js"></script>
<script src="/js/chat.js"></script>

View File

@ -1,12 +1,7 @@
$(function() {
var chat = $("#chat");
var sidebar = $("#sidebar");
setTimeout(function() {
// Enable transitions.
$("body").removeClass("preload");
}, 500);
var commands = [
"/ame",
"/amsg",
@ -165,9 +160,24 @@ $(function() {
}
}
setTimeout(function() {
// Enable transitions.
$("body").removeClass("preload");
}, 500);
var pop = new Audio();
pop.src = "/audio/pop.ogg";
var favicon = new Favico({
animation: "none"
});
document.addEventListener("visibilitychange", function() {
if (sidebar.find(".highlight").length == 0) {
favicon.badge("");
}
});
var viewport = $("#viewport");
var touchDevice = (window.screen.width <= 768);
@ -179,6 +189,7 @@ $(function() {
if (!target) {
return;
}
viewport.removeClass();
sidebar.find(".active").removeClass("active");
link.addClass("active")
@ -186,6 +197,10 @@ $(function() {
.removeClass("highlight")
.empty();
if (sidebar.find(".highlight").length == 0) {
favicon.badge("");
}
$("#main .active").removeClass("active");
var window = $(target)
.css("z-index", z++)
@ -231,6 +246,9 @@ $(function() {
var last = messages.find(".row:last-child");
if (last.hasClass("highlight")) {
pop.play();
if (document.hidden) {
favicon.badge("!");
}
}
var link = $("#channel-" + id + ":not(.active)");

7
client/js/favico.js Normal file

File diff suppressed because one or more lines are too long