1/* 2 * SMF Arcade 3 * 4 * @package SMF Arcade 5 * @version 2.6 6 * @license https://web-develop.ca/index.php?page=arcade_license_BSD2 BSD 2 7 */ 8if (window.addEventListener) 9 window.addEventListener("load", function (){ 10 arcadeFontAwesome(); 11 return false; 12 }); 13else 14 window.attachEvent("onload", function (){ 15 arcadeFontAwesome(); 16 return false; 17 }); 18 19// Add fa classes 20function arcadeFontAwesome() 21{ 22 var fazz=0, fazzClass = 0, arcadeFa = document.getElementsByClassName("fa"), faName, faNewName, fazzReg; 23 var arcadeCurrentClasses = ["fa-arcade", "fa-arcade_arena", "fa-arcade_stats", "fa-arcade_administrator", "fa-archivetype", "fa-gametype", "fa-score", "fa-fullscreen"]; 24 var arcadeReplacementClasses = ["fa-gamepad", "fa-shield", "fa-bar-chart", "fa-cogs", "fa-files-o", "fa-save", "fa-line-chart", "fa-arrows"]; 25 if (arcadeFa) { 26 for(fazz=0;fazz<arcadeFa.length;fazz++) { 27 faArr = arcadeFa[fazz].className.split(" "); 28 for(fazzClass=0;fazzClass<arcadeCurrentClasses.length;fazzClass++) { 29 faName = arcadeCurrentClasses[fazzClass].toString(); 30 faNewName = arcadeReplacementClasses[fazzClass].toString(); 31 if (faArr.indexOf(faNewName) == -1) { 32 arcadeFa[fazz].className = arcadeFa[fazz].className.replace(faName + " ", faNewName + " "); 33 } 34 } 35 } 36 } 37} 38 // Open a new game popup window 39function myGamePopupArcade(strURL,strWidth,strHeight,displayType,fullPop) 40{ 41 var fullPop = typeof fullPop == "undefined" ? false : fullPop; 42 var strOptions=""; 43 var WindowObjectReference = null; 44 var arcadeFullEnable; 45 var displayType = typeof displayType !== "undefined" ? parseInt(displayType) : 0; 46 if (displayType < 0 || displayType > 5) 47 displayType = 0; 48 else 49 displayType = isNaN(displayType) ? 0 : displayType; 50 51 if (displayType > 2) 52 { 53 displayType = displayType-2; 54 var changeWidthDims = 1.01; 55 var changeHeightDims = 1.07; 56 } 57 else 58 { 59 var changeWidthDims = 1; 60 var changeHeightDims = 1; 61 } 62 63 strWidth = strWidth*changeWidthDims; 64 strHeight = strHeight*changeHeightDims; 65 66 var strType = [ 67 "console", 68 "fixed", 69 "elastic", 70 "adjust" 71 ]; 72 73 if (strType[displayType]=="fixed") 74 strOptions = "status,height=" + strHeight + ",width=" + strWidth; 75 else if (strType[displayType]=="elastic") 76 strOptions = "toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth; 77 else if (strType[displayType]=="adjust") 78 strOptions = "status,resizable,height=" + strHeight + ",width=" + strWidth; 79 else 80 strOptions = "resizable,height=" + strHeight + ",width=" + strWidth; 81 82 var topY = window.top.outerHeight / 2 + window.top.screenY - ( strHeight / 2); 83 var leftX = window.top.outerWidth / 2 + window.top.screenX - ( strWidth / 2); 84 strOptions += ",top=" + topY + ",left=" + leftX; 85 if (!fullPop) 86 WindowObjectReference = window.open(strURL + ";full=0", "newWin", strOptions); 87 else 88 WindowObjectReference = window.open(strURL + ";full=1", "newWin", strOptions); 89 if (window.focus) 90 WindowObjectReference.focus(); 91 92 if (!fullPop) 93 WindowObjectReference.resizeTo(strWidth*1.035, strHeight*1.28); 94 else 95 { 96 WindowObjectReference.resizeTo(screen.width, screen.height); 97 } 98} 99 100function getUrlVarsArcade() 101{ 102 var vars = {}; 103 var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { 104 vars[key] = value; 105 }); 106 return vars; 107} 108 109function convertToDateArcade(variableEpoch) 110{ 111 var sourceEpoch = variableEpoch; 112 sourceEpoch = parseInt(sourceEpoch); 113 if (isNaN(sourceEpoch)) { 114 var arcadeDateDisplay = 'Invalid Timestamp'; 115 } 116 else { 117 if (sourceEpoch <= 9999999999) { 118 sourceEpoch *= 1000; 119 } 120 var arcadeDateDisplay = new Date(sourceEpoch).toUTCString(); 121 } 122 return arcadeDateDisplay; 123} 124 125function writeArcadeCookie(name,value,days) 126{ 127 var date, expires; 128 if (days) 129 { 130 date = new Date(); 131 date.setTime(date.getTime()+(days*24*60*60*1000)); 132 expires = "; expires=" + date.toGMTString(); 133 } 134 else 135 expires = ""; 136 137 if (location.protocol !== 'https:') 138 document.cookie = name + "=" + value + expires + ";SameSite=Lax;secure;path=/"; 139 else 140 document.cookie = name + "=" + value + expires + ";SameSite=Lax;path=/"; 141} 142 143function readArcadeCookie(name) 144{ 145 var i, c, ca, nameEQ = name + "="; 146 ca = document.cookie.split(";"); 147 for(i=0;i < ca.length;i++) 148 { 149 c = ca[i]; 150 while (c.charAt(0)==" ") 151 c = c.substring(1,c.length); 152 153 if (c.indexOf(nameEQ) == 0) 154 return c.substring(nameEQ.length,c.length); 155 } 156 157 return ""; 158} 159 160function submitArcadeSkin() 161{ 162 document.getElementById("arcadeSkin").onchange = function() { 163 document.forms["admin_form_wrapper"].submit(); 164 }; 165} 166 167function arcadefadeout() 168{ 169 var arcFade = document.getElementById("arcade_fadeout"); 170 if (arcFade) { 171 arcFade.style = "opacity: 0;font-style: oblique;"; 172 } 173} 174 175function addSmfArcadeEvent(evnt, elemx, func) 176{ 177 var detectArcadeBrowser = detectMyArcadeIE(); 178 179 if (elemx.addEventListener) 180 elemx.addEventListener(evnt, func, false); 181 else if (elemx.attachEvent) 182 elemx.attachEvent('on'+evnt, func); 183 else 184 elemx.onload = func(); 185} 186 187function detectMyArcadeIE() 188{ 189 var undef, 190 v = 3, 191 div = document.createElement("div"), 192 all = div.getElementsByTagName("i"); 193 194 while ( 195 div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', 196 all[0] 197 ); 198 199 return v > 4 ? v : undef; 200} 201 202function alternateArcadeImg(imgId) 203{ 204 document.getElementById(imgId).src = smf_default_theme_url + '/images/arc_icons/game.gif' 205} 206 207function throwArcadeErr(arcmsg) 208{ 209 // throw new Error(arcmsg); 210 console.log(arcmsg); 211}
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.