万方数据 根据论文信息整理出引用字符串

万方数据 根据论文信息整理出引用字符串(暂时只有期刊),未解决页数的读取,需要自行去论文利查找填写。

目前為 2020-06-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name         万方数据 根据论文信息整理出引用字符串
// @namespace    http://elib.ecnudec.com/
// @version      0.12
// @description  万方数据 根据论文信息整理出引用字符串(暂时只有期刊),未解决页数的读取,需要自行去论文利查找填写。
// @author       Shining77
// @match        *://elib.ecnudec.com/*
// @include      *://elib.ecnudec.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // 许光建, 魏义方, 戴李元,等. 中国城市住房价格变动影响因素分析[J]. 经济理论与经济管理, 2010(8):5-14.
    // 作者.题(篇)名[J].刊名.出版年(卷号):起止页.,
    let authors = '';
    let title = '';
    let type = '';
    let journal = '';
    let year = '';
    let yearAndNumber = '';
    let startPage = 0;
    let endPage = 0;

    let authorsList = [];
    document.querySelectorAll('.author_td a').forEach(author => authorsList.push(author.innerText));
    if (authorsList.length > 3) {
        authors = `${authorsList.slice(0,3).join(', ')}等`;
    } else {
        authors = `${authorsList.slice(0,3).join(', ')}`;
    }
    title = document.getElementById('title0').innerText;
    type = 'J';

    document.querySelectorAll('tr').forEach(tr => {
        let label = tr.querySelector('th t') && tr.querySelector('th t').innerText.replace(/ |:|:/g, '');
        if (label === '刊名') {
            journal = tr.querySelector('td').innerText.trim();
        }
        if (label === '年,卷(期)') {
            yearAndNumber = tr.querySelector('td a').innerText.replace(/ | |:|:/g, '');
        }
    });

    let qouteString = `${authors}. ${title}[${type}]. ${journal}, ${yearAndNumber}:${startPage}-${endPage}.`;
    let qouteNode = document.createElement('div');
    qouteNode.innerText = qouteString;
    qouteNode.setAttribute("style", "margin: 20px 0;background-color: yellow");

    let targetElement = document.querySelectorAll('.abstract_dl')[0];
    targetElement.parentNode.insertBefore(qouteNode, targetElement);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址