PageSourceSearch

https://www.rtve.es/pages/pf-portada/2.25.1/js/userFavor/UserFavor.js

js rtve.es collected 2026-10-01 06:57:11 UTC 2,221 bytes, 1 lines download raw bytes

1define(["vendor/jquery","core/core_library","vendor/jstorage","userFavor/Utils"],function(t,a,e,r){var o=a.ProJS.Class.extend({host:"MyHost",myFavo:{key:"MyFav",url:"/usuarios/allmyfavo/",url_op:"/usuarios/myfavo/{idItem}"},contenido:{url_programa:"/api/programas/{idItem}.json"},usuario:{infantil:"CHILD"},init:function(){},estaUsuarioLogado:function(){return(document.cookie||"").indexOf("Username=")>-1},usuarioLogadoAdulto:function(){return window.RTVE.user.cPerfil!==this.usuario.infantil},getMyFavo:function(t){return this._getData(this.myFavo.key,this.myFavo.url,t)},addToMyFavor:function(t,a){var o=this,i=o.myFavo.url_op;r.fetchJsonDataPost(i.replace("{idItem}",t.id),"PUT",function(r,i){if(r)return a(r);var n=e.get(o.myFavo.key);return n.keyArray.splice(0,0,t.id),n.valArray.splice(0,0,t),e.set(o.myFavo.key,n),a(null)})},deleteFromMyFavor:function(t,a){var o=this,i=o.myFavo.url_op;r.fetchJsonDataPost(i.replace("{idItem}",t),"DELETE",function(r,i){if(r)return a(r);var n=e.get(o.myFavo.key),u=o._getItemMyFavo(t,n.keyArray,!0),s=o._getItemMyFavo(t,n.valArray,!1);return n.keyArray.splice(u,1),n.valArray.splice(s,1),e.set(o.myFavo.key,n),a(null)})},_getData:function(t,a,o){var i=e.get(t),n=this;if(i)return o(null,i);r.fetchJsonData(a,function(a,r){return a?o(a):(e.set(t,r),e.set(n.host,window.location.hostname),o(null,r))})},_getItemMyFavo:function(t,a,e){for(var r=a.length,o=-1,i=0;i<r;i++)if(e){if(parseInt(a[i])===parseInt(t)){o=i;break}}else if(parseInt(a[i].id)===parseInt(t)){o=i;break}return o},isItemMyFavor:function(t,a){var e=this;e._getData(this.myFavo.key,this.myFavo.url,function(r,o){return r?a(r):a(null,-1!==e._getItemMyFavo(t,o.keyArray,!0))})},getProgramaApi:function(t,a){var e=this,o=e.contenido.url_programa;r.fetchJsonData(o.replace("{idItem}",t),function(e,r){if(e)return 404!==e.status?a(null,null):a(e);var o={id:t,status:null,title:r.page.items[0].shortTitle,url:r.page.items[0].htmlUrl};return a(null,o)})},activeFavor:function(){var a=this;t(".ico.favor>a").each(function(e,r){a.isItemMyFavor(t(r).data("id"),function(a,e){!a&&e&&(t(r).parent().addClass("active"),t(r).find("img").attr("alt","Quitar de mi lista de favorito"))})})}});return o.mixin(a.ProJS.Mediable),new o});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.