From 0a9d1ed3a645efda56ae757f45aa7efb5a35ce4f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 27 Aug 2012 15:46:05 -0400 Subject: Initial previewer for public links --- core/js/js.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 86e802cd348..0c842f05593 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -29,6 +29,16 @@ function t(app,text){ } t.cache={}; +/** +* Get the path to download a file +* @param file The filename +* @param dir The directory the file is in - e.g. $('#dir').val() +* @return string +*/ +function fileDownloadPath(dir, file) { + return OC.filePath('files', 'ajax', 'download.php')+encodeURIComponent('?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir)); +} + OC={ webroot:oc_webroot, appswebroots:oc_appswebroots, -- cgit v1.2.3 From 92c782c1b049cbb4b9c8433edec2a08b739202a9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 29 Aug 2012 01:57:35 +0200 Subject: return the jQuery deferred object when using OC.loadScript --- core/js/js.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 0c842f05593..c38eebbff29 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -120,18 +120,19 @@ OC={ */ addScript:function(app,script,ready){ var path=OC.filePath(app,'js',script+'.js'); - if(OC.addScript.loaded.indexOf(path)==-1){ - OC.addScript.loaded.push(path); + if(!OC.addScript.loaded[path]){ if(ready){ - $.getScript(path,ready); + var deferred=$.getScript(path,ready); }else{ - $.getScript(path); + var deferred=$.getScript(path); } + OC.addScript.loaded[path]=deferred; }else{ if(ready){ ready(); } } + return OC.addScript.loaded[path]; }, /** * load a css file and load it -- cgit v1.2.3