-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$('.js-converter__form').on('submit', function(e) { | ||
e.preventDefault() | ||
var $form = $(this) | ||
var $output = $form.find('.js-converter__output') | ||
var method = $form.find('.js-converter__method')[0].value | ||
var text = $form.find('.js-converter__input')[0].value | ||
$output.text(eol[method](text)) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US" class="scheme--white"> | ||
<title>EOL converter</title> | ||
<meta name="description" content="Newline character converter"> | ||
<link rel="stylesheet" href="style.css"> | ||
|
||
<header class="m-b-3"> | ||
<h1 class="m-b-1">eol converter</h1> | ||
<a class="button scheme--light" href="https://github.com/ryanve/eol">Github</a> | ||
<a class="button scheme--light" href="https://www.npmjs.com/package/eol">npm</a> | ||
</header> | ||
|
||
<form class="js-converter__form"> | ||
<fieldset class="m-b-2"> | ||
<label class="block m-b-2"> | ||
<b>Input</b> | ||
<textarea class="area border-radius scheme--white js-converter__input"></textarea> | ||
</label> | ||
<button type="submit" class="button scheme--dark">Convert line endings to</button> | ||
<label class="inline-block m-b-2"> | ||
<select class="button scheme--light js-converter__method" aria-label="Convert to"> | ||
<option selected>lf</option> | ||
<option>crlf</option> | ||
<option>cr</option> | ||
</select> | ||
</label> | ||
</fieldset> | ||
<section> | ||
<h2 class="inherit-size">Output</h2> | ||
<div class="area scheme--white border-radius js-converter__output" contenteditable></div> | ||
</section> | ||
</form> | ||
|
||
<script src="eol.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script> | ||
<script src="converter.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.scheme--white { background: #fafafa; color: #020202 } | ||
.scheme--dark { background: navy; color: #fafafa } | ||
.scheme--light { background: gainsboro; color: navy } | ||
|
||
*, :before, :after { box-sizing: border-box } | ||
html { font: 1em/2 sans-serif; } | ||
body { width: 100%; margin: auto; padding: 1em } | ||
a { text-decoration: none } | ||
a:hover { text-decoration: underline } | ||
textarea, select { font: inherit } | ||
textarea { max-width: 100%; margin: 0 } | ||
header, section { display: block } | ||
fieldset { padding: 0; border: 0 } | ||
label { margin: 0; padding: 0 } | ||
h1, h2 { line-height: 1 } | ||
|
||
.border-radius { | ||
border-radius: .25em; | ||
} | ||
|
||
.inherit-size { | ||
font-size: inherit; | ||
} | ||
|
||
.button { | ||
font-size: inherit; | ||
font-style: inherit; | ||
font-weight: bold; | ||
min-height: 2.5em; | ||
display: inline-block; | ||
border: 0; | ||
border-radius: .25em; | ||
padding: .33333em .66666em; | ||
margin: 0; | ||
} | ||
|
||
.button:enabled:hover { | ||
cursor: pointer; | ||
text-decoration: underline; | ||
} | ||
|
||
.m-b-1 { | ||
margin-bottom: .5em; | ||
} | ||
|
||
.m-b-2 { | ||
margin-bottom: 1em; | ||
} | ||
|
||
.m-b-3 { | ||
margin-bottom: 2em; | ||
} | ||
|
||
.inline-block { | ||
display: inline-block; | ||
} | ||
|
||
.block { | ||
display: block; | ||
} | ||
|
||
.area { | ||
border: 2px solid gainsboro; | ||
padding: .25em; | ||
display: block; | ||
overflow: auto; | ||
resize: vertical; | ||
width: 100%; | ||
height: 7.5em; | ||
line-height: 1.1; | ||
} |