Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions panorama/layout/hud/hud.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
<styles>
<include src="file://{resources}/styles/csgostyles.css" />
<include src="file://{resources}/styles/hud/hud.css" />
<include src="file://{resources}/styles/motd_panel.css" />
</styles>

<CSGOHud hittest="false">

<scripts>
<include src="file://{resources}/scripts/motd_panel.js" />
</scripts>

<CSGOHud hittest="false">


<CSGOHudBlurTarget blurrects="RoundImpactScoreMain MapDraft" class="HudBlurLess" hittest="false" hittestchildren="false">
<CSGOBackbufferImagePanel class="full-width full-height" />
Expand Down Expand Up @@ -144,9 +149,6 @@
</Panel>

<CSGOEndOfMatch id="EndOfMatch" />

<CSGOTeamSelectMenu id="TeamSelectMenu"/>


<CSGOSurvivalSpawnSelect id="SurvivalSpawnSelect"/>

Expand All @@ -159,9 +161,13 @@


<Panel id="ItemPreviewDebugManager" hittest="false" />
<Frame id="MOTDPanelHUD" src="file://{resources}/layout/motd_panel.xml" />
<CSGOPopupManager id="PopupManager" onpopupsdismissed="" />
<ContextMenuManager id="ContextMenuManager" />
<CSGOTooltipManager id="TooltipManager" hittest="false" />

<CSGOTeamSelectMenu id="TeamSelectMenu"/>

</CSGOHud>

</root>
35 changes: 8 additions & 27 deletions panorama/layout/mainmenu_news.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@
<include src="file://{resources}/scripts/mainmenu_news.js" />
</scripts>

<snippets>
<snippet name="news-full-entry">
<Button class="news-entry news-panel-style-short-entires">




<CSGOBlurTarget id="NewsEntryBlurTarget" class="news-entry__image--blur" >
<Image id="NewsHeaderImage" class="news-entry__image" src="" scaling="stretch-to-fit-x-preserve-aspect" />
</CSGOBlurTarget>
</Button>
</snippet>

<snippet name="news-info">
<Panel class="news-entry__info">
<Label html="true" class="news-entry__details stratum-font" text="{s:news_item_date}" />
<Label html="true" class="news-entry__title stratum-font" text="{s:news_item_title}" />
<Label html="true" class="news-entry__body" text="{s:h:news_item_body}" />
</Panel>
</snippet>

</snippets>


<Panel class="news-panel MainMenuModeOnly">
<Panel style="margin: 12px 0px 0px 12px;" class="news-panel-navbar">
Expand All @@ -40,10 +17,14 @@
<Image class="news-panel-navbar-logo news-panel-navbar-pwchina" textureheight="18" texturewidth="-1" src="file://{images}/icons/ui/ct_silhouette.svg" />
<Label html="false" text="#SFUI_MainMenu_News_Title" />
</Panel>
<Panel id="NewsPanelLister" class="news-panel__list vscroll">


</Panel>
<HTML id="HarmonyBlogHTML"
class="full-width full-height"
acceptsinput="true"
acceptsfocus="true"
focusonhover="true"
mousetracking="true"
popuplinks="false"
url="https://harmony.heapy.xyz/blog" />
</Panel>
</root>

Expand Down
32 changes: 32 additions & 0 deletions panorama/layout/motd_panel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<root>
<styles>
<include src="file://{resources}/styles/csgostyles.css" />
<include src="file://{resources}/styles/motd_panel.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/motd_panel.js" />
</scripts>

<Panel class="MOTDPanel_Backdrop">
<Panel class="MOTDPanel">
<Panel class="MOTDPanel_Header">
<Label class="MOTDPanel_Title" text="Server's Message of the Day" />
</Panel>

<HTML id="MOTDPanel_HTML"
class="full-width full-height"
acceptsinput="true"
acceptsfocus="true"
focusonhover="true"
mousetracking="true"
popuplinks="false"
url="" />

<Panel class="MOTDPanel_Footer">
<Button class="MOTDPanel_GoButton" onactivate="MOTDPanel.OnGoPressed()">
<Label text="GO" />
</Button>
</Panel>
</Panel>
</Panel>
</root>
133 changes: 43 additions & 90 deletions panorama/scripts/mainmenu_news.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,56 @@

var NewsPanel = (function () {

var _GetRssFeed = function()
{
BlogAPI.RequestRSSFeed();
}
var _Init = function() {
var elBlogHTML = $.GetContextPanel().FindChildTraverse('HarmonyBlogHTML');
if (elBlogHTML) {
elBlogHTML.SetURL('https://harmony.heapy.xyz/blog');
}
};

function _InjectCSS() {
var elBlogHTML = $.GetContextPanel().FindChildTraverse('HarmonyBlogHTML');
if (elBlogHTML) {
elBlogHTML.RunJavascript(`
var style = document.createElement('style');
style.textContent = \`
nav.sticky.top-0.z-50.flex.items-center.gap-1.border-b.border-border.px-4.py-2.backdrop-blur-sm {
display: none !important;
}
h1.text-2xl.font-semibold {
display: none !important;
}
\`;
document.head.appendChild(style);
`);
}
}

function _HTMLFinishRequest() {
_InjectCSS();
}

function _HTMLOpenPopupTab(objHtmlEventTarget, objHtml, sUrl) {
// Add custom command later here if needed, for now we allow only to open external links in 'developer 2'
if(GameInterfaceAPI.GetSettingString("developer") == 2) {
UiToolkitAPI.ShowGenericPopupYesNo( 'External Link', 'This link will open ' + sUrl + ' externally in your Browser.\n\nAre you sure that you want to open this link?', '', function() { SteamOverlayAPI.OpenUrlInOverlayOrExternalBrowser(sUrl); }, function() { } )
} else {
UiToolkitAPI.ShowGenericPopupOk( 'External Links', 'Due to security measure\'s, you cannot open any links externally from within CS Harmony unless it\'s enabled specifically in your game settings.', '', function() { } )
}
}

var _OnRssFeedReceived = function( feed )
{
if( $.GetContextPanel().BHasClass( 'news-panel--hide-news-panel' ) )
{
return;
};

var elLister = $.GetContextPanel().FindChildInLayoutFile( 'NewsPanelLister' );

if ( elLister === undefined || elLister === null || !feed )
return;

elLister.RemoveAndDeleteChildren();


var foundFirstNewsItem = false;

feed[ 'items' ].forEach( function( item, i )
{
var elEntry = $.CreatePanel( 'Panel', elLister, 'NewEntry' + i, {
acceptsinput: true
} );

var lastReadItem = GameInterfaceAPI.GetSettingString( 'ui_news_last_read_link' );


if ( !foundFirstNewsItem && !item.categories.includes( 'Minor' ) )
{
foundFirstNewsItem = true;


elEntry.AddClass( 'new' );

/*
if ( item.link != lastReadItem )
{
UiToolkitAPI.ShowCustomLayoutPopupParameters( '', 'file://{resources}/layout/popups/popup_news.xml',
'date=' + item.date + "&" +
'title=' + item.title + "&" +
'link=' + item.link );
}
*/

GameInterfaceAPI.SetSettingString( 'ui_news_last_read_link', item.link );
}

elEntry.BLoadLayoutSnippet( 'news-full-entry' );
var elImage = elEntry.FindChildInLayoutFile( 'NewsHeaderImage' );

if ( item.imageUrl )
{
elImage.SetImage( item.imageUrl );
}
else
{
elImage.SetImage( "file://{images}/store/default-news.png" );
}

var elEntryInfo = $.CreatePanel( 'Panel', elEntry, 'NewsInfo' + i );
elEntryInfo.BLoadLayoutSnippet( 'news-info' );

elEntryInfo.SetDialogVariable( 'news_item_date', item.date );
elEntryInfo.SetDialogVariable( 'news_item_title', item.title );
elEntryInfo.SetDialogVariable( 'news_item_body', item.description );


elEntry.FindChildInLayoutFile( 'NewsEntryBlurTarget' ).AddBlurPanel( elEntryInfo );

elEntry.SetPanelEvent( "onactivate", function( link, elEntry, clearNew )
{
SteamOverlayAPI.OpenURL( link );

if ( clearNew )
{
GameInterfaceAPI.SetSettingString( 'ui_news_last_read_link', link );
elEntry.RemoveClass( 'new' );
}

}.bind( SteamOverlayAPI, item.link, elEntry, i == 0 ) );

} );
};

return {
GetRssFeed : _GetRssFeed,
OnRssFeedReceived: _OnRssFeedReceived,
Init: _Init,
HTMLFinishRequest: _HTMLFinishRequest,
HTMLOpenPopupTab: _HTMLOpenPopupTab
};
})();


( function()
{
NewsPanel.GetRssFeed();
$.RegisterForUnhandledEvent( "PanoramaComponent_Blog_RSSFeedReceived", NewsPanel.OnRssFeedReceived );
NewsPanel.Init();
$.RegisterEventHandler("HTMLFinishRequest", $.GetContextPanel(), NewsPanel.HTMLFinishRequest);
$.RegisterEventHandler("HTMLOpenPopupTab", $.GetContextPanel(), NewsPanel.HTMLOpenPopupTab);
})();
53 changes: 53 additions & 0 deletions panorama/scripts/motd_panel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

var MOTDPanel = (function() {

var _m_hDenyInputToGame = null;

var elMOTDPanel = $.GetContextPanel().FindChildTraverse('MOTDPanel_HTML');

var _Init = function() {

if (elMOTDPanel) {
elMOTDPanel.SetURL( MatchStatsAPI.GetServerWebsiteURL( true ) );
}

try {
_m_hDenyInputToGame = UiToolkitAPI.AddDenyInputFlagsToGame(elMOTDPanel, "MOTDPanel_HTML", "CaptureMouse" );
} catch (error) {

}
};

function _HTMLOpenPopupTab(objHtmlEventTarget, objHtml, sUrl) {
UiToolkitAPI.ShowGenericPopupYesNo(
'External Link',
'You are about to open <b>' + sUrl + '</b> externally in your Browser.\n\nAre you sure that you want to open this link?',
'',
function() { SteamOverlayAPI.OpenUrlInOverlayOrExternalBrowser(sUrl); },
function() { } )
}

function _OnGoPressed() {
_Hide();
}

function _Hide() {
$.Msg($.GetContextPanel());
$.GetContextPanel().RemoveAndDeleteChildren();
UiToolkitAPI.ReleaseDenyInputFlagsToGame(_m_hDenyInputToGame);
_m_hDenyInputToGame = null;
}

return {
Init: _Init,
HTMLOpenPopupTab: _HTMLOpenPopupTab,
OnGoPressed: _OnGoPressed,
Hide: _Hide
};
})();

(function() {
MOTDPanel.Init();
$.RegisterEventHandler("HTMLOpenPopupTab", $.GetContextPanel().FindChildTraverse('MOTDPanel_HTML'), MOTDPanel.HTMLOpenPopupTab);
})();
2 changes: 1 addition & 1 deletion panorama/styles/mainmenu_news.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
width: 100%;
height: fill-parent-flow( 1 );
background-color: blurBackgroundColor;
background-color: #0a0a0a;
margin-bottom: 16px;
flow-children: down;

Expand Down
Loading