mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
자바스크립트를 JS파일으로 옮김
This commit is contained in:
parent
eac58afa39
commit
4ce0b5139c
2 changed files with 83 additions and 88 deletions
82
widgets/login_info/skins/ncenter_login/js/ncenter.js
Normal file
82
widgets/login_info/skins/ncenter_login/js/ncenter.js
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
//<![CDATA[
|
||||
(function ($) {
|
||||
$(function () {
|
||||
function setCookie(n, v, d) {
|
||||
var e = "";
|
||||
if (d) {
|
||||
var dt = new Date();
|
||||
dt.setTime(dt.getTime() + (d * 24 * 60 * 60000));
|
||||
e = "; expires=" + dt.toGMTString();
|
||||
}
|
||||
document.cookie = n + "=" + v + e + "; path=/";
|
||||
}
|
||||
|
||||
var n = $('#nc_container');
|
||||
$('.close', n).click(function () {
|
||||
setCookie('_ncenterlite_hide_id', '{$ncenterlite_latest_notify_id}', 1);
|
||||
n.hide().next('div').hide();
|
||||
return false;
|
||||
});
|
||||
$('.readall', n).click(function () {
|
||||
exec_xml('ncenterlite', 'procNcenterliteNotifyReadAll');
|
||||
$('.close', n).triggerHandler('click');
|
||||
return false;
|
||||
});
|
||||
$('a.notify', n).click(function () {
|
||||
$('.list', n).toggle();
|
||||
$('.readall', n).toggle();
|
||||
return false;
|
||||
});
|
||||
$(document).click(function (e) {
|
||||
var t = $(e.target);
|
||||
if (!t.is('#nc_container') && t.parents('#nc_container').length == 0) {
|
||||
if ($('.list', n).is(':visible')) {
|
||||
$('.list', n).hide();
|
||||
$('.readall', n).hide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var $listWrap = $('.list ul', n);
|
||||
var $btnMore = $('.more', n);
|
||||
$btnMore.click(function () {
|
||||
var page = $(this).data('page');
|
||||
var $item_html = $('<li><a><span class="msg"></span><span class="ago"></span></a></li>');
|
||||
var $profileImg = $('<img class="nc_profile_img" alt="" />');
|
||||
$.exec_json('ncenterlite.getMyNotifyListTpl', {'page': page}, function (ret) {
|
||||
if (!ret.list.data) return;
|
||||
|
||||
for (var i in ret.list.data) {
|
||||
if (ret.list.data.hasOwnProperty(i)) {
|
||||
var item = ret.list.data[i];
|
||||
var $html = $item_html.clone();
|
||||
if (ret.useProfileImage == 'Y') {
|
||||
var $img = $profileImg.clone();
|
||||
if (!item.profileImage) item.profileImage = request_uri + 'modules/ncenterlite/skins/default/img/p.png';
|
||||
$img.attr('src', item.profileImage);
|
||||
$html.find('a').prepend($img);
|
||||
}
|
||||
|
||||
$('span.msg', $html).html(item.text);
|
||||
$('span.ago', $html).html(item.ago);
|
||||
$('a', $html).attr('href', item.url);
|
||||
|
||||
if (i == 0) $html.attr('id', 'ncenterlite_page_' + ret.list.page.cur_page);
|
||||
$listWrap.append($html);
|
||||
}
|
||||
}
|
||||
|
||||
$listWrap.animate({scrollTop: (ret.list.page.cur_page - 1) * 265}, 800);
|
||||
|
||||
if (ret['list'].page.total_page <= ret.list.page.cur_page) {
|
||||
$btnMore.remove();
|
||||
}
|
||||
}, ['list']);
|
||||
|
||||
$(this).data('page', ++page);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
//]]>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<load target="./css/ncenter.css" />
|
||||
<load target="./js/ncenter.js" type="body" />
|
||||
|
||||
<div id="nc_container" {$ncenterlite_zindex}>
|
||||
<ul class="nc_memu">
|
||||
|
|
@ -56,91 +57,3 @@
|
|||
<a cond="$ncenterlite_page_navigation->total_count > 5" class="more" href="#" data-page="2">{$lang->ncenterlite_more}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
(function($){
|
||||
$(function(){
|
||||
function setCookie(n, v, d){
|
||||
var e = "";
|
||||
if(d){ var dt=new Date(); dt.setTime(dt.getTime() + (d*24*60*60000)); e="; expires=" + dt.toGMTString(); }
|
||||
document.cookie = n + "=" + v + e + "; path=/";
|
||||
}
|
||||
|
||||
var n = $('#nc_container');
|
||||
$('.close',n).click(function(){
|
||||
setCookie('_ncenterlite_hide_id', '{$ncenterlite_latest_notify_id}', 1); n.hide().next('div').hide(); return false;
|
||||
});
|
||||
$('.readall',n).click(function(){
|
||||
exec_xml('ncenterlite', 'procNcenterliteNotifyReadAll'); $('.close',n).triggerHandler('click'); return false;
|
||||
});
|
||||
$('a.notify',n).click(function(){
|
||||
$('.list',n).toggle(); $('.readall',n).toggle(); return false;
|
||||
});
|
||||
$(document).click(function(e){
|
||||
var t = $(e.target);if(!t.is('#nc_container') && t.parents('#nc_container').length == 0){ if($('.list', n).is(':visible')) { $('.list',n).hide(); $('.readall',n).hide(); return false; } }
|
||||
});
|
||||
|
||||
var $listWrap = $('.list ul',n);
|
||||
var $btnMore = $('.more',n);
|
||||
$btnMore.click(function(){
|
||||
var page = $(this).data('page');
|
||||
var $item_html = $('<li><a><span class="msg"></span><span class="ago"></span></a></li>');
|
||||
var $profileImg = $('<img class="nc_profile_img" alt="" />');
|
||||
$.exec_json('ncenterlite.getMyNotifyListTpl', { 'page':page }, function(ret) {
|
||||
if(!ret.list.data) return;
|
||||
|
||||
for(var i in ret.list.data)
|
||||
{
|
||||
if(ret.list.data.hasOwnProperty(i))
|
||||
{
|
||||
var item = ret.list.data[i];
|
||||
var $html = $item_html.clone();
|
||||
if(ret.useProfileImage == 'Y')
|
||||
{
|
||||
var $img = $profileImg.clone();
|
||||
if(!item.profileImage) item.profileImage = request_uri + 'modules/ncenterlite/skins/default/img/p.png';
|
||||
$img.attr('src', item.profileImage);
|
||||
$html.find('a').prepend($img);
|
||||
}
|
||||
|
||||
$('span.msg', $html).html(item.text);
|
||||
$('span.ago', $html).html(item.ago);
|
||||
$('a', $html).attr('href', item.url);
|
||||
|
||||
if(i == 0) $html.attr('id', 'ncenterlite_page_' + ret.list.page.cur_page);
|
||||
$listWrap.append($html);
|
||||
}
|
||||
}
|
||||
|
||||
$listWrap.animate({scrollTop: (ret.list.page.cur_page-1) * 265}, 800);
|
||||
|
||||
if(ret['list'].page.total_page <= ret.list.page.cur_page)
|
||||
{
|
||||
$btnMore.remove();
|
||||
}
|
||||
}, ['list']);
|
||||
|
||||
$(this).data('page', ++page);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
<block cond="!Mobile::isFromMobilePhone()">
|
||||
function sc() {
|
||||
var wh = $(window).height();
|
||||
var l = $('#nc_container .list');
|
||||
if (l.height() + 100 >= wh) {
|
||||
l.height(wh - 98).addClass('listscroll');
|
||||
} else {
|
||||
l.height('auto').removeClass('listscroll');
|
||||
}
|
||||
setTimeout(sc, 100);
|
||||
}
|
||||
sc();
|
||||
</block>
|
||||
|
||||
|
||||
})(jQuery);
|
||||
//]]>
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue