"); } // only if button was added if($(".follow-button").length) { $(".follow-button").click(function(){ var promise = isFollowing(); promise.then(function(result) { if (result) { unfollow(); } else { follow(); } }); }); // initial load toggleFollowButton(); } function toggleFollowButton() { var button = $(".follow-text"), promise = isFollowing(); promise.then(function(result) { if (result) { button.text(followingLabel); button.css("color", "#6c6d6f"); $(".follow-button").css("border-color", "#6c6d6f"); } else { button.text(followLabel); button.css("color", "#007aff"); $(".follow-button").css("border-color", "#007aff"); } }); } function isFollowing() { var promise = getMyPreferences(); return promise.then(function(result) { let myPlayers = result.myPlayers; if (myPlayers.length > 0) { for (var i = 0;i < myPlayers.length; i++) { if (myPlayers[i].guid === guid) { return true; } } } return false; }); } function getMyPreferences() { return new Promise(function(resolve, reject) { jQuery.when(fanAPI.getAsP13n()).done(resolve).fail(reject); }); } function follow() { var promise = new Promise(function(resolve, reject) { fanAPI.createPreference({ preferenceTypeId: 3, entityId: guid }, { success: function(preference) { resolve((preference && preference.preference_id) !== undefined); }, error: reject }); }); promise.then(function(result) { toggleFollowButton(); }); } function unfollow() { var preferences = getMyPreferences(), pId = null; preferences.then(function(result) { let myPreferences = result.myPreferences; for (var i = 0; i < myPreferences.length; i++) { if (myPreferences[i].metaData.guid === guid) { pId = myPreferences[i].id; break; } } if (pId !== null) { var promise = new Promise(function(resolve, reject) { fanAPI.deletePreference({ preferenceTypeId: 3, preferenceId: pId, entityId: guid }, { success: function(result) { resolve(true); }, error: reject }); }); promise.then(function(result) { if (result) { toggleFollowButton(); } }); } }); } }); })(jQuery);
Ir a
Lucas Erceg
Perfil de Jugador
Estadsticas
Splits
Resumen de Juegos
Bateo vs Lanzamiento
Zonas calientes
Vdeos
FTBOL 5u6y3n
Resultados de Hoy
Norte/Centroamrica
Sudamrica
Europa
Clubes
Mundial
Euro 2016
MS FTBOL 3py1n
Espaa
Inglaterra
Italia
Champions League
Copa Libertadores
Argentina
Colombia
MS DEPORTES 6t1cw
Bsquetbol
Bisbol
Boxeo
Ftbol Americano
Deporte Motor
Golf
Olmpicos
MS DEPORTES 6t1cw
Rugby (Scrum.com)
ESPNtenis.com
MMA
ESPNPolo.com
ESPN Run
X Games
Otros Deportes
HERRAMIENTAS 3b454s
arnos
ar a ESPN TV
Mi ESPN
Servicios para
Publicidad
VIDEO 433h29
FANTASA 4d705h
TV 6q6m6e
RADIO 546o2s
PODCENTER 5kz1a
MOVIL 1p3j6p
PLAY 1h642w
REVISTA 3623b
Menu
ESPN 4e6f5p
Resultados
Ftbol
Bsquetbol
MLB
Boxeo
F. Americano
F1
espnW
Ms Deportes
Serie del Caribe
Paralmpicos
Tenis
Golf
Clsico Mundial
Mundial 2022
MotoGP
Panamericanos
Olmpicos
Lucha Libre
La ltima Experiencia
Gaming
Ciclismo
MMA
NCAAF
Deporte Motor
ESPN Run
NHL
Otros Deportes
NCAAM
NCAAW
WNBA
Poker
UFL
Ediciones
Juegos
Disney+
MLB 1f3f65
Portada
Resultados
Calendario
Posiciones
Estadsticas
Equipos