1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-27 19:30:27 +00:00

Removed onclick markup

This commit is contained in:
jcorporation 2018-06-29 00:44:52 +01:00
parent e6fef5a174
commit a239edcff2
2 changed files with 93 additions and 60 deletions

View File

@ -26,24 +26,24 @@
</form> </form>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a id="nav-addstream" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#addstream">Add Stream</a> <a id="nav-addstream" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#addstream">Add Stream</a>
<a id="nav-updatedb" class="dropdown-item text-light bg-dark" href="#" onclick="updateDB(event);">Update Database</a> <a id="nav-updatedb" class="dropdown-item text-light bg-dark" href="#">Update Database</a>
<a id="nav-localplayer" class="dropdown-item text-light bg-dark" href="#" data-toggle="dropdown" onclick="window.open('/player.html#'+settings.mpdstream,'LocalPlayer');">Local Player</a> <a id="nav-localplayer" class="dropdown-item text-light bg-dark" href="#" data-toggle="dropdown">Local Player</a>
<a id="nav-settings" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#settings">Settings</a> <a id="nav-settings" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#settings">Settings</a>
<a id="nav-about" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#about">About</a> <a id="nav-about" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#about">About</a>
</div> </div>
</div> </div>
<div class="btn-toolbar col-auto pl-0 pr-0" role="toolbar"> <div class="btn-toolbar col-auto pl-0 pr-0" role="toolbar">
<div class="btn-group mr-2" role="group"> <div class="btn-group mr-2" role="group" id="playControlBtns">
<button id="btnPrev" type="button" class="btn btn-secondary pl-2 pr-2 material-icons" onclick="clickPrev();;"> <button id="btnPrev" type="button" class="btn btn-secondary pl-2 pr-2 material-icons">
skip_previous skip_previous
</button> </button>
<button id="btnStop" type="button" class="btn btn-secondary pl-2 pr-2 material-icons" onclick="clickStop();"> <button id="btnStop" type="button" class="btn btn-secondary pl-2 pr-2 material-icons">
stop stop
</button> </button>
<button id="btnPlay" type="button" class="btn btn-secondary pl-2 pr-2 material-icons" onclick="clickPlay();"> <button id="btnPlay" type="button" class="btn btn-secondary pl-2 pr-2 material-icons">
pause pause
</button> </button>
<button id="btnNext" type="button" class="btn btn-secondary pl-2 pr-2 material-icons" onclick="clickNext();"> <button id="btnNext" type="button" class="btn btn-secondary pl-2 pr-2 material-icons">
skip_next skip_next
</button> </button>
</div> </div>
@ -55,11 +55,11 @@
<h2 class="dropdown-header text-light">Volume: <span id="volumePrct"></span></h2> <h2 class="dropdown-header text-light">Volume: <span id="volumePrct"></span></h2>
<form class="px-4 py-0 pb-3" id="volumeControl"> <form class="px-4 py-0 pb-3" id="volumeControl">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<input type="button" class="btn btn-secondary" value="&minus;" onclick="chVolume(-5)"/> <input id="chVolumeMinus" type="button" class="btn btn-secondary" value="&minus;"/>
<div class="btn btn-secondary"> <div class="btn btn-secondary">
<input type="range" min="0" max="100" step="1" class="form-control-range" id="volumeBar"> <input type="range" min="0" max="100" step="1" class="form-control-range" id="volumeBar">
</div> </div>
<input type="button" class="btn btn-secondary" value="+" onclick="chVolume(5)"/> <input id="chVolumePlus" type="button" class="btn btn-secondary" value="+"/>
</div> </div>
</form> </form>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -91,7 +91,6 @@
</div> </div>
</div> </div>
<div class="card hide" id="cardQueue"> <div class="card hide" id="cardQueue">
<div class="card-header"> <div class="card-header">
<a href="#" data-toggle="collapse" data-target="#queue-buttons" class="text-dark">Queue</a> <a href="#" data-toggle="collapse" data-target="#queue-buttons" class="text-dark">Queue</a>

View File

@ -363,62 +363,96 @@ $(document).ready(function(){
sendAPI({"cmd": "MPD_API_ADD_TRACK", "data": { "uri": app.current.search}}); sendAPI({"cmd": "MPD_API_ADD_TRACK", "data": { "uri": app.current.search}});
},false); },false);
$('#cardBrowseNavFilesystem').on('click', function (e) { document.getElementById('nav-updatedb').addEventListener('click', function(event) {
app.goto('Browse','Filesystem'); updateDB(event);
e.preventDefault(); },false);
});
$('#cardBrowseNavDatabase').on('click', function (e) { document.getElementById('nav-localplayer').addEventListener('click', function(event) {
window.open('/player.html#' + settings.mpdstream, 'LocalPlayer');
},false);
document.getElementById('playControlBtns').addEventListener('click', function(event) {
if (event.target.nodeName == 'BUTTON') {
switch (event.target.getAttribute('id')) {
case 'btnPrev':
clickPrev();
break;
case 'btnStop':
clickStop();
break;
case 'btnPlay':
clickPlay();
break;
case 'btnNext':
clickNext();
break;
}
}
}, false);
document.getElementById('chVolumeMinus').addEventListener('click', function(event) {
chVolume(-5)
},false);
document.getElementById('chVolumePlus').addEventListener('click', function(event) {
chVolume(5)
},false);
document.getElementById('panel-heading-browse').addEventListener('click', function(event) {
if (event.target.nodeName == 'A') {
event.preventDefault();
switch (event.target.getAttribute('id')) {
case 'cardBrowseNavDatabase':
app.goto('Browse','Database'); app.goto('Browse','Database');
e.preventDefault(); break;
}); case 'cardBrowseNavPlaylists':
$('#btnBrowseDatabaseArtist').on('click', function (e) {
app.goto('Browse','Database','Artist');
e.preventDefault();
});
$('#cardBrowseNavPlaylists').on('click', function (e) {
app.goto('Browse','Playlists'); app.goto('Browse','Playlists');
e.preventDefault(); break;
}); case 'cardBrowseNavFilesystem':
$('#cardBrowseNavFilesystem').on('click', function (e) {
app.goto('Browse','Filesystem'); app.goto('Browse','Filesystem');
e.preventDefault(); break;
}); }
}
}, false);
$('#navPlayback').on('click', function (e) { document.getElementById('btnBrowseDatabaseArtist').addEventListener('click', function (event) {
app.goto('Browse','Database','Artist');
event.preventDefault();
}, false);
document.getElementById('navbar-bottom').addEventListener('click', function(event) {
if (event.target.nodeName == 'A') {
event.preventDefault();
switch (event.target.parentNode.getAttribute('id')) {
case 'navPlayback':
app.goto('Playback'); app.goto('Playback');
e.preventDefault(); break;
}); case 'navQueue':
$('#navQueue').on('click', function (e) {
app.goto('Queue'); app.goto('Queue');
e.preventDefault(); break;
}); case 'navBrowse':
$('#navBrowse').on('click', function (e) {
app.goto('Browse'); app.goto('Browse');
e.preventDefault(); break;
}); case 'navSearch':
$('#navSearch').on('click', function (e) {
app.goto('Search'); app.goto('Search');
e.preventDefault(); break;
}); }
}
}, false);
$('#searchtags2 > button').on('click',function (e) { document.getElementById('searchtags2').addEventListener('click', function(event) {
app.goto(app.current.app, app.current.tab, app.current.view, '0/' + this.innerText + '/' + app.current.search); if (event.target.nodeName == 'BUTTON')
}); app.goto(app.current.app, app.current.tab, app.current.view, '0/' + event.target.innerText + '/' + app.current.search);
}, false);
$('#searchqueuestr').keyup(function (event) { document.getElementById('searchqueuestr').addEventListener('keyup', function(event) {
app.goto(app.current.app, app.current.tab, app.current.view, '0/' + app.current.filter + '/' + this.value); app.goto(app.current.app, app.current.tab, app.current.view, '0/' + app.current.filter + '/' + this.value);
}); }, false);
$('#searchqueuetag > button').on('click',function (e) { document.getElementById('searchqueuetag').addEventListener('click', function (event) {
app.goto(app.current.app, app.current.tab, app.current.view, app.current.page + '/' + this.innerText + '/' + app.current.search); if (event.target.nodeName == 'BUTTON')
}); app.goto(app.current.app, app.current.tab, app.current.view, app.current.page + '/' + event.target.innerText + '/' + app.current.search);
}, false);
document.getElementById('inputSearch').addEventListener('keypress', function (event) { document.getElementById('inputSearch').addEventListener('keypress', function (event) {
if ( event.which == 13 ) if ( event.which == 13 )
@ -439,7 +473,7 @@ $(document).ready(function(){
}, false); }, false);
document.getElementById('searchstr2').addEventListener('keyup', function (event) { document.getElementById('searchstr2').addEventListener('keyup', function (event) {
app.goto('Search', undefined, undefined, app.current.page + '0/' + app.current.filter + '/' + this.value); app.goto('Search', undefined, undefined, '0/' + app.current.filter + '/' + this.value);
}, false); }, false);
window.addEventListener('hashchange', app.route, false); window.addEventListener('hashchange', app.route, false);