1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 07:26:11 +00:00

Improvement: Tile and snapshot relative to grid size

This commit is contained in:
MatMoul 2017-11-18 00:06:49 +01:00
parent 7b0ac506d8
commit a9a4212299
2 changed files with 7 additions and 5 deletions

View File

@ -296,7 +296,8 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne
imgObj.src = img;
var previewWidth = 1200; // Need to be linked to settings
var previewHeight = 710; // Need to be linked to settings
var previewHeight = previewWidth / app.settings.grid.columns * app.settings.grid.rows;
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
var canvas = document.createElement('canvas');
canvas.style.width = previewWidth.toString() + 'px';
@ -362,7 +363,8 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
}
var previewWidth = 1200; // Need to be linked to settings
var previewHeight = 710; // Need to be linked to settings
var previewHeight = previewWidth / app.settings.grid.columns * app.settings.grid.rows;
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
var iframe;
var xmlHttp = new XMLHttpRequest();
xmlHttp.timeout = 10000
@ -372,7 +374,7 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
iframe.width = previewWidth
iframe.height = previewHeight
iframe.style.position = 'absolute';
//iframe.style.visibility = 'hidden';
iframe.scrolling = 'no';
var content = xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '">');
iframe.onload = function(){ pageLoaded(); }
document.body.appendChild(iframe);

View File

@ -415,8 +415,8 @@ dial.updateGridLayout = function(){
var cellHeight = fullHeight / app.settings.grid.rows;
var linkWidth = 0;
var linkHeight = 0;
if(cellWidth <= cellHeight * 4 / 3) cellHeight = cellWidth / 4 * 3;
else cellWidth = cellHeight / 3 * 4;
if(cellWidth <= cellHeight * app.settings.grid.columns / app.settings.grid.rows) cellHeight = cellWidth / app.settings.grid.columns * app.settings.grid.rows;
else cellWidth = cellHeight / app.settings.grid.rows * app.settings.grid.columns;
linkWidth = cellWidth - 2 * (cellsMargin + 1) - 2 * borderSize;
linkHeight = cellHeight - 2 * (cellsMargin + 1) - 2 * borderSize - titleBorderSize;
return {