summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-04 11:17:53 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-06 16:46:59 +0200
commitfdeafef6a08c45f8b45ab9fac303e3bffc3607b0 (patch)
treea96ca5a4bfeca3b5a2a330c125e7f6738f67b10a /core/js
parent093e9dd4225e6681140523c75bfc20809cd6d651 (diff)
downloadnextcloud-server-fdeafef6a08c45f8b45ab9fac303e3bffc3607b0.tar.gz
nextcloud-server-fdeafef6a08c45f8b45ab9fac303e3bffc3607b0.zip
Auto-add fileid in URL for currently displayed folder
Diffstat (limited to 'core/js')
-rw-r--r--core/js/js.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 69ebabdb419..edee72ca3ca 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -2050,8 +2050,9 @@ OC.Util.History = {
*
* @param params to append to the URL, can be either a string
* or a map
+ * @param {boolean} [replace=false] whether to replace instead of pushing
*/
- pushState: function(params) {
+ _pushState: function(params, replace) {
var strParams;
if (typeof(params) === 'string') {
strParams = params;
@@ -2061,7 +2062,11 @@ OC.Util.History = {
}
if (window.history.pushState) {
var url = location.pathname + '?' + strParams;
- window.history.pushState(params, '', url);
+ if (replace) {
+ window.history.replaceState(params, '', url);
+ } else {
+ window.history.pushState(params, '', url);
+ }
}
// use URL hash for IE8
else {
@@ -2073,6 +2078,32 @@ OC.Util.History = {
},
/**
+ * Push the current URL parameters to the history stack
+ * and change the visible URL.
+ * Note: this includes a workaround for IE8/IE9 that uses
+ * the hash part instead of the search part.
+ *
+ * @param params to append to the URL, can be either a string
+ * or a map
+ */
+ pushState: function(params) {
+ return this._pushState(params, false);
+ },
+
+ /**
+ * Push the current URL parameters to the history stack
+ * and change the visible URL.
+ * Note: this includes a workaround for IE8/IE9 that uses
+ * the hash part instead of the search part.
+ *
+ * @param params to append to the URL, can be either a string
+ * or a map
+ */
+ replaceState: function(params) {
+ return this._pushState(params, true);
+ },
+
+ /**
* Add a popstate handler
*
* @param handler function