javascript-如何捕获GMail自动刷新

我写了一个userscript,以突出显示GMail中的当前行(由箭头指示).不幸的是,高亮显示将一直保留到GMail收件箱被自动刷新为止,这种情况经常发生.有没有办法赶上那个事件,以便我可以重新应用突出显示?我不想在超时时这样做.还有另一个用户脚本可以执行此操作,并且会加载cpu.

最佳答案
在我看来,您似乎想复习this document which is documentation for the Gmail gmonkey API,这是Google为油脂猴子脚本提供的API.

This page describes a userscript which monitors view changes,这应该与您所需要的非常相似.

我想你会想要这样的东西:

window.addEventListener('load',function() {
  if (unsafeWindow.gmonkey) {
    unsafeWindow.gmonkey.load('1.0',function(gmail) {
      function changedViewType() {
        // Threadlist
        if(gmail.getActiveViewType()== "tl"){
          // code to highlight the current row here...
        }
      }
      gmail.registerViewChangeCallback(changedViewType);
      changedViewType();
    });
  }
},true);

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...