Skip to content
Snippets Groups Projects
Commit ac0c3320 authored by Robin Appelman's avatar Robin Appelman
Browse files

add js versions of linkTo, imagePath,addScript and addStyle

parent e03340b0
No related branches found
No related tags found
No related merge requests found
......@@ -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
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment