您好,游客!

您好,新朋友。点击以下按钮加入我们!

work on-demand

About: MyAnimeList, External Kitsu Links [Preview]
最后编辑于 November 2018 脚本讨论 Chrome

You can make it work on demand on mouseover/click.

a.onclick = a.onauxclick = a.onmouseover = function(e) {
  if (e.altKey || e.metaKey || !a.href.startsWith(location.href)) return;
  e.preventDefault();
  a['on' + e.type] = null;
  a.style.cursor = 'wait';
  App.getKitsuLink(type, id, href => {
    a.style.cursor = '';
    a.href = href;
    a.onclick = a.onauxclick = a.onmouseover = null;
    if (e.type === 'mouseover' || e.button > 1) {
      const parent = a.parentElement;
      const next = a.nextSibling;
      a.remove();
      parent.insertBefore(a, next);
      return;
    }
    const active = !e.button && (!e.ctrlKey || e.shiftKey);
    if (e.button || !active) {
      GM_openInTab(href, {active, insert: true, setParent: true});
    } else {
      location.href = href;
    }
  });
};

Unfortunately I don't think it's possible to override the wheel-click (middle-click) that opens in a background tab so I guess it's not a "production ready" feature.

话题已锁定。