1. 在後台統計放入如下代碼:
- <script>
- const mobileWidth = 650
- const style = document.createElement('style')
- style.innerHTML = `.m_c .tedt, #subjecthide, .m_c .quote, .rfm {width:100%!important}`
- const metaViewport = document.createElement('meta')
- metaViewport.setAttribute('name', 'viewport')
- metaViewport.setAttribute('content', 'width=device-width, initial-scale=1, user-scalable=0, viewport-fit=cover')
- document.head.appendChild(metaViewport)
- document.querySelector('body').style.minWidth = '0'
- document.getElementById('toptb').style.minWidth = '0'
- let isMobile = false
- if (window.innerWidth<=mobileWidth) {
- isMobile = true
- window.addEventListener("DOMContentLoaded", ()=>{document.querySelector('#frt').style.display = 'none'})
- mobileLayout()
- }
- function mobileLayout() {
- document.querySelectorAll('.wp, #scbar_txt').forEach(element => {element.style.width = 'auto'})
- document.querySelectorAll('.fl_i, .fl_by, .num, #boardlogo, .category_l3, .pls').forEach(element => {element.style.display = 'none'})
- document.querySelectorAll("#wp, #ft, .hdc.cl").forEach(element => {element.style.padding = '10px'})
- document.querySelectorAll('.by').forEach(e => e.parentNode.parentNode.querySelector('.by').style.display = 'none')
- if(document.querySelector('#frt')) document.querySelector('#frt').style.display = 'none'
- if(document.querySelector('#fastposteditor')) document.querySelector('#fastposteditor').style.marginRight = '0'
- document.querySelectorAll('.pi').forEach(el => el.querySelectorAll('strong').forEach(node => node.style.display = 'none'))
- document.head.appendChild(style)
- document.querySelectorAll("img.zoom").forEach(img => img.style.maxWidth = '100%')
- }
- function pcLayout() {
- document.querySelectorAll('.wp').forEach(element => {element.style.width = '1200px'})
- document.querySelector('#scbar_txt').style.width = '480px'
- document.querySelectorAll('.fl_i, .fl_by, .num, #boardlogo, .category_l3, .pls, #frt').forEach(element => {element.style.display = ''})
- document.querySelectorAll("#wp, #ft, .hdc.cl").forEach(element => {element.style.padding = ''})
- document.querySelectorAll('.by').forEach(e => e.parentNode.parentNode.querySelector('.by').style.display = '')
- if(document.querySelector('#fastposteditor')) document.querySelector('#fastposteditor').style.marginRight = '170px'
- document.querySelectorAll('.pi').forEach(el => el.querySelectorAll('strong').forEach(node => node.style.display = ''))
- document.head.removeChild(style)
- }
- window.addEventListener('resize', ()=>{
- if (window.innerWidth<=mobileWidth) {
- if (isMobile) return
- isMobile = true
- mobileLayout()
- } else {
- if (!isMobile) return
- isMobile = false
- pcLayout()
- }
- })
- </script>
複製代碼
2. 站點寬窄風格改成窄屏(固定寬度),允許用戶自由切換改成否
3. 作者用戶名顯示位置改成顯示在帖子內部
4. 快速發帖右側顯示推薦表情改成否
5. 僅適用於Discuz! X3.5默認主題,不適用3.4 |