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
1bf2dae9
Commit
1bf2dae9
authored
Jun 01, 2016
by
chriseth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from ethereum/patch/use-js-standard
Use better JS source formatting [WIP]
parents
7ab935fe
1eca2fa1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
32 deletions
+32
-32
app.js
src/app.js
+31
-31
mode-solidity.js
src/mode-solidity.js
+1
-1
universal-dapp.js
src/universal-dapp.js
+0
-0
No files found.
src/app.js
View file @
1bf2dae9
...
...
@@ -127,42 +127,42 @@ var run = function() {
if
(
typeof
chrome
===
'undefined'
||
!
chrome
||
!
chrome
.
storage
||
!
chrome
.
storage
.
sync
)
return
;
var
obj
=
{}
var
obj
=
{}
;
var
done
=
false
;
var
count
=
0
var
count
=
0
;
var
dont
=
0
;
function
check
(
key
){
chrome
.
storage
.
sync
.
get
(
key
,
function
(
resp
){
console
.
log
(
"comparing to cloud"
,
key
,
resp
)
console
.
log
(
"comparing to cloud"
,
key
,
resp
)
;
if
(
typeof
resp
[
key
]
!=
'undefined'
&&
obj
[
key
]
!==
resp
[
key
]
&&
confirm
(
"Overwrite '"
+
fileNameFromKey
(
key
)
+
"'? Click Ok to overwrite local file with file from cloud. Cancel will push your local file to the cloud."
))
{
console
.
log
(
"Overwriting"
,
key
)
console
.
log
(
"Overwriting"
,
key
)
;
localStorage
.
setItem
(
key
,
resp
[
key
]
);
updateFiles
();
}
else
{
console
.
log
(
"add to obj"
,
obj
,
key
)
console
.
log
(
"add to obj"
,
obj
,
key
)
;
obj
[
key
]
=
localStorage
[
key
];
}
done
++
done
++
;
if
(
done
>=
count
)
chrome
.
storage
.
sync
.
set
(
obj
,
function
(){
console
.
log
(
"updated cloud files with: "
,
obj
,
this
,
arguments
)
})
})
console
.
log
(
"updated cloud files with: "
,
obj
,
this
,
arguments
)
;
})
;
})
;
}
for
(
var
y
in
window
.
localStorage
)
{
console
.
log
(
"checking"
,
y
)
console
.
log
(
"checking"
,
y
)
;
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
if
(
y
.
indexOf
(
SOL_CACHE_FILE_PREFIX
)
!==
0
)
continue
;
count
++
;
check
(
y
)
check
(
y
)
;
}
}
window
.
syncStorage
=
syncStorage
;
syncStorage
()
syncStorage
()
;
...
...
@@ -194,14 +194,14 @@ var run = function() {
var
files
=
getFiles
();
for
(
var
x
in
files
)
{
sessions
[
files
[
x
]]
=
newEditorSession
(
files
[
x
])
sessions
[
files
[
x
]]
=
newEditorSession
(
files
[
x
])
;
}
editor
.
setSession
(
sessions
[
SOL_CACHE_FILE
]
);
editor
.
resize
(
true
);
function
newEditorSession
(
filekey
)
{
var
s
=
new
ace
.
EditSession
(
window
.
localStorage
[
filekey
],
"ace/mode/javascript"
)
var
s
=
new
ace
.
EditSession
(
window
.
localStorage
[
filekey
],
"ace/mode/javascript"
)
;
s
.
setUndoManager
(
new
ace
.
UndoManager
());
s
.
setTabSize
(
4
);
s
.
setUseSoftTabs
(
true
);
...
...
@@ -332,7 +332,7 @@ var run = function() {
$filesEl
.
animate
({
left
:
Math
.
max
(
(
0
-
activeFilePos
()
+
(
FILE_SCROLL_DELTA
/
2
)),
0
)
+
"px"
},
"slow"
,
function
(){
reAdjust
();
})
})
;
});
$filesEl
.
on
(
'click'
,
'.file:not(.active)'
,
showFileHandler
);
...
...
@@ -368,7 +368,7 @@ var run = function() {
}
return
false
;
})
})
;
$filesEl
.
on
(
'click'
,
'.file .remove'
,
function
(
ev
)
{
ev
.
preventDefault
();
...
...
@@ -453,19 +453,19 @@ var run = function() {
itemsWidth
+=
itemWidth
;
});
return
itemsWidth
;
}
;
}
function
widthOfHidden
(){
return
((
$filesWrapper
.
outerWidth
())
-
widthOfList
()
-
getLeftPosi
());
}
;
}
function
widthOfVisible
(){
return
$filesWrapper
.
outerWidth
();
}
;
}
function
getLeftPosi
(){
return
$filesEl
.
position
().
left
;
}
;
}
function
activeFilePos
()
{
var
el
=
$filesEl
.
find
(
'.active'
);
...
...
@@ -489,14 +489,14 @@ var run = function() {
}
$scrollerRight
.
click
(
function
()
{
var
delta
=
(
getLeftPosi
()
-
FILE_SCROLL_DELTA
)
var
delta
=
(
getLeftPosi
()
-
FILE_SCROLL_DELTA
)
;
$filesEl
.
animate
({
left
:
delta
+
"px"
},
'slow'
,
function
(){
reAdjust
();
});
});
$scrollerLeft
.
click
(
function
()
{
var
delta
=
Math
.
min
(
(
getLeftPosi
()
+
FILE_SCROLL_DELTA
),
0
)
var
delta
=
Math
.
min
(
(
getLeftPosi
()
+
FILE_SCROLL_DELTA
),
0
)
;
$filesEl
.
animate
({
left
:
delta
+
"px"
},
'slow'
,
function
(){
reAdjust
();
});
...
...
@@ -777,7 +777,7 @@ var run = function() {
case
'compiled'
:
compilationFinished
(
data
.
data
,
data
.
missingInputs
);
break
;
}
;
}
});
worker
.
onerror
=
function
(
msg
)
{
console
.
log
(
msg
.
data
);
};
worker
.
addEventListener
(
'error'
,
function
(
msg
)
{
console
.
log
(
msg
.
data
);
});
...
...
@@ -817,7 +817,7 @@ var run = function() {
editor
.
on
(
'changeSession'
,
function
(){
editor
.
getSession
().
on
(
'change'
,
onChange
);
onChange
();
})
})
;
document
.
querySelector
(
'#optimize'
).
addEventListener
(
'change'
,
function
(){
updateQueryParams
({
optimize
:
document
.
querySelector
(
'#optimize'
).
checked
});
...
...
@@ -868,15 +868,15 @@ var run = function() {
}
};
var
gethDeploy
=
function
(
contractName
,
i
nterface
,
bytecode
){
var
gethDeploy
=
function
(
contractName
,
jsonI
nterface
,
bytecode
){
var
code
=
""
;
var
funABI
=
getConstructorInterface
(
$
.
parseJSON
(
i
nterface
));
var
funABI
=
getConstructorInterface
(
$
.
parseJSON
(
jsonI
nterface
));
$
.
each
(
funABI
.
inputs
,
function
(
i
,
inp
)
{
code
+=
"var "
+
inp
.
name
+
" = /* var of type "
+
inp
.
type
+
" here */ ;
\
n"
;
});
code
+=
"var "
+
contractName
+
"Contract = web3.eth.contract("
+
i
nterface
.
replace
(
"
\
n"
,
""
)
+
");"
code
+=
"var "
+
contractName
+
"Contract = web3.eth.contract("
+
jsonI
nterface
.
replace
(
"
\
n"
,
""
)
+
");"
+
"
\
nvar "
+
contractName
+
" = "
+
contractName
+
"Contract.new("
;
$
.
each
(
funABI
.
inputs
,
function
(
i
,
inp
)
{
...
...
@@ -898,8 +898,8 @@ var run = function() {
return
code
;
};
var
combined
=
function
(
contractName
,
i
nterface
,
bytecode
){
return
JSON
.
stringify
([{
name
:
contractName
,
interface
:
i
nterface
,
bytecode
:
bytecode
}]);
var
combined
=
function
(
contractName
,
jsonI
nterface
,
bytecode
){
return
JSON
.
stringify
([{
name
:
contractName
,
interface
:
jsonI
nterface
,
bytecode
:
bytecode
}]);
};
var
renderContracts
=
function
(
data
,
source
)
{
...
...
@@ -992,7 +992,7 @@ var run = function() {
return
$
(
'<div class="contractDetails"/>'
).
append
(
button
).
append
(
details
);
};
var
formatGasEstimates
=
function
(
data
)
{
var
gasToText
=
function
(
g
)
{
return
g
===
null
?
'unknown'
:
g
;
}
var
gasToText
=
function
(
g
)
{
return
g
===
null
?
'unknown'
:
g
;
}
;
var
text
=
''
;
if
(
'creation'
in
data
)
text
+=
'Creation: '
+
gasToText
(
data
.
creation
[
0
])
+
' + '
+
gasToText
(
data
.
creation
[
1
])
+
'
\
n'
;
...
...
@@ -1041,7 +1041,7 @@ var run = function() {
return
funABI
;
};
syncStorage
()
syncStorage
()
;
};
...
...
src/mode-solidity.js
View file @
1bf2dae9
...
...
@@ -27,7 +27,7 @@ DocCommentHighlightRules.getTagRule = function(start) {
token
:
"comment.doc.tag.storage.type"
,
regex
:
"
\\
b(?:TODO|FIXME|XXX|HACK)
\\
b"
};
}
}
;
DocCommentHighlightRules
.
getStartRule
=
function
(
start
)
{
return
{
...
...
src/universal-dapp.js
View file @
1bf2dae9
This diff is collapsed.
Click to expand it.
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