mirror of https://github.com/SuperBFG7/ympd
Configured and ran Prettier on client files
parent
9d1a3ccfb2
commit
b35e705066
@ -0,0 +1,13 @@
|
||||
# Used by Prettier to ignore certain files and folders completely.
|
||||
# See https://prettier.io/docs/en/ignore.html for details.
|
||||
|
||||
# Ignore build and system artifacts
|
||||
build/
|
||||
cmake/
|
||||
contrib/
|
||||
|
||||
# Ignore all 3rd party libraries
|
||||
**/bootstrap*
|
||||
**/jquery*
|
||||
**/modernizr*
|
||||
**/sammy*
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 4,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.html"],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["*.css"],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
# Development Notes
|
||||
|
||||
## Code Formatting
|
||||
|
||||
The project has been formatted with [prettier.io](https://prettier.io/) for the HTML, JavaScript, CSS, and Markdown files. See the configuration file [.prettierrc.json](./.prettierrc.json) and the ignore file [.prettierignore](./.prettierignore) for details. If `prettier` is installed globally, there's no need to provide the various `npm`-type dependencies in the project. Various editors may provide plugins that can use this configuration without having to install `npm` and `prettier` manually.
|
||||
|
||||
Manual Usage:
|
||||
|
||||
```bash
|
||||
> npx prettier --write .
|
||||
```
|
||||
|
||||
The C source and header files have been formatted with `clang-format`.
|
File diff suppressed because it is too large
Load Diff
@ -1,126 +1,168 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0">-->
|
||||
<meta name="viewport" content="width=320">
|
||||
<meta name="description" content="ympd - fast and lightweight MPD webclient">
|
||||
<meta name="author" content="andy@ndyk.de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0">-->
|
||||
<meta name="viewport" content="width=320" />
|
||||
<meta
|
||||
name="description"
|
||||
content="ympd - fast and lightweight MPD webclient"
|
||||
/>
|
||||
<meta name="author" content="andy@ndyk.de" />
|
||||
|
||||
<title>ympd player</title>
|
||||
<title>ympd player</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap.css" rel="stylesheet">
|
||||
<link href="css/bootstrap-theme.css" rel="stylesheet">
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap.css" rel="stylesheet" />
|
||||
<link href="css/bootstrap-theme.css" rel="stylesheet" />
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/mpd.css" rel="stylesheet">
|
||||
<link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
|
||||
<script src="js/jquery-1.10.2.min.js"></script>
|
||||
<script src="js/jquery.cookie.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/bootstrap-notify.js"></script>
|
||||
<script type="text/javascript">
|
||||
function clickLocalPlay() {
|
||||
var player = document.getElementById('player');
|
||||
$("#localplay-icon").removeClass("glyphicon-play").removeClass("glyphicon-pause");
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/mpd.css" rel="stylesheet" />
|
||||
<link
|
||||
href="assets/favicon.ico"
|
||||
rel="shortcut icon"
|
||||
type="image/vnd.microsoft.icon"
|
||||
/>
|
||||
<script src="js/jquery-1.10.2.min.js"></script>
|
||||
<script src="js/jquery.cookie.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/bootstrap-notify.js"></script>
|
||||
<script type="text/javascript">
|
||||
function clickLocalPlay() {
|
||||
var player = document.getElementById('player');
|
||||
$('#localplay-icon')
|
||||
.removeClass('glyphicon-play')
|
||||
.removeClass('glyphicon-pause');
|
||||
|
||||
if (player.paused) {
|
||||
var mpdstream = $.cookie('mpdstream');
|
||||
player.src = mpdstream;
|
||||
console.log('playing mpd stream: ' + player.src);
|
||||
player.load();
|
||||
player.play();
|
||||
$('#localplay-icon').addClass('glyphicon-pause');
|
||||
} else {
|
||||
player.pause();
|
||||
player.src = '';
|
||||
player.removeAttribute('src');
|
||||
$('#localplay-icon').addClass('glyphicon-play');
|
||||
}
|
||||
}
|
||||
|
||||
if ( player.paused ) {
|
||||
var mpdstream = $.cookie("mpdstream");
|
||||
player.src = mpdstream;
|
||||
console.log("playing mpd stream: " + player.src);
|
||||
player.load();
|
||||
player.play();
|
||||
$("#localplay-icon").addClass("glyphicon-pause");
|
||||
} else {
|
||||
player.pause();
|
||||
player.src='';
|
||||
player.removeAttribute("src");
|
||||
$("#localplay-icon").addClass("glyphicon-play");
|
||||
}
|
||||
}
|
||||
$(document).ready(function () {
|
||||
document
|
||||
.getElementById('player')
|
||||
.addEventListener('stalled', function () {
|
||||
if (!document.getElementById('player').paused) {
|
||||
this.pause();
|
||||
clickLocalPlay();
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: {
|
||||
text: 'music stream stalled - trying to recover...',
|
||||
},
|
||||
type: 'danger',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
document.getElementById('player').addEventListener('stalled', function() {
|
||||
if ( !document.getElementById('player').paused ) {
|
||||
this.pause();
|
||||
clickLocalPlay();
|
||||
$('.top-right').notify({
|
||||
message:{text:"music stream stalled - trying to recover..."},
|
||||
type: "danger",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
document
|
||||
.getElementById('player')
|
||||
.addEventListener('pause', function () {
|
||||
this.src = '';
|
||||
this.removeAttribute('src');
|
||||
$('#localplay-icon')
|
||||
.removeClass('glyphicon-pause')
|
||||
.addClass('glyphicon-play');
|
||||
});
|
||||
|
||||
document.getElementById('player').addEventListener('pause', function() {
|
||||
this.src='';
|
||||
this.removeAttribute("src");
|
||||
$("#localplay-icon").removeClass("glyphicon-pause").addClass("glyphicon-play");
|
||||
});
|
||||
|
||||
document.getElementById('player').addEventListener('error', function failed(e) {
|
||||
this.pause();
|
||||
switch (e.target.error.code) {
|
||||
case e.target.error.MEDIA_ERR_ABORTED:
|
||||
$('.top-right').notify({
|
||||
message:{text:"Audio playback aborted by user."},
|
||||
type: "info",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_NETWORK:
|
||||
$('.top-right').notify({
|
||||
message:{text:"Network error while playing audio."},
|
||||
type: "danger",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_DECODE:
|
||||
$('.top-right').notify({
|
||||
message:{text:"Audio playback aborted. Did you unplug your headphones?"},
|
||||
type: "danger",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
|
||||
$('.top-right').notify({
|
||||
message:{text:"Error while loading audio (server, network or format error)."},
|
||||
type: "danger",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
break;
|
||||
default:
|
||||
$('.top-right').notify({
|
||||
message:{text:"Unknown error while playing audio."},
|
||||
type: "danger",
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
}).show();
|
||||
break;
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/" target="_blank"><span class="glyphicon glyphicon-play-circle"></span> ympd</a>
|
||||
document.getElementById('player').addEventListener(
|
||||
'error',
|
||||
function failed(e) {
|
||||
this.pause();
|
||||
switch (e.target.error.code) {
|
||||
case e.target.error.MEDIA_ERR_ABORTED:
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: { text: 'Audio playback aborted by user.' },
|
||||
type: 'info',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_NETWORK:
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: { text: 'Network error while playing audio.' },
|
||||
type: 'danger',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_DECODE:
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: {
|
||||
text: 'Audio playback aborted. Did you unplug your headphones?',
|
||||
},
|
||||
type: 'danger',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: {
|
||||
text: 'Error while loading audio (server, network or format error).',
|
||||
},
|
||||
type: 'danger',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
default:
|
||||
$('.top-right')
|
||||
.notify({
|
||||
message: { text: 'Unknown error while playing audio.' },
|
||||
type: 'danger',
|
||||
fadeOut: { enabled: true, delay: 1000 },
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/" target="_blank"
|
||||
><span class="glyphicon glyphicon-play-circle"></span> ympd</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container starter-template">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-xs-12">
|
||||
<audio id="player" preload="none"></audio>
|
||||
<button type="button" class="btn btn-default btn-lg center-block" onclick="clickLocalPlay()">
|
||||
<span id="localplay-icon" class="glyphicon glyphicon-play"></span>
|
||||
</button>
|
||||
<div class="notifications top-right"></div>
|
||||
<div class="container starter-template">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-xs-12">
|
||||
<audio id="player" preload="none"></audio>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default btn-lg center-block"
|
||||
onclick="clickLocalPlay()"
|
||||
>
|
||||
<span id="localplay-icon" class="glyphicon glyphicon-play"></span>
|
||||
</button>
|
||||
<div class="notifications top-right"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue