summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-25 22:30:55 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-25 22:30:55 +0200
commitac0c33209da391d3a1faedaaedded3d2d3899744 (patch)
treeb756553c6aa14d02d221ae32b66b4b996e514131 /core/js
parente03340b04dca9d0513af0f4c2257d77e4d2e2a48 (diff)
downloadnextcloud-server-ac0c33209da391d3a1faedaaedded3d2d3899744.tar.gz
nextcloud-server-ac0c33209da391d3a1faedaaedded3d2d3899744.zip
add js versions of linkTo, imagePath,addScript and addStyle
Diffstat (limited to 'core/js')
-rw-r--r--core/js/js.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 9a14cb8ed4f..1c66e187366 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -18,6 +18,44 @@ function t(app,text){
}
}
+OC={
+ webroot:oc_webroot,
+ coreApps:['files','admin','log','search','settings'],
+ linkTo:function(app,file){
+ return OC.filePath(app,'',file);
+ },
+ filePath:function(app,type,file){
+ var isCore=OC.coreApps.indexOf(app)!=-1;
+ app+='/';
+ var link=OC.webroot+'/';
+ if(!isCore){
+ link+='apps/';
+ }
+ link+=app;
+ if(type){
+ link+=type+'/'
+ }
+ link+=file;
+ return link;
+ },
+ imagePath:function(app,file){
+ return OC.filePath(app,'img',file);
+ },
+ addScript:function(app,script,ready){
+ var path=OC.filePath(app,'js',script+'.js');
+ if(ready){
+ $.getScript(path,ready);
+ }else{
+ $.getScript(path);
+ }
+ },
+ addStyle:function(app,style){
+ var path=OC.filePath(app,'css',style+'.css');
+ var style=$('<link rel="stylesheet" type="text/css" href="'+path+'"/>');
+ $('head').append(style);
+ }
+}
+
$(document).ready(function(){
// Put fancy stuff in here
});