默认不再自动开启预览

This commit is contained in:
2024-11-22 16:37:51 +08:00
parent 763db5fcb2
commit cd1aaeef01
3 changed files with 24 additions and 9 deletions

View File

@@ -29,7 +29,7 @@
<input type=hidden name=problem_id value="New Problem">
<p align=left>
<div class="ui toggle checkbox">
<input type="checkbox" id="preview-toggle" checked>
<input type="checkbox" id="preview-toggle">
<label for="preview-toggle">题目预览</label>
</div>
<?php echo "<h3>".$MSG_TITLE."</h3>"?>
@@ -86,7 +86,7 @@
<input type=radio name=spj value='2' ><?php echo $MSG_RTJ?>(用于选择判断填空题,用法见<a target='_blank' href='http://hustoj.com'>hustoj.com</a>)<br>
</p>
<p align=left>
<?php echo "<h4>".$MSG_SOURCE."</h4>"?>
<?php echo "<h4>".$MSG_SOURCE." 用空格分隔"."</h4>"?>
<textarea name=source style="width:100%;" rows=1><?php echo htmlentities($source,ENT_QUOTES,'UTF-8') ?></textarea><br><br>
</p>
<p align=left><?php echo "<h4>".$MSG_CONTEST."</h4>"?>
@@ -185,7 +185,7 @@
$(document).ready(function(){
// 默认开启预览功能
<?php if (!(isset($OJ_OLD_FASHINED) && $OJ_OLD_FASHINED )) echo " transform();" ?>
// <?php if (!(isset($OJ_OLD_FASHINED) && $OJ_OLD_FASHINED )) echo " transform();" ?>
// 监听checkbox的点击事件
$('#preview-toggle').change(function() {

View File

@@ -40,6 +40,11 @@ include_once("kindeditor.php") ;
$row = $result[0];
?>
<div class="ui toggle checkbox">
<input type="checkbox" id="preview-toggle">
<label for="preview-toggle">题目预览</label>
</div>
<input type=hidden name=problem_id value='<?php echo $row['problem_id']?>'>
<p align=left>
<center>
@@ -93,7 +98,7 @@ include_once("kindeditor.php") ;
</p>
<p align=left>
<?php echo "<h4>".$MSG_SOURCE."</h4>"?>
<?php echo "<h4>".$MSG_SOURCE." 用空格分隔"."</h4>"?>
<textarea name=source style="width:100%;" rows=1><?php echo htmlentities($row['source'],ENT_QUOTES,"UTF-8")?></textarea><br>
<?php echo "<h4>".$MSG_REMOTE_OJ."</h4>"?>
@@ -179,10 +184,20 @@ include_once("kindeditor.php") ;
});
if($("#previewFrame")[0] != undefined) $("#previewFrame")[0].contentWindow.MathJax.typeset();
}
$(document).ready(function(){
<?php if (!(isset($OJ_OLD_FASHINED) && $OJ_OLD_FASHINED ) ) echo " transform();" ?>
});
$(document).ready(function(){
// 默认开启预览功能
// <?php if (!(isset($OJ_OLD_FASHINED) && $OJ_OLD_FASHINED )) echo " transform();" ?>
// 监听checkbox的点击事件
$('#preview-toggle').change(function() {
if(this.checked) {
transform();
} else {
// 假设这里是关闭预览的函数
untransform();
}
});
});
</script>
<?php
}