Build script

This commit is contained in:
Daniel Brendel
2022-09-25 10:51:50 +02:00
parent b5261f38d5
commit 72e6d03c52
7 changed files with 92 additions and 92 deletions

View File

@ -4,35 +4,35 @@ cls
set /p ver=Please enter the version:
echo "Using version: %ver%"
mkdir "%~dp0public\js\steamcards\%ver%"
mkdir "%~dp0public\css\steamcards\%ver%"
mkdir "%~dp0public\js\steamwidgets\%ver%"
mkdir "%~dp0public\css\steamwidgets\%ver%"
del "%~dp0public\js\steamcards\%ver%\steam_app.js"
del "%~dp0public\css\steamcards\%ver%\steam_app.css"
del "%~dp0public\js\steamwidgets\%ver%\steam_app.js"
del "%~dp0public\css\steamwidgets\%ver%\steam_app.css"
del "%~dp0public\js\steamcards\%ver%\steam_server.js"
del "%~dp0public\css\steamcards\%ver%\steam_server.css"
del "%~dp0public\js\steamwidgets\%ver%\steam_server.js"
del "%~dp0public\css\steamwidgets\%ver%\steam_server.css"
del "%~dp0public\js\steamcards\%ver%\steam_user.js"
del "%~dp0public\css\steamcards\%ver%\steam_user.css"
del "%~dp0public\js\steamwidgets\%ver%\steam_user.js"
del "%~dp0public\css\steamwidgets\%ver%\steam_user.css"
xcopy "%~dp0app\resources\js\steam_app.dev.js" "%~dp0public\js\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_app.dev.css" "%~dp0public\css\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\js\steam_app.dev.js" "%~dp0public\js\steamwidgets\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_app.dev.css" "%~dp0public\css\steamwidgets\%ver%\" /Y
xcopy "%~dp0app\resources\js\steam_server.dev.js" "%~dp0public\js\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_server.dev.css" "%~dp0public\css\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\js\steam_server.dev.js" "%~dp0public\js\steamwidgets\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_server.dev.css" "%~dp0public\css\steamwidgets\%ver%\" /Y
xcopy "%~dp0app\resources\js\steam_user.dev.js" "%~dp0public\js\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_user.dev.css" "%~dp0public\css\steamcards\%ver%\" /Y
xcopy "%~dp0app\resources\js\steam_user.dev.js" "%~dp0public\js\steamwidgets\%ver%\" /Y
xcopy "%~dp0app\resources\css\steam_user.dev.css" "%~dp0public\css\steamwidgets\%ver%\" /Y
ren "%~dp0public\js\steamcards\%ver%\steam_app.dev.js" "steam_app.js"
ren "%~dp0public\css\steamcards\%ver%\steam_app.dev.css" "steam_app.css"
ren "%~dp0public\js\steamwidgets\%ver%\steam_app.dev.js" "steam_app.js"
ren "%~dp0public\css\steamwidgets\%ver%\steam_app.dev.css" "steam_app.css"
ren "%~dp0public\js\steamcards\%ver%\steam_server.dev.js" "steam_server.js"
ren "%~dp0public\css\steamcards\%ver%\steam_server.dev.css" "steam_server.css"
ren "%~dp0public\js\steamwidgets\%ver%\steam_server.dev.js" "steam_server.js"
ren "%~dp0public\css\steamwidgets\%ver%\steam_server.dev.css" "steam_server.css"
ren "%~dp0public\js\steamcards\%ver%\steam_user.dev.js" "steam_user.js"
ren "%~dp0public\css\steamcards\%ver%\steam_user.dev.css" "steam_user.css"
ren "%~dp0public\js\steamwidgets\%ver%\steam_user.dev.js" "steam_user.js"
ren "%~dp0public\css\steamwidgets\%ver%\steam_user.dev.css" "steam_user.css"
echo "Job done"

View File

@ -1,13 +1,13 @@
/**
* SteamCards - Steam Cards for your website
* SteamWidgets - Steam Widgets for your website
*
* Module: Steam Game/App Widget
*
* Visit: https://github.com/danielbrendel
*/
const STEAMCARDS_APP_ENDPOINT = 'http://localhost:8000';
const STEAMCARDS_APP_VERSION = 'v1';
const STEAMWIDGETS_APP_ENDPOINT = 'http://localhost:8000';
const STEAMWIDGETS_APP_VERSION = 'v1';
/**
* Class SteamAppElem
@ -57,7 +57,7 @@ class SteamAppElem extends HTMLElement
styleHideImage: styleHideImage
};
this.setupCard(
this.setupWidget(
appid,
lang,
playtext,
@ -78,7 +78,7 @@ class SteamAppElem extends HTMLElement
}
}
setupCard(appid, lang, playtext, author, onlinecount, rating, width, height, styleBorder, styleShadow, styleColorBackground, styleColorTitle, styleColorDescription, styleColorAuthor, styleColorOnlinecount, styleHideImage)
setupWidget(appid, lang, playtext, author, onlinecount, rating, width, height, styleBorder, styleShadow, styleColorBackground, styleColorTitle, styleColorDescription, styleColorAuthor, styleColorOnlinecount, styleHideImage)
{
var req = new XMLHttpRequest();
var self = this;
@ -115,12 +115,12 @@ class SteamAppElem extends HTMLElement
author = author.replace(':publisher', publishers);
}
if (!document.getElementById('steamcards-app-styles')) {
if (!document.getElementById('steamwidgets-app-styles')) {
let link = document.createElement('link');
link.id = 'steamcards-app-styles';
link.id = 'steamwidgets-app-styles';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = STEAMCARDS_APP_ENDPOINT + '/api/resource/query?type=css&module=app&version=' + STEAMCARDS_APP_VERSION;
link.href = STEAMWIDGETS_APP_ENDPOINT + '/api/resource/query?type=css&module=app&version=' + STEAMWIDGETS_APP_VERSION;
document.getElementsByTagName('head')[0].appendChild(link);
}
@ -130,9 +130,9 @@ class SteamAppElem extends HTMLElement
onlineCountText = onlineCountText.replace(':count', self.readableCount(json.data.online_count));
}
let cardImageStyle = '';
let widgetImageStyle = '';
let cardStyle = '';
let widgetStyle = '';
if ((width !== null) || (styleBorder !== null) || (styleShadow !== true) || (styleColorBackground !== null)) {
let widthCode = '';
if (width !== null) {
@ -143,13 +143,13 @@ class SteamAppElem extends HTMLElement
if (styleBorder !== null) {
if (styleBorder === 'max') {
borderCode = 'border-radius: 25px;';
cardImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
widgetImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
} else if (styleBorder === 'small') {
borderCode = 'border-radius: 4px;';
cardImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
widgetImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
} else if (styleBorder === 'none') {
borderCode = 'border-radius: unset;';
cardImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
widgetImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
}
}
@ -163,7 +163,7 @@ class SteamAppElem extends HTMLElement
bgColor = 'background-color: ' + styleColorBackground + ';';
}
cardStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
widgetStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
}
let ratingCode = '';
@ -180,8 +180,8 @@ class SteamAppElem extends HTMLElement
}
let html = `
<div class="steam-app" ` + ((cardStyle.length > 0) ? cardStyle: '') + `>
<div class="steam-app-image" style="background-image: url('` + json.data.header_image + `'); ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((cardImageStyle.length > 0) ? cardImageStyle : '') + ((styleHideImage) ? 'display: none;' : '') + `"></div>
<div class="steam-app" ` + ((widgetStyle.length > 0) ? widgetStyle: '') + `>
<div class="steam-app-image" style="background-image: url('` + json.data.header_image + `'); ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((widgetImageStyle.length > 0) ? widgetImageStyle : '') + ((styleHideImage) ? 'display: none;' : '') + `"></div>
<div class="steam-app-infos">
<div class="steam-app-title">
@ -213,13 +213,13 @@ class SteamAppElem extends HTMLElement
self.innerHTML = html;
}
};
req.open('GET', STEAMCARDS_APP_ENDPOINT + '/api/query/app?appid=' + appid + '&lang=' + lang, true);
req.open('GET', STEAMWIDGETS_APP_ENDPOINT + '/api/query/app?appid=' + appid + '&lang=' + lang, true);
req.send();
}
updateCard()
updateWidget()
{
this.setupCard(
this.setupWidget(
this.storedData.appid,
this.storedData.lang,
this.storedData.playtext,
@ -246,7 +246,7 @@ class SteamAppElem extends HTMLElement
this.storedData.author = author;
this.storedData.onlinecount = onlinecount;
this.setupCard(
this.setupWidget(
this.storedData.appid,
this.storedData.lang,
this.storedData.playtext,
@ -270,7 +270,7 @@ class SteamAppElem extends HTMLElement
{
this.storedData.styleHideImage = !visibility;
this.setupCard(
this.setupWidget(
this.storedData.appid,
this.storedData.lang,
this.storedData.playtext,
@ -316,7 +316,7 @@ window.customElements.define('steam-app', SteamAppElem);
/**
* Class SteamApp
*
* Dynamically create a Steam game/app card via JavaScript
* Dynamically create a Steam game/app widget via JavaScript
*/
class SteamApp
{
@ -403,9 +403,9 @@ class SteamApp
}
}
updateCard()
updateWidget()
{
this.elem.updateCard();
this.elem.updateWidget();
}
changeLang(lang, playtext, author, onlinecount)

View File

@ -1,13 +1,13 @@
/**
* SteamCards - Steam Cards for your website
* SteamWidgets - Steam Widgets for your website
*
* Module: Steam Server Widget
*
* Visit: https://github.com/danielbrendel
*/
const STEAMCARDS_SERVER_ENDPOINT = 'http://localhost:8000';
const STEAMCARDS_SERVER_VERSION = 'v1';
const STEAMWIDGETS_SERVER_ENDPOINT = 'http://localhost:8000';
const STEAMWIDGETS_SERVER_VERSION = 'v1';
/**
* Class SteamServerElem
@ -56,7 +56,7 @@
styleColorTextDark
};
this.setupCard(
this.setupWidget(
addr,
header,
width,
@ -76,7 +76,7 @@
}
}
setupCard(addr, header, width, height, bots, secure_yes, secure_no, hosting_dedicated, hosting_listen, playtext, styleBorder, styleShadow, styleColorBackground, styleColorTextBright, styleColorTextDark)
setupWidget(addr, header, width, height, bots, secure_yes, secure_no, hosting_dedicated, hosting_listen, playtext, styleBorder, styleShadow, styleColorBackground, styleColorTextBright, styleColorTextDark)
{
var req = new XMLHttpRequest();
var self = this;
@ -85,18 +85,18 @@
if (req.readyState == XMLHttpRequest.DONE) {
let json = JSON.parse(req.responseText);
if (!document.getElementById('steamcards-server-styles')) {
if (!document.getElementById('steamwidgets-server-styles')) {
let link = document.createElement('link');
link.id = 'steamcards-server-styles';
link.id = 'steamwidgets-server-styles';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = STEAMCARDS_SERVER_ENDPOINT + '/api/resource/query?type=css&module=server&version=' + STEAMCARDS_SERVER_VERSION;
link.href = STEAMWIDGETS_SERVER_ENDPOINT + '/api/resource/query?type=css&module=server&version=' + STEAMWIDGETS_SERVER_VERSION;
document.getElementsByTagName('head')[0].appendChild(link);
}
let cardImageStyle = '';
let widgetImageStyle = '';
let cardStyle = '';
let widgetStyle = '';
if ((width !== null) || (styleBorder !== null) || (styleShadow !== true) || (styleColorBackground !== null)) {
let widthCode = '';
if (width !== null) {
@ -107,13 +107,13 @@
if (styleBorder !== null) {
if (styleBorder === 'max') {
borderCode = 'border-radius: 25px;';
cardImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
widgetImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
} else if (styleBorder === 'small') {
borderCode = 'border-radius: 4px;';
cardImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
widgetImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
} else if (styleBorder === 'none') {
borderCode = 'border-radius: unset;';
cardImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
widgetImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
}
}
@ -127,7 +127,7 @@
bgColor = 'background-color: ' + styleColorBackground + ';';
}
cardStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
widgetStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
}
let bgimage = '';
@ -155,8 +155,8 @@
}
let html = `
<div class="steam-server" ` + ((cardStyle.length > 0) ? cardStyle: '') + `>
<div class="steam-server-image" style="` + bgimage + ` ` + ((header == '') ? 'display: none;' : '') + ` ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((cardImageStyle.length > 0) ? cardImageStyle : '') + `"></div>
<div class="steam-server" ` + ((widgetStyle.length > 0) ? widgetStyle: '') + `>
<div class="steam-server-image" style="` + bgimage + ` ` + ((header == '') ? 'display: none;' : '') + ` ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((widgetImageStyle.length > 0) ? widgetImageStyle : '') + `"></div>
<div class="steam-server-infos">
<div class="steam-server-title">
@ -193,13 +193,13 @@
self.innerHTML = html;
}
};
req.open('GET', STEAMCARDS_SERVER_ENDPOINT + '/api/query/server?addr=' + addr, true);
req.open('GET', STEAMWIDGETS_SERVER_ENDPOINT + '/api/query/server?addr=' + addr, true);
req.send();
}
updateCard()
updateWidget()
{
this.setupCard(
this.setupWidget(
this.storedData.addr,
this.storedData.header,
this.storedData.width,
@ -227,7 +227,7 @@
this.storedData.hosting_listen = hosting_listen;
this.storedData.playtext = playtext;
this.setupCard(
this.setupWidget(
this.storedData.addr,
this.storedData.header,
this.storedData.width,
@ -258,7 +258,7 @@
this.storedData.header = '';
}
this.setupCard(
this.setupWidget(
this.storedData.addr,
this.storedData.header,
this.storedData.width,
@ -283,7 +283,7 @@
/**
* Class SteamServer
*
* Dynamically create a Steam server card via JavaScript
* Dynamically create a Steam server widgets via JavaScript
*/
class SteamServer
{
@ -354,9 +354,9 @@
}
}
updateCard()
updateWidget()
{
this.elem.updateCard();
this.elem.updateWidget();
}
changeLang(bots, secure_yes, secure_no, hosting_dedicated, hosting_listen, playtext)

View File

@ -1,13 +1,13 @@
/**
* SteamCards - Steam Cards for your website
* SteamWidgets - Steam Widgets for your website
*
* Module: Steam User Widget
*
* Visit: https://github.com/danielbrendel
*/
const STEAMCARDS_USER_ENDPOINT = 'http://localhost:8000';
const STEAMCARDS_USER_VERSION = 'v1';
const STEAMWIDGETS_USER_ENDPOINT = 'http://localhost:8000';
const STEAMWIDGETS_USER_VERSION = 'v1';
/**
* Class SteamUserElem
@ -52,7 +52,7 @@
styleColorTextDark
};
this.setupCard(
this.setupWidget(
steamid,
header,
width,
@ -70,7 +70,7 @@
}
}
setupCard(steamid, header, width, height, online_yes, online_no, member_since, viewtext, styleBorder, styleShadow, styleColorBackground, styleColorTextBright, styleColorTextDark)
setupWidget(steamid, header, width, height, online_yes, online_no, member_since, viewtext, styleBorder, styleShadow, styleColorBackground, styleColorTextBright, styleColorTextDark)
{
var req = new XMLHttpRequest();
var self = this;
@ -79,18 +79,18 @@
if (req.readyState == XMLHttpRequest.DONE) {
let json = JSON.parse(req.responseText);
if (!document.getElementById('steamcards-user-styles')) {
if (!document.getElementById('steamwidgets-user-styles')) {
let link = document.createElement('link');
link.id = 'steamcards-user-styles';
link.id = 'steamwidgets-user-styles';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = STEAMCARDS_USER_ENDPOINT + '/api/resource/query?type=css&module=user&version=' + STEAMCARDS_USER_VERSION;
link.href = STEAMWIDGETS_USER_ENDPOINT + '/api/resource/query?type=css&module=user&version=' + STEAMWIDGETS_USER_VERSION;
document.getElementsByTagName('head')[0].appendChild(link);
}
let cardImageStyle = '';
let widgetImageStyle = '';
let cardStyle = '';
let widgetStyle = '';
if ((width !== null) || (styleBorder !== null) || (styleShadow !== true) || (styleColorBackground !== null)) {
let widthCode = '';
if (width !== null) {
@ -101,13 +101,13 @@
if (styleBorder !== null) {
if (styleBorder === 'max') {
borderCode = 'border-radius: 25px;';
cardImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
widgetImageStyle = 'border-top-left-radius: 25px; border-top-right-radius: 25px;';
} else if (styleBorder === 'small') {
borderCode = 'border-radius: 4px;';
cardImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
widgetImageStyle = 'border-top-left-radius: 4px; border-top-right-radius: 4px;';
} else if (styleBorder === 'none') {
borderCode = 'border-radius: unset;';
cardImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
widgetImageStyle = 'border-top-left-radius: unset; border-top-right-radius: unset;';
}
}
@ -121,7 +121,7 @@
bgColor = 'background-color: ' + styleColorBackground + ';';
}
cardStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
widgetStyle = 'style="' + widthCode + borderCode + shadowCode + bgColor + '"';
}
let bgimage = '';
@ -145,8 +145,8 @@
member_since = member_since.replace(':day', regdate.getDate());
let html = `
<div class="steam-user" ` + ((cardStyle.length > 0) ? cardStyle: '') + `>
<div class="steam-user-image" style="` + bgimage + ` ` + ((header == '') ? 'display: none;' : '') + ` ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((cardImageStyle.length > 0) ? cardImageStyle : '') + `"></div>
<div class="steam-user" ` + ((widgetStyle.length > 0) ? widgetStyle: '') + `>
<div class="steam-user-image" style="` + bgimage + ` ` + ((header == '') ? 'display: none;' : '') + ` ` + ((height !== null) ? 'height: ' + height + 'px;' : '') + ((widgetImageStyle.length > 0) ? widgetImageStyle : '') + `"></div>
<div class="steam-user-infos">
<div class="steam-user-infos-left">
@ -172,13 +172,13 @@
self.innerHTML = html;
}
};
req.open('GET', STEAMCARDS_USER_ENDPOINT + '/api/query/user?steamid=' + steamid, true);
req.open('GET', STEAMWIDGETS_USER_ENDPOINT + '/api/query/user?steamid=' + steamid, true);
req.send();
}
updateCard()
updateWidget()
{
this.setupCard(
this.setupWidget(
this.storedData.steamid,
this.storedData.header,
this.storedData.width,
@ -202,7 +202,7 @@
this.storedData.member_since = member_since;
this.storedData.viewtext = viewtext;
this.setupCard(
this.setupWidget(
this.storedData.steamid,
this.storedData.header,
this.storedData.width,
@ -231,7 +231,7 @@
this.storedData.header = '';
}
this.setupCard(
this.setupWidget(
this.storedData.steamid,
this.storedData.header,
this.storedData.width,
@ -254,7 +254,7 @@
/**
* Class SteamUser
*
* Dynamically create a Steam user card via JavaScript
* Dynamically create a Steam user widgets via JavaScript
*/
class SteamUser
{
@ -321,9 +321,9 @@
}
}
updateCard()
updateWidget()
{
this.elem.updateCard();
this.elem.updateWidget();
}
changeLang(online_yes, online_no, member_since, viewtext)