Skip to content

Commit 5c1a9a6

Browse files
MpastoreGerupastoremetal
authored andcommitted
webpack added
1 parent fc5f0eb commit 5c1a9a6

File tree

9 files changed

+10976
-2
lines changed

9 files changed

+10976
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import "./main.css";
2+
import emojiItems from "./data";
3+
14
// Create a variable for the container to hold the emoji cards.
25
const emojiCardContainer = document.querySelector("#books");
36

data.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ const emojiItems = [
8080
year: 1926
8181
}
8282
]
83+
84+
export default emojiItems;
85+
86+
87+

dist/app.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
/******/
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
/******/
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId]) {
10+
/******/ return installedModules[moduleId].exports;
11+
/******/ }
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ i: moduleId,
15+
/******/ l: false,
16+
/******/ exports: {}
17+
/******/ };
18+
/******/
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
/******/
22+
/******/ // Flag the module as loaded
23+
/******/ module.l = true;
24+
/******/
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
/******/
29+
/******/
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
/******/
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
/******/
36+
/******/ // define getter function for harmony exports
37+
/******/ __webpack_require__.d = function(exports, name, getter) {
38+
/******/ if(!__webpack_require__.o(exports, name)) {
39+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40+
/******/ }
41+
/******/ };
42+
/******/
43+
/******/ // define __esModule on exports
44+
/******/ __webpack_require__.r = function(exports) {
45+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47+
/******/ }
48+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
49+
/******/ };
50+
/******/
51+
/******/ // create a fake namespace object
52+
/******/ // mode & 1: value is a module id, require it
53+
/******/ // mode & 2: merge all properties of value into the ns
54+
/******/ // mode & 4: return value when already ns object
55+
/******/ // mode & 8|1: behave like require
56+
/******/ __webpack_require__.t = function(value, mode) {
57+
/******/ if(mode & 1) value = __webpack_require__(value);
58+
/******/ if(mode & 8) return value;
59+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60+
/******/ var ns = Object.create(null);
61+
/******/ __webpack_require__.r(ns);
62+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64+
/******/ return ns;
65+
/******/ };
66+
/******/
67+
/******/ // getDefaultExport function for compatibility with non-harmony modules
68+
/******/ __webpack_require__.n = function(module) {
69+
/******/ var getter = module && module.__esModule ?
70+
/******/ function getDefault() { return module['default']; } :
71+
/******/ function getModuleExports() { return module; };
72+
/******/ __webpack_require__.d(getter, 'a', getter);
73+
/******/ return getter;
74+
/******/ };
75+
/******/
76+
/******/ // Object.prototype.hasOwnProperty.call
77+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78+
/******/
79+
/******/ // __webpack_public_path__
80+
/******/ __webpack_require__.p = "";
81+
/******/
82+
/******/
83+
/******/ // Load entry module and return exports
84+
/******/ return __webpack_require__(__webpack_require__.s = "./app.js");
85+
/******/ })
86+
/************************************************************************/
87+
/******/ ({
88+
89+
/***/ "./app.js":
90+
/*!****************!*\
91+
!*** ./app.js ***!
92+
\****************/
93+
/*! no static exports found */
94+
/***/ (function(module, exports) {
95+
96+
eval("// Create a variable for the container to hold the emoji cards.\r\nconst emojiCardContainer = document.querySelector(\"#books\");\r\n\r\n// Create a variable for the emoji cards.\r\nlet emojiCard = \"\";\r\n\r\n// Run the random order function below on the data inside data.js. This will display the cards in a random order on the page every time the page is refreshed.\r\nshuffle(emojiItems);\r\n\r\n// Loop through the data from the data.js file and insert parts of the data into HTML. On each loop, we are appending a new card with the HTML below.\r\nfor (let i in emojiItems) {\r\n emojiCard +=\r\n \"<div class='emoji-card'><div class='emoji-card-wrapper'><div class='hint-container' tabindex='0'><i class='fas fa-question-circle'></i><p class='hint'><span class='type'>\" + emojiItems[i].year +\r\n \"</span></p></div><div class='emoji-images' tabindex='0'>\" + emojiItems[i].emojiImgs +\r\n \"</div><div class='emoji-card-title hide-card'>\";\r\n\r\n emojiCard += \"<div class='title-content'><h3>\" + emojiItems[i].title +\r\n \" (\" + emojiItems[i].year + \")\" + \"</h3><div class='author-container'><h4>\" + emojiItems[i].author + \"</h4></div>\";\r\n\r\n emojiCard += \"</div></div></div></div>\";\r\n\r\n}\r\n\r\n// Append the emoji card variable, which has all of the emoji cards to the initial variable we created that was for the container to hold the cards.\r\nemojiCardContainer.innerHTML = emojiCard;\r\n\r\n// Run Twemoji to change all emojis to Twitter emojis.\r\ntwemoji.parse(document.body);\r\n\r\n// Add the count of number of shows/movies to the footer.\r\ndocument.querySelector(\"footer span\").innerHTML = emojiItems.length;\r\n\r\n// Display movies and show in a random order, the random order will refresh on page reload. This function is used above before the cards are rendered on the page.\r\nfunction shuffle(array) {\r\n let currentIndex = array.length,\r\n temporaryValue,\r\n randomIndex;\r\n\r\n while (currentIndex !== 0) {\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex -= 1;\r\n temporaryValue = array[currentIndex];\r\n array[currentIndex] = array[randomIndex];\r\n array[randomIndex] = temporaryValue;\r\n }\r\n\r\n return array;\r\n}\r\n\r\n// Expand the emoji card when clicked to reveal the song name, artist and music video link.\r\nconst toggleShowCard = elem => elem && elem.classList.toggle(\"hide-card\");\r\ndocument.querySelectorAll(\".emoji-images\").forEach(elem => {\r\n elem.addEventListener(\"click\", function (e) {\r\n toggleShowCard(e.target.closest(\".emoji-images\").nextElementSibling);\r\n });\r\n});\r\n\r\nconst showHint = elem => elem && elem.classList.add(\"hint-reveal\");\r\nconst hideHint = elem => elem && elem.classList.remove(\"hint-reveal\");\r\ndocument.querySelectorAll(\".hint-container\").forEach(elem => {\r\n // Display a hint (type ie tv, movie or musical) when hovering over the question mark.\r\n elem.addEventListener(\"mousedown\", function (e) {\r\n showHint(e.target.closest(\".hint-container\").querySelector(\".hint\"));\r\n });\r\n elem.addEventListener(\"keypress\", function (e) {\r\n showHint(e.target.querySelector(\".hint\"));\r\n });\r\n\r\n // Hide hint (type ie tv, movie or musical) when the user stops hovering over the question mark.\r\n elem.addEventListener(\"mouseleave\", function (e) {\r\n hideHint(e.target.querySelector(\".hint\"));\r\n });\r\n elem.addEventListener(\"focusout\", function (e) {\r\n hideHint(e.target.querySelector(\".hint\"));\r\n });\r\n});\r\n\r\n\n\n//# sourceURL=webpack:///./app.js?");
97+
98+
/***/ })
99+
100+
/******/ });

dist/index.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!doctype html>
2+
<html class="no-js" lang="">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7+
<title>EmojiPages</title>
8+
<meta name="description"
9+
content="A listing of books depicted through emojis.">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
12+
integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
13+
<link href="https://fonts.googleapis.com/css?family=Kreon:700|Open+Sans:400,700&display=swap" rel="stylesheet">
14+
<link rel="stylesheet" href="main.css">
15+
<link rel="icon" href="favicon.ico" type="image/gif" sizes="16x16">
16+
</head>
17+
18+
<body>
19+
<!--[if lt IE 8]>
20+
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
21+
<![endif]-->
22+
<main>
23+
<header>
24+
<h1>EmojiPages</h1>
25+
<div class="heading-content">
26+
<div class="header">
27+
<h2>A listing of books depicted through emojis. 💖</h2>
28+
<p>Click on the emojis to reveal the book name, year and author!</p>
29+
</div>
30+
<div class="contribute-callout">
31+
<p>Want to add to EmojiPages? Head to Github! ✨</p>
32+
<a href="https://github.com/brittanyrw/emojipages" target="_blank">Contribute</a>
33+
</div>
34+
</div>
35+
</header>
36+
<section id="books"></section>
37+
<footer>
38+
<p>EmojiPages currently has <span></span> books and plays. 💖</p>
39+
</footer>
40+
</main>
41+
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
42+
<script src="data.js"></script>
43+
<script src="app.js"></script>
44+
<script type="text/javascript" src="app.js"></script></body>
45+
46+
</html>

index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
2020
integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
2121
<link href="https://fonts.googleapis.com/css?family=Kreon:700|Open+Sans:400,700&display=swap" rel="stylesheet">
22-
<link rel="stylesheet" href="main.css">
2322
<link rel="icon" href="favicon.ico" type="image/gif" sizes="16x16">
2423
</head>
2524

@@ -46,7 +45,6 @@ <h2>A listing of books depicted through emojis. <img draggable="false" class="em
4645
</footer>
4746
</main>
4847
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
49-
<script src="data.js"></script>
5048
<script src="app.js"></script>
5149
</body>
5250

0 commit comments

Comments
 (0)