-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1、支持Zotero6 (1)去掉图片压缩 (2)去掉笔记行间距 (3)去掉笔记段间距 (4)去掉更换笔记背景 2、默认卡模版的标题改为标题1 3、添加调整浮动窗口设置高度 4、添加批量建卡 5、添加笔记源代码
- Loading branch information
Showing
15 changed files
with
414 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright 2021 018. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
'use strict'; | ||
/* global window, document, Components */ | ||
/* global Zotero, ZoteroPane, ZOTERO_CONFIG */ | ||
Components.utils.import('resource://gre/modules/Services.jsm'); | ||
|
||
var io = window.arguments && window.arguments.length > 0 ? window.arguments[0] : { dataIn: [] } | ||
|
||
io = Object.assign(io, { dataOut: false }) | ||
|
||
function onload () { | ||
io.dataIn.items.forEach((element, index) => { | ||
let label = document.createElement('label') | ||
label.setAttribute('value', `${element.label}数量:`) | ||
document.getElementById('groupbox').appendChild(label) | ||
let textbox = document.createElement('textbox') | ||
textbox.setAttribute('id', element.id) | ||
textbox.setAttribute('item-index', index) | ||
textbox.setAttribute('value', element.value || '') | ||
textbox.setAttribute('flex', '1') | ||
document.getElementById('groupbox').appendChild(textbox) | ||
}) | ||
window.sizeToContent() | ||
} | ||
|
||
function ok () { | ||
var dataOut = [] | ||
document.querySelectorAll('#groupbox textbox').forEach(textbox => { | ||
if (textbox.value.length > 0) { | ||
if (textbox.value.match(/\D/g)) { | ||
Zotero.ZotCard.Utils.warning('请正确输入数量。') | ||
textbox.focus() | ||
} else { | ||
let index = parseInt(textbox.getAttribute('item-index')) | ||
io.dataIn.items[index].value = parseInt(textbox.value) | ||
dataOut.push(io.dataIn.items[index]) | ||
} | ||
} | ||
}) | ||
if (dataOut) { | ||
io.dataOut = dataOut | ||
window.close() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!-- | ||
/* Copyright 2021 018. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
--> | ||
|
||
<?xml-stylesheet href="chrome://zoterozotcard/skin/dialog.css" type="text/css"?> | ||
<!DOCTYPE window SYSTEM "chrome://zoterozotcard/locale/overlay.dtd"> | ||
|
||
<dialog | ||
id="zotcard-batchnewcard" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | ||
orient="vertical" | ||
buttons="accept,cancel" | ||
ondialogaccept="ok();return false;" | ||
ondialogcancel="window.close();return true;" | ||
onload="onload()" | ||
flex="1" | ||
title="&zotero.zotcard.batchnewcard.title;" | ||
width="200" | ||
height="100"> | ||
|
||
<script src="chrome://zotero/content/include.js"/> | ||
<script src="chrome://zoterozotcard/content/batchnewcard.js"/> | ||
|
||
<groupbox id="groupbox" orient="vertical"> | ||
</groupbox> | ||
</dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* Copyright 2021 018. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
'use strict'; | ||
/* global window, document, Components */ | ||
/* global Zotero, ZoteroPane, ZOTERO_CONFIG */ | ||
Components.utils.import('resource://gre/modules/Services.jsm'); | ||
|
||
var io = window.arguments && window.arguments.length > 0 ? window.arguments[0] : { dataIn: [] } | ||
|
||
io = Object.assign(io, { dataOut: false }) | ||
var id = io.dataIn | ||
let note = Zotero.Items.get(id) | ||
|
||
function onload () { | ||
if (note) { | ||
document.getElementById('textbox').value = note.getNote() | ||
window.sizeToContent() | ||
} else { | ||
Zotero.ZotCard.Utils.warning('错误的笔记id。') | ||
window.close() | ||
} | ||
} | ||
|
||
async function ok () { | ||
note.setNote(document.getElementById('textbox').value) | ||
await note.saveTx() | ||
|
||
io.dataOut = true | ||
window.close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!-- | ||
/* Copyright 2021 018. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
--> | ||
|
||
<?xml-stylesheet href="chrome://zoterozotcard/skin/dialog.css" type="text/css"?> | ||
<!DOCTYPE window SYSTEM "chrome://zoterozotcard/locale/overlay.dtd"> | ||
|
||
<dialog | ||
id="zotcard-batchnewcard" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | ||
orient="vertical" | ||
buttons="accept,cancel" | ||
ondialogaccept="ok();return false;" | ||
ondialogcancel="window.close();return true;" | ||
onload="onload()" | ||
flex="1" | ||
title="&zotero.zotcard.batchnewcard.title;" | ||
width="800" | ||
height="600"> | ||
|
||
<script src="chrome://zotero/content/include.js"/> | ||
<script src="chrome://zoterozotcard/content/notesourcecode.js"/> | ||
|
||
<groupbox id="groupbox" orient="vertical"> | ||
<textbox id="textbox" multiline="true" flex="1" height="680" /> | ||
</groupbox> | ||
</dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.