Merge pull request #249 from jcass77/fix/243_html_title_tag

Include details of currently selected page in HTML title tag.
This commit is contained in:
Nick Steel 2017-10-07 17:32:05 +01:00 committed by GitHub
commit 688c994de5
4 changed files with 15 additions and 7 deletions

View File

@ -112,6 +112,7 @@ Changelog
- Detect additional stream formats (rtmp, rtmps, rtsp).
- Prevent excessive calls to the Mopidy server while buffering. (Fixes: `#237 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/237>`_).
- Include details of currently selected page in HTML title tag. (Addresses: `#243 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/243>`_).
v2.4.0 (2017-03-15)
-------------------

View File

@ -36,7 +36,7 @@
</head>
<body data-websocket-url="{{ websocketUrl }}" data-is-musicbox="{{ isMusicBox }}" data-has-alarmclock="{{ hasAlarmClock }}" data-on-track-click="{{ onTrackClick }}" data-program-name="{{ programName }}" data-hostname="{{ hostname }}">
<body data-websocket-url="{{ websocketUrl }}" data-is-musicbox="{{ isMusicBox }}" data-has-alarmclock="{{ hasAlarmClock }}" data-on-track-click="{{ onTrackClick }}" data-program-name="{{ programName }}" data-hostname="{{ hostname }}" data-title="{{ title }}">
<div data-role="page" id="page" class="ui-responsive-panel" data-theme="c" data-title="{{ title }}">
<div data-role="panel" id="panel" data-position="left" data-theme="a" data-display="reveal" data-position-fixed="true">

View File

@ -338,11 +338,12 @@ function switchContent (divid, uri) {
function setHeadline (site) {
site = site.trim()
str = $('.mainNav').find('a[href$=' + site + ']').text()
if (str === '') {
str = site.charAt(0).toUpperCase() + site.slice(1)
headline = $('.mainNav').find('a[href$=' + site + ']').text()
if (headline === '') {
headline = site.charAt(0).toUpperCase() + site.slice(1)
}
$('#contentHeadline').html('<a href="#home" onclick="switchContent(\'home\'); return false;">' + str + '</a>')
$('#contentHeadline').html('<a href="#home" onclick="switchContent(\'home\'); return false;">' + headline + '</a>')
return headline
}
// update tracklist options.
@ -371,7 +372,8 @@ function locationHashChanged () {
var divid = hash[0].substr(1)
var uri = hash[1]
setHeadline(divid)
headline = setHeadline(divid)
updateDocumentTitle(headline)
if ($(window).width() < 880) {
$('#panel').panel('close')
@ -621,3 +623,8 @@ function updatePlayIcons (uri, tlid, popupMenuIcon) {
})
}
}
function updateDocumentTitle (headline) {
headline = headline || $('#contentHeadline').text()
document.title = headline + ' | ' + $(document.body).data('title')
}

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# 2017-04-14:v1
# 2017-10-07:v1
NETWORK:
*