summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-28 19:36:21 +0100
committerJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-28 19:36:21 +0100
commit3bafa87a1223d18e7f772c9551f17aaf7bcc7abb (patch)
tree30c0b4ee3ba330ebed4effa332b946c61e6d418e /core/js/js.js
parentfeb65c89f2780220bb560a8f63c7dc6ac94602b0 (diff)
parent06c1c35ac90f7920afa637ab0b628529b4135d40 (diff)
downloadnextcloud-server-3bafa87a1223d18e7f772c9551f17aaf7bcc7abb.tar.gz
nextcloud-server-3bafa87a1223d18e7f772c9551f17aaf7bcc7abb.zip
merge styles
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js76
1 files changed, 66 insertions, 10 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 5ba7d1eef5c..f4ac3cbac8f 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -37,14 +37,14 @@ function t(app,text, vars){
t.cache[app] = [];
}
}
- 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;
- }
- );
- }
+ 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;
+ }
+ );
+ };
if( typeof( t.cache[app][text] ) !== 'undefined' ){
if(typeof vars === 'object') {
return _build(t.cache[app][text], vars);
@@ -88,7 +88,7 @@ var OC={
PERMISSION_DELETE:8,
PERMISSION_SHARE:16,
webroot:oc_webroot,
- appswebroots:oc_appswebroots,
+ appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false,
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
coreApps:['', 'admin','log','search','settings','core','3rdparty'],
/**
@@ -101,6 +101,27 @@ var OC={
return OC.filePath(app,'',file);
},
/**
+ * Creates an url for remote use
+ * @param string $service id
+ * @return string the url
+ *
+ * Returns a url to the given service.
+ */
+ linkToRemoteBase:function(service) {
+ return OC.webroot + '/remote.php/' + service;
+ },
+ /**
+ * @brief Creates an absolute url for remote use
+ * @param string $service id
+ * @param bool $add_slash
+ * @return string the url
+ *
+ * Returns a absolute url to the given service.
+ */
+ linkToRemote:function(service) {
+ return window.location.protocol + '//' + window.location.host + OC.linkToRemoteBase(service);
+ },
+ /**
* get the absolute url for a file in an app
* @param app the id of the app
* @param type the type of the file to link to (e.g. css,img,ajax.template)
@@ -247,7 +268,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')) {
@@ -289,6 +310,41 @@ OC.search.lastResults={};
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");
+ },
+ isHidden: function() {
+ return ($("#notification").text() === '');
+ }
+};
+
OC.Breadcrumb={
container:null,
crumbs:[],