// ==UserScript== // @name jisilux // @namespace http://tampermonkey.net/ // @version 0.22 // @description 在jsl与xueqiu同品种页面间跳转,不过从xueqiu转到jsl有地址不对的情况,因为jsl里lof\etf中包含的qdii、封基是分开的,没找到代码上的规律。凑合用啊~~ // @author 三川衡 // @license https://www.apache.org/licenses/LICENSE-2.0 // @include https://*jisilu.cn/data/* // @include https://*xueqiu.com/* // @icon https://www.jisilu.cn/favicon.ico // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict' var xqUrl = 'https://xueqiu.com/S/' var jslUrl = 'https://www.jisilu.cn/data/' var sh = /^(11|50|51|56|58|60|68|70|73|90)\d{4}$/ // 沪市证券 var sz = /^(00|08|12|15|16|20|30)\d{4}$/ // 深市证券 var bj = /^(83|87|88)\d{4}$/ //北交所 var cb = /^(110|113|123|127|128)\d{3}$/ // 可转债 var etf = /^(15|51|56|58)\d{4}$/ //这个跳到jsl会有错漏,ETF中的qdii ,jsl是分开的。没有找到分开的规律。 var stock = /^(600|601|603|688|000|002|300)\d{3}$/ //这个不知道有错漏没,没有包括北交所。 var lof = /^(16|50)\d{4}$/ //这个错的最多,qdii 封闭基金 都有可能,没有找到规律。 //prestart function purifyCode(code) { return code.replace(/[a-z]*/gi, '') } function addPrefix(code) { code = purifyCode(code) if (sh.test(code)) { return 'SH' + String(code)} else if (sz.test(code)) { return 'SZ' + String(code)} else if (bj.test(code)) { return 'BJ' + String(code)} else { return false } } function classify(code) { code = purifyCode(code) if (cb.test(code)) { return jslUrl.concat('convert_bond_detail/',code) } else if (etf.test(code)) { return jslUrl.concat('etf/detail/',code) } else if (stock.test(code)) { return jslUrl.concat('stock/detail/',code) } else if (lof.test(code)) { return jslUrl.concat('lof/detail/',code) } else { return false } } // start if (location.hostname.replace('www.', '') === 'jisilu.cn') { var codeJ = location.pathname.split('/').pop() var fullCode = addPrefix(codeJ) if (!fullCode) { return } var xqUrlDetail = xqUrl.concat(fullCode) var xq = `  ` if ( $('#compare_top').length > 0 ) { $('#compare_top > .left_title').append(xq) } if ( $('ol.breadcrumb').length > 0) { $('ol.breadcrumb > li.active').append(xq) } } if (location.hostname.replace('www.', '') === 'xueqiu.com') { if (location.pathname.match(/^\/[0-9]{10}\/[0-9]{8}/)) { [...document.querySelectorAll('div.article__container')].forEach(item=>{ item.oncopy = function(e) { e.stopPropagation() } }) $('.article__container h-char').removeClass('bd-hangable') } else if (location.pathname.match(/^\/S\//)) { var codeX = location.pathname.split('/').pop() var jslUrlDtail = classify(codeX) if (!jslUrlDtail) { return } var jsl = `  ` $('#app .stock-name').eq(0).after(jsl) } } })()