Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F225294
main.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
main.js
View Options
AOS
.
init
();
//initialize tooltips
$
(
'[data-toggle="tooltip"]'
).
tooltip
({
offset
:
'0, 20%'
});
$
(
'#discord'
).
bind
(
'click touchend'
,
function
()
{
if
(
navigator
.
clipboard
.
writeText
(
"despawningbone#4078"
))
{
$
(
this
).
tooltip
(
'hide'
);
$
(
'#discord'
).
attr
(
'data-original-title'
,
"(copied!)"
);
setTimeout
(()
=>
$
(
'#discord'
).
attr
(
'data-original-title'
,
"despawningbone#4078"
),
400
);
$
(
this
).
tooltip
(
'show'
);
}
});
//relative data-target patch for accordions, and also to add .show back into the button
$
(
'body'
).
on
(
'click'
,
'[data-toggle=collapse]'
,
function
(
e
)
{
var
$parent
=
$
(
this
).
parents
(
'.ctf-info'
);
$parent
.
find
(
'.ctf-table'
).
collapse
(
'toggle'
);
$parent
.
toggleClass
(
'show'
)
});
//ctf diary comment popup dynamically load content
$
(
'.ctf-table tbody tr'
).
on
(
'click'
,
function
(){
href
=
$
(
this
).
attr
(
'href'
);
//if full writeup is available, redirect
if
(
href
)
{
window
.
location
=
href
;
}
else
{
//else open comment popup
href
=
$
(
this
).
attr
(
'data-comment'
);
//only load if attr is found, which means a comment should be found
if
(
href
)
window
.
location
.
hash
=
href
;
//pass to loadComments on hashchange
}
});
//dynamically load comments from url
loadComments
=
function
()
{
if
(
window
.
location
.
hash
)
{
challName
=
window
.
location
.
hash
.
substring
(
1
);
//since we dont know which chall this is we have to search to make the title
chall
=
$
(
'.ctf-table tbody tr[data-comment="'
+
challName
+
'"]'
);
//dont run if no valid chall found - non data-comment hashes are not comment links
if
(
chall
.
length
>
0
)
{
$
(
'#commentTitle'
).
text
(
'Comments - '
+
chall
[
0
].
firstElementChild
.
textContent
)
$
(
'.ctf-comment'
).
load
(
'ctf/'
+
challName
+
'.html'
,
function
(
res
,
status
,
xhr
){
commentModal
=
$
(
'#comment'
);
if
(
status
!==
"error"
)
//only show if we can load it, otherwise treat as no comment
commentModal
.
modal
({
show
:
true
});
//reset hash on hide
commentModal
.
on
(
'hide.bs.modal'
,
()
=>
history
.
replaceState
(
null
,
null
,
' '
))
});
}
}
}
$
(
window
).
ready
(
loadComments
);
$
(
window
).
on
(
'hashchange'
,
loadComments
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 4:52 PM (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8a/c9/d1bf617b0d77cff47b03f1712a6f
Attached To
rWEB Web Portfolio
Event Timeline
Log In to Comment