From b35e705066789d8bb65b37d012b811f2b703f2f4 Mon Sep 17 00:00:00 2001 From: Andrew Carr Date: Sun, 23 May 2021 03:15:19 +0000 Subject: [PATCH] Configured and ran Prettier on client files --- .prettierignore | 13 + .prettierrc.json | 20 + .travis.yml | 17 +- DEVELOPMENT.md | 13 + README.md | 40 +- htdocs/css/mpd.css | 50 +- htdocs/index.html | 873 ++++++++++++++++++---------- htdocs/js/mpd.js | 1387 +++++++++++++++++++++++++++----------------- htdocs/player.html | 270 +++++---- 9 files changed, 1673 insertions(+), 1010 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 DEVELOPMENT.md diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..435a6f0 --- /dev/null +++ b/.prettierignore @@ -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* diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..f27022b --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,20 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "overrides": [ + { + "files": ["*.html"], + "options": { + "tabWidth": 2 + } + }, + { + "files": ["*.css"], + "options": { + "tabWidth": 2 + } + } + ] +} diff --git a/.travis.yml b/.travis.yml index 4b2afb9..b4d35ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,16 +3,15 @@ language: c sudo: required dist: trusty -compiler: - - gcc - - clang +compiler: + - gcc + - clang before_install: - - sudo apt-get -qq update - - sudo apt-get install -y libmpdclient-dev cmake - - mkdir build - - cd build - - cmake -D CMAKE_BUILD_TYPE=DEBUG .. + - sudo apt-get -qq update + - sudo apt-get install -y libmpdclient-dev cmake + - mkdir build + - cd build + - cmake -D CMAKE_BUILD_TYPE=DEBUG .. script: make - diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..3dce54e --- /dev/null +++ b/DEVELOPMENT.md @@ -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`. diff --git a/README.md b/README.md index 1d7fb81..4f9a3c3 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,26 @@ ympd Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS - http://www.ympd.org ![ScreenShot](http://www.ympd.org/assets/ympd_github.png) -Dependencies ------------- - - libmpdclient 2: http://www.musicpd.org/libs/libmpdclient/ - - cmake 2.6: http://cmake.org/ - - OpenSSL: https://www.openssl.org/ +## Dependencies -Unix Build Instructions ------------------------ +- libmpdclient 2: http://www.musicpd.org/libs/libmpdclient/ +- cmake 2.6: http://cmake.org/ +- OpenSSL: https://www.openssl.org/ + +## Unix Build Instructions 1. install dependencies. cmake, libmpdclient (dev), and OpenSSL (dev) are available from all major distributions. -2. create build directory ```cd /path/to/src; mkdir build; cd build``` -3. create makefile ```cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr``` -4. build ```make``` -5. install ```sudo make install``` or just run with ```./ympd``` +2. create build directory `cd /path/to/src; mkdir build; cd build` +3. create makefile `cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr` +4. build `make` +5. install `sudo make install` or just run with `./ympd` + +## Run flags -Run flags ---------- ``` Usage: ./ympd [OPTION]... @@ -39,21 +37,23 @@ Usage: ./ympd [OPTION]... --help this help ``` -SSL Support ------------ +## SSL Support + To run ympd with SSL support: -- create a certificate (key and cert in the same file), example: +- create a certificate (key and cert in the same file), example: + ``` # openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1000 -nodes # cat key.pem cert.pem > ssl.pem ``` -- tell ympd to use a webport using SSL and where to find the certificate: + +- tell ympd to use a webport using SSL and where to find the certificate: + ``` # ./ympd -w "ssl://8081:/path/to/ssl.pem" ``` -Copyright ---------- +## Copyright 2013-2014 diff --git a/htdocs/css/mpd.css b/htdocs/css/mpd.css index a5c6acc..c1e9d46 100644 --- a/htdocs/css/mpd.css +++ b/htdocs/css/mpd.css @@ -15,12 +15,10 @@ body { margin-bottom: 0; } - button { overflow: hidden; } - #volume-icon { float: left; margin-right: 10px; @@ -34,7 +32,7 @@ button { white-space: nowrap; } -#breadcrump > li > a{ +#breadcrump > li > a { cursor: pointer; } @@ -58,17 +56,17 @@ button { background-image: none; outline: 0; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); color: #428bca; background-color: #fdfdfd; border-color: #adadad; } @media (max-width: 1199px) { -#btn-responsive-block > .btn { - padding: 6px 12px; - font-size: 14px; - border-radius: 4px; + #btn-responsive-block > .btn { + padding: 6px 12px; + font-size: 14px; + border-radius: 4px; } } @@ -80,14 +78,16 @@ h1 { white-space: nowrap; } -td:nth-child(4), th:nth-child(4) { +td:nth-child(4), +th:nth-child(4) { /* This *has* to be placed before any t[dh]:nth-last-child(2) for the override to work. */ min-width: 50%; } -td:nth-last-child(2), th:nth-last-child(2) { +td:nth-last-child(2), +th:nth-last-child(2) { text-align: right; width: 4em; } @@ -98,7 +98,8 @@ td:nth-last-child(2), th:nth-last-child(2) { display: block; } -td:nth-child(2), td:nth-child(3) { +td:nth-child(2), +td:nth-child(3) { min-width: 25%; max-width: 10em; @@ -108,21 +109,24 @@ td:nth-child(2), td:nth-child(3) { } @media only screen and (max-width: 600px) { - td:nth-child(2), td:nth-child(3) { - min-width: 0; - max-width: 0; - } - td:nth-child(4), th:nth-child(4) { - min-width: 10%; - white-space: normal; - } + td:nth-child(2), + td:nth-child(3) { + min-width: 0; + max-width: 0; + } + td:nth-child(4), + th:nth-child(4) { + min-width: 10%; + white-space: normal; + } } tbody { cursor: pointer; } -td:last-child, td:first-child { +td:last-child, +td:first-child { width: 30px; } @@ -149,9 +153,9 @@ button { } #trashmode span:last-child { - display:inline-block; - text-align:left; - width:2.8em; + display: inline-block; + text-align: left; + width: 2.8em; } #filter > a.active { diff --git a/htdocs/index.html b/htdocs/index.html index 1cf62cf..e8e7e04 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -1,65 +1,110 @@ - - - - - - + + + + + + - ympd + ympd - - - + + + - - - - - - + + + + + + +