function QuizResize(quiz) {
this.quiz = quiz;
+
+ this.desktopWidth = 1200;
+ this.desktopHeight = 680;
+ this.mobileWidth = 390;
+
+ this.measureSizes();
+ this.resizePopup();
}
QuizResize.prototype = {
- resize: function () {
+
+ resizePopup: function () {
+ if (window.opener === null) {
+ return;
+ }
+ if (this.ww >= this.desktopWidth && this.hh >= this.desktopHeight) {
+ return;
+ }
+
+ window.resizeTo(Math.min(screen.width, this.desktopWidth), Math.min(screen.height, this.desktopHeight));
+ },
+
+ measureSizes: function () {
this.ww = $(window).width();
this.hh = $(window).height();
this.ratio = this.ww / this.hh;
+ },
+ resize: function () {
+ this.measureSizes();
- this.desktopWidth = 1200;
- this.desktopHeight = 680;
- this.mobileWidth = 390;
this.updateViewport();
$('meta[name="viewport"]').attr('content', 'width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no, test=yes');
let s = 1;
let qcss = {};
- if (this.ww < this.desktopWidth || this.hh < this.desktopHeight) {
+ if (this.ww <= this.desktopWidth || this.hh <= this.desktopHeight) {
let sw = this.ww / this.desktopWidth;
let sh = this.hh / this.desktopHeight;
s = Math.min(sw, sh);