// ==UserScript== // @id mybanzou@405647825@qq.com // @name cnki 英文版显示中文期刊页面按钮 // @version 0.5 // @author 405647825@qq.com // @namespace http://weibo.com/pendave // @description cnki 英文版显示对应中文期刊页面按钮 // @include *en.cnki.com.cn/Article_en/* // @include *navi.cnki.net/KNavi/JournalDetail* // @include *navi.cnki.net/knavi/JournalDetail/GetArticleList* // @require https://cdn.jsdelivr.net/clipboard.js/1.5.13/clipboard.min.js // @grant GM_xmlhttpRequest // @downloadURL https://update.greasyfork.icu/scripts/28734/cnki%20%E8%8B%B1%E6%96%87%E7%89%88%E6%98%BE%E7%A4%BA%E4%B8%AD%E6%96%87%E6%9C%9F%E5%88%8A%E9%A1%B5%E9%9D%A2%E6%8C%89%E9%92%AE.user.js // @updateURL https://update.greasyfork.icu/scripts/28734/cnki%20%E8%8B%B1%E6%96%87%E7%89%88%E6%98%BE%E7%A4%BA%E4%B8%AD%E6%96%87%E6%9C%9F%E5%88%8A%E9%A1%B5%E9%9D%A2%E6%8C%89%E9%92%AE.meta.js // ==/UserScript== if(location.href.indexOf('en.cnki.com.cn/Article_en') != -1 || location.href.indexOf('en.cnki.com.cn/article_en') != -1){ //获取对应中文版面 var cnPageUrl = location.href.replace(/_?en\.?/g,''); var cnMagButton = ' ➽ '; document.body.innerHTML += '
' + cnMagButton + '
'; document.querySelector('#mycnArtBtn').onclick = function(){ window.open(cnPageUrl); }; var ret = GM_xmlhttpRequest({ method: "GET", //url: cnNaviPageUrl, url: cnPageUrl, onload: function(responseDetails) { //var pat = filename + "','(.+)(?=\\.journalname)"; //var titleNameData = responseDetails.responseText.match(pat, "g"); //var art_title = titleNameData[0].split("','")[1].split(".")[0]; //var art_author = titleNameData[0].split("','")[1].split(".")[1].replace(/[,:';"<>]/gi,' '); var art_title = responseDetails.responseText.match(/xx_title">.+<\/h1>/g)[0].replace(/xx_title">|<\/h1>/g,''); var art_author = responseDetails.responseText.match(/height:30px;">.+<\/div>/g)[0].replace(/height:30px;">||<\/a>| |<\/div>/g,'').replace(/\s{2}/g,' '); var firstAuthor = art_author.split(' ')[0]; console.info(art_title); console.info(art_author); //显示该文章在cnki或者万方或者维普里是否有 var newAppend = '
' + '
' + '
'; document.querySelector('h2').outerHTML += ('
'+ art_title + '
' + art_author + '
' + newAppend); } }); }