/** drop target **/ var _target = document.getElementById('drop'); /** Spinner **/ var spinner; var _workstart = function() { spinner = new Spinner().spin(_target); } var _workend = function() { spinner.stop(); } /** Alerts **/ var _badfile = function() { alertify.alert('This file does not appear to be a valid Excel file. If we made a mistake, please send this file to dev@sheetjs.com so we can take a look.', function(){}); }; var _pending = function() { alertify.alert('Please wait until the current file is processed.', function(){}); }; var _large = function(len, cb) { alertify.confirm("This file is " + len + " bytes and may take a few moments. Your browser may lock up during this process. Shall we play?", cb); }; var _failed = function(e) { console.log(e, e.stack); alertify.alert('We unfortunately dropped the ball here. We noticed some issues with the grid recently, so please test the file using the raw parser. If there are issues with the file processor, please send this file to dev@sheetjs.com so we can make things right.', function(){}); }; /** Handsontable magic **/ var boldRenderer = function (instance, td, row, col, prop, value, cellProperties) { Handsontable.TextCell.renderer.apply(this, arguments); $(td).css({'font-weight': 'bold'}); }; var $container, $parent, $window, availableWidth, availableHeight; var calculateSize = function () { var offset = $container.offset(); availableWidth = Math.max($window.width() - 250,600); availableHeight = Math.max($window.height() - 250, 400); }; $(document).ready(function() { $container = $("#hot"); $parent = $container.parent(); $window = $(window); $window.on('resize', calculateSize); }); /* make the buttons for the sheets */ var make_buttons = function(sheetnames, cb) { var $buttons = $('#buttons'); $buttons.html(""); sheetnames.forEach(function(s,idx) { var button= $('