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
e17ef151
Commit
e17ef151
authored
Oct 08, 2015
by
d11e9
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow publishing gists and toggle rhp
parent
31ca4c4d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
2 deletions
+79
-2
index.html
index.html
+61
-0
browser-solidity.css
stylesheets/browser-solidity.css
+18
-2
No files found.
index.html
View file @
e17ef151
...
@@ -54,6 +54,7 @@ THE SOFTWARE.
...
@@ -54,6 +54,7 @@ THE SOFTWARE.
<div
id=
"editor"
>
<div
id=
"editor"
>
<div
id=
"files"
>
<div
id=
"files"
>
<span
class=
"newFile"
title=
"New File"
>
+
</span>
<span
class=
"newFile"
title=
"New File"
>
+
</span>
<span
class=
"toggleRHP"
title=
"Toggle right hand panel"
></span>
</div>
</div>
<div
id=
"input"
></div>
<div
id=
"input"
></div>
<div
id=
"dragbar"
></div>
<div
id=
"dragbar"
></div>
...
@@ -66,6 +67,7 @@ THE SOFTWARE.
...
@@ -66,6 +67,7 @@ THE SOFTWARE.
<div
class=
"info"
>
<div
class=
"info"
>
<p>
Version:
<span
id=
"version"
>
(loading)
</span><br/>
<p>
Version:
<span
id=
"version"
>
(loading)
</span><br/>
Change to:
<select
id=
"versionSelector"
></select><br/>
Change to:
<select
id=
"versionSelector"
></select><br/>
<button
id=
"gist"
>
Share
</button>
<code>
tx.origin =
<span
id=
"txorigin"
/></code></p>
<code>
tx.origin =
<span
id=
"txorigin"
/></code></p>
</div>
</div>
<div
id=
"optimizeBox"
>
<div
id=
"optimizeBox"
>
...
@@ -139,6 +141,50 @@ THE SOFTWARE.
...
@@ -139,6 +141,50 @@ THE SOFTWARE.
compile
();
compile
();
}
}
// ------------------ gist publish --------------
$
(
'#gist'
).
click
(
function
(){
//Get Github Authorization Token with proper scope, print to console
var
note
=
((
new
Date
()).
toString
()
+
Math
.
random
().
toString
());
var
description
=
"Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity"
;
$
.
ajax
({
url
:
'https://api.github.com/authorizations'
,
type
:
'POST'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"Authorization"
,
"Basic "
+
"c29sZWRpdG9yOmRlY2VudHJhbGlzZWV2ZXJ5dGhpbmc="
);
},
data
:
JSON
.
stringify
({
scopes
:[
"gist"
],
note
:
note
})
}).
done
(
function
(
response
)
{
//Create a Gist with token from above
var
files
=
{};
files
[
"00"
+
response
.
hashed_token
]
=
{
content
:
description
+
" at "
+
new
Date
()
}
var
filesArr
=
getFiles
();
for
(
var
f
in
filesArr
)
{
files
[
fileNameFromKey
(
filesArr
[
f
])]
=
{
content
:
localStorage
[
filesArr
[
f
]]
}
}
var
data
=
JSON
.
stringify
({
description
:
description
,
public
:
true
,
files
:
files
});
$
.
ajax
({
url
:
'https://api.github.com/gists'
,
type
:
'POST'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"Authorization"
,
"token "
+
response
.
token
);
},
data
:
data
}).
done
(
function
(
response
)
{
if
(
response
.
html_url
&&
confirm
(
"Created a gist at "
+
response
.
html_url
+
" Would you like to open it in a new window?"
))
{
window
.
open
(
response
.
html_url
);
}
});
});
})
// ----------------- file selector-------------
// ----------------- file selector-------------
...
@@ -305,6 +351,10 @@ THE SOFTWARE.
...
@@ -305,6 +351,10 @@ THE SOFTWARE.
onResize
();
onResize
();
}
}
function
getEditorSize
(){
window
.
localStorage
[
EDITOR_SIZE_CACHE_KEY
]
=
$
(
'#righthand-panel'
).
width
();
}
$
(
document
).
mouseup
(
function
(
e
){
$
(
document
).
mouseup
(
function
(
e
){
if
(
dragging
)
{
if
(
dragging
)
{
var
delta
=
$body
.
width
()
-
e
.
pageX
+
2
;
var
delta
=
$body
.
width
()
-
e
.
pageX
+
2
;
...
@@ -319,6 +369,17 @@ THE SOFTWARE.
...
@@ -319,6 +369,17 @@ THE SOFTWARE.
// set cached defaults
// set cached defaults
var
cachedSize
=
window
.
localStorage
.
getItem
(
EDITOR_SIZE_CACHE_KEY
);
var
cachedSize
=
window
.
localStorage
.
getItem
(
EDITOR_SIZE_CACHE_KEY
);
if
(
cachedSize
)
setEditorSize
(
cachedSize
);
if
(
cachedSize
)
setEditorSize
(
cachedSize
);
else
getEditorSize
();
// ----------------- toggle right hand panel
var
toggledRHP
=
false
;
$
(
'.toggleRHP'
).
click
(
function
(){
toggledRHP
=
!
toggledRHP
;
setEditorSize
(
toggledRHP
?
0
:
window
.
localStorage
[
EDITOR_SIZE_CACHE_KEY
]
);
$
(
'.toggleRHP'
).
toggleClass
(
'toggled'
,
toggledRHP
)
});
// ----------------- editor resize ---------------
// ----------------- editor resize ---------------
...
...
stylesheets/browser-solidity.css
View file @
e17ef151
...
@@ -17,7 +17,7 @@ body {
...
@@ -17,7 +17,7 @@ body {
height
:
2.5em
;
height
:
2.5em
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
line-height
:
2em
;
line-height
:
2em
;
padding
:
0.5em
0
.5em
0
;
padding
:
0.5em
0
0
;
}
}
#files
.file
,
#files
.file
,
...
@@ -31,12 +31,28 @@ body {
...
@@ -31,12 +31,28 @@ body {
position
:
relative
;
position
:
relative
;
}
}
#files
.newFile
{
#files
.newFile
,
#files
.toggleRHP
{
background-color
:
#B1EAC5
;
background-color
:
#B1EAC5
;
font-weight
:
bold
;
font-weight
:
bold
;
color
:
#4E775D
;
color
:
#4E775D
;
}
}
#files
.toggleRHP
{
float
:
right
;
cursor
:
pointer
;
}
#files
.toggleRHP
:before
{
content
:
">>"
;
width
:
2em
;
padding
:
0
0.6em
;
box-sizing
:
border-box
;
}
#files
.toggleRHP.toggled
:before
{
content
:
"<<"
;
}
#files
.file.active
{
#files
.file.active
{
font-weight
:
bold
;
font-weight
:
bold
;
border-bottom
:
0
none
;
border-bottom
:
0
none
;
...
...
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