mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Format code
This commit is contained in:
parent
dadbcf4a11
commit
0820b4a281
1 changed files with 18 additions and 20 deletions
|
|
@ -6,19 +6,19 @@ var blob_url;
|
|||
|
||||
audio.onended = stop;
|
||||
|
||||
function stop(){
|
||||
function stop() {
|
||||
URL.revokeObjectURL(blob_url);
|
||||
audio.pause();
|
||||
audio.src = "";
|
||||
audio.load();
|
||||
audio.currentTime = 0;
|
||||
|
||||
|
||||
$window.title(base_title);
|
||||
|
||||
$(".menu-popup").triggerHandler("update");
|
||||
};
|
||||
|
||||
function play_from_file(file){
|
||||
function play_from_file(file) {
|
||||
blob_url = URL.createObjectURL(file);
|
||||
audio.src = blob_url;
|
||||
audio.play();
|
||||
|
|
@ -31,11 +31,11 @@ var menus = {
|
|||
"&MP3": [
|
||||
{
|
||||
item: "&Play...",
|
||||
action: ()=> {
|
||||
action: () => {
|
||||
stop();
|
||||
|
||||
$("<input type='file' accept='audio/mp3'>").click().change(function(e){
|
||||
if(this.files[0]){
|
||||
$("<input type='file' accept='audio/mp3'>").click().change(function (e) {
|
||||
if (this.files[0]) {
|
||||
play_from_file(this.files[0]);
|
||||
}
|
||||
});
|
||||
|
|
@ -44,29 +44,29 @@ var menus = {
|
|||
{
|
||||
item: "&Stop",
|
||||
action: stop,
|
||||
enabled: ()=> audio.currentTime > 0,
|
||||
enabled: () => audio.currentTime > 0,
|
||||
},
|
||||
{
|
||||
item: "P&ause",
|
||||
action: ()=> {
|
||||
action: () => {
|
||||
audio.pause();
|
||||
$window.title(base_title + " - " + file_name + " - Paused");
|
||||
},
|
||||
enabled: ()=> !audio.paused,
|
||||
enabled: () => !audio.paused,
|
||||
},
|
||||
{
|
||||
item: "&Unpause",
|
||||
action: ()=> {
|
||||
action: () => {
|
||||
audio.play();
|
||||
$window.title(base_title + " - " + file_name);
|
||||
},
|
||||
enabled: ()=> audio.currentTime > 0 && audio.paused,
|
||||
enabled: () => audio.currentTime > 0 && audio.paused,
|
||||
},
|
||||
$MenuBar.DIVIDER,
|
||||
{
|
||||
item: "E&xit",
|
||||
action: ()=> {
|
||||
|
||||
action: () => {
|
||||
|
||||
},
|
||||
enabled: false,
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ var menus = {
|
|||
"&Help": [
|
||||
{
|
||||
item: "&About...",
|
||||
action: ()=> {
|
||||
action: () => {
|
||||
var $about_window = $Window({ title: "About WinAMP" });
|
||||
$about_window.$content.html(`
|
||||
WinAMP v0.2a<br>
|
||||
|
|
@ -83,9 +83,7 @@ var menus = {
|
|||
This program is freeware -- for more information,<br>
|
||||
please read the included README.TXT
|
||||
`);
|
||||
$about_window.$Button("OK", function(){
|
||||
|
||||
});
|
||||
$about_window.$Button("OK", () => { });
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
@ -94,7 +92,7 @@ var $menubar = new $MenuBar(menus);
|
|||
|
||||
TITLEBAR_ICON_SIZE = 16;
|
||||
|
||||
function $Icon(path, size){
|
||||
function $Icon(path, size) {
|
||||
var $img = $("<img class='icon'/>");
|
||||
$img.attr({
|
||||
draggable: false,
|
||||
|
|
@ -105,11 +103,11 @@ function $Icon(path, size){
|
|||
return $img;
|
||||
}
|
||||
|
||||
var $window = new $Window({title: base_title, icon: "winamp-0.2.png"});
|
||||
var $window = new $Window({ title: base_title, icon: "winamp-0.2.png" });
|
||||
$window.$content.append($menubar);
|
||||
$window.width(220);
|
||||
|
||||
$window.on("close", (event)=> {
|
||||
$window.on("close", (event) => {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue