├── .gitignore ├── 01set-item-language-to-en-if-this-field-is-empty.js ├── 02-1change-the-article-title-to-title-format.js ├── 02change-the-item-title-to-sentence-case.js ├── 03empty-the-extra-field.js ├── 04delete-the-attachment-files-after-the-items-have-been-removed-when-zotfile-was-installed.js ├── 05delete-the-addachments-when-the-items-were-removed.js ├── 06change-the-authors-case-to-title-case.js ├── 07batch-merge-duplicates.js ├── 08back-up-profile-and-data.js ├── 09delete-item(s)-snapshots.js ├── 10add-bold-tag-around-author.js ├── 11del-all-the-attachment(s)-of-item(s).js ├── 12copy-zotero-template-to-word-startup-directory.js ├── 13.1chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js ├── 13chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js ├── 14extra-replace-citations.js ├── 15swap-author-first-last-names.js ├── 16copy-creators-to-clipboard.js ├── 17.1change-item-title-to-title-case.js ├── 17change-item-title-to-title-case.js ├── 18change-item-title-to-upper-case.js ├── 19add-or-remove-space-before-start-in-author.js ├── 20empty-abstract.js ├── 21export-all-notes.js ├── 22auto-scroll-thumbnail.js ├── 23copy-publication-title-to-journal-abbreviation.js ├── 24remove-starting-zotero-in-issue.js ├── 25empty-deleted-collections.js ├── 26change-item-type.js ├── 27remove-extra-space-in-abstract.js ├── 28remove-extra-enter-in-abstract.js ├── 29batch_set_sup_sub_in_title.js ├── 30change-publication-title-to-title-case.js ├── LICENSE ├── README.md └── img ├── runJS.png └── runJSCode.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Build and Release Folders 2 | bin-debug/ 3 | bin-release/ 4 | [Oo]bj/ 5 | [Bb]in/ 6 | 7 | # Other files and folders 8 | .settings/ 9 | 10 | # Executables 11 | *.swf 12 | *.air 13 | *.ipa 14 | *.apk 15 | 16 | # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` 17 | # should NOT be excluded as they contain compiler settings and other important 18 | # information for Eclipse / Flash Builder. 19 | -------------------------------------------------------------------------------- /01set-item-language-to-en-if-this-field-is-empty.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | var rn=0; // //计数替换条目个数 4 | var lan="en"; //替换的语言 5 | for (item of items) { 6 | var la = item.getField("language"); 7 | if (la=="") //如果为空则替换 8 | {item.setField("language", lan); 9 | rn+=1; 10 | await item.saveTx(); 11 | } 12 | 13 | } 14 | return rn+"个条目语言被替换为"+lan+"。" 15 | -------------------------------------------------------------------------------- /02-1change-the-article-title-to-title-format.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | var result = ''; 4 | for (item of items) { 5 | var title = item.getField('title'); 6 | result += ' ' + title + '\n'; 7 | var new_title = title.replace(/\b([A-Z][a-z0-9]+|A)\b/g, function (x) { 8 | return x.toLowerCase(); 9 | }); 10 | new_title = new_title.replace(/(^|\?\s*)[a-z]/, function (x) { 11 | return x.toUpperCase(); 12 | }); 13 | new_title = new_title.replace( 14 | /([?:\"\“]\s*)([a-zA-Z0-9]+)(\s*)/g, 15 | function (x, p1, p2, p3) { 16 | return p1 + p2.slice(0, 1).toUpperCase() + p2.slice(1) + p3; 17 | } 18 | ); 19 | result += '-> ' + new_title + '\n\n'; 20 | // // Do it at your own risk 21 | item.setField('title', new_title); 22 | await item.saveTx(); 23 | } 24 | return result; 25 | -------------------------------------------------------------------------------- /02change-the-item-title-to-sentence-case.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | var result = ""; 4 | for (item of items) { 5 | var title = item.getField('title'); 6 | result += " " + title + "\n"; 7 | var new_title = title.replace(/\b([A-Z][a-z0-9]+|A)\b/g, function (x) { return x.toLowerCase(); }); 8 | new_title = new_title.replace(/(^|\?\s*)[a-z]/, function (x) { return x.toUpperCase(); }); 9 | result += "-> " + new_title + "\n\n"; 10 | // // Do it at your own risk 11 | item.setField('title', new_title); 12 | await item.saveTx(); 13 | } 14 | return result; 15 | -------------------------------------------------------------------------------- /03empty-the-extra-field.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | for (item of items) { 4 | item.setField("extra", ""); 5 | await item.saveTx(); 6 | } 7 | //alert("Extra已清除完成") 8 | return "Extra已清除完成"; 9 | -------------------------------------------------------------------------------- /04delete-the-attachment-files-after-the-items-have-been-removed-when-zotfile-was-installed.js: -------------------------------------------------------------------------------- 1 | //加入提醒 20210310 2 | var truthBeTold = window.confirm("所有附件的清理不可恢复,单击“确定”继续。单击“取消”停止。") 3 | if (truthBeTold) { 4 | //清理zotfile目录 5 | var AllFiles = []; //现在库中所有的文件 6 | var DirFiles = []; //当前文件夹中的文件 7 | var DelFileNum = 0; //被清理的文件个数 8 | var path = Zotero.ZotFile.getPref("dest_dir") //得到zotfile目录 9 | var FullPath ='' //文件的完整路径 10 | var OutText="";//供输出的文本,主要用于换行 11 | //得到当前库中的附件 12 | var s = new Zotero.Search(); 13 | s.libraryID = Zotero.Libraries.userLibraryID; 14 | var results = await s.search(); 15 | var items = await Zotero.Items.getAsync(results); 16 | for (let item of items){ 17 | let file = await getFilePath(item); 18 | if (file){ 19 | AllFiles.push(OS.Path.basename(file));//只存入文件名 20 | } 21 | } 22 | 23 | //得到ZotFile目录中的文件 24 | await Zotero.File.iterateDirectory(path, async function(entry){ 25 | if (!entry.isDir) { 26 | DirFiles.push(entry.name); 27 | } 28 | }); 29 | 30 | //判断是否在库的文件中 31 | for (let DirFile of DirFiles){ 32 | if (AllFiles.indexOf(DirFile)==-1){ 33 | DelFileNum += 1;//计数器加1 34 | FullPath = OS.Path.join(path, DirFile); 35 | OutText += DelFileNum + ": "+ DirFile + "\n" 36 | await OS.File.remove(FullPath); //删除文件 37 | } 38 | } 39 | alert(DelFileNum + "个文件被清理。\n 被清理的文件:\n" + OutText); 40 | async function getFilePath(item) { //1 函数 41 | if (item && !item.isNote()) { //2 if 42 | if (item.isRegularItem()) { // Regular Item 一般条目//3 if 43 | let attachmentIDs = item.getAttachments(); 44 | for (let id of attachmentIDs) { //4 for 45 | var file = await Zotero.Items.get(id).getFilePathAsync(); 46 | return file; 47 | } //4 for 48 | } // 3 if 49 | if (item.isAttachment()) { //附件条目 5 if 50 | var file = await item.getFilePathAsync(); 51 | return file; 52 | }//5if 53 | } //2 if 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /05delete-the-addachments-when-the-items-were-removed.js: -------------------------------------------------------------------------------- 1 | //20210320 2 | //添加如果文件在storage中,同时删除文件夹 3 | //删除条目的同时删除附件 4 | var zfPath = Zotero.ZotFile.getPref("dest_dir"); //得到zotfile路径 5 | var DelItems = []; //删除的条目 6 | var zoteroPane = Zotero.getActiveZoteroPane(); 7 | var items = zoteroPane.getSelectedItems(); 8 | for (let item of items) { // 1 for 9 | title = item.getField('title'); 10 | DelItems.push(title); 11 | file = await getFilePath(item); //调用函数得到文件路径 12 | if (file){ 13 | var filePath = OS.Path.dirname(file); //得到文件存放的文件夹 14 | if (filePath != zfPath){ //如果两个文件夹不一致,文件可能存在storage中 15 | await OS.File.removeDir(filePath) //删除文件夹 16 | } 17 | await OS.File.remove(file); //删除文件 18 | } 19 | item.deleted = true; //删除条目 20 | await item.saveTx(); 21 | 22 | }// 1 for 23 | 24 | alert(DelItems + "\n " + DelItems.length + "个条目(包括附件)已经被删除。") 25 | 26 | async function getFilePath(item) { //1 函数 得到文件路径 27 | 28 | if (item && !item.isNote()) { //2 if 29 | 30 | if (item.isRegularItem()) { // Regular Item 一般条目//3 if 31 | 32 | let attachmentIDs = item.getAttachments(); 33 | for (let id of attachmentIDs) { //4 for 34 | var file = await Zotero.Items.get(id).getFilePathAsync(); 35 | return file; 36 | } //4 for 37 | } // 3 if 38 | if (item.isAttachment()) { //附件条目 5 if 39 | var file = await item.getFilePathAsync(); 40 | return file; 41 | }//5if 42 | } //2 if 43 | 44 | } -------------------------------------------------------------------------------- /06change-the-authors-case-to-title-case.js: -------------------------------------------------------------------------------- 1 |  2 | var newFieldMode = 0; // 0: two-field, 1: one-field (with empty first name) 3 | var s = new Zotero.Search(); 4 | s.libraryID = ZoteroPane.getSelectedLibraryID(); 5 | var tagName = 'try'; //需要提前将需要修改的项目添加标签 6 | s.addCondition('tag', 'is', tagName); 7 | //s.addCondition('creator', 'is', oldName); 8 | 9 | var ids = await s.search(); 10 | if (!ids.length) { 11 | return "No items found"; 12 | } 13 | 14 | await Zotero.DB.executeTransaction(async function () { 15 | for (let id of ids) { 16 | var item = await Zotero.Items.getAsync(id); 17 | var creators = item.getCreators(); 18 | 19 | let newCreators = []; 20 | for (let creator of creators) { 21 | creator.firstName = titleCase(creator.firstName.trim()); 22 | creator.lastName = titleCase(creator.lastName.trim()); 23 | creator.fieldMode = newFieldMode; 24 | newCreators.push(creator); 25 | } 26 | item.setCreators(newCreators); 27 | await item.save(); 28 | } 29 | 30 | }); 31 | return ids.length + "个条目作者变为作者首字母大写。"; 32 | 33 | 34 | function titleCase(str) { var newStr = str.split(" "); for(var i = 0; i setTimeout(r, 1000)); 7 | DupPane[0].mergeSelectedItems(); 8 | Zotero_Duplicates_Pane.merge(); 9 | } -------------------------------------------------------------------------------- /08back-up-profile-and-data.js: -------------------------------------------------------------------------------- 1 | const { OS } = ChromeUtils.importESModule("chrome://zotero/content/osfile.mjs"); 2 | var user_path = 'f:\\backup'; // 用户指定备份目录 3 | var cur_date = new Date().toISOString().split('T')[0]; // 返回当前日期 4 | var back_path = OS.Path.join(user_path, cur_date); // 将用户目录与当前日期目录组合 5 | var profile = Zotero.Profile.dir; // 配置目录 6 | var data = Zotero.DataDirectory.dir;// 数据目录 7 | var back_path_profile = OS.Path.join(back_path, 'profile'); // 配置备份目录 8 | var back_path_data = OS.Path.join(back_path, 'data');// 数据备份目录 9 | var zotero_profile_ini_back = OS.Path.join(back_path, "zotero_profile_ini"); 10 | var jurism_profile_ini_back = OS.Path.join(back_path, "jurism_profile_ini"); 11 | if (await OS.File.exists(back_path)){ 12 | var truthBeTold = window.confirm('备份目录:' + 13 | back_path + ' 已存在,' + '单击 “OK” 覆盖。单击“Cancel”停止。') 14 | if (truthBeTold) { 15 | back_up(); 16 | } 17 | } else { 18 | back_up(); 19 | } 20 | 21 | 22 | // 备份函数数据、profile和profiles.ini 23 | async function back_up (){ 24 | const { OS } = ChromeUtils.importESModule("chrome://zotero/content/osfile.mjs"); 25 | await make_dir(user_path); 26 | await make_dir(back_path); 27 | await make_dir(back_path_profile); // 新建目录 28 | await make_dir(back_path_data); // 新建目录 29 | 30 | 31 | await Zotero.File.copyDirectory(data, back_path_data); // 备份数据 32 | //await Zotero.File.copyDirectory(profile, back_path_profile); 33 | await Zotero.File.iterateDirectory(profile, async function(entry){ //备份profile 34 | if (entry.name != "parent.lock") { // 不为parent.lock则复制 35 | var dest_profile = OS.Path.join(back_path_profile, entry.name) 36 | if (entry.isDir) { 37 | Zotero.File.copyDirectory(entry.path, dest_profile); 38 | } else { 39 | OS.File.copy(entry.path, dest_profile); 40 | } 41 | 42 | } 43 | }); 44 | await back_up_profiles_ini (); //备份prifiles.ini 45 | } 46 | 47 | 48 | // 备份profiles.ini未完成 49 | async function back_up_profiles_ini (){ 50 | const { OS } = ChromeUtils.importESModule("chrome://zotero/content/osfile.mjs"); 51 | var os_user_path = OS.Constants.Path.homeDir; // 得到当前用户目录 52 | zotero_profile_ini = "AppData\\Roaming\\Zotero\\Zotero\\profiles.ini"; // Zotero profiles.ini后缀 53 | jurism_profile_ini = "AppData\\Roaming\\\Jurism\\Zotero\\profiles.ini"; // Jurism profiles.ini后缀 54 | 55 | full_zotero_profile_ini = OS.Path.join(os_user_path, zotero_profile_ini); // 完整zotero profiles.ini目录 56 | full_jurism_profile_ini = OS.Path.join(os_user_path, jurism_profile_ini); // 完整jurism profiles.ini目录 57 | if (await OS.File.exists(full_zotero_profile_ini)){ // 备份zotero中profiles.ini 58 | await make_dir(zotero_profile_ini_back); 59 | await OS.File.copy(full_zotero_profile_ini , OS.Path.join(zotero_profile_ini_back, "profiles.ini")); 60 | } 61 | if (await OS.File.exists(full_jurism_profile_ini)){ // 备份Jurism中profiles.ini 62 | await make_dir(jurism_profile_ini_back); 63 | await OS.File.copy(full_jurism_profile_ini, OS.Path.join(jurism_profile_ini_back, "profiles.ini")); 64 | } 65 | } 66 | 67 | 68 | // 新建目录函数 69 | async function make_dir(path){ 70 | const { OS } = ChromeUtils.importESModule("chrome://zotero/content/osfile.mjs"); 71 | if (!await OS.File.exists(path)) { 72 | OS.File.makeDir(path, { 73 | ignoreExisting: true, 74 | unixMode: 0o755 75 | }); 76 | } 77 | 78 | } 79 | 80 | alert ('配置文件备份在:' + back_path_profile + '\n' + 81 | '数据文件备份在:' + back_path_data + '\n' + 82 | 'profiles.ini备份在:' + back_path) 83 | return "备份完成。" 84 | -------------------------------------------------------------------------------- /09delete-item(s)-snapshots.js: -------------------------------------------------------------------------------- 1 | //删除所选条目的快照,包括贮存的本地文件 2 | 3 | var items = ZoteroPane.getSelectedItems(); 4 | var item = items[0]; 5 | var truthBeTold = window.confirm("Are you sure you want to move the snapshot(s) to the Trash? ") 6 | if (truthBeTold) { 7 | delAttachment(items); 8 | } 9 | //删除条目的附件链接 10 | async function delAttachment(items) { 11 | 12 | for (let item of items) { 13 | 14 | if (item.isRegularItem()) { // not an attachment already 15 | var filePath = await getFilePath(item); 16 | if (filePath){ 17 | await OS.File.remove(filePath); //删除附件的文件 18 | } 19 | 20 | let attachmentIDs = item.getAttachments(); 21 | for (let id of attachmentIDs) { 22 | let attachment = Zotero.Items.get(id); 23 | if (attachment.attachmentContentType == 'text/html' ) { 24 | attachment.deleted = true; //删除附件(快照) 25 | await attachment.saveTx(); 26 | 27 | } 28 | } 29 | } 30 | } 31 | } 32 | 33 | // 函数得到文件路径 34 | async function getFilePath(item) { 35 | 36 | if (item && !item.isNote()) { //2 if 37 | 38 | if (item.isRegularItem()) { // Regular Item 一般条目//3 if 39 | 40 | let attachmentIDs = item.getAttachments(); 41 | for (let id of attachmentIDs) { //4 for 42 | var file = await Zotero.Items.get(id).getFilePathAsync(); 43 | return file; 44 | } //4 for 45 | } // 3 if 46 | if (item.isAttachment()) { //附件条目 5 if 47 | var file = await item.getFilePathAsync(); 48 | return file; 49 | }//5if 50 | } //2 if 51 | 52 | } 53 | -------------------------------------------------------------------------------- /10add-bold-tag-around-author.js: -------------------------------------------------------------------------------- 1 | //英文替换 2 | var oldName = "Wuji Zhang"; 3 | var newFirstName = "Wuji"; 4 | var newLastName = "Zhang"; 5 | var newFieldMode = 0; // 0: two-field, 1: one-field (with empty first name) 6 | 7 | var rn = 0; //计数替换条目个数 8 | await Zotero.DB.executeTransaction(async function () { 9 | zoteroPane = Zotero.getActiveZoteroPane(); 10 | items = zoteroPane.getSelectedItems(); 11 | for (item of items) { 12 | let creators = item.getCreators(); 13 | let newCreators = []; 14 | for (let creator of creators) { 15 | if (`${creator.firstName} ${creator.lastName}`.trim() == oldName) { 16 | creator.firstName = newFirstName; 17 | creator.lastName = newLastName; 18 | creator.fieldMode = newFieldMode; 19 | rn+=1; 20 | } 21 | newCreators.push(creator); 22 | 23 | } 24 | item.setCreators(newCreators); 25 | 26 | await item.save(); 27 | 28 | } 29 | 30 | }); 31 | return rn + " item(s) updated"; 32 | 33 | //中文替换 34 | var oldName = "无忌 张"; 35 | var newFirstName = ""; 36 | var newLastName = "张无忌"; 37 | var newFieldMode = 1; // 0: two-field, 1: one-field (with empty first name) 38 | 39 | var rn = 0; //计数替换条目个数 40 | await Zotero.DB.executeTransaction(async function () { 41 | zoteroPane = Zotero.getActiveZoteroPane(); 42 | items = zoteroPane.getSelectedItems(); 43 | for (item of items) { 44 | let creators = item.getCreators(); 45 | let newCreators = []; 46 | for (let creator of creators) { 47 | if (`${creator.firstName} ${creator.lastName}`.trim() == oldName) { 48 | creator.firstName = newFirstName; 49 | creator.lastName = newLastName; 50 | creator.fieldMode = newFieldMode; 51 | rn+=1; 52 | } 53 | newCreators.push(creator); 54 | 55 | } 56 | item.setCreators(newCreators); 57 | 58 | await item.save(); 59 | 60 | } 61 | 62 | }); 63 | return rn + " item(s) updated"; -------------------------------------------------------------------------------- /11del-all-the-attachment(s)-of-item(s).js: -------------------------------------------------------------------------------- 1 | // 20210331 2 | // 删除条目的附件保但保留条目 3 | 4 | var DelAtts = []; //删除的附件 5 | var zoteroPane = Zotero.getActiveZoteroPane(); 6 | var items = zoteroPane.getSelectedItems(); 7 | 8 | for (let item of items) { 9 | 10 | if (item && !item.isNote()) { //2 if 11 | 12 | if (item.isRegularItem()) { // Regular Item 一般条目//3 if 13 | 14 | let attachmentIDs = item.getAttachments(); 15 | for (let id of attachmentIDs) { //4 for 16 | let attachment = Zotero.Items.get(id); 17 | // if (attachment.attachmentContentType == 'text/html' ) { //可以筛选删除的附件类型 18 | attachment.deleted = true; //删除附件(快照) 19 | await attachment.saveTx(); 20 | 21 | // } 22 | var file = await attachment.getFilePathAsync(); 23 | if (file) { 24 | await OS.File.remove(file); //删除文件 25 | } 26 | DelAtts.push(file + "\n"); 27 | 28 | } //4 for 29 | } // 3 if 30 | if (item.isAttachment()) { //附件条目 5 if 31 | var file = await item.getFilePathAsync(); 32 | if (file) { 33 | await OS.File.remove(file); //删除文件 34 | } 35 | DelAtts.push(file + "\n"); 36 | item.deleted = true; 37 | await item.saveTx(); 38 | }//5if 39 | } //2 if 40 | 41 | } 42 | 43 | return (DelAtts + "\n " + DelAtts.length + "个包括附件已经被删除。") -------------------------------------------------------------------------------- /12copy-zotero-template-to-word-startup-directory.js: -------------------------------------------------------------------------------- 1 | // copy zotero.dotm from zotero install directory to Word Startup directory 2 | // 从Zotero安装目录复制zotero.dotm到Word启动目录 3 | 4 | var path = OS.Constants.Path; 5 | var softDir = path.libDir; 6 | var userDir = path.homeDir; 7 | 8 | var zotDotmPath = OS.Path.join(softDir, "extensions/zoteroWinWordIntegration@zotero.org/install/Zotero.dotm"); // zotero.dotm所在目录 9 | var wordStartupPath = OS.Path.join(userDir, "AppData/Roaming/Microsoft/Word/STARTUP/Zotero.dotm"); // Word启动目录 10 | //return OS.File.exists(zotDotmPath); 11 | var truthBeTold = window.confirm("请关闭Word,然后点击OK ") 12 | if (truthBeTold) { 13 | if (await OS.File.exists(zotDotmPath)) { // 如果存在则复制 14 | await OS.File.copy(zotDotmPath, wordStartupPath); 15 | alert("Zotero.dotm已复制,请重新打开Word"); 16 | } else { //如果不存在,报错 17 | alert("Zotero.dotm不存在, 您可能需要重装安装Zotero或JurisM"); 18 | } 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /13.1chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | // var item = items[0]; 4 | var n = 0; 5 | for (item of items) { 6 | var otitle = item.getField("publicationTitle");//原题目 7 | var reg = /^LWT$/i //i不区分大小写,g为区分 8 | var test = reg.test(otitle) 9 | if (test) 10 | { 11 | n++; 12 | var rtitle = otitle.replace(/^LWT$/i,'LWT - Food Science and Technology') 13 | //被替代的题目 14 | item.setField("publicationTitle", rtitle); 15 | await item.saveTx(); 16 | } 17 | 18 | } 19 | if (n == 0) return '题目中没有LWT。' 20 | else 21 | return n + '个题目中LWT被替换为LWT - Food Science and Technology。'; -------------------------------------------------------------------------------- /13chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js: -------------------------------------------------------------------------------- 1 | var fieldName = "publicationTitle"; 2 | var oldValue = "LWT"; 3 | var newValue = "LWT-Food Science and Technology"; 4 | 5 | var fieldID = Zotero.ItemFields.getID(fieldName); 6 | var s = new Zotero.Search(); 7 | s.libraryID = ZoteroPane.getSelectedLibraryID(); 8 | s.addCondition(fieldName, 'is', oldValue); 9 | var ids = await s.search(); 10 | if (!ids.length) { 11 | return "No items found"; 12 | } 13 | await Zotero.DB.executeTransaction(async function () { 14 | for (let id of ids) { 15 | let item = await Zotero.Items.getAsync(id); 16 | let mappedFieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(item.itemTypeID, fieldName); 17 | item.setField(mappedFieldID ? mappedFieldID : fieldID, newValue); 18 | await item.save(); 19 | } 20 | }); 21 | return ids.length + " item(s) updated"; -------------------------------------------------------------------------------- /14extra-replace-citations.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | for (item of items) { 4 | var oextra = item.getField("extra"); 5 | var rep = oextra.match(/(\d+ citations)(.+\n)(\d+ citations)(.+)/)[1] 6 | //第1个引用次数写为[1],第2个引用次数,写为[3] 7 | item.setField("extra", rep); 8 | await item.saveTx(); 9 | } 10 | return "Extra已替换为引用次数"; -------------------------------------------------------------------------------- /15swap-author-first-last-names.js: -------------------------------------------------------------------------------- 1 | myPublicationTitle = "Nanoscale" 2 | var rn = 0; //计数替换条目个数 3 | var newFieldMode = 0; // 0: two-field, 1: one-field (with empty first name) 4 | await Zotero.DB.executeTransaction(async function () { 5 | zoteroPane = Zotero.getActiveZoteroPane(); 6 | items = zoteroPane.getSelectedItems(); 7 | for (item of items) { 8 | let publicationTitle = item.getField("publicationTitle");//期刊名称 9 | if (publicationTitle == myPublicationTitle) { 10 | let creators = item.getCreators(); 11 | let newCreators = []; 12 | for (let creator of creators) { 13 | // if (`${creator.firstName} ${creator.lastName}`.trim() == oldName) { 14 | let firstName = creator.firstName; 15 | let lastName = creator.lastName; 16 | 17 | creator.firstName = lastName; 18 | creator.lastName = firstName; 19 | creator.fieldMode = newFieldMode; 20 | 21 | // } 22 | newCreators.push(creator); 23 | 24 | } 25 | item.setCreators(newCreators); 26 | rn+=1; 27 | await item.save(); 28 | 29 | } 30 | } 31 | }); 32 | return rn + " item(s) updated"; -------------------------------------------------------------------------------- /16copy-creators-to-clipboard.js: -------------------------------------------------------------------------------- 1 | 2 | var zoteroPane = Zotero.getActiveZoteroPane(); 3 | var zitems = zoteroPane.getSelectedItems(); 4 | var clipboardText = '' 5 | 6 | for (let zitem of zitems) { 7 | var creatorsArray = []; 8 | var whiteSpace = ' '; 9 | var lan = zitem.getField("language"); 10 | if (lan.indexOf("中") != -1) //如果为中文 11 | { whiteSpace = ''; //如果为中文删除空格 12 | } 13 | let creators = zitem.getCreators(); 14 | for (let creator of creators) { 15 | let creatorStr = creator.lastName + whiteSpace + creator.firstName; 16 | if (creatorsArray.indexOf(creatorStr) == -1) { 17 | creatorsArray.push(creatorStr); 18 | } 19 | var clipboardTextSingleItem = creatorsArray.join(', '); 20 | } 21 | clipboardText = clipboardText + clipboardTextSingleItem + '\r\n'; 22 | } 23 | 24 | copyToClipboard(clipboardText); 25 | return clipboardText; 26 | 27 | 28 | 29 | function copyToClipboard(clipboardText) { 30 | if (clipboardText) { 31 | const gClipboardHelper = 32 | Components.classes['@mozilla.org/widget/clipboardhelper;1'] 33 | .getService(Components.interfaces.nsIClipboardHelper); 34 | gClipboardHelper.copyString(clipboardText, document); 35 | } else { 36 | var prompts = Components. 37 | classes['@mozilla.org/embedcomp/prompt-service;1']. 38 | getService(Components.interfaces.nsIPromptService); 39 | var title = Zutilo.getString('zutilo.error.copynoitemstitle') 40 | var text = Zutilo.getString('zutilo.error.copynoitemstext') 41 | prompts.alert(null, title, text) 42 | } 43 | } -------------------------------------------------------------------------------- /17.1change-item-title-to-title-case.js: -------------------------------------------------------------------------------- 1 | //当前所选的条目 2 | var selectedItems = ZoteroPane.getSelectedItems(); 3 | 4 | //正式开始 5 | //确认对话框 6 | var truthBeTold = window.confirm("Are you sure you want to convert the title to Title Case? ") 7 | if (truthBeTold) { 8 | titleCase(selectedItems); 9 | } 10 | 11 | //加入循环 12 | //判断为一般条目再修改 13 | async function titleCase(selectedItems) { 14 | for (let item of selectedItems) { 15 | if (item && !item.isNote()) { 16 | if (item.isRegularItem()) {//普通条目 17 | var title = item.getField('title') 18 | var newTitle = Zotero.Utilities.capitalizeTitle(title, true); 19 | item.setField('title', newTitle); 20 | await item.saveTx(); 21 | } 22 | if (item.isAttachment()) { //附件条目进行的操作 23 | // find out about attachment 24 | } 25 | 26 | } 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /17change-item-title-to-title-case.js: -------------------------------------------------------------------------------- 1 | var items = ZoteroPane.getSelectedItems(); 2 | var n = 0; 3 | for (item of items) { 4 | var title = item.getField('title'); 5 | new_title = titleCase(title). // 转换为单词首字母大写 6 | replace('And', 'and'). // 替换And 7 | replace('For', 'for'). // 替换For 8 | replace('In', 'in'). // 替换In 9 | replace('Of', 'of'). // 替换Of 10 | replace('With', 'with'). 11 | replace('Usa', 'USA'). 12 | replace('Dna', 'DNA'). 13 | replace('Pcr', 'PCR'). 14 | replace('Ros', 'ROS'). 15 | replace('To', 'to') 16 | 17 | 18 | 19 | item.setField('title', new_title); 20 | await item.saveTx(); 21 | n ++ 22 | }; 23 | 24 | return n + '个条目的题目大小写转为词首字母大写,有些特殊缩写单词可能转换错误,请查实。'; 25 | 26 | // 将单词转为首字母大写 27 | function titleCase(str) { 28 | var newStr = str.split(" "); 29 | for(var i = 0; i < newStr.length; i++) { 30 | newStr[i] = newStr[i].slice(0,1).toUpperCase() + newStr[i].slice(1).toLowerCase(); 31 | } 32 | return newStr.join(" "); 33 | }; -------------------------------------------------------------------------------- /18change-item-title-to-upper-case.js: -------------------------------------------------------------------------------- 1 | var items = ZoteroPane.getSelectedItems(); 2 | var n = 0; 3 | for (item of items) { 4 | var title = item.getField('title'); 5 | new_title = title.toUpperCase() 6 | 7 | 8 | 9 | item.setField('title', new_title); 10 | await item.saveTx(); 11 | n ++ 12 | }; 13 | 14 | return n + '个条目的题目大小写转为全部大写,请查实。'; 15 | 16 | -------------------------------------------------------------------------------- /19add-or-remove-space-before-start-in-author.js: -------------------------------------------------------------------------------- 1 | // 删除*前的空格,*用于表示通讯作者 2 | var newFieldMode = 0; 3 | var items = ZoteroPane.getSelectedItems(); 4 | for (item of items) { 5 | var creators = item.getCreators(); 6 | 7 | let newCreators = []; 8 | for (let creator of creators) { 9 | creator.firstName = creator.firstName.trim().replace(' *', '*'); 10 | creator.lastName = creator.lastName.trim().replace(' *', '*'); 11 | creator.fieldMode = newFieldMode; 12 | newCreators.push(creator); 13 | } 14 | item.setCreators(newCreators); 15 | await item.save(); 16 | } 17 | return '删除*前空格操作完成。'; 18 | // *前添加空格 19 | // 用于姓名缩写后仍然显示*,最后在Word中将空格 *替换为* 20 | var newFieldMode = 0; 21 | var items = ZoteroPane.getSelectedItems(); 22 | for (item of items) { 23 | var creators = item.getCreators(); 24 | 25 | let newCreators = []; 26 | for (let creator of creators) { 27 | creator.firstName = creator.firstName.trim().replace('*', ' *'); 28 | creator.lastName = creator.lastName.trim().replace('*', ' *'); 29 | creator.fieldMode = newFieldMode; 30 | newCreators.push(creator); 31 | } 32 | item.setCreators(newCreators); 33 | await item.save(); 34 | } 35 | 36 | return '*前加空格操作完成。'; 37 | -------------------------------------------------------------------------------- /20empty-abstract.js: -------------------------------------------------------------------------------- 1 | // 删除摘要内容,以更方面显示期刊卷期 2 | var items = ZoteroPane.getSelectedItems(); 3 | for (item of items) { 4 | item.setField('abstractNote','') 5 | await item.save(); 6 | } 7 | return '操作完成。'; 8 | -------------------------------------------------------------------------------- /21export-all-notes.js: -------------------------------------------------------------------------------- 1 | var items = ZoteroPane.getSelectedItems(); 2 | 3 | var notes = [] 4 | for (let item of items) { 5 | if (item && !item.isNote()) { 6 | var noteIDs = item.getNotes(); 7 | for (let id of noteIDs) { 8 | let note = Zotero.Items.get(id); 9 | 10 | let noteHTML = note.getNote(); 11 | notes.push(noteHTML) 12 | } 13 | } 14 | } 15 | // return notes 16 | // 删除里面的其它标识 17 | return notes.map(note=>note.replace('
',''). 18 | replace('
','').replace(/

/g,'').replace(/<\/p>/g,'').replace(/\n/g,'')) -------------------------------------------------------------------------------- /22auto-scroll-thumbnail.js: -------------------------------------------------------------------------------- 1 | // 更多功能请使用Chartero:https://github.com/volatile-static/Chartero 2 | let err; 3 | // 滚动阅读器缩略图 4 | function scrollThumbnailView() { 5 | const reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID); 6 | const layout = reader._iframeWindow.document.getElementById('thumbnailView'); 7 | layout.getElementsByTagName('a')[reader.state.pageIndex].scrollIntoView(); 8 | } 9 | try { 10 | const notifierID = Zotero.Notifier.registerObserver({ 11 | notify: (event, type, ids, extraData) => { 12 | if (event === 'select' && type === 'tab') { // 选择标签页 13 | const reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID); 14 | if (!reader) return; 15 | const viewer = reader._iframeWindow.document.getElementById('viewer'); 16 | // 防止重复添加 17 | viewer.removeEventListener('mouseup', scrollThumbnailView, false); 18 | viewer.addEventListener('mouseup', scrollThumbnailView, false); 19 | } 20 | } 21 | }, ["tab"]); 22 | window.addEventListener( 23 | "unload", 24 | function (e) { 25 | Zotero.Notifier.unregisterObserver(notifierID); 26 | }, 27 | false 28 | ); 29 | } catch (error) { 30 | err = error; 31 | } 32 | err || 'success' 33 | -------------------------------------------------------------------------------- /23copy-publication-title-to-journal-abbreviation.js: -------------------------------------------------------------------------------- 1 | //用期刊名称填充期刊缩写 2 | var items = ZoteroPane.getSelectedItems(); 3 | var item = items[0]; 4 | for (i = 0; i < items.length; i++) { 5 | var journal = Zotero.ItemTypes.getName(item.itemTypeID) == 'journalArticle' // 文献类型为期刊 6 | var lanItem = items[i].getField('language'); //得到条目语言 7 | var enItem = lanItem.indexOf('en') !== -1 || // 英文条目 8 | lanItem.indexOf('English') !== -1; 9 | var chItem = lanItem.indexOf('ch') !== -1 || //中文条目 10 | lanItem.indexOf('zh') !== -1 || 11 | lanItem.indexOf('中文') !== -1 || 12 | lanItem.indexOf('CN') !== -1; 13 | var pubT = items[i].getField('publicationTitle'); 14 | if (!journal) { 15 | return "非期刊,填充失败。" 16 | } 17 | if (enItem) { 18 | return "英文期刊,填充失败。" 19 | } 20 | if (chItem) { 21 | items[i].setField('journalAbbreviation', pubT); 22 | } 23 | await items[i].saveTx(); 24 | } 25 | return "用中文期刊名称填充期刊缩写完毕。" -------------------------------------------------------------------------------- /24remove-starting-zotero-in-issue.js: -------------------------------------------------------------------------------- 1 | //删除期中开始的0,如01变为1,08变为8 2 | 3 | var items = ZoteroPane.getSelectedItems(); 4 | for (let item of items) { 5 | var newIssue = item.getField("issue").replace(/^(0+)/, "") 6 | item.setField("issue", newIssue) 7 | item.save(); 8 | } 9 | return "期号中开始的0已删除" -------------------------------------------------------------------------------- /25empty-deleted-collections.js: -------------------------------------------------------------------------------- 1 | // 清空delitem 0.0.20之前版本删除分类(文件夹)后残留在Add to Colletions中分类(文件夹) 2 | var collections = Zotero.Collections.getByLibrary(Zotero.Libraries.userLibraryID); 3 | deleted_collections = collections.filter(x => x.deleted === true); 4 | for (coll of deleted_collections) { 5 | await coll.eraseTx(); 6 | } 7 | return deleted_collections.length + ' deleted collection(s) has(have) been removed.'; -------------------------------------------------------------------------------- /26change-item-type.js: -------------------------------------------------------------------------------- 1 | var items = ZoteroPane.getSelectedItems(); 2 | // 文献类型字段见https://aurimasv.github.io/z2csl/typeMap.xml 3 | var itemType = `standard`; 4 | // var iteyType = `bill` 5 | // var iteyType = `book` 6 | // var iteyType = `bookSection` 7 | // var iteyType = `computerProgram` 8 | // var iteyType = `conferencePaper` 9 | // var iteyType = `document` 10 | // var iteyType = `journalArticle` 11 | // var iteyType = `newspaperArticle` 12 | // var iteyType = `patent` 13 | // var iteyType = `report` 14 | // var iteyType = `standard` 15 | // var iteyType = `thesis` 16 | // var iteyType = `webpage` 17 | for (let item of items) { 18 | if (item && !item.isNote() && item.isRegularItem()) { 19 | item.setType(Zotero.ItemTypes.getID(itemType)) 20 | await item.saveTx(); 21 | } 22 | } 23 | return `item type have (has) been changed to ${itemType}.`; 24 | -------------------------------------------------------------------------------- /27remove-extra-space-in-abstract.js: -------------------------------------------------------------------------------- 1 | // https://github.com/redleafnew/zotero-updateifsE/issues/124 需求来源 2 | var pattern = /\s{2,}/g 3 | var pattern1 = /\s(\d)/g 4 | var pattern2 = /(\d)\s(\/)/g; 5 | 6 | var items = Zotero.getActiveZoteroPane().getSelectedItems(); 7 | 8 | for (let item of items) { 9 | 10 | if (item.isRegularItem() && !item.isCollection()) { 11 | 12 | var newAb = item.getField('abstractNote').replace(pattern, ' ') // 多个空格替换为一个空格 13 | .replace(pattern1, "$1") //替换数字后面的空格 14 | .replace(pattern2, "$1$2"); // 清除数字和/之间的空格 15 | item.setField('abstractNote', newAb); //替换摘要 16 | item.saveTx(); 17 | 18 | 19 | } 20 | } 21 | 22 | 23 | return "摘要中的多余空格已删除!" 24 | -------------------------------------------------------------------------------- /28remove-extra-enter-in-abstract.js: -------------------------------------------------------------------------------- 1 | zoteroPane = Zotero.getActiveZoteroPane(); 2 | items = zoteroPane.getSelectedItems(); 3 | for (item of items) { 4 | var originalAbstract = item.getField('abstractNote').trim(); 5 | //将abstractNote换为extra则可以处理'其他'栏的内容 6 | modifiedAbstract = originalAbstract.replace(/\n{2,}/g, '\n'); 7 | item.setField('abstractNote', modifiedAbstract); 8 | //如果前面换了extra,这里一定也要替换 9 | await item.saveTx(); 10 | } 11 | return "摘要中的多余换行已删除!"; -------------------------------------------------------------------------------- /29batch_set_sup_sub_in_title.js: -------------------------------------------------------------------------------- 1 | // 代码来源于@Four Happy,表示感谢 2 | // 代码来源于https://zhuanlan.zhihu.com/p/24000322183 3 | zoteroPane = Zotero.getActiveZoteroPane(); 4 | items = zoteroPane.getSelectedItems(); 5 | function transformTitle(title) { 6 | const regex = /(\d+)([+-]?)/g; 7 | let transformedTitle = title.replace(regex, (match, num, symbol) => { 8 | if (symbol === '+' || symbol === '-') { 9 | return `${num}${symbol}`; 10 | } else { 11 | return `${num}`; 12 | } 13 | }); 14 | return transformedTitle; 15 | } 16 | 17 | for (item of items) { 18 | var lan = item.getField("title") 19 | lan=transformTitle(lan) 20 | item.setField("title", lan)} 21 | return '化学式上下标设置已完成,请检查可能存在一些特殊情况!'; 22 | -------------------------------------------------------------------------------- /30change-publication-title-to-title-case.js: -------------------------------------------------------------------------------- 1 | //更改期刊名称为词首字母大写 2 | var items = ZoteroPane.getSelectedItems(); 3 | for (i = 0; i < items.length; i++) { 4 | var pubT = items[i].getField('publicationTitle'); 5 | var newPubT = Zotero.Utilities.capitalizeTitle(pubT.toLowerCase(), true); 6 | // 替换特殊情况 7 | newPubT =newPubT.replace("Ieee", "IEEE") //替换IEEE 8 | .replace("Acs", "ACS") //替换ACS 9 | .replace("Aip", "AIP") //替换AIP 10 | .replace("Apl", "APL") //替换APL 11 | .replace("Avs", "AVS") //替换AVS 12 | .replace("Bmc", "BMC") //替换AVS 13 | .replace("Iet", "IET") //替换IET 14 | .replace("Rsc", "RSC") //替换RSC 15 | .replace("Lwt", "LWT") //替换RSC 16 | .replace("U S A", "USA") //删除空格 17 | .replace("U. S. A.", "U.S.A."); //删除空格 18 | items[i].setField('publicationTitle', newPubT); 19 | await items[i].saveTx(); 20 | } 21 | return "更改期刊名称为词首字母大写完毕。" 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zotero-javascripts 2 | 3 | Some JavaScripts used in Zotero to batch process 4 | 5 | 用于批处理的一些 JavaScript 脚本。 6 | 7 | - ## LICENSE 8 | 9 | [GPL](https://www.gnu.org/licenses/gpl-3.0.txt) 10 | 11 | - ## 使用方法: 12 | 13 | 1.点击需要的 JavaScript 脚本链接,再点击`Raw`,将代码复制。 14 | 15 | 2.在 Zotero 中依次点击 Tools-Developer-Run JavaScript,将代码复制到 Code 窗口,点击 Run 即可。如下图所示: 16 | 17 | 18 | 19 | 20 | - ## JavaScript 脚本: 21 | 22 | - ### [01set-item-language-to-en-if-this-field-is-empty.js] 23 | 24 | 如果语言字段为空,批量将语言设置为 en(英语)。 25 | 26 | - ### [02change-the-item-title-to-sentence-case.js] 27 | 28 | 将文献的题目大小写修改为句首字母大写(Sentence case)。 29 | 30 | - ### [03empty-the-extra-field.js] 31 | 32 | 将`Extra`字段清空。 33 | 34 | - ### [04delete-the-attachment-files-after-the-items-have-been-removed-when-zotfile-was-installed.js] 35 | 36 | 清除用了[ZotFlie](http://zotfile.com)扩展后删除条目后残留的附件。使用方法见[Zotero 不用安装其它软件清理删除条目后残留的 PDF 方法](https://zhuanlan.zhihu.com/p/356071795)。**注意:附件的删除不可恢复,请提前备份,而且仅限于不建立子文件夹的情况。** 37 | 38 | - ### [05delete-the-addachments-when-the-items-were-removed.js] 39 | 40 | 删除条目的同时删除附件(在安装了[ZotFlie](http://zotfile.com)扩展后很有用)。**注意:附件的删除不可恢复,请提前备份。** 41 | 42 | - ### [06change-the-authors-case-to-title-case.js] 43 | 44 | 将作者大小写修改词首字母大写,使用方法见[Zotero 作者姓名批量修改为首字母大写](https://zhuanlan.zhihu.com/p/354481222)。 45 | 46 | - ### [07batch-merge-duplicates.js] 47 | 48 | 批量删除(合并)重复文献,使用方法见[Zotero 批量删除(合并)重复文献](https://zhuanlan.zhihu.com/p/352324486)。 49 | 50 | - ### [08back-up-profile-and-data.js] 51 | 52 | 备份配置和数据。使用方法见[Zotero 利用 JavaScript 备份配置和数据](https://zhuanlan.zhihu.com/p/357859432)。 53 | 54 | - ### [09delete-item(s)-snapshot(s).js] 55 | 56 | 删除所选条目的快照,包括贮存的本地文件。 57 | 58 | - ### [10add-bold-tag-around-author.js] 59 | 60 | 在作者前后添加加粗标记。 61 | 62 | - ### [11del-all-the-attachment(s)-of-item(s).js] 63 | 64 | 删除条目的所有附件,包括贮存在本地的文件,但保留条目本身。**注意:附件的删除不可恢复,请提前备份。** 65 | 66 | - ### [12copy-zotero-template-to-word-startup-directory.js] 67 | 68 | 从 Zotero 安装目录复制 zotero.dotm 到 Word 启动目录。 69 | 70 | - ### [13chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js] 71 | 72 | [13.1chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js] 73 | 74 | 将 Zotero 期刊题目中的 LWT 更改为 LWT-Food Science and Technology。 75 | 76 | - ### [14extra-replace-citations.js] 77 | 78 | 将Zotero Extra字段中`SC: None[s2] 79 | 80 | WOS:000685503000003 81 | 1 citations (Semantic Scholar/DOI) [2021-12-04] 82 | 0 citations (Crossref) [2021-12-04]`替换为`_ citations`,`_`为 Semantic Scholar 引用。 83 | 84 | - ### [15swap-author-first-last-names.js] 85 | 86 | 交换作者的`姓`和`名`,如将`Zhang San`替换为`San Zhang`,使用时请将`myPublicationTitle = "Nanoscale"`双引号内的内容替换为自己需要交换作者姓名期刊名称。也可以删除此句,则将所有所选条目的作者`姓`和`名`替换。 87 | 88 | - ### [16copy-creators-to-clipboard.js] 89 | 90 | 将条目的作者复制到剪切板,代码来源于,修改后中文`姓`和`名`之间无空格,作者之前用英文逗号加空格间隔(`, `),单行显示。~~存在问题:选中多篇时,所有作者连到一起。~~ 91 | 92 | - ### [17change-item-title-to-title-case.js] 93 | 94 | [17.1change-item-title-to-title-case.js] 95 | 96 | 将条目的题目大小写转为词首字母大写(Title Case),特殊的大小写请按例子自行添加`replace`语句。 97 | 98 | - ### [18change-item-title-to-upper-case.js] 99 | 100 | 将条目的题目大小写转为部分大写。 101 | 102 | - ### [22auto-scroll-thumbnail.js] 103 | 104 | 单击 pdf 页面时,缩略图滚动到当前页面。 105 | 106 | - ### [23copy-publication-title-to-journal-abbreviation.js] 107 | 108 | 中文期刊用期刊名称填充期刊缩写。如果用 quicker 可以试试这个动作。 109 | 110 | - ### [24remove-starting-zotero-in-issue.js] 111 | 112 | 删除期刊杂志中期号开始的 0,如 01 变为 1,08 变为 8。 113 | 114 | - ### [25empty-deleted-collections.js] 115 | 116 | 清空 delitem 0.0.20 之前版本删除分类(文件夹)后残留在 Add to Colletions 中分类(文件夹),见[14#](https://github.com/redleafnew/delitemwithatt/issues/14#)。 117 | 118 | - ### [26change-item-type.js] 119 | 120 | 更改文献(条目)类型。代码源于: 121 | 122 | - ### [27remove-extra-space-in-abstract.js] 123 | 124 | 清除的摘要中的多余窗格。 125 | 126 | - ### [28remove-extra-enter-in-abstract.js] 127 | 128 | 清除的摘要中的多余回车。 129 | 130 | - ### [29batch_set_sup_sub_in_title.js] 131 | 132 | 批量改标题中的化学式上下标。代码源于:https://zhuanlan.zhihu.com/p/24000322183,感谢@Four Happy。也可用 [Quicker 动作](https://getquicker.net/Sharedaction?code=541dd48f-2890-4864-ef9b-08dd4d6a4376)。 133 | 134 | - ### [30change-publication-title-to-title-case.js] 135 | 136 | 批量修改期刊题目为词首字母大写。也可用 [Quicker 动作](https://getquicker.net/Sharedaction?code=19177b66-1db1-4456-b276-08dd5d8e706b&fromMyShare=true)。 137 | 138 | 更多 Zotero 的使用方法见[Chinese-STD-GB-T-7714-related-csl](https://github.com/redleafnew/Chinese-std-GB-T-7714-related-csl),Zotero 的使用教程见[Zotero_introduction](https://github.com/redleafnew/Zotero_introduction)。 139 | 140 | [01set-item-language-to-en-if-this-field-is-empty.js]: 01set-item-language-to-en-if-this-field-is-empty.js 141 | [02change-the-item-title-to-sentence-case.js]: 02change-the-item-title-to-sentence-case.js 142 | [03empty-the-extra-field.js]: 03empty-the-extra-field.js 143 | [04delete-the-attachment-files-after-the-items-have-been-removed-when-zotfile-was-installed.js]: 04delete-the-attachment-files-after-the-items-have-been-removed-when-zotfile-was-installed.js 144 | [05delete-the-addachments-when-the-items-were-removed.js]: 05delete-the-addachments-when-the-items-were-removed.js 145 | [06change-the-authors-case-to-title-case.js]: 06change-the-authors-case-to-title-case.js 146 | [07batch-merge-duplicates.js]: 07batch-merge-duplicates.js 147 | [08back-up-profile-and-data.js]: 08back-up-profile-and-data.js 148 | [09delete-item(s)-snapshot(s).js]: 09delete-item(s)-snapshots.js 149 | [10add-bold-tag-around-author.js]: 10add-bold-tag-around-author.js 150 | [11del-all-the-attachment(s)-of-item(s).js]: 11del-all-the-attachment(s)-of-item(s).js 151 | [12copy-zotero-template-to-word-startup-directory.js]: 12copy-zotero-template-to-word-startup-directory.js 152 | [13chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js]: 13chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js 153 | [13.1chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js]: 13.1chagne-lwt-to-lwt-food-science-and-technology-in-publication-title.js 154 | [14extra-replace-citations.js]: 14extra-replace-citations.js 155 | [15swap-author-first-last-names.js]: 15swap-author-first-last-names.js 156 | [16copy-creators-to-clipboard.js]: 16copy-creators-to-clipboard.js 157 | [17change-item-title-to-title-case.js]: 17change-item-title-to-title-case.js 158 | [17.1change-item-title-to-title-case.js]: 17.1change-item-title-to-title-case.js 159 | [18change-item-title-to-upper-case.js]: 18change-item-title-to-upper-case.js 160 | [22auto-scroll-thumbnail.js]: 22auto-scroll-thumbnail.js 161 | [23copy-publication-title-to-journal-abbreviation.js]: 23copy-publication-title-to-journal-abbreviation.js 162 | [24remove-starting-zotero-in-issue.js]: 24remove-starting-zotero-in-issue.js 163 | [25empty-deleted-collections.js]: 25empty-deleted-collections.js 164 | [26change-item-type.js]: 26change-item-type.js 165 | [27remove-extra-space-in-abstract.js]: 27remove-extra-space-in-abstract.js 166 | [28remove-extra-enter-in-abstract.js]: 28remove-extra-enter-in-abstract.js 167 | [29batch_set_sup_sub_in_title.js]: 29batch_set_sup_sub_in_title.js 168 | [30change-publication-title-to-title-case.js]: 30change-publication-title-to-title-case.js 169 | -------------------------------------------------------------------------------- /img/runJS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redleafnew/zotero-javascripts/d7503caa034c13fc36bdead58bb78bb3c2fc7c2f/img/runJS.png -------------------------------------------------------------------------------- /img/runJSCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redleafnew/zotero-javascripts/d7503caa034c13fc36bdead58bb78bb3c2fc7c2f/img/runJSCode.png --------------------------------------------------------------------------------