"); } // 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
Spencer Strider
Perfil de Jugador
Estadsticas
Splits
Resumen de Juegos
Bateo vs Lanzamiento
Zonas calientes
Vdeos
FTBOL 166l13
Resultados de Hoy
Norte/Centroamrica
Sudamrica
Europa
Clubes
Mundial
Euro 2016
MS FTBOL 543z34
Espaa
Inglaterra
Italia
Champions League
Copa Libertadores
Argentina
Colombia
MS DEPORTES w3b18
Bsquetbol
Bisbol
Boxeo
Ftbol Americano
Deporte Motor
Golf
Olmpicos
MS DEPORTES w3b18
Rugby (Scrum.com)
ESPNtenis.com
MMA
ESPNPolo.com
ESPN Run
X Games
Otros Deportes
HERRAMIENTAS 3v2l3u
arnos
ar a ESPN TV
Mi ESPN
Servicios para
Publicidad
VIDEO 4xd1d
FANTASA s5c63
TV 583p5o
RADIO 35e2z
PODCENTER 33q1h
MOVIL 226o23
PLAY 3x3h47
REVISTA 2k143p
Menu
ESPN 263d2z
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
Portada
Resultados
Calendario
Posiciones
Estadsticas
Equipos