Google Forms 通知插件使用教程

Google Forms 通知插件使用教程

apps-script-form-notifications-addon项目地址:https://gitcode.com/gh_mirrors/ap/apps-script-form-notifications-addon

1. 项目的目录结构及介绍

apps-script-form-notifications-addon/
├── authorizationEmail.html
├── about.html
├── Code.js
├── styles.css
└── README.md
  • authorizationEmail.html: 用于授权邮件的HTML模板。
  • about.html: 关于插件的介绍页面。
  • Code.js: 插件的主要脚本文件,包含事件处理和功能实现。
  • styles.css: 插件的样式文件,用于自定义外观。
  • README.md: 项目的说明文档,包含安装和使用指南。

2. 项目的启动文件介绍

Code.js 是项目的启动文件,负责初始化插件和处理各种事件。以下是 Code.js 中的一些关键函数:

/**
 * Adds a custom menu to the active form to show the add-on sidebar
 * @param {object} e The event parameter for a simple onOpen trigger
 */
function onOpen(e) {
  FormApp.getUi()
      .createAddonMenu()
      .addItem('Configure notifications', 'showSidebar')
      .addToUi();
}

/**
 * Shows the sidebar for configuring notifications
 */
function showSidebar() {
  var ui = HtmlService.createHtmlOutputFromFile('about')
      .setTitle('Form Notifications');
  FormApp.getUi().showSidebar(ui);
}
  • onOpen(e): 在表单打开时触发,添加自定义菜单项。
  • showSidebar(): 显示配置通知的侧边栏。

3. 项目的配置文件介绍

authorizationEmail.htmlabout.html 是项目的配置文件,分别用于授权邮件和插件介绍。

authorizationEmail.html

<!DOCTYPE html>
<html>
<head>
  <base target="_top">
  <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body>
  <div>
    <p>The Google Forms add-on <i>Form Notifications</i> is set to run automatically whenever a form is submitted. The add-on was recently updated and it needs you to re-authorize it to continue working.</p>
  </div>
</body>
</html>

about.html

<!DOCTYPE html>
<html>
<head>
  <base target="_top">
  <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body>
  <div>
    <p><i>Form Notifications</i> was created as an sample add-on and is meant for demonstration purposes only. It should not be used for complex or important workflows.</p>
  </div>
</body>
</html>

这两个文件主要用于提供用户界面和授权信息,确保插件能够正常运行。

apps-script-form-notifications-addon项目地址:https://gitcode.com/gh_mirrors/ap/apps-script-form-notifications-addon

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

水优嵘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值