// -------------------------------------------------------------------- function copyToClipboard( val ) { // IE-specific code path to prevent textarea being shown while dialog is visible if ( window.clipboardData && window.clipboardData.setData ) { clipboardData.setData( "Text", val ) ; return ; } if ( document.queryCommandSupported && document.queryCommandSupported("copy") ) { // create a textarea to hold the content var textarea = document.createElement( "textarea" ) ; textarea.style.position = "fixed" ; // prevent scrolling to bottom in MS Edge document.body.appendChild( textarea ) ; textarea.textContent = val ; // copy the textarea content to the clipboard textarea.select() ; try { document.execCommand( "copy" ) ; if ( getUrlParam("log-clipboard") ) console.log( "CLIPBOARD:", val ) ; } catch( ex ) { showErrorMsg( "Can't copy to the clipboard:
" + escapeHTML(ex) + "" ) ; } finally { document.body.removeChild( textarea ) ; } } } // -------------------------------------------------------------------- function ask( title, msg, args ) { // ask a question var $dlg = $("#ask") ; $dlg.html( msg ) ; $dlg.dialog( { modal: true, title: title, buttons: { OK: function() { $(this).dialog( "close" ) ; if ( "ok" in args ) args.ok() ; }, Cancel: function() { $(this).dialog( "close" ) ; if ( "cancel" in args ) args.cancel() ; }, }, close: function() { if ( "close" in args ) args.close() ; }, } ) ; return false ; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function showInfoMsg( msg ) { // show the informational message $.growl( { style: "notice", title: null, message: msg, location: "br", } ) ; storeMsgForTestSuite( "_last-info_", msg ) ; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function showWarningMsg( msg ) { // show the warning message $.growl( { style: "warning", title: null, message: msg, location: "br", } ) ; storeMsgForTestSuite( "_last-warning_", msg ) ; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function showErrorMsg( msg ) { // show the error message $.growl( { style: "error", title: null, message: msg, location: "br", fixed: true, } ) ; storeMsgForTestSuite( "_last-error_", msg ) ; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function storeMsgForTestSuite( id, msg ) { // store a message for the test suite if ( ! getUrlParam( "store_msgs" ) ) return ; var $elem = $( "#"+id ) ; if ( $elem.length === 0 ) { // NOTE: The