dist/altspace.js
function ensureInVR() {
	if (inTile || !inVR) //inTile && inAltspace
	{
		var css = document.createElement("style");
		css.type = "text/css";
		css.innerHTML = "@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace-vr-notice{color:rgba(0,0,0,.7);font-size:5vw}.altspace-pen-name{font-size:7vw}";
		document.head.appendChild(css);

		document.body.style.background = Please.make_color({ seed: getPenId() });

		var info = document.createElement("div");
		info.className = "altspace-info";
		document.body.appendChild(info);

		var nameEl = document.createElement("span");
		nameEl.className = "altspace-pen-name";
		nameEl.innerHTML = '<p>' + name.toUpperCase() + '</p>';
		info.appendChild(nameEl);

		if (inTile) {
			var errorMsg = 'VR mode does not support preview tiles. Stopping code execution.';
			console.log('ERROR: ' + errorMsg);
			throw new Error(errorMsg);
		}

		if (!inVR) {

			var launchEl = document.createElement("span");
			launchEl.className = "altspace-vr-notice";
			launchEl.innerHTML = '<p>View</p>';
			info.insertBefore(launchEl, nameEl);

			var notice = document.createElement("span");
			notice.className = "altspace-vr-notice";
			notice.innerHTML = '<p>in <a href="http://altvr.com"> AltspaceVR </a></p>';
			info.appendChild(notice);


			var errorMsg = 'Not in VR mode. Stopping code execution.';
			if (inTile) {
				console.log('ERROR: ' + errorMsg);//thrown error message not displayed in console when inTile, log it
			}
			throw new Error(errorMsg);
		}
		return;

	}
}
function ensureInVR() {
	if (inTile || !inVR) //inTile && inAltspace
	{
		var css = document.createElement("style");
		css.type = "text/css";
		css.innerHTML = "@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace-vr-notice{color:rgba(0,0,0,.7);font-size:5vw}.altspace-pen-name{font-size:7vw}";
		document.head.appendChild(css);

		document.body.style.background = Please.make_color({ seed: getPenId() });

		var info = document.createElement("div");
		info.className = "altspace-info";
		document.body.appendChild(info);

		var nameEl = document.createElement("span");
		nameEl.className = "altspace-pen-name";
		nameEl.innerHTML = '<p>' + name.toUpperCase() + '</p>';
		info.appendChild(nameEl);

		if (inTile) {
			var errorMsg = 'VR mode does not support preview tiles. Stopping code execution.';
			console.log('ERROR: ' + errorMsg);
			throw new Error(errorMsg);
		}

		if (!inVR) {

			var launchEl = document.createElement("span");
			launchEl.className = "altspace-vr-notice";
			launchEl.innerHTML = '<p>View</p>';
			info.insertBefore(launchEl, nameEl);

			var notice = document.createElement("span");
			notice.className = "altspace-vr-notice";
			notice.innerHTML = '<p>in <a href="http://altvr.com"> AltspaceVR </a></p>';
			info.appendChild(notice);


			var errorMsg = 'Not in VR mode. Stopping code execution.';
			if (inTile) {
				console.log('ERROR: ' + errorMsg);//thrown error message not displayed in console when inTile, log it
			}
			throw new Error(errorMsg);
		}
		return;

	}
}
function ensureInVR ( ) { if ( inTile || ! inVR ) //inTile && inAltspace { var css = document . createElement ( "style" ) ; css . type = "text/css" ; css . innerHTML = "@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace-vr-notice{color:rgba(0,0,0,.7);font-size:5vw}.altspace-pen-name{font-size:7vw}" ; document . head . appendChild ( css ) ; document . body . style . background = Please . make_color ( { seed : getPenId ( ) } ) ; var info = document . createElement ( "div" ) ; info . className = "altspace-info" ; document . body . appendChild ( info ) ; var nameEl = document . createElement ( "span" ) ; nameEl . className = "altspace-pen-name" ; nameEl . innerHTML = '<p>' + name . toUpperCase ( ) + '</p>' ; info . appendChild ( nameEl ) ; if ( inTile ) { var errorMsg = 'VR mode does not support preview tiles. Stopping code execution.' ; console . log ( 'ERROR: ' + errorMsg ) ; throw new Error ( errorMsg ) ; } if ( ! inVR ) { var launchEl = document . createElement ( "span" ) ; launchEl . className = "altspace-vr-notice" ; launchEl . innerHTML = '<p>View</p>' ; info . insertBefore ( launchEl , nameEl ) ; var notice = document . createElement ( "span" ) ; notice . className = "altspace-vr-notice" ; notice . innerHTML = '<p>in <a href="http://altvr.com"> AltspaceVR </a></p>' ; info . appendChild ( notice ) ; var errorMsg = 'Not in VR mode. Stopping code execution.' ; if ( inTile ) { console . log ( 'ERROR: ' + errorMsg ) ; //thrown error message not displayed in console when inTile, log it } throw new Error ( errorMsg ) ; } return ; } }
Will stop code exection and post a message informing the user to
open the example in VR
@method ensureInVR
@memberof module:altspace/utilities/codePen
Will stop code exection and post a message informing the user to open the example in VR