meshviewer/lib/title.js

39 lines
711 B
JavaScript
Raw Normal View History

2015-04-05 21:44:43 +00:00
define(function () {
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) {
title.push(d);
}
2015-04-05 21:44:43 +00:00
document.title = title.join(": ");
2015-04-05 21:44:43 +00:00
}
this.resetView = function () {
setTitle();
};
2015-04-05 21:44:43 +00:00
this.gotoNode = function (d) {
if (d) {
setTitle(d.nodeinfo.hostname);
}
};
2015-04-05 21:44:43 +00:00
this.gotoLink = function (d) {
if (d) {
setTitle((d.source.node ? d.source.node.nodeinfo.hostname : d.source.id) + " " + d.target.node.nodeinfo.hostname);
}
};
2015-04-05 21:44:43 +00:00
this.gotoLocation = function () {
//ignore
};
2015-04-05 21:44:43 +00:00
this.destroy = function () {
};
2015-04-05 21:44:43 +00:00
return this;
};
});