1/** 2* Main script file 3* @package Highlighter GK5 4* @Copyright (C) 2009-2013 Gavick.com 5* @ All rights reserved 6* @ Joomla! is Free Software 7* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html 8* @version $Revision: GK5 1.0 $ 9**/ 10 11window.addEvent("domready", function () { 12 $$('.gkHighlighterGK5').each(function (el, i) { 13 var config = JSON.decode(el.get('data-config')); 14 el.addClass('active'); 15 new GKNewsHighligher({ 16 wrapper: el, 17 speed: config.animationSpeed, 18 interval: config.animationInterval, 19 fun: config.animationFun, 20 type: config.animationType, 21 mouseOver: config.mouseover 22 }); 23 }); 24}); 25var GKNewsHighligher = new Class({ 26 options: { 27 wrapper: null, 28 speed: null, 29 interval: null, 30 fun: null, 31 type: null, 32 mouseOver: null 33 }, 34 initialize: function (options) { 35 this.setOptions(options); 36 var $this = this; 37 this.prev = null; 38 this.next = null; 39 this.options.fun = this.options.fun.split("."); 40 41 this.barCounter = 0; 42 this.item_anim = false; 43 this.wrapper = this.options.wrapper.getElement('.gkHighlighterWrapper'); 44 var modInterface = this.options.wrapper.getElement('.gkHighlighterInterface'); 45 46 if (modInterface) { 47 if (modInterface.getElement('.next')) { 48 this.prev = this.options.wrapper.getElement('.prev'); 49 this.next = this.options.wrapper.getElement('.next'); 50 } 51 $this.wrapper.setStyle('margin-' + this.options.wrapper.getElement('.gkHighlighterInterface').getProperty('data-pos'), this.options.wrapper.getElement('.gkHighlighterInterface').getSize().x + 25 + "px"); 52 } 53 54 if ($this.wrapper.getElement('.nowrap')) { 55 $this.wrapper.getElement('.nowrap').setStyle('position', 'static'); 56 } 57 58 switch(this.options.type) { 59 case 'linear' : this.linear(); break; 60 case 'slides' : this.slides(); break; 61 case 'slidesBottom' : this.slidesBottom(); break; 62 case 'slidesLayerBottom': this.slidesLayerBottom(); break; 63 case 'slidesLayer' : this.slidesLayer(); break; 64 case 'flipx' : this.flipx(); break; 65 case 'fadeLeft' : this.fadeLeft(); break; 66 case 'opacity' : this.opacity(); break; 67 case 'bar' : if(this.isIE()) { 68 this.options.type = 'flipx'; 69 this.flipx(); 70 } else { this.bar(); } break; 71 } 72 }, 73 isIE : function() { 74 var myNav = navigator.userAgent.toLowerCase(); 75 return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false; 76 }, 77 setRotation: function(rotation) { 78 // set z-rotiation 79 this.options.wrapper.getElement('.gkHighlighterWrapperSub').setStyles({ 80 '-webkit-transform': rotation, 81 '-moz-transform': rotation, 82 '-o-transform': rotation, 83 'transform': rotation 84 }); 85 }, 86 // linear animation type - infite scroller 87 linear: function() { 88 var $this = this; 89 90 var nowrap = $this.options.wrapper.getElement('.nowrap'); 91 $this.w = 0; 92 $this.options.wrapper.getElements('.nowrap > span').each(function (elmt, i) { 93 $this.w += elmt.getSize().x; 94 }); 95 $this.w += 80; 96 97 $this.options.wrapper.getElement('.gkHighlighterWrapperSub').setStyle('overflow', 'hidden'); 98 var time = (($this.w + $this.options.wrapper.getSize().x) / $this.options.speed) * 1000; 99 var timeOriginal = time; 100 var effect = new Fx.Tween(nowrap, { 101 duration: time, 102 transition: Fx.Transitions.linear, 103 onComplete: function () { 104 var w = $this.options.wrapper.getSize().x; 105 effect.set('margin-left', w); 106 effect.start('margin-left', w, -$this.w); 107 } 108 }); 109 if ($this.options.mouseOver == 'true') { 110 nowrap.addEvent("mouseenter", function () { 111 effect.pause(); 112 }); 113 nowrap.addEvent("mouseleave", function () { 114 effect.resume(); 115 }); 116 } 117 effect.set('margin-left', $this.options.wrapper.getSize().x); 118 effect.start('margin-left', $this.options.wrapper.getSize().x, -$this.w); 119 }, 120 121 // flip rotation, based on CSS3 transitions 122 flipx: function () { 123 var $this = this; 124 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 125 $this.wrapper.setStyle('max-height', '20px'); 126 $this.actual = 0; 127 $this.mouseIsOver = false; 128 $this.animPlay = false; 129 // 130 $this.timer = setInterval(function () { 131 $this.timerFunc(); 132 },$this.options.interval); 133 // 134 $this.items.each(function (elm, j) { 135 //elm.setStyle('z-index', $this.items.length - j); 136 if (j !== 0) { 137 elm.setStyle('opacity', 0); 138 } 139 }); 140 // 141 if ($this.options.mouseOver == 'true') { 142 $this.wrapper.addEvent("mouseenter", function () { 143 $this.mouseIsOver = true; 144 }); 145 $this.wrapper.addEvent("mouseleave", function () { 146 $this.mouseIsOver = false;
147 }); 148 } 149 if ($this.next) { 150 $this.next.addEvent('click', function (e) { 151 new Event(e).stop(); 152 if (!$this.animPlay) { 153 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('flipOutX').setStyle('opacity', '0'); 154 $this.actual++; 155 if ($this.actual > $this.items.length - 1) { 156 $this.actual = 0; 157 } 158 clearTimeout($this.timer); 159 160 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 161 162 setTimeout(function () { 163 $this.items[$this.actual].addClass('flipInX').setStyle('opacity', '1'); 164 },$this.options.speed); 165 $this.timer = setInterval(function () { 166 $this.timerFunc(); 167 },$this.options.interval); 168 } 169 }); 170 $this.prev.addEvent('click', function (e) { 171 new Event(e).stop(); 172 if (!$this.animPlay) { 173 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('flipOutX').setStyle('opacity', '0'); 174 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 175 clearTimeout($this.timer); 176 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 177 setTimeout(function () { 178 $this.items[$this.actual].addClass('flipInX').setStyle('opacity', '1'); 179 },$this.options.speed); 180 $this.timer = setInterval(function () { 181 $this.timerFunc(); 182 },$this.options.interval); 183 } 184 }); 185 } 186 }, 187 188 // 3D rotating bar animation 189 bar: function () { 190 var $this = this; 191 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 192 $this.wrapper.addClass('bar'); 193 $this.actual = 0; 194 $this.mouseIsOver = false; 195 $this.animPlay = false; 196 // 197 $this.timer = setInterval(function () { 198 $this.timerFunc(); 199 },$this.options.interval); 200 // 201 $this.items.each(function (elm, j) { 202 elm.setStyle('opacity', 0); 203 switch(j) { 204 case 0 : elm.addClass('front'); elm.setStyle('opacity', 1); break; 205 case 1 : elm.addClass('bottom'); break; 206 case 2 : elm.addClass('back'); break; 207 case 3 : elm.addClass('top'); break; 208 default: elm.set('class', 'gkHighlighterItem gkHidden'); break; 209 210 } 211 212 }); 213 // 214 if ($this.options.mouseOver == 'true') { 215 $this.wrapper.addEvent("mouseenter", function () { 216 $this.mouseIsOver = true; 217 }); 218 $this.wrapper.addEvent("mouseleave", function () { 219 $this.mouseIsOver = false; 220 }); 221 } 222 if ($this.next) { 223 $this.next.addEvent('click', function (e) { 224 new Event(e).stop(); 225 if (!$this.animPlay) { 226 $this.actual++; 227 $this.barCounter++; 228 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 229 var rotation = 'rotateX(' + $this.barCounter * -90 + 'deg)'; 230 clearTimeout($this.timer); 231 var active = $this.barCounter%$this.items.length; 232 $this.items[active].setStyle('opacity', 1); 233 $this.setRotation(rotation); 234 // 235 $this.timer = setInterval(function () { 236 $this.timerFunc(); 237 },$this.options.interval); 238 } 239 }); 240 $this.prev.addEvent('click', function (e) { 241 new Event(e).stop(); 242 if (!$this.animPlay) { 243 $this.actual--; 244 $this.barCounter--; 245 if ($this.actual > $this.items.length - 1) { 246 $this.actual = 0; 247 } 248 var active = $this.barCounter%$this.items.length; 249 $this.items[active].setStyle('opacity', 1); 250 var rotation = 'rotateX(' + $this.barCounter * -90 + 'deg)'; 251 clearTimeout($this.timer); 252 $this.setRotation(rotation); 253 // 254 $this.timer = setInterval(function () { 255 $this.timerFunc(); 256 },$this.options.interval); 257 } 258 }); 259 } 260 }, 261 262 // fade from left side animation 263 fadeLeft: function () { 264 var $this = this; 265 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 266 $this.wrapper.setStyle('max-height', '20px'); 267 $this.actual = 0; 268 $this.mouseIsOver = false; 269 $this.animPlay = false; 270 // 271 $this.timer = setInterval(function () { 272 $this.timerFunc(); 273 },$this.options.interval); 274 // 275 $this.items.each(function (elm, j) { 276 elm.setStyle('z-index', $this.items.length - j); 277 if (j !== 0) { 278 elm.addClass('invisible'); 279 } 280 }); 281 // 282 if ($this.options.mouseOver == 'true') { 283 $this.wrapper.addEvent("mouseenter", function () { 284 $this.mouseIsOver = true; 285 }); 286 $this.wrapper.addEvent("mouseleave", function () { 287 $this.mouseIsOver = false;
288 }); 289 } 290 if ($this.next) { 291 $this.next.addEvent('click', function (e) { 292 new Event(e).stop(); 293 if (!$this.animPlay) { 294 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOutLeft'); 295 $this.actual++; 296 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 297 clearTimeout($this.timer); 298 $this.items[$this.actual].setStyle('opacity', 0); 299 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 300 setTimeout(function () { 301 $this.items[$this.actual].addClass('fadeInLeft'); 302 }, $this.options.speed); 303 $this.timer = setInterval(function () { 304 $this.timerFunc(); 305 },$this.options.interval); 306 } 307 }); 308 $this.prev.addEvent('click', function (e) { 309 new Event(e).stop(); 310 if (!$this.animPlay) { 311 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOutLeft'); 312 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 313 clearTimeout($this.timer); 314 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 315 setTimeout(function () { 316 $this.items[$this.actual].addClass('fadeInLeft'); 317 },$this.options.speed); 318 $this.timer = setInterval(function () { 319 $this.timerFunc(); 320 },$this.options.interval); 321 } 322 }); 323 } 324 }, 325 326 // opacity animation 327 opacity: function () { 328 var $this = this; 329 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 330 $this.wrapper.setStyle('max-height', '20px'); 331 $this.actual = 0; 332 $this.mouseIsOver = false; 333 $this.animPlay = false; 334 // 335 $this.timer = setInterval(function () { 336 $this.timerFunc(); 337 },$this.options.interval); 338 // 339 $this.items.each(function (elm, j) { 340 elm.setStyle('z-index', $this.items.length - j); 341 if (j !== 0) { 342 elm.setStyle('opacity', 0); 343 } 344 }); 345 // 346 if ($this.options.mouseOver == 'true') { 347 $this.wrapper.addEvent("mouseenter", function () { 348 $this.mouseIsOver = true; 349 }); 350 $this.wrapper.addEvent("mouseleave", function () { 351 $this.mouseIsOver = false; 352 }); 353 } 354 if ($this.next) { 355 $this.next.addEvent('click', function (e) { 356 new Event(e).stop(); 357 if (!$this.animPlay) { 358 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOut'); 359 $this.actual++; 360 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 361 clearTimeout($this.timer); 362 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 363 $this.items[$this.actual].setStyle('opacity', 1); 364 $this.timer = setInterval(function () { 365 $this.timerFunc(); 366 },$this.options.interval); 367 } 368 }); 369 $this.prev.addEvent('click', function (e) { 370 new Event(e).stop(); 371 if (!$this.animPlay) { 372 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOut'); 373 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 374 clearTimeout($this.timer); 375 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 376 $this.items[$this.actual].setStyle('opacity', 1); 377 $this.timer = setInterval(function () { 378 $this.timerFunc(); 379 },$this.options.interval); 380 } 381 }); 382 } 383 }, 384 385 // slides to top animation 386 slides: function () { 387 var $this = this; 388 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 389 $this.items.setStyle('display', 'block'); 390 $this.effects1 = []; 391 $this.effects2 = []; 392 $this.actual = 0; 393 $this.mouseIsOver = false; 394 $this.animPlay = false; 395 // 396 $this.timer = setInterval(function () { 397 $this.timerFunc(); 398 },$this.options.interval); 399 // 400 $this.items.each(function (elm, j) { 401 elm.setStyle('z-index', $this.items.length - j); 402 $this.effects1[j] = new Fx.Tween(elm, { 403 duration: $this.options.speed, 404 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 405 wait: true, 406 onStart: function () { 407 $this.animPlay = true; 408 }, 409 onComplete: function () { 410 $this.animPlay = false; 411 } 412 }); 413 $this.effects2[j] = new Fx.Tween(elm, { 414 duration: $this.options.speed, 415 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 416 wait: true 417 }); 418 if (j !== 0) $this.effects1[j].set('opacity', 0); 419 if ($this.options.type !== 'linear') $this.effects2[j].set('top', 0); 420 }); 421 // 422 if ($this.options.mouseOver == 'true') { 423 $this.wrapper.addEvent("mouseenter", function () { 424 $this.mouseIsOver = true; 425 }); 426 $this.wrapper.addEvent("mouseleave", function () { 427 $this.mouseIsOver = false;
428 }); 429 } 430 if ($this.next) { 431 $this.next.addEvent('click', function (e) { 432 new Event(e).stop(); 433 if (!$this.animPlay) { 434 $this.effects1[$this.actual].start('opacity', 0); 435 $this.effects2[$this.actual].start('top', 0, -24); 436 $this.actual++; 437 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 438 $this.effects1[$this.actual].start('opacity', 1); 439 $this.effects2[$this.actual].start('top', 24, 0); 440 // 441 clearTimeout($this.timer); 442 $this.timer = setInterval(function () { 443 $this.timerFunc(); 444 },$this.options.interval); 445 } 446 }); 447 $this.prev.addEvent('click', function (e) { 448 new Event(e).stop(); 449 if (!$this.animPlay) { 450 $this.effects1[$this.actual].start('opacity', 0); 451 $this.effects2[$this.actual].start('top', 0, 24); 452 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 453 $this.effects1[$this.actual].start('opacity', 1); 454 $this.effects2[$this.actual].start('top', -24, 0); 455 // 456 clearTimeout($this.timer); 457 $this.timer = setInterval(function () { 458 $this.timerFunc(); 459 },$this.options.interval); 460 } 461 }); 462 } 463 }, 464 465 // slides to bottom 466 slidesBottom: function () { 467 var $this = this; 468 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 469 $this.items.setStyle('display', 'block'); 470 $this.effects1 = []; 471 $this.effects2 = []; 472 $this.actual = 0; 473 $this.mouseIsOver = false; 474 $this.animPlay = false; 475 // 476 $this.timer = setInterval(function () { 477 $this.timerFunc(); 478 }, $this.options.interval); 479 // 480 $this.items.each(function (elm, j) { 481 $this.effects1[j] = new Fx.Tween(elm, { 482 duration: $this.options.speed, 483 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 484 wait: true, 485 onStart: function () { 486 $this.animPlay = true; 487 }, 488 onComplete: function () { 489 $this.animPlay = false; 490 } 491 }); 492 $this.effects2[j] = new Fx.Tween(elm, { 493 duration: $this.options.speed, 494 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 495 wait: true 496 }); 497 if (j !== 0) $this.effects1[j].set('opacity', 0); 498 if ($this.options.type !== 'linear') $this.effects2[j].set('top', 0); 499 }); 500 // 501 if ($this.options.mouseOver == 'true') { 502 $this.wrapper.addEvent("mouseenter", function () { 503 $this.mouseIsOver = true; 504 }); 505 $this.wrapper.addEvent("mouseleave", function () { 506 $this.mouseIsOver = false; 507 }); 508 } 509 if ($this.next) { 510 $this.next.addEvent('click', function (e) { 511 new Event(e).stop(); 512 if (!$this.animPlay) { 513 $this.effects1[$this.actual].start('opacity', 0); 514 $this.effects2[$this.actual].start('top', 0, 24); 515 $this.actual++; 516 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 517 $this.effects1[$this.actual].start('opacity', 1); 518 $this.effects2[$this.actual].start('top', -24, 0); 519 // 520 clearTimeout($this.timer); 521 $this.timer = setInterval(function () { 522 $this.timerFunc(); 523 },$this.options.interval); 524 } 525 }); 526 $this.prev.addEvent('click', function (e) { 527 new Event(e).stop(); 528 if (!$this.animPlay) { 529 $this.effects1[$this.actual].start('opacity', 0); 530 $this.effects2[$this.actual].start('top', 0, -24); 531 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 532 $this.effects1[$this.actual].start('opacity', 1); 533 $this.effects2[$this.actual].start('top', 24, 0); 534 // 535 clearTimeout($this.timer); 536 $this.timer = setInterval(function () { 537 $this.timerFunc(); 538 },$this.options.interval); 539 } 540 }); 541 } 542 }, 543 slidesLayer: function () { 544 var $this = this; 545 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 546 $this.wrapper.setStyle('max-height', '20px'); 547 $this.effects1 = []; 548 $this.effects2 = []; 549 $this.actual = 0; 550 $this.mouseIsOver = false; 551 $this.animPlay = false; 552 // 553 $this.timer = setInterval(function () { 554 $this.timerFunc(); 555 },$this.options.interval); 556 // 557 $this.items.each(function (elm, j) { 558 elm.setStyle('z-index', $this.items.length - j); 559 $this.effects1[j] = new Fx.Tween(elm, { 560 duration: $this.options.speed, 561 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 562 wait: true, 563 onStart: function () { 564 $this.animPlay = true; 565 }, 566 onComplete: function () { 567 $this.animPlay = false;
568 } 569 }); 570 $this.effects2[j] = new Fx.Tween(elm, { 571 onComplete: function () { 572 elm.setStyle('top', '0'); 573 elm.setStyle('z-index', 1); 574 }, 575 duration: $this.options.speed, 576 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 577 wait: true 578 }); 579 if (j !== 0) $this.effects1[j].set('opacity', 0); 580 }); 581 // 582 if ($this.options.mouseOver == 'true') { 583 $this.wrapper.addEvent("mouseenter", function () { 584 $this.mouseIsOver = true; 585 }); 586 $this.wrapper.addEvent("mouseleave", function () { 587 $this.mouseIsOver = false; 588 }); 589 } 590 if ($this.next) { 591 $this.next.addEvent('click', function (e) { 592 new Event(e).stop(); 593 if (!$this.animPlay) { 594 $this.effects1[$this.actual].start('opacity', 0); 595 $this.effects2[$this.actual].start('top', 0, -$this.items[$this.actual].getSize().y); 596 var counter = 0; 597 // re-order items by z-index 598 for (var i = $this.actual; i < $this.items.length; i++) { 599 $this.items[i].setStyle('z-index', $this.items.length - counter); 600 counter++; 601 } 602 for (i = 0; i < $this.actual; i++) { 603 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 604 } 605 $this.actual++; 606 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 607 $this.effects1[$this.actual].start('opacity', 1); // 608 clearTimeout($this.timer); 609 $this.timer = setInterval(function () { 610 $this.timerFunc(); 611 },$this.options.interval); 612 } 613 }); 614 $this.prev.addEvent('click', function (e) { 615 new Event(e).stop(); 616 if (!$this.animPlay) { 617 $this.effects1[$this.actual].start('opacity', 0); 618 $this.effects2[$this.actual].start('top', 0, -$this.items[$this.actual].getSize().y); 619 var counter = 0; 620 // re-order items by z-index 621 for (var i = $this.actual; i < $this.items.length; i++) { 622 $this.items[i].setStyle('z-index', $this.items.length - counter); 623 counter++; 624 } 625 for (i = 0; i < $this.actual; i++) { 626 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 627 } 628 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 629 $this.effects1[$this.actual].start('opacity', 1); 630 // 631 clearTimeout($this.timer); 632 $this.timer = setInterval(function () { 633 $this.timerFunc(); 634 },$this.options.interval); 635 } 636 }); 637 } 638 }, 639 640 // slides to bottom animation (layer) 641 slidesLayerBottom: function () { 642 var $this = this; 643 $this.items = $this.options.wrapper.getElements('.gkHighlighterItem'); 644 $this.wrapper.setStyle('max-height', '20px'); 645 $this.effects1 = []; 646 $this.effects2 = []; 647 $this.actual = 0; 648 $this.mouseIsOver = false; 649 $this.animPlay = false; 650 // 651 $this.timer = setInterval(function () { 652 $this.timerFunc(); 653 },$this.options.interval); 654 // 655 $this.items.each(function (elm, j) { 656 elm.setStyle('z-index', $this.items.length - j); 657 if (j !== 0) { 658 elm.setStyle('opacity', 0); 659 } 660 661 $this.effects1[j] = new Fx.Tween(elm, { 662 duration: $this.options.speed, 663 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 664 wait: true, 665 onStart: function () { 666 $this.animPlay = true; 667 }, 668 onComplete: function () { 669 $this.animPlay = false; 670 } 671 }); 672 $this.effects2[j] = new Fx.Tween(elm, { 673 onComplete: function () { 674 elm.setStyle('top', '0'); 675 elm.setStyle('z-index', 1); 676 }, 677 duration: $this.options.speed, 678 transition: Fx.Transitions[$this.options.fun[2]][$this.options.fun[3]], 679 wait: true 680 }); 681 }); 682 // 683 if ($this.options.mouseOver == 'true') { 684 $this.wrapper.addEvent("mouseenter", function () { 685 $this.mouseIsOver = true; 686 }); 687 $this.wrapper.addEvent("mouseleave", function () { 688 $this.mouseIsOver = false; 689 }); 690 } 691 if ($this.next) { 692 $this.next.addEvent('click', function (e) { 693 new Event(e).stop(); 694 if (!$this.animPlay) { 695 $this.effects1[$this.actual].start('opacity', 0); 696 $this.effects2[$this.actual].start('top', 0, $this.items[$this.actual].getSize().y); 697 var counter = 0; 698 // reorder items by z-index 699 for (var i = $this.actual; i < $this.items.length; i++) { 700 $this.items[i].setStyle('z-index', $this.items.length - counter); 701 counter++; 702 } 703 for (i = 0; i < $this.actual; i++) { 704 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 705 } 706 707 $this.actual++; 708 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 709 $this.effects1[$this.actual].start('opacity', 1); // 710 clearTimeout($this.timer); 711 $this.timer = setInterval(function () { 712 $this.timerFunc(); 713 },$this.options.interval); 714 } 715 }); 716 $this.prev.addEvent('click', function (e) { 717 new Event(e).stop(); 718 if (!$this.animPlay) { 719 $this.effects1[$this.actual].start('opacity', 0); 720 $this.effects2[$this.actual].start('top', 0, $this.items[$this.actual].getSize().y); 721 var counter = 0; 722 // reorder items by z-index 723 for (var i = $this.actual; i < $this.items.length; i++) { 724 $this.items[i].setStyle('z-index', $this.items.length - counter); 725 counter++; 726 } 727 for (i = 0; i < $this.actual; i++) { 728 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 729 } 730 731 ($this.actual === 0) ? $this.actual = $this.items.length - 1 : $this.actual--; 732 $this.effects1[$this.actual].start('opacity', 1); // 733 clearTimeout($this.timer); 734 $this.timer = setInterval(function () { 735 $this.timerFunc(); 736 },$this.options.interval); 737 738 clearTimeout($this.timer); 739 $this.timer = setInterval(function () { 740 $this.timerFunc(); 741 },$this.options.interval); 742 } 743 }); 744 } 745 }, 746 timerFunc: function () { 747 var $this = this; 748 var height = this.items[$this.actual].getSize().y; 749 if ($this.mouseIsOver === false) { 750 if (this.options.type === 'slides') { 751 $this.effects1[$this.actual].start('opacity', 0); 752 $this.effects2[$this.actual].start('top', 0, -height); 753 $this.actual++; 754 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 755 $this.effects1[$this.actual].start('opacity', 1); 756 $this.effects2[$this.actual].start('top', height, 0); 757 } else if (this.options.type === 'flipx') { 758 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('flipOutX'); 759 $this.actual++; 760 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 761 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 762 setTimeout(function () { 763 $this.items[$this.actual].addClass('flipInX'); 764 },$this.options.speed); 765 } else if (this.options.type === 'fadeLeft') { 766 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOutLeft'); 767 $this.actual++; 768 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 769 $this.items[$this.actual].setStyle('opacity', 0); 770 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 771 setTimeout(function () { 772 $this.items[$this.actual].addClass('fadeInLeft'); 773 774 },$this.options.speed); 775 } else if (this.options.type === 'slidesBottom') { 776 $this.effects1[$this.actual].start('opacity', 0); 777 $this.effects2[$this.actual].start('top', 0, height); 778 $this.actual++; 779 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 780 $this.effects1[$this.actual].start('opacity', 1); 781 $this.effects2[$this.actual].start('top', -height, 0); 782 } else if (this.options.type === 'slidesLayer') { 783 $this.effects1[$this.actual].start('opacity', 0); 784 $this.effects2[$this.actual].start('top', 0, -height); 785 var counter = 0; 786 // reorder items by z-index 787 for (var i = $this.actual; i < $this.items.length; i++) { 788 $this.items[i].setStyle('z-index', $this.items.length - counter); 789 counter++; 790 } 791 for (i = 0; i < $this.actual; i++) { 792 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 793 } 794 795 $this.actual++; 796 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 797 $this.effects1[$this.actual].start('opacity', 1); 798 } else if (this.options.type == 'slidesLayerBottom') { 799 $this.effects1[$this.actual].start('opacity', 0); 800 $this.effects2[$this.actual].start('top', 0, height); 801 counter = 0; 802 // reorder items by z-index 803 for (var i = $this.actual; i < $this.items.length; i++) { 804 $this.items[i].setStyle('z-index', $this.items.length - counter); 805 counter++; 806 } 807 for (i = 0; i < $this.actual; i++) { 808 $this.items[i].setStyle('z-index', $this.items[$this.items.length - 1].getStyle('z-index') - 1 - i); 809 } 810 $this.actual++; 811 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 812 $this.effects1[$this.actual].start('opacity', 1); 813 } else if (this.options.type === 'opacity') { 814 $this.items[$this.actual].set('class', 'gkHighlighterItem').addClass('fadeOut'); 815 $this.actual++; 816 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 817 $this.items[$this.actual].setStyle('opacity', 1); 818 $this.items[$this.actual].set('class', 'gkHighlighterItem'); 819 } else if (this.options.type === 'bar') { 820 $this.actual++; 821 $this.barCounter++; 822 823 824 825 $this.actual = ($this.actual > $this.items.length - 1) ? 0 : $this.actual; 826 if (!$this.items[$this.actual].hasClass('front') && 827 !$this.items[$this.actual].hasClass('bottom') && 828 !$this.items[$this.actual].hasClass('back') && 829 !$this.items[$this.actual].hasClass('top') 830 ){ 831 // hide elements 832 $this.items.each(function (el, i) { 833 el.set('class', 'gkHighlighterItem gkHidden'); 834 }); 835 var face = $this.actual; 836 var start = $this.actual; 837 $this.items[face].setStyle('opacity', 1); 838 $this.items[face].set('class', 'gkHighlighterItem'); 839 $this.items[face].addClass('front'); 840 841 // create new 4 faces (order: front, bottom, back, top) 842 for (var i = 0; i < 3; i++) { 843 face++; 844 if (face > $this.items.length - 1) face = 0; 845 $this.items[face].set('class', 'gkHighlighterItem'); 846 if (i === 0) { 847 $this.items[face].addClass('bottom'); 848 } else if (i === 1) { 849 $this.items[face].addClass('back'); 850 } else { 851 $this.items[face].addClass('top'); 852 } 853 } 854 } 855 856 // reset classes from previous faces 857 $this.items.each(function (el, i) { 858 if (!el.hasClass('front') && 859 !el.hasClass('bottom') && 860 !el.hasClass('back') && 861 !el.hasClass('top') 862 ){ 863 el.set('class', 'gkHighlighterItem'); 864 el.addClass('gkHidden'); 865 } 866 }); 867 868 var active = $this.barCounter%$this.items.length; 869 $this.items[active].setStyle('opacity', 1); 870 var rotation = 'rotateX(' + $this.barCounter * -90 + 'deg)'; 871 $this.setRotation(rotation); 872 /*var tz = Math.round( ( 40 / 2 ) / 873 Math.tan( Math.PI / 4 ) ); 874 console.log(tz);*/ 875 } 876 } 877 } 878}); 879GKNewsHighligher.implement(new Options);
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.