// ==UserScript==
// @name 九色-优化
// @version 1.0.0
// @namespace https://sleazyfork.org/zh-CN/users/1461640-%E6%98%9F%E5%AE%BF%E8%80%81%E9%AD%94
// @author 星宿老魔
// @description 91porny(九色)视频宽屏,移除广告
// @match https://91porny.com/*
// @match https://*.jiuse.vip/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=91porny.com
// @license MIT
// @grant none
// @run-at document-start
// ==/UserScript==
(function(){'use strict';function t(){const t=document.createElement('style')
;t.textContent='\n .videoPlayContainer {\n width: 100% !important;\n max-width: 100% !important;\n margin: 0 auto !important;\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n .video-js {\n width: 100% !important;\n max-width: 100% !important;\n }\n .row .col-100 {\n width: 100% !important;\n max-width: 100% !important;\n flex-basis: 100% !important;\n margin: 0 !important;\n padding: 0 10px !important;\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n .row {\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n .row .side.col-40.col-md-50 {\n display: none;\n }\n .videoPlayContainer .scale {\n padding-bottom: 0 !important;\n height: auto !important;\n min-height: 0 !important;\n aspect-ratio: unset !important;\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n .videoPlayContainer .video-js {\n position: relative !important;\n top: 0 !important;\n left: 0 !important;\n }\n .videoPlayContainer,\n .videoPlayContainer > *,\n .col-100 {\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n body .container .row:first-child {\n margin-top: 0 !important;\n padding-top: 0 !important;\n }\n \n .rec-tabs-container {\n display: flex;\n gap: 10px;\n margin-bottom: 10px;\n }\n .rec-tab-button {\n background-color: #333;\n color: #fff;\n border: 1px solid #555;\n padding: 8px 15px;\n cursor: pointer;\n border-radius: 5px;\n font-size: 16px;\n font-weight: bold;\n }\n .rec-tab-button.active {\n background-color: #f0ad4e;\n color: #000;\n border-color: #f0ad4e;\n }\n .rec-tab-button:not(.active):hover {\n background-color: #444;\n }\n #recommended-videos-container, #author-videos-container {\n flex-wrap: wrap;\n }\n .d9867a703dd9335a77b9f88459aa7bff {\n display: none !important;\n }\n \n /* 广告拦截CSS - 仅针对特定广告容器 */\n .aa9965ce0d851e635fa7ec1dbf56d965,\n #po-s6 {\n display: none !important;\n visibility: hidden !important;\n }\n '
;document.head.appendChild(t)}function e(){function t(){
const t=document.querySelector(d.videoContainer),a=document.querySelector(d.videoElement);if(!t&&!a)return;e();n();o()
;i();if(t){t.style.width='100%';t.style.maxWidth='100%';t.style.margin='0 auto';t.style.position='relative'}if(a){
const e=16/9,n=t?t.offsetWidth:window.innerWidth,o=n/e;a.style.height=`${o}px`;a.style.width='100%'
;a.style.maxWidth='100%'}const r=document.querySelector(d.controlBar);r&&(r.style.width='100%')}function e(){
const t=document.querySelector(d.videoColumn);if(t){t.style.width='100%';t.style.maxWidth='100%'
;t.style.flexBasis='100%';t.style.margin='0';t.style.padding='0 10px';t.style.marginTop='0';t.style.paddingTop='0'
;t.classList.remove('col-60','offset-md-10','col-md-40');t.classList.add('col-100')}}function n(){
const t=document.querySelector(d.videoRow);if(t){t.style.marginTop='0';t.style.paddingTop='0'}}function o(){
const t=document.querySelector(d.scaleElement);if(t){t.style.paddingBottom='0';t.style.height='auto'
;t.style.minHeight='0';t.style.aspectRatio='unset';t.style.marginTop='0';t.style.paddingTop='0'}}function i(){
const t=document.querySelector(d.videoContainer);if(t){t.style.marginTop='0';t.style.paddingTop='0'}}t()
;window.addEventListener('resize',()=>{t()})}function n(){function t(){const t=document.createElement('div')
;t.id='author-info-container';t.style.display='none';return t}function e(){const t=document.createElement('div')
;t.id='author-videos-container';t.className='row';t.style.display='none';return t}function n(){
const t=document.createElement('button');t.textContent='视频推荐';t.className='rec-tab-button active'
;const e=document.createElement('button');e.textContent='作者视频';e.className='rec-tab-button'
;const n=document.createElement('div');n.id='rec-tabs-container';n.className='rec-tabs-container';n.appendChild(t)
;n.appendChild(e);return{recommendedBtn:t,authorBtn:e,buttonContainer:n}}function o(t,e,n,o,a){
t.addEventListener('click',()=>{t.classList.add('active');e.classList.remove('active');n.style.display='flex'
;o.style.display='none';a.style.display='none'});e.addEventListener('click',()=>{e.classList.add('active')
;t.classList.remove('active');n.style.display='none';o.style.display='flex';a.style.display='block'
;if(0===o.children.length){const t=document.querySelector('.d-flex.justify-content-between a[href*="/author/"]')
;t?i(t.href,o,a):o.innerHTML='<p style="color: white; padding: 20px;">未找到当前视频的作者信息。</p>'}})}function i(t,e,n){
e.innerHTML='<p style="color: white; padding: 20px;">正在加载作者视频...</p>';n.innerHTML=''
;fetch(t).then(t=>t.text()).then(o=>{
const i=new DOMParser,a=i.parseFromString(o,'text/html'),d=Array.from(a.querySelectorAll('p, h1, h2, h3, h4, h5')).find(t=>t.textContent?.includes('共计')&&t.textContent?.includes('视频'))
;if(d){const e=document.createElement('a');e.href=t;e.target='_blank';let o=d.textContent?.trim()||'',i=o.split(',')[0]
;i===o&&(i=o.split(',')[0]);e.textContent=i;e.title='点击跳转作者主页';e.style.color='#f0ad4e';e.style.display='block'
;e.style.marginBottom='10px';n.appendChild(e)}const r=a.querySelectorAll('.colVideoList');e.innerHTML=''
;r.length>0?r.forEach(t=>{e.appendChild(t)}):e.innerHTML='<p style="color: white; padding: 20px;">该作者没有其他视频。</p>'
}).catch(()=>{e.innerHTML='<p style="color: white; padding: 20px;">加载作者视频失败。</p>'})}(function a(){
if(document.getElementById('rec-tabs-container'))return
;const i=Array.from(document.querySelectorAll('h5.container-title')).find(t=>'视频推荐'===t.textContent?.trim())
;if(!i)return;const a=i.parentElement,d=a.nextElementSibling;if(!d||!d.classList.contains('row'))return
;d.id='recommended-videos-container';d.style.display='flex';const r=t();d.parentNode?.insertBefore(r,d);const c=e()
;r.parentNode?.insertBefore(c,r.nextSibling);const{recommendedBtn:s,authorBtn:l,buttonContainer:m}=n();a.innerHTML=''
;a.appendChild(m);o(s,l,d,c,r)})()}function o(){function t(){let t=!1
;const n=document.querySelector('.aa9965ce0d851e635fa7ec1dbf56d965');if(n){n.remove();t=!0}
const o=document.getElementById('po-s6');if(o){o.remove();t=!0}
['div[class*="aa9965ce0d851e635fa7ec1dbf56d965"]','.tab-content .coment-bottom','.commented-section'].forEach(e=>{
document.querySelectorAll(e).forEach(e=>{const n=e.textContent||'';if(n.includes('hqckq1044.com')||n.includes('约炮软件')){
e.remove();t=!0}})});t||e()}function e(){
const t=['hqckq1044.com','约炮软件','作者留言:小钢圈nine','现在约炮软件层出不穷','官方直营团队'],e=document.querySelectorAll('*')
;for(const o of e){const e=o.textContent||'';if(t.some(t=>e.includes(t))){const t=n(o);if(t){t.remove();break}}}}
function n(t){let e=t;for(;e&&e!==document.body;){const t=e.className||'',n=e.id||''
;if(t.includes('coment')||t.includes('comment')||t.includes('tab-content')||n.includes('po-s')||'DIV'===e.tagName&&t.length>20)return e
;e=e.parentElement}return t}function o(t){const e=t.className||'',n=t.id||'',o=t.textContent||''
;return!(!e.includes('aa9965ce0d851e635fa7ec1dbf56d965')&&'po-s6'!==n)||['hqckq1044.com','约炮软件','作者留言:小钢圈nine'].some(t=>o.includes(t))
}let i=!1;if(!i){(function t(){const t=new MutationObserver(t=>{t.forEach(t=>{
t.addedNodes.length>0&&t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const e=t;o(e)&&e.remove()
;e.querySelectorAll('.aa9965ce0d851e635fa7ec1dbf56d965, #po-s6').forEach(t=>{t.remove()})}})})})
;t.observe(document.body,{childList:!0,subtree:!0})})();i=!0}t();return{checkAndRemoveAds:function a(){t()}}}
function i(){function t(t,e){let n;return function(...o){clearTimeout(n);n=setTimeout(()=>{clearTimeout(n);t(...o)},e)}}
(function o(){const o=t(()=>{e();n();adBlocker.checkAndRemoveAds()},250)
;'loading'===document.readyState?document.addEventListener('DOMContentLoaded',()=>setTimeout(o,500)):setTimeout(o,500)
;document.addEventListener('load',t=>{const n=t.target;'VIDEO'!==n.tagName&&'IFRAME'!==n.tagName||e()},!0)
;window.addEventListener('load',o)})();(function i(){const o=t(()=>{e();n();adBlocker.checkAndRemoveAds()
},250),i=new MutationObserver(t=>{let e=!1;t.forEach(t=>{t.addedNodes.length>0&&(e=!0)});e&&o()})
;i.observe(document.body,{childList:!0,subtree:!0})})()}function a(){try{t();o();e();n();i()}catch(a){}}const d={
videoContainer:'.videoPlayContainer',videoElement:'.video-js',videoRow:'.row',
videoColumn:'.left.col-60.offset-md-10.col-md-40, .left.col-md-40.offset-md-10.col-60',controlBar:'.vjs-control-bar',
scaleElement:'.scale'}
;'loading'===document.readyState?document.addEventListener('DOMContentLoaded',()=>setTimeout(a,100)):setTimeout(a,100)
})();