// ==UserScript==
// @name SeaTable Custom Style (OnLine)
// @name:zh-CN SeaTable自定义样式(在线版)
// @description SeaTable自定义样式,目前只能将标签和表格分开,具体看代码
// @description:zh-cn SeaTable自定义样式,目前只能将标签和表格分开,具体看代码
// @namespace http://tampermonkey.net/
// @version 0.4
// @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.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
//--- Page-specific function to do what we want when the node is found.
function commentCallbackFunction (jNode) {
jNode.text ("This comment changed by waitForKeyElements().");
}
IMPORTANT: This function requires your script to have loaded jQuery.
*/
function waitForKeyElements (
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;
}
waitForKeyElements (".tab-link", main);
// $("head").append(`
// <style type="text/css" id="custom_css">
// div.grid-cell-type-default[title="│"]{
// font-size:100px;
// line-height:100px;
// max-height: 600px;
//
// margin-left: -10px;
//
// background-color: #e7e7e7;
// color: #dadada;
// }
// </style>
// `);
function main(){ // 记得大的数放在前面,防止小数在前时,-5删掉无法识别-50的bug
$('.tables-tabs-content .tab-link').css({'height':'50px', 'padding':'2px', 'writing-mode':'tb-rl'})
$('.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('')
// 打算用MO的形式,在每次点击标签、滚轮滚动更新数据后,再重新应用一遍。后来发现有title,直接用CSS就省事了。
// var tab_callback = function (records){
// console.log('tabbbb');
// }
// $('.tabs-tab').each(function(i, v){
// tmp_mo = new MutationObserver(callback);
// alert($(this).text())
// });
//
// // var tabs = document.getElementsByClassName("tables-nav-tabs")[0];
// // var tab_mo = new MutationObserver(tab_callback);
// // tab_mo.observe(tabs, {'subtree': true});
//
//
//
// var callback = function (records){
// $('.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, 'border-top':0})
// $('.react-grid-Cell:contains("---") > *').css({'opacity': '0'})
//
// console.log('changed');
// }
// var mo = new MutationObserver(callback);
// var container = document.getElementsByClassName("grid-rows")[0];
// mo.observe(container, {'childList': true, 'subtree': true}); // 设置一个监听器,页面由变化就触发。
// callback(); // 如果直接打开一个页面的话,默认监听器不会被触发。这时手动触发一次就很有必要了。
}