replace substr to slice

This commit is contained in:
monoid 2021-01-16 21:36:54 +09:00
parent 14401b2784
commit 64f5c82c8c
2 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ export const ContentInfo = (props: {
const subinfoContainer = props.short ? classes.short_subinfoContainer : const subinfoContainer = props.short ? classes.short_subinfoContainer :
classes.subinfoContainer; classes.subinfoContainer;
let allTag = document.tags; let allTag = document.tags;
const artists = allTag.filter(x => x.startsWith("artist:")).map(x => x.substr(7)); const artists = allTag.filter(x => x.startsWith("artist:")).map(x => x.slice(7));
allTag = allTag.filter(x => !x.startsWith("artist:")); allTag = allTag.filter(x => !x.startsWith("artist:"));
return (<Paper className={propclasses.root || rootName} elevation={4}> return (<Paper className={propclasses.root || rootName} elevation={4}>
<Link className={propclasses.thumbnail_anchor || thumbnail_anchor} component={RouterLink} to={{ <Link className={propclasses.thumbnail_anchor || thumbnail_anchor} component={RouterLink} to={{

View File

@ -63,10 +63,10 @@ export const TagChip = (props:Omit<ChipProps,"color"> & {tagname: string})=>{
let newlabel:string|undefined = undefined; let newlabel:string|undefined = undefined;
if(typeof label === "string"){ if(typeof label === "string"){
if(label.startsWith("female:")){ if(label.startsWith("female:")){
newlabel ="♀ "+label.substr(7); newlabel ="♀ "+label.slice(7);
} }
else if(label.startsWith("male:")){ else if(label.startsWith("male:")){
newlabel = "♂ "+label.substr(5); newlabel = "♂ "+label.slice(5);
} }
} }
return <ColorChip color={getTagColorName(tagname)} label={newlabel||label} {...rest}></ColorChip>; return <ColorChip color={getTagColorName(tagname)} label={newlabel||label} {...rest}></ColorChip>;