printing window will now be loaded in IE and Chrome

This commit is contained in:
DennisSchiefer 2012-04-26 07:34:51 +01:00
parent d7ffb0d492
commit 560ce74d06
2 changed files with 8 additions and 9 deletions

View File

@ -166,9 +166,7 @@ print: function() {
// generate a new window and wait till it has finished loading
OSRM.G.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
//OSRM.Browser.onLoadHandler( OSRM.Printing.printwindowLoaded, OSRM.G.printwindow );
//OSRM.Browser.onLoadHandler( OSRM.Printing.printwindowLoaded, OSRM.G.printwindow.document );
setTimeout( OSRM.Printing.printwindowLoaded, 500);
OSRM.Browser.onLoadHandler( OSRM.Printing.printwindowLoaded, OSRM.G.printwindow );
},

View File

@ -46,17 +46,18 @@ OSRM.Browser.getElementsByClassName = function( node, classname ) {
};
// call a function when DOM has finished loading and remove event handler (optionally pass a different window object)
OSRM.Browser.onLoadHandler = function( function_pointer, the_document ) {
the_document = the_document || document; // default document
OSRM.Browser.onLoadHandler = function( function_pointer, the_window ) {
the_window = the_window || window; // default document
var the_document = the_window.document;
if(the_document.addEventListener) { // FF, CH, IE9+
if(the_window.addEventListener) { // FF, CH, IE9+
var temp_function = function() {
the_document.removeEventListener("DOMContentLoaded", arguments.callee, false);
the_window.removeEventListener("DOMContentLoaded", arguments.callee, false);
function_pointer.call();
};
the_document.addEventListener("DOMContentLoaded", temp_function, false);
the_window.addEventListener("DOMContentLoaded", temp_function, false);
}
else if(the_document.attachEvent) { // IE8-
var temp_function = function() {
if ( the_document.readyState === "interactive" || the_document.readyState === "complete" ) {