Tampermonkey script for fast BibTeX export in Paperpile app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Paperpile BibTeX export button | |
// @version 0.1 | |
// @author Jared Lumpe | |
// @match http*://paperpile.com/app | |
// @grant unsafeWindow | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function exportBibtex() | |
{ | |
console.log('Triggering hacky PP export'); | |
unsafeWindow.Ext.create("Paperpile.view.settings.ExportView", {format: "BibTeX"}).triggerExport(); | |
} | |
function injectButton() | |
{ | |
var toolbarSpace = document.querySelector('.pp-top-toolbar [id^="tbfill"]'); | |
if (toolbarSpace == undefined) | |
{ | |
console.error("Couldn't find element to insert export button"); | |
return; | |
} | |
var btnContainer = document.createElement('DIV'); | |
btnContainer.style.cssText = 'float: right; transform: translate(0, -50%);'; | |
var btn = document.createElement('BUTTON') | |
btn.innerHTML = 'Export BibTeX'; | |
btn.onclick = exportBibtex; | |
btnContainer.appendChild(btn); | |
toolbarSpace.appendChild(btnContainer); | |
return btn; | |
} | |
window.onload = function() { | |
setTimeout(function() { | |
console.log('Injecting PP export button'); | |
injectButton(); | |
}, | |
2000); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment