@@ -465,7 +465,7 @@ function gameLostFree() {
465465 text : "Share" ,
466466 btnClass : 'btn-green' ,
467467 action : function ( linkButton ) {
468- var baseUrl = window . location . origin + window . location . pathname ;
468+ var baseUrl = 'https://befuddle.xyz/' ;
469469 var str = 'Befuddle:\n' + ( window . gameSesh . tlv == - 1 ? 'Gave Up' : ( 'X/' + window . gameSesh . tlv ) ) +
470470 ( window . gameSesh . hideBlanks ? '*' : '' ) +
471471 '\n' + baseUrl + '?cardId=' + window . mtgCard . id +
@@ -567,7 +567,7 @@ function gameLostDaily() {
567567 action : function ( linkButton ) {
568568 let d = new Date ( ) ;
569569 let str =
570- `Daily Befuddle ${ d . toLocaleDateString ( "en-US" ) } \nX${ ( window . gameSesh . hideBlanks ? '*' : '' ) } \n ${ window . location . href } ` ;
570+ `Daily Befuddle ${ d . toLocaleDateString ( "en-US" ) } \nX${ ( window . gameSesh . hideBlanks ? '*' : '' ) } \nhttps://befuddle.xyz/ ` ;
571571 clipboardHandler ( linkButton , str ) ;
572572 return false ;
573573 }
@@ -676,7 +676,7 @@ function gameWinDaily() {
676676 action : function ( linkButton ) {
677677 let d = new Date ( ) ;
678678 let str =
679- `Daily Befuddle ${ d . toLocaleDateString ( "en-US" ) } \n${ wr } /${ window . game . daily . lives } ${ ( window . gameSesh . hideBlanks ? '*' : '' ) } \n ${ window . location . href } ` ;
679+ `Daily Befuddle ${ d . toLocaleDateString ( "en-US" ) } \n${ wr } /${ window . game . daily . lives } ${ ( window . gameSesh . hideBlanks ? '*' : '' ) } \nhttps://befuddle.xyz/ ` ;
680680 clipboardHandler ( linkButton , str ) ;
681681 return false ;
682682 }
@@ -747,7 +747,7 @@ function gameWinFree() {
747747 var str = 'Befuddle: \n' +
748748 wr + ( window . gameSesh . tlv == - 1 ? ( ' wrong guess' + ( wr == 1 ? '' : 'es' ) ) : ( '/' + window . gameSesh . tlv ) ) +
749749 ( window . gameSesh . hideBlanks ? '*' : '' ) +
750- '\n' + window . location . href + ' ?cardId=' + window . mtgCard . id +
750+ '\n' + 'https://befuddle.xyz/ ?cardId=' + window . mtgCard . id +
751751 ( window . mtgCard . cf != - 1 ? ( '&cf=' + window . mtgCard . cf ) : '' ) ;
752752 clipboardHandler ( linkButton , str ) ;
753753 return false ;
@@ -791,7 +791,7 @@ function clipboardHandler(linkButton, str) {
791791function clipboardError ( str ) {
792792 $ . dialog ( {
793793 title : '<span class=\"modalTitle\">Error: Clipboard Access Denied</span>' ,
794- content : '<span class=\"modalText\">You can manually copy the text below:<br><br><div class=\"copyText\">' + str + '</div ></span>' ,
794+ content : '<span class=\"modalText\">You can manually copy the text below:<br><br><pre class=\"copyText\">' + str + '</pre ></span>' ,
795795 type : 'red' ,
796796 theme : window . game . theme ,
797797 animation : 'top' ,
@@ -2173,6 +2173,32 @@ function getDiscordProxiedUrl(originalUrl) {
21732173 . replace ( "https://storage.ko-fi.com" , "/kofi-storage" ) ;
21742174}
21752175
2176+ function isMobile ( ) {
2177+ let hasTouchScreen = false ;
2178+
2179+ // 1. Check for maxTouchPoints (MDN recommended primary method)
2180+ if ( "maxTouchPoints" in navigator ) {
2181+ hasTouchScreen = navigator . maxTouchPoints > 0 ;
2182+ } else if ( "msMaxTouchPoints" in navigator ) { // Fallback for older IE
2183+ hasTouchScreen = navigator . msMaxTouchPoints > 0 ;
2184+ } else {
2185+ // 2. Fallback to matchMedia for pointer accuracy
2186+ var mQ = window . matchMedia && matchMedia ( "(pointer:coarse)" ) ;
2187+ if ( mQ && mQ . media === "(pointer:coarse)" ) {
2188+ hasTouchScreen = ! ! mQ . matches ;
2189+ } else if ( 'orientation' in window ) { // 3. Fallback to orientation check (deprecated, good fallback)
2190+ hasTouchScreen = true ;
2191+ } else {
2192+ // 4. Last resort: User Agent sniffing
2193+ var UA = navigator . userAgent ;
2194+ hasTouchScreen = (
2195+ / \b ( B l a c k B e r r y | w e b O S | i P h o n e | I E M o b i l e ) \b / i. test ( UA ) ||
2196+ / \b ( A n d r o i d | W i n d o w s P h o n e | i P a d | i P o d ) \b / i. test ( UA )
2197+ ) ;
2198+ }
2199+ }
2200+ return hasTouchScreen ;
2201+ }
21762202
21772203async function initializeDiscordApp ( ) {
21782204 console . log ( "Checking platform environment..." ) ;
@@ -2198,6 +2224,11 @@ async function initializeDiscordApp() {
21982224 window . mtgSymbols [ key ] = getDiscordProxiedUrl ( window . mtgSymbols [ key ] ) ;
21992225 } ) ;
22002226
2227+ if ( isMobile ( ) ) {
2228+ console . log ( "Mobile environment detected" ) ;
2229+ document . getElementsByTagName ( 'html' ) [ 0 ] . style = "transform: translateY(50px); height: calc(100% - 50px);" ;
2230+ }
2231+
22012232 try {
22022233 await discordSdk . ready ( ) ;
22032234 console . log ( "Discord Handshake Complete!" ) ;
0 commit comments