diff --git a/assets/js/list.index.js b/assets/js/list.index.js index 39c01eb..c8a28d7 100644 --- a/assets/js/list.index.js +++ b/assets/js/list.index.js @@ -3,6 +3,7 @@ import {getCookie} from "./cookiehelper.js"; import {getData, getDataObj} from "./base.js"; import {_serverUrl} from "./setting.js"; + function createLoad(data) { let html = ""; if (data.length != 0) { @@ -26,77 +27,96 @@ function createLoad(data) { let pk_id = 0; const cookie = getCookie("_idty"); let fomrhtml = ""; + let width = iFrmeWdth(); if (cookie) { const {unibaseId, tenantId, userId} = JSON.parse(cookie); - fomrhtml = `
- -
`; + + `; } - $("#list-page").after(fomrhtml); + $("#list-page").append(fomrhtml); window.window.postMessage("ld-frm-ifrme", "*"); hdrCrtnClckEvnt(number); }); } + function hdrCrtnClckEvnt(number) { $(`.frm-ifre-${number} .minimize`).on("click", function () { let id = $(this).attr("data-unid"); let isPopUpState = $(this).attr("data-ispopup"); let height = $(`.frm-ifre-${id}`).find(".frm-hdr").height(); + $(".list-page").css({filter: "unset", opacity: 1}); $(`.frm-ifre-${id} .frm-bdy`).toggleClass("d-none"); if (isPopUpState == "true") { // popup large $(this).attr("data-ispopup", "false"); + $(`.frm-ifre-${id} .maximum`).addClass("d-none"); + $(`.frm-ifre-${id}`).parent().removeClass("wrap-iframe"); + $(`.frm-ifre-${id}`).attr("data-ispop_up", "false"); $(`.frm-ifre-${id}`).css({ - width: "22%", + width: "20%", height: height, bottom: "0px", }); } else { // popup small $(this).attr("data-ispopup", "true"); + $(`.frm-ifre-${id} .maximum`).removeClass("d-none"); + $(`.frm-ifre-${id}`).attr("data-ispop_up", "true"); $(`.frm-ifre-${id}`).css({ width: "", height: "", bottom: "", }); } + resetwidth(); }); $(`.frm-ifre-${number} .maximum`).on("click", function () { let id = $(this).attr("data-unid"); $(this).addClass("d-none"); $(this).siblings(".compress").removeClass("d-none"); $(`.frm-ifre-${id}`).find(".ld-frm-src").attr("data-ispopup", "true"); - $(`.frm-ifre-${id}`).css({width: "75%", height: "", bottom: "auto"}); + $(`.frm-ifre-${id}`).parent().addClass("wrap-iframe"); + $(`.frm-ifre-${id}`).css({width: "75%", position: "unset"}); $(`.frm-ifre-${id} .ld-frm-src`).css({width: "100%"}); $(`.frm-ifre-${id} .frm-bdy`).removeClass("d-none"); $("#list-page").css({filter: "blur(2px)", opacity: "0.5"}); + $(`.frm-ifre-${id}`).find(".minimize").toggleClass("d-none"); }); $(`.frm-ifre-${number} .compress`).on("click", function () { let id = $(this).attr("data-unid"); $(this).addClass("d-none"); $(this).siblings(".maximum").removeClass("d-none"); - $(`.frm-ifre-${id}`).css({width: "", bottom: ""}); + $(`.frm-ifre-${id}`).parent().removeClass("wrap-iframe"); + $(`.frm-ifre-${id}`).css({width: "", position: ""}); $(`.frm-ifre-${id} .ld-frm-src`).css({width: ""}); $("#list-page").css({filter: "", opacity: ""}); + $(`.frm-ifre-${id}`).find(".minimize").toggleClass("d-none"); }); $(`.frm-ifre-${number} .close`).on("click", function () { let id = $(this).attr("data-unid"); $("#list-page").css({filter: "unset", opacity: "1"}); - $(`.frm-ifre-${id}`).remove(); + $(`.frm-ifre-${id}`).parent().remove(); + resetwidth(); }); } function loadData() { @@ -284,6 +304,34 @@ function loadData() { }); }); } +function iFrmeWdth() { + let width = 0, + erwdth = 20; + $(".frm-ifre").each(function (i, e) { + if ($(this).length == 0) { + erwdth = 0; + } + if (window.innerWidth > width) { + width = width + $(this).width() + erwdth; + } + }); + return width; +} +function resetwidth() { + let width = 0, + erwdth = 20; + $(".frm-ifre").each(function (i, e) { + if (i == 0) { + $(this).css("right", width + "px"); + } + if (i != 0) { + $(this).css("right", width + "px"); + } + if (window.innerWidth > width) { + width = width + $(this).width() + erwdth; + } + }); +} export function detailClick() { $(".detailBtn").click(function () { let serverUrl = _serverUrl();