我如何在greasemonkey中使用最新的谷歌可视化API?

发布于 2024-11-10 05:30:15 字数 333 浏览 3 评论 0原文

试图让谷歌可视化API在greasemonkey(firefox)中工作,我尝试只使用:

  // @require          http://www.google.com/jsapi

google.visualization未定义

但后来我得到一个错误:添加后

//  google.load('visualization', '1', {packages: ['table']});

:我得到错误:$未定义

我需要错误的东西吗?请帮忙。

预先感谢有用的答案!

trying to get google visualisation API to work in greasemonkey (firefox) i tried to just use:

  // @require          http://www.google.com/jsapi

but then i get an Error: google.visualization is undefined

after adding:

//  google.load('visualization', '1', {packages: ['table']});

i get the Error: $ is not defined

am i requiring the wrong thing? please help.

thanks in advance for useful answers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云柯 2024-11-17 05:30:16

我对 Google Maps API 有一个类似的问题。

就我而言,我必须将 API 附加到页面

API_js_callback = "http://maps.google.com/maps/api/js?sensor=false®ion=BR&callback=initialize";

var script = document.createElement('script');
    script.src = API_js_callback;
    var head = document.getElementsByTagName("head")[0];
    (head || document.body).appendChild(script);

,并且 google 必须被称为 unsafeWindow.google,所以我添加了 google = unsafeWindow.google 也是如此。

initialize = setTimeout(function () {
    google = unsafeWindow.google;
    directionsService = new google.maps.DirectionsService();
    directionsDisplay = new google.maps.DirectionsRenderer();
    .
    .
    .

在此处查看完整的代码和说明:如何使用 google 地图 api 和 Greasemonkey 来读取地址表并跟踪路线?

i had a similar question concerning the Google Maps API.

in my case, i had to append the API to the page with

API_js_callback = "http://maps.google.com/maps/api/js?sensor=false®ion=BR&callback=initialize";

var script = document.createElement('script');
    script.src = API_js_callback;
    var head = document.getElementsByTagName("head")[0];
    (head || document.body).appendChild(script);

and google had to be called as unsafeWindow.google, so i added google = unsafeWindow.google as well.

initialize = setTimeout(function () {
    google = unsafeWindow.google;
    directionsService = new google.maps.DirectionsService();
    directionsDisplay = new google.maps.DirectionsRenderer();
    .
    .
    .

check the full code and explanation here: how to use the google maps api with greasemonkey to read a table of addresses and trace the route?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文