Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random color generator tushar raval #1108

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions 1Application-frontend/package-lock.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TusharRaval
Please specify the changes being done, here.
Unable to view the file while reviewing it.
@NitkarshChourasia
Thank you.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added MusicPlayer/README.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the README.md of the repository, carefully. Especially the Important tagged points.
This time it's an exception. Neglecting the execution of fifth point.
But 6th Point is crucially compulsory for every project.
image

Empty file.
Binary file added MusicPlayer/Screenshot (40).png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embed into README.md of the project.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MusicPlayer/Screenshot (41).png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embed into README.md of the project.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions MusicPlayer/akash0708/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mp3/Video Player</title>
</head>
<script src="style.css"></script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<!-- Linking the stylesheet. -->
<link rel="stylesheet" href="style.css">

<body>

<div class="player">
<video id="myVideo" preload width="640" height="360">
<source src="https://mainline.i3s.unice.fr/mooc/mi5.mp4" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use non-copyright material, please.

</video>
<div>
<button type="button" id="pl">Play</button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a formatter before saving and pushing.

<button type="button" id="pr">Previous</button>
<input id="slide" type="range" value="0" />
<button type="button" id="nx">Next</button>
<button type="button"> <span id="volDown">- &nbsp; </span>Vol<span id="volUp"> &nbsp; +</span></button>
</div>
<div class="thumbs">
<img id="vid1" src="https://i.imgur.com/y6RTkIi.gif" width="128" height="72" alt="video 1">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using local assets can improve performance by reducing reliance

<img id="vid2" src="https://i.imgur.com/MUG6cex.gif" width="128" height="72" alt="video 2">
<img id="vid3" src="https://i.imgur.com/Ey7oJdj.gif" width="128" height="72" alt="video 3">
</div>
</div>

</div>
<script src="script.js"></script>
</body>

</html>
Empty file added MusicPlayer/images
Empty file.
124 changes: 124 additions & 0 deletions MusicPlayer/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
var myVid = document.getElementById("myVideo");
var pl = document.getElementById("pl");
var pr = document.getElementById("pr");
var seek = document.getElementById("slide");
var nx = document.getElementById("nx");
var volDown = document.getElementById("volDown");
var volUp = document.getElementById("volUp");
var vid1 = document.getElementById("vid1");
var vid2 = document.getElementById("vid2");
var vid3 = document.getElementById("vid3");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Video sources

var sources = ["https://mainline.i3s.unice.fr/mooc/mi5.mp4",
"https://mainline.i3s.unice.fr/mooc/ff7.mp4",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use non-copyright material only.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use assets folder and input the img and videos files there.

"https://mainline.i3s.unice.fr/mooc/jbs.mp4"];

var num = 0;
myVid.src = sources[num];
myVid.volume = 0.5;

// start playing
function cinema() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use here, instead use at the first line.
with a name like
function initializePlayer() {
// Get elements
// Your code

function playPause() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Event handlers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these functions will be nested under
'function initializePlayer() {
}
'

if (myVid.paused === true) {
myVid.play();
pl.innerHTML = "Pause";
} else {
myVid.pause();
pl.innerHTML = "Play";
}
}

function prevVid() {
if (num === 0) {
num = 0;
} else {
num--;
seek.value = 0;
myVid.src = sources[num];
myVid.play();
}
}

function vidSeek() {
var vidTime = myVid.duration * (seek.value / 100);
myVid.currentTime = vidTime;
}

function vidTime() {
var nt = myVid.currentTime * (100 / myVid.duration);
seek.value = nt;
}

function nextVid() {
if (num === 2) {
if (seek.value < 100) {
num = 2;
} else {
num = 0;
myVid.src = sources[num];
seek.value = 0;
myVid.pause();
pl.innerHTML = "Play";
}
} else {
num++;
seek.value = 0;
myVid.src = sources[num];
myVid.play();
}
}

function volChangeDown() {
if (myVid.volume > 0) {
myVid.volume -= 0.1;
}
}

function volChangeUp() {
if (myVid.volume < 1) {
myVid.volume += 0.1;
}
}

function vidChoice1() {
num = 0;
myVid.src = sources[num];
playPause();
}

function vidChoice2() {
num = 1;
myVid.src = sources[num];
playPause();
}

function vidChoice3() {
num = 2;
myVid.src = sources[num];
playPause();
}

// Add all event listeners
pl.addEventListener("click", playPause, false);
pr.addEventListener("click", prevVid, false);
seek.addEventListener("mousedown", function () {
myVid.pause();
pl.innerHTML = "Play";
});
seek.addEventListener("mouseup", function () {
myVid.play();
pl.innerHTML = "Pause";
});
seek.addEventListener("input", vidSeek, false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding comments to explain complex logic.

myVid.addEventListener("timeupdate", vidTime, false);
myVid.addEventListener("ended", nextVid, false);
nx.addEventListener("click", nextVid, false);
volDown.addEventListener("mousedown", volChangeDown, false);
volUp.addEventListener("mousedown", volChangeUp, false);
vid1.addEventListener("click", vidChoice1);
vid2.addEventListener("click", vidChoice2);
vid3.addEventListener("click", vidChoice3);
}

cinema();
102 changes: 102 additions & 0 deletions MusicPlayer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

.player {
background: #000;
margin: 0 auto;
max-width: 640px;
overflow: hidden;
width: 95%;
}

.player button {
background-color: #004080;
border: none;
color: #D3D3D3;
float: left;
font-size: 100%;
height: 1.75em;
margin: 0;
overflow: hidden;
padding: 0;
white-space: nowrap;
width: 15%;
}

.player button:hover,
.player input:hover {
background-color: #00509F;
color: #fff;
cursor: pointer;
}

.player input {

background-color: #004080;
border: none;
color: #D3D3D3;
float: left;
height: 1.5em;
margin: 0;
padding: 0;
width: 40%;
}

.player input[type=range]::-ms-track {
background: transparent;
border-color: transparent;
color: transparent;
cursor: pointer;
width: 100%;
}

.player input[type=range]::-webkit-slider-thumb {

-webkit-appearance: none;
background: #00509F;
border: 1px solid #D3D3D3;
box-sizing: border-box;
height: 1.5em;
width: 1em;
}

.player video {
background: #000;
border: 1px solid #000;
box-sizing: border-box;
height: 100%;
margin: 10% auto;
max-width: 640px;
width: 100%;
}



.signup span {
margin-left: .2em;
width: 20%;
}

.thumbs {
background-color: darkgrey;
border: 1px solid #000;
box-sizing: border-box;
overflow: hidden;
width: 100%;
}

.thumbs img {
height: 100%;
margin: 2%;
max-width: 128px;
width: 20%;
}

.thumbs img:hover {
border: 1px solid #FFF;
cursor: pointer;
}


img {
border: 1px solid #000;
box-sizing: border-box;
}
21 changes: 21 additions & 0 deletions Random-Color-Generator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the title to appropriate project name.

</head>
<link rel="stylesheet" href="style.css">
<body>
<h1>Random color generator</h1>

<div class="container">
<div>
<input type="color" id="color">
<h4 id="text">#000000</h4>
<p>click to change color</p>
</div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TusharRaval
No README.md provided. No screenshots attached.
No live link to it.
A very laid back approach to submission. Next time it will be completely rejected. Beware!
@NitkarshChourasia

<script src="script.js"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions Random-Color-Generator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

function randomInteger(max) {
return Math.floor(Math.random()*(max + 1));
}

function randomRgbColor() {
let r = randomInteger(255);
let g = randomInteger(255);
let b = randomInteger(255);
return [r,g,b];
}

function randomHexColor() {
let [r,g,b] =randomRgbColor();

let hr = r.toString(16).padStart(2, '0');
let hg = g.toString(16).padStart(2, '0');
let hb = b.toString(16).padStart(2, '0');

return "#" + hr + hg + hb;
}

function changeColor() {
let hex = randomHexColor();
document.getElementById('color').value = hex;
document.getElementById('text').innerHTML = hex;
}

function clickHandler(event) {
changeColor();
event.preventDefault();
}

document.addEventListener('click', clickHandler);

changeColor();
18 changes: 18 additions & 0 deletions Random-Color-Generator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#color {
width: 50rem;
height: 30rem;
}


h4, h5, p {
font-family: sans-serif;
text-align: center;
}

.container {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
1 change: 1 addition & 0 deletions javascript-mini-projects
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you made this project?
Are you plagiarizing it?

Submodule javascript-mini-projects added at 07d855