A few months ago I released an extension for Google Chrome: Niederschlagsradar.

Mit diese Extensie konnen Sie die aktuelles Vorhersage anrufen, 5 Tagen Vorhersage und auch das Niederschlagsradar mit Aktualiserung jede 5 Minuten

With Niederschlagsradar users can see the German weather forecast. The extension was commissioned by Buienradar B.V.
The extension can be downloaded from the Google Chrome Extension Gallery.

 

Create a content script and use the following piece of code:

//Create a request listener
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { 
	//Check if the requested method equals getSelection
	if (request.method == "getSelection") 
		//Send back the selected text.
		sendResponse({data: window.getSelection().toString()}); 
	else 
		//Snub them.
		sendResponse({}); 
});

This will start a request listener. With this you can send a request named getSelect from your browser_action to the content_script.

To send the getSelect request you can use the following piece of code in your browser_action.

function selectedTextPaste() { 
	//Get the current selected tab
        chrome.tabs.getSelected(null, function(tab) { 
		//Send a request to the content script of the tab with as method getSelection
                chrome.tabs.sendRequest(tab.id, {method: "getSelection"}, function(response) { 
                        //do something with response.data 
                }); 
        }); 
}

And thats all you have to do! Now you can do whatever you want with the data the browser_action has received.

 

I made another Google Chrome extension: Pastebin.com
It’s the official extension for the #1 paste tool Pastebin.com.

With this extension you can quickly paste any type of text to the website http://pastebin.com. The extension installs a small icon in your browser. When you highlight any text in Google Chrome and press the ‘Pastebin’ button, it will automatically paste the selected text into the textarea. When you press submit you will be presented with a unique URL where you can find your pasted text.

You can download the extension from the Gallery.

© 2011 Joshua Lückers Suffusion theme by Sayontan Sinha