You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
999 B
JavaScript

'use strict'
const Promise = require("bluebird");
const documentReady = require("document-ready-promise");
const documentOffset = require("document-offset");
const util = require("util");
const riot = require("riot");
const {ipcRenderer} = require("electron");
require("../components/app");
global.triggerWindowResize = function() {
let marker = document.querySelector(".window-height-marker");
let pageHeight;
if (marker != null) {
pageHeight = documentOffset(marker).top;
} else {
let body = document.querySelector("body");
let rootElement = document.documentElement;
pageHeight = Math.max(body.scrollHeight, body.offsetHeight, rootElement.scrollHeight, rootElement.offsetHeight, rootElement.clientHeight);
}
ipcRenderer.send("resize", {
height: pageHeight
});
}
Promise.try(() => {
return documentReady();
}).then(() => {
riot.mount("app");
global.triggerWindowResize();
ipcRenderer.on("focusSearch", () => {
document.querySelector("input.search").focus();
});
})