Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-34590 javascript-static: full-screep popups for Chrome.

I have left in both:
1. the code to get the window size correct initially, becuase that seems
sensible; and
2. the subsequent resize (with the setTimeout that Chrome requires,
thanks Jeff Rader for finding that) becuase on Chrome, it gets the size
a bit too big initially, so this correction is necessary.
  • Loading branch information...
commit 92b7cdd0523af8f19d9aa0dbccf9f53b61ecfd4e 1 parent f2ddce9
@timhunt timhunt authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/javascript-static.js
View
14 lib/javascript-static.js
@@ -1113,13 +1113,23 @@ function openpopup(event, args) {
if (!args.url.match(/https?:\/\//)) {
fullurl = M.cfg.wwwroot + args.url;
}
+ if (args.fullscreen) {
+ args.options = args.options.
+ replace(/top=\d+/, 'top=0').
+ replace(/left=\d+/, 'left=0').
+ replace(/width=\d+/, 'width=' + screen.availWidth).
+ replace(/height=\d+/, 'height=' + screen.availHeight);
+ }
var windowobj = window.open(fullurl,args.name,args.options);
if (!windowobj) {
return true;
}
+
if (args.fullscreen) {
- windowobj.moveTo(0,0);
- windowobj.resizeTo(screen.availWidth,screen.availHeight);
+ setTimeout(function() {
+ windowobj.moveTo(0, 0);
+ windowobj.resizeTo(screen.availWidth, screen.availHeight)
+ }, 0);
}
windowobj.focus();
Please sign in to comment.
Something went wrong with that request. Please try again.