diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 5da4c62634..a3896b7f90 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -70,6 +70,20 @@ var Zotero_Citation_Dialog = new function () { * initialize add citation dialog */ function load() { + // make sure we are visible + window.setTimeout(function() { + var screenX = window.screenX; + var screenY = window.screenY; + var xRange = [window.screen.availLeft, window.screen.width-window.outerWidth]; + var yRange = [window.screen.availTop, window.screen.height-window.outerHeight]; + if(screenX < xRange[0] || screenX > xRange[1] || screenY < yRange[0] || screenY > yRange[1]) { + var targetX = Math.max(Math.min(screenX, xRange[1]), xRange[0]); + var targetY = Math.max(Math.min(screenY, yRange[1]), yRange[0]); + Zotero.debug("Moving window to "+targetX+", "+targetY); + window.moveTo(targetX, targetY); + } + }, 0); + document.documentElement.getButton("extra1").label = Zotero.getString("citation.multipleSources"); document.documentElement.getButton("extra2").label = Zotero.getString("citation.showEditor"); diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index 2ec1d69969..8c55eb68d0 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -83,6 +83,20 @@ var Zotero_QuickFormat = new function () { * Initialize add citation dialog */ this.onLoad = function() { + // make sure we are visible + window.setTimeout(function() { + var screenX = window.screenX; + var screenY = window.screenY; + var xRange = [window.screen.availLeft, window.screen.width-window.outerWidth]; + var yRange = [window.screen.availTop, window.screen.height-window.outerHeight]; + if(screenX < xRange[0] || screenX > xRange[1] || screenY < yRange[0] || screenY > yRange[1]) { + var targetX = Math.max(Math.min(screenX, xRange[1]), xRange[0]); + var targetY = Math.max(Math.min(screenY, yRange[1]), yRange[0]); + Zotero.debug("Moving window to "+targetX+", "+targetY); + window.moveTo(targetX, targetY); + } + }, 0); + window.focus(); qfe.focus();