问题标签 [google-sites-2016]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
80 浏览

google-drive-api - 在谷歌网站中嵌入 Altair html,如何使用私人谷歌驱动器链接“mark_image”?

我正在尝试将使用的交互式绘图嵌入Altair到 google-site 中。在此图中,我想一次以交互方式显示存储在 google-drive 上的图像。当我尝试这样做时,mark_image默默地失败了,大概是因为它没有读取图像。这并不奇怪,因为 google-drive 图像是私有的。使用公开共享的图像,我不会遇到这个问题。出于此情节的目的,我想将图像保密。另外,总共有很多图像(~1K),所以我可能不应该将它们编码为数据/字节。我怀疑这可能会使我的 HTML 文件变得又大又慢。如果我对此有误,请纠正我。

我想知道是否mark_image可以从 google-drive 链接读取图像,可能使用某种“阅读器”(上游 JS 或 python 库),然后将读取的图像提供给mark_image. 如果有人有这方面的经验,解决方案/建议/解决方法将非常有帮助。

这是一个演示代码来测试这个:

案例 1:可公开访问的图像(没问题)。使用 显示mark_image,以 HTML 格式保存。

在此处输入图像描述

然后我使用此选项将 HTML 嵌入到谷歌站点(私有,不向公众共享)中,在此处输入图像描述然后将 HTML 文件的内容粘贴到Embed code选项卡中。

案例 2:Google 驱动器上的图像(问题!)。存储在谷歌驱动器上的图像的情况(私人,不向公众共享)。

在这种情况下,显然mark_image会默默地失败,并且图像不会显示在图上。​</p>

0 投票
1 回答
133 浏览

html - 为什么使用 Altair(vega-lite)制作的 google 驱动器中的图像未通过嵌入的 html 显示在 google 网站上

当我像这样嵌入时,我很难理解为什么来自谷歌驱动器(私人或共享给公共)的图像会毫无问题地显示在谷歌网站上:

在这里,谷歌驱动器上的图像存储在https://drive.google.com/uc?export=view&id=0B6wwyazyzml-OGQ3VUo0Z2thdmc并公开共享。图像的文件 ID 是0B6wwyazyzml-OGQ3VUo0Z2thdmc.

由于图像显示,这意味着从谷歌网站上的谷歌驱动器读取图像是可能的。

但是当我使用(Vega-lite)生成一个 html 时Altair,使用以下最少的代码:

html的内容:

图像未显示。

在此处输入图像描述

我想知道为什么会这样。

为了快速诊断,我查看了 vega-editor 的 LOGS 选项卡。在那里我看到了这个错误:[Error] Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state.

0 投票
0 回答
19 浏览

html - How do I centre the content of an iframe inside Google Sites?

I need to embed a linked, non-editable table from Google Sheets in Google Sites, and I've made some progress, but there three issues I cannot resolve. Please note - this is very specific to Google and I have many restrictions on my corporate instance.

Everything in the following code works the way I expect, but I can't figure out how to resolve the last three items listed below.

How do I get the iframe to:

  • centre on the Google Site page no matter the browser (i.e. desktop vs device) (Problem A),
  • centre the content inside the iframe, instead of cramming it into the top left corner (B),
  • stop showing the title of the Google Sheet and Tab (C)?

Image of test iframe on throwaway Google Site

I have tried using div containers, position: absolute, left, right, top, bottom, margins, title=false, inline-block, etc., with no luck. I'm not even sure what kind of language I can use, since most HTML doesn't even seem to work - and if it does, I have to adapt the punctuation - and CSS definitely doesn't work.

Link to site: Link to Throwaway Site

0 投票
2 回答
105 浏览

javascript - 如何在第三方javascript代码(freshchat)加载之前将参数传递给谷歌应用程序中为新谷歌网站构建的聊天前表单

客观的:

在 google 应用程序脚本中构建一个 prechat 表单,以便可以在 google 站点中将其用作 web 应用程序,这样它就可以获取用户的姓名、姓氏、电话和电子邮件,并将这些参数传递给freshchat javascript 片段,以便在启动聊天时,用户的信息可以在freshchat工具中看到。

索引.html

index_js

代码.gs

问题:

问题是我不知道如何让freshchat函数只有在我用表单中的输入数据填充全局变量后才能启动。如果我在该区域内手动输入数据,window.fcWidget.init({...})它会很好地工作,但我不确定如何在单击按钮时以编程方式进行操作。

咨询的消息来源:

谢谢你。

0 投票
0 回答
9 浏览

html - 如何为新的 Google 协作平台创建专业(响应式)“联系我们”页面(论坛)

我想为我的新 Google 协作平台创建一个专业的+响应式“联系我们”页面,让它看起来更专业。我知道如何创建 Google 表单,现在我已经在我的 Google 站点中创建了一个 Google 表单,但它显示了侧边栏,我不喜欢并且看起来不专业。我想创建一个专业的“联系我们”页面,我可以在其中更改配色方案并且没有侧边栏。

也有可能在谷歌表单中得到回复,或者我可以说,我想在后端使用谷歌表单?