tampermonkey 油猴 改變網站 樣式 css style 增加按鈕功能


@run-at
https://www.tampermonkey.net/documentation.php#_run_at
document-start
document-body
document-end
document-idle
context-menu
https://wiki.greasespot.net/Metadata_Block#.40run-at
document-end
document-start
document-idle

不廢話直接上代碼

// ==UserScript==
// @name          delphibox-2ccc
// @namespace     http://userstyles.org
// @description	  delphibox bbs.2ccc.com beautify prettify high-dpi
// @author        HUIANG
// @homepage      https://userstyles.org/styles/204336
// @include       http://bbs.2ccc.com/*
// @include       https://bbs.2ccc.com/*
// @include       http://*.bbs.2ccc.com/*
// @include       https://*.bbs.2ccc.com/*
// @run-at        document-start
// @version       0.20210526074900
// ==/UserScript==
(function() {var css = [
	"body {",
	"    font-family: source-han-serif-tc, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif!important;",
	"    min-width: unset;",
	"    background: none!important;",
	"    background-color: rgba(119, 136, 153, .8)!important;",
	"    FONT-SIZE: 11pt; ",
	"}",
	"",
	"table[width=\"770\"] {",
	"    border-radius: 5px!important;",
	"    min-width:770px;",
	"    width: 100%;",
	"}",
	"",
	"td {",
	"    FONT-SIZE: 11pt; ",
	"}",
	"td[width=\"3\"] {",
	"    min-width:3px;",
	"    width:3px;",
	"}",
	"td[width=\"151\"] {",
	"    min-width:151px;",
	"    width:15%;",
	"}",
	"table[width=\"151\"] {",
	"    min-width:151px;",
	"    width:100%;",
	"}",
	"",
	"td[colspan=\"2\"] {",
	"    line-height: 26px;",
	"}",
	"",
	"tr[bgcolor] > td[align=\"right\"] {",
	"    min-width: 45px;",
	"    width: 6%;",
	"}",
	"",
	"div[class=\"parent\"] {",
	"    border-radius: 8px;",
	"    padding-top: 10px;",
	"    text-shadow: rgba(0,0,0,0.296875) 0 2px 3px",
	"}",
	"",
	"div[class=\"child\"] {",
	"    position: relative;",
	"    top: -10px; ",
	"}",
	"",
	".parent tr {",
	"    background-color: rgb(196, 223, 250)!important;    ",
	"}",
	"",
	".parent > table {",
	"    background-color: rgb(247, 247, 247)!important; ",
	"    padding-bottom: 10px;",
	"    border-radius: 8px 8px 8px 8px!important;   ",
	"}",
	"",
	".parent + .parent tr {",
	"    background-color: rgb(196, 223, 250)!important;",
	"}",
	"",
	".parent tr:first-child td:first-child {",
	"    border-top-left-radius: 8px;",
	"}",
	".parent tr:first-child td:last-child {",
	"    border-top-right-radius: 8px;",
	"}",
	".parent tr:first-child td:nth-child(2) {",
	"    font-size: 12pt;",
	"}",
	"",
	".child > table {",
	"    border-radius: 0px 0px 8px 8px!important;    ",
	"}",
	"",
	".child tr:last-child td:first-child {",
	"    border-bottom-left-radius: 8px;",
	"}",
	".child tr:last-child td:last-child {",
	"    border-bottom-right-radius: 8px;",
	"}",
	"",
	"table[bgcolor=\"#666666\"] a {",
	"    display: inline-block;",
	"    padding: 3px 12px;",
	"    background: #ecedee;",
	"    border-radius: 12px;",
	"    color: #888;",
	"    font-size: 13px;",
	"    line-height: 18px;",
	"}",
	"table[background=\"images/bg_blue.jpg\"] {",
	"    background: none;",
	"}",
	"img[src=\"http://icon.cnzz.com/img/pic.gif\"] {",
	"    display: none;",
	"}",
	"",
	".line ,.text{",
	"    box-sizing: border-box;",
	"    padding: 3px 16px;",
	"    outline: none;",
	"    font-size: 12px;",
	"    color: #C4C9D2;",
	"    letter-spacing: 0;",
	"    line-height: 20px;",
	"    background-color: #FFFFFF!important;",
	"    border: 1px solid #E1E4E8!important;",
	"    border-radius: 2px;  ",
	"}",
	".line:hover, .text:hover {",
	"    color: #252a32;",
	"    border-color:#2196F3!important;",
	"}",
	".line:focus, .text:focus {",
	"    color: #252a32;",
	"    border-color:#2196F3!important;",
	"    box-shadow:0 0 0 2px rgba(24,144,255,.2);    ",
	"}",
	".button, .button2 {",
	"    display: inline-block;",
	"    margin-top: 2px;",
	"    margin-bottom: 2px;",
	"    margin-right: 2px;",
	"    text-align: center;",
	"    text-transform: uppercase;",
	"    vertical-align: middle;",
	"    cursor: pointer;",
	"    background-image: none;",
	"    padding: 2px 10px;",
	"    font-size: 1rem;",
	"    border-radius: 3px;",
	"    border: 1px solid #2196f3;",
	"    text-decoration: none;",
	"    user-select: none;",
	"    color: #888;",
	"    background: rgb(247, 247, 247);",
	"    box-shadow: none;",
	"}",
	".button:hover, .button2:hover {",
	"    border-color: transparent;",
	"    color: #fff;",
	"    background: #90a4ae;",
	"    box-shadow: none;",
	"    text-decoration: none;",
	"}",
	".button:active, .button2:active {",
	"    border-color: #546e7a;",
	"    color: #cfd8dc;",
	"    background: #546e7a;",
	"    box-shadow: none;",
	"}",
	"",
	"table[width=\"100%\"] > a[href=\"javascript:OpenInfoWin(\'http://www.2ccc.com/member.asp?membername=patebeng1\"] {",
	"    display: none!important;",
	"}",
	"",
	"/* -------------------- 2ccc  bbs.ccs --------------------- */",
	"",
	"A:link{",
	"    FONT-SIZE: 12pt;",
	"}",
	"A:visited {",
	"    FONT-SIZE: 12pt}",
	"A:hover {",
	"    COLOR: #FF0000; ",
	"    FONT-SIZE: 12pt}",
	".text {",
	"    FONT-SIZE: 10pt",
	"}",
	".text2 {",
	"    FONT-SIZE: 10pt;",
	"}  ",
	".textarea {",
	"    FONT-SIZE: 10pt",
	"}",
	".textarea2 {",
	"    FONT-SIZE: 10pt",
	"}",
	".button {",
	"/*     FONT-SIZE: 10pt */",
	"}",
	".button2 {",
	"    FONT-SIZE: 10pt",
	"  }",
	".line { ",
	"/*     border-color: rgba(242, 250, 100, .8)!important; */",
	"}",
	".select {",
	"    FONT-SIZE: 10pt",
	"}",
	".select2 {",
	"    box-sizing: border-box;",
	"    padding: 3px 16px;",
	"    outline: none;",
	"    font-size: 12px;",
	"    color: #C4C9D2;",
	"    letter-spacing: 0;",
	"    line-height: 20px;",
	"    background-color: #FFFFFF;",
	"    border: 1px solid #E1E4E8;",
	"    border-radius: 2px;",
	"}",
	".select2:hover {",
	"    color: #252a32;",
	"    border-color:#2196F3;",
	"}",
	".select2::focus {",
	"    color: #252a32;",
	"    border-color:#2196F3;",
	"    box-shadow:0 0 0 2px rgba(24,144,255,.2);",
	"}",
	".file {",
	"    height: 30px;",
	"    width: 40px;",
	"    font-size: 10pt;",
	"}",
	".shadow1{",
	"    FONT-SIZE: 10pt;",
	"}",
	".shadow2{",
	"    FONT-SIZE: 10pt;",
	"}",
	".shadow3{FONT-SIZE: 10pt;",
	"}",
	".bigfont {",
	"/* 	FONT-SIZE: 12pt; */",
	"/*     LINE-HEIGHT: 140% */",
	"}"
].join("\n");
if (typeof GM_addStyle != "undefined") {
	GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
	PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
	addStyle(css);
} else {
	var node = document.createElement("style");
	node.type = "text/css";
	node.appendChild(document.createTextNode(css));
	var heads = document.getElementsByTagName("head");
	if (heads.length > 0) {
		heads[0].appendChild(node);
	} else {
		// no head yet, stick it whereever
		document.documentElement.appendChild(node);
	}
}
})();

// ==UserScript==
// @name stackoverflow刪除頁面元素
// @description Prevents annoying ads from displaying 18+
// @version 2017.09.42
// @include *://stackoverflow.com/*
// @run-at        document-start
// @namespace https://openuserjs.org/users/nonedude
// @require http://code.jquery.com/jquery-1.11.1.min.js
// @license MIT
// ==/UserScript==

//////$(".div").removeClass("ff-sans ps-fixed z-nav-fixed ws4 sm:w-auto p32 sm:p16 bg-black-750 fc-white bar-lg b16 l16 r16 js-consent-banner");

var box=document.querySelector("body > div.ff-sans.ps-fixed.z-nav-fixed.ws4.sm\\:w-auto.p32.sm\\:p16.bg-black-750.fc-white.bar-lg.b16.l16.r16.js-consent-banner");
box.remove();
//////$("#ff-sans ps-fixed z-nav-fixed ws4 sm:w-auto p32 sm:p16 bg-black-750 fc-white bar-lg b16 l16 r16 js-consent-banner").remove();
/////$("div[id^='age-verification-container']").remove();

小按鈕窗口

// ==UserScript==
// @author            Hunlongyu
// @name              小窗口跳轉
// @namespace         https://github.com/Hunlongyu
// @icon              https://i.loli.net/2019/04/22/5cbd720718fdb.png
// @description       匹配 m3u8 資源,點擊播放,即跳轉到播放器頁面自動緩沖播放。
// @version           0.6.3
// @include           *
// @grant             GM_xmlhttpRequest
// @grant             GM_setClipboard
// @grant             GM_addStyle
// @run-at            document-end
// @supportURL        https://gist.github.com/Hunlongyu/31f7a08294efdacebcce9b527afb1c11
// note               2019/07/31 新增對 MP4 格式支持,更新了資源網站
// note               2019/08/05 視頻名稱獲取更准確
// note               2019/08/09 適配更多資源網站
// note               2019/10/28 移除無效資源網站 播放頁面支持一鍵生成標題和短網址
// note               2019/11/15 資源頁面支持一鍵生成短網址, 並優化了頁面
// note               2019/11/18 切換百度短網址為 suo短網址,次數沒有限制
// note               2020/01/03 更新資源網站,修復集數顯示錯誤問題
// note               2020/01/06 優化界面,移除廣告推廣
// note               2020/11/28 優化代碼,適配更多資源網,更快的加載速度。
// ==/UserScript==

(function () {
  'use strict'

  const css =
  `
  .zyplayer {
    position: fixed;
    bottom: 1px;
    right: 1px;
    width: 16px;
    height: auto;
    z-index: 999;
    max-height: 600px;
    overflow: auto;
    background-color: #ffffff;
    padding: 20px;
    border: 1px solid #acacac;
    font-size: 16px
  }
  .zyplayer .name{
    text-align: center;
    font-size: 5px;
    color: #ff6600;
  }
  .zyplayer li{
    margin: 6px 0;
    display: flex;
    justify-content: space-between;
  }
  `

  // code here
  const player = {
    name: '',
    li: [],
    m3u8: [],
    shortUrlArr: [],
    init () {
      console.clear()
      console.log('『小助手』 已啟動!')
      this.getTitle()
    },
    getTitle () { // 判斷是否是資源頁面,並獲取資源名稱
      const h1 = document.querySelector('h1')
      const h2 = document.querySelector('h2')
      if (h1) {
        this.name = h1.innerText
      } else if (h2) {
        this.name = h2.innerText
      } else {
        this.name = document.title
      }
      this.getUrls()
    },
    getUrls () {
      const reg = /https?.*?\.m3u8/
      const list = document.querySelectorAll('li')
      if (list.length < 3) return false
      let num = 1
      for (let i = 0; i < list.length; i++) {
        const txt = list[i].outerHTML
        const flag = txt.match(reg)
        if (flag) {
          const d = {
            name: `第${num}集`,
            url: flag[0]
          }
          this.li.push(d)
          num++
        }
      }
      this.createDOM()
    },
    createDOM () {
      const dom = document.createElement('div')
      dom.setAttribute('class', 'zyplayer')
      const list = this.li
      const protocal = window.location.protocol
      const host = window.location.host
	  const url = window.location.href; /* 獲取完整URL */
      if (list.length <= 1) {
        const a = `<div class="name">${this.name}</div>
        <li>
          <a href="https://api.08bk.com/vip/?url=${url}" target="_blank">播放</a>
        </li>`
        dom.innerHTML = a
      } else {
        const a = `<div class="name">${this.name}</div>
        <li>
          <a href="https://jx.m3u8.tv/jiexi/?url=${url}" target="_blank">播放</a>
        </li>`
        dom.innerHTML = a
      }
      document.body.appendChild(dom)
      GM_addStyle(css)
    }
  }
  player.init()
})()


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM