Skip to content
Snippets Groups Projects
Commit 4728d475 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Fin de la refacto.

parent 9709d3a1
No related branches found
No related tags found
No related merge requests found
...@@ -4,5 +4,7 @@ ...@@ -4,5 +4,7 @@
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jquery-3.6.0" level="application" />
<orderEntry type="library" name="bootstrap" level="application" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -6,6 +6,16 @@ ...@@ -6,6 +6,16 @@
<option name="m_minLength" value="4" /> <option name="m_minLength" value="4" />
<option name="m_maxLength" value="32" /> <option name="m_maxLength" value="32" />
</inspection_tool> </inspection_tool>
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="bgimageurl" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="JSClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="JSClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LocalVariableNamingConventionJS" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="LocalVariableNamingConventionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[a-z][A-Za-z]*" /> <option name="m_regex" value="[a-z][A-Za-z]*" />
...@@ -32,6 +42,7 @@ ...@@ -32,6 +42,7 @@
</inspection_tool> </inspection_tool>
<inspection_tool class="PhpVariableNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="PhpVariableNamingConventionInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[a-z][A-Za-z\d]*" /> <option name="m_regex" value="[a-z][A-Za-z\d]*" />
<option name="m_minLength" value="4" />
</inspection_tool> </inspection_tool>
</profile> </profile>
</component> </component>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<link rel="mask-icon" href="<?=getWebsiteSetting("websiteUrl")?>data/images/logo/favicon-blanc.svg" color="#ffffff"> <link rel="mask-icon" href="<?=getWebsiteSetting("websiteUrl")?>data/images/logo/favicon-blanc.svg" color="#ffffff">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<!-- Polices d'écriture --> <!-- Polices d'écriture -->
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<!-- Dépendances --> <!-- Dépendances -->
<?=Client::getDependencies()?> <?php Client::getDependencies(); ?>
<title><?=getWebsiteSetting("websiteName")?> | Magasins</title> <title><?=getWebsiteSetting("websiteName")?> | Magasins</title>
<!-- Embed --> <!-- Embed -->
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</head> </head>
<body> <body>
<!-- Inclusion dynamique de la navbar --> <!-- Inclusion dynamique de la navbar -->
<?=Client::getNavbar()?> <?php Client::getNavbar(); ?>
<div id="navbarReplacement" style="z-index:-1;"></div> <div id="navbarReplacement" style="z-index:-1;"></div>
<!-- Contenu --> <!-- Contenu -->
...@@ -32,18 +32,18 @@ ...@@ -32,18 +32,18 @@
<h3>Filtres</h3> <h3>Filtres</h3>
<form method="get" name="filterForm"> <form method="get" name="filterForm">
<div class="form-group"> <div class="form-group">
<label>Trier par entité/bloc</label> <label for="blockFilter">Trier par entité/bloc</label>
<select multiple class="form-control" name="blocs[]"> <select id="blockFilter" multiple class="form-control" name="blocs[]">
<option value="">Aucune</option> <option value="">Aucune</option>
<?php <?php
$items = Shop::getAllProducts(); $products = Shop::getAllProducts();
foreach($items as $item) { foreach($products as $product) {
if(isset($_GET["blocs"]) && in_array($item->getType(), $_GET["blocs"])){ if(isset($_GET["blocs"]) && in_array($product->getType(), $_GET["blocs"])){
$selected = "selected"; $selected = "selected";
}else{ }else{
$selected = ""; $selected = "";
} }
echo '<option value="'.$item->getType().'" '.$selected.'><i class="icon-minecraft '.$item->getCssClassName().'"></i> '.$item->getLabel().'</option>'; echo '<option value="'.$product->getType().'" '.$selected.'><i class="icon-minecraft '.$product->getCssClassName().'"></i> '.$product->getLabel().'</option>';
} }
?> ?>
</select> </select>
...@@ -221,23 +221,24 @@ ...@@ -221,23 +221,24 @@
<script type="text/javascript"> <script type="text/javascript">
// On va définir la taille de la div derrière la navbar // On va définir la taille de la div derrière la navbar
function goToShop(id){ function goToShop(id){
let shopElem = $("#"+id);
var shopItemDetail='<p>Type: <strong>'+$('#'+id).attr('type')+'</strong></p>'; var shopItemDetail='<p>Type: <strong>'+$('#'+id).attr('type')+'</strong></p>';
if($("#"+id).attr("displayName") != ""){ if(shopElem.attr("displayName") !== ""){
shopItemDetail+='<p>Nom personnalisé: <strong>'+decodeURIComponent($("#"+id).attr("displayName"))+'</strong></p>'; shopItemDetail+='<p>Nom personnalisé: <strong>'+decodeURIComponent(shopElem.attr("displayName"))+'</strong></p>';
} }
if($("#"+id).attr("enchants") != "null"){ if(shopElem.attr("enchants") !== "null"){
let enchants = JSON.parse(decodeURIComponent($("#"+id).attr("enchants"))); let enchants = JSON.parse(decodeURIComponent(shopElem.attr("enchants")));
for(const [key, value] of Object.entries(enchants)){ for(const [key, value] of Object.entries(enchants)){
shopItemDetail+='<p>Enchantement: <strong>'+key+'</strong> ('+value+')</p>'; shopItemDetail+='<p>Enchantement: <strong>'+key+'</strong> ('+value+')</p>';
} }
} }
shopItemDetail+='<p>Prix: <strong>'+$("#"+id).attr("price")+'€</strong></p>'; shopItemDetail+='<p>Prix: <strong>'+shopElem.attr("price")+'€</strong></p>';
$("#shopItemDetail").html(shopItemDetail); $("#shopItemDetail").html(shopItemDetail);
$("#shopXPos").val($("#"+id).attr("x")); $("#shopXPos").val(shopElem.attr("x"));
$("#shopYPos").val($("#"+id).attr("y")); $("#shopYPos").val(shopElem.attr("y"));
$("#shopZPos").val($("#"+id).attr("z")); $("#shopZPos").val(shopElem.attr("z"));
$("#shopMapLink").attr("href", "https://live.mc.sl-projects.com/#"+$("#"+id).attr("world")+";flat;"+$("#"+id).attr("x")+","+$("#"+id).attr("y")+","+$("#"+id).attr("z")+";5"); $("#shopMapLink").attr("href", "https://live.mc.sl-projects.com/#"+shopElem.attr("world")+";flat;"+shopElem.attr("x")+","+shopElem.attr("y")+","+shopElem.attr("z")+";5");
$("#shopModal").modal("show"); $("#shopModal").modal("show");
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<!-- Dépendances --> <!-- Dépendances -->
<?=Client::getDependencies()?> <?php Client::getDependencies(); ?>
<title><?=getWebsiteSetting("websiteName")?></title> <title><?=getWebsiteSetting("websiteName")?></title>
<!-- Embed --> <!-- Embed -->
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</head> </head>
<body> <body>
<!-- Inclusion dynamique de la navbar --> <!-- Inclusion dynamique de la navbar -->
<?=Client::getNavbar()?> <?php Client::getNavbar(); ?>
<!-- Intro --> <!-- Intro -->
<div id="intro"> <div id="intro">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!-- Fin de l'intro --> <!-- Fin de l'intro -->
<?=Client::getFooter()?> <?php Client::getFooter(); ?>
<!-- connectModal --> <!-- connectModal -->
<div class="modal fade" id="connectModal"> <div class="modal fade" id="connectModal">
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label>Minecraft Java Edition</label> <label for="ipJava">Minecraft Java Edition</label>
<input type="text" class="form-control" value="play.sl-craft.fr" readonly> <input id="ipJava" type="text" class="form-control" value="play.sl-craft.fr" readonly>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Minecraft Bedrock Edition</label> <label for="ipBedrock">Minecraft Bedrock Edition</label>
<input type="text" class="form-control" value="proxy.sl-craft.fr:19132" readonly> <input id="ipBedrock" type="text" class="form-control" value="proxy.sl-craft.fr:19132" readonly>
</div> </div>
<p>*Le serveur est cross-plateformes, vous jouez sur une unique map.</p> <p>*Le serveur est cross-plateformes, vous jouez sur une unique map.</p>
</div> </div>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
// On va définir la taille de l'intro // On va définir la taille de l'intro
setVitrineHeight(); setVitrineHeight();
function setVitrineHeight() { function setVitrineHeight() {
var vitrineHeight = window.innerHeight - document.getElementById("navbar").offsetHeight; let vitrineHeight = window.innerHeight - document.getElementById("navbar").offsetHeight;
$("#intro").css("height", vitrineHeight); $("#intro").css("height", vitrineHeight);
} }
window.onresize = setVitrineHeight; window.onresize = setVitrineHeight;
...@@ -115,8 +115,9 @@ function setVitrineHeight() { ...@@ -115,8 +115,9 @@ function setVitrineHeight() {
// On va regarder si dans ce que l'on va afficher, il n'y a pas des images à charger // On va regarder si dans ce que l'on va afficher, il n'y a pas des images à charger
var imagesToLoad = []; let imagesToLoad = [];
$(".intro-vitrine .presentation > *").each(async function() { let presentationElems = $(".intro-vitrine .presentation > *");
presentationElems.each(async function() {
let hasABgImageToLoad = $(this).attr('bgImageUrl'); let hasABgImageToLoad = $(this).attr('bgImageUrl');
if (typeof hasABgImageToLoad !== 'undefined' && hasABgImageToLoad !== false) { if (typeof hasABgImageToLoad !== 'undefined' && hasABgImageToLoad !== false) {
imagesToLoad.push(hasABgImageToLoad); imagesToLoad.push(hasABgImageToLoad);
...@@ -124,18 +125,19 @@ function setVitrineHeight() { ...@@ -124,18 +125,19 @@ function setVitrineHeight() {
}); });
console.log("Images à charger:"+imagesToLoad); console.log("Images à charger:"+imagesToLoad);
await loadImages(imagesToLoad); await loadImages(imagesToLoad);
$(".intro-vitrine .presentation > *").fadeIn(1000); presentationElems.fadeIn(1000);
$(".intro-vitrine .presentation .description").css("display", "flex"); // On a retiré la propriété flex pour faire le fadeIn $(".intro-vitrine .presentation .description").css("display", "flex"); // On a retiré la propriété flex pour faire le fadeIn
imagesToLoad = []; imagesToLoad = [];
setTimeout(async function(){ setTimeout(async function(){
let hasABgImageToLoad = $("#vitrine-background-image:hidden").attr('bgImageUrl'); let hiddenVitrineBackground = $("#vitrine-background-image:hidden");
let hasABgImageToLoad = hiddenVitrineBackground.attr('bgImageUrl');
if (typeof hasABgImageToLoad !== 'undefined' && hasABgImageToLoad !== false) { if (typeof hasABgImageToLoad !== 'undefined' && hasABgImageToLoad !== false) {
imagesToLoad.push(hasABgImageToLoad); imagesToLoad.push(hasABgImageToLoad);
} }
console.log("Images à charger:"+imagesToLoad); console.log("Images à charger:"+imagesToLoad);
await loadImages(imagesToLoad); await loadImages(imagesToLoad);
$("#vitrine-background-image:hidden").fadeIn(4000); hiddenVitrineBackground.fadeIn(4000);
}, 1000) }, 1000)
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment