treconomics_project/static/javascripts/popup_launcher.js
/*
Starts a new popup window pointing at the URL provided by parameter URL.
Width and height are optional parameters - 1024x768 is the default size of the popup if the parameters are not supplied.
*/
Starts a new popup window pointing at the URL provided by parameter URL.
Width and height are optional parameters - 1024x768 is the default size of the popup if the parameters are not supplied.
Starts a new popup window pointing at the URL provided by parameter URL . Width and height are optional parameters - 1024x768 is the default size of the popup if the parameters are not supplied .
function launchPopup(url, width, height, topPos, leftPos, title) {
    topPos = (typeof topPos === 'undefined') ? 10 : topPos;
    leftPos = (typeof leftPos === 'undefined') ? 10 : leftPos;
    title =(typeof leftPos === 'undefined') ? "NewsSearch Experiment" : title;
    if (typeof width === 'undefined') {
        width = 1024;
    }
    if (typeof height === 'undefined') {
        height = 768;
    }
    var popup = window.open(url,
            title,
            'toolbar=no,' +
                    'location=no,' +
                    'directories=no,' +
                    'status=no,' +
                    'menubar=no,' +
                    'scrollbars=yes,' +
                    'resizable=no,' +
                    'copyhistory=no,' +
                    'width='+ width +',' +
                    'height='+ height +',' +
                    'top='+ topPos +',' +
                    'left='+ leftPos);
    if (wasPopupBlocked(popup)) {
        $(document).ready(function() {
            displayPopupFailed($('#instructions_text'));
        });
    }
    else {
        $(document).ready(function() {
            displayPopupLaunched($('#instructions_text'));
        });
        var pollInterval = setInterval(function(){
            if (popup.closed) {
                if (COMPLETED_EXPERIMENT) {
                    displayCompletionMessage($('#instructions_text'));
                }
                else {
                    displayIncompleteMessage($('#instructions_text'));
                }
                clearInterval(pollInterval); 
            }
        }, 100);
    }
}
function launchPopup ( url , width , height , topPos , leftPos , title ) { topPos = ( typeof topPos === 'undefined' ) ? 10 : topPos ; leftPos = ( typeof leftPos === 'undefined' ) ? 10 : leftPos ; title = ( typeof leftPos === 'undefined' ) ? "NewsSearch Experiment" : title ; if ( typeof width === 'undefined' ) { width = 1024 ; } if ( typeof height === 'undefined' ) { height = 768 ; } var popup = window . open ( url , title , 'toolbar=no,' + 'location=no,' + 'directories=no,' + 'status=no,' + 'menubar=no,' + 'scrollbars=yes,' + 'resizable=no,' + 'copyhistory=no,' + 'width=' + width + ',' + 'height=' + height + ',' + 'top=' + topPos + ',' + 'left=' + leftPos ) ; if ( wasPopupBlocked ( popup ) ) { $ ( document ) . ready ( function ( ) { displayPopupFailed ( $ ( '#instructions_text' ) ) ; } ) ; } else { $ ( document ) . ready ( function ( ) { displayPopupLaunched ( $ ( '#instructions_text' ) ) ; } ) ; var pollInterval = setInterval ( function ( ) { if ( popup . closed ) { if ( COMPLETED_EXPERIMENT ) { displayCompletionMessage ( $ ( '#instructions_text' ) ) ; } else { displayIncompleteMessage ( $ ( '#instructions_text' ) ) ; } clearInterval ( pollInterval ) ; } } , 100 ) ; } }
Starts a new popup window pointing at the URL provided by parameter URL.
Starts a new popup window pointing at the URL provided by parameter URL .
// This should work as pollInterval will already be defined. Think about it...