Skip to content

Instantly share code, notes, and snippets.

@forestlet
Last active February 25, 2022 03:39
Show Gist options
  • Save forestlet/eb6ece5a3d0079619a8a06776a7962a8 to your computer and use it in GitHub Desktop.
Save forestlet/eb6ece5a3d0079619a8a06776a7962a8 to your computer and use it in GitHub Desktop.
🔗 在新标签打开微信公众号文章链接
// ==UserScript==
// @name 在新标签打开微信公众号文章链接
// @description 在新标签打开微信公众号文章链接
// @author forestlet
// @copyright 2022-
// @homepageURL https://gist.github.com/forestlet/eb6ece5a3d0079619a8a06776a7962a8/
// @version 0.2
// @lastmodified 2022-02-25
// @match https://mp.weixin.qq.com/*
// @namespace http://tampermonkey.net/
// @grant none
// @icon data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2280%22>🔗</text></svg>
// ==/UserScript==
(function () {
'use strict';
// Your code here...
window.onload = function () {
let list_items = document.getElementsByClassName("weui-media-box weui-media-box_appmsg js_related_item js_wx_tap_highlight wx_tap_cell")
for (let i = 0; i < list_items.length; i++) {
let item = list_items[i]
item.onclick = (e) => {
e.preventDefault()
e.stopPropagation()
let link = item.getAttribute("data-url")
window.open(link, "_blank")
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment