1function createHomeOpenPopup(popupList) { 2 3 popupList.forEach((elem, idx) => { 4 5 // ì¿ í¤ ì¡°í 6 const cookies = document.cookie.split(';'); 7 const cookieNames = cookies.map(cookie => { 8 return cookie.split('=')[0].trim(); 9 }); 10 11 const result = cookieNames.includes('popupCookie' + elem.popSeq); 12 13 // ì¿ í¤ê° ìì ê²½ì°ë§ ì°½ ëì 14 if (!result) { 15 fnOpenWindowPopup(elem, idx); 16 } 17 18 }); 19 20} 21 22/*************************************************** 23 * ì´ë¯¸ì§ ì¬ì´ì¦ ì¡°í 24 * *************************************************/ 25function fnImageSize(filePath) { 26 27 const img = new Image(); 28 29 // img.src = "https://hp.health.or.kr" + filePath; // ê°ë° 30 img.src = filePath; // ì´ì 31 32 function promiseSize() { 33 return new Promise((resolve, reject) => { 34 35 img.onload = function () { 36 resolve({ 37 "width": this.width, 38 "height": this.height 39 }); 40 } 41 img.onerror = function () { 42 reject("ì´ë¯¸ì§ ë¡ë ì¤í¨"); 43 } 44 }); 45 } 46 47 return promiseSize().then(result => { 48 49 return result; 50 }).catch(err => { 51 console.error(err); 52 }); 53 54} 55 56//모ë°ì¼ê¸°ê¸°ì´ë¦ì ë´ì ë°°ì´ 57const mobile_keys = new Array('iPhone','iPad','Android','BlackBerry','Windows Phone', 'Windows CE','LG','MOT','SAMSUNG','SonyEricsson','Nokia'); 58 59/*************************************************** 60 * ìëì° íì ì°½ ìì± 61 * *************************************************/ 62async function fnOpenWindowPopup(elem, idx) { 63 64 const url = "testPopup"; 65 const name = "windowPopup"; 66 67 let filePath; 68 let isMobile = false; 69 70 for(let i in mobile_keys){ 71 if(navigator.userAgent.match(mobile_keys[i])){ 72 isMobile = true; 73 } 74 } 75 76 if (isMobile) { 77 filePath = "https://edu.kpanet.or.kr" + elem.moAttachFilePath; 78 } else { 79 filePath = "https://edu.kpanet.or.kr" + elem.pcAttachFilePath; 80 } 81 82 // ì´ë¯¸ì§ ê²½ë¡ë¥¼ íµí´ ì´ë¯¸ì§ ì¬ì´ì¦ ì¡°í 83 const sizePromise = fnImageSize(filePath); 84 const sizeObj = await sizePromise; 85 86 const windowWidth = 450; 87 // íì¬ íë©´ í¬ê¸°ì ë¹ë¡ 88 const calHeight = ((sizeObj.height * windowWidth) / sizeObj.width) + 30; 89 90 const xOffset = 750 - (idx * 150); 91 const yOffset = 100; 92 // const left = (idx+1) * 150; 93 const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX; 94 const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY; 95 const calWidth = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; 96 const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; 97 const newLeft = ((calWidth / 2) - xOffset) + dualScreenLeft; 98 const newTop = ((height / 2) - yOffset) + dualScreenTop; 99 100 // ì´ë¯¸ì§ì ëì´ê° ìëì° ì°½ë³´ë¤ ìì ê²½ì° => ìëì° ì¬ì´ì¦ ì¡°ì 101 let option = `width = ${windowWidth}, height = ${calHeight}, top = ${newTop}, left = ${newLeft}`; 102 103 let pattern = /(?:https?:\/\/)?(?:www\.)?([^\s\/?#.]+\.[^\s\/?#.:]+|http:[^\s\/?#.:]+)(?:\:[0-9]+)?(?:\/[^\s]*)?/g; 104 if (elem.linkUrl.match(pattern) !== null) { 105 const popupUrl = new URL(elem.linkUrl); 106 if (popupUrl.search !== "") { 107 const encodingLinkUrl = popupUrl.origin + popupUrl.pathname + "?" + encodeURIComponent(popupUrl.search.substring(1, popupUrl.search.length)); 108 window.open(`/${elem.popSeq}/homeOpenPopup.cm?filePath=${filePath}&popupName=${elem.title}&linkUrl=${encodingLinkUrl}`, elem.title, option); 109 } else 110 window.open(`/${elem.popSeq}/homeOpenPopup.cm?filePath=${filePath}&popupName=${elem.title}&linkUrl=${elem.linkUrl}`, elem.title, option); 111 } else 112 window.open(`/${elem.popSeq}/homeOpenPopup.cm?filePath=${filePath}&popupName=${elem.title}&linkUrl=${elem.linkUrl}`, elem.title, option); 113} 114 115
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.