#49 Added base implementation to change tooltip direction
This commit is contained in:
parent
be9fdf2448
commit
fbddc2bebc
1 changed files with 15 additions and 0 deletions
|
@ -10,9 +10,24 @@ export function init() {
|
|||
core.registerScript(node => {
|
||||
// run the scripts
|
||||
if (helper.isHtmlElement(node)) {
|
||||
if (node.tagName === TOOLTIP_TAG_NAME) {
|
||||
changeTooltipDirection(node);
|
||||
}
|
||||
else {
|
||||
node.querySelectorAll(TOOLTIP_TAG_NAME).forEach(tooltip => changeTooltipDirection(tooltip));
|
||||
}
|
||||
}
|
||||
}, "^/profile/[0-9]*\?tab=6$");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changeTooltipDirection(tooltip) {
|
||||
const DIRECTION_ATTRIBUTE = 'md-direction';
|
||||
|
||||
let directionStr = tooltip.getAttribute(DIRECTION_ATTRIBUTE);
|
||||
|
||||
if (directionStr === 'top') {
|
||||
tooltip.setAttribute(DIRECTION_ATTRIBUTE, 'right');
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue