Skip to content

Commit b86e71c

Browse files
committed
Updated design
1 parent 7fb6ae1 commit b86e71c

File tree

10 files changed

+60
-58
lines changed

10 files changed

+60
-58
lines changed

App/containers/App.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ class App extends Component {
6767
const hasObfuscatedCode = obfuscatedCode.length !== 0;
6868

6969
return (
70-
<div>
71-
70+
<React.Fragment>
7271
<CodeContainer
7372
code={code}
7473
obfuscatedCode={obfuscatedCode}
@@ -83,13 +82,8 @@ class App extends Component {
8382
hasObfuscatedCode={hasObfuscatedCode}
8483
/>
8584

86-
<div className="ui grid">
87-
<div className="column">
88-
<OptionsContainer/>
89-
</div>
90-
</div>
91-
92-
</div>
85+
<OptionsContainer/>
86+
</React.Fragment>
9387
);
9488
}
9589

App/containers/CodeContainer.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,12 @@ class CodeContainer extends Component {
257257
const tabIndex = this.state.selectedTabIndex;
258258

259259
return (
260-
<div>
261-
<Tab
262-
activeIndex={tabIndex}
263-
menu={{attached: 'top', stackable: true, widths: 'three'}}
264-
panes={this.buildPanes()}
265-
onTabChange={(event, data) => this.onTabClick(data.activeIndex)}
266-
/>
267-
</div>
260+
<Tab
261+
activeIndex={tabIndex}
262+
menu={{attached: 'top', stackable: true, widths: 'three'}}
263+
panes={this.buildPanes()}
264+
onTabChange={(event, data) => this.onTabClick(data.activeIndex)}
265+
/>
268266
);
269267
}
270268
}

App/containers/OptionsContainer.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const ReactMarkdown = require('react-markdown')
77
import {Container, Form, Grid, Header, Segment, Divider, Button} from 'semantic-ui-react';
88

99
import EntryInputContainer from '../containers/EntryInputContainer';
10-
import {emojiSupportRenderer, getOptionsMarkdown, headingRenderer} from "../util/get-options-markdown";
10+
import {getOptionsMarkdown} from '../util/get-options-markdown';
11+
import {getHeadingRenderer} from '../util/get-heading-renderer';
12+
import {getEmojiSupportRenderer} from '../util/get-emoji-support-renderer';
1113

1214
import * as types from '../constants/ActionTypes';
1315
import * as actions from '../actions';
@@ -433,23 +435,22 @@ const Options = ({dispatch, options}) => {
433435

434436
</Segment>
435437
</Grid.Column>
436-
437438
</Grid>
438439
</Form>
439440

440-
<Container>
441+
<Segment secondary>
441442
<Header as="h2">
442443
Available Options:
443444
</Header>
444445

445446
<ReactMarkdown
446447
source={getOptionsMarkdown()}
447448
renderers={{
448-
heading: headingRenderer,
449-
text: emojiSupportRenderer
449+
heading: getHeadingRenderer,
450+
text: getEmojiSupportRenderer
450451
}}
451452
/>
452-
</Container>
453+
</Segment>
453454
</React.Fragment>
454455
);
455456
};

App/styles/main.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,6 @@ pre#Html {
126126
}
127127

128128
code {
129-
background-color: #f0f0f0;
129+
background-color: #e1e1e4;
130+
white-space: pre-wrap;
130131
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const emojiDictionary = require('emoji-dictionary');
2+
3+
export const getEmojiSupportRenderer = (text) => {
4+
return text
5+
.value
6+
.replace(
7+
/:\w+:/gi,
8+
(name) => emojiDictionary.getUnicode(name)
9+
);
10+
};

App/util/get-heading-renderer.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable react/prop-types */
2+
import React from "react";
3+
4+
const flatten = (text, child) => {
5+
return typeof child === 'string'
6+
? text + child
7+
: React.Children.toArray(child.props.children).reduce(flatten, text)
8+
};
9+
10+
export const getHeadingRenderer = (props) => {
11+
const children = React.Children.toArray(props.children)
12+
const text = children.reduce(flatten, '')
13+
const slug = text.toLowerCase().replace(/\W/g, '-')
14+
15+
return React.createElement('h' + props.level, {id: slug}, props.children)
16+
};

App/util/get-options-markdown.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
import React from 'react';
21
const fullReadmeMarkdown = require('javascript-obfuscator/README.md').default;
3-
const emojiDictionary = require('emoji-dictionary');
4-
5-
function flatten(text, child) {
6-
return typeof child === 'string'
7-
? text + child
8-
: React.Children.toArray(child.props.children).reduce(flatten, text)
9-
}
10-
11-
export function headingRenderer(props) {
12-
const children = React.Children.toArray(props.children)
13-
const text = children.reduce(flatten, '')
14-
const slug = text.toLowerCase().replace(/\W/g, '-')
15-
16-
return React.createElement('h' + props.level, {id: slug}, props.children)
17-
}
18-
19-
export const emojiSupportRenderer = text => text.value.replace(/:\w+:/gi, name => emojiDictionary.getUnicode(name));
202

213
export function getOptionsMarkdown() {
224
return fullReadmeMarkdown

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"graceful-fs": "4.1.9",
3434
"html-webpack-plugin": "^3.2.0",
3535
"inert": "5.1.0",
36-
"javascript-obfuscator": "2.4.0",
36+
"javascript-obfuscator": "2.4.1",
3737
"less": "2.7.1",
3838
"less-loader": "4.1.0",
3939
"pm2": "3.5.1",

templates/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1>JavaScript Obfuscator Tool</h1>
4949
<p>
5050
A free and efficient obfuscator for JavaScript (including partial support of ES2019). Make your code harder to copy and
5151
prevent people from stealing your work. This tool is a Web UI to the excellent (and open source)
52-
<code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">javascript-obfuscator</a>@2.4.0</code>
52+
<code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">javascript-obfuscator</a>@2.4.1</code>
5353
created by Timofey Kachalov.
5454
</p>
5555
<div id="GithubBadges">
@@ -133,7 +133,7 @@ <h3>Sounds great!</h3>
133133

134134
<div class="row">
135135
<div class="column">
136-
<h2 id="FAQ">FAQ</h2>
136+
<h2 class="header" id="FAQ">FAQ</h2>
137137

138138
<h4>Why would I want to obfuscate my JavaScript code?</h4>
139139
<p>There are numerous reasons why it's a good idea to protect your code, such as:</p>

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,21 +2791,21 @@ [email protected]:
27912791
jsx-ast-utils "^2.0.1"
27922792
prop-types "^15.6.0"
27932793

2794-
eslint-scope@^3.7.1, eslint-scope@~3.7.1:
2795-
version "3.7.1"
2796-
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
2797-
dependencies:
2798-
esrecurse "^4.1.0"
2799-
estraverse "^4.1.1"
2800-
2801-
eslint-scope@^5.1.1:
2794+
28022795
version "5.1.1"
28032796
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
28042797
integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==
28052798
dependencies:
28062799
esrecurse "^4.3.0"
28072800
estraverse "^4.1.1"
28082801

2802+
eslint-scope@^3.7.1, eslint-scope@~3.7.1:
2803+
version "3.7.1"
2804+
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
2805+
dependencies:
2806+
esrecurse "^4.1.0"
2807+
estraverse "^4.1.1"
2808+
28092809
eslint-visitor-keys@^1.0.0:
28102810
version "1.0.0"
28112811
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
@@ -4341,10 +4341,10 @@ iterate-object@^1.3.0, iterate-object@^1.3.1:
43414341
resolved "https://registry.yarnpkg.com/iterate-object/-/iterate-object-1.3.4.tgz#fa50b1d9e58e340a7dd6b4c98c8a5e182e790096"
43424342
integrity sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw==
43434343

4344-
4345-
version "2.4.0"
4346-
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-2.4.0.tgz#f907723cb5193ac8d9ba52d6595d11fab48056e0"
4347-
integrity sha512-KYclayLFyw3XtMXx56axp82d6cGOaUDd5O5DxtpBaDSb+4wWT/wnG9Ecws0pfUXAL338lRoy/kkKeomQUglr/Q==
4344+
4345+
version "2.4.1"
4346+
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-2.4.1.tgz#04931775ef96dd18a42afd1e5cbd7d3f8d2b9d48"
4347+
integrity sha512-+yQruRVl21PKtJGp/gXC3Y9VFdCajpYGY6E2jARVIo2m8hMlr0vB+GGOJXZcF9gOE0Ely4opbz7KKaXfeJWiGg==
43484348
dependencies:
43494349
"@gradecam/tsenum" "1.2.0"
43504350
"@nuxtjs/opencollective" "0.2.2"
@@ -4354,7 +4354,7 @@ [email protected]:
43544354
class-validator "0.12.2"
43554355
commander "6.1.0"
43564356
escodegen "2.0.0"
4357-
eslint-scope "^5.1.1"
4357+
eslint-scope "5.1.1"
43584358
estraverse "5.2.0"
43594359
eventemitter3 "4.0.7"
43604360
fast-deep-equal "3.1.3"

0 commit comments

Comments
 (0)