-
Notifications
You must be signed in to change notification settings - Fork 2
/
wechat-article-right-click.user.js
100 lines (81 loc) · 3.13 KB
/
wechat-article-right-click.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// ==UserScript==
// @name wechat-右键点击文章页蓝色公众号id 进入微信历史文章-请允许弹出窗口
// @version 0.0.2
// @description 请允许弹出窗口-右键点击文章页蓝色公众号id 进入微信历史文章
// @match *
// @include *://*.qq.com/*
// @include *://*.sogou.com/*
// @author lgh06
// @run-at document-idle
// @grant GM_xmlhttpRequest
// @connect sogou.com
// @require http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js
// ==/UserScript==
jQuery.noConflict();
(function() {
'use strict';
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function doSearch(s){
var sid = s.innerText;
console.log(sid);
console.log(11111111);
var aurl = 'http://weixin.sogou.com/weixin?type=1&query='+sid+'&ie=utf8&_sug_=n&_sug_type_=';
GM_xmlhttpRequest({
method: "GET",
url: aurl,
onload: function(response) {
var label = jQuery(response.responseText).find('.tit').get(0);
var $a = jQuery(label).find('a');
if(!$a.length) return;
window.open($a[0].href);
}
});
}
function getCount(title,sid){
var curl = 'http://weixin.sogou.com/weixin?type=2&ie=utf8&query='+title+'&tsn=0&usip='+sid+'&from=tool';
console.log(curl);
GM_xmlhttpRequest({
method: "GET",
url: curl,
onload: function(response) {
var $s1 = jQuery(response.responseText).find('span.s1');
if(!$s1.length) return;
console.log('count:'+$s1[0].innerText);
jQuery('#post-user').after('<span class="rich_media_meta rich_media_meta_text">'+'阅读'+$s1[0].innerText+'伪</span>');
}
});
}
var $ = s => document.querySelector(s);
var $$ = s => document.querySelectorAll(s);
var aaa = function(){
if(window.location.href.indexOf('mp.weixin.qq.com')>=0){
var a = $('#post-user');
if(a) {
jQuery(a).css('cursor','context-menu');
var s = $('.profile_meta_value');
jQuery('#js_profile_qrcode').click(()=>{doSearch(s);}).find('*').css('cursor','pointer');
console.log($('#post-user').innerText);
getCount($('#activity-name').innerText,s.innerText);
$('.rich_media_meta_list').addEventListener('contextmenu', function(ev) {
ev.preventDefault();
if(ev.target === a){
doSearch(s);
}
return false;
}, false);
}
console.log(9999);
}
};
setTimeout(aaa,500);
})();