Top Stories
More Stories Videos

Trojan of The Week

Calendar
There was a problem with a Velocity script
Page/scoreboard-slider-template
ErrorInvocation of method 'remove' in class java.util.ArrayList threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at 5hmadvfckt541lum/scoreboard-slider-template[line 99, column 35]
Page source:
1: #set ($ajax = false)
2: #if ($request.getParameter("ajax").equals("true"))
3:   #set ($ajax = true)
4:   $!request.setAttribute("decorator", "")
5: #end
6: 
7: ## TEAM LINKING
8: #set ($teamIDs = $page.teamIDs)
9: 
10: #set ($columnCount = 5)
11: #if ($tool.math.toInteger($request.getParameter("columnCount")))
12:   #set ($columnCount = $tool.math.toInteger($request.getParameter("columnCount")))
13: #end
14: 
15: #if ($request.getParameter("id"))
16:   #set ($id = $request.getParameter("id"))
17: #end
18: 
19: #set ($events = $schedule.events)
20: #set ($eventCount = $events.size())
21: #set ($slideCount = $tool.math.ceil($tool.math.div($eventCount, $columnCount)))
22: 
23: #set ($upcomingEvents = [])
24: #set ($pastEvents = [])
25: #set ($activeSlideEvents = [])
26: 
27: #set ($currentTime = $now.time)
28: 
29: #set ($stringToday = $formatter.formatDate($now, "yyyy-MM-dd"))
30: #set ($today = $tool.date.toDate("yyyy-MM-dd", $stringToday))
31: 
32: ######################################################################
33: ##   STORE PAST, INPROGRESS AND UPCOMING EVENTS IN THEIR OWN ARRAYS ##
34: 
35: #set ($blocks = $eventCount / 100)
36: #foreach ($block in [0..$blocks])
37: 
38:   #set ($min = $block * 100)
39:   #set ($max = $block * 100 + 100)
40:   #if ($max > $eventCount)
41: 	#set ($max = $eventCount)
42:   #end
43: 
44:   #set ($eventsSubList = $events.subList($min, $max))
45: 
46:   #foreach ($event in $eventsSubList)
47:     #set ($eventTime = $event.date.time)
48:     #if ($currentTime > $eventTime && !$event.inProgress)
49:       #set ($bool = $pastEvents.add($event))
50:     #else
51:       #set ($bool = $upcomingEvents.add($event))
52:     #end
53:   #end
54: 
55: #end ## block loop
56: ########################################################################################################################
57: 
58: ## <!-- $pastEvents -->
59: ## <!-- $upcomingEvents -->
60: 
61: ## CREATE ACTIVE SLIDE WHICH IF POSSIBLE CONTAINS ${pastEventCountForActiveSlide} PAST EVENTS AND UPCOMING EVENTS DEPENDING ON THE COLUMN LIMIT
62: #if ($columnCount > 3)
63: 
64: #if ($pastEvents.size() >= 2)
65:     #set ($pastEventCountForActiveSlide = 2)
66: #else
67:     #set ($pastEventCountForActiveSlide = 1)
68: #end
69: 
70: ## #set ($pastEventCountForActiveSlide = 2)
71: 
72: #if ($upcomingEvents.size() == 1)
73:     #set ($pastEventCountForActiveSlide = 4)
74: #elseif ($upcomingEvents.size() == 2)
75:     #set ($pastEventCountForActiveSlide = 3)
76: #elseif ($upcomingEvents.size() == 3)
77:     #set ($pastEventCountForActiveSlide = 2)
78: #end
79: 
80: #set ($upcomingEventCountForActiveSlide = $tool.math.sub($columnCount, $pastEventCountForActiveSlide)) 
81: 
82: #if ($pastEvents.size() >= $pastEventCountForActiveSlide && $upcomingEvents.size() >= $upcomingEventCountForActiveSlide)
83: 
84:   #set ($pastEventsForActiveSlide = $pastEvents.subList($tool.math.sub($pastEvents.size(), $pastEventCountForActiveSlide), $pastEvents.size()))
85:   #set ($upcomingEventsForActiveSlide = $upcomingEvents.subList(0, $upcomingEventCountForActiveSlide))
86: 
87:   ## add the last two events into the activeSlide array
88:   #set ($bool = $activeSlideEvents.addAll($pastEventsForActiveSlide))
89: 
90:   ## remove the last two events from pastEvents array
91:   #foreach ($i in [1..$pastEventCountForActiveSlide])
92: 	#set ($bool = $!pastEvents.remove($tool.math.sub($pastEvents.size(), 1)))
93:   #end
94: 
95:   ## add the next upcoming events into the activeSlide array
96:   #set ($bool = $activeSlideEvents.addAll($upcomingEventsForActiveSlide))
97: 
98:   #foreach ($i in [1..$upcomingEventCountForActiveSlide])
99:     #set ($bool = $upcomingEvents.remove(0))
100:   #end
101: 
102: #end
103: #end ## columnCount > 3
104: ##############################################################################################################################
105: 
106: <!-- $pastEventCountForActiveSlide -->
107: <!-- $upcomingEventCountForActiveSlide -->
108: 
109: ## PRINT EVENT DETAILS
110: #macro (printEvent $event $class)
111: <div class="event-box ${class} clearfix">
112: 
113: <div class="date-sport clearfix">
114: 
115: ## DATE
116: <div class="date clearfix" title="$formatter.formatLongDate($event.date)">
117:   <span>$formatter.formatDate($event.date, "MMM dd")</span>
118: </div>
119: 
120: ## SPORT NAME
121: #if ($event.sport)
122:   <div class="sport">
123: 	#if ($event.feedURL.length() > 0)
124: 		#set ($end = $event.feedURL.indexOf("?tmpl="))
125: 		<a href="$event.feedURL.substring(0, $end)">#if ($event.sport == "Women's Soccer")Women's Soccer#else${event.sport}#end</a>
126: 	#else
127: 		<span>#if ($event.sport == "Women's Soccer")Women's Soccer#else${event.sport}#end</span>
128: 	#end
129:   </div>
130: #end
131: 
132: </div> ## date-sport
133: 
134: ## RESULT
135: #set ($result = "")
136: #if ($event.inProgress) 
137:   #set ($result = $event.result)
138: #elseif ($event.APResult.length() > 0)
139:   #set ($result = $event.APResult)
140: #else
141:   #set ($result = $event.result)
142: #end
143: 
144: #if ($result.toString().length() > 0)
145:   <div class="result">$result</div>
146: #else
147: 
148: ## STATUS
149: #set ($status = $formatter.formatStatus($event))
150: #if ($status.length() > 0)
151:   <div class="status">$status</div>
152: #end
153: 
154: #end
155: 
156: <div class="event-info clearfix">
157: 
158: ## OPPONENT
159: <div class="opponent">
160: 
161: #if ($event.neutralSite.length() > 0) 
162:   <span class="va">vs. </span> 
163: #else 
164:   #if (!$event.home)<span class="va">at </span>#end 
165: #end
166: 
167: #set ($opponentName = "")
168: #if ($event.opponent.name.length() > 0)
169:   #set ($opponentName = $event.opponent.name)
170: #elseif ($event.teams.size() > 0)
171:   #set ($opponentName = $event.teams.get(0).name)
172: #end
173: 
174: #if ($teamIDs.contains($event.opponent.teamId))
175:   <a href="${page.url}?teamId=${event.opponent.teamId}" class="opponent-name">$opponentName</a>
176: #else
177:   <span class="opponent-name">$opponentName</span>
178: #end
179: 
180: </div> ## opponent
181: 
182: #if ($event.neutralSite.length() > 0)
183:   <div class="neutral-site">@ $event.neutralSite</div>
184: #end
185: 
186: </div> ## event-info
187: 
188: 
189: <div class="links">
190: #set ($linksCounter = 0)
191: #foreach ($link in $event.links)
192:   #if (($event.statusCode >= 0 || $event.date.before($today)) && 
193:         ($link.mapType.equals("LS") || 
194:         $link.mapType.equals("PR") || 
195:         $link.mapType.equals("DI") || 
196:         $link.mapType.equals("TI") || 
197:         $link.mapType.equals("AU"))
198:   )
199:   #else
200:     #set ($linksCounter = $linksCounter + 1)
201: 	## #if ($linksCounter == 1)#end
202: 	#if ($linksCounter > 1)
203: 		<span class="sep"> | </span>
204: 	#end
205:     #if ($abbreviatedLinks)
206: 		#foreach ($l in $linksAbbreviations.entrySet())
207: 	    	#if ($link.name.equalsIgnoreCase($l.key))
208: 		  		<a href="$link.url" title="$link.name" class="gicon-$link.mapType"><span>$l.value</span></a>
209: 			#end
210: 	  	#end
211: 	#else
212:       	<a href="$link.url" class="gicon-$link.mapType"><span>$link.name</span></a>
213: 	#end
214:   #end
215: #end
216: ## #if ($linksCounter > 0)#end
217: </div>
218: 
219: </div> ## event-box
220: #end ## macro printEvent
221: 
222: ##############################################################################################################################
223: 
224: ## PRINT EVENTS
225: #macro (printEvents $eventSet $printEmptyBoxes $emptyBoxesCount $emptyBoxesPosition $activeSlide)
226: 
227: #set ($blocks = $eventSet.size() / 100)
228: #set ($counter = 0)
229: #set ($colCount = 0)
230: 
231: #foreach ($block in [0..$blocks])
232: 
233: #set ($min = $block * 100)
234: #set ($max = $block * 100 + 100)
235: #if ($max > $eventSet.size())
236:   #set ($max = $eventSet.size())
237: #end
238: 
239: #set ($eventsSubList = $eventSet.subList($min, $max))
240: 
241: #foreach ($e in $eventsSubList)
242: 
243: #set ($counter = $counter + 1)
244: #set ($colCount = $colCount + 1)
245: 
246: #if ($colCount == 1)
247:   #if ($activeSlide  && $counter == 1)
248:      <div class="item active clearfix">
249:   #else
250:      <div class="item clearfix">
251:   #end
252: #end
253: 
254: ## PRINT EMPTY EVENT BOXES IF ANY
255: #if ($printEmptyBoxes && $emptyBoxesCount > 0 && $emptyBoxesPosition == "start" && $block == 0)
256:   #foreach ($k in [1..$emptyBoxesCount])
257:     <div class="event-box empty clearfix"></div>
258:     #set ($colCount = $colCount + 1)
259:   #end
260:   #set ($printEmptyBoxes = false)
261: #end
262: 
263: <!-- $e.inProgress -->
264: #if ($currentTime > $e.date.time && !$e.inProgress)
265:   #printEvent($e, "results")
266: #else
267:   #printEvent($e, "upcoming")
268: #end
269: 
270: #if ($colCount == $columnCount  || $counter == $eventSet.size())
271:   </div> ## item
272:   #set ($colCount = 0)
273: #end
274: 
275: #end ## subList loop
276: #end ## blocks
277: 
278: #end ## macro printEvents
279: 
280: ##############################################################################################################################
281: 
282: #if ($request.getParameter("id"))
283:   #set ($id = $request.getParameter("id"))
284: #end
285: 
286: <div id="${id}" class="scoreboard-slider ${id} clearfix">
287: <div class="slider">
288: <div class="items clearfix">
289: 
290: #if ($eventCount == 0)
291: 
292: <div class="item no-events">No Events</div>
293: 
294: #else
295: 
296: #set ($printEmptyBoxes = false)
297: #if ($activeSlideEvents.size() > 0)
298:   #set ($printEmptyBoxes = true)
299: #end
300: 
301: #set ($pastEventsSlideCount = $tool.math.ceil($tool.math.div($pastEvents.size(), $columnCount)))
302: #set ($pastEventsEmptyCount = $tool.math.sub($tool.math.mul($pastEventsSlideCount, $columnCount), $pastEvents.size()))
303: 
304: #set ($upcomingEventsSlideCount = $tool.math.ceil($tool.math.div($upcomingEvents.size(), $columnCount)))
305: #set ($upcomingEventsEmptyCount = $tool.math.sub($tool.math.mul($upcomingEventsSlideCount, $columnCount), $upcomingEvents.size()))
306: 
307: #if ($pastEvents.size() > 0)
308:   #printEvents($pastEvents $printEmptyBoxes $pastEventsEmptyCount "start" false)
309: #end
310: 
311: #if ($activeSlideEvents.size() > 0)
312:   #printEvents($activeSlideEvents false 0 "" true)
313: #end
314: 
315: #if ($upcomingEvents.size() > 0)
316: 	#if ($activeSlideEvents.size() > 0)
317: 		#printEvents($upcomingEvents $printEmptyBoxes $upcomingEventsEmptyCount "end" false)
318: 	#else
319: 		#printEvents($upcomingEvents $printEmptyBoxes $upcomingEventsEmptyCount "end" true)
320: 	#end
321: #end
322: 
323: #end
324: 
325: </div>
326: </div> ## slider
327: 
328: <a class="prev">Previous</a>
329: ##<a class="pause pp">PP</a>
330: <a class="next">Next</a>
331: 
332: </div> ## scoreboard-slider
333: 
334: #if (!$ajax)
335: 
336: <script>
337: jQuery.easing.quickSnap = function (x, t, b, c, d) {
338:     var s=1.70158;var p=0;var a=c;
339:     if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
340:     if (a < Math.abs(c)) { a=c; var s=p/4; }
341:     else var s = p/(2*Math.PI) * Math.asin (c/a);
342:     return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
343: }
344: 
345: $(function() {
346: 
347: setTimeout(function() {
348: 
349: var scoreboardSlider = $('#${id}').eq(0);
350: var scroller = scoreboardSlider.children('.slider').scrollable({ 
351:     circular: false,
352: 	easing: 'quickSnap',
353: 	speed : 600
354: }).data('scrollable');
355: 
356: var activeIndex = scoreboardSlider.find('.item.active').index();
357: if (activeIndex >= 0) {
358:   scroller.seekTo(activeIndex, 0);
359: }
360: 
361: scoreboardSlider.children('.pp').on('click', function(e) {
362:   e.preventDefault();
363: 
364:   if ($(this).hasClass('pause')) {
365: 
366:     $(this).removeClass('pause');
367:     $(this).addClass('play');
368:     scroller.stop();
369: 
370:   } else if ($(this).hasClass("play")) {
371: 
372:     $(this).removeClass('play');
373:     $(this).addClass('pause');
374:     scroller.play();
375: 
376:   }
377: });
378: 
379: }, 200);
380: 
381: });
382: </script>
383: 
384: #end ## !$ajax

Results
L, 10-4
Alltoona Buccaneers
L, 8-3
Alltoona Buccaneers
W, 1-0
at Lovett
W, 54-47
at Southwest Dekalb
L, 1-0
at McIntosh Chiefs
T, 1-1
at McIntosh Chiefs
W, 7-3
Lakeside Panthers
W, 50-47
Cedar Shoals