/** * Theme cards for displaying excerpt and post content. */ jQuery(document).ready(function( $ ) { API.isAppearinCompatible(function (data) { // check if roomname is define in URI var aiRoom = lookToURI( 'appear-in' ); var aiRef = lookToURI( 'aiwp-ref' ); // if webRTC not supported show incompatibility message and hide room type selection // otherwise, if room set in URI, set up room // otherwise, do nothing if ( data.isSupported ) { $('#webrtc-compatability-tester').hide(); } if ( !data.isSupported ) { $('#appearin-incompatibility').show(); $('#aiwp-room-type-selection').hide(); } else if ( '' != aiRoom ) { // hide room type selection $('#aiwp-room-type-selection').hide(); // launch room launchAppearInRoom( aiRoom ); // respond to server with accepted invite $.post(ajaxurl, { action: 'aiwp_direct_session', aiwp_room: aiRoom, aiwp_ref: aiRef, aiwp_security: $('#appearin-room').data('security') }); } // end if }); function randomStringGenerator() { // predefine the alphabet used var alphabet = 'qwertyuiopasdfghjklzxcvbnm1234567890'; // set the length of the string var stringLength = 30; // initialize the room name as an empty string var randomString = ''; // repeat this 30 times for ( var i=0; i= 0 ) { var roomName = randomString.replace('?lite',''); } else { var roomName = 'https://appear.in/' + randomString; } var roomNameLite = roomName + '?lite'; var roomURL = window.location.protocol + "//" + window.location.host + window.location.pathname; // set the iframe source to load the room var iframe = document.getElementById('appearin-room'); iframe.setAttribute('src', roomNameLite); $('#aiwp-room-type-selection').hide(); $('#appearin-current-' + roomType).show(); $('#appearin-room').css('height','700px'); $('#appearin-room-label').html(roomURL+'?appear-in='+roomNameLite+'&aiwp-ref=invite'); $('#appearin-room-label-external').html('Visit Full Room'); window.onbeforeunload = function(){ return 'Active sessions at ' + roomName + ' will be ended.'; } } function lookToURI(name){ if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) { return decodeURIComponent(name[1]); } else { return ''; } } });