swipe chat notification to the right to make it fade out

swipe-gestures
John McLear 2014-10-12 17:46:05 +01:00
parent 040dc78df9
commit 79e684ac34
3 changed files with 12 additions and 3 deletions

View File

@ -15,6 +15,7 @@
, "pad_connectionstatus.js"
, "chat.js"
, "gritter.js"
, "hammer.js"
, "$tinycon/tinycon.js"
, "excanvas.js"
, "farbtastic.js"

View File

@ -18,6 +18,7 @@ var padutils = require('./pad_utils').padutils;
var padcookie = require('./pad_cookie').padcookie;
var Tinycon = require('tinycon/tinycon');
var hooks = require('./pluginfw/hooks');
var Hammer = require('./hammer');
var chat = (function()
{
@ -149,6 +150,7 @@ var chat = (function()
$("#chatcounter").text(count);
if(!chatOpen) {
$.gritter.add({
// (string | mandatory) the heading of the notification
title: ctx.authorName,
@ -157,7 +159,15 @@ var chat = (function()
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: ctx.sticky,
// (int | optional) the time you want it to be alive for before fading out
time: '4000'
time: '4000',
// after open allow it to be swiped
after_open: function(e){
var gritterNotification = document.getElementById(e.context.id);
var hammertime = new Hammer(gritterNotification);
hammertime.on("swiperight", function(ev){
$(gritterNotification).fadeOut();
});
}
});
}
}

View File

@ -48,7 +48,6 @@ var createCookie = require('./pad_utils').createCookie;
var readCookie = require('./pad_utils').readCookie;
var randomString = require('./pad_utils').randomString;
var gritter = require('./gritter').gritter;
var hooks = require('./pluginfw/hooks');
function createCookie(name, value, days, path){ /* Warning Internet Explorer doesn't use this it uses the one from pad_utils.js */
@ -937,4 +936,3 @@ exports.handshake = handshake;
exports.pad = pad;
exports.init = init;
exports.alertBar = alertBar;