mirror of
https://github.com/zotero/zotero.git
synced 2026-10-06 02:50:03 +00:00
More hacks for pdf.js
This commit is contained in:
parent
9b76f4b5b8
commit
645bbf92b8
2 changed files with 23 additions and 1 deletions
|
|
@ -504,6 +504,10 @@ Zotero.Attachments = new function(){
|
|||
var url = document.location.href;
|
||||
var title = forceTitle ? forceTitle : document.title;
|
||||
var mimeType = document.contentType;
|
||||
if(Zotero.Attachments.isPDFJS(document)) {
|
||||
mimeType = "application/pdf";
|
||||
}
|
||||
|
||||
var charsetID = Zotero.CharacterSets.getID(document.characterSet);
|
||||
|
||||
if (!forceTitle) {
|
||||
|
|
@ -1358,4 +1362,22 @@ Zotero.Attachments = new function(){
|
|||
.getURLSpecFromFile(file);
|
||||
browser.loadURI(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given document is an instance of PDFJS
|
||||
* @return {Boolean}
|
||||
*/
|
||||
this.isPDFJS = function(doc) {
|
||||
// pdf.js HACK
|
||||
if(doc.contentType === "text/html") {
|
||||
var win = doc.defaultView;
|
||||
if(win) {
|
||||
win = win.wrappedJSObject;
|
||||
if(win && "PDFJS" in win && win.PDFJS.isFirefoxExtension) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3082,7 +3082,7 @@ var ZoteroPane = new function()
|
|||
if (itemType == 'temporaryPDFHack') {
|
||||
itemType = null;
|
||||
var isPDF = false;
|
||||
if (doc.title.indexOf('application/pdf') != -1) {
|
||||
if (doc.title.indexOf('application/pdf') != -1 || Zotero.Attachments.isPDFJS(doc)) {
|
||||
isPDF = true;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue