1(function() { 2 var bz_name_space = "com_aquafadas_bz_html5"; 3 var bz = window[bz_name_space]; 4 if (!bz) { 5 bz = {}; 6 window[bz_name_space] = bz; 7 } 8 if (!bz.createBanner) { 9 (function() { 10 bz.banners = []; 11 bz.themes = []; 12 bz.misc = {}; 13 bz.log = false; 14 bz.warn = false; 15 bz.debugLoadingDelay = 0; 16 bz.createBanner = function(options, start) { 17 options = options || {}; 18 var themeClass; 19 if (options.themeClass) { 20 themeClass = bz[options.themeClass]; 21 } 22 if (!themeClass) { 23 themeClass = bz.BZTheme.themes[bz.BZTheme.themes.length - 1]; 24 } 25 var banner = new bz.BZBanner(options.mode, options.id, themeClass, options); 26 bz.banners.push(banner); 27 if (options.params) { 28 for (var key in options.params) { 29 banner.setParam(key, options.params[key]); 30 } 31 } 32 if (options.mediaArray) { 33 banner.setMediaArray(options.mediaArray); 34 } 35 if (options.audio) { 36 banner.setSoundSrc("audio.mp3"); 37 } 38 if (options.navigateToUrl) { 39 banner.setNavigateToUrl(options.navigateToUrl); 40 } 41 if (start) { 42 banner.loadAndStart(); 43 } 44 return banner; 45 }; 46 })(); 47 } 48 (function(global) { 49 var signals = { 50 VERSION: '0.7.4' 51 }; 52 53 function SignalBinding(signal, listener, isOnce, listenerContext, priority) { 54 this._listener = listener; 55 this._isOnce = isOnce; 56 this.context = listenerContext; 57 this._signal = signal; 58 this._priority = priority || 0; 59 } 60 SignalBinding.prototype = { 61 active: true, 62 params: null, 63 execute: function(paramsArr) { 64 var handlerReturn, params; 65 if (this.active && !!this._listener) { 66 params = this.params ? this.params.concat(paramsArr) : paramsArr; 67 handlerReturn = this._listener.apply(this.context, params); 68 if (this._isOnce) { 69 this.detach(); 70 } 71 } 72 return handlerReturn; 73 }, 74 detach: function() { 75 return this.isBound() ? this._signal.remove(this._listener, this.context) : null; 76 }, 77 isBound: function() { 78 return (!!this._signal && !!this._listener); 79 }, 80 getListener: function() { 81 return this._listener; 82 }, 83 _destroy: function() { 84 delete this._signal; 85 delete this._listener; 86 delete this.context; 87 }, 88 isOnce: function() { 89 return this._isOnce; 90 }, 91 toString: function() { 92 return '[SignalBinding isOnce:' + this._isOnce + ', isBound:' + this.isBound() + ', active:' + this.active + ']'; 93 } 94 }; 95 96 function validateListener(listener, fnName) { 97 if (typeof listener !== 'function') { 98 throw new Error('listener is a required param of {fn}() and should be a Function.'.replace('{fn}', fnName)); 99 } 100 } 101 signals.Signal = function() { 102 this._bindings = []; 103 this._prevParams = null; 104 }; 105 signals.Signal.prototype = { 106 memorize: false, 107 _shouldPropagate: true, 108 active: true, 109 _registerListener: function(listener, isOnce, listenerContext, priority) { 110 var prevIndex = this._indexOfListener(listener, listenerContext), 111 binding; 112 if (prevIndex !== -1) { 113 binding = this._bindings[prevIndex]; 114 if (binding.isOnce() !== isOnce) { 115 throw new Error('You cannot add' + (isOnce ? '' : 'Once') + '() then add' + (!isOnce ? '' : 'Once') + '() the same listener without remov
115ing the relationship first.'); 116 } 117 } else { 118 binding = new SignalBinding(this, listener, isOnce, listenerContext, priority); 119 this._addBinding(binding); 120 } 121 if (this.memorize && this._prevParams) { 122 binding.execute(this._prevParams); 123 } 124 return binding; 125 }, 126 _addBinding: function(binding) { 127 var n = this._bindings.length; 128 do { 129 --n; 130 } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority); 131 this._bindings.splice(n + 1, 0, binding); 132 }, 133 _indexOfListener: function(listener, context) { 134 var n = this._bindings.length, 135 cur; 136 while (n--) { 137 cur = this._bindings[n]; 138 if (cur._listener === listener && cur.context === context) { 139 return n; 140 } 141 } 142 return -1; 143 }, 144 has: function(listener, context) { 145 return this._indexOfListener(listener, context) !== -1; 146 }, 147 add: function(listener, listenerContext, priority) { 148 validateListener(listener, 'add'); 149 return this._registerListener(listener, false, listenerContext, priority); 150 }, 151 addOnce: function(listener, listenerContext, priority) { 152 validateListener(listener, 'addOnce'); 153 return this._registerListener(listener, true, listenerContext, priority); 154 }, 155 remove: function(listener, context) { 156 validateListener(listener, 'remove'); 157 var i = this._indexOfListener(listener, context); 158 if (i !== -1) { 159 this._bindings[i]._destroy(); 160 this._bindings.splice(i, 1); 161 } 162 return listener; 163 }, 164 removeAll: function() { 165 var n = this._bindings.length; 166 while (n--) { 167 this._bindings[n]._destroy(); 168 } 169 this._bindings.length = 0; 170 }, 171 getNumListeners: function() { 172 return this._bindings.length; 173 }, 174 halt: function() { 175 this._shouldPropagate = false; 176 }, 177 dispatch: function(params) { 178 if (!this.active) { 179 return; 180 } 181 var paramsArr = Array.prototype.slice.call(arguments), 182 n = this._bindings.length, 183 bindings; 184 if (this.memorize) { 185 this._prevParams = paramsArr; 186 } 187 if (!n) { 188 return; 189 } 190 bindings = this._bindings.slice(); 191 this._shouldPropagate = true; 192 do { 193 n--; 194 } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false); 195 }, 196 forget: function() { 197 this._prevParams = null; 198 }, 199 dispose: function() { 200 this.removeAll(); 201 delete this._bindings; 202 delete this._prevParams; 203 }, 204 toString: function() { 205 return '[Signal active:' + this.active + ' numListeners:' + this.getNumListeners() + ']'; 206 } 207 }; 208 if (typeof define === 'function' && define.amd) { 209 define(signals); 210 } else if (typeof module !== 'undefined' && module.exports) { 211 module.exports = signals; 212 } else { 213 global['signals'] = signals; 214 } 215 }(bz)); 216 (function(window) { 217 var Tween = function(target, props) { 218 this.initialize(target, props); 219 } 220 var p = Tween.prototype; 221 Tween.NONE = 0; 222 Tween.LOOP = 1; 223 Tween.REVERSE = 2; 224 Tween.IGNORE = {}; 225 Tween._tweens = []; 226 Tween._plugins = {}; 227 Tween.get = function(target, props, pluginData) { 228 return new Tween(target, props, pluginData); 229 } 230 Tween.tick = function(delta, paused) { 231 var tweens = Tween._tweens.slice(); 232 for (var i = tweens.length - 1; i >= 0; i--) { 233 var tween = tweens[i]; 234 if ((paused && !tween.ignoreGlobalPause) || tween._paused) { 235 continue; 236 } 237 tween.tick(tween._useTicks ? 1 : delta); 238 } 239 } 240 if (window.Ticker) { 241 Ticker.addListener(Tween, false); 242 } 243 Tween.removeTweens = function(target) { 244 if (!target.tweenjs_count) { 245 return; 246 } 247 var tweens = Tween._tweens; 248 for (var i = tweens.length - 1; i >= 0; i--) { 249 if (tweens[i]._target == target) { 250 tweens[i]._paused = true; 251 tweens.splice(i, 1); 252 } 253 } 254 target.tweenjs_count = 0; 255 } 256 Tween.hasActiveTweens = function(target) { 257 if (target) { 258 return target.tweenjs_count; 259 } 260 return Tween._tweens && Tween._tweens.length; 261 } 262 Tween.installPlugin = function(plugin, properties) { 263 var priority = plugin.priority; 264 if (priority == null) { 265 plugin.priority = priority = 0; 266 } 267 for (var i = 0, l = properties.length, p = Tween._plugins; i < l; i++) { 268 var n = properties[i]; 269 if (!p[n]) { 270 p[n] = [plugin]; 271 } else { 272 var arr = p[n]; 273 for (var j = 0, jl = arr.length; j < jl; j++) { 274 if (priority < arr[j].priority) { 275 break; 276 } 277 } 278 p[n].splice(j, 0, plugin); 279 } 280 } 281 } 282 Tween._register = function(tween, value) { 283 var target = tween._target; 284 if (value) { 285 if (target) { 286 target.tweenjs_count = target.tweenjs_count ? target.tweenjs_count + 1 : 1; 287 } 288 Tween._tweens.push(tween); 289 } else { 290 if (target) { 291 target.tweenjs_count--; 292 } 293 var i = Tween._tweens.indexOf(tween); 294 if (i != -1) { 295 Tween._tweens.splice(i, 1); 296 } 297 } 298 } 299 p.ignoreGlobalPause = false;
300 p.loop = false; 301 p.duration = 0; 302 p.pluginData = null; 303 p.onChange = null; 304 p.target = null; 305 p.position = null; 306 p._paused = false; 307 p._curQueueProps = null; 308 p._initQueueProps = null; 309 p._steps = null; 310 p._actions = null; 311 p._prevPosition = 0; 312 p._stepPosition = 0; 313 p._prevPos = -1; 314 p._target = null; 315 p._useTicks = false; 316 p.initialize = function(target, props, pluginData) { 317 this.target = this._target = target; 318 if (props) { 319 this._useTicks = props.useTicks; 320 this.ignoreGlobalPause = props.ignoreGlobalPause; 321 this.loop = props.loop; 322 if (props.override) { 323 Tween.removeTweens(target); 324 } 325 } 326 this.pluginData = pluginData || {}; 327 this._curQueueProps = {}; 328 this._initQueueProps = {}; 329 this._steps = []; 330 this._actions = []; 331 if (props && props.paused) { 332 this._paused = true; 333 } else { 334 Tween._register(this, true); 335 } 336 if (props && props.position != null) { 337 this.setPosition(props.position, Tween.NONE); 338 } 339 } 340 p.wait = function(duration) { 341 if (duration == null || duration <= 0) { 342 return this; 343 } 344 var o = this._cloneProps(this._curQueueProps); 345 return this._addStep({ 346 d: duration, 347 p0: o, 348 e: this._linearEase, 349 p1: o 350 }); 351 } 352 p.to = function(props, duration, ease) { 353 if (isNaN(duration) || duration < 0) { 354 duration = 0; 355 } 356 return this._addStep({ 357 d: duration || 0, 358 p0: this._cloneProps(this._curQueueProps), 359 e: ease, 360 p1: this._cloneProps(this._appendQueueProps(props)) 361 }); 362 } 363 p.call = function(callback, params, scope) { 364 return this._addAction({ 365 f: callback, 366 p: params ? params : [this], 367 o: scope ? scope : this._target 368 }); 369 } 370 p.set = function(props, target) { 371 return this._addAction({ 372 f: this._set, 373 o: this, 374 p: [props, target ? target : this._target] 375 }); 376 } 377 p.play = function(tween) { 378 return this.call(tween.setPaused, [false], tween); 379 } 380 p.pause = function(tween) { 381 if (!tween) { 382 tween = this; 383 } 384 return this.call(tween.setPaused, [true], tween); 385 } 386 p.setPosition = function(value, actionsMode) { 387 if (value < 0) { 388 value = 0; 389 } 390 if (actionsMode == null) { 391 actionsMode = 1; 392 } 393 var t = value; 394 var end = false; 395 if (t >= this.duration) { 396 if (this.loop) { 397 t = t % this.duration; 398 } else { 399 t = this.duration; 400 end = true; 401 } 402 } 403 if (t == this._prevPos) { 404 return end; 405 } 406 if (this._target) { 407 if (end) { 408 this._updateTargetProps(null, 1); 409 } else if (this._steps.length > 0) { 410 for (var i = 0, l = this._steps.length; i < l; i++) { 411 if (this._steps[i].t > t) { 412 break; 413 } 414 } 415 var step = this._steps[i - 1]; 416 this._updateTargetProps(step, (this._stepPosition = t - step.t) / step.d, t); 417 } 418 } 419 this.onChange && this.onChange(this); 420 var prevPos = this._prevPos; 421 this.position = this._prevPos = t; 422 this._prevPosition = value; 423 if (actionsMode != 0 && this._actions.length > 0) { 424 if (this._useTicks) { 425 this._runActions(t, t); 426 } else if (actionsMode == 1 && t < prevPos) { 427 if (prevPos != this.duration) { 428 this._runActions(prevPos, this.duration); 429 } 430 this._runActions(0, t, true); 431 } else { 432 this._runActions(prevPos, t); 433 } 434 } 435 if (end) { 436 this.setPaused(true); 437 } 438 return end; 439 } 440 p.tick = function(delta) { 441 if (this._paused) { 442 return; 443 } 444 this.setPosition(this._prevPosition + delta); 445 } 446 p.setPaused = function(value) { 447 this._paused = !!value; 448 Tween._register(this, !value); 449 return this; 450 } 451 p.w = p.wait; 452 p.t = p.to; 453 p.c = p.call; 454 p.s = p.set; 455 p.toString = function() { 456 return "[Tween]"; 457 } 458 p.clone = function() { 459 throw ("Tween can not be cloned.") 460 } 461 p._updateTargetProps = function(step, ratio, position) { 462 var p0, p1, v, v0, v1, arr; 463 if (!step && ratio == 1) { 464 p0 = p1 = this._curQueueProps; 465 } else { 466 if (step.e) { 467 ratio = step.e(ratio, 0, 1, 1); 468 } 469 p0 = step.p0; 470 p1 = step.p1; 471 } 472 for (n in this._initQueueProps) { 473 if ((v0 = p0[n]) == null) { 474 p0[n] = v0 = this._initQueueProps[n]; 475 } 476 if ((v1 = p1[n]) == null) { 477 p1[n] = v1 = v0; 478 } 479 if (v0 == v1 || ratio == 0 || ratio == 1 || (typeof(v0) != "number")) { 480 v = ratio == 1 ? v1 : v0; 481 } else {
482 v = v0 + (v1 - v0) * ratio; 483 } 484 var ignore = false; 485 if (arr = Tween._plugins[n]) { 486 for (var i = 0, l = arr.length; i < l; i++) { 487 var v2 = arr[i].tween(this, n, v, p0, p1, ratio, position, !step); 488 if (v2 == Tween.IGNORE) { 489 ignore = true; 490 } else { 491 v = v2; 492 } 493 } 494 } 495 if (!ignore) { 496 this._target[n] = v; 497 } 498 } 499 } 500 p._runActions = function(startPos, endPos, includeStart) { 501 var sPos = startPos; 502 var ePos = endPos; 503 var i = -1; 504 var j = this._actions.length; 505 var k = 1; 506 if (startPos > endPos) { 507 sPos = endPos; 508 ePos = startPos; 509 i = j; 510 j = k = -1; 511 } 512 while ((i += k) != j) { 513 var action = this._actions[i]; 514 var pos = action.t; 515 if (pos == ePos || (pos > sPos && pos < ePos) || (includeStart && pos == startPos)) { 516 action.f.apply(action.o, action.p); 517 } 518 } 519 } 520 p._appendQueueProps = function(o) { 521 var arr, value, v2; 522 for (var n in o) { 523 if (this._initQueueProps[n] == null) { 524 value = this._target[n]; 525 if (arr = Tween._plugins[n]) { 526 for (var i = 0, l = arr.length; i < l; i++) { 527 v2 = arr[i].init(this, n, value); 528 if (v2 != Tween.IGNORE) { 529 value = v2; 530 } 531 } 532 } 533 this._initQueueProps[n] = value; 534 } 535 this._curQueueProps[n] = o[n]; 536 } 537 return this._curQueueProps; 538 } 539 p._cloneProps = function(props) { 540 var o = {}; 541 for (var n in props) { 542 o[n] = props[n]; 543 } 544 return o; 545 } 546 p._addStep = function(o) { 547 if (o.d > 0) { 548 this._steps.push(o); 549 o.t = this.duration; 550 this.duration += o.d; 551 } 552 return this; 553 } 554 p._addAction = function(o) { 555 o.t = this.duration; 556 this._actions.push(o); 557 return this; 558 } 559 p._set = function(props, o) { 560 for (var n in props) { 561 o[n] = props[n]; 562 } 563 } 564 window.Tween = Tween; 565 }(bz)); 566 (function(window) { 567 var Ease = function() { 568 throw "Ease cannot be instantiated."; 569 } 570 Ease.linear = function(t) { 571 return t; 572 } 573 Ease.none = Ease.linear; 574 Ease.get = function(amount) { 575 if (amount < -1) { 576 amount = -1; 577 } 578 if (amount > 1) { 579 amount = 1; 580 } 581 return function(t) { 582 if (amount == 0) { 583 return t; 584 } 585 if (amount < 0) { 586 return t * (t * -amount + 1 + amount); 587 } 588 return t * ((2 - t) * amount + (1 - amount)); 589 } 590 } 591 Ease.getPowIn = function(pow) { 592 return function(t) { 593 return Math.pow(t, pow); 594 } 595 } 596 Ease.getPowOut = function(pow) { 597 return function(t) { 598 return 1 - Math.pow(1 - t, pow); 599 } 600 } 601 Ease.getPowInOut = function(pow) { 602 return function(t) { 603 if ((t *= 2) < 1) return 0.5 * Math.pow(t, pow); 604 return 1 - 0.5 * Math.abs(Math.pow(2 - t, pow)); 605 } 606 } 607 Ease.quadIn = Ease.getPowIn(2); 608 Ease.quadOut = Ease.getPowOut(2); 609 Ease.quadInOut = Ease.getPowInOut(2); 610 Ease.cubicIn = Ease.getPowIn(3); 611 Ease.cubicOut = Ease.getPowOut(3); 612 Ease.cubicInOut = Ease.getPowInOut(3); 613 Ease.quartIn = Ease.getPowIn(4); 614 Ease.quartOut = Ease.getPowOut(4); 615 Ease.quartInOut = Ease.getPowInOut(4); 616 Ease.quintIn = Ease.getPowIn(5); 617 Ease.quintOut = Ease.getPowOut(5); 618 Ease.quintInOut = Ease.getPowInOut(5); 619 Ease.sineIn = function(t) { 620 return 1 - Math.cos(t * Math.PI / 2); 621 } 622 Ease.sineOut = function(t) { 623 return Math.sin(t * Math.PI / 2); 624 } 625 Ease.sineInOut = function(t) { 626 return -0.5 * (Math.cos(Math.PI * t) - 1) 627 } 628 Ease.getBackIn = function(amount) { 629 return function(t) { 630 return t * t * ((amount + 1) * t - amount); 631 } 632 } 633 Ease.backIn = Ease.getBackIn(1.7); 634 Ease.getBackOut = function(amount) { 635 return function(t) { 636 return (--t * t * ((amount + 1) * t + amount) + 1); 637 } 638 } 639 Ease.backOut = Ease.getBackOut(1.7); 640 Ease.getBackInOut = function(amount) { 641 amount *= 1.525; 642 return function(t) { 643 if ((t *= 2) < 1) return 0.5 * (t * t * ((amount + 1) * t - amount)); 644 return 0.5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2); 645 } 646 } 647 Ease.backInOut = Ease.getBackInOut(1.7); 648 Ease.circIn = function(t) { 649 return -(Math.sqrt(1 - t * t) - 1); 650 } 651 Ease.circOut = function(t) { 652 return Math.sqrt(1 - (--t) * t); 653 } 654 Ease.circInOut = function(t) { 655 if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1); 656 return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1); 657 } 658 Ease.bounceIn = function(t) { 659 return 1 - Ease.bounceOut(1 - t); 660 } 661 Ease.bounceOut = function(t) { 662 if (t < 1 / 2.75) { 663 return (7.5625 * t * t); 664 } else if (t < 2 / 2.75) { 665 return (7.5625 * (t -= 1.5 / 2.75) * t + 0.75); 666 } else if (t < 2.5 / 2.75) { 667 return (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375); 668 } else { 669 return (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375); 670 } 671 } 672 Ease.bounceInOut = function(t) { 673 if (t < 0.5) return Ease.bounceIn(t * 2) * .5; 674 return Ease.bounceOut(t * 2 - 1) * 0.5 + 0.5; 675 } 676 Ease.getElasticIn = function(amplitude, period) { 677 var pi2 = Math.PI * 2; 678 return function(t) { 679 if (t == 0 || t == 1) return t; 680 var s = period / pi2 * Math.asin(1 / amplitude); 681 return -(amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period)); 682 } 683 } 684 Ease.elasticIn = Ease.getElasticIn(1, 0.3); 685 Ease.getElasticOut = function(amplitude, period) { 686 var pi2 = Math.PI * 2; 687 return function(t) { 688 if (t == 0 || t == 1) return t; 689 var s = period / pi2 * Math.asin(1 / amplitude); 690 return (amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1); 691 } 692 } 693 Ease.elasticOut = Ease.getElasticOut(1, 0.3); 694 Ease.getElasticInOut = function(amplitude, period) { 695 var pi2 = Math.PI * 2; 696 return function(t) { 697 var s = period / pi2 * Math.asin(1 / amplitude); 698 if ((t *= 2) < 1) return -0.5 * (amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period)); 699 return amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * 0.5 + 1; 700 } 701 } 702 Ease.elasticInOut = Ease.getElasticInOut(1, 0.3 * 1.5); 703 window.Ease = Ease; 704 }(bz)); 705 if (!bz.tweenBZProps) { 706 (function() { 707 bz.requestAnimationFrame = window.requestAnimationFrame; 708 bz.requestAnimationFrame = window.cancelAnimationFrame ? window.cancelAnimationFrame : window.cancelRequestAnimationFrame; 709 var lastTime = 0; 710 var vendors = ['ms', 'moz', 'webkit', 'o']; 711 var raf, caf; 712 for (var x = 0; x < vendors.length && !raf; ++x) { 713 raf = window[vendors[x] + 'RequestAnimationFrame']; 714 caf = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 715 } 716 if (!raf) { 717 bz.requestAnimationFrame = function(callback, element) { 718 var currTime = new Date().getTime(); 719 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 720 var id = setTimeout(function() { 721 callback(currTime + timeToCall); 722 }, timeToCall); 723 lastTime = currTime + timeToCall; 724 return id; 725 }; 726 } else { 727 bz.requestAnimationFrame = function(callback, element) { 728 return raf.call(window, callback, element); 729 } 730 } 731 if (!caf) { 732 bz.cancelAnimationFrame = function(id) { 733 clearTimeout(id); 734 }; 735 } else { 736 bz.cancelAnimationFrame = function(id) { 737 caf.call(window, id); 738 }; 739 } 740 }()); 741 bz.Tween.bz_ticking = false;
742 bz.Tween.bz_startTicking = function() { 743 if (!bz.Tween.bz_ticking) { 744 bz.Tween.bz_ticking = true; 745 var t = (new Date()).getTime(); 746 var tick = function() { 747 var newT = (new Date()).getTime(); 748 bz.Tween.tick(newT - t); 749 bz.requestAnimationFrame(tick); 750 t = newT; 751 } 752 tick(); 753 } 754 }; 755 bz.Tween.removeTweensByProperty = function(target, properties) { 756 if (!target.tweenjs_count) { 757 return; 758 } 759 var tweens = bz.Tween._tweens; 760 for (var i = tweens.length - 1; i >= 0; i--) { 761 if (tweens[i]._target == target) { 762 for (var propertyName in properties) { 763 if (tweens[i]._initQueueProps[propertyName] !== undefined) { 764 tweens[i]._paused = true; 765 tweens.splice(i, 1); 766 target.tweenjs_count--; 767 break; 768 } 769 } 770 } 771 } 772 }; 773 bz.tweenBZProps = function(target, to, time, easing, delay) { 774 if (!bz.Tween.bz_ticking) { 775 bz.Tween.bz_startTicking(); 776 } 777 if (time === undefined) { 778 time = 500; 779 } 780 if (delay === undefined) { 781 delay = 0; 782 } 783 if (!easing) { 784 easing = bz.Ease.sineOut; 785 } 786 bz.Tween.removeTweensByProperty(target.bzProps, to); 787 var tween = bz.Tween.get(target.bzProps).wait(delay).to(to, time, easing); 788 tween.onChange = function() { 789 bz.updateBZProps(target, to); 790 }; 791 return tween; 792 }; 793 bz.removeBZPropsTweens = function(target) { 794 if (target.bzProps) { 795 bz.Tween.removeTweens(target.bzProps); 796 } 797 }; 798 bz.setBZProps = function(elt, props, stopTweens) { 799 if (!elt.bzProps) { 800 elt.bzProps = bz.ObjectUtils.clone(props); 801 var hasX = (props.x !== undefined); 802 var hasY = (props.y !== undefined); 803 if (hasX && !hasY || !hasX && hasY) { 804 if (hasX) { 805 props.y = 0; 806 } else { 807 props.x = 0; 808 } 809 } 810 } else { 811 for (var propertyName in props) { 812 elt.bzProps[propertyName] = props[propertyName]; 813 } 814 if (stopTweens) { 815 bz.Tween.removeTweensByProperty(elt.bzProps, props); 816 } 817 } 818 bz.updateBZProps(elt); 819 }; 820 bz.updateBZProps = function(elt, propertyMap) { 821 var props = elt.bzProps; 822 var style = elt.style; 823 if (!propertyMap) propertyMap = props; 824 if (propertyMap.hasOwnProperty("alpha")) { 825 style.opacity = props.alpha; 826 } 827 var transform = ""; 828 if (propertyMap.hasOwnProperty("x") || props.hasOwnProperty("y") || propertyMap.hasOwnProperty("z")) { 829 if (bz.has3D && propertyMap.hasOwnProperty("z")) { 830 transform = "translate3d(" + props.x + "px," + props.y + "px," + props.z + "px) "; 831 } else { 832 transform = "translate(" + props.x + "px," + props.y + "px) "; 833 } 834 } 835 if (propertyMap.hasOwnProperty("scale")) { 836 transform += "scale(" + props.scale + ") " 837 } 838 if (propertyMap.hasOwnProperty("rotation")) { 839 transform += "rotate(" + props.rotation + "deg) " 840 } 841 if (transform != "") { 842 bz.CSS.transform(elt, transform); 843 } 844 }; 845 var prefixMap = { 846 easein: "In", 847 easeout: "Out", 848 easeoutin: "OutIn", 849 easeinout: "InOut", 850 }; 851 bz.getPluginEasing = function(propertyName, plugin) { 852 var prefix = plugin.props[propertyName + "Prefix"]; 853 var suffix = plugin.props[propertyName + "Suffix"]; 854 if (suffix == "linear" || prefix == "linear") { 855 return bz.Ease.linear; 856 } else { 857 var easingName = suffix + prefixMap[prefix]; 858 return bz.Ease[easingName]; 859 } 860 }; 861 } 862 if (!bz.CSS) { 863 (function() { 864 var _props = {}; 865 var prefixes = ["Webkit", "Moz", "O", "ms"]; 866
867 function findPrefixedProp(prop) { 868 var elt = document.createElement('div'); 869 var majProp = prop.slice(0, 1).toUpperCase() + prop.slice(1); 870 for (var i = -1; i < prefixes.length; i++) { 871 var p; 872 if (i == -1) { 873 p = prop; 874 } else { 875 p = prefixes[i] + majProp; 876 } 877 if (elt.style[p] != undefined) { 878 _props[prop] = p; 879 break; 880 } 881 } 882 } 883 var props = ["transform", "perspective", "backfaceVisibility", "transformStyle", "perspectiveOrigin", "transformOrigin", "transformStyle", "boxSizing"]; 884 for (var i = 0; i < props.length; i++) { 885 findPrefixedProp(props[i]); 886 } 887 bz.has3D = _props["perspective"] != null; 888 bz.CSS = { 889 props: _props, 890 colorHex: function(colorHex) { 891 if (typeof(colorHex) == "string") { 892 return "#" + colorHex.slice(2); 893 } else { 894 var s = colorHex.toString(16); 895 while (s.length < 6) s = "0" + s; 896 return "#" + s; 897 } 898 }, 899 colorRGB: function(colorHex, alpha) { 900 var s; 901 if (alpha !== undefined && alpha !== null) { 902 s = "rgba("; 903 } else { 904 s = "rgb("; 905 } 906 var r = colorHex >> 16; 907 var g = (colorHex >> 8) & 0xff;
908 var b = (colorHex >> 0) & 0xff; 909 s += r + "," + g + "," + b; 910 if (alpha !== undefined) { 911 s += "," + alpha; 912 } 913 s += ")"; 914 return s; 915 }, 916 setSize: function(elt, width, height) { 917 if (elt !== null && elt.hasOwnProperty("src") && elt.hasOwnProperty("alt")) { 918 elt.width = width; 919 elt.height = height; 920 } else { 921 elt.style.width = width + "px"; 922 elt.style.height = height + "px"; 923 } 924 }, 925 setPos: function(div, x, y) { 926 div.style.left = x + "px"; 927 div.style.top = y + "px"; 928 }, 929 setBackground: function(div, color, alpha) { 930 if (!color) color = ~~(0xffffff * Math.random()); 931 div.style.backgroundColor = bz.CSS.colorRGB(color, alpha); 932 }, 933 setBorder: function(div, borderWidth, borderColor, borderRadius) { 934 div.style.borderWidth = borderWidth + "px"; 935 div.style.borderColor = bz.CSS.colorHex(borderColor); 936 div.style.borderRadius = borderRadius + "px"; 937 div.style.borderStyle = "solid"; 938 }, 939 setVisible: function(div, visible) { 940 div.style.visibility = visible ? "visible" : "hidden"; 941 }, 942 setDisplay: function(div, value) { 943 div.style.display = value ? "block" : "none"; 944 }, 945 transform: function(elt, style) { 946 elt.style[_props.transform] = style; 947 }, 948 textStyle: function(elt, spanElt, props, onFontLoaded) { 949 if (props.size) { 950 elt.style.fontSize = props.size + "px"; 951 } 952 if (props.hasOwnProperty("color")) { 953 elt.style.color = bz.CSS.colorHex(props.color); 954 } 955 if (props.align) { 956 elt.style.textAlign = props.align; 957 } 958 if (!props.fontType || props.fontType == bz.FontTypes.LOCAL) { 959 if (props.font) { 960 spanElt.style.opacity = 1; 961 elt.style.fontFamily = props.font + " , sans-serif"; 962 } 963 } else { 964 var font; 965 if (props.fontType == bz.FontTypes.CUSTOM) { 966 font = props.customFont; 967 } else { 968 font = props.googleFont === bz.GoogleFonts.CUSTOM ? props.customFont : props.googleFont; 969 } 970 if (font) { 971 elt.style.fontFamily = font + " , sans-serif"; 972 if (props.fontType == bz.FontTypes.GOOGLE_FONT) { 973 bz.FontLoader.addGoogleFont(font); 974 } 975 if (!bz.FontLoader.checkFont(font)) { 976 spanElt.style.opacity = 0; 977 bz.FontLoader.onFontLoadedSignal.add(function(loadedFont) { 978 if (loadedFont == font) { 979 spanElt.style.transition = "opacity 0.4s"; 980 spanElt.style.opacity = 1; 981 if (onFontLoaded) { 982 onFontLoaded(); 983 } 984 } 985 }); 986 } else { 987 spanElt.opacity = 1; 988 } 989 } 990 } 991 }, 992 divStyle: function(div, props, prefix) { 993 if (!prefix) { 994 prefix = "div"; 995 } 996 if (props.hasOwnProperty(prefix + "_bgColor")) { 997 div.style.backgroundColor = bz.CSS.colorRGB(props[prefix + "_bgColor"], props[prefix + "_bgAlpha"]); 998 } 999 if (props.hasOwnProperty(prefix + "_borderWidth")) { 1000 bz.CSS.setBorder(div, props[prefix + "_borderWidth"], props[prefix + "_borderColor"], props[prefix + "_borderRadius"]); 1001 } 1002 }, 1003 perspective: function(elt, value) { 1004 if (value === undefined) { 1005 elt.style[_props.perspective] = "none"; 1006 } else { 1007 elt.style[_props.perspective] = value + "px"; 1008 } 1009 }, 1010 perspectiveOrigin: function(elt, value) { 1011 if (value === undefined) { 1012 value = "50% 50%"; 1013 } 1014 elt.style[_props.perspective] = value; 1015 }, 1016 backfaceVisibility: function(elt, value) { 1017 if (value === true || value == "visible") { 1018 elt.style[_props.backfaceVisibility] = "visible"; 1019 } else { 1020 elt.style[_props.backfaceVisibility] = "hidden"; 1021 } 1022 }, 1023 transformStyle: function(elt, value) { 1024 elt.style[_props.transformStyle] = value; 1025 }, 1026 transformOrigin: function(elt, value) { 1027 elt.style[_props.transformOrigin] = value; 1028 }, 1029 setPrefixedProp: function(elt, prop, value) { 1030 if (!_props[prop]) throw new Error("prop not found in CSS.js props array:" + prop); 1031 elt.style[_props[prop]] = value; 1032 }, 1033 disableMouse: function(div) { 1034 div.style.pointerEvents = "none"; 1035 }, 1036 setButtonMode: function(div, value) { 1037 if (value) { 1038 div.style.cursor = "pointer"; 1039 } else { 1040 div.style.cursor = "default"; 1041 } 1042 }, 1043 setBoxSizing: function(div) { 1044 div.style[_props["boxSizing"]] = "border-box"; 1045 } 1046 }; 1047 (function() { 1048 var fl = {}; 1049 fl.onFontLoadedSignal = new bz.signals.Signal(); 1050 var _fonts = {}; 1051 var _loadedGoogleFonts = {}; 1052 var _checkInterval; 1053 fl.addGoogleFont = function(font) { 1054 if (!_loadedGoogleFonts[font]) { 1055 bz.LoadUtils.css('http://fonts.googleapis.com/css?family='
1055+ font); 1056 _loadedGoogleFonts[font] = true; 1057 } 1058 }; 1059 fl.checkFont = function(font) { 1060 if (_fonts[font]) { 1061 return _fonts[font].loaded; 1062 } else { 1063 var s, o = { 1064 loaded: false 1065 }; 1066 _fonts[font] = o; 1067 o.elt = document.createElement('span'); 1068 o.elt.innerHTML = 'giItT1WQy@!-/#'; 1069 s = o.elt.style; 1070 s.position = 'absolute'; 1071 s.whiteSpace = 'nowrap'; 1072 s.left = '-10000px'; 1073 s.top = '-10000px'; 1074 s.fontSize = '300px'; 1075 s.fontFamily = 'sans-serif'; 1076 s.fontVariant = 'normal'; 1077 s.fontStyle = 'normal'; 1078 s.fontWeight = 'normal'; 1079 s.letterSpacing = '0'; 1080 document.body.appendChild(o.elt); 1081 o.w = o.elt.offsetWidth; 1082 s.fontFamily = font + " , sans-serif"; 1083 clearInterval(_checkInterval); 1084 setInterval(_check, 50); 1085 return false; 1086 } 1087 }; 1088 var _check = function() { 1089 var allLoaded = true; 1090 for (var key in _fonts) { 1091 var o = _fonts[key]; 1092 if (!o.loaded) { 1093 if (o.elt.offsetWidth != o.w) { 1094 console.log("bz.FontLoader - fontLoaded", key); 1095 o.loaded = true; 1096 fl.onFontLoadedSignal.dispatch(key, _fonts); 1097 } else { 1098 allLoaded = false; 1099 } 1100 } 1101 } 1102 if (allLoaded) { 1103 clearInterval(_checkInterval); 1104 } 1105 }; 1106 bz.FontLoader = fl; 1107 })(); 1108 })(); 1109 } 1110 if (!bz.Types) { 1111 bz.Enums = { 1112 createArray: function(map) { 1113 var array = []; 1114 for (var key in map) { 1115 array.push(map[key]); 1116 } 1117 array.sort(); 1118 return array; 1119 } 1120 }; 1121 bz.Modes = { 1122 DEBUG: "debug", 1123 BZ: "bz", 1124 PUBLICATION: "publication" 1125 }; 1126 bz.Flags = { 1127 STYLE: "style", 1128 SIZE: "size", 1129 THEME_SIZE: "themeSize", 1130 TIMER: "timer", 1131 ANIM: "anim", 1132 TEXT: "text" 1133 }; 1134 bz.Types = { 1135 INTEGER: "Integer", 1136 FLOAT: "Float", 1137 APPEAR_TIMING: "FloatAppear", 1138 DISAPPEAR_TIMING: "FloatDisappear", 1139 ENUM: "Enum", 1140 COLOR: "Color", 1141 COLOR_ALPHA: "ColorAlpha", 1142 TEXT: "Text", 1143 BOOL: "Bool", 1144 FONT: "Font", 1145 TEXT_ALIGN: "TextAlign", 1146 DIV_STYLE: "DivStyle", 1147 EASING: "Easing", 1148 ALPHA: "Alpha", 1149 TIME: "Time" 1150 }; 1151 bz.ImageMode = { 1152 SCALE: "scale", 1153 RECT: "rect" 1154 }; 1155 bz.FontTypes = { 1156 LOCAL: "Local", 1157 GOOGLE_FONT: "Google Font", 1158 CUSTOM: "Custom" 1159 }; 1160 bz.FontTypesArray = bz.Enums.createArray(bz.FontTypes); 1161 bz.Fonts = { 1162 ARIAL: "Arial", 1163 ARIAL_ROUNDED_BOLD: "Arial Rounded MT Bold", 1164 BASKERVILLE: "BaskerVille", 1165 COCHIN: "Cochin", 1166 COURIER_NEW: "Courier New", 1167 GEEZA_PRO: "Geeza Pro", 1168 GEORGIA: "Georgia", 1169 HELVETICA: "Helvetica", 1170 HELVETICA_NEUE: "Helvetica Neue", 1171 MARKER_FELT: "Marker Felt", 1172 PALATINO: "Palatino", 1173 TIMES_NEW_ROMAN: "Times New Roman", 1174 TREBUCHET_MS: "Trebuchet MS", 1175 VERDANA: "Verdana" 1176 }; 1177 bz.FontArray = bz.Enums.createArray(bz.Fonts); 1178 bz.GoogleFonts = { 1179 CUSTOM: "Custom...", 1180 REVALIA: "Revalia", 1181 GAFATA: "Gafata", 1182 CONDIMENT: "Condiment" 1183 }; 1184 bz.GoogleFontsArray = bz.Enums.createArray(bz.GoogleFonts); 1185 bz.Align = { 1186 LEFT: "Left", 1187 CENTER: "Center", 1188 JUSTIFY: "Justify", 1189 RIGHT: "Right" 1190 }; 1191 bz.AlignArray = bz.Enums.createArray(bz.Align); 1192 bz.EasingPrefixes = ["easein", "easeinout", "easeout"]; 1193 bz.EasingPrefixes_Strings = ["Ease In", "Ease In Out", "Eease Out"]; 1194 bz.EasingSuffixes = ["linear", "quad", "cubic", "quart", "quint", "sine", "circ", "elastic", "back", "bounce"]; 1195 bz.EasingSuffixes_Strings = ["Linear", "Quadratic", "Cubic", "Quartic", "Quintic", "Sine", "Circular", "Elastic", "Back", "Bounce"]; 1196 bz.Pos = { 1197 LEFT: "Left", 1198 RIGHT: "Right", 1199 TOP: "Top", 1200 BOTTOM: "Bottom", 1201 CENTER: "Center" 1202 }; 1203 } 1204 if (!bz.ArrayUtils) { 1205 bz.ArrayUtils = { 1206 randomize: function(a) { 1207 if (a && a.length) { 1208 var l = a.length; 1209 for (var i = 0; i < l; i++) { 1210 var randIndex = i + ~~(Math.random() * (l - i)); 1211 var stock = a[i]; 1212 a[i] = a[randIndex]; 1213 a[randIndex] = stock; 1214 } 1215 } 1216 }, 1217 removeItem: function(a, item) { 1218 var index = a.indexOf(item); 1219 if (index >= 0) { 1220 return null; 1221 } else { 1222 return a.splice(index, 1) 1223 } 1224 }, 1225 swap: function(a, i1, i2) { 1226 var s = a[i1]; 1227 a[i1] = a[i2]; 1228 a[i2] = s; 1229 } 1230 }; 1231 bz.ObjectUtils = { 1232 copyProperties: function(from, to) { 1233 for (var propertyName in from) { 1234 to[propertyName] = from[propertyName]; 1235 } 1236 }, 1237 clone: function(object) { 1238 var clone = {}; 1239 for (var propertyName in object) { 1240 clone[propertyName] = object[propertyName]; 1241 } 1242 return clone; 1243 } 1244 } 1245 bz.ClassUtils = { 1246 extend: function(subClass, superClass) { 1247 var F = function() {}; 1248 F.prototype = superClass.prototype; 1249 subClass.prototype = new F(); 1250 subClass.prototype.constructor = subClass; 1251 } 1252 }; 1253 bz.CanvasUtils = { 1254 drawRoundRect: function(ctx, w, h, r, doFill, doStroke, tl, tr, br, bl) { 1255 r = Math.min(r, w / 2, h / 2); 1256 if (r == 0) { 1257 if (doFill) ctx.fillRect(0, 0, w, h); 1258 if (doStroke) ctx.strokeRect(0, 0, w, h); 1259 } else { 1260 var pi = Math.PI; 1261 var pi_2 = Math.PI * 0.5; 1262 var allCorners = arguments.length <= 6; 1263 ctx.beginPath(); 1264 if (allCorners || tl) { 1265 ctx.moveTo(0, r); 1266 ctx.arc(r, r, r, -pi, -pi_2, false); 1267 } else { 1268 ctx.moveTo(0, 0); 1269 } 1270 if (allCorners || tr) { 1271 ctx.lineTo(w - r, 0); 1272 ctx.arc(w - r, r, r, -pi_2, 0, false); 1273 } else { 1274 ctx.lineTo(w, 0); 1275 } 1276 if (allCorners || br) { 1277 ctx.lineTo(w, h - r); 1278 ctx.arc(w - r, h - r, r, 0, pi_2, false); 1279 } else { 1280 ctx.lineTo(w, h); 1281 } 1282 if (allCorners || bl) { 1283 ctx.lineTo(r, h); 1284 ctx.arc(r, h - r, r, pi_2, pi, false); 1285 } else { 1286 ctx.lineTo(0, h); 1287 } 1288 if (allCorners || tl) { 1289 ctx.lineTo(0, r); 1290 } else { 1291 ctx.lineTo(0, 0); 1292 } 1293 ctx.closePath(); 1294 if (doFill) ctx.fill(); 1295 if (doStroke) ctx.stroke(); 1296 } 1297 } 1298 }; 1299 bz.HTMLUtils = { 1300 createNode: function(html) { 1301 var div = document.createElement("div"); 1302 div.innerHTML = html; 1303 return div.firstChild; 1304 } 1305 }; 1306 bz.LoadUtils = { 1307 js: function(path, callback) { 1308 if (window.yepnope) { 1309 yepnope({ 1310 load: path, 1311 complete: callback 1312 }); 1313 } else { 1314 var script = document.createElement("script") 1315 script.type = "text/javascript"; 1316 if (script.readyState) { 1317 script.onreadystatechange = function() { 1318 if (script.readyState == "loaded" || script.readyState == "complete") { 1319 script.onreadystatechange = null; 1320 callback(); 1321 } 1322 }; 1323 } else { 1324 script.onload = function() { 1325 callback(); 1326 }; 1327 } 1328 script.src = path; 1329 document.getElementsByTagName("head")[0].appendChild(script); 1330 } 1331 }, 1332 css: function(path) { 1333 var head = document.getElementsByTagName('head')[0], 1334 link = document.createElement('link'); 1335 link.setAttribute('href', path); 1336 link.setAttribute('rel', 'stylesheet'); 1337 link.setAttribute('type', 'text/css'); 1338 head.appendChild(link); 1339 }, 1340 cssSnippet: function(css) { 1341 var head = document.getElementsByTagName('head')[0], 1342 style = document.createElement('style'); 1343 style.type = 'text/css'; 1344 style.innerHTML = css; 1345 head.appendChild(css); 1346 } 1347 } 1348 } 1349 if (!bz.BZBanner) {
1350 bz.BZBanner = function(mode, id, themeClass, options) { 1351 if (mode == bz.Modes.DEBUG || mode == bz.Modes.BZ) { 1352 this.mode = mode; 1353 } else { 1354 this.mode = bz.Modes.PUBLICATION; 1355 } 1356 this._id = id; 1357 this._theme = new themeClass(); 1358 this._theme.init(id, this.mode, options); 1359 this._theme.mediaSizeComputedSignal.add(this.imageLoadingComplete, this); 1360 this._theme.mediaClickedSignal.add(this.mediaClicked, this); 1361 }; 1362 var p = bz.BZBanner.prototype; 1363 p.getSettingsArray = function() { 1364 return this._theme.getSettingsArray(); 1365 }; 1366 p.setMediaArray = function(mediaArray) { 1367 if (mediaArray) { 1368 for (var iMedia = 0, lenMedia = mediaArray.length; iMedia < lenMedia; iMedia++) { 1369 if (!(mediaArray[iMedia] instanceof bz.BZMedia)) { 1370 if (mediaArray[iMedia] instanceof Array) { 1371 mediaArray[iMedia] = bz.BZMedia.createMedia.apply(null, mediaArray[iMedia]); 1372 } else { 1373 mediaArray[iMedia] = bz.BZMedia.objectToMedia(mediaArray[iMedia]); 1374 } 1375 mediaArray[iMedia].title = mediaArray[iMedia].title.replace(/(\n|\r)/gm, "<br>"); 1376 mediaArray[iMedia].date = mediaArray[iMedia].date.replace(/(\n|\r)/gm, "<br>"); 1377 } 1378 } 1379 } 1380 this._theme.setMediaArray(mediaArray); 1381 }; 1382 p.setSoundSrc = function(soundSrc) { 1383 this._theme.setSoundSrc(soundSrc); 1384 }; 1385 p.setParam = function(propertyName, value) { 1386 this._theme.setParam(propertyName, value); 1387 }; 1388 p.getParam = function(propertyName) { 1389 return this._theme.getParam(propertyName); 1390 }; 1391 p.loadAndStart = function() { 1392 this._theme.loadAndStart(); 1393 }; 1394 p.imageLoadingComplete = function() { 1395 if (this.mode == bz.Modes.BZ) { 1396 try { 1397 window.imageLoadingComplete(); 1398 } catch (e) { 1399 console.error(e); 1400 } 1401 } 1402 }; 1403 p.mediaClicked = function(media) { 1404 if (this._navigateToUrl && media) { 1405 this._navigateToUrl(media.url, media.index); 1406 } 1407 }; 1408 p.setNavigateToUrl = function(callback) { 1409 this._navigateToUrl = callback; 1410 }; 1411 } 1412 if (!bz.BZMedia) { 1413 bz.BZMedia = function() { 1414 this.path = null; 1415 this.title = null; 1416 this.date = null; 1417 this.url = null; 1418 this.index = -1; 1419 this.loaded = false; 1420 this.width = null; 1421 this.height = null; 1422 this.sizeDefined = false; 1423 this.img = null; 1424 this.next = null; 1425 this.prev = null; 1426 this.isFirst = false; 1427 this.isLast = false; 1428 this.onLoadSignal = new bz.signals.Signal(); 1429 }; 1430 var p = bz.BZMedia.prototype; 1431 bz.BZMedia.objectToMedia = function(object) { 1432 var media = new bz.BZMedia(); 1433 for (var key in object) { 1434 if (media.hasOwnProperty(key)) { 1435 media[key] = object[key]; 1436 } 1437 } 1438 if (media.width && media.height) { 1439 media.sizeDefined = true; 1440 } 1441 return media; 1442 }; 1443 bz.BZMedia.createMedia = function(path, title, date, url, width, height) { 1444 var media = new bz.BZMedia(); 1445 media.path = path; 1446 media.title = title; 1447 media.date = date; 1448 media.url = url; 1449 if (width && height) { 1450 media.width = width; 1451 media.height = height; 1452 media.sizeDefined = true; 1453 } 1454 return media; 1455 }; 1456 bz.BZMedia.setRootDiv = function(themeDiv) { 1457 var div = document.createElement("div"); 1458 div.style.visibility = "hidden"; 1459 div.style.zIndex = -10; 1460 themeDiv.appendChild(div); 1461 bz.BZMedia.rootDiv = div; 1462 }; 1463 p._onLoaded = function() { 1464 this.width = this.img.width; 1465 this.height = this.img.height; 1466 this.sizeDefined = true; 1467 this.loaded = true;
1468 this.onLoadSignal.dispatch(this); 1469 }; 1470 p.load = function() { 1471 if (!this._loading && !this.loaded) { 1472 this._loading = true; 1473 this.img = document.createElement("img"); 1474 bz.BZMedia.rootDiv.appendChild(this.img); 1475 var self = this; 1476 var onloadedCallback = function() { 1477 self._onLoaded(); 1478 }; 1479 if (true || !bz.debugLoadingDelay) { 1480 this.img.onload = onloadedCallback; 1481 } else { 1482 this.img.onload = function() { 1483 self._degugTimeoutId = setTimeout(onloadedCallback, bz.debugLoadingDelay); 1484 }; 1485 } 1486 this.img.src = this.path; 1487 } 1488 }; 1489 p.unload = function() { 1490 if (this.img) { 1491 this.loaded = false; 1492 this._loading = false; 1493 this.img.src = ""; 1494 this.img.onload = null; 1495 clearTimeout(this._degugTimeoutId); 1496 bz.BZMedia.rootDiv.removeChild(this.img); 1497 this.img = null; 1498 } 1499 }; 1500 p.incrUseCount = function() { 1501 if (typeof this.useCount === "undefined") { 1502 this.useCount = 0; 1503 var self = this; 1504 this._unloadTimeout = function() { 1505 if (self._useCount == 0) { 1506 self.unload(); 1507 } 1508 }; 1509 } 1510 if (this.useCount == 0) { 1511 this.load(); 1512 } 1513 this.useCount++; 1514 }; 1515 p.decrUseCount = function() { 1516 this.useCount--; 1517 if (this.useCount == 0) { 1518 clearTimeout(this._useCountTimeoutId); 1519 this._useCountTimeoutId = setTimeout(this._unloadTimeout, 200); 1520 } 1521 }; 1522 } 1523 if (!bz.BZPlugin) { 1524 bz.BZPlugin = function() {}; 1525 var p = bz.BZPlugin.prototype; 1526 bz.BZPlugin.extend = function(PluginClass) { 1527 bz.ClassUtils.extend(PluginClass, bz.BZPlugin); 1528 }; 1529 p.settings = null; 1530 p.name = null; 1531 p.theme = null; 1532 p.props = null; 1533 p.initPlugin = function() { 1534 this.props = {}; 1535 this.initOnce(); 1536 if (!this.settings || !this.name) { 1537 throw new Error(); 1538 } 1539 }; 1540 p.startPlugin = function(theme) { 1541 this.theme = theme; 1542 if (typeof this.onParamChanged === "function") { 1543 this.theme.onParamSignal.add(this.onParamChanged, this); 1544 } 1545 this.startOnce(); 1546 }; 1547 p.updatePlugin = function(flags) { 1548 this.update(flags); 1549 }; 1550 p.set = function(propertyName, value) { 1551 this.props[propertyName] = value; 1552 }; 1553 p.get = function(propertyName) { 1554 return this.props[propertyName]; 1555 }; 1556 p.initOnce = function() { 1557 throw new Error(); 1558 }; 1559 p.startOnce = function() { 1560 throw new Error(); 1561 }; 1562 p.update = function(flags) { 1563 throw new Error(); 1564 }; 1565 } 1566 if (!bz.BZTheme) { 1567 (function() { 1568 bz.BZTheme = function() {}; 1569 var p = bz.BZTheme.prototype; 1570 bz.BZTheme.themes = []; 1571 bz.BZTheme.extend = function(themeClass, parentClass) { 1572 if (!parentClass) parentClass = bz.BZTheme; 1573 bz.ClassUtils.extend(themeClass, parentClass); 1574 bz.BZTheme.themes.push(themeClass); 1575 }; 1576 p._init = function() { 1577 this._started = false; 1578 this._rootElement = null; 1579 this.div = null; 1580 this.id = null; 1581 this._plugins = null; 1582 this.mediaArray = null; 1583 this.settings = null; 1584 this.published = false; 1585 this.onParamSignal = null; 1586 this.mediaSizeComputedSignal = new bz.signals.Signal(); 1587 this.mediaClickedSignal = new bz.signals.Signal(); 1588 this.onParamSignal = new bz.signals.Signal(); 1589 this.innerWidth = 0; 1590 this.innerHeight = 0; 1591 this.onResizeSignal = null; 1592 }; 1593 p.init = function(id, mode, options) { 1594 this._init(); 1595 this.id = id; 1596 this.mode = mode; 1597 if (!options) options = {}; 1598 this.resourcesPath = options.resourcesPath || "./"; 1599 this.assetsPath = options.assetsPath || this.resourcesPath + "assets/";
1600 if (this.id) { 1601 this._rootElement = document.getElementById(this.id); 1602 } 1603 if (!this._rootElement) { 1604 this._rootElement = document.body; 1605 } 1606 this.div = document.createElement("div"); 1607 this.div.className = "bz-themeDiv"; 1608 this.div.style.position = "relative"; 1609 this.div.style.overflow = "hidden"; 1610 this._rootElement.appendChild(this.div); 1611 bz.BZMedia.setRootDiv(this.div); 1612 this.perspectiveDiv = document.createElement("div"); 1613 this.perspectiveDiv.className = "bz-perpectiveDiv"; 1614 this.perspectiveDiv.style.cssText = "position:absolute; left:0px; right:0px; top:0px; bottom:0px;"; 1615 this.div.appendChild(this.perspectiveDiv); 1616 this.animationDiv = document.createElement("div"); 1617 this.animationDiv.className = "bz-animationDiv"; 1618 this.animationDiv.style.cssText = "position:absolute; left:0px; right:0px; top:0px; bottom:0px;"; 1619 this.perspectiveDiv.appendChild(this.animationDiv); 1620 this._plugins = {}; 1621 this._pluginsArray = []; 1622 if (!this._isAlternateTheme) { 1623 var themePlugin = new bz.ThemePlugin(); 1624 this.plug(themePlugin); 1625 this.props = themePlugin.props; 1626 this.soundPlugin = new bz.SoundPlugin(); 1627 this.plug(this.soundPlugin); 1628 this.plug(new bz.Theme3DPlugin()); 1629 } else { 1630 this.props = {}; 1631 } 1632 this.addPlugins(); 1633 this.settings = {}; 1634 for (var pluginName in this._plugins) { 1635 var plugin = this._plugins[pluginName]; 1636 var pluginSettings = plugin.settings; 1637 var extraSettings = {}; 1638 for (var propertyName in pluginSettings) { 1639 var setting = pluginSettings[propertyName]; 1640 switch (setting.type) { 1641 case bz.Types.FONT: 1642 setting.type = bz.Types.ENUM; 1643 setting.possibleValues = bz.FontArray; 1644 break; 1645 case bz.Types.TEXT_ALIGN: 1646 setting.type = bz.Types.ENUM; 1647 setting.possibleValues = bz.AlignArray; 1648 break; 1649 case bz.Types.EASING: 1650 var prefixSetting = bz.ObjectUtils.clone(setting); 1651 bz.ObjectUtils.copyProperties({ 1652 defaultValue: setting.defaultValue[0], 1653 type: bz.Types.ENUM, 1654 possibleValues: bz.EasingPrefixes, 1655 possibleTitles: bz.EasingPrefixes_Strings 1656 }, prefixSetting); 1657 extraSettings[propertyName + "Prefix"] = prefixSetting; 1658 var suffixSetting = bz.ObjectUtils.clone(setting); 1659 bz.ObjectUtils.copyProperties({ 1660 defaultValue: setting.defaultValue[1], 1661 type: bz.Types.ENUM, 1662 possibleValues: bz.EasingSuffixes, 1663 title: "↳", 1664 possibleTitles: bz.EasingSuffixes_Strings 1665 }, suffixSetting); 1666 extraSettings[propertyName + "Suffix"] = suffixSetting; 1667 break; 1668 case bz.Types.COLOR_ALPHA: 1669 extraSettings[setting.nameAlpha] = { 1670 defaultValue: setting.valueAlpha, 1671 type: bz.Types.ALPHA, 1672 flags: setting.flags, 1673 doNotSend: true 1674 }; 1675 setting.nameAlpha = plugin.name + "_" + setting.nameAlpha; 1676 break; 1677 case bz.Types.DIV_STYLE: 1678 extraSettings[propertyName + "_bgColor"] = { 1679 defaultValue: 0x0, 1680 type: bz.Types.COLOR_ALPHA, 1681 nameAlpha: propertyName + "_bgAlpha", 1682 valueAlpha: 0, 1683 flags: [bz.Flags.STYLE],
1684 title: "Background" 1685 }; 1686 extraSettings[propertyName + "_bgAlpha"] = { 1687 defaultValue: 1, 1688 type: bz.Types.ALPHA, 1689 flags: [bz.Flags.STYLE], 1690 doNotSend: true 1691 }; 1692 extraSettings[propertyName + "_bgColor"].nameAlpha = plugin.name + "_" + extraSettings[propertyName + "_bgColor"].nameAlpha; 1693 extraSettings[propertyName + "_borderWidth"] = { 1694 defaultValue: 0, 1695 type: bz.Types.INTEGER, 1696 min: 0, 1697 max: 64, 1698 flags: [bz.Flags.STYLE, bz.Flags.SIZE], 1699 title: "Border Width" 1700 }; 1701 extraSettings[propertyName + "_borderColor"] = { 1702 defaultValue: 0x0, 1703 type: bz.Types.COLOR, 1704 flags: [bz.Flags.STYLE], 1705 title: "Border Color" 1706 }; 1707 extraSettings[propertyName + "_borderRadius"] = { 1708 defaultValue: 0, 1709 type: bz.Types.INTEGER, 1710 min: 0, 1711 max: 640, 1712 flags: [bz.Flags.STYLE], 1713 title: "Radius" 1714 }; 1715 if (setting.defaultValue) { 1716 for (var prop in setting.defaultValue) { 1717 if (extraSettings[propertyName + "_" + prop]) { 1718 extraSettings[propertyName + "_" + prop].defaultValue = setting.defaultValue[prop]; 1719 } 1720 } 1721 } 1722 break; 1723 case bz.Types.TIME: 1724 setting.type = bz.Types.FLOAT; 1725 setting.unit = "s"; 1726 break; 1727 case bz.Types.APPEAR_TIMING: 1728 case bz.Types.DISAPPEAR_TIMING: 1729 setting.defaultValue = null; 1730 setting.startName = propertyName + "_start"; 1731 setting.endName = propertyName + "_end"; 1732 extraSettings[setting.startName] = { 1733 defaultValue: setting.startValue, 1734 type: bz.Types.FLOAT, 1735 min: 0, 1736 max: 1, 1737 flags: setting.flags, 1738 doNotSend: true 1739 }; 1740 extraSettings[setting.endName] = { 1741 defaultValue: setting.endValue, 1742 type: bz.Types.FLOAT, 1743 min: 0, 1744 max: 1, 1745 flags: setting.flags, 1746 doNotSend: true 1747 }; 1748 setting.startName = plugin.name + "_" + setting.startName; 1749 setting.endName = plugin.name + "_" + setting.endName; 1750 break; 1751 } 1752 } 1753 bz.ObjectUtils.copyProperties(extraSettings, pluginSettings); 1754 for (var propertyName in pluginSettings) { 1755 var setting = pluginSettings[propertyName]; 1756 if (!setting.propertyName) setting.propertyName = propertyName; 1757 if (setting.NO_PLUGIN_PREFIX) { 1758 setting.settingName = setting.propertyName; 1759 } else { 1760 setting.settingName = plugin.name + "_" + setting.propertyName; 1761 } 1762 setting.plugin = plugin; 1763 if (this.settings[setting.settingName]) { 1764 throw new Error("BZTheme.init - property " + setting.settingName + " already exists"); 1765 } 1766 this.settings[setting.settingName] = setting; 1767 } 1768 } 1769 this.overrideSettings(); 1770 for (var settingName in this.settings) { 1771 var settingObject = this.settings[settingName];
1772 if (bz.warn && !settingObject.hasOwnProperty("defaultValue")) { 1773 console.warn("BZTheme.init - property " + settingName + " missing default value"); 1774 } 1775 settingObject.plugin.set(settingObject.propertyName, settingObject.defaultValue); 1776 } 1777 }; 1778 p.plug = function(plugin, pluginName) { 1779 if (pluginName) { 1780 plugin.name = pluginName; 1781 } 1782 plugin.initPlugin(this); 1783 if (this._plugins[plugin.name] || !plugin.name) { 1784 throw new Error("IncorrectName " + plugin.name); 1785 } 1786 this._plugins[plugin.name] = plugin; 1787 this._pluginsArray.push(plugin); 1788 return plugin; 1789 }; 1790 p.setParam = function(settingName, value) { 1791 if (!this.settings.hasOwnProperty(settingName)) { 1792 if (bz.warn) { 1793 console.warn("BZTheme.setParam(" + settingName + " , " + value + ") => property does not exist"); 1794 } 1795 return; 1796 } 1797 var settingObject = this.settings[settingName]; 1798 if (settingObject.easingSetting) { 1799 settingObject = easingSetting; 1800 value = settingObject.getValue(); 1801 } 1802 if (this._started) { 1803 this._handleParamChange(settingObject, value); 1804 } else { 1805 settingObject.plugin.set(settingObject.propertyName, value); 1806 } 1807 }; 1808 p.getParam = function(settingName) { 1809 switch (settingName) { 1810 case "mediaWidth": 1811 return this.getMediaWidth(); 1812 case "mediaHeight": 1813 return this.getMediaHeight(); 1814 case "imageScaleMode": 1815 return this.getScaleMode(); 1816 } 1817 var setting = this.settings[settingName]; 1818 return setting.plugin.get(setting.propertyName); 1819 }; 1820 p.getSettingsArray = function(_testUI_) { 1821 if (!this._settingsArray) { 1822 this._settingsArray = []; 1823 for (var prop in this.settings) { 1824 var setting = this.settings[prop]; 1825 setting.name = setting.settingName; 1826 if (setting.doNotSend) { 1827 if (!_testUI_) { 1828 continue; 1829 } 1830 } else if (setting.type == bz.Types.EASING || setting.type == bz.Types.DIV_STYLE) { 1831 continue; 1832 } 1833 this._settingsArray.push(setting); 1834 } 1835 this._settingsArray.sort(function(a, b) { 1836 if (a.settingName < b.settingName) { 1837 return -1; 1838 } else { 1839 return 1; 1840 } 1841 }); 1842 } 1843 return this._settingsArray; 1844 }; 1845 p.setMediaArray = function(inMediaArray) { 1846 if (inMediaArray) { 1847 if (this.props.randomMedia) { 1848 bz.ArrayUtils.randomize(inMediaArray); 1849 } 1850 for (var iMedia = 0, lenMedia = inMediaArray.length; iMedia < lenMedia; iMedia++) { 1851 var media = inMediaArray[iMedia]; 1852 media.index = iMedia; 1853 if (iMedia == 0) { 1854 media.prev = inMediaArray[lenMedia - 1]; 1855 } else { 1856 media.prev = inMediaArray[iMedia - 1]; 1857 } 1858 if (iMedia == lenMedia - 1) { 1859 media.next = inMediaArray[0]; 1860 } else { 1861 media.next = inMediaArray[iMedia + 1]; 1862 } 1863 if (this.mode == bz.Modes.DEBUG) { 1864 media.title = "(" + (media.index + 1) + "/" + inMediaArray.length + ") " + media.title; 1865 } 1866 } 1867 inMediaArray[0].isFirst = true; 1868 inMediaArray[0].prev = inMediaArray[lenMedia - 1]; 1869 inMediaArray[lenMedia - 1].isLast = true; 1870 inMediaArray[lenMedia - 1].next = inMediaArray[0]; 1871 } 1872 this.mediaArray = inMediaArray; 1873 }; 1874 p.setSoundSrc = function(soundSrc) { 1875 this.soundSrc = soundSrc; 1876 }; 1877 p.loadAndStart = function() { 1878 if (bz.log) console.log("BZTheme#loadAndStart - ", this, this.mode); 1879 if (this._started) { 1880 throw new Error("BZTheme - loadAndStart called twice !"); 1881 } 1882 var i, lenPlugin = this._pluginsArray.length; 1883 for (i = 0; i < lenPlugin; i++) { 1884 this._pluginsArray[i].startPlugin(this); 1885 } 1886 for (i = 0; i < lenPlugin; i++) { 1887 this._pluginsArray[i].updatePlugin(); 1888 } 1889 this._started = true; 1890 this.start();
1891 this.mediaSizeComputedSignal.dispatch(); 1892 }; 1893 p.setInnerSize = function(width, height) { 1894 this.innerWidth = width; 1895 this.innerHeight = height; 1896 if (this._started) { 1897 var resizeFlag = {}; 1898 resizeFlag[bz.Flags.THEME_SIZE] = true; 1899 var lenPlugin = this._pluginsArray.length; 1900 for (var i = 0; i < lenPlugin; i++) { 1901 var plugin = this._pluginsArray[i]; 1902 plugin.updatePlugin(resizeFlag); 1903 } 1904 } 1905 }; 1906 p.onMediaClick = function(media) { 1907 // if (this.mode == bz.Modes.DEBUG) console.log("Media CLICKED", media); 1908 document.location.href=media.url; 1909 this.mediaClickedSignal.dispatch(media); 1910 }; 1911 p.getAssetPath = function(file) { 1912 return this.assetsPath + file; 1913 }; 1914 p.getResourcePath = function(file) { 1915 return this.resourcesPath + file; 1916 }; 1917 p._handleParamChange = function(setting, value) { 1918 if (!setting.delay) { 1919 this._doUpdateParams(setting, value); 1920 } else { 1921 if (this._updateLaterTimeoutId) { 1922 clearTimeout(this._updateLaterTimeoutId); 1923 } 1924 if (!this._onUpdateLaterTimeoutClosure) { 1925 var self = this; 1926 this._onUpdateLaterTimeoutClosure = function() { 1927 self._onUpdateLaterTimeout(); 1928 } 1929 } 1930 if (!this._updateLaterValues) { 1931 this._updateLaterValues = {}; 1932 } 1933 this._updateLaterValues[setting.settingName] = value; 1934 this._updateLaterTimeoutId = setTimeout(this._onUpdateLaterTimeoutClosure, 200); 1935 } 1936 }; 1937 p._doUpdateParams = function(setting, value) { 1938 if (!setting.flagsMap) { 1939 setting.flagsMap = {}; 1940 if (setting.flags) { 1941 for (var iFlag = 0, lenFlag = setting.flags.length; iFlag < lenFlag; iFlag++) { 1942 setting.flagsMap[setting.flags[iFlag]] = true; 1943 } 1944 } 1945 } 1946 setting.plugin.set(setting.propertyName, value); 1947 setting.plugin.updatePlugin(setting.flagsMap); 1948 this.onParamSignal.dispatch(setting, value); 1949 }; 1950 p._onUpdateLaterTimeout = function() { 1951 for (var settingName in this._updateLaterValues) { 1952 this._doUpdateParams(this.settings[settingName], this._updateLaterValues[settingName]); 1953 } 1954 this._updateLaterTimeoutId = null; 1955 this._updateLaterValues = null; 1956 }; 1957 p.addPlugins = function() { 1958 throw new Error(); 1959 }; 1960 p.overrideSettings = function() { 1961 throw new Error(); 1962 }; 1963 p.start = function() { 1964 throw new Error(); 1965 }; 1966 p.getMediaWidth = function() { 1967 var mediaPlugin = this.getPlugin("media"); 1968 return mediaPlugin.props.width - 2 * mediaPlugin.props.div_borderWidth; 1969 }; 1970 p.getMediaHeight = function() { 1971 var mediaPlugin = this.getPlugin("media"); 1972 return mediaPlugin.props.height - 2 * mediaPlugin.props.div_borderWidth; 1973 }; 1974 p.getScaleMode = function() { 1975 var mediaPlugin = this.getPlugin("media"); 1976 return mediaPlugin.props.scaleMode; 1977 }; 1978 p.getPlugin = function(inPlugin) { 1979 if (typeof(inPlugin) == 'string') { 1980 return this._plugins[inPlugin]; 1981 } else { 1982 if (inPlugin instanceof bz.BZPlugin) { 1983 return inPlugin; 1984 } else { 1985 for (var pluginName in this._plugins) { 1986 var plugin = this._plugins[pluginName]; 1987 if (plugin instanceof inPlugin) { 1988 return plugin; 1989 } 1990 } 1991 } 1992 } 1993 }; 1994 p.updateSetting = function(inPlugin, propertyName, defaultValue, min, max) { 1995 var plugin = this.getPlugin(inPlugin); 1996 var setting = plugin.settings[propertyName]; 1997 setting.defaultValue = defaultValue; 1998 if (min !== undefined) { 1999 setting.min = min; 2000 } 2001 if (max !== undefined) { 2002 setting.max = max; 2003 } 2004 return setting; 2005 }; 2006 p.updateSettings = function(inPlugin, map) { 2007 for (var propertyName in map) { 2008 this.updateSetting(inPlugin, propertyName, map[propertyName]); 2009 } 2010 }; 2011 })(); 2012 } 2013 if (!bz.PreloaderPlugin) { 2014 (function() { 2015 var _NAME = "preloader"; 2016 bz.PreloaderPlugin = function() { 2017 this.name = _NAME; 2018 } 2019 bz.PreloaderPlugin.NAME = _NAME; 2020 bz.BZPlugin.extend(bz.PreloaderPlugin); 2021 var p = bz.PreloaderPlugin.prototype; 2022 var PREVIEW_MODE_FLAG = "previewMode"; 2023 p.initOnce = function() { 2024 this.settings = { 2025 numImagesToLoad: { 2026 defaultValue: 1, 2027 type: bz.Types.INTEGER, 2028 min: 0, 2029 max: 100, 2030 title: "Number To Load" 2031 }, 2032 barBorderColor: { 2033 defaultValue: 0x0, 2034 type: bz.Types.COLOR, 2035 title: "Bar Border" 2036 }, 2037 barBgColor: { 2038 defaultValue: 0xffffff, 2039 type: bz.Types.COLOR,
2040 title: "Bar Background" 2041 }, 2042 barBorderWidth: { 2043 defaultValue: 0, 2044 type: bz.Types.INTEGER, 2045 min: 0, 2046 max: 100, 2047 title: "Border Width" 2048 }, 2049 barBorderRadius: { 2050 defaultValue: 5, 2051 type: bz.Types.INTEGER, 2052 min: 0, 2053 max: 100, 2054 title: "Border Radius" 2055 }, 2056 barWidth: { 2057 defaultValue: 10, 2058 type: bz.Types.INTEGER, 2059 min: 1, 2060 max: 100, 2061 title: "Bar Width" 2062 }, 2063 barHeight: { 2064 defaultValue: 10, 2065 type: bz.Types.INTEGER, 2066 min: 1, 2067 max: 100, 2068 title: "Bar Height" 2069 }, 2070 numBars: { 2071 defaultValue: 10, 2072 type: bz.Types.INTEGER, 2073 min: 4, 2074 max: 64, 2075 title: "Num Bars" 2076 }, 2077 numBarsDisplayed: { 2078 defaultValue: 8, 2079 type: bz.Types.INTEGER, 2080 min: 4, 2081 max: 64, 2082 title: "Num Displayed" 2083 }, 2084 innerRadius: { 2085 defaultValue: 15, 2086 type: bz.Types.INTEGER, 2087 min: 0, 2088 max: 100, 2089 title: "Radius" 2090 }, 2091 squareMargin: { 2092 defaultValue: 10, 2093 type: bz.Types.INTEGER, 2094 min: 0, 2095 max: 100, 2096 title: "Square Margin" 2097 }, 2098 squareBgColor: { 2099 defaultValue: 0x0, 2100 valueAlpha: 0.5, 2101 nameAlpha: "squareBgAlpha", 2102 type: bz.Types.COLOR_ALPHA, 2103 title: "Square Background" 2104 }, 2105 squareBorderRadius: { 2106 defaultValue: 10, 2107 type: bz.Types.INTEGER, 2108 min: 0, 2109 max: 100, 2110 title: "Square Radius" 2111 }, 2112 previewMode: { 2113 defaultValue: false, 2114 type: bz.Types.BOOL, 2115 flags: [PREVIEW_MODE_FLAG], 2116 title: "Preview Mode" 2117 } 2118 }; 2119 }; 2120 p.startOnce = function() { 2121 if (this.props.numBarsDisplayed > this.props.numBars) { 2122 this.props.numBarsDisplayed = this.props.numBars; 2123 } 2124 }; 2125 p.update = function(flags) { 2126 if (flags && flags[PREVIEW_MODE_FLAG]) { 2127 if (this.props.previewMode) { 2128 this.displaySpinner(); 2129 } else { 2130 this.removeSpinner(); 2131 } 2132 } 2133 }; 2134 p.startLoading = function(callBack, thisObject) { 2135 if (this.props.numImagesToLoad > 0) { 2136 this.props.numImagesToLoad = Math.min(this.props.numImagesToLoad, this.theme.mediaArray.length); 2137 this._numImagesLoaded = 0; 2138 this.displaySpinner(); 2139 bz.setBZProps(this.spinner.canvas, { 2140 alpha: 0 2141 }); 2142 bz.tweenBZProps(this.spinner.canvas, { 2143 alpha: 1 2144 }, 500); 2145 this._loadingFinishedCallback = function() { 2146 callBack.apply(thisObject); 2147 }; 2148 for (var i = 0; i < this.props.numImagesToLoad; i++) { 2149 var media = this.theme.mediaArray[i]; 2150 media.onLoadSignal.addOnce(this._mediaLoaded, this); 2151 media.load(); 2152 } 2153 } else { 2154 callBack.apply(thisObject); 2155 } 2156 }; 2157 p._mediaLoaded = function() { 2158 this._numImagesLoaded++; 2159 if (this._numImagesLoaded == this.props.numImagesToLoad) { 2160 this._loadingFinishedCallback(); 2161 this._loadingFinishedCallback = null; 2162 if (this.spinner) { 2163 var self = this; 2164 bz.tweenBZProps(this.spinner.canvas, { 2165 alpha: 0 2166 }, 500).call(function() { 2167 self.removeSpinner(); 2168 }); 2169 } 2170 } 2171 }; 2172 p.getSpinner = function() { 2173 var spinner = new bz.Spinner(this.theme, this.props); 2174 return spinner; 2175 }; 2176 p.displaySpinner = function() { 2177 if (!this.spinner) {
2178 this.spinner = this.getSpinner(); 2179 this.spinner.display(); 2180 } 2181 }; 2182 p.removeSpinner = function() { 2183 if (this.spinner) { 2184 this.spinner.destroy(); 2185 delete this.spinner; 2186 } 2187 }; 2188 bz.Spinner = function(theme, props) { 2189 this.theme = theme; 2190 this.props = props; 2191 }; 2192 var p = bz.Spinner.prototype; 2193 p.display = function(parentDiv) { 2194 if (!this.canvas) { 2195 var self = this; 2196 this._boundUpdate = function() { 2197 self.update(); 2198 }; 2199 this.canvas = document.createElement("canvas"); 2200 this.canvas.style.zIndex = 1000; 2201 this.canvas.style.position = "absolute"; 2202 } 2203 if (!this._displayed) { 2204 this._displayed = true; 2205 if (!parentDiv) { 2206 parentDiv = this.theme.div; 2207 } 2208 parentDiv.appendChild(this.canvas); 2209 this.parentDiv = parentDiv; 2210 this._time = 0; 2211 this._prevTime = new Date().getTime(); 2212 bz.requestAnimationFrame(this._boundUpdate); 2213 this.update(); 2214 } 2215 }; 2216 p.hide = function() { 2217 if (this._displayed) { 2218 this._displayed = false; 2219 this.parentDiv.removeChild(this.canvas); 2220 this.parentDiv = null; 2221 } 2222 }; 2223 p.destroy = function() { 2224 if (this._displayed) { 2225 this.hide(); 2226 } 2227 this.canvas = null; 2228 this._boundUpdate = null; 2229 }; 2230 p.update = function() { 2231 if (!this._displayed) { 2232 return; 2233 } 2234 var newTime = new Date().getTime(); 2235 this._time += (newTime - this._prevTime) 2236 this._prevTime = newTime; 2237 var duration = 1500; 2238 if (this._time > duration) { 2239 this._time -= duration; 2240 } 2241 var progress = this._time / duration; 2242 if (!this.canvas) { 2243 throw new Error("test"); 2244 } 2245 var c = this.canvas, 2246 ctx = c.getContext('2d'), 2247 props = this.props; 2248 var size = ~~(this.props.barWidth + this.props.squareMargin + this.props.innerRadius) * 2; 2249 if (this.parentDiv == this.theme.div) { 2250 c.style.left = ~~((this.theme.innerWidth - size) * 0.5) + "px";
2251 c.style.top = ~~((this.theme.innerHeight - size) * 0.5) + "px"; 2252 } else { 2253 c.style.left = ~~((parseInt(this.parentDiv.style.width) - size) * 0.5) + "px"; 2254 c.style.top = ~~((parseInt(this.parentDiv.style.height) - size) * 0.5) + "px"; 2255 } 2256 c.width = size; 2257 c.height = size; 2258 ctx.fillStyle = bz.CSS.colorRGB(props.squareBgColor, props.squareBgAlpha); 2259 bz.CanvasUtils.drawRoundRect(ctx, c.width, c.height, props.squareBorderRadius, true, false); 2260 ctx.translate(~~(c.width * 0.5), ~~(c.height * 0.5)); 2261 ctx.fillStyle = bz.CSS.colorRGB(props.barBgColor); 2262 ctx.strokeStyle = bz.CSS.colorRGB(props.barBorderColor); 2263 ctx.lineWidth = props.barBorderWidth; 2264 var tx = props.innerRadius; 2265 var ty = -(props.barHeight + 2 * props.barBorderWidth) / 2; 2266 var curBar = ~~(progress * props.numBars); 2267 var extraProgress = progress - (curBar / props.numBars); 2268 for (var i = 0; i < props.numBarsDisplayed; i++) { 2269 ctx.save(); 2270 var iBar = (curBar + i) % props.numBars; 2271 var angle = iBar * 2 * Math.PI / props.numBars; 2272 ctx.globalAlpha = (1 / props.numBars - extraProgress) + i * (1 / props.numBarsDisplayed); 2273 ctx.rotate(angle); 2274 ctx.translate(tx, ty); 2275 bz.CanvasUtils.drawRoundRect(ctx, props.barWidth, props.barHeight, props.barBorderRadius, true, props.barBorderWidth > 0); 2276 ctx.restore(); 2277 } 2278 this._currentTime = new Date().getTime(); 2279 if (this._displayed) { 2280 bz.requestAnimationFrame(this._boundUpdate); 2281 } 2282 }; 2283 }()); 2284 } 2285 if (!bz.ThemePlugin) { 2286 (function() { 2287 var _NAME = "theme"; 2288 bz.ThemePlugin = function() { 2289 this.name = _NAME; 2290 }; 2291 bz.ThemePlugin.NAME = _NAME; 2292 bz.BZPlugin.extend(bz.ThemePlugin); 2293 var p = bz.ThemePlugin.prototype; 2294 p.initOnce = function() { 2295 this.settings = { 2296 themeWidth: { 2297 NO_PLUGIN_PREFIX: true, 2298 defaultValue: 640, 2299 type: bz.Types.INTEGER, 2300 min: 10, 2301 max: 1280, 2302 flags: [bz.Flags.SIZE], 2303 title: "Width" 2304 }, 2305 themeHeight: { 2306 NO_PLUGIN_PREFIX: true, 2307 defaultValue: 480, 2308 type: bz.Types.INTEGER, 2309 min: 10, 2310 max: 1280, 2311 flags: [bz.Flags.SIZE], 2312 title: "Height" 2313 }, 2314 randomMedia: { 2315 defaultValue: false, 2316 type: bz.Types.BOOL, 2317 title: "Random Media" 2318 }, 2319 stopOnLast: { 2320 defaultValue: false, 2321 type: bz.Types.BOOL, 2322 title: "Stop On Last" 2323 }, 2324 div: { 2325 defaultValue: null, 2326 type: bz.Types.DIV_STYLE, 2327 title: "" 2328 } 2329 }; 2330 }; 2331 p.startOnce = function() { 2332 this.div = this.theme.div; 2333 }; 2334 p.update = function(flags) { 2335 if (!flags || flags[bz.Flags.STYLE]) { 2336 bz.CSS.divStyle(this.div, this.props); 2337 } 2338 if (!flags || flags[bz.Flags.SIZE]) { 2339 var borderWidth = this.props.div_borderWidth; 2340 var innerWidth = this.props.themeWidth - 2 * borderWidth; 2341 var innerHeight = this.props.themeHeight - 2 * borderWidth; 2342 bz.CSS.setSize(this.div, innerWidth, innerHeight); 2343 this.theme.setInnerSize(innerWidth, innerHeight); 2344 } 2345 }; 2346 })(); 2347 } 2348 if (!bz.SoundPlugin) { 2349 (function() { 2350 var _NAME = "sound"; 2351 bz.SoundPlugin = function() { 2352 this.name = _NAME; 2353 }; 2354 bz.SoundPlugin.NAME = _NAME; 2355 bz.BZPlugin.extend(bz.SoundPlugin); 2356 var p = bz.SoundPlugin.prototype; 2357 var ui = "ui"; 2358 var sound = "sound"; 2359 var volume = "volume"; 2360 p.initOnce = function() { 2361 var divDefault = { 2362 bgColor: 0xaaaaaa, 2363 bgAlpha: 1 2364 }; 2365 this.settings = { 2366 loop: { 2367 defaultValue: true, 2368 type: bz.Types.BOOL, 2369 flags: [sound], 2370 title: "Loop" 2371 }, 2372 autoStart: { 2373 defaultValue: false, 2374 type: bz.Types.BOOL, 2375 flags: [sound], 2376 title: "Auto start" 2377 }, 2378 displayUI: { 2379 defaultValue: true, 2380 type: bz.Types.BOOL, 2381 flags: [ui], 2382 title: "Display:" 2383 }, 2384 defaultVolume: { 2385 defaultValue: 0.6, 2386 min: 0, 2387 max: 1, 2388 flags: [volume], 2389 type: bz.Types.FLOAT, 2390 title: "Start Volume" 2391 }, 2392 div: { 2393 defaultValue: divDefault, 2394 type: bz.Types.DIV_STYLE, 2395 flags: [ui], 2396 title: "" 2397 }, 2398 hPosition: { 2399 defaultValue: bz.Pos.CENTER, 2400 type: bz.Types.ENUM, 2401 possibleValues: [bz.Pos.LEFT, bz.Pos.CENTER, bz.Pos.RIGHT], 2402 flags: [ui], 2403 title: "Horizontal Position:" 2404 }, 2405 vPosition: { 2406 defaultValue: bz.Pos.BOTTOM, 2407 type: bz.Types.ENUM, 2408 possibleValues: [bz.Pos.BOTTOM, bz.Pos.TOP], 2409 flags: [ui], 2410 title: "Vertical Position:" 2411 }, 2412 hOffset: { 2413 defaultValue: 2, 2414 min: -100, 2415 max: 800, 2416 flags: [ui], 2417 type: bz.Types.INTEGER, 2418 title: "Horizontal Offset" 2419 }, 2420 vOffset: { 2421 defaultValue: 2, 2422 min: -100, 2423 max: 800, 2424 flags: [ui], 2425 type: bz.Types.INTEGER, 2426 title: "Vertical Offset" 2427 }, 2428 size: { 2429 defaultValue: 20, 2430 min: 10, 2431 max: 100, 2432 flags: [ui], 2433 type: bz.Types.INTEGER, 2434 title: "Height" 2435 }, 2436 hMargin: { 2437 defaultValue: 5, 2438 min: 10, 2439 max: 100, 2440 flags: [ui], 2441 type: bz.Types.INTEGER, 2442 title: "Horizontal Margin" 2443 }, 2444 vMargin: { 2445 defaultValue: 5, 2446 min: 10, 2447 max: 100, 2448 flags: [ui], 2449 type: bz.Types.INTEGER, 2450 title: "Vertical Margin" 2451 }, 2452 gap: { 2453 defaultValue: 4, 2454 min: 10, 2455 max: 100, 2456 flags: [ui], 2457 type: bz.Types.INTEGER, 2458 title: "Gap" 2459 }, 2460 playPauseColor: { 2461 defaultValue: 0xffffff, 2462 type: bz.Types.COLOR_ALPHA, 2463 nameAlpha: "playPauseAlpha", 2464 valueAlpha: 1, 2465 flags: [ui], 2466 title: "Button" 2467 }, 2468 playPauseBgColor: { 2469 defaultValue: 0x0000ff, 2470 type: bz.Types.COLOR_ALPHA, 2471 nameAlpha: "playPauseBgAlpha", 2472 valueAlpha: 1, 2473 flags: [ui], 2474 title: "Circle" 2475 }, 2476 muteColor: { 2477 defaultValue: 0xffffff, 2478 type: bz.Types.COLOR_ALPHA, 2479 nameAlpha: "muteAlpha", 2480 valueAlpha: 1, 2481 flags: [ui], 2482 title: "Button" 2483 }, 2484 muteBgColor: { 2485 defaultValue: 0x0000ff, 2486 type: bz.Types.COLOR_ALPHA, 2487 nameAlpha: "muteBgAlpha", 2488 valueAlpha: 1, 2489 flags: [ui], 2490 title: "Circle" 2491 }, 2492 volumeBGColor: { 2493 defaultValue: 0x0000ff, 2494 type: bz.Types.COLOR_ALPHA, 2495 nameAlpha: "volumeBgAlpha", 2496 valueAlpha: 1, 2497 flags: [ui],
2498 title: "Background" 2499 }, 2500 volumeColor: { 2501 defaultValue: 0xffffff, 2502 type: bz.Types.COLOR_ALPHA, 2503 nameAlpha: "volumeAlpha", 2504 valueAlpha: 1, 2505 flags: [ui], 2506 title: "Fill" 2507 } 2508 }; 2509 }; 2510 p.startOnce = function() { 2511 if (this.theme.soundSrc || this.theme.mode != bz.Modes.PUBLICATION) { 2512 this.libFolder = ""; 2513 var libUrl; 2514 if (this.theme.mode == bz.Modes.DEBUG) { 2515 this.libFolder = "../../src/external/mediaElement/"; 2516 } else { 2517 this.libFolder = "./mediaElement/"; 2518 } 2519 libUrl = this.libFolder + "mediaelement.min.js"; 2520 var self = this; 2521 bz.LoadUtils.js(libUrl, function() { 2522 self.onLibLoaded(); 2523 }); 2524 } 2525 }; 2526 p.onLibLoaded = function() { 2527 this.buildSound(); 2528 }; 2529 p.buildSound = function() { 2530 if (!this.callbacks) { 2531 this.callbacks = {}; 2532 var a = ["play", "playing", "pause", "ended"]; 2533 var self = this; 2534 var buildCallback = function(event) { 2535 return function() { 2536 self.onEvent(event); 2537 }; 2538 }; 2539 for (var i = 0; i < a.length; i++) { 2540 this.callbacks[a[i]] = buildCallback(a[i]); 2541 } 2542 } 2543 if (this.audioTag) { 2544 this.mediaElement.pause(); 2545 this.audioTag.parentNode.removeChild(this.audioTag); 2546 this.audioTag = null; 2547 for (var event in this.callbacks) { 2548 this.mediaElement.removeEventListener(event, this.callbacks[event], false); 2549 } 2550 this.mediaElement = null; 2551 } 2552 var soundSrc = this.theme.soundSrc; 2553 if (typeof soundSrc == "string") { 2554 soundSrc = [soundSrc]; 2555 } 2556 if (soundSrc && soundSrc.length > 0) { 2557 var html = "<audio preload='preload' "; 2558 if (this.props.autoStart) html += "autoplay='autoplay' "; 2559 if (this.props.loop) html += "loop='loop' "; 2560 html += ">"; 2561 for (var i = 0; i < soundSrc.length; i++) { 2562 var src = soundSrc[i]; 2563 var ext = src.slice(-3); 2564 if (ext == "mp3" || ext == "ogg") { 2565 html += "<source src='" + src + "' type='audio/" + ext + "' />"; 2566 } 2567 } 2568 html += "</audio>"; 2569 this.audioTag = bz.HTMLUtils.createNode(html); 2570 this.theme.div.appendChild(this.audioTag); 2571 var self = this; 2572 mejs.MediaElement(this.audioTag, { 2573 enablePluginDebug: false, 2574 plugins: ['flash', 'silverlight'], 2575 pluginPath: this.libFolder, 2576 success: function(me) { 2577 console.log("ME - SUCCESS", arguments); 2578 self.mediaElement = me; 2579 for (var event in self.callbacks) { 2580 self.mediaElement.addEventListener(event, self.callbacks[event], false); 2581 } 2582 me.setVolume(self.props.defaultVolume); 2583 self.updateUI(); 2584 }, 2585 error: function() { 2586 console.log("ME - ERROR", arguments); 2587 } 2588 }); 2589 } 2590 }; 2591 p.update = function(flags) { 2592 if (this.mediaElement) { 2593 if (flags && flags[sound]) { 2594 this.buildSound(); 2595 } 2596 if (flags && (flags[ui] || flags[bz.Flags.STYLE] || flags[bz.Flags.THEME_SIZE])) { 2597 this.updateUI(); 2598 } 2599 if (flags && flags[volume]) { 2600 this.mediaElement.setVolume(this.props.defaultVolume); 2601 this.updateVolumeUI(); 2602 } 2603 } 2604 }; 2605 p.buildUI = function() { 2606 this.div = document.createElement("div"); 2607 this.div.style.position = "absolute"; 2608 this.div.style.zIndex = 10000; 2609 this.theme.div.appendChild(this.div); 2610 var a = ["playPauseButton", "muteButton", "volumeControl"]; 2611 for (var i = 0; i < a.length; i++) { 2612 var n = a[i]; 2613 this[n] = document.createElement("canvas"); 2614 this.div.appendChild(this[n]); 2615 this[n].style["float"] = "left"; 2616 } 2617 var self = this; 2618 this.playPauseButton.onclick = function() { 2619 self.playPause(); 2620 }; 2621 this.muteButton.onclick = function() { 2622 self.mute(); 2623 }; 2624 this.volumeControl.onmousedown = function(e) { 2625 self.volumeMouseDown(e); 2626 } 2627 }; 2628 p.updateUI = function() { 2629 if (!this.props.displayUI) { 2630 if (this.div) { 2631 bz.CSS.setVisible(this.div, false); 2632 } 2633 } else { 2634 if (!this.div) { 2635 this.buildUI(); 2636 } else { 2637 bz.CSS.setVisible(this.div, true); 2638 } 2639 bz.CSS.divStyle(this.div, this.props); 2640 this.div.style.padding = this.props.vMargin + "px " + this.props.hMargin + "px"; 2641 var c; 2642 c = this.playPauseButton; 2643 c.width = this.props.size; 2644 c.height = this.props.size; 2645 this.updatePlayPause(); 2646 c = this.muteButton; 2647 c.width = this.props.size; 2648 c.height = this.props.size; 2649 c.style.marginLeft = this.props.gap + "px"; 2650 c = this.volumeControl; 2651 c.width = ~~(this.props.size * 2.2); 2652 c.height = this.props.size; 2653 c.style.marginLeft = this.props.gap + "px"; 2654 this.updateVolumeUI(); 2655 var x = 0, 2656 y = 0; 2657 switch (this.props.hPosition) { 2658 case bz.Pos.LEFT: 2659 x = this.props.hOffset; 2660 break; 2661 case bz.Pos.RIGHT: 2662 x = this.theme.innerWidth - this.div.offsetWidth - this.props.hOffset; 2663 break; 2664 case bz.Pos.CENTER: 2665 x = ~~((this.theme.innerWidth - this.div.offsetWidth) / 2 - this.props.hOffset); 2666 break; 2667 } 2668 switch (this.props.vPosition) { 2669 case bz.Pos.TOP: 2670 y = this.props.vOffset; 2671 break; 2672 case bz.Pos.BOTTOM:
2673 y = this.theme.innerHeight - this.div.offsetHeight - this.props.vOffset; 2674 break; 2675 } 2676 bz.CSS.setPos(this.div, x, y); 2677 } 2678 }; 2679 p.updatePlayPause = function(checkStatus) { 2680 if (checkStatus && this.mediaElement.paused == this.playPauseButton.paused) { 2681 return; 2682 } 2683 var b = this.playPauseButton; 2684 if (this.mediaElement) { 2685 b.paused = this.mediaElement.paused; 2686 } else { 2687 b.paused = true; 2688 } 2689 b.width = b.width; 2690 var ctx = b.getContext("2d"); 2691 var size = this.props.size; 2692 ctx.fillStyle = bz.CSS.colorRGB(this.props.playPauseBgColor, this.props.playPauseBgAlpha); 2693 ctx.beginPath(); 2694 ctx.arc(size * 0.5, size * 0.5, size * 0.5, 0, Math.PI * 2, true); 2695 ctx.closePath(); 2696 ctx.fill(); 2697 ctx.fillStyle = bz.CSS.colorRGB(this.props.playPauseColor, this.props.playPauseAlpha); 2698 if (b.paused) { 2699 ctx.beginPath(); 2700 ctx.moveTo(0.35 * size, 0.2 * size); 2701 ctx.lineTo(0.85 * size, 0.5 * size); 2702 ctx.lineTo(0.35 * size, 0.8 * size); 2703 ctx.fill(); 2704 this.muteButton.style.opacity = 0.6; 2705 this.volumeControl.style.opacity = 0.6; 2706 } else { 2707 ctx.fillRect(0.25 * size, 0.25 * size, 0.2 * size, 0.5 * size); 2708 ctx.fillRect(0.55 * size, 0.25 * size, 0.2 * size, 0.5 * size); 2709 this.muteButton.style.opacity = 1; 2710 this.volumeControl.style.opacity = 1; 2711 } 2712 }; 2713 p.updateVolumeUI = function() { 2714 var b = this.muteButton; 2715 var size = this.props.size; 2716 var c = this.volumeControl; 2717 c.width = c.width; 2718 ctx = c.getContext("2d"); 2719 var dy = ~~(0.1 * size); 2720 ctx.fillStyle = bz.CSS.colorRGB(this.props.volumeBgColor, this.props.volumeBgAlpha); 2721 ctx.beginPath(); 2722 ctx.moveTo(0, size - dy); 2723 ctx.lineTo(c.width, size - dy); 2724 ctx.lineTo(c.width, dy); 2725 ctx.closePath(); 2726 ctx.fill(); 2727 ctx.globalCompositeOperation = 'source-atop'; 2728 ctx.fillStyle = bz.CSS.colorRGB(this.props.volumeColor, this.props.volumeAlpha); 2729 ctx.fillRect(0, 0, c.width * this.mediaElement.volume, c.height) 2730 var lFill = 5, 2731 lClear = 2, 2732 n = 4; 2733 var unit = c.width / (n * lClear + (n + 1) * lFill); 2734 for (var i = 0; i < n; i++) { 2735 var x = ~~((i + 1) * (lFill * unit) + i * lClear * unit); 2736 ctx.clearRect(x, 0, ~~(lClear * unit), c.height); 2737 } 2738 }; 2739 p.onEvent = function(event) { 2740 this.updatePlayPause(true); 2741 }; 2742 p.playPause = function() { 2743 if (this.mediaElement) { 2744 if (this.mediaElement.paused) { 2745 this.mediaElement.play(); 2746 } else { 2747 this.mediaElement.pause(); 2748 } 2749 this.updatePlayPause(); 2750 } 2751 }; 2752 p.mute = function() { 2753 if (this.mediaElement) { 2754 if (this.mediaElement.paused) return; 2755 if (this.mediaElement.volume == 0) { 2756 if (!this._savedVolume) this._savedVolume = this.props.defaultVolume; 2757 this.mediaElement.setVolume(this._savedVolume); 2758 } else { 2759 this._savedVolume = this.mediaElement.volume; 2760 this.mediaElement.setVolume(0); 2761 } 2762 this.updateVolumeUI(); 2763 } 2764 }; 2765 p.volumeMouseDown = function(e) { 2766 if (this.mediaElement.paused) return; 2767 var target = document; 2768 if (!this._onMove) { 2769 var self = this; 2770 this._onMove = function(e) { 2771 self.updateVolumeWithMousePos(e); 2772 }; 2773 this._onUp = function(e) { 2774 console.log(e.type, e.target, e.currentTarget); 2775 if (e.type == "mouseup") { 2776 target.removeEventListener("mousemove", self._onMove, false); 2777 target.removeEventListener("mouseup", self._onUp, false); 2778 } 2779 }; 2780 } 2781 target.addEventListener("mousemove", this._onMove); 2782 target.addEventListener("mouseup", this._onUp); 2783 this.updateVolumeWithMousePos(e); 2784 }; 2785 p.updateVolumeWithMousePos = function(e) { 2786 var posX = e.clientX - this.volumeControl.getBoundingClientRect().left; 2787 var vol = posX / this.volumeControl.width; 2788 if (vol < 0) { 2789 vol = 0; 2790 } else if (vol > 1) { 2791 vol = 1; 2792 } 2793 this.mediaElement.setVolume(vol); 2794 this.updateVolumeUI(); 2795 }; 2796 })(); 2797 } 2798 if (!bz.Theme3DPlugin) { 2799 (function() { 2800 var _NAME = "theme3D"; 2801 bz.Theme3DPlugin = function() { 2802 this.name = _NAME; 2803 }; 2804 bz.Theme3DPlugin.NAME = _NAME; 2805 bz.BZPlugin.extend(bz.Theme3DPlugin); 2806 var p = bz.Theme3DPlugin.prototype; 2807 p.initOnce = function() { 2808 this.settings = { 2809 enabled3D: { 2810 defaultValue: false, 2811 type: bz.Types.BOOL, 2812 flags: [bz.Flags.SIZE], 2813 title: "Enable" 2814 }, 2815 x: { 2816 defaultValue: 0, 2817 type: bz.Types.INTEGER, 2818 min: -1000, 2819 max: 1000, 2820 flags: [bz.Flags.SIZE], 2821 title: "X" 2822 }, 2823 y: { 2824 defaultValue: 0, 2825 type: bz.Types.INTEGER, 2826 min: -1000, 2827 max: 1000, 2828 flags: [bz.Flags.SIZE], 2829 title: "Y" 2830 }, 2831 z: { 2832 defaultValue: -200, 2833 type: bz.Types.INTEGER, 2834 min: -1000, 2835 max: 500, 2836 flags: [bz.Flags.SIZE], 2837 title: "Z" 2838 }, 2839 rx: { 2840 defaultValue: 10, 2841 type: bz.Types.INTEGER, 2842 min: -90, 2843 max: 90, 2844 flags: [bz.Flags.SIZE], 2845 title: "Rotation X" 2846 }, 2847 ry: { 2848 defaultValue: 25, 2849 type: bz.Types.INTEGER, 2850 min: -90, 2851 max: 90, 2852 flags: [bz.Flags.SIZE], 2853 title: "Rotation Y" 2854 }, 2855 rz: { 2856 defaultValue: 0, 2857 type: bz.Types.INTEGER, 2858 min: -90, 2859 max: 90, 2860 flags: [bz.Flags.SIZE], 2861 title: "Rotation Z" 2862 } 2863 }; 2864 }; 2865 p.startOnce = function() { 2866 this.div = this.theme.div; 2867 }; 2868 p.update = function(flags) { 2869 if (!flags || flags[bz.Flags.SIZE]) { 2870 var pDiv = this.theme.perspectiveDiv; 2871 var aDiv = this.theme.animationDiv; 2872 bz.CSS.perspective(pDiv, 600); 2873 if (bz.has3D && this.props.enabled3D) {
2874 bz.CSS.setPrefixedProp(pDiv, "transformStyle", "preserve-3d"); 2875 bz.CSS.setPrefixedProp(aDiv, "transformStyle", "preserve-3d"); 2876 bz.CSS.setPrefixedProp(aDiv, "transformOrigin", "center center"); 2877 bz.CSS.transform(aDiv, "translate3D(" + this.props.x + "px," + this.props.y + "px," + this.props.z + "px) " + 2878 "rotateX(" + this.props.rx + "deg) " + 2879 "rotateY(" + this.props.ry + "deg) " + 2880 "rotateZ(" + this.props.rz + "deg)"); 2881 } else { 2882 bz.CSS.setPrefixedProp(pDiv, "transformStyle", ""); 2883 bz.CSS.setPrefixedProp(aDiv, "transformStyle", "preserve-3d"); 2884 bz.CSS.setPrefixedProp(aDiv, "transformOrigin", null); 2885 bz.CSS.transform(aDiv, null); 2886 } 2887 } 2888 }; 2889 })(); 2890 } 2891})();
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.