diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 1dd4a25a15..d5329bbae2 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -703,27 +703,20 @@ var Zotero_File_Interface = new function () { var _getMendeleyTranslation = async function () { + let Zotero_Import_Mendeley; if (true) { - Cu.import("chrome://zotero/content/import/mendeley/mendeleyImport.js"); + ({ Zotero_Import_Mendeley } = ChromeUtils.importESModule("chrome://zotero/content/import/mendeley/mendeleyImport.js")); } // TEMP: Load uncached from ~/zotero-client for development else { - ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs"); + const { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs"); let file = FileUtils.getDir("Home", []); file = OS.Path.join( file.path, 'zotero-client', 'chrome', 'content', 'zotero', 'import', 'mendeley', 'mendeleyImport.js' ); let fileURI = OS.Path.toFileURI(file); - let xmlhttp = await Zotero.HTTP.request( - 'GET', - fileURI, - { - noCache: true, - responseType: 'text' - } - ); - eval(xmlhttp.response); + ({ Zotero_Import_Mendeley } = ChromeUtils.importESModule(fileURI)); } return new Zotero_Import_Mendeley(); }; diff --git a/chrome/content/zotero/import/mendeley/mendeleyImport.js b/chrome/content/zotero/import/mendeley/mendeleyImport.mjs similarity index 99% rename from chrome/content/zotero/import/mendeley/mendeleyImport.js rename to chrome/content/zotero/import/mendeley/mendeleyImport.mjs index 7e0bc60075..dcb0b3a1a9 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyImport.js +++ b/chrome/content/zotero/import/mendeley/mendeleyImport.mjs @@ -1,8 +1,6 @@ - -/* global mendeleyDBMaps:false, mendeleyOnlineMappings:false, mendeleyAPIUtils:false, PathUtils: false */ -var EXPORTED_SYMBOLS = ["Zotero_Import_Mendeley"]; +/* global mendeleyDBMaps:false, mendeleyOnlineMappings:false, mendeleyAPIUtils:false */ +import { OS } from "chrome://zotero/content/osfile.mjs"; -var { OS } = ChromeUtils.importESModule("chrome://zotero/content/osfile.mjs"); Services.scriptloader.loadSubScript("chrome://zotero/content/include.js"); Services.scriptloader.loadSubScript("chrome://zotero/content/import/mendeley/mendeleyOnlineMappings.js"); Services.scriptloader.loadSubScript("chrome://zotero/content/import/mendeley/mendeleyAPIUtils.js"); @@ -24,7 +22,7 @@ colorMap.set('#d3c2ff', '#a28ae5'); colorMap.set('rgb(220, 255, 176)', '#5fb236'); colorMap.set('#dcffb0', '#5fb236'); -var Zotero_Import_Mendeley = function () { +export var Zotero_Import_Mendeley = function () { this.createNewCollection = null; this.linkFiles = null; this.newItems = [];