diff --git a/snapshot/index.js b/snapshot/index.js
index 71a06c676..feb0f3c12 100644
--- a/snapshot/index.js
+++ b/snapshot/index.js
@@ -1,98 +1,107 @@
-if(window && window.process && window.process.type && process.versions['electron']) (function(){
- console.log('I AN IN ELECTRON');
- var windowWidth = window.innerWidth;
- var windowHeight = window.innerHeight;
- var dpi = window.devicePixelRatio;
- var ipc = require('electron').ipcRenderer;
-
- var onScroll = function(){};
- ipc.on('scroll', function(){
- onScroll.apply(this, arguments);
- setTimeout(function(){ ipc.send('snapshot', 'scroll-done') }, 500);
- });
- var onComplete = function(){};
- ipc.on('complete', function(){ onComplete.apply(this, arguments) });
-
- function captureElement(options, callback){
- window.scroll(0, 0);
- setTimeout(function(){
- var rect = options.el.getBoundingClientRect();
- onScroll = function(event, arg){
- window.scrollTo(0, arg);
+if (window && window.process && window.process.type && process.versions["electron"])
+ (function() {
+ console.log("I AN IN ELECTRON");
+ var windowWidth = window.innerWidth;
+ var windowHeight = window.innerHeight;
+ var dpi = window.devicePixelRatio;
+ var ipc = require("electron").ipcRenderer;
+
+ var onScroll = function() {};
+ ipc.on("scroll", function() {
+ onScroll.apply(this, arguments);
+ setTimeout(function() {
+ ipc.send("snapshot", "scroll-done");
+ }, 500);
+ });
+ var onComplete = function() {};
+ ipc.on("complete", function() {
+ onComplete.apply(this, arguments);
+ });
+
+ function captureElement(options, callback) {
+ window.scroll(0, 0);
+ setTimeout(function() {
+ var rect = options.el.getBoundingClientRect();
+ onScroll = function(event, arg) {
+ window.scrollTo(0, arg);
+ };
+ onComplete = function() {
+ if (callback) callback();
+ onComplete = function() {};
+ };
+ ipc.send("snapshot", {
+ name: options.name,
+ windowWidth: windowWidth,
+ windowHeight: windowHeight,
+ doubleTrim: options.doubleTrim,
+ dpi: dpi,
+ x: rect.left | 0,
+ y: rect.top | 0,
+ width: rect.width | 0,
+ height: rect.height | 0
+ });
+ }, 10);
+ }
+
+ window.onload = function() {
+ var snapshotTasks = [
+ {
+ el: document.querySelector("#downloadoptions"),
+ name: "download-options",
+ doubleTrim: "white"
+ },
+ {
+ el: document.querySelector("#languages"),
+ name: "languages"
+ },
+ {
+ el: document.querySelector("#variants"),
+ name: "variants"
+ },
+ {
+ el: document.querySelector("#stylesets"),
+ name: "stylesets"
+ },
+ {
+ el: document.querySelector("#charvars"),
+ name: "charvars"
+ },
+ {
+ el: document.querySelector("#matrix"),
+ name: "matrix"
+ },
+ {
+ el: document.querySelector("#family"),
+ name: "family"
+ },
+ {
+ el: document.querySelector("#previews"),
+ name: "preview-all"
+ },
+ {
+ el: document.querySelector("#weights"),
+ name: "weights"
+ },
+ {
+ el: document.querySelector("#ligations"),
+ name: "ligations",
+ doubleTrim: "white"
+ }
+ ];
+ current = 0;
+ var step = function() {
+ var doit = function() {
+ captureElement(snapshotTasks[current], function() {
+ current += 1;
+ if (current >= snapshotTasks.length) window.close();
+ else setTimeout(step, 100);
+ });
+ };
+ if (snapshotTasks[current].prepare) snapshotTasks[current].prepare(doit);
+ else setTimeout(doit, 100);
};
- onComplete = function(){
- if(callback) callback();
- onComplete = function(){};
- };
- ipc.send('snapshot', {
- name: options.name,
- windowWidth: windowWidth,
- windowHeight: windowHeight,
- doubleTrim: options.doubleTrim,
- dpi: dpi,
- x: rect.left | 0,
- y: rect.top | 0,
- width: rect.width | 0,
- height: rect.height | 0
- });
- }, 10);
- }
-
- window.onload = function(){
- var snapshotTasks = [
- {
- el: document.querySelector('#downloadoptions'),
- name: 'download-options',
- doubleTrim: 'white'
- },
- {
- el: document.querySelector('#languages'),
- name: 'languages'
- },
- {
- el: document.querySelector('#variants'),
- name: 'variants'
- },
- {
- el: document.querySelector('#opentype'),
- name: 'opentype'
- },
- {
- el: document.querySelector('#matrix'),
- name: 'matrix'
- },
- {
- el: document.querySelector('#family'),
- name: 'family'
- },
- {
- el: document.querySelector('#previews'),
- name: 'preview-all'
- },
- {
- el: document.querySelector('#weights'),
- name: 'weights'
- },
- {
- el: document.querySelector('#ligations'),
- name: 'ligations',
- doubleTrim: 'white'
- }
- ];
- current = 0;
- var step = function(){
- var doit = function(){
- captureElement(snapshotTasks[current], function(){
- current += 1;
- if(current >= snapshotTasks.length) window.close()
- else setTimeout(step, 100)
- })
- };
- if(snapshotTasks[current].prepare) snapshotTasks[current].prepare(doit);
- else setTimeout(doit, 100)
+ ipc.send("snapshot", "i am ready");
+ console.log("I AM READY");
+ setTimeout(step, 2000);
};
- ipc.send('snapshot', 'i am ready');
- console.log('I AM READY');
- setTimeout(step, 2000);
- }
-})()
\ No newline at end of file
+ })();
diff --git a/snapshot/index.styl b/snapshot/index.styl
index 16fdbd222..f1732294a 100644
--- a/snapshot/index.styl
+++ b/snapshot/index.styl
@@ -114,7 +114,7 @@ section#matrix > div > row > span {
padding: 0 0.5em
}
-section#opentype
+section.opentype
width: 36em
padding: 0 8em
> h2 { display: none }