您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Custom SeaTable Style
当前为
// ==UserScript== // @name SeaTable Custom Style (OnLine) // @name:zh-CN SeaTable自定义样式(在线版) // @description Custom SeaTable Style // @description:zh-cn SeaTable自定义样式 // @namespace http://tampermonkey.net/ // @version 0.5 // @author oraant // @grant none // @license MIT // @require http://code.jquery.com/jquery-3.4.1.min.js // @match *://*:4480* // @match *://*.192.168.1.2:4480/* // @match *://*.seatable.cn/* // @match *://*.table.everything.pub/* // @match *://*.biz.oraant.cc/* // ==/UserScript== /*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, that detects and handles AJAXed content. */ function waitForKeyElements ( /* IMPORTANT: This function requires your script to have loaded jQuery. */ selectorTxt, /* Required: The jQuery selector string that specifies the desired element(s). */ actionFunction, /* Required: The code to run when elements are found. It is passed a jNode to the matched element. */ bWaitOnce, /* Optional: If false, will continue to scan for new elements even after the first match is found. */ iframeSelector /* Optional: If set, identifies the iframe to search. */ ) { var targetNodes, btargetsFound; if (typeof iframeSelector == "undefined") targetNodes = $(selectorTxt); else targetNodes = $(iframeSelector).contents().find(selectorTxt); if (targetNodes && targetNodes.length > 0) { btargetsFound = true; /*--- Found target node(s). Go through each and act if they are new. */ targetNodes.each ( function () { var jThis = $(this); var alreadyFound = jThis.data ('alreadyFound') || false; if (!alreadyFound) { //--- Call the payload function. var cancelFound = actionFunction (jThis); if (cancelFound) btargetsFound = false; else jThis.data ('alreadyFound', true); } } ); } else { btargetsFound = false; } //--- Get the timer-control variable for this selector. var controlObj = waitForKeyElements.controlObj || {}; var controlKey = selectorTxt.replace (/[^\w]/g, "_"); var timeControl = controlObj [controlKey]; //--- Now set or clear the timer as appropriate. if (btargetsFound && bWaitOnce && timeControl) { //--- The only condition where we need to clear the timer. clearInterval (timeControl); delete controlObj [controlKey] } else { //--- Set a timer, if needed. if ( ! timeControl) { timeControl = setInterval ( function () { waitForKeyElements ( selectorTxt, actionFunction, bWaitOnce, iframeSelector ); }, 300 ); controlObj [controlKey] = timeControl; } } waitForKeyElements.controlObj = controlObj; } $("head").append(` <style type="text/css" id="custom_tags_css"> /* 为自律的奖罚标签设置特殊的颜色背景 */ div.react-grid-Cell[data-column_key="Je1Q"] .link { background-color:#39ab69; color:white; } div.react-grid-Cell[data-column_key="l2CX"] .link { background-color:#e36767; color:white; } /* 长文本弹窗宽度调整,阅读更加舒适 */ div.longtext-modal-dialog.longtext-preview { width:1200px; } /* 预览屏宽度 */ div.longtext-modal-dialog { width:fit-content; max-width:1800px; } /* 弹窗遮罩宽度 */ div.longtext-modal-dialog div.editor.article { width:max-content; min-width:800px; } /* 实际内容宽度 */ div.longtext-modal-dialog div.editor.article div.editor-component { min-height:500px; } /* 鼠标放上去有光标 */ div.longtext-modal-dialog div.editor.article table { width: inherit; } /* 去掉表格横线 */ div.longtext-modal-dialog div.editor.article table tr { display:inherit; } /* 取消表格宽度相等 */ div.longtext-modal-dialog div.editor.article table td { max-width:400px; } /* 防止某列过宽 */ /* 长文本弹窗排版样式 */ div.longtext-modal-dialog h1 { font-size:2.1em; } div.longtext-modal-dialog h2 { font-size:1.8em; } div.longtext-modal-dialog h3 { font-size:1.5em; } div.longtext-modal-dialog h4 { font-size:1.2em; } div.longtext-modal-dialog h5 { font-size:0.9em; } div.longtext-modal-dialog h6 { font-size:0.7em; } /* 调整列标题的tooltip格式 */ /* 改为动态调整,可以防止tip位置偏离太远 */ /* div.tooltip-inner.column-description-tip { white-space: pre; width:fit-content; max-width:800px; height:fit-content; max-height:800px; } */ /* div.longtext-modal-dialog table td span { white-space: pre; } */ /* 子表标签竖向排列,更加紧致,放的更多 */ div.tables-tabs-content div.tab-link { height:50px; padding:2px; padding-right:2px!important; writing-mode:tb-rl; } /* 单独设置 padding-right 是为了防止其自动修改内联样式的 padding-right */ /* 取消单元格边框,或者调浅 */ div.react-grid-Cell{ border:none !important; } /* div.react-grid-Cell{ border-right:1px solid #f9f9f9;border-bottom: 1px solid #f9f9f9; } */ /* 单元格默认不压缩空格 */ /* div.grid-cell-type-default {white-space: pre;} /* font-family: Agave, "Ubuntu Mono", Inconsolata */ </style> `); waitForKeyElements ("div.grid-cell-type-default", ttt); function ttt(){ console.log('111') } waitForKeyElements ("div#dtable-row-height-popover", add_custom_btns); function add_custom_btns(){ // 渲染表格内的元素 let btn = $(` <div class="toolbar-item ml-2 view-row-render" id="dtable-row-render-popover"> <span class="toolbar-btn view-row-render"> <i class="dtable-font dtable-icon-sync"></i> <span>渲染</span> </span> </div> `)[0]; btn.addEventListener("click", function() { $('.grid-cell-type-default').each(function() { $(this).html($(this).text()); }); }); $('div#dtable-row-height-popover').after(btn); } waitForKeyElements ("div.tooltip-inner", tip_return); // .column-description-tip function tip_return(){ // 使列描述中内容支持换行符号 $('div.tooltip-inner').each(function() { // 遍历所有 <div> 元素 var text = $(this).text(); // 获取当前元素中的文本内容 if(text.includes('■')) { // 如果文本内容包含 '■' var newText = text.replace(/■/g, '\n'); // 将所有 '■' 替换为换行符 $(this).text(newText); // 更新元素的文本内容 console.log('replace tip !!!') } }); $('div.tooltip-inner').css({'white-space':'pre', 'width':'fit-content', 'max-width':'800px', 'height':'fit-content', 'max-height':'800px'}) } waitForKeyElements ("div.longtext-modal-dialog table span", span_return); function span_return(){ // 使长文本中的表格支持换行符号 console.log('span !!!') $('div.longtext-modal-dialog table span[data-slate-string="true"]').each(function() { // 遍历所有 <span> 元素 var text = $(this).text(); // 获取当前元素中的文本内容 if(text.includes('■')) { // 如果文本内容包含 '■' var newText = text.replace(/■/g, '\n'); // 将所有 '■' 替换为换行符 $(this).text(newText); // 更新元素的文本内容 console.log('replace span !!!') } }); } waitForKeyElements (".tab-link", tab_link_style); function tab_link_style(){ // 记得大的数放在前面,防止小数在前时,-5删掉无法识别-50的bug console.log('tab link style !!!') // 子表标签透明空格,逻辑更加清晰 // 记得大的数放在前面,防止小数在前时,-5删掉无法识别-50的bug $('.tab-link:contains("-200")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'200px'}) $('.tab-title:contains("-200")').text('') $('.tab-link:contains("-100")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'100px'}) $('.tab-title:contains("-100")').text('') $('.tab-link:contains("-50")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'50px'}) $('.tab-title:contains("-50")').text('') $('.tab-link:contains("-30")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'30px'}) $('.tab-title:contains("-30")').text('') $('.tab-link:contains("-20")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'20px'}) $('.tab-title:contains("-20")').text('') $('.tab-link:contains("-10")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'10px'}) $('.tab-title:contains("-10")').text('') $('.tab-link:contains("-5")').css({'opacity': 0, 'padding':0, 'border-radius':0, 'width':'20px'}) $('.tab-title:contains("-5")').text('') $('.tab-link:contains("--")').css({'opacity': 0, 'padding':'2px 1px !important', 'border-radius':0, 'width':'3px'}) $('.tab-title:contains("--")').text('') // 子表标签白色竖线,逻辑更加清晰 $('.tab-link:contains("|||")').css({'padding':0, 'margin':'0 5px', 'border-radius':0, 'width':'5px', 'background-color':'white'}) $('.tab-title:contains("|||")').text('') $('.tab-link:contains("||")').css({'padding':0, 'margin':'0 2px', 'border-radius':0, 'width':'3px', 'background-color':'white'}) $('.tab-title:contains("||")').text('') } /* waitForKeyElements (".react-grid-Cell", grid_cell_style); function grid_cell_style(){ console.log('grid cell style !!!') // 为单元格增加边框线 $('.react-grid-Cell:contains("世界")').css({'border-left':'solid 2px black;'}) // 人工竖直分割线 // $('.react-grid-HeaderCell:contains("---")').css({'border-bottom':0, 'background-color':'white'}) // $('.react-grid-HeaderCell:contains("---") > *').css({'opacity': 0}) // $('.react-grid-Cell:contains("---")').css({'border-bottom':0}) // $('.react-grid-Cell:contains("---") > *').css({'opacity': '0'}) } */