first commit
This commit is contained in:
157
application/views/m/common/light_header.php
Executable file
157
application/views/m/common/light_header.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<script>
|
||||
|
||||
|
||||
// 검색
|
||||
function onkeyup_search_keyword(val) {
|
||||
if (window.event.keyCode == 13) {
|
||||
search_keyword_proc(val);
|
||||
|
||||
} else {
|
||||
if (val == '') {
|
||||
$("#search_arrow").removeClass();
|
||||
$("#search_keyword_list").empty();
|
||||
$("#open_search").hide();
|
||||
$("#search_arrow").addClass('src_icon arrow_down_on');
|
||||
}
|
||||
else {
|
||||
var form_data = {
|
||||
"keyword": val
|
||||
};
|
||||
$.ajax({
|
||||
url: '/m/search/search_keyword',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: form_data,
|
||||
success: function (rtnJson) {
|
||||
if (rtnJson.code == "0000") {
|
||||
var count = rtnJson.data.length;
|
||||
var content = '';
|
||||
for (var i = 0; i < count; i++) {
|
||||
var result = rtnJson.data[i];
|
||||
var result_keyword = result.keyword;
|
||||
keyword = result_keyword.replace(val, '<span class="on">' + val + '</span>');
|
||||
content += ' <div class="recents"><span><a href="javascript:search_keyword_proc(\'' + result_keyword + '\');">' + keyword + '</a></span><span class="close fr"><img src="/img/mobile/img_pointer.png"></span></div>';
|
||||
}
|
||||
$("#search_keyword_list").html(content);
|
||||
$("#search_arrow").removeClass();
|
||||
$("#open_search").show();
|
||||
|
||||
} else {
|
||||
$("#search_arrow").removeClass();
|
||||
$("#search_keyword_list").empty();
|
||||
// $("#open_search").hide();
|
||||
}
|
||||
},
|
||||
error: function (rtnJson) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function search_keyword_proc(search_keyword) {
|
||||
if (search_keyword == '') {
|
||||
search_keyword = $("#search_keyword").val();
|
||||
}
|
||||
|
||||
$("#search_keyword").val(search_keyword);
|
||||
$("#search_form").submit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function remove(i){
|
||||
|
||||
$k = JSON.parse($.cookie("pre_keyword"));
|
||||
$k.splice(i,1);
|
||||
$.cookie("pre_keyword",JSON.stringify($k),{ expires: 7, path: '/'});
|
||||
$("#keys"+i).remove();
|
||||
}
|
||||
|
||||
function removeAll(){
|
||||
|
||||
$.cookie("pre_keyword","[]",{ expires: 7, path: '/'});
|
||||
$(".keys").remove();
|
||||
}
|
||||
|
||||
function pre_keyword_toggle(){
|
||||
toggle = $.cookie('pre_keyword_show') || "Y";
|
||||
|
||||
if(toggle == 'Y'){
|
||||
$.cookie('pre_keyword_show',"N",{ expires: 7, path: '/'});
|
||||
$("#prev_keyword_list").hide();
|
||||
$("#pre_on_off").text("켜기");
|
||||
}
|
||||
else{
|
||||
$.cookie('pre_keyword_show',"Y",{ expires: 7, path: '/'});
|
||||
$("#prev_keyword_list").show();
|
||||
$("#pre_on_off").text("끄기");
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
keys = $.cookie("pre_keyword") || "[]";
|
||||
keys = JSON.parse(keys);
|
||||
$("#prev_keyword_list").html("");
|
||||
for(i=0;i<keys.length;i++){
|
||||
$("#prev_keyword_list").append("\n" +
|
||||
"\t\t<div class='keys' id='keys"+i+"'>\n" +
|
||||
"\t\t\t<span><a href=\"javascript:search_keyword_proc('"+keys[i].split("|")[0]+"')\"><span class=\"search_pointer\">"+keys[i].split("|")[0]+"</span></a></span>\n" +
|
||||
"\t\t\t<span class=\"close fr\" onclick='remove("+i+")'><img src=\"/img/mobile/img_x_grey.png\"></span>\n" +
|
||||
"<span class=\"date fr\">"+keys[i].split("|")[1]+"</span>"+
|
||||
"\t\t</div>");
|
||||
}
|
||||
|
||||
$("#search_keyword").focus(function(){
|
||||
$(".open_search").show();
|
||||
});
|
||||
|
||||
toggle = $.cookie('pre_keyword_show') || "Y";
|
||||
|
||||
if(toggle == 'Y'){
|
||||
$("#prev_keyword_list").show();
|
||||
$("#pre_on_off").text("끄기");
|
||||
}
|
||||
else{
|
||||
$("#prev_keyword_list").hide();
|
||||
$("#pre_on_off").text("켜기");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mypage_top mypage_top_fixed bgb3">
|
||||
<div class="mypage_logo"><a href="/"><img src="/img/mobile/logo_cm.jpg" alt="logo"></a>
|
||||
</div>
|
||||
<div class="mypage_title">
|
||||
<a href="<?= $page_title_link ?>"><span class="header_tit"><?= $page_title ?></span></a>
|
||||
</div>
|
||||
<div class="mypage_search" style="width: 150px; text-align: right;">
|
||||
<form name="search_form" id="search_form" method="get" action="/m/search/">
|
||||
<span><input type="text" class="inputer" id="search_keyword" name="search_keyword" placeholder="검색"
|
||||
value=""
|
||||
onkeyup="onkeyup_search_keyword(this.value);"><a
|
||||
href="javascript:search_form.submit();"><img
|
||||
src="/img/mobile/mypage_serch_icon.gif" alt="검색하기"></a></span>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="mypage_menu"><a href=""><img src="/img/mobile/menu_list.gif" alt="menu"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="open_search" id="open_search" style="display:none;top:53px">
|
||||
<div class="roll_box" id="prev_keyword_list">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="roll_box" id="search_keyword_list">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="roll_footer">
|
||||
<span><a href="javascript:pre_keyword_toggle()">최근 검색어 <span id="pre_on_off"></span></a></span> | <span><a href="javascript:removeAll()">전체삭제</a></span>
|
||||
<span class="fr"><a href='javascript:$("#open_search").hide();'>닫기</a></span>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user