Mimic onclick events in Google Keep with JavaScript

可紊 提交于 2019-12-25 03:11:56

问题


Long story short, Google does not provide an API for Google Keep. So I am trying to "hack" together something that fits my needs. What I've come up with is a JavaScript userscript for Chrome that run on https://keep.google.com. The userscript would, for my needs, iterate through each note and click on the reminder button, then fill out the various parts to add a reminder.

I'm stuck on getting the click event to fire for the DIV. The HTML for a single note is below. The line that starts <div aria-label="Remind me"... is the div that a user would click on to show the reminder popup. The problem is I cannot figure out how to generate the click event such that the reminder popup shows.

<div class="IZ65Hb-n0tgWb IZ65Hb-WsjYwc-nUpftc RNfche" style="width: 240px;" tabindex="0">
    <div aria-label="Select note" class="VIpgJd-LgbsSe IZ65Hb-NGme3c" role="button" style="-webkit-user-select: none;" tabindex="0">
        <div class="IZ65Hb-NGme3c-bN97Pc"></div>
    </div>
    <div class="IZ65Hb-TBnied HLvlvd-h1U9Be" style="background-color: rgb(250, 250, 250);">
        <div class="IZ65Hb-s2gQvd">
            <div class="IZ65Hb-hYUzqc" style="height: 0px; width: 240px;"></div>
            <div class="notranslate IZ65Hb-YPqjbf r4nke-YPqjbf LwH6nd" style="display: none;">
                Title
            </div>
            <div class="notranslate IZ65Hb-YPqjbf r4nke-YPqjbf" contenteditable="false" style="display: none;"></div>
            <div class="notranslate IZ65Hb-YPqjbf h1U9Be-YPqjbf LwH6nd" style="display: none;">
                Note
            </div>
            <div class="notranslate IZ65Hb-YPqjbf h1U9Be-YPqjbf rTEl-SX9D7d-Y5a8lc" contenteditable="false">
                this is a bingo<br>
                <br>
            </div>
            <div class="IZ65Hb-x00ATb" style="display: none;"></div>
            <div class="IZ65Hb-Tswv1b">
                Edited 9:17 PM
            </div>
            <div class="IZ65Hb-kODWGd" style="display: none;"></div>
        </div>
        <div class="IZ65Hb-yePe5c">
            <div class="VIpgJd-LgbsSe fmcmS-LgbsSe IZ65Hb-iib5kc" role="button" style="-webkit-user-select: none;" tabindex="0">
                Done
            </div>
            <div class="IZ65Hb-INgbqf" role="toolbar">
                <div aria-label="Remind me" class="VIpgJd-LgbsSe Bz112c-LgbsSe zyxPWd INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
                <div aria-label="Share" class="VIpgJd-LgbsSe Bz112c-LgbsSe euCgFf INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
                <div aria-label="Change color" class="VIpgJd-LgbsSe Bz112c-LgbsSe VsHK1d INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
                <div aria-label="Add image" class="VIpgJd-LgbsSe Bz112c-LgbsSe Ge5tnd-HiaYvf INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
                <div aria-label="Archive" class="VIpgJd-LgbsSe Bz112c-LgbsSe JqEhuc INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
                <div aria-label="More" class="VIpgJd-LgbsSe Bz112c-LgbsSe xl07Ob INgbqf-LgbsSe" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
            </div>
            <div class="IZ65Hb-zyxPWd-bVEB4e" style="display: none;">
                <div class="IZ65Hb-zyxPWd-bVEB4e-V67aGc"></div>
                <div aria-label="Delete reminder" class="VIpgJd-LgbsSe Bz112c-LgbsSe IZ65Hb-zyxPWd-bVEB4e-VkLyEc" role="button" style="-webkit-user-select: none;" tabindex="0"></div>
            </div>
            <div class="s7EWJd-bVEB4e" style="display: none;"></div>
        </div>
    </div>
</div>

来源:https://stackoverflow.com/questions/34193147/mimic-onclick-events-in-google-keep-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!