// ==UserScript==
// @id mybanzou@405647825@qq.com
// @name cnki 英文版显示中文期刊页面按钮
// @version 0.4
// @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 none
// ==/UserScript==
if(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);
}
});
}