Allow tips to be hidden and cycled through

This commit is contained in:
Nick O'Leary
2017-04-07 12:24:39 +01:00
parent 67da853146
commit ede940a398
2 changed files with 34 additions and 2 deletions

View File

@@ -63,6 +63,20 @@ RED.sidebar.info = (function() {
tipContainer = $('<div class="node-info-tips"></div>').appendTo(content);
tipBox = $('<div class="node-info-tip"></div>').appendTo(tipContainer);
var tipButtons = $('<div class="node-info-tips-buttons"></div>').appendTo(tipContainer);
var tipRefresh = $('<a href="#" class="workspace-footer-button"><i class="fa fa-refresh"></a>').appendTo(tipButtons);
tipRefresh.click(function(e) {
e.preventDefault();
tips.next();
})
var tipClose = $('<a href="#" class="workspace-footer-button"><i class="fa fa-times"></a>').appendTo(tipButtons);
tipClose.click(function(e) {
e.preventDefault();
RED.actions.invoke("core:toggle-show-tips");
RED.notify("You can re-open the tips from the side menu");
});
RED.sidebar.addTab({
id: "info",
@@ -272,9 +286,15 @@ RED.sidebar.info = (function() {
refreshTimeout = null;
startTimeout = null;
}
function nextTip() {
clearInterval(refreshTimeout);
startTimeout = true;
setTip();
}
return {
start: startTips,
stop: stopTips
stop: stopTips,
next: nextTip
}
})();