• 博客园美化首页随笔同时一天发布内容分开分开版块展示


    博客园美化首页随笔同时一天发布内容分开分开版块展示

    由于我有点强迫症很不习惯博客园会把同一天发的随笔黏一起

    一.直接上js代码

    <script>
        let forFlow = document.querySelector('.forFlow');
        let day = forFlow.querySelectorAll('.day');
        let topicListFooter = forFlow.querySelector('.topicListFooter');
        let forFlow_html = '';
        let new_day_html = '';
        let new_data = '';
        for (let day_index = 0; day_index < day.length; day_index++) {
            let dayTitle = day[day_index].querySelector('.dayTitle');
            let day_html = day[day_index].innerHTML;
            day_html_list = day_html.split('</div>');
            for (let day_html_list_index = 0; day_html_list_index < day_html_list.length - 1; day_html_list_index++) {
                data = day_html_list[day_html_list_index];
                let data_dayTitle = (data.match('dayTitle'));
                let data_postCon = (data.match('postCon'));
                let data_postTitle = (data.match('postTitle'));
                let data_clear = (data.match('clear'));
                let data_postSeparator = (data.match('postSeparator'));
                let data_postDesc = (data.match('postDesc'));
                if (data_postTitle != null) {
                    new_data = '<div class="day">' + '<div class="dayTitle">' + dayTitle.innerHTML + '</div>' + data + '</div>';
                } else if (data_postCon != null) {
                    new_data = data + '</div>' + '<div class="postDesc"></div>'+'<div class="clear"></div>'+'</div>';
    
                } else {
                    if (data_dayTitle == null) {
                        if (data_postDesc == null) {
                            if (data_postSeparator == null) {
                                if (data_clear == null) {
                                    new_data = data + '</div>';
                                }
                                else {
                                new_data = ''
    
                            }
                            }
    
                        }
    
                    }
    
                }
                console.log(new_data);
                new_day_html = new_day_html + new_data;
    
            }
    
            forFlow_html = forFlow_html + new_day_html;
            new_day_html = '';
            new_data = '';
    
        }
        forFlow_html = forFlow_html+'<div class="topicListFooter">' + topicListFooter.innerHTML + '</div>';
        if (forFlow_html != '') {                     <!-- 为了解决正文会无法加载-->
            forFlow.innerHTML = forFlow_html
        }
    </script>
    

    二.缺点

    1.编辑栏我把他删了 因为我用不到

    要修改区域在

       if (data_postDesc == null) 
        这里修改代码
    
  • 相关阅读:
    iOS
    关于HTTP协议学习(三)
    关于HTTP协议学习(二)
    关于HTTP协议学习(一)
    Swift之Swift编码规范
    老罗学习MVC之旅:MVC组件分析
    android 左右翻页
    android 检测网络是否可用
    android 在线升级借助开源中国App源码
    android 渐变展示启动屏
  • 原文地址:https://www.cnblogs.com/pythonywy/p/11374654.html
Copyright © 2020-2023  润新知