Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请求在模版中获取期刊标签影响因子的功能或方法、代码 #51

Open
Chengqixu2022 opened this issue Dec 28, 2023 · 3 comments

Comments

@Chengqixu2022
Copy link

Chengqixu2022 commented Dec 28, 2023

image

`<h1><font` size="4">${(() => {
      const titleTranslation = topItem.getField("titleTranslation");
      if (titleTranslation) {
        return `(${topItem.getField("date")}) ${topItem.getField("title")} (${titleTranslation})`;
      } else {
        return `(${topItem.getField("date")}) ${topItem.getField("title")}`;
      }
    })()}
  </h1>
  <div><strong>作者</strong>:: ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</div>
  <div><strong>出版年份</strong>:: ${topItem.getField('date')}</div>
  <div><strong>期刊</strong>:: ${topItem.getField('publicationTitle')}</div>
  <div><strong>期刊标签</strong>:: ${(() => {
              let tags = Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags(
                  "", true, true, topItem, undefined);
  			let out = " ";
  			if (!tags){
  				  out += `<span></span>`;
  			}else{
  
                const jsonStartIndex = tags.indexOf('{');
                if (jsonStartIndex !== -1) {
                  tags = tags.slice(jsonStartIndex);
                }
                let regex = /"(sci|sciif)":"([^"]+)"/g;
                let matches = tags.match(regex);
  
                const keyValuePairs = JSON.parse(tags);
                const colors = ["#b73508", "#d47828", "#f5d44b", "#afcfa6	", "#4c6643"];
  
                for (const key in keyValuePairs) {
                  if (key === "sci") {
                    out += `<span style="background-color: ${colors[0]}; margin-right: 20px; padding:5px">SCI ${keyValuePairs[key]}</span>`;
                  }
                  if (key === "sciUp") {
                    out += `<span style="background-color: ${colors[1]}; margin-right: 20px; padding:5px">中科院 ${keyValuePairs[key]}</span>`;
                  }
                  if (key === "sciif") {
                    out += `<span style="background-color: ${colors[2]}; margin-right: 20px; padding:5px">IF ${keyValuePairs[key]}</span>`;
                  }
                  if (key === "pku") {
                    out += `<span style="background-color: ${colors[3]}; margin-right: 20px; padding:5px"> 北核</span>`;
                  }
                  if (key === "cssci") {
                    out += `<span style="background-color: ${colors[4]}; margin-right: 20px; padding:5px"> ${keyValuePairs[key]}</span>`;
                  }
				  if (key === "xju") {
                out += `<span style="background-color: ${colors[4]}; margin-right: 20px;  padding:5px">  #${keyValuePairs[key]}</span>`;
              }
                }
  			}
                return out;
              })()}</div>
  <div><strong>标题翻译</strong>:: ${topItem.getField('titleTranslation')}</div>
  <div><strong>摘要翻译</strong>:: ${topItem.getField('abstractTranslation')}</div>
  <div><strong>doi</strong>:: ${topItem.getField('DOI')}</div>
  <div><strong>附件链接</strong>:: <a href="zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments())[0].key}">
                  ${Zotero.Items.get(topItem.getAttachments())[0].getFilename()}
              </a></div>
  <div><strong>创新摘要</strong>:: </div>
  
  
  <h2 style="color:  #45aab4;">📜 背景</h2>
 <hr/>
  <p></p>
  <h2 style="color:#f9637c; ">🔬 研究内容</h2>
 <hr/>
  <p></p>
  <h2 style="color:#fbb45c;">💧 数据</h2>
 <hr/>
  <p></p>
  <h2 style="color:#4f6962; ">⚙️ 方法</h2>
 <hr/>
  <p></p>
  <h2 style="color:#fbc1ad;">🚩 研究结果</h2>
 <hr/>
  <p></p>
  <h2 style="color: #006064; ">💡 创新点</h2>
 <hr/>
  <p></p>
  <h2 style="color:#fe7966;">💭 借鉴</h2>
 <hr/>
@Chengqixu2022
Copy link
Author

导入模版的时候,只有期刊标签中的数据不能获取,显示未定义,急求如何解决这个问题。

@qiushouzhao
Copy link

应该你看看你的影响因子是由哪个插件定义的吧

@Ada-2002
Copy link

请问,影响因子用哪个插件才能显示出来呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants