feat: minor code refactor
This commit is contained in:
parent
6471aa2140
commit
6e7de72686
5 changed files with 6 additions and 6 deletions
|
@ -133,7 +133,7 @@ if (!gotSingleInstanceLock) {
|
||||||
// HACK: patch webrequest to fix devtools incompatibility with electron 2.x.
|
// HACK: patch webrequest to fix devtools incompatibility with electron 2.x.
|
||||||
// See https://github.com/electron/electron/issues/13008#issuecomment-400261941
|
// See https://github.com/electron/electron/issues/13008#issuecomment-400261941
|
||||||
session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => {
|
session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => {
|
||||||
if (details.url.indexOf('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33') !== -1) {
|
if (details.url.includes('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33')) {
|
||||||
callback({
|
callback({
|
||||||
redirectURL: details.url.replace(
|
redirectURL: details.url.replace(
|
||||||
'7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33',
|
'7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33',
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default function FileViewer(props: Props) {
|
||||||
costInfo,
|
costInfo,
|
||||||
} = props;
|
} = props;
|
||||||
const cost = costInfo && costInfo.cost;
|
const cost = costInfo && costInfo.cost;
|
||||||
const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1;
|
const isPlayable = ['audio', 'video'].includes(mediaType);
|
||||||
const fileStatus = fileInfo && fileInfo.status;
|
const fileStatus = fileInfo && fileInfo.status;
|
||||||
const supported = (IS_WEB && isStreamable) || !IS_WEB;
|
const supported = (IS_WEB && isStreamable) || !IS_WEB;
|
||||||
|
|
||||||
|
|
|
@ -371,10 +371,10 @@ export default class Autocomplete extends React.Component {
|
||||||
if (value !== '' && matchedItem) {
|
if (value !== '' && matchedItem) {
|
||||||
const itemValue = getItemValue(matchedItem);
|
const itemValue = getItemValue(matchedItem);
|
||||||
const itemValueDoesMatch =
|
const itemValueDoesMatch =
|
||||||
itemValue.toLowerCase().indexOf(
|
itemValue.toLowerCase().includes(
|
||||||
value.toLowerCase()
|
value.toLowerCase()
|
||||||
// below line is the the only thing that is changed from the real component
|
// below line is the the only thing that is changed from the real component
|
||||||
) !== -1;
|
);
|
||||||
if (itemValueDoesMatch) {
|
if (itemValueDoesMatch) {
|
||||||
return { highlightedIndex: index };
|
return { highlightedIndex: index };
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
||||||
|
|
||||||
// If the file is for a claim we published then also abandon the claim
|
// If the file is for a claim we published then also abandon the claim
|
||||||
const myClaimsOutpoints = selectMyClaimsOutpoints(state);
|
const myClaimsOutpoints = selectMyClaimsOutpoints(state);
|
||||||
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
|
if (abandonClaim && myClaimsOutpoints.includes(outpoint)) {
|
||||||
const [txid, nout] = outpoint.split(':');
|
const [txid, nout] = outpoint.split(':');
|
||||||
|
|
||||||
dispatch(doAbandonClaim(txid, Number(nout)));
|
dispatch(doAbandonClaim(txid, Number(nout)));
|
||||||
|
|
|
@ -30,7 +30,7 @@ export function toQueryString(params) {
|
||||||
// https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter
|
// https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter
|
||||||
export function updateQueryParam(uri, key, value) {
|
export function updateQueryParam(uri, key, value) {
|
||||||
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
||||||
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
const separator = uri.includes('?') ? '&' : '?';
|
||||||
if (uri.match(re)) {
|
if (uri.match(re)) {
|
||||||
return uri.replace(re, '$1' + key + '=' + value + '$2');
|
return uri.replace(re, '$1' + key + '=' + value + '$2');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue