Skip to content

Commit f1795f7

Browse files
ThatJoeMooreblakemorgan
authored andcommitted
Add selected branch/tag to sessionStorage (#262)
1 parent 914c9a1 commit f1795f7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/load-components.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@
3131
var root = '//cdn.byu.edu/byu-theme-components/';
3232
var min = true;
3333

34+
var storedVersion = window.sessionStorage.getItem('version');
3435

3536
// allow user to set a version or branch in the querystring
3637
var version = getParameterByName('version');
37-
if (!version)
38-
{
39-
version = 'latest';
38+
if (!version) {
39+
version = storedVersion || 'latest';
4040
}
41-
var branch = getParameterByName('branch');
4241

43-
if (branch)
44-
{
42+
var branch = getParameterByName('branch');
43+
if (branch) {
4544
version = 'experimental/' + branch;
4645
}
46+
window.sessionStorage.setItem('version', version);
4747
root = root + version;
4848

4949
var isLocalhost = checkIfLocalhost();
5050

5151
// allow testing other branches from localhost
52-
if (version != 'latest')
52+
if (version !== 'latest')
5353
isLocalhost = false;
5454

5555
var isForced = window.location.search && window.location.search.indexOf('load-local=true') >= 0;

0 commit comments

Comments
 (0)