/* IBM Confidential OCO Source Materials IBM Cognos Products: rs (C) Copyright IBM Corp. 2018 The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office. */ define( [], function() { var m_divEventBlocker; var K_iKeyTab = 9; var f_stopTabKey = function( e ) { if ( e.keyCode == K_iKeyTab ) { e.preventDefault(); e.stopPropagation(); } }; var U_Blocker = {}; /** * Show a blocker over the entire window to prevent user interaction * @param {Integer} v_iZIndex z-index that the blocker should be shown at * @type DIV * @returns The blocker. */ U_Blocker.F_ShowEventBlocker = function( v_iZIndex ) { if ( !m_divEventBlocker ) { m_divEventBlocker = document.body.appendChild( document.createElement( "DIV" ) ); m_divEventBlocker.onkeydown = f_stopTabKey; //m_divEventBlocker.className = "clsBlocker"; // Following is equivalent to clsBlocker m_divEventBlocker.style.position = 'absolute'; m_divEventBlocker.style.left = '0'; m_divEventBlocker.style.top = '0'; m_divEventBlocker.style.width = '100%'; m_divEventBlocker.style.height = '100%'; } m_divEventBlocker.style.zIndex = v_iZIndex; m_divEventBlocker.style.visibility = "visible"; return m_divEventBlocker; }; /** * Hides the blocker * @type void */ U_Blocker.F_HideEventBlocker = function() { if ( m_divEventBlocker ) { m_divEventBlocker.style.visibility = "hidden"; ["onmousedown", "onmouseup", "onmousemove", "onclick", "ondblclick", "onmouseover", "onmouseout"].forEach( function( s ) { this[s] = null; }, m_divEventBlocker ); } }; return U_Blocker; });