Google Apps脚本:如何在HtmlService中使用js库 [英] Google Apps Script: How can use js library in HtmlService

查看:105
本文介绍了Google Apps脚本:如何在HtmlService中使用js库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google Apps脚本在Google网站中制作轮播。该轮播包括可动态更改的文本消息。我正在使用jquery来实现这一点,但GAS HtmlService API无法评估该js脚本文件。

我用 http://flexslider.com 在我的旋转木马应用。但它不工作。
我也尝试过caja操场,但它没有传送带执行js文件。
我将所有需要的js文件上传到Google云端存储并公开发布。

 < script type =text / javascriptsrc =http://commondatastorage.googleapis.com/shCore.js>< / script> 
< script type =text / javascriptsrc =http://commondatastorage.googleapis.com/shBrushXml.js>< / script>
< script type =text / javascriptsrc =http://commondatastorage.googleapis.com/shBrushJScript.js>< / script>

<! - 可选的FlexSlider附件 - >
< script src =http://commondatastorage.googleapis.com/jquery.easing.js>< / script>
< script src =http://commondatastorage.googleapis.com/jquery.mousewheel.js>< / script>
< script defer src =http://commondatastorage.googleapis.com/demo.js>< / script>

有什么建议可以实现这个功能?

解决方案

这是因为Caja会清理脚本并过滤来自js的一些代码。
查看此处获取详细信息。



或者,您可以使用Google Drive Webhost发布您的轮播,然后使用公开的iFrame小工具将其嵌入Google网站。
在此处查看类似演示
https:// sites。 google.com/site/appsdatepicker/test-page-2


I am trying to make carousel in google site using Google Apps Script. This carousel includes text messages that would be changed dynamically. I am using jquery to implement this but GAS HtmlService api is not able to evalute that js script files.

I used http://flexslider.com carousel in my application. But its not working. I also tried with caja playground but it does not have carousel implementation js file. I upload all required js files to google cloud storage and made them public.

 <script type="text/javascript" src="http://commondatastorage.googleapis.com/shCore.js"></script>
 <script type="text/javascript" src="http://commondatastorage.googleapis.com/shBrushXml.js"></script>
<script type="text/javascript" src="http://commondatastorage.googleapis.com/shBrushJScript.js"></script>

 <!-- Optional FlexSlider Additions -->
<script src="http://commondatastorage.googleapis.com/jquery.easing.js"></script>
<script src="http://commondatastorage.googleapis.com/jquery.mousewheel.js"></script>
<script defer src="http://commondatastorage.googleapis.com/demo.js"></script>

Any suggestion to implement this?

解决方案

It is because of Caja which sanitizes the script and filters some of the code from your js. Check here for details.

Alternatively, you can use Google Drive Webhost to publish your carousel and then embed it in Google Site using publicly available iFrame gadget. Check a similar demo here https://sites.google.com/site/appsdatepicker/test-page-2

这篇关于Google Apps脚本:如何在HtmlService中使用js库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆