1/* Minification failed. Returning unminified contents. 2(9771,515-516): run-time error JS1013: Syntax error in regular expression: ) 3 */ 4var language = { 5 datePrefix: '', 6 7 validation: { 8 verifyEmail: 'This is not a proper email address' 9 }, 10 11 currencyFormat: { 12 format: '$ {0}', 13 separator: '.' 14 }, 15 16 sportConfig: { 17 hockey: { id: 1, name: 'hockey', periodName: 'period', imageUrl: '//cache.kreezee.com/images/sports/hockey-logo-grey_20x20.png', teamDefaultStat: 15, playerDefaultStat: 29, playerDefaultCategory: 2 }, 18 baseball: { id: 2, name: 'baseball', periodName: 'inning', imageUrl: '//cache.kreezee.com/images/sports/baseball-logo-grey_20x20.png', teamDefaultStat: 73, playerDefaultStat: 29, playerDefaultCategory: 2 }, 19 football: { id: 3, name: 'football', periodName: 'quarter', imageUrl: '//cache.kreezee.com/images/sports/football-logo-grey_20x20.png', teamDefaultStat: 74, playerDefaultStat: 29, playerDefaultCategory: 2 }, 20 basketball: { id: 4, name: 'basketball', periodName: 'quarter', imageUrl: '//cache.kreezee.com/images/sports/basketball-logo-grey_20x20.png', teamDefaultStat: 83, playerDefaultStat: 29, playerDefaultCategory: 2 }, 21 badminton: { id: 5, name: 'badminton', periodName: 'set', imageUrl: '//cache.kreezee.com/images/sports/badminton-logo-grey_20x20.png', teamDefaultStat: 15, playerDefaultStat: 29, playerDefaultCategory: 2 }, 22 soccer: { id: 6, name: 'soccer', periodName: 'half', imageUrl: '//cache.kreezee.com/images/sports/soccer-logo-grey_20x20.png', teamDefaultStat: 42, playerDefaultStat: 51, playerDefaultCategory: 2 }, 23 volleyball: { id: 7, name: 'volleyball', periodName: 'set', imageUrl: '//cache.kreezee.com/images/sports/volleyball-logo-grey_20x20.png', teamDefaultStat: 92, playerDefaultStat: 29, playerDefaultCategory: 2 }, 24 tennis: { id: 8, name: 'tennis', periodName: 'set', imageUrl: '//cache.kreezee.com/images/sports/tennis-logo-grey_20x20.png', teamDefaultStat: 15, playerDefaultStat: 29, playerDefaultCategory: 2 }, 25 golf: { id: 9, name: 'golf', periodName: 'round', imageUrl: '//cache.kreezee.com/images/sports/golf-logo-grey_20x20.png', teamDefaultStat: 15, playerDefaultStat: 29, playerDefaultCategory: 2 }, 26 dekhockey: { id: 11, name: 'dekhockey', periodName: 'period', imageUrl: '//cache.kreezee.com/images/sports/dekhockey-logo-grey_20x20.png', teamDefaultStat: 107, playerDefaultStat: 29, playerDefaultCategory: 2 }, 27 rugby: { id: 12, name: 'rugby', periodName: 'half', imageUrl: '//cache.kreezee.com/images/sports/rugby-logo-grey_20x20.png', teamDefaultStat: 173, playerDefaultStat: 29, playerDefaultCategory: 2 }, 28 ultimate: { id: 13, name: 'ultimate', periodName: 'half', imageUrl: '//cache.kreezee.com/images/sports/fr
28isbee-logo-grey_20x20.png', teamDefaultStat: 164, playerDefaultStat: 29, playerDefaultCategory: 2 }, 29 handball: { id: 14, name: 'handball', periodName: 'half', imageUrl: '//cache.kreezee.com/images/sports/handball-logo-grey_20x20.png', teamDefaultStat: 152, playerDefaultStat: 60, playerDefaultCategory: 16 }, 30 ringette: { id: 15, name: 'ringette', periodName: 'period', imageUrl: '//cache.kreezee.com/images/sports/ringette-logo-grey_20x20.png', teamDefaultStat: 143, playerDefaultStat: 29, playerDefaultCategory: 2 }, 31 other: { id: 10, name: 'sport', periodName: 'period', imageUrl: '//cache.kreezee.com/images/sports/other-logo-grey_20x20.png', teamDefaultStat: 160, playerDefaultStat: 29, playerDefaultCategory: 2 } 32 }, 33 34 staffTeamType: [ 35 { id: 1, name: 'Assistant Coach' }, 36 { id: 2, name: 'General Manager' }, 37 { id: 3, name: 'Head Coach' }, 38 { id: 11, name: 'Goaltending Coach' }, 39 { id: 12, name: 'Assistant General Manager' }, 40 { id: 13, name: 'President' }, 41 { id: 14, name: 'Equipment Manager' }, 42 { id: 15, name: 'Athletic Therapist' }, 43 { id: 16, name: 'Strength & Conditioning Coach' }, 44 { id: 17, name: 'Secretary' }, 45 { id: 18, name: 'Treasurer' }, 46 { id: 19, name: 'Member of the Board' }, 47 { id: 29, name: 'Team Manager' }, 48 { id: 35, name: 'Coach' }, 49 { id: 39, name: 'Statistician' }, 50 { id: 40, name: 'Locker Room Manager' } 51 ], 52 53 staffLeagueType: [ 54 { id: 6, name: 'General Manager' }, 55 { id: 7, name: 'Official' }, 56 { id: 8, name: 'Linesperson' }, 57 { id: 9, name: 'Scorekeeper' }, 58 { id: 10, name: 'Secretary' }, 59 { id: 20, name: 'Assistant General Manager' }, 60 { id: 21, name: 'President' }, 61 { id: 22, name: 'Treasurer' }, 62 { id: 23, name: 'Member of the Board' }, 63 { id: 24, name: 'Referee-in-Chief' }, 64 { id: 25, name: 'Referee' }, 65 { id: 26, name: 'Administrator' }, 66 { id: 27, name: 'Statistician' }, 67 { id: 28, name: 'Media Manager' }, 68 { id: 33, name: 'Time Keeper' }, 69 { id: 34, name: 'Announcer' }, 70 { id: 36, name: 'League Official' }, 71 { id: 37, name: 'Event Security' }, 72 { id: 38, name: 'Medical Staff' }, 73 { id: 41, name: 'Shot Clock Operator' }, 74 ], 75 76 sportTerm: { 77 1: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 78 2: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 79 3: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 80 4: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 81 6: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 82 7: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 83 10: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 84 11: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 85 12: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 86 13: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 87 14: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 88 15: { period: 'th', firstPeriod: 'st', firstPeriodFeminine: 'st', secondPeriod: 'nd', thirdPeriod: 'rd' }, 89 }, 90 91 bracketRounds: { 92 'final': { text: 'Final' }, 93 'semi-final': { text: 'Semi-final' }, 94 'quarter-final': { text: 'Quarterfinal' }, 95 'eighth-final': { text: 'Eighth finals' } 96 }, 97 98 periodSuffix: function (value, sportId) { 99 var endTerm = language.sportTerm[sportId]; 100 101 if (value % 10 == 1) { 102 return value + endTerm.firstPeriod; 103 } 104 else if (value % 10 == 2) { 105 return value + endTerm.secondPeriod; 106 } 107 else if (value % 10 == 3) { 108 return value + endTerm.thirdPeriod; 109 } 110 111 return value + endTerm.period; 112 }, 113 114 tabsName: { 115 summary: 'summary' , 116 stats: 'stats' , 117 stars: 'stars' , 118 media: 'media' , 119 lineups: 'lineups', 120 carreerStats: 'carreer-stats', 121 calendar: 'calendar',
122 staff: 'staff', 123 photos: 'photos', 124 albums: 'albums', 125 videos: 'videos', 126 leaders: 'leaders', 127 teams: 'teams', 128 players: 'players', 129 goalies: 'goalies', 130 hitters: 'hitters', 131 pitchers: 'pitching', 132 suspensions: 'suspensions', 133 sportCenters: 'sport-centers', 134 playerStats: 'players-stats', 135 scorers: 'scorers', 136 schedule: 'schedule', 137 standings: 'standings', 138 brackets: 'brackets', 139 sponsors: 'sponsors' 140 141 }, 142 playerLeaderType: [ 143 { id: 6, text: 'Goals' }, 144 { id: 7, text: 'Assists' }, 145 { id: 29, text: 'Points' }, 146 { id: 31, text: 'Points/GP' }, 147 ], 148 goalieLeaderType: [ 149 { id: 14, text: 'Games Played' }, 150 { id: 15, text: 'Wins' }, 151 { id: 30, text: 'Sv%' }, 152 { id: 25, text: 'Shutouts' }, 153 ], 154 155 matchStatusType: [ 156 { id: 1, text: 'NOT STARTED'}, 157 { id: 2, text: 'ONGOING'}, 158 { id: 3, text: 'FINISHED'}, 159 { id: 4, text: 'STOPPED'}, 160 { id: 5, text: 'DELAYED'}, 161 ], 162 163 messageType: [ 164 { Id: 1, Name: 'Important' }, 165 { Id: 2, Name: 'Warning' }, 166 { Id: 3, Name: 'Message' }, 167 { Id: 4, Name: 'Note' } 168 ], 169 170 daysOfTheWeek: [ 171 { index: 0, text: 'Sunday', shortText: 'Sun' }, 172 { index: 1, text: 'Monday', shortText: 'Mon' }, 173 { index: 2, text: 'Tuesday', shortText: 'Tue' }, 174 { index: 3, text: 'Wednesday', shortText: 'Wed' }, 175 { index: 4, text: 'Thursday', shortText: 'Thu' }, 176 { index: 5, text: 'Friday', shortText: 'Fri' }, 177 { index: 6, text: 'Saturday', shortText: 'Sat' }], 178 179 months: [ 180 { index: 0, name: 'January', shortText: 'Jan' }, 181 { index: 1, name: 'February', shortText: 'Feb' }, 182 { index: 2, name: 'March', shortText: 'Mar' }, 183 { index: 3, name: 'April', shortText: 'Apr' }, 184 { index: 4, name: 'May', shortText: 'May' }, 185 { index: 5, name: 'June', shortText: 'Jun' }, 186 { index: 6, name: 'July', shortText: 'Jul' }, 187 { index: 7, name: 'August', shortText: 'Aug' }, 188 { index: 8, name: 'September', shortText: 'Sep' }, 189 { index: 9, name: 'October', shortText: 'Oct' }, 190 { index: 10, name: 'November', shortText: 'Nov' }, 191 { index: 11, name: 'December', shortText: 'Dec' }], 192 193 194 timeFormat: 'hh:mm A', 195 196 global: { 197 noDataLabel: 'No results', 198 versusTeamLabel: '@', 199 buttons: { 200 kreezeePage: 'Kreezee Page', 201 follow: 'Follow', 202 unfollow: 'Unfollow', 203 cancel: 'Cancel' 204 } 205 }, 206 207 top: { 208 logoAlt: 'Kreezee Sports', 209 signIn: 'Sign In', 210 latestConnections: { 211 title: 'Connections', 212 inviteContacts: 'Invite your contacts' 213 }, 214 latestMessages: { 215 title: 'Messages' 216 }, 217 shoppingCart: { 218 labels: { 219 item: 'item' 220 } 221 } 222 }, 223 224 urlRewrite: { 225 prefixUser: 'user' 226 }, 227 228 menu: { 229 dashboard: { text: 'Dashboard', url: 'dashboard' }, 230 dashboardV2: { text: 'V2', url: 'v2/home' }, 231 home: { text: 'Home', url: '' }, 232 latestNews: { text: 'Latest News', url: '' }, 233 moreNews: { text: 'More News', url: '' }, 234 scores: { text: 'Scores', url: 'scores' }, 235 standings: { text: 'Standings', url: 'standings' }, 236 calendar: { text: 'Schedule', url: 'schedule' }, 237 statistics: { text: 'Statistics', url: 'statistics' }, 238 teams: { text: 'Teams', url: 'teams' }, 239 players: { text: 'Players', url: 'players' }, 240 news: { text: 'News', url: 'news' }, 241 medias: { text: 'Media', url: 'medias' }, 242 match: { text: 'Games', url: 'match' }, 243 portal: { text: 'Portal', url: 'portal' }, 244 association: { text: 'Association', url: 'association' }, 245 league: { text: 'League', url: 'league' }, 246 leagues: { text: 'Leagues', url: 'leagues' }, 247 videos: { text: 'Videos', url: 'videos' }, 248 photos: { text: 'Photos', url: 'photos' }, 249 albums: { text: 'Albums', url: 'albums' }, 250 product: { text: 'Online Store', url: 'online-store' }, 251 cart: { text: 'Cart', url: 'cart' }, 252 sportsFacilities: { text: 'Sports facilities', url: 'sports-facilities' }, 253 sportCenters: { text: 'Sport Centers', url: 'sport-centers' }, 254 address: '© Kreezee Corporation, Quebec City, Canada | ', 255 termsAndConditions: { text: 'Terms and conditions', url: 'sports/terms-and-conditions' },
256 advertiseWithUs: { text: 'Advertise with us' }, 257 privacyPolicy: { text: 'Privacy policy', url: 'sports/privacy-policy' }, 258 contactUs: { text: 'Contact Us', url: 'mailto:[email protected]' } 259 }, 260 datatable: { 261 "sEmptyTable": "No data available", 262 "sLoadingRecords": "Loading...", 263 "sProcessing": "Processing...", 264 "sZeroRecords": "No matching records found", 265 "oPaginate": { 266 "sFirst": "First", 267 "sLast": "Last", 268 "sNext": "Next", 269 "sPrevious": "Previous" 270 }, 271 "oAria": { 272 "sSortAscending": ": activate to sort column ascending", 273 "sSortDescending": ": activate to sort column descending" 274 } 275 }, 276 277 hockeyPenalityType: [ 278 { id: 1, text: 'Minor (2 min.)', minute: '2', code: 'A', abbr: 'Min.' }, 279 { id: 2, text: 'Bench Minor (2 min.)', minute: '2', code: 'A', abbr: 'Bench Min.' }, 280 { id: 3, text: 'Major (5 min.)', minute: '5', code: 'B', abbr: 'Maj.' }, 281 { id: 4, text: 'Misconduct (10 min.)', minute: '10', code: 'C', abbr: 'Misc' }, 282 { id: 5, text: 'Game Misconduct (10 min.)', minute: '10', code: 'D', abbr: 'Game Misc.' }, 283 { id: 6, text: 'Game (10 min.)', minute: '10', code: 'E', abbr: 'Game' }, 284 { id: 7, text: 'Penalty Shot', minute: '0', code: 'F', abbr: 'Pen. Shot' }, 285 { id: 273, text: 'Minor (3 min.)', minute: '3', code: 'A3', abbr: 'Min.' }, 286 { id: 274, text: 'Minor (4 min.)', minute: '4', code: 'A4', abbr: 'Min.' }, 287 { id: 275, text: 'Minor (1.5 min.)', minute: '1.5', code: 'A1.5', abbr: 'Min.' }, 288 { id: 276, text: 'Major (15 min.)', minute: '15', code: 'B15', abbr: 'Min.' }, 289 { id: 277, text: 'Minor (1 min.)', minute: '1', code: 'A1', abbr: 'Min.' }, 290 { id: 278, text: 'Major (3 min.)', minute: '3', code: 'B3', abbr: 'Min.' }, 291 { id: 279, text: 'Major (4 min.)', minute: '4', code: 'B4', abbr: 'Min.' }, 292 { id: 280, text: 'Misconduct (8 min.)', minute: '8', code: 'C8', abbr: 'Min.' } 293 ], 294 295 hockeyPenality: [ 296 { id: 11, group: 1, text: 'Aggressor' }, 297 { id: 12, group: 1, text: 'Fighting' }, 298 { id: 13, group: 1, text: 'Fighting' }, 299 { id: 14, group: 1, text: 'Instigator' }, 300 { id: 15, group: 1, text: 'Use of rings, tape or other material on the hands to injure an opponent' }, 301 { id: 16, group: 1, text: 'Remaining at the site of a fight' }, 302 { id: 17, group: 1, text: 'Second or subsequent fight during the same stoppage of play' }, 303 { id: 18, group: 1, text: 'Third player entering a fight' }, 304 { id: 19, group: 1, text: 'First player to leave a bench' }, 305 { id: 20, group: 1, text: 'Goalkeeper who leaves the goal' }, 306 { id: 21, group: 1, text: 'Grabbing opponentâs without gaining advantage' }, 307 { id: 22, group: 1, text: 'Grabbing opponentâs and gaining advantage' }, 308 { id: 23, group: 1, text: 'Using equipment as a weapon' }, 309 { id: 24, group: 1, text: 'Player deliberately removes his helmet to fight or to challenge an opponent to fight' }, 310 { id: 25, group: 2, text: 'Slashing' }, 311 { id: 26, group: 2, text: 'Spearing' }, 312 { id: 27, group: 2, text: 'Butt-ending' }, 313 { id: 28, group: 2, text: 'Cross Checking' }, 314 { id: 29, group: 2, text: 'High Sticking' }, 315 { id: 30, group: 3, text: 'Charging' }, 316 { id: 31, group: 3, text: 'Attempt to injure' }, 317 { id: 32, group: 3, text: 'Elbowing' }, 318 { id: 33, group: 3, text: 'Kneeing' }, 319 { id: 34, group: 3, text: 'Kicking' }, 320 { id: 35, group: 3, text: 'Head butting' }, 321 { id: 36, group: 3, text: 'Illegal body checking' }, 322 { id: 37, group: 3, text: 'Checking from behind' }, 323 { id: 38, group: 3, text: 'Boarding' }, 324 { id: 39, group: 3, text: 'Roughing' }, 325 { id: 40, group: 3, text: 'Head contact' }, 326 { id: 41, group: 4, text: 'Holding' }, 327 { id: 42, group: 4, text: 'Holding the stick' }, 328 { id: 43, group: 4, text: 'Hooking' }, 329 { id: 44, group: 4, text: 'Tripping' }, 330 { id: 45, group: 4, text: 'Slew-footing' }, 331 { id: 46, group: 4, text: 'Clipping' }, 332 { id: 47, group: 4, text: 'Interference' }, 333 { id: 48, group: 5, text: 'Verbal abuse of an official, unsportsmanlike conduct, misconduct' }, 334 { id: 49, group: 5, text: 'Diving' }, 335 { id: 50, group: 5, text: 'Engaging in verbal taunts, insults or intimidation based on discriminatory' }, 336 { id: 51, group: 5, text: 'Team manifestation of unsportsmanlike conduct' }, 337 { id: 52, group: 5, text: 'Gross misconduct for making a travesty of the game' }, 338 { id: 53, group: 5, text: 'Abusive language, gesture or obscene gestures' }, 339 { id: 54, group: 5, text: 'Not proceeding immediately to the penalty box' }, 340 { id: 55, group: 5, text: 'Inciting an opponent' }, 341 { id: 56, group: 5, text: 'Threatening or attempting to strike an official' }, 342 { id: 57, group: 5, text: 'Physical aggression of an official' }, 343 { id: 58, group: 5, text: 'Spitting' }, 344 { id: 59, group: 6, text: 'Too many players on the ice' }, 345 { id: 60, group: 6, text: 'Playing with a broken, illegal or illegally obtained stick' }, 346 { id: 61, group: 6, text: 'Unsustained request for equipment measurement' }, 347 { id: 62, group: 6, text: 'Refusing to have equipment measured' }, 348 { id: 63, group: 6, text: 'Participating in the play without the proper protective equipment' }, 349 { id: 64, group: 6, text: 'Wearing non-certified or dangerous equipment' }, 350 { id: 65, group: 6, text: 'Wearing equipment in a non-regulatory fashion' }, 351 { id: 66, group: 6, text: 'Bench minor penalty or team penalty' }, 352 { id: 67, group: 6, text: 'Second misconduct penalty' }, 353 { id: 68, group: 6, text: 'Kick shot' }, 354 { id: 69, group: 6, text: 'Leaving the players bench or penalty box' }, 355 { id: 70, group: 6, text: 'Throwing his stick or other object' }, 356 { id: 71, group: 6, text: 'Delaying the game' }, 357 { id: 72, group: 6, text: 'Deliberately dislodging the goal from its position' }, 358 { id: 73, group: 6, text: 'Ineligible player' }, 359 { id: 74, group: 6, text: 'Illegal face-off' }, 360 { id: 75, group: 6, text: 'Closing the hand on or freezing the puck' }, 361 { id: 76, group: 6, text: 'Refusing to start play or refusing to leave the playerâs bench or the ice' }, 362 { id: 77, group: 6, text: 'Leaving the bench at the end of a period and/or the game' }, 363 { id: 164, group: 6, text: 'Miscellaneous' }, 364 { id: 260, group: 4, text: 'Interference from the bench' }, 365 { id: 261, group: 5, text: 'Instigator of a gathering during the handshake procedure' }, 366 { id: 262, group: 5, text: 'Misconduct' }, 367 { id: 263, group: 5, text: 'Game misconduct' }, 368 { id: 264, group: 5, text: 'Match Penalty' }, 369 { id: 265, group: 5, text: 'Second Fight' }, 370 { id: 266, group: 3, text: 'Grabbing the Face Mask' }, 371 { id: 267, group: 5, text: 'Attempt to remove helmet' }, 372 { id: 268, group: 1, text: 'Avoidable Check/Check after Whistle' }, 373 { id: 269, group: 1, text: 'Deliberate Illegal Substitution' }, 374 { id: 270, group: 5, text: 'Unsportsmanlike Conduct' }, 375 { id: 271, group: 3, text: 'T-Charging' }, 376 { id: 272, group: 3, text: 'Charging' }, 377 { id: 281, group: 1, text: 'Player not wearing a jersey tie-down during a fight' }, 378 { id: 285, group: 4, text: 'Interference with the goaltender' }, 379 { id: 286, group: 5, text: 'Discrimination - Allegations' } 380 ], 381 382 hockeyEventType: { 383 goal: { id: 1, name: 'But' }, 384 penalty: { id: 2, name: 'Punition'}, 385 shot: { id: 3, name: 'Lancer'}, 386 faceoff: { id: 4, name: 'Mise en jeu'}, 387 checking: { id: 5, name: 'Mise en échec' }, 388 shootout: {id: 6, name: 'Fusillade' } 389 }, 390 391 hockeyEventQualifier: { 392 equalforce: { id: 161, name: 'Even Strength', abbr: '' }, 393 powerplay: { id: 162, name: 'Power Play', abbr: '(PPG)' }, 394 shorthanded: { id: 163, name: 'Short Handed', abbr: '(SHG)' }, 395 penaltyShot: { id: 256, name: 'Penalty Shot', abbr: '(PS)' }, 396 emptyNet: { id: 259, name: 'Empty Net', abbr: '(EN)' } 397 }, 398 399 hockeyStatsType: { 400 goal: { id: 6, name: 'Goal', Abb: 'Goal' }, 401 assist: { id: 7, name: 'Assist', Abb: 'Assist' }, 402 penalty: { id: 8, name: 'Penalty', Abb: 'Penalty' }, 403 shot: { id: 9, name: 'Shot', Abb: 'Shot' }, 404 save: { id: 10, name: 'Save', Abb: 'Save' }, 405 checking: { id: 11, name: 'Checking', Abb: 'Checking' }, 406 shootoutGoal: { id: 12, name: 'Shootout Goal', Abb: 'Shootout Goal' }, 407 shootoutSave: { id: 13, name: 'Shootout Save', Abb: 'Shootout Save' }, 408 gamePlayed: { id: 14, name: 'Games Played', Abb: 'Games Played' }, 409 victory: { id: 15, name: 'Victory', Abb: 'W' }, 410 defeat: { id: 16, name: 'Losses', Abb: 'L' }, 411 draw: { id: 17, name: 'Ties', Abb: 'T' }, 412 overtimeVictory: { id: 18, name: 'Overtime Wins', Abb: 'Overtime W.' }, 413 overtimeDefeat: { id: 19, name: 'Overtime Loss', Abb: 'Overtime L.' }, 414 shootoutVictory: { id: 20, name: 'ShootOut Victory', Abb: 'ShootOut V.' }, 415 shootoutDefeat: { id: 21, name: 'Shootout Defeat', Abb: 'Shootout D.' }, 416 goalAgaints: { id: 22, name: 'Goals Against', Abb: 'Goals Against' }, 417 shotAgaints: { id: 23, name: 'Shot Against', Abb: 'Shot Against' }, 418 minutes: { id: 24, name: 'Minutes', Abb: 'Minutes' }, 419 shutout: { id: 25, name: 'Shutout', Abb: 'Shutout' }, 420 powerplayGoal: { id: 26, name: 'Powerplay Goal', Abb: 'Sup. Goal' }, 421 shorthandedGoal: { id: 27, name: 'Shorthanded Goal', Abb: 'Inf. Goal' }, 422 winningGoal: { id: 28, name: 'Winning Goal', Abb: 'Winning Goal' }, 423 point: { id: 29, name: 'Points', Abb: 'Pts' }, 424 savepercentage: { id: 30, name: 'Save Percentage', Abb: 'Sv%' }, 425 ppm: { id: 31, name: 'Average Points per Game', Abb: 'PTS/GP'}, 426 gaa: { id: 32, name: 'Goals Against Average', Abb: 'GAA'}, 427 overtimeShootoutDefeat: { id: 33, name: 'Overtime or Shootout Loss', Abb: 'OSD' }, 428 gamePlayedGoalie: { id: 62, name: 'Games Played', Abb: 'Games Played' } 429 }, 430 hockeyStatsTypeArray: [ 431 { id: 6, name: 'Goal', Abb: 'Goals' }, 432 { id: 7, name: 'Assist', Abb: 'Assists' }, 433 { id: 8, name: 'Penalty', Abb: 'Penalties' }, 434 { id: 9, name: 'Shot', Abb: 'Shot' }, 435 { id: 10, name: 'Save', Abb: 'Save' }, 436 { id: 11, name: 'Checking', Abb: 'Checking' }, 437 { id: 12, name: 'Shootout Goal', Abb: 'Shootout Goal' }, 438 { id: 13, name: 'Shootout Save', Abb: 'Shootout Save' }, 439 { id: 14, name: 'Games Played', Abb: 'Games Played' }, 440 { id: 15, name: 'Wins', Abb: 'Wins' }, 441 { id: 16, name: 'Losses', Abb: 'Losses' }, 442 { id: 17, name: 'Tie Games', Abb: 'Tie' }, 443 { id: 18, name: 'Overtime Wins', Abb: 'Overtime W.' }, 444 { id: 19, name: 'Overtime Loss', Abb: 'Overtime L.' }, 445 { id: 20, name: 'ShootOut Victory', Abb: 'ShootOut V.' }, 446 { id: 21, name: 'Shootout Loss', Abb: 'Shootout L.' }, 447 { id: 22, name: 'Goal Againts', Abb: 'Goal Againts' }, 448 { id: 23, name: 'Shot Againts', Abb: 'Shot Againts' }, 449 { id: 24, name: 'Minutes', Abb: 'Minutes' }, 450 { id: 25, name: 'Shutout', Abb: 'Shutouts' }, 451 { id: 26, name: 'Powerplay Goal', Abb: 'Sup. Goal' }, 452 { id: 27, name: 'Shorthanded Goal', Abb: 'Inf. Goal' }, 453 { id: 28, name: 'Winning Goal', Abb: 'Winning Goal' }, 454 { id: 29, name: 'Point', Abb: 'Points' }, 455 { id: 30, name: 'Save Percentage', Abb: 'Sv%' }, 456 { id: 31, name: 'Average Points per Game', Abb: 'PTS/GP'}, 457 { id: 32, name: 'Goals Against Average', Abb: 'GAA'}, 458 { id: 33, name: 'Overtime or Shootout Loss', Abb: 'OSL'} 459 ], 460 461 hockeyTeamStats: { 462 goalFor: { id: 1, name: 'Goal For', abbr: 'GF' }, 463 goalAgaints: { id: 2, name: 'Goal Againts', abbr: 'GA' }, 464 goalSupNum: { id: 3, name: 'Goal Numerical Superiority', abbr: 'PPG' }, 465 goalInfNum: { id: 4, name: 'Goal Numerical Inferiority', abbr: 'SHG' }, 466 gamePlayed: { id: 5, name: 'Games Played', abbr: 'GP' }, 467 victory: { id: 6, name: 'Wins', abbr: 'W' }, 468 defeat: { id: 7, name: 'Losses', abbr: 'L' }, 469 draw: { id: 8, name: 'Ties', abbr: 'T' }, 470 overtimeVictory: { id: 9, name: 'Overtime Wins', abbr: 'OTW' }, 471 overtimeDefeat: { id: 10, name: 'Overtime Losses', abbr: 'OTL' }, 472 shootoutVictory: { id: 11, name: 'Shooutout Victory', abbr: 'SOW' }, 473 shootoutDefeat: { id: 12, name: 'Shootout Losses', abbr: 'SOL' }, 474 penalty: { id: 13, name: 'Penalty', abbr: 'PIM' }, 475 shutout: { id: 14, name: 'Shutouts', abbr: 'SO' }, 476 points: { id: 15, name: 'Points', abbr: 'PTS' }, 477 differential: { id: 16, name: '+/-', abbr: 'DIFF' }, 478 pointsPeriod1: { id: 18, name: 'Point per period 1', abbr: 'PP1' }, 479 pointsPeriod2: { id: 19, name: 'Point per period 2', abbr: 'PP2' }, 480 pointsPeriod3: { id: 20, name: 'Point per period 3', abbr: 'PP3' }, 481 pointsPeriod4: { id: 21, name: 'Point per period 4', abbr: 'PP4' },
482 victoryPeriod1: { id: 26, name: '1st Period Wins', abbr: 'WP1' }, 483 victoryPeriod2: { id: 27, name: '2nd Period Wins', abbr: 'WP2' }, 484 victoryPeriod3: { id: 28, name: '3rd Period Wins', abbr: 'WP3' }, 485 victoryPeriod4: { id: 29, name: '4th Period Wins', abbr: 'WP4' }, 486 tiePeriod1: { id: 30, name: '1st Period Ties', abbr: 'TP1' }, 487 tiePeriod2: { id: 31, name: '2nd Period Ties', abbr: 'TP2' }, 488 tiePeriod3: { id: 32, name: '3rd Period Ties', abbr: 'TP3' }, 489 tiePeriod4: { id: 33, name: '4th Period Ties', abbr: 'TP4' }, 490 defeatPeriod1: { id: 34, name: 'Loss Period 1', abbr: 'LP1' }, 491 defeatPeriod2: { id: 35, name: 'Loss Period 2', abbr: 'LP2' }, 492 defeatPeriod3: { id: 36, name: 'Loss Period 3', abbr: 'LP3' }, 493 defeatPeriod4: { id: 37, name: 'Loss Period 4', abbr: 'LP4' } 494 }, 495 496 legends: { 497 }, 498 499 sportTeamStats: { 500 position: { name: "Position", abbr: "POS", legend: "POS: Position" }, 501 rank: { name: "Rank", abbr: "RK", legend: "RK: Rank" }, 502 1: { id: 1, sportId: 1, name: 'Goals For', abbr: 'GF', legend: 'GF : Goals For' }, 503 2: { id: 2, sportId: 1, name: 'Goals Against', abbr: 'GA', legend: 'GA : Goals Against' }, 504 3: { id: 3, sportId: 1, name: 'Goal Numerical Superiority', abbr: 'PPG', legend: 'PPG : Power Play Goals' }, 505 4: { id: 4, sportId: 1, name: 'Goal Numerical Inferiority', abbr: 'SHG', legend: 'SHG : Short Handed Goals' }, 506 5: { id: 5, sportId: 1, name: 'Games Played', abbr: 'GP', legend: 'GP : Games Played' }, 507 6: { id: 6, sportId: 1, name: 'Wins', abbr: 'W', legend: 'W : Wins' }, 508 7: { id: 7, sportId: 1, name: 'Losses', abbr: 'L', legend: 'L : Losses' }, 509 8: { id: 8, sportId: 1, name: 'Tie Games', abbr: 'T', legend: 'T : Tie Games' }, 510 9: { id: 9, sportId: 1, name: 'Overtime Wins', abbr: 'OTW', legend: 'OTW : Overtime Wins' }, 511 10: { id: 10, sportId: 1, name: 'Overtime Losses', abbr: 'OTL', legend: 'OTL : Overtime Losses' }, 512 11: { id: 11, sportId: 1, name: 'Shooutout Victory', abbr: 'SOW', legend: 'SOW : Shootout Wins' }, 513 12: { id: 12, sportId: 1, name: 'Shootout Losses', abbr: 'SOL', legend: 'SOL : Shootout Losses' }, 514 13: { id: 13, sportId: 1, name: 'Penalty Minutes', abbr: 'PIM', legend: 'PIM : Penalty Minutes' }, 515 14: { id: 14, sportId: 1, name: 'Shutouts', abbr: 'SO', legend: 'SO : Shutouts' }, 516 15: { id: 15, sportId: 1, name: 'Points', abbr: 'PTS', legend: 'PTS : Points' }, 517 16: { id: 16, sportId: 1, name: '+/-', abbr: 'DIFF', legend: 'DIFF : Goals Differential' }, 518 17: { id: 17, sportId: 1, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 519 18: { id: 18, sportId: 1, name: '1st Period Points', abbr: 'PP1', legend: 'PP1: 1st Period Points' }, 520 19: { id: 19, sportId: 1, name: '2nd Period Points', abbr: 'PP2', legend: 'PP2: 2nd Period Points' }, 521 20: { id: 20, sportId: 1, name: '3rd Period Points', abbr: 'PP3', legend: 'PP3: 3rd Period Points' }, 522 21: { id: 21, sportId: 1, name: '4th Period Points', abbr: 'PP4', legend: 'PP4: 4th Period Points' }, 523 22: { id: 22, sportId: 1, name: 'Empty Net Shots', abbr: 'ENS', legend: 'ENS: Empty Net Shots' }, 524 23: { id: 23, sportId: 1, name: 'Empty Net Goals', abbr: 'ENG', legend: 'ENG: Empty Net Goals' }, 525 24: { id: 24, sportId: 1, name: 'Manual Standings', abbr: 'MS', legend: 'MS: Manual Standings' }, 526 25: { id: 25, sportId: 1, name: 'Best Differential #2', abbr: 'BD', legend: 'BD: Goals for / (Goals for + Goals against)' }, 527 26: { id: 26, sportId: 1, name: '1st Period Wins', abbr: 'WP1', legend: 'WP1: 1st Period Wins' }, 528 27: { id: 27, sportId: 1, name: '2nd Period Wins', abbr: 'WP2', legend: 'WP2: 2nd Period Wins' }, 529 28: { id: 28, sportId: 1, name: '3rd Period Wins', abbr: 'WP3', legend: 'WP3: 3rd Period Wins' }, 530 29: { id: 29, sportId: 1, name: '4th Period Wins', abbr: 'WP4', legend: 'WP4: 4th Period Wins' },
531 30: { id: 30, sportId: 1, name: '1st Period Ties', abbr: 'TP1', legend: 'TP1: 1st Period Ties' }, 532 31: { id: 31, sportId: 1, name: '2nd Period Ties', abbr: 'TP2', legend: 'TP2: 2nd Period Ties' }, 533 32: { id: 32, sportId: 1, name: '3rd Period Ties', abbr: 'TP3', legend: 'TP3: 3rd Period Ties' }, 534 33: { id: 33, sportId: 1, name: '4th Period Ties', abbr: 'TP4', legend: 'TP4: 4th Period Ties' }, 535 34: { id: 34, sportId: 1, name: 'Loss Period 1', abbr: 'LP1', legend: 'LP1: Loss Period 1' }, 536 35: { id: 35, sportId: 1, name: 'Loss Period 2', abbr: 'LP2', legend: 'LP2: Loss Period 2' }, 537 36: { id: 36, sportId: 1, name: 'Loss Period 3', abbr: 'LP3', legend: 'LP3: Loss Period 3' }, 538 37: { id: 37, sportId: 1, name: 'Loss Period 4', abbr: 'LP4', legend: 'LP4: Loss Period 4' }, 539 52: { id: 52, sportId: 1, name: 'Wins Points per Period', abbr: 'PWP', legend: 'PWP: Wins Points per Period' }, 540 53: { id: 53, sportId: 1, name: 'Losses Points per Period', abbr: 'PLP', legend: 'PLP: Losses Points per Period' }, 541 54: { id: 54, sportId: 1, name: 'Ties Points per Period', abbr: 'PTP', legend: 'PTP: Ties Points per Period' }, 542 38: { id: 38, sportId: 6, name: 'Games Played', abbr: 'GP', legend: 'GP : Games Played' }, 543 39: { id: 39, sportId: 6, name: 'Wins', abbr: 'W', legend: 'W : Wins' }, 544 40: { id: 40, sportId: 6, name: 'Losses', abbr: 'L', legend: 'L : Losses' }, 545 41: { id: 41, sportId: 6, name: 'Tie Games', abbr: 'T', legend: 'T : Tie Games' }, 546 42: { id: 42, sportId: 6, name: 'Points', abbr: 'PTS', legend: 'PTS : Points' }, 547 43: { id: 43, sportId: 6, name: 'Shots', abbr: 'S', legend: 'S: Shots' }, 548 44: { id: 44, sportId: 6, name: 'Shots on goal', abbr: 'ST', legend: 'ST: Shots on goal' }, 549 45: { id: 45, sportId: 6, name: 'Offside', abbr: 'OS', legend: 'OS: Offside' }, 550 46: { id: 46, sportId: 6, name: 'Yellow Cards', abbr: 'YC', legend: 'YC: Yellow Cards' }, 551 47: { id: 47, sportId: 6, name: 'Red Cards', abbr: 'RC', legend: 'RC: Red Cards' }, 552 48: { id: 48, sportId: 6, name: 'Goals For', abbr: 'GF', legend: 'GF: Goals For' }, 553 49: { id: 49, sportId: 6, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 554 50: { id: 50, sportId: 6, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 555 51: { id: 51, sportId: 6, name: 'Shutouts', abbr: 'SO', legend: 'SO: Shutouts' }, 556 55: { id: 55, sportId: 2, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 557 56: { id: 56, sportId: 2, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 558 57: { id: 57, sportId: 2, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 559 58: { id: 58, sportId: 2, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 560 59: { id: 59, sportId: 2, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 561 60: { id: 60, sportId: 2, name: 'Points For', abbr: 'PF', legend: 'PF: Points For' }, 562 61: { id: 61, sportId: 2, name: 'Points Against', abbr: 'PA', legend: 'PA: Points Against' }, 563 62: { id: 62, sportId: 2, name: 'Shutouts', abbr: 'SO', legend: 'SO: Shutouts' }, 564 63: { id: 63, sportId: 2, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 565 64: { id: 64, sportId: 3, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 566 65: { id: 65, sportId: 3, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 567 66: { id: 66, sportId: 3, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 568 67: { id: 67, sportId: 3, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 569 68: { id: 68, sportId: 3, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 570 69: { id: 69, sportId: 3, name: 'Points For', abbr: 'PF', legend: 'PF: Points For' }, 571 70: { id: 70, sportId: 3, name: 'Points Against', abbr: 'PA', legend: 'PA: Points Against' }, 572 71: { id: 71, sportId: 3, name: 'Shutouts', abbr: 'SO', legend: 'SO: Shutouts' }, 573 72: { id: 72, sportId: 3, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 574 73: { id: 73, sportId: 2, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 575 74: { id: 74, sportId: 3, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 576 75: { id: 75, sportId: 4, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 577 76: { id: 76, sportId: 4, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 578 77: { id: 77, sportId: 4, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 579 78: { id: 78, sportId: 4, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 580 79: { id: 79, sportId: 4, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 581 80: { id: 80, sportId: 4, name: 'Points For', abbr: 'PF', legend: 'PF: Points For' }, 582 81: { id: 81, sportId: 4, name: 'Points Against', abbr: 'PA', legend: 'PA: Points Against' }, 583 82: { id: 82, sportId: 4, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 584 83: { id: 83, sportId: 4, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 585 84: { id: 84, sportId: 7, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 586 85: { id: 85, sportId: 7, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 587 86: { id: 86, sportId: 7, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 588 87: { id: 87, sportId: 7, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 589 88: { id: 88, sportId: 7, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 590 89: { id: 89, sportId: 7, name: 'Points For', abbr: 'PF', legend: 'PF: Points For' }, 591 90: { id: 90, sportId: 7, name: 'Points Against', abbr: 'PA', legend: 'PA: Points Against' }, 592 91: { id: 91, sportId: 7, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 593 92: { id: 92, sportId: 7, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 594 93: { id: 93, sportId: 11, name: 'Goals For', abbr: 'GF', legend: 'GF : Goals For' }, 595 94: { id: 94, sportId: 11, name: 'Goals Againts', abbr: 'GA', legend: 'GA : Goals Against' }, 596 95: { id: 95, sportId: 11, name: 'Goal Numerical Superiority', abbr: 'PPG', legend: 'PPG : Power Play Goals' }, 597 96: { id: 96, sportId: 11, name: 'Goal Numerical Inferiority', abbr: 'SHG', legend: 'SHG : Short Handed Goals' }, 598 97: { id: 97, sportId: 11, name: 'Games Played', abbr: 'GP', legend: 'GP : Games Played' }, 599 98: { id: 98, sportId: 11, name: 'Wins', abbr: 'W', legend: 'W : Wins' }, 600 99: { id: 99, sportId: 11, name: 'Losses', abbr: 'L', legend: 'L : Losses' }, 601 100: { id: 100, sportId: 11, name: 'Tie Games', abbr: 'T', legend: 'T : Tie Games' }, 602 101: { id: 101, sportId: 11, name: 'Overtime Wins', abbr: 'OTW', legend: 'OTW : Overtime Wins' }, 603 102: { id: 102, sportId: 11, name: 'Overtime Losses', abbr: 'OTL', legend: 'OTL : Overtime Losses' }, 604 103: { id: 103, sportId: 11, name: 'Shooutout Victory', abbr: 'SOW', legend: 'SOW : Shootout Wins' }, 605 104: { id: 104, sportId: 11, name: 'Shootout Losses', abbr: 'SOL', legend: 'SOL : Shootout Losses' }, 606 105: { id: 105, sportId: 11, name: 'Penalty Minutes', abbr: 'PIM', legend: 'PIM : Penalty Minutes' }, 607 106: { id: 106, sportId: 11, name: 'Shutouts', abbr: 'SO', legend: 'SO : Shutouts' }, 608 107: { id: 107, sportId: 11, name: 'Points', abbr: 'PTS', legend: 'PTS : Points' }, 609 108: { id: 108, sportId: 11, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 610 109: { id: 109, sportId: 11, name: 'Point par period 1', abbr: 'PP1', legend: 'PP1: Points per period 1' }, 611 110: { id: 110, sportId: 11, name: 'Point par period 2', abbr: 'PP2', legend: 'PP2: Points per period 2' }, 612 111: { id: 111, sportId: 11, name: 'Point par period 3', abbr: 'PP3', legend: 'PP3: Points per period 3' }, 613 112: { id: 112, sportId: 11, name: 'Point par period 4', abbr: 'PP4', legend: 'PP4: Points per period 4' }, 614 113: { id: 113, sportId: 11, name: 'Wins Period 1', abbr: 'WP1', legend: 'WP1: Wins Period 1' }, 615 114: { id: 114, sportId: 11, name: 'Wins Period 2', abbr: 'WP2', legend: 'WP2: Wins Period 2' }, 616 115: { id: 115, sportId: 11, name: 'Wins Period 3', abbr: 'WP3', legend: 'WP3: Wins Period 3' }, 617 116: { id: 116, sportId: 11, name: 'Wins Period 4', abbr: 'WP4', legend: 'WP4: Wins Period 4' },
618 117: { id: 117, sportId: 11, name: '1st Period Ties', abbr: 'TP1', legend: 'TP1: 1st Period Ties' }, 619 118: { id: 118, sportId: 11, name: '2nd Period Ties', abbr: 'TP2', legend: 'TP2: 2nd Period Ties' }, 620 119: { id: 119, sportId: 11, name: '3rd Period Ties', abbr: 'TP3', legend: 'TP3: 3rd Period Ties' }, 621 120: { id: 120, sportId: 11, name: '4th Period Ties', abbr: 'TP4', legend: 'TP4: 4th Period Ties' }, 622 121: { id: 121, sportId: 11, name: 'Loss Period 1', abbr: 'LP1', legend: 'LP1: Loss Period 1' }, 623 122: { id: 122, sportId: 11, name: 'Loss Period 2', abbr: 'LP2', legend: 'LP2: Loss Period 2' }, 624 123: { id: 123, sportId: 11, name: 'Loss Period 3', abbr: 'LP3', legend: 'LP3: Loss Period 3' }, 625 124: { id: 124, sportId: 11, name: 'Loss Period 4', abbr: 'LP4', legend: 'LP4: Loss Period 4' }, 626 125: { id: 125, sportId: 11, name: 'Wins Points per Period', abbr: 'PWP', legend: 'PWP: Wins Points per Period' }, 627 126: { id: 126, sportId: 11, name: 'Losses Points per Period', abbr: 'PLP', legend: 'PLP: Losses Points per Period' }, 628 127: { id: 127, sportId: 11, name: 'Ties Points per Period', abbr: 'PTP', legend: 'PTP: Ties Points per Period' }, 629 128: { id: 128, sportId: 11, name: '+/-', abbr: 'DIFF', legend: 'DIFF : Goals Differential' }, 630 129: { id: 129, sportId: 12, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 631 130: { id: 130, sportId: 12, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 632 131: { id: 131, sportId: 12, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 633 132: { id: 132, sportId: 12, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 634 133: { id: 133, sportId: 12, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 635 134: { id: 134, sportId: 12, name: 'Points For', abbr: 'PF', legend: 'PF: Points For' }, 636 135: { id: 135, sportId: 12, name: 'Points Against', abbr: 'PA', legend: 'PA: Points Against' }, 637 136: { id: 136, sportId: 12, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 638 137: { id: 137, sportId: 12, name: 'Bad Point', abbr: 'BAP', legend: 'BAP: Bad Point' }, 639 138: { id: 138, sportId: 12, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 640 139: { id: 139, sportId: 15, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 641 140: { id: 140, sportId: 15, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 642 141: { id: 141, sportId: 15, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 643 142: { id: 142, sportId: 15, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 644 143: { id: 143, sportId: 15, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 645 144: { id: 144, sportId: 15, name: 'Goals For', abbr: 'GF', legend: 'GF: Goals For' }, 646 145: { id: 145, sportId: 15, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 647 146: { id: 146, sportId: 15, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 648 147: { id: 147, sportId: 15, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 649 148: { id: 148, sportId: 14, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 650 149: { id: 149, sportId: 14, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 651 150: { id: 150, sportId: 14, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 652 151: { id: 151, sportId: 14, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 653 152: { id: 152, sportId: 14, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 654 153: { id: 153, sportId: 14, name: 'Goals For', abbr: 'GF', legend: 'GF: Goals For' }, 655 154: { id: 154, sportId: 14, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 656 155: { id: 155, sportId: 14, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 657 156: { id: 156, sportId: 13, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 658 157: { id: 157, sportId: 13, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 659 158: { id: 158, sportId: 13, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 660 159: { id: 159, sportId: 13, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 661 160: { id: 160, sportId: 13, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 662 161: { id: 161, sportId: 13, name: 'Goals For', abbr: 'GF', legend: 'GF: Goals For' }, 663 162: { id: 162, sportId: 13, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 664 163: { id: 163, sportId: 13, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 665 164: { id: 164, sportId: 13, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 666 165: { id: 165, sportId: 10, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 667 166: { id: 166, sportId: 10, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 668 167: { id: 167, sportId: 10, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 669 168: { id: 168, sportId: 10, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 670 169: { id: 169, sportId: 10, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 671 170: { id: 170, sportId: 10, name: 'Goals For', abbr: 'GF', legend: 'GF: Goals For' }, 672 171: { id: 171, sportId: 10, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 673 172: { id: 172, sportId: 10, name: '+/-', abbr: 'DIFF', legend: 'DIFF: Differential' }, 674 173: { id: 173, sportId: 12, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 675 174: { id: 174, sportId: 14, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 676 175: { id: 175, sportId: 2, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 677 176: { id: 176, sportId: 2, name: 'Manual Standings', abbr: 'MS', legend: 'MS: Manual Standings' }, 678 177: { id: 177, sportId: 6, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 679 178: { id: 178, sportId: 6, name: 'Fault', abbr: 'F', legend: 'F: Fault' }, 680 179: { id: 179, sportId: 15, name: 'Manual Standings', abbr: 'MS', legend: 'MS: Manual Standings' }, 681 180: { id: 180, sportId: 14, name: 'Manual Standings', abbr: 'MS', legend: 'MS: Manual Standings' }, 682 181: { id: 181, sportId: 1, name: 'Best Differential #1', abbr: 'BD', legend: 'BD: (Goals for + Goals against) / Goals against.' }, 683 182: { id: 182, sportId: 3, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 684 183: { id: 183, sportId: 1, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 685 184: { id: 184, sportId: 6, name: 'Manual Standings', abbr: 'MS', legend: 'MS: Manual Standings' }, 686 185: { id: 185, sportId: 1, name: 'Best Differential #3', abbr: 'BD', legend: 'BD: Goals for / Goals against' }, 687 186: { id: 186, sportId: 1, name: 'Shots', abbr: 'S', legend: 'S: Shots' }, 688 187: { id: 187, sportId: 1, name: 'Shots Received', abbr: 'SR', legend: 'SR: Shots Received' }, 689 188: { id: 188, sportId: 1, name: 'Victory Regulatory Time', abbr: 'VRT', legend: 'VRT: Victory Regulatory Time' }, 690 189: { id: 189, sportId: 1, name: 'PowerPlay', abbr: 'PP', legend: 'PP: PowerPlay' }, 691 190: { id: 190, sportId: 1, name: 'PowerPlay Chance', abbr: 'PPC', legend: 'PPC: PowerPlay Chance' }, 692 191: { id: 191, sportId: 1, name: 'Goals Against SHG', abbr: 'GASHG', legend: 'GASHG: Goals Against SHG' }, 693 192: { id: 192, sportId: 1, name: 'Number Shorthanded', abbr: 'NS', legend: 'NS: Number Shorthanded' }, 694 193: { id: 193, sportId: 1, name: 'Special Point', abbr: 'SP', legend: 'SP: Special Point' }, 695 194: { id: 194, sportId: 1, name: 'Winning Percentage', abbr: 'PCT', legend: 'PCT: Winning Percentage' }, 696 203: { id: 203, sportId: 7, name: 'Bonus Points', abbr: 'BP', legend: 'BP: Bonus Points' }, 697 204: { id: 204, sportId: 7, name: 'Sets Won', abbr: 'SW', legend: 'SW: Sets Won' }, 698 205: { id: 205, sportId: 7, name: 'Sets Lost', abbr: 'SL', legend: 'SL: Sets Lost' }, 699 }, 700 701 sportPlayerStats: { 702 position: { name: "Position", abbr: "POS", legend: "POS: Position" }, 703 rank: { name: "Rank", abbr: "RK", legend: "RK: Rank" }, 704 6: { id: 6, sportId: 1, name: 'Goals', abbr: 'G', legend: 'G: Goals' }, 705 7: { id: 7, sportId: 1, name: 'Assist', abbr: 'A', legend: 'A: Assist' }, 706 8: { id: 8, sportId: 1, name: 'Penalty', abbr: 'PIM', legend: 'P: Penalty in minutes' }, 707 9: { id: 9, sportId: 1, name: 'Shots', abbr: 'S', legend: 'S: Shots' }, 708 10: { id: 10, sportId: 1, name: 'Saves', abbr: 'Sa', legend: 'Sa: Saves' }, 709 11: { id: 11, sportId: 1, name: 'Check', abbr: 'C', legend: 'C: Check' }, 710 12: { id: 12, sportId: 1, name: 'Shootout Goals', abbr: 'SG', legend: 'SG: Shootout Goals' }, 711 13: { id: 13, sportId: 1, name: 'Shootout Saves', abbr: 'SS', legend: 'SS: Shootout Saves' }, 712 14: { id: 14, sportId: 1, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 713 15: { id: 15, sportId: 1, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 714 16: { id: 16, sportId: 1, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 715 17: { id: 17, sportId: 1, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 716 18: { id: 18, sportId: 1, name: 'Overtime Win', abbr: 'OW', legend: 'OW: Overtime Win' }, 717 19: { id: 19, sportId: 1, name: 'Overtime Loss', abbr: 'OL', legend: 'OL: Overtime Loss' }, 718 20: { id: 20, sportId: 1, name: 'Shootout Win', abbr: 'SW', legend: 'SW: Shootout Win' }, 719 21: { id: 21, sportId: 1, name: 'Shootout Loss', abbr: 'SL', legend: 'SL: Shootout Loss' }, 720 22: { id: 22, sportId: 1, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 721 23: { id: 23, sportId: 1, name: 'Shot Against', abbr: 'SA', legend: 'SA: Shot Against' }, 722 24: { id: 24, sportId: 1, name: 'Minutes Played', abbr: 'Min', legend: 'Min: Minutes Played' }, 723 25: { id: 25, sportId: 1, name: 'Shutouts', abbr: 'SO', legend: 'SO: Shutouts' }, 724 26: { id: 26, sportId: 1, name: 'Powerplay goal', abbr: 'PPG', legend: 'PPG: Powerplay Goal' }, 725 27: { id: 27, sportId: 1, name: 'Shorthanded Goal', abbr: 'SHG', legend: 'SHG: Shorthanded Goal' }, 726 28: { id: 28, sportId: 1, name: 'Winning Goal', abbr: 'WG', legend: 'WG: Winning Goal' }, 727 29: { id: 29, sportId: 1, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 728 30: { id: 30, sportId: 1, name: 'Efficiency', abbr: 'E', legend: 'E: Efficiency' }, 729 31: { id: 31, sportId: 1, name: 'Points per game', abbr: 'PPG', legend: 'PPM: Points per game' }, 730 32: { id: 32, sportId: 1, name: 'Goals Against Average', abbr: 'GAA', legend: 'GAA: Goals Against Average' }, 731 33: { id: 33, sportId: 1, name: 'Loss overtime and shootout', abbr: 'LOF', legend: 'LOF: Loss overtime and shootout' }, 732 34: { id: 34, sportId: 6, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 733 35: { id: 35, sportId: 6, name: 'Game Started', abbr: 'GS', legend: 'GS: Game Started' }, 734 36: { id: 36, sportId: 6, name: 'Minutes Played', abbr: 'Min', legend: 'Min: Minutes Played' }, 735 37: { id: 37, sportId: 6, name: 'Goals', abbr: 'G', legend: 'G: Goals' }, 736 38: { id: 38, sportId: 6, name: 'Assists', abbr: 'A', legend: 'A: Assists' }, 737 39: { id: 39, sportId: 6, name: 'Shots', abbr: 'S', legend: 'S: Shots' }, 738 40: { id: 40, sportId: 6, name: 'Shots on Goal', abbr: 'SOT', legend: 'SOT: Shots on Goal' }, 739 41: { id: 41, sportId: 6, name: 'Fouls', abbr: 'F', legend: 'F: Fouls' }, 740 42: { id: 42, sportId: 6, name: 'Offside', abbr: 'OS', legend: 'OS: Offside' }, 741 43: { id: 43, sportId: 6, name: 'Yellow Cards', abbr: 'YC', legend: 'YC: Yellow Cards' }, 742 44: { id: 44, sportId: 6, name: 'Red Cards', abbr: 'RC', legend: 'RC: Red Cards' }, 743 45: { id: 45, sportId: 6, name: 'Shots Blocked', abbr: 'SB', legend: 'SB: Shots Blocked' }, 744 46: { id: 46, sportId: 6, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 745 47: { id: 47, sportId: 6, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 746 48: { id: 48, sportId: 6, name: 'Tie Games', abbr: 'T', legend: 'T: Tie Games' }, 747 49: { id: 49, sportId: 6, name: 'Shutouts', abbr: 'SO', legend: 'SO: Shutouts' }, 748 50: { id: 50, sportId: 6, name: 'Goals Against', abbr: 'GA', legend: 'GA: Goals Against' }, 749 51: { id: 51, sportId: 6, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 750 52: { id: 52, sportId: 6, name: 'Goals Against Average', abbr: 'GAA', legend: 'GAA: Goals Against Average' }, 751 53: { id: 53, sportId: 14, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 752 54: { id: 54, sportId: 14, name: 'Goals', abbr: 'G', legend: 'G: Goals' }, 753 55: { id: 55, sportId: 14, name: 'Penalty Goal', abbr: 'PG', legend: 'PG: Penalty Goal' }, 754 56: { id: 56, sportId: 14, name: 'Yellow Cards', abbr: 'YC', legend: 'YC: Yellow Cards' }, 755 57: { id: 57, sportId: 14, name: 'Two minutes', abbr: '2Min', legend: '2Min: Two Minutes' }, 756 58: { id: 58, sportId: 14, name: 'Red Cards', abbr: 'RC', legend: 'RC: Red Cards' }, 757 59: { id: 59, sportId: 14, name: 'Blue Cards', abbr: 'BC', legend: 'BC: Blue Cards' }, 758 60: { id: 60, sportId: 14, name: 'Points', abbr: 'PTS', legend: 'PTS: Points' }, 759 61: { id: 61, sportId: 14, name: 'Average', abbr: 'Av', legend: 'Av: Average' }, 760 62: { id: 62, sportId: 1, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 761 63: { id: 63, sportId: 6, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 762 64: { id: 64, sportId: 6, name: 'Minutes Played', abbr: 'Min', legend: 'Min: Minutes Played' }, 763 65: { id: 65, sportId: 2, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 764 66: { id: 66, sportId: 2, name: 'Plate Appearance', abbr: 'PA', legend: 'PA: PlateAppearance' }, 765 67: { id: 67, sportId: 2, name: 'At Bat', abbr: 'AB', legend: 'AB: At Bat' }, 766 68: { id: 68, sportId: 2, name: 'Simple', abbr: '1B', legend: '1B: Singles' }, 767 69: { id: 69, sportId: 2, name: 'Doubles', abbr: '2B', legend: '2B: Doubles' }, 768 70: { id: 70, sportId: 2, name: 'Triple', abbr: '3B', legend: '3B: Triples' }, 769 71: { id: 71, sportId: 2, name: 'Home Runs', abbr: 'HR', legend: 'HR: Home Runs' }, 770 72: { id: 72, sportId: 2, name: 'Bases on Balls', abbr: 'BB', legend: 'BB: Bases on Balls' }, 771 73: { id: 73, sportId: 2, name: 'Hits By Pitch', abbr: 'HP', legend: 'HP: Hits By Pitch' }, 772 74: { id: 74, sportId: 2, name: 'Sacrifice Flies', abbr: 'SF', legend: 'SF: Sacrifice Flies' }, 773 75: { id: 75, sportId: 2, name: 'Runs Batted In', abbr: 'RBI', legend: 'RBI: Runs Batted In' }, 774 76: { id: 76, sportId: 2, name: 'Strikeouts', abbr: 'SO', legend: 'SO: Strikeouts' }, 775 77: { id: 77, sportId: 2, name: 'Runs Scored', abbr: 'R', legend: 'R: Runs Scored' }, 776 78: { id: 78, sportId: 2, name: 'Runs Batted In', abbr: 'RBI', legend: 'RB: Runs Batted In' }, 777 79: { id: 79, sportId: 2, name: 'Stolen Base', abbr: 'SB', legend: 'SB: Stolen Bases' }, 778 80: { id: 80, sportId: 2, name: 'Hits', abbr: 'H', legend: 'H: Hits' }, 779 81: { id: 81, sportId: 2, name: 'Batting Average', abbr: 'AVG', legend: 'AVG: Batting Average' }, 780 82: { id: 82, sportId: 2, name: 'Slugging Average', abbr: 'SLG', legend: 'SLG: Slugging Average' }, 781 83: { id: 83, sportId: 2, name: 'On Base Percentage', abbr: 'OBP', legend: 'OBP: On Base Percentage' }, 782 85: { id: 85, sportId: 2, name: 'TotalBases', abbr: 'TB', legend: 'TB: Total Bases' }, 783 86: { id: 86, sportId: 2, name: 'On Base Plus Slogging', abbr: 'OPS', legend: 'OPS: On Base Plus Slogging' }, 784 87: { id: 87, sportId: 2, name: 'Pitchs', abbr: 'P', legend: 'P: Pitchs' }, 785 88: { id: 88, sportId: 2, name: 'Balls', abbr: 'B', legend: 'B: Balls' }, 786 89: { id: 89, sportId: 2, name: 'Strike', abbr: 'S', legend: 'S: Strike'
786 }, 787 90: { id: 90, sportId: 2, name: 'Out', abbr: 'O', legend: 'O: Out' }, 788 91: { id: 91, sportId: 2, name: 'StrikeOuts', abbr: 'SO', legend: 'SO: StrikeOuts' }, 789 92: { id: 92, sportId: 2, name: 'Base On Balls', abbr: 'BB', legend: 'BB: Base On Balls' }, 790 93: { id: 93, sportId: 2, name: 'Earned Runs', abbr: 'ER', legend: 'ER: Earned Runs' }, 791 94: { id: 94, sportId: 2, name: 'Batter Faced', abbr: 'BF', legend: 'BF: Batter Faced' }, 792 95: { id: 95, sportId: 2, name: 'Hits Allowed', abbr: 'HA', legend: 'HA: Hits Allowed' }, 793 96: { id: 96, sportId: 2, name: 'Wins', abbr: 'W', legend: 'W: Wins' }, 794 97: { id: 97, sportId: 2, name: 'Losses', abbr: 'L', legend: 'L: Losses' }, 795 98: { id: 98, sportId: 2, name: 'Saves', abbr: 'S', legend: 'S: Saves' }, 796 99: { id: 99, sportId: 2, name: 'Innings Pitched', abbr: 'IP', legend: 'IP: Innings Pitched' }, 797 100: { id: 100, sportId: 2, name: 'Earned Runs Average', abbr: 'ERA', legend: 'ERA: Earned Runs Average' }, 798 101: { id: 101, sportId: 2, name: 'Opponents Batting Average', abbr: 'OPA', legend: 'OPA: Opponents Batting Average' }, 799 102: { id: 102, sportId: 2, name: 'Inherited Runs Allowed', abbr: 'IRA', legend: 'IRA: Inherited Runs Allowed' }, 800 103: { id: 103, sportId: 2, name: 'Hit by pitch', abbr: 'HBP', legend: 'HBP: Hit by pitch' }, 801 104: { id: 104, sportId: 2, name: 'Games Played', abbr: 'GP', legend: 'GP: Games Played' }, 802 105: { id: 105, sportId: 2, name: 'Errors', abbr: 'E', legend: 'E: Errors' }, 803 106: { id: 106, sportId: 2, name: 'Caught Stealing', abbr: 'CS', legend: 'CS: Caught Stealing' }, 804 107: { id: 107, sportId: 2, name: 'Total Outs', abbr: 'O', legend: 'O: Total Outs' }, 805 108: { id: 108, sportId: 2, name: 'Assists', abbr: 'A', legend: 'A: Assists' }, 806 109: { id: 109, sportId: 2, name: 'Ground Outs', abbr: 'GO', legend: 'GO: Ground Outs' }, 807 110: { id: 110, sportId: 2, name: 'Fly Outs', abbr: 'FO', legend: 'FO: Fly Outs' }, 808 111: { id: 111, sportId: 2, name: 'Fielder\'s Choices', abbr: 'FC', legend: 'FC: Fielder\'s Choices' } 809 }, 810 811 hockeyShootout: { 812 goal: { id: 257, name: 'Goal', Abb: 'G' }, 813 save: { id: 258, name: 'Save', Abb: 'S' } 814 }, 815 816 statType: [//for Abb max 15 caracts 817 { id: 1, text: 'Goals', Abb: 'Goals' }, 818 { id: 2, text: 'Assist', Abb: 'Assist' }, 819 { id: 3, text: 'Points', Abb: 'Points' }, 820 { id: 4, text: 'Points/GP', Abb: 'Points/GP' }, 821 { id: 5, text: 'Games Played', Abb: 'Games Played' }, 822 { id: 6, text: 'Wins', Abb: 'Wins' }, 823 { id: 7, text: 'Average', Abb: 'Average' }, 824 { id: 8, text: 'Shutouts', Abb: 'Shutouts' }, 825 { id: 9, text: 'Penalty minutes', Abb: 'Penalty min.' }, 826 { id: 10, text: 'Losses', Abb: 'Losses' }, 827 { id: 11, text: 'Tie Games', Abb: 'Tie Games' }, 828 { id: 12, text: 'Shootout Losses', Abb: 'Shootout L.' }, 829 { id: 13, text: 'Overtime Losses', Abb: 'Overtime L.' }, 830 { id: 14, text: 'Goals against', Abb: 'Goals against' }, 831 { id: 15, text: 'Goals Against Average', Abb: 'Avg Goals Aga.' }, 832 { id: 16, text: 'Minutes', Abb: 'Minutes' }, 833 { id: 24, text: 'Minutes', Abb: 'Minutes' }, 834 { id: 25, text: 'Shutouts', Abb: 'Shutouts' }, 835 ], 836 837 teamStatType: [ 838 { id: 1, text: 'Wins' }, 839 { id: 2, text: 'Goals' }, 840 { id: 3, text: 'Goals Against' }, 841 { id: 4, text: '+/-' } 842 ], 843 844 rapportType: [ 845 { id: 1, text: 'Summary' }, 846 { id: 1, text: 'Complete' } 847 ], 848 849 standingList: [ 850 { id: 'general', text: 'General' }, 851 { id: 'section', text: 'By section' } 852 ], 853 854 calendarType: [ 855 { id: 1, text: 'Regular Season' }, 856 { id: 2, text: 'Playoffs' }, 857 { id: 3, text: 'Pre-season' } 858 ], 859 seasonType: { 860 regular: { id: 1, text: 'Regular Season' }, 861 playoff: { id: 2, text: 'Playoffs' }, 862 preseason: { id: 3, text: 'Pre-season' }, 863 singleElimination: { id: 6, text: 'Single Eliminiation' }, 864 roundRobinSingleElimination: { id: 7, text: 'Round Robin + Single Elimination' } 865 }, 866
867 penaltiesType: [ 868 { id: 1, text: 'Tripping'}, 869 { id: 2, text: 'Slashing' }, 870 { id: 3, text: 'Roughing' }, 871 { id: 4, text: 'Game misconduct' }, 872 { id: 5, text: 'Extreme game misconduct' }, 873 { id: 6, text: '(MAJ) Fighting' }, 874 ], 875 876 starType: [ 877 { id: 1, title: '1st STAR' }, 878 { id: 2, title: '2nd STAR' }, 879 { id: 3, title: '3rd STAR' }, 880 { id: 4, title: 'Goalie of Game' }, 881 { id: 5, title: 'Player of Game' }, 882 { id: 6, title: 'Offensive Star' }, 883 { id: 7, title: 'Defensive Star' }, 884 ], 885 886 categoryType: { 887 goalie: 1, 888 forward: 2 889 }, 890 891 matchStateType: { 892 scheduled: { id: 1, title: 'Scheduled' }, 893 ongoing: { id: 2, title: 'Ongoing' }, 894 finished: { id: 3, title: 'Finished' }, 895 stopped: { id: 4, title: 'Stopped' }, 896 delayed: { id: 5, title: 'Delayed' }, 897 }, 898 899 phoneType: [ 900 { id: '1', name: 'Home' }, 901 { id: '2', name: 'Work' }, 902 { id: '3', name: 'Cellphone' } 903 ], 904 905 hockeyUserPosition: { 906 center: { id: 5, description: 'Centre', abbreviation: 'C' }, 907 rightWing: { id: 6, description: 'Right Wing', abbreviation: 'RW' }, 908 leftWing: { id: 7, description: 'Left Wing', abbreviation: 'LW' }, 909 forward: { id: 2, description: 'Forward', abbreviation: 'F' }, 910 defense: { id: 3, description: 'Defense', abbreviation: 'D' }, 911 goalie: { id: 4, description: 'Goalie', abbreviation: 'G' }, 912 player: { id: 8, description: 'Forward/Defence', abbreviation: 'F/D' }, 913 undefined: { id: '', description: 'N/A', abbreviation: '' } 914 }, 915 916 sportUserPosition: { 917 1: { 918 center: { id: 5, description: 'Center', abbreviation: 'C', categoryId: 2 }, 919 rightWing: { id: 6, description: 'Right Wing', abbreviation: 'RW', categoryId: 2 }, 920 leftWing: { id: 7, description: 'Left Wing', abbreviation: 'LW', categoryId: 2 }, 921 forward: { id: 2, description: 'Forward', abbreviation: 'F', categoryId: 2 }, 922 defense: { id: 3, description: 'Defense', abbreviation: 'D', categoryId: 2 }, 923 goalie: { id: 4, description: 'Goaltender', abbreviation: 'G', categoryId: 1 }, 924 player: { id: 8, description: 'Forward/Defence', abbreviation: 'F/D', categoryId: 2 }, 925 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 926 }, 927 2: { 928 pitcher: { id: 61, description: 'Pitcher', abbreviation: 'P', categoryId: 8 }, 929 firstBase: { id: 62, description: 'First Baseman', abbreviation: '1B', categoryId: 9 }, 930 secondBase: { id: 63, description: 'Second Baseman', abbreviation: '2B', categoryId: 9 }, 931 thirdBase: { id: 64, description: 'Third Baseman', abbreviation: '3B', categoryId: 9 }, 932 shortStop: { id: 65, description: 'Shortstop', abbreviation: 'SS', categoryId: 9 }, 933 catcher: { id: 66, description: 'Catcher', abbreviation: 'C', categoryId: 9 }, 934 leftField: { id: 67, description: 'Left Fielder', abbreviation: 'LF', categoryId: 9 }, 935 centerField: { id: 68, description: 'Center Fielder', abbreviation: 'CF', categoryId: 9 }, 936 rightField: { id: 69, description: 'Right Fielder', abbreviation: 'RF', categoryId: 9 }, 937 designatedHitter: { id: 75, description: 'Designated Hitter', abbreviation: 'DH', categoryId: 9 }, 938 outfielder: { id: 135, description: 'Outfielder', abbreviation: 'OF', categoryId: 9 }, 939 rover: { id: 136, description: 'Rover', abbreviation: 'R', categoryId: 9 }, 940 infielder: { id: 137, description: 'Infielder', abbreviation: 'IF', categoryId: 9 }, 941 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 942 }, 943 3: { 944 quarterback: { id: 34, description: 'Quarterback', abbreviation: 'QB', categoryId: 5 }, 945 runningBack: { id: 35, description: 'Running Back', abbreviation: 'RB', categoryId: 5 }, 946 halfback: { id: 36, description: 'Halfback', abbreviation: 'HB', categoryId: 5 }, 947 fullback: { id: 37, description: 'Fullback', abbreviation: 'FB', categoryId: 5 }, 948 wideReceiver: { id: 38, description: 'Wide Receiver', abbreviation: 'WR', categoryId: 5 }, 949 defensiveHalfback: { id: 39, description: 'Defensive Halfback', abbreviation: 'DH', categoryId: 6 }, 950 offensiveTackle: { id: 40, description: 'Offensive Tackle', abbreviation: 'OT', categoryId: 5 }, 951 center: { id: 41, description: 'Center', abbreviation: 'C', categoryId: 5 }, 952 offensiveGuard: { id: 42, description: 'Offensive Guard', abbreviation: 'OG', categoryId: 5 }, 953 slotBack: { id: 43, description: 'Slot-Back', abbreviation: 'SB', categoryId: 5 }, 954 tackle: { id: 44, description: 'Tackle', abbreviation: 'T', categoryId: 6 }, 955 defensiveTackle: { id: 45, description: 'Defensive Tackle', abbreviation: 'DT',
955categoryId: 6 }, 956 strongSafety: { id: 46, description: 'Strong Safety', abbreviation: 'SS', categoryId: 6 }, 957 defensiveEnd: { id: 47, description: 'Defensive End', abbreviation: 'DE', categoryId: 6 }, 958 linebacker: { id: 48, description: 'Linebacker', abbreviation: 'LB', categoryId: 6 }, 959 outsideLinebacker: { id: 49, description: 'Outside Linebacker', abbreviation: 'OLB', categoryId: 6 }, 960 middleLinebacker: { id: 50, description: 'Middle Linebacker', abbreviation: 'MLB', categoryId: 6 }, 961 defensiveBack: { id: 51, description: 'Defensive Back', abbreviation: 'DB', categoryId: 6 }, 962 cornerback: { id: 52, description: 'Cornerback', abbreviation: 'CB', categoryId: 6 }, 963 defensiveTackle: { id: 53, description: 'Defensive Tackle', abbreviation: 'DT', categoryId: 6 }, 964 punter: { id: 54, description: 'Punter', abbreviation: 'P', categoryId: 7 }, 965 kicker: { id: 55, description: 'Kicker', abbreviation: 'K', categoryId: 7 }, 966 puntReturner: { id: 56, description: 'Punt Returner', abbreviation: 'PR', categoryId: 7 }, 967 freeSafety: { id: 70, description: 'Free Safety', abbreviation: 'FS', categoryId: 6 }, 968 tightEnd: { id: 71, description: 'Tight End', abbreviation: 'TE', categoryId: 5 }, 969 longSnapper: { id: 72, description: 'Long Snapper', abbreviation: 'LS', categoryId: 7 }, 970 kickoffSpecialist: { id: 73, description: 'Kickoff Specialist', abbreviation: 'KOS', categoryId: 7 }, 971 kickReturner: { id: 74, description: 'Kick Returner', abbreviation: 'LKR', categoryId: 7 }, 972 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 973 }, 974 4: { 975 pointGuard: { id: 76, description: 'Point Guard', abbreviation: 'PG', categoryId: 10 }, 976 shootingGuard: { id: 77, description: 'Shooting Guard', abbreviation: 'SG', categoryId: 10 }, 977 smallForward: { id: 78, description: 'Small Forward', abbreviation: 'SF', categoryId: 10 }, 978 powerForward: { id: 79, description: 'Power Forward', abbreviation: 'PF', categoryId: 10 }, 979 center: { id: 80, description: 'Center', abbreviation: 'C', categoryId: 10 }, 980 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 981 }, 982 6: { 983 goalkeeper: { id: 57, description: 'Goalkeeper', abbreviation: 'GK', categoryId: 4 }, 984 defender: { id: 58, description: 'Defensive', abbreviation: 'D', categoryId: 3 }, 985 midfield: { id: 59, description: 'Midfield', abbreviation: 'M', categoryId: 3 }, 986 attacking: { id: 60, description: 'Attacking', abbreviation: 'A', categoryId: 3 }, 987 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 988 }, 989 7: { 990 middle: { id: 87, description: 'Middle', abbreviation: 'M', categoryId: 13 }, 991 setter: { id: 88, description: 'Setter', abbreviation: 'S', categoryId: 13 }, 992 libero: { id: 89, description: 'Libero', abbreviation: 'L', categoryId: 13 }, 993 hitter: { id: 90, description: 'Hitter', abbreviation: 'H', categoryId: 13 }, 994 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 995 }, 996 10: { 997 player: { id: 138, description: 'Player', abbreviation: 'P', categoryId: 20 }, 998 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 999 }, 1000 11: { 1001 defensmen: { id: 81, description: 'Defense', abbreviation: 'D', categoryId: 11 }, 1002 forward: { id: 82, description: 'Forward', abbreviation: 'F', categoryId: 11 }, 1003 rightWing: { id: 83, description: 'Right Wing', abbreviation: 'RW', categoryId: 11 }, 1004 leftWing: { id: 84, description: 'Left Wing', abbreviation: 'LW', categoryId: 11 }, 1005 center: { id: 85, description: 'Center', abbreviation: 'C', categoryId: 11 }, 1006 goaltender: { id: 86, description: 'Goaltender', abbreviation: 'G',
1006categoryId: 12 }, 1007 undefined: { id: 0, description: 'N/A', abbreviation: '' } 1008 }, 1009 12: { 1010 forward: { id: 91, description: 'Forward', abbreviation: 'F', categoryId: 14 }, 1011 firstRow: { id: 92, description: 'First Row', abbreviation: '1st R', categoryId: 14 }, 1012 secondRow: { id: 93, description: 'Second Row', abbreviation: '2nd R', categoryId: 14 }, 1013 thirdRow: { id: 94, description: 'Third Row', abbreviation: '3nd R', categoryId: 14 }, 1014 half: { id: 95, description: 'Half', abbreviation: 'HA', categoryId: 14 }, 1015 backRows: { id: 96, description: 'Back Rows', abbreviation: 'BR', categoryId: 14 }, 1016 center: { id: 97, description: 'Center', abbreviation: 'C', categoryId: 14 }, 1017 wing: { id: 98, description: 'Wing', abbreviation: 'W', categoryId: 14 }, 1018 looseHeadProp: { id: 99, description: 'Loose Head Prop', abbreviation: 'LHP', categoryId: 14 }, 1019 prop: { id: 100, description: 'Prop', abbreviation: 'P', categoryId: 14 }, 1020 hooker: { id: 101, description: 'Hooker', abbreviation: 'H', categoryId: 14 }, 1021 tightHeadProp: { id: 102, description: 'Tight Head Prop', abbreviation: 'THP', categoryId: 14 }, 1022 lock: { id: 103, description: 'Lock', abbreviation: 'L', categoryId: 14 }, 1023 leftLock: { id: 104, description: 'Left Lock', abbreviation: 'LL', categoryId: 14 }, 1024 rightLock: { id: 105, description: 'Right Lock', abbreviation: 'RL', categoryId: 14 }, 1025 flanker: { id: 106, description: 'Flanker', abbreviation: 'FL', categoryId: 14 }, 1026 blindsideFlanker: { id: 107, description: 'Blindside Flanker', abbreviation: 'BF', categoryId: 14 }, 1027 opensideFlanker: { id: 108, description: 'Openside Flanker', abbreviation: 'OF', categoryId: 14 }, 1028 number: { id: 109, description: 'Number 8', abbreviation: 'No. 8', categoryId: 14 }, 1029 scrumHalf: { id: 110, description: 'Scrum Half', abbreviation: 'SH', categoryId: 14 }, 1030 flyHalf: { id: 111, description: 'Fly Half', abbreviation: 'FH', categoryId: 14 }, 1031 outsideHalf: { id: 112, description: 'Outside Half', abbreviation: 'OH', categoryId: 14 }, 1032 leftCenter: { id: 113, description: 'Left center', abbreviation: 'LC', categoryId: 14 }, 1033 insideCenter: { id: 114, description: 'Inside Center', abbreviation: 'IC', categoryId: 14 }, 1034 rightCenter: { id: 115, description: 'Right Center', abbreviation: 'RC', categoryId: 14 }, 1035 outsideCenter: { id: 116, description: 'Outside Center', abbreviation: 'OC', categoryId: 14 }, 1036 leftWing: { id: 117, description: 'Left Wing', abbreviation: 'LW', categoryId: 14 }, 1037 rightWing: { id: 118, description: 'Right Wing', abbreviation: 'RW', categoryId: 14 }, 1038 fullBack: { id: 119, description: 'Full-Back', abbreviation: 'FB', categoryId: 14 }, 1039 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 1040 }, 1041 13: { 1042 handler: { id: 120, description: 'Handler', abbreviation: 'H', categoryId: 15 }, 1043 cutter: { id: 121, description: 'Cutter', abbreviation: 'C', categoryId: 15 }, 1044 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 1045 }, 1046 14: { 1047 rightWinger: { id: 122, description: 'Right Winger', abbreviation: 'RW', categoryId: 16 }, 1048 rightBack: { id: 123, description: 'Right Back', abbreviation: 'RB', categoryId: 16 }, 1049 centerBack: { id: 124, description: 'Center Back', abbreviation: 'CB', categoryId: 16 }, 1050 leftBack: { id: 125, description: 'Left Back', abbreviation: 'LB', categoryId: 16 }, 1051 leftWinger: { id: 126, description: 'Left Winger', abbreviation: 'LW', categoryId: 16 }, 1052 centerForward: { id: 127, description: 'Center Forward', abbreviation: 'CF', categoryId: 16 }, 1053 goalKeeper: { id: 128, description: 'Goalkeeper', abbreviation: 'G',
1053categoryId: 17 }, 1054 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 1055 }, 1056 15: { 1057 centerr: { id: 129, description: 'Center', abbreviation: 'C', categoryId: 18 }, 1058 forward: { id: 130, description: 'Forward', abbreviation: 'F', categoryId: 18 }, 1059 leftWinger: { id: 131, description: 'Left Winger', abbreviation: 'LW', categoryId: 18 }, 1060 rightWinger: { id: 132, description: 'Right Winger', abbreviation: 'RW', categoryId: 18 }, 1061 defender: { id: 133, description: 'Defender', abbreviation: 'D', categoryId: 18 }, 1062 goaltender: { id: 134, description: 'Goaltender', abbreviation: 'G', categoryId: 19 }, 1063 undefined: { id: 0, description: 'N/A', abbreviation: '', categoryId: 0 } 1064 } 1065 }, 1066 1067 solutionList: { 1068 league: { id: 1, name: 'League', url: 'league' }, 1069 tournament: { id: 2, name: 'Tournament', url: 'tournament' }, 1070 team: { id: 6, name: 'Team', url: 'team' }, 1071 portal: { id: 10, name: 'Portal', url: 'portal' }, 1072 association: { id: 9, name: 'Organization', url: 'organization' } 1073 }, 1074 1075 solutionType: [ 1076 { id: '1', name: 'League' }, 1077 { id: '2', name: 'Team' }, 1078 { id: '3', name: 'Tournament' }, 1079 { id: '4', name: 'Sport Center' }, 1080 { id: '10', name: 'Portal' } 1081 ], 1082 1083 sport: { 1084 hockey: 'hockey', 1085 baseball: 'baseball', 1086 football: 'football', 1087 basketball: 'basketball', 1088 badminton: 'badminton', 1089 soccer: 'soccer' 1090 }, 1091 1092 facilities: { 1093 title: 'Sports Facilities', 1094 tableHeaders: { 1095 phone: 'Phone', 1096 name: 'Name', 1097 address: 'Address', 1098 city: 'City', 1099 state: 'Province / State', 1100 status: 'Status' 1101 }, 1102 watermarks: { 1103 sportCenters: 'Search' 1104 } 1105 }, 1106 1107 league: { 1108 tabs: { 1109 staffTab: 'Staff', 1110 sportCentersTab: 'Sport Centers', 1111 partnersTab: 'Partners' 1112 }, 1113 tableHeaders: { 1114 staff: 'Staff member', 1115 title: 'Position / Title', 1116 phone: 'Phone', 1117 email: 'Email', 1118 name: 'Name', 1119 address: 'Address', 1120 city: 'City', 1121 state: 'Province / State' 1122 }, 1123 watermarks: { 1124 sportCenters: 'Search' 1125 } 1126 }, 1127 gameResults: { 1128 summaryLabel: 'Summary', 1129 statsLabel: 'Stats', 1130 starsLabel: 'Stars', 1131 mediaLabel: 'Media', 1132 lineupsLabel: 'Lineups', 1133 viewDetailsLabel: 'View Details', 1134 overtimeLabel: 'OT', 1135 endLabel: 'End', 1136 shootouts: 'Shootouts', 1137 dateFormat: 'ddd MMM D', 1138 hourFormat: 'hh:mm A' 1139 }, 1140 downloadTheAppBar: { 1141 downloadTheApp: 'Download the app!', 1142 androidImage: 'https://cache.kreezee.com/images/apppage/google-play-badge-en.png', 1143 iosImage: 'https://cache.kreezee.com/images/apppage/apple-store-badge-en.png' 1144 }, 1145 standings: { 1146 allCaption: 'All', 1147 standingsTitle: 'Standings', 1148 positionHeader: 'POS', 1149 positionDef: 'POS: Standings Position', 1150 teamHeader: 'TEAM', 1151 playerHeader: 'PLAYER', 1152 pjHeader: 'GP', 1153 vHeader: 'W', 1154 dHeader: 'L', 1155 nHeader: 'T', 1156 vpHeader: 'OTW', 1157 vfHeader: 'SOW', 1158 dpHeader: 'OTL', 1159 dfHeader: 'SOL', 1160 banHeader: 'PPG', 1161 bdnHeader: 'SHG', 1162 ptsHeader: 'PTS', 1163 percPtsHeader: '%PTS', 1164 diffHeader: 'DIFF', 1165 percVicHeader: '%VIC', 1166 bpHeader: 'GF', 1167 bcHeader: 'GA', 1168 bcfdHeader: 'ENG', 1169 plusMinusHeader: 'DIFF', 1170 pemHeader: 'PIM', 1171 calendarTypeLabel: 'Calendar type', 1172 calendarLabel: 'Schedule', 1173 allLabel: 'All', 1174 standingLabel:'Standings', 1175 noSectionStandings: 'No by section standings are available for this season' 1176 }, 1177 1178 leagues: { 1179 title: 'League List', 1180 search: 'Search', 1181 headers: { 1182 logo: 'Logo', 1183 name: 'Name', 1184 teamCount: 'Team Count', 1185 playerCount: 'Player Count' 1186 } 1187 }, 1188 1189 syncCalendarDialog: { 1190 subscriptionMode: 'Calendar Subscription Mode', 1191 receiveByEmail: '1. Receive by email',
1192 emailNotifications: 'Email Notifications', 1193 downloadCalendar: '2. Download the calendar', 1194 outlook: 'Outlook', 1195 iphone: 'iPhone', 1196 googleCalendar: 'Google Calendar', 1197 selectSubscription: '3. Select subscription', 1198 subscribe: 'Subscribe' 1199 }, 1200 1201 calendar: { 1202 calendarTitleLabel: 'Schedule', 1203 scoresTitleLabel: 'Scores', 1204 dateDisplay: 'From {0} to {1}', 1205 dayFormat: 'dd MMMM yyyy', 1206 dateFormat: 'dddd, MMMM D, YYYY', 1207 dayPillFormat: 'MMMM D, YYYY', 1208 dayAbbrFormat: 'MMM D, YYYY', 1209 monthFormat: 'MMMM, YYYY', 1210 monthAbbrFormat: 'MMM, YYYY', 1211 listDayFormat: 'DDDD, MMMM dd, yyyy', 1212 hourFormat: 'hh:mm A', 1213 allGames: 'ALL GAMES', 1214 dayFormat: 'MMMM dd, yyyy', 1215 allLabel: 'All', 1216 daysLabel: 'Day', 1217 weekLabel: 'Week', 1218 monthLabel: 'Month', 1219 seasonLabel: 'Season', 1220 threeDaysLabel: '3 days', 1221 tomorrowLabel: 'Tomorrow', 1222 yesterdayLabel: 'Yesterday', 1223 topdataWeek: 'Week of:', 1224 todayLabel: 'Today', 1225 noMatchTitle: 'No games', 1226 summaryLabel: 'Summary', 1227 statsLabel: 'Stats', 1228 mediaLabel: 'Media', 1229 starsLabel: 'Stars', 1230 detailLabel: 'Details', 1231 scorersLabel: 'Scorers', 1232 goaliesLabel: 'Goalies', 1233 overtimeAbbreviation: 'OT', 1234 shootoutsAbbreviation: 'SO', 1235 selectAllTeams: 'Team:All', 1236 teamLabel: 'Team', 1237 divisionLabel: 'Division', 1238 calendarLabel: 'Schedule', 1239 groupLabel: 'Group', 1240 sponsoredBy: 'Sponsored By', 1241 sportCenterLabel: 'Sport Center', 1242 allLabel: 'All', 1243 noScorer: 'No scorer', 1244 noGoalie: 'No goalie', 1245 timeSeparator: ' to ', 1246 home: 'Home', 1247 away: 'Away', 1248 viewDetails: 'View Details', 1249 watchLive: 'Watch Live' 1250 }, 1251 1252 divisions: { 1253 title: 'Divisions', 1254 labels: { 1255 selectSeason: 'Select Season', 1256 selectDivision: 'Select Division' 1257 }, 1258 tabs: { 1259 schedule: 'Schedule', 1260 standings: 'Standings', 1261 brackets: 'Brackets' 1262 } 1263 }, 1264 1265 statsLegend: { 1266 title: 'Legend', 1267 legendPitcher: 'Legend Pitcher', 1268 legendPlayer: 'Legend Player', 1269 legendGoalie: 'Legend Goalie', 1270 stats: { 1271 pj: { abbreviation: 'GP', legend: 'GP : Games Played' }, 1272 v: { abbreviation: 'W', legend: 'W : Wins' }, 1273 d: { abbreviation: 'L', legend: 'L : Losses' }, 1274 n: { abbreviation: 'T', legend: 'T : Tie Games' }, 1275 vp: { abbreviation: 'OTW', legend: 'OTW : Overtime Wins' }, 1276 vf: { abbreviation: 'SOW', legend: 'SOW : Shootout Wins' }, 1277 dp: { abbreviation: 'OTL', legend: 'OTL : Overtime Losses' }, 1278 df: { abbreviation: 'SOL', legend: 'SOL : Shootout Losses' }, 1279 lan: { abbreviation: 'S', legend: 'S : Shots Taken' }, 1280 me: { abbreviation: 'Hits', legend: 'Hits : Hits' }, 1281 mj: { abbreviation: 'FO', legend: 'FO : Faceoffs Taken' }, 1282 mjg: { abbreviation: 'FOW', legend: 'FOW : Faceoffs Won' }, 1283 1284 pts: { abbreviation: 'PTS', legend: 'PTS : Points' }, 1285 percPts: { abbreviation: '%PTS', legend: '%PTS : Points percentage' }, 1286 diff: { abbreviation: 'DIFF', legend: 'DIFF : Differential with top team' }, 1287 percVic: { abbreviation: '%VIC', legend: '%VIC : Victory percentage' }, 1288 1289 bp: { abbreviation: 'GF', legend: 'GF : Goals For' }, 1290 bc: { abbreviation: 'GA', legend: 'GA : Goals Against' }, 1291 1292 pg: { abbreviation: 'PPG', legend: 'PPG : Power Play Goals' }, 1293 sg: { abbreviation: 'SHG', legend: 'SHG : Short Handed Goals' }, 1294 1295 bcfd: { abbreviation: 'ENG', legend: 'ENG : Empty Net Goals' }, 1296 plusMinus: { abbreviation: 'DIFF', legend: 'DIFF : Goals Differential' }, 1297 pem: { abbreviation: 'PIM', legend: 'PIM : Penalty Minutes' }, 1298 1299 a: { abbreviation: 'A', legend: 'A : Assists' }, 1300 b: { abbreviation: 'G', legend: 'G : Goals' }, 1301 ban: { abbreviation: 'PPG', legend: 'PPG : Power Play Goals' }, 1302 bdn: { abbreviation: 'SHG', legend: 'SHG : Short Handed Goals' }, 1303 ptsP: { abbreviation: 'PTS/GP', legend: 'PTS/GP : Average Points per Games Played' }, 1304 sus: { abbreviation: 'SUS', legend: 'SUS : Supension games' }, 1305 bg: { abbreviation: 'GW', legend: 'GW : Game Winning Goals' }, 1306 1307 moy: { abbreviation: 'GAA', legend: 'GAA : Goals Against Average' }, 1308 min: { abbreviation: 'MIN', legend: 'Min : Minutes' }, 1309 bl: { abbreviation: 'SO', legend: 'SO : Shutouts' }, 1310 vd: { abbreviation: 'W/L', legend: 'W/L : Goalie\'s Decision' }, 1311 lc: {abbreviation: 'SA', legend: 'SA : Shots Against'}, 1312 arr: { abbreviation: 'S', legend: 'S : Saves' }, 1313 arrP: { abbreviation: 'Sv%', legend: 'Sv% : Save Percentage' }, 1314 lcf: { abbreviation: 'SOS', legend: 'SOS : Shootout Shots Against' }, 1315 arrf: { abbreviation: 'SOSV', legend: 'SOSV : Shootout Saves' } 1316 } 1317 }, 1318 1319 stats: { 1320 dateFormat: 'MM/DD/YYYY', 1321 menuLead: 'Leaders', 1322 menuTeams: 'Teams', 1323 menuPlayers: 'Players', 1324 menuGoalies: 'Goalies',
1325 menuPitchers: 'Pitchers', 1326 menuSuspensions: 'Suspensions', 1327 selectCaptionSeasonType:'All', 1328 selectCaptionDivision: 'All', 1329 selectCaptionSeason: 'All', 1330 calendarTypeLabel: 'Schedule type', 1331 groupDivisionLabel: 'Group / Division', 1332 teamLabel: 'Team', 1333 calendarLabel: 'Schedule', 1334 statsListTitle: 'Statistics', 1335 positionHeader: 'RK', 1336 positionDef: 'RK : Rank', 1337 teamHeader: 'TEAM', 1338 playerHeader: 'PLAYER', 1339 noHeader: 'No', 1340 matchHeader: 'Games', 1341 startHeader: 'Start', 1342 endHeader: 'End', 1343 detailsHeader: 'Details', 1344 descriptionHeader: 'Description', 1345 allCaption: function () { return 'All' }, 1346 filterLabels: { 1347 calendarType: 'Schedule Type', 1348 calendar: 'Schedule', 1349 teamGroup: 'Team / Group', 1350 group: 'Group / Division', 1351 position: 'Position', 1352 vsTeamGroup: 'vs Team / Group', 1353 reportType: 'Report Type' 1354 }, 1355 tabLeaders: { 1356 completeListLink: 'All Stats', 1357 tabsTitles: { 1358 players: 'Players', 1359 goalies: 'Goalies', 1360 teams: 'Teams' 1361 }, 1362 sectionTitles: { 1363 offensiveLeaders: 'Offensive Leaders', 1364 pitcherLeaders: 'Pitcher Leaders', 1365 goalieLeaders: 'Goalie Leaders', 1366 teamLeaders: 'Team Leaders', 1367 } 1368 } 1369 }, 1370 1371 loginDialog: { 1372 labels: { 1373 login: 'Login', 1374 createAccount: 'Create your New FREE Account', 1375 acceptConditions: 'I accept the terms and conditions', 1376 pendingAccount: 'Your account is waiting for confirmation. An email has been sent to you to validate your identity.', 1377 signupUsing: 'Or sign up using' 1378 }, 1379 placeholders: { 1380 email: 'Email', 1381 password: 'Password', 1382 firstName: 'First Name', 1383 lastName: 'Last Name', 1384 repeatPassword: 'Repeat Password' 1385 }, 1386 buttons: { 1387 createAccount: 'Create my Account' 1388 }, 1389 errors: { 1390 confirmPassword: 'Confirmation password does not match.', 1391 emailAlreadyExists: 'This email already exists' 1392 } 1393 }, 1394 1395 teams: { 1396 noTeamLabel: 'No team found.', 1397 teamListTitle: 'Team list', 1398 logoHeader: 'Logo', 1399 nameHeader: 'Name', 1400 groupDivisionHeader: 'Group / Division', 1401 abbrHeader: 'abbreviation', 1402 searchWatermarkText: 'Search', 1403 selectCaptionDivision: 'Group / Division: All', 1404 selectCaptionSeason:'Season', 1405 selectTitleDivision: 'All' 1406 1407 }, 1408 team: { 1409 noDataLabel:'No results', 1410 goalsForLabel: 'Goals for', 1411 plusMinus: 'Goals Differential', 1412 percVic: 'Victory %', 1413 percPoints: 'Points %', 1414 diff:'Differential', 1415 calendarTypeLabel: 'Schedule Type', 1416 calendarLabel: 'Schedule', 1417 vsTeamLabel: 'vs Team/Group', 1418 reportTypeLabel: 'Report Type', 1419 staffTitleLabel: 'Staff members', 1420 nameHead: 'STAFF MEMBRES', 1421 titleHead: 'POSITION/TITLE', 1422 ageHead: 'AGE', 1423 heightHead: 'Height', 1424 weightHead: 'Weight', 1425 numberHead: '#', 1426 playerHead: 'Player', 1427 goalieHead: 'Goalie', 1428 positionHead: 'Pos', 1429 levelHead: 'Lvl', 1430 matchsHead: 'Games', 1431 startHead: 'Start', 1432 endHead: 'End', 1433 descriptionHead: 'Description', 1434 fansLabel: 'FANS', 1435 pageKreezeeLabel: 'KREEZEE PAGE', 1436 statsPill: 'Stats', 1437 careerStatsPill: 'All Time Stats', 1438 calendarPill: 'Schedule', 1439 lineupPill: 'Roster', 1440 playerStatsPill: 'Players Stats', 1441 staffPill: 'Staff', 1442 mediaPill: 'Media', 1443 sponsorsPill: 'Sponsors', 1444 lineupSection: 'Roster', 1445 playerStatsSection: 'Players Stats', 1446 suspensionSection: 'Suspended players', 1447 teamGroupLabel: 'vs Team/Group', 1448 reportTypeLabel: 'Report type', 1449 allLabel: 'All', 1450 careerStatLabel: 'All Time Stats', 1451 seasonHead: 'Season', 1452 serieHead: 'Playoffs', 1453 rankHead: 'Rank', 1454 teamHead: 'Team', 1455 pjHead: 'GP', 1456 vHead: 'W', 1457 dHead: 'L', 1458 nHead: 'T', 1459 vpHead: 'OTW', 1460 vfHead: 'SOW', 1461 dpHead: 'OTL', 1462 dfHead: 'SOL', 1463 bpHead: 'GF', 1464 bcHead: 'GA', 1465 bgHead: 'GW', 1466 savePercHead: 'Sv%', 1467 ptsGpHead: 'PTS/GP', 1468 plusMinusHead: 'Diff', 1469 pemHead: 'PIM', 1470 posLegend: 'POS: Player Position', 1471 noLegend: '#: Player Number', 1472 regularSeasonLabel: 'Regular season', 1473 eliminationSeriesLabel: 'Playoffs / Tournament', 1474 noStatsAvailable: 'No Statistics Available', 1475 substitute: '(S)', 1476 sponsorThisTeam: 'Sponsor this team', 1477 manageThisTeam: 'Manage this team', 1478 youAreTheManager: 'You are the manager or the coach of this team?', 1479 clickOnManage: 'Click on <span class="accent">MANAGE THIS TEAM</span> and use the Kreezee Sports team management app.', 1480 synchronizeSchedule: 'Synchronize the schedule with YOUR app. Manager attendances and communications with your team members.' 1481 }, 1482 1483 defaultPage: { 1484 rollOfHonor: 'Highlights', 1485 versus: 'VS', 1486 labels: { 1487 goals: 'goals', 1488 assists: 'assists', 1489 points: 'points', 1490 average: 'avg.', 1491 victories: 'wins', 1492 minutes: 'minutes' 1493 }, 1494 titles: { 1495 leaders: 'Leaders', 1496 gamesToCome: 'Games to come', 1497 teamProfile: 'Team profile', 1498 generalStandings: 'General Standings', 1499 bestScorers: 'Scoring Leaders' 1500 }, 1501 links: { 1502 completeMatchList: 'Complete game list', 1503 completeStatsList: 'Complete statistics', 1504 completeStandings: 'Complete Standings', 1505 } 1506 }, 1507 1508 form: { 1509 fileTooBig: 'The file is too big ({0} mB)',
1510 wrongFormat: 'The file format is invalid', 1511 browse: 'Browse', 1512 limit: 'Maximum registrations limit has been reached.' 1513 }, 1514 1515 score: { 1516 title: 'Game details', 1517 dateTime: 'Date and time: ', 1518 dateFormat: 'dddd, MMMM D, YYYY', 1519 hourFormat: 'hh:mm A', 1520 otFormat: 'Ot{0}', 1521 soHeader: 'So', 1522 periodLabel: 'period', 1523 overtimeLabel: 'overtime', 1524 location: 'Location: ', 1525 calendar: 'Schedule: ', 1526 gameNumber: 'Game No: ', 1527 attendance: 'Attendance: ', 1528 final: 'Final', 1529 shootouts: 'Shootouts', 1530 goalsPerPeriod: { 1531 1: 'Goals per period', 1532 2: 'Points per inning', 1533 3: 'Points per quarter', 1534 6: 'Goals per half' 1535 }, 1536 shotsPerPeriod: 'Shots per period', 1537 sequence: 'Sequence:', 1538 victory: function (plural) { return plural ? 'Wins' : 'Win' }, 1539 tabTitles: { 1540 summary: 'Summary', 1541 scorers: 'Scorers', 1542 stats: 'Stats', 1543 stars: 'Stars', 1544 medias: 'Media', 1545 lineups: 'Lineups' 1546 }, 1547 tabSummary: { 1548 sectionTitles: { 1549 goals: 'Goals', 1550 shootouts: 'Shootouts', 1551 penalties: 'Penalties' 1552 }, 1553 emptyLists: { 1554 penalties: 'No penalty', 1555 goals: 'No goal' 1556 }, 1557 labels: { 1558 period: 'Period', 1559 overtime: 'Overtime', 1560 assists: 'Assists: ', 1561 powerplay: '(PPG)', 1562 shorthanded: '(SHG)' 1563 } 1564 }, 1565 tabScorers: { 1566 players: 'Players', 1567 goalies: 'Goalie (s)', 1568 pitchers: 'Pitchers', 1569 noScorer: 'No Scorer' 1570 }, 1571 tabStats: { 1572 labels: { 1573 total: 'Total', 1574 }, 1575 tableHeaders: { 1576 number: '#', 1577 player: 'PLAYER', 1578 goalie: 'GOALIE', 1579 position: 'POS', 1580 }, 1581 legends: { 1582 number: '# : Player\'s number', 1583 position: 'POS : Player\'s Position' 1584 } 1585 }, 1586 tabStars: { 1587 labels: { 1588 goal: function (plural) { return plural ? 'Goals' : 'Goal' }, 1589 pass: function (plural) { return plural ? 'Passes' : 'Pass' }, 1590 point: function (plural) { return plural ? 'Points' : 'Point' }, 1591 victory: function (plural) { return plural ? 'Wins' : 'Win' }, 1592 save: function (plural) { return plural ? 'Saves' : 'Save' }, 1593 savesP: '% saves' 1594 } 1595 }, 1596 tabLineups: { 1597 tableHeaders: { 1598 age: 'Age', 1599 height: 'Height', 1600 weight: 'Weight', 1601 level: 'Lvl' 1602 } 1603 } 1604 }, 1605 1606 players: { 1607 title: 'Player List', 1608 watermarks: { 1609 search: 'Search a player', 1610 team: 'Team: All', 1611 position: 'Position: All', 1612 season: 'Season: All' 1613 }, 1614 labels: { 1615 search: 'Search', 1616 positions: 'Positions', 1617 }, 1618 tableHeaders: { 1619 number: 'No', 1620 player: 'Player', 1621 position: 'Position', 1622 team: 'Team', 1623 age: 'Age', 1624 height: 'Height', 1625 weight: 'Weight' 1626 } 1627 }, 1628 1629 1630 player: { 1631 informations: { 1632 age: '{0} years old', 1633 weight: '{0} lbs', 1634 fans: 'fans' 1635 }, 1636 statsTab: { 1637 tabTitle: 'Stats', 1638 sectionTitle: 'Statistics', 1639 labels: { 1640 gamePlayed: 'Games Played', 1641 goals: 'Goals', 1642 assists: 'Assists', 1643 points: 'Points', 1644 penaltyMinutes: 'Penalty Minutes', 1645 leader: '(leader)', 1646 victories: 'Wins', 1647 defeats: 'Losses', 1648 ties: 'Tie Games', 1649 overtimeDefeats: 'Overtime Losses', 1650 shootoutDefeats: 'Shootout Losses', 1651 goalsAgainst: 'Goals against', 1652 goalsAgainstAverage: 'Goals Against Average', 1653 minutes: 'Minutes', 1654 shutouts: 'Shutouts', 1655 schedule: 'Schedule', 1656 overtimeShootoutDefeats: 'Shootout or Overtime Losses', 1657 noStatsAvailable: 'No Statistics Available' 1658 } 1659 }, 1660 carreerStatsTab: { 1661 noDataLabel:'No results', 1662 tabTitle: 'All Time Stats', 1663 sectionTitle: 'All Time Stats', 1664 tableHeaders: { 1665 season: 'Season', 1666 team: 'Team', 1667 playoffs: 'Playoffs' 1668 }, 1669 sectionTitles: { 1670 regular: 'Regular Season', 1671 playoffs: 'Playoffs / Tournament', 1672 regularPlayer: 'Regular Season as player', 1673 playoffsPlayer: 'Playoffs as player', 1674 regularGoalie: 'Regular Season as goalie', 1675 playoffsGoalie: 'Playoffs as goalie', 1676 regularPitcher: 'Regular Season as pitcher', 1677 playoffsPitcher: 'Playoffs as pitcher' 1678 } 1679 }, 1680 mediasTab: { 1681 tabTitle: 'Media' 1682 } 1683 1684 }, 1685 1686 news: { 1687 title: 'News', 1688 search: 'Search', 1689 videoSection: 'Videos', 1690 dateFormat: '{0}, {2} {1}, {3}', 1691 allVideos: 'See all videos', 1692 backToNewsLabel: 'SEE ALL NEWS', 1693 }, 1694 1695 medias: { 1696 title: 'Media', 1697 tabs: { 1698 photos: 'Photos', 1699 videos: 'Videos', 1700 albums: 'Albums' 1701 }, 1702 photos: 'Photos', 1703 search: 'Search' 1704 }, 1705 1706 video: { 1707 dateFormat: '{0}, {2} {1}, {3} {4}:{5}' 1708 }, 1709 1710 album: { 1711 search: 'Search' 1712 }, 1713 1714 sportCentreStatus: { 1715 title: 'Sports Facilities', 1716 lastUpdate: 'Last Update: ', 1717 dateFormat: 'MM/DD/YYYY [at] HH:mm', 1718 status: { 1719 opened: 'Opened', 1720 undetermined: 'Undetermined', 1721 closed: 'Closed' 1722 } 1723 }, 1724 1725 bracket: { 1726 title: 'Tournament Brackets', 1727 labels: { 1728 matchWinner: '#{0} Winner', 1729 seed: 'Seed {0}', 1730 summary: 'Summary', 1731 stats: 'Stats', 1732 details: 'Details', 1733 overtimeAbbreviation: 'OT', 1734 period: 'period' 1735 }, 1736 dateFormat: 'ddd MMM D', 1737 timeFormat: 'hh:mm A' 1738 }, 1739 1740 registration: { 1741 title: 'Registration' 1742 }, 1743 1744 product: { 1745 messages: { 1746 addItem: { 1747 success: { 1748 title: '{0} item(s) ajouté(s) au panier', 1749 message: '{0}' 1750 } 1751 } 1752 }, 1753 labels: { 1754 1755 } 1756 } 1757} 1758 1759if(moment) { 1760 moment.locale('en', { 1761 monthsShort : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] 1762 });
1763 1764 moment.locale('fr', { 1765 monthsShort : [ 'Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Déc' ] 1766 }); 1767}; 1768$(function () { 1769 var preloads = [ 1770 '//cache.kreezee.com/images/ajax-loader.gif' 1771 ]; 1772 1773 $(preloads).each(function () { 1774 $('<img />')[0].src = this; 1775 }); 1776 1777 $.ajaxSetup({ 1778 error: function (error) { 1779 if (error.status == 401) { 1780 window.location.href = '/'; 1781 } 1782 } 1783 }) 1784}); 1785 1786window.onhashchange = function () { 1787 core.hashChange(); 1788}; 1789 1790var logger = function () { 1791 var oldConsoleLog = null; 1792 var pub = {}; 1793 1794 pub.enableLogger = function enableLogger() { 1795 if (oldConsoleLog == null) 1796 return; 1797 1798 window['console']['log'] = oldConsoleLog; 1799 }; 1800 1801 pub.disableLogger = function disableLogger() { 1802 oldConsoleLog = console.log; 1803 window['console']['log'] = function () { }; 1804 }; 1805 1806 return pub; 1807}(); 1808 1809function checkIfAdobeFlashIsInstalled() { 1810 if (!$.browser.flash) 1811 $('#adobe-flash-is-staff').toggle(); 1812} 1813 1814// Check if a user email already exist. 1815function checkUserEmail(email) { 1816 var jData = {}; 1817 var result; 1818 jData._email = email; 1819 1820 // Remove CSS styles. 1821 $('#checkUserEmail').removeClass('validationSuccess validationError'); 1822 $('#checkUserEmail').html(''); 1823 1824 if (isValidEmailAddress(email.value)) { 1825 result = Utilities.postJSON(config.webService.wsUser + 'CheckUserEmail', jData); 1826 if (result != null) { 1827 $('#checkUserEmail').addClass('validationError'); 1828 $('#checkUserEmail').html('Erreur'); 1829 1830 } else { 1831 $('#checkUserEmail').addClass('validationSuccess'); 1832 } 1833 } 1834} 1835 1836// Call Search service. 1837function searchTextProfil(obj) { 1838 var jData = {}; 1839 var result; 1840 1841 var searchbox = $(obj).val(); 1842 if (searchbox == '') { 1843 $('#display-search-results').hide(); 1844 } 1845 else { 1846 jData._searchValue = $(obj).val(); 1847 result = Utilities.postJSON(config.webService.wsSearch + 'GetSearchResults', jData); 1848 if (result != null) { 1849 $('#display-search-results').html(result.d).show(); 1850 } 1851 } 1852} 1853 1854var tabs = { 1855 season: { 1856 informations: 0, 1857 divisions: 1, 1858 periods: 2, 1859 standings: 3, 1860 matchs: 4, 1861 stats: 5, 1862 tree: 7 1863 }, 1864 team: { 1865 informations: 0, 1866 //admin: 1, 1867 calendar: 1, 1868 player: 2, 1869 staff: 3, 1870 //media: 5, 1871 suspension: 4, 1872 management: 5, 1873 startingPitchers: 7 1874 }, 1875 match: { 1876 informations: 0, 1877 }, 1878 matchScoreboard: { 1879 lineups: 0, 1880 staffs: 1, 1881 stats: 2, 1882 stars: 3 1883 }, 1884 connection: { 1885 connections: 0, 1886 groups: 1, 1887 fans: 2, 1888 requests: 3, 1889 find: 4 1890 }, 1891 connectionGroup: { 1892 informations: 0, 1893 connections: 1 1894 } 1895}; 1896 1897var images = { 1898 url: '//cache.kreezee.com/', 1899 hockeyTeamDefault: 'images/teams/hockey-team-default.png', 1900 hockeyPlayerDefault: 'images/players/hockey-player-default.png', 1901 newsDefault: 'images/news/News-default.png' 1902}; 1903 1904/************************************************/ 1905/*************** Administration *****************/ 1906/************************************************/ 1907var admin = { 1908 sendContactUs: function (firstName, lastName, email, phoneNumber, organizationName, comments, culture) { 1909 var jData = {}; 1910 jData.firstName = firstName; 1911 jData.lastName = lastName 1912 jData.email = email; 1913 jData.phoneNumber = phoneNumber; 1914 jData.organizationName = organizationName; 1915 jData.comments = comments; 1916 jData.culture = culture; 1917 1918 return data.post(config.webService.wsUserSuscribe + 'SendContactUs', jData); 1919 }, 1920 1921 contactUs: function (name, email, message, culture) { 1922 var jContactUs = {}; 1923 jContactUs.name = name; 1924 jContactUs.email = email 1925 jContactUs.message = message; 1926 jContactUs.culture = culture; 1927 1928 var jData = {}; 1929 jData.contactUs = jContactUs; 1930 1931 return data.post(config.webService.wsUserSuscribe + 'ContactUs', jData); 1932 }, 1933 1934 sendSales: function (firstName, lastName, email, phoneNumber, organizationName, comments, culture) { 1935 var jData = {}; 1936 jData.firstName = firstName; 1937 jData.lastName = lastName 1938 jData.email = email; 1939 jData.phoneNumber = phoneNumber; 1940 jData.organizationName = organizationName; 1941 jData.comments = comments; 1942 jData.culture = culture; 1943 1944 return data.post(config.webService.wsUserSuscribe + 'SendSales', jData); 1945 }, 1946 1947 1948 suscribeUser: function (email, firstName, lastName, sportSelected, culture) { 1949 var jData = {}; 1950 jData.email = email; 1951 jData.firstName = firstName; 1952 jData.lastName = lastName; 1953 jData.sportSelected = sportSelected; 1954 jData.culture = culture; 1955 1956 return Utilities.postJSON(config.webService.wsUserSuscribe + 'SuscribeUser', jData); 1957 }, 1958 1959 unsuscribeUser: function (email) { 1960 var jData = {}; 1961 jData.email = email; 1962 1963 return Utilities.postJSON(config.webService.wsUserSuscribe + 'UnsuscribeUser', jData); 1964 }, 1965 1966 isSuscribeUser: function (email) { 1967 var jData = {}; 1968 jData.email = email; 1969 1970 return Utilities.postJSON(config.webService.wsUserSuscribe + 'IsSuscribeUser', jData); 1971 }, 1972 1973 getSuscribeUser: function (email) { 1974 var jData = {}; 1975 jData.email = email; 1976 1977 return Utilities.postJSON(config.webService.wsUserSuscribe + 'GetUserSuscribe', jData); 1978 }, 1979 1980 getStates: function (culture, callback) { 1981 var jData = {}; 1982 jData.culture = culture; 1983 1984 Utilities.postJSONAsynch(config.webService.wsAdminService + 'GetStates', jData, callback, arguments[2]); 1985 }, 1986 1987 getCustomPageByUrl: function (url, callback) { 1988 var jData = {}; 1989 jData.url = url; 1990 1991 Utilities.postJSONAsynch(config.webService.wsCustomPage + 'GetByUrl', jData, callback, arguments[2]); 1992 }, 1993 1994 createCustomPage: function (url, title, description, body, keywords, callback) { 1995 var jData = {}; 1996 jData.url = url; 1997 jData.title = title; 1998 jData.description = description; 1999 jData.body = body; 2000 jData.keywords = keywords; 2001 2002 Utilities.postJSONAsynch(config.webService.wsCustomPage + 'Create', jData, callback, arguments[6]); 2003 }, 2004 2005 updateCustomPage: function (url, title, description, body, keywords, callback) { 2006 var jData = {}; 2007 jData.url = url; 2008 jData.title = title; 2009 jData.description = description; 2010 jData.body = body; 2011 jData.keywords = keywords; 2012 2013 Utilities.postJSONAsynch(config.webService.wsCustomPage + 'Update', jData, callback, arguments[6]); 2014 }, 2015 2016 deleteCustomPage: function (url, callback) { 2017 var jData = {}; 2018 jData.url = url; 2019 2020 Utilities.postJSONAsynch(config.webService.wsCustomPage + 'Delete', jData, callback, arguments[2]); 2021 }, 2022 2023 importData: function (filePath, solutionId, season, team, seasonTeam, player, sportCenter, match, staff, team_stat, player_stat, callback) { 2024 var jData = {}; 2025 jData.filePath = filePath; 2026 jData.solutionId = solutionId; 2027 jData.season = season; 2028 jData.team = team; 2029 jData.seasonTeam = seasonTeam; 2030 jData.player = player; 2031 jData.sportCenter = sportCenter; 2032 jData.match = match; 2033 jData.staff = staff; 2034 jData.stat_team = team_stat; 2035 jData.stat_player = player_stat; 2036 2037 Utilities.postJSONAsynch(config.webService.wsImportData + 'Import', jData, callback); 2038 }, 2039 2040 importSeasons: function (filePath, match, team_stat, player_stat, callback) { 2041 var jData = {}; 2042 jData.filePath = filePath; 2043 jData.match = match; 2044 jData.stat_team = team_stat; 2045 jData.stat_player = player_stat; 2046 2047 Utilities.postJSONAsynch(config.webService.wsImportData + 'ImportSeasons', jData, callback); 2048 }, 2049 2050 getStateList: function (culture) { 2051 var jData = {}; 2052 2053 if (culture == undefined) { 2054 culture = core.getLanguage(); 2055 } 2056 2057 if (window.sessionStorage.states == undefined) { 2058 jData.culture = culture; 2059 2060 var states = Utilities.postJSON(config.webService.wsAdminService + 'GetStates', jData); 2061 window.sessionStorage.states = JSON.stringify(states); 2062 return JSON.parse(window.sessionStorage.states); 2063 } 2064 else { 2065 return JSON.parse(window.sessionStorage.states); 2066 } 2067 }, 2068 2069 getJersey: function (solutionId) { 2070 var jData = {}; 2071 jData.solutionId = solutionId; 2072 2073 return data.post(config.webService.wsAdminService + 'GetJerseyBySolution', jData); 2074 }, 2075 2076 getUserInformation: function (accountId) { 2077 var jData = {}; 2078 jData.accountId = accountId; 2079 2080 return data.post(config.webService.wsAdminService + 'GetUserInformation', jData); 2081 }, 2082 2083 getStatesByCountry: function (countryId, culture, callback) { 2084 var jData = {}; 2085 jData.countryId = countryId; 2086 jData.culture = culture; 2087 2088 Utilities.postJSONAsynch(config.webService.wsAdminService + 'GetStatesByCountry', jData, callback, arguments[3]); 2089 }, 2090 2091 getSolutionPage: function (solutionId) { 2092 var jData = {}; 2093 jData.solutionId = solutionId; 2094 2095 return data.post(config.webService.wsAdminService + 'GetSolutionPage', jData); 2096 }, 2097
2098 getBackgrounds: function (solutionId) { 2099 var jData = {}; 2100 jData.solutionId = solutionId; 2101 2102 return data.post(config.webService.wsAdminService + 'GetBackgroundsBySolution', jData); 2103 }, 2104 2105 getDocumentationType: function () { 2106 var jData = {}; 2107 2108 return data.post(config.webService.wsAdminService + 'GetDocumentationType', jData); 2109 }, 2110 2111 createItem: function (item) { 2112 var jData = {}; 2113 jData.item = item; 2114 2115 return data.post(config.webService.wsAdminService + 'CreateItem', jData); 2116 }, 2117 2118 updateItem: function (item) { 2119 var jData = {}; 2120 jData.item = item; 2121 2122 return data.post(config.webService.wsAdminService + 'UpdateItem', jData); 2123 }, 2124 2125 deleteItem: function (itemId) { 2126 var jData = {}; 2127 jData.itemId = itemId; 2128 2129 return data.post(config.webService.wsAdminService + 'DeleteItem', jData); 2130 }, 2131 2132 searchItem: function (culture, searchText) { 2133 var jData = {}; 2134 jData.culture = culture; 2135 jData.searchText = searchText; 2136 2137 return data.post(config.webService.wsAdminService + 'SearchItem', jData); 2138 }, 2139 2140 searchItemByType: function (culture, typeId, searchText) { 2141 var jData = {}; 2142 jData.culture = culture; 2143 jData.typeId = typeId; 2144 jData.searchText = searchText; 2145 2146 return data.post(config.webService.wsAdminService + 'SearchItemByType', jData); 2147 }, 2148 2149 getItemByType: function (typeId) { 2150 var jData = {}; 2151 jData.typeId = typeId; 2152 2153 return data.post(config.webService.wsAdminService + 'GetItemByTypeId', jData); 2154 }, 2155 2156 getItemById: function (itemId) { 2157 var jData = {}; 2158 jData.itemId = itemId; 2159 2160 return data.post(config.webService.wsAdminService + 'GetItemById', jData); 2161 } 2162}; 2163 2164/************************************************/ 2165/*************** Advertisement ******************/ 2166/************************************************/ 2167var ads = { 2168 getAdvertisers: function (page, pageSize, sort, search) { 2169 var jData = {}; 2170 jData.page = page; 2171 jData.pageSize = pageSize; 2172 jData.sort = sort || ""; 2173 jData.search = search || ""; 2174 2175 return data.post(config.webService.wsAds + 'GetAdvertisers', jData); 2176 }, 2177 2178 getAdvertiserById: function (advertiserId) { 2179 var jData = {}; 2180 2181 jData.advertiserId = advertiserId; 2182 2183 return data.post(config.webService.wsAds + 'GetAdvertiserById', jData); 2184 }, 2185 2186 getAdvertisersBySolutionId: function (solutionId, page, pageSize, sort, search) { 2187 var jData = {}; 2188 2189 jData.solutionId = solutionId; 2190 jData.page = page || 1; 2191 jData.pageSize = pageSize || 100000; 2192 jData.sort = sort || ""; 2193 jData.search = search || ""; 2194 2195 return data.post(config.webService.wsAds + 'GetAdvertisersBySolutionId', jData); 2196 }, 2197 2198 getBannersByAdvertiserId: function (advertiserId) { 2199 var jData = {}; 2200 2201 jData.advertiserId = advertiserId; 2202 2203 return data.post(config.webService.wsAds + 'GetBannersByAdvertiserId', jData); 2204 }, 2205 2206 getBannersBySolutionId: function (solutionId) { 2207 var jData = {}; 2208 2209 jData.solutionId = solutionId; 2210 2211 return data.post(config.webService.wsAds + 'GetBannersBySolutionId', jData); 2212 }, 2213 2214 getBannersByTeamId: function (teamId) { 2215 var jData = {}; 2216 2217 jData.teamId = teamId; 2218 2219 return data.post(config.webService.wsAds + 'GetBannersByTeamId', jData); 2220 }, 2221 2222 createAdvertiser: function (advertiser) { 2223 var jData = {}; 2224 2225 jData.advertiser = advertiser; 2226 2227 return data.post(config.webService.wsAds + 'CreateAdvertiser', jData); 2228 }, 2229 2230 updateAdvertiser: function (advertiser) { 2231 var jData = {}; 2232 2233 jData.advertiser = advertiser; 2234 2235 return data.post(config.webService.wsAds + 'UpdateAdvertiser', jData); 2236 }, 2237 2238 deleteAdvertiser: function (advertiserId) { 2239 var jData = {}; 2240 jData.advertiserId = advertiserId; 2241 2242 return data.post(config.webService.wsAds + 'DeleteAdvertiser', jData); 2243 }, 2244 2245 getBannerById: function (bannerId) { 2246 var jData = {}; 2247 2248 jData.bannerId = bannerId; 2249 2250 return data.post(config.webService.wsAds + 'GetBannerById', jData); 2251 }, 2252 2253 getSolutionByBannerId: function (bannerId) { 2254 var jData = {}; 2255 2256 jData.bannerId = bannerId; 2257 2258 return data.post(config.webService.wsAds + 'GetSolutionByBannerId', jData); 2259 }, 2260 2261 createBanner: function (banner) { 2262 var jData = {}; 2263 2264 jData.banner = banner; 2265 2266 return data.post(config.webService.wsAds + 'CreateBanner', jData); 2267 }, 2268 2269 updateBanner: function (banner) { 2270 var jData = {}; 2271 2272 jData.banner = banner; 2273 2274 return data.post(config.webService.wsAds + 'UpdateBanner', jData); 2275 }, 2276 2277 deleteBanner: function (bannerId) { 2278 var jData = {}; 2279 2280 jData.bannerId = bannerId; 2281 2282 return data.post(config.webService.wsAds + 'DeleteBanner', jData); 2283 }, 2284 2285 deleteBannerSolution: function (bannerId, solutionId) { 2286 var jData = {}; 2287 2288 jData.bannerId = bannerId; 2289 jData.solutionId = solutionId; 2290 2291 return data.post(config.webService.wsAds + 'DeleteBannerSolution', jData); 2292 }, 2293 2294 createBannerSolution: function (bannerId, solutionIds) { 2295 var jData = {}; 2296 2297 jData.bannerId = bannerId; 2298 jData.solutionIds = solutionIds; 2299 2300 return data.post(config.webService.wsAds + 'CreateBannerSolution', jData); 2301 }, 2302 2303 getExternalAdvertiser: function (solutionId, isValidateSponsorThisGame) { 2304 var queryKeyValue = { solutionId: solutionId, isValidateSponsorThisGame: isValidateSponsorThisGame } 2305 2306 return data.get(String.format('/api/advertiser/externalconfig{0}', Utilities.buildQueryString(queryKeyValue)), {}); 2307 } 2308} 2309 2310/************************************************/ 2311/****************** Account *********************/ 2312/************************************************/ 2313var core = { 2314 createAccount: function (email, password, lastName, firstname, accountType, culture, token, callback) { 2315 var jData = {}; 2316 jData.email = email; 2317 jData.password = password; 2318 jData.lastName = lastName; 2319 jData.firstname = firstname; 2320 jData.accountType = accountType; 2321 jData.culture = culture; 2322 jData.token = token; 2323 2324 Utilities.postJSONAsynch(config.webService.wsUser + 'Create', jData, callback, arguments[8]); 2325 }, 2326 2327 isEmailExist: function (email) { 2328 var jData = {}; 2329 jData.email = email; 2330 2331 return Utilities.postJSON(config.webService.wsAuthentication + 'IsEmailExist', jData); 2332 }, 2333 2334 searchUser: function (searchTerm, sourceArray) { 2335 var jData = {}; 2336 jData.text = searchTerm; 2337 2338 return sourceArray(Utilities.postJSON(config.webService.wsUser + 'SearchByName', jData)); 2339 }, 2340 2341 searchUserWithoutConnection: function (searchTerm, sourceArray) { 2342 var jData = {}; 2343 jData.text = searchTerm; 2344 2345 return sourceArray(Utilities.postJSON(config.webService.wsUser + 'SearchWithoutConnection', jData)); 2346 }, 2347
2348 signIn: function (username, password, stayConnected, callback) { 2349 var jData = {}; 2350 jData.username = username; 2351 jData.password = password; 2352 jData.stayConnected = stayConnected; 2353 2354 Utilities.postJSONAsynch(config.webService.wsAuthentication + 'SignIn', jData, callback, arguments[4]); 2355 }, 2356 2357 isAccountFromToken: function (token) { 2358 var jData = {}; 2359 jData.token = token; 2360 2361 return data.post(config.webService.wsAuthentication + 'IsAccountFromToken', jData); 2362 }, 2363 2364 getTokenType: function (token) { 2365 var jData = {}; 2366 jData.token = token; 2367 2368 return data.post(config.webService.wsAuthentication + 'GetTokenType', jData); 2369 }, 2370 2371 updateTokenType: function (token, type) { 2372 var jData = {}; 2373 jData.token = token; 2374 jData.type = type; 2375 2376 return data.post(config.webService.wsAuthentication + 'UpdateTokenType', jData); 2377 }, 2378 2379 getAdminsBySolution: function (solutionId, callback) { 2380 var jData = {}; 2381 jData.solutionId = solutionId; 2382 2383 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'GetBySolution', jData, callback, arguments[2]); 2384 }, 2385 2386 updateAdministratorRole: function (solutionId, accountId, roleId) { 2387 var jData = {}; 2388 jData.solutionId = solutionId; 2389 jData.accountId = accountId; 2390 jData.roleId = roleId; 2391 2392 return data.post(config.webService.wsAccounAdministrator + 'UpdateRole', jData); 2393 }, 2394 2395 addSolutionAdministratorByEmail: function (solutionId, email, roleId, culture, callback) { 2396 var jData = {}; 2397 jData.solutionId = solutionId; 2398 jData.email = email; 2399 jData.roleId = roleId; 2400 jData.culture = culture; 2401 2402 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'AddSolutionAdministratorByEmail', jData, callback, arguments[5]); 2403 }, 2404 2405 addSolutionAdministratorByConnection: function (solutionId, connectionId, roleId, callback) { 2406 var jData = {}; 2407 jData.solutionId = solutionId; 2408 jData.connectionId = connectionId; 2409 jData.roleId = roleId; 2410 2411 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'AddSolutionAdministratorByConnection', jData, callback, arguments[4]); 2412 }, 2413 2414 saveTeamManager: function (solutionId, teamId, email, sectionsRight) { 2415 var jData = {}; 2416 jData.solutionId = solutionId; 2417 jData.teamId = teamId; 2418 jData.email = email; 2419 jData.sectionsRight = sectionsRight; 2420 2421 return data.post(config.webService.wsAccounAdministrator + 'SaveTeamManager', jData); 2422 }, 2423 2424 resendTeamManagerInvitation: function (solutionId, teamId, email) { 2425 var jData = {}; 2426 jData.solutionId = solutionId; 2427 jData.teamId = teamId; 2428 jData.email = email; 2429 2430 return data.post(config.webService.wsAccounAdministrator + 'ResendTeamManagerInvitation', jData); 2431 }, 2432 2433 getTeamManager: function (solutionId, teamId) { 2434 var jData = {}; 2435 jData.solutionId = solutionId; 2436 jData.teamId = teamId; 2437 2438 return data.post(config.webService.wsAccounAdministrator + 'GetTeamManager', jData); 2439 }, 2440 2441 deleteAdministrator: function (accountId, solutionId, callback) { 2442 var jData = {}; 2443 jData.accountId = accountId; 2444 jData.solutionId = solutionId; 2445 2446 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'Delete', jData, callback, arguments[3]); 2447 }, 2448 2449 acceptRequestAdminSolution: function (solutionId, callback) { 2450 var jData = {}; 2451 jData.solutionId = solutionId; 2452 2453 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'AcceptRequestAdminSolution', jData, callback, arguments[2]); 2454 }, 2455 2456 acceptRequestAdminTeamManager: function (guid, callback) { 2457 var jData = {}; 2458 jData.actionGuid = guid; 2459 2460 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'AcceptRequestAdminTeamManager', jData, callback, arguments[2]); 2461 }, 2462 2463 refuseRequestAdminSolution: function (solutionId, callback) { 2464 var jData = {}; 2465 jData.solutionId = solutionId; 2466 2467 Utilities.postJSONAsynch(config.webService.wsAccounAdministrator + 'RefuseRequestAdminSolution', jData, callback, arguments[2]); 2468 }, 2469 2470 acceptRequestAction: function (guid, type) { 2471 var jData = {}; 2472 jData.guid = guid; 2473 jData.type = type; 2474 2475 return data.post(config.webService.wsRequest + 'AcceptAction', jData); 2476 }, 2477 2478 deleteAdminInvitation: function (invitationId, callback) { 2479 var jData = {}; 2480 jData.invitationId = invitationId; 2481 2482 return data.post(config.webService.wsAccounAdministrator + 'DeleteInvitation', jData); 2483 }, 2484 2485 changeLanguage: function (accountId, newculture) { 2486 var jData = {}; 2487 jData.accountId = accountId; 2488 jData.culture = newculture; 2489 2490 return Utilities.postJSON(config.webService.wsUser + 'ChangeLanguage', jData); 2491 }, 2492 2493 sendEmail: function (emailFrom, displayName, emailTo, subject, message) { 2494 var jData = {}; 2495 jData.emailFrom = emailFrom; 2496 jData.displayName = displayName; 2497 jData.emailTo = emailTo; 2498 jData.subject = subject; 2499 jData.message = message; 2500 2501 return Utilities.postJSON(config.webService.wsFeedback + 'SendEmail', jData); 2502 }, 2503 2504 getRequestAccount: function (callback) { 2505 var jData = {}; 2506 2507 Utilities.postJSONAsynch(config.webService.wsAccountRequest + 'GetByAccount', jData, callback, arguments[1]); 2508 }, 2509 2510 getRequestCountByAccount: function (status) { 2511 var jData = {}; 2512 jData.status = status; 2513 2514 return Utilities.postJSON(config.webService.wsAccountRequest + 'GetCountByAccount', jData); 2515 }, 2516
2517 getRequestCountByAccountAsynch: function (status, callback) { 2518 var jData = {}; 2519 jData.status = status; 2520 2521 Utilities.postJSONAsynch(config.webService.wsAccountRequest + 'GetCountByAccount', jData, callback, arguments[2]); 2522 }, 2523 2524 getRequestAccountStatus: function (status, callback) { 2525 var jData = {}; 2526 jData.status = status; 2527 2528 Utilities.postJSONAsynch(config.webService.wsAccountRequest + 'GetByAccountStatus', jData, callback, arguments[2]); 2529 }, 2530 2531 getFeatureAccount: function (pageName, culture) { 2532 var jData = {}; 2533 jData.pageName = pageName; 2534 jData.culture = culture; 2535 2536 return Utilities.postJSON(config.webService.wsFeature + 'Gets', jData); 2537 }, 2538 2539 getUserStatus: function (accountId) { 2540 var jData = {}; 2541 jData.accountId = accountId; 2542 2543 return Utilities.postJSON(config.webService.wsUser + 'GetUserStatus', jData); 2544 }, 2545 2546 setUserStatus: function (status) { 2547 var jData = {}; 2548 jData.status = status; 2549 2550 return Utilities.postJSON(config.webService.wsUser + 'SetUserStatus', jData); 2551 }, 2552 2553 setFeatureAccount: function (featureId) { 2554 var jData = {}; 2555 jData.featureId = featureId; 2556 2557 return Utilities.postJSON(config.webService.wsFeature + 'SetFeature', jData); 2558 }, 2559 2560 logoutUser: function () { 2561 window.sessionStorage.clear(); 2562 var backlen = history.length; // Clean history 2563 history.go(-backlen); 2564 window.location.href = language.global.pageDefaultUrl; 2565 }, 2566 2567 getUsername: function () { 2568 var currentUser; 2569 currentUser = Utilities.getSession('CurrentUser'); 2570 return currentUser.FirstName + ' ' + currentUser.LastName; 2571 }, 2572 2573 getLanguage: function () { 2574 var currentUser; 2575 currentUser = Utilities.getSession('CurrentUser'); 2576 var language = Utilities.getCookie('Language'); 2577 if (currentUser) { 2578 return currentUser.Culture; 2579 } 2580 else if (language) { 2581 return language; 2582 } 2583 else { 2584 return 'fr'; 2585 } 2586 2587 }, 2588 2589 getUserAvatar: function () { 2590 var currentUser; 2591 currentUser = Utilities.getSession('CurrentUser'); 2592 return currentUser.Avatar; 2593 }, 2594 2595 getUserLanguage: function () { 2596 var currentUser; 2597 currentUser = Utilities.getSession('CurrentUser'); 2598 return currentUser.Culture; 2599 }, 2600 2601 changeUserLanguage: function (language) { 2602 var currentUser; 2603 currentUser = Utilities.getSession(); 2604 console.log(currentUser); 2605 }, 2606 2607 getUserUrl: function (isPhoneGapApplication) { 2608 var url = Utilities.postJSON(config.webService.wsUser + 'GetUserUrl', { isPhoneGapApplication: isPhoneGapApplication }); 2609 2610 return url; 2611 }, 2612 2613 getAccountId: function () { 2614 var currentUser; 2615 currentUser = Utilities.getSession('CurrentUser'); 2616 if (currentUser != null) { 2617 return currentUser.Id; 2618 } else { 2619 window.location.href = language.global.pageDefaultUrl; 2620 } 2621 }, 2622 2623 getGamesheets: function () { 2624 var url = `${config.setting.urlRestApi}/api/file/gamesheets`; 2625 return data.get(url, {}); 2626 }, 2627 2628 hashChange: function () { 2629 if (language.urlRewrite === undefined) return; 2630 2631 if (document.location.pathname.indexOf(language.urlRewrite.prefixUser) == 1) { 2632 switch (document.location.hash.split('/?')[0]) { 2633 case '#' + language.userDashboardMenu.hashtags.confidentiality: 2634 $('#user-section').load('/App_Ctrl/User/Settings/privacy.html', function () { 2635 $('#user-section').show(); 2636 }); 2637 break; 2638 case '#' + language.userDashboardMenu.hashtags.notifications: 2639 $('#user-section').load('/App_Ctrl/User/Settings/notifications.html', function () { 2640 $('#user-section').show(); 2641 }); 2642 break; 2643 case '#' + language.userDashboardMenu.hashtags.display: 2644 $('#user-section').load('/App_Ctrl/User/Settings/display.html', function () { 2645 $('#user-section').show(); 2646 }); 2647 break; 2648 case '#' + language.userDashboardMenu.hashtags.password: 2649 $('#user-section').load('/App_Ctrl/User/Security/password.html', function () { 2650 $('#user-section').show(); 2651 }); 2652 break; 2653 case '#' + language.userDashboardMenu.hashtags.solutions: 2654 $('#user-section').load('/App_Ctrl/User/Account/solutions.html', function () { 2655 $('#user-section').show(); 2656 }); 2657 break; 2658 case '#' + language.userDashboardMenu.hashtags.informations: 2659 default: 2660 $('#user-section').load('/App_Ctrl/User/Profile/user-account.html', function () { 2661 $('#user-section').show(); 2662 }); 2663 } 2664 } 2665 else if (document.location.pathname.indexOf(language.urlRewrite.prefixLeague) == 1) { 2666 switch (document.location.hash.split('/?')[0]) { 2667 case '#' + language.dashboardMenu.hashtags.divisions: 2668 $('#league-section').load('/App_Ctrl/Division/divisions.html', function () { 2669 $('#league-dashboard').hide(); 2670 }); 2671 break; 2672 2673 case '#' + language.dashboardMenu.hashtags.players: 2674 $('#league-section').load('/App_Ctrl/Player/players.html', function () { 2675 $('#league-dashboard').hide(); 2676 }); 2677 break; 2678 2679 case '#' + language.dashboardMenu.hashtags.teams: 2680 $('#league-section').load('/App_Ctrl/Team/teams.html', function () { 2681 $('#league-dashboard').hide(); 2682 }); 2683 break; 2684 2685 case '#' + language.dashboardMenu.hashtags.staff: 2686 $('#league-section').load('/App_Ctrl/Staff/staff.html', function () { 2687 $('#league-dashboard').hide(); 2688 }); 2689 break; 2690 2691 case '#' + language.dashboardMenu.hashtags.leagueAccount: 2692 $('#league-section').load('/App_Ctrl/League/league-account.html', function () { 2693 $('#league-dashboard').hide(); 2694 }); 2695 break; 2696 2697 case '#' + language.dashboardMenu.hashtags.seasons: 2698 $('#league-section').load('/App_Ctrl/Season/seasons.html', function () { 2699 $('#league-dashboard').hide(); 2700 }); 2701 break; 2702 2703 case '#' + language.dashboardMenu.hashtags.games: 2704 $('#league-section').load('/App_Ctrl/Season/games.html', function () { 2705 $('#league-dashboard').hide(); 2706 }); 2707 break; 2708 2709 case '#' + language.dashboardMenu.hashtags.sportsCenters: 2710 $('#league-section').load('/App_Ctrl/SportCenter/sportsCenters.html', function () { 2711 $('#league-dashboard').hide(); 2712 }); 2713 break; 2714 2715 case '#' + language.dashboardMenu.hashtags.news: 2716 $('#league-section').load('/App_Ctrl/Medias/news.html', function () { 2717 $('#league-dashboard').hide(); 2718 }); 2719 break; 2720 2721 case '#' + language.dashboardMenu.hashtags.videos: 2722 $('#league-section').load('/App_Ctrl/Medias/videos.html', function () { 2723 $('#league-dashboard').hide(); 2724 }); 2725 break; 2726 2727 case '#photos': 2728 $('#league-section').load('/App_Ctrl/Medias/photos.html', function () { 2729 $('#league-dashboard').hide(); 2730 }); 2731 break; 2732 2733 case '#' + language.dashboardMenu.hashtags.suspensions: 2734 $('#league-section').load('/App_Ctrl/Suspension/su
2734spensions.html', function () { 2735 $('#league-dashboard').hide(); 2736 }); 2737 break; 2738 default: 2739 $('#league-section').load('/App_Ctrl/Season/calendar.html', function () { 2740 $('#league-dashboard').hide(); 2741 }); 2742 } 2743 } 2744 else if (document.location.pathname.indexOf(language.urlRewrite.prefixPortal) == 1) { 2745 switch (document.location.hash.split('/?')[0]) { 2746 2747 case '#' + language.dashboardMenu.hashtags.players: 2748 $('#portal-section').load('/App_Ctrl/Player/players.html', function () { 2749 $('#portal-dashboard').hide(); 2750 }); 2751 break; 2752 2753 case '#' + language.dashboardMenu.hashtags.teams: 2754 $('#portal-section').load('/App_Ctrl/Team/teams.html', function () { 2755 $('#portal-dashboard').hide(); 2756 }); 2757 break; 2758 2759 case '#' + language.dashboardMenu.hashtags.staff: 2760 $('#portal-section').load('/App_Ctrl/Staff/staff.html', function () { 2761 $('#portal-dashboard').hide(); 2762 }); 2763 break; 2764 2765 case '#' + language.dashboardMenu.hashtags.leagueAccount: 2766 $('#portal-section').load('/App_Ctrl/League/league-account.html', function () { 2767 $('#portal-dashboard').hide(); 2768 }); 2769 break; 2770 2771 case '#' + language.dashboardMenu.hashtags.games: 2772 $('#portal-section').load('/App_Ctrl/Season/games.html', function () { 2773 $('#portal-dashboard').hide(); 2774 }); 2775 break; 2776 2777 case '#' + language.dashboardMenu.hashtags.sportsCenters: 2778 $('#portal-section').load('/App_Ctrl/SportCenter/sportsCenters.html', function () { 2779 $('#portal-dashboard').hide(); 2780 }); 2781 break; 2782 2783 case '#' + language.dashboardMenu.hashtags.news: 2784 $('#portal-section').load('/App_Ctrl/Medias/news.html', function () { 2785 $('#portal-dashboard').hide(); 2786 }); 2787 break; 2788 2789 case '#' + language.dashboardMenu.hashtags.videos: 2790 $('#portal-section').load('/App_Ctrl/Medias/videos.html', function () { 2791 $('#portal-dashboard').hide(); 2792 }); 2793 break; 2794 2795 case '#' + language.dashboardMenu.hashtags.photos: 2796 $('#portal-section').load('/App_Ctrl/Medias/photos.html', function () { 2797 $('#portal-dashboard').hide(); 2798 }); 2799 break; 2800 2801 default: 2802 $('#portal-section').load('/App_Ctrl_Portal/Solutions/solutions.html', function () { 2803 $('#portal-dashboard').hide(); 2804 }); 2805 } 2806 } 2807 }, 2808 2809 initializeListPager: function () { 2810 $('#button-first-page').button({ icons: { primary: "ui-icon-seek-first" }, text: false }); 2811 $('#button-previous-page').button({ icons: { primary: "ui-icon-seek-prev" }, text: false }); 2812 $('#button-next-page').button({ icons: { primary: "ui-icon-seek-next" }, text: false }); 2813 $('#button-last-page').button({ icons: { primary: "ui-icon-seek-end" }, text: false }); 2814 }, 2815 2816 modifyPassword: function (oldPassword, newPassword, callback) { 2817 var jData = {}; 2818 jData.oldPassword = oldPassword; 2819 jData.newPassword = newPassword; 2820 2821 Utilities.postJSONAsynch(config.webService.wsUser + 'ModifyPassword', jData, callback, arguments[3]); 2822 }, 2823 2824 resetPassword: function (email) { 2825 var jData = {}; 2826 jData.email = email; 2827 2828 return Utilities.postJSON(config.webService.wsUser + 'ResetPassword', jData); 2829 }, 2830 2831 modifyTemporaryPassword: function (email, currentPassword, newPassword, callback) { 2832 var jData = {}; 2833 jData.email = email; 2834 jData.temporaryPassword = currentPassword; 2835 jData.newPassword = newPassword; 2836 debugger; 2837 console.log(arguments[4]); 2838 Utilities.postJSONAsynch(config.webService.wsUser + 'ModifyTemporaryPassword', jData, callback, arguments[4]); 2839 }, 2840 2841 activateAccount: function (activationKey, culture, callback) { 2842 var jData = {}; 2843 jData.activationKey = activationKey; 2844 jData.culture = culture; 2845
2846 Utilities.postJSONAsynch(config.webService.wsUser + 'AccountActivation', jData, callback, arguments[3]); 2847 } 2848}; 2849 2850/************************************************/ 2851/******************** User **********************/ 2852/************************************************/ 2853var user = { 2854 get: function () { 2855 var jData = {}; 2856 2857 return data.post(config.webService.wsUser + 'Get', jData); 2858 }, 2859 2860 update: function (user) { 2861 var jData = {}; 2862 jData.user = user; 2863 2864 return data.post(config.webService.wsUser + 'Update', jData); 2865 }, 2866 2867 updateAttendance: function (contactId, calendarId, attendanceType) { 2868 var jData = {}; 2869 jData.contactId = contactId; 2870 jData.calendarId = calendarId; 2871 jData.attendanceType = attendanceType; 2872 2873 return data.post(config.webService.wsUser + 'UpdateAttendance', jData); 2874 }, 2875 2876 refreshUserSecurity: function (solutionId) { 2877 var jData = {}; 2878 jData.solutionId = solutionId; 2879 2880 return data.post(config.webService.wsUser + 'RefreshUserSecurity', jData); 2881 }, 2882 2883 getSolutionSecurity: function (solutionId) { 2884 var jData = {}; 2885 jData.solutionId = solutionId; 2886 2887 return data.post(config.webService.wsUser + 'GetSolutionSecurity', jData); 2888 }, 2889 2890 payPremiumAccount: function (securityToken, creditCardToken) { 2891 var jData = {}; 2892 jData.securityToken = securityToken; 2893 jData.creditCardToken = creditCardToken; 2894 2895 return data.post(config.webService.wsUser + 'PayPremiumAccount', jData); 2896 }, 2897 2898 search: function (searchTerm) { 2899 var jData = {}; 2900 jData.text = searchTerm; 2901 2902 return data.post(config.webService.wsUser + 'Search', jData); 2903 }, 2904}; 2905 2906/************************************************/ 2907/****************** Leagues *********************/ 2908/************************************************/ 2909var league = { 2910 get: function (leagueId, callback) { 2911 var jData = {}; 2912 jData.league = leagueId; 2913 2914 Utilities.postJSONAsynch(config.webService.wsLeague + 'Get', jData, callback, arguments[2]); 2915 }, 2916 2917 getBySolutionId: function (solutionId, callback) { 2918 var jData = {}; 2919 jData.solutionId = solutionId; 2920 2921 Utilities.postJSONAsynch(config.webService.wsLeague + 'GetBySolutionId', jData, callback, arguments[2]); 2922 }, 2923 2924 getBySolutionIdWithDeferred: function (solutionId) { 2925 var jData = {}; 2926 jData.solutionId = solutionId; 2927 2928 return data.post(config.webService.wsLeague + 'GetBySolutionId', jData); 2929 }, 2930 2931 getListBySolutionId: function (solutionId) { 2932 var jData = {}; 2933 jData.solutionId = solutionId; 2934 2935 return data.post(config.webService.wsLeague + 'GetListBySolutionId', jData); 2936 }, 2937 2938 deleteLeague: function (leagueId) { 2939 var jData = {}; 2940 jData.league = leagueId; 2941 2942 return Utilities.postJSON(config.webService.wsLeague + 'Delete', jData); 2943 }, 2944 2945 create: function (sportId, typeId, name, abbreviation, handle, logo) { 2946 var jData = {}; 2947 jData.sportId = sportId; 2948 jData.typeId = encodeURI(typeId); 2949 jData.name = encodeURI(name); 2950 jData.abbreviation = encodeURI(abbreviation); 2951 jData.website = encodeURI(handle); 2952 jData.logo = encodeURI(logo); 2953 2954 return Utilities.postJSON(config.webService.wsLeague + 'Create', jData); 2955 }, 2956 2957 createWithDeferred: function (sportId, typeId, name, abbreviation, webSite, logo) { 2958 var jData = {}; 2959 jData.sportId = sportId; 2960 jData.typeId = typeId; 2961 jData.name = name; 2962 jData.abbreviation = abbreviation; 2963 jData.website = webSite 2964 jData.logo = logo; 2965 2966 return data.post(config.webService.wsLeague + 'Create', jData); 2967 }, 2968 2969 update: function (league, callback) { 2970 var jData = {}; 2971 jData.league = league; 2972 2973 Utilities.postJSONAsynch(config.webService.wsLeague + 'Update', jData, callback, arguments[2]); 2974 }, 2975 2976 getDivisionListBySolution: function (solutionId, withTeam, callback) { 2977 var jData = {}; 2978 jData.solutionId = solutionId; 2979 jData.withTeam = withTeam; 2980
2981 Utilities.postJSONAsynch(config.webService.wsDivision + 'GetBySolutionId', jData, callback, arguments[3]); 2982 } 2983}; 2984 2985/************************************************/ 2986/****************** Season **********************/ 2987/************************************************/ 2988var season = { 2989 getById: function (seasonId, callback) { 2990 var jData = {}; 2991 jData.seasonId = seasonId; 2992 2993 Utilities.postJSONAsynch(config.webService.wsSeason + 'GetSeason', jData, callback, arguments[2]); 2994 }, 2995 2996 getPlayoffById: function (playoffId) { 2997 var jData = {}; 2998 jData.playoffId = playoffId; 2999 3000 return data.post(config.webService.wsSeason + 'GetPlayoff', jData); 3001 }, 3002 3003 updatePlayoff: function (playoff) { 3004 var jData = {}; 3005 jData.playoff = playoff; 3006 3007 return data.post(config.webService.wsSeason + 'UpdatePlayoff', jData); 3008 }, 3009 3010 getDivisionTeam: function (seasonId) { 3011 var jData = {}; 3012 jData.seasonId = seasonId; 3013 3014 return data.post(config.webService.wsSeason + 'GetSeasonDivisionTeam', jData); 3015 }, 3016 3017 getListByEventId: function (eventId) { 3018 var jData = {}; 3019 jData.eventId = eventId; 3020 3021 return data.post(config.webService.wsSeason + 'GetListByEventId', jData); 3022 }, 3023 3024 getByMatchId: function (matchId) { 3025 var jData = {}; 3026 jData.matchId = matchId; 3027 3028 return data.post(config.webService.wsSeason + 'GetByMatchId', jData); 3029 }, 3030 3031 getBySolutionId: function (solutionId, callback) { 3032 var jData = {}; 3033 jData.solutionId = solutionId; 3034 3035 Utilities.postJSONAsynch(config.webService.wsSeason + 'GetBySolutionId', jData, callback, arguments[2]); 3036 }, 3037 3038 getBySolutionIdWithDeferred: function (solutionId) { 3039 var jData = {}; 3040 jData.solutionId = solutionId; 3041 3042 return data.post(config.webService.wsSeason + 'GetBySolutionId', jData); 3043 }, 3044 3045 getType: function (callback) { 3046 var jData = {}; 3047 3048 Utilities.postJSONAsynch(config.webService.wsSeason + 'GetSeasonType', jData, callback, arguments[1]); 3049 }, 3050 3051 create: function (solutionId, typeId, name, description, startDate, endDate, active, callback) { 3052 var jData = {}; 3053 jData.solutionId = solutionId; 3054 jData.typeId = typeId; 3055 jData.name = name; 3056 jData.description = description; 3057 jData.startingDate = startDate; 3058 jData.endingDate = endDate; 3059 jData.active = active; 3060 3061 Utilities.postJSONAsynch(config.webService.wsSeason + 'Create', jData, callback, arguments[8]); 3062 }, 3063 3064 update: function (seasonId, name, typeId, description, startDate, endDate, active, callback) { 3065 var jData = {}; 3066 jData.seasonId = seasonId; 3067 jData.name = name; 3068 jData.typeId = typeId; 3069 jData.description = description; 3070 jData.startingDate = startDate; 3071 jData.endingDate = endDate; 3072 jData.active = active; 3073 3074 Utilities.postJSONAsynch(config.webService.wsSeason + 'Update', jData, callback, arguments[8]); 3075 }, 3076 3077 updateSeason: function (season) { 3078 var jData = {}; 3079 jData.season = season; 3080 3081 return data.post(config.webService.wsSeason + 'UpdateSeason', jData); 3082 }, 3083 3084 getDivisionList: function (seasonId, callback) { 3085 var jData = {}; 3086 jData.seasonId = seasonId; 3087 3088 Utilities.postJSONAsynch(config.webService.wsDivision + 'GetBySeason', jData, callback, arguments[2]); 3089 }, 3090 3091 updateDivisionTeam: function (seasonId, divisionList, teamList) { 3092 var jData = {}; 3093 jData.seasonId = seasonId; 3094 jData.divisionList = divisionList; 3095 jData.teamList = teamList; 3096 3097 return data.post(config.webService.wsSeason + 'UpdateDivisionsTeams', jData); 3098 }, 3099 3100 deleteSeason: function (seasonId, callback) { 3101 var jData = {}; 3102 jData.seasonId = seasonId; 3103 3104 Utilities.postJSONAsynch(config.webService.wsSeason + 'Delete', jData, callback, arguments[2]); 3105 }, 3106 3107 getParametersByGame: function (gameId) { 3108 var jData = {}; 3109 jData.gameId = gameId; 3110 3111 return data.post(config.webService.wsSeason + 'GetParametersByGame', jData); 3112 }, 3113 3114 getParameter: function (seasonId, code, callback) { 3115 var jData = {}; 3116 jData.seasonId = seasonId; 3117 jData.code = code; 3118 3119 Utilities.postJSONAsynch(config.webService.wsSeason + 'GetParameter', jData, callback, arguments[3]); 3120 }, 3121 3122 getParameters: function (seasonId, callback) { 3123 var jData = {}; 3124 jData.seasonId = seasonId; 3125 3126 return Utilities.postJSONAsynch(config.webService.wsSeason + 'GetParameters', jData, callback, arguments[2]); 3127 }, 3128 3129 updateParameter: function (seasonId, code, value, callback) { 3130 var jData = {}; 3131 jData.seasonId = seasonId; 3132 jData.code = code; 3133 jData.value = value; 3134 3135 Utilities.postJSONAsynch(config.webService.wsSeason + 'UpdateParameter', jData, callback, arguments[4]); 3136 }, 3137 3138 updateParameters: function (seasonId, seasonParms, callback) { 3139 var jData = {}; 3140 jData.seasonId = seasonId; 3141 jData.seasonParms = seasonParms;
3142 3143 return Utilities.postJSONAsynch(config.webService.wsSeason + 'UpdateParameters', jData, callback, arguments[3]); 3144 }, 3145 3146 createParameter: function (seasonId, code, value, callback) { 3147 var jData = {}; 3148 jData.seasonId = seasonId; 3149 jData.code = code; 3150 jData.value = value; 3151 3152 Utilities.postJSONAsynch(config.webService.wsSeason + 'CreateParameter', jData, callback, arguments[4]); 3153 }, 3154 3155 getEvents: function (seasonId, callback) { 3156 var jData = {}; 3157 jData.seasonId = seasonId; 3158 3159 Utilities.postJSONAsynch(config.webService.wsSeason + 'GetEvents', jData, callback, arguments[2]); 3160 }, 3161 3162 updateEvents: function (seasonId, seasonEvents, callback) { 3163 var jData = {}; 3164 jData.seasonId = seasonId; 3165 jData.seasonEvents = seasonEvents; 3166 3167 Utilities.postJSONAsynch(config.webService.wsSeason + 'UpdateEvents', jData, callback, arguments[3]); 3168 }, 3169 3170 getActive: function (solutionId) { 3171 var jData = {}; 3172 jData.solutionId = solutionId; 3173 3174 if (viewstate.get('activeSeasonId-' + solutionId) == undefined) { 3175 return $.when(data.post(config.webService.wsSolution + 'GetActiveSeason', jData)).then(function (a) { 3176 viewstate.save('activeSeasonId-' + a, { expires: 600000 }); 3177 return a; 3178 }); 3179 } 3180 else { 3181 return viewstate.get('activeSeasonId-' + solutionId); 3182 } 3183 }, 3184 3185 cloneSeason: function (solutionId, seasonId, name, active) { 3186 var url = '/api/solution/{0}/season/{1}/clone'; 3187 3188 return data.post(config.setting.urlRestApi + String.format(url, solutionId, seasonId), { name: name, active: active }); 3189 } 3190 3191}; 3192 3193var checklist = { 3194 get: function (checkListId) { 3195 var jData = {}; 3196 jData.checkListId = checkListId; 3197 3198 return data.post(config.webService.wsSolution + 'GetCheckListById', jData); 3199 }, 3200 3201 getBySolutionId: function (solutionId, page, pageSize, searchText, teamId, statusId) { 3202 var jData = {}; 3203 jData.solutionId = solutionId; 3204 jData.page = page || 1; 3205 jData.pageSize = pageSize || 30000; 3206 jData.searchText = searchText || ''; 3207 jData.statusId = statusId || null; 3208 jData.teamId = teamId || null; 3209 3210 return data.post(config.webService.wsSolution + 'GetCheckListBySolutionId', jData); 3211 }, 3212 3213 getByMatchId: function (solutionId, matchId) { 3214 var jData = {}; 3215 jData.solutionId = solutionId; 3216 jData.matchId = matchId; 3217 3218 return data.post(config.webService.wsSolution + 'GetCheckListByMatchId', jData); 3219 }, 3220 3221 create: function (solutionId, checkList) { 3222 var jData = {}; 3223 jData.solutionId = solutionId; 3224 jData.checkList = checkList; 3225 3226 return data.post(config.webService.wsSolution + 'CreateCheckList', jData); 3227 }, 3228 3229 updateChecklists: function (solutionId, checkList) { 3230 var jData = {}; 3231 jData.solutionId = solutionId; 3232 jData.checkList = checkList; 3233 3234 return data.post(config.webService.wsSolution + 'UpdateCheckList', jData); 3235 }, 3236 3237 update: function (solutionId, checkList) { 3238 var jData = {}; 3239 jData.solutionId = solutionId; 3240 jData.checkList = checkList; 3241 3242 return data.post(config.webService.wsSolution + 'UpdateCheckListControl', jData); 3243 }, 3244 3245 delete: function (checkListId) { 3246 var jData = {}; 3247 jData.checkListId = checkListId; 3248 3249 return data.post(config.webService.wsSolution + 'DeleteCheckList', jData); 3250 } 3251} 3252 3253/************************************************/ 3254/**************** Post **********************/ 3255/************************************************/ 3256var post = { 3257 getById: function (postId, callback) { 3258 var jData = {}; 3259 jData.postId = postId; 3260 3261 Utilities.postJSONAsynch(config.webService.wsPost + 'Get', jData, callback, arguments[2]); 3262 }, 3263 3264 getByAccountId: function (timestamp, culture, callback) { 3265 var jData = {}; 3266 jData.timestamp = timestamp.toUTCString(); 3267 jData.culture = culture; 3268 3269 Utilities.postJSONAsynch(config.webService.wsPost + 'GetByAccount', jData, callback, arguments[3]); 3270 }, 3271 3272 getLatestByAccountId: function (timestamp, callback) { 3273 var jData = {}; 3274 jData.timestamp = timestamp.toUTCString(); 3275 3276 Utilities.postJSONAsynch(config.webService.wsPost + 'GetLatestByAccount', jData, callback, arguments[2]); 3277 }, 3278 3279 create: function (content, callback) { 3280 var jData = {}; 3281 jData.content = content; 3282 3283 Utilities.postJSONAsynch(config.webService.wsPost + 'CreatePost', jData, callback, arguments[2]); 3284 }, 3285 3286 delete: function (postId, callback) { 3287 var jData = {}; 3288 jData.postId = postId; 3289 3290 Utilities.postJSONAsynch(config.webService.wsPost + 'Delete', jData, callback, arguments[2]); 3291 } 3292}; 3293 3294/************************************************/ 3295/**************** Post **********************/ 3296/************************************************/ 3297var comment = { 3298 getByPostId: function (postId, callback) { 3299 var jData = {}; 3300 jData.postId = postId; 3301 3302 Utilities.postJSONAsynch(config.webService.wsComment + 'GetByPostId', jData, callback, arguments[2]); 3303 }, 3304 3305 getCountByPostId: function (postId, callback) { 3306 var jData = {}; 3307 jData.postId = postId; 3308 3309 Utilities.postJSONAsynch(config.webService.wsComment + 'GetCountByPostId', jData, callback, arguments[2]); 3310 }, 3311 3312 deleteComment: function (commentId, callback) { 3313 var jData = {}; 3314 jData.commentId = commentId; 3315 3316 Utilities.postJSONAsynch(config.webService.wsComment + 'Delete', jData, callback, arguments[2]); 3317 } 3318}; 3319 3320/************************************************/ 3321/**************** Post **********************/ 3322/************************************************/ 3323var like = { 3324 getCountByPostId: function (postId, callback) { 3325 var jData = {}; 3326 jData.postId = postId; 3327 3328 Utilities.postJSONAsynch(config.webService.wsLike + 'GetCountByPostId', jData, callback, arguments[2]); 3329 }, 3330 3331 getCountByCommentId: function (commentId, callback) { 3332 var jData = {}; 3333 jData.commentId = commentId; 3334 3335 Utilities.postJSONAsynch(config.webService.wsLike + 'GetCountByCommentId', jData, callback, arguments[2]); 3336 }, 3337 3338 createPostLike: function (postId, callback) { 3339 var jData = {}; 3340 jData.postId = postId; 3341 3342 Utilities.postJSONAsynch(config.webService.wsLike + 'CreatePostLike', jData, callback, arguments[2]); 3343 }, 3344 3345 createCommentLike: function (commentId, callback) { 3346 var jData = {}; 3347 jData.commentId = commentId; 3348 3349 Utilities.postJSONAsynch(config.webService.wsLike + 'CreateCommentLike', jData, callback, arguments[2]); 3350 } 3351}; 3352 3353/************************************************/ 3354/**************** Division **********************/ 3355/************************************************/ 3356var division = { 3357 get: function (divisionId) { 3358 var jData = {}; 3359 jData.divisionId = divisionId; 3360
3361 return data.post(config.webService.wsDivision + 'Get', jData); 3362 }, 3363 3364 getStandingsBySeason: function (solutionId, seasonId, divisionId) { 3365 3366 var queryKeyValue = { 3367 3368 page: 1, pageSize: 10000, seasonId: seasonId, divisionId: divisionId 3369 } 3370 3371 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/team/statistics${Utilities.buildQueryString(queryKeyValue)}`; 3372 return data.get(url, {}); 3373 }, 3374 3375 create: function (division) { 3376 var jData = {}; 3377 jData.division = division; 3378 3379 return data.post(config.webService.wsDivision + 'Create', jData); 3380 }, 3381 3382 update: function (division) { 3383 var jData = {}; 3384 jData.division = division; 3385 3386 return data.post(config.webService.wsDivision + 'Update', jData); 3387 }, 3388 3389 updateActive: function (divisionId, active) { 3390 var jData = {}; 3391 jData.divisionId = divisionId; 3392 jData.active = active; 3393 3394 return data.post(config.webService.wsDivision + 'UpdateActive', jData); 3395 }, 3396 3397 getLevelBySolution: function (solutionId, callback) { 3398 var jData = {}; 3399 jData.solutionId = solutionId; 3400 3401 Utilities.postJSONAsynch(config.webService.wsDivision + 'GetLevelBySolution', jData, callback, arguments[2]); 3402 }, 3403 3404 getBySolutionId: function (solutionId, withTeams) { 3405 var jData = {}; 3406 jData.solutionId = solutionId; 3407 jData.withTeam = withTeams; 3408 3409 return data.post(config.webService.wsDivision + 'GetBySolutionId', jData); 3410 }, 3411 3412 getBySeasonId: function (seasonId) { 3413 var jData = {}; 3414 jData.seasonId = seasonId; 3415 3416 return data.post(config.webService.wsDivision + 'GetBySeasonId', jData); 3417 }, 3418 3419 delete: function (divisionId) { 3420 var jData = {}; 3421 jData.divisionId = divisionId; 3422 3423 return data.post(config.webService.wsDivision + 'Delete', jData); 3424 } 3425 3426}; 3427 3428/************************************************/ 3429/****************** Team ************************/ 3430/************************************************/ 3431var team = { 3432 get: function (teamId, solutionId, callback) { 3433 var jData = {}; 3434 jData.teamId = teamId; 3435 jData.solutionId = solutionId || null; 3436 3437 Utilities.postJSONAsynch(config.webService.wsTeam + 'Get', jData, callback, arguments[3]); 3438 }, 3439 3440 getWithPromise: function (teamId, solutionId) { 3441 var jData = {}; 3442 jData.teamId = teamId; 3443 jData.solutionId = solutionId || null; 3444 3445 return data.post(config.webService.wsTeam + 'Get', jData); 3446 }, 3447 3448 getJersey: function (teamId) { 3449 var jData = {}; 3450 jData.teamId = teamId; 3451 3452 return data.post(config.webService.wsTeam + 'GetJersey', jData); 3453 }, 3454 3455 getTeamPlayerStaff: function (teamId) { 3456 var jData = {}; 3457 jData.teamId = teamId; 3458 3459 return data.post(config.webService.wsTeam + 'GetTeamPlayerStaff', jData); 3460 }, 3461 3462 getDuplicateTeam: function (solutionId, teamList) { 3463 var jData = {}; 3464 jData.solutionId = solutionId; 3465 jData.teamList = teamList; 3466 3467 return data.post(config.webService.wsTeam + 'GetDuplicateTeam', jData); 3468 }, 3469 3470 getBySolutionId: function (solutionId, callback) { 3471 var jData = {}; 3472 jData.solutionId = solutionId; 3473 3474 Utilities.postJSONAsynch(config.webService.wsTeam + 'GetBySolutionId', jData, callback, arguments[2]); 3475 }, 3476 3477 getActiveBySolutionId: function (solutionId, callback) { 3478 var jData = {}; 3479 jData.solutionId = solutionId; 3480 3481 Utilities.blockObject(arguments[2]); 3482 var deferred = data.post(config.webService.wsTeam + 'GetActiveBySolutionId', jData).always(function () { Utilities.unblockObject(arguments[2]) }); 3483 3484 if (callback) 3485 deferred.done(callback); 3486 3487 return deferred; 3488 }, 3489 3490 getBySolutionIdWithDeferred: function (solutionId) { 3491 var jData = {}; 3492 jData.solutionId = solutionId; 3493 3494 return data.post(config.webService.wsTeam + 'GetBySolutionId', jData); 3495 }, 3496 3497 getBySolutionIdV2: function (solutionId, seasonId, divisionId, page, pageSize, sortColumn, sortOrder, searchText) { 3498 var jData = {}; 3499 jData.solutionId = solutionId; 3500 jData.seasonId = seasonId; 3501 jData.divisionId = divisionId; 3502 jData.page = page; 3503 jData.pageSize = pageSize; 3504 jData.sortColumn = sortColumn; 3505 jData.sortOrder = sortOrder; 3506 jData.searchText = searchText; 3507 3508 return data.post(config.webService.wsTeam + 'GetBySolutionIdV2', jData); 3509 }, 3510 3511 getBySeasonIdDeferred: function (seasonId) { 3512 var jData = {}; 3513 jData.seasonId = seasonId; 3514 3515 return data.post(config.webService.wsTeam + 'GetBySeasonId', jData); 3516 }, 3517 3518 getBySeasonId: function (seasonId, callback) { 3519 var jData = {}; 3520 jData.seasonId = seasonId; 3521 3522 Utilities.postJSONAsynch(config.webService.wsTeam + 'GetBySeasonId', jData, callback, arguments[2]); 3523 }, 3524 3525 getStandingsBySeason: function (solutionId, seasonId, statsId, divisionId) { 3526 var jData = {}; 3527 jData.solutionId = solutionId; 3528 jData.seasonId = seasonId; 3529 jData.statsId = statsId; 3530 jData.divisionId = divisionId; 3531 3532 return data.post(config.webService.wsTeam + 'GetStandingsBySeason', jData); 3533 }, 3534 3535 getTeamsStatsBySolutionId: function (solutionId, page, pageSize, sortStatId, sortColumn, sortOrder, seasonTypeId, seasonId, divisionId) { 3536 var queryKeyValue = { 3537 page: page, pageSize: pageSize, sortStatId: sortStatId, sortColumn: sortColumn, 3538 sortOrder: sortOrder, seasonTypeId: seasonTypeId, seasonId: seasonId, divisionId: divisionId 3539 } 3540 3541 return data.get(String.format('/api/leagues/{0}/teams/stats{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 3542 }, 3543 3544 getTeamManagerBySolutionId: function (solutionId, seasonId, divisionId, page, pageSize, sortColumn, sortOrder, searchText) { 3545 var jData = {}; 3546 jData.solutionId = solutionId; 3547 jData.seasonId = seasonId; 3548 jData.divisionId = divisionId; 3549 jData.page = page; 3550 jData.pageSize = pageSize; 3551 jData.sortColumn = sortColumn; 3552 jData.sortOrder = sortOrder; 3553 jData.searchText = searchText; 3554 3555 return data.post(config.webService.wsTeam + 'GetTeamManagerBySolutionId', jData); 3556 }, 3557 3558 getManagerRights: function (solutionId, accountAdministrator) { 3559 var jData = {}; 3560 jData.solutionId = solutionId; 3561 jData.accountAdministrator = accountAdministrator; 3562 3563 return data.post(config.webService.wsTeam + 'GetManagerRights', jData); 3564 }, 3565 3566 updateManagerRights: function (solutionId, accountAdministrator, rights) { 3567 var jData = {}; 3568 jData.solutionId = solutionId; 3569 jData.accountAdministrator = accountAdministrator; 3570 jData.rights = rights; 3571 3572 return data.post(config.webService.wsTeam + 'UpdateManagerRights', jData); 3573 }, 3574 3575 deleteManager: function (solutionId, accountAdministrator) { 3576 var jData = {}; 3577 jData.solutionId = solutionId; 3578 jData.accountAdministrator = accountAdministrator; 3579 3580 return data.post(config.webService.wsTeam + 'DeleteManager', jData); 3581 }, 3582 3583 create: function (solutionId, fullName, name, abbreviation, website, avatar, note, active, isInternal, jerseys, seasonId, callback) { 3584 var jData = {}; 3585 jData.solutionId = solutionId; 3586 jData.fullName = fullName; 3587 jData.name = name; 3588 jData.abbreviation = abbreviation; 3589 jData.website = website; 3590 jData.avatar = avatar; 3591 jData.note = note; 3592 jData.jerseys = jerseys; 3593 jData.active = active; 3594 jData.isInternal = isInternal; 3595 jData.seasonId = seasonId; 3596 3597 Utilities.postJSONAsynch(config.webService.wsTeam + 'Create', jData, callback, arguments[12]); 3598 }, 3599 3600 createList: function (solutionId, teamList, callback) { 3601 var jData = {}; 3602 jData.solutionId = solutionId; 3603 jData.teamList = teamList; 3604 3605 Utilities.postJSONAsynch(config.webService.wsTeam + 'CreateTeamList', jData, callback, arguments[3]); 3606 }, 3607 3608 createManager: function (solutionId, teamId, email, sectionsRight) { 3609 var jData = {}; 3610 jData.solutionId = solutionId; 3611 jData.teamId = teamId; 3612 jData.email = email; 3613 jData.sectionsRight = sectionsRight; 3614 3615 return data.post(config.webService.wsTeam + 'CreateManager', jData); 3616 }, 3617 3618 update: function (teamId, fullName, name, abbreviation, website, avatar, note, isInternal, jerseys, callback) { 3619 var jData = {}; 3620 jData.teamId = teamId; 3621 jData.fullName = fullName; 3622 jData.name = name; 3623 jData.abbreviation = abbreviation; 3624 jData.website = website; 3625 jData.avatar = avatar; 3626 jData.note = note; 3627 jData.isInternal = isInternal; 3628 jData.jerseys = jerseys; 3629 3630 Utilities.postJSONAsynch(config.webService.wsTeam + 'Update', jData, callback, arguments[10]); 3631 }, 3632 3633 createInContainer: function (solutionId, fullName, name, abbreviation, website, avatar, note, active, isInternal, jerseys, seasonId, solutionList, callback) { 3634 var jData = {}; 3635 jData.solutionId = solutionId; 3636 jData.fullName = fullName; 3637 jData.name = name; 3638 jData.abbreviation = abbreviation; 3639 jData.website = website; 3640 jData.avatar = avatar; 3641 jData.note = note; 3642 jData.jerseys = jerseys; 3643 jData.active = active; 3644 jData.isInternal = isInternal; 3645 jData.seasonId = seasonId; 3646 jData.solutionList = solutionList; 3647 3648 Utilities.postJSONAsynch(config.webService.wsTeam + 'CreateInContainer', jData, callback, arguments[13]); 3649 }, 3650 3651 updateInContainer: function (teamId, fullName, name, abbreviation, website, avatar, note, isInternal, solutionList, jerseys, callback) { 3652 var jData = {}; 3653 jData.teamId = teamId; 3654 jData.fullName = fullName; 3655 jData.name = name; 3656 jData.abbreviation = abbreviation; 3657 jData.website = website; 3658 jData.avatar = avatar; 3659 jData.note = note; 3660 jData.isInternal = isInternal; 3661 jData.jerseys = jerseys; 3662 jData.solutionList = solutionList; 3663 3664 Utilities.postJSONAsynch(config.webService.wsTeam + 'UpdateInContainer', jData, callback, arguments[11]); 3665 }, 3666 3667 insertSolution: function (teamId, solutionId) { 3668 var jData = {}; 3669 jData.teamId = teamId; 3670 jData.solutionId = solutionId; 3671 3672 return data.post(config.webService.wsTeam + 'InsertSolution', jData); 3673 }, 3674 3675 updateActive: function (teamId, active) { 3676 var jData = {}; 3677 jData.teamId = teamId; 3678 jData.active = active; 3679 3680 return data.post(config.webService.wsTeam + 'UpdateActive', jData); 3681 }, 3682 3683 updateInternal: function (teamId, isInternal) { 3684 var jData = {}; 3685 jData.teamId = teamId; 3686 jData.isInternal = isInternal; 3687 3688 return data.post(config.webService.wsTeam + 'UpdateInternal', jData); 3689 }, 3690 3691 updateAvatar: function (teamId, avatar) { 3692 var jData = {}; 3693 jData.teamId = teamId; 3694 jData.avatar = avatar; 3695 3696 return data.post(config.webService.wsTeam + 'UpdateAvatar', jData); 3697 }, 3698 3699 updates: function (seasonId, teams, callback) { 3700 var jData = {}; 3701 jData.seasonId = seasonId; 3702 jData.teams = teams; 3703 3704 Utilities.postJSONAsynch(config.webService.wsTeam + 'Updates', jData, callback, arguments[3]); 3705 }, 3706 3707 delete: function (teamId, solutionId, callback) { 3708 var jData = {}; 3709 jData.teamId = teamId; 3710 jData.solutionId = solutionId; 3711 3712 Utilities.postJSONAsynch(config.webService.wsTeam + 'Delete', jData, callback, arguments[3]); 3713 }, 3714 3715 manualStandingsBySeason: function (seasonId, statId, teamStats) { 3716 var jData = {}; 3717 jData.seasonId = seasonId; 3718 jData.statId = statId; 3719 jData.teamStats = teamStats; 3720 3721 return data.post(config.webService.wsStats + 'ManualStandingsBySeason', jData); 3722 }, 3723 3724 payKreezeeTeam: function (securityToken, creditCardToken) { 3725 var jData = {}; 3726 jData.securityToken = securityToken; 3727 jData.creditCardToken = creditCardToken; 3728 3729 return data.post(config.webService.wsTeam + 'PayKreezeeTeam', jData); 3730 }, 3731 3732 deactivateTeams: function (solutionId) { 3733 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/team/deactivate`; 3734 return data.post(url); 3735 } 3736}; 3737 3738/************************************************/ 3739/****************** Contact**********************/ 3740/************************************************/ 3741var contact = { 3742 3743 getBySolutionId: function (solutionId, page, pageSize, sort, search) { 3744 var jData = {}; 3745 jData.solutionId = solutionId; 3746 jData.page = page; 3747 jData.pageSize = pageSize; 3748 jData.sort = sort; 3749 jData.search = search; 3750 3751 return data.post(config.webService.wsContact + 'GetBySolutionId', jData); 3752 }, 3753 3754 createTab: function (tab) { 3755 var jData = {}; 3756 jData.tab = tab; 3757 3758 return data.post(config.webService.wsContact + 'CreateContactTab', jData); 3759 }, 3760 updateTab: function (tab) { 3761 var jData = {}; 3762 jData.tab = tab; 3763 3764 return data.post(config.webService.wsContact + 'UpdateContactTab', jData); 3765 }, 3766 getContactTab: function (id) { 3767 jData = {}; 3768 jData.id = id; 3769 3770 return data.post(config.webService.wsContact + 'GetContactTab', jData); 3771 }, 3772 deleteTab: function (id) { 3773 jData = {}; 3774 jData.id = id; 3775 3776 return data.post(config.webService.wsContact + 'DeleteContactTab', jData); 3777 }, 3778 getContactTabs: function (contactId) { 3779 var jData = {}; 3780 jData.contactId = contactId; 3781 3782 return data.post(config.webService.wsContact + 'GetContactTabs', jData); 3783 }, 3784 updateDefaultTab: function (contactId, tabId, isDefault) { 3785 var jData = {}; 3786 jData.contactId = contactId; 3787 jData.tabId = tabId; 3788 jData.isDefault = isDefault; 3789 3790 return data.post(config.webService.wsContact + 'UpdateDefaultTab', jData); 3791 } 3792}; 3793 3794/************************************************/ 3795/****************** Connection ******************/ 3796/************************************************/ 3797var connection = { 3798 getByAccount: function (callback) { 3799 var jData = {}; 3800 3801 Utilities.postJSONAsynch(config.webService.wsConnection + 'GetByAccount', jData, callback, arguments[1]); 3802 }, 3803 3804 getPending: function (callback) { 3805 var jData = {}; 3806 3807 Utilities.postJSONAsynch(config.webService.wsConnection + 'GetPending', jData, callback, arguments[1]); 3808 }, 3809 3810 getByEmail: function (email, callback) { 3811 var jData = {}; 3812 jData.email = email; 3813 3814 Utilities.postJSONAsynch(config.webService.wsConnection + 'GetByEmail', jData, callback, arguments[2]); 3815 }, 3816 3817 getByGroup: function (groupId, callback) { 3818 var jData = {}; 3819 jData.groupId = groupId; 3820 3821 Utilities.postJSONAsynch(config.webService.wsConnection + 'GetByGroup', jData, callback, arguments[2]); 3822 }, 3823 3824 create: function (accountId, callback) { 3825 var jData = {}; 3826 jData.accountId = accountId; 3827 3828 Utilities.postJSONAsynch(config.webService.wsConnection + 'Create', jData, callback, arguments[2]); 3829 }, 3830 3831 updateReading: function (callback) { 3832 var jData = {}; 3833 3834 Utilities.postJSONAsynch(config.webService.wsConnection + 'UpdateReading', jData, callback, arguments[1]); 3835 }, 3836 3837 getCountNew: function (callback) { 3838 var jData = {}; 3839 3840 return Utilities.postJSONAsynch(config.webService.wsConnection + 'GetCountNew', jData, callback); 3841 }, 3842 3843 accept: function (contactId, c
3843allback) { 3844 var jData = {}; 3845 jData.contactId = contactId; 3846 3847 Utilities.postJSONAsynch(config.webService.wsConnection + 'Accept', jData, callback, arguments[2]); 3848 }, 3849 3850 refuse: function (contactId, callback) { 3851 var jData = {}; 3852 jData.contactId = contactId; 3853 3854 Utilities.postJSONAsynch(config.webService.wsConnection + 'Refuse', jData, callback, arguments[2]); 3855 }, 3856 3857 cancel: function (contactId, callback) { 3858 var jData = {}; 3859 jData.contactId = contactId; 3860 3861 Utilities.postJSONAsynch(config.webService.wsConnection + 'Cancel', jData, callback, arguments[2]); 3862 }, 3863 3864 deleteConnection: function (contactId, callback) { 3865 var jData = {}; 3866 jData.contactId = contactId; 3867 3868 Utilities.postJSONAsynch(config.webService.wsConnection + 'Delete', jData, callback, arguments[2]); 3869 } 3870}; 3871 3872/************************************************/ 3873/****************** Contact group**********************/ 3874/************************************************/ 3875var group = { 3876 get: function (groupId, callback) { 3877 var jData = {}; 3878 jData.groupId = groupId; 3879 3880 Utilities.postJSONAsynch(config.webService.wsGroup + 'Get', jData, callback, arguments[2]); 3881 }, 3882 3883 getByAccount: function (callback) { 3884 var jData = {}; 3885 3886 Utilities.postJSONAsynch(config.webService.wsGroup + 'GetByAccount', jData, callback, arguments[1]); 3887 }, 3888 3889 create: function (groupName, groupDescription, groupConnections, callback) { 3890 var jData = {}; 3891 jData.groupName = groupName; 3892 jData.groupDescription = groupDescription; 3893 jData.groupConnections = groupConnections; 3894 3895 Utilities.postJSONAsynch(config.webService.wsGroup + 'Create', jData, callback, arguments[4]); 3896 }, 3897 3898 updateGroup: function (groupId, groupName, groupDescription, groupConnections, callback) { 3899 var jData = {}; 3900 jData.groupId = groupId; 3901 jData.groupName = groupName; 3902 jData.groupDescription = groupDescription; 3903 jData.groupConnections = groupConnections; 3904 3905 Utilities.postJSONAsynch(config.webService.wsGroup + 'Update', jData, callback, arguments[5]); 3906 }, 3907 3908 deleteGroup: function (groupId, callback) { 3909 var jData = {}; 3910 3911 jData.groupId = groupId; 3912 3913 Utilities.postJSONAsynch(config.webService.wsGroup + 'Delete', jData, callback, arguments[2]); 3914 } 3915 3916 // removeConnection: function(gro) 3917}; 3918 3919/************************************************/ 3920/****************** Player **********************/ 3921/************************************************/ 3922var player = { 3923 get: function (playerId, solutionId, callback) { 3924 var jData = {}; 3925 jData.playerId = playerId; 3926 jData.solutionId = solutionId; 3927 3928 function mockPages(player) { 3929 3930 player.Pages = [ 3931 { "__type": "Kreezee.DAL.Entities.Account.CustomPage", "details": [{ "Id": 49, "Culture": "en", "Visibility": 4, "Url": "test-12", "Title": "Test12", "Description": "Test12", "Content": "<p>My form to pay inscription of the run</p>\n\n<p><u><strong>Noroits 1 - Coach Marquis</strong></u></p>\n\n<table border=\"1\" cellpadding=\"100\" cellspacing=\"3\" style=\"border-collapse:collapse; border-spacing:0px; box-sizing:border-box; font-family:open sans,sans-serif; font-size:14px; max-width:100%; width:376px\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td style=\"height:20px; width:126px\"><strong>BOUCHARD</strong></td>\n\t\t\t<td style=\"width:126px\"><strong>CHRISTOPHE</strong></td>\n\t\t\t<td style=\"width:126px\">Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>BUSSIÈRES</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>FÉLIX</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>DAGENAIS</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>ANTOINE</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>DELAUNIÈRE</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>ZACHARY</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>GUÉNETTE</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>ÉLIOTT</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>PARÉ</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>VINCENT</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>ROCHON</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>SAMUEL</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>THIBAULT</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>FÉLIX</strong></td>\n\t\t\t<td>Attaquant</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>BOUCHARD</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>JUSTIN</strong></td>\n\t\t\t<td>Défenseur</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>DELISLE</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>CHARLES-ÉDOUARD</strong></td>\n\t\t\t<td>Défenseur</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>MARQUIS</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>ANTOINE</strong></td>\n\t\t\t<td>Défenseur</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>TREMBLAY</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>SIMON</strong></td>\n\t\t\t<td>Défenseur</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>UBARTAS</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>MIKAEL</strong></td>\n\t\t\t<td>Défenseur</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>LEVESQUE</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>XAVIER</strong></td>\n\t\t\t<td>Gardien</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dir=\"LTR\" style=\"height:20px; width:126px\"><strong>MORISSETTE</strong></td>\n\t\t\t<td dir=\"LTR\" style=\"width:126px\"><strong>JUSTIN</strong></td>\n\t\t\t<td>Gardien</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n<p> </p>\n\n<p><br />\n<!-- ** Ne pas supprimer / Do not delete ** --><img data-form-id=\"c29sdXRpb25JZD0yNjgmZm9ybUlkPTcw\" src=\"https://cache.kreezee.com/files/form.png\" style=\"width:100px\" title=\"Formulaire de feu\" /> <!-- ** Ne pas supprimer / Do not delete ** --><br />\n<!-- ** Ne pas supprimer / Do not delete ** --><br />\n<!-- ** Ne pas supprimer / Do not delete ** --></p>\n\n<div> </div>\n", "Keywords": "" }, { "Id": 49, "Culture": "fr", "Visibility": 4, "Url": "tests", "Title": "Tests", "Description": "Tests", "Content": "<p>Mon formulaire préféré car paiement en ligne de course</p>\n\n<p><!-- ** Ne pas supprimer / Do not delete ** --><img data-form-id=\"c29sdXRpb25JZD0yNjgmZm9ybUlkPTcx\" src=\"https://cache.kreezee.com/files/form.png\" style=\"width:100px\" title=\"Paiement test\" /> <!-- ** Ne pas supprimer / Do not delete ** --> <!-- ** Ne pas supprimer / Do not delete ** --> <!-- ** Ne pas supprimer / Do not delete ** --><br />\n<!-- ** Ne pas supprimer / Do not delete ** --></p>\n", "Keywords": "" }], "Id": 49, "SolutionId": 268, "Name": "Mon formulaire" } 3932 ]; 3933 console.log(player); 3934 callback(player); 3935 } 3936 3937 Utilities.postJSONAsynch(config.webService.wsPlayer + 'Get', jData, mockPages, arguments[3]); 3938 }, 3939 3940 getGamePlayBySeasonId: function (matchId, seasonId) { 3941 var jData = {};
3942 jData.matchId = matchId; 3943 jData.seasonId = seasonId; 3944 3945 return data.post(config.webService.wsPlayer + 'GetGamePlayBySeasonId', jData); 3946 }, 3947 3948 getBySolutionId: function (solutionId, page, pageSize, sortColumn, sortOrder, search, positionId, teamId, statusId) { 3949 var jData = {}; 3950 jData.solutionId = solutionId; 3951 jData.page = page || 1; 3952 jData.pageSize = pageSize || 30000; 3953 jData.sort = (sortOrder ? sortOrder : '+') + (sortColumn || ''); 3954 jData.search = search || ''; 3955 jData.positionId = positionId || null; 3956 jData.teamId = teamId || null; 3957 jData.statusId = statusId || null; 3958 3959 return data.post(config.webService.wsPlayer + 'GetBySolutionId', jData); 3960 }, 3961 3962 getBySolutionIdWithDeferred: function (solutionId) { 3963 var jData = {}; 3964 jData.solutionId = solutionId; 3965 3966 return data.post(config.webService.wsPlayer + 'GetBySolutionId', jData); 3967 }, 3968 3969 getStatsBySeasonTeam: function (teamId, statId, seasonId) { 3970 var jData = {}; 3971 jData.teamId = teamId; 3972 jData.statId = statId; 3973 jData.seasonId = seasonId || null; 3974 3975 return data.post(config.webService.wsPlayer + 'GetStatsBySeasonTeam', jData); 3976 }, 3977 3978 getDuplicatePlayer: function (solutionId, playerList) { 3979 var jData = {}; 3980 jData.solutionId = solutionId; 3981 jData.playerList = playerList; 3982 3983 return data.post(config.webService.wsPlayer + 'GetDuplicatePlayer', jData); 3984 }, 3985 3986 getByTeam: function (teamId, callback) { 3987 var jData = {}; 3988 jData.teamId = teamId; 3989 3990 Utilities.postJSONAsynch(config.webService.wsPlayer + 'GetByTeam', jData, callback, arguments[2]); 3991 }, 3992 3993 getStarByMatch: function (matchId, callback) { 3994 var jData = {}; 3995 jData.matchId = matchId; 3996 3997 Utilities.postJSONAsynch(config.webService.wsPlayer + 'GetStarByMatch', jData, callback, arguments[2]); 3998 }, 3999 4000 createList: function (solutionId, playerList, teamId, callback) { 4001 var jData = {}; 4002 jData.solutionId = solutionId; 4003 jData.playerList = playerList; 4004 jData.teamId = teamId || null; 4005 4006 return Utilities.postJSONAsynch(config.webService.wsPlayer + 'CreatePlayerList', jData, callback, arguments[4]); 4007 }, 4008 4009 addPlayersToTeam: function (teamId, players) { 4010 var jData = {}; 4011 jData.teamId = teamId; 4012 jData.players = players; 4013 4014 return data.post(config.webService.wsPlayer + 'AddPlayersToTeam', jData); 4015 }, 4016 4017 createInTeam: function (solutionId, teamId, email, firstName, lastName, number, picture, position, birthday, height, weight, playerStatus, active, note, level, playerTeams, address, phones, emails, callback) { 4018 var jData = {}; 4019 jData.solutionId = solutionId; 4020 jData.teamId = teamId; 4021 jData.email = email; 4022 jData.firstName = firstName; 4023 jData.lastName = lastName; 4024 jData.number = number; 4025 jData.picture = picture; 4026 jData.position = position; 4027 jData.birthday = birthday; 4028 jData.height = height; 4029 jData.weight = weight; 4030 jData.playerStatus = playerStatus; 4031 jData.active = active; 4032 jData.note = note; 4033 jData.level = level; 4034 jData.playerTeams = playerTeams; 4035 jData.phones = phones 4036 jData.emails = emails; 4037 jData.address = address; 4038 4039 Utilities.postJSONAsynch(config.webService.wsPlayer + 'CreateInTeam', jData, callback, arguments[20]); 4040 }, 4041 4042 createInSolution: function (solutionId, email, firstName, lastName, number, picture, position, birthday, height, weight, playerStatus, active, note, level, playerTeams, address, phones, emails, callback) { 4043 var jData = {}; 4044 jData.solutionId = solutionId; 4045 jData.email = email; 4046 jData.firstName = firstName; 4047 jData.lastName = lastName; 4048 jData.number = number; 4049 jData.picture = picture; 4050 jData.position = position; 4051 jData.birthday = birthday; 4052 jData.height = height; 4053 jData.weight = weight; 4054 jData.playerStatus = playerStatus; 4055 jData.active = active; 4056 jData.note = note; 4057 jData.level = level; 4058 jData.playerTeams = playerTeams; 4059 jData.phones = phones 4060 jData.emails = emails; 4061 jData.address = address; 4062 4063 Utilities.postJSONAsynch(config.webService.wsPlayer + 'CreateInSolution', jData, callback, arguments[19]); 4064 }, 4065 4066 update: function (playerId, firstName, lastName, picture, position, email, birthday, height, weight, note, level, playerTeams, address, phones, emails, teamId, callback) { 4067 var jData = {}; 4068 jData.playerId = playerId; 4069 jData.firstName = firstName; 4070 jData.lastName = lastName; 4071 jData.picture = picture; 4072 jData.position = position; 4073 jData.email = email; 4074 jData.birthday = birthday; 4075 jData.height = height; 4076 jData.weight = weight; 4077 jData.note = note; 4078 jData.level = level; 4079 jData.playerTeams = playerTeams; 4080 jData.phones = phones 4081 jData.emails = emails; 4082 jData.address = address; 4083 jData.teamId = teamId || null; 4084 4085 Utilities.postJSONAsynch(config.webService.wsPlayer + 'Update', jData, callback, arguments[17]); 4086 }, 4087 4088 updateActive: function (playerId, teamId, active) { 4089 var jData = {}; 4090 jData.playerId = playerId; 4091 jData.teamId = teamId; 4092 jData.active = active; 4093 4094 return data.post(config.webService.wsPlayer + 'UpdateActive', jData); 4095 }, 4096 4097 updateAvatar: function (playerId, avatar) { 4098 var jData = {}; 4099 jData.playerId = playerId; 4100 jData.avatar = avatar; 4101 4102 return data.post(config.webService.wsPlayer + 'UpdateAvatar', jData); 4103 }, 4104 4105 updateProperties: function (players) { 4106 var jData = {}; 4107 jData.players = players; 4108 4109 return data.post(config.webService.wsPlayer + 'UpdateProperties', jData); 4110 }, 4111 4112 deletePlayer: function (solutionId, playerId, teamId, callback) { 4113 var jData = {}; 4114 jData.solutionId = solutionId; 4115 jData.playerId = playerId; 4116 jData.teamId = teamId || null; 4117 4118 Utilities.postJSONAsynch(config.webService.wsPlayer + 'Delete', jData, callback, arguments[4]); 4119 }, 4120 4121 updateSubstitute: function (solutionId, playerMovementId, substitute) { 4122 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/player-movement/${playerMovementId}/substitute`; 4123 return data.put(url, substitute); 4124 }, 4125 4126 updateActiveRestApi: function (solutionId, playerMovementId, active) { 4127 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/player-movement/${playerMovementId}/active`; 4128 return data.put(url, active); 4129 }, 4130 4131 merge: function (solutionId, playerId, playerMergeId) { 4132 var url = '/api/player/{0}/{1}/merge/{2}'; 4133 return data.post(config.setting.urlRestApi + String.format(url, playerId, solutionId, playerMergeId), {}); 4134 }, 4135 4136 getFreeAgents: function (solutionId, teamId, page, pageSize, searchText) { 4137 var url = '/api/solution/{0}/team/{1}/player/freeagent{2}'; 4138 var queryString = Utilities.buildQueryString({ page: page, pagesize: pageSize, searchText: searchText })
4139 return data.get(config.setting.urlRestApi + String.format(url, solutionId, teamId, queryString)); 4140 }, 4141 4142 addFreeAgentToTeam: function (solutionId, teamId, playerId) { 4143 var url = '/api/solution/{0}/team/{1}/player/{2}/freeagent'; 4144 return data.post(config.setting.urlRestApi + String.format(url, solutionId, teamId, playerId), {}); 4145 }, 4146 4147 deactivatePlayers: function (solutionId) { 4148 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/players/deactivate`; 4149 return data.post(url); 4150 } 4151}; 4152 4153 4154/************************************************/ 4155/****************** Staff ***********************/ 4156/************************************************/ 4157var staff = { 4158 get: function (staffId, teamId, callback) { 4159 var jData = {}; 4160 jData.staffId = staffId; 4161 jData.teamId = teamId || null; 4162 4163 Utilities.postJSONAsynch(config.webService.wsStaff + 'Get', jData, callback, arguments[3]); 4164 }, 4165 4166 getSolutionStaff: function (staffId, callback) { 4167 var jData = {}; 4168 jData.staffId = staffId; 4169 4170 Utilities.postJSONAsynch(config.webService.wsStaff + 'GetSolutionStaff', jData, callback, arguments[2]); 4171 }, 4172 4173 getBySolution: function (solutionId, callback) { 4174 var jData = {}; 4175 jData.solutionId = solutionId; 4176 4177 Utilities.postJSONAsynch(config.webService.wsStaff + 'GetBySolutionId', jData, callback, arguments[2]); 4178 }, 4179 4180 getTeamsBySolution: function (solutionId) { 4181 var jData = {}; 4182 jData.solutionId = solutionId; 4183 4184 return data.post(config.webService.wsStaff + 'GetTeamsBySolutionId', jData); 4185 }, 4186 4187 getByMatch: function (matchId, callback) { 4188 var jData = {}; 4189 jData.matchId = matchId; 4190 4191 Utilities.postJSONAsynch(config.webService.wsStaff + 'GetByMatchId', jData, callback, arguments[2]); 4192 }, 4193 4194 getByTeam: function (teamId, callback) { 4195 var jData = {}; 4196 jData.teamId = teamId; 4197 4198 Utilities.postJSONAsynch(config.webService.wsStaff + 'GetByTeamId', jData, callback, arguments[2]); 4199 }, 4200 4201 getDuplicateStaff: function (solutionId, staffList) { 4202 var jData = {}; 4203 jData.solutionId = solutionId; 4204 jData.staffList = staffList; 4205 4206 return data.post(config.webService.wsStaff + 'GetDuplicateStaff', jData); 4207 4208 }, 4209 4210 createInLeague: function (staff) { 4211 var jData = {}; 4212 jData.staff = staff; 4213 4214 return data.post(config.webService.wsStaff + 'CreateInLeague', jData); 4215 }, 4216 4217 create: function (staff, staffTeams, teamId) { 4218 var jData = {}; 4219 jData.staff = staff; 4220 jData.staffTeams = staffTeams; 4221 jData.teamId = teamId || null; 4222 4223 return data.post(config.webService.wsStaff + 'Create', jData); 4224 }, 4225 4226 createListInTeam: function (solutionId, teamId, staffList, callback) { 4227 var jData = {}; 4228 jData.solutionId = solutionId; 4229 jData.teamId = teamId; 4230 jData.staffList = staffList; 4231 4232 Utilities.postJSONAsynch(config.webService.wsStaff + 'CreateListInTeam', jData, callback, arguments[4]); 4233 }, 4234 4235 createListInSolution: function (solutionId, staffList, callback) { 4236 var jData = {}; 4237 jData.solutionId = solutionId; 4238 jData.staffList = staffList; 4239 4240 Utilities.postJSONAsynch(config.webService.wsStaff + 'CreateListInSolution', jData, callback, arguments[3]); 4241 }, 4242 4243 update: function (staff, staffMovements, teamId) { 4244 var jData = {}; 4245 jData.staff = staff; 4246 jData.staffMovements = staffMovements; 4247 jData.teamId = teamId || null; 4248 4249 return data.post(config.webService.wsStaff + 'Update', jData); 4250 }, 4251 4252 updateActive: function (staffId, teamId, active) { 4253 var jData = {}; 4254 jData.staffId = staffId; 4255 jData.teamId = teamId; 4256 jData.active = active; 4257 4258 return data.post(config.webService.wsStaff + 'UpdateActive', jData); 4259 }, 4260 4261 deleteStaff: function (staffId, teamId) { 4262 var jData = {}; 4263 jData.staffId = staffId;
4264 jData.teamId = teamId || null; 4265 4266 return data.post(config.webService.wsStaff + 'Delete', jData); 4267 }, 4268 4269 deactivateTeamStaff: function (solutionId) { 4270 var url = `${config.setting.urlRestApi}/api/solution/${solutionId}/team-staff/deactivate`; 4271 return data.post(url); 4272 } 4273}; 4274 4275/*****************************************************/ 4276/****************** Suspension ***********************/ 4277/*****************************************************/ 4278var suspension = { 4279 get: function (suspensionId) { 4280 var jData = {}; 4281 jData.suspensionId = suspensionId; 4282 4283 return data.post(config.webService.wsSuspension + 'Get', jData); 4284 }, 4285 4286 getBySolution: function (solutionId) { 4287 var jData = {}; 4288 jData.solutionId = solutionId; 4289 4290 return data.post(config.webService.wsSuspension + 'GetBySolution', jData); 4291 }, 4292 4293 getByTeam: function (teamId) { 4294 var jData = {}; 4295 jData.teamId = teamId; 4296 4297 return data.post(config.webService.wsSuspension + 'GetByTeam', jData); 4298 }, 4299 4300 getByPlayer: function (playerId) { 4301 var jData = {}; 4302 jData.playerId = playerId; 4303 4304 return data.post(config.webService.wsSuspension + 'GetByPlayer', jData); 4305 }, 4306 4307 getByStaff: function (staffId) { 4308 var jData = {}; 4309 jData.staffId = staffId; 4310 4311 return data.post(config.webService.wsSuspension + 'GetByStaff', jData); 4312 }, 4313 4314 create: function (suspension) { 4315 var jData = {}; 4316 jData.suspension = suspension; 4317 4318 return data.post(config.webService.wsSuspension + 'Create', jData); 4319 }, 4320 4321 update: function (suspension) { 4322 var jData = {}; 4323 jData.suspension = suspension; 4324 4325 return data.post(config.webService.wsSuspension + 'Update', jData); 4326 }, 4327 4328 delete: function (suspensionId) { 4329 var jData = {}; 4330 jData.suspensionId = suspensionId; 4331 4332 return data.post(config.webService.wsSuspension + 'Delete', jData); 4333 } 4334} 4335 4336/************************************************/ 4337/****************** Phone ***********************/ 4338/************************************************/ 4339var phone = { 4340 getTypes: function (culture) { 4341 var jData = {}; 4342 jData.culture = culture; 4343 4344 return [ 4345 { Id: '4', Name: 'Maison' }, 4346 { Id: '8', Name: 'Travail' }, 4347 { Id: '19', Name: 'Cellulaire' }]; 4348 }, 4349 4350 getPhoneByContact: function (contactId, callback) { 4351 var jData = {}; 4352 jData.contactId = contactId; 4353 Utilities.postJSONAsynch(config.webService.wsPhone + 'GetPhoneByContact', jData, callback); 4354 }, 4355 4356 createPhone: function (contactId, typeId, phoneNumber, primary) { 4357 var jData = {}; 4358 jData.contactId = contactId; 4359 jData.typeId = typeId; 4360 jData.phoneNumber = phoneNumber; 4361 jData.primary = primary; 4362 4363 return Utilities.postJSON(config.webService.wsPhone + 'CreatePhone', jData); 4364 }, 4365 4366 updatePhone: function (phoneId, typeId, phoneNumber, primary) { 4367 var jData = {}; 4368 jData.phoneId = phoneId; 4369 jData.typeId = typeId; 4370 jData.phoneNumber = phoneNumber; 4371 jData.primary = primary; 4372 4373 return Utilities.postJSON(config.webService.wsPhone + 'UpdatePhone', jData); 4374 }, 4375 4376 deletePhone: function (phoneId) { 4377 var jData = {}; 4378 jData.phoneId = phoneId; 4379 4380 return Utilities.postJSON(config.webService.wsPhone + 'DeletePhone', jData); 4381 } 4382}; 4383 4384 4385/************************************************/ 4386/****************** Address *********************/ 4387/************************************************/ 4388var address = { 4389 createAddress: function (contactId, typeId, addressFirstLine, addressSecondLine, city, state, country, zip, primary) { 4390 var jData = {}; 4391 jData.contactId = contactId; 4392 jData.typeId = typeId; 4393 jData.addressFirstLine = addressFirstLine; 4394 jData.addressSecondLine = addressSecondLine; 4395 jData.city = city; 4396 jData.state = state; 4397 jData.country = country; 4398 jData.zip = zip; 4399 jData.primary = primary; 4400 4401 return Utilities.postJSON(config.webService.wsAddress + 'CreateAddress', jData); 4402 }, 4403 4404 getAddress: function (addressId) { 4405 var jData = {}; 4406 jData.addressId = addressId; 4407 4408 return Utilities.postJSON(config.webService.wsAddress + 'GetAddress', jData); 4409 }, 4410 4411 getAddressByContact: function (contactId) { 4412 var jData = {}; 4413 jData.contactId = contactId; 4414 4415 return Utilities.postJSON(config.webService.wsAddress + 'GetAddressByContact', jData); 4416 }, 4417 4418 updateAddress: function (addressId, typeId, addressFirstLine, addressSecondLine, city, state, country, zip, primary) { 4419 var jData = {}; 4420 jData.addressId = addressId; 4421 jData.typeId = typeId;
4422 jData.addressFirstLine = addressFirstLine; 4423 jData.addressSecondLine = addressSecondLine; 4424 jData.city = city; 4425 jData.state = state; 4426 jData.country = country; 4427 jData.zip = zip; 4428 jData.primary = primary; 4429 4430 return Utilities.postJSON(config.webService.wsAddress + 'UpdateAddress', jData); 4431 }, 4432 4433 deleteAddress: function (addressId) { 4434 var jData = {}; 4435 jData.addressId = addressId; 4436 4437 return Utilities.postJSON(config.webService.wsAddress + 'DeleteAddress', jData); 4438 } 4439}; 4440 4441/************************************************/ 4442/****************** Email ***********************/ 4443/************************************************/ 4444var email = { 4445 getPhoneByContact: function (contactId) { 4446 var jData = {}; 4447 jData.contactId = contactId; 4448 4449 return Utilities.postJSON(config.webService.wsEmail + 'GetEmailByContact', jData); 4450 }, 4451 4452 verify: function (email) { 4453 var jData = {}; 4454 jData.email = email; 4455 4456 return data.post(config.webService.wsMail + 'Verify', jData); 4457 }, 4458 4459 createEmail: function (contactId, typeId, emailAddress, primary) { 4460 var jData = {}; 4461 jData.contactId = contactId; 4462 jData.typeId = typeId; 4463 jData.emailAddress = emailAddress; 4464 jData.primary = primary; 4465 4466 return Utilities.postJSON(config.webService.wsEmail + 'CreateEmail', jData); 4467 }, 4468 4469 updateEmail: function (emailId, typeId, emailAddress, primary) { 4470 var jData = {}; 4471 jData.emailId = emailId; 4472 jData.typeId = typeId; 4473 jData.emailAddress = emailAddress; 4474 jData.primary = primary; 4475 4476 return Utilities.postJSON(config.webService.wsEmail + 'UpdateEmail', jData); 4477 }, 4478 4479 deleteEmail: function (emailId) { 4480 var jData = {}; 4481 jData.emailId = emailId; 4482 4483 return Utilities.postJSON(config.webService.wsEmail + 'DeleteEmail', jData); 4484 } 4485}; 4486 4487/************************************************/ 4488/****************** Sport Center ****************/ 4489/************************************************/ 4490var sportCenter = { 4491 getById: function (sportCenterId, callback) { 4492 var jData = {}; 4493 jData.sportCenterId = sportCenterId; 4494 4495 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'GetById', jData, callback, arguments[2]); 4496 }, 4497 4498 getByAccount: function (accountId, callback) { 4499 var jData = {}; 4500 jData.accountId = accountId; 4501 4502 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'GetByAccount', jData, callback); 4503 }, 4504 4505 getBySolutionId: function (solutionId, callback) { 4506 var jData = {}; 4507 jData.solutionId = solutionId; 4508 4509 return Utilities.postJSONAsynch(config.webService.wsSportCenter + 'GetBySolutionId', jData, callback, arguments[2]); 4510 }, 4511 4512 getDetailBySolutionId: function (solutionId, callback) { 4513 var jData = {}; 4514 jData.solutionId = solutionId; 4515 4516 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'GetDetailBySolutionId', jData, callback, arguments[2]); 4517 }, 4518 4519 getByLeagueId: function (leagueId, callback) { 4520 var jData = {}; 4521 jData.leagueId = leagueId; 4522 4523 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'GetByLeagueId', jData, callback, arguments[2]); 4524 }, 4525 4526 getDuplicateSportCenter: function (solutionId, sportCenterList) { 4527 var jData = {}; 4528 jData.solutionId = solutionId; 4529 jData.sportCenterList = sportCenterList; 4530 4531 return data.post(config.webService.wsSportCenter + 'GetDuplicateSportCenter', jData); 4532 }, 4533 4534 insertSolution: function (sportCenterId, solutionId) { 4535 var jData = {}; 4536 jData.sportCenterId = sportCenterId; 4537 jData.solutionId = solutionId; 4538 4539 return data.post(config.webService.wsSportCenter + 'InsertSolution', jData); 4540 }, 4541 4542 create: function (sportCenter, callback) { 4543 var jData = {}; 4544 jData.sportCenter = sportCenter; 4545 4546 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'Create', jData, callback); 4547 }, 4548 4549 update: function (sportCenter, callback) { 4550 var jData = {}; 4551 jData.sportCenter = sportCenter; 4552 4553 Utilities.postJSONAsynch(config.webService.wsSportCenter + 'Update', jData, callback); 4554 }, 4555 4556 delete: function (sportCenterId, solutionId) { 4557 var jData = {}; 4558 jData.sportCenterId = sportCenterId; 4559 jData.solutionId = solutionId; 4560 4561 return data.post(config.webService.wsSportCenter + 'Delete', jData); 4562 }, 4563 4564 updateState: function (sportCenterId, state, stateNote, updateDate) { 4565 var jData = {}; 4566 jData.sportCenterId = sportCenterId; 4567 jData.state = state; 4568 jData.stateNote = stateNote; 4569 jData.updateDate = updateDate; 4570 4571 return data.post(config.webService.wsSportCenter + 'UpdateState', jData); 4572 }, 4573 4574 updateActive: function (solutionId, sportCenterId, active) { 4575 var jData = {}; 4576 jData.solutionId = solutionId; 4577 jData.sportCenterId = sportCenterId; 4578 jData.active = active; 4579 4580 return data.post(config.webService.wsSportCenter + 'UpdateActive', jData); 4581 } 4582}; 4583 4584/************************************************/ 4585/***************** Account News *****************/ 4586/************************************************/ 4587function getNewsByAccount(accountId) { 4588 var jData = {}; 4589 jData.accountId = accountId; 4590 4591 return Utilities.postJSON(config.webService.wsAccountNews + 'GetByAccount', jData); 4592} 4593 4594/************************************************/ 4595/****************** Schedule ********************/ 4596/************************************************/ 4597var schedule = { 4598 getBySolutionId: function (solutionId, startDate, endDate, page, pageSize, teamId, sportCenterId, opponentTeamId, inSolutionId, typeId, searchText, seasonId, divisionId) { 4599 var jData = {}; 4600 jData.solutionId = solutionId; 4601 jData.startDate = startDate || null; 4602 jData.endDate = endDate || null; 4603 jData.page = page || 1; 4604 jData.pageSize = pageSize || 10; 4605 jData.teamId = teamId || null; 4606 jData.sportCenterId = sportCenterId || null; 4607 jData.opponentTeamId = opponentTeamId || null; 4608 jData.inSolutionId = inSolutionId || null; 4609 jData.typeId = typeId || null; 4610 jData.searchText = searchText || ""; 4611 jData.seasonId = seasonId || null; 4612 jData.divisionId = divisionId || null; 4613 4614 return data.post(config.webService.wsSolution + 'GetScheduleBySolutionId', jData); 4615 }, 4616 4617 getMultieditGameBySolutionId: function (solutionId, startDate, endDate, page, pageSize, teamId, sportCenterId, opponentTeamId, inSolutionId, searchText, divisionId) { 4618 var jData = {}; 4619 jData.solutionId = solutionId; 4620 jData.startDate = startDate || null; 4621 jData.endDate = endDate || null; 4622 jData.page = page || 1; 4623 jData.pageSize = pageSize || 10; 4624 jData.teamId = teamId || null; 4625 jData.sportCenterId = sportCenterId || null; 4626 jData.searchText = searchText || ""; 4627 jData.opponentTeamId = opponentTeamId || null; 4628 jData.inSolutionId = inSolutionId || null; 4629 jData.divisionId = divisionId || null; 4630 4631 return data.post(config.webService.wsSolution + 'GetMultiEditGameBySolutionId', jData); 4632 }, 4633 4634 getStartingPitchers: function (solutionId, teamId, startDate, endDate, page, pageSize) { 4635 var url = '/api/solution/{0}/teammanager/{1}/game/startingpitcher{2}'; 4636 var queryString = Utilities.buildQueryString({ startdate: startDate, enddate: endDate, page: page, pagesize: pageSize }) 4637 return data.get(config.setting.urlRestApi + String.format(url, solutionId, teamId, queryString)); 4638 }, 4639 4640 updateStartingPitcher: function (solutionId, teamId, gameId, playerId) { 4641 var url = '/api/solution/{0}/teammanager/{1}/game/{2}/startingpitcher/{3}' 4642 return data.put(config.setting.urlRestApi + String.format(url, solutionId, teamId, gameId, playerId)); 4643 } 4644}; 4645 4646/************************************************/
4647/****************** Match ********************/ 4648/************************************************/ 4649var match = { 4650 getById: function (matchId, callback) { 4651 var jData = {}; 4652 jData.matchId = matchId; 4653 4654 Utilities.postJSONAsynch(config.webService.wsMatch + 'GetAdmin', jData, callback, arguments[2]); 4655 }, 4656 4657 getDetailsById: function (matchId) { 4658 var jData = {}; 4659 jData.matchId = matchId; 4660 4661 return data.post(config.webService.wsMatch + 'GetAdmin', jData); 4662 }, 4663 4664 getScoreboardLineup: function (matchId) { 4665 var jData = {}; 4666 jData.matchId = matchId; 4667 4668 return data.post(config.webService.wsMatch + 'GetScoreboardLineUp', jData); 4669 }, 4670 4671 saveScoreboardLineup: function (match) { 4672 var jData = {}; 4673 jData.match = match; 4674 4675 return data.post(config.webService.wsMatch + 'SaveScoreboardLineup', jData); 4676 }, 4677 4678 getDuplicateMatch: function (seasonId, matchList) { 4679 var jData = {}; 4680 jData.seasonId = seasonId; 4681 jData.matchList = matchList; 4682 4683 return data.post(config.webService.wsMatch + 'GetDuplicateMatch', jData); 4684 }, 4685 4686 updateScoreBoard: function (match, playerStarList, teamId) { 4687 var jData = {}; 4688 jData.match = match; 4689 jData.playerStarList = playerStarList; 4690 jData.teamId = teamId || null; 4691 4692 return data.post(config.webService.wsMatch + 'UpdateScoreboard', jData); 4693 }, 4694 4695 getBySeason: function (seasonId, callback) { 4696 var jData = {}; 4697 jData.seasonId = seasonId; 4698 4699 Utilities.postJSONAsynch(config.webService.wsMatch + 'GetBySeason', jData, callback, arguments[2]); 4700 }, 4701 4702 getBySolution: function (solutionId, callback) { 4703 var jData = {}; 4704 jData.solutionId = solutionId; 4705 4706 Utilities.postJSONAsynch(config.webService.wsMatch + 'GetBySolution', jData, callback, arguments[2]); 4707 }, 4708 4709 getBySolutionWithDeferred: function (solutionId, startDate, endDate, page, pageSize, teamId, sportCenterId, inSolutionId, searchText) { 4710 var jData = {}; 4711 jData.solutionId = solutionId; 4712 jData.startDate = startDate || null; 4713 jData.endDate = endDate || null; 4714 jData.page = page || 1; 4715 jData.pageSize = pageSize || 10; 4716 jData.teamId = teamId || null; 4717 jData.sportCenterId = sportCenterId || null; 4718 jData.inSolutionId = inSolutionId || null; 4719 jData.searchText = searchText || ''; 4720 4721 return data.post(config.webService.wsMatch + 'GetBySolution', jData); 4722 }, 4723 4724 getByTeam: function (teamId, startDate, endDate, page, pageSize, opponentTeamId, sportCenterId, searchText) { 4725 var jData = {}; 4726 jData.teamId = teamId; 4727 jData.startDate = startDate || null; 4728 jData.endDate = endDate || null; 4729 jData.page = page || 1; 4730 jData.pageSize = pageSize || 10; 4731 jData.opponentTeamId = opponentTeamId || null; 4732 jData.sportCenterId = sportCenterId || null; 4733 jData.searchText = searchText || ''; 4734 4735 return data.post(config.webService.wsMatch + 'GetByTeam', jData); 4736 }, 4737 4738 getByTeamDate: function (solutionId, teamId, startDate, matchId) { 4739 var jData = {}; 4740 jData.solutionId = solutionId; 4741 jData.teamId = teamId; 4742 jData.startDate = startDate; 4743 jData.matchId = matchId; 4744 4745 return data.post(config.webService.wsMatch + 'GetByTeamDate', jData); 4746 }, 4747 4748 getStats: function (matchId, callback) { 4749 var jData = {}; 4750 jData.matchId = matchId; 4751 4752 Utilities.postJSONAsynch(config.webService.wsMatch + 'GetStats', jData, callback, arguments[2]); 4753 }, 4754 4755 create: function (solutionId, seasonId, typeId, localTeamId, visitorTeamId, date, startTime, duration, sportCenterId, surface, localLockerRoom, visitorLockerRoom, statusId, periodId, noteTypeId, note, number, teamId, divisionId, properties, callback) { 4756 var jData = {} 4757 jData.solutionId = solutionId; 4758 jData.seasonId = seasonId; 4759 jData.typeId = typeId;
4760 jData.localTeamId = localTeamId; 4761 jData.visitorTeamId = visitorTeamId; 4762 jData.date = date; 4763 jData.startTime = startTime; 4764 jData.duration = duration; 4765 jData.sportCenterId = sportCenterId; 4766 jData.surface = surface; 4767 jData.localLockerRoom = localLockerRoom; 4768 jData.visitorLockerRoom = visitorLockerRoom; 4769 jData.statusId = statusId; 4770 jData.periodId = periodId; 4771 jData.noteTypeId = noteTypeId; 4772 jData.note = note; 4773 jData.number = number; 4774 jData.teamId = teamId || null; 4775 jData.divisionId = divisionId || null; 4776 jData.properties = properties || null; 4777 4778 Utilities.postJSONAsynch(config.webService.wsMatch + 'Create', jData, callback, arguments[21]); 4779 4780 }, 4781 4782 update: function (matchId, solutionId, seasonId, typeId, localTeamId, visitorTeamId, date, startTime, duration, sportCenterId, surface, localLockerRoom, visitorLockerRoom, statusId, periodId, noteTypeId, note, number, teamId, divisionId, properties, callback) { 4783 var jData = {} 4784 jData.matchId = matchId; 4785 jData.solutionId = solutionId; 4786 jData.seasonId = seasonId; 4787 jData.typeId = typeId; 4788 jData.localTeamId = localTeamId; 4789 jData.visitorTeamId = visitorTeamId; 4790 jData.date = date; 4791 jData.startTime = startTime; 4792 jData.duration = duration; 4793 jData.sportCenterId = sportCenterId; 4794 jData.surface = surface; 4795 jData.localLockerRoom = localLockerRoom; 4796 jData.visitorLockerRoom = visitorLockerRoom; 4797 jData.statusId = statusId; 4798 jData.periodId = periodId; 4799 jData.noteTypeId = noteTypeId; 4800 jData.note = note; 4801 jData.number = number; 4802 jData.teamId = teamId || null; 4803 jData.divisionId = divisionId || null; 4804 jData.properties = properties || null; 4805 4806 Utilities.postJSONAsynch(config.webService.wsMatch + 'Update', jData, callback, arguments[22]); 4807 }, 4808 4809 createList: function (solutionId, matchList, teamId, callback) { 4810 var jData = {}; 4811 jData.solutionId = solutionId; 4812 jData.matchList = matchList; 4813 jData.teamId = teamId || null; 4814 4815 Utilities.postJSONAsynch(config.webService.wsMatch + 'CreateList', jData, callback, arguments[4]); 4816 }, 4817 4818 updateStaffList: function (gameId, staffList, callback) { 4819 var jData = {}; 4820 jData.gameId = gameId; 4821 jData.staffList = staffList; 4822 4823 Utilities.postJSONAsynch(config.webService.wsMatch + 'UpdateStaffList', jData, callback, arguments[3]); 4824 }, 4825 4826 updateLineup: function (gameId, playerList, staffList, callback) { 4827 var jData = {}; 4828 jData.gameId = gameId; 4829 jData.playerList = playerList; 4830 jData.staffList = staffList; 4831 4832 Utilities.postJSONAsynch(config.webService.wsMatch + 'UpdateLineup', jData, callback, arguments[4]); 4833 }, 4834 4835 updateStar: function (gameId, playerList, callback) { 4836 var jData = {}; 4837 jData.gameId = gameId; 4838 jData.playerList = playerList; 4839 4840 Utilities.postJSONAsynch(config.webService.wsMatch + 'UpdateStar', jData, callback, arguments[3]); 4841 }, 4842 4843 updateStats: function (match, eventList, statsList, statsTeamList, callback) { 4844 var jData = {}; 4845 jData.match = match; 4846 jData.eventList = eventList; 4847 jData.statsList = statsList; 4848 jData.statsTeamList = statsTeamList; 4849 4850 Utilities.postJSONAsynch(config.webService.wsMatch + 'UpdateStats', jData, callback, arguments[5]); 4851 }, 4852 4853 updateStatus: function (gameId, statusId, periodId) { 4854 var jData = {}; 4855 jData.gameId = gameId; 4856 jData.statusId = statusId; 4857 jData.periodId = periodId; 4858 4859 return data.post(config.webService.wsMatch + 'UpdateStatus', jData); 4860 }, 4861 4862 deleteMatch: function (matchId, teamId) { 4863 var jData = {}; 4864 jData.matchId = matchId; 4865 jData.teamId = teamId || null; 4866 4867 return data.post(config.webService.wsMatch + 'Delete', jData); 4868 }, 4869 4870 updateGameList: function (matchList, teamId) { 4871 var jData = {}; 4872 jData.matchList = matchList; 4873 jData.teamId = teamId || null; 4874 4875 return data.post(config.webService.wsMatch + 'UpdateGameList', jData); 4876 }, 4877 4878 updateList: function (seasonId, matchList, callback) { 4879 var jData = {}; 4880 jData.seasonId = seasonId; 4881 jData.matchList = matchList; 4882 4883 return Utilities.postJSONAsynch(config.webService.wsMatch + 'UpdateList', jData, callback, arguments[3]); 4884 }, 4885 4886 updateBroadcast: function (solutionId, broadcasts) { 4887 var jData = {}; 4888 jData.solutionId = solutionId; 4889 jData.broadcasts = broadcasts; 4890 4891 return data.post(config.webService.wsEvent + 'UpdateBroadcast', jData); 4892 }, 4893 4894 updateStaffSignature: function (solutionId, gameId, staffId, signature) { 4895 var url = '/api/solution/{0}/game/{1}/staffSigned/{2}'; 4896 return data.put(config.setting.urlRestApi + String.format(url, solutionId, gameId, staffId), signature); 4897 4898 }, 4899 4900 deleteStaffSignature: function (solutionId, gameId, staffId) { 4901 var url = '/api/solution/{0}/game/{1}/staffSigned/{2}'; 4902 return data.delete(config.setting.urlRestApi + String.format(url, solutionId, gameId, staffId)); 4903 } 4904}; 4905 4906var scoreboard = { 4907 get: function (solutionId, gameId) { 4908 var url = '/api/solution/{0}/scoreboard/baseball/{1}'; 4909 return data.get(config.setting.urlRestApi + String.format(url, solutionId, gameId)); 4910 }, 4911 startGame: function (gameId) { 4912 var url = '/api/scoreboard/baseball/start/{0}'; 4913 return data.post(config.setting.urlRestApi + String.format(url, gameId), {}); 4914 }, 4915 field: { 4916 get: function (gameId) { 4917 var url = '/api/field/baseball/{0}'; 4918 return data.get(config.setting.urlRestApi + String.format(url, gameId)); 4919 } 4920 }, 4921 event: { 4922 get: function (gameId) { 4923 var url = '/api/event/game/baseball/{0}'; 4924 return data.get(config.setting.urlRestApi + String.format(url, gameId)); 4925 }, 4926 create: function (gameId, sequence) { 4927 var url = '/api/event/baseball/{0}'; 4928 return data.post(config.setting.urlRestApi + String.format(url, gameId), sequence); 4929 }, 4930 update: function (sequence) { 4931 var url = '/api/event/baseball'; 4932 return data.put(config.setting.urlRestApi + url, sequence) 4933 }, 4934 }, 4935 lineup: { 4936 updateStarting: function (solutionId, gameId, lineup) { 4937 var url = '/api/solution/{0}/lineup/baseball/starting/{1}'; 4938 return data.put(config.setting.urlRestApi + String.format(url, solutionId, gameId), lineup) 4939 }, 4940 addSubstitution: function (gameId, substitution) { 4941 var url = '/api/lineup/baseball/{0}/substitution'; 4942 return data.put(config.setting.urlRestApi + String.format(url, gameId), substitution); 4943 } 4944 } 4945} 4946 4947/************************************************/ 4948/******************* Event **********************/ 4949/************************************************/ 4950var calendarEvent = { 4951 getById: function (eventId) { 4952 var jData = {}; 4953 jData.eventId = eventId; 4954 4955 return data.post(config.webService.wsEvent + 'Get', jData); 4956 }, 4957 4958 getBySolution: function (solutionId) { 4959 var jData = {}; 4960 jData.solutionId = solutionId; 4961 jData.startDate = null; 4962 jData.endDate = null; 4963 4964 return data.post(config.webService.wsEvent + 'GetBySolution', jData); 4965 }, 4966 4967 create: function (solutionId, eventObject, teamId) { 4968 var jData = {} 4969 jData.solutionId = solutionId; 4970 jData.eventObject = eventObject; 4971 jData.teamId = teamId || null; 4972 4973 return data.post(config.webService.wsEvent + 'Create', jData); 4974 }, 4975 4976 createList: function (solutionId, eventList, teamId) { 4977 var jData = {}; 4978 jData.solutionId = solutionId; 4979 jData.eventList = eventList; 4980 jData.teamId = teamId || null; 4981 4982 return data.post(config.webService.wsEvent + 'CreateList', jData); 4983 }, 4984 4985 update: function (solutionId, eventObject, teamId) { 4986 var jData = {} 4987 jData.solutionId = solutionId; 4988 jData.eventObject = eventObject; 4989 jData.teamId = teamId || null; 4990 4991 return data.post(config.webService.wsEvent + 'Update', jData); 4992 }, 4993 4994 4995 deleteEvent: function (eventId, teamId) { 4996 var jData = {}; 4997 jData.eventId = eventId; 4998 jData.teamId = teamId || null; 4999 5000 return data.post(config.webService.wsEvent + 'Delete', jData); 5001 } 5002} 5003 5004/************************************************/ 5005/******************* Medias *********************/ 5006/************************************************/ 5007var medias = { 5008 document: { 5009 getBySolutionId: function (solutionId) { 5010 var jData = {}; 5011 jData.solutionId = solutionId; 5012 5013 return data.post(config.webService.wsDocument + 'GetBySolutionId', jData); 5014 }, 5015 5016 getById: function (documentId) { 5017 var jData = {}; 5018 jData.documentId = documentId; 5019 5020 return data.post(config.webService.wsDocument + 'GetById', jData); 5021 }, 5022 5023 create: function (solutionId, title, description, url, fileFormat, fileSize, visibility) { 5024 var jData = {}; 5025 jData.solutionId = solutionId; 5026 jData.title = title; 5027 jData.description = description; 5028 jData.url = url; 5029 jData.fileFormat = fileFormat; 5030 jData.fileSize = fileSize; 5031 jData.visibility = visibility; 5032 5033 return data.post(config.webService.wsDocument + 'Create', jData); 5034 }, 5035 5036 update: function (documentId, solutionId, title, description, url, fileFormat, fileSize, visibility) { 5037 var jData = {}; 5038 jData.documentId = documentId; 5039 jData.solutionId = solutionId; 5040 jData.title = title; 5041 jData.description = description; 5042 jData.url = url; 5043 jData.fileFormat = fileFormat; 5044 jData.fileSize = fileSize; 5045 jData.visibility = visibility; 5046 5047 return data.post(config.webService.wsDocument + 'Update', jData); 5048 }, 5049 5050 delete: function (documentId) { 5051 var jData = {}; 5052 jData.documentId = documentId; 5053 5054 return data.post(config.webService.wsDocument + 'Delete', jData); 5055 } 5056 }, 5057 news: { 5058 getBySolutionId: function (solutionId, page, pageSize, searchText, sortOrder, sortColumn) { 5059 var jData = {}; 5060 jData.solutionId = solutionId; 5061 jData.searchText = searchText; 5062 jData.sortOrder = sortOrder; 5063 jData.sortColumn = sortColumn; 5064 jData.page = page; 5065 jData.pageSize = pageSize; 5066 5067 return data.post(config.webService.wsNews + 'GetBySolutionId', jData); 5068 }, 5069 5070 getByLeagueId: function (leagueId, callback) { 5071 var jData = {}; 5072 jData.leagueId = leagueId; 5073 5074 Utilities.postJSONAsynch(config.webService.wsNews + 'GetByLeagueId', jData, callback, arguments[2]); 5075 }, 5076
5077 getSpecificByLeagueId: function (leagueId, number, callback) { 5078 var jData = {}; 5079 jData.leagueId = leagueId; 5080 jData.number = number; 5081 5082 Utilities.postJSONAsynch(config.webService.wsNews + 'GetByLeagueId', jData, callback, arguments[3]); 5083 }, 5084 5085 get: function (newsId, callback) { 5086 var jData = {}; 5087 jData.newsId = newsId; 5088 5089 return Utilities.postJSONAsynch(config.webService.wsNews + 'Get', jData, callback, arguments[2]); 5090 }, 5091 5092 create: function (news, callback) { 5093 var jData = {}; 5094 jData.news = news; 5095 5096 Utilities.postJSONAsynch(config.webService.wsNews + 'Create', jData, callback, arguments[7]); 5097 }, 5098 5099 update: function (news, callback) { 5100 var jData = {}; 5101 jData.news = news; 5102 5103 Utilities.postJSONAsynch(config.webService.wsNews + 'Update', jData, callback, arguments[7]); 5104 }, 5105 5106 deleteByNewsId: function (newsId, callback) { 5107 var jData = {}; 5108 jData.newsId = newsId; 5109 5110 Utilities.postJSONAsynch(config.webService.wsNews + 'Delete', jData, callback, arguments[2]); 5111 } 5112 }, 5113 5114 video: { 5115 get: function (videoId, callback) { 5116 var jData = {}; 5117 jData.videoId = videoId; 5118 5119 Utilities.postJSONAsynch(config.webService.wsVideo + 'Get', jData, callback, arguments[2]); 5120 }, 5121 5122 getBySolutionId: function (solutionId, callback) { 5123 var jData = {}; 5124 jData.solutionId = solutionId; 5125 5126 Utilities.postJSONAsynch(config.webService.wsVideo + 'GetBySolutionId', jData, callback, arguments[2]); 5127 }, 5128 5129 createBySolutionId: function (solutionId, title, description, url, thumbnail, tags, category, duration, status, visibilityId, callback) { 5130 var jData = {}; 5131 jData.solutionId = solutionId; 5132 jData.title = title; 5133 jData.description = description; 5134 jData.url = url; 5135 jData.thumbnail = thumbnail; 5136 jData.tags = tags; 5137 jData.category = category; 5138 jData.duration = duration; 5139 jData.status = status; 5140 jData.visibilityId = visibilityId; 5141 5142 Utilities.postJSONAsynch(config.webService.wsVideo + 'CreateBySolutionId', jData, callback, arguments[11]); 5143 }, 5144 5145 update: function (videoId, title, description, url, thumbnail, tags, category, duration, status, visibilityId, callback) { 5146 var jData = {}; 5147 jData.videoId = videoId; 5148 jData.title = title; 5149 jData.description = description; 5150 jData.url = url; 5151 jData.thumbnail = thumbnail; 5152 jData.tags = tags; 5153 jData.category = category; 5154 jData.duration = duration; 5155 jData.status = status; 5156 jData.visibilityId = visibilityId; 5157 5158 Utilities.postJSONAsynch(config.webService.wsVideo + 'Update', jData, callback, arguments[11]); 5159 }, 5160 5161 delete: function (videoId, callback) { 5162 var jData = {}; 5163 jData.videoId = videoId; 5164 5165 Utilities.postJSONAsynch(config.webService.wsVideo + 'Delete', jData, callback, arguments[2]); 5166 }, 5167 5168 getVideoInformation: function (url, callback) { 5169 var provider = ''; 5170 5171 if ((url.toLowerCase().indexOf('youtube') != -1) 5172 || (url.toLowerCase().indexOf('youtu.be') != -1)) { 5173 provider = 'youtube'; 5174 } else if (url.toLowerCase().indexOf('vimeo') != -1) { 5175 provider = 'vimeo'; 5176 } else if (url.toLowerCase().indexOf('dailymotion') != -1) { 5177 provider = 'dailymotion'; 5178 } 5179 5180 $.ajax({
5181 type: 'GET', 5182 url: 'handlers/video.ashx?provider=' + escape(provider) + '&videoId=' + escape(Utilities.parseVideoUrl(url)), 5183 data: {}, 5184 contentType: 'application/json; charset=utf-8', 5185 dataType: 'json', 5186 cache: false, 5187 async: false 5188 }) 5189 .done(function (data) { 5190 var video = {}; 5191 5192 switch (provider) { 5193 case 'dailymotion': 5194 video.Title = data.title; 5195 video.Description = data.description; 5196 video.From = data["owner.screenname"]; 5197 video.Category = data.strongtags; 5198 video.Tags = ''; 5199 video.Thumbnail = data.thumbnail_180_url; 5200 video.Duration = ''; 5201 break; 5202 5203 case 'vimeo': 5204 video.Title = data[0].title; 5205 video.Description = data[0].description; 5206 video.From = data[0].user_name; 5207 video.Category = ''; 5208 video.Tags = data[0].Tags; 5209 video.Thumbnail = data[0].thumbnail_medium; 5210 video.Duration = ''; 5211 break; 5212 5213 case 'youtube': 5214 video.Title = data.items[0].snippet.title; 5215 video.Description = data.items[0].snippet.description; 5216 video.From = data.items[0].snippet.channelTitle; 5217 video.Category = ''; 5218 video.Tags = ''; 5219 video.Thumbnail = data.items[0].snippet.thumbnails.high.url; 5220 video.Duration = ''; 5221 break; 5222 } 5223 callback(video); 5224 }) 5225 .fail(function (jqxhr, textStatus, error) { 5226 //debugger; 5227 if (error.length > 0) 5228 alert(error); 5229 // var err = eval("(" + jqxhr.responseText + ")"); 5230 // Utilities.displayMessage('error', language.errorMessage.title, language.errorMessage.message + err.Message); 5231 }) 5232 .always(function () { 5233 //if (idObject != undefined) { 5234 //$(idObject).unblock({ fadeOut: 0 }); 5235 //} 5236 }); 5237 } 5238 }, 5239 5240 photo: { 5241 get: function (photoId, callback) { 5242 var jData = {}; 5243 jData.photoId = photoId; 5244 5245 Utilities.postJSONAsynch(config.webService.wsPhoto + 'Get', jData, callback, arguments[2]); 5246 }, 5247 5248 getBySolutionId: function (solutionId, callback) { 5249 var jData = {}; 5250 jData.solutionId = solutionId; 5251 5252 Utilities.postJSONAsynch(config.webService.wsPhoto + 'GetBySolutionId', jData, callback, arguments[2]); 5253 }, 5254 5255 getByTeamId: function (teamId, callback) { 5256 var jData = {}; 5257 jData.teamId = teamId; 5258 5259 Utilities.postJSONAsynch(config.webService.wsPhoto + 'GetByTeamId', jData, callback, arguments[2]); 5260 }, 5261 5262 getByPlayerId: function (playerId, callback) { 5263 var jData = {}; 5264 jData.playerId = playerId; 5265 5266 Utilities.postJSONAsynch(config.webService.wsPhoto + 'GetByPlayerId', jData, callback, arguments[2]); 5267 }, 5268 5269 getByStaffId: function (staffId, callback) { 5270 var jData = {}; 5271 jData.staffId = staffId; 5272 5273 Utilities.postJSONAsynch(config.webService.wsPhoto + 'GetByStaffId', jData, callback, arguments[2]); 5274 }, 5275 5276 getByMatchId: function (matchId, callback) { 5277 var jData = {};
5278 jData.matchId = matchId; 5279 5280 Utilities.postJSONAsynch(config.webService.wsPhoto + 'GetByMatchId', jData, callback, arguments[2]); 5281 }, 5282 5283 createBySolutionId: function (solutionId, title, description, url, visibilityId, callback) { 5284 var jData = {}; 5285 jData.solutionId = solutionId; 5286 jData.title = title; 5287 jData.description = description; 5288 jData.url = url; 5289 jData.visibilityId = visibilityId; 5290 5291 Utilities.postJSONAsynch(config.webService.wsPhoto + 'CreateBySolutionId', jData, callback, arguments[6]); 5292 }, 5293 5294 createByTeamId: function (teamId, title, description, url, visibilityId, callback) { 5295 var jData = {}; 5296 jData.teamId = teamId; 5297 jData.title = title; 5298 jData.description = description; 5299 jData.url = url; 5300 jData.visibilityId = visibilityId; 5301 5302 Utilities.postJSONAsynch(config.webService.wsPhoto + 'CreateByTeamId', jData, callback, arguments[6]); 5303 }, 5304 5305 createByPlayerId: function (playerId, title, description, url, visibilityId, callback) { 5306 var jData = {}; 5307 jData.playerId = playerId; 5308 jData.title = title; 5309 jData.description = description; 5310 jData.url = url; 5311 jData.visibilityId = visibilityId; 5312 5313 Utilities.postJSONAsynch(config.webService.wsPhoto + 'CreateByPlayerId', jData, callback, arguments[6]); 5314 }, 5315 5316 createByStaffId: function (staffId, title, description, url, visibilityId, callback) { 5317 var jData = {}; 5318 jData.staffId = staffId; 5319 jData.title = title; 5320 jData.description = description; 5321 jData.url = url; 5322 jData.visibilityId = visibilityId; 5323 5324 Utilities.postJSONAsynch(config.webService.wsPhoto + 'CreateByStaffId', jData, callback, arguments[6]); 5325 }, 5326 5327 createByMatchId: function (matchId, title, description, url, visibilityId, callback) { 5328 var jData = {}; 5329 jData.matchId = matchId; 5330 jData.title = title; 5331 jData.description = description; 5332 jData.url = url; 5333 jData.visibilityId = visibilityId; 5334 5335 Utilities.postJSONAsynch(config.webService.wsPhoto + 'CreateByMatchId', jData, callback, arguments[6]); 5336 }, 5337 5338 update: function (photoId, title, description, url, visibilityId, callback) { 5339 var jData = {}; 5340 jData.photoId = photoId; 5341 jData.title = title; 5342 jData.description = description; 5343 jData.url = url; 5344 jData.visibilityId = visibilityId; 5345 5346 Utilities.postJSONAsynch(config.webService.wsPhoto + 'Update', jData, callback, arguments[6]); 5347 }, 5348 5349 delete: function (photoId, callback) { 5350 var jData = {}; 5351 jData.photoId = photoId; 5352 5353 Utilities.postJSONAsynch(config.webService.wsPhoto + 'Delete', jData, callback, arguments[2]); 5354 } 5355 }, 5356 5357 album: { 5358 get: function (albumId, callback) { 5359 var jData = {}; 5360 jData.albumId = albumId; 5361 5362 Utilities.postJSONAsynch(config.webService.wsAlbum + 'Get', jData, callback, arguments[2]); 5363 }, 5364 5365 getBySolutionId: function (solutionId, callback) { 5366 var jData = {}; 5367 jData.solutionId = solutionId; 5368 5369 Utilities.postJSONAsynch(config.webService.wsAlbum + 'GetBySolutionId', jData, callback, arguments[2]); 5370 }, 5371 5372 getByTeamId: function (teamId, callback) { 5373 var jData = {}; 5374 jData.teamId = teamId; 5375 5376 Utilities.postJSONAsynch(config.webService.wsAlbum + 'GetByTeamId', jData, callback, arguments[2]); 5377 }, 5378 5379 getByPlayerId: function (playerId, callback) { 5380 var jData = {}; 5381 jData.playerId = playerId; 5382 5383 Utilities.postJSONAsynch(config.webService.wsAlbum + 'GetByPlayerId', jData, callback, arguments[2]); 5384 }, 5385 5386 getByStaffId: function (staffId, callback) { 5387 var jData = {}; 5388 jData.staffId = staffId;
5389 5390 Utilities.postJSONAsynch(config.webService.wsAlbum + 'GetByStaffId', jData, callback, arguments[2]); 5391 }, 5392 5393 getByMatchId: function (matchId, callback) { 5394 var jData = {}; 5395 jData.matchId = matchId; 5396 5397 Utilities.postJSONAsynch(config.webService.wsAlbum + 'GetByMatchId', jData, callback, arguments[2]); 5398 }, 5399 5400 createBySolutionId: function (solutionId, title, description, photos, visibilityId, callback) { 5401 var jData = {}; 5402 jData.solutionId = solutionId; 5403 jData.title = title; 5404 jData.description = description; 5405 jData.photos = photos; 5406 jData.visibilityId = visibilityId; 5407 5408 Utilities.postJSONAsynch(config.webService.wsAlbum + 'CreateBySolutionId', jData, callback, arguments[6]); 5409 }, 5410 5411 createByTeamId: function (teamId, title, description, photos, visibilityId, callback) { 5412 var jData = {}; 5413 jData.teamId = teamId; 5414 jData.title = title; 5415 jData.description = description; 5416 jData.photos = photos; 5417 jData.visibilityId = visibilityId; 5418 5419 Utilities.postJSONAsynch(config.webService.wsAlbum + 'CreateByTeamId', jData, callback, arguments[6]); 5420 }, 5421 5422 createByPlayerId: function (playerId, title, description, photos, visibilityId, callback) { 5423 var jData = {}; 5424 jData.playerId = playerId; 5425 jData.title = title; 5426 jData.description = description; 5427 jData.photos = photos; 5428 jData.visibilityId = visibilityId; 5429 5430 Utilities.postJSONAsynch(config.webService.wsAlbum + 'CreateByPlayerId', jData, callback, arguments[6]); 5431 }, 5432 5433 createByStaffId: function (staffId, title, description, photos, visibilityId, callback) { 5434 var jData = {}; 5435 jData.staffId = staffId; 5436 jData.title = title; 5437 jData.description = description; 5438 jData.photos = photos; 5439 jData.visibilityId = visibilityId; 5440 5441 Utilities.postJSONAsynch(config.webService.wsAlbum + 'CreateByStaffId', jData, callback, arguments[6]); 5442 }, 5443 5444 createByMatchId: function (matchId, title, description, photos, visibilityId, callback) { 5445 var jData = {}; 5446 jData.matchId = matchId; 5447 jData.title = title; 5448 jData.description = description; 5449 jData.photos = photos; 5450 jData.visibilityId = visibilityId; 5451 5452 Utilities.postJSONAsynch(config.webService.wsAlbum + 'CreateByMatchId', jData, callback, arguments[6]); 5453 }, 5454 5455 update: function (albumId, title, description, photos, visibilityId, callback) { 5456 var jData = {}; 5457 jData.albumId = albumId; 5458 jData.title = title; 5459 jData.description = description; 5460 jData.photos = photos; 5461 jData.visibilityId = visibilityId; 5462 5463 Utilities.postJSONAsynch(config.webService.wsAlbum + 'Update', jData, callback, arguments[6]); 5464 }, 5465 5466 delete: function (albumId, callback) { 5467 var jData = {}; 5468 jData.albumId = albumId; 5469 5470 Utilities.postJSONAsynch(config.webService.wsAlbum + 'Delete', jData, callback, arguments[2]); 5471 } 5472 } 5473}; 5474 5475/************************************************/ 5476/****************** Calendar ********************/ 5477/************************************************/ 5478var calendar = { 5479 getByAccount: function (accountId, callback) { 5480 var jData = {}; 5481 jData.accountId = accountId; 5482 5483 Utilities.postJSONAsynch(config.webService.wsCalendar + 'GetByAccount', jData, callback); 5484 }, 5485 5486 getByLeague: function (leagueId, callback) { 5487 var jData = {}; 5488 jData.leagueId = leagueId; 5489 5490 Utilities.postJSONAsynch(config.webService.wsCalendar + 'GetByLeague', jData, callback); 5491 }, 5492 5493 getBySeason: function (seasonId) { 5494 var jData = {}; 5495 jData.seasonId = seasonId; 5496 5497 return Utilities.postJSON(config.webService.wsMatch + 'GetBySeason', jData); 5498 }, 5499 5500 updateMatchDate: function (matchId, startDate, endDate) { 5501 var jData = {};
5502 jData.matchId = matchId; 5503 jData.startDate = startDate; 5504 jData.endDate = endDate; 5505 5506 // Service non approprié car on utilise plus FullCalendat 5507 return 1; 5508 //return Utilities.postJSON(config.webService.wsMatch + 'UpdateMatchDate', jData); 5509 }, 5510 5511 sync: function (solutionId, teamId, format) { 5512 var queryKeyValue = { solutionId: solutionId || null, teamId: teamId || null, tz: moment.tz.guess() }; 5513 var url = String.format('webcal://' + location.hostname + (location.port ? ':' + location.port : '') + '/handlers/Calendar.ashx{0}', Utilities.buildQueryString(queryKeyValue)); 5514 5515 if (format == 'google_calendar') { 5516 url = 'https://calendar.google.com/calendar/render?cid=' + encodeURIComponent(url); 5517 } 5518 5519 window.open(url); 5520 } 5521}; 5522 5523/************************************************/ 5524/******************** Bottin ********************/ 5525/************************************************/ 5526var bottin = { 5527 gets: function (callback) { 5528 var jData = {}; 5529 5530 Utilities.postJSONAsynch(config.webService.wsSearch + 'GetsBottin', jData, callback); 5531 }, 5532 5533 search: function (searchTerm, callback) { 5534 var jData = {}; 5535 jData.searchTerm = searchTerm; 5536 5537 Utilities.postJSONAsynch(config.webService.wsSearch + 'SearchBottin', jData, callback); 5538 }, 5539 5540 searchTest: function (searchTerm, sourceArray) { 5541 var jData = {}; 5542 jData.searchTerm = searchTerm; 5543 5544 return sourceArray(Utilities.postJSON(config.webService.wsSearch + 'SearchBottin', jData)); 5545 }, 5546 5547 getByCountry: function (countryId, callback) { 5548 var jData = {}; 5549 jData.countryId = countryId; 5550 5551 Utilities.postJSONAsynch(config.webService.wsSearch + 'GetBottinByCountry', jData, callback); 5552 }, 5553 5554 getByState: function (stateId, callback) { 5555 var jData = {}; 5556 jData.stateId = stateId; 5557 5558 Utilities.postJSONAsynch(config.webService.wsSearch + 'GetBottinByState', jData, callback); 5559 }, 5560 5561 getByType: function (typeId, callback) { 5562 var jData = {}; 5563 jData.typeId = typeId; 5564 5565 Utilities.postJSONAsynch(config.webService.wsSearch + 'GetBottinByType', jData, callback); 5566 }, 5567 5568 getStateByCountry: function (countryId, callback) { 5569 var jData = {}; 5570 jData.countryId = countryId; 5571 5572 Utilities.postJSONAsynch(config.webService.wsSearch + 'GetStateByCountry', jData, callback); 5573 } 5574}; 5575 5576// *** Public Website *** 5577var publicWebsite = { 5578 formatNewsUrl: function () { 5579 return String.format('pub/{0}/{1}/{2}', leagueId, Utilities.textToUrl(leagueName), language.global.publicWebSite.urls.news); 5580 }, 5581 5582 formatNewsByIdUrl: function (leagueId, leagueName, newsId, newsTitle) { 5583 return String.format('pub/{0}/{1}/{2}/{3}-{4}', leagueId, Utilities.textToUrl(leagueName), language.global.publicWebSite.urls.news, Utilities.textToUrl(newsTitle), newsId); 5584 } 5585}; 5586 5587/************************************************/ 5588/****************** Solution ********************/ 5589/************************************************/ 5590var solution = (function () { 5591 var sportPromises = {}; 5592 return { 5593 getById: function (solutionId, callback) { 5594 var jData = {}; 5595 jData.solutionId = solutionId; 5596 5597 Utilities.postJSONAsynch(config.webService.wsSolution + 'Get', jData, callback, arguments[2]); 5598 }, 5599 5600 getByIdWithDeferred: function (solutionId, refreshSolution) { 5601 var jData = {}; 5602 jData.solutionId = solutionId; 5603 5604 if (viewstate.get('solutionAdmin-' + solutionId) == undefined || refreshSolution) { 5605 return $.when(data.post(config.webService.wsSolution + 'Get', jData)).then(function (a) { 5606 viewstate.save('solutionAdmin-' + solutionId, a, { expires: 180000 }); 5607 return a; 5608 }); 5609 } 5610 else { 5611 var solution = viewstate.get('solutionAdmin-' + solutionId); 5612 return solution; 5613 } 5614 }, 5615 5616 getFeature: function (solutionId, name) { 5617 var jData = {}; 5618 var solution = null; 5619 jData.solutionId = solutionId; 5620 5621 if (viewstate.get('solutionAdmin-' + solutionId) == undefined) { 5622 solution = $.when(data.post(config.webService.wsSolution + 'Get', jData)).then(function (a) { 5623 viewstate.save('solutionAdmin-' + solutionId, a, { expires: 180000 }); 5624 return a; 5625 }); 5626 } 5627 else { 5628 var solution = viewstate.get('solutionAdmin-' + solutionId); 5629 solution = solution; 5630 } 5631 5632 return $.when(solution).then(function (solution) { 5633 return _.find(solution.features, { Name: name }); 5634 }); 5635 }, 5636 5637 getSport: function (solutionId) { 5638 if (viewstate.get('solutionAdmin-' + solutionId) == undefined) { 5639 var jData = {}; 5640 jData.solutionId = solutionId; 5641 var solution = Utilities.postJSON(config.webService.wsSolution + 'Get', jData); 5642 viewstate.save('solutionAdmin-' + solutionId, solution, { expires: 180000 }); 5643 return solution.SportId; 5644 } 5645 else { 5646 var solution = viewstate.get('solutionAdmin-' + solutionId); 5647 return solution.SportId; 5648 } 5649 }, 5650 5651 getSolutionMenuById: function (solutionId) { 5652 var jData = {}; 5653 jData.solutionId = solutionId; 5654 5655 return data.post(config.webService.wsSolution + 'GetSolutionMenuById', jData); 5656 }, 5657 5658 getListBySolutionId: function (solutionId) { 5659 var jData = {}; 5660 jData.solutionId = solutionId; 5661 5662 return data.post(config.webService.wsSolution + 'GetListBySolutionId', jData); 5663 }, 5664 5665 getLeagueBySolutionId: function (solutionId) { 5666 var jData = {}; 5667 jData.solutionId = solutionId; 5668 5669 return data.post(config.webService.wsSolution + 'GetLeagueBySolutionId', jData); 5670 }, 5671 5672 getListById: function (solutionId) { 5673 var jData = {}; 5674 5675 jData.solutionId = solutionId; 5676 5677 return data.post(config.webService.wsSolution + 'Get', jData); 5678 }, 5679 5680 getByAccount: function (callback) { 5681 var jData = {}; 5682 jData.solutionTypeId = null; 5683 5684 Utilities.postJSONAsynch(config.webService.wsSolution + 'Gets', jData, callback, arguments[1]); 5685 }, 5686 5687 getByAccountWithDeferred: function () { 5688 var jData = {}; 5689 5690 return data.post(config.webService.wsSolution + 'Gets', jData); 5691 }, 5692 5693 gets: function () { 5694 var jData = {}; 5695 5696 return data.post(config.webService.wsSolution + 'GetSolutions', jData); 5697 }, 5698 5699 getDashboard: function (solutionId) { 5700 var jData = {}; 5701 jData.solutionId = solutionId; 5702 5703 return data.post(config.webService.wsSolution + 'GetDashboard', jData); 5704 }, 5705 5706 getFormTemplate: function (templateId) { 5707 var jData = {}; 5708 jData.templateId = templateId; 5709 5710 return data.post(config.webService.wsSolution + 'GetFormTemplate', jData); 5711 }, 5712 5713 getSolutionPlan: function (solutionId) { 5714 var jData = {}; 5715 jData.solutionId = solutionId; 5716 5717 return data.post(config.webService.wsSolution + 'GetSolutionPlan', jData); 5718 }, 5719 5720 create: function (typeId, name, description, abreviation, webSite, logo, callback) { 5721 var jData = {}; 5722 jData.typeId = typeId;
5723 jData.name = name; 5724 jData.description = description; 5725 jData.abreviation = abreviation; 5726 jData.webSite = webSite; 5727 jData.logo = logo; 5728 5729 Utilities.postJSONAsynch(config.webService.wsSolution + 'Create', jData, callback, arguments[8]); 5730 }, 5731 5732 createTeam: function (name, description, abreviation, webSite, logo, sportId) { 5733 var jData = {}; 5734 jData.name = name; 5735 jData.description = description; 5736 jData.abreviation = abreviation; 5737 jData.webSite = webSite; 5738 jData.logo = logo; 5739 jData.sportId = sportId; 5740 5741 return data.post(config.webService.wsSolution + 'CreateTeamSolution', jData); 5742 }, 5743 5744 createWithDeferred: function (typeId, name, description, abreviation, webSite, logo, sportId) { 5745 var jData = {}; 5746 jData.typeId = typeId; 5747 jData.name = name; 5748 jData.description = description; 5749 jData.abreviation = abreviation; 5750 jData.webSite = webSite; 5751 jData.logo = logo; 5752 jData.sportId = sportId; 5753 5754 return data.post(config.webService.wsSolution + 'Create', jData); 5755 }, 5756 5757 addSolutions: function (portalId, solutionList) { 5758 var jData = {}; 5759 jData.portalId = portalId; 5760 jData.solutionList = solutionList; 5761 5762 return data.post(config.webService.wsSolution + 'AddSolutions', jData); 5763 }, 5764 5765 validate: function (solution) { 5766 var jData = {}; 5767 jData.solution = solution; 5768 5769 return data.post(config.webService.wsSolution + 'ValidateSolution', jData); 5770 }, 5771 5772 update: function (solution, callback) { 5773 // remove features from solution (problem with feature dates) 5774 if (solution.features) { 5775 solution.features = null; 5776 } 5777 5778 var jData = {}; 5779 jData.solution = solution; 5780 5781 Utilities.postJSONAsynch(config.webService.wsSolution + 'Update', jData, callback, arguments[2]); 5782 }, 5783
5784 updateBackground: function (solutionId, backgroundId) { 5785 var jData = {}; 5786 jData.solutionId = solutionId; 5787 jData.backgroundId = backgroundId; 5788 5789 data.post(config.webService.wsSolution + 'UpdateBackground', jData); 5790 }, 5791 5792 updateConfig: function (solutionId, configList) { 5793 var jData = {}; 5794 jData.solutionId = solutionId; 5795 jData.configList = configList; 5796 5797 return data.post(config.webService.wsSolution + 'UpdateSolutionConfig', jData); 5798 }, 5799 5800 updateMenu: function (solution, menuList) { 5801 var jData = {}; 5802 jData.solutionId = solutionId; 5803 jData.menuList = menuList; 5804 5805 return data.post(config.webService.wsSolution + 'UpdateMenu', jData); 5806 }, 5807 5808 updateSolutionPlan: function (planId, solutionId) { 5809 var jData = {}; 5810 jData.solutionId = solutionId; 5811 jData.planId = planId; 5812 5813 return data.post(config.webService.wsSolution + 'UpdateSolutionPlan', jData); 5814 }, 5815 5816 getCustomPagesBySolutionId: function (solutionId) { 5817 var jData = {}; 5818 jData.solutionId = solutionId; 5819 5820 return data.post(config.webService.wsSolution + 'GetCustomPagesBySolutionId', jData); 5821 }, 5822 5823 getCustomPagesDetailBySolutionId: function (solutionId) { 5824 var jData = {}; 5825 jData.solutionId = solutionId; 5826 5827 return data.post(config.webService.wsSolution + 'GetCustomPagesDetailBySolutionId', jData); 5828 }, 5829 5830 getCustomPageById: function (id) { 5831 var jData = {}; 5832 jData.id = id; 5833 5834 return data.post(config.webService.wsSolution + 'GetCustomPageById', jData); 5835 }, 5836 5837 getFormBySolutionId: function (solutionId, active) { 5838 var jData = {}; 5839 jData.solutionId = solutionId; 5840 jData.active = active; 5841 5842 return data.post(config.webService.wsSolution + 'GetFormBySolution', jData); 5843 }, 5844 5845 getFormById: function (formId) { 5846 var jData = {}; 5847 jData.formId = formId; 5848 5849 return data.post(config.webService.wsSolution + 'GetFormById', jData); 5850 }, 5851 5852 createForm: function (form) { 5853 var jData = {}; 5854 jData.form = form; 5855 5856 return data.post(config.webService.wsSolution + 'CreateForm', jData); 5857 }, 5858 5859 updateForm: function (form) { 5860 var jData = {}; 5861 jData.form = form; 5862 5863 return data.post(config.webService.wsSolution + 'UpdateForm', jData); 5864 }, 5865 5866 cloneForm: function (solutionId, formId, name) { 5867 var jData = {}; 5868 jData.solutionId = solutionId; 5869 jData.formId = formId; 5870 jData.name = name; 5871 5872 return data.post(config.webService.wsSolution + 'CloneForm', jData); 5873 }, 5874 5875 deleteForm: function (formId) { 5876 var jData = {}; 5877 jData.formId = formId; 5878 5879 return data.post(config.webService.wsSolution + 'DeleteForm', jData); 5880 }, 5881 5882 createCustomPage: function (page) { 5883 var url = '/api/custompage/{0}'; 5884 return data.post(config.setting.urlRestApi + String.format(url, page.SolutionId), page); 5885 }, 5886 5887 updateCustomPage: function (page) { 5888 var url = '/api/custompage/{0}'; 5889 return data.put(config.setting.urlRestApi + String.format(url, page.SolutionId), page); 5890 }, 5891 5892 deleteCustomPage: function (pageId, solutionId) { 5893 var url = '/api/custompage/{0}/page/{1}'; 5894 return data.delete(config.setting.urlRestApi + String.format(url, solutionId, pageId), {}); 5895 }, 5896 5897 isAdministrator: function (accountId, solutionId) { 5898 var jData = {}; 5899 jData.accountId = accountId; 5900 jData.solutionId = solutionId; 5901 5902 //return Utilities.postJSON(config.webService.wsSolution + 'GetSolution', jData); 5903 return true; 5904 }, 5905 5906 deleteSolution: function (solutionId, callback) { 5907 callback; 5908 }, 5909 5910 isSuperAdmin: function (solutionId) { 5911 var url = '/api/solution/{0}/superadmin'; 5912 return data.get(config.setting.urlRestApi + String.format(url, solutionId), {}); 5913 }, 5914 5915 setSuperAdmin: function (solutionId) { 5916 var url = '/api/solution/{0}/superadmin'; 5917 return data.post(config.setting.urlRestApi + String.format(url, solutionId), {}); 5918 } 5919 }; 5920})(); 5921 5922var stripe = { 5923 connect: { 5924 getBySolutionId: function (solutionId, callback) { 5925 var jData = {}; 5926 jData.solutionId = solutionId; 5927 5928 Utilities.postJSONAsynch(config.webService.wsStripeConnect + 'GetBySolutionId', jData, callback, arguments[2]); 5929 }, 5930 5931 disconnect: function (solutionId) { 5932 var jData = {}; 5933 jData.solutionId = solutionId; 5934 5935 return data.post(config.webService.wsStripeConnect + 'Disconnect', jData); 5936 } 5937 } 5938} 5939 5940var queue = { 5941 userSession: { 5942 add: function (type, url) { 5943 var queryKeyValue = { type: type, url: url }; 5944 5945 data.put(String.format('/api/queue/usersession/data{0}', Utilities.buildQueryString(queryKeyValue))); 5946 } 5947 } 5948} 5949 5950/************************************************/ 5951/****************** Favorite ********************/ 5952/************************************************/ 5953function getFavoriteByAccount(accountId) { 5954 var jData = {}; 5955 jData.accountId = accountId; 5956 5957 return [ 5958 { id: '1', name: 'Favorite 1', abbreviation: 'S1', url: 'favorite1.aspx', description: 'Mon Favoris 1' }, 5959 { id: '2', name: 'Favorite 2', abbreviation: 'S2', url: 'favorite2.aspx', description: 'Mon Favoris 2' }, 5960 { id: '3', name: 'Favorite 3', abbreviation: 'S3', url: 'favorite3.aspx', description: 'Mon Favoris 3' }]; 5961} 5962 5963function getSeasonType(sportId) { 5964 var jData = {}; 5965 jData.accountId = sportId; 5966 5967 return [ 5968 { id: '1', name: 'Saison régulière' }, 5969 { id: '2', name: 'Série éliminatoire' }, 5970 { id: '3', name: 'Hors Concours' }]; 5971} 5972; 5973/// <reference path="kreezee.utilities.js" /> 5974var session = null; 5975var queryStrings = {}; 5976(function () { 5977 var e, 5978 a = /\+/g, // Regex for replacing addition symbol with a space 5979 r = /([^&=]+)=?([^&]*)/g, 5980 d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, 5981 q = window.location.search.substring(1); 5982 5983 while (e = r.exec(q)) 5984 queryStrings[d(e[1])] = d(e[2]); 5985})(); 5986 5987String.format = function () { 5988 var s = arguments[0]; 5989 for (var i = 0; i < arguments.length - 1; i++) { 5990 var reg = new RegExp("\\{" + i + "\\}", "gm"); 5991 s = s.replace(reg, arguments[i + 1]); 5992 } 5993 return s; 5994}; 5995 5996function getQueryStringData(name) { 5997 var result = null; 5998 var regexS = "[\\?&#]" + name + "=([^&#]*)"; 5999 var regex = new RegExp(regexS); 6000 var results = regex.exec('?' + window.location.href.split('?')[1]); 6001 var test = document.location.search; 6002 if (results != null) { 6003 result = decodeURIComponent(results[1].replace(/\+/g, " "));
6004 } 6005 return result; 6006}; 6007 6008function isValidEmailAddress(email) { 6009 var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i); 6010 return pattern.test(email); 6011}; 6012 6013function toLowerCase(input) { 6014 input.value = input.value.toLowerCase(); 6015} 6016 6017function toggleSectionMenu(objId) { 6018 $(objId).slideToggle('fast'); 6019} 6020 6021function showSection(objId) { 6022 $(objId).css('display', 'block'); 6023} 6024 6025function getFileExtention(filename) { 6026 return filename.split('.').pop(); 6027} 6028 6029function getTicks() { 6030 var now = new Date(); 6031 return now.getTime(); 6032} 6033 6034function convertIsoToUtc(dateIso) { 6035 var dt = new Date(dateIso.match(/\d+/) * 1); 6036 return dt.getFullYear() + '-' + ("0" + (dt.getMonth() + 1)).slice(-2) + '-' + ("0" + dt.getDate()).slice(-2); 6037} 6038 6039var Utilities = { 6040 isShowControlPage: function (config, section, control) { 6041 var returnValue = true; 6042 if (config && config.sections !== undefined) 6043 config.sections.forEach(function (s) { 6044 if (s.name === section) { 6045 if (s.filters !== null) { 6046 s.filters.forEach(function (f) { 6047 if (f.name === control) { 6048 returnValue = f.visible; 6049 return; 6050 } 6051 }); 6052 } else { 6053 return; 6054 } 6055 } 6056 }); 6057 6058 return returnValue; 6059 }, 6060 6061 isFollowTeamActivate: function (config) { 6062 if (config.team && config.team === true) { 6063 if (config.mobileonly && config.mobileonly === true) { 6064 if (Utilities.mobileCheck()) { 6065 return true; 6066 } 6067 } 6068 else { 6069 return true; 6070 } 6071 } 6072 6073 return false; 6074 }, 6075 6076 isFollowSolutionActivate: function (config) { 6077 if (config.solution && config.solution === true) { 6078 if (config.mobileonly && config.mobileonly === true) { 6079 if (Utilities.mobileCheck()) { 6080 return true; 6081 } 6082 } 6083 else { 6084 return true; 6085 } 6086 } 6087 6088 return false; 6089 }, 6090 6091 isFollowTeamScheduleActivate: function (config) { 6092 if (config.teamschedule && config.teamschedule === true) { 6093 if (config.mobileonly && config.mobileonly === true) { 6094 if (Utilities.mobileCheck()) { 6095 return true; 6096 } 6097 } 6098 else { 6099 return true; 6100 } 6101 } 6102 6103 return false; 6104 }, 6105 6106 isSynchScheduleActivate: function (config) { 6107 if (config.synchschedule && config.synchschedule === true) { 6108 if (config.mobileonly && config.mobileonly === true) { 6109 if (Utilities.mobileCheck()) { 6110 return true; 6111 } 6112 } 6113 else { 6114 return true; 6115 } 6116 } 6117 6118 return false; 6119 }, 6120 6121 mobileCheck: function () { 6122 var check = false; 6123 (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
6123sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true })(navigator.userAgent || navigator.vendor || window.opera); 6124 return check; 6125 }, 6126 6127 mobileAndTabletcheck: function () { 6128 var check = false; 6129 (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true })(navigator.userAgent || navigator.vendor || window.opera); 6130 return check; 6131 }, 6132 6133 deleteTemporaryFile: function (filetype, filename) { 6134 $.get(String.format('/handlers/DeleteTempFile.ashx?filetype={0}&filename={1}', filetype, encodeURI(filename)), function (data) { 6135 console.log(data); 6136 }); 6137 }, 6138 6139 deleteBlobFile: function (filename) { 6140 $.get(String.format('/handlers/DeleteTemporayBlobFile.ashx?filename={0}', encodeURI(filename)), function (data) { 6141 console.log(data); 6142 }); 6143 }, 6144 6145 splitLines: function (textToSplit) { 6146 // To support all OS (MAC) 6147 var linesFiles = textToSplit.replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '\r\n'); 6148 6149 return linesFiles.split('\r\n'); 6150 }, 6151 6152 displayPenaltyMinute: function (value) { 6153 var calculateValue = value / 10; 6154 var penaltyMinute = calculateValue.toFixed(1); 6155 6156 if (penaltyMinute.length > 2) { 6157 if (penaltyMinute.slice(-2) == ".0") { 6158 penaltyMinute = penaltyMinute.substr(0, penaltyMinute.length - 2); 6159 } 6160 } 6161 6162 return penaltyMinute; 6163 }, 6164 6165 displayDifferential: function (value, precision) { 6166 var calculateValue = value / 100; 6167 precision = precision || 2; 6168 if (calculateValue >= 1) { 6169 return calculateValue.toFixed(precision); 6170 } 6171 else { 6172 return (calculateValue.toFixed(precision)).slice(1); 6173 } 6174 }, 6175 6176 displaySportPercentage: function (value, precision) { 6177 var calculateValue = value / 1000; 6178 precision = precision || 3; 6179 if (calculateValue >= 1) { 6180 return calculateValue.toFixed(precision); 6181 } 6182 else { 6183 return (calculateValue.toFixed(precision)).slice(1); 6184 } 6185 }, 6186 6187 displayInningPitched: function (value) { 6188 var newValue = value.toString(); 6189 var inningPitched = newValue.slice(0, -1) == '' ? 0 : newValue.slice(0, -1); 6190 switch (newValue.slice(-1)) { 6191 case '3': 6192 inningPitched = inningPitched + ' â ' 6193 break; 6194 case '6': 6195 inningPitched = inningPitched + ' â ' 6196 break; 6197 } 6198 return inningPitched; 6199 }, 6200 6201 saveFile: function (file, fileType, section, solutionId, ratio, maxWidth) { 6202 //saveImage: function (image, section) { 6203 $.ajax({
6204 type: 'POST', 6205 url: '/handlers/AmazonS3.ashx?filetype=' + fileType + '&filename=' + escape(file) + '§ion=' + escape(section) + '&solutionId=' + solutionId + '&ratio=' + ratio + '&maxWidth=' + maxWidth, 6206 //url: 'handlers/AzureStorageService.ashx?filename=' + escape(image) + '§ion=' + escape(section), 6207 data: {}, 6208 contentType: 'application/json; charset=utf-8', 6209 dataType: 'json', 6210 cache: false, 6211 async: false 6212 }) 6213 .done(function (data) { 6214 //debugger; 6215 //leagueAccountViewState.league.Logo = 'images/leagues/' + self.filename(); 6216 //callback(data.d); 6217 }) 6218 .fail(function (jqxhr, textStatus, error) { 6219 //debugger; 6220 if (error.length > 0) 6221 alert(error); 6222 // var err = eval("(" + jqxhr.responseText + ")"); 6223 // Utilities.displayMessage('error', language.errorMessage.title, language.errorMessage.message + err.Message); 6224 }) 6225 .always(function () { 6226 //if (idObject != undefined) { 6227 //$(idObject).unblock({ fadeOut: 0 }); 6228 //} 6229 }); 6230 }, 6231 6232 documentTitle: function (title) { 6233 document.title = title + ' | Kreezee.com'; 6234 }, 6235 6236 getDateTimeNow: function(){ 6237 var dat = new Date(); 6238 return dat.toUTCString(); 6239 }, 6240 6241 extractCookie: function (cookies, name) { 6242 for (i = 0; i < cookies.length; i++) { 6243 x = cookies[i].substr(0, cookies[i].indexOf('=')); 6244 y = cookies[i].substr(cookies[i].indexOf('=') + 1); 6245 x = x.replace(/^\s+|\s+$/g, ''); 6246 if (x == name) { 6247 6248 if (name === '__DataCacheUser__') { 6249 return unescape(y); 6250 } 6251 return unescape(decodeURI(y)); 6252 } 6253 } 6254 return ''; 6255 }, 6256 6257 getCookie: function (name) { 6258 var i, x, y, cookies = document.cookie.split(';'); 6259 return Utilities.extractCookie(cookies, name); 6260 }, 6261
6262 setCookie: function (name, value, expireDays) { 6263 var expiresDate = new Date(); 6264 expiresDate.setDate(expiresDate.getDate() + expireDays); 6265 var cookieValue = escape(value) + ((expireDays == null) ? "" : "; expires=" + expiresDate.toUTCString()); 6266 document.cookie = name + "=" + cookieValue; 6267 }, 6268 6269 getSession: function (name) { 6270 if (!session) { 6271 var jData = { }; 6272 var isAuthenticated = Utilities.postJSON(config.webService.wsAuthentication + "AccountAuthenticated", jData); 6273 if (isAuthenticated) { 6274 session = JSON.parse(Utilities.getCookie('__KreezeeSessionCookieV2__')); 6275 } else { 6276 Utilities.setCookie('__KreezeeSessionCookieV2__', '', -1) 6277 return null; 6278 } 6279 } 6280 return session.Session[name]; 6281 }, 6282 6283 setSession: function (name, value) { 6284 var cookie = document.cookie; 6285 var regex = new RegExp('"' + name + '":"[a-zA-Z\-]+"', 'ig'); 6286 var regex2 = new RegExp('"' + name+'UI' + '":"[a-zA-Z\-]+"', 'ig'); 6287 cookie = cookie.replace(regex, '"' + name + '":"' + value + '"'); 6288 cookie = cookie.replace(regex2, '"' + name + 'UI' + '":"' + value + '"'); 6289 document.cookie = ''; 6290 document.cookie = cookie; 6291 return true; 6292 }, 6293 6294 postJSONAsynch: function (webService, jsondata, callback) { 6295 var idObject = arguments[3]; 6296 return $.ajax({ 6297 type: 'POST', 6298 url: webService, 6299 data: JSON.stringify(jsondata), 6300 contentType: 'application/json; charset=utf-8', 6301 dataType: 'json', 6302 beforeSend: function () { 6303 Utilities.blockObject(idObject); 6304 } 6305 }) 6306 .done(function (data, status, xhr) { 6307 if (callback !== undefined) { 6308 callback(data.d, xhr); 6309 } 6310 }) 6311 .fail(function (jqxhr, textStatus, error) { 6312 var err = eval("(" + jqxhr.responseText + ")"); 6313 var message = language.errorMessage.message + '<a href="javascript:Utilities.reportError(' + err.Message + ');"><span style="color: white;">' + language.errorMessage.messageLink + '</span></a>' 6314 Utilities.displayMessage('error', language.errorMessage.title, message); 6315 }) 6316 .always(function () { 6317 Utilities.unblockObject(idObject); 6318 }); 6319 }, 6320 6321 reportError: function (noError){ 6322 var jData = {}; 6323 jData.noError = noError; 6324 6325 $.ajax({
6326 type: 'POST', 6327 url: config.webService.wsMail + 'SendErrorReport', 6328 data: JSON.stringify(jData), 6329 contentType: 'application/json; charset=utf-8', 6330 dataType: 'json' 6331 }); 6332 6333 $.pnotify_remove_all(); 6334 }, 6335 6336 postJSON: function (webService, jsondata) { 6337 var jsonResult = null; 6338 $.ajax({ 6339 type: 'POST', 6340 url: webService, 6341 data: JSON.stringify(jsondata), 6342 async: false, 6343 contentType: 'application/json; charset=utf-8', 6344 dataType: 'json' 6345 }) 6346 .done(function (data) { 6347 jsonResult = data.d; 6348 }) 6349 .fail(function (jqxhr, textStatus, error) { 6350 var err = eval("(" + jqxhr.responseText + ")"); 6351 var message = language.errorMessage.message + '<a href="javascript:Utilities.reportError(' + err.Message + ');"><span style="color: white;">' + language.errorMessage.messageLink + '</span></a>' 6352 Utilities.displayMessage('error', language.errorMessage.title, message); 6353 }) 6354 .always(function () { 6355 }); 6356 return jsonResult; 6357 }, 6358 6359 getJSON: function (url, callback) { 6360 var jqxhr = $.getJSON(url, function (data) { 6361 // debugger; 6362 callback(data); 6363 }) 6364 .done(function () { 6365 //console.log("second success"); 6366 }) 6367 .fail(function () { 6368 //console.log("error"); 6369 }) 6370 .always(function () { 6371 //console.log("complete"); 6372 }); 6373 6374 6375 jqxhr.complete(function () { 6376 //console.log("second complete"); 6377 }); 6378 6379 return jqxhr; 6380 }, 6381 6382 rewriteUrl: function (value, id) { 6383 return String.format('{0}-{1}', Utilities.textToUrl(value), id); 6384 }, 6385 6386 textToUrl: function (str) { 6387 var url = _.deburr(str.toLowerCase()); 6388 return _.kebabCase(url); 6389 }, 6390 6391 displayMessage: function (type, title, text) { 6392 //cache.kreezee.com/scripts/jquery.pnotify.1.2.0.min.js' 6393 var opts = { 6394 title: title, 6395 text: text, 6396 type: type, // error, info, success 6397 addclass: "stack-bar-top", 6398 cornerclass: "", 6399 opacity: .9, 6400 delay: type == 'success' ? 5000 : 15000, 6401 stack: false, 6402 sticker: false, 6403 width: "100%" 6404 }; 6405 6406 if ($.pnotify) 6407 { 6408 $.pnotify.defaults.history = false; 6409 $.pnotify.defaults.styling = "jqueryui"; 6410 $.pnotify(opts); 6411 } 6412 }, 6413 6414 //addMessage: function (type, title, text) { 6415 // var jData = {}; 6416 // jData.type = type; 6417 // jData.title = title; 6418 // jData.text = text; 6419 // Utilities.setSession('Messages', jData); 6420 //}, 6421 6422 //deleteMessages: function () { 6423 // Utilities.setSession('Messages', null); 6424 //}, 6425 6426 //getMessages: function () { 6427 // return Utilities.getSession('Messages'); 6428 //}, 6429 6430 findObjectById: function (array, id) { 6431 if (array !== undefined) { 6432 for (var i = 0, j = array.length; i < j; i++) { 6433 if (array[i].Id === id) { 6434 return array[i]; 6435 } 6436 } 6437 } 6438 6439 return null; 6440 }, 6441 //array: tableau dans lequel on cherche 6442 //value: Valeur recherché dans array #[0] 6443 //searchAttribute: attribut sur lequel faire la recherche 6444 //returnAttribute: optional attribut retourner, si null, l'objet est retourné 6445 findObjectByAttribute: function(array, value, searchAttribute, returnAttribute) 6446 { 6447 if (array !== undefined) 6448 { 6449 for (var i = 0, j = array.length; i < j; i++) { 6450 if (($.isFunction(searchAttribute) ? searchAttribute(array[i]) : ko.unwrap(array[i][searchAttribute])) === value) 6451 { 6452 if (returnAttribute) { 6453 if($.isFunction(returnAttribute)) { 6454 return returnAttribute(array[i]); 6455 } 6456 else { 6457 var value = ''; 6458 var object = array[i]; 6459 var path = returnAttribute.split('.'); 6460 6461 for (var j = 0; j < path.length; j++) { 6462 if (object[path[j]]) { 6463 object = object[path[j]]; 6464 } 6465 else { 6466 return ''; 6467 } 6468 } 6469 6470 return object; 6471 } 6472 6473 return $.isFunction(returnAttribute) ? returnAttribute(array[i]) : ko.unwrap(array[i][returnAttribute]); 6474 } 6475 else { 6476 return array[i]; 6477 } 6478 } 6479 } 6480 } 6481 6482 return returnAttribute ? '' : undefined; 6483 }, 6484 6485 tryParseInt: function(str, defaultValue) { 6486 if(typeof str == 'number') 6487 { 6488 return str; 6489 } 6490 6491 var retValue = defaultValue; 6492 if(str !== null && str !== undefined) { 6493 if(str.length > 0) { 6494 if (!isNaN(str)) { 6495 retValue = parseInt(str); 6496 } 6497 } 6498 } 6499 return retValue; 6500 }, 6501 6502 formatJSONDate: function (jsonDate) { 6503 if ((jsonDate != null) && (jsonDate.length > 0)) { 6504 var date = new Date(parseInt(jsonDate.substr(6))); 6505 return date.getFullYear() + '-' + ("0" + (date.getMonth() + 1)).slice(-2) + '-' + ("0" + date.getDate()).slice(-2); 6506 } 6507 6508 return ''; 6509 }, 6510 6511 formatJSONDateTime: function (jsonDate) { 6512 if ((jsonDate != null) && (jsonDate.length > 0)) { 6513 var date = new Date(parseInt(jsonDate.substr(6))); 6514 return date.getFullYear() + '-' + ("0" + (date.getMonth() + 1)).slice(-2) + '-' + ("0" + date.getDate()).slice(-2) + 'T' + ("0" + date.getHours()).slice(-2) + ':' + ("0" + date.getMinutes()).slice(-2) + ':00'; 6515 } 6516 6517 return ''; 6518 }, 6519 6520 formatJSONTime: function (jsonDate) { 6521 if ((jsonDate != null) && (jsonDate.length > 0)) { 6522 var date = new Date(parseInt(jsonDate.substr(6))); 6523 return ("0" + date.getHours()).slice(-2) + ':' + ("0" + date.getMinutes()).slice(-2); 6524 } 6525 6526 return ''; 6527 }, 6528 6529 formatJSONDateToTimeStamp: function (jsonDate) { 6530 if ((jsonDate != null) && (jsonDate.length > 0)) { 6531 var date = new Date(parseInt(jsonDate.substr(6))); 6532 return date.toString(); 6533 } 6534 return ''; 6535 }, 6536 6537 formatDate: function (date, format, timezoneOffset) { 6538 var offset = timezoneOffset ? new Date(date).getTimezoneOffset() : 0; 6539 6540 return moment.utc(date).zone(offset).format(format); 6541 }, 6542 6543 convertDateToJScriptDate: function(date){ 6544 return new Date(moment(date).utc().format('YYYY-MM-DDThh:mm:ss')); 6545 }, 6546 6547 getMomentDate: function (date, timezoneOffset) { 6548 var offset = timezoneOffset ? new Date(date).getTimezoneOffset() : 0; 6549 6550 return moment.utc(date).zone(offset); 6551 }, 6552 6553 getTimeZone: function () { 6554 return moment().tz().guess(); 6555 }, 6556 6557 formatTime: function(time, format) { 6558 if(!time) { 6559 return ''; 6560 } 6561 6562 if(typeof time === 'string') { 6563 var string = time; 6564 var splittedTime = string.split(':'); 6565 time = {}; 6566 6567 time.Hours = Utilities.tryParseInt(splittedTime[0], 0); 6568 time.Minutes = Utilities.tryParseInt(splittedTime[1], 0); 6569 } 6570 6571 var result = format; 6572 var fullHour = ("00" + time.Hours).slice(-2); 6573 var midHour = ("00" + (time.Hours >
6573 12 ? time.Hours - 12 : time.Hours)).slice(-2); 6574 var amPm = time.Hours >= 12 ? "PM" : "AM"; 6575 var minutes = ("00" + time.Minutes).slice(-2); 6576 6577 result = result.replace(/HH/g, fullHour); 6578 result = result.replace(/hh/g, midHour); 6579 result = result.replace(/A/g, amPm); 6580 result = result.replace(/mm/g, minutes); 6581 6582 return result; 6583 }, 6584 6585 addIconButton: function (obj, icon, label) { 6586 obj.button({ 6587 label: label, 6588 icons: { primary: icon }, 6589 text: true 6590 }); 6591 }, 6592 6593 removeIconButton: function (obj) { 6594 var label = obj.find('.ui-button-text'); 6595 obj 6596 .removeClass('ui-button-text-icon-primary') 6597 .addClass('ui-button-text-only') 6598 .html(label); 6599 }, 6600 6601 addIconTabs: function (obj, icon) { 6602 obj.html('<span class="ui-icon ' + icon + '"></span> ' + obj.html()); 6603 }, 6604 6605 removeIconTabs: function (obj) { 6606 obj.children().remove(); 6607 }, 6608 6609 formatTextToHtml: function (text) { 6610 var html = ''; 6611 6612 // Replace carriage return. 6613 html = text.replace(/(\r\n|\n|\r)/g, "<br />"); 6614 6615 // Replace url in text with html hyperlink. 6616 html = this.replaceUrlToHtml(html); 6617 6618 return html; 6619 }, 6620 6621 replaceUrlToHtml: function (text) { 6622 var urlRegex = /((?:https?:|www\.)[^\s]+)/g; 6623 return text.replace(urlRegex, function (url) { 6624 return '<a href="' + url + '" target="_blank">' + url + '</a>'; 6625 }); 6626 }, 6627 6628 extractContenFromURL: function (url, callback) { 6629 $.ajax({
6630 url: 'handlers/extractContentFromUrl.ashx?url=' + url, 6631 async: false, 6632 cache: false 6633 }) 6634 .done(function (data) { 6635 callback(JSON.parse(data)); 6636 }); 6637 }, 6638 6639 extractImgSrcFromHtml: function (html) { 6640 var regex = /<img.*?src="(.*?)"/; 6641 return regex.exec(html) != null ? regex.exec(html)[1].replace(/\&/g, '&') : null; 6642 }, 6643 6644 removerHtmlFromText: function (html, length) { 6645 var temp = document.createElement("div"); 6646 temp.innerHTML = html; 6647 var text = temp.textContent || temp.innerText || ""; 6648 if (length !== undefined) { 6649 return text.length > length ? text.substr(0, length - 1).trim() + '...' : text; 6650 } 6651 return text; 6652 }, 6653 6654 blockObject: function (idObject, onBlockCallback) { 6655 if (idObject != undefined) { 6656 if (typeof idObject == "string") { 6657 $(idObject).block({ 6658 css: { 6659 border: 'none', 6660 padding: '15px', 6661 backgroundColor: '#fff', 6662 '-webkit-border-radius': '10px', 6663 '-moz-border-radius': '10px', 6664 opacity: 0.4, 6665 color: '#fff', 6666 height: '32px', 6667 width: '48px' 6668 }, 6669 overlayCSS: { 6670 backgroundColor: '#ffffff', 6671 opacity: 0.5, 6672 cursor: 'wait' 6673 }, 6674 message: '<img src="//cache.kreezee.com/images/ajax-loader.gif" />', 6675 fadeIn: 0, 6676 theme: false, 6677 onBlock: onBlockCallback 6678 }); 6679 } 6680 else { 6681 idObject.block({ 6682 css: { 6683 border: 'none', 6684 padding: '15px', 6685 backgroundColor: '#fff', 6686 '-webkit-border-radius': '10px', 6687 '-moz-border-radius': '10px', 6688 opacity: 0.4, 6689 color: '#fff', 6690 height: '32px', 6691 width: '48px' 6692 }, 6693 overlayCSS: { 6694 backgroundColor: '#ffffff', 6695 opacity: 0.5, 6696 cursor: 'wait' 6697 }, 6698 message: '<img src="//cache.kreezee.com/images/ajax-loader.gif" />', 6699 fadeIn: 0, 6700 theme: false, 6701 onBlock: onBlockCallback 6702 }); 6703 } 6704 } 6705 }, 6706 6707 unblockObject: function (idObject) { 6708 if (idObject != undefined) { 6709 if (typeof idObject == "string") { 6710 $(idObject).unblock({ fadeOut: 0 }); 6711 } 6712 else { 6713 idObject.unblock({ fadeOut: 0 }); 6714 } 6715 } 6716 }, 6717 6718 parseVideoUrl: function (url) { 6719 var youtubeRegEx = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/; 6720 var vimeoRegEx = /\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; 6721 var dailyMotionRegEx = /^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/; 6722 var match = null; 6723 6724 if ((url.toLowerCase().indexOf('youtube') != -1) 6725 || (url.toLowerCase().indexOf('youtu.be') != -1)) { 6726 match = url.match(youtubeRegEx); 6727 return match !== null ? match[1] : null; 6728 6729 } else if (url.toLowerCase().indexOf('vimeo') != -1) { 6730 match = url.match(vimeoRegEx); 6731 return match !== null ? match[2] : null; 6732 6733 } else if (url.toLowerCase().indexOf('dailymotion') != -1) { 6734 match = url.match(dailyMotionRegEx); 6735 if (match !== null) { 6736 if (match[4] !== undefined) { 6737 return match[4]; 6738 } 6739 return match[2]; 6740 } 6741 return null; 6742 } else { 6743 return null; 6744 } 6745 }, 6746 6747 embedVideo: function (url, videoId, width, height) { 6748 if ((url.toLowerCase().indexOf('youtube') != -1) 6749 || (url.toLowerCase().indexOf('youtu.be') != -1)) { 6750 return String.format('<iframe id="videoPlayer" src="//www.youtube.com/embed/{0}" width="{1}" height="{2}" frameborder="0" allowfullscreen></iframe>', Utilities.parseVideoUrl(url), width, height); 6751 6752 } else if (url.toLowerCase().indexOf('vimeo') != -1) { 6753 return String.format('<iframe id="videoPlayer" src="//player.vimeo.com/video/{0}?portrait=0" width="{1}" height="{2}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>', Utilities.parseVideoUrl(url), width, height); 6754 6755 } else if (url.toLowerCase().indexOf('dailymotion') != -1) { 6756 return String.format('<iframe id="videoPlayer" src="//www.dailymotion.com/embed/video/{0}" width="{1}" height="{2}" frameborder="0"></iframe>', Utilities.parseVideoUrl(url), width, height); 6757 6758 } else if ((url.toLowerCase().indexOf('kreezee') != -1) || 6759 (url.toLowerCase().indexOf('localhost') != -1)) { 6760 return String.format('<iframe id="videoPlayer" src="/embed/{0}" width="{1}" height="{2}" frameborder="0"></iframe>', videoId, width, height); 6761 } else { 6762 return ''; 6763 } 6764 }, 6765 6766 getAgeFromDate: function(date) { 6767 if (date) { 6768 var today = moment(); 6769 var birthday = moment(date); 6770 return today.diff(birthday, 'years'); 6771 } 6772 return ''; 6773 }, 6774 6775 getScoreUrl: function(solutionName, solutionId, gameId, scoreUrl, gameUrl, destinationUrl) 6776 { 6777 var pathUrl = !window.whiteLabel 6778 ? String.format('/{0}/{1}/{2}/{3}-{4}', solutionName, solutionId, scoreUrl, gameUrl, gameId) 6779 : String.format('/{0}/{1}-{2}', scoreUrl, gameUrl, gameId); 6780 6781 if (destinationUrl !== undefined) { 6782 pathUrl = pathUrl + '#' + destinationUrl; 6783 } 6784 6785 return pathUrl; 6786 }, 6787 6788 getPublicAbsolutePath: function (rootUrl, page) 6789 { 6790 var pathSegments = document.location.pathname.split('/'); 6791 var path = ''; 6792 6793 if (!window.whiteLabel) { 6794 if (typeId === language.solutionList.portal.id) { 6795 path = pathSegments[1] + '/' + pathSegments[2] + '/' + pathSegments[3]; 6796 } 6797 else { 6798 path = pathSegments[1] + '/' + pathSegments[2] + '/' + pathSegments[3] + '/' + pathSegments[4]; 6799 } 6800 } 6801 6802 for (var i = 0; i < arguments.length; i++) { 6803 path += '/' + arguments[i]; 6804 } 6805 6806 return window.whiteLabel 6807 ? path 6808 : '/' + path; 6809 }, 6810 6811 encodeVideo: function (videoId) { 6812 $.get(String.format('/handlers/VideoEncoder.ashx?videoId={0}', videoId), function (data) { 6813 console.log(data); 6814 }); 6815 }, 6816 6817 getNumberHandlerUrl: function (number, color) { 6818 return String.format('/images/handler/{0}/number.png?color={1}', 6819 ((number !== null) && (number.toString().length > 0)) ? number : '-', 6820 color !== null ? encodeURIComponent(color) : encodeURIComponent('#000000')); 6821 }, 6822 6823 uploadImageToCloud: function (section, filename) { 6824 $.ajax({
6825 type: 'POST', 6826 url: '/handlers/AmazonS3.ashx?filetype=image&filename=' + escape(filename) + '§ion=' + escape(section), 6827 data: {}, 6828 contentType: 'application/json; charset=utf-8', 6829 dataType: 'json', 6830 cache: false, 6831 async: false, 6832 success: function(result) { 6833 6834 }, 6835 error: function(xhr, ajaxOptions, thrownError) { 6836 if (thrownError.length > 0) 6837 alert(thrownError); 6838 } 6839 }); 6840 }, 6841 6842 joinText: function(spacer) { 6843 var textArray = []; 6844 Array.prototype.slice.call(arguments, 1).forEach(function(argument) { 6845 if(Array.isArray(argument)) 6846 argument = argument.join(spacer); 6847 6848 if(argument) 6849 textArray.push(argument); 6850 }); 6851 return textArray.join(spacer); 6852 }, 6853 6854 buildQueryString: function(queryObject) { 6855 var queryArray = []; 6856 6857 for(var index in queryObject) { 6858 if ((typeof queryObject[index] != "undefined") && (queryObject[index] != null)) { 6859 queryArray.push(String.format(index + '={0}', typeof queryObject[index] == "string" ? encodeURIComponent(queryObject[index]) : queryObject[index])); 6860 } 6861 } 6862 return queryArray.length > 0 ? '?' + queryArray.join('&', queryArray) : ''; 6863 }, 6864 6865 objectToArray: function(object) { 6866 var array = []; 6867 for(var index in object) { 6868 array.push(object[index]); 6869 } 6870 return array; 6871 }, 6872 6873 bytesToSize: function (bytes) { 6874 var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; 6875 if (bytes == 0) return '0 Byte'; 6876 var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); 6877 return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; 6878 }, 6879 6880 visitTree: function(array, callback, childrenKey) 6881 { 6882 var treeLevel = arguments[3] || 0; 6883 var parent = arguments[4] || null; 6884 var parents = arguments[5] || []; 6885 6886 var childrenKey = childrenKey || 'Children'; 6887 6888 for(var i = 0, shortcut = false; i < array.length && !shortcut; i++) 6889 { 6890 shortcut = callback(array[i], parent, treeLevel, parents); 6891 if(!shortcut && array[i][childrenKey]) 6892 { 6893 shortcut = Utilities.visitTree(ko.unwrap(array[i][childrenKey]), callback, childrenKey, treeLevel+1, array[i], parents.concat([array[i]])); 6894 } 6895 } 6896 6897 return shortcut; 6898 }, 6899 guid: function() { 6900 var h=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']; 6901 var k=['x','x','x','x','x','x','x','x','-','x','x','x','x','-','4','x','x','x','-','y','x','x','x','-','x','x','x','x','x','x','x','x','x','x','x','x']; 6902 var u='',i=0,rb=Math.random()*0xffffffff|0; 6903 while(i++<36) { 6904 var c=k[i-1],r=rb&0xf,v=c=='x'?r:(r&0x3|0x8); 6905 u+=(c=='-'||c=='4')?c:h[v];rb=i%8==0?Math.random()*0xffffffff|0:rb>>4 6906 } 6907 return u 6908 }, 6909 6910 formatCurrency: function (value) { 6911 value = parseFloat(value); 6912 return String.format(language.currencyFormat.format, value.toFixed(2).toString().replace('.', language.currencyFormat.separator)); 6913 }, 6914 6915 parseQuerystring: function (string) { 6916 var object = {}; 6917 var vars = string.split('&'); 6918 for (var i = 0; i < vars.length; i++) { 6919 var pair = vars[i].split('='); 6920 if (decodeURIComponent(pair[0]) && decodeURIComponent(pair[1])) { 6921 object[decodeURIComponent(pair[0])] = Utilities.tryParseInt(decodeURIComponent(pair[1]), decodeURIComponent(pair[1])); 6922 } 6923 } 6924 return object; 6925 } 6926}; 6927 6928$.fn.settingsMenu = function (options) { 6929 var defaults = { 6930 menus: [], 6931 select: null 6932 } 6933 var settings = $.extend(true, {}, defaults, options); 6934 6935 return this.each(function () { 6936 var element = $(this); 6937 var index = 0; 6938 6939 var toHide = true; 6940 6941 function show() { 6942 toHide = true; 6943 bindEvents(); 6944 element.css("display", "block"); 6945 } 6946 6947 function hide() { 6948 if (toHide) 6949 { 6950 element.css("display", "none"); 6951 toHide = true; 6952 unbindEvents(); 6953 } 6954 } 6955 6956 hide(); 6957 6958 var links = element.find("a"); 6959 element.addClass("settingsMenu"); 6960 element.css("top", element.parent().height() + 2); 6961 6962 element.parent().on('mouseover', show); 6963 element.parent().on('mouseout', hide); 6964 element.parent().on('click', function (e) { show(); e.stopPropagation() }); 6965 $(document).on('click.settingsMenu', function () { toHide = true; hide(); }); 6966 6967 function bindEvents() { 6968 element.on('mouseover.settingsMenu', function (e) { toHide = false; e.stopPropagation();}); 6969 element.on('mouseout.settingsMenu', function (e) { toHide = false; e.stopPropagation(); }); 6970 element.on('click.settingsMenu', function (e) { e.stopPropagation() }); 6971 } 6972 6973 function unbindEvents() 6974 { 6975 element.off('mouseover.settingsMenu'); 6976 element.off('mouseout.settingsMenu'); 6977 element.off('click.settingsMenu'); 6978 } 6979 6980 });
6981} 6982 6983var test2 = 0; 6984$.fn.pinPoint = function (method) { 6985 var element = $(this); 6986 var pinPoint = $('<div class="pin-container top-right"><div class="pin"></div><div class="pulse"></div></div>'); 6987 var methods = { 6988 remove: function () { 6989 $(".pin-container", element).remove(); 6990 } 6991 } 6992 6993 if (methods[method]) { 6994 methods[method](); 6995 } 6996 else { 6997 element.css('position', 'relative'); 6998 element.append(pinPoint); 6999 } 7000 7001} 7002 7003if ($.fn.dataTable) 7004{ 7005 $.fn.dataTableExt.oApi.fnResetData = function (oSettings, data) { 7006 this.fnClearTable(false); 7007 if (data && data.length > 0) 7008 this.fnAddData(data); 7009 this.fnDraw(); 7010 return true; 7011 } 7012 7013 $.extend(true, $.fn.dataTable.defaults, { 7014 dom: '<"datatable-responsive"t><"row"<"col-xs-12"p>>', 7015 lengthChange: false, 7016 searching: true, 7017 pageLength: 10, 7018 info: false, 7019 column: { 7020 asSorting: ['desc', 'asc'] 7021 }, 7022 order: [[0, 'desc']] 7023 }); 7024 7025 function sort_function(x, y) { 7026 var alpha = " 0123456789AaÃà ÃâBbCcÃçDdEeÃéÃèÃêÃëFfGgHhIiÃïJjKkLlMmNnOoÃôÃöPpQqRrSsTtUuÃùVvWwXxYyZz" 7027 var index = 0; 7028 var returnVal = 0; 7029 var y = Utilities.removerHtmlFromText(y).replace(/[\.,;:\(\)\[\]\{\}\"\'\?\!]/g, '').replace(/[\-\â\/]/, " "); 7030 var x = Utilities.removerHtmlFromText(x).replace(/[\.,;:\(\)\[\]\{\}\"\'\?\!]/g, '').replace(/[\-\â\/]/, " "); 7031 7032 7033 while(index < x.length && index < y.length && x[index] == y[index]) 7034 { 7035 index++; 7036 } 7037 7038 if (x[index] != y[index]) { 7039 7040 returnVal = alpha.indexOf(x[index]) - alpha.indexOf(y[index]); 7041 } 7042 else 7043 { 7044 if(x.length < y.length) 7045 { 7046 returnVal = -1; 7047 } 7048 else 7049 { 7050 returnVal = 1; 7051 } 7052 } 7053 7054 return returnVal; 7055 } 7056 7057 $.extend($.fn.dataTableExt.oSort, { 7058 "html-pre": null, 7059 7060 "html-asc": function (a, b) { 7061 return sort_function(a, b); 7062 }, 7063 7064 "html-desc": function (a, b) { 7065 return sort_function(a, b) * -1; 7066 }, 7067 7068 "string-pre": null, 7069 7070 "string-asc": function (a, b) { 7071 return sort_function(a, b); 7072 }, 7073 7074 "string-desc": function (a, b) { 7075 return sort_function(a, b) * -1; 7076 }, 7077 7078 "height-pre": function(a) 7079 { 7080 var numbers = a.match(/[0-9]+/g) 7081 return numbers ? (parseFloat(numbers[0] + ("00" + (numbers[1] ? numbers[1] : '0')).slice(-2))) - (numbers[1] ? 0 : 0.5) : 0; 7082 }, 7083 7084 "weight-pre": function(a) 7085 { 7086 var numbers = a.match(/[0-9]+/g); 7087 return numbers ? parseInt(numbers.join('')) : 0; 7088 }, 7089 7090 "num-pre": function (a) { 7091 var number = parseFloat(a); 7092 return number; 7093 } 7094 }); 7095 7096 function customOrder(name, columns) { 7097 $.fn.dataTable.ext.order[name] = function ( settings, col ) 7098 { 7099 var rows = settings.aoData; 7100 var indexArray = this.api().column( col ).nodes(); 7101 7102 var sortedArray = rows.sort(function (a, b) { 7103 return rowTest(a, b, columns, 0); 7104 }); 7105 7106 sortedArray.forEach(function (r, i) { indexArray[i] = i }); 7107 console.log(indexArray); 7108 return indexArray; 7109 } 7110 7111 } 7112 7113 function rowTest(a, b, columns, i) 7114 { 7115 var alpha = " 0123456789AaÃà ÃâBbCcÃçDdEeÃéÃèÃêÃëFfGgHhIiÃïJjKkLlMmNnOoÃôÃöPpQqRrSsTtUuÃùVvWwXxYyZz" 7116 var valX = 0; 7117 7118 if(typeof a._aData[columns[i][0]] == 'string') 7119 { 7120 // find the first different letter and compare 7121 var x = Utilities.removerHtmlFromText(a._aData[columns[i][0]]).replace(/[\.,;:\(\)\[\]\{\}\"\'\?\!]/g, '').replace(/[\-\â\/]/, " "); 7122 var y = Utilities.removerHtmlFromText(b._aData[columns[i][0]]).replace(/[\.,;:\(\)\[\]\{\}\"\'\?\!]/g, '').replace(/[\-\â\/]/, " "); 7123 var index = 0; 7124 7125 while(index < x.length && index < y.length && x[index] == y[index]) 7126 { 7127 index++; 7128 } 7129 7130 if (x[index] != y[index]) { 7131 7132 valX = alpha.indexOf(x[index]) - alpha.indexOf(y[index]); 7133 } 7134 } 7135 else 7136 { 7137 // compare numbers 7138 valX = a._aData[columns[i][0]] - b._aData[columns[i][0]]; 7139 } 7140 7141 // sort by the other column if equals 7142 if (valX == 0 && i < columns.length - 1) { 7143 return rowTest(a, b, columns, i+1); 7144 } 7145 7146 // return sort value 7147 if (columns[i][1] == 'reverse') 7148 { 7149 return valX * -1; 7150 } 7151 else 7152 { 7153 return valX; 7154 } 7155 } 7156} 7157; 7158var data = { 7159 get: function(service, params) { 7160 var deferred = new $.Deferred(); 7161 7162 $.ajax({
7163 type: 'GET', 7164 headers: { '__KreezeeSession__': amplify.store('__KreezeeSession__') }, 7165 url: service, 7166 data: params, 7167 contentType: 'application/json; charset=utf-8', 7168 dataType: 'json' 7169 }) 7170 .done(function (data, status, xhr) { 7171 if (xhr.getResponseHeader('X-Pagination')) { 7172 var response = JSON.parse(xhr.getResponseHeader('X-Pagination')); 7173 response['results'] = data; 7174 deferred.resolve(response); 7175 } else { 7176 deferred.resolve(data); 7177 } 7178 }) 7179 .fail(function (jqxhr, textStatus, error) { 7180 deferred.reject(); 7181 }); 7182 7183 return deferred.promise(); 7184 }, 7185 7186 post: function(service, json) { 7187 var deferred = new $.Deferred(); 7188 7189 $.ajax({ 7190 type: 'POST', 7191 headers: { '__KreezeeSession__': amplify.store('__KreezeeSession__')}, 7192 url: service, 7193 data: JSON.stringify(json), 7194 contentType: 'application/json; charset=utf-8', 7195 dataType: 'json' 7196 }) 7197 .done(function (data) { 7198 if (data && data.d !== undefined) { 7199 deferred.resolve(data.d); 7200 } 7201 else { 7202 deferred.resolve(data); 7203 } 7204 7205 }) 7206 .fail(function () { 7207 deferred.reject(arguments); 7208 //var err = eval("(" + jqxhr.responseText + ")"); 7209 //Utilities.displayMessage('error', language.errorMessage.title, message); 7210 }); 7211 7212 return deferred.promise(); 7213 7214 }, 7215 7216 put: function (service, json) { 7217 var deferred = new $.Deferred(); 7218 7219 $.ajax({
7220 type: 'PUT', 7221 headers: { '__KreezeeSession__': amplify.store('__KreezeeSession__') }, 7222 url: service, 7223 data: JSON.stringify(json), 7224 contentType: 'application/json; charset=utf-8', 7225 dataType: 'json' 7226 }) 7227 .done(function (data) { 7228 deferred.resolve((data || {}).d || data); 7229 }) 7230 .fail(function () { 7231 deferred.reject(arguments); 7232 //var err = eval("(" + jqxhr.responseText + ")"); 7233 //Utilities.displayMessage('error', language.errorMessage.title, message); 7234 }); 7235 7236 return deferred.promise(); 7237 }, 7238 7239 delete: function (service) { 7240 var deferred = new $.Deferred(); 7241 7242 $.ajax({ 7243 type: 'DELETE', 7244 headers: { '__KreezeeSession__': amplify.store('__KreezeeSession__') }, 7245 url: service, 7246 contentType: 'application/json; charset=utf-8', 7247 dataType: 'json' 7248 }) 7249 .done(function (data) { 7250 deferred.resolve((data || {}).d); 7251 }) 7252 .fail(function () { 7253 deferred.reject(arguments); 7254 }); 7255 7256 return deferred.promise(); 7257 } 7258} 7259; 7260var socialMedia = { 7261 getFacebookStats: function(url) { 7262 var deferred = new $.Deferred(); 7263 7264 $.getJSON(String.format('https://api.facebook.com/restserver.php?method=links.getStats&format=json&urls={0}', url)) 7265 .done(function (data) { 7266 deferred.resolve(data.length > 0 ? data : null); 7267 }) 7268 .fail(function () { 7269 deferred.reject(); 7270 }); 7271 7272 return deferred.promise(); 7273 }, 7274 7275 getTwitterStats: function (url) { 7276 var deferred = new $.Deferred(); 7277 7278 $.getJSON(String.format('https://urls.api.twitter.com/1/urls/count.json?url={0}&callback=?', url)) 7279 .done(function (data) { 7280 deferred.resolve(data.count > 0 ? data : null); 7281 }) 7282 .fail(function () { 7283 deferred.reject(); 7284 }); 7285 7286 return deferred.promise(); 7287 } 7288};; 7289/************************************************/ 7290/********* Administration Section ***************/ 7291/************************************************/ 7292function getAdminSection(section) { 7293 var resultat; 7294 7295 switch (section) { 7296 case "ADMSPO": 7297 resultat = getAdminSport(); 7298 break; 7299 case "ADMPAY": 7300 resultat = getAdminCountry(); 7301 break; 7302 case "ADMSTA": 7303 resultat = getAdminStats(); 7304 break; 7305 default: 7306 resultat = null; 7307 } 7308 return resultat; 7309} 7310 7311function getAdminSport() { 7312 var jData = {}; 7313 jData.culture = 'fr'; 7314 7315 //return postJSON(wsAdminSport + 'GetAdminSports', jData); 7316 var value = [ 7317 { Id: "1", Name: "Hockey", Desc: "Hockey" }, 7318 { Id: "2", Name: "Football", Desc: "Desc" }, 7319 { Id: "3", Name: "Baseball", Desc: "Desc" }, 7320 { Id: "4", Name: "Soccer", Desc: "Desc"}]; 7321 return value; 7322} 7323 7324function getAdminCountry() { 7325 var jData = {}; 7326 jData.culture = 'fr'; 7327 7328// return postJSON(wsAdminCountry + 'GetCountries', jData); 7329 var value = [ 7330 { Id: "1", Name: "Canada", Desc: "Canada" }, 7331 { Id: "2", Name: "Ãtats-Unis", Desc: "US" }]; 7332 return value; 7333} 7334 7335function getAdminStats() { 7336 var jData = {}; 7337 jData.culture = 'fr'; 7338 7339 //return postJSON(wsAdminSport + 'GetAdminSports', jData); 7340 var value = [ 7341 { Id: "1", Name: "But", Desc: "Hockey" }, 7342 { Id: "2", Name: "Passe", Desc: "Hockey" }, 7343 { Id: "3", Name: "Pénalité", Desc: "Hockey" }]; 7344 return value; 7345} 7346 7347function getAdminTraduction(sectionName, id) { 7348 var jData = {}; 7349 jData.sectionName = sectionName; 7350 jData.id = id; 7351 7352 // return postJSON(wsAdminCountry + 'GetCountries', jData); 7353 var value = [ 7354 { Id: "1", Name: "Traduction 1", Desc: "Traduction1" }, 7355 { Id: "2", Name: "Traduction 2", Desc: "Traduction2"}]; 7356 return value; 7357} 7358 7359function getPhoneTypeIcon(id) 7360{ 7361 var url = ""; 7362 switch (parseInt(id)) { 7363 case 1: 7364 url = "//cache.kreezee.com/images/icon-phone-26px.png"; 7365 break; 7366 case 2: 7367 url = "//cache.kreezee.com/images/icon-phone-office-26px.png"; 7368 break; 7369 case 3: 7370 url = "//cache.kreezee.com/images/icon-cellphone-26px.png"; 7371 break; 7372 case 4: 7373 url = "//cache.kreezee.com/images/icon-fax-26px.png"; 7374 } 7375 7376 return url; 7377} 7378 7379function getEmailTypeIcon(id) 7380{ 7381 var url = ""; 7382 switch(parseInt(id)) 7383 { 7384 case 1: 7385 url = "//cache.kreezee.com/images/icon-home-26px.png"; 7386 break; 7387 case 3: 7388 url = "//cache.kreezee.com/images/icon-suitcase-26px.png"; 7389 } 7390 return url; 7391}; 7392ko.bindingHandlers.autoComplete = { 7393 findSelectedItem: function (dataSource, binding, selectedValue) { 7394 var unwrap = ko.utils.unwrapObservable; 7395 //Go through the source and find the id, and use its label to set the autocomplete 7396 var source = unwrap(dataSource); 7397 var valueProp = unwrap(binding.optionsValue); 7398 7399 var selectedItem = ko.utils.arrayFirst(source, function (item) { 7400 if (unwrap(item[valueProp]) === selectedValue) 7401 return true; 7402 }, this); 7403 7404 return selectedItem; 7405 }, 7406 buildDataSource: function (dataSource, labelProp, valueProp, iconProp, descProp) { 7407 var unwrap = ko.utils.unwrapObservable; 7408 var source = unwrap(dataSource); 7409 var mapped = ko.utils.arrayMap(source, function (item) { 7410 var result = {}; 7411 if (typeof labelProp == 'function') 7412 { 7413 result.label = labelProp(item); //show in pop-up choices 7414 } 7415 else 7416 { 7417 result.label = labelProp ? unwrap(item[labelProp]) : unwrap(item).toString(); //show in pop-up choices 7418 } 7419 7420 if (descProp) { 7421 if (typeof descProp == 'function') { 7422 result.desc = descProp(item); //show in pop-up choices 7423 } 7424 else { 7425 result.desc = descProp ? unwrap(item[descProp]) : unwrap(item).toString(); //show in pop-up choices 7426 } 7427 } 7428 7429 result.value = valueProp ? unwrap(item[valueProp]) : unwrap(item).toString(); //value 7430 result.icon = iconProp ? unwrap(item[iconProp]) : unwrap(item).toString(); //value 7431 return result; 7432 }); 7433 return mapped; 7434 }, 7435 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 7436 var unwrap = ko.utils.unwrapObservable; 7437 var dataSource = valueAccessor(); 7438 var binding = allBindingsAccessor(); 7439 var bindingMode = unwrap(binding.optionsMode); // Mode to display the autocomplete value in a listbox 7440 var valueProp = unwrap(binding.optionsValue); 7441 var labelProp = unwrap(binding.optionsText) || valueProp; 7442 var iconProp = unwrap(binding.optionsIcon); 7443 var descProp = unwrap(binding.optionsDesc); 7444 var classProp = unwrap(binding.optionsClass); 7445 var styleProp = unwrap(binding.optionsStyle); 7446 var itemClassProp = unwrap(binding.optionsItemClass); 7447 var noWrite = unwrap(binding.optionsNoWrite); 7448 var query = unwrap(binding.optionsQuery); 7449 var textValue = binding.textValue; 7450 var acceptText = unwrap(binding.optionsAcceptText); 7451 7452 var displayId = $(element).attr('id') + '-display'; 7453 var displayElement; 7454 var options = {}; 7455 var objectValue = binding.object; 7456 7457 //function that is shared by both select and change event handlers 7458 function writeValueToModel(valueToWrite) {
7459 if (ko.isWriteableObservable(objectValue)) { 7460 objectValue(valueToWrite); 7461 } else { //write to non-observable 7462 if (binding['_ko_property_writers'] && binding['_ko_property_writers']['object']) 7463 binding['_ko_property_writers']['object'](valueToWrite); 7464 } 7465 } 7466 7467 if (binding.autoCompleteOptions) { 7468 options = $.extend(options, binding.autoCompleteOptions); 7469 } 7470 7471 //Create a new input to be the autocomplete so that the label shows 7472 // also hide the original control since it will be used for the value binding 7473 displayElement = $('<input type="text" id="' + displayId + '" class="' + classProp + '" style="' + styleProp + '" />'); 7474 7475 $(element).hide(); 7476 $(element).after(displayElement); 7477 7478 var modelValue = binding.value; 7479 if (modelValue) { 7480 var handleValueChange = function (event, ui) { 7481 var labelToWrite = ui.item ? ui.item.label : null 7482 var valueToWrite = ui.item ? ui.item.value : null; 7483 var selectedItem = ko.bindingHandlers.autoComplete.findSelectedItem(dataSource, binding, valueToWrite); 7484 writeValueToModel(selectedItem); 7485 if (labelToWrite && valueToWrite) { 7486 if (ko.isWriteableObservable(modelValue)) { 7487 //Since this is an observable, the update part will fire and select the 7488 // appropriate display values in the controls 7489 modelValue(valueToWrite); 7490 } else { //write to non-observable 7491 if (binding['_ko_property_writers'] && binding['_ko_property_writers']['value']) { 7492 binding['_ko_property_writers']['value'](valueToWrite); 7493 displayElement.val(labelToWrite); 7494 $(element).val(valueToWrite); 7495 } 7496 } 7497 } 7498 else { 7499 var currentModelValue = unwrap(modelValue); 7500 if (!currentModelValue) 7501 displayElement.val(''); 7502 else { 7503 var selectedItem = ko.bindingHandlers.autoComplete.findSelectedItem(dataSource, binding, currentModelValue); 7504 7505 if (selectedItem) { 7506 var displayText = labelProp ? unwrap(selectedItem[labelProp]) : unwrap(selectedItem).toString(); 7507 displayElement.val(displayText); 7508 } 7509 else { 7510 displayElement.val(''); 7511 } 7512 } 7513 } 7514 7515 return false; 7516 }; 7517 7518 var handleFocus = function (event, ui) { 7519 return false; 7520 }; 7521 7522 var handleChange = function (event, ui) { 7523 if (ui.item == null) { 7524 if (acceptText) { 7525 textValue(displayElement.val()); 7526 } else { 7527 displayElement.val(''); 7528 } 7529 objectValue(null); 7530 modelValue(null); 7531 } 7532 return false; 7533 }; 7534 7535 options.change = handleChange; 7536 options.select = handleValueChange; 7537 options.focus = handleFocus; 7538 } 7539 else if (objectValue) { 7540 var handleValueChange = function (event, ui) { 7541 7542 var labelToWrite = ui.item ? ui.item.label : null 7543 var valueToWrite = ui.item ? ui.item.value : null; 7544 var selectedItem = ko.bindingHandlers.autoComplete.findSelectedItem(dataSource, binding, valueToWrite); 7545 writeValueToModel(selectedItem); 7546 7547 if (unwrap(noWrite)) 7548 { 7549 displayElement.val(''); 7550 return false; 7551 } 7552 7553 if (labelToWrite && valueToWrite) { 7554 displayElement.val(labelToWrite); 7555 $(element).val(valueToWrite); 7556 } 7557 else { 7558 var currentModelValue = unwrap(objectValue); 7559 if (!currentModelValue) { 7560 displayElement.val(''); 7561 } 7562 else { 7563 if (selectedItem) { 7564 7565 var displayText = labelProp ? unwrap(selectedItem[labelProp]) : unwrap(selectedItem).toString(); 7566 displayElement.val(displayText); 7567 } 7568 else { 7569 displayElement.val(''); 7570 } 7571 } 7572 } 7573 return false; 7574 }; 7575 7576 var handleFocus = function (event, ui) { 7577 return false; 7578 }; 7579 7580 var handleChange = function (event, ui) { 7581 if (ui.item == null || !unwrap(objectValue)) { 7582 if (acceptText) { 7583 textValue(displayElement.val()); 7584 } else { 7585 displayElement.val(''); 7586 } 7587 objectValue(null); 7588 } 7589 return false; 7590 }; 7591 7592 options.change = handleChange; 7593 options.select = handleValueChange; 7594 options.focus = handleFocus; 7595 } 7596 7597 var currentResponse = null; 7598 7599 //handle the choices being updated in a Dependant Observable (DO), so the update function doesn't 7600 // have to do it each time the value is updated. Since we are passing the dataSource in DO, if it is 7601 // an observable, when you change the dataSource, the dependentObservable will be re-evaluated 7602 // and its subscribe event will fire allowing us to update the autocomplete datasource 7603 var mappedSource = ko.dependentObservable({ 7604 read: function () { 7605 return ko.bindingHandlers.autoComplete.buildDataSource(dataSource, labelProp, valueProp, iconProp, descProp); 7606 }, 7607 write: function (newValue) { 7608 dataSource(newValue); 7609 if (currentResponse) { 7610 currentResponse(mappedSource()); 7611 } 7612 } 7613 }); 7614 7615 //hold the autocomplete current response 7616 if (query) { 7617 options.source = function (request, response) { 7618 currentResponse = response; 7619 query.call(this, request.term, mappedSource); 7620 }; 7621 } else { 7622 //whenever the items that make up the source are updated, make sure that autocomplete knows it 7623 mappedSource.subscribe(function (newValue) { 7624 if (displayElement.data('ui-autocomplete')) { 7625 displayElement.autocomplete("option", "source", newValue); 7626 } 7627 }); 7628 7629 options.source = mappedSource(); 7630 } 7631 7632 // Modify the render html list of jquery.autocomplete 7633 // Three modes is available : normal, description, image, image-description 7634 // normal : display only the label (by default this mode is displayed)
7635 // description : display label and a description in a second line. 7636 // image : display a image following by the label. 7637 // image-description : display a image following by the label and a description in second line. 7638 displayElement.autocomplete(options).data("ui-autocomplete")._renderItem = function (ul, item) { 7639 switch (bindingMode) { 7640 case 'normal': 7641 { 7642 return $("<li class='" + itemClassProp + "'>") 7643 .data("ui-autocomplete-item", item) 7644 .append("<a>" + item.label + "</a>") 7645 .appendTo(ul); 7646 } 7647 case 'description': 7648 { 7649 return $("<li class='" + itemClassProp + "'>") 7650 .data("ui-autocomplete-item", item) 7651 .append("<a>" + item.label + "<br>" + item.desc + "</a>") 7652 .appendTo(ul); 7653 } 7654 case 'image': 7655 { 7656 return $("<li class='" + itemClassProp + "'>") 7657 .data("ui-autocomplete-item", item) 7658 .append("<a>" + "<img src=" + item.icon + "/>" + item.label + "</a>") 7659 .appendTo(ul); 7660 } 7661 case 'image-description': 7662 { 7663 return $("<li class='" + itemClassProp + "'>") 7664 .data("ui-autocomplete-item", item) 7665 .append("<a>" + "<img src=" + item.icon + "/>" + item.label + "<br>" + item.desc + "</a>") 7666 .appendTo(ul); 7667 } 7668 case 'search-contact': 7669 { 7670 return $("<li class='" + itemClassProp + "'>") 7671 .data("ui-autocomplete-item", item) 7672 .append(String.format('<a style="float:none;padding:5px;height:34px;"><span style="float:left;display:block;width:32px;height:32px;background:url(\'{0}\') no-repeat;background-size:32px 32px;"></span><span style="margin-left:8px;">{1}</span><br /><span style="margin-left:8px;">{2}</span></a>', item.icon, item.label, item.desc)) 7673 .appendTo(ul); 7674 } 7675 case 'search-team': 7676 { 7677 return $("<li class='" + itemClassProp + "'>") 7678 .data("ui-autocomplete-item", item) 7679 .append(String.format('<a style="float:none;padding:5px;height:34px;"><span style="float:left;display:block;width:32px;height:32px;background:url(\'{0}\') no-repeat;background-size:32px 32px;"></span><span style="margin-left:8px;">{1}</span><br /><span style="margin-left:8px;">{2}</span></a>', item.icon, item.label, item.desc)) 7680 .appendTo(ul); 7681 } 7682 default: 7683 { 7684 return $("<li class='" + itemClassProp + "'>") 7685 .data("ui-autocomplete-item", item) 7686 .append("<a>" + item.label + "</a>") 7687 .appendTo(ul); 7688 } 7689 } 7690 }; 7691 }, 7692 update: function (element, valueAccessor, allBindingsAccessor, viewModel) { 7693 //update value based on a model change 7694 var unwrap = ko.utils.unwrapObservable; 7695 var dataSource = valueAccessor(); 7696 var binding = allBindingsAccessor(); 7697 var valueProp = unwrap(binding.optionsValue); 7698 var labelProp = unwrap(binding.optionsText) || valueProp; 7699 var iconProp = unwrap(binding.optionsIcon) || iconProp; 7700 var displayId = $(element).attr('id') + '-display'; 7701 var displayElement = $(element).siblings('#' + displayId); 7702 var modelValue = binding.value; 7703 var objectValue = binding.object; 7704 var required = binding.required; 7705 7706 if (modelValue) { 7707 var currentModelValue = unwrap(modelValue); 7708 //Set the hidden box to be the same as the viewModels Bound property 7709 $(element).val(currentModelValue); 7710 //Go through the source and find the id, and use its label to set the autocomplete 7711 var selectedItem = ko.bindingHandlers.autoComplete.findSelectedItem(dataSource, binding, currentModelValue); 7712 if (selectedItem) { 7713 var displayText = labelProp ? unwrap(selectedItem[labelProp]) : unwrap(selectedItem).toString(); 7714 displayElement.val(displayText); 7715 } 7716 else { 7717 displayElement.val(''); 7718 } 7719 } 7720 else if (objectValue) { 7721 var currentObjectValue = unwrap(objectValue); 7722 //console.log(currentObjectValue); 7723 if (currentObjectValue) { 7724 $(element).val(currentObjectValue[valueProp]); 7725 var displayText = labelProp ? currentObjectValue[labelProp] : currentObjectValue.toString(); 7726 displayElement.val(displayText); 7727 } 7728 else { 7729 if (required) { 7730 displayElement.val(""); 7731 } 7732 } 7733 } 7734 } 7735}; 7736 7737ko.bindingHandlers.inlineSelect = { 7738 init: function(element, valueAccessor, allBindingsAccessor) { 7739 var span = $(element); 7740 var select = $('<select></select>', { 'style': 'display: none' }); 7741 span.after(select); 7742 ko.applyBindingsToNode(select.get(0), { value: valueAccessor(), options: allBindingsAccessor().inlineOptions }); 7743 ko.applyBindingsToNode(span.get(0), { text: valueAccessor() }); 7744 span.click(function() { 7745 span.hide(); 7746 select.show(); 7747 select.focus(); 7748 }); 7749 select.change(function() { 7750 span.show(); 7751 select.hide(); 7752 }); 7753 } 7754}; 7755 7756ko.bindingHandlers.signature = { 7757 init: function (element, valueAccessor, allBindingsAccessor) { 7758 var touchHandler = function (e) { 7759 var event = e.originalEvent; 7760 var touches = event.changedTouches, 7761 first = touches[0], 7762 type = ""; 7763 switch (event.type) { 7764 case "touchstart": type = "mousedown"; break; 7765 case "touchmove": type = "mousemove"; break; 7766 case "touchend": type = "mouseup"; break; 7767 default: return; 7768 } 7769 7770 var simulatedEvent = document.createEvent("MouseEvent"); 7771 simulatedEvent.initMouseEvent(type, true, true, window, 1, 7772 first.screenX, first.screenY, 7773 first.clientX, first.clientY, false, 7774 false, false, false, 0/*left*/, null); 7775 7776 first.target.dispatchEvent(simulatedEvent); 7777 event.preventDefault(); 7778 } 7779 7780 var onChange = allBindingsAccessor().signatureChanged || null; 7781 var jElement = $(element); 7782 jElement.signature({ 7783 syncFormat: 'PNG', 7784 change: function () { 7785 onChange(jElement.signature('toDataURL')) 7786 } 7787 }); 7788 7789 jElement.on('touchstart', touchHandler); 7790 jElement.on('touchend', touchHandler); 7791 jElement.on('touchmove', touchHandler); 7792 jElement.on('touchcancel', touchHandler); 7793 }, 7794 update: function (element, valueAccessor, allBindingsAccessor) { 7795 var signature = ko.utils.unwrapObservable(valueAccessor()); 7796 7797 if (signature == null) { 7798 $(element).signature('clear'); 7799 } 7800 } 7801}; 7802 7803ko.bindingHandlers.inlineToggle = { 7804 init: function (element, valueAccessor, allBindingsAccessor) { 7805 var displayType = allBindingsAccessor().type || "bool"; 7806 var displayArray = []; 7807 if (displayType == "bool") { 7808 displayArray = ["True", "False"]; 7809 } else if (displayType == "on") { 7810 displayArray = ["On", "Off"]; 7811 } else { 7812 displayArray = displayType.split("/"); 7813 } 7814 var target = valueAccessor(); 7815 var observable = valueAccessor(); 7816 var interceptor = ko.computed(function () { return observable() ? displayArray[0] : displayArray[1]; }); 7817 ko.applyBindingsToNode(element, { text: interceptor }); 7818 ko.applyBindingsToNode(element, { click: function () { target(!target()); } }); 7819 } 7820}; 7821 7822 7823ko.bindingHandlers.inlineSelectedOptions = { 7824 init: function(element, valueAccessor, allBindingsAccessor) { 7825 var span = $(element); 7826 var select = $('<select></select>', { 'style': 'display: none', 'multiple': 'true' }); 7827 span.after(select); 7828 ko.applyBindingsToNode(select.get(0), { selectedOptions: valueAccessor(), options: allBindingsAccessor().inlineOptions }); 7829 ko.applyBindingsToNode(span.get(0), { text: valueAccessor() }); 7830 span.click(function() { 7831 span.hide(); 7832 select.show(); 7833 select.focus(); 7834 }); 7835 select.change(function() { 7836 span.show(); 7837 select.hide(); 7838 }); 7839 } 7840}; 7841 7842ko.bindingHandlers.enterKey = { 7843 init: function(element, valueAccessor, allBindings, data) { 7844 var handler = function(data, event) { 7845 if (event.keyCode === 13) { 7846 valueAccessor().call(data, data, event); 7847 } 7848 ; 7849 }; 7850 var newValueAccessor = function() { return { keyup: handler }; }; 7851 ko.bindingHandlers.event.init(element, newValueAccessor, allBindings, data); 7852 } 7853}; 7854 7855ko.observableArray.fn.moveUp = function (item) { 7856 var index = this.indexOf(item); 7857 if (index == -1 || index == 0) 7858 return; 7859 this.remove(item); 7860 this.splice(index - 1, 0, item); 7861}; 7862 7863ko.observableArray.fn.moveDown = function (item) { 7864 var index = this.indexOf(item); 7865 if (index == -1 || index + 1 == this().length) 7866 return; 7867 this.remove(item); 7868 this.splice(index + 1, 0, item); 7869}; 7870 7871ko.bindingHandlers.slideVisible = { 7872 init: function (element, valueAccessor, allBindingsAccessor) { 7873 var value = ko.utils.unwrapObservable(valueAccessor()); 7874 // Get the current value of the current property we're bound to 7875 $(element).toggle(value); // jQuery will hide/show the element depending on whether "value" or true or false 7876 }, 7877 update: function (element, valueAccessor, allBindingsAccessor) { 7878 var afterShow = allBindingsAccessor().afterShow || $.noop; 7879 7880 // First get the latest data that we're bound to 7881 var value = valueAccessor(), allBindings = allBindingsAccessor(); 7882 7883 // Next, whether or not the supplied model property is observable, get its current value 7884 var valueUnwrapped = ko.utils.unwrapObservable(value); 7885 7886 // Grab some more data from another binding property 7887 var duration = allBindings.slideDuration || 400; // 400ms is default duration unless otherwise specified 7888 7889 // Now manipulate the DOM element 7890 if (valueUnwrapped == true) 7891 $(element).slideDown(duration, afterShow); 7892 else
7893 $(element).slideUp(duration); 7894 } 7895}; 7896 7897if (ko && ko.bindingHandlers) { 7898 ko.bindingHandlers['buttonEnable'] = { 7899 'update': function (element, valueAccessor) { 7900 var value = ko.utils.unwrapObservable(valueAccessor()); 7901 var $button = $(element); 7902 $button.prop("disabled", !value); 7903 if ($button.hasClass("ui-button")) { 7904 $button.button("option", "disabled", !value); 7905 } 7906 } 7907 }; 7908} 7909 7910ko.bindingHandlers.datepicker = (function() { 7911 var idIndex = 1; 7912 return { init: function (element, valueAccessor, allBindingsAccessor) { 7913 //initialize datepicker with some optional options 7914 var id = $(element).attr("id") || "datePicker"; 7915 $(element).attr("id", id + idIndex++); 7916 7917 var options = allBindingsAccessor().datepickerOptions || {}; 7918 var datepickerFormat = allBindingsAccessor().datepickerFormat || 'DD/MM/YYYY'; 7919 var openObservable = allBindingsAccessor().datepickerOpen || undefined; 7920 7921 $(element).datepicker(options); 7922 7923 if(openObservable !== undefined) { 7924 if(ko.isSubscribable(openObservable)) { 7925 openObservable.subscribe(function(value) { 7926 if(value) { 7927 $(element).datepicker('show'); 7928 } 7929 else { 7930 $(element).datepicker('hide'); 7931 } 7932 }); 7933 7934 $(element).datepicker('option', 'onClose', function() { 7935 openObservable(false); 7936 }); 7937 } 7938 } 7939 7940 //handle the field changing 7941 ko.utils.registerEventHandler(element, "change", function () { 7942 var observable = valueAccessor(); 7943 observable($(element).datepicker("getDate")); 7944 $(element).datepicker("setDate", $(element).datepicker("getDate")); 7945 }); 7946 7947 //handle disposal (if KO removes by the template binding) 7948 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 7949 $(element).datepicker("destroy"); 7950 }); 7951 7952 7953 }, 7954 update: function (element, valueAccessor) { 7955 var value = ko.utils.unwrapObservable(valueAccessor()); 7956 7957 //handle date data coming via json from Microsoft 7958 if (String(value).indexOf('/Date(') == 0) { 7959 value = new Date(parseInt(value.replace(/\/Date\((.*?)\)\//gi, "$1"))); 7960 } 7961 7962 current = $(element).datepicker("getDate"); 7963 7964 if (value - current !== 0) { 7965 $(element).datepicker("setDate", value); 7966 } 7967 } 7968 } 7969 7970 })(); 7971 7972ko.bindingHandlers.button = { 7973 initIcon: function (options) { 7974 if (options.icon) { 7975 options.icons = { primary: options.icon }; 7976 } 7977 7978 if (options.faIcon) 7979 { 7980 options.iconClass = 'fa ' + options.faIcon; 7981 } 7982 7983 if (options.text) { 7984 options.text = options.text; 7985 } 7986 }, 7987 init: function (element, valueAccessor) { 7988 var options = ko.utils.unwrapObservable(ko.toJS(valueAccessor())) || {}; 7989 ko.bindingHandlers.button.initIcon(options); 7990 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 7991 $(element).button("destroy"); 7992 }); 7993 7994 $(element).button(options); 7995 7996 if(options.faIcon) 7997 { 7998 var iconHtml = '<i class="fa ' + options.faIcon + '"></i>'; 7999 if(options.label) { 8000 iconHtml = '<span style="vertical-align:middle; margin-right:5px">' + options.label + '</span>' + iconHtml; 8001 } 8002 8003 $(element).html(iconHtml); 8004 8005 if(options.faSize) 8006 { 8007 $('i', $(element)).css('font-size', options.faSize); 8008 } 8009 } 8010 }, 8011 update: function (element, valueAccessor) { 8012 var options = ko.toJS(valueAccessor()); 8013 ko.bindingHandlers.button.initIcon(options); 8014 8015 8016 if (options) { 8017 $(element).button(options); 8018 } 8019 // Fix span problem. 8020 if (!options.faIcon) 8021 { 8022 $(element).html('<span class="ui-button-text">' + $(element).html() + '</span>'); 8023 } 8024 else 8025 { 8026 var iconHtml = '<i class="fa ' + options.faIcon + '"></i>'; 8027 if(options.label) { 8028 iconHtml = '<span style="margin-right:10px">' + options.label + '</span>' + iconHtml; 8029 } 8030 8031 $(element).html(iconHtml); 8032 8033 8034 if (options.faSize) { 8035 $('i', $(element)).css('font-size', options.faSize); 8036 $('span', $(element)).css('line-height', options.faSize); 8037 } 8038 } 8039 } 8040}; 8041 8042ko.unapplyBindings = function ($node, remove) { 8043 // unbind events 8044 $node.find("*").each(function () { 8045 $(this).unbind(); 8046 });
8047 8048 // Remove KO subscriptions and references 8049 if (remove) { 8050 ko.removeNode($node[0]); 8051 } else { 8052 ko.cleanNode($node[0]); 8053 } 8054}; 8055 8056ko.bindingHandlers.spinner = { 8057 init: function (element, valueAccessor, allBindingsAccessor) { 8058 //initialize datepicker with some optional options 8059 var options = allBindingsAccessor().spinnerOptions || {}; 8060 $(element).spinner(options); 8061 8062 //handle the field changing 8063 ko.utils.registerEventHandler(element, "spinchange", function () { 8064 var observable = valueAccessor(); 8065 observable($(element).spinner("value")); 8066 }); 8067 8068 //handle disposal (if KO removes by the template binding) 8069 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 8070 $(element).spinner("destroy"); 8071 }); 8072 8073 }, 8074 update: function (element, valueAccessor) { 8075 var value = ko.utils.unwrapObservable(valueAccessor()); 8076 8077 current = $(element).spinner("value"); 8078 if (value !== current) { 8079 $(element).spinner("value", value); 8080 } 8081 } 8082}; 8083 8084ko.bindingHandlers.select2 = { 8085 init: function(element, valueAccessor) { 8086 $(element).select2(valueAccessor()); 8087 8088 8089 if (valueAccessor().focus) 8090 { 8091 var focusUnwrapped = ko.unwrap(valueAccessor().focus); 8092 if(focusUnwrapped) $(element).select2('focus'); 8093 } 8094 8095 ko.utils.domNodeDisposal.addDisposeCallback(element, function() { 8096 $(element).select2('destroy'); 8097 }); 8098 }, 8099 update: function (element, valueAccessor, allAccessors) { 8100 var optionsValue = ko.unwrap(allAccessors().optionsValue); 8101 var options = ko.unwrap(allAccessors().options); 8102 var value = ko.unwrap(allAccessors().value); 8103 var optionsColor = ko.unwrap(allAccessors().optionsColor); 8104 var optionsTextColor = ko.unwrap(allAccessors().optionsTextColor); 8105 var select2Element = $(element).prev('.select2-container'); 8106 8107 $(element).select2("val", value); 8108 8109 if(optionsColor) { 8110 var color = Utilities.findObjectByAttribute(options, value, optionsValue, optionsColor); 8111 $('a.select2-choice', select2Element).css({'background-color': color, 'background-image': 'none', 'box-shadow': 'none'}); 8112 } 8113 8114 if(optionsTextColor) { 8115 var textColor = Utilities.findObjectByAttribute(options, value, optionsValue, optionsTextColor); 8116 $('a.select2-choice', select2Element).css('color', textColor); 8117 } 8118 8119 8120 if (valueAccessor().focus) { 8121 var focusUnwrapped = ko.unwrap(valueAccessor().focus); 8122 if (focusUnwrapped) $(element).select2('focus'); 8123 } 8124 } 8125}; 8126 8127ko.bindingHandlers.watermark = { 8128 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8129 var allBindings = allBindingsAccessor(); 8130 var text, options; 8131 var watermark = allBindings.watermark; 8132 8133 if (typeof watermark == "string") 8134 { text = watermark; } 8135 else { 8136 text = watermark.text; 8137 options = watermark.options; 8138 } 8139 $(element).watermark(text, options); 8140 } 8141}; 8142 8143ko.bindingHandlers.timeAgo = { 8144 update: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8145 $(element).text($.timeago(ko.unwrap(valueAccessor()))); 8146 } 8147}; 8148 8149ko.bindingHandlers.tipsy = { 8150 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8151 // tipsy options 8152 // delayIn: 0, // delay before showing tooltip (ms) 8153 // delayOut: 0, // delay before hiding tooltip (ms) 8154 // fade: false, // fade tooltips in/out? 8155 // fallback: '', // fallback text to use when no tooltip text 8156 // gravity: 'n', // gravity 8157 // html: false, // is tooltip content HTML? 8158 // live: false, // use live event support? 8159 // offset: 0, // pixel offset of tooltip from element 8160 // opacity: 0.8, // opacity of tooltip 8161 // title: 'title', // attribute/callback containing tooltip text 8162 // trigger: 'hover' // how tooltip is triggered - hover | focus | manual 8163 $(element).tipsy(allBindingsAccessor().tipsy); 8164 } 8165}; 8166 8167ko.bindingHandlers.menu = { 8168 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8169 var value = valueAccessor(); 8170 var menu = ko.unwrap(value); 8171 var select = ko.unwrap(select); 8172 8173 //console.log(menu.menus); 8174 var html = "<li class='actions'><ul>";
8175 menu.menus.forEach( 8176 function (element) { 8177 var visible = ko.unwrap(element.visible != undefined ? element.visible : true); 8178 8179 if (element.divider) 8180 { 8181 html += "<li height:5px;><div style='margin:0 5px; border-bottom:1px solid #b1b0b0'></div></li>"; 8182 } 8183 else if(visible) 8184 { 8185 if (element.type == "link") { 8186 if (element.target) { 8187 html += "<li><a data-bind=\"html: '" + element.text + "'\" href=\"" + element.url + "\" target=\"" + element.target + "\"></a></li>"; 8188 } 8189 else { 8190 html += "<li><a data-bind=\"html: '" + element.text + "'\" href=\"" + element.url + "\"></a></li>"; 8191 } 8192 } 8193 else { 8194 html += "<li><a data-bind=\"html: '" + element.text + "', click:" + element.method + "\"></a></li>"; 8195 } 8196 } 8197 }); 8198 8199 html += "</ul></li>"; 8200 8201 $(element).html(html); 8202 $(element).menu({ position: { my: menu.position.my, at: menu.position.at } }); 8203 } 8204}; 8205 8206ko.bindingHandlers.settingsMenu = { 8207 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8208 $(element).settingsMenu(); 8209 } 8210} 8211 8212ko.bindingHandlers.fallback = { 8213 update: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8214 $(element).css('visibility', 'visible'); 8215 }, 8216 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8217 var fallback = ko.unwrap(valueAccessor()); 8218 8219 $(element).on('error',function () { 8220 if (fallback == 'hide') { 8221 $(this).css('visibility', 'hidden'); 8222 } 8223 else if(fallback == 'remove') 8224 { 8225 $(this).css('display', 'none'); 8226 } 8227 else 8228 { 8229 $(this).attr('src', fallback); 8230 } 8231 }); 8232 } 8233} 8234 8235ko.bindingHandlers.numeric = { 8236 init: function (element) { 8237 $(element).on("keydown", function (event) { 8238 // Allow: backspace, delete, tab, escape, and enter 8239 if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || 8240 // Allow: Ctrl+A 8241 (event.keyCode == 65 && event.ctrlKey === true) || 8242 // Allow: . , et - 8243 (event.keyCode == 188 || event.keyCode == 190 || event.keyCode == 110 || event.keyCode == 109 || event.keyCode == 189) || 8244 // Allow: home, end, left, right 8245 (event.keyCode >= 35 && event.keyCode <= 39)) { 8246 // let it happen, don't do anything 8247 return; 8248 } 8249 else { 8250 // Ensure that it is a number and stop the keypress 8251 if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) { 8252 event.preventDefault(); 8253 } 8254 } 8255 }); 8256 } 8257}; 8258 8259ko.bindingHandlers.integer = { 8260 init: function (element, valueAccessor, allBindingsAccessor, viewModel) { 8261 var allowNegative = allBindingsAccessor().allowNegative || false; 8262 8263 $(element).on("keydown", function (event) { 8264 // Allow: backspace, delete, tab, escape, and enter 8265 if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || 8266 // Allow: Ctrl+A 8267 (event.keyCode == 65 && event.ctrlKey === true) || 8268 // Allow: - if negatives are allowed 8269 ((event.keyCode == 109 || event.keyCode == 189) && allowNegative) || 8270 // Allow: home, end, left, right 8271 (event.keyCode >= 35 && event.keyCode <= 39)) { 8272 // let it happen, don't do anything 8273 return; 8274 } 8275 else { 8276 // Ensure that it is a number and stop the keypress 8277 if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) { 8278 event.preventDefault(); 8279 } 8280 } 8281 }); 8282 } 8283}; 8284 8285ko.bindingHandlers.integerMinMaxValue = { 8286 init: function (element) { 8287 $(element).on("keydown", function (event) { 8288 // Allow: backspace, delete, tab, escape, and enter 8289 if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || 8290 // Allow: Ctrl+A 8291 (event.keyCode == 65 && event.ctrlKey === true) || 8292 // Allow: home, end, left, right 8293 (event.keyCode >= 35 && event.keyCode <= 39)) { 8294 // let it happen, don't do anything 8295 return; 8296 } 8297 else { 8298 // Ensure that it is a number and stop the keypress 8299 if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) { 8300 event.preventDefault(); 8301 } 8302 } 8303 }); 8304 }, 8305 update: function (element, valueAccessor) { 8306 var value = ko.utils.unwrapObservable(valueAccessor()); 8307 var maxValue = element.getAttribute("maxvalue"); 8308 var minValue = element.getAttribute("minvalue"); 8309 if (isNaN(value)) value = minValue; 8310 if (Number(value) > Number(maxValue)) value = maxValue; 8311 $(element).val(value); 8312 } 8313}; 8314 8315//!!!!! Put no id on dataTables in html when this handler is used with a data-bind="forEac
8315h:... Or you'll get display problems !!!!!! 8316ko.bindingHandlers.datatable = { 8317 init: function(element, valueAccessor, allBindingsAccessor, viewModel) { 8318 var allBindings = allBindingsAccessor(); 8319 var options = ko.unwrap(allBindings.datatableOptions); 8320 8321 $(element).dataTable(options); 8322 8323 if (ko.isSubscribable(allBindings.datatableOptions)) { 8324 allBindings.datatableOptions.subscribe(function(value) { 8325 var data = $(element).dataTable().fnGetData(); 8326 $(element).dataTable().fnDestroy(); 8327 $(element).dataTable(value); 8328 $(element).dataTable().fnResetData(data); 8329 }); 8330 } 8331 8332 }, 8333 8334 update: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8335 var data = ko.unwrap(valueAccessor()); 8336 var allBindings = allBindingsAccessor(); 8337 var options = ko.unwrap(allBindings.datatableOptions); 8338 8339 var object = $(element).dataTable(); 8340 object.fnResetData(data); 8341 } 8342}; 8343 8344ko.bindingHandlers.clockpicker = { 8345 init: function(element, valueAccessor, allBindingsAccessor, viewModel) 8346 { 8347 var defaults = { autoclose: true } 8348 var options = ko.utils.unwrapObservable(ko.toJS(valueAccessor())) || {}; 8349 options = $.extend({}, defaults, options); 8350 8351 $(element).clockpicker(options); 8352 } 8353} 8354 8355ko.bindingHandlers.stopBinding = { 8356 init: function () { 8357 return { controlsDescendantBindings: true }; 8358 } 8359}; 8360 8361//wrapper for a computed observable that can pause its subscriptions 8362ko.pauseableComputed = function (evaluatorFunction, evaluatorFunctionTarget) { 8363 var _cachedValue = ""; 8364 var _isPaused = ko.observable(false); 8365 8366 //the computed observable that we will return 8367 var result = ko.computed(function () { 8368 if (!_isPaused()) { 8369 //call the actual function that was passed in 8370 return evaluatorFunction.call(evaluatorFunctionTarget); 8371 } 8372 return _cachedValue; 8373 }, evaluatorFunctionTarget); 8374 8375 //keep track of our current value and set the pause flag to release our actual subscriptions 8376 result.pause = function () { 8377 _cachedValue = this(); 8378 _isPaused(true); 8379 }.bind(result); 8380 8381 //clear the cached value and allow our computed observable to be re-evaluated 8382 result.resume = function () { 8383 _cachedValue = ""; 8384 _isPaused(false); 8385 } 8386 8387 return result; 8388}; 8389 8390ko.bindingHandlers.consoleLog = { 8391 update: function(element, valueAccessor, allBindingsAccessor, viewModel) { 8392 console.log(ko.unwrap(valueAccessor())); 8393 } 8394} 8395 8396ko.bindingHandlers.ifvisible = { 8397 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8398 8399 return ko.bindingHandlers.if.init(element, valueAccessor, allBindingsAccessor, viewModel, context); 8400 }, 8401 update: function(element, valueAccessor, allBindingsAccessor, viewModel, context){ 8402 var show = ko.unwrap(valueAccessor()); 8403 if(!show) { 8404 $(element).addClass('hidden'); 8405 } 8406 else { 8407 $(element).removeClass('hidden'); 8408 } 8409 8410 ko.bindingHandlers.if.update(element, valueAccessor, allBindingsAccessor, viewModel, context); 8411 } 8412} 8413 8414ko.bindingHandlers.dialog = { 8415 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) 8416 { 8417 var isOpen = allBindingsAccessor().isOpen; 8418 8419 $(element).dialog(ko.unwrap(valueAccessor())); 8420 $(element).on( "dialogclose", function( event, ui ) { 8421 if(ko.isObservable(isOpen)) 8422 { 8423 isOpen(false); 8424 } 8425 }); 8426 8427 if(isOpen) 8428 { 8429 $(element).dialog(ko.unwrap(isOpen) ? "open" : "close") 8430 if(ko.isSubscribable(isOpen)) 8431 { 8432 isOpen.subscribe(function(value) 8433 { 8434 $(element).dialog(ko.unwrap(isOpen) ? "open" : "close"); 8435 }); 8436 } 8437 } 8438 } 8439} 8440 8441ko.bindingHandlers.nestedSortable = (function() { 8442 var defaultOptions = { 8443 listType: 'ul', 8444 maxLevels: 7, 8445 placeholder: 'sortable-placeholder', 8446 errorClass: 'sortable-error', 8447 forcePlaceholderSize: true, 8448 tolerance: 'intersect', 8449 items: 'li', 8450 excludeRoot: true, 8451 connectWith: '.sortable' 8452 }; 8453 8454 var ITEMKEY = "ko_sortItem", 8455 INDEXKEY = "ko_sourceIndex", 8456 LISTKEY = "ko_sortList", 8457 PARENTKEY = "ko_parentList", 8458 DRAGKEY = "ko_dragItem", 8459 unwrap = ko.utils.unwrapObservable, 8460 dataGet = ko.utils.domData.get, 8461 dataSet = ko.utils.domData.set; 8462 8463 function prepareTemplateOptions(valueAccessor, items) 8464 { 8465 var templateOptions = {}, 8466 options = unwrap(valueAccessor()) || {}, 8467 actualAfterRender; 8468 8469 templateOptions.foreach = options.data || []; 8470 templateOptions.name = options.template; 8471
8472 ko.utils.arrayForEach(["afterAdd", "afterRender", "as", "beforeRemove", "includeDestroyed", "templateEngine", "templateOptions", "nodes"], 8473 function (option) { 8474 if (options.hasOwnProperty(option)) { 8475 templateOptions[option] = options[option]; 8476 } 8477 }); 8478 8479 if (templateOptions.afterRender) { 8480 actualAfterRender = templateOptions.afterRender; 8481 templateOptions.afterRender = function(element, data) { 8482 addMetaDataAfterRender.call(data, element, data); 8483 actualAfterRender.call(data, element, data); 8484 }; 8485 } else { 8486 templateOptions.afterRender = addMetaData; 8487 } 8488 8489 return templateOptions; 8490 } 8491 8492 function addMetaData(elements, data) { 8493 //console.log(elements); 8494 ko.utils.arrayForEach(elements, function(element) { 8495 if (element.nodeType === 1) { 8496 dataSet(element, ITEMKEY, data); 8497 dataSet(element, PARENTKEY, dataGet(element.parentNode.parentNode, ITEMKEY)); 8498 if(data.Children().length > 0) 8499 { 8500 addMetaDataToChildren($(element).children('ul').children('li'), data.Children, data); 8501 } 8502 } 8503 }); 8504 } 8505 8506 function addMetaDataToChildren(domChildren, dataChildren, dataParent) 8507 { 8508 dataChildren = unwrap(dataChildren); 8509 domChildren.each(function(i, element) { 8510 dataSet(element, ITEMKEY, dataChildren[i]); 8511 dataSet(element, PARENTKEY, dataParent); 8512 8513 if(dataChildren[i].Children().length > 0) 8514 { 8515 addMetaDataToChildren($(element).children('ul').children('li'), dataChildren[i].Children, dataChildren[i]); 8516 } 8517 }); 8518 } 8519 8520 return { 8521 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) 8522 { 8523 var array = valueAccessor().data; 8524 var sortableOptions = allBindingsAccessor().sortableOptions || {}; 8525 var options = $.extend(defaultOptions, ko.unwrap(sortableOptions)); 8526 8527 var templateOptions = prepareTemplateOptions(valueAccessor); 8528 8529 ko.bindingHandlers.template.init(element, function() { return templateOptions; }, allBindingsAccessor, data, context); 8530 8531 var createTimeout = setTimeout(function() { 8532 options.start = function(event, object) { 8533 var el = object.item[0]; 8534 dataSet(el, INDEXKEY, ko.utils.arrayIndexOf(object.item.parent().children(), el)); 8535 } 8536 8537 var actualRelocate = options.relocate; 8538 options.relocate = function(event, object) { 8539 setTimeout(function() { 8540 var sourceArray, targetArray; 8541 var el = dataGet(object.item[0], ITEMKEY); 8542 var sourceParent = dataGet(object.item[0], PARENTKEY); 8543 var sourceIndex = dataGet(object.item[0], INDEXKEY); 8544 var targetParent; 8545 var targetIndex = ko.utils.arrayIndexOf(object.item.parent().children(), object.item[0]); 8546 8547 if(object.item.parents(options.items).length > 0) { 8548 targetParent = dataGet(object.item.parents(options.items)[0], ITEMKEY); 8549 } 8550 8551 $(element).nestedSortable('cancel'); 8552 8553 if (targetIndex >= 0) { 8554 if (sourceParent) { 8555 sourceArray = sourceParent.Children; 8556 } 8557 else { 8558 sourceArray = array; 8559 } 8560 8561 sourceArray().splice(sourceIndex, 1); 8562 8563 if(targetParent) { 8564 targetArray = targetParent.Children; 8565 } 8566 else { 8567 targetArray = array; 8568 } 8569 8570 targetArray().splice(targetIndex, 0, el); 8571 } 8572 8573 dataSet(object.item[0], INDEXKEY, null); 8574 8575 var arrayCopy = array(); 8576 $(element).html(''); 8577 array([]); 8578 array(arrayCopy); 8579 8580 if(actualRelocate) { 8581 var event = {} 8582 event.targetParent = targetParent; 8583 event.targetIndex = targetIndex; 8584 event.element = el; 8585 event.sourceParent = sourceParent; 8586 event.sourceIndex = sourceIndex; 8587 actualRelocate(event); 8588 } 8589 }, 0); 8590 } 8591 8592 $(element).nestedSortable(options); 8593 }, 0); 8594 8595 return { controlsDescendantBindings: true }; 8596 }, 8597 update: function(element, valueAccessor, allBindingsAccessor, viewModel, context) 8598 { 8599 var templateOptions = prepareTemplateOptions(valueAccessor); 8600 ko.bindingHandlers.template.update(element, function() { return templateOptions; }, allBindingsAccessor, data, context); 8601 } 8602 } 8603})(); 8604 8605ko.bindingHandlers.spectrum = { 8606 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) 8607 { 8608 var color = valueAccessor(); 8609 var options = allBindingsAccessor().spectrumOptions || {}; 8610 var changeColor = function(newColor) { 8611 if(ko.isObservable(color)) { 8612 color(newColor) 8613 } 8614 else { 8615 color = newColor; 8616 } 8617 } 8618 8619 options.color = ko.unwrap(valueAccessor()); 8620 8621 if(options.valueUpdate != 'onchange') { 8622 options.move = options.onChange || changeColor; 8623 } 8624 8625 options.change = options.onChange || changeColor; 8626 8627 if(ko.isSubscribable(color)) { 8628 color.subscribe(function(value) { 8629 $(element).spectrum('set', value); 8630 }); 8631 } 8632 8633 $(element).spectrum(options); 8634 } 8635} 8636 8637ko.bindingHandlers.toggle = { 8638 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8639 var value = valueAccessor(); 8640 $(element).on('click', function() { 8641 if(ko.isObservable(value)) { 8642 value(!value()); 8643 } 8644 else { 8645 value = !value; 8646 } 8647 }); 8648 } 8649} 8650 8651ko.bindingHandlers.truncate = { 8652 init: function(element, valueAccessor, allBindingsAccessor) { 8653 $(window).resize(function() { 8654 $(element).text($(element).data("fulltext")); 8655 $(element).truncate({ multiline: true });
8656 }); 8657 8658 $(element).on("update.trunc", function() { 8659 $(element).text($(element).data("fulltext")); 8660 $(element).truncate({ multiline: true }); 8661 }); 8662 }, 8663 update: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8664 $(element).data('fulltext', ko.unwrap(valueAccessor())); 8665 $(element).text($(element).data("fulltext")); 8666 $(element).truncate({ multiline: true }) 8667 } 8668} 8669 8670ko.bindingHandlers.draggable = { 8671 init: function(element, valueAccessor) { 8672 $(element).draggable(ko.unwrap(valueAccessor())); 8673 } 8674} 8675 8676ko.bindingHandlers.sortable = { 8677 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8678 var sortableOptions = $.extend({}, ko.unwrap(valueAccessor())); 8679 var sortableItems = allBindingsAccessor().sortableItems || null; 8680 8681 if(sortableItems != null) 8682 ko.bindingHandlers.foreach.init(element, sortableItems, allBindingsAccessor, viewModel, context); 8683 8684 var actualUpdate = null; 8685 8686 if(sortableOptions.update) { 8687 actualUpdate = sortableOptions.update; 8688 sortableOptions.update = undefined; 8689 } 8690 8691 $(element).sortable(sortableOptions); 8692 8693 8694 if(sortableItems != null) { 8695 var startIndex = -1; 8696 $(element).on('sortstart', function(event, ui) { 8697 startIndex = ui.item.index(); 8698 }); 8699 $(element).on('sortupdate', function(event, ui) { 8700 8701 var elements = sortableItems(); 8702 var updatedIndex = ui.item.index(); 8703 8704 var item = elements.splice(startIndex, 1); 8705 elements.splice(updatedIndex, 0, item[0]); 8706 sortableItems.valueHasMutated(); 8707 8708 if(actualUpdate) 8709 actualUpdate.call(context["$data"], item[0], event, ui); 8710 }); 8711 } 8712 8713 return { controlsDescendantBindings: true }; 8714 }, 8715 update: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8716 var sortableItems = allBindingsAccessor().sortableItems || null; 8717 8718 if(sortableItems != null) 8719 ko.bindingHandlers.foreach.update(element, sortableItems, allBindingsAccessor, viewModel, context); 8720 8721 return { controlsDescendantBindings: true }; 8722 } 8723} 8724 8725ko.bindingHandlers.resizable = { 8726 init: function(element, valueAccessor, allBindingsAccessor, viewModel, context) { 8727 if(ko.unwrap(valueAccessor())) { 8728 var resizableOptions = $.extend({}, ko.unwrap(valueAccessor())); 8729 8730 if(resizableOptions.containment) { 8731 resizableOptions.containment = $(element).closest(resizableOptions.containment); 8732 } 8733 8734 if(resizableOptions.resize) { 8735 var actualResize = resizableOptions.resize; 8736 resizableOptions.resize = function(event, ui) { 8737 actualResize.call(context["$data"], context["$data"], event, ui); 8738 }; 8739 } 8740 8741 $(element).resizable(resizableOptions); 8742 } 8743 } 8744} 8745 8746 8747ko.bindingHandlers.dropzone = { 8748 init: function (element, valueAccessor) { 8749 var value = ko.unwrap(valueAccessor()); 8750 if (value.bottom) 8751 $(element).css("bottom", value.bottom + "px"); 8752 8753 if (value.width) 8754 $(element).css("width", value.width + "px"); 8755 8756 $(element).dropzone(value); 8757 } 8758}; 8759 8760ko.bindingHandlers.popover = { 8761 init: function (element, valueAccessor) { 8762 var value = ko.unwrap(valueAccessor()); 8763 8764 $(element).popover({ content: value }); 8765 } 8766}; 8767 8768var idSuffix = 0; 8769ko.bindingHandlers.ad = { 8770 init: function (element, valueAccessor, allBindingAccessor, viewModel, context) { 8771 var adId = ko.unwrap(valueAccessor()) || null; 8772 var adType = ko.unwrap(allBindingAccessor().adType) || null; 8773 var solutionId = ko.unwrap(allBindingAccessor().solutionId) || null; 8774 var width = ko.unwrap(allBindingAccessor().width) || null; 8775 var height = ko.unwrap(allBindingAccessor().height) || null; 8776 var backgroundColor = ko.unwrap(allBindingAccessor().backgroundColor) || null; 8777 var visible = ko.unwrap(allBindingAccessor().visible) || null; 8778 var mediaType = ko.unwrap(allBindingAccessor().mediaType) || null; 8779 var scheduleList = ko.unwrap(allBindingAccessor().scheduleList) || null; 8780 var culture = ko.unwrap(allBindingAccessor().culture) || null; 8781 var external = ko.unwrap(allBindingAccessor().external) || false;
8782 var validateSponsorThisGame = ko.unwrap(allBindingAccessor().validateSponsorThisGame) || false; 8783 8784 if (window.ads_api) { 8785 if (external) { 8786 ads_api.createExternal(adId, idSuffix, solutionId, width, height, validateSponsorThisGame, culture).then(function (ad) { 8787 if (ad) { 8788 element.appendChild(ad); 8789 } 8790 }); 8791 8792 var suffix = idSuffix; 8793 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 8794 ads_api.destroyExternal(adId + '-' + suffix); 8795 }); 8796 8797 idSuffix++; 8798 } 8799 else { 8800 element.appendChild(ads_api.create(adId, adType, solutionId, width, height, backgroundColor, visible, mediaType, scheduleList, culture)); 8801 } 8802 } 8803 } 8804}; 8805 8806ko.bindingHandlers.timeoutIf = { 8807 init: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8808 var delay = ko.unwrap(valueAccessor()) || null; 8809 var observable = ko.observable(false); 8810 8811 var timeout = setTimeout(function () { 8812 observable(true); 8813 }, delay); 8814 8815 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 8816 clearTimeout(timeout); 8817 }); 8818 8819 ko.bindingHandlers.if.init(element, observable, allBindingsAccessor, viewModel, context); 8820 8821 ko.computed({ 8822 read: function () { 8823 return ko.bindingHandlers.if.update(element, observable, allBindingsAccessor, viewModel, context); 8824 } 8825 }); 8826 8827 return { 'controlsDescendantBindings': true }; 8828 } 8829}; 8830 8831ko.bindingHandlers.blockFeature = { 8832 init: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8833 var name = ko.unwrap(valueAccessor()); 8834 8835 $(element).block({ message: '<span>' + language.global.premiumFeature + '<\span>' }); 8836 8837 solution.getFeature(solutionId, name).then(function (feature) { 8838 if (feature) { 8839 $(element).unblock(); 8840 } 8841 else { 8842 $(element).addClass('blocked-feature'); 8843 $(element).on('click', function () { 8844 window.open('https://www.kreezee.com/sport/organization/kreezee-sports-premiums/11966/premiums'); 8845 }); 8846 } 8847 }); 8848 } 8849} 8850 8851ko.bindingHandlers.tags = { 8852 init: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8853 $(element).click(function () { 8854 $('input', $(element)).focus(); 8855 }); 8856 } 8857} 8858 8859ko.bindingHandlers.mask = (function () { 8860 var maskSet = false; 8861 8862 function setMask(element, pattern, uppercase) { 8863 if (!pattern) { 8864 $(element).unmask(); 8865 return false; 8866 } 8867 else { 8868 $(element).mask(pattern, { 8869 onChange: function (value, event) { 8870 if (uppercase) 8871 event.currentTarget.value = value.toUpperCase(); 8872 } 8873 }); 8874 return true; 8875 } 8876 } 8877 8878 return { 8879 init: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8880 var pattern = ko.unwrap(valueAccessor()); 8881 var value = allBindingsAccessor().value; 8882 var uppercase = allBindingsAccessor().uppercase || false; 8883 8884 maskSet = setMask(element, pattern, uppercase); 8885 8886 if (maskSet && value()) { 8887 var maskedValue = $(element).masked(value()); 8888 8889 if (uppercase) { 8890 maskedValue = maskedValue.toUpperCase(); 8891 } 8892 8893 value(maskedValue); 8894 } 8895 8896 }, 8897 update: function (element, valueAccessor, allBindingsAccessor, viewModel, context) { 8898 var pattern = ko.unwrap(valueAccessor()); 8899 var value = allBindingsAccessor().value; 8900 var uppercase = allBindingsAccessor().uppercase || false; 8901 8902 maskSet = setMask(element, pattern, uppercase); 8903
8904 if (maskSet && value() && uppercase) { 8905 var maskedValue = $(element).masked(value()).toUpperCase(); 8906 8907 value(maskedValue); 8908 $(element).val(maskedValue); 8909 } 8910 } 8911 } 8912})();; 8913var Notification = { 8914 newConnectionNotification: function (value) { 8915 $('#top-notification-connection').html('<span>' + value + '</span>'); 8916 }, 8917 clearConnectionNotification: function () { 8918 $('#top-notification-connection').html(''); 8919 }, 8920 newEmailNotification: function (value) { 8921 $('#top-notification-mail').html('<span>' + value + '</span>'); 8922 }, 8923 clearEmailNotification: function () { 8924 $('#top-notification-mail').html(''); 8925 }, 8926 newFlagNotification: function (value) { 8927 $('#top-notification-flag').html('<span>' + value + '</span>'); 8928 }, 8929 clearFlagNotification: function () { 8930 $('#top-notification-flag').html(''); 8931 } 8932};; 8933var viewstate = { 8934 get: function (key) { 8935 return amplify.store.sessionStorage && (amplify.store.sessionStorage(key) !== undefined) ? JSON.parse(amplify.store.sessionStorage(key)) : undefined; 8936 }, 8937 save: function (key, value, options) { 8938 if(amplify.store.sessionStorage) 8939 amplify.store.sessionStorage(key, JSON.stringify(value), options); 8940 }, 8941 delete: function (key) { 8942 if(amplify.store.sessionStorage) 8943 amplify.store.sessionStorage(key, null); 8944 } 8945};; 8946var SolutionConfig = (function() { 8947 8948 // Stores promises so the request won't be called twice 8949 var promise = []; 8950 var TEAM = 0; 8951 var PLAYER = 1; 8952 var GOALIE = 2; 8953 function get(solutionId, code) { 8954 var config = ko.observable(undefined); 8955 var promiseKey = solutionId; 8956 // Create promise from request or viewstate 8957 var promiseCode = getPromise(solutionId, code); 8958 8959 // When the promise is done, put the config value in the observable 8960 promiseCode.done(function(configData) { 8961 config(configData); 8962 }); 8963 8964 return config; 8965 } 8966 8967 function getPromise(solutionId, code) { 8968 var promiseKey = solutionId; 8969 8970 // Create promise from request or viewstat 8971 if(promise[promiseKey] == undefined) { 8972 if (viewstate.get('solutionData-' + solutionId) == undefined) { 8973 promise[promiseKey] = $.when(data.get(String.format('/api/solutions/{0}', solutionId))).then(function (a) { 8974 viewstate.save('solutionData-' + solutionId, a, { expires: 60000 }); 8975 return a.configs; 8976 }); 8977 } 8978 else 8979 { 8980 var solutionData = viewstate.get('solutionData-' + solutionId); 8981 promise[promiseKey] = $.Deferred().resolve(solutionData.configs).promise(); 8982 } 8983 } 8984 8985 return promise[promiseKey].then(function (configs) { 8986 var configData = Utilities.findObjectByAttribute(configs, code, 'Code', 'Value'); 8987 if(configData) { 8988 // Parse if possible, else put the value as is in the observable 8989 try { 8990 var configObject = JSON.parse(configData); 8991 return configObject; 8992 } 8993 catch(e) 8994 { 8995 return configData; 8996 } 8997 } 8998 else 8999 { 9000 return ""; 9001 } 9002 }); 9003 } 9004 9005 return { 9006 get: get, 9007 getPromise:Â getPromise 9008 } 9009})();; 9010var SmartIFrame = { 9011 9012 initialize: function() { 9013 parent.postMessage( 9014 { 9015 type: 'page-loading', 9016 value: { title: document.title, icon: 'https://www.kreezee.com/files/images/favicon.ico' } 9017 }, smartIFrame); 9018 }, 9019 9020 click: function (url, fallback, rootUrl) { 9021 var urlSegments = url.split('/'); 9022 9023 if (getUrlExtention(url) == null) { 9024 parent.postMessage( 9025 { 9026 type: 'click', 9027 value: typeof rootUrl === 'undefined' 9028 ? urlSegments[urlSegments.length - 1] 9029 : rootUrl + '/' + urlSegments[urlSegments.length - 1] 9030 }, smartIFrame); 9031 9032 return false; 9033 } else { 9034 return fallback; 9035 } 9036 }, 9037 9038 handleClickEvent: function (url, rootUrl) { 9039 if (smartIFrame) { 9040 return SmartIFrame.click(url, false, rootUrl) 9041 } 9042 9043 return true; 9044 }, 9045 9046 getUrl: function (url, rootUrl) { 9047 var urlSegments = url.split('/'); 9048 9049 if (getUrlExtention(url) == null) { 9050 return typeof rootUrl === 'undefined' 9051 ? smartIFrame + '/' + urlSegments[urlSegments.length - 1] 9052 : smartIFrame + '/' + rootUrl+ '/' + urlSegments[urlSegments.length - 1]; 9053 } else { 9054 return url; 9055 } 9056 } 9057 9058}; 9059 9060function getUrlExtention(url) { 9061 return /^.+\.([^.]+)$/.exec(url); 9062} 9063; 9064 9065 9066var league = { 9067 getById: function (solutionId, callback) { 9068 Utilities.getJSON(String.format('/api/leagues/{0}', solutionId), callback); 9069 }, 9070 9071 getBySolutionId: function(solutionId, callback) { 9072 Utilities.getJSON(String.format('/api/solutions/{0}/leagues', solutionId), callback); 9073 } 9074}; 9075 9076var season = (function () { 9077 var promiseSeason = null; 9078 return { 9079 getBySolutionId: function (solutionId, callback) { 9080 var promise = data.get(String.format('/api/leagues/{0}/seasons', solutionId), {}); 9081 if (callback) { 9082 promise.done(callback); 9083 } 9084 return promise 9085 }, 9086 9087 getById: function (solutionId, seasonId, callback) { 9088 var promise = data.get(String.format('/api/leagues/{0}/seasons/{1}', solutionId, seasonId), {}); 9089 if (callback) { 9090 promise.done(callback); 9091 } 9092 return promise 9093 }, 9094 9095 getParams: function (seasonId, callback) { 9096 Utilities.getJSON(String.format('/api/seasons/{0}/seasonparms', seasonId), callback); 9097 }, 9098 9099 getActive: function (solutionId) { 9100 if (promiseSeason == null) { 9101 if (viewstate.get('solutionData-' + solutionId) == undefined) { 9102 promiseSeason = $.when(data.get(String.format('/api/solutions/{0}', solutionId))).then(function (a) { 9103 viewstate.save('solutionData-' + solutionId, a, { expires: 180000 }); 9104 return a.DefaultSeasonId; 9105 }); 9106 } 9107 else { 9108 var solutionData = viewstate.get('solutionData-' + solutionId); 9109 promiseSeason = $.Deferred().resolve(solutionData.DefaultSeasonId).promise(); 9110 } 9111 } 9112 9113 return promiseSeason; 9114 } 9115 } 9116})(); 9117 9118var division = { 9119 getBySolutionId: function (solutionId, withTeam, callback) { 9120 var promise = data.get(String.format('/api/leagues/{0}/divisions?withTeam={1}', solutionId, withTeam), {}) 9121 9122 if(callback) { 9123 promise.done(callback); 9124 } 9125 9126 return promise; 9127 }, 9128 9129 getBySeasonId: function (seasonId) { 9130 return data.get(String.format('/api/seasons/{0}/divisions', seasonId), {}); 9131 }, 9132 9133}; 9134 9135var leader = { 9136 getDefaultLeaderBySolutionId: function (solutionId, seasonTypeId, seasonId, teamId, divisionId) { 9137 var queryKeyValue = { seasonTypeId: seasonTypeId, seasonId: seasonId, teamId: teamId, divisionId: divisionId } 9138 9139 return data.get(String.format('/api/solution/{0}/leaders{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9140 } 9141} 9142 9143var team = { 9144 9145 getBySolutionId: function (solutionId, callback) { 9146 Utilities.getJSON(String.format('/api/leagues/{0}/teams', solutionId), callback); 9147 }, 9148 9149 getBySolutionIdV2: function(solutionId, seasonId, divisionId, page, pageSize, sortColumn, sortOrder, searchText) { 9150 var queryKeyValue = { seasonId: seasonId, divisionId: divisionId, 9151 page: page, pageSize: pageSize, sortColumn: sortColumn, sortOrder: sortOrder, searchText: searchText } 9152 9153 return data.get(String.format('/api2/leagues/{0}/teams{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9154 }, 9155 9156 getActiveBySolutionId: function (solutionId, seasonId, divisionId, page, pageSize, sortColumn, sortOrder, searchText) { 9157 var queryKeyValue = { seasonId: seasonId, divisionId: divisionId, 9158 page: page, pageSize: pageSize, sortColumn: sortColumn, sortOrder: sortOrder, searchText: searchText } 9159 9160 return data.get(String.format('/api/leagues/{0}/teams/active{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9161 }, 9162 9163 getBySeasonId: function (solutionId, seasonId) { 9164 return data.get(String.format('/api/leagues/{0}/seasons/{1}/teams', solutionId, seasonId), {}); 9165 }, 9166 9167 getStatsByTeamId: function(solutionId, teamId, seasonTypeId, seasonId) { 9168 var queryKeyValue = { seasonTypeId: seasonTypeId, seasonId: seasonId } 9169 9170 return data.get(String.format('/api/leagues/{0}/teams/{1}/stats{2}', solutionId, teamId, Utilities.buildQueryString(queryKeyValue)), {}); 9171 }, 9172 9173 getStatsBySeasonTeamId: function(solutionId, teamId) { 9174 return data.get(String.format('/api/leagues/{0}/teams/{1}/seasons/stats', solutionId, teamId), {}); 9175 }, 9176 9177 getLeaders: function(solutionId, seasonTypeId, seasonId, teamId) { 9178 var queryKeyValue = { seasonTypeId: seasonTypeId, seasonId: seasonId, teamId: teamId } 9179 9180 return data.get(String.format('/api/leagues/{0}/teams/leaders{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9181 }, 9182 9183 getTeamsStatsBySolutionId: function (solutionId, page, pageSize, sortStatId, sortColumn, sortOrder, seasonTypeId, seasonId, divisionId, automatedStats) { 9184 var queryKeyValue = { page: page, pageSize: pageSize, sortStatId: sortStatId, sortColumn: sortColumn, 9185 sortOrder: sortOrder, seasonTypeId: seasonTypeId, seasonId: seasonId, divisionId: divisionId, automatedStats: automatedStats } 9186 9187 return data.get(String.format('/api/leagues/{0}/teams/stats{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9188 }, 9189 9190 getById: function (solutionId, teamId, callback) { 9191 Utilities.getJSON(String.format('/api/leagues/{0}/teams/{1}', solutionId, teamId), callback); 9192 }, 9193 9194 follow: function(teamId, userId) { 9195 return data.put(String.format('/api/data-cache/teams/{0}/follow/{1}', teamId, userId)); 9196 }, 9197 9198 unfollow: function (teamId, userId) { 9199 return data.put(String.format('/api/data-cache/teams/{0}/unfollow/{1}', teamId, userId)); 9200 } 9201}; 9202 9203var player = { 9204 9205 getPlayersStatsBySolutionId: function(solutionId, sortStatId, sortColumn, page, pageSize, sortOrder, seasonTypeId, seasonId, positionType, positionId, divisionId, teamId) { 9206 var queryKeyValue = { page: page, pageSize: pageSize, sortOrder: sortOrder, sortStatId: sortStatId, sortColumn: sortColumn, 9207 seasonTypeId: seasonTypeId, seasonId: seasonId, positionType: positionType, positionId: positionId, divisionId: divisionId, teamId: teamId }; 9208 9209 return data.get(String.format('/api/leagues/{0}/players/stats{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9210 }, 9211 9212 getLeaders: function(solutionId, seasonTypeId, seasonId, teamId, divisionId, positionId) { 9213 var queryKeyValue = { seasonTypeId: seasonTypeId, seasonId: seasonId, teamId: teamId, divisionId: divisionId, positionId: positionId } 9214 9215 return data.get(String.format('/api/leagues/{0}/players/leaders{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9216 }, 9217 9218 getLeaderByStatsId: function(solutionId, statsId, seasonId, seasonTypeId, teamId) { 9219 var queryKeyValue = { seasonId: seasonId, seasonTypeId: seasonTypeId, teamId: teamId }; 9220 9221 return data.get(String.format('/api/leagues/{0}/players/stats/{1}/leaders{2}', solutionId, statsId, Utilities.buildQueryString(queryKeyValue)), {}); 9222 }, 9223 9224 getBySolutionId: function (solutionId, page, pageSize, sortColumn, sortOrder, searchText, positionId) { 9225 var queryKeyValue = { page: page, 9226 pageSize: pageSize, 9227 sort: sortOrder && sortColumn ? (String.format('{0}{1}', typeof sortOrder != 'undefined' ? sortOrder : '+', sortColumn)) : undefined, 9228 search: searchText ||Â '', 9229 positionId: positionId } 9230 var queryString = Utilities.buildQueryString(queryKeyValue); 9231 9232 return data.get(String.format('/api2/leagues/{0}/players{1}', solutionId, queryString), {}); 9233 }, 9234 9235 getByTeamId: function (teamId, callback) { 9236 Utilities.getJSON(String.format('/api/teams/{0}/players', teamId), callback); 9237 }, 9238 9239 getPlayersStatsByTeamId: function (solutionId, teamId, seasonId) { 9240 var queryKeyValue = { seasonId: seasonId }; 9241 var queryString = Utilities.buildQueryString(queryKeyValue); 9242 9243 return data.get(String.format('/api/leagues/{0}/team/{1}/players/stats{2}', solutionId, teamId, queryString), {}); 9244 }, 9245 9246 getByTeamMatchId: function(teamId, matchId, callback) 9247 { 9248 Utilities.getJSON(String.format('/api/matchs/{0}/teams/{1}/players', matchId, teamId), callback); 9249 }, 9250 9251 getById: function (solutionId, playerId, callback) { 9252 Utilities.getJSON(String.format('/api/leagues/{0}/players/{1}', solutionId, playerId), callback); 9253 }, 9254 9255 getByIdV2: function(playerId, solutionId, seasonId, seasonTypeId, teamId, positionId) 9256 { 9257 var queryKeyValue = { seasonTypeId: seasonTypeId, seasonId: seasonId, teamId: teamId, positionId: positionId }; 9258 var queryString = Utilities.buildQueryString(queryKeyValue); 9259 9260 return data.get(String.format('/api2/leagues/{0}/players/{1}{2}', solutionId, playerId, queryString), {}); 9261 }, 9262 9263 getBySeasonPlayerId: function(playerId, solutionId) { 9264 return data.get(String.format('/api/leagues/{0}/players/{1}/seasons/stats', solutionId, playerId), {}); 9265 }, 9266 9267 getStarsByMatchId: function(matchId, callback) 9268 { 9269 Utilities.getJSON(String.format('/api/matchs/{0}/stars', matchId), callback); 9270 } 9271}; 9272 9273var sportCenter = { 9274 getDetailsBySolutionId: function (solutionId, callback) { 9275 Utilities.getJSON(String.format('/api/leagues/{0}/sportscentersdetails', solutionId), callback); 9276 }, 9277 9278 getBySolutionId: function (solutionId, callback) { 9279 Utilities.getJSON(String.format('/api/leagues/{0}/sportscenters', solutionId), callback); 9280 }, 9281 9282 getById: function (solutionId, sportCenterId, callback) { 9283 // Utilities.getJSON(String.format('/api/leagues/{0}/sportscenters/{1}', solutionId, sportCenterId), callback); 9284 return data.get(String.format('/api/leagues/{0}/sportscenters/{1}', solutionId, sportCenterId)); 9285 }, 9286 9287 getStatusBySolutionId: function (solutionId) { 9288 return data.get(String.format('/api/leagues/{0}/facilities/state', solutionId)); 9289 } 9290}; 9291 9292var staff = { 9293 getBySolutionId: function (solutionId, callback) { 9294 Utilities.getJSON(String.format('/api/leagues/{0}/staffs', solutionId), callback); 9295 }, 9296 9297 getByTeamId: function (teamId, callback) { 9298 Utilities.getJSON(String.format('/api/teams/{0}/staffs', teamId), callback); 9299 } 9300}; 9301 9302var medias = { 9303 news: {
9304 getBySolutionId: function (solutionId, maxItems, callback) { 9305 if (maxItems != null) { 9306 Utilities.getJSON(String.format('/api/leagues/{0}/news?maxItems={1}', solutionId, maxItems), callback); 9307 } else { 9308 Utilities.getJSON(String.format('/api/leagues/{0}/news', solutionId), callback); 9309 } 9310 9311 }, 9312 9313 getBySolutionIdV2: function(solutionId, page, pageSize, searchText, sortOrder, sortColumn) { 9314 var queryKeyValue = { searchText: searchText, sortOrder: sortOrder, sortColumn: sortColumn, page: page, pageSize: pageSize}; 9315 return data.get(String.format('/api2/leagues/{0}/news{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9316 }, 9317 9318 getById: function (solutionId, newsId, callback) { 9319 Utilities.getJSON(String.format('/api/leagues/{0}/news/{1}', solutionId, newsId), callback); 9320 } 9321 }, 9322 9323 video: { 9324 getBySolutionId: function (solutionId, callback) { 9325 Utilities.getJSON(String.format('/api/solutions/{0}/videos', solutionId), callback); 9326 }, 9327 9328 getBySolutionIdWithDeferred: function(solutionId) { 9329 return data.get(String.format('/api/solutions/{0}/videos', solutionId)); 9330 }, 9331 9332 getById: function (solutionId, videoId, callback) { 9333 Utilities.getJSON(String.format('/api/leagues/{0}/videos/{1}', solutionId, videoId), callback); 9334 } 9335 }, 9336 9337 photo: { 9338 getBySolutionId: function (solutionId, callback) { 9339 Utilities.getJSON(String.format('/api/leagues/{0}/photos', solutionId), callback); 9340 }, 9341 9342 getById: function (solutionId, photoId, callback) { 9343 Utilities.getJSON(String.format('/api/leagues/{0}/photos/{1}', solutionId, photoId), callback); 9344 } 9345 }, 9346 9347 album: { 9348 getBySolutionId: function (solutionId, callback) { 9349 Utilities.getJSON(String.format('/api/leagues/{0}/albums', solutionId), callback); 9350 } 9351 } 9352}; 9353 9354//var data = { 9355// provinces: { 9356// getProvinces: function (culture, calback) { 9357// Utilities.getJSON(String.format('/api/data/provinces', solutionId), callback); 9358// } 9359// } 9360//}; 9361 9362var stats = { 9363 getBySolutionId: function (solutionId, callback) { 9364 Utilities.getJSON(String.format('/api/leagues/{0}/stats', solutionId), callback); 9365 }, 9366 getBySolutionIdStatsTeam: function (solutionId, callback) { 9367 Utilities.getJSON(String.format('/api/leagues/{0}/statsteam', solutionId), callback); 9368 }, 9369 getPlayersStatsById: function (playerId, callback) { 9370 Utilities.getJSON(String.format('/api/players/{0}/stats', playerId), callback); 9371 }, 9372 getPlayersStatsByTeamId: function (teamId, callback) { 9373 Utilities.getJSON(String.format('/api/teams/{0}/stats', teamId), callback); 9374 }, 9375 getLeagueLeaderBySeasonId: function (seasonId, callback) { 9376 Utilities.getJSON(String.format('/api/seasons/{0}/statsteamleaders', seasonId), callback); 9377 }, 9378 getPlayersStatsBySeasonActiveTeamId: function (teamId, callback) { 9379 Utilities.getJSON(String.format('/api/teams/{0}/statsactive', teamId), callback); 9380 }, 9381 getTeamStatsByTeamId: function (teamId, callback) { 9382 Utilities.getJSON(String.format('/api/teams/{0}/statsteam', teamId), callback); 9383 }, 9384 9385 getStatsPlayerLeadersBySolutionId: function (solutionId, callback) { 9386 Utilities.getJSON(String.format('/api/leagues/{0}/statsleaders', solutionId), callback); 9387 }, 9388 getStatsPlayerLeadersBySeasonId: function (seasonId, callback) { 9389 Utilities.getJSON(String.format('/api/seasons/{0}/statsleaders', seasonId), callback); 9390 }, 9391 9392 getStatsTeamLeadersBySolutionId: function (solutionId, callback) { 9393 Utilities.getJSON(String.format('/api/leagues/{0}/statsteamleaders', solutionId), callback); 9394 }, 9395 getStatsTeamLeadersBySeasonId: function (seasonId, callback) { 9396 Utilities.getJSON(String.format('/api/seasons/{0}/statsteamleaders/', seasonId), callback); 9397 }, 9398 getStatsTeamLeadersBySolutionIdAndSeasonTypeId: function (solutionId, seasonTypeId, callback) { 9399 Utilities.getJSON(String.format('/api/leagues/{0}/seasontype/{1}/statsteamleaders', solutionId, seasonTypeId), callback); 9400 }, 9401 9402 getStatsReportByMatchId: function (matchId, callback) { 9403 Utilities.getJSON(String.format('/api/match/{0}/stats', matchId), callback); 9404 } 9405}; 9406 9407var suspension = { 9408 getBySolutionId: function(solutionId, page, pageSize, sortOrder, sortColumn, seasonTypeId, seasonId, divisionId) { 9409 var queryKeyValue = { sortOrder: sortOrder, sortColumn: sortColumn, page: page, pageSize: pageSize, seasonTypeId: seasonTypeId, seasonId: seasonId, divisionId: divisionId}; 9410 9411 return data.get(String.format('/api/leagues/{0}/suspensions{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9412 }, 9413} 9414 9415var user = { 9416 changeLanguage: function (culture) { 9417 var jData = {}; 9418 jData.culture = culture; 9419 9420 return data.post(config.webService.wsUser + 'ChangeLanguage', jData); 9421 }, 9422 9423 getUserDataCache: function (userId) {
9424 var cookie = Utilities.getCookie('__DataCacheUser__'); 9425 9426 if (cookie) { 9427 return $.Deferred().resolve(JSON.parse(cookie)).promise(); 9428 } 9429 else { 9430 return data.get(String.format('/api/data-cache/users/{0}', userId)).then(function (result) { 9431 Utilities.setCookie('__DataCacheUser__', JSON.stringify(result), 2); 9432 return result; 9433 }); 9434 } 9435 }, 9436 9437 updateUserDataCacheCookie: function (user) { 9438 Utilities.setCookie('__DataCacheUser__', JSON.stringify(user), 1); 9439 } 9440} 9441 9442var game = { 9443 getBySolutionId: function(solutionId, startDate, endDate) { 9444 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9445 9446 return data.get(String.format('/api/leagues/{0}/matchs{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9447 }, 9448 getGameBarBySolutionId: function(solutionId) { 9449 var queryKeyValue = { maxGame: 30 || null, delayDay: 30 || null }; 9450 return data.get(String.format('/api/leagues/{0}/matchs/bargame{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9451 }, 9452 getByTeamId: function(teamId, startDate, endDate) { 9453 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9454 9455 return data.get(String.format('/api/teams/{0}/matchs{1}', teamId, Utilities.buildQueryString(queryKeyValue)), {}); 9456 }, 9457 getById: function(solutionId, matchId, callback) { 9458 Utilities.getJSON(String.format('/api/leagues/{0}/matchs/{1}', solutionId, matchId), callback); 9459 }, 9460 getDetailsById: function(solutionId, matchId) { 9461 return data.get(String.format('/api/leagues/{0}/matchdetails/{1}', solutionId, matchId), {}); 9462 }, 9463 getBySeasonId: function(seasonId, startDate, endDate) { 9464 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9465 9466 return data.get(String.format('/api/seasons/{0}/matchs{1}', seasonId, Utilities.buildQueryString(queryKeyValue)), {}); 9467 } 9468}; 9469 9470var schedule = { 9471 getBySolutionId: function (solutionId, startDate, endDate) { 9472 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9473 9474 return data.get(String.format('/api/solution/{0}/schedule{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9475 }, 9476 getByTeamId: function(teamId, startDate, endDate) { 9477 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9478 9479 return data.get(String.format('/api/teams/{0}/schedule{1}', teamId, Utilities.buildQueryString(queryKeyValue)), {}); 9480 }, 9481 getBySeasonId: function(seasonId, startDate, endDate) { 9482 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9483 9484 return data.get(String.format('/api/seasons/{0}/schedule{1}', seasonId, Utilities.buildQueryString(queryKeyValue)), {}); 9485 }, 9486 getBySeasonTeamId: function(seasonId, teamId, startDate, endDate) { 9487 var queryKeyValue = { startDate: startDate || null, endDate: endDate || null }; 9488 9489 return data.get(String.format('/api/seasons/{0}/teams/{1}/schedule{2}', seasonId, teamId, Utilities.buildQueryString(queryKeyValue)), {}); 9490 } 9491}; 9492 9493var shop = { 9494 product: { 9495 getBySolutionId: function(solutionId, page, pageSize, sortOrder, sortColumn) { 9496 var queryKeyValue = { 9497 page: page, pageSize: pageSize, sortOrder: sortOrder, sortColumn: sortColumn 9498 }; 9499 9500 return data.get(String.format('/api/v1/shop/{0}/products{1}', solutionId, Utilities.buildQueryString(queryKeyValue)), {}); 9501 }, 9502 getById: function(solutionId, productId) { 9503 return data.get(String.format('/api/v1/shop/{0}/products/{1}', solutionId, productId), {}); 9504 } 9505 }, 9506 9507 photo: { 9508 getByProductId: function (solutionId, productId) { 9509 return data.get(String.format('/api/v1/shop/{0}/products/{1}/photos', solutionId, productId), {}); 9510 } 9511 }, 9512 9513 variant: { 9514 getByProductId: function (solutionId, productId) { 9515 return data.get(String.format('/api/v1/shop/{0}/products/{1}/variants', solutionId, productId), {}); 9516 } 9517 }, 9518 9519 variantOption: { 9520 getByVariantId: function (solutionId, productId, variantId) { 9521 return data.get(String.format('/api/v1/shop/{0}/products/{1}/variants/{2}/options', solutionId, productId, variantId), {}); 9522 } 9523 }, 9524 9525 variantCombination: { 9526 getByVariantOptionId: function (solutionId, productId, variantId, variantOptionId1, variantOptionId2, variantOptionId3) { 9527 var queryKeyValue = { 9528 variantOptionId1: variantOptionId1, variantOptionId2: variantOptionId2, variantOptionId3: variantOptionId3 9529 }; 9530 9531 return data.get(String.format('/api/v1/shop/{0}/products/{1}/variants/{2}/combinations{3}', solutionId, productId, variantId, Utilities.buildQueryString(queryKeyValue)), {}); 9532 } 9533 } 9534} 9535 9536var solution = (function () { 9537 var promise = null; 9538 var sportPromises = {}; 9539 return { 9540 getById: function (solutionId, callback) { 9541 Utilities.getJSON(String.format('/api/solutions/{0}', solutionId), callback); 9542 }, 9543 9544 getByIdWithStorage: function (solutionId) { 9545 if (promise == null) { 9546 if (viewstate.get('solutionData-' + solutionId) == undefined) { 9547 promise = $.when(data.get(String.format('/api/solutions/{0}', solutionId))).then(function (a) { 9548 viewstate.save('solutionData-' + solutionId, a, { expires: 180000 }); 9549 return this; 9550 }); 9551 } 9552 else { 9553 var solutionData = viewstate.get('solutionData-' + solutionId); 9554 if (solutionData.Culture != null && solutionData.Culture != "" && solutionData.Culture != culture) { 9555 viewstate.delete('solutionData-' + solutionId) 9556 promise = $.when(data.get(String.format('/api/solutions/{0}', solutionId))).then(function (a) { 9557 viewstate.save('solutionData-' + solutionId, a, { expires: 180000 }); 9558 return this; 9559 }); 9560 } 9561 else { 9562 promise = $.Deferred().resolve(solutionData).promise(); 9563 } 9564 } 9565 } 9566 9567 return promise; 9568 }, 9569 9570 getSport: function (solutionId) { 9571 if (viewstate.get('solutionData-' + solutionId) == undefined) { 9572 var jData = {}; 9573 jData.solutionId = solutionId; 9574 var solution = Utilities.postJSON(config.webService.wsSolution + 'GetPublic', jData); 9575 viewstate.save('solutionData-' + solutionId, solution, { expires: 180000 }); 9576 return solution.SportId; 9577 } 9578 else { 9579 var solution = viewstate.get('solutionData-' + solutionId); 9580 return solution.SportId; 9581 } 9582 }, 9583 9584 isFormLimitReached: function (formId) { 9585 return data.get(`/api/form/${formId}/limit`); 9586 }, 9587 9588 follow: function (solutionId, userId) { 9589 return data.put(String.format('/api/data-cache/solutions/{0}/follow/{1}', solutionId, userId)); 9590 }, 9591 9592 unfollow: function (soluionId, userId) { 9593 return data.delete(String.format('/api/data-cache/solutions/{0}/unfollow/{1}', solutionId, userId)); 9594 } 9595 } 9596})(); 9597 9598(function () { 9599 window.addEventListener('message', receiveMessage, false); 9600 9601 function receiveMessage(e) { 9602 if (e.origin.indexOf('kreezee.com') != -1) { 9603 if ((typeof e.data !== 'undefined') 9604 && (typeof e.data.iframe !== 'undefined')) { 9605 var iframe = document.getElementById(e.data.iframe); 9606 iframe.parentNode.removeChild(iframe); // Remove iframe. 9607 } 9608 return; 9609 } 9610 } 9611})();; 9612ko.validation.rules['postal_code'] = { 9613 validator: function (val, countryId) { 9614 if(val == '' || val == null || val == undefined) { 9615 return true; 9616 } 9617 9618 switch(countryId())//switch sur le id du pays 9619 { 9620 case 1://CANADA 9621 var patt = new RegExp("^([ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ])\\ {0,1}(\\d[ABCEGHJKLMNPRSTVWXYZ]\\d)$"); 9622 return patt.test(val); 9623 break; 9624 case 2://UNITED-STATES 9625 var patt = new RegExp("^\\d{5}([\\-]?\\d{4})?$"); 9626 return patt.test(val); 9627 break; 9628 default://NONE SELECTED 9629 return true; 9630 break; 9631 //Autre regEx !!!!Note!!!! (Dans les regEx, pour echaper un caractère, il faut mettre "\\" et non "\" {à changer}) !!!! 9632 /*"US" => "^\d{5}([\-]?\d{4})?$", 9633 "UK" => "^(GIR|[A-Z]\d[A-Z\d]??|[A-Z]{2}\d[A-Z\d]??)[ ]??(\d[A-Z]{2})$" , 9634 "DE" => "\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b" , 9635 "CA" => "^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])\ {0,1}(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$" , 9636 "FR" => "^(F-)?((2[A|B])|[0-9]{2})[0-9]{3}$" , 9637 "IT" => "^(V-|I-)?[0-9]{5}$" , 9638 "AU" => "^(0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2}
9638)|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2})$" , 9639 "NL" => "^[1-9][0-9]{3}\s?([a-zA-Z]{2})?$" , 9640 "ES" => "^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$" , 9641 "DK" => "^([D-d][K-k])?( |-)?[1-9]{1}[0-9]{3}$" , 9642 "SE" => "^(s-|S-){0,1}[0-9]{3}\s?[0-9]{2}$" , 9643 "BE" => "^[1-9]{1}[0-9]{3}$" */ 9644 } 9645 }, 9646 message: 'CountryId error' 9647}; 9648 9649// Is valid if the number isNaN or if the number is greater or equal to test variable 9650ko.validation.rules['is_higher_than'] = { 9651 validator: function (val, observableMin) { 9652 var observableVal = ko.unwrap(observableMin); 9653 if (val != undefined && observableVal != undefined) 9654 { 9655 return val >= observableVal; 9656 } 9657 return true; 9658 }, 9659 message: 'Must be higher than min', 9660}; 9661 9662ko.validation.rules['is_lower_than'] = { 9663 validator: function (val, observableMax) { 9664 var observableVal = ko.unwrap(observableMax); 9665 if (val != undefined && observableVal != undefined) 9666 { 9667 return val <= observableVal; 9668 } 9669 return true; 9670 }, 9671 message: 'Must be lower than max' 9672}; 9673 9674ko.validation.rules['basic_phone'] = { 9675 validator: function (val) { 9676 var patt = new RegExp("^[0-9\\(\\)\\-\\#\\ ]*$"); 9677 return patt.test(val); 9678 }, 9679 message: 'Valide phone number' 9680}; 9681 9682 9683 9684//Passer un array[3] en params avec {year: month: day:} !!!!!! 9685ko.validation.rules['validate_group_date'] = { 9686 validator: function (val, dates) { 9687 if ((dates.year() && dates.month() && dates.day()) || (!dates.year() && !dates.month() && !dates.day())) 9688 { 9689 return true; 9690 } 9691 else 9692 { 9693 if( !val ) 9694 { 9695 return false; 9696 } 9697 else 9698 { 9699 return true; 9700 } 9701 } 9702 }, 9703 message: 'validate groupdate. return true if all selected or non selected' 9704}; 9705 9706ko.validation.rules['validate_group_date_moment'] = { 9707 validator: function (val, dates) { 9708 var momentDate = moment({ y: dates.year(), M: dates.month(), d: dates.day() }); 9709 if (momentDate.isValid()) { 9710 return true; 9711 } 9712 else { 9713 if (!val) { 9714 return false; 9715 } 9716 else { 9717 return true; 9718 } 9719 } 9720 }, 9721 message: 'validate groupdate. return true if all selected or non selected' 9722}; 9723 9724//Passer un array[6] en params avec {year: month: day:} !!!!!! 9725ko.validation.rules['group_date_is_after'] = { 9726 validator: function (val, dates) { 9727 9728 var oldDate = new Date(dates.olderYear(), dates.olderMonth(), dates.olderDay()); 9729 var newerDate = new Date(dates.newerYear(), dates.newerMonth(), dates.newerDay()); 9730 9731 if ( dates.olderYear() && dates.olderMonth() && dates.olderDay() 9732 && dates.newerYear() && dates.newerMonth() && dates.newerDay()) 9733 { 9734 return oldDate.getTime() < newerDate.getTime(); 9735 } 9736 9737 return true; 9738 }, 9739 message: 'Return true if newer date is after olderDate' 9740}; 9741 9742ko.validation.rules['areSame'] = { 9743 getValue: function (o) { 9744 return (typeof o === 'function' ? o() : o); 9745 }, 9746 validator: function (val, otherField) { 9747 return val === this.getValue(otherField); 9748 }, 9749 message: 'The fields must have the same value' 9750}; 9751 9752ko.validation.rules['verifyEmail'] = { 9753 async: true, 9754 validator: function (val, params, callback) { 9755 if (val === '') 9756 { 9757 callback(true); 9758 return; 9759 } 9760 9761 email.verify(val).then(function (result) { callback(result.IsValid) }); 9762 }, 9763 message: language.validation.verifyEmail 9764}; 9765 9766ko.validation.rules['url'] = { 9767 validator: function (val) { 9768 if (!val) { 9769 return true; 9770 } 9771 9772 val = val.replace(/^\s+|\s+$/, ''); //Strip whitespace 9773 //Regex by Diego Perini from: http://mathiasbynens.be/demo/url-regex 9774 return val.match(/^(?:(?:https?):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.ââ\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[ââ6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1ââ,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00ââa1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\uââ00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/i); 9775 }, 9776 message: language.validation.invalidUrl 9777}; 9778
9779ko.validation.registerExtenders();; 9780function DataTable(options) 9781{ 9782 var self = this; 9783 var elementId = options.elementId ? '#' + options.elementId : "#players-list-v2"; 9784 9785 initializeObservables(); 9786 9787 self.sortByColumn = function(data) { 9788 if ((typeof data.sortable !== 'undefined') && (data.sortable)) { 9789 $(elementId + ' .asc').removeClass('asc'); 9790 $(elementId + ' .desc').removeClass('desc'); 9791 9792 if(data.id == self.sortColumn()) { 9793 $(elementId + ' #' + data.id).removeClass(data.order); 9794 data.order = data.order == 'asc' ? 'desc' : 'asc'; 9795 $(elementId + ' #' + data.id).addClass(data.order); 9796 } 9797 else { 9798 data.order = data.defaultOrder || 'asc' ; 9799 $(elementId + ' #' + data.id).addClass(data.order); 9800 } 9801 9802 self.sortColumn(data.id); 9803 self.sortOrder(data.order); 9804 options.onSortColumn(data.id, data.order); 9805 $(elementId + ' tr td').css('font-weight', 'normal'); 9806 $(elementId + ' tr td:nth-child(' + ($(elementId + ' .asc, ' + elementId + ' .desc').index() + 1) + ')').css('font-weight', 'bold'); 9807 } 9808 }; 9809 9810 self.sort = function(sortColumn, sortOrder) { 9811 if(sortColumn == null) { 9812 self.sortColumn(undefined); 9813 self.sortOrder(undefined); 9814 $(elementId + ' tr td').css('font-weight', 'normal'); 9815 } 9816 else { 9817 var column = Utilities.findObjectByAttribute(self.columns(), sortColumn, 'id'); 9818 if(!column) 9819 { 9820 throw RangeException(sortColumn + ' doesn\'t exists'); 9821 } 9822 9823 if (column.sortable) { 9824 $(elementId + ' .asc').removeClass('asc'); 9825 $(elementId + ' .desc').removeClass('desc'); 9826 9827 column.order = sortOrder ; 9828 $(elementId + ' #' + data.id).addClass(column.order); 9829 9830 self.sortColumn(sortColumn); 9831 self.sortOrder(sortOrder); 9832 options.onSortColumn(sortColumn, sortOrder); 9833 $(elementId + ' tr td').css('font-weight', 'normal'); 9834 $(elementId + ' tr td:nth-child(' + ($(elementId + ' .asc, ' + elementId + ' .desc').index() + 1) + ')').css('font-weight', 'bold'); 9835 } 9836 } 9837 } 9838 9839 self.bind = function (response, column1Callback) { 9840 var Results = response.results || response.Results || []; 9841 var TotalPages = response.TotalPages || Math.ceil(response.TotalCount / (response.PageSize || 10)) || 0; 9842 var CurrentPage = response.Page || self.currentPage(); 9843 9844 if(Results.length == 0 && $.isArray(response)) 9845 { 9846 Results = response; 9847 } 9848 9849 if(TotalPages == 0) { 9850 self.currentPage(''); 9851 } 9852 else { 9853 self.currentPage(CurrentPage > TotalPages ? TotalPages : CurrentPage); 9854 } 9855 self.totalPages(TotalPages); 9856 9857 if (typeof column1Callback !== 'undefined') { 9858 self.column1Callback = column1Callback; 9859 } 9860 9861 // Load data into the list array. 9862 self.list(Results); 9863 $(elementId + ' tr td:nth-child(' + ($(elementId + ' .asc, ' + elementId + ' .desc').index() + 1) + ')').css('font-weight', 'bold'); 9864 9865 // Create paging control. 9866 createPaging(); 9867 }; 9868 9869 self.onPageClick = function(data) { 9870 if ((data.enabled) && (!data.active)) { 9871 if (data.value == 'previousButton') { 9872 self.currentPage(self.currentPage() - 1); 9873 } else if (data.value == 'nextButton') { 9874 self.currentPage(self.currentPage() + 1); 9875 } else { 9876 self.currentPage(data.value); 9877 } 9878 9879 if (typeof options.onPageClick !== 'undefined') { 9880 options.onPageClick(self.currentPage()); 9881 } 9882 } 9883 }; 9884 9885 self.classNameHeader = function(data) { 9886 if (data.sortable) { 9887 var className = ''; 9888 if ((typeof data.className !== 'undefined') && (data.className.length > 0)) { 9889 className = String.format('{0} sorting', data.className); 9890 } else { 9891 className = 'sorting'; 9892 } 9893 9894 return className += (data.id == self.sortColumn() ? ' ' + self.sortOrder() : ''); 9895 } else { 9896 if ((typeof data.className !== 'undefined') && (data.className.length > 0)) { 9897 return data.className; 9898 } 9899 } 9900 9901 return ''; 9902 }; 9903 9904 self.classNamePaging = function(data) { 9905 var className = ''; 9906 9907 if ((data.value === 'previousButton') && (self.currentPage() == 1)) { 9908 return 'disabled'; 9909 } 9910 9911 if (data.value === 'ellipsisButton') { 9912 return 'disabled'; 9913 } 9914 9915 if ((data.value === 'nextButton') && (self.currentPage() == self.totalPages())) { 9916 return 'disabled'; 9917 } 9918 9919 if (data.value === self.currentPage()) { 9920 return 'active'; 9921 } 9922 return className; 9923 }; 9924 9925 function initializeObservables() { 9926 self.noDataAvailable = language.datatable.sEmptyTable; // TODO translate 9927 self.currentPage = ko.observable(''); 9928 self.totalPages = ko.observable(''); 9929 self.columns = ko.observableArray(options.columns); 9930 self.columnsCount = ko.observable(self.columns().length);
9931 self.sortColumn = ko.observable(options.defaultSortColumn || ''); 9932 self.sortOrder = ko.observable(options.defaultSortOrder || 'asc'); 9933 self.elementId = options.elementId ? options.elementId : "players-list-v2"; 9934 9935 self.list = ko.observableArray([]); 9936 self.paging = ko.observableArray([]); 9937 } 9938 9939 var breakDown = 500; 9940 var isSmallScreen = window.innerWidth <= breakDown; 9941 function createPaging() { 9942 var paging = []; 9943 var maxDisplayedPages = 7; 9944 var nextLabel = language.datatable.oPaginate.sNext; 9945 var previousLabel = language.datatable.oPaginate.sPrevious; 9946 9947 if(isSmallScreen) { 9948 maxDisplayedPages = 5; 9949 nextLabel = '>'; 9950 previousLabel = '<'; 9951 } 9952 9953 var pagesWithoutEllipsis = maxDisplayedPages - 2; 9954 var pages = self.totalPages() <= maxDisplayedPages ? self.totalPages() : pagesWithoutEllipsis; 9955 var startIndex = 1; 9956 // Add previous page button. 9957 paging.push({ text: previousLabel, enabled: self.currentPage() == 1 ? false : true, active: false, value: 'previousButton' }); 9958 9959 if (self.currentPage() >= pagesWithoutEllipsis && (self.totalPages() > maxDisplayedPages)) { 9960 if (self.currentPage() <= self.totalPages() - (pagesWithoutEllipsis - 1)) { 9961 paging.push({ text: 1, active: false, enabled: true, value: 1 }); 9962 paging.push({ text: '...', enabled: false }); 9963 pages = pagesWithoutEllipsis - 2; 9964 startIndex = self.currentPage() - ((pages - 1) / 2); 9965 9966 } else { 9967 paging.push({ text: 1, active: false, enabled: true, value: 1 }); 9968 paging.push({ text: '...', enabled: false }); 9969 startIndex = self.totalPages() - (pagesWithoutEllipsis - 1); 9970 pages = pagesWithoutEllipsis; 9971 } 9972 } 9973 9974 for (var i = startIndex; i <= startIndex + pages - 1; i++) { 9975 paging.push({ text: i, enabled: true, active: self.currentPage() == i ? true : false, value: i }); 9976 } 9977 9978 if ((self.totalPages() > maxDisplayedPages) && (self.currentPage() <= self.totalPages() - (pagesWithoutEllipsis - 1))) { 9979 paging.push({ text: '...', enabled: false, active: false, value: 'ellipsisButton'}); 9980 paging.push({ text: self.totalPages(), enabled: true, active: false, value: parseInt(self.totalPages()) }); 9981 } 9982 9983 // Add next page button. 9984 paging.push({ text: nextLabel, enabled: self.currentPage() == self.totalPages() ? false : true, active: false, value: 'nextButton' }); 9985 9986 self.paging(paging); 9987 } 9988 9989 $(window).resize(function () { 9990 if ((isSmallScreen && window.innerWidth > breakDown) || (!isSmallScreen && window.innerWidth <= breakDown)) 9991 { 9992 isSmallScreen = !isSmallScreen; 9993 createPaging(); 9994 } 9995 }); 9996} 9997 9998$.fn.kzDatatable = function(options) { 9999 return new DataTable(options); 10000}; 10001var dataMapping = { 10002 hockeyGoalQualifier: { 10003 event: { id: 161, name: 'Event' }, 10004 advantage: { id: 162, name: 'Advantage' }, 10005 disadvantage: { id: 163, name: 'Disadvantage' }, 10006 emptyNet: { id: 259, name: 'EmptyNet' } 10007 }, 10008 10009 document: { 10010 visibility: { 10011 'private': '1', 10012 'public': '4' 10013 } 10014 }, 10015 10016 video: { 10017 status: { 10018 pending: 1, 10019 processing: 2, 10020 ready: 3 10021 }, 10022 visibility: { 10023 'private': '1', 10024 'public': '4' 10025 } 10026 }, 10027 10028 news: { 10029 visibility: { 10030 'private': '1', 10031 'public': '4' 10032 } 10033 }, 10034 10035 getStandingsType: function (value) { 10036 switch (value) { 10037 case 1: 10038 return language.standingsType.points; 10039 case 2: 10040 return language.standingsType.pointsPercentage; 10041 case 3: 10042 return language.standingsType.winningPercentage; 10043 case 4: 10044 return language.standingsType.differential; 10045 case 5: 10046 return language.standingsType.noStandings;
10047 default: 10048 return undefined; 10049 } 10050 }, 10051 getOrdinalSuffix: function(value){ 10052 var format = value.toString(); 10053 format = format.slice(-1); 10054 switch (format) { 10055 case '1': 10056 return language.ordinalSuffix.case1; 10057 case '2': 10058 return language.ordinalSuffix.case2; 10059 case '3': 10060 return language.ordinalSuffix.case3; 10061 default: 10062 return language.ordinalSuffix.caseBase; 10063 } 10064 }, 10065 getNumericAdvantageAbbById: function(value){ 10066 switch(value) 10067 { 10068 case 1: 10069 return language.matchScoreboard.tabStats.numericAvantageType[0].Abb; 10070 case 2: 10071 return language.matchScoreboard.tabStats.numericAvantageType[1].Abb; 10072 case 3: 10073 return language.matchScoreboard.tabStats.numericAvantageType[2].Abb; 10074 } 10075 }, 10076 getRuleText: function (value, type) { 10077 switch (value) { 10078 case 1: 10079 return language.season.tabStandings.rules.rule1; 10080 case 2: 10081 return language.season.tabStandings.rules.rule2; 10082 case 3: 10083 return language.season.tabStandings.rules.rule3; 10084 case 4: 10085 switch (type) { 10086 case 1: 10087 return language.season.tabStandings.rules.rule4.pointsRule; 10088 case 2: 10089 return language.season.tabStandings.rules.rule4.pointsPercentageRule; 10090 case 3: 10091 return language.season.tabStandings.rules.rule4.winPercentageRule; 10092 case 4: 10093 return language.season.tabStandings.rules.rule4.differentialRule; 10094 default: 10095 return undefined; 10096 }; 10097 case 5: 10098 return language.season.tabStandings.rules.rule5; 10099 case 6: 10100 return language.season.tabStandings.rules.rule6; 10101 case 7: 10102 return language.season.tabStandings.rules.rule7; 10103 case 8: 10104 return language.season.tabStandings.rules.rule8; 10105 case 9: 10106 return language.season.tabStandings.rules.rule9; 10107 case 10: 10108 return language.season.tabStandings.rules.rule10; 10109 case 11: 10110 return language.season.tabStandings.rules.rule11; 10111 case 12: 10112 return language.season.tabStandings.rules.rule12; 10113 case 13: 10114 return language.season.tabStandings.rules.rule13; 10115 case 14: 10116 return language.season.tabStandings.rules.rule14; 10117 case 15: 10118 return language.season.tabStandings.rules.rule15; 10119 case 16: 10120 return language.season.tabStandings.rules.rule16; 10121 default: 10122 return undefined; 10123 } 10124 }, 10125 10126 getStandingsTitle: function (value) { 10127 switch (value) { 10128 case 1: 10129 return language.season.tabStandings.titles.points; 10130 case 2: 10131 return language.season.tabStandings.titles.pointsPercentage; 10132 case 3: 10133 return language.season.tabStandings.titles.winPercentage; 10134 case 4: 10135 return language.season.tabStandings.titles.differential; 10136 case 5: 10137 return language.season.tabStandings.titles.noStandings; 10138 default: 10139 return undefined; 10140 } 10141 }, 10142 10143 getSport: function (value) { 10144 switch (value) { 10145 case language.sportList.hockey.id: 10146 return language.sportList.hockey; 10147 case language.sportList.baseball.id: 10148 return language.sportList.baseball; 10149 case language.sportList.football.id: 10150 return language.sportList.football; 10151 case language.sportList.basketball.id: 10152 return language.sportList.basketball; 10153 case language.sportList.badminton.id: 10154 return language.sportList.badminton; 10155 case language.sportList.soccer.id: 10156 return language.sportList.soccer; 10157 case language.sportList.volleyball.id: 10158 return language.sportList.volleyball; 10159 case language.sportList.tennis.id: 10160 return language.sportList.tennis; 10161 case language.sportList.golf.id: 10162 return language.sportList.golf; 10163 case language.sportList.other.id: 10164 return language.sportList.other; 10165 case language.sportList.dekhockey.id: 10166 return language.sportList.dekhockey; 10167 case language.sportList.rugby.id: 10168 return language.sportList.rugby; 10169 case language.sportList.ultimate.id: 10170 return language.sportList.ultimate; 10171 case language.sportList.handball.id: 10172 return language.sportList.handball; 10173 case language.sportList.ringette.id: 10174 return language.sportList.ringette; 10175 default: 10176 return undefined; 10177 } 10178 }, 10179 10180 getSportConfig: function (value) { 10181 switch (value) { 10182 case language.sportConfig.hockey.id: 10183 return language.sportConfig.hockey; 10184 case language.sportConfig.baseball.id: 10185 return language.sportConfig.baseball;
10186 case language.sportConfig.football.id: 10187 return language.sportConfig.football; 10188 case language.sportConfig.basketball.id: 10189 return language.sportConfig.basketball; 10190 case language.sportConfig.badminton.id: 10191 return language.sportConfig.badminton; 10192 case language.sportConfig.soccer.id: 10193 return language.sportConfig.soccer; 10194 case language.sportConfig.volleyball.id: 10195 return language.sportConfig.volleyball; 10196 case language.sportConfig.tennis.id: 10197 return language.sportConfig.tennis; 10198 case language.sportConfig.golf.id: 10199 return language.sportConfig.golf; 10200 case language.sportConfig.other.id: 10201 return language.sportConfig.other; 10202 case language.sportConfig.dekhockey.id: 10203 return language.sportConfig.dekhockey; 10204 case language.sportConfig.rugby.id: 10205 return language.sportConfig.rugby; 10206 case language.sportConfig.ultimate.id: 10207 return language.sportConfig.ultimate; 10208 case language.sportConfig.handball.id: 10209 return language.sportConfig.handball; 10210 case language.sportConfig.ringette.id: 10211 return language.sportConfig.ringette; 10212 default: 10213 return undefined; 10214 } 10215 }, 10216 10217 getSolution: function (value) { 10218 switch (value) { 10219 case 1: 10220 return language.solution.league; 10221 case 2: 10222 return language.solution.tournament; 10223 case 4: 10224 return language.solution.event; 10225 case 6: 10226 return language.solution.team; 10227 case 7: 10228 return language.solution.sportcenter; 10229 case 9: 10230 return language.solution.organization; 10231 default: 10232 return undefined; 10233 } 10234 }, 10235 10236 getSeasonType: function (value) { 10237 switch (value) { 10238 case 1: 10239 return language.seasonType.regular; 10240 case 2: 10241 return language.seasonType.playoff; 10242 case 3: 10243 return language.seasonType.preseason; 10244 case 6: 10245 return language.seasonType.singleElimination; 10246 case 7: 10247 return language.seasonType.roundRobinSingleElimination; 10248 case 8: 10249 return language.seasonType.playoffsRounds; 10250 default: 10251 return undefined; 10252 } 10253 }, 10254 10255 getUserStatus: function (value) { 10256 switch (value) { 10257 case language.userStatus.online.id: 10258 return language.userStatus.online.name; 10259 case language.userStatus.offline.id: 10260 return language.userStatus.offline.name; 10261 case language.userStatus.passwordRecovery.id: 10262 return language.userStatus.passwordRecovery.name; 10263 case language.userStatus.pending.id: 10264 return language.userStatus.pending.name; 10265 case language.userStatus.activate.id: 10266 return language.userStatus.activate.name; 10267 default: 10268 return undefined; 10269 } 10270 }, 10271 10272 getPlayerPosition: function (value) { 10273 var position = null; 10274 10275 _.forOwn(language.sportUserPosition[sportId], function(_position) { 10276 if(_position.id == value) 10277 position = _position; 10278 }) 10279 10280 if(position) 10281 return position; 10282 10283 return language.sportUserPosition[sportId].undefined; 10284 }, 10285 10286 getStarImage: function (value) { 10287 switch (value) { 10288 case 1: 10289 return '//cache.kreezee.com/images/icon-first-star-48px.png'; 10290 case 2: 10291 return '//cache.kreezee.com/images/icon-second-star-48px.png'; 10292 case 3: 10293 return '//cache.kreezee.com/images/icon-third-star-48px.png'; 10294 } 10295 }, 10296 10297 getRequestText: function(value) { 10298 switch (parseInt(value)) { 10299 case 1: 10300 return language.messages.tabRequests.type.connexion; 10301 break; 10302 case 2: 10303 return language.messages.tabRequests.type.solutionAdmin; 10304 break; 10305 case 3: 10306 return language.messages.tabRequests.type.teamManagerAdmin; 10307 break; 10308 case 5: 10309 return language.messages.tabRequests.type.playerInvited; 10310 break; 10311 case 7: 10312 return language.messages.tabRequests.type.staffInvited; 10313 break; 10314 case 9: 10315 return language.messages.tabRequests.type.supervisorInvited; 10316 break 10317 case 11: 10318 return language.messages.tabRequests.type.teamManagerInvited; 10319 default: 10320 return ""; 10321 } 10322 }, 10323 10324 getRound: function(value, length) { 10325 switch(parseInt(value)) 10326 { 10327 case 1: 10328 return language.playoffRounds.final.Name; 10329 case 2: 10330 return language.playoffRounds.semiFinal.Name; 10331 case 3: 10332 return language.playoffRounds.quarter.Name; 10333 default: 10334 return 'Ronde ' + ((length - value) + 1); 10335 10336 } 10337 }, 10338 10339 getUrlPrefix: function(solutionType) { 10340 var prefix 10341 switch (solutionType) { 10342 case language.solutionList.portal.id: 10343 prefix = language.urlRewrite.prefixPortal; 10344 break; 10345 case language.solutionList.league.id: 10346 prefix = language.urlRewrite.prefixLeague; 10347 break; 10348 case language.solutionList.association.id: 10349 prefix = language.urlRewrite.prefixAssociation; 10350 break; 10351 default: 10352 prefix = language.urlRewrite.prefixLeague; 10353 } 10354 10355 return prefix 10356 }, 10357 10358 getMatchTypeImage: function(typeId) { 10359 switch(typeId) { 10360 case 2: 10361 return 'icon-strategy'; 10362 case 3: 10363 return 'icon-barbell'; 10364 case 4: 10365 return 'icon-star2'; 10366 case 5: 10367 return 'icon-olympic-medal'; 10368 case 6: 10369 return 'icon-trophy'; 10370 default: 10371 return ''; 10372 } 10373 }, 10374 10375 getEventTypeImage: function(typeId) { 10376 switch(typeId) { 10377 case 8: 10378 return 'icon-strategy'; 10379 case 7: 10380 return 'icon-barbell'; 10381 case 9: 10382 return 'icon-user'; 10383 case 10:
10384 return 'icon-clipboard'; 10385 case 11: 10386 return 'icon-open-book'; 10387 case 12: 10388 return 'icon-emoji-happy'; 10389 case 13: 10390 return 'icon-stopwatch'; 10391 case 14: 10392 return 'icon-trophy'; 10393 case 15: 10394 return 'icon-dots-three-horizontal'; 10395 default: 10396 return ''; 10397 } 10398 } 10399} 10400; 10401logger.disableLogger(); 10402 10403var config = { 10404 setting: { 10405 urlV2: 'http://www.kreezee.com/v2', 10406 urlMobile: 'https://m.kreezee.com', 10407 urlCache: 'https://cache.kreezee.com/', 10408 urlAds: 'https://ads.kreezee.com', 10409 urlHelp: 'https://help.kreezee.com', 10410 urlRestApi: 'https://api.kreezee.com', 10411 twitterWidgetId: '668811104622149636', 10412 v2Active: false 10413 }, 10414 webService: { 10415 wsAccounAdministrator: '/ws/AccountAdministrator.asmx/', 10416 wsAuthentication: '/ws/Authentication.asmx/', 10417 wsFeedback: '/ws/Feedback.asmx/', 10418 wsSearch: '/ws/Search.asmx/', 10419 wsUserSuscribe: '/ws/UserSuscribe.asmx/', 10420 wsCustomPage: '/ws/CustomPage.asmx/', 10421 wsUser: '/ws/User.asmx/', 10422 wsLeague: '/ws/League.asmx/', 10423 wsSeason: '/ws/Season.asmx/', 10424 wsDivision: '/ws/Division.asmx/', 10425 wsImportData: '/ws/ImportData.asmx/', 10426 wsTeam: '/ws/Team.asmx/', 10427 wsPlayer: '/ws/Player.asmx/', 10428 wsContact: '/ws/Contact.asmx/', 10429 wsStaff: '/ws/Staff.asmx/', 10430 wsSuspension: '/ws/Suspension.asmx/', 10431 wsCalendar: '/ws/Calendar.asmx/', 10432 wsMatch: '/ws/Match.asmx/', 10433 wsEvent: '/ws/Event.asmx/', 10434 wsAddress: '/ws/Address.asmx/', 10435 wsPhone: '/ws/Phone.asmx/', 10436 wsEmail: '/ws/Email.asmx/', 10437 wsMail: '/ws/Mail.asmx/', 10438 wsSportCenter: '/ws/SportCenter.asmx/', 10439 wsSolution: '/ws/Solution.asmx/', 10440 wsAccountNews: '/ws/AccountNews.asmx/', 10441 wsAccountMessage: '/ws/Message.asmx/', 10442 wsAccountRequest: '/ws/Request.asmx/', 10443 wsPost: '/ws/Post.asmx/', 10444 wsComment: '/ws/Comment.asmx/', 10445 wsLike: '/ws/Like.asmx/', 10446 wsFeature: '/ws/Feature.asmx/', 10447 wsAdminSport: '/ws/AdminSport.asmx/', 10448 wsAdminCountry: '/ws/AdminCountry.asmx/', 10449 wsAdminService: '/ws/AdminService.asmx/', 10450 wsConnection: '/ws/Connection.asmx/', 10451 wsStats: '/ws/Stats.asmx/', 10452 wsGroup: '/ws/Group.asmx/', 10453 wsPhoto: '/ws/Photo.asmx/', 10454 wsAlbum: '/ws/Album.asmx/', 10455 wsVideo: '/ws/Video.asmx/', 10456 wsDocument: '/ws/Medias/Document.asmx/', 10457 wsNews: '/ws/Medias/News.asmx/', 10458 wsRequest: '/ws/Request.asmx/', 10459 wsAds: '/ws/Ads.asmx/', 10460 wsStripeConnect: '/ws/Payment/Stripe/Connect.asmx/', 10461 } 10462}; 10463; 10464$(function() { 10465 // *** Share Buttons Widget *** 10466 $("div[kreezee-widget='share-buttons']").each(function(i, e) { 10467 $(e).replaceWith('<div data-bind="with: $root.share">' + 10468 '<ul class="share-buttons">' + 10469 '<li class="email">' + 10470 '<a data-bind="attr: { href: mailToUrl }">' + 10471 '<span class="icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve"><g><path d="M20.111 26.147c-2.336 1.051-4.361 1.401-7.125 1.401c-6.462 0-12.146-4.633-12.146-12.265 c0-7.94 5.762-14.833 14.561-14.833c6.853 0 11.8 4.7 11.8 11.252c0 5.684-3.194 9.265-7.399 9.3 c-1.829 0-3.153-0.934-3.347-2.997h-0.077c-1.208 1.986-2.96 2.997-5.023 2.997c-2.532 0-4.361-1.868-4.361-5.062 c0-4.749 3.504-9.071 9.111-9.071c1.713 0 3.7 0.4 4.6 0.973l-1.169 7.203c-0.388 2.298-0.116 3.3 1 3.4 c1.673 0 3.773-2.102 3.773-6.58c0-5.061-3.27-8.994-9.303-8.994c-5.957 0-11.175 4.673-11.175 12.1 c0 6.5 4.2 10.2 10 10.201c1.986 0 4.089-0.43 5.646-1.245L20.111 26.147z M16.646 10.1 c-0.311-0.078-0.701-0.155-1.207-0.155c-2.571 0-4.595 2.53-4.595 5.529c0 1.5 0.7 2.4 1.9 2.4 c1.441 0 2.959-1.828 3.311-4.087L16.646 10.068z"></path></g></svg></span>' + 10472 '<span class="text">email</span>' + 10473 '</a>' + 10474 '</li>' + 10475 '<li class="facebook">' + 10476 '<a href="#" data-bind="click: shareOnFacebook, attr: {href: shareOnFacebookUrl}">' + 10477 '<span class="icon">' + 10478 '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">' + 10479 '<path d="M27.825,4.783c0-2.427-2.182-4.608-4.608-4.608H4.783c-2.422,0-4.608,2.182-4.608,4.608v18.434c0,2.427,2.181,4.608,4.608,4.608H14V17.379h-3.379v-4.608H14v-1.795c0-3.089,2.335-5.885,5.192-5.885h3.718v4.608h-3.726c-0.408,0-0.884,0.492-0.884,1.236v1.836h4.609v4.608h-4.609v10.446h4.916c2.422,0,4.608-2.188,4.608-4.608V4.783z"></path>' + 10480 '</svg>' + 10481 '</span>' + 10482 '<!-- ko if: facebookShareCount --><span data-bind="text: facebookShareCount" class="text"></span><!-- /ko -->' + 10483 '</a>' + 10484 '</li>' + 10485 '<li class="twitter">' + 10486 '<a data-bind="click: shareOnTwitter, attr: { href: shareOnTwitterUrl }">' + 10487 '<span class="icon">' + 10488 '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">' + 10489 '<path d="M24.253,8.756C24.689,17.08,18.297,24.182,9.97,24.62c-3.122,0.162-6.219-0.646-8.861-2.32c2.703,0.179,5.376-0.648,7.508-2.321c-2.072-0.247-3.818-1.661-4.489-3.638c0.801,0.128,1.62,0.076,2.399-0.155C4.045,15.72,2.215,13.6,2.115,11.077c0.688,0.275,1.426,0.407,2.168,0.386c-2.135-1.65-2.729-4.621-1.394-6.965C5.575,7.816,9.54,9.84,13.803,10.071c-0.842-2.739,0.694-5.64,3.434-6.482c2.018-0.623,4.212,0.044,5.546,1.683c1.186-0.213,2.318-0.662,3.329-1.317c-0.385,1.256-1.247,2.312-2.399,2.942c1.048-0.106,2.069-0.394,3.019-0.851C26.275,7.229,25.39,8.196,24.253,8.756z"></path>' + 10490 '</svg>' + 10491 '</span>' + 10492 '<!-- ko if: twitterShareCount --><span data-bind="text: twitterShareCount" class="text"></span><!-- /ko -->' + 10493 '</a>' + 10494 '</li>' + 10495 '</ul>' + 10496 '</div>'); 10497 });
10498});; 10499function Menu(path, menuId) { 10500 var self = this; 10501 10502 self.path = !window.whiteLabel ? path : ''; 10503 self.showHeaderBanner = false; 10504 var menus = []; 10505 self.menuItems = ko.observableArray([]); 10506 self.overflowItems = ko.observableArray([]); 10507 self.allMenuItems = ko.observableArray([]); 10508 10509 self.visit = function(callback, array) { 10510 var menuItems = array || self.getAllItems(); 10511 menuItems.forEach(function(item) { 10512 item.visitChildren(callback); 10513 }); 10514 } 10515 10516 self.bindItems = function(items, showHeaderBanner) { 10517 var menuItems = []; 10518 self.showHeaderBanner = showHeaderBanner; 10519 10520 items.forEach(function(menu) { 10521 if(menu.ParentId == null) { 10522 menuItems.push(new MenuItem(menu, self.path)); 10523 } 10524 else { 10525 self.visit(function(item) { 10526 if (item.Id == menu.ParentId) { 10527 item.Children.push(new MenuItem(menu, self.path)); 10528 } 10529 }, menuItems); 10530 } 10531 }); 10532 10533 menus = menuItems; 10534 self.allMenuItems(menuItems); 10535 self.updateMenuWidth(); 10536 } 10537 10538 self.activateMenu = function () { 10539 var items = self.getAllItems(); 10540 10541 self.visit(function (item) { 10542 var itemUrl = item.Url.split('/'); 10543 if(itemUrl[itemUrl.length - 1] == "") { 10544 itemUrl = itemUrl.slice(0, -1); 10545 } 10546 10547 var documentPath = document.location.pathname.split('/'); 10548 if (documentPath[documentPath.length - 1] == itemUrl[itemUrl.length - 1]) { 10549 item.IsActive(true); 10550 } 10551 }, items); 10552 }; 10553 10554 self.getAllItems = function() { 10555 return self.menuItems().concat(self.overflowItems()); 10556 } 10557 10558 self.updateMenuWidth = function () { 10559 var imgSpacerWidth = 0; 10560 var listElement = $("#menuList"); 10561 var widthBusted = false; 10562 10563 if (!self.showHeaderBanner) { 10564 imgSpacerWidth = $('#imgHolder').outerWidth(); 10565 } 10566 10567 self.menuItems([]); 10568 self.overflowItems([]); 10569 10570 menus.forEach(function(menu) { 10571 if(!widthBusted) 10572 { 10573 self.menuItems.push(menu); 10574 10575 var width = 0; 10576 $('#menuList li').each(function () { 10577 var $this = $(this); 10578 width += $this.outerWidth(); 10579 }); 10580 10581 if (width + imgSpacerWidth > listElement.outerWidth(false)) { 10582 var item = self.menuItems.splice(-1); 10583 self.overflowItems.push(item[0]); 10584 widthBusted = true; 10585 } 10586 } 10587 else { 10588 self.overflowItems.push(menu); 10589 } 10590 }); 10591 } 10592 10593 $(window).on('resize', function(event) { 10594 self.updateMenuWidth(); 10595 }); 10596} 10597 10598function MenuItem(_menu, path) { 10599 var self = this; 10600 10601 self.Id = _menu.Id; 10602 self.Text = _menu.Text; 10603 self.Type = _menu.Type; 10604 self.Children = []; 10605 self.Target = '_self'; 10606 10607 self.Url = '#'; 10608 self.IsActive = ko.observable(false); 10609 10610 if(self.Type == 'page' || self.Type == 'psolution') 10611 { 10612 self.Url = !window.whiteLabel 10613 ? String.format('/' + path + '/{0}/{1}', solutionId, _menu.Url) 10614 : String.format('/{0}', _menu.Url); 10615 } 10616 else if(self.Type == 'link') 10617 { 10618 self.Url = _menu.Url.match(/^https?:\/\//) == null ? 'http://' + _menu.Url : _menu.Url; 10619 } 10620 else if (self.Type == 'document') { 10621 self.Target = "_blank"; 10622 self.Url = _menu.Url; 10623 } 10624 10625 self.visitChildren = function(callback) { 10626 var treeLevel = arguments[1] || 0; 10627 var parent = arguments[2] || null; 10628 callback(self, parent, treeLevel); 10629 10630 for(var i = 0; i < self.Children.length; i++) 10631 { 10632 self.Children[i].visitChildren(callback, treeLevel+1, self); 10633 } 10634 } 10635 10636 self.handleClickEvent = function () { 10637 if (smartIFrame) { 10638 return SmartIFrame.click(self.Url, !self.IsActive()) 10639 } 10640 10641 return !self.IsActive(); 10642 } 10643} 10644 10645$( document ).ready(function() { 10646 $("body").on('click', '.dropdown-menu [data-toggle=dropdown], .dropdown [data-toggle=dropdown]', openMenu); 10647 $("body").on('mouseenter', '.dropdown-menu [data-toggle=dropdown], .dropdown [data-toggle=dropdown]', openMenu); 10648 $("body").on('mouseleave', '.dropdown.open', closeMenu); 10649 10650 $("#side-menu").on("hide.bs.modal", function () { 10651 $('.collapse.in', $(this)).each(function () { 10652 $(this).collapse('hide'); 10653 $(this).removeClass("in"); 10654 }) 10655 $(".modal-content", $(this)).scrollTop(0); 10656 });
10657 10658 var intervals = []; 10659 10660 $("#side-menu").on("show.bs.collapse", '.collapse', function () { 10661 var self = this; 10662 10663 if (intervals[$(this).attr("id")]) 10664 clearInterval(intervals[$(this).attr("id")]); 10665 10666 intervals[$(this).attr("id")] = setInterval(function () { 10667 scrollToShow($(self).closest(".modal-content"), $(self), 'interval'); 10668 }, 10) 10669 }); 10670 10671 $("#side-menu").on("shown.bs.collapse", '.collapse', function () { 10672 clearInterval(intervals[$(this).attr("id")]); 10673 intervals[$(this).attr("id")] = null; 10674 10675 scrollToShow($(this).closest(".modal-content"), $(this)); 10676 }); 10677}); 10678 10679function scrollToShow(scrollableElement, collapseElement, interval) { 10680 var dialogTop = scrollableElement.scrollTop(); 10681 var dialogBottom = dialogTop + scrollableElement.height(); 10682 10683 var elementTop = collapseElement.offset().top + dialogTop; 10684 var elementBottom = elementTop + collapseElement.height(); 10685 10686 if (elementBottom >= dialogBottom) { 10687 scrollableElement.scrollTop(dialogTop + (elementBottom - dialogBottom)); 10688 } 10689} 10690 10691 10692function openMenu(event) { 10693 event.preventDefault(); 10694 event.stopPropagation(); 10695 $(this).parent().siblings().removeClass('open'); 10696 if(!$(this).parent().hasClass('open')) { 10697 $(this).parent().addClass('open'); 10698 } 10699 10700 if($('ul', $(this).parent()).offset().left < 0) { 10701 $('ul', $(this).parent()).css('right', $(this).parent().outerWidth() - $('ul', $(this).parent()).outerWidth() - 20 + 'px'); 10702 10703 $('ul', $(this).parent()).css('top', 'auto'); 10704 } 10705 10706 if ($('ul', $(this).parent()).offset().left + $('ul', $(this).parent()).outerWidth() > $(window).width()) { 10707 $('ul', $(this).parent()).css('left', ($(window).width() - $(this).parent().offset().left) - $('ul', $(this).parent()).outerWidth() - 20 + 'px'); 10708 10709 $('ul', $(this).parent()).css('top', 'auto'); 10710 } 10711} 10712 10713function closeMenu(event) { 10714 $(event.currentTarget).removeClass('open'); 10715 $('.open', $(event.currentTarget)).each(function() { $(this).removeClass('open') }); 10716} 10717;
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.