Created
November 14, 2014 11:43
-
-
Save gaving/05079cbc8ac3ee68a0a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fix for deprecated method in Chrome 37 | |
if (!window.showModalDialog) { | |
window.showModalDialog = function (arg1, arg2, arg3) { | |
var w; | |
var h; | |
var resizable = "no"; | |
var scroll = "no"; | |
var status = "no"; | |
// get the modal specs | |
var mdattrs = arg3.split(";"); | |
for (i = 0; i < mdattrs.length; i++) { | |
var mdattr = mdattrs[i].split(":"); | |
var n = mdattr[0]; | |
var v = mdattr[1]; | |
if (n) { n = n.trim().toLowerCase(); } | |
if (v) { v = v.trim().toLowerCase(); } | |
if (n == "dialogheight") { | |
h = v.replace("px", ""); | |
} else if (n == "dialogwidth") { | |
w = v.replace("px", ""); | |
} else if (n == "resizable") { | |
resizable = v; | |
} else if (n == "scroll") { | |
scroll = v; | |
} else if (n == "status") { | |
status = v; | |
} | |
} | |
var left = window.screenX + (window.outerWidth / 2) - (w / 2); | |
var top = window.screenY + (window.outerHeight / 2) - (h / 2); | |
var targetWin = window.open(arg1, arg1, 'toolbar=no, location=no, directories=no, status=' + status + ', menubar=no, scrollbars=' + scroll + ', resizable=' + resizable + ', copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); | |
targetWin.focus(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment