|
@@ -374,7 +374,6 @@ export function checkUrlType(urlType: string) {
|
|
return 'video';
|
|
return 'video';
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
const instruments: any = {
|
|
const instruments: any = {
|
|
'Acoustic Grand Piano': '大钢琴',
|
|
'Acoustic Grand Piano': '大钢琴',
|
|
'Bright Acoustic Piano': '明亮的钢琴',
|
|
'Bright Acoustic Piano': '明亮的钢琴',
|
|
@@ -581,13 +580,13 @@ const instruments: any = {
|
|
export const getInstrumentName = (name = '') => {
|
|
export const getInstrumentName = (name = '') => {
|
|
name = name.toLocaleLowerCase().replace(/ /g, '');
|
|
name = name.toLocaleLowerCase().replace(/ /g, '');
|
|
if (!name) return '';
|
|
if (!name) return '';
|
|
- for (let key in instruments) {
|
|
|
|
|
|
+ for (const key in instruments) {
|
|
const _key = key.toLocaleLowerCase().replace(/ /g, '');
|
|
const _key = key.toLocaleLowerCase().replace(/ /g, '');
|
|
if (_key.includes(name)) {
|
|
if (_key.includes(name)) {
|
|
return instruments[key];
|
|
return instruments[key];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (let key in instruments) {
|
|
|
|
|
|
+ for (const key in instruments) {
|
|
const _key = key.toLocaleLowerCase().replace(/ /g, '');
|
|
const _key = key.toLocaleLowerCase().replace(/ /g, '');
|
|
if (name.includes(_key)) {
|
|
if (name.includes(_key)) {
|
|
return instruments[key];
|
|
return instruments[key];
|
|
@@ -647,4 +646,28 @@ export const sortMusical = (name: string, index: number) => {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
return sortId;
|
|
return sortId;
|
|
-};
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export const iframeDislableKeyboard = (iframeDom: any) => {
|
|
|
|
+ // 在 iframe 内部注入脚本禁用右键菜单
|
|
|
|
+ const script = document.createElement('script');
|
|
|
|
+ script.innerHTML = `
|
|
|
|
+ document.addEventListener('contextmenu', function(e) {
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ document.addEventListener('keydown', function (event) {
|
|
|
|
+ // 屏蔽 F12 和 Ctrl+Shift+I
|
|
|
|
+ if (
|
|
|
|
+ event.key === 'F12' ||
|
|
|
|
+ (event.ctrlKey && event.shiftKey && event.key === 'I') ||
|
|
|
|
+ (event.metaKey && event.altKey && event.key === 'I')
|
|
|
|
+ ) {
|
|
|
|
+ event.preventDefault();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ `;
|
|
|
|
+ if (iframeDom.contentWindow.document.body) {
|
|
|
|
+ iframeDom?.contentDocument?.body.appendChild(script);
|
|
|
|
+ }
|
|
|
|
+};
|