first commit 2

This commit is contained in:
hmw1001
2026-06-11 18:47:38 +09:00
parent c768729ce6
commit 6f534e33a6
11095 changed files with 1595758 additions and 0 deletions
@@ -0,0 +1,91 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* rb.custom :: main_visual_section/config.php
* 메인 비주얼 모듈의 모든 동작을 제어하는 설정 파일
*/
$main_visual_config = array(
// 💡 [최종 수정] 오른쪽 메뉴 롤링 설정
'enable_right_menu_rolling' => false, // 오른쪽 메뉴를 롤링할지 여부 (true/false)
'right_menu_rolling_time' => 10000, // 💡 [수정] 오른쪽 메뉴 롤링 시간 (밀리초) - 10초
'right_menu_visible_items' => 5, // 오른쪽 메뉴에 한 번에 보이는 아이템 수 (이것이 높이 계산의 기준이 됩니다)
'right_menu_item_height_px' => 55, // 💡 [추가] 오른쪽 메뉴 아이템 하나의 고정 높이 (px) - 이 값을 기준으로 전체 높이 계산
'boards' => array(
// array(
// 'id' => 'journal',
// 'name' => '과월호',
// 'latest_rows' => 5, // 가져올 최신글 개수 (리스트형은 항상 5개로 분할)
// 'latest_subject_len' => 30,
// 'link_to_board' => false, // 클릭 시 게시판으로 이동할지 여부
// 'left_content_type' => 'slider', // 💡 [추가] 왼쪽 콘텐츠 표시 방식: 'slider' 또는 'list'
// 'left_content_rolling_time' => 5000 // 'slider'일 경우 롤링 시간 (밀리초)
// ),
array(
'id' => 'coverage',
'name' => '레이저포커스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'slider', // 💡 [추가] 왼쪽 콘텐츠 표시 방식: 'list'
'left_content_rolling_time' => 5000 // 'slider'일 경우 롤링 시간 (밀리초)
),
array(
'id' => 'interview',
'name' => '인터뷰',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 6000
),
array(
'id' => 'newsfocus1',
'name' => '레이저뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 6000
),
array(
'id' => 'newsfocus2',
'name' => '관련산업뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 6000
),
array(
'id' => 'photonews',
'name' => '포토뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 6000
),
array(
'id' => 'newtech',
'name' => '신기술',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 5500
),
array(
'id' => 'newproduct',
'name' => '신제품',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list',
'left_content_rolling_time' => 5500
),
)
);
?>
@@ -0,0 +1,88 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* rb.custom :: main_visual_section/config.php
* 메인 비주얼 모듈의 모든 동작을 제어하는 설정 파일
*/
$main_visual_config = array(
// 💡 [최종 수정] 오른쪽 메뉴 롤링 설정
'enable_right_menu_rolling' => false, // 오른쪽 메뉴를 롤링할지 여부 (true/false)
'right_menu_rolling_time' => 10000, // 💡 [수정] 오른쪽 메뉴 롤링 시간 (밀리초) - 10초
'right_menu_visible_items' => 5, // 오른쪽 메뉴에 한 번에 보이는 아이템 수 (이것이 높이 계산의 기준이 됩니다)
'right_menu_item_height_px' => 55, // 💡 [추가] 오른쪽 메뉴 아이템 하나의 고정 높이 (px) - 이 값을 기준으로 전체 높이 계산
'boards' => array(
// array(
// 'id' => 'journal',
// 'name' => '과월호',
// 'latest_rows' => 5, // 가져올 최신글 개수 (리스트형은 항상 5개로 분할)
// 'latest_subject_len' => 30,
// 'link_to_board' => false, // 클릭 시 게시판으로 이동할지 여부
// 'left_content_type' => 'slider', // 💡 [추가] 왼쪽 콘텐츠 표시 방식: 'slider' 또는 'list'
// 'left_content_rolling_time' => 5000 // 'slider'일 경우 롤링 시간 (밀리초)
// ),
array(
'id' => 'coverage',
'name' => '레이저포커스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'slider', // 💡 [추가] 왼쪽 콘텐츠 표시 방식: 'list'
'left_content_rolling_time' => 5000 // 'slider'일 경우 롤링 시간 (밀리초)
),
array(
'id' => 'interview',
'name' => '인터뷰',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list'
),
array(
'id' => 'newsfocus1',
'name' => '레이저뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'slider',
'left_content_rolling_time' => 6000
),
array(
'id' => 'newsfocus2',
'name' => '관련산업뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'slider',
'left_content_rolling_time' => 6000
),
array(
'id' => 'photonews',
'name' => '포토뉴스',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list'
),
array(
'id' => 'newtech',
'name' => '신기술',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'slider',
'left_content_rolling_time' => 5500
),
array(
'id' => 'newproduct',
'name' => '신제품',
'latest_rows' => 5,
'latest_subject_len' => 30,
'link_to_board' => false,
'left_content_type' => 'list'
),
)
);
?>
@@ -0,0 +1,322 @@
/* ==========================================================================
Main Visual Section - 최종 수정본
========================================================================== */
/* === FIXED main_visual_section module.css === */
.main-visual-module {
display: flex;
gap: 0; /* 간격 제거 */
background-color: #f8f8f8;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.05);
/* height는 JS에서 동적으로 설정 */
}
.main-visual-left {
flex: 2; /* 레퍼런스 비율 */
position: relative;
overflow: hidden;
height: 100%;
}
.main-visual-left .content-group {
position: absolute;
inset: 0;
display: none;
}
.main-visual-left .content-group.active {
display: block;
}
.main-visual-left [class^="headmain-slider-"] {
position: relative !important;
width: 100%;
height: 100%;
}
.main-visual-left [class^="headmain-slider-"] .main_visual {
position: absolute;
inset: 0;
}
.main-visual-left .headmain_wrap {
position: relative;
width: 100%;
height: 100%;
display: none;
}
.main-visual-left .headmain-slider {
width: 100%;
height: 100%;
}
.main-visual-left .main_visual {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
}
.main-visual-left .main_visual:first-child {
display: block;
}
.main-visual-left .main_visual a {
display: block;
position: relative;
width: 100%;
height: 100%;
text-decoration: none;
color: inherit;
}
.main-visual-left .visual_img_con {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.main-visual-left .visual_img_con img {
width: 100%;
height: 100%;
object-fit: cover;
}
.main-visual-left .main_title {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
z-index: 2;
padding: 20px;
background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
color: #fff;
}
.main-visual-left .main_title .line2 {
display: block;
font-size: 1.5rem;
font-weight: 700;
line-height: 1.4;
max-height: 2.8em;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.main-visual-left .btn_left,
.main-visual-left .btn_right {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.5);
border: none;
color: #fff;
padding: 10px;
cursor: pointer;
z-index: 10;
font-size: 1.5rem;
width: 40px;
height: 60px;
display: flex;
justify-content: center;
}
.main-visual-left .btn_left { left: 0; border-radius: 0 5px 5px 0; }
.main-visual-left .btn_right { right: 0; border-radius: 5px 0 0 5px; }
.main-visual-left .content-list-static-inner {
width: 100%;
height: 100%;
padding: 20px;
overflow-y: auto;
}
.main-visual-left .content-list-static-inner ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
height: 100%;
}
.main-visual-left .content-list-static-inner li {
flex: 1;
margin-bottom: 0;
padding-bottom: 0;
border-bottom: 1px dashed #eee;
overflow: hidden;
}
.main-visual-left .content-list-static-inner li:last-child {
border-bottom: none;
}
.main-visual-left .content-list-static-inner li a {
display: flex;
text-decoration: none;
color: inherit;
height: 100%;
padding: 5px 0;
}
.main-visual-left .content-list-static-inner .content-list-thumb {
flex-shrink: 0;
width: 25%;
height: 100%;
overflow: hidden;
border-radius: 5px;
margin-left: 15px;
order: 2;
}
.main-visual-left .content-list-static-inner .content-list-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
.main-visual-left .content-list-static-inner .content-list-summary {
flex: 3;
order: 1;
padding-right: 15px;
}
.main-visual-left .content-list-static-inner .content-list-summary h3 {
font-size: 1.1rem;
font-weight: 700;
line-height: 1.3;
margin-bottom: 3px;
color: #222;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.main-visual-right {
flex: 1;
background-color: #fff;
border-left: 1px solid #eee;
padding: 0;
position: relative;
}
.main-visual-right .menu-list {
list-style: none;
padding: 0;
margin: 0;
height: 100%;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
}
.main-visual-right .menu-list.static-menu {
overflow: visible;
height: auto;
}
.main-visual-right .menu-item {
display: flex;
align-items: center;
}
.main-visual-right .menu-item a {
display: block;
padding: 18px 25px;
text-decoration: none;
color: #555;
font-size: 1.1rem;
font-weight: 500;
transition: background-color 0.3s ease, color 0.3s ease;
border-left: 5px solid transparent;
width: 100%;
}
.main-visual-right .menu-item.active a {
background-color: #e0f2f7;
color: #0056b3;
font-weight: 700;
border-left-color: #0056b3;
}
.main-visual-right .menu-item a:hover:not(.active) {
background-color: #f0f0f0;
color: #333;
border-left-color: #ccc;
}
@media (max-width: 1024px) {
.main-visual-module {
flex-direction: column-reverse;
min-height: auto;
}
.main-visual-left {
height: auto;
min-height: 300px;
}
.main-visual-left .main_title .line2 {
font-size: 1.2rem;
}
.main-visual-right {
border-left: none;
border-bottom: 1px solid #eee;
height: auto;
}
.main-visual-right .menu-list {
height: auto;
flex-direction: row;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
white-space: nowrap;
}
.main-visual-right .menu-item {
height: auto;
flex-shrink: 0;
width: 20%;
}
.main-visual-right .menu-item a {
padding: 8px 15px; /* 💡 [최종 수정] 세로 패딩을 줄여 높이를 약 30px로 맞춤 */
font-size: 0.8rem; /* 💡 [최종 수정] 폰트 크기 조정 */
border-left: none;
border-bottom: 3px solid transparent;
text-align: center;
}
.main-visual-right .menu-item.active a {
border-left-color: transparent;
border-bottom-color: #0056b3;
}
}
@media (max-width: 1024px) {
.main-visual-module {
min-height: auto !important;
height: auto !important;
}
.main-visual-right {
height: auto !important;
}
.main-visual-right .menu-list {
height: auto !important;
min-height: unset !important;
overflow-x: auto;
overflow-y: hidden;
}
.main-visual-right .menu-item {
flex: 0 0 auto;
width: auto;
}
}
@@ -0,0 +1,319 @@
/* === FIXED main_visual_section module.css === */
.main-visual-module {
display: flex;
gap: 0; /* 간격 제거 */
background-color: #f8f8f8;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.05);
/* height는 JS에서 동적으로 설정 */
}
.main-visual-left {
flex: 2; /* 레퍼런스 비율 */
position: relative;
overflow: hidden;
height: 100%;
}
.main-visual-left .content-group {
position: absolute;
inset: 0;
display: none;
}
.main-visual-left .content-group.active {
display: block;
}
.main-visual-left [class^="headmain-slider-"] {
position: relative !important;
width: 100%;
height: 100%;
}
.main-visual-left [class^="headmain-slider-"] .main_visual {
position: absolute;
inset: 0;
}
.main-visual-left .headmain_wrap {
position: relative;
width: 100%;
height: 100%;
display: none;
}
.main-visual-left .headmain-slider {
width: 100%;
height: 100%;
}
.main-visual-left .main_visual {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
}
.main-visual-left .main_visual:first-child {
display: block;
}
.main-visual-left .main_visual a {
display: block;
position: relative;
width: 100%;
height: 100%;
text-decoration: none;
color: inherit;
}
.main-visual-left .visual_img_con {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.main-visual-left .visual_img_con img {
width: 100%;
height: 100%;
object-fit: cover;
}
.main-visual-left .main_title {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
z-index: 2;
padding: 20px;
background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
color: #fff;
}
.main-visual-left .main_title .line2 {
display: block;
font-size: 1.5rem;
font-weight: 700;
line-height: 1.4;
max-height: 2.8em;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.main-visual-left .btn_left,
.main-visual-left .btn_right {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.5);
border: none;
color: #fff;
padding: 10px;
cursor: pointer;
z-index: 10;
font-size: 1.5rem;
width: 40px;
height: 60px;
display: flex;
justify-content: center;
}
.main-visual-left .btn_left { left: 0; border-radius: 0 5px 5px 0; }
.main-visual-left .btn_right { right: 0; border-radius: 5px 0 0 5px; }
.main-visual-left .content-list-static-inner {
width: 100%;
height: 100%;
padding: 20px;
overflow-y: auto;
}
.main-visual-left .content-list-static-inner ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
height: 100%;
}
.main-visual-left .content-list-static-inner li {
flex: 1;
margin-bottom: 0;
padding-bottom: 0;
border-bottom: 1px dashed #eee;
overflow: hidden;
}
.main-visual-left .content-list-static-inner li:last-child {
border-bottom: none;
}
.main-visual-left .content-list-static-inner li a {
display: flex;
text-decoration: none;
color: inherit;
height: 100%;
padding: 5px 0;
}
.main-visual-left .content-list-static-inner .content-list-thumb {
flex-shrink: 0;
width: 25%;
height: 100%;
overflow: hidden;
border-radius: 5px;
margin-left: 15px;
order: 2;
}
.main-visual-left .content-list-static-inner .content-list-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
.main-visual-left .content-list-static-inner .content-list-summary {
flex: 3;
order: 1;
padding-right: 15px;
}
.main-visual-left .content-list-static-inner .content-list-summary h3 {
font-size: 1.1rem;
font-weight: 700;
line-height: 1.3;
margin-bottom: 3px;
color: #222;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.main-visual-right {
flex: 1;
background-color: #fff;
border-left: 1px solid #eee;
padding: 0;
position: relative;
}
.main-visual-right .menu-list {
list-style: none;
padding: 0;
margin: 0;
height: 100%;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
}
.main-visual-right .menu-list.static-menu {
overflow: visible;
height: auto;
}
.main-visual-right .menu-item {
display: flex;
align-items: center;
}
.main-visual-right .menu-item a {
display: block;
padding: 18px 25px;
text-decoration: none;
color: #555;
font-size: 1.1rem;
font-weight: 500;
transition: background-color 0.3s ease, color 0.3s ease;
border-left: 5px solid transparent;
width: 100%;
}
.main-visual-right .menu-item.active a {
background-color: #e0f2f7;
color: #0056b3;
font-weight: 700;
border-left-color: #0056b3;
}
.main-visual-right .menu-item a:hover:not(.active) {
background-color: #f0f0f0;
color: #333;
border-left-color: #ccc;
}
@media (max-width: 1024px) {
.main-visual-module {
flex-direction: column-reverse;
min-height: auto;
}
.main-visual-left {
height: auto;
min-height: 300px;
}
.main-visual-left .main_title .line2 {
font-size: 1.2rem;
}
.main-visual-right {
border-left: none;
border-bottom: 1px solid #eee;
height: auto;
}
.main-visual-right .menu-list {
height: auto;
flex-direction: row;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
white-space: nowrap;
}
.main-visual-right .menu-item {
height: auto;
flex-shrink: 0;
width: 20%;
}
.main-visual-right .menu-item a {
padding: 8px 15px; /* 💡 [최종 수정] 세로 패딩을 줄여 높이를 약 30px로 맞춤 */
font-size: 0.8rem; /* 💡 [최종 수정] 폰트 크기 조정 */
border-left: none;
border-bottom: 3px solid transparent;
text-align: center;
}
.main-visual-right .menu-item.active a {
border-left-color: transparent;
border-bottom-color: #0056b3;
}
}
@media (max-width: 1024px) {
.main-visual-module {
min-height: auto !important;
height: auto !important;
}
.main-visual-right {
height: auto !important;
}
.main-visual-right .menu-list {
height: auto !important;
min-height: unset !important;
overflow-x: auto;
overflow-y: hidden;
}
.main-visual-right .menu-item {
flex: 0 0 auto;
width: auto;
}
}
@@ -0,0 +1,153 @@
// main_visual_section 모듈을 위한 JavaScript (ES6+ 버전)
window.initMainVisualModule = function(moduleId) {
const mainVisualModule = document.getElementById(moduleId);
if (!mainVisualModule) {
console.warn(`Main Visual Module (ID: ${moduleId}) 요소를 찾을 수 없습니다.`);
return;
}
const menuItems = mainVisualModule.querySelectorAll('.main-visual-right .menu-item');
const rightMenuRollingEnabled = mainVisualModule.dataset.rightMenuRolling === 'true';
const rightMenuRollingTime = parseInt(mainVisualModule.dataset.rightMenuRollingTime, 10) || 0;
const rightMenuVisibleItems = parseInt(mainVisualModule.dataset.rightMenuVisibleItems, 10) || 5;
const rightMenuItemHeightPx = parseInt(mainVisualModule.dataset.rightMenuItemHeightPx, 10) || 92;
let currentActiveIndex = 0;
let rightMenuAutoRollingInterval; // 오른쪽 메뉴 롤링 인터벌
const menuList = mainVisualModule.querySelector('.main-visual-right .menu-list');
if (menuList) {
menuItems.forEach(item => {
item.style.height = `${rightMenuItemHeightPx}px`;
});
let actualMenuListHeight = 0;
menuItems.forEach(item => {
actualMenuListHeight += item.offsetHeight;
});
if (rightMenuRollingEnabled) {
menuList.style.height = `${rightMenuVisibleItems * rightMenuItemHeightPx}px`;
} else {
menuList.style.height = `${actualMenuListHeight}px`;
menuList.classList.add('static-menu');
}
mainVisualModule.style.height = menuList.style.height;
}
function activateLeftContent(index) {
menuItems.forEach(item => item.classList.remove('active'));
if (menuItems[index]) {
menuItems[index].classList.add('active');
}
currentActiveIndex = index;
mainVisualModule.querySelectorAll('.main-visual-left .content-group').forEach(group => {
group.style.display = 'none';
});
const targetBoardId = menuItems[index].dataset.id;
const targetContentGroup = mainVisualModule.querySelector(`.main-visual-left .content-group[data-id="${targetBoardId}"]`);
if (targetContentGroup) {
targetContentGroup.style.display = 'block';
const leftContentType = menuItems[index].dataset.leftContentType;
const leftContentRollingTime = parseInt(menuItems[index].dataset.leftContentRollingTime, 10) || 0;
if (leftContentType === 'slider') {
const targetHeadmainWrap = targetContentGroup.querySelector('.headmain_wrap');
if (targetHeadmainWrap) {
targetHeadmainWrap.style.display = 'block';
const targetSliderContainer = targetHeadmainWrap.querySelector(`.headmain-slider-${targetBoardId}`);
if (targetSliderContainer) {
if (typeof jQuery !== 'undefined' && jQuery.fn.cycle) {
if (jQuery(targetSliderContainer).data('cycle.opts')) {
jQuery(targetSliderContainer).cycle('destroy');
}
// 💡 [핵심] Cycle2가 prev/next 옵션을 통해 버튼을 직접 제어하도록 위임합니다.
jQuery(targetSliderContainer).cycle({
fx: 'scrollHorz',
timeout: leftContentRollingTime,
slides: '> .main_visual',
prev: jQuery(targetHeadmainWrap).find('.btn_left'),
next: jQuery(targetHeadmainWrap).find('.btn_right'),
log: false
});
} else {
console.warn("jQuery Cycle2 라이브러리가 로드되지 않았습니다. 슬라이더 기능이 작동하지 않습니다.");
}
}
}
}
}
}
function startRightMenuRolling() {
if (!rightMenuRollingEnabled) return;
stopRightMenuRolling();
rightMenuAutoRollingInterval = setInterval(() => {
let nextIndex = (currentActiveIndex + 1) % menuItems.length;
if (typeof jQuery !== 'undefined' && jQuery.fn.cycle) {
jQuery('.main-visual-right .menu-list').cycle('goto', nextIndex);
}
activateLeftContent(nextIndex);
}, rightMenuRollingTime);
}
function stopRightMenuRolling() {
clearInterval(rightMenuAutoRollingInterval);
}
menuItems.forEach((menuItem, index) => {
menuItem.addEventListener('click', (e) => {
const linkToBoard = menuItem.dataset.linkToBoard === 'true';
if (rightMenuRollingEnabled || !linkToBoard) {
e.preventDefault();
}
activateLeftContent(index);
stopRightMenuRolling();
if (rightMenuRollingEnabled && typeof jQuery !== 'undefined' && jQuery.fn.cycle) {
jQuery('.main-visual-right .menu-list').cycle('goto', index);
}
});
});
// 💡 [최종 수정] 불필요하고 충돌을 일으키는 수동 버튼 제어 로직을 완전히 제거합니다.
/*
mainVisualModule.querySelectorAll('.headmain_wrap .btn_left').forEach(btn => {
btn.addEventListener('click', () => { ... });
});
mainVisualModule.querySelectorAll('.headmain_wrap .btn_right').forEach(btn => {
btn.addEventListener('click', () => { ... });
});
*/
mainVisualModule.addEventListener('mouseenter', stopRightMenuRolling);
mainVisualModule.addEventListener('mouseleave', startRightMenuRolling);
if (rightMenuRollingEnabled && typeof jQuery !== 'undefined' && jQuery.fn.cycle) {
jQuery('.main-visual-right .menu-list').cycle({
fx: 'carousel',
timeout: rightMenuRollingTime,
slides: '> li',
vertical: true,
carouselVisible: rightMenuVisibleItems,
allowWrap: true,
log: false
});
jQuery('.main-visual-right .menu-list').on('cycle-before', (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) => {
const incomingIndex = jQuery(incomingSlideEl).index();
activateLeftContent(incomingIndex);
});
}
activateLeftContent(0);
startRightMenuRolling();
};
@@ -0,0 +1,160 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* rb.custom :: main_visual_section/module.php
* 메인 비주얼 모듈
*/
// 이 모듈은 독립적으로 동작하므로, 다른 모듈과 충돌하지 않는 자신만의 고유 ID를 생성합니다.
$visual_id = 'mvm_' . uniqid();
// 1. 설정 파일 로드
$config_path = __DIR__ . '/config.php';
if (file_exists($config_path)) {
include_once($config_path);
} else {
return;
}
// 2. 설정에 따라 각 게시판의 최신글 데이터를 미리 가져옵니다.
$all_latest_data = array();
foreach ($main_visual_config['boards'] as $board_info) {
$bo_table = $board_info['id'];
$rows = $board_info['latest_rows'];
$subject_len = $board_info['latest_subject_len'];
$latest_list = get_latest($bo_table, $rows, $subject_len);
$items = array();
foreach ($latest_list as $row) {
$item = $row;
$item['href'] = get_pretty_url($bo_table, $row['wr_id']);
$item['subject'] = cut_str(get_text($row['wr_subject']), $subject_len);
$item['summary'] = cut_str(strip_tags($row['wr_1'] ?: $row['wr_content']), 120);
$thumb = get_list_thumbnail($bo_table, $row['wr_id'], 875, 582, false, true);
$item['thumb_src'] = $thumb['src'] ?: G5_THEME_URL . '/rb.img/no_image.png';
$item['thumb_alt'] = $thumb['alt'] ?: get_text($row['wr_subject']);
$items[] = $item;
}
$all_latest_data[$bo_table] = $items;
}
$right_menu_total_height = $main_visual_config['right_menu_visible_items'] * $main_visual_config['right_menu_item_height_px'];
?>
<div class="main-visual-module"
id="<?php echo $visual_id; ?>"
data-right-menu-rolling="<?php echo $main_visual_config['enable_right_menu_rolling'] ? 'true' : 'false'; ?>"
data-right-menu-rolling-time="<?php echo $main_visual_config['right_menu_rolling_time']; ?>"
data-right-menu-visible-items="<?php echo $main_visual_config['right_menu_visible_items']; ?>"
data-right-menu-item-height-px="<?php echo $main_visual_config['right_menu_item_height_px']; ?>"
style="min-height: <?php echo $right_menu_total_height; ?>px;">
<div class="main-visual-left">
<?php
$first_board_id = $main_visual_config['boards'][0]['id'];
foreach ($main_visual_config['boards'] as $board_info):
$bo_table = $board_info['id'];
$items = $all_latest_data[$bo_table];
$left_content_type = $board_info['left_content_type'];
$left_content_rolling_time = isset($board_info['left_content_rolling_time']) ? $board_info['left_content_rolling_time'] : $main_visual_config['right_menu_rolling_time'];
?>
<div class="content-group <?php echo ($bo_table == $first_board_id) ? 'active' : ''; ?>"
data-id="<?php echo $bo_table; ?>"
data-left-content-type="<?php echo $left_content_type; ?>"
data-left-content-rolling-time="<?php echo $left_content_rolling_time; ?>">
<?php if (!empty($items)): ?>
<?php if ($left_content_type === 'slider'): ?>
<div class="headmain_wrap">
<div class="headmain-slider-<?php echo $bo_table; ?>">
<?php foreach ($items as $item): ?>
<div class="main_visual">
<a href="<?php echo $item['href']; ?>">
<div class="visual_img_con">
<img src="<?php echo $item['thumb_src']; ?>" alt="<?php echo $item['thumb_alt']; ?>">
</div>
<p class="main_title">
<span class="line2"><?php echo $item['subject']; ?></span>
</p>
</a>
</div>
<?php endforeach; ?>
</div>
<button class="btn btn_left"><i class="fas fa-chevron-left"></i></button>
<button class="btn btn_right"><i class="fas fa-chevron-right"></i></button>
</div>
<?php else: ?>
<div class="content-list-static-inner">
<ul>
<?php foreach ($items as $item): ?>
<li>
<a href="<?php echo $item['href']; ?>">
<div class="content-list-thumb">
<img src="<?php echo $item['thumb_src']; ?>" alt="<?php echo $item['thumb_alt']; ?>">
</div>
<div class="content-list-summary">
<h3><?php echo $item['subject']; ?></h3>
<p><?php echo $item['summary']; ?></p>
</div>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php else: ?>
<div class="empty-content">게시물이 없습니다.</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="main-visual-right">
<ul class="menu-list">
<?php
$first_board_id = $main_visual_config['boards'][0]['id'];
foreach ($main_visual_config['boards'] as $board_info):
?>
<li class="menu-item <?php echo ($board_info['id'] == $first_board_id) ? 'active' : ''; ?>"
data-id="<?php echo $board_info['id']; ?>"
data-link-to-board="<?php echo $board_info['link_to_board'] ? 'true' : 'false'; ?>"
data-left-content-type="<?php echo $board_info['left_content_type']; ?>"
data-left-content-rolling-time="<?php echo isset($board_info['left_content_rolling_time']) ? $board_info['left_content_rolling_time'] : $main_visual_config['right_menu_rolling_time']; ?>">
<a href="<?php echo get_pretty_url($board_info['id']); ?>">
<?php echo $board_info['name']; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<link rel="stylesheet" href="<?php echo G5_THEME_URL; ?>/rb.custom/main_visual_section/module.css?ver=<?php echo G5_CSS_VER; ?>">
<!-- 💡 [최종 수정] 현재 테마(rd.laser)에 복사된 로컬 라이브러리 파일을 로드합니다. -->
<script src="<?php echo G5_THEME_URL; ?>/js/cycle2/jquery.cycle2.min.js"></script>
<script src="<?php echo G5_THEME_URL; ?>/js/cycle2/jquery.cycle2.carousel.min.js"></script>
<script>
(function() {
var currentModuleId = '<?php echo $visual_id; ?>';
var initFunctionName = 'initMainVisualModule';
var scriptId = 'main-visual-module-script-' + currentModuleId;
if (document.getElementById(scriptId)) {
if (typeof window[initFunctionName] === 'function') {
window[initFunctionName](currentModuleId);
}
return;
}
var script = document.createElement('script');
script.id = scriptId;
script.src = '<?php echo G5_THEME_URL; ?>/rb.custom/main_visual_section/module.js?ver=<?php echo G5_JS_VER; ?>';
script.async = true;
script.onload = function() {
if (typeof window[initFunctionName] === 'function') {
window[initFunctionName](currentModuleId);
}
};
document.head.appendChild(script);
})();
</script>