diff --git a/panorama/layout/hud/hud.xml b/panorama/layout/hud/hud.xml
index f9d3c25..71da618 100644
--- a/panorama/layout/hud/hud.xml
+++ b/panorama/layout/hud/hud.xml
@@ -2,10 +2,15 @@
+
-
-
+
+
+
+
+
+
@@ -144,9 +149,6 @@
-
-
-
@@ -159,9 +161,13 @@
+
+
+
+
diff --git a/panorama/layout/mainmenu_news.xml b/panorama/layout/mainmenu_news.xml
index 8210f9d..27bb35b 100644
--- a/panorama/layout/mainmenu_news.xml
+++ b/panorama/layout/mainmenu_news.xml
@@ -9,29 +9,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -40,10 +17,14 @@
-
-
-
-
+
diff --git a/panorama/layout/motd_panel.xml b/panorama/layout/motd_panel.xml
new file mode 100644
index 0000000..0ac4a58
--- /dev/null
+++ b/panorama/layout/motd_panel.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/panorama/scripts/mainmenu_news.js b/panorama/scripts/mainmenu_news.js
index c1d6fb3..b17e27f 100644
--- a/panorama/scripts/mainmenu_news.js
+++ b/panorama/scripts/mainmenu_news.js
@@ -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);
})();
\ No newline at end of file
diff --git a/panorama/scripts/motd_panel.js b/panorama/scripts/motd_panel.js
new file mode 100644
index 0000000..b671e7c
--- /dev/null
+++ b/panorama/scripts/motd_panel.js
@@ -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 ' + sUrl + ' 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);
+})();
\ No newline at end of file
diff --git a/panorama/styles/mainmenu_news.css b/panorama/styles/mainmenu_news.css
index 40735ef..1d26df4 100644
--- a/panorama/styles/mainmenu_news.css
+++ b/panorama/styles/mainmenu_news.css
@@ -8,7 +8,7 @@
{
width: 100%;
height: fill-parent-flow( 1 );
- background-color: blurBackgroundColor;
+ background-color: #0a0a0a;
margin-bottom: 16px;
flow-children: down;
diff --git a/panorama/styles/motd_panel.css b/panorama/styles/motd_panel.css
new file mode 100644
index 0000000..c2ad453
--- /dev/null
+++ b/panorama/styles/motd_panel.css
@@ -0,0 +1,64 @@
+.MOTDPanel_Backdrop {
+ width: 100%;
+ height: 100%;
+ background-color: blurBackgroundColor;
+ horizontal-align: center;
+ vertical-align: center;
+}
+
+.MOTDPanel {
+ width: 80%;
+ height: 75%;
+ horizontal-align: center;
+ vertical-align: center;
+ flow-children: down;
+ background-color: #1e1e1eff;
+ border: 1px solid #444444ff;
+ border-radius: 8px;
+ box-shadow: 0px 0px 20px black;
+}
+
+.MOTDPanel_Header {
+ width: 100%;
+ height: 50px;
+ vertical-align: center;
+ padding-left: 20px;
+ background-color: #141414ff;
+ border-radius: 8px 8px 0px 0px;
+}
+
+.MOTDPanel_Title {
+ font-size: 22px;
+ font-weight: bold;
+ font-family: Stratum2, 'Arial Unicode MS';
+ color: white;
+}
+
+#MOTDPanel_HTML {
+ width: 100%;
+ height: fill-parent-flow(1);
+}
+
+.MOTDPanel_Footer {
+ width: 100%;
+ height: 60px;
+ vertical-align: center;
+ background-color: #141414ff;
+ border-radius: 0px 0px 8px 8px;
+}
+
+.MOTDPanel_GoButton {
+ width: 170px;
+ height: 40px;
+ background-color: #1a1a1aff;
+ border: 1px solid #555555ff;
+ horizontal-align: center;
+ vertical-align: center;
+}
+
+.MOTDPanel_GoButton Label {
+ horizontal-align: center;
+ vertical-align: center;
+ color: white;
+ font-family: Stratum2, 'Arial Unicode MS';
+}
\ No newline at end of file