Commit 138f056 1 parent 66ffd48 commit 138f056 Copy full SHA for 138f056
File tree 5 files changed +118
-16
lines changed
5 files changed +118
-16
lines changed Original file line number Diff line number Diff line change
1
+ $ ( '.js-converter__form' ) . on ( 'submit' , function ( e ) {
2
+ e . preventDefault ( )
3
+ var $form = $ ( this )
4
+ var $output = $form . find ( '.js-converter__output' )
5
+ var method = $form . find ( '.js-converter__method' ) [ 0 ] . value
6
+ var text = $form . find ( '.js-converter__input' ) [ 0 ] . value
7
+ $output . text ( eol [ method ] ( text ) )
8
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en-US " class ="scheme--white ">
3
+ < title > EOL converter</ title >
4
+ < meta name ="description " content ="Newline character converter ">
5
+ < link rel ="stylesheet " href ="style.css ">
6
+
7
+ < header class ="m-b-3 ">
8
+ < h1 class ="m-b-1 "> eol converter</ h1 >
9
+ < a class ="button scheme--light " href ="https://github.com/ryanve/eol "> Github</ a >
10
+ < a class ="button scheme--light " href ="https://www.npmjs.com/package/eol "> npm</ a >
11
+ </ header >
12
+
13
+ < form class ="js-converter__form ">
14
+ < fieldset class ="m-b-2 ">
15
+ < label class ="block m-b-2 ">
16
+ < b > Input</ b >
17
+ < textarea class ="area border-radius scheme--white js-converter__input "> </ textarea >
18
+ </ label >
19
+ < button type ="submit " class ="button scheme--dark "> Convert line endings to</ button >
20
+ < label class ="inline-block m-b-2 ">
21
+ < select class ="button scheme--light js-converter__method " aria-label ="Convert to ">
22
+ < option selected > lf</ option >
23
+ < option > crlf</ option >
24
+ < option > cr</ option >
25
+ </ select >
26
+ </ label >
27
+ </ fieldset >
28
+ < section >
29
+ < h2 class ="inherit-size "> Output</ h2 >
30
+ < div class ="area scheme--white border-radius js-converter__output " contenteditable > </ div >
31
+ </ section >
32
+ </ form >
33
+
34
+ < script src ="eol.js "> </ script >
35
+ < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js "> </ script >
36
+ < script src ="converter.js "> </ script >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " eol" ,
3
3
"description" : " Newline character converter" ,
4
- "version" : " 0.4 .0" ,
4
+ "version" : " 0.5 .0" ,
5
5
"homepage" : " https://github.com/ryanve/eol" ,
6
6
"license" : " MIT" ,
7
7
"author" : " Ryan Van Etten" ,
21
21
],
22
22
"main" : " eol.js" ,
23
23
"scripts" : {
24
- "pretest" : " jshint eol.js && jshint test.js" ,
24
+ "lint" : " jshint eol.js && jshint test.js" ,
25
+ "pretest" : " npm run lint" ,
25
26
"test" : " node test.js"
26
27
},
27
28
"repository" : {
Original file line number Diff line number Diff line change
1
+ .scheme--white { background : # fafafa ; color : # 020202 }
2
+ .scheme--dark { background : navy; color : # fafafa }
3
+ .scheme--light { background : gainsboro; color : navy }
4
+
5
+ * , : before , : after { box-sizing : border-box }
6
+ html { font : 1 em/2 sans-serif; }
7
+ body { width : 100% ; margin : auto; padding : 1em }
8
+ a { text-decoration : none }
9
+ a : hover { text-decoration : underline }
10
+ textarea , select { font : inherit }
11
+ textarea { max-width : 100% ; margin : 0 }
12
+ header , section { display : block }
13
+ fieldset { padding : 0 ; border : 0 }
14
+ label { margin : 0 ; padding : 0 }
15
+ h1 , h2 { line-height : 1 }
16
+
17
+ .border-radius {
18
+ border-radius : .25em ;
19
+ }
20
+
21
+ .inherit-size {
22
+ font-size : inherit;
23
+ }
24
+
25
+ .button {
26
+ font-size : inherit;
27
+ font-style : inherit;
28
+ font-weight : bold;
29
+ min-height : 2.5em ;
30
+ display : inline-block;
31
+ border : 0 ;
32
+ border-radius : .25em ;
33
+ padding : .33333em .66666em ;
34
+ margin : 0 ;
35
+ }
36
+
37
+ .button : enabled : hover {
38
+ cursor : pointer;
39
+ text-decoration : underline;
40
+ }
41
+
42
+ .m-b-1 {
43
+ margin-bottom : .5em ;
44
+ }
45
+
46
+ .m-b-2 {
47
+ margin-bottom : 1em ;
48
+ }
49
+
50
+ .m-b-3 {
51
+ margin-bottom : 2em ;
52
+ }
53
+
54
+ .inline-block {
55
+ display : inline-block;
56
+ }
57
+
58
+ .block {
59
+ display : block;
60
+ }
61
+
62
+ .area {
63
+ border : 2px solid gainsboro;
64
+ padding : .25em ;
65
+ display : block;
66
+ overflow : auto;
67
+ resize : vertical;
68
+ width : 100% ;
69
+ height : 7.5em ;
70
+ line-height : 1.1 ;
71
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments