| 1456 |
ariadna |
1 |
(function(){
|
|
|
2 |
window.addEventListener('load', () => {
|
|
|
3 |
const el = document.querySelector('.phpdocumentor-on-this-page__content')
|
|
|
4 |
if (!el) {
|
|
|
5 |
return;
|
|
|
6 |
}
|
|
|
7 |
|
|
|
8 |
const observer = new IntersectionObserver(
|
|
|
9 |
([e]) => {
|
|
|
10 |
e.target.classList.toggle("-stuck", e.intersectionRatio < 1);
|
|
|
11 |
},
|
|
|
12 |
{threshold: [1]}
|
|
|
13 |
);
|
|
|
14 |
|
|
|
15 |
observer.observe(el);
|
|
|
16 |
})
|
|
|
17 |
})();
|
|
|
18 |
function openSvg(svg) {
|
|
|
19 |
// convert to a valid XML source
|
|
|
20 |
const as_text = new XMLSerializer().serializeToString(svg);
|
|
|
21 |
// store in a Blob
|
|
|
22 |
const blob = new Blob([as_text], { type: "image/svg+xml" });
|
|
|
23 |
// create an URI pointing to that blob
|
|
|
24 |
const url = URL.createObjectURL(blob);
|
|
|
25 |
const win = open(url);
|
|
|
26 |
// so the Garbage Collector can collect the blob
|
|
|
27 |
win.onload = (evt) => URL.revokeObjectURL(url);
|
|
|
28 |
};
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
var svgs = document.querySelectorAll(".phpdocumentor-uml-diagram svg");
|
|
|
32 |
for( var i=0,il = svgs.length; i< il; i ++ ) {
|
|
|
33 |
svgs[i].onclick = (evt) => openSvg(evt.target);
|
|
|
34 |
}
|