summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorGeorg Ehrke <georg@ownCloud.com>2013-02-09 17:20:08 +0100
committerGeorg Ehrke <georg@ownCloud.com>2013-03-01 18:30:25 +0100
commitff9476b3e3f857369521a0cab39d76b821b8b7fc (patch)
treee5549608e05b0319c9f6c77fd19436b49c2d725a /core/js
parent7019972320868b95b709891fc21fcdc2a5b1cc72 (diff)
downloadnextcloud-server-ff9476b3e3f857369521a0cab39d76b821b8b7fc.tar.gz
nextcloud-server-ff9476b3e3f857369521a0cab39d76b821b8b7fc.zip
fix oc#47
Diffstat (limited to 'core/js')
-rw-r--r--core/js/js.js93
1 files changed, 54 insertions, 39 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 6d5d65403fb..f3141fcd41a 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1,7 +1,7 @@
/**
* Disable console output unless DEBUG mode is enabled.
* Add
- * define('DEBUG', true);
+ * define('DEBUG', true);
* To the end of config/config.php to enable debug mode.
* The undefined checks fix the broken ie8 console
*/
@@ -44,13 +44,13 @@ function t(app,text, vars){
}
}
var _build = function (text, vars) {
- return text.replace(/{([^{}]*)}/g,
- function (a, b) {
- var r = vars[b];
- return typeof r === 'string' || typeof r === 'number' ? r : a;
- }
- );
- };
+ return text.replace(/{([^{}]*)}/g,
+ function (a, b) {
+ var r = vars[b];
+ return typeof r === 'string' || typeof r === 'number' ? r : a;
+ }
+ );
+ };
if( typeof( t.cache[app][text] ) !== 'undefined' ){
if(typeof vars === 'object') {
return _build(t.cache[app][text], vars);
@@ -274,7 +274,7 @@ var OC={
var popup = $('#appsettings_popup');
if(popup.length == 0) {
$('body').prepend('<div class="popup hidden" id="appsettings_popup"></div>');
- popup = $('#appsettings_popup');
+ popup = $('#appsettings_popup');
popup.addClass(settings.hasClass('topright') ? 'topright' : 'bottomleft');
}
if(popup.is(':visible')) {
@@ -317,35 +317,50 @@ OC.addStyle.loaded=[];
OC.addScript.loaded=[];
OC.Notification={
- getDefaultNotificationFunction: null,
- setDefault: function(callback) {
- OC.Notification.getDefaultNotificationFunction = callback;
- },
- hide: function(callback) {
- $("#notification").text('');
- $('#notification').fadeOut('400', function(){
- if (OC.Notification.isHidden()) {
- if (OC.Notification.getDefaultNotificationFunction) {
- OC.Notification.getDefaultNotificationFunction.call();
- }
- }
- if (callback) {
- callback.call();
- }
- });
- },
- showHtml: function(html) {
- var notification = $('#notification');
- notification.hide();
- notification.html(html);
- notification.fadeIn().css("display","inline");
- },
- show: function(text) {
- var notification = $('#notification');
- notification.hide();
- notification.text(text);
- notification.fadeIn().css("display","inline");
- },
+ queuedNotifications: new Array(),
+ getDefaultNotificationFunction: null,
+ setDefault: function(callback) {
+ OC.Notification.getDefaultNotificationFunction = callback;
+ },
+ hide: function(callback) {
+ $('#notification').fadeOut('400', function(){
+ if (OC.Notification.isHidden()) {
+ if (OC.Notification.getDefaultNotificationFunction) {
+ OC.Notification.getDefaultNotificationFunction.call();
+ }
+ }
+ if (callback) {
+ callback.call();
+ }
+ $('#notification').empty();
+ if(OC.Notification.queuedNotifications.length > 0){
+ OC.Notification.showHtml(OC.Notification.queuedNotifications[0]);
+ OC.Notification.queuedNotifications.shift();
+ }
+ });
+ },
+ showHtml: function(html) {
+ if(($('#notification').filter('span.undo').length == 1) || OC.Notification.isHidden()){
+ $('#notification').html(html);
+ $('#notification').fadeIn().css("display","inline");
+ }else{
+ OC.Notification.queuedNotifications.push(html);
+ }
+ },
+ show: function(text) {
+ if(text == ''){
+ return false;
+ }
+ if(OC.Notification.currentlyShownNotifications < 2){
+ var notification = $('#notification');
+ notification.hide();
+ notification.text(text);
+ notification.fadeIn().css("display","inline");
+ OC.Notification.currentlyShownNotifications++;
+ }else{
+ OC.Notification.queuedNotifications.push($(text).html());
+ }
+ },
isHidden: function() {
return ($("#notification").text() === '');
}
@@ -548,7 +563,7 @@ function replaceSVG(){
*/
function object(o) {
function F() {}
- F.prototype = o;
+ F.prototype = o;
return new F();
}