var RioGrande = { config: { sbt_u:'http://api.sbt.com.br', sbt_v:'2.0.1', sbt_k:'AE8C984EECBA4F7F835C585D5CB6AB4B', diretorio:'tv/portoalegre/sbtriograndesegundaedicao', cod_site:'458', cod_site_regional:'297', sbt_idS_Videos:'211', sbt_idS:'273', sbt_idSA_Home:'1491', sbt_idSA_Videos:'1068', sbt_idSA_Sobre:'1492', sbt_idSA_Apresentador:'1493', sbt_idSA_Quadros:'1494', sbt_idP_Videos:'6160', sbt_idP_Topo:'6156', sbt_idP_VideoRegional: '297', sbt_idP_ChannelRegional: '6325', }, getPgmHorario: function(container, site){ SBTAPI.getProgram('showtimes',{ id:site, limit:1, sort:"desc" },function(json){ var retorno; if( json.programs ){ var showtimes = json.programs[0].showtimes; var horarios = showtimes; if( showtimes != '' ){ showtimes = showtimes.split(" - "); if(Array.isArray(showtimes) && showtimes.length > 1){ var itemDiario; for(i=0;i < showtimes.length;i++){ itemDiario = showtimes[i].split('|'); if(itemDiario.length == 2){ $(container).append('
'+ itemDiario[0] +'|'+ itemDiario[1] +'
'); } } }else{ $(container).append('
'+ horarios +'
'); } } } },{v: this.config.sbt_v,u: this.config.sbt_u,k: this.config.sbt_k}); }, getDestaqueTopo: function(container){ var config = this.config; SBTAPI.getMedia('title,author,image,description',{ idsite: this.config.sbt_idS, idSiteArea: this.config.sbt_idSA_Home, idPlaylist: this.config.sbt_idP_Topo, limit:100, orderBy:"ordem", sort:"desc" },function(json){ if( json.medias ){ var title, lnk, img; var cssmargin = ''; $.each(json.medias, function(i,item){ title = item.title; lnk = item.author; img = item.image; desc = item.description; $(".destaqueTopo").append('
'+ title +'

'+ title +'

'+ desc +'

'); }); if(json.medias.length == 1){ $('.destaqueTopo .slidesjs-pagination').hide(); $('.destaqueTopo h3').hide(); $('.destaqueTopo p').hide(); }else{ $(".destaqueTopo").slidesjs({height: 315, navigation:{ active:true, effect:"fade" }}); } } },{v: this.config.sbt_v,u: this.config.sbt_u,k: this.config.sbt_k}); }, getVideosHome: function(){ var config = this.config; SBTAPI.getVideo('id,thumbnailsite,thumbnail,title',{ program:this.config.sbt_idP_VideoRegional, category:this.config.sbt_idP_ChannelRegional, limit:20, orderBy:"publishDate", sort:"desc" },function(json){ if( json.videos ){ var idMedia, titleMedia, thumbMedia, linkVideo; $.each(json.videos, function(i,item){ idMedia = item.id; titleMedia = item.title; thumbMedia = (item.thumbnailsite == '')?item.thumbnail:item.thumbnailsite; linkVideo = SBTAPI.makeLinkPageHTML ('http://www.sbt.com.br/'+ config.diretorio +'/sbtvideos/categoria/0/', idMedia, titleMedia); $("
  • ").addClass("BOX W222 H127 POSREL OH").append('
    ').appendTo(".ContentVideos ul"); if(i == (json.videos.length-1)){ $('.playlistVideos .carousel-navigation').jcarousel(); $('.playlistVideos .prev-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '-=5'}); $('.playlistVideos .next-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '+=5'}); } }); } },{v: config.sbt_v,u: config.sbt_u,k: config.sbt_k}); }, getSobre: function(container){ var config = this.config; SBTAPI.getMedia('title,description',{ idsite: this.config.sbt_idS, idSiteArea: this.config.sbt_idSA_Sobre, limit:1, orderBy:"ordem", sort:"desc" },function(json){ if( json.medias ){ var title, lnk; $.each(json.medias, function(i,item){ title = item.title.toString(); desc = item.description.toString(); $(".DescriptionProgram").append('

    '+ title +'

    '+ desc +'
    '); return false; }); } },{v: this.config.sbt_v,u: this.config.sbt_u,k: this.config.sbt_k}); }, getApresentador: function(container){ var config = this.config; SBTAPI.getMedia('title,description,author,image',{ idsite: this.config.sbt_idS, idSiteArea: this.config.sbt_idSA_Apresentador, limit:2, orderBy:"ordem", sort:"desc" },function(json){ if( json.medias ){ var title, desc, thumb, nameap; $.each(json.medias, function(i,item){ desc = item.description.toString(); nameap = item.author.toString(); imagem = item.image; $(".DescriptionApresentador").append(''+ desc +''); return false; }); } },{v: this.config.sbt_v,u: this.config.sbt_u,k: this.config.sbt_k}); }, getQuadrosFull: function(container,page){ var config = this.config; var rpp = 9; var totalRegistros = 0; var totalPages = 0; SBTAPI.getMedia('id,title,thumbnail,total',{ idsite: this.config.sbt_idS, idSiteArea: this.config.sbt_idSA_Quadros, limit:rpp, page:(page-1), orderby:"ordem", sort:"desc" },function(json){ var id, title, thumb, desc, video, cssItem; if (json.medias){ $.each(json.medias, function(i,item){ id = item.id.toString(); title = item.title.toString(); thumb = item.thumbnail.toString(); video = ""; cssItem = ((i+4)%3 == 0)?'MR0':''; $('
  • ').attr({'class':'BOX BOXSIZING W300 H250 MB20 CP OH POSREL BS '+ cssItem +' '}).append('

    '+ title +'

    ').appendTo(container +' ul'); totalRegistros = parseInt(item.total); }); $('.paginator').SBTPaginator({ totalRegistros : parseInt(totalRegistros), registrosPorPagina : parseInt(rpp), paginaAtual : parseInt(page), tamanhoRegua : 9 }); } },{v: this.config.sbt_v,u: this.config.sbt_u,k: this.config.sbt_k}); }, getCarouselQuadros: function(container, idQuadro){ var config = this.config; SBTAPI.getMedia('id,title,thumbnail',{ idsite: config.sbt_idS, idSiteArea: config.sbt_idSA_Quadros, limit: 100, orderBy: "ordem", sort: "asc" },function(json){ if(json.medias){ var idMedia, titleMedia, thumbMedia, classCSS, jcarouselQuadros; var activeItem = 0; $.each(json.medias, function(i,item){ idMedia = item.id; titleMedia = item.title; thumbMedia = item.thumbnail; classCSS = ''; if(idMedia == idQuadro || ( idQuadro == '' && i == 0 )){ classCSS = 'active'; activeItem = i; } $('
  • ').appendTo(container + ' ul'); if(i == (json.medias.length - 1)){ $(container +' .carousel-navigation').jcarousel(); $(container +' .prev-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '-=4'}); $(container +' .next-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '+=4'}); var itensQuadros = $(container +' .carousel-navigation').data('jcarousel'); itensQuadros.scroll(activeItem); activeItem = 0; } }); } },{v: config.sbt_v,u: config.sbt_u,k: config.sbt_k}); }, getQuadrosIntegra: function(container, idQuadro){ var containerVideos = '.VideosQuadros'; var config = this.config; SBTAPI.getMedia('title,description,author',{ id: idQuadro, idsite: config.sbt_idS, idSiteArea: config.sbt_idSA_Quadros, limit: 1, orderBy:"startdate", sort:"desc" },function(jm){ if( jm.medias ){ var titleQu, descQu, idCategory; titleQu = jm.medias[0].title.toString(); descQu = jm.medias[0].description.toString(); idCategory = jm.medias[0].author; /* ----- verifica galeria -----*/ tmpNoticiaArr = getGallerySBT(descQu); $(container).append(''+ titleQu +'
    '+ tmpNoticiaArr[1] +'
    '); if(tmpNoticiaArr[0]){eval(tmpNoticiaArr[2]);} } console.log(idCategory); /* ----------- LOAD VIDEOS EPISODIOS -------- */ SBTAPI.getVideo('id,title,thumbnail',{ program: config.cod_site_regional, category: idCategory, limit: 100, orderBy: "publishdate", sort: "desc" },function(j){ if(idCategory != ""){ if( j.videos ){ $('.contentVideosQuadros').append('
    Vídeos
    '); var idVideo, titleVideo, thumbVideo, linkVideo; $.each(j.videos, function(k,video){ idVideo = video.id; titleVideo = video.title; thumbVideo = Trim(video.thumbnail); linkVideo = 'http://www.sbt.com.br/'+ config.diretorio +'/sbtvideos/categoria/'+ idCategory +'/'+ idVideo +'/'+ titleVideo +'.html'; $(containerVideos +" ul").append('
  • '+ titleVideo +'
  • '); if(k == (j.videos.length - 1)){ $(containerVideos +" .btnVerVideo").click(function(){ tb_show('Video','video.asp?id='+ $(this).attr("rel")+'&title='+ $(this).attr("title") +'TB_iframe=false&widht=960&height=470&modal=true'); }); var jcarousel= $(containerVideos +' .carousel-navigation').jcarousel(); $(containerVideos +' .prev-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '-=3'}); $(containerVideos +' .next-navigation') .on('jcarouselcontrol:active', function(){$(this).removeClass('inactive');}) .on('jcarouselcontrol:inactive', function(){$(this).addClass('inactive');}) .jcarouselControl({target: '+=3'}); jcarousel.jcarousel('reload'); } }); } } },{v: config.sbt_v,u: config.sbt_u,k: config.sbt_k}); },{v: config.sbt_v,u: config.sbt_u,k: config.sbt_k}); } }