Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
frangoud committed Mar 2, 2021
1 parent 3451498 commit 64d9604
Show file tree
Hide file tree
Showing 17 changed files with 575 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.project
*.xpi
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Mozilla Public License Version 2.0
means any form of the work other than Source Code Form.

1.7. "Larger Work"
means a work that combines Covered Software with other material, in
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.

1.8. "License"
Expand Down Expand Up @@ -370,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------

This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
defined by the Mozilla Public License, v. 2.0.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# ZoteroDuplicatesMerger
A zotero plugin to automatically merge duplicate items
# Zotero Duplicates Merger

This is an add-on for Zotero that automatically merges duplicated items, without having to manually go through the list.

Please report any bugs, questions, or feature requests on the Zotero forums.

Code for this extension is based in part [Zotero DOI Manager](https://github.com/bwiernik/zotero-shortdoi) by Brenton M. Wiernik.

### Plugin Functions

- Merge duplicate items automatically
o Select which of the duplicate copies will be the master one
o Select how to handle type conflicts

### License

Copyright (C) 2021 Fotos Frangoudes

Distributed under the Mozilla Public License (MPL) Version 2.0.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
echo Enter version number:
read version
rm zotero-duplicatesmerger-${version}.xpi
zip -r zotero-duplicatesmerger-${version}.xpi chrome/* defaults/* chrome.manifest install.rdf options.xul
5 changes: 5 additions & 0 deletions chrome.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
content zoteroduplicatesmerger chrome/content/
locale zoteroduplicatesmerger en-US chrome/locale/en-US/
skin zoteroduplicatesmerger default chrome/skin/default/zoteroduplicatesmerger/

overlay chrome://zotero/content/zoteroPane.xul chrome://zoteroduplicatesmerger/content/overlay.xul
52 changes: 52 additions & 0 deletions chrome/content/options.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/preferences.css"?>

<!DOCTYPE window SYSTEM "chrome://zoteroduplicatesmerger/locale/options.dtd">

<!-- onload="updatePreferenceWindow('all');" -->
<prefwindow id="duplicatesmerger-pref" title="&duplicatesmerger-preferences;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<stringbundleset id="stringbundleset">
<stringbundle id="duplicatesmerger-options" src="chrome://zotero-duplicatesmerger/locale/options.properties"/>
</stringbundleset>
<prefpane label="&duplicatesmerger-preferences;" id="duplicatesmerger-prefpane">
<preferences>
<preference id="pref-duplicatesmerger-master" name="extensions.duplicatesmerger.master" type="string"/>
<preference id="pref-duplicatesmerger-typemismatch" name="extensions.duplicatesmerger.typemismatch" type="string"/>
<preference id="pref-duplicatesmerger-delay" name="extensions.duplicatesmerger.delay" type="int"/>
</preferences>

<groupbox>
<caption label="&duplicatesmerger-menu-master-label;"/>
<radiogroup id="id-duplicatesmerger-master" preference="pref-duplicatesmerger-master">
<radio label="&duplicatesmerger-master-oldest-label;" value='oldest'/>
<radio label="&duplicatesmerger-master-newest-label;" value='newest'/>
</radiogroup>
</groupbox>
<separator class="thin"/>

<groupbox>
<caption label="&duplicatesmerger-menu-typemismatch-label;"/>
<radiogroup id="id-duplicatesmerger-typemismatch" preference="pref-duplicatesmerger-typemismatch">
<radio label="&duplicatesmerger-typemismatch-skip-label;" value='skip'/>
<radio label="&duplicatesmerger-typemismatch-master-label;" value='master'/>
</radiogroup>
</groupbox>

<separator class="thin"/>
<hbox style="margin: 0">
<label value="&duplicatesmerger-preferences-delay;"/>
<textbox id="id-duplicatesmerger-delay" preference="pref-duplicatesmerger-delay" width="50"/>
</hbox>

<hbox style="margin: 0">
<label style="margin-right:0px" value="&for-more-information;"/>
<label style="margin-left:0px; margin-right:0px" class="text-link" onclick="Zotero.DuplicatesMerger.loadURI('https://github.com/frangoud/ZoteroDuplicatesMerger');" value="&duplicatesMerger-website;"/>
<label style="margin-left:0px; margin-right:0px" value="."/>
</hbox>
</prefpane>

<script src="options.js"/>
<script src="chrome://zotero/content/include.js"/>

</prefwindow>
66 changes: 66 additions & 0 deletions chrome/content/overlay.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>

<!DOCTYPE overlay SYSTEM "chrome://zoteroduplicatesmerger/locale/overlay.dtd">

<overlay
id="zoteroduplicatesmerger"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script src="chrome://zoteroduplicatesmerger/content/scripts/zoteroduplicatesmerger.js"/>
<script src="chrome://zotero/content/include.js"/>

<stringbundleset id="stringbundleset">
<stringbundle
id="duplicatesmerger-bundle"
src="chrome://zoteroduplicatesmerger/locale/duplicatesmerger.properties"/>
</stringbundleset>

<!-- Items popup menu -->
<popup
id="zotero-itemmenu">
<menuitem
id="duplicatesmerger-itemmenu"
label="&duplicatesmerger-itemmenu-label;"
oncommand="Zotero.DuplicatesMerger.mergeDuplicates()"/>
</popup>

<!-- Tools menu on the toolbar -->
<menupopup id="menu_ToolsPopup">
<menu id="menu_Tools-duplicatesmerger-menu" label="&duplicatesmerger-menu-root-label;">
<menupopup id="menu_Tools-duplicatesmerger-menu-popup">
<!-- Open preferences window -->
<menuitem id="menu_Tools-duplicatesmerger-preferences" label="&duplicatesmerger-preferences-label;" oncommand="Zotero.DuplicatesMerger.openPreferenceWindow();"/>
<!-- Handle master item selection -->
<menu id="menu_Tools-duplicatesmerger-menu-master" label="&duplicatesmerger-menu-master-label;">
<menupopup id="menu_Tools-duplicatesmerger-menu-popup-master" onpopupshowing="Zotero.DuplicatesMerger.setCheck('master');">
<menuitem
id="menu_Tools-duplicatesmerger-menu-popup-master-oldest"
type="checkbox"
label="&duplicatesmerger-master-oldest-label;"
oncommand="Zotero.DuplicatesMerger.changePref('master','oldest');"/>
<menuitem
id="menu_Tools-duplicatesmerger-menu-popup-master-newest"
type="checkbox"
label="&duplicatesmerger-master-newest-label;"
oncommand="Zotero.DuplicatesMerger.changePref('master','newest');"/>
</menupopup>
</menu>
<!-- Handle type mismatch errors -->
<menu id="menu_Tools-duplicatesmerger-menu-typemismatch" label="&duplicatesmerger-menu-typemismatch-label;">
<menupopup id="menu_Tools-duplicatesmerger-menu-popup-typemismatch" onpopupshowing="Zotero.DuplicatesMerger.setCheck('typemismatch');">
<menuitem
id="menu_Tools-duplicatesmerger-menu-popup-typemismatch-skip"
type="checkbox"
label="&duplicatesmerger-typemismatch-skip-label;"
oncommand="Zotero.DuplicatesMerger.changePref('typemismatch','skip');"/>
<menuitem
id="menu_Tools-duplicatesmerger-menu-popup-typemismatch-master"
type="checkbox"
label="&duplicatesmerger-typemismatch-master-label;"
oncommand="Zotero.DuplicatesMerger.changePref('typemismatch','master');"/>
</menupopup>
</menu>
</menupopup>
</menu>
</menupopup>
</overlay>
Empty file.
Loading

0 comments on commit 64d9604

Please sign in to comment.