Skip to content

Commit

Permalink
Centralise Paypal pop-up as suggested at #9
Browse files Browse the repository at this point in the history
  • Loading branch information
hifocus committed Jan 18, 2020
1 parent 5b8398d commit 084a93a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion assets/js/dev-files/function.original.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,18 @@ if (typeof paypal === "undefined" || paypal === null || paypal === "") {
else {
function openbox() {
selected = "yes";
window.open(paypal, "_blank", "width=360,height=560");
function openpaypal(url, w, h) { // code from https://stackoverflow.com/questions/4068373/center-a-popup-window-on-screen?answertab=votes#tab-top
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var systemZoom = width / window.screen.availWidth;
var left = (width - w) / 2 / systemZoom + dualScreenLeft
var top = (height - h) / 2 / systemZoom + dualScreenTop
var newWindow = window.open(url, "_blank", 'width=' + w / systemZoom + ', height=' + h / systemZoom + ', top=' + top + ', left=' + left);
if (window.focus) newWindow.focus();
}
openpaypal(paypal,'420','680');
}
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/dev-files/function.original.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 084a93a

Please sign in to comment.