博客園美化首頁隨筆同時一天發佈內容分開分開版塊展示 一.直接上js代碼 二.缺點 1.編輯欄我把他刪了 因為我用不到 要修改區域在 ...
博客園美化首頁隨筆同時一天發佈內容分開分開版塊展示
由於我有點強迫症很不習慣博客園會把同一天發的隨筆黏一起
一.直接上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)
這裡修改代碼