diff --git a/.env.example b/.env.example index 3bd69ab..bce8e6a 100644 --- a/.env.example +++ b/.env.example @@ -29,6 +29,7 @@ APP_EXAMPLE_APP="" APP_EXAMPLE_SERVER="" APP_EXAMPLE_USER="" APP_EXAMPLE_WIDGET="" +APP_EXAMPLE_GROUP="" STEAM_API_KEY="" diff --git a/app/resources/js/steam_group.dev.js b/app/resources/js/steam_group.dev.js index 81b12d4..8772ffc 100644 --- a/app/resources/js/steam_group.dev.js +++ b/app/resources/js/steam_group.dev.js @@ -16,6 +16,7 @@ const STEAMWIDGETS_GROUP_VERSION = 'v1'; */ class SteamGroupElem extends HTMLElement { + HEADLINE_MAX_LEN = 30; DESCRIPTION_MAX_LEN = 40; storedData = {}; @@ -116,6 +117,11 @@ class SteamGroupElem extends HTMLElement groupBaseStyle += 'background-color: ' + styleColorBackground + ';'; } + let headline = json.data.groupHeadline; + if (headline.length >= self.HEADLINE_MAX_LEN) { + headline = headline.substr(0, self.HEADLINE_MAX_LEN - 3) + '...'; + } + let description = json.data.groupSummary; if (description.length >= self.DESCRIPTION_MAX_LEN) { description = description.substr(0, self.DESCRIPTION_MAX_LEN - 3) + '...'; @@ -126,7 +132,7 @@ class SteamGroupElem extends HTMLElement
+ When referenced the required Steam Group module, the minimum code to render a widget is as follows:
+
+
+<steam-group group="{{ env('APP_EXAMPLE_GROUP') }}"></steam-group>
+
+
+
+
+
You can define these options:
+
+
Attribute | +Value | +
group | +Specifies the group either by numeric ID or URL identifier token | +
members | +Specifies the text of the members stats label | +
online | +Specifies the text of the online stats label | +
ingame | +Specifies the text of the in-game stats label | +
viewtext | +Specifies the text of the button which can be used to go to the group page | +
show-image / showImage | +Specifies if the group avatar image shall be displayed. Defaults to true/1 | +
style-border / style.border | +Specify border rounding: Either none, small or max | +
style-shadow / style.shadow | +You can specify false to prevent displaying box shadow or true to enable (default) | +
style-color-background / style.colorBackground | +Specify a CSS value for the background color | +
style-color-title / style.colorTitle | +Specify a CSS value for the title color | +
style-color-description / style.colorDescription | +Specify a CSS value for the description color | +
style-color-stats-count / style.colorStatsCount | +Specify a CSS value for the stats count color | +
style-color-stats-label / style.colorStatsLabel | +Specify a CSS value for the stats label color | +
+ You can also dynamically create Steam Group widgets via JavaScript:
+
+
+
+<div id="group-widget"></div>
+
+<script>
+document.addEventListener('DOMContentLoaded', function() {
+ let widget = new SteamGroup('#group-widget', {
+ group: '{{ env('APP_EXAMPLE_GROUP') }}',
+ //You can specify the same attributes as shown in the table above
+ });
+});
+</script>
+
+
+
+
+
+
The following methods are available for a Steam Group element / object:
+
+
Method | +Description | +
updateWidget() | +Updates the widget data and displays them | +
changeLang(online, ingame, members, viewtext) | +Changes the language of the widget using the given information | +
setImageVisibility(visibility) | +Sets the widget image visibility | +
remove() | Removes the widget from the document | diff --git a/app/views/navbar.php b/app/views/navbar.php index ea95625..f8f3d49 100644 --- a/app/views/navbar.php +++ b/app/views/navbar.php @@ -13,10 +13,6 @@