This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
/
main.20.skin.php
280 lines (223 loc) · 8.52 KB
/
main.20.skin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
/*
상품리스트가 일정 시간마다 위로 롤링되는 스킨
롤링되기 위해서는 상품이 2줄 이상이어야 함
*/
?>
<!-- 이전 재생 정지 다음 버튼 시작 { -->
<ul id="btn_smt_<?php echo $this->type; ?>" class="sctrl">
<li><button type="button" class="sctrl_play">효과재생<span></span></button></li>
<li><button type="button" class="sctrl_stop">효과정지<span></span></button></li>
</ul>
<!-- } 이전 재생 정지 다음 버튼 끝 -->
<!-- 상품진열 20 시작 { -->
<?php
$i=0;
foreach((array) $list as $row){
if( empty($row) ) continue;
$i++;
$sct_last = '';
$item_link_href = shop_item_url($row['it_id']);
$star_score = $row['it_use_avg'] ? (int) get_star($row['it_use_avg']) : '';
if($i>1 && $i%$this->list_mod == 0)
$sct_last = ' sct_last'; // 줄 마지막
if ($i == 1) {
if ($this->css) {
echo "<div id=\"smt_{$this->type}\" class=\"{$this->css}\">\n";
} else {
echo "<div id=\"smt_{$this->type}\" class=\"sct smt_20\">\n";
}
echo "<ul class=\"sct_ul sct_ul_first\">\n";
}
if ($i>1 && $i%$this->list_mod == 1) {
echo "</ul>\n";
echo "<ul class=\"sct_ul\">\n";
}
echo "<li class=\"sct_li{$sct_last}\">";
if ($this->href) {
echo "<div class=\"sct_img\"><a href=\"{$item_link_href}\" class=\"sct_a\">\n";
}
if ($this->view_it_img) {
echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."\n";
}
if ($this->href) {
echo "</a></div>\n";
}
if ($this->view_it_id) {
echo "<div class=\"sct_id\"><".stripslashes($row['it_id'])."></div>\n";
}
if ($this->href) {
echo "<div class=\"sct_txt\"><a href=\"{$item_link_href}\" class=\"sct_a\">\n";
}
if ($this->view_it_name) {
echo stripslashes($row['it_name'])."\n";
}
if ($this->href) {
echo "</a></div>\n";
}
if ($this->view_it_basic && $row['it_basic']) {
echo "<div class=\"sct_basic\">".stripslashes($row['it_basic'])."</div>\n";
}
if ($this->view_it_cust_price || $this->view_it_price) {
echo "<div class=\"sct_cost\">\n";
if ($this->view_it_cust_price && $row['it_cust_price']) {
echo "<span class=\"sct_dict\">".display_price($row['it_cust_price'])."</span>\n";
}
if ($this->view_it_price) {
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
}
echo "</div>\n";
}
if ($this->view_sns) {
$sns_top = $this->img_height + 10;
$sns_url = $item_link_href;
$sns_title = get_text($row['it_name']).' | '.get_text($config['cf_title']);
echo "<div class=\"sct_sns\" style=\"top:{$sns_top}px\">";
echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/facebook.png');
echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/twitter.png');
echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/gplus.png');
echo "</div>\n";
}
if ($this->view_it_icon) {
echo "<div class=\"sct_icon\">".item_icon($row)."</div>\n";
}
echo "</li>\n";
}
if ($i >= 1) {
echo "</ul>\n";
echo "</div>\n";
}
if($i == 0) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
<script>
(function($) {
var intervals = {};
var methods = {
init: function(option)
{
if(this.length < 1)
return false;
var $smt = this.find("ul.sct_ul");
var $smt_a = $smt.find("a");
var height = 0;
var count = $smt.length;
var c_idx = o_idx = 0;
var fx = null;
var el_id = this[0].id;
$smt.each(function() {
var h = $(this).outerHeight(true);
if(h > height)
height = h;
});
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
this.height(height);
$smt.eq(o_idx).siblings().css("top", height+"px");
// 기본 설정값
var settings = $.extend({
interval: 5000,
duration: 800
}, option);
if(count < 2)
return;
set_interval();
$smt.hover(
function() {
clear_interval();
},
function() {
set_interval();
}
);
$smt_a.on("focusin", function() {
clear_interval();
});
$smt_a.on("focusout", function() {
set_interval();
});
function top_rolling() {
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$smt.eq(o_idx).animate(
{ top: "-="+height+"px" }, settings.duration,
function() {
$(this).css("display", "none").css("top", height+"px");
}
);
c_idx = (o_idx + 1) % count;
$smt.eq(c_idx).css("display", "block").animate(
{ top: "-="+height+"px" }, settings.duration,
function() {
o_idx = c_idx;
}
);
}
function set_interval() {
if(count > 1) {
clear_interval();
if($("#btn_"+el_id).find("button.sctrl_stop").data("stop") == true)
return;
intervals[el_id] = setInterval(top_rolling, settings.interval);
// control 버튼 class
$("#btn_"+el_id).find("button span").removeClass("sctrl_on").html("")
.end().find("button.sctrl_play span").addClass("sctrl_on").html("<b class=\"sound_only\">선택됨</b>");
}
}
function clear_interval() {
if(intervals[el_id]) {
clearInterval(intervals[el_id]);
// control 버튼 class
$("#btn_"+el_id).find("button span").removeClass("sctrl_on").html("")
.end().find("button.sctrl_stop span").addClass("sctrl_on").html("<b class=\"sound_only\">선택됨</b>");
}
}
},
stop: function()
{
var el_id = this[0].id;
if(intervals[el_id])
clearInterval(intervals[el_id]);
}
};
$.fn.topRolling = function(option) {
if (methods[option])
return methods[option].apply(this, Array.prototype.slice.call(arguments, 1));
else
return methods.init.apply(this, arguments);
}
}(jQuery));
$(function() {
$("#smt_<?php echo $this->type; ?>").topRolling();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#smt_<?php echo $this->type; ?>").topRolling({ interval: 2000, duration: 800 });
// 애니메이션 play
$("#btn_smt_<?php echo $this->type; ?> button.sctrl_play").on("click", function() {
$("#btn_smt_<?php echo $this->type; ?> button.sctrl_stop").data("stop", false);
var id = $(this).closest(".sctrl").attr("id").replace("btn_", "");
$("#"+id).topRolling();
//$("#"+id).topRolling({ interval: 2000, duration: 800 });
});
// 애니메이션 stop
$("#btn_smt_<?php echo $this->type; ?> button.sctrl_stop").on("click", function() {
if($(this).parent().siblings().find(".sctrl_on").length > 0) {
$(this).parent().siblings().find("span").removeClass("sctrl_on").html("");
$(this).children().addClass("sctrl_on").html("<b class=\"sound_only\">선택됨</b>");
var id = $(this).closest(".sctrl").attr("id").replace("btn_", "");
$("#"+id).topRolling("stop");
$(this).data("stop", true);
}
});
});
</script>
<!-- } 상품진열 20 끝 -->