diff --git a/public/internal/footer.php b/public/internal/footer.php index bad543db73205d028ffedb88ab414b9025a80e60..fcb17377a5fec7330c98e5f91bba780c671fc340 100644 --- a/public/internal/footer.php +++ b/public/internal/footer.php @@ -55,6 +55,8 @@ function getFooter(){ </script> <script src="/js/includeHTML.js"></script> <script src="/js/burgerMenu.js"></script> + <script src="/js/dialog.js"></script> + <script src="/js/imgPreview.js"></script> </body> </html> EOF); diff --git a/scss/_dialog.scss b/scss/_dialog.scss new file mode 100644 index 0000000000000000000000000000000000000000..1e49c54f800401d3447abdfcc881abf9a6d167d8 --- /dev/null +++ b/scss/_dialog.scss @@ -0,0 +1,33 @@ +.dialog { + opacity: 0; + height: 100%; + width: 100%; + position: fixed; + top: 0; + left: 0; + + display: flex; + justify-content: center; + align-items: center; + + background-color: rgba(0, 0, 0, 0.5); + + .dialogContent { + height: 80%; + width: 80%; + background-color: white; + border: 10px solid rgb(86, 86, 86); + border-radius: 10px; + + iframe { + width: 100%; + height: 100%; + border: none; + } + } + + .imageDialog{ + height: auto; + width: auto; + } +} diff --git a/scss/_menue.scss b/scss/_menue.scss index 1532a9bcf1886b57cd8fe433effcfc22e23c6fff..e105e79265a2d05168d467efd004b60f3da3d475 100644 --- a/scss/_menue.scss +++ b/scss/_menue.scss @@ -35,14 +35,14 @@ color: $text-color; &:first-of-type{ - border-top-left-radius: 10px; - border-top-right-radius: 10px; + border-top-left-radius: $border-radius-sub-nav; + border-top-right-radius: $border-radius-sub-nav; } &:last-of-type { border-bottom: none; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; + border-bottom-left-radius: $border-radius-sub-nav; + border-bottom-right-radius: $border-radius-sub-nav; } &:hover{ diff --git a/scss/_var.scss b/scss/_var.scss index bdcbe3f29d49f45b463ae324cce5c16b41484baa..86d3e7793bd002d8a82a955ab7f7697a7e0accb8 100644 --- a/scss/_var.scss +++ b/scss/_var.scss @@ -7,5 +7,7 @@ $content-footer-div-color: #03A8F4; $darker-color: 5%; $darker-color-2: 2%; +$border-radius-sub-nav: 10px; + $mobile-max-width: 600px; $small-mobile-max-width: 300px; \ No newline at end of file diff --git a/scss/style.scss b/scss/style.scss index 590b5e2cbd86c0544c101f761a159839589aae7c..dc143e838036509278ba53588315676fd35986e4 100644 --- a/scss/style.scss +++ b/scss/style.scss @@ -13,4 +13,5 @@ @import "content"; @import "mobile"; @import "menuMobile"; -@import "mobileSmall"; \ No newline at end of file +@import "mobileSmall"; +@import "dialog"; \ No newline at end of file diff --git a/ts/dialog.ts b/ts/dialog.ts new file mode 100644 index 0000000000000000000000000000000000000000..d101421b22147758fed3ecf8339a17b735e4efa2 --- /dev/null +++ b/ts/dialog.ts @@ -0,0 +1,38 @@ +function createDialogIframe(url:string) { + createDialogHTML(`<iframe src="${url}">`); +} + +function createDialogImage(url:string) { + createDialogHTML(`<img src="${url}">`, "imageDialog"); +} + +function createDialogHTML(html:string, customClasses = "") { + var dialog = document.createElement("div"); + dialog.classList.add("dialog"); + dialog.onclick = function () { + fade(dialog, -0.04, true); + } + + dialog.innerHTML = ` + <div class="dialogContent ${customClasses}">${html}</div>`; + + document.body.appendChild(dialog); + fade(dialog, 0.04); +} + +function fade(element:HTMLElement, value = 0.1, deleteAfterwards = false) { + let opacity:number = +(element.style.opacity) + value; + + element.style.opacity = String(opacity); + + if ((opacity < 1 && value > 0) || (opacity >= 0 && value < 0)) { + setTimeout(function () { + fade(element, value, deleteAfterwards); + }, 10); + } else if (deleteAfterwards) { + setTimeout(function () { + // @ts-ignore + element.parentNode.removeChild(element); + }, 10); + } +} \ No newline at end of file diff --git a/ts/imgPreview.ts b/ts/imgPreview.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b9f614580a192feef156c7ed45d6e133d6d8f26 --- /dev/null +++ b/ts/imgPreview.ts @@ -0,0 +1,7 @@ +let images:HTMLCollectionOf<HTMLImageElement> = <HTMLCollectionOf<HTMLImageElement>> document.getElementsByTagName("img"); +for(let i = 0; i < images.length; i++){ + let element:HTMLImageElement = images[i]; + if(element.getAttribute("data-noPreview") === "true") { + element.onclick = () => createDialogImage(element.src); + } +} \ No newline at end of file