function t(app,text){ if( !( app in t.cache )){ $.post( OC.filePath('core','ajax','translations.php'), {'app': app}, function(jsondata){ t.cache[app] = jsondata.data; }); // Bad answer ... if( !( app in t.cache )){ t.cache[app] = []; } } if( typeof( t.cache[app][text] ) !== 'undefined' ){ return t.cache[app][text]; } else{ return text; } } t.cache={}; OC={ webroot:oc_webroot, coreApps:['files','admin','log','search','settings','core'], 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){ if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support file+=(SVGSupport())?'.svg':'.png' } return OC.filePath(app,'img',file); }, addScript:function(app,script,ready){ var path=OC.filePath(app,'js',script+'.js'); if(OC.addStyle.loaded.indexOf(path)==-1){ OC.addStyle.loaded.push(path); if(ready){ $.getScript(path,ready); }else{ $.getScript(path); } } }, addStyle:function(app,style){ var path=OC.filePath(app,'css',style+'.css'); if(OC.addScript.loaded.indexOf(path)==-1){ OC.addScript.loaded.push(path); var style=$(''); $('head').append(style); } }, search:function(query){ if(query){ OC.addStyle('search','results'); $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), OC.search.showResults); } } } OC.addStyle.loaded=[]; OC.addScript.loaded=[]; OC.search.catagorizeResults=function(results){ var types={}; for(var i=0;i