1const gameDemoVideoModal = new Map([ 2 ['would_you_rather', 'gameWouldYouRatherDemoVideoModal'], 3 ['draw_it', 'gameDrawItDemoVideoModal'], 4 ['trivia', 'gameTriviaDemoVideoModal'], 5 ['describe_it', 'gameDescribeItDemoVideoModal'], 6 ['question_of_the_day', 'gameQOTDDemoVideoModal'], 7 ['werewolf_game', 'gameWerewolfDemoVideoModal'], 8 ['charades', 'gameCharadesDemoVideoModal'], 9 ['draw_tell', 'gameDrawTellDemoVideoModal'], 10 ['spot_my_lie', 'gameSpotMyLieDemoVideoModal'], 11]); 12 13const joinGameModalFormSubmit = (event) => { 14 event.preventDefault(); 15 const data = formToJSON(join_game_modal_form.elements); 16 const hypenDigitGameRoomId = data['gameRoomId']; 17 let targetUrl; 18 identifyAmplitude('setOnce', 'firstExperience', 'Participant'); 19 if (isPlayground) 20 targetUrl = 'http://localhost:54576/room/' + hypenDigitGameRoomId; 21 else if (isDev) 22 targetUrl = 'https://dev.orric.app/room/' + hypenDigitGameRoomId; 23 else targetUrl = 'https://app.brightful.me/room/' + hypenDigitGameRoomId; 24 return (location.href = targetUrl); 25}; 26 27function filteredValue(value) { 28 let result = value.replace('-', ''); 29 if (result.length >= 4) { 30 return result.substring(0, 4) + '-' + result.substring(4, result.length); 31 } 32 return result; 33} 34 35function setSelectionPos(input, selectionStart) { 36 if (input.createTextRange) { 37 var range = input.createTextRange(); 38 range.collapse(true); 39 range.moveEnd('character', selectionStart); 40 range.moveStart('character', selectionStart); 41 range.select(); 42 // real browsers :) 43 } else if (input.setSelectionRange) { 44 input.focus(); 45 input.setSelectionRange(selectionStart, selectionStart); 46 } 47} 48 49function setIDFilter(id) { 50 let gameRoomId = $(`#${id} #gameRoomId`); 51 gameRoomId.keydown(function (e) { 52 // ctrl-a/c/v 53 if ( 54 (e.which == 65 || e.which == 67 || e.which == 86) && 55 (e.ctrlKey == true || e.metaKey == true) 56 ) { 57 return true; 58 } 59 60 // no value 61 if (gameRoomId.val().length === 0) { 62 if ( 63 (e.which >= 65 && e.which <= 90) || 64 (e.which >= 48 && e.which <= 57) || 65 (e.which >= 96 && e.which <= 105) 66 ) { 67 return true; 68 } else { 69 return false; 70 } 71 } 72 73 // number room id 74 if (gameRoomId.val()[0] >= '0' && gameRoomId.val()[0] <= '9') { 75 if (
76 e.which != 13 && 77 e.which != 8 && 78 e.which != 0 && 79 e.which != 46 && 80 (e.which < 37 || e.which > 40) && 81 !(e.which >= 48 && e.which <= 57) && 82 !(e.which >= 96 && e.which <= 105) 83 ) { 84 return false; 85 } 86 if ( 87 ((e.which >= 48 && e.which <= 57) || 88 (e.which >= 96 && e.which <= 105)) && 89 gameRoomId.val().length >= 9 90 ) { 91 return false; 92 } 93 if ((e.which === 8 || e.which === 46) && gameRoomId.val().length === 5) { 94 const selectionStart = e.target.selectionStart; 95 gameRoomId.val(gameRoomId.val().substring(0, 4)); 96 setSelectionPos(gameRoomId[0], selectionStart); 97 } 98 if (e.which === 13) { 99 return gameRoomId.val().length === 9; 100 } 101 } else { 102 // custom game room id 103 if ( 104 e.which != 13 && 105 e.which != 8 && 106 e.which != 0 && 107 e.which != 46 && 108 (e.which < 37 || e.which > 40) && 109 !(e.which >= 48 && e.which <= 57) && 110 !(e.which >= 96 && e.which <= 105) && 111 !(e.which >= 65 && e.which <= 90) 112 ) { 113 return false; 114 } 115 if ( 116 ((e.which >= 48 && e.which <= 57) || 117 (e.which >= 96 && e.which <= 105) || 118 (e.which >= 65 && e.which <= 90)) && 119 gameRoomId.val().length >= 20 120 ) { 121 return false; 122 } 123 if (e.which === 13) { 124 return gameRoomId.val().length <= 20 && gameRoomId.val().length >= 3; 125 } 126 } 127 }); 128 gameRoomId.keyup(function (e) { 129 // number room id 130 if (gameRoomId.val()[0] >= '0' && gameRoomId.val()[0] <= '9') { 131 const selectionStartToEnd = 132 gameRoomId.val().length - e.target.selectionStart; 133 gameRoomId.val(filteredValue(gameRoomId.val())); 134 setSelectionPos( 135 gameRoomId[0], 136 gameRoomId.val().length - selectionStartToEnd 137 ); 138 } 139 }); 140} 141 142const join_game_modal_form = document.getElementById('join-game-modal-form'); 143join_game_modal_form.addEventListener('submit', joinGameModalFormSubmit); 144 145$('#joinAGameModal').on('shown.bs.modal', function (e) { 146 setIDFilter('joinAGameModal'); 147}); 148 149function pauseVideoWhenClosed(modalName) { 150 const div = document.getElementById(modalName); 151 const iframe = div.getElementsByTagName('iframe')[0].contentWindow; 152 iframe.postMessage( 153 '{"event":"command","func":"' + 'pauseVideo' + '","args":""}', 154 '*' 155 ); 156} 157 158$('#gameWouldYouRatherDemoVideoModal').on('hide.bs.modal', function (e) { 159 pauseVideoWhenClosed('gameWouldYouRatherDemoVideoModal'); 160}); 161$('#gameDrawItDemoVideoModal').on('hide.bs.modal', function (e) { 162 pauseVideoWhenClosed('gameDrawItDemoVideoModal'); 163}); 164$('#gameTriviaDemoVideoModal').on('hide.bs.modal', function (e) { 165 pauseVideoWhenClosed('gameTriviaDemoVideoModal'); 166}); 167$('#gameDescribeItDemoVideoModal').on('hide.bs.modal', function (e) { 168 pauseVideoWhenClosed('gameDescribeItDemoVideoModal'); 169}); 170$('#gameQOTDDemoVideoModal').on('hide.bs.modal', function (e) { 171 pauseVideoWhenClosed('gameQOTDDemoVideoModal'); 172}); 173$('#gameWerewolfDemoVideoModal').on('hide.bs.modal', function (e) { 174 pauseVideoWhenClosed('gameWerewolfDemoVideoModal'); 175}); 176$('#gameCharadesDemoVideoModal').on('hide.bs.modal', function (e) { 177 pauseVideoWhenClosed('gameCharadesDemoVideoModal'); 178}); 179$('#gameDrawTellDemoVideoModal').on('hide.bs.modal', function (e) { 180 pauseVideoWhenClosed('gameDrawTellDemoVideoModal'); 181}); 182$('#gameSpotMyLieDemoVideoModal').on('hide.bs.modal', function (e) { 183 pauseVideoWhenClosed('gameSpotMyLieDemoVideoModal'); 184}); 185 186function changeHeadButtonColor() { 187 size = $(window).width(); 188 size_document = $(document).width(); 189 if (size < 992) { 190 $('.mobile-head-button > a').removeClass('btn-orange-stroke'); 191 $('.mobile-head-button > a').addClass('btn-orange'); 192 } else { 193 $('.mobile-head-button > a').addClass('btn-orange-stroke'); 194 $('.mobile-head-button > a').removeClass('btn-orange'); 195 } 196} 197 198$(document).ready(function () { 199 setIDFilter('join-a-game'); 200 changeHeadButtonColor(); 201 window.addEventListener('resize', changeHeadButtonColor); 202});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.