Orbit/app/assets/javascripts/kernel.js

82 lines
2.1 KiB
JavaScript
Raw Normal View History

var banners = [];
var banner_index = 0;
$(document).ready(function() {
$.each($(".dymanic_load"),function(){
if($(this).attr("path")==''){
$(this).html("App setting Failed");
}else{
// Check if this App is AD_Banner
if($(this).attr("path").indexOf("show_banner")>0){
ajax_load_proc($(this),$(this).attr("path"),"true");
}else{
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
2011-12-23 10:34:21 +00:00
}
}
2011-12-23 10:34:21 +00:00
});
$("#main_content").addClass("module");
});
function ajax_load_proc(wapper,url,isBanner){
2012-12-24 07:22:26 +00:00
$.get(encodeURI(url), {}, function(respText,textSta,XML){
if (textSta == 'success') {
if(isBanner=="true"){
wapper.html(respText);
2013-10-18 07:25:19 +00:00
$( '.cycle-slideshow' ).cycle();
// var banner = banners[banner_index];
// $(banner.banner_name+" > img").each(function(){
// $(this).load(function(){banner.image_loaded++; });
// });
// BannerCycle(banner_index);
// banner_index++;
// $( '.cycle-slideshow' ).cycle();
}else{
wapper.html(respText);
}
};
if(textSta == 'error')
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
2011-12-23 10:34:21 +00:00
});
}
2012-02-27 09:48:30 +00:00
function BannerCycle(banner_index){
var banner = banners[banner_index];
// Wait untill all images are loaded
2013-10-18 07:25:19 +00:00
// console.log(banner.image_loaded, $(banner.banner_name+" img").length, banners[banner_index])
if (banner.image_loaded==$(banner.banner_name+" img").length){
2013-10-18 07:25:19 +00:00
$(banner.banner_name).cycle({
fx: banner.banner_fx,
2013-10-18 07:25:19 +00:00
timeout: banner.timeout,
pager: banner.banner_pager,
2013-10-18 07:25:19 +00:00
speed: banner.banner_speed,
fit: 1,
containerResize: 0,
width: banner.banner_width,
height: banner.banner_height,
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
});
}else{
2013-10-18 07:25:19 +00:00
setTimeout("BannerCycle("+banner_index+")",100);
}
}
2012-02-27 09:48:30 +00:00
$(document).ready(function() {
2013-10-18 07:25:19 +00:00
$(document).on('click', '.cycle-slideshow img', function()
{
2012-08-13 03:03:11 +00:00
if($(this).attr('link_url')!='')
{
2012-08-13 03:03:11 +00:00
if($(this).attr('link_open')=='new_window')
{
window.open($(this).attr('link_url'));
}
2012-08-13 03:03:11 +00:00
else
{
document.location.href=$(this).attr('link_url')
}
2012-08-13 03:03:11 +00:00
}
})
});
2012-02-19 09:43:47 +00:00
// Ad Banner FX code [end]