From 13e1734b2c40e35cbae8d7429d16f5452c1aa9f7 Mon Sep 17 00:00:00 2001 From: Yogpod Date: Sun, 7 Feb 2021 14:48:05 -0800 Subject: [PATCH] bring up to date, add better source scheme, remove localization edits --- html/css/Workshop.css | 224 ++++++-- html/css/creations/Creations.css | 65 ++- html/css/menu/Menu.css | 16 +- html/css/menu/NewGame.css | 18 +- html/css/menu/PageOptions.css | 161 +++++- html/css/menu/Servers.css | 20 +- html/dupes.html | 2 +- html/js/creations/dupes.js | 17 + html/js/creations/saves.js | 16 + html/js/menu/Subscriptions.js | 50 +- html/js/menu/TestData.js | 2 +- html/js/menu/TestWorkshop.js | 21 +- html/js/menu/WorkshopFiles.js | 50 +- html/js/menu/control.Addons.js | 303 +++++++++-- html/js/menu/control.Demos.js | 2 + html/js/menu/control.Dupes.js | 2 + html/js/menu/control.Main.js | 61 ++- html/js/menu/control.Menu.js | 55 +- html/js/menu/control.Saves.js | 2 + html/js/menu/control.Servers.js | 29 +- html/js/menu/menuApp.js | 2 +- html/js/svc.Tranny.js | 6 +- html/loading.css | 104 +++- html/loading.html | 55 +- html/menu.html | 7 +- html/saves.html | 2 +- html/template/addon_list.html | 165 ++++-- html/template/creations/dupes.html | 73 +-- html/template/creations/saves.html | 73 +-- html/template/demos.html | 117 +++-- html/template/dupes.html | 143 +++--- html/template/main.html | 7 +- html/template/saves.html | 145 +++--- html/template/servers.html | 5 +- lua/includes/modules/co.lua | 410 +++++++-------- lua/menu/mainmenu.lua | 77 ++- lua/menu/menu.lua | 2 +- resource/SourceScheme.res | 485 +++++++++--------- resource/localization/bg/main_menu.properties | 320 ------------ resource/localization/cs/main_menu.properties | 320 ------------ resource/localization/da/main_menu.properties | 320 ------------ resource/localization/de/main_menu.properties | 320 ------------ resource/localization/el/main_menu.properties | 320 ------------ .../localization/en-PT/main_menu.properties | 320 ------------ resource/localization/en/main_menu.properties | 321 ------------ .../localization/es-ES/main_menu.properties | 320 ------------ resource/localization/et/main_menu.properties | 320 ------------ resource/localization/fi/main_menu.properties | 320 ------------ resource/localization/fr/main_menu.properties | 320 ------------ resource/localization/he/main_menu.properties | 320 ------------ resource/localization/hr/main_menu.properties | 320 ------------ resource/localization/hu/main_menu.properties | 320 ------------ resource/localization/it/main_menu.properties | 320 ------------ resource/localization/ja/main_menu.properties | 320 ------------ resource/localization/ko/main_menu.properties | 320 ------------ resource/localization/lt/main_menu.properties | 320 ------------ resource/localization/nl/main_menu.properties | 320 ------------ resource/localization/no/main_menu.properties | 320 ------------ resource/localization/pl/main_menu.properties | 320 ------------ .../localization/pt-BR/main_menu.properties | 320 ------------ .../localization/pt-PT/main_menu.properties | 320 ------------ resource/localization/ru/main_menu.properties | 320 ------------ resource/localization/sk/main_menu.properties | 320 ------------ .../localization/sv-SE/main_menu.properties | 320 ------------ resource/localization/th/main_menu.properties | 320 ------------ resource/localization/tr/main_menu.properties | 320 ------------ resource/localization/uk/main_menu.properties | 320 ------------ resource/localization/vi/main_menu.properties | 320 ------------ .../localization/zh-CN/main_menu.properties | 320 ------------ .../localization/zh-TW/main_menu.properties | 320 ------------ 70 files changed, 1932 insertions(+), 11303 deletions(-) delete mode 100644 resource/localization/bg/main_menu.properties delete mode 100644 resource/localization/cs/main_menu.properties delete mode 100644 resource/localization/da/main_menu.properties delete mode 100644 resource/localization/de/main_menu.properties delete mode 100644 resource/localization/el/main_menu.properties delete mode 100644 resource/localization/en-PT/main_menu.properties delete mode 100644 resource/localization/en/main_menu.properties delete mode 100644 resource/localization/es-ES/main_menu.properties delete mode 100644 resource/localization/et/main_menu.properties delete mode 100644 resource/localization/fi/main_menu.properties delete mode 100644 resource/localization/fr/main_menu.properties delete mode 100644 resource/localization/he/main_menu.properties delete mode 100644 resource/localization/hr/main_menu.properties delete mode 100644 resource/localization/hu/main_menu.properties delete mode 100644 resource/localization/it/main_menu.properties delete mode 100644 resource/localization/ja/main_menu.properties delete mode 100644 resource/localization/ko/main_menu.properties delete mode 100644 resource/localization/lt/main_menu.properties delete mode 100644 resource/localization/nl/main_menu.properties delete mode 100644 resource/localization/no/main_menu.properties delete mode 100644 resource/localization/pl/main_menu.properties delete mode 100644 resource/localization/pt-BR/main_menu.properties delete mode 100644 resource/localization/pt-PT/main_menu.properties delete mode 100644 resource/localization/ru/main_menu.properties delete mode 100644 resource/localization/sk/main_menu.properties delete mode 100644 resource/localization/sv-SE/main_menu.properties delete mode 100644 resource/localization/th/main_menu.properties delete mode 100644 resource/localization/tr/main_menu.properties delete mode 100644 resource/localization/uk/main_menu.properties delete mode 100644 resource/localization/vi/main_menu.properties delete mode 100644 resource/localization/zh-CN/main_menu.properties delete mode 100644 resource/localization/zh-TW/main_menu.properties diff --git a/html/css/Workshop.css b/html/css/Workshop.css index e20ca35..8c2bbce 100644 --- a/html/css/Workshop.css +++ b/html/css/Workshop.css @@ -56,7 +56,7 @@ workshopicon name color: #DDD; } -workshopicon author, workshopicon votes +workshopicon author, workshopicon votes, workshopicon size { position: absolute; bottom: 0px; @@ -76,14 +76,20 @@ workshopicon author, workshopicon votes padding: 3px 6px; } +workshopicon size +{ + top: 22px; + bottom: auto; + border-radius: 0 0 0 4px; +} -workshopicon author +workshopicon author, workshopicon size { right: 0px; -webkit-transition: right 100ms ease-out 200ms; } -workshopicon:hover author +workshopicon:hover author, workshopicon:hover size { right: -200px; -webkit-transition: right 100ms ease-in 0ms; @@ -92,9 +98,15 @@ workshopicon:hover author workshopicon votes { left: 0px; + color: #4a4; -webkit-transition: left 100ms ease-out 200ms; } +workshopicon votes.negative +{ + color: #a44; +} + workshopicon:hover votes { left: -200px; @@ -106,7 +118,6 @@ workshopicon votes bottom: 0px; right: inherit; border-radius: 0 4px 0 0; - color: #DDD !important; } workshopicon description @@ -118,10 +129,11 @@ workshopicon description right: 0; text-align: justify; background-color: #777; - font-size: 12px; + font-size: 11px; padding: 32px 8px; color: #DDD; cursor: default; + opacity: 0; -webkit-transition: opacity 100ms ease-in 0ms; } @@ -153,6 +165,13 @@ workshopmessage margin: 64px; } +@media screen and (max-height: 800px) { + workshopmessage + { + margin: 16px; + } +} + workshopcontainer { position: absolute; @@ -178,7 +197,7 @@ controls controls control { - font-size: 12px; + font-size: 11px; display: inline-block; background-color: #333; padding: 2px 4px; @@ -200,19 +219,149 @@ controls control:hover background-color: #666; } -pagnation +.ugc_settings_button +{ + height: 44px; + width: 44px; + + padding: 6px; + background: #666; + border-radius: 4px; + box-sizing: border-box; + + position: absolute; + bottom: 4px; + right: 4px; + cursor: default; +} +.ugc_settings_button:hover +{ + background: rgb(33, 33, 33); +} + +.ugc_settings +{ + width: 100%; + + padding: 10px; + background: rgb(33, 33, 33); + + z-index: 128; + position: absolute; + bottom: 52px; + left: 0; + box-sizing: border-box; + + visibility: hidden; + overflow: hidden; +} +.ugc_settings.active +{ + visibility: visible; +} + +.ugc_settings span +{ + display: block; + font-weight: bold; +} +.ugc_settings label +{ + position: relative; + top: -2px; +} + +.ugc_settings a { - background-color: #222; + font-weight: bold; + color: #000; + padding: 4px 15px; + background: rgb(90, 90, 90); + display: block; + margin-top: 2px; + text-align: center; + border-radius: 4px; + cursor: default; +} +.ugc_settings a:hover +{ + colo2r: #ff7; + background: rgb(151, 15, 15); +} + +.ugc_settings_cat +{ + vertical-align: top; + display: inline-block; + color: rgb(252, 252, 252); + padding: 0px 1%; + margin: 0 auto; +} + +.create_preset +{ + min-width: 350px; +} + +.preset_content +{ + min-width: 500px; + margin-bottom: 5px; +} +.preset_list +{ + background: rgb(58, 58, 58, 255); + width: 150px; + display: inline-block; + max-height: 400px; + min-height: 230px; + overflow-y: scroll; + overflow-x: hidden; +} +.preset_list font +{ + display: block; + padding: 5px; + cursor: default; +} +.preset_list font:hover +{ + background: #ddd; +} +.preset_list font.active +{ + background: #ccc; +} +.preset_data +{ + width: 345px; + padding-left: 5px; + display: inline-block; + vertical-align: top; + cursor: default; +} + +pagination +{ + background-color: rgb(36, 36, 36); border-radius: 4px; margin: 0 auto; padding: 4px 4px; - white-space: nowrap; - margin-left: 10%; - margin-right: 10%; + /*white-space: nowrap;*/ + max-width: 500px; + z-index: 64; /* Ensure it is above other elements in case something goes wrong */ } +@media screen and (max-width: 840px) +{ + pagination + { + margin: 0; + margin-right: 48px; + } +} -pagnation .back, pagnation .next +pagination .back, pagination .next { display: block; float: left; @@ -224,49 +373,66 @@ pagnation .back, pagnation .next background-position: center center; } -pagnation .next +pagination .next { float: right; background-image: url('../img/arrow_right.png'); } -workshopicon.installed +pagination .pages { - border-color: #676; + overflow: hidden; + margin-top: 6px; } -workshopicon.installed name +pagination span.pagenum { - background-color: #676; + font-size: 14px; } - -workshopicon.installed author +pagination a.page { - background-color: #676; + opacity: 0.5; +} +pagination a.page.active +{ + opacity: 1; } -workshopicon.installed votes +workshopicon.installed +{ + border-color: #676; +} +workshopicon.installed name, workshopicon.installed author, workshopicon.installed votes, workshopicon.installed size { - background-color: #676; + background: #676; } workshopicon.disabled { border-color: #766; } - -workshopicon.disabled name +workshopicon.disabled name, workshopicon.disabled author, workshopicon.disabled votes, workshopicon.disabled size { - background-color: #766; + background: #766; } -workshopicon.disabled author +workshopicon.invalid +{ + border-color: #d22; +} +workshopicon.invalid name, workshopicon.invalid author, workshopicon.invalid votes, workshopicon.invalid size { - background-color: #766; + background: #d22; + color: #fff; } -workshopicon.disabled votes +workshopicon.invalid.disabled +{ + border-color: #922; +} +workshopicon.invalid.disabled name, workshopicon.invalid.disabled author, workshopicon.invalid.disabled votes, workshopicon.invalid.disabled size { - background-color: #766; + background: #922; + color: #766; } diff --git a/html/css/creations/Creations.css b/html/css/creations/Creations.css index a76caa6..576a529 100644 --- a/html/css/creations/Creations.css +++ b/html/css/creations/Creations.css @@ -151,7 +151,7 @@ DIV.disabled border-radius: 4px; } -pagnation +pagination { position: absolute; bottom: 4px; @@ -309,7 +309,7 @@ workshopmessage .options UL LI a { - //text-shadow: 1px 1px 1px rgba( 0, 0, 0, 0.5 ); + /*text-shadow: 1px 1px 1px rgba( 0, 0, 0, 0.5 );*/ color: rgba( 255, 255, 255, 0.9 ); } @@ -319,3 +319,64 @@ workshopmessage text-shadow: 0px 0px 8px rgba( 255, 255, 255, 1.0 ); } +/* 1152x864 and lower */ +@media (max-width: 700px) { + workshopicon + { + margin: 0px; + margin-right: 5px; + margin-bottom: 5px; + } +} + +/* 1024x768 and lower */ +@media (max-width: 670px) { + .options { + width: 150px !important; + } + + .clickable { + padding-left: 5px !important; + } + + DIV.page + { + left: 150px !important; + } + + workshopicon + { + width: 170px !important; + height: 170px !important; + margin: 0px; + margin-right: 1px; + margin-bottom: 1px; + } +} + +/* 800x600 and lower */ +@media (max-width: 530px) { + .options { + width: 130px !important; + } + + .clickable { + padding-left: 5px !important; + } + + DIV.page + { + left: 130px !important; + } + .options UL { + margin: 0px; + } + workshopicon + { + width: 90px !important; + height: 90px !important; + margin: 0px; + margin-right: 0px; + margin-bottom: 0px; + } +} diff --git a/html/css/menu/Menu.css b/html/css/menu/Menu.css index 945c883..5d18c7b 100644 --- a/html/css/menu/Menu.css +++ b/html/css/menu/Menu.css @@ -1,3 +1,4 @@ + BODY { overflow: hidden; @@ -78,7 +79,7 @@ UL.category LI.icon position: absolute; } -.btn-primary +.btn-primary, .btn-primary-disabled { background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#08C), to(#05C)); border: 1px solid #CCC; @@ -192,7 +193,7 @@ DIV.disabled border-radius: 4px; } -pagnation +pagination { position: absolute; bottom: 4px; @@ -259,6 +260,12 @@ loading box-shadow: 0 0 10px 1px rgba( 0, 0, 0, 0.4 ); cursor: hand; } +.news_buttons div.new { + background: #f55; +} +.news_buttons div.selected.new { + background: #fcc; +} .news_buttons div.selected { background: #eee; } @@ -271,9 +278,8 @@ loading box-shadow: 0 0 10px 1px rgba( 0, 0, 0, 0.4 ); height: 256px; width: 512px; - position:relative; + position: relative; } - .news_item div font { font-weight: normal; font-size: small; @@ -323,4 +329,4 @@ loading right: 5px; top: 65px; } -} \ No newline at end of file +} diff --git a/html/css/menu/NewGame.css b/html/css/menu/NewGame.css index 995606b..9497b94 100644 --- a/html/css/menu/NewGame.css +++ b/html/css/menu/NewGame.css @@ -39,7 +39,7 @@ UL.category LI.mapicon position: relative; width: 128px; text-align: center; - font-size: 12px; + font-size: 10px; padding: 6px; margin: 2px; cursor: pointer; @@ -154,7 +154,7 @@ gamesettings select border: 1px solid #222; display: none; cursor: pointer; - font-size: 12px; + font-size: 13px; -webkit-box-shadow: 2px 2px 8px rgba( 0, 0, 0, 0.5 ); color: #DDD; } @@ -166,7 +166,7 @@ gamesettings select .dropdown .contents div:hover { - background-color: #666; + background-color:#666; } .caret @@ -190,10 +190,20 @@ gamesettings .control gamesettings .control LABEL { - font-size: 12px; + font-size: 11px; color: #888; } +gamesettings .control:not(.control-numeric) LABEL +{ + position: relative; + top: -2px; +} +gamesettings .control-numeric LABEL +{ + line-height: 20px; +} + gamesettings .control input[type=text] { width: 95%; diff --git a/html/css/menu/PageOptions.css b/html/css/menu/PageOptions.css index 115e1ac..a6cd389 100644 --- a/html/css/menu/PageOptions.css +++ b/html/css/menu/PageOptions.css @@ -80,6 +80,17 @@ DIV.page DIV.options .search_bar margin-bottom: 8px; } +div.ugc_content +{ + position: absolute; + left: 320px; + top: 16px; + bottom: 16px; + right: 16px; + padding: 16px; + padding-top: 0; +} + @media screen and (max-height: 768px) { DIV.page DIV.options UL.submenu LI { @@ -87,6 +98,14 @@ DIV.page DIV.options .search_bar } } +@media screen and (max-width: 1024px) +{ + div.ugc_content + { + left: 200px; + } +} + @media screen and (max-width: 1280px) { DIV.page DIV.options @@ -135,7 +154,6 @@ DIV.page DIV.options .search_bar } @media screen and (max-height: 420px) { - DIV.page DIV.options UL { margin: 0px; @@ -147,9 +165,18 @@ DIV.page DIV.options .search_bar } } -/* Pop up confirmation message when uninstalling ALL addons */ +@media screen and (max-width: 640px) { + DIV.page DIV.options + { + padding-top: 0px; + padding-left: 0px; + } +} + -body div.modaldialog { +/* Pop up confirmation message when uninstalling ALL addons, etc */ + +div.modaldialog { background: rgba( 0, 0, 0, 0.5 ); width: 100%; height: 100%; @@ -160,51 +187,149 @@ body div.modaldialog { z-index: 9999; } -body div.centermessage { +div.centermessage { position: fixed; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); - background: #111; + background: white; border-radius: 5px; - border: 2px solid #333; + padding: 20px; max-width: 500px; text-align: center; } +div.centermessage.left { + text-align: left; +} -body div.centermessage label { +div.centermessage span { color: #DDD; display: block; font-size: 20px; margin-bottom: 20px; + cursor: default; +} + +div.centermessage label { + position: relative; + top: -2px; + cursor: default; } -body div.centermessage a { +div.centermessage a +{ display: block; color: #DDD; font-size: 16px; border-radius: 4px; background: #333; padding: 5px 10px; - /*margin: 0px 25px;*/ + text-align: center; + cursor: default; } -body div.centermessage a:hover { +div.centermessage a:hover +{ background: #666; color: #FFF; } -body div.centermessage a.confirm { - background: #633; - color: #DDD; +div.centermessage a.big +{ padding: 10px 20px; font-size: 32px; - /*margin: 0px;*/ - margin-bottom: 10px; +} +div.centermessage a:not(:last-child) +{ + margin-bottom: 5px; } -body div.centermessage a.confirm:hover { - background: #933; - color: #FFF; +div.centermessage a.warning { + background: #ca1e12; + color: white; + font-weight: bold; } +div.centermessage a.warning:hover { + background: #eb2719; +} + +div.centermessage a.create { + background: #4CAF50; + color: white; + font-weight: bold; +} +div.centermessage a.create:hover { + background: #63bb66; +} + +input.preset_name +{ + width: 100%; + padding: 3px 5px; +} + + +div.centermessage .button { + display: block; + color: black; + font-size: 16px; + border-radius: 4px; + background: #ddd; + padding: 5px 10px; +} +div.centermessage .button:hover { + background: #e3e3e3; +} + +div.centermessage div.button { + margin-bottom: 2px; + position: relative; + background: #ddd; +} +div.centermessage .wstitle { + text-align: left; + width: 100%; + display: inline-block; + cursor: default; + overflow: hidden; +} +div.centermessage .wssub { + width: 55px; + height: 28px; + /* background: #4CAF50; */ + display: inline-block; + position: absolute; + right: 0px; + top: 0px; +} +div.centermessage wsbut img { + position: relative; + top: 2px; + right: 2px; +} +div.centermessage wsbut +{ + background: #b1b1b1; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +div.centermessage wsbut:hover +{ + background: #c1c1c1; +} +div.centermessage .subbed wsbut +{ + background: #4CAF50; +} +/*div.centermessage .subbed wsbut:hover +{ + background: #55c55a; +}*/ +div.centermessage .subbed { + background: #b2d6b2 !important; +} +div.centermessage .subbed:hover { + background: #cadeca !important; +} + diff --git a/html/css/menu/Servers.css b/html/css/menu/Servers.css index 1fd530b..ade16d9 100644 --- a/html/css/menu/Servers.css +++ b/html/css/menu/Servers.css @@ -36,7 +36,6 @@ top: 5px; font-size: 20px; white-space: nowrap; - color: #DDD; } .gamemode .stats @@ -551,19 +550,20 @@ SPAN.installgamemode:hover } } -name .unfavbutton { - background: url( '../../img/favourite.png' ); - margin-right: 8px; +name .favbutton { + background: url( '../../img/notfavourite.png' ); + margin-right: 4px; height: 16px; width: 16px; display: inline-block; } -name .unfavbutton:hover { - background: url( '../../img/favourite_remove.png' ); +name .favbutton:hover { + background: url( '../../img/notfavourite_add.png' ); } -name .unfavbutton.removed { - background: url( '../../img/notfavourite.png' ); +name .favbutton.favorited { + background: url( '../../img/favourite.png' ); } -name .unfavbutton.removed:hover { - background: url( '../../img/notfavourite_add.png' ); +name .favbutton.favorited:hover { + background: url( '../../img/favourite_remove.png' ); } + diff --git a/html/dupes.html b/html/dupes.html index 5461e9a..ef1eef2 100644 --- a/html/dupes.html +++ b/html/dupes.html @@ -23,7 +23,7 @@ - +
diff --git a/html/js/creations/dupes.js b/html/js/creations/dupes.js index 6cd78c9..0c52277 100644 --- a/html/js/creations/dupes.js +++ b/html/js/creations/dupes.js @@ -31,6 +31,8 @@ function CDupes( $scope, $timeout, $location ) CreationScope.CategoriesSecondary = [ + "followed", + "favorite", "friends", "mine" ]; @@ -85,3 +87,18 @@ function ShowLocalDupes() CreationScope.$apply(); } + + +function WindowResized() +{ + // dupe is from control.Dupes.js + dupe.RefreshDimensions(); + dupe.UpdatePageNav(); + + // Refresh HTML + dupe.DigestUpdate = setTimeout( function() + { + self.DigestUpdate = 0; + Scope.Go( 0 ); + }, 500 ) +} diff --git a/html/js/creations/saves.js b/html/js/creations/saves.js index be4c8d3..7bb0c23 100644 --- a/html/js/creations/saves.js +++ b/html/js/creations/saves.js @@ -31,6 +31,8 @@ function CSaves( $scope, $timeout, $location ) CreationScope.CategoriesSecondary = [ + "followed", + "favorite", "friends", "mine" ]; @@ -79,3 +81,17 @@ function SetMap( mapname ) CreationScope.MapName = mapname; UpdateDigest( CreationScope, 10 ); } + +function WindowResized() +{ + // save is from control.Saves.js + save.RefreshDimensions(); + save.UpdatePageNav(); + + // Refresh HTML + save.DigestUpdate = setTimeout( function() + { + self.DigestUpdate = 0; + Scope.Go( 0 ); + }, 500 ) +} diff --git a/html/js/menu/Subscriptions.js b/html/js/menu/Subscriptions.js index f429e6d..a853637 100644 --- a/html/js/menu/Subscriptions.js +++ b/html/js/menu/Subscriptions.js @@ -1,12 +1,8 @@ function Subscriptions() { - } -// -// Initialize -// Subscriptions.prototype.Init = function( scope ) { this.Scope = scope; @@ -14,9 +10,6 @@ Subscriptions.prototype.Init = function( scope ) this.FilesUGC = {}; } -// -// Contains -// Subscriptions.prototype.Contains = function( id ) { id = String( id ); @@ -24,24 +17,22 @@ Subscriptions.prototype.Contains = function( id ) return this.Files[ id ] != null; } -// -// IsEnabled -// Subscriptions.prototype.Enabled = function( id ) { return this.Files[ String( id ) ].mounted; } -// -// SetAllEnabled -// -Subscriptions.prototype.SetAllEnabled = function( bBool ) +Subscriptions.prototype.GetInvalidReason = function( id ) { - bBool = bBool ? "true" : "false"; + if ( !this.Files[ String( id ) ] ) return; + return this.Files[ String( id ) ].invalid_reason; +} +Subscriptions.prototype.SetAllEnabled = function( bBool ) +{ for ( k in this.Files ) { - lua.Run( "steamworks.SetShouldMountAddon( %s, " + bBool + " );", String( k ) ); + this.SetShouldMountAddon( k, bBool ); } } @@ -49,26 +40,37 @@ Subscriptions.prototype.Subscribe = function( wsid ) { lua.Run( "steamworks.Subscribe( %s );", String( wsid ) ); } - Subscriptions.prototype.Unsubscribe = function( wsid ) { lua.Run( "steamworks.Unsubscribe( %s );", String( wsid ) ); } -// -// DeleteAll -// +Subscriptions.prototype.ApplyChanges = function() +{ + lua.Run( "steamworks.ApplyAddons();" ) +} + +Subscriptions.prototype.SetShouldMountAddon = function( wsid, bBool ) +{ + bBool = bBool ? "true" : "false"; + lua.Run( "steamworks.SetShouldMountAddon( %s, " + bBool + " );", String( wsid ) ); +} + Subscriptions.prototype.UnsubscribeAll = function() { for ( k in this.Files ) { - lua.Run( "steamworks.Unsubscribe( %s );", String( k ) ); + this.Unsubscribe( k ); } } -// -// Update - called from engine -// +// Ew +Subscriptions.prototype.GetAll = function() +{ + return this.Files; +} + +// Called from engine for Subscriptions Subscriptions.prototype.Update = function( json ) { this.Files = {}; diff --git a/html/js/menu/TestData.js b/html/js/menu/TestData.js index c8f4d7f..dba9f98 100644 --- a/html/js/menu/TestData.js +++ b/html/js/menu/TestData.js @@ -19,7 +19,7 @@ function DoTestData() if ( !IN_ENGINE ) { - setTimeout( function () { DoTestData() }, 10 ); + setTimeout( function () { DoTestData() }, 100 ); } function TestUpdateServers( type, id ) diff --git a/html/js/menu/TestWorkshop.js b/html/js/menu/TestWorkshop.js index 72b6840..689adf7 100644 --- a/html/js/menu/TestWorkshop.js +++ b/html/js/menu/TestWorkshop.js @@ -1,5 +1,5 @@ -function WorkshopTestData( type, namespace ) +function WorkshopTestData( type, namespace, perpage ) { if ( type == 'friends' ) { @@ -7,11 +7,22 @@ function WorkshopTestData( type, namespace ) return; } - namespace.ReceiveIndex( { totalresults: 120, results: [ 1234, 12345, 123456, 1234567, 3, 4, 5, 78, 9, 885, 456, 65, 27, 548, 9, 3455, 345, 677, 876 ] } ); + var items = { totalresults: perpage * 90, results: [ 1234, 12345, 123 ] }; + + for ( var i = items.results.length; i < perpage; i++ ) + { + items.results.push( Math.floor( Math.random() * 100000000 ) ) + } + namespace.ReceiveIndex( items ); + namespace.ReceiveFileInfo( 1234, { "score": 0.95, "total": 22, "down": 1, "up": 21, "created": 1.33679e+009, "ownername": "garry :D", "description": "The name explains what to do.\n\nUse your crossbow to assasinate Breen and his bodyguards!", "tags": "save", "id": "71502490", "owner": "76561197965224200", "previewsize": 16322, "previewid": "540675364321761226", "updated": 1.33679e+009, "title": "Assasinate Breen.", "disabled": false, "installed": false, "banned": false, "size": 21733, "fileid": "540675364321760831" } ) - namespace.ReceiveFileInfo( 12345, { "score": 0, "total": 0, "down": 0, "up": 0, "created": 1.33679e+009, "description": "The name explains what to do.\n\nUse your crossbow to assasinate Breen and his bodyguards!", "tags": "save", "id": "71502490", "owner": "76561197965224200", "previewsize": 16322, "previewid": "540675364321761226", "updated": 1.33679e+009, "title": "Really long title that sucks cocks", "disabled": false, "installed": false, "banned": false, "size": 21733, "fileid": "540675364321760831" } ) + namespace.ReceiveFileInfo( 12345, { "score": 0, "total": 0, "down": 0, "up": 0, "created": 1.33679e+009, "description": "The name explains what to do.\n\nUse your crossbow to assasinate Breen and his bodyguards!", "tags": "save", "id": "71502490", "owner": "76561197965224200", "previewsize": 16322, "previewid": "540675364321761226", "updated": 1.33679e+009, "title": "Really long title that is actually really long ok?", "disabled": false, "installed": false, "banned": false, "size": 21733, "fileid": "540675364321760831" } ) + namespace.ReceiveFileInfo( 123, { "score": 0, "total": 0, "down": 0, "up": 0, "created": 1.33679e+009, "description": "fpei9ufaf9pwiufjawpif", "tags": "save", "id": "71502490", "owner": "76561197965224200", "previewsize": 16322, "previewid": "540675364321761226", "updated": 1.33679e+009, "title": "dfayhfuiofhawofiuawfihawofuawhfoaiuwf", "disabled": false, "installed": true, "banned": false, "size": 21733, "fileid": "540675364321760831" } ) + + namespace.ReceiveImage( 1234, "img/creation-play.png" ); + namespace.ReceiveImage( 12345, "img/localaddon.png" ); - namespace.ReceiveImage( 1234, "img/addonpreview.png" ); - namespace.ReceiveImage( 12345, "../cache/630737834418002174.cache" ); + subscriptions.Files[ "1234" ] = { mounted: false }; + subscriptions.Files[ "123" ] = { mounted: true }; } diff --git a/html/js/menu/WorkshopFiles.js b/html/js/menu/WorkshopFiles.js index c937b03..dfc2fe5 100644 --- a/html/js/menu/WorkshopFiles.js +++ b/html/js/menu/WorkshopFiles.js @@ -55,6 +55,11 @@ WorkshopFiles.prototype.Init = function( namespace, scope, RootScope ) scope.SwitchWithTag( scope.Category, 0, scope.Tagged, scope.MapName ) } + this.Scope.HandleSortChange = function() + { + scope.SwitchWithTag( scope.Category, 0, scope.Tagged, scope.MapName ) + } + var hackyWackyTimer = 0; this.Scope.HandleOnSearch = function() { @@ -94,17 +99,17 @@ WorkshopFiles.prototype.Init = function( namespace, scope, RootScope ) if ( !IN_ENGINE ) { - setTimeout( function() { WorkshopTestData( scope.Category, self ); }, 0 ); + setTimeout( function() { WorkshopTestData( scope.Category, self, scope.PerPage ); }, 0 ); } else { // fumble if ( scope.MapName && scope.Tagged ) { - gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.Tagged + "," + scope.MapName, scope.SubscriptionSearchText, filter ); + gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.Tagged + "," + scope.MapName, scope.SubscriptionSearchText, filter, scope.UGCSortMethod ); } else if ( scope.MapName ) { - gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.MapName, scope.SubscriptionSearchText, filter ); + gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.MapName, scope.SubscriptionSearchText, filter, scope.UGCSortMethod ); } else { - gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.Tagged, scope.SubscriptionSearchText, filter ); + gmod.FetchItems( self.NameSpace, scope.Category, scope.Offset, scope.PerPage, scope.Tagged, scope.SubscriptionSearchText, filter, scope.UGCSortMethod ); } } } @@ -158,8 +163,8 @@ WorkshopFiles.prototype.ReceiveLocal = function( data ) filled : true, info : { - title : data.results[k].name, - file : data.results[k].file, + title : data.results[k].name, + file : data.results[k].file, } }; @@ -168,7 +173,7 @@ WorkshopFiles.prototype.ReceiveLocal = function( data ) this.UpdatePageNav(); this.Changed(); -}; +} // // The index contains the number of saves, @@ -181,7 +186,7 @@ WorkshopFiles.prototype.ReceiveIndex = function( data ) this.Scope.TotalResults = data.totalresults; this.Scope.NumResults = data.numresults; - this.Scope.Files = [] + this.Scope.Files = []; for ( k in data.results ) { @@ -190,6 +195,7 @@ WorkshopFiles.prototype.ReceiveIndex = function( data ) order : k, id : data.results[k], filled : false, + extra : data.extraresults ? data.extraresults[ k ] : {}, }; this.Scope.Files.push( entry ); @@ -197,7 +203,7 @@ WorkshopFiles.prototype.ReceiveIndex = function( data ) this.UpdatePageNav(); this.Changed(); -}; +} // // ReceiveFileInfo @@ -213,7 +219,7 @@ WorkshopFiles.prototype.ReceiveFileInfo = function( id, data ) this.Changed(); } -}, +} // // ReceiveUserName @@ -229,7 +235,7 @@ WorkshopFiles.prototype.ReceiveUserName = function( id, data ) this.Changed(); } -}, +} // // ReceiveImage @@ -243,7 +249,7 @@ WorkshopFiles.prototype.ReceiveImage = function( id, url ) this.Scope.Files[k].background = url; this.Changed(); } -}, +} WorkshopFiles.prototype.Changed = function() { @@ -260,13 +266,12 @@ WorkshopFiles.prototype.Changed = function() self.DigestUpdate = 0; self.Scope.$digest(); }, 10 ) - } WorkshopFiles.prototype.RefreshDimensions = function() { - var w = Math.max( 480, $( "workshopcontainer" ).width() ); - var h = Math.max( 320, $( "workshopcontainer" ).height() - 48 ); + var w = Math.max( 180, $( "workshopcontainer" ).width() ); + var h = Math.max( 180, $( "workshopcontainer" ).height() - 48 ); var iconswide = Math.floor( w / 180 ); var iconstall = Math.floor( h / 180 ); @@ -283,15 +288,18 @@ WorkshopFiles.prototype.RefreshDimensions = function() WorkshopFiles.prototype.UpdatePageNav = function() { - self.Scope.Page = Math.floor(self.Scope.Offset / self.Scope.PerPage) + 1; - self.Scope.NumPages = Math.ceil(self.Scope.TotalResults / self.Scope.PerPage); + self.Scope.Page = Math.floor( self.Scope.Offset / self.Scope.PerPage ) + 1; - if ( self.Scope.NumPages > 32 ) self.Scope.NumPages = 32; + var maxPages = 32; + var realMaxPages = Math.ceil( self.Scope.TotalResults / self.Scope.PerPage ) + self.Scope.NumPages = Math.min( realMaxPages, maxPages ); - self.Scope.Pages = []; + var pageOfPages = Math.floor( ( self.Scope.Page - 1 ) / ( maxPages ) ); + var pageOffset = pageOfPages * maxPages; - for ( var i=1; i 0 ) + { + var needsWarning = false; + for ( var i = 0; i < file.info.children.length; i++ ) + { + var wsid = file.info.children[ i ]; + if ( !$scope.IsSubscribedID( wsid ) ) + { + needsWarning = true; + break; + } + } + + if ( needsWarning ) + { + for ( var i = 0; i < file.info.children.length; i++ ) + { + var wsid = file.info.children[ i ]; + lua.Run( "MenuGetAddonData( %i );", wsid ); + } - // Update files if viewing subscribed list? - }; + $scope.PopupMessageFiles = file.info.children; + $scope.DisplayPopupMessage( "addons.addon_depends", function() + { + subscriptions.Subscribe( file.id ); + } ); + return; + } + } + subscriptions.Subscribe( file.id ); + } $scope.Unsubscribe = function( file ) { subscriptions.Unsubscribe( file.id ); - - // Update files if viewing subscribed list? - }; - + } $scope.UninstallAllSubscribed = function() { subscriptions.UnsubscribeAll(); - lua.Run( "steamworks.ApplyAddons();" ); + subscriptions.ApplyChanges(); } - $scope.IsSubscribed = function( file ) { return subscriptions.Contains( file.id ); - }; + } + $scope.IsSubscribedID = function( fileID ) + { + return subscriptions.Contains( fileID ); + } $scope.DisableAllSubscribed = function() { subscriptions.SetAllEnabled( false ); - lua.Run( "steamworks.ApplyAddons();" ); + subscriptions.ApplyChanges(); } - $scope.EnableAllSubscribed = function() { subscriptions.SetAllEnabled( true ); - lua.Run( "steamworks.ApplyAddons();" ); + subscriptions.ApplyChanges(); } - $scope.IsEnabled = function( file ) { return subscriptions.Enabled( file.id ); - }; - + } $scope.Disable = function( file ) { - lua.Run( "steamworks.SetShouldMountAddon( %s, false );", String( file.id ) ) - lua.Run( "steamworks.ApplyAddons();" ) - }; - + subscriptions.SetShouldMountAddon( String( file.id ), false ); + subscriptions.ApplyChanges(); + } $scope.Enable = function( file ) { - lua.Run( "steamworks.SetShouldMountAddon( %s, true );", String( file.id ) ) - lua.Run( "steamworks.ApplyAddons();" ) - }; + subscriptions.SetShouldMountAddon( String( file.id ), true ); + subscriptions.ApplyChanges(); + } $scope.DisplayPopupMessage = function( txt, func ) { @@ -106,11 +155,17 @@ function ControllerAddons( $scope, $element, $rootScope, $location ) $scope.ClosePopupMessage = function( txt, func ) { $scope.PopupMessageDisplayed = false; + $scope.PopupMessageFiles = []; + + $scope.CreatePresetOpen = false; + $scope.LoadPresetMenuOpen = false; + $scope.SelectedPreset = undefined; } $scope.ExecutePopupFunction = function() { - $scope.PopupMessageDisplayed = false; - if ( $scope.PopupMessageDisplayedFunc ) { + $scope.ClosePopupMessage(); + if ( $scope.PopupMessageDisplayedFunc ) + { $scope.PopupMessageDisplayedFunc() $scope.PopupMessageDisplayedFunc = null; } @@ -120,45 +175,211 @@ function ControllerAddons( $scope, $element, $rootScope, $location ) { for ( var k in $scope.SelectedItems ) $scope.SelectedItems[ k ] = false; } + $scope.SelectAllPage = function() + { + for ( var k in $scope.Files ) $scope.SelectedItems[ $scope.Files[ k ].id ] = true; + } + $scope.SelectAll = function() + { + for ( var k in subscriptions.GetAll() ) $scope.SelectedItems[ k ] = true; + } $scope.EnableAllSelected = function() { - for ( var k in $scope.SelectedItems ) { + for ( var k in $scope.SelectedItems ) + { if ( !$scope.SelectedItems[ k ] ) continue; - lua.Run( "steamworks.SetShouldMountAddon( %s, true );", String( k ) ); + + subscriptions.SetShouldMountAddon( k, true ); $scope.SelectedItems[ k ] = false; } - lua.Run( "steamworks.ApplyAddons();" ) + subscriptions.ApplyChanges(); } $scope.DisableAllSelected = function() { - for ( var k in $scope.SelectedItems ) { + for ( var k in $scope.SelectedItems ) + { if ( !$scope.SelectedItems[ k ] ) continue; - lua.Run( "steamworks.SetShouldMountAddon( %s, false );", String( k ) ); + + subscriptions.SetShouldMountAddon( k, false ); $scope.SelectedItems[ k ] = false; } - lua.Run( "steamworks.ApplyAddons();" ) + subscriptions.ApplyChanges(); } $scope.UninstallAllSelected = function() { - for ( var k in $scope.SelectedItems ) { + for ( var k in $scope.SelectedItems ) + { if ( !$scope.SelectedItems[ k ] ) continue; - lua.Run( "steamworks.Unsubscribe( %s );", String( k ) ); + + subscriptions.Unsubscribe( k ); $scope.SelectedItems[ k ] = false; } - lua.Run( "steamworks.ApplyAddons();" ) + subscriptions.ApplyChanges(); } $scope.IsAnySelected = function() { - var count = 0; - for ( var k in $scope.SelectedItems ) if ( $scope.SelectedItems[ k ] ) count++; - return count > 0; + for ( var k in $scope.SelectedItems ) + { + if ( $scope.SelectedItems[ k ] ) return true; + } + return false; + } + + $scope.ToggleSettings = function() + { + $scope.UGCSettingsOpen = !$scope.UGCSettingsOpen; + } + + $scope.OpenCreatePresetMenu = function() + { + // Reset to defaults.. + $scope.CreatePresetSaveEnabled = true; + $scope.CreatePresetSaveDisabled = true; + $scope.CreatePresetNew = "disable"; + $scope.CreatePresetName = ""; + + $scope.CreatePresetOpen = true; + } + $scope.CreateNewPreset = function() + { + var newPreset = { + enabled: [], disabled: [], + name: $scope.CreatePresetName, + newAction: $scope.CreatePresetNew + } + + var files = subscriptions.GetAll(); + for ( var id in files ) + { + var enabled = files[ id ].mounted; + + if ( enabled && $scope.CreatePresetSaveEnabled ) newPreset.enabled.push( id ); + if ( !enabled && $scope.CreatePresetSaveDisabled ) newPreset.disabled.push( id ); + } + + lua.Run( "CreateNewAddonPreset( %s )", JSON.stringify( newPreset ) ); + + $scope.CreatePresetOpen = false; + } + + $scope.OpenLoadPresetMenu = function() + { + lua.Run( "ListAddonPresets()" ); + $scope.LoadPresetMenuOpen = true; + $scope.LoadPresetResub = false; + } + $scope.SelectPreset = function( preset, newAction ) + { + $scope.SelectedPreset = preset; + $scope.CreatePresetNew = newAction; + } + $scope.DeletePreset = function( preset ) + { + lua.Run( "DeleteAddonPreset( %s )", preset ); + $scope.SelectedPreset = undefined; + } + $scope.LoadSelectedPreset = function() + { + var preset = $scope.PresetList[ $scope.SelectedPreset ]; + var newAct = $scope.CreatePresetNew; + + // Resub to missing stuff + if ( $scope.LoadPresetResub ) + { + for ( var k in preset.disabled ) + { + var id = preset.disabled[ k ]; + if ( !subscriptions.Contains( id ) ) subscriptions.Subscribe( id ); + } + for ( var k in preset.enabled ) + { + var id = preset.enabled[ k ]; + if ( !subscriptions.Contains( id ) ) subscriptions.Subscribe( id ); + } + subscriptions.ApplyChanges(); + } + + var IDsDone = {}; + for ( var k in preset.disabled ) + { + var id = preset.disabled[ k ]; + subscriptions.SetShouldMountAddon( id, false ); + IDsDone[ id ] = true; + } + for ( var k in preset.enabled ) + { + var id = preset.enabled[ k ]; + subscriptions.SetShouldMountAddon( id, true ); + IDsDone[ id ] = true; + } + + if ( newAct != "" ) + { + var files = subscriptions.GetAll(); + for ( var id in files ) + { + if ( !IDsDone[ id ] ) + { + subscriptions.SetShouldMountAddon( id, newAct == "enable" ); + } + } + } + + subscriptions.ApplyChanges(); + $scope.LoadPresetMenuOpen = false; + $scope.SelectedPreset = undefined; } + + $scope.GetAddonClasses = function( file ) + { + var classes = []; + if ( $scope.IsSubscribed( file ) ) + { + classes.push( $scope.IsEnabled( file ) ? "installed" : "disabled" ); + if ( subscriptions.GetInvalidReason( file.id ) ) classes.push( "invalid" ); + } + return classes.join( " " ); + } + + $scope.GetAddonDescription = function( file ) + { + var invalid = subscriptions.GetInvalidReason( file.id ) + if ( invalid ) return invalid; + + if ( !file.info ) return "ERROR?"; + + return file.info.description + } + + $scope.GetNiceSize = function( size ) + { + if ( !size || size <= 0 ) return "0 Bytes" + if ( size < 1000 ) return size + " Bytes" + if ( size < 1000 * 1000 ) return Math.round( size / 1000, 2 ) + " KB" + if ( size < 1000 * 1000 * 1000 ) return Math.round( size / ( 1000 * 1000 ), 2 ) + " MB" + + return Math.round( size / ( 1000 * 1000 * 1000 ), 2 ) + " GB" + } +} + +function ReceivedChildAddonInfo( info ) +{ + var elem = document.getElementById( "wsid" + info.id ) + elem.innerText = info.title +} + +function OnReceivePresetList( list ) +{ + if ( !Scope ) return; + + Scope.PresetList = list; + UpdateDigest( Scope, 50 ); } function UpdateAddonDisabledState( noaddons, noworkshop ) { - if ( Scope ) { - Scope.Disabled = noworkshop; - UpdateDigest( Scope, 50 ); - } + if ( !Scope ) return; + + Scope.Disabled = noworkshop; + UpdateDigest( Scope, 50 ); } diff --git a/html/js/menu/control.Demos.js b/html/js/menu/control.Demos.js index 8f456dc..f00f9c6 100644 --- a/html/js/menu/control.Demos.js +++ b/html/js/menu/control.Demos.js @@ -24,6 +24,8 @@ function ControllerDemos( $scope, $element, $rootScope, $location ) $scope.CategoriesSecondary = [ + "followed", + "favorite", "friends", "mine", ]; diff --git a/html/js/menu/control.Dupes.js b/html/js/menu/control.Dupes.js index 493387d..d71c905 100644 --- a/html/js/menu/control.Dupes.js +++ b/html/js/menu/control.Dupes.js @@ -24,6 +24,8 @@ function ControllerDupes($scope, $rootScope, $location, $timeout, $routeParams) $scope.CategoriesSecondary = [ + "followed", + "favorite", "friends", "mine" ]; diff --git a/html/js/menu/control.Main.js b/html/js/menu/control.Main.js index a4245ee..c9b9920 100644 --- a/html/js/menu/control.Main.js +++ b/html/js/menu/control.Main.js @@ -1,3 +1,4 @@ + var scope = null var rootScope = null; @@ -10,25 +11,31 @@ function ControllerMain( $scope, $element, $rootScope ) $scope.NewsList = []; $scope.CurrentNewsItem = null; + $scope.HideNews = false; + $scope.AnyNewNewsItems = false; if ( !IN_ENGINE ) { $rootScope.NewsList = [ - { HeaderImage: 'example.jpg', Title: 'December 2018 Hotfix', SummaryHtml: 'A security hotfix', Url: 'https://google.com/?q=1' }, - { Title: 'Post without an image', SummaryHtml: 'They are very hard to make', Url: 'https://google.com/?q=2' }, - { HeaderImage: 'example.jpg', Title: 'December 2018 is a very long Security Hotfix that means we need to handle this', SummaryHtml: 'A security hotfix', Url: 'https://google.com/?q=3' }, - { HeaderImage: 'example.jpg', Title: 'December 2018 Hotfix', SummaryHtml: 'A very long security hotfix example indeed like it is so long that i dont know how I will fit this stuff in the box', Url: 'https://google.com/?q=4' }, + { HeaderImage: 'img/whatsnew.png', Title: 'December 2018 Hotfix', SummaryHtml: 'A security hotfix', Url: 'https://google.com/?q=1', Date: Date.now() }, + { HeaderImage: 'img/whatsnew.png', Title: 'December 2018 Coldfix', SummaryHtml: 'A very long security hotfix example indeed like it is so long that i dont know how I will fit this stuff in the box', Url: 'https://google.com/?q=4' , Date: 0 }, + { Title: 'Post without an image', SummaryHtml: 'They are very hard to make', Url: 'https://google.com/?q=2', Date: Date.now() - 604800000 - 10000 }, + { HeaderImage: 'img/whatsnew.png', Title: 'December 2018 is a very long Security Hotfix that means we need to handle this', SummaryHtml: 'A security hotfix', Url: 'https://google.com/?q=3', Date: Date.now() - 604800000 + 10000 }, ] } - if ( $rootScope.NewsList ) + $scope.NewsItemClass = function( NewsItem ) { - $scope.NewsList = $rootScope.NewsList; - $scope.CurrentNewsItem = $scope.NewsList[ 0 ]; + // If newer than a 3.5 days, force show news + if ( Date.parse( NewsItem.Date ) > Date.now() - 302400000 ) + { + $scope.AnyNewNewsItems = true; // Kind of a hack to do this here + $scope.SetHideNewsList( false ); + return "new"; + } + return ""; } - lua.Run( "LoadNewsList()" ); - $scope.NewsItemBackground = function( url ) { return "background-image: url( " + url + " )"; @@ -36,6 +43,8 @@ function ControllerMain( $scope, $element, $rootScope ) $scope.SelectItem = function( item ) { + $scope.SetHideNewsList( false, true ); + $scope.CurrentNewsItem = item; } @@ -43,16 +52,44 @@ function ControllerMain( $scope, $element, $rootScope ) { lua.Run( "gui.OpenURL( '" + url + "' )" ); } + + $scope.SetHideNewsList = function( bHide, bSave ) + { + $scope.HideNews = bHide; + $rootScope.HideNews = $scope.HideNews; + + if ( bSave ) lua.Run( "SaveHideNews( '" + $scope.HideNews + "' )" ); + } + $scope.ToggleNewsList = function() + { + $scope.SetHideNewsList( !$scope.HideNews, true ); + + //$scope.CurrentNewsItem = undefined; + } + + // Load it all up + if ( $rootScope.NewsList ) + { + $scope.NewsList = $rootScope.NewsList; + $scope.SetHideNewsList( $rootScope.HideNews ); + $scope.CurrentNewsItem = $scope.NewsList[ 0 ]; + } + else + { + lua.Run( "LoadNewsList()" ); + } } -function UpdateNewsList( newslist ) +function UpdateNewsList( newslist, hide ) { + scope.SetHideNewsList( hide ); scope.NewsList = newslist; - scope.CurrentNewsItem = newslist[ 0 ]; + scope.CurrentNewsItem = /*scope.HideNews ? undefined :*/ newslist[ 0 ]; if ( rootScope ) { + rootScope.HideNews = hide rootScope.NewsList = newslist; UpdateDigest( rootScope, 50 ); } -} \ No newline at end of file +} diff --git a/html/js/menu/control.Menu.js b/html/js/menu/control.Menu.js index 95dd2cf..5a71953 100644 --- a/html/js/menu/control.Menu.js +++ b/html/js/menu/control.Menu.js @@ -29,19 +29,19 @@ function MenuController( $scope, $rootScope ) $( '.gamemode_list' ).toggle(); } - $scope.ToggleLanguage = function () + $scope.ToggleLanguage = function() { $( '.popup:not(.language_list)' ).hide(); $( '.language_list' ).toggle(); } - $scope.ToggleGames = function () + $scope.ToggleGames = function() { $( '.popup:not(.games_list)' ).hide(); $( '.games_list' ).toggle(); } - $scope.TogglePopup = function ( name ) + $scope.TogglePopup = function( name ) { $( '.popup:not('+name+')' ).hide(); $( name ).toggle(); @@ -56,7 +56,7 @@ function MenuController( $scope, $rootScope ) $( '.gamemode_list' ).hide(); } - $scope.SelectLanguage = function ( lang ) + $scope.SelectLanguage = function( lang ) { $rootScope.Language = lang; lua.Run( "RunConsoleCommand( \"gmod_language\", \"" + lang + "\" )" ); @@ -64,7 +64,7 @@ function MenuController( $scope, $rootScope ) $( '.language_list' ).hide(); } - $scope.MenuOption = function ( btn, v ) + $scope.MenuOption = function( btn, v ) { lua.Run( "RunGameUICommand( '" + v + "' )" ) } @@ -104,47 +104,44 @@ function MenuController( $scope, $rootScope ) lua.Run( "gui.HideGameUI()" ); } - $scope.AddServerToFavorites = function() + $scope.ToggleServerFavorites = function( bAdd ) { - lua.Run( "serverlist.AddCurrentServerToFavorites()" ); + lua.Run( "serverlist.AddCurrentServerToFavorites( " + bAdd + " )" ); } - $scope.Disconnect = function () + $scope.Disconnect = function() { lua.Run( "RunConsoleCommand( 'disconnect' )" ); } - $scope.OpenWorkshopFile = function ( id ) + $scope.OpenWorkshopFile = function( id ) { if ( !id ) return; lua.Run( "steamworks.ViewFile( %s )", String( id ) ); } - $scope.OpenFolder = function ( foldername ) + $scope.OpenFolder = function( foldername ) { lua.Run( "OpenFolder( %s )", String( foldername ) ); } - $scope.OpenWorkshop = function () + $scope.OpenWorkshop = function() { lua.Run( "steamworks.OpenWorkshop()" ); } $scope.ShowNews = function() { - if ( gScope.Branch == "dev" ) return lua.Run( "gui.OpenURL( 'http://wiki.garrysmod.com/changelist/' )" ); - if ( gScope.Branch == "prerelease" ) return lua.Run( "gui.OpenURL( 'http://wiki.garrysmod.com/changelist/prerelease/' )" ); + if ( gScope.Branch != "unknown" ) return lua.Run( "gui.OpenURL( 'https://commits.facepunch.com/r/garrysmod' )" ); lua.Run( "gui.OpenURL( 'http://gmod.facepunch.com/changes/' )" ); } - // Background - ChangeBackground(); - // InGame $scope.InGame = false; $scope.ShowFavButton = false; + $scope.IsCurrentServerFav = false; // Kinect options $scope.kinect = @@ -182,23 +179,19 @@ function MenuController( $scope, $rootScope ) } ); } -function SetInGame( bool ) +function SetInGame( bInGame ) { - gScope.InGame = bool; + gScope.InGame = bInGame; UpdateDigest( gScope, 50 ); } -function SetShowFavButton( bool ) +function SetShowFavButton( bShow, bFav ) { - gScope.ShowFavButton = bool; + gScope.ShowFavButton = bShow; + gScope.IsCurrentServerFav = bFav; UpdateDigest( gScope, 50 ); } -function ChangeBackground() -{ - setTimeout( function(){ ChangeBackground() }, 12000 ) -} - function UpdateGamemodes( gm ) { gScope.Gamemodes = []; @@ -315,9 +308,9 @@ function UpdateVersion( version, branch ) // // Setup sounds.. // -$(document).on( "mouseenter", ".options a", function () { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); -$(document).on( "click", ".options a", function () { lua.PlaySound( "garrysmod/ui_click.wav" ); } ); -$(document).on( "mouseenter", ".noisy", function () { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); -$(document).on( "click", ".noisy", function () { lua.PlaySound( "garrysmod/ui_click.wav" ); } ); -$(document).on( "mouseenter", ".ui_sound_return", function () { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); -$(document).on( "click", ".ui_sound_return", function () { lua.PlaySound( "garrysmod/ui_return.wav" ); } ); \ No newline at end of file +$(document).on( "mouseenter", ".options a", function() { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); +$(document).on( "click", ".options a", function() { lua.PlaySound( "garrysmod/ui_click.wav" ); } ); +$(document).on( "mouseenter", ".noisy", function() { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); +$(document).on( "click", ".noisy", function() { lua.PlaySound( "garrysmod/ui_click.wav" ); } ); +$(document).on( "mouseenter", ".ui_sound_return", function() { lua.PlaySound( "garrysmod/ui_hover.wav" ); } ); +$(document).on( "click", ".ui_sound_return", function() { lua.PlaySound( "garrysmod/ui_return.wav" ); } ); diff --git a/html/js/menu/control.Saves.js b/html/js/menu/control.Saves.js index 2fe385a..67f03a3 100644 --- a/html/js/menu/control.Saves.js +++ b/html/js/menu/control.Saves.js @@ -24,6 +24,8 @@ function ControllerSaves($scope, $rootScope, $location, $timeout, $routeParams) $scope.CategoriesSecondary = [ + "followed", + "favorite", "friends", "mine" ]; diff --git a/html/js/menu/control.Servers.js b/html/js/menu/control.Servers.js index 7a2cd8a..782902c 100644 --- a/html/js/menu/control.Servers.js +++ b/html/js/menu/control.Servers.js @@ -13,15 +13,13 @@ function ControllerServers( $scope, $element, $rootScope, $location ) if ( !Scope.CurrentGamemode ) Scope.CurrentGamemode = null; - if ( !Scope.Refreshing ) - Scope.Refreshing = {} - + if ( !Scope.Refreshing ) Scope.Refreshing = {} $scope.DoStopRefresh = function() { lua.Run( "DoStopServers( '" + Scope.ServerType + "' )" ); } - $scope.$on( "$destroy", function() + $scope.$on( "$destroy", function() { $scope.DoStopRefresh(); } ); @@ -35,8 +33,8 @@ function ControllerServers( $scope, $element, $rootScope, $location ) // // Clear out all of the servers // - ServerTypes[Scope.ServerType].gamemodes = {}; - ServerTypes[Scope.ServerType].list.length = 0; + ServerTypes[ Scope.ServerType ].gamemodes = {}; + ServerTypes[ Scope.ServerType ].list.length = 0; if ( !IN_ENGINE ) TestUpdateServers( Scope.ServerType, RequestNum[ Scope.ServerType ] ); @@ -46,7 +44,7 @@ function ControllerServers( $scope, $element, $rootScope, $location ) // lua.Run( "GetServers( '" + Scope.ServerType + "', '" + RequestNum[ Scope.ServerType ] + "' )" ); - Scope.Refreshing[ Scope.ServerType] = "true"; + Scope.Refreshing[ Scope.ServerType ] = "true"; UpdateDigest( Scope, 50 ); } @@ -132,6 +130,9 @@ function ControllerServers( $scope, $element, $rootScope, $location ) $scope.JoinServer = function ( srv ) { + // It's full, why even bother... + // if ( srv.players >= srv.maxplayers ) return; + if ( srv.password ) lua.Run( "RunConsoleCommand( \"password\", \"" + srv.password + "\" )" ) @@ -234,7 +235,7 @@ function GetGamemode( name, type ) return ServerTypes[type].gamemodes[name]; } -function AddServer( type, id, ping, name, desc, map, players, maxplayers, botplayers, pass, lastplayed, address, gamemode, workshopid, isAnon, steamID ) +function AddServer( type, id, ping, name, desc, map, players, maxplayers, botplayers, pass, lastplayed, address, gamemode, workshopid, isAnon, steamID, isFav ) { if ( id != RequestNum[ type ] ) return; @@ -258,17 +259,14 @@ function AddServer( type, id, ping, name, desc, map, players, maxplayers, botpla workshopid: workshopid, isAnon: isAnon, steamID: steamID, - favorite: false // This needs to be set properly + favorite: isFav == "true" }; - if ( type == "favorite" ) { - data.favorite = true; // This needs to be set properly - } - data.hasmap = DoWeHaveMap( data.map ); data.recommended = 40; - if(data.ping >= 60) data.recommended = data.ping; + if ( data.ping >= 60 ) data.recommended = data.ping; + if ( data.players == 0 ) data.recommended += 75; // Server is empty if ( data.players >= data.maxplayers ) data.recommended += 100; // Server is full, can't join it if ( data.pass ) data.recommended += 300; // Password protected, can't join it @@ -371,10 +369,11 @@ function UpdateGamemodeInfo( server ) // // Use the most common workshop id // - //if ( server.workshopid != "" ) + if ( server.workshopid != "" ) { if ( !gi.wsid ) gi.wsid = {} if ( !gi.wsid[ server.workshopid ] ) { gi.wsid[ server.workshopid ] = 1; } else { gi.wsid[ server.workshopid ]++; } gi.workshopid = GetHighestKey( gi.wsid ); } } + diff --git a/html/js/menu/menuApp.js b/html/js/menu/menuApp.js index dc935d1..c64362f 100644 --- a/html/js/menu/menuApp.js +++ b/html/js/menu/menuApp.js @@ -56,4 +56,4 @@ App.filter( 'startFrom', function () start = +start; //parse to int return input.slice( start ); } -} ); \ No newline at end of file +} ); diff --git a/html/js/svc.Tranny.js b/html/js/svc.Tranny.js index f7eb872..7906429 100644 --- a/html/js/svc.Tranny.js +++ b/html/js/svc.Tranny.js @@ -11,15 +11,11 @@ angular.module( 'tranny', [] ) { if ( IN_ENGINE ) { - var outStr_old = language.Update( strName, function( outStr ) + language.Update( strName, function( outStr ) { $(element).html( outStr ); $(element).attr( "placeholder", outStr ); } ); - - // Compatibility with Awesomium - $(element).html( outStr_old ); - $(element).attr( "placeholder", outStr_old ); } else { diff --git a/html/loading.css b/html/loading.css index 189e3e6..255f330 100644 --- a/html/loading.css +++ b/html/loading.css @@ -1,8 +1,13 @@ + BODY { background: #fff url( 'img/bg.jpg' ); -webkit-background-size: 100% 100%; overflow: hidden; + margin: 0px; + + background-position: center; + background-size: cover; } #container @@ -23,7 +28,7 @@ BODY border-radius: 3px; text-align: left; padding: 1px; - background-color: rgba( 0, 0, 0, 0.6); + background-color: rgba( 0, 0, 0, 0.6 ); float: right; } @@ -32,7 +37,7 @@ BODY -webkit-box-reflect: below -1px -webkit-gradient(linear, left top, left bottom, from(transparent), from(rgba(0, 0, 0, 0.0)), to(rgba(255, 255, 255, 0.5))); } -.progressbar .inner +.progressbar .inner { border-radius: 2px; background-color: rgba( 88, 0, 0, 1.0); @@ -57,44 +62,103 @@ BODY white-space: nowrap; } - -@-webkit-keyframes walk +@-webkit-keyframes walk { - 0% - { - -webkit-transform: rotateZ(0deg); - } + 0% + { + -webkit-transform: rotateZ(0deg); + } 25% { -webkit-transform: rotateZ(30deg); } - 50% - { - -webkit-transform: rotateZ(0deg); - } + 50% + { + -webkit-transform: rotateZ(180deg); + } - 75% + 75% { -webkit-transform: rotateZ(-30deg); } - 100% - { - -webkit-transform: rotateZ(0deg); - } + 100% + { + -webkit-transform: rotateZ(360deg); + } } .walk { -webkit-animation-name: walk; - -webkit-animation-duration: 2.0s; + -webkit-animation-duration: 10.0s; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: linear; -webkit-perspective: 6000px; - width: 48px; - height: 48px; + text-align: center; + background-color: #fe7; + width: 24px; + height: 24px; + color: #999; + font-size: 16px; + font-family: arial; + font-weight: bold; + border-radius: 3px; display: inline-block; + border: 2px solid #999; } +#spambox +{ + float: right; + overflow: hidden; + max-height: 100%; +} + +#background +{ + background-image: url( 'img/bg.png' ); + background-size: 100% 100%; + height: 100%; +} +body.dark #background +{ + background-image: url( 'img/bg_dark.png' ); +} +body.dark +{ + color: #fff; +} + +.server_info +{ + display: inline-block; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + background-image: -webkit-gradient( linear, 0 0, 90% 0, 100% 0, from( ), to( rgba( 0, 0, 0, 0 ) ), to( rgba( 0, 0, 0, 0 ) ) ); + background-image: -webkit-linear-gradient( left, rgba( 0, 0, 0, 0.4 ) 0%, rgba( 0, 0, 0, 0.03 ) 75%, rgba( 0, 0, 0, 0 ) 100% ); + padding: 20px; + padding-right: 180px; + visibility: hidden; + white-space: nowrap; +} +.server_info.visible +{ + visibility: visible; +} +.server_info .text +{ + display: inline-block; + vertical-align: top; + + line-height: 42px; + font-size: xx-large; +} +.server_info img +{ + width: 128px; + height: 128px; + background: #666; + margin-right: 16px; +} diff --git a/html/loading.html b/html/loading.html index 6502e5f..609af63 100644 --- a/html/loading.html +++ b/html/loading.html @@ -5,27 +5,58 @@ - -
+
+
-
-
- -
+ -
- +
+
+ +
+ +
+ +
+
+ A really long server name will be here that will be too long to fit on the loading screen
+ gm_hilldirt
+ Snadbox +
+
- +
+
+