From a14b3a2eb36b69742e8f851ffc3b4eb148b21bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 11 Oct 2018 13:24:32 +0300 Subject: [PATCH] Make the debugging bookmarklet loader.js point to staging zotero --- scripts/gulpfile_bookmarklet.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/gulpfile_bookmarklet.js b/scripts/gulpfile_bookmarklet.js index 04c461ad1..300125519 100644 --- a/scripts/gulpfile_bookmarklet.js +++ b/scripts/gulpfile_bookmarklet.js @@ -143,10 +143,15 @@ function processFile(argv) { return through.obj(async function(file, enc, cb) { ); break; case 'loader.js': - let config = await fs.readFile(join(__dirname, '../src/bookmarklet/zotero_config.js'), 'utf-8'); - let url = /BOOKMARKLET_URL: ?['"]([^'"]*)['"]/.exec(config)[1]; - file.contents = Buffer.from(file.contents.toString() - .replace('https://www.zotero.org/bookmarklet/', url)); + if (!argv.p) { + file.contents = Buffer.from(file.contents.toString() + .replace('www.zotero.org', 'staging.zotero.net')); + } else { + let config = await fs.readFile(join(__dirname, '../src/bookmarklet/zotero_config.js'), 'utf-8'); + let url = /BOOKMARKLET_URL: ?['"]([^'"]*)['"]/.exec(config)[1]; + file.contents = Buffer.from(file.contents.toString() + .replace('https://www.zotero.org/bookmarklet/', url)); + } }