fix problems reported by eslint

This commit is contained in:
Tilman Kranz 2024-11-10 15:08:12 +01:00 committed by Tilman Kranz
parent 8e6b09583d
commit 36773fe342
2 changed files with 35 additions and 21 deletions

10
eslint.config.js Normal file
View File

@ -0,0 +1,10 @@
// eslint.config.js
export default [
{
rules: {
semi: "error",
"prefer-const": "error"
}
}
];

View File

@ -118,7 +118,7 @@ var MyPlayer = function(_args) {
"3g2": "video/3gpp2",
"7z": "application/x-7z-compressed"
}[extension] || "application/octet-stream";
}
};
var args = (typeof(_args)==='undefined')
? defaultArgs
@ -141,7 +141,7 @@ var MyPlayer = function(_args) {
$(args.audio).css({
'height': '500px',
});
}
};
var readId3 = function() {
$(args.element).find('ul.mejs li').each(function(i, track){
@ -149,30 +149,34 @@ var MyPlayer = function(_args) {
$(track).prepend('<span class="ajaxLoader">&nbsp;</span>&nbsp;');
ID3.loadTags(url, function() {
var tags = ID3.getAllTags(url);
jsmediatags.read(url, {
onSuccess: function(tag) {
var tags = tag.tags;
var track_title;
if(typeof(tags.title)!='undefined') {
var track_title = tags.title;
if(typeof(tags.title)!='undefined')
track_title = tags.title;
else
track_title = url;
if(typeof(tags.artist)!='undefined')
track_title = tags.artist + ' - ' + track_title;
track_title = tags.artist + ' - ' + track_title;
$(args.element).find('ul.mejs li').each(function(j, _track){
if(i==j)
$(_track).html(track_title);
if(i==j)
$(_track).html(track_title);
});
}
});
});
}
};
var playerCreated = function() {
restoreParams();
if(args.id3)
readId3();
}
};
var createPlayer = function() {
player = new MediaElementPlayer(
@ -186,7 +190,7 @@ var MyPlayer = function(_args) {
'The player is currently detached.'+
'</p>'
);
}
};
var param = function(name) {
var query = window.location.search.substring(1);
@ -200,7 +204,7 @@ var MyPlayer = function(_args) {
}
return false;
}
};
var setupDetach = function() {
if(!args.detachable)
@ -224,7 +228,7 @@ var MyPlayer = function(_args) {
$("iframe",top.document).height(20);
return false;
}
};
if(param('popup')==false) {
$('.mejs-controls').append(
@ -255,7 +259,7 @@ var MyPlayer = function(_args) {
'currentTime='+currentTime+'&'+
'volume='+volume+'&'+
'trackNo='+trackNo
)
);
});
}
else {
@ -265,9 +269,9 @@ var MyPlayer = function(_args) {
$("iframe", opener.top.document).height(windowHeight);
$('.mejs-audio', opener.document).show();
$('.playerDetached', opener.document).hide();
}
};
}
}
};
var restoreParams = function() {
if(!detached)
@ -289,7 +293,7 @@ var MyPlayer = function(_args) {
if(paused)
player.pause();
}
};
if(param('popup')!==false) {
detached = true;
@ -413,5 +417,5 @@ var MyPlayer = function(_args) {
$(args.element).append('<p>Unsupported mode "'+args.mode+'"</p>');
failed = true;
}
}
};