move errorToException 'appendTop' javascript into 'js' hook
since this also fixes not having had this in backend_header before.
This commit is contained in:
@ -34,25 +34,6 @@ function serendipity_plugin_api_frontend_header($event_name, &$bag, &$eventData,
|
||||
<script>jQuery.noConflict();</script>
|
||||
<?php
|
||||
}
|
||||
// add a global available (index.tpl; admin/index.tpl; preview_iframe.tpl) redirect error string function used by errorToExceptionHandler()
|
||||
// hardened by admin only - better have that here, to be reachable everywhere
|
||||
if ($serendipity['production'] === true) {
|
||||
if( $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN ) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function create(htmlStr) {
|
||||
var frag = document.createDocumentFragment(),
|
||||
temp = document.createElement("div");
|
||||
temp.innerHTML = htmlStr;
|
||||
while (temp.firstChild) {
|
||||
frag.appendChild(temp.firstChild);
|
||||
}
|
||||
return frag;
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add jquery to all backend templates
|
||||
|
@ -135,7 +135,22 @@ function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$add
|
||||
|
||||
case 'js':
|
||||
// This is frontend and backend!
|
||||
// alway add \n\n for the next and start at line Col 1, to populate the (virtual) serendipity.js file
|
||||
// add a global available (index.tpl; admin/index.tpl; preview_iframe.tpl) redirect error string function used by errorToExceptionHandler()
|
||||
// hardened by admin only - better have that here, to be reachable everywhere
|
||||
if( $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN ) {
|
||||
echo "
|
||||
function create(htmlStr) {
|
||||
var frag = document.createDocumentFragment(),
|
||||
temp = document.createElement('div');
|
||||
temp.innerHTML = htmlStr;
|
||||
while (temp.firstChild) {
|
||||
frag.appendChild(temp.firstChild);
|
||||
}
|
||||
return frag;
|
||||
}
|
||||
\n";
|
||||
}
|
||||
// alway add \n\n for the last element dor plugins using this hook and start at line Col 1, to populate the (virtual) serendipity.js file
|
||||
echo "
|
||||
jQuery(function() {
|
||||
jQuery('input[type=\"url\"]').change(function() {
|
||||
|
Reference in New Issue
Block a user