229 lines
6.1 KiB
PHP
Executable File
229 lines
6.1 KiB
PHP
Executable File
<?
|
|
|
|
# request
|
|
$ci = &get_instance();
|
|
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->where('depth', '1');
|
|
$this->db->from('main_category');
|
|
$this->db->order_by('p_category_code asc, depth asc, category_code asc');
|
|
$this->db->limit(3, 0);
|
|
$res = $this->db->get();
|
|
$cat1 = $res->result_array();
|
|
|
|
|
|
?>
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
history_refresh();
|
|
});
|
|
function select(i, elm) {
|
|
$(".news_media").find("span.news_media_list").removeClass("current");
|
|
$(elm).parent().addClass("current");
|
|
$("ul[class*=cat2_]").hide();
|
|
|
|
$(".cat2_" + i).show();
|
|
$(".news_company").hide();
|
|
|
|
|
|
}
|
|
|
|
function select2(code){
|
|
$(".portal").hide();
|
|
$(".portal."+code).show();
|
|
}
|
|
|
|
function open_url(url,name,img){
|
|
|
|
|
|
history = JSON.parse($.cookie("history") || "{}") || [] ;
|
|
delete history[name];
|
|
history[name]= {"name" : name , "img" : img , "url" : url , "time" : Date.now()};
|
|
$.cookie("history",JSON.stringify(history),{ expires: 7, path: '/'});
|
|
|
|
console.log(history);
|
|
window.open(url);
|
|
}
|
|
|
|
function remove_history(index = null){
|
|
|
|
console.log(index);
|
|
if(index){
|
|
a = JSON.parse($.cookie("history") || "{}") || [] ;
|
|
delete a[index];
|
|
$.cookie("history",JSON.stringify(a),{ expires: 7, path: '/'});
|
|
}
|
|
else{
|
|
|
|
if(confirm("모든 방문내역을 삭제하시겠습니까?")){
|
|
|
|
$.cookie("history",null,{ expires: 7, path: '/'});
|
|
}
|
|
|
|
|
|
}
|
|
$(".news_company").hide();
|
|
history_refresh();
|
|
|
|
}
|
|
|
|
function history_refresh(){
|
|
|
|
a = JSON.parse($.cookie("history") || "{}") || [] ;
|
|
$txt = '';
|
|
$(".news_company").html("");
|
|
|
|
tmp = [];
|
|
|
|
$.each(a,function(i,v){
|
|
tmp.push({
|
|
name : v.name,
|
|
url : v.url,
|
|
img : v.img,
|
|
time : v.time
|
|
});
|
|
});
|
|
|
|
tmp = tmp.sort(function (a, b) {
|
|
return (a.time > b.time) ? -1 : (a.time < b.time) ? 1 : 0 ;
|
|
});
|
|
$.each(tmp,function(i,v){
|
|
$txt += '<div class="news_company_box">\n' +
|
|
'\t\t<a href="'+v.url+'" target="_blank">\n' +
|
|
'\t\t\t<img src="'+v.img+'" style="width:55px;height:55px;">\n' +
|
|
'\t\t</a>\n' +
|
|
'\t\t<span class="companyname">\n' +
|
|
'\t\t<a href="'+v.url+'" target="_blank">\n' +v.name+
|
|
'\t\t</a>\n' +
|
|
'\t\t\t\t\t\t</span>\n' +
|
|
'\t\t<span class="companyarrow">\n' +
|
|
'\t\t<a href="javascript:remove_history(\''+v.name+'\')" target="_blank">\n' +
|
|
'\t\t\t\t\t\t\t\t<img src="/img/mobile/company_close.gif">\n' +
|
|
'\t\t</a>\n' +
|
|
'\t\t\t\t\t\t</span>\n' +
|
|
'\t</div>\n' +
|
|
'\n';
|
|
|
|
});
|
|
|
|
$txt += '\t<div style="margin:20px auto; text-align:center;">\n' +
|
|
'\t\t\t\t\t\t<span>\n' +
|
|
'\t\t\t\t\t\t\t<a href="javascript:remove_history()" class="btn btn-default br20" style="padding:10px 100px;">방문내역 삭제</a>\n' +
|
|
'\t\t\t\t\t\t</span>\n' +
|
|
'\t</div>';
|
|
|
|
$(".news_company").append($txt);
|
|
$(".news_company").show();
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<div class="news_media">
|
|
<span class="news_media_list current">
|
|
<a href="javascript:select(0,this)">
|
|
<span>
|
|
<img src="/img/mobile/direct1.png">
|
|
<p>홈</p>
|
|
</span>
|
|
</a>
|
|
</span>
|
|
|
|
|
|
<? foreach ($cat1 as $data): ?>
|
|
<span class="news_media_list">
|
|
<a href="javascript:select(<?= $data['category_code'] ?>,this)">
|
|
<span>
|
|
<img src="<?= $data['category_img'] ?>">
|
|
<p><?= $data['category_name'] ?></p>
|
|
</span>
|
|
</a>
|
|
</span>
|
|
<? endforeach ?>
|
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->where('depth', '2');
|
|
$this->db->from('main_category');
|
|
$this->db->order_by('p_category_code asc, depth asc, category_code asc');
|
|
$res = $this->db->get();
|
|
$cat2 = $res->result_array();
|
|
$cat_compare = '';
|
|
?>
|
|
|
|
<ul class="news_media3 cat2_0" style=";">
|
|
<li><a href="javascript:$('.news_media3').hide();$('.portal').hide();$('.news_company').show();" target="_blank" class="current">최근</a></li>
|
|
<li><a href="https://m.naver.com" target="_blank" class="current">네이버</a></li>
|
|
<li><a href="https://m.daum.net" target="_blank" class="current">다음</a></li>
|
|
<li><a href="http://m.nate.com" target="_blank" class="current">네이트</a></li>
|
|
|
|
<li><a href="https://m.search.naver.com/search.naver?query=%EB%82%A0%EC%94%A8&where=m&sm=mtp_hty" target="_blank" class="current">날씨</a></li>
|
|
|
|
</ul>
|
|
<?
|
|
foreach ($cat2
|
|
|
|
as $key => $data):
|
|
|
|
?>
|
|
|
|
<?
|
|
if ($data['p_category_code'] != $cat_compare): ?>
|
|
|
|
<?if ($key != 0): ?></ul><?endif;?>
|
|
<ul class="news_media3 cat2_<?= $data['p_category_code'] ?>" style="display:none;">
|
|
<?
|
|
endif ?>
|
|
<li>
|
|
<a href="javascript:select2('<?=$data['p_category_code']."-".$data['category_code']?>')" class="current"><?= $data['category_name'] ?></a>
|
|
</li>
|
|
|
|
<?if (($key + 1) == count($cat2)):?></ul><?endif ?>
|
|
<?$cat_compare = $data['p_category_code'];endforeach; ?>
|
|
<div class="news_company" style="display:block;">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('main_category_company');
|
|
$this->db->order_by('category_code1,category_code2,display_sort',"asc");
|
|
$res = $this->db->get();
|
|
$cat2 = $res->result_array();
|
|
$cat_compare = '';
|
|
foreach ($cat2 as $key => $data):
|
|
$code = $data['category_code1']."-".$data['category_code2'];
|
|
?>
|
|
|
|
|
|
<?if ($code!= $cat_compare): ?>
|
|
<?if ($key != 0): ?></div><?endif;?>
|
|
<div class="portal <?=$code?>" style="display:none;">
|
|
<?endif?>
|
|
<div class="news_media_list2"><span><a href="javascript:open_url('<?=$data['homepage']?>','<?=$data['company_name']?>','<?=$data['logo_img']?>')"><img src="<?=$data['logo_img']?>" style="width:62px;height:72px;"><p><?=$data['company_name']?></p></a></span></div>
|
|
<?if (($key + 1) == count($cat2)):?></div><?endif ?>
|
|
<?$cat_compare = $code;endforeach; ?>
|
|
|
|
|
|
<div class="banner_grace">
|
|
<!-- <a href="#"><img src="/img/mobile/banner_grace.jpg" alt="banner"></a> -->
|
|
<!-- m크맵 _바로가기 -->
|
|
<ins class="adsbygoogle"
|
|
style="display:inline-block;width:720px;height:74px"
|
|
data-ad-client="ca-pub-7071495522658800"
|
|
data-ad-slot="5412203153"></ins>
|
|
<script>
|
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
|
</script>
|
|
</div>
|
|
|
|
|
|
|