您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make it possible to quickly find the current document in the tree view on Coda.io
// ==UserScript== // @name Coda.io - Scroll Current Page Into View // @namespace http://tampermonkey.net/ // @version 0.1 // @description Make it possible to quickly find the current document in the tree view on Coda.io // @author Paul Wheeler // @license CC0 // @match https://coda.io/* // @icon https://www.google.com/s2/favicons?sz=64&domain=coda.io // @grant none // ==/UserScript== (function() { 'use strict'; function scrollCurrentPageIntoView() { let pageListDiv = [...document.getElementsByTagName('div')].filter(d => d.getAttribute('data-coda-ui-id') === 'page-list')[0]; let slug = window.location.href.split('/').slice(-1)[0].replace(/#.*$/, '') let pageLink = [...pageListDiv.getElementsByTagName('a')].filter(a => a.href.split('/').slice(-1)[0] === slug)[0]; pageLink.scrollIntoView(); } function maybeInjectScrollIntoViewButton(mutationsList, observer) { // Inject the scroll into view button if it doesn't exist yet if (!document.getElementById('scrollCurrentIntoViewBtn')) { // Check if the page header is loaded let addCoverBtn = [...document.getElementsByTagName('span')].filter(d => d.getAttribute('data-coda-ui-id') === 'page-header-add-cover')[0]; if (addCoverBtn) { let headerButtonContainer = addCoverBtn.parentElement; let btn = document.createElement('span'); btn.id = 'scrollCurrentIntoViewBtn'; btn.className = addCoverBtn.className; btn.innerText = '↕️ Scroll Into View'; btn.addEventListener('click', scrollCurrentPageIntoView); headerButtonContainer.appendChild(btn); } } }; const observer = new MutationObserver(maybeInjectScrollIntoViewButton); observer.observe(document.body, { attributes: false, childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址