LoginSignup
0
0

More than 5 years have passed since last update.

firegestures 画像検索スクリプト

Last updated at Posted at 2015-07-27

var srcNode = FireGestures.sourceNode;
var imgURL = getComputedStyle(srcNode, '').getPropertyValue('background-image');

if (imgURL == 'none')
imgURL = FireGestures.getImageURL(srcNode);
else
imgURL = imgURL.replace(/"|'/g,"").replace(/url(|)$/ig, "");

if (!imgURL)
throw "Not on a image";

// check the URL is safe
FireGestures.checkURL(imgURL, srcNode.ownerDocument);

imgURL = 'http://www.google.com/searchbyimage?image_url='
+ encodeURIComponent(imgURL) + '&num=10'

// open image in new tab
var background = gPrefService.getBoolPref("browser.tabs.loadInBackground");
if (event.shiftKey || event.ctrlKey)
background = !background;
gBrowser.loadOneTab(imgURL, null, null, null, background, false);

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0