找回密码
 快速注册
搜索
查看: 136|回复: 10

[已解决]

[复制链接]

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

hbghlyj 发表于 2022-9-14 11:12 |阅读模式
本帖最后由 hbghlyj 于 2025-3-2 00:23 编辑 已解决

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2022-9-14 14:06
要不我给 /kk/zdy3pc.js 加段:
  1.     if (window.location.href.match('highlight')) {
  2.         window.location.href = window.location.href.replace(/&highlight=.*/, '');
  3.     }
复制代码

如何?

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2022-9-14 14:08
或者从搜索那里入手,把搜出来的链接的 &highlight=.* 去掉?

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-14 21:52
kuing 发表于 2022-9-14 07:06
要不我给 /kk/zdy3pc.js 加段:

如何?

这个window.location.href.match('highlight')不如
  1. (new URL(document.location)).searchParams.has('highlight');
复制代码

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2022-9-14 21:54
hbghlyj 发表于 2022-9-14 21:49
打开控制台再刷新,菜单就出来了

不用打开控制台,我刷新了几次,有时出来有时不出。

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2022-9-25 03:47
hbghlyj 发表于 2022-9-25 03:42
好呀.

它有时还会导致MathJax出错:

不知道改哪里

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-25 17:42

搜索加号



应该是在 upload/source/function/function_search.php
  1. function searchkey($keyword, $field, $returnsrchtxt = 0) {
  2.         $srchtxt = '';
  3.         if($field && $keyword) {
  4.                 if(preg_match("(AND|\+|&|\s)", $keyword) && !preg_match("(OR|\|)", $keyword)) {
  5.                         $andor = ' AND ';
  6.                         $keywordsrch = '1';
  7.                         $keyword = preg_replace("/( AND |&| )/is", "+", $keyword);
  8.                 } else {
  9.                         $andor = ' OR ';
  10.                         $keywordsrch = '0';
  11.                         $keyword = preg_replace("/( OR |\|)/is", "+", $keyword);
  12.                 }
  13.                 $keyword = str_replace('*', '%', addcslashes($keyword, '%_'));
  14.                 $srchtxt = $returnsrchtxt ? $keyword : '';
  15.                 foreach(explode('+', $keyword) as $text) {
  16.                         $text = trim(daddslashes($text));
  17.                         if($text) {
  18.                                 $keywordsrch .= $andor;
  19.                                 $keywordsrch .= str_replace('{text}', $text, $field);
  20.                         }
  21.                 }
  22.                 $keyword = " AND ($keywordsrch)";
  23.         }
  24.         return $returnsrchtxt ? array($srchtxt, $keyword) : $keyword;
  25. }
复制代码

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-25 17:59

高亮

我看了一下,好像应该是在 source/function/function_search.php以及 source/module/search/search_forum.php

function bat_highlight(\$message, \$words, \$color = '#ff0000') {
        if(!empty(\$words)) {
                \$highlightarray = explode(' ', \$words);
                \$sppos = strrpos(\$message, chr(0).chr(0).chr(0));
                if(\$sppos !== FALSE) {
                        \$specialextra = substr(\$message, \$sppos + 3);
                        \$message = substr(\$message, 0, \$sppos);
                }
                bat_highlight_callback_highlight_21(\$highlightarray, 1);
                \$message = preg_replace_callback("/(^|>)([^<]+)(?=<|\$)/sU", 'bat_highlight_callback_highlight_21', \$message);
                \$message = preg_replace("/<highlight>(.*)<\/highlight>/siU", "<strong><font color=\"\$color\">\\1</font></strong>", \$message);
                if(\$sppos !== FALSE) {
                        \$message = \$message.chr(0).chr(0).chr(0).\$specialextra;
                }
        }
        return \$message;
}
                foreach(C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',',\$index['ids']), null, 0, \$orderby, \$start_limit, \$_G['tpp'], '>=', \$ascdesc) as \$thread) {
                        \$thread['subject'] = bat_highlight(\$thread['subject'], \$keyword);
                        \$thread['realtid'] = \$thread['isgroup'] == 1 ? \$thread['closed'] : \$thread['tid'];
                        \$threadlist[\$thread['tid']] = procthread(\$thread, 'dt');
                        \$posttables[\$thread['posttableid']][] = \$thread['tid'];
                }
                if(\$threadlist) {
                        foreach(\$posttables as \$tableid => \$tids) {
                                foreach(C::t('forum_post')->fetch_all_by_tid(\$tableid, \$tids, true, '', 0, 0, 1) as \$post) {
                                        \$threadlist[\$post['tid']]['message'] = bat_highlight(messagecutstr(\$post['message'], 200), \$keyword);
                                }
                        }

                }

730

主题

1万

回帖

9万

积分

积分
93623
QQ

显示全部楼层

kuing 发表于 2022-9-25 21:32

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-25 21:59

原值返回



估计改成原值返回就行了
  1. function bat_highlight($message, $words, $color = '#ff0000') {
  2.     return $message;
  3. }
复制代码

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2022-9-25 22:01

比如highlight=res会把$message中的res替换成<strong><font color="#FF0000">res</font></strong>

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 18:06

Powered by Discuz!

× 快速回复 返回顶部 返回列表