Empty history state - Fixes #130

This commit is contained in:
2022-10-22 12:11:13 +02:00
parent 745e16bc51
commit cbf1520dfd

View File

@ -339,6 +339,7 @@ function prepare_stylesheets(string $class): void
$styles['custom'] = preg_replace("/(\r?\n|\r\n?)/u", '', "body,iframe{background-color:#$colbg;color:#$coltxt} $css"); $styles['custom'] = preg_replace("/(\r?\n|\r\n?)/u", '', "body,iframe{background-color:#$colbg;color:#$coltxt} $css");
$allow_js = (bool) get_setting('allow_js'); $allow_js = (bool) get_setting('allow_js');
if($allow_js){ if($allow_js){
$scripts['default'] = 'if(window.history.replaceState){window.history.replaceState(null,"");}';
if($class === 'frameset') { if($class === 'frameset') {
$scripts[ 'frameset' ] = 'window.addEventListener("message", (e)=>{ $scripts[ 'frameset' ] = 'window.addEventListener("message", (e)=>{
if(e.data === "post_box_loaded"){ if(e.data === "post_box_loaded"){
@ -372,6 +373,7 @@ function print_stylesheet(string $class): void
echo "<style>$styles[custom]</style>"; echo "<style>$styles[custom]</style>";
$allow_js = (bool) get_setting( 'allow_js' ); $allow_js = (bool) get_setting( 'allow_js' );
if ( $allow_js ) { if ( $allow_js ) {
echo "<script>$scripts[default]</script>";
if(isset($scripts[$class])) { if(isset($scripts[$class])) {
echo "<script>$scripts[$class]</script>"; echo "<script>$scripts[$class]</script>";
} }