Javascript 获取当前弹出窗口中事件的描述

Javascript 获取当前弹出窗口中事件的描述,javascript,google-calendar-api,tampermonkey,Javascript,Google Calendar Api,Tampermonkey,我目前正试图编写自己的tampermonkey脚本,将事件描述插入谷歌日历中的弹出窗口。编辑:点击特定事件时显示其详细信息的弹出窗口 不幸的是,Google calendars内部JS库隐藏了实际的请求/链接,所以我不知道实际执行了什么POST/GET请求,也不知道它是如何生成的——这只是javascript:void0。 因此,有三种不同的解决方案,我为每一种都提出了一个问题: 是否可以通过tampermonkey在Google日历中找到当前显示的弹出窗口的事件ID?之后,我可以使用官方的Ja

我目前正试图编写自己的tampermonkey脚本,将事件描述插入谷歌日历中的弹出窗口。编辑:点击特定事件时显示其详细信息的弹出窗口 不幸的是,Google calendars内部JS库隐藏了实际的请求/链接,所以我不知道实际执行了什么POST/GET请求,也不知道它是如何生成的——这只是javascript:void0。 因此,有三种不同的解决方案,我为每一种都提出了一个问题:

是否可以通过tampermonkey在Google日历中找到当前显示的弹出窗口的事件ID?之后,我可以使用官方的JavaScript API 是否可以在tampermonkey中克隆完整的网站上下文?这将允许我在不同的上下文中执行单击,因此在不更改当前页面的情况下,解析描述并在当前上下文中重用它。 是否有可能在合理的时间内找出javascript:void0单击以反向工程请求创建后执行的具体内容这也意味着我必须访问javascript的上下文f.e.,以获取当前事件ID。 谢谢你的回答/帮助

编辑: 我已经可以通过@grant unsafeWindow访问窗口的JS上下文,但是如果我能在上下文中的某个地方找到事件的ID,直到现在我都找不到它,我仍然需要手动调用Google Calendar API。我想知道是否有更简单的方法在当前事件弹出窗口中找到当前显示事件的描述

我当前的代码如下所示:我要阅读描述的部分用TODO标记:

// ==UserScript==
// @name         EnhanceGCal
// @version      0.1
// @description  Script to enhance the Google Calendar popup view
// @license      Apache License 2.0
// @match        https://www.google.com/calendar/*
// @grant        unsafeWindow
// @require      http://code.jquery.com/jquery-latest.js
// @require      https://apis.google.com/js/client.js?onload=checkAuth
// ==/UserScript==

console.log('Started....')

// check if the bubble is available
if (!$('.bubblecontent').length) { console.log('Nothing found...'); return; }

// Try enhance the popup everytime it is created
$('.bubblecontent').bind("DOMSubtreeModified", function() {
    var table, tbody, tr, td1, td2;
    table = document.getElementsByClassName('eb-data')[0];
    if (!table) { return; }
    tbody = table.childNodes[0];
    if (!tbody) { return; }

    if (window.currentlyEditing) { return; }
    window.currentlyEditing = true;

    // add a new table row for the description
    if (!$('#enhanceGCalDescriptionRow').length) {
        tr = document.createElement('tr');
        tr.id = 'enhanceGCalDescriptionRow';
        td1 = document.createElement('td');
        td1.innerHTML="<b>Description</b>";
        td2 = document.createElement('td');
        td2.innerHTML="Description text";
        td2.id = 'enhanceGCalDescriptionText';
        tr.appendChild(td1);

        tr.appendChild(td2);
        tbody.appendChild(tr);
    }

    // TODO read the description of the current event and set it in the new table column
    $('#enhanceGCalDescriptionText').text('Enter description of the event in the popup here...');

    window.currentlyEditing = false;
});

目前,这个问题还不清楚,范围太广,无法给出简洁的答案。澄清:谷歌日历中的弹出窗口;有很多。澄清:JS库。描述一下你做了什么,这样回答者就不会浪费时间重复同样的理由。例如,您是否使用浏览器工具检查页面并查找事件ID?您发现了什么?您可以在devtools调试器中设置一个XHR断点:F12->Sources->XHR断点右侧边栏->[x]任意XHR。或者,您可以在“网络”选项卡上查看请求,然后单击“启动器”列以打开脚本源。然后使用左下角的{}按钮来美化缩小的代码。