Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-07-04 18:29:42 +0300
committerJulius Härtl <jus@bitgrid.net>2019-07-16 08:39:16 +0300
commite188ef35377b5e534d395904febd61e248e1f29c (patch)
tree45b473002e6cbc95ac3ccad8a02cdccf6480f17d /src
parent2e94bdd338aec4714ed249d9c42e0dde06cc82d6 (diff)
Move getSearchParam to helper file
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r--src/helpers/url.js31
-rw-r--r--src/viewer.js8
2 files changed, 32 insertions, 7 deletions
diff --git a/src/helpers/url.js b/src/helpers/url.js
new file mode 100644
index 00000000..49e9c006
--- /dev/null
+++ b/src/helpers/url.js
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const getSearchParam = (name) => {
+ var results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href)
+ if (results === null) {
+ return null
+ }
+ return decodeURI(results[1]) || 0
+}
+
+export { getSearchParam }
diff --git a/src/viewer.js b/src/viewer.js
index 7ae2f2f6..e70a6dca 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -1,10 +1,4 @@
-function getSearchParam(name) {
- var results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href)
- if (results === null) {
- return null
- }
- return decodeURI(results[1]) || 0
-}
+import { getSearchParam } from './helpers/url'
var preloadType = getSearchParam('richdocuments_create')
var preloadFilename = getSearchParam('richdocuments_filename')