jQuery.fn.accessNews = function( settings ) { settings = jQuery.extend({ headline : "", speed : "slow", slideBy : 2, image_display : "left", headline_bgcolor : "", headline_bgcolor_selected : "", headline_bgimage : "", pl_textcolor : "", pl_textcolor_selected : "", headline_bgimage_selected : "", tb_use_style: 1, tb_bgcolor: "", tb_bgimg: "", tb_fontcolor: "", tb_fontface: "", tb_fontstyle: "", tb_fontsize: "", click_wholestory: 0, headline_number:4 }, settings); return this.each(function() { jQuery.fn.accessNews.run( jQuery( this ), settings ); }); }; jQuery.fn.accessNews.run = function( $this, settings ) { jQuery( ".javascript_css", $this ).css( "display", "none" ); var ul = jQuery( "ul:eq(0)", $this ); var li = ul.children(); var current = 1; if ( li.length <= settings.headline_number ) {jQuery(".back").remove();jQuery(".next").remove(); }; var $next = jQuery( ".next > a", $this ); var $back = jQuery( ".back > a", $this ); var liWidth = jQuery( li[0] ).width(); var animating = false; ul.css( "width", ( li.length * liWidth ) ); $next.click(function() { if ( !animating ) { animating = true; offsetLeft = parseInt( ul.css( "left" ) ) - ( liWidth * settings.slideBy ); if ( offsetLeft + ul.width() > 0 ) { current++; jQuery('.count').html( settings.headline + " " + (((current * settings.slideBy) - settings.slideBy) + 1) + " - "+ ((current * settings.slideBy) > li.length ? li.length:(current * settings.slideBy)) + " of " + li.length); $back.show(); ul.animate({ left: offsetLeft }, settings.speed, function() { if ( parseInt( ul.css( "left" ) ) + ul.width() <= liWidth * settings.slideBy ) { } animating = false; }); } else { animating = false; ul.hide(); ul.css("left",-(ul.width())) ul.show(); ul.animate({ left:0 }, settings.speed,function(){ current = 1; jQuery('.count').html( settings.headline + " " + (((current * settings.slideBy) - settings.slideBy) + 1) + " - "+ current * settings.slideBy + " of " + li.length); animating=false; }); } } return false; }); $back.click(function() { // start of back.click if ( !animating ) { animating = true; offsetRight = parseInt( ul.css( "left" ) ) + ( liWidth * settings.slideBy ); if ( offsetRight + ul.width() <= ul.width() ) { current--; if(current !== 1) { jQuery('.count').html( settings.headline + " " + ((current * settings.slideBy) - settings.slideBy) + " - " + current * settings.slideBy + " of " + li.length); } else { jQuery('.count').html( settings.headline + " " + (((current * settings.slideBy) - settings.slideBy) + 1) + " - "+ current * settings.slideBy + " of "+ li.length); } // end of back.click $next.show(); ul.animate({ left: offsetRight }, settings.speed, function() { if ( parseInt( ul.css( "left" ) ) == 0 ) { } animating = false; }); } else { animating = false; } } return false; }); $next.show(); jQuery(".description").hide(); jQuery('#list').before( [ "
", "
" ].join( "" ) ); //jQuery('#list').before( [ "
", " total
" ].join( "" ) ); if (settings.headline_bgcolor != '') { $(li).css('backgroundColor', '#' + settings.headline_bgcolor); jQuery('.view_all').css('backgroundColor', '#' + settings.headline_bgcolor); } if (settings.headline_bgimage != '') { var hlbgimg='url(' + settings.headline_bgimage + ')'; jQuery('.view_all').css('background-image', hlbgimg); jQuery('.view_all').css('background-repeat', 'repeat'); jQuery('.view_all').css('background-position', 'top left'); jQuery('.view_all').css('backgroundColor', 'transparent'); } if (settings.pl_textcolor != '') { jQuery('#RWDMashup_PreviewContentSlider ul#list li p a.title').css('color', '#' + settings.pl_textcolor); } if (settings.pl_textcolor_selected != '') { jQuery('#RWDMashup_PreviewContentSlider ul li:eq(0) p a.title').css('color', '#' + settings.pl_textcolor_selected); } if ( li.length > settings.headline_number ){ jQuery('.count').html( settings.headline + " " + (((current * settings.slideBy) - settings.slideBy) + 1) + " - "+ current * settings.slideBy + " of "+ li.length); }else{ jQuery('.count').html( settings.headline + " " + (((current * settings.slideBy) - settings.slideBy) + 1) + " - "+ li.length + " of "+ li.length); } jQuery(".next").prependTo('.view_all'); jQuery(".back").prependTo('.view_all'); if (settings.tb_use_style == 0) { /* If there is no title on RWD form, view_all will be turned into title instead.*/ if (settings.tb_bgimg != '') { jQuery('.view_all').css('background-image', settings.tb_bgimg); jQuery('.view_all').css('background-repeat', 'repeat-x'); jQuery('.view_all').css('background-color', 'transparent'); }else{ jQuery('.view_all').css('background-color', '#' + settings.tb_bgcolor); } jQuery('.view_all .count').css('color', '#' + settings.tb_fontcolor); jQuery('.view_all .back a').css('color', '#' + settings.tb_fontcolor); jQuery('.view_all .next a').css('color', '#' + settings.tb_fontcolor); jQuery('.view_all .count').css('font-Size', settings.tb_fontsize); jQuery('.view_all .back a').css('font-Size', settings.tb_fontsize); jQuery('.view_all .next a').css('font-Size', settings.tb_fontsize); jQuery('.view_all .count').css('font-face', settings.tb_fontface); jQuery('.view_all .back a').css('font-face', settings.tb_fontface); jQuery('.view_all .next a').css('font-face', settings.tb_fontface); } var date = jQuery('
'); var firstimg = jQuery( "ul li:eq(0) img", $this ); switch(settings.image_display) { case "right": story_img_style=' style="float:right;margin-left:5px;margin-right:5px"'; break; case "left": story_img_style=' style="float:left;margin-right:5px;margin-left:5px"'; break; case "top": story_img_style=""; break; default: story_img_style=""; } img = jQuery('') img.appendTo("#container"); img.attr('src', firstimg.attr('src')); para = jQuery('
'); para.appendTo("#container"); var firstli = jQuery("#RWDMashup_PreviewContentSlider ul li:eq(0)"); if (settings.click_wholestory == 0) { para.html("

" + jQuery('p.description', firstli).html() + "

"); }else{ var fb_URL=jQuery('#mu_fcs_bpt', firstli).text(); $("#RWDMashup_PreviewContentSlider #container").load(fb_URL, 'plugin=RWDMashup_PreviewContentSlider&templates=bodypart&formid=96'); } firstli.addClass('selected'); if (settings.headline_bgimage_selected != '') { var hlbgimg_selected='url(' + settings.headline_bgimage_selected + ')'; firstli.css('background-image', hlbgimg_selected); firstli.css('background-repeat', 'no-repeat'); firstli.css('background-position', 'bottom center'); firstli.css('backgroundColor', 'transparent'); } if (settings.headline_bgcolor_selected != '') { firstli.css('backgroundColor', '#' + settings.headline_bgcolor_selected); } if (settings.click_wholestory == 0) { li.hover( function () { li.removeClass('selected'); if (settings.headline_bgimage != '') { var hlbgimg='url(' + settings.headline_bgimage + ')'; $(li).css('background-image', hlbgimg); $(li).css('background-repeat', 'no-repeat'); $(li).css('background-position', 'bottom center'); $(li).css('backgroundColor', 'transparent'); }else{ $(li).css('backgroundColor', '#' + settings.headline_bgcolor); $(li).css('background-image', 'none'); } if (settings.pl_textcolor != '') { jQuery('#RWDMashup_PreviewContentSlider ul#list li p a.title').css('color', '#' + settings.pl_textcolor); } var current = jQuery(this); current.addClass('selected'); img.attr('src', current.find('img').attr('src')); para.html("

" + jQuery('.description', current).html() + "

"); if (settings.pl_textcolor_selected != '') { jQuery('#RWDMashup_PreviewContentSlider ul#list li.selected p a.title').css('color', '#' + settings.pl_textcolor_selected); } if (settings.headline_bgimage_selected != '') { var hlbgimg_selected='url(' + settings.headline_bgimage_selected + ')'; current.css('background-image', hlbgimg_selected); current.css('background-repeat', 'no-repeat'); current.css('background-position', 'bottom center'); current.css('backgroundColor', 'transparent'); }else{ current.css('background-image', 'none'); if (settings.headline_bgcolor_selected != '') { current.css('backgroundColor', '#' + settings.headline_bgcolor_selected); } } }, function () { current.parent().css('backgroundColor', '#' + settings.headline_bgcolor); } ); // li.hover } // settings.click_wholestory == 0 if (settings.click_wholestory != 0) { li.click( function () { li.removeClass('selected'); if (settings.headline_bgimage != '') { var hlbgimg='url(' + settings.headline_bgimage + ')'; $(li).css('background-image', hlbgimg); $(li).css('background-repeat', 'no-repeat'); $(li).css('background-position', 'bottom center'); $(li).css('backgroundColor', 'transparent'); }else{ $(li).css('backgroundColor', '#' + settings.headline_bgcolor); $(li).css('background-image', 'none'); } if (settings.pl_textcolor != '') { jQuery('#RWDMashup_PreviewContentSlider ul#list li p a.title').css('color', '#' + settings.pl_textcolor); } var current = jQuery(this); current.addClass('selected'); fb_URL=jQuery('#mu_fcs_bpt', current).text(); $("#RWDMashup_PreviewContentSlider #container").load(fb_URL, 'plugin=RWDMashup_PreviewContentSlider&templates=bodypart&formid=96'); if (settings.pl_textcolor_selected != '') { jQuery('#RWDMashup_PreviewContentSlider ul#list li.selected p a.title').css('color', '#' + settings.pl_textcolor_selected); } if (settings.headline_bgimage_selected != '') { var hlbgimg_selected='url(' + settings.headline_bgimage_selected + ')'; current.css('background-image', hlbgimg_selected); current.css('background-repeat', 'no-repeat'); current.css('background-position', 'bottom center'); current.css('backgroundColor', 'transparent'); }else{ current.css('background-image', 'none'); if (settings.headline_bgcolor_selected != '') { current.css('backgroundColor', '#' + settings.headline_bgcolor_selected); } } } ) // li.click } //settings.click_wholestory != 0 }