meshviewer/lib/title.js
Xaver Maierhofer 5600832305
[TASK] Move to es5 eslint airbnb
Step forward to es6 airbnb
2017-01-30 00:51:12 +01:00

41 lines
773 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define(function () {
'use strict';
return function (config) {
function setTitle(d) {
var title = [config.siteName];
if (d !== undefined) {
title.push(d);
}
document.title = title.join(': ');
}
this.resetView = function resetView() {
setTitle();
};
this.gotoNode = function gotoNode(d) {
if (d) {
setTitle(d.nodeinfo.hostname);
}
};
this.gotoLink = function gotoLink(d) {
if (d) {
setTitle((d.source.node ? d.source.node.nodeinfo.hostname : d.source.id) + ' ' + d.target.node.nodeinfo.hostname);
}
};
this.gotoLocation = function gotoLocation() {
// ignore
};
this.destroy = function destroy() {
};
return this;
};
});