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
489f45aa
Commit
489f45aa
authored
Oct 08, 2015
by
d11e9
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert to anonymous gists
parent
f76af79c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
33 deletions
+17
-33
index.html
index.html
+17
-33
No files found.
index.html
View file @
489f45aa
...
...
@@ -145,43 +145,27 @@ THE SOFTWARE.
$
(
'#gist'
).
click
(
function
(){
//Get Github Authorization Token with proper scope, print to console
var
note
=
((
new
Date
()).
toString
()
+
Math
.
random
().
toString
());
//Get Github Authorization Token with proper scope, print to console
var
description
=
"Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity"
;
//Create a Gist with token from above
var
files
=
{};
var
filesArr
=
getFiles
();
files
[
"00"
+
response
.
hashed_token
]
=
{
content
:
filesArr
.
join
(
".sol "
)
+
" "
+
new
Date
()
}
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/
authorization
s'
,
url
:
'https://api.github.com/
gist
s'
,
type
:
'POST'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"Authorization"
,
"Basic "
+
"c29sZWRpdG9yOmRlY2VudHJhbGlzZWV2ZXJ5dGhpbmc="
);
},
data
:
JSON
.
stringify
({
scopes
:[
"gist"
],
note
:
note
})
data
:
data
}).
done
(
function
(
response
)
{
//Create a Gist with token from above
var
files
=
{};
var
filesArr
=
getFiles
();
files
[
"00"
+
response
.
hashed_token
]
=
{
content
:
filesArr
.
join
(
".sol "
)
+
" "
+
new
Date
()
}
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
);
}
});
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
,
'_blank'
);
}
});
})
...
...
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