John White Google Search Link

Turns company name into a Google search link.

当前为 2015-03-20 提交的版本,查看 最新版本

// ==UserScript==
// @name        John White Google Search Link
// @author      mmmturkeybacon + ScottB
// @description Turns company name into a Google search link.
// @include     https://www.mturkcontent.com*
// @require     http://code.jquery.com/jquery-latest.min.js
// @version     1.0
// @grant       none
// @namespace https://greasyfork.org/users/6129
// ==/UserScript==

{ // John White Company Search
    var company_node = $("td:contains('Company Name:')").next();
    var city_node = $("td:contains('City:')").next();
    var state_node = $("td:contains('State:')").next();

    var company_text = company_node.text().trim().replace("&", "%26");
    var city_text = city_node.text().trim().replace("None Listed", "");
    var state_text = state_node.text().trim().replace("None Listed", "");
    var google_URL = "http://www.google.com/search?q=" + company_text + " " + city_text + " " + state_text;
    google_URL = google_URL.replace(/[" "]/g, "+");
    company_node.html('<a href="' + google_URL + '" target="_blank">' + company_text + '</a>');
}