Merge branch '3.0'
Conflicts: chrome/content/zotero/xpcom/storage/webdav.js chrome/content/zotero/xpcom/storage/zfs.js
This commit is contained in:
commit
585e5981f6
|
@ -1205,7 +1205,13 @@ function downloadPDFTool(tool, version, callback) {
|
||||||
|
|
||||||
wbp.progressListener = progressListener;
|
wbp.progressListener = progressListener;
|
||||||
Zotero.debug("Saving " + uri.spec + " to " + fileURL.spec);
|
Zotero.debug("Saving " + uri.spec + " to " + fileURL.spec);
|
||||||
|
try {
|
||||||
wbp.saveURI(uri, null, null, null, null, fileURL);
|
wbp.saveURI(uri, null, null, null, null, fileURL);
|
||||||
|
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||||
|
// XXX Always use when we no longer support Firefox < 18
|
||||||
|
wbp.saveURI(uri, null, null, null, null, fileURL, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
// "WebPageDump" Firefox Extension
|
// "WebPageDump" Firefox Extension
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
@ -42,8 +41,6 @@
|
||||||
// provides common functions (file, preferences, windows, error,...)
|
// provides common functions (file, preferences, windows, error,...)
|
||||||
//
|
//
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
var gBrowserWindow = null;
|
var gBrowserWindow = null;
|
||||||
var gExceptLocation = "about:blank";
|
var gExceptLocation = "about:blank";
|
||||||
var gCallback = "";
|
var gCallback = "";
|
||||||
|
@ -74,11 +71,11 @@ var WPD_MAXUIERRORCOUNT=8;
|
||||||
/* [14:55:15] paolinho: var browserWin = windowMediator.getMostRecentWindow("navigator:browser");
|
/* [14:55:15] paolinho: var browserWin = windowMediator.getMostRecentWindow("navigator:browser");
|
||||||
const mainTabBox = browserWin.getBrowser().mTabBox;
|
const mainTabBox = browserWin.getBrowser().mTabBox;
|
||||||
const topWindow = browserWin.getBrowser().browsers[mainTabBox.selectedIndex].contentWindow;
|
const topWindow = browserWin.getBrowser().browsers[mainTabBox.selectedIndex].contentWindow;
|
||||||
[14:55:50] … var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
|
[14:55:50]
|
||||||
|
var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function wpdGetTopBrowserWindow()
|
function wpdGetTopBrowserWindow() {
|
||||||
{
|
|
||||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||||
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
|
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||||
var topWindowOfType = windowManagerInterface.getMostRecentWindow("navigator:browser");
|
var topWindowOfType = windowManagerInterface.getMostRecentWindow("navigator:browser");
|
||||||
|
@ -90,8 +87,7 @@ function wpdGetTopBrowserWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function wpdWindowLoaded()
|
function wpdWindowLoaded() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
// this will be called multiple times if the page contains more than one document (frames, flash,...)
|
// this will be called multiple times if the page contains more than one document (frames, flash,...)
|
||||||
//var browser=this.document.getElementById("content");
|
//var browser=this.document.getElementById("content");
|
||||||
|
@ -116,8 +112,7 @@ function wpdWindowLoaded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wpdTimeOut()
|
function wpdTimeOut() {
|
||||||
{
|
|
||||||
Zotero.debug("[wpdTimeOut] timeout triggered!");
|
Zotero.debug("[wpdTimeOut] timeout triggered!");
|
||||||
gTimedOut = true;
|
gTimedOut = true;
|
||||||
gBrowserWindow.clearTimeout(gTimeOutID);
|
gBrowserWindow.clearTimeout(gTimeOutID);
|
||||||
|
@ -125,13 +120,11 @@ function wpdTimeOut()
|
||||||
gBrowserWindow.setTimeout(gCallback, 0);
|
gBrowserWindow.setTimeout(gCallback, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function wpdIsTimedOut()
|
function wpdIsTimedOut() {
|
||||||
{
|
|
||||||
return gTimedOut;
|
return gTimedOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
function wpdLoadURL(aURI,aCallback)
|
function wpdLoadURL(aURI, aCallback) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
gTimedOut = false;
|
gTimedOut = false;
|
||||||
Zotero.debug("[wpdLoadURL] aURI: " + aURI);
|
Zotero.debug("[wpdLoadURL] aURI: " + aURI);
|
||||||
|
@ -193,8 +186,7 @@ var wpdCommon = {
|
||||||
|
|
||||||
// checks the CRLFs at the beginning - if there are CRLFs present
|
// checks the CRLFs at the beginning - if there are CRLFs present
|
||||||
// one additional CRLF will be added at the beginning
|
// one additional CRLF will be added at the beginning
|
||||||
checkCRLF : function (aNode)
|
checkCRLF: function (aNode) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var before = false;
|
var before = false;
|
||||||
var after = false;
|
var after = false;
|
||||||
|
@ -231,8 +223,7 @@ var wpdCommon = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
unicodeToEntity : function (text,charset)
|
unicodeToEntity: function (text, charset) {
|
||||||
{
|
|
||||||
|
|
||||||
function convertEntity(letter) {
|
function convertEntity(letter) {
|
||||||
try {
|
try {
|
||||||
|
@ -243,8 +234,7 @@ var wpdCommon = {
|
||||||
} else if ((l != letter)) {
|
} else if ((l != letter)) {
|
||||||
return "&#" + letter.charCodeAt(0) + ";";
|
return "&#" + letter.charCodeAt(0) + ";";
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {}
|
||||||
}
|
|
||||||
// now we check if the letter is valid inside the destination charset
|
// now we check if the letter is valid inside the destination charset
|
||||||
// (if the result is a ? it is not valid - except letter=?)
|
// (if the result is a ? it is not valid - except letter=?)
|
||||||
try {
|
try {
|
||||||
|
@ -252,8 +242,7 @@ var wpdCommon = {
|
||||||
if ((charset != "UTF-8") && (s == "?")) {
|
if ((charset != "UTF-8") && (s == "?")) {
|
||||||
return "&#" + letter.charCodeAt(0) + ";";
|
return "&#" + letter.charCodeAt(0) + ";";
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {}
|
||||||
}
|
|
||||||
return letter;
|
return letter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,25 +282,21 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
playSound : function()
|
playSound: function () {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var sound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
|
var sound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
|
||||||
sound.playSystemSound("ringin.wav");
|
sound.playSystemSound("ringin.wav");
|
||||||
} catch(ex) {
|
} catch (ex) {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// return the current focused window
|
// return the current focused window
|
||||||
getFocusedWindow : function()
|
getFocusedWindow: function () {
|
||||||
{
|
|
||||||
var win = document.commandDispatcher.focusedWindow;
|
var win = document.commandDispatcher.focusedWindow;
|
||||||
if (!win || win == window || win instanceof Components.interfaces.nsIDOMChromeWindow) win = window._content;
|
if (!win || win == window || win instanceof Components.interfaces.nsIDOMChromeWindow) win = window._content;
|
||||||
return win;
|
return win;
|
||||||
},
|
},
|
||||||
|
|
||||||
sizeWindow : function(w,h)
|
sizeWindow: function (w, h) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var window = this.getFocusedWindow();
|
var window = this.getFocusedWindow();
|
||||||
window.moveTo(0, 0);
|
window.moveTo(0, 0);
|
||||||
|
@ -319,13 +304,11 @@ var wpdCommon = {
|
||||||
if ((h == 0) || (w > screen.availHeight)) h = screen.availHeight;
|
if ((h == 0) || (w > screen.availHeight)) h = screen.availHeight;
|
||||||
window.resizeTo(w, h);
|
window.resizeTo(w, h);
|
||||||
window.focus();
|
window.focus();
|
||||||
} catch(ex) {
|
} catch (ex) {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// add a line to the error list (displays a maximum of 15 errors)
|
// add a line to the error list (displays a maximum of 15 errors)
|
||||||
addError : function(aError)
|
addError: function (aError) {
|
||||||
{
|
|
||||||
Zotero.debug('ERROR: ' + aError);
|
Zotero.debug('ERROR: ' + aError);
|
||||||
if (this.errCount < WPD_MAXUIERRORCOUNT) {
|
if (this.errCount < WPD_MAXUIERRORCOUNT) {
|
||||||
if (this.errList.indexOf(aError) > -1) return; // is the same
|
if (this.errList.indexOf(aError) > -1) return; // is the same
|
||||||
|
@ -348,8 +331,7 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// returns num as string of length i filled up with 0s
|
// returns num as string of length i filled up with 0s
|
||||||
addLeftZeros : function(num,i)
|
addLeftZeros: function (num, i) {
|
||||||
{
|
|
||||||
var s = "" + num;
|
var s = "" + num;
|
||||||
var r = "";
|
var r = "";
|
||||||
for (var f = 0; f < i - s.length; f++) r = r + "0";
|
for (var f = 0; f < i - s.length; f++) r = r + "0";
|
||||||
|
@ -357,8 +339,7 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// split the filename in filename and extension
|
// split the filename in filename and extension
|
||||||
splitFileName : function(aFileName)
|
splitFileName: function (aFileName) {
|
||||||
{
|
|
||||||
var pos = aFileName.lastIndexOf(".");
|
var pos = aFileName.lastIndexOf(".");
|
||||||
var ret = [];
|
var ret = [];
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
|
@ -372,8 +353,7 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// replace illegal characters
|
// replace illegal characters
|
||||||
getValidFileName : function(aFileName)
|
getValidFileName: function (aFileName) {
|
||||||
{
|
|
||||||
aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
|
aFileName = aFileName.replace(/[\"\?!~`]+/g, "");
|
||||||
aFileName = aFileName.replace(/[\*\&]+/g, "+");
|
aFileName = aFileName.replace(/[\*\&]+/g, "+");
|
||||||
aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
|
aFileName = aFileName.replace(/[\\\/\|\:;]+/g, "-");
|
||||||
|
@ -384,14 +364,12 @@ var wpdCommon = {
|
||||||
return aFileName;
|
return aFileName;
|
||||||
},
|
},
|
||||||
|
|
||||||
getURL : function()
|
getURL: function () {
|
||||||
{
|
|
||||||
return top.window._content.document.location.href;
|
return top.window._content.document.location.href;
|
||||||
},
|
},
|
||||||
|
|
||||||
// remove get variables from an URL
|
// remove get variables from an URL
|
||||||
removeGETFromURL : function(aURL)
|
removeGETFromURL: function (aURL) {
|
||||||
{
|
|
||||||
var pos;
|
var pos;
|
||||||
aURL = ((pos = aURL.indexOf("?")) != -1) ? aURL.substring(0, pos) : aURL;
|
aURL = ((pos = aURL.indexOf("?")) != -1) ? aURL.substring(0, pos) : aURL;
|
||||||
aURL = ((pos = aURL.indexOf("#")) != -1) ? aURL.substring(0, pos) : aURL;
|
aURL = ((pos = aURL.indexOf("#")) != -1) ? aURL.substring(0, pos) : aURL;
|
||||||
|
@ -399,24 +377,21 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// extract filename from URL
|
// extract filename from URL
|
||||||
getFileName : function(aURL)
|
getFileName: function (aURL) {
|
||||||
{
|
|
||||||
var pos;
|
var pos;
|
||||||
aURL = this.removeGETFromURL(aURL);
|
aURL = this.removeGETFromURL(aURL);
|
||||||
aURL = ((pos = aURL.lastIndexOf("/")) != -1) ? aURL.substring(++pos) : aURL;
|
aURL = ((pos = aURL.lastIndexOf("/")) != -1) ? aURL.substring(++pos) : aURL;
|
||||||
return aURL;
|
return aURL;
|
||||||
},
|
},
|
||||||
|
|
||||||
filePathToURI: function(filePath)
|
filePathToURI: function (filePath) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(filePath);
|
obj_File.initWithPath(filePath);
|
||||||
var obj_FPH = Components.classes["@mozilla.org/network/protocol;1?name=file"].getService(Components.interfaces.nsIFileProtocolHandler);
|
var obj_FPH = Components.classes["@mozilla.org/network/protocol;1?name=file"].getService(Components.interfaces.nsIFileProtocolHandler);
|
||||||
return obj_FPH.getURLSpecFromFile(obj_File);
|
return obj_FPH.getURLSpecFromFile(obj_File);
|
||||||
},
|
},
|
||||||
|
|
||||||
URLToFilePath: function(aURL)
|
URLToFilePath: function (aURL) {
|
||||||
{
|
|
||||||
var obj_FPH = Components.classes["@mozilla.org/network/protocol;1?name=file"].getService(Components.interfaces.nsIFileProtocolHandler);
|
var obj_FPH = Components.classes["@mozilla.org/network/protocol;1?name=file"].getService(Components.interfaces.nsIFileProtocolHandler);
|
||||||
try {
|
try {
|
||||||
return obj_FPH.getFileFromURLSpec(aURL).path;
|
return obj_FPH.getFileFromURLSpec(aURL).path;
|
||||||
|
@ -426,31 +401,27 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// right part of filepath/filename
|
// right part of filepath/filename
|
||||||
getFileLeafName: function(filePath)
|
getFileLeafName: function (filePath) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(filePath);
|
obj_File.initWithPath(filePath);
|
||||||
return obj_File.leafName;
|
return obj_File.leafName;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFilePath: function(filePath)
|
getFilePath: function (filePath) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(filePath);
|
obj_File.initWithPath(filePath);
|
||||||
var pos; // Added by Dan S. for Zotero
|
var pos; // Added by Dan S. for Zotero
|
||||||
return ((pos = filePath.lastIndexOf(obj_File.leafName)) != -1) ? filePath.substring(0, pos) : filePath;
|
return ((pos = filePath.lastIndexOf(obj_File.leafName)) != -1) ? filePath.substring(0, pos) : filePath;
|
||||||
},
|
},
|
||||||
|
|
||||||
appendFilePath: function(filePath,appendPath)
|
appendFilePath: function (filePath, appendPath) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(filePath);
|
obj_File.initWithPath(filePath);
|
||||||
obj_File.appendRelativePath(appendPath);
|
obj_File.appendRelativePath(appendPath);
|
||||||
return obj_File.path;
|
return obj_File.path;
|
||||||
},
|
},
|
||||||
|
|
||||||
pathExists: function(filePath)
|
pathExists: function (filePath) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].getService(Components.interfaces.nsILocalFile);
|
||||||
try {
|
try {
|
||||||
obj_File.initWithPath(filePath);
|
obj_File.initWithPath(filePath);
|
||||||
|
@ -461,18 +432,17 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// add the HTML Tag Stuff to aNode and embedd the aNode.innerHTML between the tags
|
// add the HTML Tag Stuff to aNode and embedd the aNode.innerHTML between the tags
|
||||||
nodeToHTMLString: function(aNode)
|
nodeToHTMLString: function (aNode) {
|
||||||
{
|
|
||||||
if (aNode == null) return "";
|
if (aNode == null) return "";
|
||||||
var tag = "<" + aNode.nodeName.toLowerCase();
|
var tag = "<" + aNode.nodeName.toLowerCase();
|
||||||
for ( var i=0; i<aNode.attributes.length; i++ )
|
for (var i = 0; i < aNode.attributes.length; i++) {
|
||||||
tag += ' ' + aNode.attributes[i].name + '="' + aNode.attributes[i].value + '"';
|
tag += ' ' + aNode.attributes[i].name + '="' + aNode.attributes[i].value + '"';
|
||||||
|
}
|
||||||
tag += ">\n";
|
tag += ">\n";
|
||||||
return tag + aNode.innerHTML + "</" + aNode.nodeName.toLowerCase() + ">\n";
|
return tag + aNode.innerHTML + "</" + aNode.nodeName.toLowerCase() + ">\n";
|
||||||
},
|
},
|
||||||
|
|
||||||
ConvertFromUnicode16 : function(aString,charset)
|
ConvertFromUnicode16: function (aString, charset) {
|
||||||
{
|
|
||||||
if (!aString) return "";
|
if (!aString) return "";
|
||||||
try {
|
try {
|
||||||
var UNICODE = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
|
var UNICODE = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
|
||||||
|
@ -485,8 +455,7 @@ var wpdCommon = {
|
||||||
return aString;
|
return aString;
|
||||||
},
|
},
|
||||||
|
|
||||||
ConvertToUnicode16 : function(aString,charset)
|
ConvertToUnicode16: function (aString, charset) {
|
||||||
{
|
|
||||||
if (!aString) return "";
|
if (!aString) return "";
|
||||||
try {
|
try {
|
||||||
var UNICODE = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
|
var UNICODE = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
|
||||||
|
@ -499,8 +468,7 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// convert the doctype to an HTML doctype String
|
// convert the doctype to an HTML doctype String
|
||||||
doctypeToHTMLString : function(aDoctype)
|
doctypeToHTMLString: function (aDoctype) {
|
||||||
{
|
|
||||||
if (!aDoctype) return "";
|
if (!aDoctype) return "";
|
||||||
var ret = "<!DOCTYPE " + aDoctype.name;
|
var ret = "<!DOCTYPE " + aDoctype.name;
|
||||||
if (aDoctype.publicId) ret += ' PUBLIC "' + aDoctype.publicId + '"';
|
if (aDoctype.publicId) ret += ' PUBLIC "' + aDoctype.publicId + '"';
|
||||||
|
@ -509,16 +477,14 @@ var wpdCommon = {
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
addCommentTag : function(targetNode, aComment)
|
addCommentTag: function (targetNode, aComment) {
|
||||||
{
|
|
||||||
targetNode.appendChild(document.createTextNode("\n"));
|
targetNode.appendChild(document.createTextNode("\n"));
|
||||||
targetNode.appendChild(document.createComment(aComment));
|
targetNode.appendChild(document.createComment(aComment));
|
||||||
targetNode.appendChild(document.createTextNode("\n"));
|
targetNode.appendChild(document.createTextNode("\n"));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
removeNodeFromParent : function(aNode)
|
removeNodeFromParent: function (aNode) {
|
||||||
{
|
|
||||||
// Added by Dan S. for Zotero
|
// Added by Dan S. for Zotero
|
||||||
var document = aNode.ownerDocument;
|
var document = aNode.ownerDocument;
|
||||||
|
|
||||||
|
@ -530,16 +496,14 @@ var wpdCommon = {
|
||||||
|
|
||||||
// convert URL String to Object
|
// convert URL String to Object
|
||||||
// for easier URL handling
|
// for easier URL handling
|
||||||
convertURLToObject : function(aURLString)
|
convertURLToObject: function (aURLString) {
|
||||||
{
|
|
||||||
var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
|
var aURL = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURL);
|
||||||
aURL.spec = aURLString;
|
aURL.spec = aURLString;
|
||||||
return aURL;
|
return aURL;
|
||||||
},
|
},
|
||||||
|
|
||||||
// resolves the relative URL (aRelURL) with the base URL (aBaseURL)
|
// resolves the relative URL (aRelURL) with the base URL (aBaseURL)
|
||||||
resolveURL : function(aBaseURL, aRelURL)
|
resolveURL: function (aBaseURL, aRelURL) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var aBaseURLObj = this.convertURLToObject(aBaseURL);
|
var aBaseURLObj = this.convertURLToObject(aBaseURL);
|
||||||
return aBaseURLObj.resolve(aRelURL);
|
return aBaseURLObj.resolve(aRelURL);
|
||||||
|
@ -549,8 +513,7 @@ var wpdCommon = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getHostName : function(aURL)
|
getHostName: function (aURL) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var aURLObj = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
|
var aURLObj = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
|
||||||
aURLObj.spec = aURL
|
aURLObj.spec = aURL
|
||||||
|
@ -561,8 +524,7 @@ var wpdCommon = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
convertUrlToASCII : function(aURL)
|
convertUrlToASCII: function (aURL) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var aURLObj = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
|
var aURLObj = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
|
||||||
aURLObj.spec = aURL
|
aURLObj.spec = aURL
|
||||||
|
@ -573,32 +535,27 @@ var wpdCommon = {
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
createDir : function(str_Dir)
|
createDir: function (str_Dir) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(str_Dir);
|
obj_File.initWithPath(str_Dir);
|
||||||
if (!obj_File.exists())
|
if (!obj_File.exists()) obj_File.create(obj_File.DIRECTORY_TYPE, 0700);
|
||||||
obj_File.create(obj_File.DIRECTORY_TYPE, 0700);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
readDir : function(str_Dir)
|
readDir: function (str_Dir) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(str_Dir);
|
obj_File.initWithPath(str_Dir);
|
||||||
if (obj_File.exists()) return obj_File.directoryEntries;
|
if (obj_File.exists()) return obj_File.directoryEntries;
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
fileSize : function(str_Filename)
|
fileSize: function (str_Filename) {
|
||||||
{
|
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(str_Filename);
|
obj_File.initWithPath(str_Filename);
|
||||||
return obj_File.fileSize;
|
return obj_File.fileSize;
|
||||||
},
|
},
|
||||||
|
|
||||||
// read the file (str_Filename) to a String Buffer (str_Buffer)
|
// read the file (str_Filename) to a String Buffer (str_Buffer)
|
||||||
readFile : function(str_Filename,removeComments,text)
|
readFile: function (str_Filename, removeComments, text) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(str_Filename);
|
obj_File.initWithPath(str_Filename);
|
||||||
|
@ -629,14 +586,12 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// write the String Buffer (str_Buffer) to a file (str_Filename)
|
// write the String Buffer (str_Buffer) to a file (str_Filename)
|
||||||
writeFile : function(str_Buffer,str_Filename)
|
writeFile: function (str_Buffer, str_Filename) {
|
||||||
{
|
|
||||||
if (MODE_SIMULATE) return true;
|
if (MODE_SIMULATE) return true;
|
||||||
try {
|
try {
|
||||||
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
obj_File.initWithPath(str_Filename);
|
obj_File.initWithPath(str_Filename);
|
||||||
if (!obj_File.exists())
|
if (!obj_File.exists()) obj_File.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||||
obj_File.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666 );
|
|
||||||
|
|
||||||
var obj_Transport = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
var obj_Transport = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||||
|
|
||||||
|
@ -675,17 +630,14 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
copyFile : function(sourcefile,destfile)
|
copyFile: function (sourcefile, destfile) {
|
||||||
{
|
|
||||||
|
|
||||||
var destdir = this.getFilePath(destfile);
|
var destdir = this.getFilePath(destfile);
|
||||||
destfile = this.getFileLeafName(destfile);
|
destfile = this.getFileLeafName(destfile);
|
||||||
var aFile = Components.classes["@mozilla.org/file/local;1"]
|
var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
.createInstance(Components.interfaces.nsILocalFile);
|
|
||||||
if (!aFile) return false;
|
if (!aFile) return false;
|
||||||
|
|
||||||
var aDir = Components.classes["@mozilla.org/file/local;1"]
|
var aDir = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
.createInstance(Components.interfaces.nsILocalFile);
|
|
||||||
if (!aDir) return false;
|
if (!aDir) return false;
|
||||||
|
|
||||||
aFile.initWithPath(sourcefile);
|
aFile.initWithPath(sourcefile);
|
||||||
|
@ -698,8 +650,7 @@ var wpdCommon = {
|
||||||
|
|
||||||
// download aSourceURL to aTargetFilename
|
// download aSourceURL to aTargetFilename
|
||||||
// (works also on local files...)
|
// (works also on local files...)
|
||||||
downloadFile : function (aSourceURL,aTargetFilename)
|
downloadFile: function (aSourceURL, aTargetFilename) {
|
||||||
{
|
|
||||||
if (MODE_SIMULATE) return true;
|
if (MODE_SIMULATE) return true;
|
||||||
try {
|
try {
|
||||||
//new obj_URI object
|
//new obj_URI object
|
||||||
|
@ -718,14 +669,19 @@ var wpdCommon = {
|
||||||
|
|
||||||
// set flags
|
// set flags
|
||||||
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
|
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
|
||||||
var flags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
|
var flags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES | nsIWBP.PERSIST_FLAGS_FROM_CACHE;
|
||||||
nsIWBP.PERSIST_FLAGS_FROM_CACHE;
|
|
||||||
//nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
//nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||||
obj_Persist.persistFlags = flags;
|
obj_Persist.persistFlags = flags;
|
||||||
|
|
||||||
// has the url the same filetype like the file extension?
|
// has the url the same filetype like the file extension?
|
||||||
//save file to target
|
//save file to target
|
||||||
|
try {
|
||||||
obj_Persist.saveURI(obj_URI, null, null, null, null, obj_TargetFile);
|
obj_Persist.saveURI(obj_URI, null, null, null, null, obj_TargetFile);
|
||||||
|
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||||
|
// XXX Always use when we no longer support Firefox < 18
|
||||||
|
obj_Persist.saveURI(obj_URI, null, null, null, null, obj_TargetFile, null);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -737,43 +693,37 @@ var wpdCommon = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// get the integer preferences
|
// get the integer preferences
|
||||||
getIntPrefs : function (branch)
|
getIntPrefs: function (branch) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
||||||
return mPrefSvc.getIntPref(branch);
|
return mPrefSvc.getIntPref(branch);
|
||||||
},
|
},
|
||||||
|
|
||||||
// set the integer preferences
|
// set the integer preferences
|
||||||
setIntPrefs : function (branch,value)
|
setIntPrefs: function (branch, value) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
||||||
return mPrefSvc.setIntPref(branch, value);
|
return mPrefSvc.setIntPref(branch, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
// get the integer preferences
|
// get the integer preferences
|
||||||
getStrPrefs : function (branch)
|
getStrPrefs: function (branch) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
||||||
return mPrefSvc.getCharPref(branch);
|
return mPrefSvc.getCharPref(branch);
|
||||||
},
|
},
|
||||||
|
|
||||||
// set the string preferences
|
// set the string preferences
|
||||||
setStrPrefs : function (branch,value)
|
setStrPrefs: function (branch, value) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
||||||
return mPrefSvc.setCharPref(branch, value);
|
return mPrefSvc.setCharPref(branch, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
// get the string preferences
|
// get the string preferences
|
||||||
getStrPrefsEx : function (branch)
|
getStrPrefsEx: function (branch) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||||
return mPrefSvc.getComplexValue(branch, Components.interfaces.nsISupportsString).data;
|
return mPrefSvc.getComplexValue(branch, Components.interfaces.nsISupportsString).data;
|
||||||
},
|
},
|
||||||
|
|
||||||
// set the string preferences
|
// set the string preferences
|
||||||
setStrPrefsEx : function (branch,value)
|
setStrPrefsEx: function (branch, value) {
|
||||||
{
|
|
||||||
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
|
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
|
||||||
str.data = value;
|
str.data = value;
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||||
|
@ -782,12 +732,9 @@ var wpdCommon = {
|
||||||
|
|
||||||
|
|
||||||
// Get the preferences branch ("browser.download." for normal 'save' mode)...
|
// Get the preferences branch ("browser.download." for normal 'save' mode)...
|
||||||
setBoolPrefs : function (branch,value)
|
setBoolPrefs: function (branch, value) {
|
||||||
{
|
|
||||||
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
var mPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
|
||||||
return mPrefSvc.setBoolPref(branch, value);
|
return mPrefSvc.setBoolPref(branch, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
// "WebPageDump" Firefox Extension
|
// "WebPageDump" Firefox Extension
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
@ -67,9 +66,7 @@
|
||||||
//
|
//
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// TO DO: use version information from rdf file...
|
// TO DO: use version information from rdf file...
|
||||||
var WPD_VERSION = "0.2";
|
var WPD_VERSION = "0.2";
|
||||||
|
|
||||||
|
@ -88,7 +85,7 @@ var WPD_CRLFBUG = true;
|
||||||
// the ConvertToEntities XPCOM function for generating usual
|
// the ConvertToEntities XPCOM function for generating usual
|
||||||
// HTML Entities...
|
// HTML Entities...
|
||||||
// (this is precisely not a bug but a concept failure)
|
// (this is precisely not a bug but a concept failure)
|
||||||
var WPD_ENTITYBUG = true;
|
var WPD_ENTITYBUG = false;
|
||||||
|
|
||||||
// CSSSCROLLBUG: The css "scroll" property of "background" is
|
// CSSSCROLLBUG: The css "scroll" property of "background" is
|
||||||
// loosing the zero vertical position leading to a false
|
// loosing the zero vertical position leading to a false
|
||||||
|
@ -109,7 +106,7 @@ var WPD_CSSBACKGROUNDPOSITIONBUG = true;
|
||||||
// leave the doctype at the original position before the
|
// leave the doctype at the original position before the
|
||||||
// HTML tag <HTML> and insert the doctype entry a second
|
// HTML tag <HTML> and insert the doctype entry a second
|
||||||
// time below the <HTML> tag...
|
// time below the <HTML> tag...
|
||||||
var WPD_DOCTYPEBUG = true;
|
var WPD_DOCTYPEBUG = false;
|
||||||
|
|
||||||
// JAVASCRIPTSRCBUG: Deleting the "src" attribute together
|
// JAVASCRIPTSRCBUG: Deleting the "src" attribute together
|
||||||
// with the whole <SCRIPT> tag may result in unexpected
|
// with the whole <SCRIPT> tag may result in unexpected
|
||||||
|
@ -145,8 +142,7 @@ var wpdDOMSaver = {
|
||||||
dateObj: null,
|
dateObj: null,
|
||||||
|
|
||||||
// initialize the properties (set document, URL, Directory, ...)
|
// initialize the properties (set document, URL, Directory, ...)
|
||||||
init : function(fileName, document)
|
init: function (fileName, document) {
|
||||||
{
|
|
||||||
Zotero.debug("[wpdDOMSaver.init] ...");
|
Zotero.debug("[wpdDOMSaver.init] ...");
|
||||||
|
|
||||||
this.name = "";
|
this.name = "";
|
||||||
|
@ -213,11 +209,9 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
|
|
||||||
// get all frames in the document (recursively) and save in this.frameList
|
// get all frames in the document (recursively) and save in this.frameList
|
||||||
setFrameList : function(aDocument)
|
setFrameList: function (aDocument) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
for ( var f=0; f<aDocument.frames.length; f++ )
|
for (var f = 0; f < aDocument.frames.length; f++) {
|
||||||
{
|
|
||||||
this.frameList.push(aDocument.frames[f]);
|
this.frameList.push(aDocument.frames[f]);
|
||||||
this.setFrameList(aDocument.frames[f]);
|
this.setFrameList(aDocument.frames[f]);
|
||||||
}
|
}
|
||||||
|
@ -225,8 +219,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// resolve the javascript links inside the attributes (e.g. onclick,...)
|
// resolve the javascript links inside the attributes (e.g. onclick,...)
|
||||||
normalizeJavaScriptLink : function(aNode, aAttr)
|
normalizeJavaScriptLink: function (aNode, aAttr) {
|
||||||
{
|
|
||||||
var val = aNode.getAttribute(aAttr); // get the attribute value and check for link stuff
|
var val = aNode.getAttribute(aAttr); // get the attribute value and check for link stuff
|
||||||
if (!val.match(/\(\'([^\']+)\'/)) return aNode;
|
if (!val.match(/\(\'([^\']+)\'/)) return aNode;
|
||||||
val = RegExp.$1;
|
val = RegExp.$1;
|
||||||
|
@ -250,17 +243,37 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// check if the file extension of the url is specified in the options array
|
// check if the file extension of the url is specified in the options array
|
||||||
checkFileTypeOptions : function (aURL)
|
checkFileTypeOptions: function (aURL) {
|
||||||
{
|
|
||||||
var ext = wpdCommon.splitFileName(wpdCommon.getFileName(aURL))[1].toLowerCase();
|
var ext = wpdCommon.splitFileName(wpdCommon.getFileName(aURL))[1].toLowerCase();
|
||||||
var flag = false;
|
var flag = false;
|
||||||
switch ( ext )
|
switch (ext) {
|
||||||
{
|
case "jpg":
|
||||||
case "jpg" : case "jpeg" : case "png" : case "gif" : flag = this.option["image"]; break;
|
case "jpeg":
|
||||||
case "mp3" : case "wav" : case "ram" : case "wma" : flag = this.option["sound"]; break;
|
case "png":
|
||||||
case "mpg" : case "mpeg" : case "avi" :
|
case "gif":
|
||||||
case "ram" : case "rm" : case "mov" : case "wmv" : flag = this.option["movie"]; break;
|
flag = this.option["image"];
|
||||||
case "zip" : case "lzh" : case "rar" : case "xpi" : flag = this.option["archive"]; break;
|
break;
|
||||||
|
case "mp3":
|
||||||
|
case "wav":
|
||||||
|
case "ram":
|
||||||
|
case "wma":
|
||||||
|
flag = this.option["sound"];
|
||||||
|
break;
|
||||||
|
case "mpg":
|
||||||
|
case "mpeg":
|
||||||
|
case "avi":
|
||||||
|
case "ram":
|
||||||
|
case "rm":
|
||||||
|
case "mov":
|
||||||
|
case "wmv":
|
||||||
|
flag = this.option["movie"];
|
||||||
|
break;
|
||||||
|
case "zip":
|
||||||
|
case "lzh":
|
||||||
|
case "rar":
|
||||||
|
case "xpi":
|
||||||
|
flag = this.option["archive"];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (ext && this.option["custom"]) {
|
if (ext && this.option["custom"]) {
|
||||||
if ((", " + this.option["custom"] + ", ").indexOf(", " + ext + ", ") != -1) flag = true;
|
if ((", " + this.option["custom"] + ", ").indexOf(", " + ext + ", ") != -1) flag = true;
|
||||||
|
@ -272,8 +285,7 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
|
|
||||||
// do the conversion from the DOM Text to the destination Charset
|
// do the conversion from the DOM Text to the destination Charset
|
||||||
convertEntity : function(aText)
|
convertEntity: function (aText) {
|
||||||
{
|
|
||||||
if (this.option["encodeUTF8"]) {
|
if (this.option["encodeUTF8"]) {
|
||||||
return wpdCommon.unicodeToEntity(aText, "UTF-8");
|
return wpdCommon.unicodeToEntity(aText, "UTF-8");
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,8 +294,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// we only can manage GIF animations - Flash does not work...
|
// we only can manage GIF animations - Flash does not work...
|
||||||
disableAnimation : function(aNode)
|
disableAnimation: function (aNode) {
|
||||||
{
|
|
||||||
// thanx to pageanimator extension...
|
// thanx to pageanimator extension...
|
||||||
/* try {
|
/* try {
|
||||||
//dump("inspecting "+aNode.nodeName+"\n");
|
//dump("inspecting "+aNode.nodeName+"\n");
|
||||||
|
@ -305,8 +316,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// get the node value of aNode directly from the actual DOM tree (WPD_CLONENODEBUG)
|
// get the node value of aNode directly from the actual DOM tree (WPD_CLONENODEBUG)
|
||||||
getCurrentNodeValue : function(aNode)
|
getCurrentNodeValue: function (aNode) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
this.curDocument.body.cloneNode(false);
|
this.curDocument.body.cloneNode(false);
|
||||||
var body = this.curDocument.body;
|
var body = this.curDocument.body;
|
||||||
|
@ -317,9 +327,7 @@ var wpdDOMSaver = {
|
||||||
var nodes = this.curBody.getElementsByTagName(aNode.nodeName);
|
var nodes = this.curBody.getElementsByTagName(aNode.nodeName);
|
||||||
if (refnodes.length != nodes.length) return aNode.value;
|
if (refnodes.length != nodes.length) return aNode.value;
|
||||||
for (var i = 0; i < refnodes.length; i++) {
|
for (var i = 0; i < refnodes.length; i++) {
|
||||||
if ( ( nodes[i]==aNode ) &&
|
if ((nodes[i] == aNode) && (refnodes[i].name == aNode.name) && (refnodes[i].defaultValue == aNode.defaultValue)) {
|
||||||
( refnodes[i].name==aNode.name ) &&
|
|
||||||
( refnodes[i].defaultValue==aNode.defaultValue ) ) {
|
|
||||||
return refnodes[i].value;
|
return refnodes[i].value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,14 +335,13 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// process the DOM Node (update the links, remove attributes and process the options)
|
// process the DOM Node (update the links, remove attributes and process the options)
|
||||||
processDOMNode : function(aNode)
|
processDOMNode: function (aNode) {
|
||||||
{
|
|
||||||
this.disableAnimation(aNode);
|
this.disableAnimation(aNode);
|
||||||
try {
|
try {
|
||||||
switch ( aNode.nodeName.toLowerCase() )
|
switch (aNode.nodeName.toLowerCase()) {
|
||||||
{
|
|
||||||
case "img":
|
case "img":
|
||||||
case "embed" : // "embed": embedding multimedia content
|
case "embed":
|
||||||
|
// "embed": embedding multimedia content
|
||||||
if (this.option["format"]) {
|
if (this.option["format"]) {
|
||||||
if (aNode.hasAttribute("onclick")) aNode = this.normalizeJavaScriptLink(aNode, "onclick");
|
if (aNode.hasAttribute("onclick")) aNode = this.normalizeJavaScriptLink(aNode, "onclick");
|
||||||
var aDownload = true;
|
var aDownload = true;
|
||||||
|
@ -350,7 +357,8 @@ var wpdDOMSaver = {
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
return wpdCommon.removeNodeFromParent(aNode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "object" : // for embedding different data sources in the html page
|
case "object":
|
||||||
|
// for embedding different data sources in the html page
|
||||||
if (this.option["format"]) {
|
if (this.option["format"]) {
|
||||||
var aFileName = this.download(aNode.data, true);
|
var aFileName = this.download(aNode.data, true);
|
||||||
// Changed by Dan S. for Zotero -- see this.repairRelativeLinks()
|
// Changed by Dan S. for Zotero -- see this.repairRelativeLinks()
|
||||||
|
@ -398,7 +406,8 @@ var wpdDOMSaver = {
|
||||||
if (WPD_ENTITYBUG) aNode.setAttribute("value", this.convertEntity(aNode.getAttribute("value")));
|
if (WPD_ENTITYBUG) aNode.setAttribute("value", this.convertEntity(aNode.getAttribute("value")));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "link" : // could containt urls (icon, stylesheet and fontdef)
|
case "link":
|
||||||
|
// could containt urls (icon, stylesheet and fontdef)
|
||||||
// We have to remove nodes with the stylesheet attribute because they will be added later
|
// We have to remove nodes with the stylesheet attribute because they will be added later
|
||||||
if ((aNode.getAttribute("rel").toLowerCase() == "stylesheet") && (aNode.getAttribute("href").indexOf("chrome://") == -1)) {
|
if ((aNode.getAttribute("rel").toLowerCase() == "stylesheet") && (aNode.getAttribute("href").indexOf("chrome://") == -1)) {
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
return wpdCommon.removeNodeFromParent(aNode);
|
||||||
|
@ -442,8 +451,7 @@ var wpdDOMSaver = {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "noscript":
|
case "noscript":
|
||||||
if ( !WPD_JAVASCRIPTSRCBUG )
|
if (!WPD_JAVASCRIPTSRCBUG) return wpdCommon.removeNodeFromParent(aNode);
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
|
||||||
break;
|
break;
|
||||||
case "a":
|
case "a":
|
||||||
case "area":
|
case "area":
|
||||||
|
@ -464,17 +472,11 @@ var wpdDOMSaver = {
|
||||||
aNode.setAttribute("action", wpdCommon.resolveURL(this.currentURL, aNode.action));
|
aNode.setAttribute("action", wpdCommon.resolveURL(this.currentURL, aNode.action));
|
||||||
break;
|
break;
|
||||||
case "meta":
|
case "meta":
|
||||||
if ( (aNode.hasAttribute("http-equiv") && aNode.hasAttribute("content")) &&
|
if ((aNode.hasAttribute("http-equiv") && aNode.hasAttribute("content")) && (aNode.getAttribute("http-equiv").toLowerCase() == "content-type") && (aNode.getAttribute("content").match(/charset\=/i))) {
|
||||||
(aNode.getAttribute("http-equiv").toLowerCase() == "content-type") &&
|
|
||||||
(aNode.getAttribute("content").match(/charset\=/i)) )
|
|
||||||
{
|
|
||||||
// we remove possible charset definitions because they will be added later
|
// we remove possible charset definitions because they will be added later
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
return wpdCommon.removeNodeFromParent(aNode);
|
||||||
}
|
}
|
||||||
if ( (aNode.hasAttribute("http-equiv") && aNode.hasAttribute("content")) &&
|
if ((aNode.hasAttribute("http-equiv") && aNode.hasAttribute("content")) && (aNode.getAttribute("http-equiv").toLowerCase() == "refresh") && (aNode.getAttribute("content").match(/URL\=/i))) {
|
||||||
(aNode.getAttribute("http-equiv").toLowerCase() == "refresh") &&
|
|
||||||
(aNode.getAttribute("content").match(/URL\=/i)) )
|
|
||||||
{
|
|
||||||
// there should be no refresh present - could be a noframe relict...
|
// there should be no refresh present - could be a noframe relict...
|
||||||
// (is already processed or timer is longer...)
|
// (is already processed or timer is longer...)
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
return wpdCommon.removeNodeFromParent(aNode);
|
||||||
|
@ -483,12 +485,12 @@ var wpdDOMSaver = {
|
||||||
case "base":
|
case "base":
|
||||||
//<BASE HREF="http://www.amin.org/look/amin/">
|
//<BASE HREF="http://www.amin.org/look/amin/">
|
||||||
// we need to set the base url to currenturl
|
// we need to set the base url to currenturl
|
||||||
if ( aNode.hasAttribute("href") && (aNode.getAttribute("href")!="") )
|
if (aNode.hasAttribute("href") && (aNode.getAttribute("href") != "")) this.currentURL = aNode.getAttribute("href");
|
||||||
this.currentURL=aNode.getAttribute("href");
|
|
||||||
return wpdCommon.removeNodeFromParent(aNode);
|
return wpdCommon.removeNodeFromParent(aNode);
|
||||||
break;
|
break;
|
||||||
case "frame":
|
case "frame":
|
||||||
case "iframe" : // normal and embedded frames (iframe) -> call "saveDocumentEx" for saving the frame document
|
case "iframe":
|
||||||
|
// normal and embedded frames (iframe) -> call "saveDocumentEx" for saving the frame document
|
||||||
try {
|
try {
|
||||||
// we don't have to worry about the currentURL - saveDocumentEx will set the
|
// we don't have to worry about the currentURL - saveDocumentEx will set the
|
||||||
// currentURL to the URL of the frame document and afterwards back to the baseURL
|
// currentURL to the URL of the frame document and afterwards back to the baseURL
|
||||||
|
@ -526,11 +528,9 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
|
|
||||||
// get through the DOM tree (recursiv function)
|
// get through the DOM tree (recursiv function)
|
||||||
processDOMRecursively : function(rootNode)
|
processDOMRecursively: function (rootNode) {
|
||||||
{
|
|
||||||
if (rootNode == null) return;
|
if (rootNode == null) return;
|
||||||
for ( var curNode = rootNode.firstChild; curNode != null; curNode = curNode.nextSibling )
|
for (var curNode = rootNode.firstChild; curNode != null; curNode = curNode.nextSibling) {
|
||||||
{
|
|
||||||
if (curNode.nodeName != "#text" && curNode.nodeName != "#comment") {
|
if (curNode.nodeName != "#text" && curNode.nodeName != "#comment") {
|
||||||
curNode = this.processDOMNode(curNode);
|
curNode = this.processDOMNode(curNode);
|
||||||
this.processDOMRecursively(curNode);
|
this.processDOMRecursively(curNode);
|
||||||
|
@ -549,8 +549,7 @@ var wpdDOMSaver = {
|
||||||
// style attribute does not work - innerHTML will finally
|
// style attribute does not work - innerHTML will finally
|
||||||
// generate e.g "repeat scroll 0%;" regardless of the style setting
|
// generate e.g "repeat scroll 0%;" regardless of the style setting
|
||||||
// (e.g. "repeat;")
|
// (e.g. "repeat;")
|
||||||
repairInlineCSS : function(aHTMLText)
|
repairInlineCSS: function (aHTMLText) {
|
||||||
{
|
|
||||||
if ((WPD_CSSSCROLLBUG) && (aHTMLText.match(/background:/i))) {
|
if ((WPD_CSSSCROLLBUG) && (aHTMLText.match(/background:/i))) {
|
||||||
// Regex fixed by Dan for Zotero
|
// Regex fixed by Dan for Zotero
|
||||||
//var re = new RegExp(/style=\"(.*)background:(.*)(repeat scroll 0(?:pt|px|%);)/);
|
//var re = new RegExp(/style=\"(.*)background:(.*)(repeat scroll 0(?:pt|px|%);)/);
|
||||||
|
@ -576,8 +575,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
relativeLinkFix : function(aFileName)
|
relativeLinkFix: function (aFileName) {
|
||||||
{
|
|
||||||
return "about:blank?" + aFileName;
|
return "about:blank?" + aFileName;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -585,15 +583,13 @@ var wpdDOMSaver = {
|
||||||
// which are prepended with "about:blank?" to fix a bug in Scrapbook/WPD
|
// which are prepended with "about:blank?" to fix a bug in Scrapbook/WPD
|
||||||
// that sending an invalid request to the server when the img src
|
// that sending an invalid request to the server when the img src
|
||||||
// is a relative link to a file in a different directory
|
// is a relative link to a file in a different directory
|
||||||
repairRelativeLinks : function(aHTMLText)
|
repairRelativeLinks: function (aHTMLText) {
|
||||||
{
|
|
||||||
return aHTMLText.replace(/(src)="about:blank\?([^"]*)"/g, '$1="$2"');
|
return aHTMLText.replace(/(src)="about:blank\?([^"]*)"/g, '$1="$2"');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// process the CSS text of one stylesheet element
|
// process the CSS text of one stylesheet element
|
||||||
processCSSText : function(aCSStext, aCSShref, inline)
|
processCSSText: function (aCSStext, aCSShref, inline) {
|
||||||
{
|
|
||||||
if (!aCSStext) return "";
|
if (!aCSStext) return "";
|
||||||
|
|
||||||
// search for "url" entries inside the css
|
// search for "url" entries inside the css
|
||||||
|
@ -616,10 +612,8 @@ var wpdDOMSaver = {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if ( (WPD_CSSSCROLLBUG) && ( aCSStext.match(/background: /i)) )
|
if ((WPD_CSSSCROLLBUG) && (aCSStext.match(/background: /i))) aCSStext = aCSStext.replace(/ scroll 0(pt|px|%);/g, ";");
|
||||||
aCSStext = aCSStext.replace(/ scroll 0(pt|px|%);/g, ";");
|
if ((WPD_CSSBACKGROUNDPOSITIONBUG) && (aCSStext.match(/background-position: /i))) aCSStext = aCSStext.replace(/ background-position: 0(pt|px|%);/g, ";");
|
||||||
if ( (WPD_CSSBACKGROUNDPOSITIONBUG) && ( aCSStext.match(/background-position: /i)) )
|
|
||||||
aCSStext = aCSStext.replace(/ background-position: 0(pt|px|%);/g, ";");
|
|
||||||
return aCSStext;
|
return aCSStext;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -632,8 +626,7 @@ var wpdDOMSaver = {
|
||||||
// MEDIA_RULE = 4,
|
// MEDIA_RULE = 4,
|
||||||
// FONT_FACE_RULE = 5,
|
// FONT_FACE_RULE = 5,
|
||||||
// PAGE_RULE = 6
|
// PAGE_RULE = 6
|
||||||
processCSSRecursively : function(aCSS)
|
processCSSRecursively: function (aCSS) {
|
||||||
{
|
|
||||||
if (aCSS.disabled) return "";
|
if (aCSS.disabled) return "";
|
||||||
var content = "";
|
var content = "";
|
||||||
var medium = aCSS.media.mediaText;
|
var medium = aCSS.media.mediaText;
|
||||||
|
@ -649,10 +642,8 @@ var wpdDOMSaver = {
|
||||||
// element appears within <body> instead of <head>
|
// element appears within <body> instead of <head>
|
||||||
try {
|
try {
|
||||||
aCSS.cssRules
|
aCSS.cssRules
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
var msg = "Unable to access cssRules property of " + aCSS.href + " in wpdDOMSaver.processCSSRecursively()";
|
||||||
var msg = "Unable to access cssRules property of " + aCSS.href
|
|
||||||
+ " in wpdDOMSaver.processCSSRecursively()";
|
|
||||||
Zotero.debug("WebPageDump: " + msg, 2);
|
Zotero.debug("WebPageDump: " + msg, 2);
|
||||||
Components.utils.reportError(msg);
|
Components.utils.reportError(msg);
|
||||||
return "";
|
return "";
|
||||||
|
@ -674,31 +665,51 @@ var wpdDOMSaver = {
|
||||||
return content;
|
return content;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//given a file name and source URL (optional) with content (optional)
|
||||||
|
//returns a unique file name and registers it
|
||||||
|
getUniqueFileNameAndRegister: function(fileName, sourceURL, content) {
|
||||||
|
fileName = this.checkForEqualFilenames(
|
||||||
|
wpdCommon.getValidFileName(fileName).toLowerCase(),
|
||||||
|
sourceURL);
|
||||||
|
this.registerFile(fileName, sourceURL, content);
|
||||||
|
return fileName;
|
||||||
|
},
|
||||||
|
|
||||||
|
//register filename, so we don't overwrite them later
|
||||||
|
registerFile: function (newFileName, sourceURL, content) {
|
||||||
|
this.fileInfo[newFileName] = {
|
||||||
|
url: sourceURL,
|
||||||
|
downloaded: content
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// is the file registered (e.g. downloaded)?
|
// is the file registered (e.g. downloaded)?
|
||||||
isFileRegistered : function(newFileName)
|
isFileRegistered: function (newFileName) {
|
||||||
{
|
if (this.fileInfo[newFileName] != undefined) return true;
|
||||||
if ( this.fileInfo[newFileName] != undefined )
|
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isDownloaded: function(fileName) {
|
||||||
|
if(!this.fileInfo[fileName]) return;
|
||||||
|
return this.fileInfo[fileName].downloaded;
|
||||||
|
},
|
||||||
|
|
||||||
// check for equal Filenames with different locations
|
// check for equal Filenames with different locations
|
||||||
// if this is the case, we generate a new name...
|
// if this is the case, we generate a new name
|
||||||
checkForEqualFilenames : function(newFileName,aURLSpec)
|
// if no aURLSpec is passed, this generates a unique file name
|
||||||
{
|
checkForEqualFilenames: function (newFileName, aURLSpec) {
|
||||||
if (this.isFileRegistered(newFileName)) {
|
if (this.isFileRegistered(newFileName)) {
|
||||||
if (this.fileInfo[newFileName]["url"] != aURLSpec ) {
|
if (!aURLSpec || this.fileInfo[newFileName]["url"] != aURLSpec) {
|
||||||
// the file is already registered but from a different location
|
// the file is already registered but from a different location
|
||||||
// => probably not the same file, so we have to find a different name it (e.g. filename_001.ext)
|
// => probably not the same file, so we have to find a different name it (e.g. filename_001.ext)
|
||||||
var seq = 1;
|
var seq = 1;
|
||||||
var fileLR = wpdCommon.splitFileName(newFileName);
|
var fileLR = wpdCommon.splitFileName(newFileName);
|
||||||
if (!fileLR[1]) fileLR[1] = "dat";
|
if (!fileLR[1]) fileLR[1] = "dat";
|
||||||
while ( this.fileInfo[newFileName] != undefined )
|
newFileName = fileLR[0] + "_" + wpdCommon.addLeftZeros(seq++, 3) + "." + fileLR[1];
|
||||||
{
|
while (this.fileInfo[newFileName] != undefined) {
|
||||||
// is the file already registered with the new name?
|
// is the file already registered with the new name?
|
||||||
if ( this.fileInfo[newFileName]["url"] == aURLSpec )
|
if (aURLSpec && this.fileInfo[newFileName]["url"] == aURLSpec) return newFileName; // Yes -> so it<69>s already downloaded and we are finished
|
||||||
return newFileName; // Yes -> so it<69>s already downloaded and we are finished
|
newFileName = fileLR[0] + "_" + wpdCommon.addLeftZeros(seq++, 3) + "." + fileLR[1]; // No -> "increment" filename
|
||||||
newFileName = fileLR[0] + "_" + wpdCommon.addLeftZeros(++seq,3) + "." + fileLR[1]; // No -> "increment" filename
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,13 +718,11 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
// Download the specified URL to "this.currentDir". Takes
|
// Download the specified URL to "this.currentDir". Takes
|
||||||
// care about equal filenames from different locations
|
// care about equal filenames from different locations
|
||||||
download : function(aURLSpec,aDownload)
|
download: function (aURLSpec, aDownload) {
|
||||||
{
|
|
||||||
if (!aURLSpec) return "";
|
if (!aURLSpec) return "";
|
||||||
|
|
||||||
// is this a relative URL (no protocol present) which needs to be resolved?
|
// is this a relative URL (no protocol present) which needs to be resolved?
|
||||||
if ( aURLSpec.indexOf("://") < 0 )
|
if (aURLSpec.indexOf("://") < 0) aURLSpec = wpdCommon.resolveURL(this.currentURL, aURLSpec);
|
||||||
aURLSpec = wpdCommon.resolveURL(this.currentURL, aURLSpec);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var aURL = wpdCommon.convertURLToObject(aURLSpec);
|
var aURL = wpdCommon.convertURLToObject(aURLSpec);
|
||||||
|
@ -723,16 +732,15 @@ var wpdDOMSaver = {
|
||||||
if (!newFileName) newFileName = "untitled";
|
if (!newFileName) newFileName = "untitled";
|
||||||
newFileName = wpdCommon.getValidFileName(newFileName);
|
newFileName = wpdCommon.getValidFileName(newFileName);
|
||||||
// same name but different location?
|
// same name but different location?
|
||||||
newFileName = this.checkForEqualFilenames(newFileName,aURLSpec);
|
newFileName = this.getUniqueFileNameAndRegister(newFileName, aURLSpec);
|
||||||
|
|
||||||
// is the file already registered (processed) ?
|
// is the file already registered (processed) ?
|
||||||
if ( this.isFileRegistered(newFileName)==false ) {
|
if (!this.isDownloaded(newFileName)) {
|
||||||
// No -> we have to download and register the file
|
if (aDownload) {
|
||||||
this.fileInfo[newFileName] = new Array("url","downloaded");
|
aDownload = wpdCommon.downloadFile(aURLSpec, this.currentDir + newFileName);
|
||||||
this.fileInfo[newFileName]["url"] = aURLSpec;
|
} else {
|
||||||
this.fileInfo[newFileName]["downloaded"] = true;
|
aDownload = true;
|
||||||
if (aDownload)
|
}
|
||||||
this.fileInfo[newFileName]["downloaded"] = wpdCommon.downloadFile(aURLSpec,this.currentDir+newFileName);
|
this.registerFile(newFileName, aURLSpec, aDownload);
|
||||||
}
|
}
|
||||||
return newFileName;
|
return newFileName;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -742,14 +750,13 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get a CSS filename node for inserting in the DOM Tree
|
// Get a CSS filename node for inserting in the DOM Tree
|
||||||
createCSSFileNode : function(aDocument,rootNode,aFileName)
|
createCSSFileNode: function (aDocument, rootNode, aFileName) {
|
||||||
{
|
|
||||||
var newLinkNode = aDocument.createElement("link");
|
var newLinkNode = aDocument.createElement("link");
|
||||||
|
|
||||||
rootNode.firstChild.appendChild(aDocument.createTextNode("\n"));
|
rootNode.firstChild.appendChild(aDocument.createTextNode("\n"));
|
||||||
|
|
||||||
newLinkNode.setAttribute("media", "all");
|
newLinkNode.setAttribute("media", "all");
|
||||||
newLinkNode.setAttribute("href", aFileName + ".css");
|
newLinkNode.setAttribute("href", aFileName);
|
||||||
newLinkNode.setAttribute("type", "text/css");
|
newLinkNode.setAttribute("type", "text/css");
|
||||||
newLinkNode.setAttribute("rel", "stylesheet");
|
newLinkNode.setAttribute("rel", "stylesheet");
|
||||||
|
|
||||||
|
@ -760,8 +767,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Creates a placeholder node for inserting the DOCTYPE after the html tag
|
// Creates a placeholder node for inserting the DOCTYPE after the html tag
|
||||||
createPseudeDocTypeNode : function(aDocument,rootNode)
|
createPseudeDocTypeNode: function (aDocument, rootNode) {
|
||||||
{
|
|
||||||
var aDoctype = aDocument.doctype;
|
var aDoctype = aDocument.doctype;
|
||||||
if (!aDoctype) return;
|
if (!aDoctype) return;
|
||||||
try {
|
try {
|
||||||
|
@ -777,8 +783,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// replaces the placeholder node generated by createPseudeDocTypeNode with the DOCTYPE
|
// replaces the placeholder node generated by createPseudeDocTypeNode with the DOCTYPE
|
||||||
replaceDocType : function(aDocument,aHTMLText)
|
replaceDocType: function (aDocument, aHTMLText) {
|
||||||
{
|
|
||||||
var aDoctype = aDocument.doctype;
|
var aDoctype = aDocument.doctype;
|
||||||
if (!aDoctype) return aHTMLText;
|
if (!aDoctype) return aHTMLText;
|
||||||
try {
|
try {
|
||||||
|
@ -791,8 +796,7 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
// Returns the HTML Text generated from rootNode and does
|
// Returns the HTML Text generated from rootNode and does
|
||||||
// some processing (WPD_DOCTYPEBUG, WPD_ENTITYBUG, cleaning,...)
|
// some processing (WPD_DOCTYPEBUG, WPD_ENTITYBUG, cleaning,...)
|
||||||
generateHTMLString : function(aDocument,rootNode)
|
generateHTMLString: function (aDocument, rootNode) {
|
||||||
{
|
|
||||||
if (WPD_DOCTYPEBUG) this.createPseudeDocTypeNode(aDocument, rootNode);
|
if (WPD_DOCTYPEBUG) this.createPseudeDocTypeNode(aDocument, rootNode);
|
||||||
var HTMLText = wpdCommon.nodeToHTMLString(rootNode);
|
var HTMLText = wpdCommon.nodeToHTMLString(rootNode);
|
||||||
if (WPD_DOCTYPEBUG) HTMLText = this.replaceDocType(aDocument, HTMLText);
|
if (WPD_DOCTYPEBUG) HTMLText = this.replaceDocType(aDocument, HTMLText);
|
||||||
|
@ -810,8 +814,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a DOCTYPE definition string based on aDocument.doctype
|
// Returns a DOCTYPE definition string based on aDocument.doctype
|
||||||
getDocType : function(aDocument)
|
getDocType: function (aDocument) {
|
||||||
{
|
|
||||||
var aDoctype = aDocument.doctype;
|
var aDoctype = aDocument.doctype;
|
||||||
if (!aDoctype) return "";
|
if (!aDoctype) return "";
|
||||||
var dt = "<!DOCTYPE " + aDoctype.name;
|
var dt = "<!DOCTYPE " + aDoctype.name;
|
||||||
|
@ -822,8 +825,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get the meta charset information from the document
|
// Get the meta charset information from the document
|
||||||
getMetaCharset : function(aDocument)
|
getMetaCharset: function (aDocument) {
|
||||||
{
|
|
||||||
var metas = aDocument.getElementsByTagName("meta");
|
var metas = aDocument.getElementsByTagName("meta");
|
||||||
for (var i = metas.length; --i >= 0;) {
|
for (var i = metas.length; --i >= 0;) {
|
||||||
var meta = metas[i];
|
var meta = metas[i];
|
||||||
|
@ -837,8 +839,7 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
|
|
||||||
// Create and return a meta charset node for the DOM Tree
|
// Create and return a meta charset node for the DOM Tree
|
||||||
createMetaCharsetNode : function(aDocument,rootNode,aContentType,aCharSet)
|
createMetaCharsetNode: function (aDocument, rootNode, aContentType, aCharSet) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var metaNode = aDocument.createElement("meta");
|
var metaNode = aDocument.createElement("meta");
|
||||||
rootNode.firstChild.insertBefore(aDocument.createTextNode("\n"), rootNode.firstChild.firstChild);
|
rootNode.firstChild.insertBefore(aDocument.createTextNode("\n"), rootNode.firstChild.firstChild);
|
||||||
|
@ -855,8 +856,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// get a meta node for the DOM Tree
|
// get a meta node for the DOM Tree
|
||||||
createMetaNameNode : function(aDocument,rootNode,name,content)
|
createMetaNameNode: function (aDocument, rootNode, name, content) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
var metaNode = aDocument.createElement("meta");
|
var metaNode = aDocument.createElement("meta");
|
||||||
|
|
||||||
|
@ -884,8 +884,7 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
|
|
||||||
// Return the WPD Meta Base URL Information from aFile
|
// Return the WPD Meta Base URL Information from aFile
|
||||||
getMetaBaseURL : function(aFile)
|
getMetaBaseURL: function (aFile) {
|
||||||
{
|
|
||||||
if (wpdCommon.pathExists(aFile)) {
|
if (wpdCommon.pathExists(aFile)) {
|
||||||
str = new String(wpdCommon.readFile(aFile, false, true));
|
str = new String(wpdCommon.readFile(aFile, false, true));
|
||||||
re = new RegExp(/<meta name=\"wpd_baseurl\" content=\"(.*?)\">/);
|
re = new RegExp(/<meta name=\"wpd_baseurl\" content=\"(.*?)\">/);
|
||||||
|
@ -897,8 +896,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Return the WPD Meta Date Information from aFile
|
// Return the WPD Meta Date Information from aFile
|
||||||
getMetaDate : function(aFile)
|
getMetaDate: function (aFile) {
|
||||||
{
|
|
||||||
if (wpdCommon.pathExists(aFile)) {
|
if (wpdCommon.pathExists(aFile)) {
|
||||||
str = new String(wpdCommon.readFile(aFile, false, true));
|
str = new String(wpdCommon.readFile(aFile, false, true));
|
||||||
re = new RegExp(/<meta name=\"wpd_date\" content=\"(.*?)\">/);
|
re = new RegExp(/<meta name=\"wpd_date\" content=\"(.*?)\">/);
|
||||||
|
@ -910,8 +908,7 @@ var wpdDOMSaver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// creates the meta nodes for the wpd meta tags (version, baseurl, url, date/time)
|
// creates the meta nodes for the wpd meta tags (version, baseurl, url, date/time)
|
||||||
createMetaInformation : function(aDocument,rootNode)
|
createMetaInformation: function (aDocument, rootNode) {
|
||||||
{
|
|
||||||
// insert url/date/time meta information
|
// insert url/date/time meta information
|
||||||
//
|
//
|
||||||
var d = this.dateObj.getUTCFullYear() + "-" + wpdCommon.addLeftZeros(this.dateObj.getUTCMonth(), 2) + "-" + wpdCommon.addLeftZeros(this.dateObj.getUTCDate(), 2);
|
var d = this.dateObj.getUTCFullYear() + "-" + wpdCommon.addLeftZeros(this.dateObj.getUTCMonth(), 2) + "-" + wpdCommon.addLeftZeros(this.dateObj.getUTCDate(), 2);
|
||||||
|
@ -926,11 +923,12 @@ var wpdDOMSaver = {
|
||||||
// save a non HTML "aDocument" as "aFileName" and generate a
|
// save a non HTML "aDocument" as "aFileName" and generate a
|
||||||
// wrapper HTML File which references "aDocument"
|
// wrapper HTML File which references "aDocument"
|
||||||
// ("aFileName" is the filename without(!) extension)
|
// ("aFileName" is the filename without(!) extension)
|
||||||
saveDocumentFile : function(aDocument,aFileName)
|
saveDocumentFile: function (aDocument, aFileName) {
|
||||||
{
|
Zotero.debug("[wpdDOMSaver.saveDocumentFile]: Saving file from " + this.currentURL);
|
||||||
Zotero.debug("[wpdDOMSaver.saveDocumentFile]: "+aFileName);
|
aFileName = this.download(this.currentURL, true)
|
||||||
|
Zotero.debug("[wpdDOMSaver.saveDocumentFile]: Saved to " + aFileName);
|
||||||
|
|
||||||
return this.download(this.currentURL,true)
|
return aFileName;
|
||||||
/* Wrapper file disabled by Dan S. for Zotero
|
/* Wrapper file disabled by Dan S. for Zotero
|
||||||
var aFileURL = aDocument.location.href;
|
var aFileURL = aDocument.location.href;
|
||||||
|
|
||||||
|
@ -957,8 +955,7 @@ var wpdDOMSaver = {
|
||||||
// process the CSS Text
|
// process the CSS Text
|
||||||
// "aFileName" is the filename without(!) extension
|
// "aFileName" is the filename without(!) extension
|
||||||
// (".css" will be added)
|
// (".css" will be added)
|
||||||
saveDocumentCSS: function(aDocument,aFileName)
|
saveDocumentCSS: function (aDocument, aFileName) {
|
||||||
{
|
|
||||||
var CSSText = ""; //"body {display: block;margin: 8px;}; ";
|
var CSSText = ""; //"body {display: block;margin: 8px;}; ";
|
||||||
if (this.option["format"]) {
|
if (this.option["format"]) {
|
||||||
var myStyleSheets = aDocument.styleSheets;
|
var myStyleSheets = aDocument.styleSheets;
|
||||||
|
@ -973,12 +970,12 @@ var wpdDOMSaver = {
|
||||||
} else {
|
} else {
|
||||||
CSSText = wpdCommon.ConvertFromUnicode16(CSSText, this.curCharacterSet);
|
CSSText = wpdCommon.ConvertFromUnicode16(CSSText, this.curCharacterSet);
|
||||||
}
|
}
|
||||||
Zotero.debug("[wpdDOMSaver.saveDocumentCSS]: "+this.currentDir+aFileName+".css");
|
aFileName = this.getUniqueFileNameAndRegister(aFileName + ".css");
|
||||||
|
Zotero.debug("[wpdDOMSaver.saveDocumentCSS]: " + this.currentDir + aFileName);
|
||||||
// write css file
|
// write css file
|
||||||
var CSSFile = this.currentDir + aFileName + ".css";
|
var CSSFile = this.currentDir + aFileName;
|
||||||
if (!wpdCommon.writeFile(CSSText, CSSFile))
|
if (!wpdCommon.writeFile(CSSText, CSSFile)) wpdCommon.addError("[wpdDOMSaver.saveDocumentCSS]: could not write CSS File\n");
|
||||||
wpdCommon.addError("[wpdDOMSaver.saveDocumentCSS]: could not write CSS File\n");
|
return aFileName;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -988,9 +985,12 @@ var wpdDOMSaver = {
|
||||||
// DOM Tree (see processDOMNode) - calls also saveDocumentCSS
|
// DOM Tree (see processDOMNode) - calls also saveDocumentCSS
|
||||||
// "aFileName" is the filename without(!) extension
|
// "aFileName" is the filename without(!) extension
|
||||||
// (".html" will be added)
|
// (".html" will be added)
|
||||||
saveDocumentHTML: function(aDocument,aFileName)
|
saveDocumentHTML: function (aDocument, aFileName) {
|
||||||
{
|
aFileName = this.getUniqueFileNameAndRegister(aFileName + ".html");
|
||||||
Zotero.debug("[wpdDOMSaver.saveDocumentHTML]: "+this.currentDir+aFileName+".html");
|
var aFileNameNoExt = wpdCommon.splitFileName(aFileName)[0];
|
||||||
|
|
||||||
|
Zotero.debug("[wpdDOMSaver.saveDocumentHTML]: " + this.currentDir + aFileName);
|
||||||
|
|
||||||
this.curDocument = aDocument;
|
this.curDocument = aDocument;
|
||||||
this.curCharacterSet = aDocument.characterSet;
|
this.curCharacterSet = aDocument.characterSet;
|
||||||
var charset = this.curCharacterSet;
|
var charset = this.curCharacterSet;
|
||||||
|
@ -1015,12 +1015,11 @@ var wpdDOMSaver = {
|
||||||
this.processDOMRecursively(rootNode);
|
this.processDOMRecursively(rootNode);
|
||||||
|
|
||||||
// write css file and add css node with the new css filename in the DOM Tree
|
// write css file and add css node with the new css filename in the DOM Tree
|
||||||
if (this.saveDocumentCSS(aDocument,aFileName))
|
var cssFileName = this.saveDocumentCSS(aDocument, aFileNameNoExt);
|
||||||
this.createCSSFileNode(aDocument,rootNode,aFileName);
|
if (cssFileName) this.createCSSFileNode(aDocument, rootNode, cssFileName);
|
||||||
|
|
||||||
// create meta information (version, base_url, url, date/time)
|
// create meta information (version, base_url, url, date/time)
|
||||||
if (this.option["metainfo"])
|
if (this.option["metainfo"]) this.createMetaInformation(aDocument, rootNode);
|
||||||
this.createMetaInformation(aDocument,rootNode);
|
|
||||||
|
|
||||||
// add the charset defintions previously removed by processDOMNode
|
// add the charset defintions previously removed by processDOMNode
|
||||||
if (this.option["encodeUTF8"]) {
|
if (this.option["encodeUTF8"]) {
|
||||||
|
@ -1034,7 +1033,6 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
// "var " added by Dan S. for Zotero
|
// "var " added by Dan S. for Zotero
|
||||||
var HTMLText = this.generateHTMLString(aDocument, rootNode);
|
var HTMLText = this.generateHTMLString(aDocument, rootNode);
|
||||||
|
|
||||||
// convert the DOM String to the desired Charset
|
// convert the DOM String to the desired Charset
|
||||||
if (this.option["encodeUTF8"]) {
|
if (this.option["encodeUTF8"]) {
|
||||||
HTMLText = wpdCommon.ConvertFromUnicode16(HTMLText, "UTF-8");
|
HTMLText = wpdCommon.ConvertFromUnicode16(HTMLText, "UTF-8");
|
||||||
|
@ -1045,16 +1043,14 @@ var wpdDOMSaver = {
|
||||||
this.curCharacterSet = charset;
|
this.curCharacterSet = charset;
|
||||||
|
|
||||||
// and write the file...
|
// and write the file...
|
||||||
var HTMLFile = this.currentDir + aFileName + ".html";
|
var HTMLFile = this.currentDir + aFileName;
|
||||||
if (!wpdCommon.writeFile(HTMLText, HTMLFile))
|
if (!wpdCommon.writeFile(HTMLText, HTMLFile)) wpdCommon.addError("[wpdDOMSaver.saveDocumentHTML]: could not write HTML File\n");
|
||||||
wpdCommon.addError("[wpdDOMSaver.saveDocumentHTML]: could not write HTML File\n");
|
|
||||||
|
|
||||||
return aFileName + ".html";
|
return aFileName;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Decides the calling of SaveDocumentFile or saveDocumentHTML
|
// Decides the calling of SaveDocumentFile or saveDocumentHTML
|
||||||
saveDocumentEx : function(aDocument,aFileName)
|
saveDocumentEx: function (aDocument, aFileName) {
|
||||||
{
|
|
||||||
// we have to set a new current url which is the
|
// we have to set a new current url which is the
|
||||||
// base reference url (necessary for frame processing)
|
// base reference url (necessary for frame processing)
|
||||||
this.currentURL = aDocument.location.href;
|
this.currentURL = aDocument.location.href;
|
||||||
|
@ -1076,8 +1072,7 @@ var wpdDOMSaver = {
|
||||||
|
|
||||||
// Main Routine: call it for saving the actual active top window
|
// Main Routine: call it for saving the actual active top window
|
||||||
// (be sure to call the init function at the top of this file before)
|
// (be sure to call the init function at the top of this file before)
|
||||||
saveHTMLDocument: function()
|
saveHTMLDocument: function () {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
this.saveDocumentEx(this.document, this.name);
|
this.saveDocumentEx(this.document, this.name);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
|
|
@ -965,7 +965,13 @@ Zotero.Sync.Storage.WebDAV = (function () {
|
||||||
.createInstance(nsIWBP);
|
.createInstance(nsIWBP);
|
||||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||||
wbp.progressListener = listener;
|
wbp.progressListener = listener;
|
||||||
|
try {
|
||||||
wbp.saveURI(uri, null, null, null, null, destFile);
|
wbp.saveURI(uri, null, null, null, null, destFile);
|
||||||
|
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||||
|
// XXX Always use when we no longer support Firefox < 18
|
||||||
|
wbp.saveURI(uri, null, null, null, null, destFile, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
request.error(e);
|
request.error(e);
|
||||||
|
|
|
@ -861,7 +861,13 @@ Zotero.Sync.Storage.ZFS = (function () {
|
||||||
.createInstance(nsIWBP);
|
.createInstance(nsIWBP);
|
||||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||||
wbp.progressListener = listener;
|
wbp.progressListener = listener;
|
||||||
|
try {
|
||||||
wbp.saveURI(uri, null, null, null, null, destFile);
|
wbp.saveURI(uri, null, null, null, null, destFile);
|
||||||
|
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||||
|
// XXX Always use when we no longer support Firefox < 18
|
||||||
|
wbp.saveURI(uri, null, null, null, null, destFile, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.Sync.Storage.EventManager.error(e);
|
Zotero.Sync.Storage.EventManager.error(e);
|
||||||
|
|
|
@ -595,6 +595,17 @@ Zotero.Translate.Sandbox = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remap attachment (but not link) URLs
|
||||||
|
var properToProxy = translate.translator[0].properToProxy;
|
||||||
|
if(properToProxy && item.attachments) {
|
||||||
|
for(var i=0; i<item.attachments.length; i++) {
|
||||||
|
var attachment = item.attachments[i];
|
||||||
|
if(attachment.snapshot !== false && attachment.url) {
|
||||||
|
attachment.url = properToProxy(attachment.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// call super
|
// call super
|
||||||
|
|
|
@ -35,6 +35,7 @@ const BOMs = {
|
||||||
}
|
}
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||||
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
Zotero.Translate.DOMWrapper = new function() {
|
Zotero.Translate.DOMWrapper = new function() {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -272,6 +272,45 @@ Zotero.Utilities = {
|
||||||
return doi ? doi[0] : null;
|
return doi ? doi[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean and validate ISBN.
|
||||||
|
* Return isbn if valid, otherwise return false
|
||||||
|
*/
|
||||||
|
"cleanISBN":function(/**String*/ isbn) {
|
||||||
|
isbn = isbn.replace(/[^x\d]+/ig, '').toUpperCase();
|
||||||
|
|
||||||
|
if(isbn.length == 10) {
|
||||||
|
// Verify ISBN-10 checksum
|
||||||
|
var sum = 0;
|
||||||
|
for (var i = 0; i < 9; i++) {
|
||||||
|
if(isbn[i] == 'X') return false; //X can only be a check digit
|
||||||
|
sum += isbn[i] * (10-i);
|
||||||
|
}
|
||||||
|
//check digit might be 'X'
|
||||||
|
sum += (isbn[9] == 'X')? 10 : isbn[9]*1;
|
||||||
|
|
||||||
|
return (sum % 11 == 0) ? isbn : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isbn = isbn.replace(/X/g, ''); //get rid of Xs
|
||||||
|
|
||||||
|
if(isbn.length == 13) {
|
||||||
|
// ISBN-13 should start with 978 or 979 i.e. GS1 for book publishing industry
|
||||||
|
var prefix = isbn.slice(0,3);
|
||||||
|
if (prefix != "978" && prefix != "979") return false;
|
||||||
|
|
||||||
|
// Verify checksum
|
||||||
|
var sum = 0;
|
||||||
|
for (var i = 0; i < 12; i+=2) sum += isbn[i]*1; //to make sure it's int
|
||||||
|
for (i = 1; i < 12; i+=2) sum += isbn[i]*3;
|
||||||
|
sum += isbn[12]*1; //add the check digit
|
||||||
|
|
||||||
|
return (sum % 10 == 0 )? isbn : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert plain text to HTML by replacing special characters and replacing newlines with BRs or
|
* Convert plain text to HTML by replacing special characters and replacing newlines with BRs or
|
||||||
* P tags
|
* P tags
|
||||||
|
|
|
@ -1253,6 +1253,10 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
*/
|
*/
|
||||||
this.getInstalledExtensions = function(callback) {
|
this.getInstalledExtensions = function(callback) {
|
||||||
function onHaveInstalledAddons(installed) {
|
function onHaveInstalledAddons(installed) {
|
||||||
|
installed.sort(function(a, b) {
|
||||||
|
return ((a.appDisabled || a.userDisabled) ? 1 : 0) -
|
||||||
|
((b.appDisabled || b.userDisabled) ? 1 : 0);
|
||||||
|
});
|
||||||
var addons = [];
|
var addons = [];
|
||||||
for each(var addon in installed) {
|
for each(var addon in installed) {
|
||||||
switch (addon.id) {
|
switch (addon.id) {
|
||||||
|
@ -1262,7 +1266,9 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
}
|
}
|
||||||
|
|
||||||
addons.push(addon.name + " (" + addon.version
|
addons.push(addon.name + " (" + addon.version
|
||||||
+ (addon.type != 2 ? ", " + addon.type : "") + ")");
|
+ (addon.type != 2 ? ", " + addon.type : "")
|
||||||
|
+ ((addon.appDisabled || addon.userDisabled) ? ", disabled" : "")
|
||||||
|
+ ")");
|
||||||
}
|
}
|
||||||
callback(addons);
|
callback(addons);
|
||||||
}
|
}
|
||||||
|
|
|
@ -819,6 +819,11 @@ function ChromeExtensionHandler() {
|
||||||
var fileURI = ph.newFileURI(file);
|
var fileURI = ph.newFileURI(file);
|
||||||
}
|
}
|
||||||
var channel = ioService.newChannelFromURI(fileURI);
|
var channel = ioService.newChannelFromURI(fileURI);
|
||||||
|
//set originalURI so that it seems like we're serving from zotero:// protocol
|
||||||
|
//this is necessary to allow url() links to work from within css files
|
||||||
|
//otherwise they try to link to files on the file:// protocol, which is not allowed
|
||||||
|
channel.originalURI = uri;
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"alias": "Google Scholar",
|
"alias": "Google Scholar",
|
||||||
"_urlTemplate": "http://scholar.google.com/scholar?as_q=&as_epq={z:title}&as_occt=title&as_sauthors={rft:aufirst?}+{rft:aulast?}&as_ylo={z:year?}&as_yhi={z:year?}&as_sdt=1.&as_sdtp=on&as_sdtf=&as_sdts=22&",
|
"_urlTemplate": "http://scholar.google.com/scholar?as_q=&as_epq={z:title}&as_occt=title&as_sauthors={rft:aufirst?}+{rft:aulast?}&as_ylo={z:year?}&as_yhi={z:year?}&as_sdt=1.&as_sdtp=on&as_sdtf=&as_sdts=22&",
|
||||||
"description": "Google Scholar Search",
|
"description": "Google Scholar Search",
|
||||||
"hidden": true,
|
"hidden": false,
|
||||||
"_urlParams": [],
|
"_urlParams": [],
|
||||||
"_urlNamespaces": {
|
"_urlNamespaces": {
|
||||||
"rft": "info:ofi/fmt:kev:mtx:journal",
|
"rft": "info:ofi/fmt:kev:mtx:journal",
|
||||||
|
@ -25,19 +25,5 @@
|
||||||
"": "http://a9.com/-/spec/opensearch/1.1/"
|
"": "http://a9.com/-/spec/opensearch/1.1/"
|
||||||
},
|
},
|
||||||
"_iconSourceURI": "http://scholar.google.com/favicon.ico"
|
"_iconSourceURI": "http://scholar.google.com/favicon.ico"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Pubget Lookup",
|
|
||||||
"alias": "Pubget",
|
|
||||||
"_urlTemplate": "http://pubget.com/openurl?rft.title={rft:title}&rft.issue={rft:issue?}&rft.spage={rft:spage?}&rft.epage={rft:epage?}&rft.issn={rft:issn?}&rft.jtitle={rft:stitle?}&doi={z:DOI?}",
|
|
||||||
"description": "Pubget Article Lookup",
|
|
||||||
"hidden": true,
|
|
||||||
"_urlParams": [],
|
|
||||||
"_urlNamespaces": {
|
|
||||||
"rft": "info:ofi/fmt:kev:mtx:journal",
|
|
||||||
"z": "http://www.zotero.org/namespaces/openSearch#",
|
|
||||||
"": "http://a9.com/-/spec/opensearch/1.1/"
|
|
||||||
},
|
|
||||||
"_iconSourceURI": "http://pubget.com/favicon.ico"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
Reference in New Issue
Block a user