mirror of
https://github.com/MatMoul/quickdial-webext.git
synced 2025-12-15 16:33:13 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c79e9e38f | |||
| 5e61b65e82 | |||
| cebdb32c35 | |||
| 1e5e450565 | |||
| 5a2c30e00f | |||
| 938f1a0fde | |||
| 4019c0cf77 | |||
| 152506f463 | |||
|
|
cf0ed2bf69 |
2
TODO
2
TODO
@@ -1,6 +1,4 @@
|
||||
Create style for popup
|
||||
Add a setting to customize bookmark root folder
|
||||
Add a setting to lock title from update
|
||||
Add a visual hint for multipage
|
||||
Need a best solution to update folder and bookmark when it are updated from Firefox
|
||||
Improve screenshot result
|
||||
|
||||
67
src/_locales/it/messages.json
Normal file
67
src/_locales/it/messages.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"extensionDescription": {
|
||||
"message": "Quick Dial, una dial page inspirata a fast dial.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Aggiungi a Quick Dial",
|
||||
"description": "Text of add bookmark menu item."
|
||||
},
|
||||
|
||||
"menuNew": {
|
||||
"message": "Nuovo",
|
||||
"description": "Text of new menu item."
|
||||
},
|
||||
|
||||
"menuNewBookmark": {
|
||||
"message": "Segnalibro",
|
||||
"description": "Text of add bookmark menu item."
|
||||
},
|
||||
|
||||
"AddBookmarkPrompt": {
|
||||
"message": "Scrivi l'url del nuovo segnalibro:",
|
||||
"description": "Text of the add bookmark prompt."
|
||||
},
|
||||
|
||||
"menuNewFolder": {
|
||||
"message": "Cartella",
|
||||
"description": "Text of add folder menu item."
|
||||
},
|
||||
|
||||
"AddFolderPrompt": {
|
||||
"message": "Scrivi il nome della nuova cartella:",
|
||||
"description": "Text of the add folder prompt."
|
||||
},
|
||||
|
||||
"menuProperties": {
|
||||
"message": "Proprietà",
|
||||
"description": "Text of properties menu item."
|
||||
},
|
||||
|
||||
"menuRefreshItem": {
|
||||
"message": "Aggiorna",
|
||||
"description": "Text of refresh menu item."
|
||||
},
|
||||
|
||||
"menuCapturePage": {
|
||||
"message": "Cattura in una nuova scheda",
|
||||
"description": "Text of capture menu item."
|
||||
},
|
||||
|
||||
"menuDeleteItem": {
|
||||
"message": "Elimina",
|
||||
"description": "Text of delete menu item."
|
||||
},
|
||||
|
||||
"deleteItemConfimation": {
|
||||
"message": "Eliminare $1?",
|
||||
"description": "Text of delete confirmation."
|
||||
},
|
||||
|
||||
"menuSettings": {
|
||||
"message": "Impostazioni Quick Dial",
|
||||
"description": "Text of settings menu item."
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,16 +33,17 @@
|
||||
<tr>
|
||||
<td><span>Title :</span></td>
|
||||
<td><input id="Title" type="text" style="width:100%"></td>
|
||||
<td style="width:20px"><input id="TitleLocked" type="checkbox" title="Lock title"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Url :</span></td>
|
||||
<td><input id="Url" type="text" style="width:100%"></td>
|
||||
<td colspan="2"><input id="Url" type="text" style="width:100%"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><span>Image :</span></td>
|
||||
<td>
|
||||
<td colspan="2">
|
||||
<button id="ImageReset">Reset</button>
|
||||
<button id="ImageDefault">Default</button>
|
||||
<button class="hidden" id="ImageRefresh">Refresh</button>
|
||||
@@ -52,7 +53,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><div id="ImagePreview" style="width: 300px; height: 180px;"></div></td>
|
||||
<td colspan="2"><div id="ImagePreview" style="width: 300px; height: 180px;"></div></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
.Tab .TabSpace { width: 100%; border-bottom: solid 1px #505050; }
|
||||
.Tab .TabButton { border: solid 1px #505050; padding: 2px 6px 2px 6px; cursor: default; }
|
||||
.Tab .TabButtonActive { border: solid 1px #505050; border-bottom: none; padding: 2px 6px 2px 6px; cursor: default; }
|
||||
.Tab>div { padding: 8px; height: 330px; border-left: solid 1px #505050; border-bottom: solid 1px #505050; border-right: solid 1px #505050; }
|
||||
.Tab>div { padding: 8px; height: 350px; border-left: solid 1px #505050; border-bottom: solid 1px #505050; border-right: solid 1px #505050; }
|
||||
</style>
|
||||
</head>
|
||||
<body id="body">
|
||||
@@ -82,6 +82,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td><span>Root Folder :</span></td>
|
||||
<td><input id="GridRoot" type="text" style="width:100%;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
<table>
|
||||
|
||||
@@ -38,11 +38,17 @@ app.Messages.init = function(){ // Init Messages Listeners
|
||||
sendResponse(app.settings);
|
||||
break;
|
||||
case app.Messages.Commands.setSettings:
|
||||
let rootChanged = (app.settings.grid.root!=request.settings.grid.root);
|
||||
app.settings = request.settings;
|
||||
app.Settings.save();
|
||||
sendResponse(app.settings);
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.settingsChanged } );
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
|
||||
if(rootChanged){
|
||||
app.node = { children: [] };
|
||||
app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); });
|
||||
} else {
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
|
||||
}
|
||||
break;
|
||||
case app.Messages.Commands.getNodeByID:
|
||||
var nodes = app.GridNodes.getNodeWithParents(request.id);
|
||||
@@ -212,7 +218,9 @@ app.Bookmarks.initListener = function(){ // (Called from app.init) (/!\ Need fil
|
||||
}
|
||||
app.Bookmarks.load = function(rootPath, callback){ // Load root bookmark and create it if not exist
|
||||
if(!callback) return;
|
||||
browser.bookmarks.getSubTree('menu________').then(function(bookmarkItems){
|
||||
var root = 'menu________';
|
||||
if(rootPath.substr(0,1)=='/') root = 'root________';
|
||||
browser.bookmarks.getSubTree(root).then(function(bookmarkItems){
|
||||
function getChildItem(bookmarkItem, path, callback){
|
||||
if(path.length == 0){
|
||||
callback(bookmarkItem);
|
||||
@@ -228,7 +236,8 @@ app.Bookmarks.load = function(rootPath, callback){ // Load root bookmark and cre
|
||||
return getChildItem(bookmarkItem, path.substr(bookmarkItem.title.length + 1), callback);
|
||||
}, function(){ callback(); });
|
||||
}
|
||||
getChildItem(bookmarkItems[0], rootPath, callback);
|
||||
if(rootPath.substr(0,1)=='/') getChildItem(bookmarkItems[0], rootPath.substr(1), callback);
|
||||
else getChildItem(bookmarkItems[0], rootPath, callback);
|
||||
}, function(){ callback(); });
|
||||
}
|
||||
|
||||
@@ -452,6 +461,7 @@ app.GridNodes.getNodeWithParents = function(id){
|
||||
app.GridNodes.updateNode = function(gridNode, value, callback){
|
||||
if(value){
|
||||
if(value.title) gridNode.title = value.title;
|
||||
if(value.titleLocked!=null) gridNode.titleLocked = value.titleLocked;
|
||||
if(value.image) gridNode.image = value.image;
|
||||
else delete gridNode.image;
|
||||
if(gridNode.type == app.GridNodes.GridNodeType.bookmark && value.url && gridNode.url != value.url){
|
||||
@@ -570,7 +580,7 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.SiteInfos.fromFrame(gridNode.url, function(infos){
|
||||
if(infos){
|
||||
gridNode.title = infos.title;
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
@@ -606,7 +616,7 @@ app.GridNodes.capturePage = function(gridNode, callback){
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.SiteInfos.fromNewTab(gridNode.url, function(infos){
|
||||
if(infos){
|
||||
gridNode.title = infos.title;
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
|
||||
@@ -79,10 +79,22 @@ app.Messages.init = function(){
|
||||
});
|
||||
};
|
||||
app.Messages.getSettings = function(callback){
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.getSettings }).then(callback, callback);
|
||||
browser.runtime.getBackgroundPage().then(function(page){
|
||||
if(page){
|
||||
if(callback) callback(page.app.settings);
|
||||
} else {
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.getSettings }).then(callback, callback);
|
||||
}
|
||||
});
|
||||
};
|
||||
app.Messages.getNode = function(path, callback){
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.getNode, path: path }).then(callback);
|
||||
browser.runtime.getBackgroundPage().then(function(page){
|
||||
if(page){
|
||||
if(callback) callback(page.app.GridNodes.getNode(page.app.node, dial.path.substr(1)));
|
||||
} else {
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.getNode, path: path }).then(callback);
|
||||
}
|
||||
});
|
||||
};
|
||||
app.Messages.setNodeIndex = function(index, newIndex, callback){
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.setNodeIndex, path: dial.path, index: index, newIndex: newIndex }).then(callback);
|
||||
@@ -289,7 +301,7 @@ dial.initGrid = function(){
|
||||
EndIndex = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.getAttribute('gridindex'));
|
||||
}
|
||||
if(app.settings.grid.backNode && dial.path != '/') EndIndex -= dial.page;
|
||||
app.Messages.setNodeIndex(StartIndex, EndIndex);
|
||||
if(StartIndex != EndIndex) app.Messages.setNodeIndex(StartIndex, EndIndex);
|
||||
}
|
||||
link.draggable = true;
|
||||
link.ondragstart = dragstart_handler;
|
||||
@@ -342,8 +354,10 @@ dial.populateGrid = function(){
|
||||
populateFolder = function(link, node){
|
||||
link.Node = node;
|
||||
link.className = 'Folder';
|
||||
if(node.image) link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
|
||||
else link.childNodes[0].style.backgroundImage = '';
|
||||
if(node.image){
|
||||
if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image;
|
||||
else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
|
||||
} else link.childNodes[0].style.backgroundImage = '';
|
||||
link.childNodes[1].innerText = node.title;
|
||||
if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(dial.path + node.title);
|
||||
else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(node.title);
|
||||
@@ -354,7 +368,8 @@ dial.populateGrid = function(){
|
||||
link.Node = node;
|
||||
if(node.image){
|
||||
link.className = 'Bookmark';
|
||||
link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
|
||||
if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image;
|
||||
else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
|
||||
} else {
|
||||
link.className = 'BookmarkLoading';
|
||||
link.childNodes[0].style.backgroundImage = '';
|
||||
@@ -471,7 +486,7 @@ dial.PopupPanel = function(width, height, modal){ // PopupPanel Object
|
||||
}
|
||||
|
||||
dial.editSettings = function(){
|
||||
var popup = new dial.PopupPanel(500, 420, true);
|
||||
var popup = new dial.PopupPanel(500, 440, true);
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.style.width = '100%';
|
||||
iframe.style.height = '100%';
|
||||
@@ -483,6 +498,7 @@ dial.editSettings = function(){
|
||||
iframe.src = '/html/settings.html';
|
||||
iframe.popup = popup;
|
||||
popup.popup();
|
||||
iframe.focus();
|
||||
}
|
||||
|
||||
dial.editProperties = function(selectedItem){
|
||||
@@ -498,4 +514,5 @@ dial.editProperties = function(selectedItem){
|
||||
iframe.src = '/html/properties.html?id=' + selectedItem.Node.id;
|
||||
iframe.popup = popup;
|
||||
popup.popup();
|
||||
iframe.focus();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
||||
});
|
||||
|
||||
app.init = function(){
|
||||
document.addEventListener('keyup', function(e){
|
||||
switch(e.key){
|
||||
case 'Escape':
|
||||
window.frameElement.popup.close();
|
||||
break;
|
||||
}
|
||||
});
|
||||
app.Messages.getSettings(function(settings){
|
||||
app.settings = settings;
|
||||
app.Messages.getNodeByID(new URL(window.location).searchParams.get('id'), function(node){
|
||||
@@ -16,18 +23,21 @@ app.init = function(){
|
||||
ImagePreview.style.backgroundSize = '100% 100%';
|
||||
switch(node.type){
|
||||
case app.GridNodes.GridNodeType.folder:
|
||||
TitleLocked.parentNode.style.display = 'none';
|
||||
Url.parentNode.parentNode.style.display = 'none';
|
||||
if(node.image){
|
||||
if(node.image.indexOf('url(')>0) Image = node.image;
|
||||
if(node.image.indexOf('url(')>=0) Image = node.image;
|
||||
else Image = 'url(' + node.image + ')';
|
||||
} else Image = null;
|
||||
if(Image==null) ImagePreview.style.backgroundImage = app.settings.grid.folderIcon;
|
||||
else ImagePreview.style.backgroundImage = Image;
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
TitleLocked.checked = (node.titleLocked==true);
|
||||
ImageDefault.style.display = 'none';
|
||||
Url.value = node.url;
|
||||
Image = 'url(' + node.image + ')';
|
||||
if(node.image.indexOf('url(')>=0) Image = node.image;
|
||||
else Image = 'url(' + node.image + ')';
|
||||
ImagePreview.style.backgroundImage = Image;
|
||||
break;
|
||||
}
|
||||
@@ -90,7 +100,7 @@ app.init = function(){
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, image: Image })
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, url: Url.value, image: Image })
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, url: Url.value, image: Image })
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,13 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
||||
|
||||
|
||||
app.init = function(){
|
||||
document.addEventListener('keyup', function(e){
|
||||
switch(e.key){
|
||||
case 'Escape':
|
||||
window.frameElement.popup.close();
|
||||
break;
|
||||
}
|
||||
});
|
||||
app.Messages.getSettings(function(settings){
|
||||
app.settings = settings;
|
||||
BackgroundColor.value = app.settings.backgroundColor;
|
||||
@@ -18,6 +25,7 @@ app.init = function(){
|
||||
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
|
||||
BackgroundPreview.style.backgroundRepeat = 'no-repeat';
|
||||
BackgroundPreview.style.backgroundSize = '100% 100%';
|
||||
GridRoot.value = app.settings.grid.root;
|
||||
GridRows.value = app.settings.grid.rows;
|
||||
GridMargins.value = app.settings.grid.margin;
|
||||
GridColumns.value = app.settings.grid.columns;
|
||||
@@ -84,6 +92,7 @@ app.init = function(){
|
||||
else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value;
|
||||
if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null;
|
||||
else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value;
|
||||
app.settings.grid.root = GridRoot.value;
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } );
|
||||
}
|
||||
BtnCancel.onclick = function(){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "Quick Dial",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"author": "MatMoul",
|
||||
"homepage_url": "https://github.com/MatMoul/quickdial-webext",
|
||||
"developer": {
|
||||
|
||||
Reference in New Issue
Block a user