Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【求助】这是一个求助 #70

Open
LoCCai opened this issue Mar 25, 2023 · 17 comments
Open

【求助】这是一个求助 #70

LoCCai opened this issue Mar 25, 2023 · 17 comments
Assignees

Comments

@LoCCai
Copy link

LoCCai commented Mar 25, 2023

No description provided.

@LoCCai
Copy link
Author

LoCCai commented Mar 25, 2023

大佬们好,我修改了index.php 这部分的代码

<div class="mdui-card-primary-title"><?php $this->sticky();$this -> title(); ?></div>
                <div class="mdui-card-primary-subtitle index-info"><strong>[<?php $this -> tags('] ['); ?>]</strong><br />
                    <strong>❃<?php $this -> category(','); ?>❃</strong>
                    <?php $this -> date(); ?><?php get_post_view($this) ?> 浏览|
                <?php $this -> commentsNum('没有评论呐', '孤单 の 1 条评论', '%d 条评论'); ?></div>
                <div class="mdui-card-primary-subtitle index-subtitle"><?php $this -> excerpt(); ?></div>

用以改变主页面的卡片样式

@LoCCai
Copy link
Author

LoCCai commented Mar 25, 2023

image

@LoCCai
Copy link
Author

LoCCai commented Mar 25, 2023

但是只能在第一页正常显示

在主页上,向下滑动至第二页后均会造成布局混乱。
有大佬可以帮忙解惑吗?

目前博客粗暴的用跳转链接其他页面了。

相关链接:
https://blog.loccai.top/
https://blog.loccai.top/index.php/page/2/

@bhaoo
Copy link
Owner

bhaoo commented Mar 28, 2023

混乱前和混乱后的图片可以提供一下吗?还有你修改这段代码的commit有么,有的话可以提供一下

@LoCCai
Copy link
Author

LoCCai commented Mar 29, 2023

上图即为改后卡片格式,在第一页的所有卡片都如图正常显示。
向下滚动至超出当前页最大文章卡片数(typecho->阅读设置->每页文章数目)就会出现如下图情况
1680076495477

@LoCCai
Copy link
Author

LoCCai commented Mar 29, 2023

commit没得,我都是打包然后上传到服务器直接改的,没用git。
修改的文件:index.php
修改起始行:60
原始代码:

                <div class="mdui-card-primary-title"><?php $this->sticky();$this -> title(); ?></div>
                <div class="mdui-card-primary-subtitle index-info"><?php $this -> date(); ?><?php $this -> commentsNum('0 条评论', '1 条评论', '%d 条评论'); ?></div>
                <div class="mdui-card-primary-subtitle index-subtitle"><?php $this -> excerpt(); ?></div>

修改后代码:

                <div class="mdui-card-primary-title"><?php $this->sticky();$this -> title(); ?></div>
                <div class="mdui-card-primary-subtitle index-info"><strong>[<?php $this -> tags('] ['); ?>]</strong><br />
                    <strong>❃<?php $this -> category(','); ?>❃</strong>
                    <?php $this -> date(); ?><?php get_post_view($this) ?> 浏览|
                <?php $this -> commentsNum('没有评论呐', '孤单 の 1 条评论', '%d 条评论'); ?></div>
                <div class="mdui-card-primary-subtitle index-subtitle"><?php $this -> excerpt(); ?></div>

@LoCCai
Copy link
Author

LoCCai commented Mar 29, 2023

相关的achieve.php部分一并修改了。

@bhaoo
Copy link
Owner

bhaoo commented May 26, 2023

抱歉 来晚力 问题还存在么?

@bhaoo
Copy link
Owner

bhaoo commented Aug 2, 2023

这几天看了下,出现这个问题的原因是因为你添加的

<?php $this -> tags('] ['); ?>
<?php $this -> category(','); ?>

会解析变成带有 <a></a> 标签的内容,但是最外层已经有一个 a 标签包裹了,所以会导致样式问题

@bhaoo
Copy link
Owner

bhaoo commented Aug 2, 2023

要解决这个问题就需要重新规划 a 标签力

@bhaoo bhaoo self-assigned this Aug 2, 2023
@bhaoo bhaoo closed this as completed Oct 26, 2023
@LoCCai
Copy link
Author

LoCCai commented Aug 24, 2024

原来如此

@LoCCai
Copy link
Author

LoCCai commented Aug 25, 2024

@bhaoo 大佬,我想问一下如果我修改这里的a标签用div在外面嵌套里面的话,懒加载部分加载的标签在哪里修改啊

@bhaoo
Copy link
Owner

bhaoo commented Aug 25, 2024

@LoCCai 指的是瀑布流加载下一页的那个吗?可以说明再详细一点么,贴上些源码?Σ(・ิ¬・ิ)

@LoCCai
Copy link
Author

LoCCai commented Aug 26, 2024

就是我想把article标签里面追加的class为 post 的 a标签改为 div 。 然后不添加href指向。而后将指向性a标签(permalink)添加到index-img 和 index-primary部分。这样里面嵌套的a标签就不会有问题了。但是这样后续加载下一页时。追加到article的标签还是a标签。也就是需要改typecho 博客 下一页获取到的内容模板。但是我没找到在哪里。看那个cuckoo.min.js的IFS函数,没看太懂

@LoCCai
Copy link
Author

LoCCai commented Aug 26, 2024

<div class="article">
have()) : while ($this->next()) : if ($this->fields->articleType == "article" or $this->fields->articleType == NULL) { ?>
  <div class="post no-change">
    <div class="mdui-card index-card mdui-hoverable">
      <div class="mdui-card-media index-img-media">
              <a href=" > permalink() ?>">
                <div class="index-img" data-bg="<?php $wzimg = $this->fields->wzimg;if (!empty($wzimg)) {echo $wzimg;} else {echo randPic();} ?>"></div>
                <div class="index-card-filter"></div>
              </a >
        <div class="mdui-card-media-covered">
          <div class="mdui-card-primary index-primary">
                    <a href="<?php $this -> permalink() ?>">
                        <div class="mdui-card-primary-title"><?php $this->sticky();$this -> title(); ?></div>
                    </a >
            <div class="mdui-card-primary-subtitle index-info"><strong>[<?php $this -> tags('] ['); ?>]</strong><br />
                <strong>❃<?php $this -> category('->'); ?>❃</strong>
                <?php $this -> date(); ?>
              |<?php get_post_view($this) ?> 浏览|
            <?php $this -> commentsNum('没有评论呐', '孤单 の 1 条评论', '%d 条评论'); ?></div>
            <div class="mdui-card-primary-subtitle index-subtitle"><?php $this -> excerpt(); ?></div>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php } elseif ($this->fields->articleType == "daily") { ?>
  <div class="mdui-card index-card-daily mdui-hoverable post">
    <div class="index-icon mdui-shadow-3">
      <div></div>
      <i class="mdui-icon material-icons">message</i>
    </div>
    <div class="mdui-card-primary">
        <div class="mdui-card-primary-title"><?php $this -> title(); ?></div>
      <div class="mdui-card-primary-subtitle mdui-typo"><strong>[<?php $this -> tags('] ['); ?>]</strong><br />
                <strong>❃<?php $this -> category('->'); ?>❃</strong>
                <?php $this->sticky(); $this -> date('Y-m-d H:i:s'); ?></div>
    </div>
    <div class="mdui-card-content mdui-typo"><?php parseContent(parseBiaoQing($this->content)); ?></div>
  </div>
  <?php
}
endwhile; ?>
</div>
<?php $this->pageLink('下一页', 'next'); ?>

@LoCCai
Copy link
Author

LoCCai commented Aug 26, 2024

var patt1 = /Powered By <a(.) href="http://www.typecho.org"(.)>Typecho</a>/i;
var ivd = 'copy';
var IFS = function () {
let infScroll = new InfiniteScroll('.article', {
path: '.next',
hideNav: '.next',
append: '.post',
history: false,
button: '.changePage-load',
status: '.changePage-end',
checkLastPage: '.checkLast'
});
infScroll.on('load', onPageLoad);
infScroll.on('append', function () {
defaults();
lazyload();
pjax.refresh($('.article')[0]);
});
infScroll.on('last', function () {
$('.changePage-load')
.css('display', 'none')
});

function onPageLoad() {
if (infScroll.loadCount == 1) {
infScroll.options.loadOnScroll = false;
$('.changePage-load')
.css('display', 'block');
infScroll.off(onPageLoad)
}
}

};
if ($('.article')
.length && $('.changePage-load')
.length) {
IFS()
};
defaults = function () {
if (!patt1.test($(po + ck + ook)
.html()) || !patt.test($(po + ck + ook)
.html()) || $(po + ck + ook)
.length == 0 || $(po + ck + ook)
.css('d' + dwq + 'play') == 'none' || $(po + ck + ook)
.css('v' + dwq + 'i' + acf + 'ty') == 'hidden' || $(po + ck + ook)
.css('v' + dwq + 'i' + acf + 'ty') == 'collapse' || $(patt2)
.css('d' + dwq + 'play') == 'none') {
$(".mdui-card-primary-title, .mdui-card-content")
.html(msg);
$(".mdui-typo-title")
.html(msg);
$(po + ck + ivd)
.html(msg);
$(".mdui-card-primary-title")
.html(msg);
$(".article-page")
.html(msg);
$(".post-content")
.html(msg)
}
};

@LoCCai
Copy link
Author

LoCCai commented Aug 26, 2024

大概就是这样,想让后面追加到article的a标签变成div,并和php中的一样

@bhaoo bhaoo reopened this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants