-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (26 loc) · 828 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (26 loc) · 828 Bytes
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
import "./index.less";
import "babel-polyfill";
import gcTheme from "./theme/index.js";
import gcPattern from "./pattern/index.js";
import CoverDrawer from "./lib/cover-drawer.js";
class GhostCover{
constructor(pattern, theme){
this.drawer = new CoverDrawer(pattern, theme);
window.addEventListener('resize', () => {
this.drawCover();
});
}
drawCover(){
if(location.pathname !== '/') return;
const svg = this.drawer.drawPattern(window.innerWidth, window.innerHeight * 1.2);
const svgString = `url('${svg.toDataURI()}')`;
var $ = document.querySelector.bind(document);
var header = $('.main-header');
header.classList.remove('no-cover');
header.style.background = svgString;
}
};
window.gcCover = GhostCover;
window.gcDrawer = CoverDrawer;
window.gcTheme = gcTheme;
window.gcPattern = gcPattern;