Greasy Fork is available in English.
方便跳转到理性仁网站查看个股数据
当前为
// ==UserScript==
// @name 雪球助手
// @namespace http://tampermonkey.net/
// @version 0.3
// @description 方便跳转到理性仁网站查看个股数据
// @author 小紫baby
// @include /^https:\/\/xueqiu\.com.*/
// @grant none
// ==/UserScript==
/*eslint-disable*/
(function () {
'use strict';
function getMarketCode(code) {
var len = code.toString().length;
if ([5, 6].indexOf(len) === -1) {
console.warn('股票代码未知:' + code);
return;
}
if (len === 5) return 'hk';
if (code.indexOf('00') === 0) {
return 'sz';
}
if (code.indexOf('60') === 0) {
return 'sh';
}
return;
}
function getLixingrenStockPageUrl(marketCode, stockCode) {
return 'https://www.lixinger.com/analytics/company/' + marketCode + '/' + stockCode + '/detail/fundamental/value';
}
/**
* 主页自选股跳转到理性仁
*/
var linkSelector = '#optional tr.sortable a.code';
$(document.body).on('click', linkSelector, function(e) {
var href = $(this).attr('href').toLowerCase();
if (href.indexOf('www.lixinger.com') > -1) {
return;
}
var code = href.match(/\d+/);
if (code.length === 0) {
console.warn('未知信息:' + href);
return;
}
code = code[0];
var marketCode = getMarketCode(code);
$(this).attr('href', getLixingrenStockPageUrl(marketCode, code));
});
/**
* 股票页跳转到理性仁
*/
var titleSelector = '.stock-name';
$(titleSelector).after('<div style="float: left;width: 16px; height: 16px;margin: 0 16px;">' +
'<a class="lxr-icon" target="_blank"><img src="https://www.lixinger.com/static/img/favicon.ico" style="vertical-align: middle;" /></a></div>');
$('.lxr-icon').one('mouseenter', function() {
var code = location.href.match(/\d+/)[0];
var marketCode = getMarketCode(code);
$(this).attr('href', getLixingrenStockPageUrl(marketCode, code));
});
})();