Rename VTX Hyperlink stuff

This commit is contained in:
Bryan Ashby 2017-09-23 23:17:16 -06:00
parent 1ad5b125f5
commit 48c6edc5b3
3 changed files with 7 additions and 7 deletions

View File

@ -56,7 +56,7 @@ exports.getSyncTERMFontFromAlias = getSyncTERMFontFromAlias;
exports.setSyncTermFontWithAlias = setSyncTermFontWithAlias; exports.setSyncTermFontWithAlias = setSyncTermFontWithAlias;
exports.setCursorStyle = setCursorStyle; exports.setCursorStyle = setCursorStyle;
exports.setEmulatedBaudRate = setEmulatedBaudRate; exports.setEmulatedBaudRate = setEmulatedBaudRate;
exports.getVtxHyperlink = getVtxHyperlink; exports.vtxHyperlink = vtxHyperlink;
// //
// See also // See also
@ -486,13 +486,13 @@ function setEmulatedBaudRate(rate) {
return 0 === speed ? exports.emulationSpeed() : exports.emulationSpeed(1, speed); return 0 === speed ? exports.emulationSpeed() : exports.emulationSpeed(1, speed);
} }
function getVtxHyperlink(client, url, text) { function vtxHyperlink(client, url, len) {
if(!client.terminalSupports('vtx_hyperlink')) { if(!client.terminalSupports('vtx_hyperlink')) {
return ''; return '';
} }
text = text || url; len = len || url.length;
url = url.split('').map(c => c.charCodeAt(0)).join(';'); url = url.split('').map(c => c.charCodeAt(0)).join(';');
return `${ESC_CSI}1;${text.length};1;1;${url}\\`; return `${ESC_CSI}1;${len};1;1;${url}\\`;
} }

View File

@ -501,7 +501,7 @@ Client.prototype.terminalSupports = function(query) {
return 'vtx' === termClient; return 'vtx' === termClient;
case 'vtx_hyperlink' : case 'vtx_hyperlink' :
return termClient === 'vtx'; return 'vtx' === termClient;
default : default :
return false; return false;

View File

@ -274,7 +274,7 @@ exports.getModule = class FileAreaList extends MenuModule {
} else { } else {
const webDlExpireTimeFormat = config.webDlExpireTimeFormat || 'YYYY-MMM-DD @ h:mm'; const webDlExpireTimeFormat = config.webDlExpireTimeFormat || 'YYYY-MMM-DD @ h:mm';
entryInfo.webDlLink = ansi.getVtxHyperlink(this.client, serveItem.url) + serveItem.url; entryInfo.webDlLink = ansi.vtxHyperlink(this.client, serveItem.url) + serveItem.url;
entryInfo.webDlExpire = moment(serveItem.expireTimestamp).format(webDlExpireTimeFormat); entryInfo.webDlExpire = moment(serveItem.expireTimestamp).format(webDlExpireTimeFormat);
} }
@ -497,7 +497,7 @@ exports.getModule = class FileAreaList extends MenuModule {
const webDlExpireTimeFormat = self.menuConfig.config.webDlExpireTimeFormat || 'YYYY-MMM-DD @ h:mm'; const webDlExpireTimeFormat = self.menuConfig.config.webDlExpireTimeFormat || 'YYYY-MMM-DD @ h:mm';
self.currentFileEntry.entryInfo.webDlLink = ansi.getVtxHyperlink(self.client, url) + url; self.currentFileEntry.entryInfo.webDlLink = ansi.vtxHyperlink(self.client, url) + url;
self.currentFileEntry.entryInfo.webDlExpire = expireTime.format(webDlExpireTimeFormat); self.currentFileEntry.entryInfo.webDlExpire = expireTime.format(webDlExpireTimeFormat);
return callback(null); return callback(null);