mirror of
https://github.com/MatMoul/quickdial-webext.git
synced 2025-12-15 16:33:13 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff0eebed69 | |||
| 9fdcc91ec6 | |||
| 39ab845d58 | |||
| 6815551c8c | |||
| ce82a4c67e | |||
| 72ab3e5f6b | |||
| beb52273a2 | |||
| 2e5bbce72f | |||
| ddbd2f40c8 | |||
| 63569851d8 | |||
| 88b6a8d45d | |||
|
|
7b6e112038 | ||
| ee310a9546 | |||
|
|
e400d07f01 | ||
| d8620464a3 | |||
| 1a71f96a91 | |||
| 45f7e60fb8 | |||
| 190d54a0f1 | |||
| 05a78e2d63 | |||
| 1ba60232f2 |
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"extensionDescription": {
|
||||
"message": "Quick Dial, eine Schnellwahl-Seite inspiriert von Fast Dial.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Zu Quick Dial hinzufügen",
|
||||
"description": "Text of add bookmark menu item."
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"extensionDescription": {
|
||||
"message": "Quick Dial, a dial page inspired from fast dial.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Add to Quick Dial",
|
||||
"description": "Text of add bookmark menu item."
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"extensionDescription": {
|
||||
"message": "Quick Dial, page dial inspirée de fast dial.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Ajouter à Quick Dial",
|
||||
"description": "Text of add bookmark menu item."
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"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."
|
||||
|
||||
67
src/_locales/pt_BR/messages.json
Normal file
67
src/_locales/pt_BR/messages.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Adicionar ao Quick Dial",
|
||||
"description": "Texto do iten de menu adicionar ao Quick Dial."
|
||||
},
|
||||
|
||||
"menuNew": {
|
||||
"message": "Novo",
|
||||
"description": "Texto do item de menu novo."
|
||||
},
|
||||
|
||||
"menuNewBookmark": {
|
||||
"message": "Favorito",
|
||||
"description": "Texto do iten de menu adicionar favorito."
|
||||
},
|
||||
|
||||
"AddBookmarkPrompt": {
|
||||
"message": "Entre com a url do novo favorito :",
|
||||
"description": "Texto do rótulo adicionar favorito."
|
||||
},
|
||||
|
||||
"menuNewFolder": {
|
||||
"message": "Pasta",
|
||||
"description": "Texto do item de menu adicionar pasta."
|
||||
},
|
||||
|
||||
"AddFolderPrompt": {
|
||||
"message": "Entre com o nome da nova pasta :",
|
||||
"description": "Texto do rótulo adicionar pasta."
|
||||
},
|
||||
|
||||
"menuProperties": {
|
||||
"message": "Propriedades",
|
||||
"description": "Texto do item de menu propriedades."
|
||||
},
|
||||
|
||||
"menuRefreshItem": {
|
||||
"message": "Atualizar",
|
||||
"description": "Texto do item de menu atualizar."
|
||||
},
|
||||
|
||||
"menuCaptureHere": {
|
||||
"message": "Capturar aqui",
|
||||
"description": "Texto do item de menu capturar aqui."
|
||||
},
|
||||
|
||||
"menuCapturePage": {
|
||||
"message": "Capturar em uma nova guia",
|
||||
"description": "Texto do item de menu capturar em uma nova guia."
|
||||
},
|
||||
|
||||
"menuDeleteItem": {
|
||||
"message": "Excluir",
|
||||
"description": "Texto do item de menu excluir."
|
||||
},
|
||||
|
||||
"deleteItemConfimation": {
|
||||
"message": "Excluir $1 ?",
|
||||
"description": "Texto de confirmação da exclusão."
|
||||
},
|
||||
|
||||
"menuSettings": {
|
||||
"message": " Configurações do Quick Dial",
|
||||
"description": "Texto do item de menu configurações."
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"extensionDescription": {
|
||||
"message": "Quick Dial, вдохновление умершим расширением Fast Dial.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Добавить в Quick Dial",
|
||||
"description": "Text of add bookmark menu item."
|
||||
|
||||
67
src/_locales/sr/messages.json
Normal file
67
src/_locales/sr/messages.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"menuAddToQuickDial": {
|
||||
"message": "Додај у брзо бирање",
|
||||
"description": "Text of add bookmark menu item."
|
||||
},
|
||||
|
||||
"menuNew": {
|
||||
"message": "Нова",
|
||||
"description": "Text of new menu item."
|
||||
},
|
||||
|
||||
"menuNewBookmark": {
|
||||
"message": "Забелешка",
|
||||
"description": "Text of add bookmark menu item."
|
||||
},
|
||||
|
||||
"AddBookmarkPrompt": {
|
||||
"message": "Унесите УРЛ нове забелешке :",
|
||||
"description": "Text of the add bookmark prompt."
|
||||
},
|
||||
|
||||
"menuNewFolder": {
|
||||
"message": "Фасцикла",
|
||||
"description": "Text of add folder menu item."
|
||||
},
|
||||
|
||||
"AddFolderPrompt": {
|
||||
"message": "Унесите име нове фасцикле :",
|
||||
"description": "Text of the add folder prompt."
|
||||
},
|
||||
|
||||
"menuProperties": {
|
||||
"message": "Својства",
|
||||
"description": "Text of properties menu item."
|
||||
},
|
||||
|
||||
"menuRefreshItem": {
|
||||
"message": "Обнови",
|
||||
"description": "Text of refresh menu item."
|
||||
},
|
||||
|
||||
"menuCaptureHere": {
|
||||
"message": "Ухвати овде",
|
||||
"description": "Text of capture here menu item."
|
||||
},
|
||||
|
||||
"menuCapturePage": {
|
||||
"message": "Ухвати у новом језичку",
|
||||
"description": "Text of capture menu item."
|
||||
},
|
||||
|
||||
"menuDeleteItem": {
|
||||
"message": "Обриши",
|
||||
"description": "Text of delete menu item."
|
||||
},
|
||||
|
||||
"deleteItemConfimation": {
|
||||
"message": "Обрисати $1 ?",
|
||||
"description": "Text of delete confirmation."
|
||||
},
|
||||
|
||||
"menuSettings": {
|
||||
"message": "Подешавање брзог бирања",
|
||||
"description": "Text of settings menu item."
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<tr>
|
||||
<td><span>Image :</span></td>
|
||||
<td colspan="2">
|
||||
<td>
|
||||
<select id="ImageMode">
|
||||
<option value="-1">Default</option>
|
||||
<option value="0">Stretch</option>
|
||||
@@ -57,6 +57,7 @@
|
||||
<button class="hidden" id="ImageCapture">Capture</button>
|
||||
<input id="ImageFile" type="file" style="width:180px;">
|
||||
</td>
|
||||
<td style="width:20px"><input id="ImageLocked" type="checkbox" title="Lock image"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
@@ -58,6 +58,18 @@
|
||||
<td>Preview :</td>
|
||||
<td><div id="BackgroundPreview" style="width: 300px; height: 180px;"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Show "Add to ..." :</td>
|
||||
<td><input id="MenuShowAdd" type="checkbox"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open QD in new page :</td>
|
||||
<td><input id="ButtonOpenInNewPage" type="checkbox"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
@@ -69,10 +81,35 @@
|
||||
<input id="GridColumns" type="number" min="1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Ratio (X/Y) :</span></td>
|
||||
<td>
|
||||
<input id="GridRatioX" type="number" min="1">
|
||||
<input id="GridRatioY" type="number" min="1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Margins :</span></td>
|
||||
<td><input id="GridMargins" type="number" min="0"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Open Bookmarks In :</span></td>
|
||||
<td>
|
||||
<select id="GridOpenBookmarksIn">
|
||||
<option value="0">Default</option>
|
||||
<option value="1">New Tab</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Open Folders In :</span></td>
|
||||
<td>
|
||||
<select id="GridOpenFoldersIn">
|
||||
<option value="0">Default</option>
|
||||
<option value="1">New Tab</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Back Button :</span></td>
|
||||
<td><input id="GridBackNode" type="checkbox"></td>
|
||||
|
||||
@@ -4,8 +4,9 @@ app.init = function(){ // Init module
|
||||
app.Settings.init(function(){
|
||||
app.Messages.init();
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged });
|
||||
browser.browserAction.onClicked.addListener(function(){
|
||||
browser.tabs.create({});
|
||||
browser.browserAction.onClicked.addListener(function(e){
|
||||
if(app.settings.openQuickDialInNewPage) browser.tabs.create({});
|
||||
else browser.tabs.update(e.id, {url: '/dial'}).then();
|
||||
});
|
||||
app.GridNodes.sync(app.node, app.settings.grid.root, function(){
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
|
||||
@@ -49,6 +50,7 @@ app.Messages.init = function(){ // Init Messages Listeners
|
||||
} else {
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
|
||||
}
|
||||
app.ContextMenus.updateMenu();
|
||||
break;
|
||||
case app.Messages.Commands.getNodeByID:
|
||||
var nodes = app.GridNodes.getNodeWithParents(request.id);
|
||||
@@ -107,16 +109,22 @@ app.Settings.init = function(callback){ // Load settings and nodes
|
||||
backgroundColor: '#3c4048',
|
||||
backgroundImage: null,
|
||||
backgroundMode: 0,
|
||||
menuShowAdd: true,
|
||||
openQuickDialInNewPage: true,
|
||||
grid: {
|
||||
margin: 10,
|
||||
rows: 4,
|
||||
columns: 5,
|
||||
ratioX: 4,
|
||||
ratioY: 3,
|
||||
backNode: true,
|
||||
backIcon: 'url(/img/back.png)',
|
||||
backIconMode: 3,
|
||||
folderIcon: 'url(/img/folder.png)',
|
||||
folderIconMode: 0,
|
||||
loadingIcon: 'url(/img/throbber.gif)',
|
||||
openBookmarkMethod: 0,
|
||||
openFolderMethod: 0,
|
||||
cells: {
|
||||
margin: 4,
|
||||
marginHover: 4,
|
||||
@@ -200,7 +208,26 @@ app.Settings.init = function(callback){ // Load settings and nodes
|
||||
}
|
||||
if(data.version == 4){ // Upgrade Data Version
|
||||
if(!data.settings.grid.cells.snapshotDelay) data.settings.grid.cells.snapshotDelay = 2000;
|
||||
//app.Settings.save();
|
||||
if(data.settings.grid.ratioAuto == true || data.settings.grid.ratioAuto == false){
|
||||
delete data.settings.grid.ratioAuto;
|
||||
data.settings.grid.ratioX = 4;
|
||||
data.settings.grid.ratioY = 3;
|
||||
}
|
||||
if(!data.settings.grid.ratioX){
|
||||
data.settings.grid.ratioX = 4;
|
||||
data.settings.grid.ratioY = 3;
|
||||
}
|
||||
if(!(data.settings.menuShowAdd == true) && !(data.settings.menuShowAdd == false)){
|
||||
data.settings.menuShowAdd = true;
|
||||
}
|
||||
if(!data.settings.grid.openBookmarkMethod && data.settings.grid.openBookmarkMethod != 0){
|
||||
data.settings.grid.openBookmarkMethod = 0;
|
||||
data.settings.grid.openFolderMethod = 0;
|
||||
}
|
||||
if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){
|
||||
data.settings.openQuickDialInNewPage = true;
|
||||
}
|
||||
//app.Settings.save();
|
||||
}
|
||||
app.settings = data.settings;
|
||||
app.node = data.node;
|
||||
@@ -218,25 +245,32 @@ app.Settings.save = function(callback){ // Save settings
|
||||
browser.storage.local.set(data).then(function(){
|
||||
if(callback) callback();
|
||||
}, function(){ console.log('Error saving settings'); });
|
||||
}
|
||||
};
|
||||
|
||||
app.init();
|
||||
|
||||
app.ContextMenus = {} // ContextMenu helper Object
|
||||
app.ContextMenus.initMenu = function(){ // (Called from app.init) Init context menu in all pages
|
||||
browser.contextMenus.create({ // Create Context menu
|
||||
id: 'AddToQuickDial',
|
||||
title: browser.i18n.getMessage("menuAddToQuickDial"),
|
||||
contexts: ["all"],
|
||||
documentUrlPatterns: [ 'http://*/*', 'https://*/*', 'file://*/*', 'ftp://*/*' ]
|
||||
}, function(){});
|
||||
browser.contextMenus.onClicked.addListener(function(info, tab) { // Context menu click event
|
||||
if (info.menuItemId == "AddToQuickDial")
|
||||
app.GridNodes.createBookmark(app.node, info.pageUrl, tab.title, function(){
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
|
||||
});
|
||||
app.ContextMenus.menuItemClicked = function(info, tab){
|
||||
if (info.menuItemId == "AddToQuickDial") app.GridNodes.createBookmark(app.node, info.pageUrl, tab.title, function(){
|
||||
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
|
||||
});
|
||||
}
|
||||
};
|
||||
app.ContextMenus.initMenu = function(){ // (Called from app.init) Init context menu in all pages
|
||||
if(app.settings.menuShowAdd){
|
||||
browser.contextMenus.create({ // Create Context menu
|
||||
id: 'AddToQuickDial',
|
||||
title: browser.i18n.getMessage("menuAddToQuickDial"),
|
||||
contexts: ["all"],
|
||||
documentUrlPatterns: [ 'http://*/*', 'https://*/*', 'file://*/*', 'ftp://*/*' ]
|
||||
}, function(){});
|
||||
browser.contextMenus.onClicked.addListener(app.ContextMenus.menuItemClicked);
|
||||
}
|
||||
};
|
||||
app.ContextMenus.updateMenu = function(){
|
||||
browser.contextMenus.onClicked.removeListener(app.ContextMenus.menuItemClicked);
|
||||
browser.contextMenus.removeAll();
|
||||
app.ContextMenus.initMenu();
|
||||
};
|
||||
|
||||
app.Bookmarks = {} // Bookmarks helper object
|
||||
app.Bookmarks._onCreated = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); }
|
||||
@@ -301,7 +335,7 @@ 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 = previewWidth / app.settings.grid.columns * app.settings.grid.rows;
|
||||
var previewHeight = previewWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
|
||||
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
@@ -368,7 +402,7 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
|
||||
}
|
||||
|
||||
var previewWidth = 1200; // Need to be linked to settings
|
||||
var previewHeight = previewWidth / app.settings.grid.columns * app.settings.grid.rows;
|
||||
var previewHeight = previewWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
|
||||
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
|
||||
var iframe;
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
@@ -413,59 +447,63 @@ app.GridNodes.sync = function(gridNode, rootPath, callback){ // Sync GridNodes w
|
||||
function syncNode(gridNode, bookmarkItem){
|
||||
gridNode.id = bookmarkItem.id;
|
||||
gridNode.title = bookmarkItem.title;
|
||||
if(bookmarkItem.url){
|
||||
gridNode.type = app.GridNodes.GridNodeType.bookmark;
|
||||
if(gridNode.url != bookmarkItem.url){
|
||||
gridNode.url = bookmarkItem.url;
|
||||
delete gridNode.image;
|
||||
}
|
||||
} else if(bookmarkItem.children){
|
||||
gridNode.type = app.GridNodes.GridNodeType.folder;
|
||||
var EmptyNodes = [];
|
||||
if(! gridNode.children) gridNode.children = [];
|
||||
else {
|
||||
for(var i=gridNode.children.length-1; i>=0; i--){
|
||||
if(!gridNode.children[i]) gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
|
||||
if(gridNode.children[i].type==app.GridNodes.GridNodeType.empty){
|
||||
EmptyNodes.unshift(gridNode.children[i]);
|
||||
} else {
|
||||
var found = false;
|
||||
for(var child of bookmarkItem.children){
|
||||
if(child.id==gridNode.children[i].id){
|
||||
found = true;
|
||||
break;
|
||||
switch(bookmarkItem.type){
|
||||
case 'bookmark':
|
||||
gridNode.type = app.GridNodes.GridNodeType.bookmark;
|
||||
if(gridNode.url != bookmarkItem.url){
|
||||
gridNode.url = bookmarkItem.url;
|
||||
delete gridNode.image;
|
||||
}
|
||||
break;
|
||||
case 'folder':
|
||||
gridNode.type = app.GridNodes.GridNodeType.folder;
|
||||
var EmptyNodes = [];
|
||||
if(! gridNode.children) gridNode.children = [];
|
||||
else {
|
||||
for(var i=gridNode.children.length-1; i>=0; i--){
|
||||
if(!gridNode.children[i]) gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
|
||||
if(gridNode.children[i].type==app.GridNodes.GridNodeType.empty){
|
||||
EmptyNodes.unshift(gridNode.children[i]);
|
||||
} else {
|
||||
var found = false;
|
||||
for(var child of bookmarkItem.children){
|
||||
if(child.id==gridNode.children[i].id){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(! found){
|
||||
if(i<gridNode.children.length - 1){
|
||||
gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
|
||||
EmptyNodes.unshift(gridNode.children[i]);
|
||||
} else {
|
||||
gridNode.children.pop();
|
||||
if(! found){
|
||||
if(i<gridNode.children.length - 1){
|
||||
gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
|
||||
EmptyNodes.unshift(gridNode.children[i]);
|
||||
} else {
|
||||
gridNode.children.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var child of bookmarkItem.children){
|
||||
var childGridNode = app.GridNodes.getChildNode(gridNode, child.id);
|
||||
if(!childGridNode){
|
||||
if(EmptyNodes.length>0){
|
||||
childGridNode = EmptyNodes[0];
|
||||
EmptyNodes.shift();
|
||||
}else {
|
||||
childGridNode = {};
|
||||
gridNode.children.push(childGridNode)
|
||||
for(var child of bookmarkItem.children){
|
||||
var childGridNode = app.GridNodes.getChildNode(gridNode, child.id);
|
||||
if(!childGridNode){
|
||||
if(EmptyNodes.length>0){
|
||||
childGridNode = EmptyNodes[0];
|
||||
EmptyNodes.shift();
|
||||
}else {
|
||||
childGridNode = {};
|
||||
gridNode.children.push(childGridNode)
|
||||
}
|
||||
}
|
||||
syncNode(childGridNode, child);
|
||||
}
|
||||
syncNode(childGridNode, child);
|
||||
}
|
||||
EmptyNodes.length = 0;
|
||||
} else {
|
||||
gridNode.type = app.GridNodes.GridNodeType.empty;
|
||||
EmptyNodes.length = 0;
|
||||
break;
|
||||
default:
|
||||
gridNode.type = app.GridNodes.GridNodeType.empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
syncNode(gridNode, bookmarkItem);
|
||||
delete app.GridNodes._syncing;
|
||||
if(app.GridNodes._needSync == true) {
|
||||
@@ -521,8 +559,14 @@ 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(value.imageLocked!=null){
|
||||
gridNode.imageLocked = value.imageLocked;
|
||||
if(value.image) gridNode.image = value.image;
|
||||
else delete gridNode.image;
|
||||
} else if(gridNode.imageLocked != true){
|
||||
if(value.image) gridNode.image = value.image;
|
||||
else delete gridNode.image;
|
||||
}
|
||||
if(value.imageMode || value.imageMode == 0) {
|
||||
if(value.imageMode == -1) delete gridNode.imageMode;
|
||||
else gridNode.imageMode = value.imageMode;
|
||||
@@ -531,24 +575,25 @@ app.GridNodes.updateNode = function(gridNode, value, callback){
|
||||
gridNode.url = value.url;
|
||||
app.GridNodes.refreshNode(gridNode, function(){
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
var data = { title: gridNode.title };
|
||||
if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
|
||||
if(gridNode.type == app.GridNodes.GridNodeType.bookmark) data.url = gridNode.url;
|
||||
//if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
|
||||
//if(gridNode.type == app.GridNodes.GridNodeType.bookmark) data.url = gridNode.url;
|
||||
data.url = gridNode.url;
|
||||
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
|
||||
browser.bookmarks.update(gridNode.id, data).then(function(){
|
||||
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
|
||||
});
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
});
|
||||
} else {
|
||||
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
var data = { title: gridNode.title };
|
||||
if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
|
||||
//if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
|
||||
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
|
||||
browser.bookmarks.update(gridNode.id, data).then(function(){
|
||||
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
|
||||
});
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
}
|
||||
}
|
||||
if(callback) callback(gridNode);
|
||||
@@ -664,12 +709,15 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.SiteInfos.fromFrame(gridNode.url, function(infos){
|
||||
if(infos){
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
if(gridNode.imageLocked!=true){
|
||||
if(infos){
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
}
|
||||
}
|
||||
|
||||
delete gridNode.__isLoading;
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
if(callback) callback(infos);
|
||||
@@ -704,11 +752,13 @@ app.GridNodes.capturePage = function(gridNode, callback){
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.SiteInfos.fromNewTab(gridNode.url, function(infos){
|
||||
if(infos){
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
if(gridNode.imageLocked!=true){
|
||||
if(infos){
|
||||
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
|
||||
gridNode.image = infos.screenshot;
|
||||
} else {
|
||||
gridNode.image = '0';
|
||||
}
|
||||
}
|
||||
delete gridNode.__isLoading;
|
||||
app.GridNodes.saveNode(gridNode);
|
||||
|
||||
@@ -415,8 +415,8 @@ dial.updateGridLayout = function(){
|
||||
var cellHeight = fullHeight / app.settings.grid.rows;
|
||||
var linkWidth = 0;
|
||||
var linkHeight = 0;
|
||||
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;
|
||||
if(cellWidth <= cellHeight * app.settings.grid.ratioX / app.settings.grid.ratioY) cellHeight = cellWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
|
||||
else cellWidth = cellHeight / app.settings.grid.ratioY * app.settings.grid.ratioX;
|
||||
linkWidth = cellWidth - 2 * (cellsMargin + 1) - 2 * borderSize;
|
||||
linkHeight = cellHeight - 2 * (cellsMargin + 1) - 2 * borderSize - titleBorderSize;
|
||||
return {
|
||||
@@ -477,6 +477,7 @@ dial.populateGrid = function(){
|
||||
link.Node = null;
|
||||
link.className = 'Empty';
|
||||
link.childNodes[0].style.backgroundImage = '';
|
||||
if(link.target) delete link.target;
|
||||
link.href = null;
|
||||
link.onclick = null;
|
||||
link.removeAttribute('contextmenu');
|
||||
@@ -486,6 +487,7 @@ dial.populateGrid = function(){
|
||||
link.className = 'Back';
|
||||
link.childNodes[0].style.backgroundImage = '';
|
||||
link.childNodes[1].innerText = 'Back';
|
||||
if(link.target) delete link.target;
|
||||
link.href = '#';
|
||||
link.onclick = function(){ window.history.back(); }
|
||||
link.removeAttribute('contextmenu');
|
||||
@@ -500,6 +502,14 @@ dial.populateGrid = function(){
|
||||
else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
|
||||
} else link.childNodes[0].style.backgroundImage = '';
|
||||
link.childNodes[1].innerText = node.title;
|
||||
switch(app.settings.grid.openFolderMethod){
|
||||
case 0:
|
||||
if(link.target) delete link.target;
|
||||
break;
|
||||
case 1:
|
||||
link.target = '_blank';
|
||||
break;
|
||||
}
|
||||
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);
|
||||
link.onclick = null;
|
||||
@@ -519,6 +529,14 @@ dial.populateGrid = function(){
|
||||
dial.refreshNode(link);
|
||||
}
|
||||
link.childNodes[1].innerText = node.title;
|
||||
switch(app.settings.grid.openBookmarkMethod){
|
||||
case 0:
|
||||
if(link.target) delete link.target;
|
||||
break;
|
||||
case 1:
|
||||
link.target = '_blank';
|
||||
break;
|
||||
}
|
||||
link.href = node.url;
|
||||
link.onclick = null;
|
||||
link.setAttribute('contextmenu', 'item');
|
||||
|
||||
@@ -26,6 +26,7 @@ app.init = function(){
|
||||
switch(node.type){
|
||||
case app.GridNodes.GridNodeType.folder:
|
||||
TitleLocked.parentNode.style.display = 'none';
|
||||
ImageLocked.parentNode.style.display = 'none';
|
||||
Url.parentNode.parentNode.style.display = 'none';
|
||||
if(node.image){
|
||||
if(node.image.indexOf('url(')>=0) Image = node.image;
|
||||
@@ -36,6 +37,7 @@ app.init = function(){
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
TitleLocked.checked = (node.titleLocked==true);
|
||||
ImageLocked.checked = (node.imageLocked==true);
|
||||
ImageDefault.style.display = 'none';
|
||||
Url.value = node.url;
|
||||
if(node.image.indexOf('url(')>=0) Image = node.image;
|
||||
@@ -102,7 +104,7 @@ app.init = function(){
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, image: Image, imageMode: +(ImageMode.value) })
|
||||
break;
|
||||
case app.GridNodes.GridNodeType.bookmark:
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, url: Url.value, image: Image, imageMode: +(ImageMode.value) })
|
||||
app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, imageLocked: ImageLocked.checked, url: Url.value, image: Image, imageMode: +(ImageMode.value) })
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ app.init = function(){
|
||||
});
|
||||
app.Messages.getSettings(function(settings){
|
||||
app.settings = settings;
|
||||
MenuShowAdd.checked = app.settings.menuShowAdd;
|
||||
BackgroundColor.value = app.settings.backgroundColor;
|
||||
BackgroundImage = app.settings.backgroundImage;
|
||||
BackgroundMode.value = app.settings.backgroundMode;
|
||||
@@ -26,10 +27,15 @@ app.init = function(){
|
||||
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
|
||||
BackgroundPreview.style.backgroundRepeat = 'no-repeat';
|
||||
BackgroundPreview.style.backgroundSize = '100% 100%';
|
||||
ButtonOpenInNewPage.checked = app.settings.openQuickDialInNewPage;
|
||||
GridRoot.value = app.settings.grid.root;
|
||||
GridRows.value = app.settings.grid.rows;
|
||||
GridRatioX.value = app.settings.grid.ratioX;
|
||||
GridRatioY.value = app.settings.grid.ratioY;
|
||||
GridMargins.value = app.settings.grid.margin;
|
||||
GridColumns.value = app.settings.grid.columns;
|
||||
GridOpenBookmarksIn.value = app.settings.grid.openBookmarkMethod;
|
||||
GridOpenFoldersIn.value = app.settings.grid.openFolderMethod;
|
||||
GridBackNode.checked = app.settings.grid.backNode;
|
||||
GridBackMode.value = app.settings.grid.backIconMode;
|
||||
GridBackImage = app.settings.grid.backIcon;
|
||||
@@ -77,12 +83,18 @@ app.init = function(){
|
||||
window.frameElement.popup.close();
|
||||
}
|
||||
BtnApply.onclick = function(){
|
||||
app.settings.menuShowAdd = MenuShowAdd.checked;
|
||||
app.settings.backgroundColor = BackgroundColor.value;
|
||||
app.settings.backgroundImage = BackgroundImage;
|
||||
app.settings.backgroundMode = +(BackgroundMode.value);
|
||||
app.settings.openQuickDialInNewPage = ButtonOpenInNewPage.checked;
|
||||
app.settings.grid.rows = +(GridRows.value);
|
||||
app.settings.grid.margin = +(GridMargins.value);
|
||||
app.settings.grid.columns = +(GridColumns.value);
|
||||
app.settings.grid.ratioX = GridRatioX.value;
|
||||
app.settings.grid.ratioY = GridRatioY.value;
|
||||
app.settings.grid.openBookmarkMethod = +(GridOpenBookmarksIn.value);
|
||||
app.settings.grid.openFolderMethod = +(GridOpenFoldersIn.value);
|
||||
app.settings.grid.backNode = GridBackNode.checked;
|
||||
app.settings.grid.backIconMode = +(GridBackMode.value);
|
||||
app.settings.grid.backIcon = GridBackImage;
|
||||
@@ -160,6 +172,19 @@ app.init = function(){
|
||||
fileReader.readAsDataURL(BackgroundImageFile.files[0]);
|
||||
}
|
||||
|
||||
GridRows.onchange = function(){
|
||||
if(GridRatioAuto.checked){
|
||||
GridRatioX.value = GridColumns.value;
|
||||
GridRatioY.value = GridRows.value;
|
||||
}
|
||||
}
|
||||
GridColumns.onchange = function(){
|
||||
if(GridRatioAuto.checked){
|
||||
GridRatioX.value = GridColumns.value;
|
||||
GridRatioY.value = GridRows.value;
|
||||
}
|
||||
}
|
||||
|
||||
GridBackImageReset.onclick = function(){
|
||||
GridBackImage = 'url(/img/back.png)';
|
||||
GridBackPreview.style.backgroundImage = GridBackImage;
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "Quick Dial",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.13",
|
||||
"author": "MatMoul",
|
||||
"homepage_url": "https://github.com/MatMoul/quickdial-webext",
|
||||
"developer": {
|
||||
"name": "MatMoul",
|
||||
"url": "https://github.com/MatMoul/quickdial-webext"
|
||||
},
|
||||
"description": "__MSG_extensionDescription__",
|
||||
|
||||
"icons": {
|
||||
"24": "img/24.png",
|
||||
|
||||
Reference in New Issue
Block a user