Skip to content

Commit

Permalink
Add initial JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Mar 15, 2022
1 parent 0ff896b commit db1928d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/resources/lib/layout/layout.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ THE SOFTWARE.
</footer>
</j:if>

<script src="${resURL}/jsbundles/tooltips.js" type="text/javascript" />

<!-- SVG sprite polyfill for IE 11.
Loaded at the end in order to not make modern browsers wait for it. This causes a flash-of-no-icons on IE 11 -->
<script src="${resURL}/scripts/svgxuse.min.js" type="text/javascript" async="true" />
Expand Down
37 changes: 37 additions & 0 deletions war/src/main/js/tooltips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import tippy from "tippy.js"

tippy("[tooltip]", {
content: element => element.getAttribute("tooltip"),
arrow: false,
theme: "tooltip",
animation: "tooltip"
})

tippy("[html-tooltip]", {
content: element => element.getAttribute("html-tooltip"),
allowHTML: true,
arrow: false,
theme: "tooltip",
animation: "tooltip"
})

function hoverNotification(text, element) {
let tooltip = tippy(element, {
interactive: true,
trigger: "hover",
followCursor: "initial",
arrow: false,
theme: "tooltip",
offset: [0, 0],
animation: "tooltip",
content: text,
onShow(instance) {
setTimeout(() => {
instance.hide()
}, 3000)
},
})
tooltip.show()
}

window.hoverNotification = hoverNotification
1 change: 1 addition & 0 deletions war/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = (env, argv) => ({
path.join(__dirname, "src/main/js/config-tabbar.js"),
path.join(__dirname, "src/main/js/config-tabbar.less"),
],
"tooltips": [path.join(__dirname, "src/main/js/tooltips.js")],
"sortable-drag-drop": [path.join(__dirname, "src/main/js/sortable-drag-drop.js")],
"section-to-tabs": [path.join(__dirname, "src/main/js/section-to-tabs.js")],
"filter-build-history": [path.join(__dirname, "src/main/js/filter-build-history.js")],
Expand Down

0 comments on commit db1928d

Please sign in to comment.