forked from DebaucheryLibrarian/traxxx
Added Jules Jordan scraper. Added render argument to stop going into ncurses mode during dev.
This commit is contained in:
@@ -7,6 +7,10 @@ const formatters = {
|
||||
date: (date, column) => moment(date).format(column.format || 'MMM DD, YYYY'),
|
||||
actors: actors => actors.join(', '),
|
||||
rating: (rating) => {
|
||||
if (rating === null) {
|
||||
return '\x1b[90mNot available\x1b[0m';
|
||||
}
|
||||
|
||||
if (rating.stars === null) {
|
||||
return '\x1b[90mUnrated\x1b[0m';
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ function render(scenes, screen) {
|
||||
: scene[column.value])
|
||||
.toString();
|
||||
|
||||
const realLength = value.replace(/\x1b\[\d+m/g, '').length;
|
||||
const realLength = value.replace(/\x1b\[\d+m/g, '').length; // eslint-disable-line no-control-regex
|
||||
const entityLength = value.length - realLength;
|
||||
|
||||
const truncatedValue = realLength > column.width - 2 ? `${value.slice(0, column.width - 2 - 3)}...` : value;
|
||||
@@ -40,7 +40,30 @@ function render(scenes, screen) {
|
||||
return `${row}${sceneIndex}`;
|
||||
});
|
||||
|
||||
function search(cb) {
|
||||
const menu = blessed.List({
|
||||
style: {
|
||||
selected: {
|
||||
bold: true,
|
||||
},
|
||||
},
|
||||
top: 1,
|
||||
height: screen.rows - 3,
|
||||
width: 161,
|
||||
keys: true,
|
||||
vi: true,
|
||||
mouse: true,
|
||||
scrollbar: {
|
||||
style: {
|
||||
bg: 'red',
|
||||
},
|
||||
track: {
|
||||
bg: 'blue',
|
||||
},
|
||||
},
|
||||
items,
|
||||
});
|
||||
|
||||
menu.search = (cb) => {
|
||||
const searchbox = blessed.Textbox({
|
||||
inputOnFocus: true,
|
||||
});
|
||||
@@ -57,22 +80,7 @@ function render(scenes, screen) {
|
||||
screen.append(menu);
|
||||
screen.render();
|
||||
});
|
||||
}
|
||||
|
||||
const menu = blessed.List({
|
||||
style: {
|
||||
selected: {
|
||||
bold: true,
|
||||
},
|
||||
},
|
||||
top: 1,
|
||||
height: screen.rows - 3,
|
||||
keys: true,
|
||||
vi: true,
|
||||
mouse: true,
|
||||
search,
|
||||
items,
|
||||
});
|
||||
};
|
||||
|
||||
const tableBottom = blessed.Text({
|
||||
content: config.columns.reduce((acc, column, index) => `${acc}${'─'.repeat(column.width)}${index < config.columns.length - 1 ? '┴' : '┘\x1b[0m\n'}`, '\x1b[30m└'),
|
||||
|
||||
Reference in New Issue
Block a user