Permalink
Browse files

Forward to a MetaCPAN search when search suggestions return no results

  • Loading branch information...
1 parent 89bd8c9 commit 637f9478bbc91dff3ddf60cd8f00802f067e624d @wata committed Oct 5, 2011
Showing with 9 additions and 3 deletions.
  1. +8 −2 background.js
  2. +1 −1 manifest.json
View
@@ -54,7 +54,13 @@ function getSuggestions(text){
*/
function searchOnCPAN(text){
var obj = getSuggestions(text);
- var path = text == obj[0].documentation ? '/module/' : '/search?q=';
+ var path;
+ if (obj.length && obj[0].documentation == text) {
+ path = '/module/';
+ }
+ else {
+ path = '/search?q=';
+ }
var target_url = encodeURI(cpan_url + path + text);
selectOrCreateTab(target_url);
}
@@ -101,7 +107,7 @@ function loadFeed() {
entry.content.match(/img src="([^"]+)"/);
var img_url = RegExp.$1;
if (settings.notify) {
- //Fetch favorite modules and authors
+ //Fetch keywords
if (!settings.all && settings.favorites.length) {
for (var j= 0; j < settings.favorites.length; j++) {
var re = new RegExp(settings.favorites[j], "i");
View
@@ -1,6 +1,6 @@
{
"name": "CPAN Helper",
- "version": "0.2",
+ "version": "0.3",
"description": "Tiny helper extension for CPAN",
"icons": {
"16": "icon_16.png",

0 comments on commit 637f947

Please sign in to comment.