Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.

Commit 76f17e3

Browse files
committed
Specify startup file in URL
1 parent 6dd9ba1 commit 76f17e3

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/main/webapp/app.run.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
(function () {
22
'use strict';
33

4+
var STARTUP_FILE = '';
5+
46
function main($rootScope) {
5-
$rootScope.selectedFile = '';
7+
var re = /([^&=]+)=([^&]*)/g;
8+
var m, s;
9+
10+
if (typeof(s) === 'undefined') {
11+
while (m = re.exec(location.hash.slice(1))) {
12+
if (decodeURIComponent(m[1]) === 'file') {
13+
s = decodeURIComponent(m[2]);
14+
break;
15+
}
16+
}
17+
}
18+
if (typeof(s) === 'undefined') {
19+
while (m = re.exec(location.search.slice(1))) {
20+
if (decodeURIComponent(m[1]) === 'file') {
21+
s = decodeURIComponent(m[2]);
22+
break;
23+
}
24+
}
25+
}
26+
27+
if (typeof(s) === 'undefined') {
28+
if (typeof(STARTUP_FILE) !== 'undefined' && STARTUP_FILE.length) {
29+
s = STARTUP_FILE;
30+
}
31+
}
32+
33+
if (typeof(s) !== 'undefined') {
34+
$rootScope.selectedFile = s;
35+
}
636
}
737

838
angular.module('GroupDocsAnnotationApp').run(main);

0 commit comments

Comments
 (0)