New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

steamwidgets

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steamwidgets

Render Steam Widgets into your document

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

SteamWidgets NPM package

(C) 2022 - 2023 by Daniel Brendel

Released under the MIT license

https://www.steamwidgets.com

About

SteamWidgets is a clientside web component that offers an easy way to integrate Steam Widgets of various Steam entities into your website. Therefore you only need very few code in order to render Steam Widgets into your document.

SteamWidgets is used via JavaScript. Since JavaScript is supported by all major browser per default it is platform independent and compatible.

The following Widgets are currently available:

  • Steam App Widget
  • Steam Server Widget
  • Steam User Widget
  • Steam Workshop Widget
  • Steam Group Widget

Installation

npm i steamwidgets
import 'steamwidgets'; //Import all available widgets

import 'steamwidgets/steam_app'; //Import Steam App Widget
import 'steamwidgets/steam_server'; //Import Steam Server Widget
import 'steamwidgets/steam_user'; //Import Steam User Widget
import 'steamwidgets/steam_workshop'; //Import Steam Workshop Widget
import 'steamwidgets/steam_group'; //Import Steam Group Widget

Steam App

When referenced the required Steam App module, the minimum code to render a widget is as follows:

<steam-app appid="620"></steam-app>

This renders the following widget:
Steam App Widget

You can define these options:

AttributeValue
appidSpecifies the ID of a Steam game/app
langSpecifies the language of the localized Steam data
onlinecountIf specified this will be the text for the online count. Use :count to dynamically insert the actual products player/user count.
ratingIf set to true then the app rating will be shown as a 5-star-system, otherwise it is hidden
playtextSpecifies the text of the button that eventually links to the Steam products store page
authorSpecify a text that is displayed as the author of the product. You can use :developer and :publisher to dynamically insert the products developer and publisher names
widthSpecify the width of the widget
heightSpecify the height of the widget
style-border / style.borderSpecify border rounding: Either none, small or max
style-shadow / style.shadowYou can specify false to prevent displaying box shadow or true to enable (default)
style-color-background / style.colorBackgroundSpecify a CSS value for the background color
style-color-title / style.colorTitleSpecify a CSS value for the title color
style-color-description / style.colorDescriptionSpecify a CSS value for the description color
style-color-author / style.colorAuthorSpecify a CSS value for the author color
style-color-onlinecount / style.colorOnlinecountSpecify a CSS value for the online count color
style-hideimage / style.hideimageSpecify whether the widget image shall be hidden or not

You can also dynamically create Steam Widgets via JavaScript:

<div id="app-widget"></div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        let widget = new SteamApp('#app-widget', {
            appid: '620',
            //You can specify the same attributes as shown in the table above as well as events (see below)
        });
    });
</script>

The following methods are available for a Steam App element / object:

MethodDescription
updateWidget()Updates the widget data and displays them
changeLang(lang, playtext, author, onlinecount)Changes the language of the widget using the given information
setImageVisibility(visibility)Sets the widget image visibility
remove()Removes the widget from the document

The following events are available for a Steam App object:

EventDescription
events.onInit(e)Called when the widget is initialized
events.onCompleted(e)Called when the widget has finished loading

Steam Server

When referenced the required Steam Server module, the minimum code to render a widget is as follows:

<steam-server addr="ip:port"></steam-server>

This renders the following widget:
Steam Server Widget

You can define these options:

AttributeValue
addrSpecifies the address of the server using format ip:port
headerIf you want to render the widget with a header image you may specify the URL to an image here
botsSpecify the text for the bot info. Use :count to render the actual bot count
secure_yesSpecifies the text that is displayed if the server is a secure server
secure_noSpecifies the text that is displayed if the server is not a secure server
hosting_dedicatedSpecifies the text that is displayed if the server is a dedicated server
hosting_listenSpecifies the text that is displayed if the server is a listen server
playtextSpecifies the text of the button that issues a connection to the server
widthSpecify the width of the widget
heightSpecify the height of the widget
style-border / style.borderSpecify border rounding: Either none, small or max
style-shadow / style.shadowYou can specify false to prevent displaying box shadow or true to enable (default)
style-color-background / style.colorBackgroundSpecify a CSS value for the background color
style-color-text-bright / style.colorTextBrightSpecify a CSS value for the bright texts
style-color-text-dark / style.colorTextDarkSpecify a CSS value for the dark texts

You can also dynamically create Steam Server widgets via JavaScript:

<div id="server-widget"></div>

<script>
document.addEventListener('DOMContentLoaded', function() {
	let widget = new SteamServer('#server-widget', {
		addr: 'ip:port',
		//You can specify the same attributes as shown in the table above as well as events (see below)
	});
});
</script>

The following methods are available for a Steam Server element / object:

MethodDescription
updateWidget()Updates the widget data and displays them
changeLang(bots, secure_yes, secure_no, hosting_dedicated, hosting_listen, playtext)Changes the language of the widget using the given information
setImageVisibility(visibility)Sets the widget image visibility
remove()Removes the widget from the document

The following events are available for a Steam Server object:

EventDescription
events.onInit(e)Called when the widget is initialized
events.onCompleted(e)Called when the widget has finished loading

Steam User

When referenced the required Steam User module, the minimum code to render a widget is as follows:

<steam-user steamid="id"></steam-user>

This renders the following widget:
Steam User Widget

You can define these options:

AttributeValue
steamidSpecifies the SteamID of the Steam user
headerIf you want to render the widget with a header image you may specify the URL to an image here
online_yesSpecifies the text that is displayed if the user is currently online
online_noSpecifies the text that is displayed if the user is not currently online
member_sinceSpecifies the text and format of the info that shows since when the user account is registered. Use :year, :month and :day to format the date.
viewtextSpecifies the text of the button which can be used to go to the users Steam Community profile
widthSpecify the width of the widget
heightSpecify the height of the widget
style-border / style.borderSpecify border rounding: Either none, small or max
style-shadow / style.shadowYou can specify false to prevent displaying box shadow or true to enable (default)
style-color-background / style.colorBackgroundSpecify a CSS value for the background color
style-color-text-bright / style.colorTextBrightSpecify a CSS value for the bright texts
style-color-text-dark / style.colorTextDarkSpecify a CSS value for the dark texts

You can also dynamically create Steam User widgets via JavaScript:

<div id="user-widget"></div>

<script>
	document.addEventListener('DOMContentLoaded', function() {
        let widget = new SteamUser('#user-widget', {
            steamid: 'id',
            //You can specify the same attributes as shown in the table above as well as events (see below)
        });
    });
</script>

The following methods are available for a Steam User element / object:

MethodDescription
updateWidget()Updates the widget data and displays them
changeLang(online_yes, online_no, member_since, 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

The following events are available for a Steam User object:

EventDescription
events.onInit(e)Called when the widget is initialized
events.onCompleted(e)Called when the widget has finished loading

Steam Workshop

When referenced the required Steam Workshop module, the minimum code to render a widget is as follows:

<steam-workshop itemid="id"></steam-workshop>

This renders the following widget:
Steam Workshop Widget

You can define these options:

AttributeValue
itemidSpecifies the item ID of the Steam Workshop item
viewsSpecifies the text of the views stats label
subscriptionsSpecifies the text of the subscriptions stats label
favoritesSpecifies the text of the favorites stats label
authorSpecifies the author text. Use :creator to insert the creators Steam persona name
viewtextSpecifies the text of the button which can be used to go to the Workshop item page
show-image / showImageSpecifies if the workshop item preview image shall be displayed. Defaults to true/1
style-border / style.borderSpecify border rounding: Either none, small or max
style-shadow / style.shadowYou can specify false to prevent displaying box shadow or true to enable (default)
style-color-background / style.colorBackgroundSpecify a CSS value for the background color
style-color-title / style.colorTitleSpecify a CSS value for the title color
style-color-description / style.colorDescriptionSpecify a CSS value for the description color
style-color-stats-count / style.colorStatsCountSpecify a CSS value for the stats count color
style-color-stats-label / style.colorStatsLabelSpecify a CSS value for the stats label color

You can also dynamically create Steam Workshop widgets via JavaScript:

<div id="workshop-widget"></div>

<script>
	document.addEventListener('DOMContentLoaded', function() {
        let widget = new SteamWorkshop('#workshop-widget', {
            itemid: 'id',
            //You can specify the same attributes as shown in the table above as well as events (see below)
        });
    });
</script>

The following methods are available for a Steam Workshop element / object:

MethodDescription
updateWidget()Updates the widget data and displays them
changeLang(views, subscriptions, favorites, author, 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

The following events are available for a Steam Workshop object:

EventDescription
events.onInit(e)Called when the widget is initialized
events.onCompleted(e)Called when the widget has finished loading

Steam Group

When referenced the required Steam Group module, the minimum code to render a widget is as follows:

<steam-group group="id"></steam-group>

This renders the following widget:
Steam Group Widget

You can define these options:

AttributeValue
groupSpecifies the group either by numeric ID or URL identifier token
membersSpecifies the text of the members stats label
onlineSpecifies the text of the online stats label
ingameSpecifies the text of the in-game stats label
viewtextSpecifies the text of the button which can be used to go to the group page
show-image / showImageSpecifies if the group avatar image shall be displayed. Defaults to true/1
style-border / style.borderSpecify border rounding: Either none, small or max
style-shadow / style.shadowYou can specify false to prevent displaying box shadow or true to enable (default)
style-color-background / style.colorBackgroundSpecify a CSS value for the background color
style-color-title / style.colorTitleSpecify a CSS value for the title color
style-color-description / style.colorDescriptionSpecify a CSS value for the description color
style-color-stats-count / style.colorStatsCountSpecify a CSS value for the stats count color
style-color-stats-label / style.colorStatsLabelSpecify 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: 'id or url',
            //You can specify the same attributes as shown in the table above as well as events (see below)
        });
    });
</script>

The following methods are available for a Steam Group element / object:

MethodDescription
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

The following events are available for a Steam Group object:

EventDescription
events.onInit(e)Called when the widget is initialized
events.onCompleted(e)Called when the widget has finished loading

Keywords

steam

FAQs

Package last updated on 31 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts