使用Google协作平台的Tabletop.js

时间:2015-07-03 06:20:27

标签: javascript google-sites

我正在尝试将Tabletop.js与Google协作平台集成。这是我与桌面相关的代码:

$(function() {
    var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/SAMPLE_URL/pubhtml';

    Tabletop.init( { key: public_spreadsheet_url,
             callback: displayEntries } );
});

function displayEntries(data, tabletop) {
    var page = SitesApp.getActivePage();
    var student = page.getName();

    var entries = tabletop.sheets(student).all();
    Logger.log(entries);

    for (i=entries.length - 1; i >= 0; i--) {
        var eventname = entries[i].event;
        var judge = entries[i].judge;
        var comments = entries[i].comments;

    $('.comment-list').append('<li class="comment-entry"><span class="event">' + eventname + '</span><span class="judge">Judge: ' + judge + '</span><p class="comment-body">'+ comments + '</p></li>');
    }
}

这是我的HTML:

<div class="comments">
<ul class="comment-list">
  <!-- here is where tabletop data is inserted -->
</ul>
</div>

我已经摆弄了几个选项,包括插入HTML Box并创建一个带有Google Apps脚本的网络应用,以便在页面中嵌入小工具,但HTML Box似乎无法导入Tabletop.js脚本文件,我无法弄清楚GAS webapp路由。什么是最简单的方法来实现这一目标?

0 个答案:

没有答案