Skip to content
Snippets Groups Projects
Commit b35ddb49 authored by Matthieu Vannin's avatar Matthieu Vannin
Browse files

test

parent 8cd29c1a
No related branches found
No related tags found
No related merge requests found
{
"presets": ["@babel/env"]
}
\ No newline at end of file
"use strict";
var html2 = "";
var data = [{
name: 'Regina',
base: 'tomate',
price_small: 6.5,
price_large: 9.95,
image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
}, {
name: 'Napolitaine',
base: 'tomate',
price_small: 6.5,
price_large: 8.95,
image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'
}, {
name: 'Spicy',
base: 'crème',
price_small: 5.5,
price_large: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300'
}];
var euro = new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 2
});
function baseTomate(element) {
return element.base.localeCompare('tomate') == 0;
}
function inf6(element) {
return element.price_small < 6;
}
function occI(element) {
var tmp = 0;
for (var i = 0; i < element.name.length; i++) {
if (element.name.charAt(i) == 'i') {
tmp += 1;
}
}
return tmp >= 2;
}
data.sort(function (a, b) {
//var textA = a.name.toUpperCase();
//var textB = b.name.toUpperCase();
var textA = a.price_small;
var textB = b.price_small;
if (textA - textB == 0) {
textA = a.price_large;
textB = b.price_large;
}
return textA - textB;
});
console.log(data); //data = data.filter(occI);
data.forEach(ShowImage);
function ShowImage(element) {
var psmall = euro.format(element.price_small);
var plarge = euro.format(element.price_large);
var url = 'images/' + element.name.toLowerCase() + '.jpg';
var html = '<article class="pizzaThumbnail">\n' + '<a href="' + element.image + '">' + '<img src="' + element.image + '"/>' + '<section>' + '<h4>' + element.name + '</h4>' + '<ul>' + '<li>Prix petit format : ' + psmall + '</li>' + '<li>Prix grand format : ' + plarge + '</li>' + '</ul>' + '</section>' + '</a>' + '</article>';
console.log(url);
console.log(html);
html2 += html;
}
function BaseTomate(element) {
return element.base.localeCompare('tomate') == 0;
}
function PrixMoins6(element) {
return element.price_small < 6;
}
function NomPlus2I(element) {
var tmp = 0;
for (var i = 0; i < element.name.length; i++) {
if (element.name.charAt(i) == 'i') {
tmp += 1;
}
}
return tmp >= 2;
}
document.querySelector('.pageContent').innerHTML = html2;
//# sourceMappingURL=main.js.map
\ No newline at end of file
{"version":3,"sources":["../src/main.js"],"names":["html2","data","name","base","price_small","price_large","image","euro","Intl","NumberFormat","style","currency","minimumFractionDigits","baseTomate","element","localeCompare","inf6","occI","tmp","i","length","charAt","sort","a","b","textA","textB","console","log","forEach","ShowImage","psmall","format","plarge","url","toLowerCase","html","BaseTomate","PrixMoins6","NomPlus2I","document","querySelector","innerHTML"],"mappings":";;AAAA,IAAIA,KAAK,GAAG,EAAZ;AACA,IAAIC,IAAI,GAAG,CACV;AACCC,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAE,QAFP;AAGCC,EAAAA,WAAW,EAAE,GAHd;AAICC,EAAAA,WAAW,EAAE,IAJd;AAKCC,EAAAA,KAAK,EAAE;AALR,CADU,EAQV;AACCJ,EAAAA,IAAI,EAAE,aADP;AAECC,EAAAA,IAAI,EAAE,QAFP;AAGCC,EAAAA,WAAW,EAAE,GAHd;AAICC,EAAAA,WAAW,EAAE,IAJd;AAKCC,EAAAA,KAAK,EAAE;AALR,CARU,EAeV;AACCJ,EAAAA,IAAI,EAAE,OADP;AAECC,EAAAA,IAAI,EAAE,OAFP;AAGCC,EAAAA,WAAW,EAAE,GAHd;AAICC,EAAAA,WAAW,EAAE,CAJd;AAKCC,EAAAA,KAAK,EAAE;AALR,CAfU,CAAX;AAwBA,IAAMC,IAAI,GAAG,IAAIC,IAAI,CAACC,YAAT,CAAsB,OAAtB,EAA+B;AACxCC,EAAAA,KAAK,EAAE,UADiC;AAExCC,EAAAA,QAAQ,EAAE,KAF8B;AAGxCC,EAAAA,qBAAqB,EAAE;AAHiB,CAA/B,CAAb;;AAMA,SAASC,UAAT,CAAoBC,OAAp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tprice_small: 6.5,\n\t\tprice_large: 9.95,\n\t\timage: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'\n\t},\n\t{\n\t\tname: 'Napolitaine',\n\t\tbase: 'tomate',\n\t\tprice_small: 6.5,\n\t\tprice_large: 8.95,\n\t\timage: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'\n\t},\n\t{\n\t\tname: 'Spicy',\n\t\tbase: 'crème',\n\t\tprice_small: 5.5,\n\t\tprice_large: 8,\n\t\timage: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300',\n\t}\n];\n\nconst euro = new Intl.NumberFormat('fr-FR', {\n style: 'currency',\n currency: 'EUR',\n minimumFractionDigits: 2\n});\n\nfunction baseTomate(element){\n return element.base.localeCompare('tomate')==0;\n}\nfunction inf6(element){\n return element.price_small<6;\n}\nfunction occI(element){\n let tmp = 0;\n for(let i = 0; i < element.name.length; i++){\n if(element.name.charAt(i)=='i'){\n tmp +=1;\n }\n }\n return tmp >= 2;\n}\n\ndata.sort(function(a, b) {\n //var textA = a.name.toUpperCase();\n //var textB = b.name.toUpperCase();\n var textA = a.price_small;\n var textB = b.price_small;\n if(textA-textB==0){\n textA=a.price_large;\n textB=b.price_large;\n }\n return (textA-textB);\n});\n\nconsole.log(data);\n//data = data.filter(occI);\ndata.forEach(ShowImage);\nfunction ShowImage(element){\n let psmall = euro.format(element.price_small);\n let plarge = euro.format(element.price_large);\n const url = 'images/'+element.name.toLowerCase()+'.jpg';\n const html = '<article class=\"pizzaThumbnail\">\\n' +\n '<a href=\"'+element.image+'\">' +\n '<img src=\"'+element.image+'\"/>' +\n '<section>' +\n '<h4>'+element.name+'</h4>' +\n '<ul>' +\n '<li>Prix petit format : '+psmall+'</li>'+\n '<li>Prix grand format : '+plarge+'</li>'+\n '</ul>'+\n '</section>'+\n '</a>'+\n '</article>'; \n console.log(url);\n console.log(html);\n html2 += html;\n}\nfunction BaseTomate(element){\n return element.base.localeCompare('tomate')==0;\n}\nfunction PrixMoins6(element){\n return element.price_small < 6;\n}\nfunction NomPlus2I(element){\n let tmp = 0;\n for(let i = 0; i < element.name.length; i++){\n if(element.name.charAt(i)=='i'){\n tmp +=1;\n }\n }\n return tmp >= 2;\n}\n\ndocument.querySelector('.pageContent').innerHTML = html2;\n"],"file":"main.js"}
\ No newline at end of file
......@@ -37,5 +37,6 @@
<div>Free photos from <a href="https://unsplash.com/unsplash">Unsplash</a></div>
<div>Icons made by <a href="https://www.freepik.com/" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
</footer>
<script src="build/main.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
{
"name": "pizzaland",
"version": "1.0.0",
"description": "<img src=\"images/readme/header.jpg\">",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitlab.univ-lille.fr/matthieu.vannin.etu/tp1.git"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11"
}
}
console.log('Welcome to PizzaLand 🍕 !');
\ No newline at end of file
let html2 = "";
let data = [
{
name: 'Regina',
base: 'tomate',
price_small: 6.5,
price_large: 9.95,
image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
},
{
name: 'Napolitaine',
base: 'tomate',
price_small: 6.5,
price_large: 8.95,
image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'
},
{
name: 'Spicy',
base: 'crème',
price_small: 5.5,
price_large: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300',
}
];
const euro = new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 2
});
function baseTomate(element){
return element.base.localeCompare('tomate')==0;
}
function inf6(element){
return element.price_small<6;
}
function occI(element){
let tmp = 0;
for(let i = 0; i < element.name.length; i++){
if(element.name.charAt(i)=='i'){
tmp +=1;
}
}
return tmp >= 2;
}
data.sort(function(a, b) {
//var textA = a.name.toUpperCase();
//var textB = b.name.toUpperCase();
var textA = a.price_small;
var textB = b.price_small;
if(textA-textB==0){
textA=a.price_large;
textB=b.price_large;
}
return (textA-textB);
});
console.log(data);
//data = data.filter(occI);
data.forEach(ShowImage);
function ShowImage(element){
let psmall = euro.format(element.price_small);
let plarge = euro.format(element.price_large);
const url = 'images/'+element.name.toLowerCase()+'.jpg';
const html = '<article class="pizzaThumbnail">\n' +
'<a href="'+element.image+'">' +
'<img src="'+element.image+'"/>' +
'<section>' +
'<h4>'+element.name+'</h4>' +
'<ul>' +
'<li>Prix petit format : '+psmall+'</li>'+
'<li>Prix grand format : '+plarge+'</li>'+
'</ul>'+
'</section>'+
'</a>'+
'</article>';
console.log(url);
console.log(html);
html2 += html;
}
function BaseTomate(element){
return element.base.localeCompare('tomate')==0;
}
function PrixMoins6(element){
return element.price_small < 6;
}
function NomPlus2I(element){
let tmp = 0;
for(let i = 0; i < element.name.length; i++){
if(element.name.charAt(i)=='i'){
tmp +=1;
}
}
return tmp >= 2;
}
document.querySelector('.pageContent').innerHTML = html2;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment