Skip to content

Commit

Permalink
release: zotero-better-bibtex-0.9.0.xpi
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Apr 18, 2015
1 parent 9e0818f commit a541c61
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion chrome/content/zotero-better-bibtex/cache.coffee
Expand Up @@ -15,7 +15,7 @@ Zotero.BetterBibTeX.auto.recursive = ->
Zotero.BetterBibTeX.auto.process = (reason) ->
return if @running
switch Zotero.BetterBibTeX.pref.get('autoExport')
when 'off', 'disabled' then return
when 'off' then return
when 'idle' then return unless @idle

Zotero.BetterBibTeX.log("Auto-export: #{reason}")
Expand Down
8 changes: 3 additions & 5 deletions chrome/content/zotero-better-bibtex/preferences.coffee
Expand Up @@ -56,8 +56,6 @@ Zotero.BetterBibTeX.pref.collectionPath = (id) ->
Zotero.BetterBibTeX.pref.update = ->
return unless Zotero.BetterBibTeX.initialized # ?!?!

document.getElementById('better-bibtex-prefs-auto-export').setAttribute('hidden', Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled')

serverCheckbox = document.getElementById('id-better-bibtex-preferences-server-enabled')
serverEnabled = serverCheckbox.checked
serverCheckbox.setAttribute('hidden', Zotero.isStandalone && serverEnabled)
Expand Down Expand Up @@ -109,7 +107,7 @@ Zotero.BetterBibTeX.pref.update = ->
if refill
itemNode = document.createElement('listitem')
itemNode.setAttribute('value', ae.id)
itemNode.setAttribute('label', "collection_name -> #{ae.path.replace(/^.*[\\\/]/, '')}")
itemNode.setAttribute('label', "#{Zotero.Collections.get(ae.collection)?.name || ae.collection} -> #{ae.path.replace(/^.*[\\\/]/, '')}")
itemNode.setAttribute('class', "export-state-#{if Zotero.BetterBibTeX.auto.running == ae.id then 'running' else ae.status}")
itemNode.setAttribute('tooltiptext', "#{@collectionPath(ae.collection)} -> #{ae.path}")
exportlist.appendChild(itemNode)
Expand All @@ -135,9 +133,9 @@ Zotero.BetterBibTeX.pref.autoexport =
ae = Zotero.DB.rowQuery('select * from betterbibtex.autoexport ae join betterbibtex.exportoptions eo on ae.exportoptions = eo.id where ae.id = ?', [selectedItem.getAttribute('value')])
Zotero.BetterBibTeX.log(':::selected', Zotero.BetterBibTeX.pref.clone(ae))

Zotero.BetterBibTeX.pref.display('id-better-bibtex-preferences-auto-export-collection', 'ae.collection_name')
Zotero.BetterBibTeX.pref.display('id-better-bibtex-preferences-auto-export-collection', "#{Zotero.Collections.get(ae.collection)?.name || ae.collection}")
Zotero.BetterBibTeX.pref.display('id-better-bibtex-preferences-auto-export-target', ae.path)
Zotero.BetterBibTeX.pref.display('id-better-bibtex-preferences-auto-export-translator', 'ae.translatorID')
Zotero.BetterBibTeX.pref.display('id-better-bibtex-preferences-auto-export-translator', Zotero.BetterBibTeX.translatorName(ae.translatorID))
document.getElementById('id-better-bibtex-preferences-auto-export-auto-abbrev').checked = (ae.useJournalAbbreviation == 'true')
document.getElementById('id-better-bibtex-preferences-auto-export-notes').checked = (ae.exportNotes == 'true')
document.getElementById('id-better-bibtex-preferences-auto-export-preserve-bibvars').checked = (ae.preserveBibTeXVariables == 'true')
Expand Down
14 changes: 9 additions & 5 deletions chrome/content/zotero-better-bibtex/zotero-better-bibtex.coffee
Expand Up @@ -67,7 +67,7 @@ Zotero.BetterBibTeX.pref.observer = {
# if any var changes, drop the cache and kick off all exports
Zotero.DB.query('delete from betterbibtex.cache')
Zotero.DB.query("update betterbibtex.autoexport set status='pending'")
Zotero.BetterBibTeX.auto.process() unless Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled'
Zotero.BetterBibTeX.auto.process()
return
}

Expand All @@ -77,7 +77,6 @@ Zotero.BetterBibTeX.pref.ZoteroObserver = {
observe: (subject, topic, data) ->
switch data
when 'recursiveCollections'
return if Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled'
recursive = "#{!!Zotero.BetterBibTeX.auto.recursive()}"
Zotero.DB.execute("update betterbibtex.autoexport set exportedRecursively = ?, status = 'pending' where exportedRecursively <> ?", [recursive, recursive])
Zotero.BetterBibTeX.auto.process('recursiveCollections')
Expand Down Expand Up @@ -542,7 +541,7 @@ Zotero.BetterBibTeX.itemAdded = {
item.save()
collection.addItem(item.id)

unless collections.length == 0 || Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled'
unless collections.length == 0
collections = Zotero.BetterBibTeX.withParentCollections(collections)
Zotero.DB.query("update betterbibtex.autoexport set status = 'pending' where collection in #{Zotero.BetterBibTeX.SQLSet(collections)}")
Zotero.BetterBibTeX.auto.process('collectionChanged')
Expand Down Expand Up @@ -580,7 +579,7 @@ Zotero.BetterBibTeX.itemChanged = notify: (event, type, ids, extraData) ->
Zotero.BetterBibTeX.keymanager.get({itemID: id}, 'on-change')

collections = Zotero.Collections.getCollectionsContainingItems(ids, true)
unless collections.length == 0 || Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled'
unless collections.length == 0
collections = Zotero.BetterBibTeX.withParentCollections(collections)
Zotero.DB.query("update betterbibtex.autoexport set status = 'pending' where collection in #{Zotero.BetterBibTeX.SQLSet(collections)}")
Zotero.BetterBibTeX.auto.process('itemChanged')
Expand Down Expand Up @@ -664,7 +663,7 @@ Zotero.BetterBibTeX.load = (translator) ->
Zotero.File.getContentsFromURL("resource://zotero-better-bibtex/translators/#{translator}")
].join("\n")

delete header.displayOptions['Keep updated'] if header.displayOptions && Zotero.BetterBibTeX.pref.get('autoExport') == 'disabled'
delete header.displayOptions['Keep updated'] if header.displayOptions

@translators[header.label.toLowerCase().replace(/[^a-z]/, '')] = header
Zotero.Translators.save(header, code)
Expand All @@ -678,6 +677,11 @@ Zotero.BetterBibTeX.getTranslator = (name) ->
throw "No translator #{name}; available: #{Object.keys(@translators).join(', ')}" unless translator
return translator.translatorID

Zotero.BetterBibTeX.translatorName = (id) ->
for own name, tr of @translators
return tr.label if tr.translatorID == id
return "#{id}"

Zotero.BetterBibTeX.safeGetAll = ->
try
all = Zotero.Items.getAll()
Expand Down
2 changes: 1 addition & 1 deletion defaults/preferences/defaults.coffee
@@ -1,7 +1,7 @@
pref('extensions.zotero.translators.better-bibtex.attachmentsNoMetadata', false)
pref('extensions.zotero.translators.better-bibtex.autoAbbrevStyle', '')
pref('extensions.zotero.translators.better-bibtex.autoAbbrev', true)
pref('extensions.zotero.translators.better-bibtex.autoExport', 'disabled')
pref('extensions.zotero.translators.better-bibtex.autoExport', 'off')
pref('extensions.zotero.translators.better-bibtex.citeCommand', 'cite')
pref('extensions.zotero.translators.better-bibtex.citekeyFormat', '[auth][year]')
pref('extensions.zotero.translators.better-bibtex.DOIandURL', 'both')
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Expand Up @@ -4,7 +4,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>better-bibtex@iris-advies.com</em:id>
<em:name>Zotero Better Bib(La)Tex</em:name>
<em:version>0.8.41</em:version>
<em:version>0.9.0</em:version>
<em:description>Make Zotero useful for us LaTeX holdouts. More info @ https://github.com/ZotPlus/zotero-better-bibtex</em:description>
<em:creator>Emiliano Heyns</em:creator>
<em:iconURL>chrome://zotero-better-bibtex/skin/better-bibtex.svg</em:iconURL>
Expand Down

0 comments on commit a541c61

Please sign in to comment.