Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 52 additions & 18 deletions bbs/content/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,15 @@ function packSize($size){
#$translated=$floor['text'];
$translatedforquote=translateforquote($floor['text'],$floor['ishtml']=="YES");
#echo("<div class='textblock' id='floor$i'>$translated</div>\n");
print "<div class='textblock' id='floor$i' style='line-height:160% !important'>$translated</div>\n";
// print "<div class='textblock' id='floor$i' style='line-height:160% !important'>$translated</div>\n";
$wrappedcontennt="<div class='textblock'>$translated</div>\n";
if(@$userinfo['sig'.$floor['sig']]){
$wrappedcontennt.="<div class='sigblock'>\n";
$wrappedcontennt.="<span class='sigtip'>--------</span>\n";
$wrappedcontennt.="<div class='sig'>".translate($userinfo['sig'.$floor['sig']],false,false)."<br><br><br>"."</div>\n";
$wrappedcontennt.="</div>";
}
print wraphtmltoiframe($wrappedcontennt, 'floor'.$i);
if($floor['attachs']){
echo('<span id="attachtipdark">本帖包含如下的附件:</span>');
echo("<div class='attachsdark'>\n");
Expand All @@ -318,12 +326,12 @@ function packSize($size){
}
echo("</div>\n");
}
if(@$userinfo['sig'.$floor['sig']]){
echo("<div class='sigblock'>\n");
echo("<span class='sigtip'>--------</span>\n");
echo("<div class='sig'>".translate($userinfo['sig'.$floor['sig']],false,false)."<br><br><br>"."</div>\n");
echo("</div>");
}
// if(@$userinfo['sig'.$floor['sig']]){
// echo("<div class='sigblock'>\n");
// echo("<span class='sigtip'>--------</span>\n");
// echo("<div class='sig'>".translate($userinfo['sig'.$floor['sig']],false,false)."<br><br><br>"."</div>\n");
// echo("</div>");
// }
$lzl=mainfunc(array(
"ask"=>"lzl",
"method"=>"ask",
Expand Down Expand Up @@ -563,13 +571,37 @@ function packjump($p,$text){
?>
refreshAttach();
$(window).load(function() {
$(".textblock").each(function() {
var text=$(this);
text.find("img").each(function() {
var img=$(this);
var width=parseInt(img.css("width"));
width=(width>700)?700:width;
img.css("width",width);
// 已经用css实现
// $(".textblock").each(function() {
// var text=$(this);
// text.find("img").each(function() {
// var img=$(this);
// var width=parseInt(img.css("width"));
// width=(width>700)?700:width;
// img.css("width",width);
// });
// });
$('iframe').each(function() {
const iframe = this; // `this` is the raw DOM element
$(iframe).on('load', function() {
try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

// 创建观察器
const resizeObserver = new ResizeObserver(entries => {
const height = entries[0].target.scrollHeight;
// 设置高度
iframe.style.height = height + 'px';
});

// 观察iframe内容
resizeObserver.observe(iframeDoc.documentElement);

// 初始设置高度
iframe.style.height = iframeDoc.documentElement.scrollHeight + 'px';
} catch (e) {
console.error("ResizeObserver 错误:", e);
}
});
});
});
Expand Down Expand Up @@ -954,15 +986,17 @@ function quote(who, num) {
what = selectedText;
} else {
// If not, try to get the specified post
var data = $("#floor" + num).html();
const $iframe = $("#floor" + num);
const $textblock = $iframe.contents().find(".textblock");
var data = $textblock.html();

$("#floor" + num)
$textblock
.find(".quotel")
.each(function() {
$(this).remove();
});
what = $("#floor" + num).html();
$("#floor" + num).html(data);
what = $textblock.html();
$textblock.html(data);

if (what.length >= 133) what = what.substr(0, 130) + "...";

Expand Down
Loading