Skip to content

Commit

Permalink
Creada versión 2.0.0 a partir de los plugins que había en las version…
Browse files Browse the repository at this point in the history
…es anteriores
  • Loading branch information
juaalta committed May 9, 2017
1 parent 31b69df commit eae66cb
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# webextension-icono-blog
WebExtension - Icono Blog Cosillas de Juansal

Esta extensión es la evolución de las dos siguientes:
* [Addon de Firefox: Icono Blog Cosillas de Juansal](https://github.com/juaalta/firefox-addon-icono-blog)
* [Addon de Chrome: Icono Blog Cosillas de Juansal](https://github.com/juaalta/chrome-addon-icono-blog)
42 changes: 42 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"extensionName": {
"message": "Icon Blog Cosillas de Juansal",
"description": "Open a menu to access the blog directly."
},

"extensionDescription": {
"message": "Demonstrates the contextMenus API.",
"description": "Description of the add-on."
},

"contextMenuItemBlogPaginaPrincipal": {
"message": "Homepage",
"description": "Open homepage."
},

"contextMenuItemIndiceEtiqueta": {
"message": "Index by tag",
"description": "Open index by tag."
},

"contextMenuItemLinksInteresantes": {
"message": "Interesting Links",
"description": "Open interesting links."
},

"contextMenuItemDocumentosCompartidos": {
"message": "Shared Documents",
"description": "Open shared documents."
},

"contextMenuItemPluginsNavegadores": {
"message": "Browser Plugins",
"description": "Open browser plugins."
},

"contextMenuItemProyectos": {
"message": "Projects",
"description": "Open projects."
}

}
41 changes: 41 additions & 0 deletions _locales/es/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"extensionName": {
"message": "Icono Blog Cosillas de Juansal",
"description": "Abre un menú para acceder directamente al blog."
},

"extensionDescription": {
"message": "Abre un menú para acceder directamente al blog.",
"description": "Abre un menú para acceder directamente al blog."
},

"contextMenuItemBlogPaginaPrincipal": {
"message": "Página principal",
"description": "Abre la página principal."
},
"contextMenuItemIndiceEtiqueta": {
"message": "Índice por etiqueta",
"description": "Abre el índice por etiqueta."
},

"contextMenuItemLinksInteresantes": {
"message": "Links interesantes",
"description": "Abre los links interesantes."
},

"contextMenuItemDocumentosCompartidos": {
"message": "Documentos compartidos",
"description": "Abre los documentos compartidos."
},

"contextMenuItemPluginsNavegadores": {
"message": "Plugins navegadores",
"description": "Abre los plugins de navegadores."
},

"contextMenuItemProyectos": {
"message": "Proyectos",
"description": "Abre los proyectos."
}

}
120 changes: 120 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
Called when the item has been created, or when creation failed due to an error.
We'll just log success/failure here.
*/
function onCreated(n) {
if (browser.runtime.lastError) {
console.log(`Error: ${browser.runtime.lastError}`);
} else {
console.log("Item created successfully");
}
}

/*
Called when the item has been removed.
We'll just log success here.
*/
function onRemoved() {
console.log("Item removed successfully");
}

/*
Called when there was an error.
We'll just log the error here.
*/
function onError(error) {
console.log(`Error: ${error}`);
}

/*
Create all the context menu items.
*/

browser.contextMenus.create({
id: "blog_pagina_principal",
title: browser.i18n.getMessage("contextMenuItemBlogPaginaPrincipal"),
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "separator-1",
type: "separator",
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "blog_indice_etiqueta",
title: browser.i18n.getMessage("contextMenuItemIndiceEtiqueta"),
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "blog_links_interesantes",
title: browser.i18n.getMessage("contextMenuItemLinksInteresantes"),
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "blog_documentos_compartidos",
title: browser.i18n.getMessage("contextMenuItemDocumentosCompartidos"),
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "blog_plugins_navegadores",
title: browser.i18n.getMessage("contextMenuItemPluginsNavegadores"),
contexts: ["all"]
}, onCreated);

browser.contextMenus.create({
id: "blog_proyectos",
title: browser.i18n.getMessage("contextMenuItemProyectos"),
contexts: ["all"]
}, onCreated);


function onCreated(tab) {
console.log(`Created new tab: ${tab.id}`)
}

function onError(error) {
console.log(`Error: ${error}`);
}

openOnNewTab = function(linkUrl) {
console.log(linkUrl);
var creating = chrome.tabs.create({
url: linkUrl,
active: false
});

creating.then(onCreated, onError);

};

/*
The click event listener, where we perform the appropriate action given the
ID of the menu item that was clicked.
*/
browser.contextMenus.onClicked.addListener(function(info, tab) {
switch (info.menuItemId) {
case "blog_pagina_principal":
openOnNewTab("http://blog.juansal.com/");
break;
case "blog_indice_etiqueta":
openOnNewTab("http://blog.juansal.com/p/indice.html");
break;
case "blog_links_interesantes":
openOnNewTab("http://blog.juansal.com/p/links-interesantes.html");
break;
case "blog_documentos_compartidos":
openOnNewTab("http://blog.juansal.com/p/documentos-compartidos.html");
break;
case "blog_plugins_navegadores":
openOnNewTab("http://blog.juansal.com/p/plugins-de-firefox.html");
break;
case "blog_proyectos":
openOnNewTab("http://blog.juansal.com/p/proyectos.html");
break;
}
});
Binary file added icons/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon-96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{

"manifest_version": 2,
"name": "Icono Blog Cosillas de Juansal",
"description": "Abre un menú para acceder directamente a las secciones del blog.",
"version": "2.0.0",
"default_locale": "es",

"background": {
"scripts": ["background.js"]
},

"permissions": [
"contextMenus",
"activeTab",
"tabs"
],

"icons": { "16": "icons/icon16.png",
"48": "icons/icon48.png",
"96": "icons/icon96.png",
"128": "icons/icon128.png" },

"browser_action": {
"default_icon": "icons/icon.png",
"default_popup": "menu/menu.html"
}

}
60 changes: 60 additions & 0 deletions menu/menu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#menuPanel
{
background-color: #629cd1;
}

#menuv {
border: 1px solid #ACCFE8;
width: 190px;
font-family: Verdana, Geneva, sans-serif;
font-size: 80%;
font-style: normal;
line-height: normal;
}
#menuv ul, li {
list-style-type: none;
}

#menuv ul {
margin: 0;
padding: 0;
width: 185
}

#menuv li {
border: 1px solid #3d97e3;
width: 185px;
}

#menuv li ul {
margin: 0 0 0 5;
padding: 0;
width: 180px;
}

#menuv li ul li {
border: 1px solid #3d97e3;
width: 173px;
}

#menuv a {
text-decoration: none;
color: #3d97e3;
background: #d8e4ff;
display: block;
width: 177px;
padding-top: 3px;
padding-right: 6px;
padding-bottom: 3px;
padding-left: 6px;
}

#menuv li ul li a {
border: 1px solid #3d97e3;
width: 170px;
}

#menuv a:hover {
background-color: d8e4ff;
color: #666;
}
22 changes: 22 additions & 0 deletions menu/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<html>
<head>
<title>Menu Blog Cosillas de Juansal</title>
<link href="menu.css" rel="stylesheet" type="text/css">
</head>
<body id="menuPanel">
<div id="menuv">
<ul>
<li><a href="http://blog.juansal.com/" target="_blank" class="menu">P&aacute;gina principal</a></li>
<li>
<ul>
<li><a href="http://blog.juansal.com/p/indice.html" target="_blank" class="menu">&Iacute;ndice por etiqueta</a></li>
<li><a href="http://blog.juansal.com/p/links-interesantes.html" target="_blank" class="menu">Links interesantes</a></li>
<li><a href="http://blog.juansal.com/p/documentos-compartidos.html" target="_blank" class="menu">Documentos compartidos</a></li>
<li><a href="http://blog.juansal.com/p/plugins-de-firefox.html" target="_blank" class="menu">Plugins de navegadores</a></li>
<li><a href="http://blog.juansal.com/p/proyectos.html" target="_blank" class="menu">Proyectos</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>

0 comments on commit eae66cb

Please sign in to comment.