Skip to content

Commit

Permalink
LGSL 6.0.1 New Style: Cards, New Map Preview script
Browse files Browse the repository at this point in the history
New game icons
Selecting active scripts on install page
Minor fixes
  • Loading branch information
tltneon committed Feb 11, 2021
1 parent d79f1d0 commit ada41d6
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 21 deletions.
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![GitHub forks](https://img.shields.io/github/forks/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/fork)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/archive/master.zip)
[![Packagist](https://img.shields.io/packagist/l/tltneon/lgsl?style=for-the-badge)](https://github.com/tltneon/lgsl/blob/master/LICENSE)
# LGSL v6.0.0 (Live Game Server List) for PHP 7+
# LGSL v6.0.1 (Live Game Server List) for PHP 7+
Based-off LGSL v5.8 (stand-alone version) from www.greycube.com. This is almost original version of LGSL with [new features](https://github.com/tltneon/lgsl#changelog) and working on PHP 5.4-8.x and MySQL 5.5.27-8.0.x or MariaDB 5.5-10.5.x

## [Live Demos](http://lgsl-demo.freesite.vip/) | [Wiki](https://github.com/tltneon/lgsl/wiki) | [How to install]( https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL) | [Supported games](https://github.com/tltneon/lgsl/wiki/Supported-Games) | [Custom styles](https://github.com/tltneon/lgsl/wiki/Styles)
Expand All @@ -21,6 +21,12 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
![lgsl Server List on mobile device](https://i.imgur.com/oui8Nya.png)

## [Changelog](https://github.com/tltneon/lgsl/wiki/Changelog)
#### v6.0.1
- **New Style: Cards** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl9/index.php)]
- **Selecting active scripts on install page**
- **Available Map Preview script**
- **New game icons**
- **Minor fixes**
#### v6.0.0
- **LGSL now can use pagination!**
- **Filtering by type or game using ?game= or ?type= parameters**
Expand Down Expand Up @@ -63,21 +69,6 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
- *Thanks to [@ctannurella](https://github.com/ctannurella)*
- **Default style was changed to: Darken**
- **Added support to including js files in _lgsl_config.php_**
#### v5.9.4
- **More custom CSS classes for changing styles**
- **Added OGP Style** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl4/index.php)]
- *Author [@oNdsen](https://github.com/oNdsen)*
- **Added a few game icons**
- **Added French and Spanish languages**
- *Thanks to [@own3mall](https://github.com/own3mall)*
- **Added Czech, Bulgarian language**
- **Changed HL Game Links to _steam://ip:port_ protocol**
#### v5.9.3
- **Added Darken Style** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl2/index.php)]
- **Added favicon to _\lgsl_files\other\favicon.ico_**
- **Added translation feature**
- [*You can help to translate LGSL to your language!*](https://github.com/tltneon/lgsl/tree/master/lgsl_files/languages)
- **Added Russian language**

##### [:: Older versions](https://github.com/tltneon/lgsl/wiki/Changelog)

Expand Down
29 changes: 28 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<option value="material_style.css">Material Design</option>
<option value="breeze_style.css">Breeze</option>
<option value="parallax_style.css">Parallax</option>
<option value="cards_style.css">Cards</option>
<option value="classic_style.css">Classic</option>
<option value="disc_ff_style.css">Disc FF</option>
<option value="wallpaper_style.css">Wallpaper</option>
Expand All @@ -207,6 +208,12 @@
</select>
</p>
<p>
<l k="selsc"></l>:
<br /><input type="checkbox" id="parallax.js" name="scripts" onChange="changeCheckbox(event)" /> parallax (for Parallax Style)
<br /><input type="checkbox" id="preview.js" name="scripts" onChange="changeCheckbox(event)" /> map preview (on server list)
</p>
<hr />
<p>
Expand Down Expand Up @@ -302,6 +309,7 @@ function reloadLocale(){
lgsl_password: "",
//
style: "darken_style.css",
scripts: [],
language: "english",
sort_servers_by: "id",
sort_players_by: "name",
Expand All @@ -314,6 +322,7 @@ function reloadLocale(){
locations: false
}
function changeValue(event, options = {}) {
console.log(event);
if(options.styleChanged){
if(event.target.value == "showcase"){
event.target.value = "darken_style.css";
Expand All @@ -332,6 +341,10 @@ function changeValue(event, options = {}) {
vars[event.target.name] = event.target.value;
}
function changeCheckbox(event) {
if(event.target.name == 'scripts'){
vars[event.target.name][event.target.id] = event.target.checked;
}
else
vars[event.target.name] = event.target.checked;
}
function updateLValue(el, key){
Expand All @@ -342,13 +355,18 @@ function generateConfig()
{
if(vars.mysql_user == "" || vars.lgsl_user == "" || vars.lgsl_password == "") return alert(l("filla"));
let textarea = document.body.getElementsByTagName("textarea")[0] ? document.body.getElementsByTagName("textarea")[0] : document.createElement("textarea");
let slist = '';
for(s in vars['scripts']){
if(vars['scripts'][s])
slist += '"' + s + '",';
}
document.body.getElementsByTagName("div")[0].appendChild(textarea);
textarea.innerHTML = "&lt;?php \n" +
"global $lgsl_config; $lgsl_config = array(); \n" +
"$lgsl_config['feed']['method'] = 0; \n" +
"$lgsl_config['feed']['url'] = \"http://www.greycube.co.uk/lgsl/feed/lgsl_files/lgsl_feed.php\"; \n" +
"$lgsl_config['style'] = \""+ vars.style +"\"; // options: breeze_style.css, darken_style.css, classic_style.css, ogp_style.css, parallax_style.css, disc_ff_style.css, materials_style.css \n" +
"$lgsl_config['scripts'] = ['parallax.js']; \n" +
"$lgsl_config['scripts'] = ["+ slist +"]; \n" +
"$lgsl_config['locations'] = "+ vars.locations +"; \n" +
"$lgsl_config['list']['totals'] = "+ vars.totals +"; \n" +
"$lgsl_config['sort']['servers'] = \""+ vars.sort_servers_by +"\"; // OPTIONS: id type zone players status \n" +
Expand Down Expand Up @@ -438,6 +456,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -465,6 +484,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -492,6 +512,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -519,6 +540,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -546,6 +568,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -573,6 +596,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -600,6 +624,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down Expand Up @@ -627,6 +652,7 @@ function l(key){
"after": "Potom čo vytvoríš konfiguraciu, vymeň subor za lgsl_files/lgsl_config.php",
"selst": "Zvoliť štýl",
"sella": "Zvoliť jazyk",
"selsc": "Select scripts",
"sorts": "Zoradiť servery podľa",
"sortp": "Zoradiť hráčov podľa",
"enaim": "Povoliť obrázkové zobrazovanie",
Expand Down Expand Up @@ -654,6 +680,7 @@ function l(key){
"after": "After you make config, replace it into lgsl_files/lgsl_config.php",
"selst": "Select style",
"sella": "Select language",
"selsc": "Select scripts",
"sorts": "Sort servers by",
"sortp": "Sort players by",
"enaim": "Enable Image mod",
Expand Down
1 change: 1 addition & 0 deletions lgsl_files/lgsl_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ function lgsl_url_path()
<select onchange='javascript:document.querySelector(\"link[rel=stylesheet]\").href = \"lgsl_files/styles/\" + this.value + \".css\"'>
<option value='breeze_style'>breeze_style</option>
<option value='classic_style'>classic_style</option>
<option value='cards_style'>cards_style</option>
<option value='disc_ff_style'>disc_ff_style</option>
<option value='material_style'>material_style</option>
<option value='ogp_style'>ogp_style</option>
Expand Down
4 changes: 2 additions & 2 deletions lgsl_files/lgsl_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//------------------------------------------------------------------------------------------------------------+
//[ BACKGROUND COLORS: TEXT HARD TO READ ? CHANGE THESE TO CONTRAST THE FONT COLOR / www.colorpicker.com ]

$lgsl_config['style'] = "darken_style.css"; // options: breeze_style.css, darken_style.css, classic_style.css, ogp_style.css, parallax_style.css, disc_ff_style.css, material_style.css
$lgsl_config['scripts'] = ['parallax.js'];
$lgsl_config['style'] = "darken_style.css"; // options: breeze_style.css, darken_style.css, classic_style.css, ogp_style.css, parallax_style.css, disc_ff_style.css, material_style.css, cards_style.css
$lgsl_config['scripts'] = [];

//------------------------------------------------------------------------------------------------------------+
//[ SHOW LOCATION FLAGS: 0=OFF 1=GEO-IP "GB"=MANUALLY SET COUNTRY CODE FOR SPEED ]
Expand Down
2 changes: 1 addition & 1 deletion lgsl_files/lgsl_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
$output .= "
</table>";

if($lgsl_config['pagination_mod'] && (intdiv(count($server_list), $lgsl_config['pagination_lim']) > 0 || strval($page) > 1)){
if($lgsl_config['pagination_mod'] && ((int)(count($server_list)/ $lgsl_config['pagination_lim']) > 0 || strval($page) > 1)){
$output .= "
<div id='pages'>
" . ($page > 1 ? "<a href='" . str_replace('page='.strval($page), 'page='.strval($page - 1), $_SERVER['REQUEST_URI']) . "'><</a>" : "") . "
Expand Down
2 changes: 1 addition & 1 deletion lgsl_files/lgsl_protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -4311,7 +4311,7 @@ function lgsl_gs_crypt($type, &$buffer, $encrypt = FALSE)

function lgsl_version()
{
return "LGSL By Richard Perry</a> | <a href='https://github.com/tltneon/lgsl'>v 6.0.0"; // little dirty trick
return "LGSL By Richard Perry</a> | <a href='https://github.com/tltneon/lgsl'>v 6.0.1"; // little dirty trick
}

//------------------------------------------------------------------------------------------------------------+
Expand Down
38 changes: 38 additions & 0 deletions lgsl_files/scripts/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function imageExists(image_url){
var http = new XMLHttpRequest();
http.open('HEAD', image_url, false);
http.send();
return http.status != 404;
}

var types = document.querySelectorAll("#server_list_table > tbody > tr > td.status_cell > a > img");
document.querySelectorAll('#server_list_table > tbody > tr > td.map_cell').forEach((a, b)=>{
let map = a.innerHTML.trim();
if(map != '--'){
let el = document.createElement('img');
let type = types[b].title.match(/Type: [\w]*/)[0].slice(6);
let game = types[b].title.match(/Game: [\w]*/)[0].slice(6);
let pathes = [
'lgsl_files/maps/' + type + '/' + game + '.jpg',
'lgsl_files/maps/' + type + '/' + game + '.png',
'lgsl_files/maps/' + type + '/' + game + '/' + map + '.jpg',
'lgsl_files/maps/' + type + '/' + game + '/' + map + '.png'
]
path = 'lgsl_files/other/map_no_image.jpg';
pathes.forEach(a => {
if(imageExists(a)){
path = a;
}
})
el.src = path;
el.style.width = '250px';
el.style.height = '188px';
el.style.display = 'none';
el.style.position = 'absolute';
el.className = 'mapImage' + b;
a.appendChild(el);

a.onmouseover = function(){document.querySelector('.mapImage'+b).style.display = 'inherit';}
a.onmouseout = function(){document.querySelector('.mapImage'+b).style.display = 'none';}
}
})
Loading

0 comments on commit ada41d6

Please sign in to comment.