From bae64a63b1619bbe2a627d54d914c9dcdbc34354 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sat, 30 Sep 2017 02:33:58 +0200 Subject: [PATCH] small improvements --- src/dial | 2 +- src/js/background.js | 11 ++++++----- src/js/dial.js | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dial b/src/dial index 92123f6..6075aef 100644 --- a/src/dial +++ b/src/dial @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/js/background.js b/src/js/background.js index f500eb5..ef0ec53 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -112,7 +112,7 @@ core.Bookmarks.getItem = function(bookmarkItem, path){ // Return BookmarkItem fr core.SiteInfos = {} // Siteinfos helper object core.SiteInfos.loadInfos = function(url, args, callback){ // args: { icon: false; screenshot: false }, callback( { url, title, (/!\ Not handled now)icon, screenshot } || error: {} ) - function pageLoaded(){ + function pageLoaded(last){ var docTitle = iframe.contentWindow.document.title; var docIcon = null; var docScreenshot = null; @@ -134,7 +134,7 @@ core.SiteInfos.loadInfos = function(url, args, callback){ // args: { icon: false docScreenshot = canvas.toDataURL(); } - document.body.removeChild(iframe); + if(last) document.body.removeChild(iframe); if(callback) callback({ url: url, title: docTitle, icon: docIcon, screenshot:docScreenshot }); } @@ -150,14 +150,15 @@ core.SiteInfos.loadInfos = function(url, args, callback){ // args: { icon: false xmlHttp.open('GET', url, true); xmlHttp.onload = function(){ document.body.appendChild(iframe); - iframe.contentWindow.document.write(xmlHttp.responseText.replace('', '')); - //iframe.contentWindow.document.write(xmlHttp.responseText.replace('', '')); + iframe.srcdoc = xmlHttp.responseText.replace('', ''); + //iframe.srcdoc = xmlHttp.responseText.replace('', ''); setTimeout(function(){ pageLoaded(); }, 2000); // /!\ Caution function can be shortcuted and sendtimeout is not the best way + setTimeout(function(){ pageLoaded(true); }, 6000); // /!\ Caution function can be shortcuted and sendtimeout is not the best way } xmlHttp.onabort = function(){ if(callback) callback(); } xmlHttp.onerror = function(){ if(callback) callback(); } xmlHttp.ontimeout = function(){ if(callback) callback(); } - xmlHttp.send(null); + xmlHttp.send(); } core.GridNodes = {}; // GridNodes helper object diff --git a/src/js/dial.js b/src/js/dial.js index 2121d25..21c0d4a 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -47,6 +47,7 @@ window.onwheel = function(ev){ dial.initUI = function(){ dial.Head = document.getElementById('head'); + dial.Title = document.getElementById('title'); dial.Body = document.getElementById('body'); dial.Body.setAttribute('contextmenu', 'page'); dial.Body.setAttribute('contextmenu', 'page'); @@ -60,6 +61,7 @@ dial.initUI = function(){ } else { dial.Node = app.getNode(app.settings.grid.node, '/'); } + dial.Title.innerText = dial.Node.title; dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); }