Merge pull request #17609 from owncloud/core-js-helpersforcurrenturl
Add helper functions for host, port and webroot
This commit is contained in:
commit
08faf1811b
|
@ -68,7 +68,17 @@ var OC={
|
||||||
PERMISSION_ALL:31,
|
PERMISSION_ALL:31,
|
||||||
TAG_FAVORITE: '_$!<Favorite>!$_',
|
TAG_FAVORITE: '_$!<Favorite>!$_',
|
||||||
/* jshint camelcase: false */
|
/* jshint camelcase: false */
|
||||||
|
/**
|
||||||
|
* Relative path to ownCloud root.
|
||||||
|
* For example: "/owncloud"
|
||||||
|
*
|
||||||
|
* @type string
|
||||||
|
*
|
||||||
|
* @deprecated since 8.2, use OC.getRootPath() instead
|
||||||
|
* @see OC#getRootPath
|
||||||
|
*/
|
||||||
webroot:oc_webroot,
|
webroot:oc_webroot,
|
||||||
|
|
||||||
appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false,
|
appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false,
|
||||||
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
|
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
|
||||||
config: window.oc_config,
|
config: window.oc_config,
|
||||||
|
@ -218,6 +228,41 @@ var OC={
|
||||||
return window.location.protocol.split(':')[0];
|
return window.location.protocol.split(':')[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the host name used to access this ownCloud instance
|
||||||
|
*
|
||||||
|
* @return {string} host name
|
||||||
|
*
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
getHost: function() {
|
||||||
|
return window.location.host;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the port number used to access this ownCloud instance
|
||||||
|
*
|
||||||
|
* @return {int} port number
|
||||||
|
*
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
getPort: function() {
|
||||||
|
return window.location.port;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the web root path where this ownCloud instance
|
||||||
|
* is accessible, with a leading slash.
|
||||||
|
* For example "/owncloud".
|
||||||
|
*
|
||||||
|
* @return {string} web root path
|
||||||
|
*
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
getRootPath: function() {
|
||||||
|
return OC.webroot;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the absolute path to an image file
|
* get the absolute path to an image file
|
||||||
* if no extension is given for the image, it will automatically decide
|
* if no extension is given for the image, it will automatically decide
|
||||||
|
|
Loading…
Reference in New Issue