Skip to content
Snippets Groups Projects
Commit 97dbdc14 authored by Felicien Delannoy's avatar Felicien Delannoy
Browse files

tpFini

parent 8cd29c1a
Branches master
No related tags found
No related merge requests found
{
"presets": ["@babel/env"]
}
"use strict";
//variable
var name = 'Regina';
var url;
var html = "";
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'
}]; //fonctions de sort
var sortName = function sortName(a, b) {
if (a.name < b.name) {
return -1;
} else return 1;
};
var sortLowPrice = function sortLowPrice(a, b) {
if (a.price_small < b.price_small) {
return -1;
} else if (a.price_small == b.price_small) {
return sortHighPrice(a, b);
} else return 1;
};
var sortHighPrice = function sortHighPrice(a, b) {
if (a.price_large < b.price_large) {
return -1;
} else return 1;
}; //fonction pour les filtres
var isBaseTomate = function isBaseTomate(a) {
return a.base == "tomate";
};
var doubleI = function doubleI(a) {
var reponse = 0;
for (var index = 0; index < a.name.length; index++) {
var element = a.name[index];
if (element == "i") {
reponse++;
}
}
return reponse == 2;
}; //application des fonctions
data.sort(sortName);
data.sort(sortLowPrice);
var dataFilterBase = data.filter(isBaseTomate);
var dataFilterPrix = data.filter(function (element) {
return element.price_small < 6;
});
var dataFilterI = data.filter(doubleI); //affichage
data.forEach(function (element) {
var name = element.name,
base = element.base,
price_small = element.price_small,
price_large = element.price_large,
image = element.image;
html += "<article class=\"pizzaThumbnail\">\n <a href=\"".concat(image, "\">\n <img src=\"").concat(image, "\"/>\n <section><h4>").concat(name, "</h4>\n <ul>\n <li> Prix petit format : ").concat(price_small, " \u20AC </li> \n <li> Prix grand format : ").concat(price_large, " \u20AC </li> \n </ul> \n </section>\n </a>\n</article>");
});
console.log(html);
document.querySelector('.pageContent').innerHTML = html;
//# sourceMappingURL=main.js.map
\ No newline at end of file
{"version":3,"sources":["../src/main.js"],"names":["name","url","html","data","base","price_small","price_large","image","sortName","a","b","sortLowPrice","sortHighPrice","isBaseTomate","doubleI","reponse","index","length","element","sort","dataFilterBase","filter","dataFilterPrix","dataFilterI","forEach","console","log","document","querySelector","innerHTML"],"mappings":"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","sourcesContent":["//variable\r\nconst name = 'Regina';\r\nlet url ;\r\nlet html = \"\";\r\n\r\nconst data = [\r\n\t{\r\n\t\tname: 'Regina',\r\n\t\tbase: 'tomate',\r\n\t\tprice_small: 6.5,\r\n\t\tprice_large: 9.95,\r\n\t\timage: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'\r\n\t},\r\n\t{\r\n\t\tname: 'Napolitaine',\r\n\t\tbase: 'tomate',\r\n\t\tprice_small: 6.5,\r\n\t\tprice_large: 8.95,\r\n\t\timage: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'\r\n\t},\r\n\t{\r\n\t\tname: 'Spicy',\r\n\t\tbase: 'crème',\r\n\t\tprice_small: 5.5,\r\n\t\tprice_large: 8,\r\n\t\timage: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300',\r\n\t}\r\n];\r\n//fonctions de sort \r\nconst sortName = function(a,b){\r\n if(a.name < b.name){\r\n return -1;\r\n }\r\n else return 1;\r\n}\r\nconst sortLowPrice = function(a,b){\r\n if(a.price_small < b.price_small){\r\n return -1;\r\n }\r\n else if(a.price_small==b.price_small){\r\n return sortHighPrice(a,b);\r\n }\r\n else return 1;\r\n}\r\n\r\nconst sortHighPrice = function(a,b){\r\n if(a.price_large < b.price_large){\r\n return -1;\r\n }\r\n else return 1;\r\n}\r\n//fonction pour les filtres \r\n\r\nconst isBaseTomate= function(a){\r\n return a.base == \"tomate\";\r\n}\r\nconst doubleI= function(a){\r\n let reponse =0 ;\r\n for (let index = 0; index < a.name.length; index++) {\r\n const element = a.name[index];\r\n if(element==\"i\"){\r\n reponse++;\r\n }\r\n \r\n }\r\n return reponse == 2;\r\n}\r\n\r\n//application des fonctions\r\ndata.sort(sortName);\r\ndata.sort(sortLowPrice);\r\nconst dataFilterBase = data.filter(isBaseTomate);\r\nconst dataFilterPrix = data.filter(element=> element.price_small< 6);\r\nconst dataFilterI = data.filter(doubleI);\r\n\r\n//affichage\r\ndata.forEach(element => {\r\n const{name,base,price_small,price_large,image} = element;\r\n html +=`<article class=\"pizzaThumbnail\">\r\n <a href=\"${image}\">\r\n <img src=\"${image}\"/>\r\n <section><h4>${name}</h4>\r\n <ul>\r\n <li> Prix petit format : ${price_small} € </li> \r\n <li> Prix grand format : ${price_large} € </li> \r\n </ul> \r\n </section>\r\n </a>\r\n</article>`;\r\n});\r\nconsole.log(html);\r\ndocument.querySelector('.pageContent').innerHTML = html;\r\n"],"file":"main.js"}
\ No newline at end of file
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
<link rel="stylesheet" href="css/news.css"> <link rel="stylesheet" href="css/news.css">
<link rel="stylesheet" href="css/pizzaList.css"> <link rel="stylesheet" href="css/pizzaList.css">
<link rel="stylesheet" href="css/footer.css"> <link rel="stylesheet" href="css/footer.css">
</head> </head>
<body> <body>
<header> <header>
...@@ -37,5 +39,6 @@ ...@@ -37,5 +39,6 @@
<div>Free photos from <a href="https://unsplash.com/unsplash">Unsplash</a></div> <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> <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> </footer>
<script src="build/main.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
@echo off
setlocal
title Install Additional Tools for Node.js
cls
echo ====================================================
echo Tools for Node.js Native Modules Installation Script
echo ====================================================
echo.
echo This script will install Python and the Visual Studio Build Tools, necessary
echo to compile Node.js native modules. Note that Chocolatey and required Windows
echo updates will also be installed.
echo.
echo This will require about 3 Gb of free disk space, plus any space necessary to
echo install Windows updates. This will take a while to run.
echo.
echo Please close all open programs for the duration of the installation. If the
echo installation fails, please ensure Windows is fully updated, reboot your
echo computer and try to run this again. This script can be found in the
echo Start menu under Node.js.
echo.
echo You can close this window to stop now. Detailed instructions to install these
echo tools manually are available at https://github.com/nodejs/node-gyp#on-windows
echo.
pause
cls
REM Adapted from https://github.com/Microsoft/windows-dev-box-setup-scripts/blob/79bbe5bdc4867088b3e074f9610932f8e4e192c2/README.md#legal
echo Using this script downloads third party software
echo ------------------------------------------------
echo This script will direct to Chocolatey to install packages. By using
echo Chocolatey to install a package, you are accepting the license for the
echo application, executable(s), or other artifacts delivered to your machine as a
echo result of a Chocolatey install. This acceptance occurs whether you know the
echo license terms or not. Read and understand the license terms of the packages
echo being installed and their dependencies prior to installation:
echo - https://chocolatey.org/packages/chocolatey
echo - https://chocolatey.org/packages/python
echo - https://chocolatey.org/packages/visualstudio2017-workload-vctools
echo.
echo This script is provided AS-IS without any warranties of any kind
echo ----------------------------------------------------------------
echo Chocolatey has implemented security safeguards in their process to help
echo protect the community from malicious or pirated software, but any use of this
echo script is at your own risk. Please read the Chocolatey's legal terms of use
echo as well as how the community repository for Chocolatey.org is maintained.
echo.
pause
cls
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1'')); choco upgrade -y python visualstudio2017-workload-vctools; Read-Host ''Type ENTER to exit'' ' -Verb RunAs
File added
<instrumentationManifest
xmlns="http://schemas.microsoft.com/win/2004/08/events"
xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<instrumentation>
<events>
<provider name="NodeJS-ETW-provider"
guid="{77754E9B-264B-4D8D-B981-E4135C1ECB0C}"
symbol="NODE_ETW_PROVIDER"
message="$(string.NodeJS-ETW-provider.name)"
resourceFileName="node.exe"
messageFileName="node.exe">
<tasks>
<task name="MethodRuntime" value="1"
symbol="JSCRIPT_METHOD_RUNTIME_TASK">
<opcodes>
<opcode name="MethodLoad" value="10"
symbol="JSCRIPT_METHOD_METHODLOAD_OPCODE"/>
</opcodes>
</task>
</tasks>
<opcodes>
<opcode name="NODE_HTTP_SERVER_REQUEST" value="10"/>
<opcode name="NODE_HTTP_SERVER_RESPONSE" value="11"/>
<opcode name="NODE_HTTP_CLIENT_REQUEST" value="12"/>
<opcode name="NODE_HTTP_CLIENT_RESPONSE" value="13"/>
<opcode name="NODE_NET_SERVER_CONNECTION" value="14"/>
<opcode name="NODE_NET_STREAM_END" value="15"/>
<opcode name="NODE_GC_START" value="16"/>
<opcode name="NODE_GC_DONE" value="17"/>
<opcode name="NODE_V8SYMBOL_REMOVE" value="21"/>
<opcode name="NODE_V8SYMBOL_MOVE" value="22"/>
<opcode name="NODE_V8SYMBOL_RESET" value="23"/>
</opcodes>
<templates>
<template tid="node_connection">
<data name="fd" inType="win:UInt32" />
<data name="port" inType="win:UInt32" />
<data name="remote" inType="win:AnsiString" />
<data name="buffered" inType="win:UInt32" />
</template>
<template tid="node_http_client_request">
<data name="url" inType="win:AnsiString" />
<data name="method" inType="win:AnsiString" />
<data name="fd" inType="win:UInt32" />
<data name="port" inType="win:UInt32" />
<data name="remote" inType="win:AnsiString" />
<data name="buffered" inType="win:UInt32" />
</template>
<template tid="node_http_server_request">
<data name="url" inType="win:AnsiString" />
<data name="method" inType="win:AnsiString" />
<data name="forwardedFor" inType="win:AnsiString" />
<data name="fd" inType="win:UInt32" />
<data name="port" inType="win:UInt32" />
<data name="remote" inType="win:AnsiString" />
<data name="buffered" inType="win:UInt32" />
</template>
<template tid="node_gc">
<data name="gctype" inType="win:UInt32" />
<data name="gccallbackflags" inType="win:UInt32" />
</template>
<template tid="V8AddressChange">
<data name="addr1" inType="win:Pointer" outType="win:HexInt64"/>
<data name="addr2" inType="win:Pointer" outType="win:HexInt64"/>
</template>
<template tid="MethodLoadUnload">
<data name="ScriptContextID" inType="win:Pointer" outType="win:HexInt64"/>
<data name="MethodStartAddress" inType="win:Pointer" outType="win:HexInt64" />
<data name="MethodSize" inType="win:UInt64" />
<data name="MethodID" inType="win:UInt32" />
<data name="MethodFlags" inType="win:UInt16" />
<data name="MethodAddressRangeID" inType="win:UInt16" />
<data name="SourceID" inType="win:UInt64" />
<data name="Line" inType="win:UInt32" outType="xs:unsignedInt" />
<data name="Column" inType="win:UInt32" outType="xs:unsignedInt" />
<data name="MethodName" inType="win:UnicodeString" outType="xs:string" />
</template>
</templates>
<events>
<event value="1"
opcode="NODE_HTTP_SERVER_REQUEST"
template="node_http_server_request"
symbol="NODE_HTTP_SERVER_REQUEST_EVENT"
message="$(string.NodeJS-ETW-provider.event.1.message)"
level="win:Informational"/>
<event value="2"
opcode="NODE_HTTP_SERVER_RESPONSE"
template="node_connection"
symbol="NODE_HTTP_SERVER_RESPONSE_EVENT"
message="$(string.NodeJS-ETW-provider.event.2.message)"
level="win:Informational"/>
<event value="3"
opcode="NODE_HTTP_CLIENT_REQUEST"
template="node_http_client_request"
symbol="NODE_HTTP_CLIENT_REQUEST_EVENT"
message="$(string.NodeJS-ETW-provider.event.3.message)"
level="win:Informational"/>
<event value="4"
opcode="NODE_HTTP_CLIENT_RESPONSE"
template="node_connection"
symbol="NODE_HTTP_CLIENT_RESPONSE_EVENT"
message="$(string.NodeJS-ETW-provider.event.4.message)"
level="win:Informational"/>
<event value="5"
opcode="NODE_NET_SERVER_CONNECTION"
template="node_connection"
symbol="NODE_NET_SERVER_CONNECTION_EVENT"
message="$(string.NodeJS-ETW-provider.event.5.message)"
level="win:Informational"/>
<event value="6"
opcode="NODE_NET_STREAM_END"
template="node_connection"
symbol="NODE_NET_STREAM_END_EVENT"
message="$(string.NodeJS-ETW-provider.event.6.message)"
level="win:Informational"/>
<event value="7"
opcode="NODE_GC_START"
template="node_gc"
symbol="NODE_GC_START_EVENT"
message="$(string.NodeJS-ETW-provider.event.7.message)"
level="win:Informational"/>
<event value="8"
opcode="NODE_GC_DONE"
template="node_gc"
symbol="NODE_GC_DONE_EVENT"
message="$(string.NodeJS-ETW-provider.event.8.message)"
level="win:Informational"/>
<event value="9"
level="win:Informational"
opcode="MethodLoad"
symbol="MethodLoad"
message="$(string.NodeJS-ETW-provider.event.9.message)"
task="MethodRuntime"
template="MethodLoadUnload"/>
<event value="21"
opcode="NODE_V8SYMBOL_REMOVE"
template="V8AddressChange"
symbol="NODE_V8SYMBOL_REMOVE_EVENT"
message="$(string.NodeJS-ETW-provider.event.21.message)"
level="win:Informational" />
<event value="22"
opcode="NODE_V8SYMBOL_MOVE"
template="V8AddressChange"
symbol="NODE_V8SYMBOL_MOVE_EVENT"
message="$(string.NodeJS-ETW-provider.event.22.message)"
level="win:Informational" />
<event value="23"
opcode="NODE_V8SYMBOL_RESET"
symbol="NODE_V8SYMBOL_RESET_EVENT"
message="$(string.NodeJS-ETW-provider.event.23.message)"
level="win:Informational" />
</events>
</provider>
</events>
</instrumentation>
<localization>
<resources culture="en-US">
<stringTable>
<string id="NodeJS-ETW-provider.name" value="Node.js ETW Provider"/>
<string id="NodeJS-ETW-provider.event.1.message" value="Node.js HTTP Server Request%nMethod: %2%nRemote: %6%nPort: %5%nURL: %1"/>
<string id="NodeJS-ETW-provider.event.2.message" value="Node.js HTTP Server Response%nRemote: %3%nPort: %2"/>
<string id="NodeJS-ETW-provider.event.3.message" value="Node.js HTTP Client Request%nMethod: %2%nRemote: %5%nPort: %4%nURL: %1"/>
<string id="NodeJS-ETW-provider.event.4.message" value="Node.js HTTP Client Response%nRemote: %3%nPort: %2"/>
<string id="NodeJS-ETW-provider.event.5.message" value="Node.js Net Server Connection%nRemote: %3%nPort: %2"/>
<string id="NodeJS-ETW-provider.event.6.message" value="Node.js Net Stream End%nRemote: %3%nPort: %2"/>
<string id="NodeJS-ETW-provider.event.7.message" value="Node.js Garbage Collection Start"/>
<string id="NodeJS-ETW-provider.event.8.message" value="Node.js Garbage Collection Done"/>
<string id="NodeJS-ETW-provider.event.9.message" value="Node.js Function Compiled: %10"/>
<string id="NodeJS-ETW-provider.event.21.message" value="Node.js V8 Symbol Remove"/>
<string id="NodeJS-ETW-provider.event.22.message" value="Node.js V8 Symbol Move"/>
<string id="NodeJS-ETW-provider.event.23.message" value="Node.js V8 Symbol Reset"/>
</stringTable>
</resources>
</localization>
</instrumentationManifest>
@echo off
rem Ensure this Node.js and npm are first in the PATH
set "PATH=%APPDATA%\npm;%~dp0;%PATH%"
setlocal enabledelayedexpansion
pushd "%~dp0"
rem Figure out the Node.js version.
set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'"
for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v
rem Print message.
if exist npm.cmd (
echo Your environment has been set up for using Node.js !version! and npm.
) else (
echo Your environment has been set up for using Node.js !version!.
)
popd
endlocal
rem If we're in the Node.js directory, change to the user's home dir.
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%"
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/felicien.delannoy.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 🍕 !'); //variable
\ No newline at end of file const name = 'Regina';
let url ;
let html = "";
const 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',
}
];
//fonctions de sort
const sortName = function(a,b){
if(a.name < b.name){
return -1;
}
else return 1;
}
const sortLowPrice = function(a,b){
if(a.price_small < b.price_small){
return -1;
}
else if(a.price_small==b.price_small){
return sortHighPrice(a,b);
}
else return 1;
}
const sortHighPrice = function(a,b){
if(a.price_large < b.price_large){
return -1;
}
else return 1;
}
//fonction pour les filtres
const isBaseTomate= function(a){
return a.base == "tomate";
}
const doubleI= function(a){
let reponse =0 ;
for (let index = 0; index < a.name.length; index++) {
const element = a.name[index];
if(element=="i"){
reponse++;
}
}
return reponse == 2;
}
//application des fonctions
data.sort(sortName);
data.sort(sortLowPrice);
const dataFilterBase = data.filter(isBaseTomate);
const dataFilterPrix = data.filter(element=> element.price_small< 6);
const dataFilterI = data.filter(doubleI);
//affichage
data.forEach(element => {
const{name,base,price_small,price_large,image} = element;
html +=`<article class="pizzaThumbnail">
<a href="${image}">
<img src="${image}"/>
<section><h4>${name}</h4>
<ul>
<li> Prix petit format : ${price_small} € </li>
<li> Prix grand format : ${price_large} € </li>
</ul>
</section>
</a>
</article>`;
});
console.log(html);
document.querySelector('.pageContent').innerHTML = html;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment