1// Effects Plugin for eXeLearning 2// By Ignacio Gros (http://www.gros.es/) for eXeLearning (http://exelearning.net/) 3// Creative Commons Attribution-ShareAlike (http://creativecommons.org/licenses/by-sa/3.0/) 4if (typeof ($exeFX_i18n) == 'undefined') $exeFX_i18n = { previous: "Previous", next: "Next", show: "Show", hide: "Hide", showFeedback: "Show Feedback", hideFeedback: "Hide Feedback", correct: "Correct", incorrect: "Incorrect", menu: "Menu", download: "Download", yourScoreIs: "Your score is ", dataError: "Error recovering data", epubJSerror: "This might not work in this ePub reader.", solution: "Solution", epubDisabled: "This activity does not work in ePub.", print: "Print" } 5 6$exeFX = { 7 baseClass: "exe", 8 h2: "h2", 9 isOldBrowser: false, 10 init: function () { 11 var ie = $exeFX.checkIE(); 12 if ((!isNaN(parseFloat(ie)) && isFinite(ie)) && ie < 9) { 13 $exeFX.isOldBrowser = true; 14 $exeFX.h2 = "H2"; 15 } 16 var k = $exeFX.baseClass; 17 var f = $("." + k + "-fx"); 18 var hasTimeLines = false; 19 $("." + k + "-fx").each(function (i) { 20 var c = this.className; 21 if (c.indexOf(" " + k + "-accordion") != -1) $exeFX.accordion.init(this, i); 22 else if (c.indexOf(" " + k + "-tabs") != -1) $exeFX.tabs.init(this, i); 23 else if (c.indexOf(" " + k + "-paginated") != -1) $exeFX.paginated.init(this, i); 24 else if (c.indexOf(" " + k + "-carousel") != -1) $exeFX.carousel.init(this, i); 25 else if (c.indexOf(" " + k + "-timeline") != -1 && document.body.className.indexOf("exe-epub3") != 0) { 26 $exeFX.timeline.init(this, i); 27 hasTimeLines = true; 28 } 29 }); 30 if (hasTimeLines) { 31 setTimeout(function () { $.timeliner({}); }, 500); 32 } 33 }, 34 35 hex2rgb: function (h, a) { 36 // h should be #rrggbb 37 var hex = parseInt(h.substring(1), 16); 38 var r = (hex & 0xff0000) >> 16; 39 var g = (hex & 0x00ff00) >> 8; 40 var b = hex & 0x0000ff; 41 // return [r, g, b]; 42 var c = "rgb"; 43 if (a) c += "a"; 44 c += "(" + r + "," + g + "," + b + ""; 45 if (a) c += "," + a; 46 c += ")"; 47 return c; 48 }, 49 h5pResize: function (block) { 50 var iframes = $("iframe", block); 51 iframes.each(function () { 52 if (this.src && (this.src.indexOf("https://h5p.org/") == 0 || this.src.indexOf("/wp-admin/admin-ajax.php?action=h5p_embed") != -1)) { 53 if (!this.style || !this.style.height || this.style.height == "") { 54 this.src = this.src; 55 } 56 } 57 }); 58 }, 59 removeXMLNS: function (t) { 60 if (document.body.className.indexOf("exe-epub3") == 0) { 61 var xmlnsString = 'h2 xmlns="http://www.w3.org/1999/xhtml"'; 62 var xmlnsStringExp = new RegExp(xmlnsString, 'g'); 63 t = t.replace(xmlnsStringExp, 'h2'); 64 } 65 return t; 66 }, 67 rftTitles: function (t) { 68 // Remove all attributes (except the title) 69 var div = $("<div></div>"); 70 div.html(t); 71 $("h2", div).each(function () { 72 var attributes = $.map(this.attributes, function (item) { 73 return item.name; 74 }); 75 var title = $(this); 76 $.each(attributes, function (i, item) { 77 if (item.toLowerCase() != "title") title.removeAttr(item); 78 }); 79 }); 80 t = div.html(); 81 // Remove xmlns="http://www.w3.org/1999/xhtml" 82 t = $exeFX.removeXMLNS(t); 83 // Replace <h2 title=""></h2> by <h2><span title=""></span></h2>. That's how TinyMCE inserts the title when using the Insert/Edit Attributes option 84 var s = t.split('<' + $exeFX.h2 + ' title="'); 85 var n = ""; 86 if (s.length < 2) return t; 87 for (var i = 0; i < s.length; i++) { 88 n += s[i]; 89 if (i < (s.length - 1)) n += '<' + $exeFX.h2 + '><span title="'; 90 n = n.replace("</" + $exeFX.h2 + ">", "</span></" + $exeFX.h2 + ">"); 91 } 92 return n; 93 }, 94 noFX: function (e) { 95 // Wrong HTML (no H2, etc.): No effects or special presentation 96 e.attr("class", "").css("padding", "1em"); 97 }, 98 accordion: { 99 closeBlock: function (aID) { 100 var k = $exeFX.baseClass; 101 $('.fx-accordion-title', "#" + aID).removeClass('active'); 102 $('.fx-accordion-content', "#" + aID).slideUp(300).removeClass('open'); 103 }, 104 enable: function (x) { 105 var k = $exeFX.baseClass; 106 var t = $('.fx-accordion-title', x); 107 // Get the box shadow color 108 var color = ''; 109 var title = t.eq(0); 110 if (title.length == 1) { 111 color = title.css("background-color"); 112 if (typeof (color) == "string") { 113 color = color.replace("rgb(", "rgba(").replace(")", ",0.5)"); 114 if (color.indexOf("rgba(") == 0) x.css("box-shadow", "0px 1px 3px " + color); 115 // Get border color (titles) 116 color = x.css("background-color"); 117 if (typeof (color) == "string") { 118 color = color.replace("rgb(", "rgba(").replace(")", ",0.2)"); 119 if (color.indexOf("rgba(") == 0) { 120 t.each(function () { 121 this.style.borderColor = color; 122 }); 123 } 124 } 125 } 126 }
127 // onclick 128 t.off('click').click(function (e) { 129 var aID = this.id.split("-")[0]; 130 aID = aID.replace("_", "-").replace("_", "-"); 131 var currentAttrValue = $(this).attr('href'); 132 133 // IE7 retrieves link#hash instead of #hash 134 currentAttrValue = currentAttrValue.split("#"); 135 currentAttrValue = "#" + currentAttrValue[1]; 136 // / IE7 137 138 var target = $(e.target); 139 var targetName; 140 141 if ($exeFX.isOldBrowser) targetName = target[0].nodeName; 142 else targetName = target[0].localName; 143 144 if (targetName == $exeFX.h2) target = target.parent(); 145 146 if (target.is('.active')) { 147 $exeFX.accordion.closeBlock(aID); 148 } else { 149 $exeFX.accordion.closeBlock(aID); 150 $(this).addClass('active'); 151 $('.' + k + '-accordion ' + currentAttrValue).slideDown(300, function () { 152 $exeFX.h5pResize($(this)); 153 }).addClass('open'); 154 } 155 e.preventDefault(); 156 }); 157 }, 158 rft: function (e, i) { 159 var html = ""; 160 var h = e.html(); 161 h = $exeFX.rftTitles(h); 162 var p = h.split('<' + $exeFX.h2 + '>'); 163 if (p.length == h.split('</' + $exeFX.h2 + '>').length) { 164 for (var x = 1; x < p.length; x++) { 165 html += '<' + $exeFX.h2 + '>' + p[x]; 166 } 167 } 168 169 var k = $exeFX.baseClass; 170 if ($exeFX.isOldBrowser) { 171 html = html.replace(/<H2/g, '</div>\n<H2'); 172 html = html.replace('</div>\n<H2', '<H2') 173 html = html.replace(/<\/H2>/g, '</H2>\n<div class="fx-accordion-content">'); 174 } else { 175 html = html.replace(/<h2/g, '</div>\n<h2'); 176 html = html.replace('</div>\n<h2', '<h2') 177 html = html.replace(/<\/h2>/g, '</h2>\n<div class="fx-accordion-content">'); 178 } 179 180 // Something went wrong (see #318) 181 if (html == "") { 182 $exeFX.noFX(e); 183 return; 184 } 185 186 html = html + '</div>'; 187 e.html('<div id="' + k + '-accordion-' + i + '">\n<div class="fx-accordion-section">\n' + html + '\n</div>\n</div>\n'); 188 var h2 = $("h2", e); 189 $(".fx-accordion-content", e).each(function (y) { 190 var id = k + "-accordion-" + i + "-" + y; 191 this.id = id; 192 h2.eq(y).wrap('<a class="fx-accordion-title fx-accordion-title-' + y + ' fx-C1" href="#' + id + '" id="' + id.replace("-", "_").replace("-", "_") + '-trigger"></a>'); 193 }); 194 $exeFX.accordion.enable(e); 195 }, 196 init: function (x, i) { 197 var e = $(x); 198 if (e.find('.fx-accordion-section').length > 0) { 199 $exeFX.accordion.enable(e); 200 return; 201 } 202 var a = $("h2", e); 203 if (a.length > 0) $exeFX.accordion.rft(e, i); 204 else $exeFX.noFX(e); 205 } 206 }, 207 timeline: { 208 getColor: function (e) { 209 var c = e.css("color"); 210 if (c.indexOf("rgb") != 0) return c; 211 return $exe.rgb2hex(c); 212 }, 213 rft: function (e, i) { 214 var k = $exeFX.baseClass; 215 var gID = k + "-timeline-" + i; 216 e.attr("id", gID); 217 var mainColor = $exeFX.timeline.getColor(e); 218 var titlesColor = $exe.useBlackOrWhite(mainColor.replace("#", "")); 219 var html = ""; 220 var o = e.html(); 221 var h2 = "<h2>"; 222 var _h2 = "</h2>"; 223 var h3 = "<h3>"; 224 var _h3 = "<h3>"; 225 var oldB = false; 226 if (o.indexOf("<H2") != -1) { 227 h2 = "<H2>"; 228 _h2 = "</H2>"; 229 h3 = "<H3>"; 230 _h3 = "</H3>"; 231 oldB = true; 232 } else { 233 // To rgba 234 if (mainColor.length == 7) mainColor = $exeFX.hex2rgb(mainColor, "0.8"); 235 } 236 // Remove first line if empty 237 if (o.indexOf(h2) != 0) { 238 var x = o.split(h2); 239 if (x.length == 1) return false; 240 o = o.replace(x[0], "") 241 } 242 var n = o.split(h2); 243 for (i = 0; i < n.length; i++) { 244 if (n[i].length > 0) { 245 var partTitle = ""; 246 var partContent = ""; 247 var part = n[i]; 248 var part2 = part.split(_h2); 249 if (part2.length == 2) { 250 partTitle = part2[0]; 251 partContent = part2[1]; 252 // Count the number of H3 in each content 253 var p2 = partContent.split(_h3) 254 if (p2.length == 1 || p2.length == 0) { 255 partTitle = ""; 256 partContent = ""; 257 } else { 258 if (oldB) { 259 partContent = partContent.replace(/\<\/H3>/g, '</a></h3>\n<div class="fx-timeline-event" style="display:none">'); 260 partContent = partContent.replace(/\<H3>/g, '</div>\n<h3 class="fx-timeline-event-trigger"><a href="#" style="color:' + mainColor + '" title="' + $exeFX_i18n.show + '/' + $exeFX_i18n.hide + '">'); 261 } else { 262 partContent = partContent.replace(/\<\/h3>/g, '</a></h3>\n<div class="fx-timeline-event" style="display:none">'); 263 partContent = partContent.replace(/\<h3>/g, '</div>\n<h3 class="fx-timeline-event-trigger"><a href="#" style="color:' + mainColor + '" title="' + $exeFX_i18n.show + '/' + $exeFX_i18n.hide + '">'); 264 } 265 partContent = partContent.replace('</div>', ''); 266 partContent += '</div>'; 267 partContent = '<div class="fx-timeline-major">\n<h2 class="fx-timeline-marker" title="' + $exeFX_i18n.show + '/' + $exeFX_i18n.hide + '"><span><a href="#" style="background:' + mainColor + '">' + partTitle + '</a></span></h2>\n<div class="fx-timeline-minor">\n' + partContent + '\n</div>\n</div>' 268 html += partContent; 269 } 270 } 271 } 272 } 273 if (html != "") { 274 e.addClass("fx-timeline-container").css("border-color", mainColor); 275 var ie = $exeFX.checkIE(); 276 if ((!isNaN(parseFloat(ie)) && isFinite(ie)) && ie < 8) { 277 e.addClass("fx-static-timeline-container"); 278 html = html.replace(/<h2/g, '<span class="fx-ie-dash">â</span><h2'); 279 e.html(html); 280 } else { 281 e.html('<div class="fx-timeline-toggler"><p><a href="#" class="fx-timeline-expand" style="background-color:' + mainColor + ';color:' + titlesColor + '">' + $exeFX_i18n.show + '</a></p></div>' + html) 282 } 283 $(".fx-timeline-event", e).each(function (z) { 284 this.id = "event-" + e.attr("id") + "-" + z + "EX"; 285 }); 286 $(".fx-timeline-event-trigger", e).each(function (z) { 287 this.id = "event-" + e.attr("id") + "-" + z; 288 }); 289 } 290 // Add a STYLE tag HEAD 291 if (oldB == false) { 292 var css = "<style type='text/css'>#" + gID + " .fx-timeline-major h2:before,#" + gID + " .fx-timeline-major h3:before{color:" + mainColor + "}</style>"; 293 $("HEAD").append(css); 294 } 295 }, 296 init: function (x, i) { 297 var e = $(x); 298 if (e.find('.fx-timeline-major').length > 0) { 299 e.off("click", ".fx-timeline-minor h3"); 300 e.off("click", ".fx-timeline-marker");
301 $(".fx-timeline-expand", e).off("click"); 302 return; 303 } 304 var h2 = $("H2", e); 305 var h3 = $("H3", e); 306 if (h2.length > 0 && h3.length > 0) $exeFX.timeline.rft(e, i); 307 else $exeFX.noFX(e); 308 } 309 }, 310 tabs: { 311 show: function (gID, id) { 312 var g = $("#" + gID); 313 $(".fx-tabs li", g).removeClass("fx-current").removeClass("fx-C2"); 314 $("#" + id + "-link").addClass("fx-current fx-C2"); 315 $(".fx-tab-content", g).removeClass("fx-current"); 316 var block = $("#" + id); 317 block.addClass("fx-current"); 318 $exeFX.h5pResize(block); 319 }, 320 rft: function (e, i) { 321 var html = ""; 322 var k = $exeFX.baseClass; 323 var gID = k + "-tabs-" + i; 324 var h = e.html(); 325 h = $exeFX.rftTitles(h); 326 var p = h.split('<' + $exeFX.h2 + '>'); 327 if (p.length == h.split('</' + $exeFX.h2 + '>').length) { 328 for (var x = 1; x < p.length; x++) { 329 html += '<' + $exeFX.h2 + '>' + p[x]; 330 } 331 } 332 if ($exeFX.isOldBrowser) { 333 html = html.replace(/<H2/g, '</div>\n<H2'); 334 html = html.replace('</div>\n<H2', '<H2'); 335 html = html.replace(/<H2/g, '<div class="fx-tab-content fx-C2">\n<H2 class="sr-av"'); 336 } else { 337 html = html.replace(/<h2/g, '</div>\n<h2'); 338 html = html.replace('</div>\n<h2', '<h2'); 339 html = html.replace(/<h2/g, '<div class="fx-tab-content fx-C2">\n<h2 class="sr-av"'); 340 } 341 342 // Something went wrong (see #318) 343 if (html == "") { 344 $exeFX.noFX(e); 345 return; 346 } 347 348 html = html + '</div>'; 349 e.attr("id", gID).html(html); 350 351 var ul = '<ul class="fx-tabs">\n'; 352 $(".fx-tab-content", e).each(function (y) { 353 var h2 = $("H2", this).eq(0); 354 355 // Default tab title 356 var t = y + 1; 357 if (h2.length == 0) { 358 // Can't getElementsByTagName("H2") in some ePub readers (xmlns="http://www.w3.org/1999/xhtml"...) 359 var tit = this.innerHTML.split(">"); 360 if (tit.length > 1) tit = tit[1]; 361 tit = tit.split("<"); 362 if (tit.length > 1) tit = tit[0]; 363 if (tit.length > 0) t = tit; 364 } else { 365 // Normal behavior 366 t = h2.text(); 367 } 368 369 var hT = $("SPAN", h2); 370 if (hT.length == 1) { 371 hT = hT.eq(0).attr("title"); 372 if (hT) { 373 t = hT; 374 h2.removeClass("sr-av") 375 } 376 } 377 var id = k + "-tab-" + i + "-" + y; 378 var c = ""; 379 if (y == 0) { 380 c += ' class="fx-current fx-C2"'; 381 this.className += " fx-current fx-default-panel"; 382 } 383 ul += '<li' + c + ' id="' + id + '-link"><a href="#' + id + '" class="exeFXTabLink' + gID + '_' + id + '">' + t + '</a></li>\n'; 384 this.id = id; 385 }); 386 ul += '</ul>'; 387 e.prepend(ul); 388 // onclick 389 $(".fx-tabs a", e).off('click').click( 390 function () { 391 var c = this.className; 392 c = c.split(" "); 393 for (var i = 0; i < c.length; i++) { 394 if (c[i].indexOf("exeFXTabLink") == 0) c = c[i]; 395 } 396 c = c.replace("exeFXTabLink", ""); 397 c = c.split("_"); 398 if (c.length == 2) { 399 $exeFX.tabs.show(c[0], c[1]); 400 } 401 return false; 402 } 403 ); 404 }, 405 init: function (x, i) { 406 var e = $(x); 407 if (e.find('.fx-tabs').length > 0) { 408 $(".fx-tabs a", e).off('click').click( 409 function () { 410 var c = this.className; 411 c = c.split(" "); 412 for (var i = 0; i < c.length; i++) { 413 if (c[i].indexOf("exeFXTabLink") == 0) c = c[i]; 414 } 415 c = c.replace("exeFXTabLink", ""); 416 c = c.split("_"); 417 if (c.length == 2) { 418 $exeFX.tabs.show(c[0], c[1]); 419 } 420 return false; 421 } 422 ); 423 return; 424 } 425 var a = $("h2", e); 426 if (a.length > 0) $exeFX.tabs.rft(e, i); 427 else $exeFX.noFX(e); 428 } 429 }, 430 paginated: { 431 show: function (gID, id, n) { 432 n = parseInt(n); 433 var g = $("#" + gID); 434 var lis = $(".fx-pagination li", g); 435 436 // Pagination 437 var l = (lis.length - 2); 438 if (l == 1) return false;
439 var prevLi = $("#" + gID + "-prev"); 440 var prevA = document.getElementById(gID + "-prev-lnk"); 441 var nextLi = $("#" + gID + "-next"); 442 var nextA = document.getElementById(gID + "-next-lnk"); 443 if (!prevA || !nextA) return false; 444 if (n == 0) { 445 // Prev 446 prevLi.addClass("fx-disabled"); 447 prevA.className = "fx-disabled-link"; 448 // Next 449 nextLi.removeClass("fx-disabled"); 450 nextA.className = "exeFXPageLink" + gID + "_" + gID + "-1_1"; 451 } else { 452 // Prev 453 prevLi.removeClass("fx-disabled"); 454 prevA.className = "exeFXPageLink" + gID + "_" + gID + "-" + (n - 1) + "_" + (n - 1); 455 // Next 456 if ((n + 2) > l) { 457 nextLi.addClass("fx-disabled"); 458 nextA.className = "fx-disabled-link"; 459 } else { 460 nextLi.removeClass("fx-disabled"); 461 nextA.className = "exeFXPageLink" + gID + "_" + gID + "-" + (n + 1) + "_" + (n + 1); 462 } 463 } 464 465 lis.removeClass("fx-current").removeClass("fx-C1"); 466 $("#" + id + "-link").addClass("fx-current fx-C1"); 467 $(".fx-page-content", g).removeClass("fx-current"); 468 var block = $("#" + id); 469 block.addClass("fx-current"); 470 $exeFX.h5pResize(block); 471 }, 472 init: function (x, i) { 473 var e = $(x); 474 if (e.find('.fx-pagination').length > 0) { 475 $(".fx-pagination a", e).off('click').click( 476 function () { 477 var a = $(this); 478 if (a.hasClass("fx-disabled-link")) { 479 return false; 480 } 481 var c = a.attr("class"); 482 c = c.split(" "); 483 for (var i = 0; i < c.length; i++) { 484 if (c[i].indexOf("exeFXPageLink") == 0) c = c[i]; 485 } 486 c = c.replace("exeFXPageLink", ""); 487 c = c.split("_"); 488 if (c.length == 3) { 489 $exeFX.paginated.show(c[0], c[1], c[2]); 490 } 491 return false; 492 } 493 ); 494 return; 495 } 496 var a = $("h2", e); 497 if (a.length > 0) $exeFX.paginated.rft(e, i); 498 else $exeFX.noFX(e); 499 }, 500 rft: function (e, i) { 501 var html = ""; 502 var k = $exeFX.baseClass; 503 var gID = k + "-paginated-" + i; 504 var h = e.html(); 505 h = $exeFX.rftTitles(h); 506 var p = h.split('<' + $exeFX.h2 + '>'); 507 if (p.length == h.split('</' + $exeFX.h2 + '>').length) { 508 for (var x = 1; x < p.length; x++) { 509 html += '<' + $exeFX.h2 + '>' + p[x]; 510 } 511 } 512 if ($exeFX.isOldBrowser) { 513 html = html.replace(/<H2/g, '</div>\n<H2'); 514 html = html.replace('</div>\n<H2', '<H2'); 515 html = html.replace(/<H2/g, '<div class="fx-page-content fx-C2">\n<H2'); 516 } else { 517 html = html.replace(/<h2/g, '</div>\n<h2'); 518 html = html.replace('</div>\n<h2', '<h2'); 519 html = html.replace(/<h2/g, '<div class="fx-page-content fx-C2">\n<h2'); 520 } 521 522 // Something went wrong (see #318) 523 if (html == "") { 524 $exeFX.noFX(e); 525 return; 526 } 527 528 html = html + '</div>'; 529 e.attr("id", gID).html(html); 530 531 var counter = 0; 532 var hasNext = false; 533 var ul = '<ul class="fx-pagination">\n'; 534 ul += '<li id="' + k + '-paginated-' + i + '-prev" class="fx-prev-next fx-prev fx-disabled"><a href="#" id="' + k + '-paginated-' + i + '-prev-lnk" title="' + $exeFX_i18n.previous + '" class="fx-disabled-link"><span>◄</span><span class="sr-av"> ' + $exeFX_i18n.previous + '</span></a></li>'; 535 $(".fx-page-content", e).each(function (y) { 536 var t = $("H2", this).eq(0).text(); 537 t = t.replace(/\"/g, '"'); 538 var id = k + "-paginated-" + i + "-" + y; 539 var c = ""; 540 if (y == 0) { 541 c += ' class="fx-current fx-C1"'; 542 this.className += " fx-current"; 543 } 544 ul += '<li' + c + ' id="' + id + '-link"><a href="#' + id + '" class="exeFXPageLink' + gID + '_' + id + '_' + y + '" title="' + t + '">' + (y + 1) + '</a></li>\n'; 545 this.id = id; 546 counter++; 547 }); 548 if (counter > 1) hasNext = true; 549 ul += '<li id="' + k + '-paginated-' + i + '-next" class="fx-prev-next fx-next';
550 var css = 'exeFXPageLink' + gID + '_' + gID + '-1_1'; 551 if (!hasNext) { 552 ul += ' fx-disabled'; 553 css = 'fx-disabled-link'; 554 } 555 ul += '"><a href="#" id="' + k + '-paginated-' + i + '-next-lnk" title="' + $exeFX_i18n.next + '" class="' + css + '"><span>►</span><span class="sr-av"> ' + $exeFX_i18n.next + '</span></a></li>'; 556 ul += '</ul>'; 557 e.prepend(ul); 558 // onclick 559 $(".fx-pagination a", e).off('click').click( 560 function () { 561 var a = $(this); 562 if (a.hasClass("fx-disabled-link")) { 563 return false; 564 } 565 var c = a.attr("class"); 566 c = c.split(" "); 567 for (var i = 0; i < c.length; i++) { 568 if (c[i].indexOf("exeFXPageLink") == 0) c = c[i]; 569 } 570 c = c.replace("exeFXPageLink", ""); 571 c = c.split("_"); 572 if (c.length == 3) { 573 $exeFX.paginated.show(c[0], c[1], c[2]); 574 } 575 return false; 576 } 577 ); 578 } 579 }, 580 carousel: { 581 isWorking: false, 582 show: function (gID, id, n) { 583 if ($exeFX.carousel.isWorking) return false; 584 $exeFX.carousel.isWorking = true; 585 n = parseInt(n); 586 var g = $("#" + gID); 587 var lis = $(".fx-carousel-pagination li", g); 588 589 // Pagination 590 var l = (lis.length - 2); 591 if (l == 1) return false; 592 var prevLi = $("#" + gID + "-prev"); 593 var prevA = document.getElementById(gID + "-prev-lnk"); 594 var nextLi = $("#" + gID + "-next"); 595 var nextA = document.getElementById(gID + "-next-lnk"); 596 if (!prevA || !nextA) return false; 597 if (n == 0) { 598 // Prev 599 prevLi.addClass("fx-disabled"); 600 prevA.className = "fx-disabled-link"; 601 // Next 602 nextLi.removeClass("fx-disabled"); 603 nextA.onclick = function () { 604 $exeFX.carousel.show(gID, gID + "-1", 1); 605 return false; 606 } 607 } else { 608 // Prev 609 prevLi.removeClass("fx-disabled"); 610 prevA.className = "exeFXSlideLink" + gID + "_" + gID + "-" + (n - 1) + "_" + (n - 1); 611 // Next 612 if ((n + 2) > l) { 613 nextLi.addClass("fx-disabled"); 614 nextA.className = "fx-disabled-link"; 615 } else { 616 nextLi.removeClass("fx-disabled"); 617 nextA.className = "exeFXSlideLink" + gID + "_" + gID + "-" + (n + 1) + "_" + (n + 1); 618 } 619 } 620 621 lis.removeClass("fx-current").removeClass("fx-C1"); 622 $("#" + id + "-link").addClass("fx-current fx-C1"); 623 $(".fx-carousel-content", g).hide(); 624 $("#" + id).fadeIn("slow", function () { 625 $exeFX.carousel.isWorking = false; 626 $exeFX.h5pResize($(this)); 627 }); 628 }, 629 init: function (x, i) { 630 var e = $(x); 631 if (e.find('.fx-carousel-pagination').length > 0) { 632 $(".fx-carousel-pagination a", e).off('click').click( 633 function () { 634 var a = $(this); 635 if (a.hasClass("fx-disabled-link")) { 636 return false; 637 } 638 var c = a.attr("class"); 639 c = c.split(" "); 640 for (var i = 0; i < c.length; i++) { 641 if (c[i].indexOf("exeFXSlideLink") == 0) c = c[i]; 642 } 643 c = c.replace("exeFXSlideLink", ""); 644 c = c.split("_"); 645 if (c.length == 3) { 646 $exeFX.carousel.show(c[0], c[1], c[2]); 647 } 648 return false; 649 } 650 ); 651 return; 652 } 653 var a = $("h2", e); 654 if (a.length > 0) $exeFX.carousel.rft(e, i); 655 else $exeFX.noFX(e); 656 }, 657 rft: function (e, i) { 658 var html = ""; 659 var k = $exeFX.baseClass; 660 var gID = k + "-carousel-" + i; 661 var h = e.html(); 662 h = $exeFX.rftTitles(h); 663 var p = h.split('<' + $exeFX.h2 + '>'); 664 if (p.length == h.split('</' + $exeFX.h2 + '>').length) { 665 for (var x = 1; x < p.length; x++) { 666 html += '<' + $exeFX.h2 + '>' + p[x]; 667 } 668 } 669 if ($exeFX.isOldBrowser) { 670 html = html.replace(/<H2/g, '</div>\n<H2'); 671 html = html.replace('</div>\n<H2', '<H2'); 672 html = html.replace(/<H2/g, '<div class="fx-carousel-content fx-C2">\n<H2'); 673 } else { 674 html = html.replace(/<h2/g, '</div>\n<h2'); 675 html = html.replace('</div>\n<h2', '<h2'); 676 html = html.replace(/<h2/g, '<div class="fx-carousel-content fx-C2">\n<h2'); 677 } 678 679 // Something went wrong (see #318) 680 if (html == "") { 681 $exeFX.noFX(e); 682 return; 683 } 684 685 html = html + '</div>'; 686 e.attr("id", gID).html(html); 687 688 var counter = 0; 689 var hasNext = false;
690 var ul = '<ul class="fx-pagination fx-carousel-pagination">\n'; 691 ul += '<li id="' + k + '-carousel-' + i + '-prev" class="fx-carousel-prev-next fx-carousel-prev fx-disabled fx-C2"><a href="#" id="exe-carousel-' + i + '-prev-lnk" title="' + $exeFX_i18n.previous + '" class="fx-disabled-link"><span>◄</span><span class="sr-av"> ' + $exeFX_i18n.previous + '</span></a></li>'; 692 $(".fx-carousel-content", e).each(function (y) { 693 var t = $("H2", this).eq(0).text(); 694 t = t.replace(/\"/g, '"'); 695 var id = k + "-carousel-" + i + "-" + y; 696 var c = ""; 697 if (y == 0) { 698 c += ' class="fx-current fx-C1"'; 699 this.className += " fx-current"; 700 } 701 ul += '<li' + c + ' id="' + id + '-link"><a href="#' + id + '" class="exeFXSlideLink' + gID + '_' + id + '_' + y + '" title="' + t + '">' + (y + 1) + '</a></li>\n'; 702 this.id = id; 703 counter++; 704 }); 705 if (counter > 1) hasNext = true; 706 ul += '<li id="' + k + '-carousel-' + i + '-next" class="fx-carousel-prev-next fx-carousel-next fx-C2'; 707 if (!hasNext) ul += ' fx-disabled'; 708 ul += '"><a href="#" id="' + k + '-carousel-' + i + '-next-lnk" title="' + $exeFX_i18n.next + '"'; 709 if (hasNext) ul += ' class="exeFXSlideLink' + gID + '_' + gID + '-1_1"' 710 ul += '><span>►</span><span class="sr-av"> ' + $exeFX_i18n.next + '</span></a></li>'; 711 ul += '</ul>'; 712 e.append(ul); 713 // onclick 714 $(".fx-carousel-pagination a", e).off('click').click( 715 function () { 716 var a = $(this); 717 if (a.hasClass("fx-disabled-link")) { 718 return false; 719 } 720 var c = a.attr("class"); 721 c = c.split(" "); 722 for (var i = 0; i < c.length; i++) { 723 if (c[i].indexOf("exeFXSlideLink") == 0) c = c[i]; 724 } 725 c = c.replace("exeFXSlideLink", ""); 726 c = c.split("_"); 727 if (c.length == 3) { 728 $exeFX.carousel.show(c[0], c[1], c[2]); 729 } 730 return false; 731 } 732 ); 733 } 734 }, 735 checkIE: function () { 736 var n = navigator.userAgent.toLowerCase(); 737 return (n.indexOf('msie') != -1) ? parseInt(n.split('msie')[1]) : false; 738 } 739} 740 741$(function () { 742 if (window.eXeLearning === undefined) $exeFX.init(); 743}); 744 745/* 746* Timeliner.js 747* @version 1.5.1 748* @copyright Tarek Anandan (http://www.technotarek.com) 749*/ 750; (function (e) { var t; e.timeliner = function (n) { t = jQuery.extend({ timelineContainer: ".fx-timeline-container", startState: "closed", startOpen: [], baseSpeed: 100, speed: 4, fontOpen: "1.1em", fontClosed: "1em", expandAllText: $exeFX_i18n.show, collapseAllText: $exeFX_i18n.hide }, n); e(document).ready(function () { function n(n, r) { e(n).removeClass("closed").addClass("open").animate({ fontSize: t.fontOpen }, t.baseSpeed); e(r).show(t.speed * t.baseSpeed) } function r(n, r) { e(n).animate({ fontSize: t.fontClosed }, 0).removeClass("open").addClass("closed"); e(r).hide(t.speed * t.baseSpeed) } if (t.startState === "closed") { e(".fx-timeline-event").hide(); e.each(e(t.startOpen), function (t, r) { n(e(r).parent(".fx-timeline-minor").find("h3 a"), e(r)) }) } else { n(e(".fx-timeline-minor h3 a"), e(".fx-timeline-event")) } e(t.timelineContainer).on("click", ".fx-timeline-minor h3", function () { var t = e(this).attr("id"); if (e(this).find("a").is(".open")) { r(e("a", this), e("#" + t + "EX")); return false } else { n(e("a", this), e("#" + t + "EX")) } return false }); e(t.timelineContainer).on("click", ".fx-timeline-marker", function () { var t = e(this).parents(".fx-timeline-major").find(".fx-timeline-minor").length; var i = e(this).parents(".fx-timeline-major").find(".open").length; if (t > i) { n(e(this).parents(".fx-timeline-major").find("h3 a", ".fx-timeline-minor"), e(this).parents(".fx-timeline-major").find(".fx-timeline-event")) } else { r(e(this).parents(".fx-timeline-major").find(".fx-timeline-minor a"), e(this).parents(".fx-timeline-major").find(".fx-timeline-event")) } return false }); e(".fx-timeline-expand").click(function () { if (e(this).hasClass("expanded")) { r(e(this).parents(t.timelineContainer).find("h3 a", ".fx-timeline-minor"), e(this).parents(t.timelineContainer).find(".fx-timeline-event")); e(this).removeClass("expanded").html(t.expandAllText) } else { n(e(this).parents(t.timelineContainer).find("h3 a", ".fx-timeline-minor"), e(this).parents(t.timelineContainer).find(".fx-timeline-event")); e(this).addClass("expanded").html(t.collapseAllText) } return false }) }) } })(jQuery);
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.