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

You Gotta Love... JSLint #10

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
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
Empty file modified README.md
100644 → 100755
Empty file.
44 changes: 44 additions & 0 deletions blind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*jslint es6, white, this, browser */

var BlindJS = (function (blindJS) {

"use strict";

blindJS.content = {};
blindJS.$el = {};

blindJS.printText = function () {
this.$el.value = this.typed;
};

blindJS.saveState = function () {
this.typed += this.content.slice(this.column, this.column + 1);
this.column += 1;
};

blindJS.type = function () {
blindJS.saveState();
blindJS.printText();
};

blindJS.handleKeyUpEvent = function () {
this.$el.addEventListener('keyup', this.type);
};

blindJS.start = function (cfg) {
this.column = 0;
this.typed = "";
this.content = cfg.input;
this.$el = cfg.output;
this.call(handleKeyUpEvent);
};

return blindJS;

})(BlindJS || {});

if (typeof define === "function") {
define(function (require, exports, module) {
exports.BlindJS = BlindJS;
});
}
Empty file modified frame.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified frame.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 131 additions & 18 deletions index.css
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,22 +1,135 @@
body {
margin: 0;
padding: 0;
background-color: #ddd;
font-family: Futura-pt, Arial;
}

.pretext {
width: 613px;
position: absolute;
top: 20px;
left: 45%;
text-align: center;
font-size: 24px;
}

.logo {
font-family: Futura-pt, Arial;
text-transform: uppercase;
font-size: 64px;
width: 613px;
height: 448px;
padding: 60px;
letter-spacing: 15px;
display: inline-block;
box-sizing: border-box;
white-space: nowrap;
color: white;
border: solid 7px currentColor;
background: linear-gradient(rgb(9, 97, 197), rgb(0, 208, 157), rgb(0, 208, 157)) no-repeat;
position: absolute;
top: calc(50vh - 224px);
left: calc(50vw - 306px);
width: 613px;
height: 448px;
padding: 60px;
display: inline-block;
box-sizing: border-box;
border: solid 7px currentColor;
background: linear-gradient(rgb(9, 97, 197), rgb(0, 208, 157), rgb(0, 208, 157)) no-repeat;
position: absolute;
top: calc(50vh - 224px);
left: 45%;
}

body {
background-color: #ddd;
.container {
position: relative;
}

.txt {
opacity: 0.2;
text-transform: uppercase;
font-size: 64px;
letter-spacing: 15px;
white-space: nowrap;
color: white;
}

.editor,
.report {
font-family: 'courier';
font-size: 12px;
}

.editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 0;
padding: 0;
width: 40%;
height: calc(100% - 50px);
border: 0;
background: black;
color: white;
}

.check {
height: 50px;
position: absolute;
bottom: 0;
left: 0;
width: 40%;
background-color: lightsteelblue;
border: 0;
color: black;
cursor: pointer;
font-size: 20px;
text-align: center;
}

.report {
position: absolute;
top: 0;
left: 0;
height: 100%;
overflow: auto;
}

.hidden {
display: none;
}

.scaled {
-webkit-animation: scale 0.3s 3;
animation: scale 0.3s 3;
opacity: 1;
}

@-webkit-keyframes scale {
0%, 100% {
-webkit-transform: scale(1);
}
50% {
-webkit-transform: scale(1.2);
}
}

@keyframes scale {
0%, 100% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
}

.faded {
-webkit-animation: fadein 2s 1;
animation: fadein 2s 1;
}

@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
82 changes: 71 additions & 11 deletions index.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,77 @@
<!DOCTYPE html>
<html>

<head>
<title>Challenge</title>
<link rel="stylesheet" href="http://use.typekit.net/c/378ea6/1w;futura-pt,2,SHB:R:n3,Y5K:R:n4,SH3:R:n5/d?3bb2a6e53c9684ffdc9a9bf1135b2a62ecbeaca761fbe87f15aec123ab5093d026e6e1bb0d00ffc19956aac399f687d37207ff0330bc849d7519f782e5795707e78fd4f92779514ac98f3c769303b71fbde8f0e29e96fabb2e7f3a73d1d2b97547169569af50e8d45aedbf371b103c11b2f7d0e1a043a9713c753390cb87e51662e4ec3f0bc59e3604c2407428380fa1ca58d18f5feee2373fd24b8a287646038c5b62c26fa4a434f83e10a9b7b2c4fbcc86eb"
media="all">
<link rel="stylesheet" href="index.css">
<title>Challenge</title>
<link rel="stylesheet" href="http://use.typekit.net/c/378ea6/1w;futura-pt,2,SHB:R:n3,Y5K:R:n4,SH3:R:n5/d?3bb2a6e53c9684ffdc9a9bf1135b2a62ecbeaca761fbe87f15aec123ab5093d026e6e1bb0d00ffc19956aac399f687d37207ff0330bc849d7519f782e5795707e78fd4f92779514ac98f3c769303b71fbde8f0e29e96fabb2e7f3a73d1d2b97547169569af50e8d45aedbf371b103c11b2f7d0e1a043a9713c753390cb87e51662e4ec3f0bc59e3604c2407428380fa1ca58d18f5feee2373fd24b8a287646038c5b62c26fa4a434f83e10a9b7b2c4fbcc86eb" media="all">
<link rel="stylesheet" href="index.css">
</head>

<body>
<div class="logo">
You
<br>gotta
<br>love
<br>frontend
</div>
<div class="pretext instructions">
OOOPS! JSLint claims that my <a href="https://github.com/ShaiMesisterano/BlindJS" target="_blank">GitHub project</a> has some issues, can you help me solve them?
</div>
<div class="pretext fork hidden">
GREAT! Please fork <a href="https://github.com/ShaiMesisterano/BlindJS" target="_blank">my repo</a> and commit your change
</div>
<div class="logo">
<div class="container">
<div class="txt">
You
<br>gotta
<br>love
<br>frontend
</div>
<div class="report">
Loading...
</div>
</div>
</div>
<textarea class="editor"></textarea>
<button class="check">JSLint</button>

<script src="report.js"></script>
<script src="jslint.js"></script>
<script>
var btnCheck = document.getElementsByClassName('check')[0],
report = document.getElementsByClassName('report')[0],
editor = document.getElementsByClassName('editor')[0],
txt = document.getElementsByClassName('txt')[0],
instructions = document.getElementsByClassName('instructions')[0],
fork = document.getElementsByClassName('fork')[0];

window.onload = function () {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "blind.js", true);
xmlhttp.send(null);
xmlhttp.onload = function () {
editor.innerHTML = xmlhttp.responseText;
displayReport();
};
};

btnCheck.onclick = function () {
displayReport();
};

displayReport = function () {
var result;

result = jslint(editor.value);
if (result.warnings.length === 0) {
displaySuccess();
} else {
report.innerHTML = REPORT.error(result);
}
};

displaySuccess = function () {
report.innerHTML = "";
txt.className += " scaled";
instructions.className = "hidden";
fork.className = "pretext faded";
}
</script>
</body>
</html>

</html>
Loading