Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
5dc4165f
Commit
5dc4165f
authored
Mar 22, 2022
by
Carsten Rose
Browse files
Merge branch 'F9052_Report_CodeMirror' of git.math.uzh.ch:typo3/qfq into F9052_Report_CodeMirror
parents
3d3a392f
b38b28dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/Helper/codemirror.js
View file @
5dc4165f
...
...
@@ -108,6 +108,11 @@ $(document).ready(function(){
var
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
var
ttContentParam
=
urlParams
.
get
(
'
tt-content
'
);
var
pageId
=
urlParams
.
get
(
'
id
'
);
if
(
pageId
===
null
){
pageId
=
''
;
}
else
{
pageId
=
'
id=
'
+
pageId
+
'
&
'
;
}
if
(
ttContentParam
!==
null
&&
$
(
targetEditReportButton
).
next
(
"
#
"
+
ttContentParam
)[
0
]
!==
undefined
){
var
formContent
=
$
(
$
(
targetEditReportButton
).
next
(
"
#
"
+
ttContentParam
)[
0
].
outerHTML
);
...
...
@@ -117,18 +122,23 @@ $(document).ready(function(){
// execute changes(post) and reload page with id of tt-content as get parameter. Staying in same window with new content.
$
(
externWindow
).
submit
(
function
()
{
$
.
post
(
$
(
externWindow
).
attr
(
'
action
'
),
$
(
externWindow
).
serializeArray
());
alert
(
"
Changes have been saved. Reload your primary window after that.
"
);
if
(
pageId
===
null
){
pageId
=
''
;
}
else
{
pageId
=
'
id=
'
+
pageId
+
'
&
'
;
}
if
(
window
.
location
.
search
!==
'
?
'
+
"
tt-content=
"
+
$
(
'
form
'
).
attr
(
'
id
'
)){
$
(
'
<div style="text-align: right; margin-top: 10px;"><span style="background-color: green;" class="badge badge-success">Saved</span></div>
'
)
.
insertAfter
(
'
.btn-default
'
)
.
delay
(
3000
)
.
fadeOut
(
function
()
{
$
(
this
).
remove
()
;
});
if
(
window
.
location
.
search
!==
'
?
'
+
pageId
+
"
tt-content=
"
+
$
(
'
form
'
).
attr
(
'
id
'
)){
window
.
location
.
href
=
'
//
'
+
location
.
host
+
location
.
pathname
+
"
?
"
+
pageId
+
"
tt-content=
"
+
$
(
'
form
'
).
attr
(
'
id
'
);
}
return
false
;
});
// Refresh new window with correct url
if
(
$
(
externWindow
).
length
!==
0
&&
window
.
location
.
search
!==
'
?
'
+
pageId
+
"
tt-content=
"
+
$
(
'
form
'
).
attr
(
'
id
'
)){
window
.
location
.
href
=
'
//
'
+
location
.
host
+
location
.
pathname
+
"
?
"
+
pageId
+
"
tt-content=
"
+
$
(
'
form
'
).
attr
(
'
id
'
);
}
// enable CodeMirror for extern window
$
(
externWindow
).
children
(
"
[class=qfq-codemirror]
"
).
each
(
function
()
{
...
...
Write
Preview
Supports
Markdown
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