/* Js for https://xiangyunkj.com/article/catalog-online-22.html, Version=1680066312 */
v.objectType = "article";;v.objectID = 22;;v.showDetail = "\u663e\u793a\u5168\u90e8";;v.hideDetail = "\u6536\u8d77";;$(document).ready(function()
{
$.setAjaxForm('#commentForm', function(response)
{
if(response.result == 'success')
{
setTimeout(function()
{
var link = createLink('message', 'comment', 'objecType=' + v.objectType + '&objectID=' + v.objectID);
$('#commentForm').closest('#commentBox').load(link, location.href="#first");
},
1000);
}
else
{
if(response.reason == 'needChecking')
{
$('#captchaBox').html(Base64.decode(response.captcha)).show();
}
}
});
$('#pager').find('a').click(function()
{
$('#commentBox').load($(this).attr('href'));
return false;
});
$('a[id*=reply]').modalTrigger();
/* Process contents. */
$('.content-detail').each(function()
{
var obj = $(this);
if(obj.height() > 100)
{
var buttons = "<" + "a href='javascript:void(0)' onclick='showDetail(this)' class='showDetail'> ... " + v.showDetail + "";
buttons += "<" + "a href='javascript:void(0)' onclick='hideDetail(this)' class='hideDetail'> " + v.hideDetail + "";
obj.parent().append(buttons);
obj.parent().find('.hideDetail').hide();
obj.addClass('content-abstract');
}
});
});
function showDetail(obj)
{
var tdContent = $(obj).parents('.td-content');
tdContent.find('.content-detail').removeClass('content-abstract');
tdContent.find('.showDetail').hide();
tdContent.find('.hideDetail').show();
}
function hideDetail(obj)
{
var tdContent = $(obj).parents('.td-content');
tdContent.find('.content-detail').addClass('content-abstract');
tdContent.find('.showDetail').show();
tdContent.find('.hideDetail').hide();
}
$(document).ready(function()
{
$('#pager').find('a').click(function()
{
if(v.objectType == 'order') $('#commentForm').closest('.modal-body').load($(this).attr('href'));
if(v.objectType != 'order') $('#commentForm').closest('#commentBox').load($(this).attr('href'));
return false;
});
/* Process contents. */
$('.content-detail').each(function()
{
var obj = $(this);
if(obj.height() > 100)
{
var buttons = " ... " + v.showDetail + "";
buttons += " " + v.hideDetail + "";
obj.parent().append(buttons);
obj.parent().find('.hideDetail').hide();
obj.addClass('content-abstract');
}
});
});
function showDetail(obj)
{
var tdContent = $(obj).parents('.td-content');
tdContent.find('.content-detail').removeClass('content-abstract');
tdContent.find('.showDetail').hide();
tdContent.find('.hideDetail').show();
}
function hideDetail(obj)
{
var tdContent = $(obj).parents('.td-content');
tdContent.find('.content-detail').addClass('content-abstract');
tdContent.find('.showDetail').show();
tdContent.find('.hideDetail').hide();
}
;(function(root, factory, plug)
{
factory(root.jQuery, plug);
})(window, function($, plug) {
var __PROTOTYPE__ =
{
_init: function()
{
this.scrollTop = 0;
this._top = this.offset().top;
this._bottom = this._top + this.height();
this.winHeight = $(window).height();
this.bodyHeight = $('body').height();
},
_addAction: function()
{
var _this = this;
var elementLength = _this.length;
//init 当页面加载 将可视区域的内容add class
_this.each(function (index, element)
{
scrollTop = 0;
var elementTop = $(element).offset().top;
elementBottom = elementTop + $(element).height();
if(elementTop < _this.winHeight)
{
$(element).addClass('animated ' + _this.animated);
//add animate parameter
if(elementLength > 1)
{
this.duration = _this.duration;
this.delay = parseInt(_this.delay) + index / 2;
}
}
$(document).on('scroll', function ()
{
_this.scrollTop = $(window).scrollTop();
var elementTop = $(element).offset().top;
if(elementTop < _this.winHeight + _this.scrollTop)
{
console.log('in +height')
$(element).addClass('animated ' + _this.animated );
//滚动距离大于 bottom 高度 remove class
if(elementBottom < _this.scrollTop)
{
console.log('in bottom')
$(element).removeClass('animated ' + _this.animated );
}
}else{
console.log('in else')
$(element).removeClass('animated ' + _this.animated );
}
});
$(this).css(
{
'-webkit-animation-duration': this.duration + 's',
'animation-duration': this.duration + 's',
"-webkit-animation-delay": this.delay + 's',
"animation-delay": this.delay + 's',
});
})
}
};
var __DEFAULTS__ =
{
animated : "bounce",
delay : '0',
duration : '2'
};
$.fn[plug] = function(options)
{
$.extend(this, __PROTOTYPE__, __DEFAULTS__, options);
this._init();
this._addAction();
return this;
}
}, "themeAnimation");
// $().ready(function(){
// bodyHeight = parseInt($('body').height());
// windowHeight = parseInt($(document).height());
// if(bodyHeight < windowHeight)
// {
// $('.all-bottom').css('margin-top', windowHeight - bodyHeight);
// }
// });
$().ready(function(){
bodyHeight = parseInt($('body').height());
windowHeight = parseInt($(document).height());
if(bodyHeight < windowHeight)
{
$('.all-bottom').css('margin-top', windowHeight - bodyHeight);
}
});
//nav hover event
;(function (){
$('#header .nav').children().hover(function (){
$(this).addClass('open').siblings().removeClass('open');
},function(){
$(this).removeClass('open');
});
})();