From 1620d1e4be447a63daf811b13365ea673dc4cf7f Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Fri, 21 Jun 2013 17:48:12 -0400 Subject: [PATCH] fixes #17 --- public/src/app.js | 21 ++++++++++++++++----- public/src/forum/accountedit.js | 2 +- src/posts.js | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index 274f3d7c3f..93d5bbd181 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -107,10 +107,23 @@ var socket, var alert = $('#'+alert_id); + function startTimeout(div, timeout) { + var timeoutId = setTimeout(function() { + $(div).fadeOut(1000, function() { + this.remove(); + }); + }, timeout); + + $(div).attr('timeoutId', timeoutId); + } + if(alert.length > 0) { alert.find('strong').html(params.title); alert.find('p').html(params.message); alert.attr('class', "alert toaster-alert " + ((params.type=='warning') ? '' : "alert-" + params.type)); + + clearTimeout(alert.attr('timeoutId')); + startTimeout(alert, params.timeout); } else { var div = document.createElement('div'), @@ -140,11 +153,7 @@ var socket, jQuery('#'+params.location).prepend(jQuery(div).fadeIn('100')); if (params.timeout) { - setTimeout(function() { - jQuery(div).fadeOut(1000, function() { - this.remove(); - }); - }, params.timeout) + startTimeout(div, params.timeout); } if (params.clickfn) { @@ -158,6 +167,8 @@ var socket, } } + + app.current_room = null; app.enter_room = function(room) { if (app.current_room === room) return; diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index 9939f85b5c..6f37c755d4 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -129,7 +129,7 @@ $(document).ready(function() { type: 'success', title: 'Profile Updated', message: 'Your profile has been updated successfully', - timeout: 2000 + timeout: 10000 }); } ); diff --git a/src/posts.js b/src/posts.js index f287928ae6..890cd924a5 100644 --- a/src/posts.js +++ b/src/posts.js @@ -187,7 +187,7 @@ marked.setOptions({ RDB.del('cid:' + cid + ':read_by_uid'); RDB.zadd('categories:recent_posts:cid:' + cid, Date.now(), pid); - + topics.markAsRead(tid, uid); });