javascript cleanup: MDL-16583 clean up the close_window function in weblib.php.

This commit is contained in:
tjhunt
2008-12-10 08:57:50 +00:00
parent ff9b4ea40a
commit b166403f18
3 changed files with 40 additions and 18 deletions
+16
View File
@@ -731,4 +731,20 @@ collapsible_region.prototype.handle_animation_complete = function() {
if (this.collapsed) {
this.div.className += ' collapsed';
}
}
/** Close the current browser window. */
function close_window() {
window.close();
}
/**
* Close the current browser window, forcing the window/tab that opened this
* popup to reload itself. */
function close_window_reloading_opener() {
if (window.opener) {
window.opener.location.reload(1);
close_window();
// Intentionally, only try to close the window if there is some evidence we are in a popup.
}
}