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). - 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>`_). - 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) v2.4.0 (2017-03-15)
------------------- -------------------

View File

@ -36,7 +36,7 @@
</head> </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="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"> <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) { function setHeadline (site) {
site = site.trim() site = site.trim()
str = $('.mainNav').find('a[href$=' + site + ']').text() headline = $('.mainNav').find('a[href$=' + site + ']').text()
if (str === '') { if (headline === '') {
str = site.charAt(0).toUpperCase() + site.slice(1) 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. // update tracklist options.
@ -371,7 +372,8 @@ function locationHashChanged () {
var divid = hash[0].substr(1) var divid = hash[0].substr(1)
var uri = hash[1] var uri = hash[1]
setHeadline(divid) headline = setHeadline(divid)
updateDocumentTitle(headline)
if ($(window).width() < 880) { if ($(window).width() < 880) {
$('#panel').panel('close') $('#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 CACHE MANIFEST
# 2017-04-14:v1 # 2017-10-07:v1
NETWORK: NETWORK:
* *