mirror of https://github.com/keeweb/keeweb.git
organized files inside util
This commit is contained in:
parent
0028f2293f
commit
9e7a86a1db
|
@ -20,14 +20,14 @@ const Launcher = require('./comp/launcher');
|
|||
const FeatureTester = require('./comp/feature-tester');
|
||||
const FocusDetector = require('./comp/focus-detector');
|
||||
const Timeouts = require('./const/timeouts');
|
||||
const FeatureDetector = require('./util/feature-detector');
|
||||
const KdbxwebInit = require('./util/kdbxweb-init');
|
||||
const Features = require('./util/features');
|
||||
const KdbxwebInit = require('./util/kdbxweb/kdbxweb-init');
|
||||
const Locale = require('./util/locale');
|
||||
|
||||
const ready = (Launcher && Launcher.ready) || $;
|
||||
|
||||
ready(() => {
|
||||
if (AuthReceiver.receive() || FeatureDetector.isFrame) {
|
||||
if (AuthReceiver.receive() || Features.isFrame) {
|
||||
return;
|
||||
}
|
||||
loadMixins();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const EntryCollection = require('../collections/entry-collection');
|
||||
const Ranking = require('../util/ranking');
|
||||
const Ranking = require('../util/data/ranking');
|
||||
|
||||
const urlPartsRegex = /^(\w+:\/\/)?(?:(?:www|wwws|secure)\.)?([^\/]+)\/?(.*)/;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const AutoTypeObfuscator = require('./auto-type-obfuscator');
|
||||
const AutoTypeEmitterFactory = require('./auto-type-emitter-factory');
|
||||
const Format = require('../util/format');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const Logger = require('../util/logger');
|
||||
|
||||
const emitterLogger = new Logger('auto-type-emitter');
|
||||
|
@ -310,15 +310,15 @@ AutoTypeRunner.prototype.dt = function(part) {
|
|||
case 'Y':
|
||||
return this.now.getFullYear().toString();
|
||||
case 'M':
|
||||
return Format.pad(this.now.getMonth() + 1, 2);
|
||||
return StringFormat.pad(this.now.getMonth() + 1, 2);
|
||||
case 'D':
|
||||
return Format.pad(this.now.getDate(), 2);
|
||||
return StringFormat.pad(this.now.getDate(), 2);
|
||||
case 'h':
|
||||
return Format.pad(this.now.getHours(), 2);
|
||||
return StringFormat.pad(this.now.getHours(), 2);
|
||||
case 'm':
|
||||
return Format.pad(this.now.getMinutes(), 2);
|
||||
return StringFormat.pad(this.now.getMinutes(), 2);
|
||||
case 's':
|
||||
return Format.pad(this.now.getSeconds(), 2);
|
||||
return StringFormat.pad(this.now.getSeconds(), 2);
|
||||
default:
|
||||
throw 'Bad part: ' + part;
|
||||
}
|
||||
|
@ -338,15 +338,15 @@ AutoTypeRunner.prototype.udt = function(part) {
|
|||
case 'Y':
|
||||
return this.now.getUTCFullYear().toString();
|
||||
case 'M':
|
||||
return Format.pad(this.now.getUTCMonth() + 1, 2);
|
||||
return StringFormat.pad(this.now.getUTCMonth() + 1, 2);
|
||||
case 'D':
|
||||
return Format.pad(this.now.getUTCDate(), 2);
|
||||
return StringFormat.pad(this.now.getUTCDate(), 2);
|
||||
case 'h':
|
||||
return Format.pad(this.now.getUTCHours(), 2);
|
||||
return StringFormat.pad(this.now.getUTCHours(), 2);
|
||||
case 'm':
|
||||
return Format.pad(this.now.getUTCMinutes(), 2);
|
||||
return StringFormat.pad(this.now.getUTCMinutes(), 2);
|
||||
case 's':
|
||||
return Format.pad(this.now.getUTCSeconds(), 2);
|
||||
return StringFormat.pad(this.now.getUTCSeconds(), 2);
|
||||
default:
|
||||
throw 'Bad part: ' + part;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Backbone = require('backbone');
|
||||
const EntryModel = require('../models/entry-model');
|
||||
const Comparators = require('../util/comparators');
|
||||
const Comparators = require('../util/data/comparators');
|
||||
|
||||
const EntryCollection = Backbone.Collection.extend({
|
||||
model: EntryModel,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Alerts = require('../comp/alerts');
|
||||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const Launcher = require('./launcher');
|
||||
|
@ -8,7 +8,7 @@ const AppRightsChecker = {
|
|||
AppPath: '/Applications/KeeWeb.app',
|
||||
|
||||
init() {
|
||||
if (!FeatureDetector.isDesktop || !FeatureDetector.isMac) {
|
||||
if (!Features.isDesktop || !Features.isMac) {
|
||||
return;
|
||||
}
|
||||
if (AppSettingsModel.instance.get('skipFolderRightsWarning')) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Storage = require('../storage');
|
||||
|
||||
const AuthReceiver = {
|
||||
receive() {
|
||||
if (!FeatureDetector.isPopup && !FeatureDetector.isStandalone) {
|
||||
if (!Features.isPopup && !Features.isStandalone) {
|
||||
return false;
|
||||
}
|
||||
const opener = window.opener || window.parent;
|
||||
|
@ -12,7 +12,7 @@ const AuthReceiver = {
|
|||
if (!hasKeys) {
|
||||
return false;
|
||||
}
|
||||
if (FeatureDetector.isStandalone) {
|
||||
if (Features.isStandalone) {
|
||||
if (sessionStorage.authStorage) {
|
||||
Storage[sessionStorage.authStorage].handleOAuthReturnMessage(message);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const kdbxweb = require('kdbxweb');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
|
||||
const FeatureTester = {
|
||||
test() {
|
||||
|
@ -51,7 +51,7 @@ const FeatureTester = {
|
|||
},
|
||||
|
||||
checkLocalStorage() {
|
||||
if (FeatureDetector.isDesktop) {
|
||||
if (Features.isDesktop) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Backbone = require('backbone');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Launcher = require('../comp/launcher');
|
||||
|
||||
const FocusDetector = {
|
||||
init() {
|
||||
this.isFocused = true;
|
||||
this.detectsFocusWithEvents = !FeatureDetector.isDesktop && !FeatureDetector.isMobile;
|
||||
this.detectsFocusWithEvents = !Features.isDesktop && !Features.isMobile;
|
||||
if (this.detectsFocusWithEvents) {
|
||||
window.addEventListener('focus', () => {
|
||||
if (!FocusDetector.isFocused) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const kdbxweb = require('kdbxweb');
|
||||
const Format = require('../util/format');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const DateFormat = require('../util/formatting/date-format');
|
||||
const Locale = require('../util/locale');
|
||||
const MdToHtml = require('../util/md-to-html');
|
||||
const MdToHtml = require('../util/formatting/md-to-html');
|
||||
const Links = require('../const/links');
|
||||
const RuntimeInfo = require('./runtime-info');
|
||||
|
||||
|
@ -50,7 +51,7 @@ function walkEntry(db, entry, parents) {
|
|||
}
|
||||
}
|
||||
fields.push({
|
||||
title: Format.capFirst(Locale[field.locStr]),
|
||||
title: StringFormat.capFirst(Locale[field.locStr]),
|
||||
value,
|
||||
protect: field.protect,
|
||||
html
|
||||
|
@ -72,7 +73,7 @@ function walkEntry(db, entry, parents) {
|
|||
const title = entryField(entry, 'Title');
|
||||
let expires;
|
||||
if (entry.times.expires && entry.times.expiryTime) {
|
||||
expires = Format.dtStr(entry.times.expiryTime);
|
||||
expires = DateFormat.dtStr(entry.times.expiryTime);
|
||||
}
|
||||
|
||||
const attachments = Object.entries(entry.binaries)
|
||||
|
@ -93,8 +94,8 @@ function walkEntry(db, entry, parents) {
|
|||
title,
|
||||
fields,
|
||||
tags: entry.tags.join(', '),
|
||||
created: Format.dtStr(entry.times.creationTime),
|
||||
modified: Format.dtStr(entry.times.lastModTime),
|
||||
created: DateFormat.dtStr(entry.times.creationTime),
|
||||
modified: DateFormat.dtStr(entry.times.lastModTime),
|
||||
expires,
|
||||
attachments
|
||||
});
|
||||
|
@ -110,7 +111,7 @@ const KdbxToHtml = {
|
|||
const content = db.groups.map(group => walkGroup(db, group, [])).join('\n');
|
||||
return Templates.db({
|
||||
name: options.name,
|
||||
date: Format.dtStr(Date.now()),
|
||||
date: DateFormat.dtStr(Date.now()),
|
||||
appLink: Links.Homepage,
|
||||
appVersion: RuntimeInfo.version,
|
||||
content
|
||||
|
|
|
@ -2,9 +2,9 @@ const Backbone = require('backbone');
|
|||
const Alerts = require('./alerts');
|
||||
const Locale = require('../util/locale');
|
||||
const Logger = require('../util/logger');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Shortcuts = require('../comp/shortcuts');
|
||||
const Otp = require('../util/otp');
|
||||
const Otp = require('../util/data/otp');
|
||||
const QrCode = require('jsqrcode');
|
||||
|
||||
const logger = new Logger('otp-qr-reader');
|
||||
|
@ -22,7 +22,7 @@ const OtpQrReader = {
|
|||
'<code>' + screenshotKey + '</code>'
|
||||
);
|
||||
}
|
||||
const pasteKey = FeatureDetector.isMobile
|
||||
const pasteKey = Features.isMobile
|
||||
? ''
|
||||
: Locale.detSetupOtpAlertBodyWith.replace(
|
||||
'{}',
|
||||
|
@ -33,10 +33,10 @@ const OtpQrReader = {
|
|||
{ result: 'manually', title: Locale.detSetupOtpManualButton, silent: true },
|
||||
Alerts.buttons.cancel
|
||||
];
|
||||
if (FeatureDetector.isMobile) {
|
||||
if (Features.isMobile) {
|
||||
buttons.unshift({ result: 'select', title: Locale.detSetupOtpScanButton });
|
||||
}
|
||||
const line3 = FeatureDetector.isMobile
|
||||
const line3 = Features.isMobile
|
||||
? Locale.detSetupOtpAlertBody3Mobile
|
||||
: Locale.detSetupOtpAlertBody3.replace('{}', pasteKey || '');
|
||||
OtpQrReader.alert = Alerts.alert({
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const Backbone = require('backbone');
|
||||
const Locale = require('./../util/locale');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
|
||||
const appleThemes = {
|
||||
macdark: 'setGenThemeMacDark'
|
||||
};
|
||||
|
||||
const extraThemes = FeatureDetector.isMac || FeatureDetector.isiOS ? appleThemes : {};
|
||||
const extraThemes = Features.isMac || Features.isiOS ? appleThemes : {};
|
||||
|
||||
const SettingsManager = {
|
||||
neutralLocale: null,
|
||||
|
@ -64,7 +64,7 @@ const SettingsManager = {
|
|||
},
|
||||
|
||||
setFontSize(fontSize) {
|
||||
const defaultFontSize = FeatureDetector.isMobile ? 14 : 12;
|
||||
const defaultFontSize = Features.isMobile ? 14 : 12;
|
||||
document.documentElement.style.fontSize = defaultFontSize + (fontSize || 0) * 2 + 'px';
|
||||
},
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Launcher = require('./launcher');
|
||||
const StringUtil = require('../util/string-util');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const Logger = require('../util/logger');
|
||||
|
||||
const logger = new Logger('settings');
|
||||
|
@ -23,7 +23,7 @@ const SettingsStore = {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
const data = localStorage[StringUtil.camelCase(key)];
|
||||
const data = localStorage[StringFormat.camelCase(key)];
|
||||
return this.parseData(key, data, resolve);
|
||||
}
|
||||
});
|
||||
|
@ -54,7 +54,7 @@ const SettingsStore = {
|
|||
resolve();
|
||||
});
|
||||
} else if (typeof localStorage !== 'undefined') {
|
||||
localStorage[StringUtil.camelCase(key)] = JSON.stringify(data);
|
||||
localStorage[StringFormat.camelCase(key)] = JSON.stringify(data);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Keys = require('../const/keys');
|
||||
const Format = require('../util/format');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const Launcher = require('./launcher');
|
||||
|
||||
|
@ -38,7 +38,7 @@ const Shortcuts = {
|
|||
if (event.shiftKey) {
|
||||
modifiers.push('Shift');
|
||||
}
|
||||
if (FeatureDetector.isMac && event.metaKey) {
|
||||
if (Features.isMac && event.metaKey) {
|
||||
modifiers.push('Meta');
|
||||
}
|
||||
const keyName = getAllowedKeys()[event.which];
|
||||
|
@ -67,32 +67,16 @@ const Shortcuts = {
|
|||
.join('');
|
||||
},
|
||||
actionShortcutSymbol(formatting) {
|
||||
return FeatureDetector.isMac
|
||||
? '⌘'
|
||||
: formatting
|
||||
? '<span class="thin">ctrl + </span>'
|
||||
: 'ctrl+';
|
||||
return Features.isMac ? '⌘' : formatting ? '<span class="thin">ctrl + </span>' : 'ctrl+';
|
||||
},
|
||||
altShortcutSymbol(formatting) {
|
||||
return FeatureDetector.isMac
|
||||
? '⌥'
|
||||
: formatting
|
||||
? '<span class="thin">alt + </span>'
|
||||
: 'alt+';
|
||||
return Features.isMac ? '⌥' : formatting ? '<span class="thin">alt + </span>' : 'alt+';
|
||||
},
|
||||
shiftShortcutSymbol(formatting) {
|
||||
return FeatureDetector.isMac
|
||||
? '⇧'
|
||||
: formatting
|
||||
? '<span class="thin">shift + </span>'
|
||||
: 'shift+';
|
||||
return Features.isMac ? '⇧' : formatting ? '<span class="thin">shift + </span>' : 'shift+';
|
||||
},
|
||||
ctrlShortcutSymbol(formatting) {
|
||||
return FeatureDetector.isMac
|
||||
? '⌃'
|
||||
: formatting
|
||||
? '<span class="thin">ctrl + </span>'
|
||||
: 'ctrl+';
|
||||
return Features.isMac ? '⌃' : formatting ? '<span class="thin">ctrl + </span>' : 'ctrl+';
|
||||
},
|
||||
globalShortcutText(type, formatting) {
|
||||
return this.presentShortcut(this.globalShortcut(type), formatting);
|
||||
|
@ -106,7 +90,7 @@ const Shortcuts = {
|
|||
}
|
||||
const globalShortcut = globalShortcuts[type];
|
||||
if (globalShortcut) {
|
||||
if (FeatureDetector.isMac && globalShortcut.mac) {
|
||||
if (Features.isMac && globalShortcut.mac) {
|
||||
return globalShortcut.mac;
|
||||
}
|
||||
return globalShortcut.all;
|
||||
|
@ -125,19 +109,19 @@ const Shortcuts = {
|
|||
Launcher.setGlobalShortcuts(AppSettingsModel.instance.attributes);
|
||||
},
|
||||
globalShortcutAppSettingsKey(type) {
|
||||
return 'globalShortcut' + Format.capFirst(type);
|
||||
return 'globalShortcut' + StringFormat.capFirst(type);
|
||||
},
|
||||
screenshotToClipboardShortcut() {
|
||||
if (FeatureDetector.isiOS) {
|
||||
if (Features.isiOS) {
|
||||
return 'Sleep+Home';
|
||||
}
|
||||
if (FeatureDetector.isMobile) {
|
||||
if (Features.isMobile) {
|
||||
return '';
|
||||
}
|
||||
if (FeatureDetector.isMac) {
|
||||
if (Features.isMac) {
|
||||
return 'Command-Shift-Control-4';
|
||||
}
|
||||
if (FeatureDetector.isWindows) {
|
||||
if (Features.isWindows) {
|
||||
return 'Alt+PrintScreen';
|
||||
}
|
||||
return '';
|
||||
|
|
|
@ -6,7 +6,7 @@ const AppSettingsModel = require('../models/app-settings-model');
|
|||
const UpdateModel = require('../models/update-model');
|
||||
const Transport = require('../comp/transport');
|
||||
const Logger = require('../util/logger');
|
||||
const SemVer = require('../util/semver');
|
||||
const SemVer = require('../util/data/semver');
|
||||
const publicKey = require('public-key.pem').default;
|
||||
|
||||
const logger = new Logger('updater');
|
||||
|
|
|
@ -3,7 +3,7 @@ const Backbone = require('backbone');
|
|||
|
||||
const Locale = require('../util/locale');
|
||||
|
||||
const Tip = require('../util/tip');
|
||||
const Tip = require('../util/ui/tip');
|
||||
const Timeouts = require('../const/timeouts');
|
||||
|
||||
const Copyable = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const Backbone = require('backbone');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const baron = require('baron');
|
||||
|
||||
const isEnabled = !FeatureDetector.isMobile;
|
||||
const isEnabled = !Features.isMobile;
|
||||
|
||||
const Scrollable = {
|
||||
createScroll(opts) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Backbone = require('backbone');
|
||||
const Tip = require('../util/tip');
|
||||
const Tip = require('../util/ui/tip');
|
||||
|
||||
_.extend(Backbone.View.prototype, {
|
||||
hide() {
|
||||
|
|
|
@ -10,11 +10,11 @@ const FileModel = require('./file-model');
|
|||
const FileInfoModel = require('./file-info-model');
|
||||
const Storage = require('../storage');
|
||||
const Timeouts = require('../const/timeouts');
|
||||
const IdGenerator = require('../util/id-generator');
|
||||
const IdGenerator = require('../util/generators/id-generator');
|
||||
const Logger = require('../util/logger');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Format = require('../util/format');
|
||||
const UrlUtil = require('../util/url-util');
|
||||
const Features = require('../util/features');
|
||||
const DateFormat = require('../util/formatting/date-format');
|
||||
const UrlFormat = require('../util/formatting/url-format');
|
||||
const AutoType = require('../auto-type');
|
||||
const Launcher = require('../comp/launcher');
|
||||
const RuntimeInfo = require('../comp/runtime-info');
|
||||
|
@ -101,7 +101,7 @@ const AppModel = Backbone.Model.extend({
|
|||
},
|
||||
|
||||
ensureCanLoadConfig(url) {
|
||||
if (!FeatureDetector.isSelfHosted) {
|
||||
if (!Features.isSelfHosted) {
|
||||
throw 'Configs are supported only in self-hosted installations';
|
||||
}
|
||||
const link = document.createElement('a');
|
||||
|
@ -1049,7 +1049,7 @@ const AppModel = Backbone.Model.extend({
|
|||
if (!backup || !backup.storage || !backup.path) {
|
||||
return callback('Invalid backup settings');
|
||||
}
|
||||
let path = backup.path.replace('{date}', Format.dtStrFs(new Date()));
|
||||
let path = backup.path.replace('{date}', DateFormat.dtStrFs(new Date()));
|
||||
logger.info('Backup file to', backup.storage, path);
|
||||
const saveToFolder = () => {
|
||||
if (Storage[backup.storage].getPathForName) {
|
||||
|
@ -1069,7 +1069,7 @@ const AppModel = Backbone.Model.extend({
|
|||
callback(err);
|
||||
});
|
||||
};
|
||||
let folderPath = UrlUtil.fileToDir(path);
|
||||
let folderPath = UrlFormat.fileToDir(path);
|
||||
if (Storage[backup.storage].getPathForName) {
|
||||
folderPath = Storage[backup.storage].getPathForName(folderPath).replace('.kdbx', '');
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Backbone = require('backbone');
|
||||
const AttachmentModel = require('./attachment-model');
|
||||
const IconMap = require('../const/icon-map');
|
||||
const Color = require('../util/color');
|
||||
const IconUrl = require('../util/icon-url');
|
||||
const Otp = require('../util/otp');
|
||||
const Color = require('../util/data/color');
|
||||
const IconUrlFormat = require('../util/formatting/icon-url-format');
|
||||
const Otp = require('../util/data/otp');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
const Ranking = require('../util/ranking');
|
||||
const Ranking = require('../util/data/ranking');
|
||||
const KdbxToHtml = require('../comp/kdbx-to-html');
|
||||
|
||||
const EntryModel = Backbone.Model.extend({
|
||||
|
@ -115,7 +115,7 @@ const EntryModel = Backbone.Model.extend({
|
|||
this.customIcon = null;
|
||||
this.customIconId = null;
|
||||
if (this.entry.customIcon) {
|
||||
this.customIcon = IconUrl.toDataUrl(
|
||||
this.customIcon = IconUrlFormat.toDataUrl(
|
||||
this.file.db.meta.customIcons[this.entry.customIcon]
|
||||
);
|
||||
this.customIconId = this.entry.customIcon.toString();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Backbone = require('backbone');
|
||||
const GroupCollection = require('../collections/group-collection');
|
||||
const GroupModel = require('./group-model');
|
||||
const IconUrl = require('../util/icon-url');
|
||||
const IconUrlFormat = require('../util/formatting/icon-url-format');
|
||||
const Logger = require('../util/logger');
|
||||
const KdbxToHtml = require('../comp/kdbx-to-html');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
|
@ -666,7 +666,9 @@ const FileModel = Backbone.Model.extend({
|
|||
},
|
||||
|
||||
getCustomIcons() {
|
||||
return _.mapObject(this.db.meta.customIcons, customIcon => IconUrl.toDataUrl(customIcon));
|
||||
return _.mapObject(this.db.meta.customIcons, customIcon =>
|
||||
IconUrlFormat.toDataUrl(customIcon)
|
||||
);
|
||||
},
|
||||
|
||||
addCustomIcon(iconData) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const MenuItemModel = require('./menu/menu-item-model');
|
||||
const EntryModel = require('../models/entry-model');
|
||||
const IconMap = require('../const/icon-map');
|
||||
const IconUrl = require('../util/icon-url');
|
||||
const IconUrlFormat = require('../util/formatting/icon-url-format');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
const KdbxIcons = kdbxweb.Consts.Icons;
|
||||
let GroupCollection;
|
||||
|
@ -107,7 +107,7 @@ const GroupModel = MenuItemModel.extend({
|
|||
_buildCustomIcon() {
|
||||
this.customIcon = null;
|
||||
if (this.group.customIcon) {
|
||||
return IconUrl.toDataUrl(this.file.db.meta.customIcons[this.group.customIcon]);
|
||||
return IconUrlFormat.toDataUrl(this.file.db.meta.customIcons[this.group.customIcon]);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ const MenuSectionCollection = require('../../collections/menu/menu-section-colle
|
|||
const MenuSectionModel = require('./menu-section-model');
|
||||
const GroupsMenuModel = require('./groups-menu-model');
|
||||
const Locale = require('../../util/locale');
|
||||
const Format = require('../../util/format');
|
||||
const StringFormat = require('../../util/formatting/string-format');
|
||||
const Keys = require('../../const/keys');
|
||||
const Colors = require('../../const/colors');
|
||||
|
||||
|
@ -194,7 +194,7 @@ const MenuModel = Backbone.Model.extend({
|
|||
menu.each(section =>
|
||||
section.get('items').each(item => {
|
||||
if (item.get('locTitle')) {
|
||||
item.set('title', Format.capFirst(Locale[item.get('locTitle')]));
|
||||
item.set('title', StringFormat.capFirst(Locale[item.get('locTitle')]));
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -204,7 +204,7 @@ const MenuModel = Backbone.Model.extend({
|
|||
|
||||
_getDefaultTagItem() {
|
||||
return {
|
||||
title: Format.capFirst(Locale.tags),
|
||||
title: StringFormat.capFirst(Locale.tags),
|
||||
icon: 'tags',
|
||||
defaultItem: true,
|
||||
disabled: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Backbone = require('backbone');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
const Links = require('../const/links');
|
||||
const SignatureVerifier = require('../util/signature-verifier');
|
||||
const SignatureVerifier = require('../util/data/signature-verifier');
|
||||
const Logger = require('../util/logger');
|
||||
const SettingsStore = require('../comp/settings-store');
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const PluginCollection = require('./plugin-collection');
|
|||
const PluginGallery = require('./plugin-gallery');
|
||||
const SettingsStore = require('../comp/settings-store');
|
||||
const RuntimeInfo = require('../comp/runtime-info');
|
||||
const SignatureVerifier = require('../util/signature-verifier');
|
||||
const SignatureVerifier = require('../util/data/signature-verifier');
|
||||
const Logger = require('../util/logger');
|
||||
|
||||
const PluginManager = Backbone.Model.extend({
|
||||
|
|
|
@ -7,8 +7,8 @@ const SettingsManager = require('../comp/settings-manager');
|
|||
const IoCache = require('../storage/io-cache');
|
||||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const BaseLocale = require('../locales/base.json');
|
||||
const SignatureVerifier = require('../util/signature-verifier');
|
||||
const SemVer = require('../util/semver');
|
||||
const SignatureVerifier = require('../util/data/signature-verifier');
|
||||
const SemVer = require('../util/data/semver');
|
||||
const RuntimeInfo = require('../comp/runtime-info');
|
||||
|
||||
const commonLogger = new Logger('plugin');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const ThemeVarsScss = require('raw-loader!../../styles/base/_theme-vars.scss').default;
|
||||
const ThemeDefaults = require('../../styles/themes/_theme-defaults.scss');
|
||||
const Color = require('../util/color');
|
||||
const Color = require('../util/data/color');
|
||||
|
||||
const ThemeVars = {
|
||||
themeDefaults: null,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Format = require('../util/format');
|
||||
const DateFormat = require('../util/formatting/date-format');
|
||||
const Locale = require('../util/locale');
|
||||
|
||||
const EntryPresenter = function(descField, noColor, activeEntryId) {
|
||||
|
@ -47,10 +47,10 @@ EntryPresenter.prototype = {
|
|||
return this.entry ? this.entry.id === this.activeEntryId : this.group.active;
|
||||
},
|
||||
get created() {
|
||||
return this.entry ? Format.dtStr(this.entry.created) : undefined;
|
||||
return this.entry ? DateFormat.dtStr(this.entry.created) : undefined;
|
||||
},
|
||||
get updated() {
|
||||
return this.entry ? Format.dtStr(this.entry.updated) : undefined;
|
||||
return this.entry ? DateFormat.dtStr(this.entry.updated) : undefined;
|
||||
},
|
||||
get expired() {
|
||||
return this.entry ? this.entry.expired : false;
|
||||
|
|
|
@ -3,7 +3,7 @@ const Logger = require('../util/logger');
|
|||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const RuntimeDataModel = require('../models/runtime-data-model');
|
||||
const Links = require('../const/links');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
|
||||
const MaxRequestRetries = 3;
|
||||
|
||||
|
@ -37,7 +37,7 @@ _.extend(StorageBase.prototype, {
|
|||
this._oauthProcessReturn(this._oauthReturnMessage);
|
||||
delete this._oauthReturnMessage;
|
||||
delete sessionStorage.authStorage;
|
||||
if (FeatureDetector.isStandalone) {
|
||||
if (Features.isStandalone) {
|
||||
const [url, urlParams] = location.href.split(/[?#]/);
|
||||
if (urlParams) {
|
||||
location.href = url;
|
||||
|
@ -137,7 +137,7 @@ _.extend(StorageBase.prototype, {
|
|||
settings = Object.keys(settings)
|
||||
.map(key => key + '=' + settings[key])
|
||||
.join(',');
|
||||
if (FeatureDetector.isStandalone) {
|
||||
if (Features.isStandalone) {
|
||||
sessionStorage.authStorage = this.name;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const StorageBase = require('./storage-base');
|
||||
const UrlUtil = require('../util/url-util');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const UrlFormat = require('../util/formatting/url-format');
|
||||
const Features = require('../util/features');
|
||||
|
||||
const DropboxKeys = {
|
||||
AppFolder: 'qp7ctun6qt5n9d6',
|
||||
|
@ -21,7 +21,7 @@ const StorageDropbox = StorageBase.extend({
|
|||
_toFullPath(path) {
|
||||
const rootFolder = this.appSettings.get('dropboxFolder');
|
||||
if (rootFolder) {
|
||||
path = UrlUtil.fixSlashes('/' + rootFolder + '/' + path);
|
||||
path = UrlFormat.fixSlashes('/' + rootFolder + '/' + path);
|
||||
}
|
||||
return path;
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ const StorageDropbox = StorageBase.extend({
|
|||
} else if (ix === 1) {
|
||||
path = path.substr(rootFolder.length + 1);
|
||||
}
|
||||
path = UrlUtil.fixSlashes('/' + path);
|
||||
path = UrlFormat.fixSlashes('/' + path);
|
||||
}
|
||||
return path;
|
||||
},
|
||||
|
@ -59,7 +59,7 @@ const StorageDropbox = StorageBase.extend({
|
|||
},
|
||||
|
||||
_canUseBuiltInKeys() {
|
||||
return !FeatureDetector.isSelfHosted;
|
||||
return !Features.isSelfHosted;
|
||||
},
|
||||
|
||||
_getOAuthConfig() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Colors = require('../const/colors');
|
||||
const Colors = require('../../const/colors');
|
||||
|
||||
const KnownColors = {};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const Logger = require('./logger');
|
||||
const Logger = require('../logger');
|
||||
|
||||
const logger = new Logger('otp');
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const Logger = require('./logger');
|
||||
const Logger = require('../logger');
|
||||
const publicKey = require('public-key.pem').default;
|
||||
const kdbxweb = require('kdbxweb');
|
||||
|
|
@ -3,7 +3,7 @@ const MinDesktopScreenWidth = 800;
|
|||
|
||||
const isDesktop = !!(window.process && window.process.versions && window.process.versions.electron);
|
||||
|
||||
const FeatureDetector = {
|
||||
const Features = {
|
||||
isDesktop,
|
||||
isMac: navigator.platform.indexOf('Mac') >= 0,
|
||||
isWindows: navigator.platform.indexOf('Win') >= 0,
|
||||
|
@ -37,4 +37,4 @@ const FeatureDetector = {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = FeatureDetector;
|
||||
module.exports = Features;
|
|
@ -1,65 +0,0 @@
|
|||
const Locale = require('./locale');
|
||||
|
||||
const Format = {
|
||||
pad(num, digits) {
|
||||
let str = num.toString();
|
||||
while (str.length < digits) {
|
||||
str = '0' + str;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
padStr(str, len) {
|
||||
while (str.length < len) {
|
||||
str += ' ';
|
||||
}
|
||||
return str;
|
||||
},
|
||||
dtStr(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? this.dStr(dt) +
|
||||
' ' +
|
||||
this.pad(dt.getHours(), 2) +
|
||||
':' +
|
||||
this.pad(dt.getMinutes(), 2) +
|
||||
':' +
|
||||
this.pad(dt.getSeconds(), 2)
|
||||
: '';
|
||||
},
|
||||
dStr(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? dt.getDate() + ' ' + Locale.monthsShort[dt.getMonth()] + ' ' + dt.getFullYear()
|
||||
: '';
|
||||
},
|
||||
capFirst(str) {
|
||||
if (!str) {
|
||||
return '';
|
||||
}
|
||||
return str[0].toUpperCase() + str.substr(1);
|
||||
},
|
||||
dtStrFs(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? dt.getFullYear() +
|
||||
'-' +
|
||||
this.pad(dt.getMonth() + 1, 2) +
|
||||
'-' +
|
||||
this.pad(dt.getDate(), 2) +
|
||||
'T' +
|
||||
this.pad(dt.getHours(), 2) +
|
||||
'-' +
|
||||
this.pad(dt.getMinutes(), 2) +
|
||||
'-' +
|
||||
this.pad(dt.getSeconds(), 2)
|
||||
: '';
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Format;
|
|
@ -0,0 +1,49 @@
|
|||
const Locale = require('../locale');
|
||||
const StringFormat = require('./string-format');
|
||||
|
||||
const DateFormat = {
|
||||
dtStr(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? this.dStr(dt) +
|
||||
' ' +
|
||||
StringFormat.pad(dt.getHours(), 2) +
|
||||
':' +
|
||||
StringFormat.pad(dt.getMinutes(), 2) +
|
||||
':' +
|
||||
StringFormat.pad(dt.getSeconds(), 2)
|
||||
: '';
|
||||
},
|
||||
|
||||
dStr(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? dt.getDate() + ' ' + Locale.monthsShort[dt.getMonth()] + ' ' + dt.getFullYear()
|
||||
: '';
|
||||
},
|
||||
|
||||
dtStrFs(dt) {
|
||||
if (typeof dt === 'number') {
|
||||
dt = new Date(dt);
|
||||
}
|
||||
return dt
|
||||
? dt.getFullYear() +
|
||||
'-' +
|
||||
StringFormat.pad(dt.getMonth() + 1, 2) +
|
||||
'-' +
|
||||
StringFormat.pad(dt.getDate(), 2) +
|
||||
'T' +
|
||||
StringFormat.pad(dt.getHours(), 2) +
|
||||
'-' +
|
||||
StringFormat.pad(dt.getMinutes(), 2) +
|
||||
'-' +
|
||||
StringFormat.pad(dt.getSeconds(), 2)
|
||||
: '';
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = DateFormat;
|
|
@ -1,6 +1,6 @@
|
|||
const kdbxweb = require('kdbxweb');
|
||||
|
||||
const IconUrl = {
|
||||
const IconUrlFormat = {
|
||||
toDataUrl(iconData) {
|
||||
return iconData
|
||||
? 'data:image/png;base64,' + kdbxweb.ByteUtils.bytesToBase64(iconData)
|
||||
|
@ -8,4 +8,4 @@ const IconUrl = {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = IconUrl;
|
||||
module.exports = IconUrlFormat;
|
|
@ -0,0 +1,31 @@
|
|||
const StringFormat = {
|
||||
camelCaseRegex: /-./g,
|
||||
|
||||
capFirst(str) {
|
||||
if (!str) {
|
||||
return '';
|
||||
}
|
||||
return str[0].toUpperCase() + str.substr(1);
|
||||
},
|
||||
|
||||
pad(num, digits) {
|
||||
let str = num.toString();
|
||||
while (str.length < digits) {
|
||||
str = '0' + str;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
|
||||
padStr(str, len) {
|
||||
while (str.length < len) {
|
||||
str += ' ';
|
||||
}
|
||||
return str;
|
||||
},
|
||||
|
||||
camelCase(str) {
|
||||
return str.replace(this.camelCaseRegex, match => match[1].toUpperCase());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = StringFormat;
|
|
@ -1,4 +1,4 @@
|
|||
const UrlUtil = {
|
||||
const UrlFormat = {
|
||||
multiSlashRegex: /\/{2,}/g,
|
||||
lastPartRegex: /\/?[^\/\\]+$/,
|
||||
kdbxEndRegex: /\.kdbx$/i,
|
||||
|
@ -25,4 +25,4 @@ const UrlUtil = {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = UrlUtil;
|
||||
module.exports = UrlFormat;
|
|
@ -1,5 +1,5 @@
|
|||
const kdbxweb = require('kdbxweb');
|
||||
const Logger = require('../util/logger');
|
||||
const Logger = require('../logger');
|
||||
|
||||
const logger = new Logger('argon2');
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
const StringUtil = {
|
||||
camelCaseRegex: /\-./g,
|
||||
|
||||
camelCase(str) {
|
||||
return str.replace(this.camelCaseRegex, match => match[1].toUpperCase());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = StringUtil;
|
|
@ -1,4 +1,4 @@
|
|||
const timeouts = require('../const/timeouts');
|
||||
const timeouts = require('../../const/timeouts');
|
||||
|
||||
const FileSaver = {
|
||||
saveAs(blob, name) {
|
|
@ -1,5 +1,5 @@
|
|||
const Backbone = require('backbone');
|
||||
const FeatureDetector = require('./feature-detector');
|
||||
const Features = require('../features');
|
||||
|
||||
const Tip = function(el, config) {
|
||||
this.el = el;
|
||||
|
@ -13,7 +13,7 @@ const Tip = function(el, config) {
|
|||
this.hide = this.hide.bind(this);
|
||||
};
|
||||
|
||||
Tip.enabled = !FeatureDetector.isMobile;
|
||||
Tip.enabled = !Features.isMobile;
|
||||
|
||||
Tip.prototype.init = function() {
|
||||
if (!Tip.enabled) {
|
|
@ -20,7 +20,7 @@ const IdleTracker = require('../comp/idle-tracker');
|
|||
const Launcher = require('../comp/launcher');
|
||||
const SettingsManager = require('../comp/settings-manager');
|
||||
const Locale = require('../util/locale');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const UpdateModel = require('../models/update-model');
|
||||
|
||||
const AppView = Backbone.View.extend({
|
||||
|
@ -113,7 +113,7 @@ const AppView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
setWindowClass() {
|
||||
const getBrowserCssClass = FeatureDetector.getBrowserCssClass();
|
||||
const getBrowserCssClass = Features.getBrowserCssClass();
|
||||
if (getBrowserCssClass) {
|
||||
this.$el.addClass(getBrowserCssClass);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ const AppView = Backbone.View.extend({
|
|||
// TODO: remove once Edge 14 share drops enough
|
||||
// https://github.com/keeweb/keeweb/issues/636#issuecomment-304225634
|
||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5782378/
|
||||
if (FeatureDetector.needFixClicks) {
|
||||
if (Features.needFixClicks) {
|
||||
const msEdgeScrewer = $('<input/>')
|
||||
.appendTo(this.$el)
|
||||
.focus();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Backbone = require('backbone');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Links = require('../const/links');
|
||||
const Timeouts = require('../const/timeouts');
|
||||
|
||||
|
@ -18,8 +18,8 @@ const AutoTypeHintView = Backbone.View.extend({
|
|||
|
||||
render() {
|
||||
this.renderTemplate({
|
||||
cmd: FeatureDetector.isMac ? 'command' : 'ctrl',
|
||||
hasCtrl: FeatureDetector.isMac,
|
||||
cmd: Features.isMac ? 'command' : 'ctrl',
|
||||
hasCtrl: Features.isMac,
|
||||
link: Links.AutoType
|
||||
});
|
||||
const rect = this.input.getBoundingClientRect();
|
||||
|
|
|
@ -7,7 +7,7 @@ const EntryPresenter = require('../../presenters/entry-presenter');
|
|||
const Scrollable = require('../../mixins/scrollable');
|
||||
const Shortcuts = require('../../comp/shortcuts');
|
||||
const DropdownView = require('../dropdown-view');
|
||||
const Format = require('../../util/format');
|
||||
const StringFormat = require('../../util/formatting/string-format');
|
||||
|
||||
const AutoTypePopupView = Backbone.View.extend({
|
||||
el: 'body',
|
||||
|
@ -286,14 +286,14 @@ const AutoTypePopupView = Backbone.View.extend({
|
|||
options.push({
|
||||
value: '{USERNAME}',
|
||||
icon: 'user',
|
||||
text: Format.capFirst(Locale.user)
|
||||
text: StringFormat.capFirst(Locale.user)
|
||||
});
|
||||
}
|
||||
if (entry.password) {
|
||||
options.push({
|
||||
value: '{PASSWORD}',
|
||||
icon: 'key',
|
||||
text: Format.capFirst(Locale.password)
|
||||
text: StringFormat.capFirst(Locale.password)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const Backbone = require('backbone');
|
||||
const KeyHandler = require('../../comp/key-handler');
|
||||
const Keys = require('../../const/keys');
|
||||
const Format = require('../../util/format');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
const StringFormat = require('../../util/formatting/string-format');
|
||||
const Locale = require('../../util/locale');
|
||||
const Alerts = require('../../comp/alerts');
|
||||
const FieldViewReadOnly = require('../fields/field-view-read-only');
|
||||
|
@ -26,42 +27,42 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
name: 'ms',
|
||||
round: 1,
|
||||
format(d) {
|
||||
return Format.dtStr(d);
|
||||
return DateFormat.dtStr(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'sec',
|
||||
round: 1000,
|
||||
format(d) {
|
||||
return Format.dtStr(d);
|
||||
return DateFormat.dtStr(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'min',
|
||||
round: 1000 * 60,
|
||||
format(d) {
|
||||
return Format.dtStr(d).replace(':00 ', ' ');
|
||||
return DateFormat.dtStr(d).replace(':00 ', ' ');
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'hour',
|
||||
round: 1000 * 60 * 60,
|
||||
format(d) {
|
||||
return Format.dtStr(d).replace(':00', '');
|
||||
return DateFormat.dtStr(d).replace(':00', '');
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'day',
|
||||
round: 1000 * 60 * 60 * 24,
|
||||
format(d) {
|
||||
return Format.dStr(d);
|
||||
return DateFormat.dStr(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'month',
|
||||
round: 1000 * 60 * 60 * 24 * 31,
|
||||
format(d) {
|
||||
return Format.dStr(d);
|
||||
return DateFormat.dStr(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -141,7 +142,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
name: 'Updated',
|
||||
title: Locale.detHistorySaved,
|
||||
value:
|
||||
Format.dtStr(this.record.updated) +
|
||||
DateFormat.dtStr(this.record.updated) +
|
||||
(this.record.unsaved ? ' (' + Locale.detHistoryCurUnsavedState + ')' : '') +
|
||||
(ix === this.history.length - 1 && !this.record.unsaved
|
||||
? ' (' + Locale.detHistoryCurState + ')'
|
||||
|
@ -153,7 +154,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnlyRaw({
|
||||
model: {
|
||||
name: '$Title',
|
||||
title: Format.capFirst(Locale.title),
|
||||
title: StringFormat.capFirst(Locale.title),
|
||||
value:
|
||||
'<i class="fa fa-' +
|
||||
this.record.icon +
|
||||
|
@ -168,7 +169,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: '$UserName',
|
||||
title: Format.capFirst(Locale.user),
|
||||
title: StringFormat.capFirst(Locale.user),
|
||||
value: this.record.user
|
||||
}
|
||||
})
|
||||
|
@ -177,7 +178,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: '$Password',
|
||||
title: Format.capFirst(Locale.password),
|
||||
title: StringFormat.capFirst(Locale.password),
|
||||
value: this.record.password
|
||||
}
|
||||
})
|
||||
|
@ -186,7 +187,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: '$URL',
|
||||
title: Format.capFirst(Locale.website),
|
||||
title: StringFormat.capFirst(Locale.website),
|
||||
value: this.record.url
|
||||
}
|
||||
})
|
||||
|
@ -195,7 +196,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: '$Notes',
|
||||
title: Format.capFirst(Locale.notes),
|
||||
title: StringFormat.capFirst(Locale.notes),
|
||||
value: this.record.notes
|
||||
}
|
||||
})
|
||||
|
@ -204,7 +205,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: 'Tags',
|
||||
title: Format.capFirst(Locale.tags),
|
||||
title: StringFormat.capFirst(Locale.tags),
|
||||
value: this.record.tags.join(', ')
|
||||
}
|
||||
})
|
||||
|
@ -214,7 +215,7 @@ const DetailsHistoryView = Backbone.View.extend({
|
|||
model: {
|
||||
name: 'Expires',
|
||||
title: Locale.detExpires,
|
||||
value: this.record.expires ? Format.dtStr(this.record.expires) : ''
|
||||
value: this.record.expires ? DateFormat.dtStr(this.record.expires) : ''
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
|
@ -25,11 +25,12 @@ const Alerts = require('../../comp/alerts');
|
|||
const CopyPaste = require('../../comp/copy-paste');
|
||||
const OtpQrReader = require('../../comp/otp-qr-reader');
|
||||
const AutoType = require('../../auto-type');
|
||||
const Format = require('../../util/format');
|
||||
const StringFormat = require('../../util/formatting/string-format');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
const Locale = require('../../util/locale');
|
||||
const Tip = require('../../util/tip');
|
||||
const FileSaver = require('../../util/file-saver');
|
||||
const FeatureDetector = require('../../util/feature-detector');
|
||||
const Tip = require('../../util/ui/tip');
|
||||
const FileSaver = require('../../util/ui/file-saver');
|
||||
const Features = require('../../util/features');
|
||||
const Timeouts = require('../../const/timeouts');
|
||||
const Copyable = require('../../mixins/copyable');
|
||||
|
||||
|
@ -175,7 +176,7 @@ const DetailsView = Backbone.View.extend({
|
|||
this.fileEditView = new FieldViewSelect({
|
||||
model: {
|
||||
name: '$File',
|
||||
title: Format.capFirst(Locale.file),
|
||||
title: StringFormat.capFirst(Locale.file),
|
||||
value() {
|
||||
return fileNames;
|
||||
}
|
||||
|
@ -187,7 +188,7 @@ const DetailsView = Backbone.View.extend({
|
|||
new FieldViewReadOnly({
|
||||
model: {
|
||||
name: 'File',
|
||||
title: Format.capFirst(Locale.file),
|
||||
title: StringFormat.capFirst(Locale.file),
|
||||
value() {
|
||||
return model.fileName;
|
||||
}
|
||||
|
@ -198,7 +199,7 @@ const DetailsView = Backbone.View.extend({
|
|||
this.userEditView = new FieldViewAutocomplete({
|
||||
model: {
|
||||
name: '$UserName',
|
||||
title: Format.capFirst(Locale.user),
|
||||
title: StringFormat.capFirst(Locale.user),
|
||||
value() {
|
||||
return model.user;
|
||||
},
|
||||
|
@ -209,7 +210,7 @@ const DetailsView = Backbone.View.extend({
|
|||
this.passEditView = new FieldViewText({
|
||||
model: {
|
||||
name: '$Password',
|
||||
title: Format.capFirst(Locale.password),
|
||||
title: StringFormat.capFirst(Locale.password),
|
||||
canGen: true,
|
||||
value() {
|
||||
return model.password;
|
||||
|
@ -220,7 +221,7 @@ const DetailsView = Backbone.View.extend({
|
|||
this.urlEditView = new FieldViewUrl({
|
||||
model: {
|
||||
name: '$URL',
|
||||
title: Format.capFirst(Locale.website),
|
||||
title: StringFormat.capFirst(Locale.website),
|
||||
value() {
|
||||
return model.url;
|
||||
}
|
||||
|
@ -231,7 +232,7 @@ const DetailsView = Backbone.View.extend({
|
|||
new FieldViewText({
|
||||
model: {
|
||||
name: '$Notes',
|
||||
title: Format.capFirst(Locale.notes),
|
||||
title: StringFormat.capFirst(Locale.notes),
|
||||
multiline: 'true',
|
||||
markdown: true,
|
||||
value() {
|
||||
|
@ -244,7 +245,7 @@ const DetailsView = Backbone.View.extend({
|
|||
new FieldViewTags({
|
||||
model: {
|
||||
name: 'Tags',
|
||||
title: Format.capFirst(Locale.tags),
|
||||
title: StringFormat.capFirst(Locale.tags),
|
||||
tags: this.appModel.tags,
|
||||
value() {
|
||||
return model.tags;
|
||||
|
@ -284,7 +285,7 @@ const DetailsView = Backbone.View.extend({
|
|||
name: 'Created',
|
||||
title: Locale.detCreated,
|
||||
value() {
|
||||
return Format.dtStr(model.created);
|
||||
return DateFormat.dtStr(model.created);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -295,7 +296,7 @@ const DetailsView = Backbone.View.extend({
|
|||
name: 'Updated',
|
||||
title: Locale.detUpdated,
|
||||
value() {
|
||||
return Format.dtStr(model.updated);
|
||||
return DateFormat.dtStr(model.updated);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -304,7 +305,7 @@ const DetailsView = Backbone.View.extend({
|
|||
new FieldViewHistory({
|
||||
model: {
|
||||
name: 'History',
|
||||
title: Format.capFirst(Locale.history),
|
||||
title: StringFormat.capFirst(Locale.history),
|
||||
value() {
|
||||
return { length: model.historyLength, unsaved: model.unsaved };
|
||||
}
|
||||
|
@ -959,7 +960,7 @@ const DetailsView = Backbone.View.extend({
|
|||
this.model.moveToTrash();
|
||||
Backbone.trigger('refresh');
|
||||
};
|
||||
if (FeatureDetector.isMobile) {
|
||||
if (Features.isMobile) {
|
||||
Alerts.yesno({
|
||||
header: Locale.detDelToTrash,
|
||||
body: Locale.detDelToTrashBody,
|
||||
|
|
|
@ -3,7 +3,7 @@ const FieldViewText = require('./field-view-text');
|
|||
const FieldView = require('./field-view');
|
||||
const Keys = require('../../const/keys');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
const Tip = require('../../util/tip');
|
||||
const Tip = require('../../util/ui/tip');
|
||||
const Locale = require('../../util/locale');
|
||||
|
||||
const FieldViewCustom = FieldViewText.extend({
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const FieldViewText = require('./field-view-text');
|
||||
const Locale = require('../../util/locale');
|
||||
const Pikaday = require('pikaday');
|
||||
const Format = require('../../util/format');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
|
||||
const FieldViewDate = FieldViewText.extend({
|
||||
renderValue(value) {
|
||||
let result = value ? Format.dStr(value) : '';
|
||||
let result = value ? DateFormat.dStr(value) : '';
|
||||
if (value && this.model.lessThanNow && value < new Date()) {
|
||||
result += ' ' + this.model.lessThanNow;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const FieldViewDate = FieldViewText.extend({
|
|||
},
|
||||
|
||||
getEditValue(value) {
|
||||
return value ? Format.dStr(value) : '';
|
||||
return value ? DateFormat.dStr(value) : '';
|
||||
},
|
||||
|
||||
startEdit() {
|
||||
|
|
|
@ -4,10 +4,10 @@ const FieldView = require('./field-view');
|
|||
const GeneratorView = require('../generator-view');
|
||||
const KeyHandler = require('../../comp/key-handler');
|
||||
const Keys = require('../../const/keys');
|
||||
const PasswordGenerator = require('../../util/password-generator');
|
||||
const FeatureDetector = require('../../util/feature-detector');
|
||||
const Tip = require('../../util/tip');
|
||||
const MdToHtml = require('../../util/md-to-html');
|
||||
const PasswordGenerator = require('../../util/generators/password-generator');
|
||||
const Features = require('../../util/features');
|
||||
const Tip = require('../../util/ui/tip');
|
||||
const MdToHtml = require('../../util/formatting/md-to-html');
|
||||
|
||||
const FieldViewText = FieldView.extend({
|
||||
renderValue(value) {
|
||||
|
@ -49,7 +49,7 @@ const FieldViewText = FieldView.extend({
|
|||
if (this.model.multiline) {
|
||||
this.setInputHeight();
|
||||
}
|
||||
if (FeatureDetector.isMobile) {
|
||||
if (Features.isMobile) {
|
||||
this.createMobileControls();
|
||||
}
|
||||
if (this.model.canGen) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Backbone = require('backbone');
|
||||
const CopyPaste = require('../../comp/copy-paste');
|
||||
const Tip = require('../../util/tip');
|
||||
const Tip = require('../../util/ui/tip');
|
||||
|
||||
const FieldView = Backbone.View.extend({
|
||||
template: require('templates/details/field.hbs'),
|
||||
|
|
|
@ -2,7 +2,7 @@ const Backbone = require('backbone');
|
|||
const Scrollable = require('../mixins/scrollable');
|
||||
const Locale = require('../util/locale');
|
||||
const GeneratorPresets = require('../comp/generator-presets');
|
||||
const PasswordGenerator = require('../util/password-generator');
|
||||
const PasswordGenerator = require('../util/generators/password-generator');
|
||||
|
||||
const GeneratorPresetsView = Backbone.View.extend({
|
||||
template: require('templates/generator-presets.hbs'),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const Backbone = require('backbone');
|
||||
const PasswordGenerator = require('../util/password-generator');
|
||||
const PasswordGenerator = require('../util/generators/password-generator');
|
||||
const CopyPaste = require('../comp/copy-paste');
|
||||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const GeneratorPresets = require('../comp/generator-presets');
|
||||
const Locale = require('../util/locale');
|
||||
const Tip = require('../util/tip');
|
||||
const Tip = require('../util/ui/tip');
|
||||
|
||||
const GeneratorView = Backbone.View.extend({
|
||||
el: 'body',
|
||||
|
|
|
@ -2,7 +2,7 @@ const Backbone = require('backbone');
|
|||
const SecureInput = require('../comp/secure-input');
|
||||
const Alerts = require('../comp/alerts');
|
||||
const Locale = require('../util/locale');
|
||||
const InputFx = require('../util/input-fx');
|
||||
const InputFx = require('../util/ui/input-fx');
|
||||
const Keys = require('../const/keys');
|
||||
|
||||
const KeyChangeView = Backbone.View.extend({
|
||||
|
|
|
@ -2,11 +2,11 @@ const Backbone = require('backbone');
|
|||
const Keys = require('../const/keys');
|
||||
const KeyHandler = require('../comp/key-handler');
|
||||
const DropdownView = require('./dropdown-view');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
const Shortcuts = require('../comp/shortcuts');
|
||||
const Format = require('../util/format');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const Locale = require('../util/locale');
|
||||
const Comparators = require('../util/comparators');
|
||||
const Comparators = require('../util/data/comparators');
|
||||
|
||||
const ListSearchView = Backbone.View.extend({
|
||||
template: require('templates/list-search.hbs'),
|
||||
|
@ -37,32 +37,36 @@ const ListSearchView = Backbone.View.extend({
|
|||
{
|
||||
value: 'title',
|
||||
icon: 'sort-alpha-asc',
|
||||
loc: () => Format.capFirst(Locale.title) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
loc: () =>
|
||||
StringFormat.capFirst(Locale.title) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
},
|
||||
{
|
||||
value: '-title',
|
||||
icon: 'sort-alpha-desc',
|
||||
loc: () => Format.capFirst(Locale.title) + ' ' + this.addArrow(Locale.searchZA)
|
||||
loc: () =>
|
||||
StringFormat.capFirst(Locale.title) + ' ' + this.addArrow(Locale.searchZA)
|
||||
},
|
||||
{
|
||||
value: 'website',
|
||||
icon: 'sort-alpha-asc',
|
||||
loc: () => Format.capFirst(Locale.website) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
loc: () =>
|
||||
StringFormat.capFirst(Locale.website) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
},
|
||||
{
|
||||
value: '-website',
|
||||
icon: 'sort-alpha-desc',
|
||||
loc: () => Format.capFirst(Locale.website) + ' ' + this.addArrow(Locale.searchZA)
|
||||
loc: () =>
|
||||
StringFormat.capFirst(Locale.website) + ' ' + this.addArrow(Locale.searchZA)
|
||||
},
|
||||
{
|
||||
value: 'user',
|
||||
icon: 'sort-alpha-asc',
|
||||
loc: () => Format.capFirst(Locale.user) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
loc: () => StringFormat.capFirst(Locale.user) + ' ' + this.addArrow(Locale.searchAZ)
|
||||
},
|
||||
{
|
||||
value: '-user',
|
||||
icon: 'sort-alpha-desc',
|
||||
loc: () => Format.capFirst(Locale.user) + ' ' + this.addArrow(Locale.searchZA)
|
||||
loc: () => StringFormat.capFirst(Locale.user) + ' ' + this.addArrow(Locale.searchZA)
|
||||
},
|
||||
{
|
||||
value: 'created',
|
||||
|
@ -135,7 +139,7 @@ const ListSearchView = Backbone.View.extend({
|
|||
this.sortOptions.forEach(opt => {
|
||||
opt.text = opt.loc();
|
||||
});
|
||||
const entryDesc = FeatureDetector.isMobile
|
||||
const entryDesc = Features.isMobile
|
||||
? ''
|
||||
: ' <span class="muted-color">(' +
|
||||
Locale.searchShiftClickOr +
|
||||
|
@ -143,8 +147,8 @@ const ListSearchView = Backbone.View.extend({
|
|||
Shortcuts.altShortcutSymbol(true) +
|
||||
'N)</span>';
|
||||
this.createOptions = [
|
||||
{ value: 'entry', icon: 'key', text: Format.capFirst(Locale.entry) + entryDesc },
|
||||
{ value: 'group', icon: 'folder', text: Format.capFirst(Locale.group) }
|
||||
{ value: 'entry', icon: 'key', text: StringFormat.capFirst(Locale.entry) + entryDesc },
|
||||
{ value: 'group', icon: 'folder', text: StringFormat.capFirst(Locale.group) }
|
||||
];
|
||||
this.render();
|
||||
},
|
||||
|
@ -383,7 +387,7 @@ const ListSearchView = Backbone.View.extend({
|
|||
options.push({
|
||||
value: 'tmpl',
|
||||
icon: 'sticky-note-o',
|
||||
text: Format.capFirst(Locale.template)
|
||||
text: StringFormat.capFirst(Locale.template)
|
||||
});
|
||||
return options;
|
||||
},
|
||||
|
|
|
@ -8,7 +8,7 @@ const EntryPresenter = require('../presenters/entry-presenter');
|
|||
const DragDropInfo = require('../comp/drag-drop-info');
|
||||
const AppSettingsModel = require('../models/app-settings-model');
|
||||
const Locale = require('../util/locale');
|
||||
const Format = require('../util/format');
|
||||
const StringFormat = require('../util/formatting/string-format');
|
||||
const Alerts = require('../comp/alerts');
|
||||
|
||||
const ListView = Backbone.View.extend({
|
||||
|
@ -277,7 +277,7 @@ const ListView = Backbone.View.extend({
|
|||
const options = this.tableColumns.map(col => ({
|
||||
value: col.val,
|
||||
icon: col.enabled ? 'check-square-o' : 'square-o',
|
||||
text: Format.capFirst(Locale[col.name])
|
||||
text: StringFormat.capFirst(Locale[col.name])
|
||||
}));
|
||||
view.render({
|
||||
position: {
|
||||
|
|
|
@ -9,13 +9,13 @@ const KeyHandler = require('../comp/key-handler');
|
|||
const StorageFileListView = require('../views/storage-file-list-view');
|
||||
const Logger = require('../util/logger');
|
||||
const Locale = require('../util/locale');
|
||||
const UrlUtil = require('../util/url-util');
|
||||
const InputFx = require('../util/input-fx');
|
||||
const Comparators = require('../util/comparators');
|
||||
const UrlFormat = require('../util/formatting/url-format');
|
||||
const InputFx = require('../util/ui/input-fx');
|
||||
const Comparators = require('../util/data/comparators');
|
||||
const Storage = require('../storage');
|
||||
const Launcher = require('../comp/launcher');
|
||||
const FocusDetector = require('../comp/focus-detector');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
const Features = require('../util/features');
|
||||
|
||||
const logger = new Logger('open-view');
|
||||
|
||||
|
@ -113,7 +113,7 @@ const OpenView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
focusInput(focusOnMobile) {
|
||||
if (FocusDetector.hasFocus() && (focusOnMobile || !FeatureDetector.isMobile)) {
|
||||
if (FocusDetector.hasFocus() && (focusOnMobile || !Features.isMobile)) {
|
||||
this.inputEl.focus();
|
||||
}
|
||||
},
|
||||
|
@ -789,7 +789,7 @@ const OpenView = Backbone.View.extend({
|
|||
this.params.id = null;
|
||||
this.params.storage = storage.name;
|
||||
this.params.path = file.path;
|
||||
this.params.name = UrlUtil.getDataFileName(file.name);
|
||||
this.params.name = UrlFormat.getDataFileName(file.name);
|
||||
this.params.rev = file.rev;
|
||||
this.params.fileData = null;
|
||||
this.displayOpenFile();
|
||||
|
@ -887,7 +887,7 @@ const OpenView = Backbone.View.extend({
|
|||
this.params.storage = req.storage;
|
||||
this.params.path = req.path;
|
||||
this.params.opts = req.opts;
|
||||
this.params.name = UrlUtil.getDataFileName(req.path);
|
||||
this.params.name = UrlFormat.getDataFileName(req.path);
|
||||
this.params.rev = stat.rev;
|
||||
this.params.fileData = null;
|
||||
this.displayOpenFile();
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
const Backbone = require('backbone');
|
||||
const OpenConfigView = require('../open-config-view');
|
||||
const Shortcuts = require('../../comp/shortcuts');
|
||||
const PasswordGenerator = require('../../util/password-generator');
|
||||
const PasswordGenerator = require('../../util/generators/password-generator');
|
||||
const Alerts = require('../../comp/alerts');
|
||||
const Launcher = require('../../comp/launcher');
|
||||
const Storage = require('../../storage');
|
||||
const Links = require('../../const/links');
|
||||
const Format = require('../../util/format');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
const Locale = require('../../util/locale');
|
||||
const UrlUtil = require('../../util/url-util');
|
||||
const FileSaver = require('../../util/file-saver');
|
||||
const UrlFormat = require('../../util/formatting/url-format');
|
||||
const FileSaver = require('../../util/ui/file-saver');
|
||||
const AppSettingsModel = require('../../models/app-settings-model');
|
||||
const kdbxweb = require('kdbxweb');
|
||||
|
||||
|
@ -92,7 +92,7 @@ const SettingsFileView = Backbone.View.extend({
|
|||
storage: this.model.get('storage'),
|
||||
syncing: this.model.get('syncing'),
|
||||
syncError: this.model.get('syncError'),
|
||||
syncDate: Format.dtStr(this.model.get('syncDate')),
|
||||
syncDate: DateFormat.dtStr(this.model.get('syncDate')),
|
||||
password: PasswordGenerator.present(this.model.get('passwordLength')),
|
||||
defaultUser: this.model.get('defaultUser'),
|
||||
recycleBinEnabled: this.model.get('recycleBinEnabled'),
|
||||
|
@ -329,7 +329,7 @@ const SettingsFileView = Backbone.View.extend({
|
|||
const expName = this.model.get('name').toLowerCase();
|
||||
const existingFile = _.find(files, file => {
|
||||
return (
|
||||
!file.dir && UrlUtil.getDataFileName(file.name).toLowerCase() === expName
|
||||
!file.dir && UrlFormat.getDataFileName(file.name).toLowerCase() === expName
|
||||
);
|
||||
});
|
||||
if (existingFile) {
|
||||
|
|
|
@ -3,16 +3,16 @@ const SettingsPrvView = require('./settings-prv-view');
|
|||
const SettingsLogsView = require('./settings-logs-view');
|
||||
const Launcher = require('../../comp/launcher');
|
||||
const Updater = require('../../comp/updater');
|
||||
const Format = require('../../util/format');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
const AppSettingsModel = require('../../models/app-settings-model');
|
||||
const UpdateModel = require('../../models/update-model');
|
||||
const RuntimeInfo = require('../../comp/runtime-info');
|
||||
const Alerts = require('../../comp/alerts');
|
||||
const SettingsManager = require('../../comp/settings-manager');
|
||||
const Storage = require('../../storage');
|
||||
const FeatureDetector = require('../../util/feature-detector');
|
||||
const Features = require('../../util/features');
|
||||
const Locale = require('../../util/locale');
|
||||
const SemVer = require('../../util/semver');
|
||||
const SemVer = require('../../util/data/semver');
|
||||
const Links = require('../../const/links');
|
||||
const AutoType = require('../../auto-type');
|
||||
|
||||
|
@ -92,7 +92,7 @@ const SettingsGeneralView = Backbone.View.extend({
|
|||
lockOnAutoType: AppSettingsModel.instance.get('lockOnAutoType'),
|
||||
lockOnOsLock: AppSettingsModel.instance.get('lockOnOsLock'),
|
||||
tableView: AppSettingsModel.instance.get('tableView'),
|
||||
canSetTableView: !FeatureDetector.isMobile,
|
||||
canSetTableView: !Features.isMobile,
|
||||
autoUpdate: Updater.getAutoUpdateType(),
|
||||
updateInProgress: Updater.updateInProgress(),
|
||||
updateInfo: this.getUpdateInfo(),
|
||||
|
@ -104,10 +104,10 @@ const SettingsGeneralView = Backbone.View.extend({
|
|||
releaseNotesLink: Links.ReleaseNotes,
|
||||
colorfulIcons: AppSettingsModel.instance.get('colorfulIcons'),
|
||||
directAutotype: AppSettingsModel.instance.get('directAutotype'),
|
||||
supportsTitleBarStyles: Launcher && FeatureDetector.supportsTitleBarStyles(),
|
||||
supportsTitleBarStyles: Launcher && Features.supportsTitleBarStyles(),
|
||||
titlebarStyle: AppSettingsModel.instance.get('titlebarStyle'),
|
||||
storageProviders,
|
||||
showReloadApp: FeatureDetector.isStandalone
|
||||
showReloadApp: Features.isStandalone
|
||||
});
|
||||
this.renderProviderViews(storageProviders);
|
||||
},
|
||||
|
@ -140,7 +140,7 @@ const SettingsGeneralView = Backbone.View.extend({
|
|||
'. ' +
|
||||
Locale.setGenLastCheckSuccess.replace(
|
||||
'{}',
|
||||
Format.dtStr(UpdateModel.instance.get('lastSuccessCheckDate'))
|
||||
DateFormat.dtStr(UpdateModel.instance.get('lastSuccessCheckDate'))
|
||||
) +
|
||||
': ' +
|
||||
Locale.setGenLastCheckVer.replace(
|
||||
|
@ -154,7 +154,7 @@ const SettingsGeneralView = Backbone.View.extend({
|
|||
let msg =
|
||||
Locale.setGenCheckedAt +
|
||||
' ' +
|
||||
Format.dtStr(UpdateModel.instance.get('lastCheckDate')) +
|
||||
DateFormat.dtStr(UpdateModel.instance.get('lastCheckDate')) +
|
||||
': ';
|
||||
const cmp = SemVer.compareVersions(
|
||||
RuntimeInfo.version,
|
||||
|
@ -166,7 +166,7 @@ const SettingsGeneralView = Backbone.View.extend({
|
|||
msg +=
|
||||
Locale.setGenNewVer.replace('{}', UpdateModel.instance.get('lastVersion')) +
|
||||
' ' +
|
||||
Format.dStr(UpdateModel.instance.get('lastVersionReleaseDate'));
|
||||
DateFormat.dStr(UpdateModel.instance.get('lastVersionReleaseDate'));
|
||||
}
|
||||
switch (UpdateModel.instance.get('updateStatus')) {
|
||||
case 'downloading':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Backbone = require('backbone');
|
||||
const Logger = require('../../util/logger');
|
||||
const Format = require('../../util/format');
|
||||
const StringFormat = require('../../util/formatting/string-format');
|
||||
|
||||
const SettingsLogView = Backbone.View.extend({
|
||||
template: require('templates/settings/settings-logs-view.hbs'),
|
||||
|
@ -10,7 +10,7 @@ const SettingsLogView = Backbone.View.extend({
|
|||
level: item.level,
|
||||
msg:
|
||||
'[' +
|
||||
Format.padStr(item.level.toUpperCase(), 5) +
|
||||
StringFormat.padStr(item.level.toUpperCase(), 5) +
|
||||
'] ' +
|
||||
item.args.map(arg => this.mapArg(arg)).join(' ')
|
||||
}));
|
||||
|
|
|
@ -3,11 +3,11 @@ const Locale = require('../../util/locale');
|
|||
const PluginManager = require('../../plugins/plugin-manager');
|
||||
const PluginGallery = require('../../plugins/plugin-gallery');
|
||||
const AppSettingsModel = require('../../models/app-settings-model');
|
||||
const Comparators = require('../../util/comparators');
|
||||
const Format = require('../../util/format');
|
||||
const Comparators = require('../../util/data/comparators');
|
||||
const DateFormat = require('../../util/formatting/date-format');
|
||||
const SettingsManager = require('../../comp/settings-manager');
|
||||
const FeatureDetector = require('../../util/feature-detector');
|
||||
const SemVer = require('../../util/semver');
|
||||
const Features = require('../../util/features');
|
||||
const SemVer = require('../../util/data/semver');
|
||||
const RuntimeInfo = require('../../comp/runtime-info');
|
||||
const Links = require('../../const/links');
|
||||
|
||||
|
@ -54,7 +54,7 @@ const SettingsPluginsView = Backbone.View.extend({
|
|||
status: plugin.get('status'),
|
||||
installTime: Math.round(plugin.get('installTime')),
|
||||
updateError: plugin.get('updateError'),
|
||||
updateCheckDate: Format.dtStr(plugin.get('updateCheckDate')),
|
||||
updateCheckDate: DateFormat.dtStr(plugin.get('updateCheckDate')),
|
||||
installError: plugin.get('installError'),
|
||||
official: plugin.get('official'),
|
||||
autoUpdate: plugin.get('autoUpdate'),
|
||||
|
@ -68,7 +68,7 @@ const SettingsPluginsView = Backbone.View.extend({
|
|||
galleryLoadError: PluginGallery.loadError,
|
||||
galleryPlugins: this.getGalleryPlugins(),
|
||||
searchStr: this.searchStr,
|
||||
hasUnicodeFlags: FeatureDetector.hasUnicodeFlags(),
|
||||
hasUnicodeFlags: Features.hasUnicodeFlags(),
|
||||
pluginDevLink: Links.PluginDevelopStart,
|
||||
translateLink: Links.Translation
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ const Locale = require('../../util/locale');
|
|||
const Keys = require('../../const/keys');
|
||||
const Launcher = require('../../comp/launcher');
|
||||
const Shortcuts = require('../../comp/shortcuts');
|
||||
const FeatureDetector = require('../../util/feature-detector');
|
||||
const Features = require('../../util/features');
|
||||
|
||||
const SettingsShortcutsView = Backbone.View.extend({
|
||||
template: require('templates/settings/settings-shortcuts.hbs'),
|
||||
|
@ -34,7 +34,7 @@ const SettingsShortcutsView = Backbone.View.extend({
|
|||
this.renderTemplate({
|
||||
cmd: Shortcuts.actionShortcutSymbol(true),
|
||||
alt: Shortcuts.altShortcutSymbol(true),
|
||||
globalIsLarge: !FeatureDetector.isMac,
|
||||
globalIsLarge: !Features.isMac,
|
||||
autoTypeSupported: !!Launcher,
|
||||
globalShortcuts: Launcher
|
||||
? {
|
||||
|
@ -58,7 +58,7 @@ const SettingsShortcutsView = Backbone.View.extend({
|
|||
.addClass('shortcut__editor-input')
|
||||
.val(Shortcuts.globalShortcutText(globalShortcutType))
|
||||
.appendTo(shortcutEditor);
|
||||
if (!FeatureDetector.isMac) {
|
||||
if (!Features.isMac) {
|
||||
shortcutEditorInput.addClass('shortcut__editor-input--large');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Backbone = require('backbone');
|
||||
const UrlUtil = require('../util/url-util');
|
||||
const UrlFormat = require('../util/formatting/url-format');
|
||||
|
||||
const StorageFileListView = Backbone.View.extend({
|
||||
template: require('templates/storage-file-list.hbs'),
|
||||
|
@ -20,7 +20,7 @@ const StorageFileListView = Backbone.View.extend({
|
|||
return {
|
||||
path: file.path,
|
||||
name: file.name.replace(/\.kdbx$/i, ''),
|
||||
kdbx: UrlUtil.isKdbx(file.name),
|
||||
kdbx: UrlFormat.isKdbx(file.name),
|
||||
dir: file.dir
|
||||
};
|
||||
});
|
||||
|
|
|
@ -387,16 +387,37 @@
|
|||
}
|
||||
.markdown {
|
||||
white-space: normal;
|
||||
h6 { font-size: 1rem; }
|
||||
h5 { font-size: modular-scale(1, 1rem, 1.05); }
|
||||
h4 { font-size: modular-scale(2, 1rem, 1.05); }
|
||||
h3 { font-size: modular-scale(3, 1rem, 1.05); }
|
||||
h2 { font-size: modular-scale(4, 1rem, 1.05); }
|
||||
h1 { font-size: $small-header-font-size; }
|
||||
ul, ol { margin-bottom: 1em; }
|
||||
ul { list-style-type: initial; }
|
||||
ol { list-style-type: decimal; }
|
||||
li { margin-left: 2em; }
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
h5 {
|
||||
font-size: modular-scale(1, 1rem, 1.05);
|
||||
}
|
||||
h4 {
|
||||
font-size: modular-scale(2, 1rem, 1.05);
|
||||
}
|
||||
h3 {
|
||||
font-size: modular-scale(3, 1rem, 1.05);
|
||||
}
|
||||
h2 {
|
||||
font-size: modular-scale(4, 1rem, 1.05);
|
||||
}
|
||||
h1 {
|
||||
font-size: $small-header-font-size;
|
||||
}
|
||||
ul,
|
||||
ol {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
ul {
|
||||
list-style-type: initial;
|
||||
}
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
li {
|
||||
margin-left: 2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ body.th-macdark {
|
|||
.at-select__item--active .at-select__item-options:hover {
|
||||
background: var(--secondary-background-color);
|
||||
}
|
||||
.dropdown__item--active, .dropdown__item--active:hover {
|
||||
.dropdown__item--active,
|
||||
.dropdown__item--active:hover {
|
||||
background-color: var(--selected-item-color);
|
||||
}
|
||||
@include nomobile {
|
||||
|
|
Loading…
Reference in New Issue