Minor fixes
This commit is contained in:
parent
bd113dd46e
commit
2fd5f293f0
8
client/js/libs.min.js
vendored
8
client/js/libs.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
* @fileOverview Favico animations
|
* @fileOverview Favico animations
|
||||||
* @author Miroslav Magda, http://blog.ejci.net
|
* @author Miroslav Magda, http://blog.ejci.net
|
||||||
* @version 0.3.4
|
* @version 0.3.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,13 +34,14 @@
|
|||||||
animation : 'slide',
|
animation : 'slide',
|
||||||
elementId : false
|
elementId : false
|
||||||
};
|
};
|
||||||
var _opt, _orig, _h, _w, _canvas, _context, _img, _ready, _lastBadge, _running, _readyCb, _stop, _browser;
|
var _opt, _orig, _h, _w, _canvas, _context, _img, _ready, _lastBadge, _running, _readyCb, _stop, _browser, _animTimeout, _drawTimeout;
|
||||||
|
|
||||||
_browser = {};
|
_browser = {};
|
||||||
_browser.ff = (/firefox/i.test(navigator.userAgent.toLowerCase()));
|
_browser.ff = typeof InstallTrigger != 'undefined';
|
||||||
_browser.chrome = (/chrome/i.test(navigator.userAgent.toLowerCase()));
|
_browser.chrome = !!window.chrome;
|
||||||
_browser.opera = (/opera/i.test(navigator.userAgent.toLowerCase()));
|
_browser.opera = !!window.opera || navigator.userAgent.indexOf('Opera') >= 0;
|
||||||
_browser.ie = (/msie/i.test(navigator.userAgent.toLowerCase())) || (/trident/i.test(navigator.userAgent.toLowerCase()));
|
_browser.ie = /*@cc_on!@*/false;
|
||||||
|
_browser.safari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||||
_browser.supported = (_browser.chrome || _browser.ff || _browser.opera);
|
_browser.supported = (_browser.chrome || _browser.ff || _browser.opera);
|
||||||
|
|
||||||
var _queue = [];
|
var _queue = [];
|
||||||
@ -136,6 +137,9 @@
|
|||||||
*/
|
*/
|
||||||
icon.reset = function() {
|
icon.reset = function() {
|
||||||
//reset
|
//reset
|
||||||
|
if (!_ready) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_queue = [];
|
_queue = [];
|
||||||
_lastBadge = false;
|
_lastBadge = false;
|
||||||
_context.clearRect(0, 0, _w, _h);
|
_context.clearRect(0, 0, _w, _h);
|
||||||
@ -144,6 +148,8 @@
|
|||||||
link.setIcon(_canvas);
|
link.setIcon(_canvas);
|
||||||
//webcam('stop');
|
//webcam('stop');
|
||||||
//video('stop');
|
//video('stop');
|
||||||
|
window.clearTimeout(_animTimeout);
|
||||||
|
window.clearTimeout(_drawTimeout);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Start animation
|
* Start animation
|
||||||
@ -164,16 +170,23 @@
|
|||||||
};
|
};
|
||||||
if (_queue.length > 0) {
|
if (_queue.length > 0) {
|
||||||
_running = true;
|
_running = true;
|
||||||
|
var run = function() {
|
||||||
|
// apply options for this animation
|
||||||
|
['type', 'animation', 'bgColor', 'textColor', 'fontFamily', 'fontStyle'].forEach(function(a) {
|
||||||
|
if ( a in _queue[0].options) {
|
||||||
|
_opt[a] = _queue[0].options[a];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animation.run(_queue[0].options, function() {
|
||||||
|
finished();
|
||||||
|
}, false);
|
||||||
|
};
|
||||||
if (_lastBadge) {
|
if (_lastBadge) {
|
||||||
animation.run(_lastBadge.options, function() {
|
animation.run(_lastBadge.options, function() {
|
||||||
animation.run(_queue[0].options, function() {
|
run();
|
||||||
finished();
|
|
||||||
}, false);
|
|
||||||
}, true);
|
}, true);
|
||||||
} else {
|
} else {
|
||||||
animation.run(_queue[0].options, function() {
|
run();
|
||||||
finished();
|
|
||||||
}, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -258,13 +271,13 @@
|
|||||||
_context.clearRect(0, 0, _w, _h);
|
_context.clearRect(0, 0, _w, _h);
|
||||||
_context.drawImage(_img, 0, 0, _w, _h);
|
_context.drawImage(_img, 0, 0, _w, _h);
|
||||||
_context.beginPath();
|
_context.beginPath();
|
||||||
_context.font = "bold " + Math.floor(opt.h * (opt.n > 99 ? 0.9 : 1)) + "px sans-serif";
|
_context.font = _opt.fontStyle + " " + Math.floor(opt.h * (opt.n > 99 ? 0.9 : 1)) + "px " + _opt.fontFamily;
|
||||||
_context.textAlign = 'center';
|
_context.textAlign = 'center';
|
||||||
_context.fillStyle = 'rgba(' + _opt.bgColor.r + ',' + _opt.bgColor.g + ',' + _opt.bgColor.b + ',' + opt.o + ')';
|
_context.fillStyle = 'rgba(' + _opt.bgColor.r + ',' + _opt.bgColor.g + ',' + _opt.bgColor.b + ',' + opt.o + ')';
|
||||||
_context.fillRect(opt.x, opt.y, opt.w, opt.h);
|
_context.fillRect(opt.x, opt.y, opt.w, opt.h);
|
||||||
_context.fillStyle = 'rgba(' + _opt.textColor.r + ',' + _opt.textColor.g + ',' + _opt.textColor.b + ',' + opt.o + ')';
|
_context.fillStyle = 'rgba(' + _opt.textColor.r + ',' + _opt.textColor.g + ',' + _opt.textColor.b + ',' + opt.o + ')';
|
||||||
//_context.fillText((more) ? '9+' : opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
//_context.fillText((more) ? '9+' : opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
||||||
if ((typeof opt.n)==='number' && opt.len > 3) {
|
if (( typeof opt.n) === 'number' && opt.n > 999) {
|
||||||
_context.fillText(((opt.n > 9999) ? 9 : Math.floor(opt.n / 1000) ) + 'k+', Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
|
_context.fillText(((opt.n > 9999) ? 9 : Math.floor(opt.n / 1000) ) + 'k+', Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
|
||||||
} else {
|
} else {
|
||||||
_context.fillText(opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
_context.fillText(opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
|
||||||
@ -275,19 +288,36 @@
|
|||||||
/**
|
/**
|
||||||
* Set badge
|
* Set badge
|
||||||
*/
|
*/
|
||||||
var badge = function(number, animType) {
|
var badge = function(number, opts) {
|
||||||
|
opts = (( typeof opts) === 'string' ? {
|
||||||
|
animation : opts
|
||||||
|
} : opts) || {};
|
||||||
_readyCb = function() {
|
_readyCb = function() {
|
||||||
try {
|
try {
|
||||||
if ( typeof (number) === 'number' ? (number > 0) : (number !== '')) {
|
if ( typeof (number) === 'number' ? (number > 0) : (number !== '')) {
|
||||||
if (animation.types['' + animType]) {
|
var q = {
|
||||||
_opt.animation = animType;
|
|
||||||
}
|
|
||||||
_queue.push({
|
|
||||||
type : 'badge',
|
type : 'badge',
|
||||||
options : {
|
options : {
|
||||||
n : number
|
n : number
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if ('animation' in opts && animation.types['' + opts.animation]) {
|
||||||
|
q.options.animation = '' + opts.animation;
|
||||||
|
}
|
||||||
|
if ('type' in opts && type['' + opts.type]) {
|
||||||
|
q.options.type = '' + opts.type;
|
||||||
|
}
|
||||||
|
['bgColor', 'textColor'].forEach(function(o) {
|
||||||
|
if ( o in opts) {
|
||||||
|
q.options[o] = hexToRgb(opts[o]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
['fontStyle', 'fontFamily'].forEach(function(o) {
|
||||||
|
if ( o in opts) {
|
||||||
|
q.options[o] = opts[o];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_queue.push(q);
|
||||||
if (_queue.length > 100) {
|
if (_queue.length > 100) {
|
||||||
throw 'Too many badges requests in queue.';
|
throw 'Too many badges requests in queue.';
|
||||||
}
|
}
|
||||||
@ -414,7 +444,7 @@
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
setTimeout(drawVideo, animation.duration, video);
|
_drawTimeout = setTimeout(drawVideo, animation.duration, video);
|
||||||
link.setIcon(_canvas);
|
link.setIcon(_canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +459,7 @@
|
|||||||
var getLink = function() {
|
var getLink = function() {
|
||||||
var link = document.getElementsByTagName('head')[0].getElementsByTagName('link');
|
var link = document.getElementsByTagName('head')[0].getElementsByTagName('link');
|
||||||
for (var l = link.length, i = (l - 1); i >= 0; i--) {
|
for (var l = link.length, i = (l - 1); i >= 0; i--) {
|
||||||
if ((/icon/i).test(link[i].getAttribute('rel'))) {
|
if ((/(^|\s)icon(\s|$)/i).test(link[i].getAttribute('rel'))) {
|
||||||
return link[i];
|
return link[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -450,7 +480,7 @@
|
|||||||
}
|
}
|
||||||
//check if image and link url is on same domain. if not raise error
|
//check if image and link url is on same domain. if not raise error
|
||||||
url = (_opt.elementId) ? elm.src : elm.href;
|
url = (_opt.elementId) ? elm.src : elm.href;
|
||||||
if (url.indexOf(document.location.hostname) === -1) {
|
if (url.substr(0, 5) !== 'data:' && url.indexOf(document.location.hostname) === -1) {
|
||||||
throw new Error('Error setting favicon. Favicon image is on different domain (Icon: ' + url + ', Domain: ' + document.location.hostname + ')');
|
throw new Error('Error setting favicon. Favicon image is on different domain (Icon: ' + url + ', Domain: ' + document.location.hostname + ')');
|
||||||
}
|
}
|
||||||
elm.setAttribute('type', 'image/png');
|
elm.setAttribute('type', 'image/png');
|
||||||
@ -762,7 +792,7 @@
|
|||||||
};
|
};
|
||||||
if ((step < animationType.length) && (step >= 0)) {
|
if ((step < animationType.length) && (step >= 0)) {
|
||||||
type[_opt.type](merge(opt, animationType[step]));
|
type[_opt.type](merge(opt, animationType[step]));
|
||||||
setTimeout(function() {
|
_animTimeout = setTimeout(function() {
|
||||||
if (revert) {
|
if (revert) {
|
||||||
step = step - 1;
|
step = step - 1;
|
||||||
} else {
|
} else {
|
||||||
@ -784,7 +814,10 @@
|
|||||||
video : video,
|
video : video,
|
||||||
image : image,
|
image : image,
|
||||||
webcam : webcam,
|
webcam : webcam,
|
||||||
reset : icon.reset
|
reset : icon.reset,
|
||||||
|
browser : {
|
||||||
|
supported : _browser.supported
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -487,17 +487,17 @@ $(function() {
|
|||||||
}
|
}
|
||||||
favico.badge("!");
|
favico.badge("!");
|
||||||
if (settings.badge && Notification.permission == "granted") {
|
if (settings.badge && Notification.permission == "granted") {
|
||||||
var n = new Notification(msg.from + " says:", {
|
var notify = new Notification(msg.from + " says:", {
|
||||||
body: msg.text.trim(),
|
body: msg.text.trim(),
|
||||||
icon: "/img/logo-64.png"
|
icon: "/img/logo-64.png"
|
||||||
});
|
});
|
||||||
n.onclick = function() {
|
notify.onclick = function() {
|
||||||
window.focus();
|
window.focus();
|
||||||
button.click();
|
button.click();
|
||||||
this.close();
|
this.close();
|
||||||
};
|
};
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
n.close();
|
notify.close();
|
||||||
}, 5 * 1000);
|
}, 5 * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,9 @@ templates['chan'] = template({"1":function(depth0,helpers,partials,data) {
|
|||||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||||
+ "\" class=\"chan "
|
+ "\" class=\"chan "
|
||||||
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
|
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
|
||||||
+ "\">\n <span class=\"badge\">";
|
+ "\">\n <span class=\"badge\" data-count=\""
|
||||||
|
+ escapeExpression(((helper = (helper = helpers.unread || (depth0 != null ? depth0.unread : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"unread","hash":{},"data":data}) : helper)))
|
||||||
|
+ "\">";
|
||||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.unread : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
|
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.unread : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
|
||||||
if (stack1 != null) { buffer += stack1; }
|
if (stack1 != null) { buffer += stack1; }
|
||||||
return buffer + "</span>\n <span class=\"close\"></span>\n "
|
return buffer + "</span>\n <span class=\"close\"></span>\n "
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{#each channels}}
|
{{#each channels}}
|
||||||
<button data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
|
<button data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
|
||||||
<span class="badge">{{#if unread}}{{unread}}{{/if}}</span>
|
<span class="badge" data-count="{{unread}}">{{#if unread}}{{unread}}{{/if}}</span>
|
||||||
<span class="close"></span>
|
<span class="close"></span>
|
||||||
{{name}}
|
{{name}}
|
||||||
</button>
|
</button>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "shout",
|
"name": "shout",
|
||||||
"description": "A web IRC client",
|
"description": "A web IRC client",
|
||||||
"version": "0.32.1",
|
"version": "0.32.2",
|
||||||
"author": "Mattias Erming",
|
"author": "Mattias Erming",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user