Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Kellershoff
pwny.gorilla.moe
Commits
be5089bb
Commit
be5089bb
authored
Feb 08, 2017
by
Ysragh Heiden
Browse files
New url parsing format + autoRun
parent
88d3a346
Changes
2
Hide whitespace changes
Inline
Side-by-side
assets/pwny.css
View file @
be5089bb
...
...
@@ -8,7 +8,7 @@
html
,
body
{
overflow
:
hidden
;
background-color
:
#334
;}
html
,
body
,
div
,
iframe
{
margin
:
0
;
padding
:
0
;
border
:
0
none
;}
button
,
select
{
font-family
:
"Helvetica Neue"
,
"Calibri Light"
,
Roboto
,
sans-serif
;
border
:
1px
solid
#333
;
margin
:
3px
;
font-size
:
1rem
;
padding
:
0.75rem
1.35rem
;}
iframe
{
display
:
block
;
border
:
1px
solid
#444
;}
iframe
{
display
:
block
;
border
:
1px
solid
#444
;
margin-top
:
10px
;
}
html
,
body
,
#app
{
margin
:
0
;
padding
:
0
;
width
:
100%
;
height
:
100%
;}
@media
(
max-width
:
1000px
)
{
...
...
assets/pwny.js
View file @
be5089bb
...
...
@@ -23,6 +23,8 @@
compression
=
{},
my_lzma
=
new
window
.
LZMA
(
'
assets/lzma_worker.js
'
);
this
.
version
=
3
;
this
.
append
=
function
(
element
,
target
)
{
target
=
target
||
document
.
body
;
if
(
typeof
target
===
'
string
'
)
target
=
document
.
querySelector
(
target
);
...
...
@@ -323,29 +325,40 @@
return
SYNTAXES
.
includes
(
syntax
);
};
this
.
autoRun
=
function
()
{
window
.
mockhtml
();
col1
.
style
.
display
=
'
none
'
;
col2
.
style
.
display
=
'
block
'
;
col2
.
style
.
width
=
'
100%
'
;
};
this
.
loadFromHash
=
function
()
{
var
hash
=
window
.
location
.
hash
,
loc
=
hash
.
indexOf
(
'
#!/
'
),
split
=
''
,
virtual_url
=
''
,
url_params
=
null
,
syntax
=
'
html
'
,
shared_code
=
''
;
if
(
loc
===
0
&&
hash
.
length
>
3
)
{
virtual_url
=
hash
.
substring
(
3
);
url_params
=
self
.
getUrlParams
(
virtual_url
);
try
{
split
=
hash
.
split
(
'
/
'
);
if
(
split
.
length
===
2
)
{
shared_code
=
split
[
1
];
}
else
if
(
split
.
length
===
3
)
{
shared_code
=
split
[
2
];
syntax
=
split
[
1
];
}
if
(
SYNTAXES
.
includes
(
syntax
)
===
true
)
{
shared_code
=
url_params
.
get
(
'
t
'
);
syntax
=
url_params
.
get
(
'
s
'
);
if
(
self
.
isAllowedSyntax
(
syntax
)
===
true
)
{
EDITOR
.
getSession
().
setMode
(
'
ace/mode/
'
+
syntax
);
}
this
.
compression
.
decompress
(
shared_code
,
function
(
err
,
result
){
if
(
!
err
)
self
.
compression
.
decompress
(
shared_code
,
function
(
err
,
result
){
if
(
!
err
)
{
EDITOR
.
setValue
(
result
);
else
if
(
url_params
.
get
(
'
a
'
)
===
'
1
'
)
{
self
.
hideLoading
();
self
.
autoRun
();
return
;
}
}
else
{
window
.
alert
(
'
No valid token received
'
);
}
self
.
hideLoading
();
});
}
catch
(
ex
)
{
...
...
@@ -524,7 +537,7 @@
evt
.
preventDefault
();
var
syntax
=
self
.
getEditorSyntax
();
self
.
compression
.
compress
(
EDITOR
.
getValue
(),
function
(
err
,
result
){
var
link
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
hostname
+
'
/#!/
'
+
syntax
+
'
/
'
+
result
.
toString
();
var
link
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
hostname
+
'
/#!/
?s=
'
+
syntax
+
'
&t=
'
+
result
.
toString
();
// http://stackoverflow.com/questions/15090220/maximum-length-for-url-in-chrome-browser
// var max_link_length = 2083;
// not giving a fuck about other browsers than chrome
...
...
@@ -582,7 +595,6 @@
useSoftTabs
:
false
});
self
.
loadFromHash
();
self
.
fillSyntax
();
document
.
getElementById
(
'
syntax
'
).
onchange
=
function
(
evt
)
{
...
...
@@ -615,6 +627,7 @@
};
window
.
addEventListener
(
'
resize
'
,
onResizeEvent
);
onResizeEvent
();
self
.
loadFromHash
();
};
return
this
;
...
...
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