KingNish smolSWE commited on
Commit
cc0a382
·
verified ·
1 Parent(s): c49a8ad

Initial Google clone implementation (#17)

Browse files

- Initial Google clone implementation (6f102b52ce122160ebed64cc489b6b374bf8d874)
- Update README.md (359cb6a29e666096bec136c635f755a156eb9c19)


Co-authored-by: smolSWE Bot <smolSWE@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +0 -35
  2. .gitignore +0 -6
  3. index.html +10 -57
  4. script.js +56 -16
  5. style.css +37 -130
.gitattributes CHANGED
@@ -1,35 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore CHANGED
@@ -1,6 +0,0 @@
1
- *.env
2
- *.__pycache__
3
- *.pyc
4
- *.pyo
5
- *.exe
6
- .venv
 
 
 
 
 
 
 
index.html CHANGED
@@ -1,64 +1,17 @@
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
- <title>Netflix Clone</title>
5
- <link rel="stylesheet" href="style.css">
6
  </head>
7
  <body>
8
- <nav class="navbar">
9
- <div class="navbar-logo">
10
- <img src="https://upload.wikimedia.org/wikipedia/commons/0/08/Netflix_2015_logo.svg" alt="Netflix Logo">
11
- </div>
12
- <ul class="navbar-menu">
13
- <li><a href="#">Home</a></li>
14
- <li><a href="#">TV Shows</a></li>
15
- <li><a href="#">Movies</a></li>
16
- <li><a href="#">My List</a></li>
17
- </ul>
18
- </nav>
19
 
20
- <section class="hero">
21
- <div class="hero-content">
22
- <h1>Movie Title</h1>
23
- <p>A brief description of the movie.</p>
24
- <div class="hero-buttons">
25
- <button>Play</button>
26
- <button>More Info</button>
27
- </div>
28
- </div>
29
- </section>
30
-
31
- <main class="container">
32
- <div class="movie-row">
33
- <h2>Trending Now</h2>
34
- <div class="movie-posters">
35
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
36
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
37
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
38
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
39
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
40
- </div>
41
- </div>
42
-
43
- <div class="movie-row">
44
- <h2>Top Picks for You</h2>
45
- <div class="movie-posters">
46
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
47
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
48
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
49
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
50
- <img src="https://via.placeholder.com/150x200" alt="Movie Poster">
51
- </div>
52
- </div>
53
- </main>
54
-
55
- <footer class="footer">
56
- <p>&copy; 2024 Netflix Clone</p>
57
- <ul>
58
- <li><a href="#">Terms of Use</a></li>
59
- <li><a href="#">Privacy Policy</a></li>
60
- </ul>
61
- </footer>
62
- <script src="script.js"></script>
63
  </body>
64
- </html>
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
+ <title>Google Clone</title>
5
+ <link rel="stylesheet" href="style.css">
6
  </head>
7
  <body>
8
+ <div class="search-container">
9
+ <input type="text" id="search-input" placeholder="Search Google">
10
+ <div id="suggestions"></div>
11
+ </div>
12
+ <div id="results-container">
13
+ </div>
 
 
 
 
 
14
 
15
+ <script src="script.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  </body>
17
+ </html>
script.js CHANGED
@@ -1,22 +1,62 @@
 
 
 
1
 
2
- // Function to display a movie trailer (placeholder)
3
- function showTrailer() {
4
- alert('Trailer is not available yet.');
5
- }
 
 
 
6
 
7
- // Function to add a movie to My List (placeholder)
8
- function addToMyList() {
9
- alert('Added to My List!');
10
- }
 
11
 
12
- // Add event listeners to movie posters
13
- const moviePosters = document.querySelectorAll('.movie-posters img');
14
- moviePosters.forEach(poster => {
15
- poster.addEventListener('click', showTrailer);
16
  });
17
 
18
- // Add event listener to the "More Info" button (placeholder)
19
- const moreInfoButton = document.querySelector('.hero-buttons button:last-child');
20
- moreInfoButton.addEventListener('click', () => {
21
- alert('More info about the movie will be displayed here.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const searchInput = document.getElementById("search-input");
2
+ const suggestionsDiv = document.getElementById("suggestions");
3
+ const resultsContainer = document.getElementById("results-container");
4
 
5
+ const dummySuggestions = [
6
+ "what is javascript",
7
+ "how to make a website",
8
+ "best restaurants near me",
9
+ "weather today",
10
+ "current news"
11
+ ];
12
 
13
+ searchInput.addEventListener("input", function() {
14
+ const inputValue = searchInput.value.toLowerCase();
15
+ const filteredSuggestions = dummySuggestions.filter(suggestion =>
16
+ suggestion.toLowerCase().startsWith(inputValue)
17
+ );
18
 
19
+ displaySuggestions(filteredSuggestions);
 
 
 
20
  });
21
 
22
+ function displaySuggestions(suggestions) {
23
+ suggestionsDiv.innerHTML = "";
24
+ if (suggestions.length > 0 && searchInput.value) {
25
+ suggestions.forEach(suggestion => {
26
+ const suggestionElement = document.createElement("div");
27
+ suggestionElement.textContent = suggestion;
28
+ suggestionElement.addEventListener("click", function() {
29
+ searchInput.value = suggestion;
30
+ suggestionsDiv.style.display = "none";
31
+ displayResults(suggestion);
32
+ });
33
+ suggestionsDiv.appendChild(suggestionElement);
34
+ });
35
+ suggestionsDiv.style.display = "block";
36
+ } else {
37
+ suggestionsDiv.style.display = "none";
38
+ }
39
+ }
40
+
41
+ searchInput.addEventListener("keydown", function(event) {
42
+ if (event.key === "Enter") {
43
+ const inputValue = searchInput.value;
44
+ displayResults(inputValue);
45
+ suggestionsDiv.style.display = "none";
46
+ }
47
  });
48
+
49
+ function displayResults(query) {
50
+ resultsContainer.innerHTML = "";
51
+ const dummyResults = [
52
+ `Result 1 for ${query}`,
53
+ `Result 2 for ${query}`,
54
+ `Result 3 for ${query}`
55
+ ];
56
+
57
+ dummyResults.forEach(result => {
58
+ const resultElement = document.createElement("div");
59
+ resultElement.textContent = result;
60
+ resultsContainer.appendChild(resultElement);
61
+ });
62
+ }
style.css CHANGED
@@ -1,143 +1,50 @@
1
-
2
  body {
3
- font-family: sans-serif;
4
- background-color: #000;
5
- color: #fff;
6
- margin: 0;
7
- }
8
-
9
- .navbar {
10
- background-color: #000;
11
- padding: 10px 20px;
12
- display: flex;
13
- justify-content: space-between;
14
- align-items: center;
15
- }
16
-
17
- .navbar-logo img {
18
- width: 100px;
19
- }
20
-
21
- .navbar-menu {
22
- list-style: none;
23
- display: flex;
24
- padding: 0;
25
- }
26
-
27
- .navbar-menu li {
28
- margin-left: 20px;
29
- }
30
-
31
- .navbar-menu li a {
32
- color: #fff;
33
- text-decoration: none;
34
- }
35
-
36
- .hero {
37
- background-image: url('https://via.placeholder.com/1920x1080');
38
- background-size: cover;
39
- background-position: center;
40
- height: 500px;
41
- display: flex;
42
- align-items: center;
43
- padding: 0 20px;
44
- }
45
-
46
- .hero-content {
47
- max-width: 600px;
48
- }
49
-
50
- .hero-content h1 {
51
- font-size: 3em;
52
- margin-bottom: 20px;
53
  }
54
 
55
- .hero-content p {
56
- font-size: 1.2em;
57
- margin-bottom: 30px;
58
  }
59
 
60
- .hero-buttons button {
61
- background-color: rgba(0, 0, 0, 0.5);
62
- color: #fff;
63
- border: none;
64
- padding: 10px 20px;
65
- margin-right: 10px;
66
- font-size: 1.1em;
67
- cursor: pointer;
68
  }
69
 
70
- .container {
71
- padding: 20px;
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
- .movie-row {
75
- margin-bottom: 30px;
 
76
  }
77
 
78
- .movie-posters {
79
- display: flex;
80
- overflow-x: auto;
81
  }
82
 
83
- .movie-posters img {
84
- margin-right: 10px;
85
- width: 150px;
86
- height: 200px;
87
- }
88
-
89
- .footer {
90
- background-color: #222;
91
- padding: 20px;
92
- text-align: center;
93
- }
94
-
95
- .footer ul {
96
- list-style: none;
97
- padding: 0;
98
- display: flex;
99
- justify-content: center;
100
- }
101
-
102
- .footer li {
103
- margin: 0 10px;
104
- }
105
-
106
- .footer li a {
107
- color: #fff;
108
- text-decoration: none;
109
- }
110
-
111
- /* Responsive Design */
112
- @media (max-width: 768px) {
113
- .navbar {
114
- flex-direction: column;
115
- align-items: flex-start;
116
- }
117
-
118
- .navbar-menu {
119
- margin-top: 10px;
120
- flex-direction: column;
121
- }
122
-
123
- .navbar-menu li {
124
- margin-left: 0;
125
- margin-bottom: 10px;
126
- }
127
-
128
- .hero {
129
- height: 400px;
130
- }
131
-
132
- .hero-content {
133
- max-width: 100%;
134
- }
135
-
136
- .hero-content h1 {
137
- font-size: 2em;
138
- }
139
-
140
- .hero-content p {
141
- font-size: 1em;
142
- }
143
- }
 
 
1
  body {
2
+ font-family: Arial, sans-serif;
3
+ margin: 0;
4
+ padding: 0;
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
+ .search-container {
11
+ margin-top: 100px;
12
+ position: relative;
13
  }
14
 
15
+ #search-input {
16
+ width: 500px;
17
+ padding: 12px 20px;
18
+ font-size: 16px;
19
+ border: 1px solid #ccc;
20
+ border-radius: 24px;
21
+ outline: none;
 
22
  }
23
 
24
+ #suggestions {
25
+ position: absolute;
26
+ top: 100%;
27
+ left: 0;
28
+ width: 500px;
29
+ background-color: #fff;
30
+ border: 1px solid #ccc;
31
+ border-top: none;
32
+ border-radius: 0 0 8px 8px;
33
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
34
+ display: none;
35
+ z-index: 1;
36
  }
37
 
38
+ #suggestions div {
39
+ padding: 8px 16px;
40
+ cursor: pointer;
41
  }
42
 
43
+ #suggestions div:hover {
44
+ background-color: #f0f0f0;
 
45
  }
46
 
47
+ #results-container {
48
+ margin-top: 20px;
49
+ width: 600px;
50
+ }