mirror of
https://github.com/MatMoul/quickdial-webext.git
synced 2024-12-23 07:26:11 +00:00
small improvements
This commit is contained in:
parent
b9fb4adc33
commit
bae64a63b1
2
src/dial
2
src/dial
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head id="head"><meta charset="utf-8" /><link rel="shortcut icon" type="image/png" href="img/24.png" /><script type="text/javascript" src="js/dial.js"></script></head><body id="body"></body></html>
|
||||
<!DOCTYPE html><html><head id="head"><meta charset="utf-8" /><link rel="shortcut icon" type="image/png" href="img/24.png" /><title id="title"></title><script type="text/javascript" src="js/dial.js"></script></head><body id="body"></body></html>
|
@ -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('<head>', '<head><base href="' + url + '">'));
|
||||
//iframe.contentWindow.document.write(xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '"><script>window.top = window;</script>'));
|
||||
iframe.srcdoc = xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '">');
|
||||
//iframe.srcdoc = xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '"><script>window.top = window;</script>');
|
||||
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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user