Skip to content

Loading…

Added flashing favicon :D #71

Open
wants to merge 1 commit into from

1 participant

@chid

As discussed. Makes it nicer to pin as app tab :)

@chid

Strange, I recall that I wrote something that would give the number of new Messages in the Favicon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. Yay. added flashing favicon

    Charley committed
This page is out of date. Refresh to see the latest.
Showing with 47 additions and 4 deletions.
  1. +41 −1 wifiSMS/Web/func.js
  2. +6 −3 wifiSMS/Web/index.html
  3. BIN wifiSMS/Web/tinyicon.png
View
42 wifiSMS/Web/func.js
@@ -884,6 +884,46 @@ function shownotify(Phone, Sender, flags, SMS, lastMessage, group) {
}
+c=0;
+function favIconClear() {
+ var icon=document.getElementById("favicon");
+ (newIcon = icon.cloneNode(true)).setAttribute('href','data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wIEAklFDS5Vb8AAAMFSURBVDjLVZNNaFxlFIaf833fncn8JTOTWmvTBGKyEUMW4g/SotnURTYiFSxIXQgWXYjbFlcuKihuFMxGQVBcFI1gUxB/a6UYsP4UmVJT2wnJNMkkM5lJ5ufeOzP33s/FJFpX5+VwnvNu3lfen5/TyWziRCqXPJfJDE4IElqxYAGhP+lrsYLF6kajcdvdcV/3mt68cXX7qVjWOV+L6mzv1ABMn7D/sn1e/tNKJnVWn2+32rPGHXBPB16wT4jFEtmIAR0npmMg4AcdOoGPVhoRtXeJdJ3uabPj1dNaG7BIaAOSJsHY0CgP5h8il8jRC7vsdOuUdle5WV+i2W1ilBGAoBekzba/bZXShGHA4fQI0/dNcVO+ZTcsMB3NcDT/DAPa0DzoMlL+lYu3vmSzXUaLwfqh1eNPj59yI29CKcXxsVkeP/IEbs+j2tng6+2PuNr4hvtjj5J17uVQagSv51Ko/Emz16TjdYuqUCqw7VVJ6hTT9zxG1a/w/c4nrPgFTuTO0ul1eav4POutVXqhMDX8MAknRc2rcn2tgCrVSiwWFylurKLCJLEwz/H0Kzg2xYeV1ziWOIkNhU/X36DrCybKsLy5ws9/L3KnUUKRtkRxy1ZQZqW2goRJJp0ZXj3wOUfjL/Bx5QwziZe57l5hqXGNO/UNyn6ZKNHnFBlBsrCqbvPj1gUS8YC5ree41H6PF0fP4UiMhllmSIbZjK7xU/UiJV1EcsCgoM2z+lQ4FE50YwG3/BsciR1mbHCER/JPMpmbwIaWQwOjxO0gl9cv80VlgVq8hiTAcXTRSA5IgQLWow3erb7DV+PfsewXmV/7jEz8Adb8NX5pr7LQuURzqIXaD6ULhmFEUuynl7RJ83b5TRZ2L1ALaoClHXngAAf7RlhAgW0iRrRUOQCEWCXIkv2LP6LfCYYjUCARKPl/rwBrBdG+VI36Tc054+ZkNxeIiqAlLegb9CELosBGe4u9ZjlNA1fVnCRnE8pO2WMyIy+Rtnks0d1NFrkL7j9TtKUW/WA/kBty5R+VwGHZCCAY1QAAAABJRU5ErkJggg==');
+ // better would be to set the href for the render (background image)
+ // then just use it like the flashing
+ icon.parentNode.replaceChild(newIcon,icon);
+}
+
+window.onfocus = function () {
+ favIconClear();
+ c = 0;
+};
+
+tf = 0; // temp var for flashing
+function flash() {
+ var c6 = document.getElementById("render");
+ var c6_context = c6.getContext("2d");
+ if (c > 0) {
+ c6_context.clearRect(0, 0, 600, 300);
+ c6_context.fillStyle= '#000';
+ c6_context.fillRect(0, 0,50,100);
+
+ c6_context.fillStyle= '#f00';
+ if (tf % 2) {
+ c6_context.fillStyle= '#faa';
+ }
+ tf=tf+1;
+ c6_context.fillRect(0, 0,16,4);
+ c6_context.fillStyle = '#aaf';
+ c6_context.textAlign = 'right';
+ c6_context.fillText(c.toString(), 16, 16);
+ var icon=document.getElementById("favicon");
+ // (newIcon = icon.cloneNode(true)).setAttribute('href',c6.canvas.toDataURL());
+ (newIcon = icon.cloneNode(true)).setAttribute('href',c6.toDataURL());
+ icon.parentNode.replaceChild(newIcon,icon);
+ }
+}
+setInterval(function(){flash()},500);
+
function updateTitle() {
//Update doc title
@@ -904,7 +944,7 @@ function updateTitle() {
} else {
document.title = "WifiSMS";
}
-
+ c = unread;
}
function isNumber(n) {
View
9 wifiSMS/Web/index.html
@@ -3,13 +3,15 @@
<head>
<title>WifiSMS</title>
- <link rel="apple-touch-icon-precomposed" href="touch-icon-iphone.png" />
+<!-- <link rel="apple-touch-icon-precomposed" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="touch-icon-ipad.png" />
- <link rel="apple-touch-icon-precomposed" sizes="114x114" href="touch-icon-iphone4.png" />
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="touch-icon-iphone4.png" /> -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0;">
- <link rel="icon" href="touch-icon-iphone4.png" sizes="128x128" />
+<!-- <link id="favicon" rel="icon" href="touch-icon-iphone4.png" sizes="128x128" /> -->
+ <link id="favicon" rel="shortcut icon" type="image/png" href="touch-icon-iphone4.png"/>
+
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' src='func.js'></script>
@@ -169,6 +171,7 @@
<div onclick="addemoji(&quot;E409&quot;)" title="Insert"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAENUlEQVQ4ja2UaWxUVRiGn3OXTmlLy9hhSktbKMWUUJA2LYWAxeovkE2iQTQWBBN/GOMCISYQ4y9NVGKCSyAxEA2iiKLBpCKBEMAEWVoL2MpmQQbodGiZ6Sydzp17537+mDa4kfjDL3mTk7M8+U7Oe174n0vda2H8GCa0lLFwXjkPPVBGPcD5XjpP3OTY0V5+6B+m7z8Bc3XyXprFphcX5b3sb5xdYEyahyqqBECiAZzrJ7jdfibx4YHk1vfP8VYqQ/Ke3ZbkUX5wJe3Wvjkiwb0iyXMiiQ6R6MmsEh3ZueBesf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CmATIz4g8NBP7nbPuDMdUhX2ykti1G+zMH8SpP0tDbS7W3MLzcpX+ag7PEYDrWdTK2LTNWHK+UjERkKAFIDzNbu4dYfGmqWnNufSeW7O3nd3EppkcLuz3MQahiSAQAWLNQor8pBxEIYoxY2VUUIFSMhafWFrwGmAozXdemX3Ju20WvCs1uX8kevG2QQkTEAMkBwOEJoOAIiMHkWxKZHsOsj2EUUORS2TneOnwLGNSDpy1jz5KtF2YzEoCDbxr4jNax4ai/HD0uOHZIkIhOvP306vLJdsL4GiAqEAdaAyYG6RN3NsGwBkhogSdzpGo6aRKVOKA4zXAOg6Fy8YFDghdwnJuFwGxoaFNZv0cCuIUOC1vqxgT311l4gcP8/A0zLWP5x89r9Pln5Vq3ZfyRTyi6XNHxOGe/JkNLvkNLvkLGuDGn6nFJ2umTqrFO2vKfdLsriJcB9nwtTaTMLyHPbKf5ojfLym1v0DZnFmopbAdtkbRMIWtzrTqYO/mSe3nPB+io0xl9A8EHaTMWZC5hZks3CjcViVXWxUjbTI3IA+v0y2NRp3ajrlPUdIS4D/UB06qgPI7YCZE2OksFEjwAGEAPCQASwHrz4L34b6ZSrEM1zAAAAAElFTkSuQmCC"></div>
</div>
+ <canvas id="render" width="16" height="16" style="display:none"></canvas>
</body>
</html>
View
BIN wifiSMS/Web/tinyicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Something went wrong with that request. Please try again.