Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
661d17fc
Commit
661d17fc
authored
Sep 08, 2016
by
chriseth
Committed by
GitHub
Sep 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #219 from ethereum/compile-button
Compile button and option to disable automatic compilation
parents
5e15c43c
f3864763
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
23 deletions
+52
-23
browser-solidity.css
assets/css/browser-solidity.css
+13
-0
index.html
index.html
+2
-0
app.js
src/app.js
+37
-0
compiler.js
src/app/compiler.js
+0
-23
No files found.
assets/css/browser-solidity.css
View file @
661d17fc
...
@@ -257,6 +257,19 @@ body {
...
@@ -257,6 +257,19 @@ body {
padding-left
:
6em
;
padding-left
:
6em
;
}
}
#settingsView
button
{
background-color
:
#C6CFF7
;
font-size
:
12px
;
padding
:
0.25em
;
margin-bottom
:
.5em
;
color
:
black
;
border
:
0
none
;
border-radius
:
3px
;
width
:
8em
;
margin-right
:
1em
;
cursor
:
pointer
;
}
#publishView
button
{
#publishView
button
{
background-color
:
#C6CFF7
;
background-color
:
#C6CFF7
;
font-size
:
12px
;
font-size
:
12px
;
...
...
index.html
View file @
661d17fc
...
@@ -90,6 +90,8 @@
...
@@ -90,6 +90,8 @@
<div
class=
"crow"
>
<div
class=
"crow"
>
<label
for=
"editorWrap"
><input
id=
"editorWrap"
type=
"checkbox"
>
Text Wrap
</label>
<label
for=
"editorWrap"
><input
id=
"editorWrap"
type=
"checkbox"
>
Text Wrap
</label>
<label
for=
"optimize"
><input
id=
"optimize"
type=
"checkbox"
>
Enable Optimization
</label>
<label
for=
"optimize"
><input
id=
"optimize"
type=
"checkbox"
>
Enable Optimization
</label>
<label
for=
"autoCompile"
><input
id=
"autoCompile"
type=
"checkbox"
checked
>
Auto Compile
</label>
<button
id=
"compile"
title=
"Compile source code"
><i
class=
"fa fa-cog"
></i>
Compile
</button>
</div>
</div>
</div>
</div>
<div
id=
"publishView"
>
<div
id=
"publishView"
>
...
...
src/app.js
View file @
661d17fc
...
@@ -436,6 +436,42 @@ var run = function () {
...
@@ -436,6 +436,42 @@ var run = function () {
var
renderer
=
new
Renderer
(
editor
,
executionContext
.
web3
(),
updateFiles
,
udapp
,
executionContext
,
formalVerification
.
event
,
compiler
.
event
);
// eslint-disable-line
var
renderer
=
new
Renderer
(
editor
,
executionContext
.
web3
(),
updateFiles
,
udapp
,
executionContext
,
formalVerification
.
event
,
compiler
.
event
);
// eslint-disable-line
var
autoCompile
=
document
.
querySelector
(
'#autoCompile'
).
checked
;
document
.
querySelector
(
'#autoCompile'
).
addEventListener
(
'change'
,
function
()
{
autoCompile
=
document
.
querySelector
(
'#autoCompile'
).
checked
;
});
var
previousInput
=
''
;
var
compileTimeout
=
null
;
function
editorOnChange
()
{
var
input
=
editor
.
getValue
();
if
(
input
===
''
)
{
editor
.
setCacheFileContent
(
''
);
return
;
}
if
(
input
===
previousInput
)
{
return
;
}
previousInput
=
input
;
if
(
!
autoCompile
)
{
return
;
}
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
);
}
compileTimeout
=
window
.
setTimeout
(
compiler
.
compile
,
300
);
}
editor
.
onChangeSetup
(
editorOnChange
);
$
(
'#compile'
).
click
(
function
()
{
compiler
.
compile
();
});
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
compiler
.
compile
();
compiler
.
compile
();
});
});
...
@@ -449,6 +485,7 @@ var run = function () {
...
@@ -449,6 +485,7 @@ var run = function () {
});
});
compiler
.
event
.
register
(
'compilerLoaded'
,
this
,
function
(
version
)
{
compiler
.
event
.
register
(
'compilerLoaded'
,
this
,
function
(
version
)
{
previousInput
=
''
;
setVersionText
(
version
);
setVersionText
(
version
);
compiler
.
compile
();
compiler
.
compile
();
initWithQueryParams
();
initWithQueryParams
();
...
...
src/app/compiler.js
View file @
661d17fc
...
@@ -17,31 +17,9 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
...
@@ -17,31 +17,9 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
var
compileJSON
;
var
compileJSON
;
var
compilerAcceptsMultipleFiles
;
var
compilerAcceptsMultipleFiles
;
var
previousInput
=
''
;
var
cachedRemoteFiles
=
{};
var
cachedRemoteFiles
=
{};
var
worker
=
null
;
var
worker
=
null
;
var
compileTimeout
=
null
;
function
onChange
()
{
var
input
=
editor
.
getValue
();
if
(
input
===
''
)
{
editor
.
setCacheFileContent
(
''
);
return
;
}
if
(
input
===
previousInput
)
{
return
;
}
previousInput
=
input
;
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
);
}
compileTimeout
=
window
.
setTimeout
(
compile
,
300
);
}
editor
.
onChangeSetup
(
onChange
);
var
compile
=
function
(
missingInputs
)
{
var
compile
=
function
(
missingInputs
)
{
editor
.
clearAnnotations
();
editor
.
clearAnnotations
();
self
.
event
.
trigger
(
'compilationStarted'
,
[]);
self
.
event
.
trigger
(
'compilationStarted'
,
[]);
...
@@ -67,7 +45,6 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
...
@@ -67,7 +45,6 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
this
.
setCompileJSON
=
setCompileJSON
;
// this is exposed for testing
this
.
setCompileJSON
=
setCompileJSON
;
// this is exposed for testing
function
onCompilerLoaded
(
version
)
{
function
onCompilerLoaded
(
version
)
{
previousInput
=
''
;
self
.
event
.
trigger
(
'compilerLoaded'
,
[
version
]);
self
.
event
.
trigger
(
'compilerLoaded'
,
[
version
]);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment