-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryStringUtils.js
More file actions
47 lines (40 loc) · 1.07 KB
/
QueryStringUtils.js
File metadata and controls
47 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var urlParams = new URLSearchParams(window.location.search);
export var tuning = urlParams.get("tuning");
export var scale = urlParams.get("scale");
export var scaleType = urlParams.get("scale-type");
export var capo = urlParams.get("capo");
export function SetTuning(Tuning) {
tuning = Tuning;
}
export function SetScale(Scale) {
scale = Scale;
}
export function SetScaleType(ScaleType) {
scaleType = ScaleType;
}
export function SetCapo(Capo) {
capo = Capo;
}
export function SetQueryString() {
if (history.pushState) {
var newurl =
window.location.protocol +
"//" +
window.location.host +
window.location.pathname +
"?tuning=" +
this.tuning +
"&scale=" +
this.scale +
"&scale-type=" +
this.scaleType +
"&capo=" +
this.capo;
window.history.pushState({ path: newurl }, "", newurl);
var title = "Fretboard Explorer " + this.tuning + " " + this.scale + " " + this.scaleType;
if (this.capo && this.capo != 0) {
title += " Capo " + this.capo;
}
window.document.title = title;
}
}