Skip to content

Instantly share code, notes, and snippets.

@jonleung
Created December 16, 2019 21:33
Show Gist options
  • Save jonleung/62bc97e4c63bc1f612596e56ecb8769c to your computer and use it in GitHub Desktop.
Save jonleung/62bc97e4c63bc1f612596e56ecb8769c to your computer and use it in GitHub Desktop.
Janky Tampermonkey script to untruncates Airtable's Kanban View's Titles
// ==UserScript==
// @name Kanban View Mod
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Janky Tampermonkey script to untruncates Airtable's Kanban View's Titles
// @author Jonathan Leung
// @match https://airtable.com/*
// @grant none
// ==/UserScript==
const MULTIPLIER = 2;
const HEIGHT = 100;
const V_CELL_SPACING = 55;
(function() {
let isMouseDown = false;
$(document).on('mousedown', () => {
isMouseDown = true;
console.log('🔴🔴🔴')
});
$(document).on('mousemove', () => {
if (isMouseDown) {
$('.light-scrollbar').each((i, scrollbar) => {
const $container = $(scrollbar).first();
$container.children().children().each((i, card) => {
$card = $(card);
const cardTop = parseInt($card.css('top').slice(0, -2));
if((cardTop - 5) % V_CELL_SPACING === 5) {
const topPxStr = $card.css('top');
const topPx = parseInt(topPxStr.slice(0, -2));
const newTopPx = topPx / MULTIPLIER;
// $card.css('top', newTopPx + 'px');
}
});
});
const $titles = $('.kanbanCardContainer .text-dark.strong');
$titles.each((i, title) => {
$title = $(title);
$titleContainer = $title.parent();
$titleContainerContainer = $titleContainer.parent();
// $titleContainer.css('height', 55 + 'px');
// $titleContainerContainer.css('height', 55 + 'px');
});
}
});
$(document).on('mouseup', () => {
console.log('up');
isMouseDown = false;
const $titles = $('.kanbanCardContainer .text-dark.strong');
$titles.each((i, title) => {
$title = $(title);
$titleContainer = $title.parent();
$titleContainerContainer = $titleContainer.parent();
if ($titleContainer.outerHeight() !== HEIGHT) {
$title.removeClass('truncate');
//$titleContainer.css('height', HEIGHT + 'px');
//$titleContainerContainer.css('height', HEIGHT + 'px');
}
});
});
setInterval(function() {
const $titles = $('.kanbanCardContainer .truncate');
$titles.each((i, title) => {
$title = $(title);
$title.removeClass('truncate');
});
}, 250);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment