Browser Extension, Google Chrome, Google-Music-Search, Javascript

Google Chrome Extension – Google Music Search, an Omnibox extension

Adds Music Search functionality to Google Chrome, Chromium, and Comodo Dragon.

manifest.json

{
  "name": "Google Music Search",
  "description" : "To use, type 'music', a space plus a band or artist name into the Omnibox. timothytocci.com",
  "version": "0.3",
  "background": {
    "scripts": ["background.js"]
  },
  "omnibox": { "keyword" : "music" },
   "icons" : {
		"16" : "google.png",
		"32" : "peopleicon32.png",
		"48" : "peopleicon48.png",
		"128" : "peopleicon128.png"
	},
  "manifest_version": 2
}

background.js

chrome.omnibox.onInputChanged.addListener(function(text, suggest) {
	suggest( [ {
		content : text + " discography",
		description : "+Discography"
	}, {
		content : text + " greatest hits",
		description : "+Greatest Hits"
	}, {
		content : text + " album",
		description : "+Album"
	}, {
		content : text + " collection",
		description : "+Collection"
	}, {
		content : text + " compilation",
		description : "+Compilation"
	} ]);
});
chrome.omnibox.onInputEntered
		.addListener(function(text) {
			var query = 'intitle:index.of +?last modified? +?parent directory? +(mp3|wma|ogg|wav) +"' + text + '" -htm -html -php -asp -jsp -"Passwords"';
			var createProperties = {
				url : "https://www.google.com/search?q="
						+ encodeURIComponent(query)
			};
			chrome.tabs.create(createProperties);
		});
chrome.omnibox.onInputStarted
		.addListener(function() {
			var suggestion = {
				description : "Find Music by %s using Google Music Search"
			}
			chrome.omnibox.setDefaultSuggestion(suggestion);
		});

Install (you must trust my code)

If you downloaded an extension from somewhere other than Google, Chrome will not let you install it on the fly. You have to go to the browser menu and choose Tools->Extensions to open up the Extensions tab. Then drag the extension from wherever it is on the file-system to the open Extensions page. This should start the install process. If you ever feel funny about a packed extension you can unzip them to inspect the code (if you don’t have 7zip you’ll have to change the file extension to .zip – do it on a copy).

Advertisement
Standard

2 thoughts on “Google Chrome Extension – Google Music Search, an Omnibox extension

  1. Pingback: Adobe AIR Application – Google Music Search « The Coding Adventures of Timothy Tocci

  2. Excellent goods from you, man. I’ve understand your stuff previous to and you’re just too great.
    I really like what you’ve acquired here, really like what
    you’re stating and the way in which you say it. You make it enjoyable and you still care for
    to keep it wise. I cant wait to read much more from you.
    This is actually a wonderful website.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s