MCPcopy
hub / github.com/impress/impress.js / open

Function open

js/impress.js:2882–2984  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2880 };
2881
2882 var open = function() {
2883 if ( top.isconsoleWindow ) {
2884 return;
2885 }
2886
2887 if ( consoleWindow && !consoleWindow.closed ) {
2888 consoleWindow.focus();
2889 } else {
2890 consoleWindow = window.open( '', 'impressConsole' );
2891
2892 // If opening failes this may be because the browser prevents this from
2893 // not (or less) interactive JavaScript...
2894 if ( consoleWindow == null ) {
2895
2896 // ... so I add a button to klick.
2897 // workaround on firefox
2898 var message = document.createElement( 'div' );
2899 message.id = 'impress-console-button';
2900 message.style.position = 'fixed';
2901 message.style.left = 0;
2902 message.style.top = 0;
2903 message.style.right = 0;
2904 message.style.bottom = 0;
2905 message.style.backgroundColor = 'rgba(255, 255, 255, 0.9)';
2906 var clickStr = 'var x = document.getElementById(\'impress-console-button\');' +
2907 'x.parentNode.removeChild(x);' +
2908 'var r = document.getElementById(\'' + rootId + '\');' +
2909 'impress(\'' + rootId +
2910 '\').lib.util.triggerEvent(r, \'impress:console:open\', {})';
2911 var styleStr = 'margin: 25vh 25vw;width:50vw;height:50vh;';
2912 message.innerHTML = '<button style="' + styleStr + '" ' +
2913 'onclick="' + clickStr + '">' +
2914 lang.clickToOpen +
2915 '</button>';
2916 document.body.appendChild( message );
2917 return;
2918 }
2919
2920 var cssLink = '';
2921 if ( cssFile !== undefined ) {
2922 cssLink = '<link rel="stylesheet" type="text/css" media="screen" href="' +
2923 cssFile + '">';
2924 }
2925
2926 // This sets the window location to the main window location, so css can be loaded:
2927 consoleWindow.document.open();
2928
2929 // Write the template:
2930 consoleWindow.document.write(
2931
2932 // CssStyleStr is lots of inline <style></style> defined at the end of this file
2933 consoleTemplate.replace( '{{cssStyle}}', cssStyleStr() )
2934 .replace( '{{cssLink}}', cssLink )
2935 .replace( /{{.*?}}/gi, function( x ) {
2936 return lang[ x.substring( 2, x.length - 2 ) ]; }
2937 )
2938 );
2939 consoleWindow.document.title = 'Speaker Console (' + document.title + ')';

Callers 2

_initFunction · 0.70
impress.jsFile · 0.70

Calls 3

cssStyleStrFunction · 0.70
registerKeyEventFunction · 0.70
onStepEnterFunction · 0.70

Tested by

no test coverage detected