@@ -7,7 +7,7 @@ import { initializeAppGrid, tryGetIcon, trackRecentlyUsed } from "./desktopui/st
77const IFRAME_ATTRS =
88 'style="width:100%;height:100%;border:none;" allow="autoplay; fullscreen; clipboard-write; encrypted-media; picture-in-picture" sandbox="allow-forms allow-downloads allow-modals allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"' ;
99import { getLibraryUrl } from "./shared/cdnConfig.js" ;
10- import { StorageKeys , os , brand } from "./framework.js" ;
10+ import { StorageKeys , os , brand , yuriPageTitle } from "./framework.js" ;
1111import { parseBool } from "./utils/utils.js" ;
1212import {
1313 fetchHtmlAsBlobUrl ,
@@ -551,12 +551,10 @@ player.load("${swfPath}");
551551 const isGame = this . isTransparencyBlocked ( appId , { type } ) ;
552552 const gameIcon = this . appMap [ appId ] ?. icon || "fas fa-gamepad" ;
553553 const resolvedGameIcon = resolveIconUrl ( gameIcon ) ;
554- const gameIconHtml =
555- resolvedGameIcon . startsWith ( "fas " ) ||
556- resolvedGameIcon . startsWith ( "fab " ) ||
557- resolvedGameIcon . startsWith ( "far " )
558- ? `<i class="${ resolvedGameIcon } " style="margin-right:6px;font-size:16px;vertical-align:middle;"></i>`
559- : `<img src="${ resolvedGameIcon } " style="width:20px;height:20px;margin-right:6px;vertical-align:middle;object-fit:contain;">` ;
554+ const gameIconHtml = this . buildWindowIconHtml ( resolvedGameIcon , {
555+ margin : "6px" ,
556+ iconVerticalAlign : true
557+ } ) ;
560558
561559 if ( window . electronAPI ) {
562560 let nativeWidth = 1280 ;
@@ -609,13 +607,12 @@ player.load("${swfPath}");
609607 : "" ;
610608
611609 win . innerHTML = `
612- <div class="window-header">
613- <span>${ gameIconHtml } ${ displayTitle } </span>
614- <div class="window-header-actions">
615- ${ overlayBtnHtml }
616- ${ os . window . getWindowControls ( resolvedSource , true ) }
617- </div>
618- </div>
610+ ${ this . buildWindowHeaderMarkup (
611+ gameIconHtml ,
612+ displayTitle ,
613+ overlayBtnHtml ,
614+ os . window . getWindowControls ( resolvedSource , true )
615+ ) }
619616 <div class="window-content" style="width:100%; height:100%; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#1a1a1a;">
620617 <div class="modern-loader">
621618 <div class="loader-dots">
@@ -702,10 +699,32 @@ player.load("${swfPath}");
702699 return ! ( appMeta . type === "system" || this . TRANSPARENCY_ALLOWED_APP_IDS . has ( appId ) ) ;
703700 }
704701
702+ buildWindowIconHtml ( resolvedIcon , options = { } ) {
703+ const { margin = "8px" , iconVerticalAlign = false } = options ;
704+ const isFontIcon =
705+ resolvedIcon . startsWith ( "fas " ) || resolvedIcon . startsWith ( "fab " ) || resolvedIcon . startsWith ( "far " ) ;
706+ const vertAlignStyle = iconVerticalAlign ? "vertical-align:middle;" : "" ;
707+ return isFontIcon
708+ ? `<i class="${ resolvedIcon } " style="margin-right:${ margin } ;font-size:16px;${ vertAlignStyle } "></i>`
709+ : `<img src="${ resolvedIcon } " style="width:20px;height:20px;margin-right:${ margin } ;vertical-align:middle;object-fit:contain;">` ;
710+ }
711+
712+ buildWindowHeaderMarkup ( iconHtml , title , overlayBtnHtml , controlsHtml ) {
713+ return `
714+ <div class="window-header">
715+ <span>${ iconHtml } ${ title } </span>
716+ <div class="window-header-actions">
717+ ${ overlayBtnHtml }
718+ ${ controlsHtml }
719+ </div>
720+ </div>
721+ ` ;
722+ }
723+
705724 createWindow ( id , title , contentHtml , externalUrl = null , appId = null , appMeta = { } ) {
706725 const urlParams = new URLSearchParams ( window . location . search ) ;
707726 if ( urlParams . has ( "game" ) && appId ) {
708- document . title = sanitizeTitle ( title ) ;
727+ document . title = yuriPageTitle ( ) || sanitizeTitle ( title ) ;
709728 document . head . insertAdjacentHTML (
710729 "beforeend" ,
711730 `<style>
@@ -751,23 +770,14 @@ player.load("${swfPath}");
751770 } ) ;
752771
753772 const resolvedIcon = resolveIconUrl ( icon ) ;
754- const iconHtml =
755- resolvedIcon . startsWith ( "fas " ) || resolvedIcon . startsWith ( "fab " ) || resolvedIcon . startsWith ( "far " )
756- ? `<i class="${ resolvedIcon } " style="margin-right:8px;font-size:16px;"></i>`
757- : `<img src="${ resolvedIcon } " style="width:20px;height:20px;margin-right:8px;vertical-align:middle;object-fit:contain;">` ;
773+ const iconHtml = this . buildWindowIconHtml ( resolvedIcon , { margin : "8px" } ) ;
758774
759775 const overlayBtnHtml = isGame
760776 ? `<button class="overlay-open-btn" title="Steam Overlay (Shift+Tab)"><i class="fab fa-steam"></i></button>`
761777 : "" ;
762778
763779 win . innerHTML = `
764- <div class="window-header">
765- <span>${ iconHtml } ${ title } </span>
766- <div class="window-header-actions">
767- ${ overlayBtnHtml }
768- ${ os . window . getWindowControls ( externalUrl , true ) }
769- </div>
770- </div>
780+ ${ this . buildWindowHeaderMarkup ( iconHtml , title , overlayBtnHtml , os . window . getWindowControls ( externalUrl , true ) ) }
771781 <div class="window-content" style="width:100%; height:100%; overflow:hidden;">${ contentHtml } </div>
772782 ` ;
773783
0 commit comments