parent
1ef546d569
commit
712cf512f0
|
@ -358,6 +358,7 @@ function getDefaultConfig() {
|
|||
//
|
||||
'[0-3]?[0-9][\\-\\/\\.][0-3]?[0-9][\\-\\/\\.]((?:[0-9]{2})?[0-9]{2})', // m/d/yyyy, mm-dd-yyyy, etc.
|
||||
"\\B('[1789][0-9])\\b", // eslint-disable-line quotes
|
||||
'[0-3]?[0-9][\\-\\/\\.](?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|september|october|november|december)[\\-\\/\\.]((?:[0-9]{2})?[0-9]{2})',
|
||||
// :TODO: DD/MMM/YY, DD/MMMM/YY, DD/MMM/YYYY, etc.
|
||||
],
|
||||
|
||||
|
|
|
@ -19,4 +19,4 @@ exports.CRC32 = class CRC32 {
|
|||
finalize() {
|
||||
return (this.crc ^ (-1)) >>> 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ function TextView(options) {
|
|||
|
||||
renderLength = renderStringLength(textToDraw);
|
||||
|
||||
if(renderLength > this.dimens.width) {
|
||||
if(renderLength >= this.dimens.width) {
|
||||
if(this.hasFocus) {
|
||||
if(this.horizScroll) {
|
||||
textToDraw = renderSubstr(textToDraw, renderLength - this.dimens.width, renderLength);
|
||||
|
|
|
@ -12,6 +12,7 @@ const FileArea = require('../core/file_area.js');
|
|||
const Errors = require('../core/enig_error.js').Errors;
|
||||
const ArchiveUtil = require('../core/archive_util.js');
|
||||
const Config = require('../core/config.js').config;
|
||||
const DownloadQueue = require('../core/download_queue.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
|
@ -21,21 +22,7 @@ const paths = require('path');
|
|||
|
||||
/*
|
||||
Misc TODO
|
||||
* Allow rating to be user defined colors & characters/etc.
|
||||
*
|
||||
|
||||
|
||||
Well known file entry meta values:
|
||||
* upload_by_username
|
||||
* upload_by_user_id
|
||||
* file_md5
|
||||
* file_sha256
|
||||
* file_crc32
|
||||
* est_release_year
|
||||
* dl_count
|
||||
* byte_size
|
||||
* user_rating
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
exports.moduleInfo = {
|
||||
|
@ -56,6 +43,7 @@ const MciViewIds = {
|
|||
browse : {
|
||||
desc : 1,
|
||||
navMenu : 2,
|
||||
queueToggle : 3, // active queue toggle indicator - others avail in customs as {isQueued}
|
||||
// 10+ = customs
|
||||
},
|
||||
details : {
|
||||
|
@ -82,12 +70,12 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
const config = this.menuConfig.config;
|
||||
|
||||
if(options.extraArgs) {
|
||||
this.filterCriteria = options.extraArgs.filterCriteria;
|
||||
}
|
||||
|
||||
this.dlQueue = new DownloadQueue(this.client.user);
|
||||
|
||||
this.filterCriteria = this.filterCriteria || {
|
||||
// :TODO: set area tag - all in current area by default
|
||||
};
|
||||
|
@ -119,6 +107,11 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
this.viewControllers.details.setFocus(false);
|
||||
return this.displayBrowsePage(true, cb); // true=clearScreen
|
||||
},
|
||||
toggleQueue : (formData, extraArgs, cb) => {
|
||||
this.dlQueue.toggle(this.currentFileEntry);
|
||||
this.updateQueueIndicator();
|
||||
return cb(null);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -155,6 +148,8 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
const uploadTimestampFormat = config.browseUploadTimestampFormat || config.uploadTimestampFormat || 'YYYY-MMM-DD';
|
||||
const area = FileArea.getFileAreaByTag(currEntry.areaTag);
|
||||
const hashTagsSep = config.hashTagsSep || ', ';
|
||||
const isQueuedIndicator = config.isQueuedIndicator || 'Y';
|
||||
const isNotQueuedIndicator = config.isNotQueuedIndicator || 'N';
|
||||
|
||||
const entryInfo = this.currentFileEntry.entryInfo = {
|
||||
fileId : currEntry.fileId,
|
||||
|
@ -167,6 +162,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
descLong : currEntry.descLong || '',
|
||||
uploadTimestamp : moment(currEntry.uploadTimestamp).format(uploadTimestampFormat),
|
||||
hashTags : Array.from(currEntry.hashTags).join(hashTagsSep),
|
||||
isQueued : this.dlQueue.isQueued(this.currentFileEntry) ? isQueuedIndicator : isNotQueuedIndicator,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -311,6 +307,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
}
|
||||
}
|
||||
|
||||
self.updateQueueIndicator();
|
||||
self.populateCustomLabels('browse', 10);
|
||||
|
||||
return callback(null);
|
||||
|
@ -364,6 +361,22 @@ exports.getModule = class FileAreaList extends MenuModule {
|
|||
);
|
||||
}
|
||||
|
||||
updateQueueIndicator() {
|
||||
const indicatorView = this.viewControllers.browse.getView(MciViewIds.browse.queueToggle);
|
||||
|
||||
if(indicatorView) {
|
||||
const isQueuedIndicator = this.menuConfig.config.isQueuedIndicator || 'Y';
|
||||
const isNotQueuedIndicator = this.menuConfig.config.isNotQueuedIndicator || 'N';
|
||||
|
||||
indicatorView.setText(stringFormat(
|
||||
this.dlQueue.isQueued(this.currentFileEntry) ?
|
||||
isQueuedIndicator :
|
||||
isNotQueuedIndicator
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
cacheArchiveEntries(cb) {
|
||||
// check cache
|
||||
if(this.currentFileEntry.archiveEntries) {
|
||||
|
|
Loading…
Reference in New Issue