userContent/theme.js
// find a mdi class by filename/pos/href
find a mdi class by filename/pos/href
find a mdi class by filename / pos / href
function mapping(img, pos, href) {
		let l1 = MMP[img];
		if (img.includes('?')) {
			return '';
		}
		if (!l1) {
			console.warn('MAP MIS1:', img, pos);
			return '';
		}
		if (typeof(l1) == 'string') {
			return l1;
		}
		let params = [{
			key: 'pos',
			value: pos || ''
		}, {
			key: 'href',
			value: href || ''
		}];
		let rst = l1;
		for (let prm of params) {
			nxt = rst.filter(v => !v[prm.key] || prm.value.endsWith(v[prm.key]));
			if (!nxt.length) {
				console.warn(`MAP MIS: ${img} on ${prm.key}=${prm.value}`);
				return '';
			} else if (nxt.length == 1) {
				return nxt[0].value;
			}
			rst = nxt;
		}
		console.warn('MAP MULTI:', img, pos, href);
		return '';
	}
function mapping ( img , pos , href ) { let l1 = MMP [ img ] ; if ( img . includes ( '?' ) ) { return '' ; } if ( ! l1 ) { console . warn ( 'MAP MIS1:' , img , pos ) ; return '' ; } if ( typeof ( l1 ) == 'string' ) { return l1 ; } let params = [ { key : 'pos' , value : pos || '' } , { key : 'href' , value : href || '' } ] ; let rst = l1 ; for ( let prm of params ) { nxt = rst . filter ( v => ! v [ prm . key ] || prm . value . endsWith ( v [ prm . key ] ) ) ; if ( ! nxt . length ) { console . warn ( ` ${ img } ${ prm . key } ${ prm . value } ` ) ; return '' ; } else if ( nxt . length == 1 ) { return nxt [ 0 ] . value ; } rst = nxt ; } console . warn ( 'MAP MULTI:' , img , pos , href ) ; return '' ; }
find a mdi class by filename/pos/href
find a mdi class by filename / pos / href
// skip dynamic image // miss config 1 // match by 'endsWith' // miss config 2 // match multiple icon