-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
39 lines (33 loc) · 1.41 KB
/
script.js
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
var ScaleWindow = {
trebleSvgWindow: document.getElementById('trebleSvgWindow'),
trebleElement: document.getElementById('treble'),
bassSvgWindow: document.getElementById('bassSvgWindow'),
bassElement: document.getElementById('bass'),
basePadding: 196,
trebleSvgWidth: trebleSvgWindow.offsetWidth,
trebleSvgHeight: trebleSvgWindow.offsetHeight,
bassSvgWidth: bassSvgWindow.offsetWidth,
bassSvgHeight: bassSvgWindow.offsetHeight,
scale: null,
scaleElements: function () {
ScaleWindow.treble()
ScaleWindow.bass()
},
treble: function () {
var getAttribute = ScaleWindow.trebleElement.getAttribute('transform');
sanitise = getAttribute.replace('scale(', '');
ScaleWindow.scale = sanitise.replace(')', '');
ScaleWindow.trebleSvgWindow.style.height = ScaleWindow.trebleSvgHeight * ScaleWindow.scale;
ScaleWindow.trebleSvgWindow.style.width = ScaleWindow.trebleSvgWidth * ScaleWindow.scale;
},
bass: function () {
var padding = ScaleWindow.basePadding * ScaleWindow.scale;
ScaleWindow.bassSvgWindow.style.height = ScaleWindow.bassSvgHeight * ScaleWindow.scale;
ScaleWindow.bassSvgWindow.style.width = ScaleWindow.bassSvgWidth * ScaleWindow.scale;
ScaleWindow.bassElement.setAttribute('transform', "scale(" + ScaleWindow.scale + ")");
ScaleWindow.bassSvgWindow.style.padding = padding + " 0 0 0";
}
}
window.addEventListener('load', function loaded() {
ScaleWindow.scaleElements();
}, false);