2019-09-04 21:01:54 +05:30
|
|
|
import './styles/toolbar.css';
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
import { buttonAndForm, note, selectContainer, REVIEW_CONTAINER } from './components';
|
2019-09-04 21:01:54 +05:30
|
|
|
import { debounce, eventLookup, getInitialView, initializeState, updateWindowSize } from './store';
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Welcome to the visual review toolbar files. A few useful notes:
|
|
|
|
|
|
|
|
- These files build a static script that is served from our webpack
|
|
|
|
assets folder. (https://gitlab.com/assets/webpack/visual_review_toolbar.js)
|
|
|
|
|
|
|
|
- To compile this file, run `yarn webpack-vrt`.
|
|
|
|
|
|
|
|
- Vue is not used in these files because we do not want to ask users to
|
|
|
|
install another library at this time. It's all pure vanilla javascript.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
initializeState(window, document);
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
const mainContent = buttonAndForm(getInitialView(window));
|
2019-09-04 21:01:54 +05:30
|
|
|
const container = document.createElement('div');
|
|
|
|
container.setAttribute('id', REVIEW_CONTAINER);
|
2019-09-30 21:07:59 +05:30
|
|
|
container.insertAdjacentHTML('beforeend', note);
|
|
|
|
container.insertAdjacentHTML('beforeend', mainContent);
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
document.body.insertBefore(container, document.body.firstChild);
|
|
|
|
|
|
|
|
selectContainer().addEventListener('click', event => {
|
|
|
|
eventLookup(event)();
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener('resize', debounce(updateWindowSize.bind(null, window), 200));
|
|
|
|
});
|