meshviewer/lib/title.js

37 lines
730 B
JavaScript
Raw Permalink Normal View History

2015-04-05 21:44:43 +00:00
define(function () {
'use strict';
2016-05-27 21:59:01 +00:00
return function (config) {
2015-04-05 21:44:43 +00:00
function setTitle(d) {
var title = [config.siteName];
2015-04-05 21:44:43 +00:00
if (d !== undefined) {
2017-04-25 22:43:53 +00:00
title.unshift(d);
}
2015-04-05 21:44:43 +00:00
2017-04-25 22:43:53 +00:00
document.title = title.join(' - ');
2015-04-05 21:44:43 +00:00
}
this.resetView = function resetView() {
setTitle();
};
2015-04-05 21:44:43 +00:00
this.gotoNode = function gotoNode(d) {
2017-03-05 11:29:21 +00:00
setTitle(d.nodeinfo.hostname);
};
2015-04-05 21:44:43 +00:00
this.gotoLink = function gotoLink(d) {
2017-04-25 22:43:53 +00:00
setTitle((d.source.node ? d.source.node.nodeinfo.hostname : d.source.id) + ' \u21D4 ' + d.target.node.nodeinfo.hostname);
};
2015-04-05 21:44:43 +00:00
this.gotoLocation = function gotoLocation() {
// ignore
};
this.destroy = function destroy() {
};
2015-04-05 21:44:43 +00:00
return this;
};
});