if(!window['googleLT_']){window['googleLT_']=(new Date()).getTime();}if (!window['google']) { window['google'] = {}; } if (!window['google']['loader']) { window['google']['loader'] = {}; google.loader.ServiceBase = 'http://www.google.com/uds'; google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax'; google.loader.ApiKey = 'notsupplied'; google.loader.KeyVerified = true; google.loader.LoadFailure = false; google.loader.Secure = false; google.loader.GoogleLocale = 'www.google.com'; google.loader.ClientLocation = null; google.loader.AdditionalParams = ''; (function() {function g(a){return a in l?l[a]:l[a]=-1!=navigator.userAgent.toLowerCase().indexOf(a)}var l={};function m(a,b){var c=function(){};c.prototype=b.prototype;a.ca=b.prototype;a.prototype=new c}function n(a,b,c){var d=Array.prototype.slice.call(arguments,2)||[];return function(){return a.apply(b,d.concat(Array.prototype.slice.call(arguments)))}}function p(a){a=Error(a);a.toString=function(){return this.message};return a} function q(a,b){for(var c=a.split(/\./),d=window,e=0;e\x3c/script>"):(g("safari")||g("konqueror"))&&window.setTimeout(B,10)),x.push(a)):y(window,"load",a)};t("google.setOnLoadCallback",google.ba); function y(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a["on"+b];a["on"+b]=null!=d?C([c,d]):c}}function C(a){return function(){for(var b=0;b\x3c/script>'):"css"==a&&document.write('')}; t("google.loader.writeLoadTag",google.loader.f);google.loader.Z=function(a){w=a};t("google.loader.rfm",google.loader.Z);google.loader.aa=function(a){for(var b in a)"string"==typeof b&&b&&":"==b.charAt(0)&&!v[b]&&(v[b]=new E(b.substring(1),a[b]))};t("google.loader.rpl",google.loader.aa);google.loader.$=function(a){if((a=a.specs)&&a.length)for(var b=0;b 0 ) { // grab from the list for (var i=0; i < opt_options.autoExecuteList.executeList.length; i++) { this.executeList.push( this.newListItem(opt_options.autoExecuteList.executeList[i])); } this.autoExecuteMode = true; this.currentIndex = 0; if (opt_options.autoExecuteList.statusRoot) { this.statusRoot = opt_options.autoExecuteList.statusRoot; } } } } } GSvideoBar.prototype.resetAutoExecuteListItems = function(newList) { if (this.autoExecuteMode && newList.length > 0) { // stop the timer... if (this.cycleTimer) { clearTimeout(this.cycleTimer); this.cycleTimer = null; } // clear the status area if (this.statusRoot) { this.removeChildren(this.statusRoot); } // nuke the old list this.executeList = new Array(); // build the new list for (var i=0; i < newList.length; i++) { this.executeList.push(this.newListItem(newList[i])); } this.currentIndex = 0; if (this.statusRoot) { this.populateStatusRoot(); } if ( this.executeList.length == 1) { this.switchToListItem(0); } else { this.cycleTimeout(); } } } GSvideoBar.prototype.setGlobals = function() { this.br_AgentContains_cache_ = {}; // subserstructure boxes this.CL_PLAYERBOX = "playerBox_gsvb"; this.CL_PLAYING = "playerBox_gsvb playing_gsvb"; this.CL_IDLE = "playerBox_gsvb idle_gsvb"; this.CL_FLOATING_BOX = "floatingPlayerBox_gsvb"; this.CL_FLOATING_BRANDING = "floatingBranding_gsvb"; this.CL_FLOATING_BOX_PLAYING = "floatingPlayerBox_gsvb playing_gsvb"; this.CL_FLOATING_BOX_IDLE = "floatingPlayerBox_gsvb idle_gsvb"; this.CL_FLOATING_PLAYER = "floatingPlayer_gsvb"; this.CL_FLOATING_PLAYER_PLAYING = "floatingPlayer_gsvb playing_gsvb"; this.CL_FLOATING_PLAYER_IDLE = "floatingPlayer_gsvb idle_gsvb"; this.CL_PLAYERINNERBOX = "playerInnerBox_gsvb"; this.CL_VIDEOBARBOX = "videoBarBox_gsvb"; this.CL_VIDEOBARBOXFULL = "videoBarBox_gsvb full_gsvb"; this.CL_VIDEOBARBOXEMPTY = "videoBarBox_gsvb empty_gsvb"; // major app states this.CL_ACTIVE = "active_gsvb"; // player this.CL_PLAYER = "player_gsvb"; this.CL_ALLDONE = "alldone_gsvb"; this.CL_TITLE = "title_gsvb"; // results this.CL_RESULTSBOX = "resultsBox_gsvb"; this.CL_BRANDINGBOX = "brandingBox_gsvb"; this.CL_RESULTTABLE_VERTICAL = "resultTable_gsvb vertical_gsvb"; this.CL_RESULTTABLE_HORIZONTAL = "resultTable_gsvb horizontal_gsvb"; this.CL_RESULTCELL = "resultCell_gsvb"; this.CL_RESULTDIV = "resultDiv_gsvb"; this.CL_RESULTDIV_SMALL = "resultDiv_gsvb smallResultDiv_gsvb"; // status this.CL_STATUSBOX = "statusBox_gsvb"; this.CL_STATUSITEM = "statusItem_gsvb"; this.CL_STATUSITEM_SELECTED = "statusItem_gsvb statusItemSelected_gsvb"; this.smallResultBoxHeight = 39; this.resultBoxHeight = 77; } GSvideoBar.prototype.buildSuperStructure = function() { // build the player box if we are a master, if not // link up to the master's player if (this.externalMaster == null) { if ( this.playerRoot == GSvideoBar.PLAYER_ROOT_FLOATING ) { this.floatingPlayerBox = this.createDiv(null, this.CL_FLOATING_BOX_IDLE); this.playerRoot = this.createDiv(null, this.CL_FLOATING_PLAYER_IDLE); document.body.appendChild(this.floatingPlayerBox); document.body.appendChild(this.playerRoot); if (this.br_IsMac()) { // disable opacity on mac this.floatingPlayerBox.style.opacity = "1.00"; } } else { this.removeChildren(this.playerRoot); } this.playerBox = this.createDiv(null, this.CL_PLAYERBOX); this.playerAllDone = this.createDiv(this.ST_ALL_DONE, this.CL_ALLDONE); this.playerAllDone.onclick = this.methodClosure(this, this.stopVideo, []); this.playerInnerBox = this.createDiv(null, this.CL_PLAYERINNERBOX); this.playerBox.appendChild(this.playerAllDone); this.playerBox.appendChild(this.playerInnerBox); this.playerRoot.appendChild(this.playerBox); this.cssSetClass(this.playerBox, this.CL_IDLE); } this.player = null; // create the videoBar box this.removeChildren(this.barRoot); this.barBox = this.createDiv(null, this.CL_VIDEOBARBOX); this.barRoot.appendChild(this.barBox); // add results box and branding box this.resultsBox = this.createDiv(null, this.CL_RESULTSBOX); this.barBox.appendChild(this.resultsBox); this.cssSetClass(this.barBox, this.CL_VIDEOBARBOXEMPTY); // clear and optionally populate the status area if (this.statusRoot) { this.populateStatusRoot(); } } GSvideoBar.prototype.buildSearchControl = function() { this.vs = new GvideoSearch(); this.vs.setResultSetSize(this.resultSetSize); this.vs.setSearchCompleteCallback(this, GSvideoBar.prototype.searchComplete, [true]); this.vsBypass = new GvideoSearch(); this.vsBypass.setResultSetSize(this.resultSetSize); this.vsBypass.setSearchCompleteCallback(this, GSvideoBar.prototype.searchComplete, [false]); } GSvideoBar.prototype.execute = function(query) { this.vsBypass.execute(query); } GSvideoBar.prototype.executeInternal = function(query) { this.vs.execute(query); } GSvideoBar.prototype.clearAllResults = function() { this.cssSetClass(this.barBox, this.CL_VIDEOBARBOXEMPTY); } GSvideoBar.prototype.searchComplete = function(fromListItem) { var results = null; if (fromListItem) { var currentListItem = this.executeList[this.currentIndex]; if (this.vs.results && this.vs.results.length > 0) { // populate cache currentListItem.results = new Array(); currentListItem.cacheCount = 1; currentListItem.errorCount = 0; for (var i = 0; i < this.vs.results.length; i++) { currentListItem.results.push(this.vs.results[i]); } results = currentListItem.results; } else { currentListItem.errorCount++; // if the error is due to a bad search term, then // nuke right away if (this.vs.completionStatus == 200) { currentListItem.errorCount = GSvideoBar.MAX_ERROR_COUNT + 1; } } } else { // normal .execute called, no caching... if (this.vsBypass.results && this.vsBypass.results.length > 0) { results = this.vsBypass.results; } } this.processResults(results); } GSvideoBar.prototype.processResults = function(results) { if ( results && results.length > 0) { this.cssSetClass(this.barBox, this.CL_VIDEOBARBOXFULL); this.removeChildren(this.resultsBox); var cell; var table; var row = null; if (this.verticalMode) { table = this.createTable(this.CL_RESULTTABLE_VERTICAL); } else { table = this.createTable(this.CL_RESULTTABLE_HORIZONTAL); } table.setAttribute("align", "center"); for (var i = 0; i < results.length; i++) { var res = results[i]; var imageScaler; var resultBoxHeight; var resultClass = null; if (this.thumbSize == GSvideoBar.THUMBNAILS_MEDIUM ) { // full size image imageScaler = {width:100,height:75}; resultBoxHeight = this.resultBoxHeight; resultClass = this.CL_RESULTDIV; } else { // small size image imageScaler = {width:50,height:37}; resultBoxHeight = this.smallResultBoxHeight; resultClass = this.CL_RESULTDIV_SMALL; } var scaled = GSearch.scaleImage(res.tbWidth, res.tbHeight, imageScaler); var img = this.createImage(res.tbUrl, scaled.width, scaled.height, null); if (this.externalMaster) { img.onclick = this.methodClosure(this.externalMaster, this.externalMaster.playVideo, [res]); } else { img.onclick = this.methodClosure(this, this.playVideo, [res]); } // manually set the top padding if ((resultBoxHeight - scaled.height) > 0) { var padTop = Math.round((resultBoxHeight - scaled.height)/2); img.setAttribute("vspace", padTop); } // compute duration var seconds = res.duration; var minutes = parseInt(seconds/60); var durationString; if (minutes > 0) { durationString = minutes + "m"; var remainder = seconds%60; if (remainder > 20) { durationString += " " + remainder + "s"; } } else { durationString = seconds + "s"; } var toolTip = res.titleNoFormatting + " ( " + durationString + " )"; var div = this.createDiv(null, resultClass); div.title = toolTip; div.appendChild(img); // create a new row for each result when in vertical mode // otherwise, jam everything into a single row. if (this.verticalMode) { row = this.createTableRow(table); } else { if (row == null) { row = this.createTableRow(table); } } cell = this.createTableCell(row, this.CL_RESULTCELL); cell.setAttribute("align", "center"); cell.appendChild(div); } // now add in the branding... row = this.createTableRow(table); var brandingOrientation; if (this.verticalMode) { cell = this.createTableCell(row, this.CL_RESULTCELL); brandingOrientation = GSearch.VERTICAL_BRANDING; } else { cell = this.createTableCell(row, this.CL_RESULTCELL); if (this.br_IsIE()) { cell.setAttribute("colSpan", results.length); } else { cell.setAttribute("colspan", results.length); } brandingOrientation = GSearch.HORIZONTAL_BRANDING; } GSearch.getBranding(cell, brandingOrientation, "http://www.youtube.com"); this.brandingCell = cell; this.resultsBox.appendChild(table); } else { this.cssSetClass(this.barBox, this.CL_VIDEOBARBOXEMPTY); } } GSvideoBar.prototype.playVideo = function(result) { this.stopVideo(); if (this.autoExecuteMode && this.cycleTimer) { clearTimeout(this.cycleTimer); this.cycleTimer = null; } if (result.playUrl && result.playUrl != "") { this.cssSetClass(this.playerBox, this.CL_PLAYING); if (this.floatingPlayerBox) { this.cssSetClass(this.floatingPlayerBox, this.CL_FLOATING_BOX_PLAYING); this.cssSetClass(this.playerRoot, this.CL_FLOATING_PLAYER_PLAYING); } this.player = GvideoSearch.createPlayer(result, this.CL_PLAYER); this.playerInnerBox.appendChild(this.player); // the title var title = this.createDivLink(result.url, result.title, null, this.CL_TITLE); this.playerInnerBox.appendChild(title); if (this.floatingPlayerBox) { var playerBounds = GSvideoBar.nodeBounds(this.playerRoot); var bounds = GSvideoBar.nodeBounds(this.barRoot); var x; var y; if (this.verticalMode) { x = bounds.x - playerBounds.width; y = bounds.y + bounds.height / 2 - playerBounds.height / 2; var brandingBounds = GSvideoBar.nodeBounds(this.brandingCell); y = y - brandingBounds.height / 2; if (x < 10) { x = bounds.x + bounds.width; } } else { x = bounds.x + bounds.width / 2 - playerBounds.width / 2; y = bounds.y - playerBounds.height; if (y < 10) { y = bounds.y + bounds.height; } } this.playerRoot.style.top = y + "px"; this.playerRoot.style.left = x + "px"; this.floatingPlayerBox.style.top = y - 10 + "px"; this.floatingPlayerBox.style.left = x - 10 + "px"; boxWidth = (playerBounds.width + 20) + "px"; this.floatingPlayerBox.style.width = boxWidth; this.floatingPlayerBox.style.height = (playerBounds.height + 20) + "px"; } } } GSvideoBar.prototype.stopVideo = function() { this.cssSetClass(this.playerBox, this.CL_IDLE); if (this.floatingPlayerBox) { this.cssSetClass(this.floatingPlayerBox, this.CL_FLOATING_BOX_IDLE); this.cssSetClass(this.playerRoot, this.CL_FLOATING_PLAYER_IDLE); } this.removeChildren(this.playerInnerBox); if (this.player) { delete(this.player); this.player = null; } if (this.autoExecuteMode && this.executeList.length > 1) { this.clearTimer(); this.cycleTimer = setTimeout(this.cycleTimeClosure, this.cycleTime); } } GSvideoBar.prototype.clearTimer = function() { if (this.cycleTimer) { clearTimeout(this.cycleTimer); this.cycleTimer = null; } } GSvideoBar.prototype.cycleTimeout = function() { // select a new video // execute a search // restart the timer if ( this.player == null ) { // if there is only a single item in the execute list, // run it if ( this.executeList.length == 1) { this.switchToListItem(0); } else { var index = 0; if (this.cycleMode == GSvideoBar.CYCLE_MODE_RANDOM) { var max = this.executeList.length - 1; index = Math.round(max * Math.random()); } else if (this.cycleMode == GSvideoBar.CYCLE_MODE_LINEAR){ index = this.cycleNext; this.cycleNext++; if (this.cycleNext >= this.executeList.length) { this.cycleNext = 0; } } this.switchToListItem(index); this.clearTimer(); this.cycleTimer = setTimeout(this.cycleTimeClosure, this.cycleTime); } } } /** * Autoexecute List Item Support */ GSvideoBar.prototype.newListItem = function(q) { var listItem = new Object(); listItem.node = null; listItem.query = q; listItem.results = new Array(); listItem.errorCount = 0; listItem.cacheCount = 0; return listItem; } GSvideoBar.prototype.switchToListItem = function(i) { // reset selcted class of previous item // note, first time through this sets // node 0 if (this.executeList[this.currentIndex].node) { this.cssSetClass(this.executeList[this.currentIndex].node, this.CL_STATUSITEM); } this.currentIndex = i; if (this.executeList[this.currentIndex].node) { this.cssSetClass(this.executeList[this.currentIndex].node, this.CL_STATUSITEM_SELECTED); } var queryTerm = this.executeList[this.currentIndex].query; var cacheResults = false; var currentListItem = null; currentListItem = this.executeList[this.currentIndex]; // if the error count of an item has reached max, reset query term if (currentListItem.errorCount > GSvideoBar.MAX_ERROR_COUNT) { currentListItem.errorCount = 0; queryTerm = GSvideoBar.DEFAULT_QUERY; currentListItem.query = queryTerm; } // if the listItem has no cached results, OR if // we have used the cached results several times // already, initiate a real search if (currentListItem.cacheCount == 0 || currentListItem.cacheCount > this.cacheLifetime ) { currentListItem.cacheCount = 0; this.executeInternal(queryTerm); } else { currentListItem.cacheCount++; this.processResults(currentListItem.results); } } GSvideoBar.prototype.populateStatusRoot = function() { this.removeChildren(this.statusRoot); this.statusBox = this.createDiv(null, this.CL_STATUSBOX); this.statusRoot.appendChild(this.statusBox); if ( this.executeList.length > 0) { for (var i=0; i < this.executeList.length; i++ ) { var listItem = this.executeList[i]; var displayTerm = listItem.query; // if we are looking at our special feed: terms, strip // feed: from the display var m = displayTerm.match(/feed:(top100|top100new)$/); if (m && m.length == 2) { displayTerm = m[1]; } var div = this.createDiv(displayTerm, this.CL_STATUSITEM); // add click handler... div.onclick = this.methodClosure(this, GSvideoBar.prototype.switchToListItem, [i] ); listItem.node = div; this.statusBox.appendChild(div); this.statusBox.appendChild(document.createTextNode(" ")); } } } /** * Static Helper Method */ GSvideoBar.methodCallback = function(object, method) { return function() { return method.apply(object, arguments); } } /** * Class methods */ GSvideoBar.prototype.methodClosure = function(object, method, opt_argArray) { return function() { return method.apply(object, opt_argArray); } } GSvideoBar.prototype.createDiv = function(opt_text, opt_className) { var el = document.createElement("div"); if (opt_text) { el.innerHTML = opt_text; } if (opt_className) { el.className = opt_className; } return el; } GSvideoBar.prototype.removeChildren = function(parent) { while (parent.firstChild) { parent.removeChild(parent.firstChild); } } GSvideoBar.prototype.removeChild = function(parent, child) { parent.removeChild(child); } GSvideoBar.prototype.cssSetClass = function(el, className) { el.className = className; } GSvideoBar.prototype.createTable = function(opt_className) { var el = document.createElement("table"); if (opt_className) { el.className = opt_className; } return el; } GSvideoBar.prototype.createTableRow = function(table, opt_className) { var tr = table.insertRow(-1); if (opt_className) { tr.className = opt_className; } return tr; } GSvideoBar.prototype.createTableCell = function(tr, opt_className) { var td = tr.insertCell(-1); if (opt_className) { td.className = opt_className; } return td; } GSvideoBar.prototype.createDivLink = function(href, text, opt_target, opt_className) { var div = this.createDiv(null, opt_className); var el = document.createElement("a"); el.href = href; el.appendChild(document.createTextNode(text)); if (opt_className) { el.className = opt_className; } if (opt_target) { el.target = opt_target; } div.appendChild(el); return div; } GSvideoBar.prototype.createImage = function(src, opt_w, opt_h, opt_className) { var el = document.createElement("img"); el.src = src; if (opt_w) { el.width = opt_w; } if (opt_h) { el.height = opt_h; } if (opt_className) { el.className = opt_className; } return el; } GSvideoBar.prototype.getNodeWidth = function(node) { return node.offsetWidth; } GSvideoBar.prototype.br_AgentContains_ = function(str) { if (str in this.br_AgentContains_cache_) { return this.br_AgentContains_cache_[str]; } return this.br_AgentContains_cache_[str] = (navigator.userAgent.toLowerCase().indexOf(str) != -1); } GSvideoBar.prototype.br_IsIE = function() { return this.br_AgentContains_('msie'); } GSvideoBar.prototype.br_IsMac = function() { return this.br_AgentContains_('macintosh') || this.br_AgentContains_('mac_powerpc'); } GSvideoBar.prototype.br_IsKonqueror = function() { return this.br_AgentContains_('konqueror'); } GSvideoBar.prototype.br_IsOpera = function() { return this.br_AgentContains_('opera'); } GSvideoBar.prototype.br_IsSafari = function() { return this.br_AgentContains_('safari') || this.br_IsKonqueror(); } GSvideoBar.prototype.br_IsNav = function() { return !this.br_IsIE() && !this.br_IsSafari() && this.br_AgentContains_('mozilla'); } GSvideoBar.prototype.br_IsWin = function() { return this.br_AgentContains_('win'); } GSvideoBar.nodeBounds = function(obj) { var result = {}; function fixRectForScrolling(r) { // Need to take into account scrolling offset of ancestors (IE already does // this) for (var o = obj.offsetParent; o && o.offsetParent; o = o.offsetParent) { if (o.scrollLeft) { r.x -= o.scrollLeft; } if (o.scrollTop) { r.y -= o.scrollTop; } } } // Mozilla if (obj.ownerDocument && obj.ownerDocument.getBoxObjectFor) { var box = obj.ownerDocument.getBoxObjectFor(obj); result.x = box.x; result.y = box.y; result.width = box.width; result.height = box.height; fixRectForScrolling(result); return result; } // IE if (obj.getBoundingClientRect) { var refWindow; if (obj.ownerDocument && obj.ownerDocument.parentWindow) { refWindow = obj.ownerDocument.parentWindow; } else { refWindow = window; } var rect = obj.getBoundingClientRect(); result.x = rect.left + GSvideoBar.GetIEScrollLeft(refWindow); result.y = rect.top + GSvideoBar.GetIEScrollTop(refWindow); result.width = rect.right - rect.left; result.height = rect.bottom - rect.top; return result; } // Fallback to recursively computing this var left = 0; var top = 0; for (var o = obj; o.offsetParent; o = o.offsetParent) { left += o.offsetLeft; top += o.offsetTop; } result.x = left; result.y = top; result.width = obj.offsetWidth; result.height = obj.offsetHeight; fixRectForScrolling(result); return result; } // Get the y position scroll offset. GSvideoBar.GetIEScrollTop = function(win) { if ("compatMode" in win.document && win.document.compatMode == "CSS1Compat") { return win.document.documentElement.scrollTop; } else { return win.document.body.scrollTop; } } // Get the x position scroll offset. GSvideoBar.GetIEScrollLeft = function(win) { if ("compatMode" in win.document && win.document.compatMode == "CSS1Compat") { return win.document.documentElement.scrollLeft; } else { return win.document.body.scrollLeft; } } /** * Master animation controller * * @changes 2011-01-04 / cs / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author cs * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ /** * Constructor * * @access public */ de.tanzschulerank.gui.YouTubeController = function() { // Constructor this.constructor = de.tanzschulerank.gui.YouTubeController; } de.tanzschulerank.gui.YouTubeController.prototype.Initialize = function() { this.YouTubeChannelSearch(); } de.tanzschulerank.gui.YouTubeController.prototype.YouTubeChannelSearch = function() { var ytChannelTag = document.getElementById( 'ytChannelTag' ); var ytVideoPlayerTag = document.getElementById( 'ytVideoPlayer' ); if ( ytChannelTag != null && ytVideoPlayerTag != null ) { var videoBar; var options = { string_allDone : " ", largeResultSet : true, horizontal : false, thumbnailSize : GSvideoBar.THUMBNAILS_MEDIUM, autoExecuteList : { cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM, cycleMode : GSvideoBar.CYCLE_MODE_LINEAR, executeList : ["ytchannel:tanzschulerank"] } } videoBar = new GSvideoBar(ytChannelTag, ytVideoPlayerTag, options ); } } /** * Master animation controller * * @changes 2011-01-04 / cs / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author cs * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ var ControlEventHandler = com.chilibytes.phx.gui.ControlEventHandler; var Motion = com.chilibytes.phx.gui.animation.Motion; var Scaling = com.chilibytes.phx.gui.animation.Scaling; var Fading = com.chilibytes.phx.gui.animation.Fading; var Sprite = com.chilibytes.phx.gui.animation.Sprite; var DoNothing = com.chilibytes.phx.gui.animation.DoNothing; var Animation = com.chilibytes.phx.gui.animation.Animation; var AnimationSequence = com.chilibytes.phx.gui.animation.AnimationSequence; var QuadraticBezierProcess = com.chilibytes.phx.gui.animation.QuadraticBezierProcess; var BounceProcess = com.chilibytes.phx.gui.animation.BounceProcess; var SlurpProcess = com.chilibytes.phx.gui.animation.SlurpProcess; var GammaProcess = com.chilibytes.phx.gui.animation.GammaProcess; var LinearProcess = com.chilibytes.phx.gui.animation.LinearProcess; var Base64 = com.chilibytes.phx.common.Base64; var Environment = com.chilibytes.phx.net.web.Environment; /** * Constructor * * @access public */ de.tanzschulerank.gui.AnimationController = function() { // Constructor this.constructor = de.tanzschulerank.gui.AnimationController; this.fControlEventHandler = new ControlEventHandler(); // divs and imgs for animations this.fShutDivA = new Array(); this.fShutImgA = new Array(); this.fMenuDivA = new Array(); this.fMenuImgA = new Array(); this.fMenuGlow = null; this.fMenuShadeDiv = null; this.fFacebookDiv = null; this.fFacebookImg = null; this.fAdtvDiv = null; this.fAdtvImg = null; // start page shutter animation this.fShutterOpenA = new Array(); // registration form animation this.fFormOut = null; this.fFormIn = null; this.fFormIsOut = false; // menu action animation this.fMenuOpenSequenceA = new Array(); this.fMenuShadeSequence = null; this.fPlayerContainer = null; // menu transition animations this.fMenuTransitionUpA = new Array; this.fMenuTransitionDownA = new Array; this.fIsMenuEnabled = true; // employee shutters this.fEmployeeDivA = new Array(); this.fEmployeeImgA = new Array(); this.fEmployeeOpenA = new Array(); // link animations this.fLinkFacebook = null; this.fLinkAdtv = null; // full page shading, blocks all user interaction this.fShadeAll = null; // please wait image this.fWaitDiv = null; } /** * Starts various initialization processes * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.Initialize = function() { this._InitializeMenuDivs(); this._InitializeShutters(); this._InitializeFormScroll(); this._InitializeMenuAction(); this._InitializeMenuTransition(); this._InitializeLinkIcons(); this._InitializeEmployeeShutters(); } /** * Determines, whether the current mouseover object is a child of the root object, to keep mouseover valid * * @param eventP triggered event * @param rootObject the object on whose children mouseover shall also be valid * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._IsEventValid = function( eventP, rootObject ){ var relatedTarget = null; if ( eventP.type == "mouseover" ) { relatedTarget = ( eventP.fromElement ? eventP.fromElement : eventP.relatedTarget ); } else if ( eventP.type == "mouseout" ) { relatedTarget = ( eventP.toElement ? eventP.toElement : eventP.relatedTarget ); } return ( !this._IsChildOf( relatedTarget, rootObject ) && ( relatedTarget != rootObject ) ); } /** * Determines, whether an object is a child object of another object * * @param child the child object to test * @param parent the parent object * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._IsChildOf = function( child, parent ){ if( child != null ) { while( child.parentNode ) { if( (child = child.parentNode) == parent ) { return true; } } } return false; } /** * On a menu div, determines the menu number (1-6) * * @param div the menu div * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._GetMenuNo = function( div ) { if( div != null ) { return parseInt( div.id.substring(4,5) ) - 1; } else { return null; } } /** * Initializes the divs used in menu animations * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuDivs = function() { var divA = document.getElementsByTagName( "div" ); for ( var i = 0; i < divA.length; i++ ) { if ( divA[i].id.indexOf( "shut" ) != -1 ) { var n = this._GetMenuNo( divA[i] ); this.fShutDivA[n] = divA[i]; this.fShutImgA[n] = document.getElementById( this.fShutDivA[n].id+"img" ); } if ( divA[i].id.indexOf( "menu" ) != -1 ) { var n = this._GetMenuNo( divA[i] ); this.fMenuDivA[n] = divA[i]; this.fMenuImgA[n] = document.getElementById( this.fMenuDivA[n].id+"img" ); } } this.fMenuGlow = document.getElementById( "menuglow" ); this.fPlayerContainer = document.getElementById( "playerContainer" ); this.fMenuShadeDiv = document.getElementById( "bgshade" ); this.fWaitDiv = document.getElementById( 'wait' ); } //------------------------------------------------------------------------------------------------------------------ // // shutters on start page // //------------------------------------------------------------------------------------------------------------------ /** * Initializes the start page shutter animations * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeShutters = function() { var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); for ( var n = 0; n <= 5; n++ ) { if ( this.fShutDivA[n] != null && this.fShutImgA[n] != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fShutDivA[n], this, this.EventOnShutterAction, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fShutDivA[n], this, this.EventOnShutterAction, false ); this.fShutterOpenA[n] = new Animation( 500 ); this.fShutterOpenA[n].AddElement( new Motion( this.fShutImgA[n], "absolute", 0, 0, 0, 260, process ) ); } } } /** * Starts start page shutter animations, differentiates between running and resting animation status * * @param eventP triggered event * @param control element that triggered the event * @param directionOpen direction of shutter anmiation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnShutterAction = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) && this.fIsMenuEnabled ) { var self = this; var n = this._GetMenuNo( control ); var anim = this.fShutterOpenA[n]; var delay = ( directionOpen ? 0 : 100 ) if (anim.IsRunning() ) { window.setTimeout( function() { self.ShutterActionDelay( anim, directionOpen ); }, delay); } else { anim.Run( null, null, directionOpen); } } } /** * Runs start page shutter animations (called after delay to make them look more mass inert) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShutterActionDelay = function( anim, directionOpen ) { anim.Stop(); var t = anim.GetProgress() * anim.GetDuration(); if ( directionOpen ) { anim.Run( t, null, true); } else { anim.Run( null, t, false); } } //------------------------------------------------------------------------------------------------------------------ // // menu inflation / deflation and background shading // //------------------------------------------------------------------------------------------------------------------ /** * Initializes menu animations, including background shading * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuAction = function() { var menuInflateA = new Array(); var menuDownA = new Array(); for ( var n = 0; n <= 5 ; n++ ) { // attach mouse events this.fControlEventHandler.AttachOnMouseOverEvent( this.fMenuDivA[n], this, this.EventOnMenuAction, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fMenuDivA[n], this, this.EventOnMenuAction, false ); // menu animations menuInflateA[n] = new Animation( 500 ); menuDownA[n] = new Animation( 500 ); var menuProcess = new QuadraticBezierProcess(); menuProcess.SetParameter( "x", 0.4 ); menuProcess.SetParameter( "y", 1 ); if ( this.fMenuDivA[n] != null && this.fMenuImgA[n] != null ) { menuInflateA[n].AddElement( new Motion( this.fMenuDivA[n], "absolute", n*95, 30, n*57, 30, menuProcess ) ); menuInflateA[n].AddElement( new Scaling( this.fMenuDivA[n], "absolute", 20, 20, 210, 210, menuProcess ) ); menuInflateA[n].AddElement( new Scaling( this.fMenuImgA[n], "absolute", 68, 68, 258, 258, menuProcess ) ); menuDownA[n].AddElement( new Motion( this.fMenuImgA[n], "absolute", 0, 0, 0, 260, menuProcess ) ); } this.fMenuOpenSequenceA[n] = new AnimationSequence( true ); this.fMenuOpenSequenceA[n].AddAnimation( menuInflateA[n] ); this.fMenuOpenSequenceA[n].AddAnimation( menuDownA[n] ); } // background shading var menuShade = new Animation( 500 ); var shadeProcess = new QuadraticBezierProcess(); shadeProcess.SetParameter( "x", 0.6 ); shadeProcess.SetParameter( "y", 0 ); if ( this.fMenuShadeDiv != null ) { menuShade.AddElement( new Fading( this.fMenuShadeDiv, 0, 0.5, shadeProcess ) ); menuShade.AttachOnAnimationCompleteEvent( this, this.DisableShadeDiv ); } if( this.fMenuGlow != null ) { menuShade.AddElement( new Motion( this.fMenuGlow, "relative", 0, 0, 15, 15, menuProcess ) ); menuShade.AddElement( new Scaling( this.fMenuGlow, "absolute", 100, 100, 70, 70, menuProcess ) ); } var menuShadePause = new Animation( 500 ); // pause before un-shading menuShadePause.AddElement( new DoNothing() ); this.fMenuShadeSequence = new AnimationSequence ( true ); this.fMenuShadeSequence.AddAnimation( menuShade ); this.fMenuShadeSequence.AddAnimation( menuShadePause ); // shade all animation for 'wait' screen this.fShadeAll = new Animation( 300 ); this.fShadeAll.AddElement( new Fading( this.fMenuShadeDiv, 0, 0.5, shadeProcess ) ); } /** * Event for menu animation * * @param eventP triggering event * @param control element that triggered the event * @param directionOpen determines direction of animation: true = 'obpn menu', false = 'close menu' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuAction = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) && this.fIsMenuEnabled ) { var self = this; var delay = 200; var n = this._GetMenuNo( control ); if (directionOpen) { delay = 0; for ( var i = 0; i <= 5 ; i++ ) { this.fMenuDivA[i].style.zIndex = ( i == n ? 5 : 1); } this.fMenuShadeDiv.style.visibility = "visible"; if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "hidden"; } } if ( this.fMenuOpenSequenceA[n].IsRunning() ) { window.setTimeout( function() { self.MenuActionDelay( n, directionOpen ); }, delay); } else { this.fMenuOpenSequenceA[n].Run( directionOpen ); } if ( this.fMenuShadeSequence.IsRunning() ) { this.fMenuShadeSequence.Stop(); this.fMenuShadeSequence.Continue( directionOpen ); } else { this.fMenuShadeSequence.Run( directionOpen ); } } } /** * Runs menu animation (called after delay to make it look more mass inert) * * @param targetSequence animation sequence for a specific menu shutter * @param directionOpen determines direction of animation: true = 'open menu', false = 'close menu' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.MenuActionDelay = function( targetSequence, directionOpen ) { this.fMenuOpenSequenceA[targetSequence].Stop(); this.fMenuOpenSequenceA[targetSequence].Continue( directionOpen ); } /** * Disables visibility of the full shade div element when not in use * * @param isRunning determines, whether menu animation is running * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.DisableShadeDiv = function( isRunning ) { if ( !isRunning ) { this.fMenuShadeDiv.style.visibility = "hidden"; if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "visible"; } } } /** * Runs shade all animation ('wait' screen) * * @param directionShade direction of shading process: true = 'shade', false = 'release shade' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShadeAll = function( directionShade ) { var self = this; if (directionShade) { this.fMenuShadeDiv.style.zIndex = 10; this.fMenuShadeDiv.style.visibility = "visible"; window.setTimeout( function() { self.fWaitDiv.style.visibility = "visible"; }, 300); this.fShadeAll.Stop(); this.fShadeAll.Run( null, null, true ); } else { this.fShadeAll.Stop(); this.fShadeAll.Run( null, null, false ); this.fWaitDiv.style.visibility = "hidden"; window.setTimeout( function() { self.UnshadeAllDelay(); }, 300); } } /** * Runs animation to release shade (called after delay) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.UnshadeAllDelay = function() { this.fMenuShadeDiv.style.zIndex = 2; this.fMenuShadeDiv.style.visibility = "hidden"; } //------------------------------------------------------------------------------------------------------------------ // // menu transition (menu <-> start page) // //------------------------------------------------------------------------------------------------------------------ /** * Initializes the menu transition animations from start page to menu bar * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuTransition = function() { var anchor = document.getElementById( 'homelink' ); if ( anchor != null ) { this.fControlEventHandler.AttachOnClickEvent( anchor, this, this.EventOnMenuTransitionDown, anchor.href ); } var anchor = document.getElementById( 'imprintlink' ); if ( anchor != null ) { this.fControlEventHandler.AttachOnClickEvent( anchor, this, this.EventOnMenuTransitionUp, -1 ); } for ( var n = 0; n <= 5; n++ ) { this.fMenuTransitionUpA[n] = new Animation( 700 ); this.fMenuTransitionDownA[n] = new Animation( 700 ); var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); // transition down (menu -> start page) if ( this.fMenuDivA[n] != null && this.fMenuImgA[n] != null ) { this.fMenuTransitionDownA[n].AddElement( new Motion( this.fMenuDivA[n], "absolute", 95 * n, 30, 285 * ( n % 3 ), 125 + 285 * Math.floor( n / 3 ), process ) ); this.fMenuTransitionDownA[n].AddElement( new Scaling( this.fMenuDivA[n], "absolute", 20, 20, 210, 210, process ) ); this.fMenuTransitionDownA[n].AddElement( new Scaling( this.fMenuImgA[n], "absolute", 68, 68, 258, 258, process ) ); } // transition up (start page -> menu) if ( this.fShutDivA[n] != null && this.fShutImgA[n] != null ) { var anchorA = this.fShutDivA[n].getElementsByTagName( 'a' ); for ( var i = 0; i < anchorA.length; i++ ) { if ( anchorA[i] != null ) { this.fControlEventHandler.AttachOnClickEvent( anchorA[i], this, this.EventOnMenuTransitionUp, n ); } } this.fMenuTransitionUpA[n].AddElement( new Motion( this.fShutDivA[n], "absolute", 285 * ( n % 3 ), 125 + 285 * Math.floor( n / 3 ), 95 * n, 30, process ) ); this.fMenuTransitionUpA[n].AddElement( new Scaling( this.fShutDivA[n], "absolute", 210, 210, 20, 20, process ) ); this.fMenuTransitionUpA[n].AddElement( new Scaling( this.fShutImgA[n], "absolute", 258, 258, 68, 68, process ) ); } } } /** * Event for moving shutter boxes up (start page -> menu) * * @param eventP triggered event * @param control menu anchor link that triggered the event * @param n menu box number (0-5) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuTransitionUp = function( eventP, control, n ) { var self = this; var delay = 0; var target = control.href ? control.href : ''; this.fIsMenuEnabled = false; if ( n>=0 && n<=5 ) { this.fShutterOpenA[n].Run( null, null, false ); delay = 500; } window.setTimeout( function() { self.fMenuTransitionUpA[0].Run(); }, delay + 0 ); window.setTimeout( function() { self.fMenuTransitionUpA[1].Run(); }, delay + 200 ); window.setTimeout( function() { self.fMenuTransitionUpA[2].Run(); }, delay + 400 ); window.setTimeout( function() { self.fMenuTransitionUpA[3].Run(); }, delay + 600 ); window.setTimeout( function() { self.fMenuTransitionUpA[4].Run(); }, delay + 800 ); window.setTimeout( function() { self.fMenuTransitionUpA[5].Run(); }, delay + 1000 ); window.setTimeout( function() { window.location.href = target; }, delay + 2000 ); window.setTimeout( function() { self.fWaitDiv.style.visibility='visible'; }, delay + 1500 ); return false; // prevent execution of html "a href" } /** * Event for moving shutter boxes down (menu -> start page) * * @param eventP triggered event * @param control anchor link that triggered the event * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuTransitionDown = function( eventP, control ) { var self = this; var target = control.href ? control.href : ''; this.fIsMenuEnabled = false; var mainwrapper = document.getElementById( 'mainwrapper' ); mainwrapper.style.visibility = 'hidden'; if ( this.fMenuGlow != null ) { this.fMenuGlow.style.visibility = 'hidden'; } if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "hidden"; } window.setTimeout( function() { self.fMenuTransitionDownA[0].Run(); }, 1000 ); window.setTimeout( function() { self.fMenuTransitionDownA[1].Run(); }, 800 ); window.setTimeout( function() { self.fMenuTransitionDownA[2].Run(); }, 400 ); window.setTimeout( function() { self.fMenuTransitionDownA[3].Run(); }, 300 ); window.setTimeout( function() { self.fMenuTransitionDownA[4].Run(); }, 200 ); window.setTimeout( function() { self.fMenuTransitionDownA[5].Run(); }, 0 ); window.setTimeout( function() { window.location.href = target }, 2000 ); window.setTimeout( function() { self.fWaitDiv.style.visibility='visible'; }, 2000 ); return false; // prevent execution of html "a href" } //------------------------------------------------------------------------------------------------------------------ // // registration form // //------------------------------------------------------------------------------------------------------------------ /** * Initializes scrolling animation of registration forms * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeFormScroll = function() { this.fFormOut = new Animation( 1000 ); this.fFormIn = new Animation( 1000 ); this.fFormOut.AttachOnAnimationCompleteEvent( this, this.EventOnScrollFormOutCompleted ); this.fFormIn.AttachOnAnimationCompleteEvent( this, this.EventOnScrollFormInCompleted ); var process = new BounceProcess(); process.SetParameter( 'amount', 0.07 ); process.SetParameter( 'bounceoff', true ); var targetObject = document.getElementById( "form" ); var targetObject2 = document.getElementById( "formfinalizer" ); if ( targetObject != null && targetObject2 != null ) { this.fFormOut.AddElement( new Motion( targetObject, "absolute", 285, 0, 570, 0, process ) ); this.fFormOut.AddElement( new Motion( targetObject2, "absolute", 285, 0, 570, 0, process ) ); this.fFormIn.AddElement( new Motion( targetObject, "absolute", 570, 0, 285, 0, process ) ); this.fFormIn.AddElement( new Motion( targetObject2, "absolute", 570, 0, 285, 0, process ) ); } } /** * animation to scroll registration forms in or out * * @params directionOut determines scroll direction: true = 'show form', false = 'hide form' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ScrollForm = function( directionOut ) { if ( this.fFormIn != null && this.fFormOut != null ) { this.ShowSelectBoxIE6Fix( directionOut ); // fix for IE6 problems with select boxes and z-indices if ( directionOut ) { this.fFormIn.Stop(); this.fFormOut.Run(); } else if ( this.fFormIsOut || ( this.fFormOut.GetProgress() < 1 && this.fFormOut.GetProgress() > 0 ) ) { this.fFormOut.Stop(); this.fFormIn.Run(); } } } /** * Event on scroll form in animation completed * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnScrollFormInCompleted = function() { this.fFormIsOut = false; } /** * Event on scroll form out animation completed * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnScrollFormOutCompleted = function() { this.fFormIsOut = true; } /** * fixes IE6 display problems with select boxes and z-indices on form scroll * * @params directionShow determines scroll direction: true = 'show form', false = 'hide form' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShowSelectBoxIE6Fix = function( directionShow ) { if ( Environment.CurrentClientBrowser() == CB_ENVIRONMENT_BROWSER_IDENT_IE6x ) { var select = document.getElementById( 'i_rate' ); if ( select !=null ) { if ( directionShow ) { window.setTimeout( function() { select.style.visibility = 'visible'}, 200 ); } else { select.style.visibility = 'hidden'; } } } } //------------------------------------------------------------------------------------------------------------------ // // link icons // //------------------------------------------------------------------------------------------------------------------ /** * Initializes animations of footer bar link icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeLinkIcons = function() { var process = new BounceProcess(); process.SetParameter( "amount", 0.4 ); process.SetParameter( "bounceoff", false ); this.fFacebookDiv = document.getElementById( "facebook" ); this.fFacebookImg = document.getElementById( "facebookimg" ); if ( this.fFacebookDiv != null && this.fFacebookImg != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fFacebookDiv, this, this.EventOnLinkFacebook, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fFacebookDiv, this, this.EventOnLinkFacebook, false ); this.fLinkFacebook = new Animation( 200 ); this.fLinkFacebook.AddElement( new Motion( this.fFacebookDiv, "relative", 0, 0, -5, -8, process ) ); this.fLinkFacebook.AddElement( new Scaling( this.fFacebookDiv, "absolute", 20, 20, 30, 30, process ) ); this.fLinkFacebook.AddElement( new Scaling( this.fFacebookImg, "absolute", 20, 20, 30, 30, process ) ); } this.fAdtvDiv = document.getElementById( "adtv" ); this.fAdtvImg = document.getElementById( "adtvimg" ); if ( this.fAdtvDiv != null && this.fAdtvImg != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fAdtvDiv, this, this.EventOnLinkAdtv, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fAdtvDiv, this, this.EventOnLinkAdtv, false ); this.fLinkAdtv = new Animation( 200 ); this.fLinkAdtv.AddElement( new Motion( this.fAdtvDiv, "relative", 0, 0, -6, -8, process ) ); this.fLinkAdtv.AddElement( new Scaling( this.fAdtvDiv, "absolute", 24, 20, 36, 30, process ) ); this.fLinkAdtv.AddElement( new Scaling( this.fAdtvImg, "absolute", 24, 20, 36, 30, process ) ); } } /** * Runs animation for facebook icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnLinkFacebook = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var anim = this.fLinkFacebook; this.fFacebookDiv.style.zIndex = 2; this.fAdtvDiv.style.zIndex = 1; if (anim.IsRunning() ) { anim.Stop(); } anim.Run( null, null, directionOpen); } } /** * Runs animation for adtv icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnLinkAdtv = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var anim = this.fLinkAdtv; this.fFacebookDiv.style.zIndex = 1; this.fAdtvDiv.style.zIndex = 2; if (anim.IsRunning() ) { anim.Stop(); } anim.Run( null, null, directionOpen); } } //------------------------------------------------------------------------------------------------------------------ // // employee shutters // //------------------------------------------------------------------------------------------------------------------ /** * Initializes animations on employee shutters on 'us' page * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeEmployeeShutters = function() { this.fEmployeeDivA[1] = document.getElementById( "andi" ); this.fEmployeeImgA[1] = document.getElementById( "andiimg" ); this.fEmployeeDivA[2] = document.getElementById( "sabrina" ); this.fEmployeeImgA[2] = document.getElementById( "sabrinaimg" ); this.fEmployeeDivA[3] = document.getElementById( "marcel" ); this.fEmployeeImgA[3] = document.getElementById( "marcelimg" ); this.fEmployeeDivA[4] = document.getElementById( "lukas" ); this.fEmployeeImgA[4] = document.getElementById( "lukasimg" ); var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); for ( n = 1; n <= 4; n++) { if ( this.fEmployeeDivA[n] != null && this.fEmployeeImgA[n] != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fEmployeeDivA[n], this, this.EventOnEmployeeShutter, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fEmployeeDivA[n], this, this.EventOnEmployeeShutter, false ); this.fEmployeeOpenA[n] = new Animation( 500 ); this.fEmployeeOpenA[n].AddElement( new Motion( this.fEmployeeImgA[n], "absolute", 0, 0, 0, 260, process ) ); } } } /** * Event for employee shutter animation * * @param eventP triggered event * @param control element that triggered the event * @param directionOpen direction of animation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnEmployeeShutter = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var self = this; var anim = null; if ( control.id == "andi" ) { anim = this.fEmployeeOpenA[1] } else if ( control.id == "sabrina" ) { anim = this.fEmployeeOpenA[2] } else if ( control.id == "marcel" ) { anim = this.fEmployeeOpenA[3] } else if ( control.id == "lukas" ) { anim = this.fEmployeeOpenA[4] } var delay = ( directionOpen ? 0 : 100 ) if (anim.IsRunning() ) { window.setTimeout( function() { self.EmployeeShutterDelay( anim, directionOpen ); }, delay); } else { anim.Run( null, null, directionOpen); } } } /** * Runs employee shutter animations (called after delay to make them look more mass inert) * * @param anim animation to run * @param directionOpen direction of animation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EmployeeShutterDelay = function( anim, directionOpen ) { anim.Stop(); var t = anim.GetProgress() * anim.GetDuration(); if ( directionOpen ) { anim.Run( t, null, true); } else { anim.Run( null, t, false); } } /** * Page controller * * @changes 2011-04-02 / mb / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author mb * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ var AbstractWindowEvents = com.chilibytes.phx.gui.AbstractWindowEvents; var ControlEventHandler = com.chilibytes.phx.gui.ControlEventHandler; var Base64 = com.chilibytes.phx.common.Base64; var Environment = com.chilibytes.phx.net.web.Environment; var Form = com.chilibytes.phx.gui.Form; var YouTubeController = de.tanzschulerank.gui.YouTubeController; var AnimationController = de.tanzschulerank.gui.AnimationController; /** * Constructor * * @access public */ de.tanzschulerank.gui.PageController = function() { // Constructor this.constructor = de.tanzschulerank.gui.PageController; // Super class AbstractWindowEvents.call( this ); this.fControlEventHandler = new ControlEventHandler(); // Misc controller this.fAnimationController = new AnimationController(); this.fYouTubeController = new YouTubeController(); this.fForm = null; } /** * Inherit from window events */ var _pageControllerInheritP = function() {}; _pageControllerInheritP.prototype = AbstractWindowEvents.prototype; de.tanzschulerank.gui.PageController.prototype = new _pageControllerInheritP(); /** * @{inheritdoc} */ de.tanzschulerank.gui.PageController.prototype.WindowOnLoad = function( eventP ) { this.Initialize(); if ( this.fAnimationController != null ) this.fAnimationController.Initialize(); if ( this.fYouTubeController != null ) this.fYouTubeController.Initialize(); } de.tanzschulerank.gui.PageController.prototype.Initialize = function() { // Get all galleries var anchorA = document.getElementsByName( 'svgallery' ); for( var i=0; i -1 ) ) { var metaRaw = object.id.substring( idPrefix.length ); var metaA = eval( '(' + Base64.Decode( metaRaw ) + ')' ); if ( metaA != null && svObject ) { svObject.addVariable( 'xmlDataPath', metaA['GalleryPath'] ); svObject.write( metaA['ContainerID'] ); } } } /** * Sends mail */ de.tanzschulerank.gui.PageController.prototype.EventOnSendButtonClick = function( eventP, object ) { if ( this.fForm != null && this.fForm.Validate() ) { if ( this.fAnimationController != null ) this.fAnimationController.ShadeAll( true ); this.fForm.Submit(); } } /** * Callback function from server */ de.tanzschulerank.gui.PageController.prototype.EventOnFormSent = function( eventP ) { if ( this.fAnimationController != null && this.fForm != null ) { this.fForm.Reset(); this.fAnimationController.ScrollForm( false ); this.fAnimationController.ShadeAll( false ); } } /** * Callback function from server */ de.tanzschulerank.gui.PageController.prototype.EventOnFormError = function( exception ) { console.log( exception ); } /** * Event on event detail click */ de.tanzschulerank.gui.PageController.prototype.EventOnEventDetailClick = function( eventP, control ) { var eventDetailHeader = document.getElementById( "eventdetailheader" ); var eventDetailText = document.getElementById( "eventdetailtext" ); if ( eventDetailText && eventDetailHeader && control ) { var eventdata = document.getElementById( control.id+"_formdata" ); var eventDataA = null; if ( eventdata.firstChild.data != null ) { eventDataA = eval( "(" + Base64.Decode( eventdata.firstChild.data ) + ")" ); } if ( eventDataA != null ) { if ( eventDetailHeader.firstChild ) eventDetailHeader.removeChild( eventDetailHeader.firstChild ); if ( eventDetailText.firstChild ) eventDetailText.removeChild( eventDetailText.firstChild ); eventDetailHeader.appendChild( document.createTextNode( eventDataA["Title"] ) ); // Add as html eventDetailText.innerHTML = eventDataA["Description"]; if ( eventDataA["Categories"] && eventDataA["Categories"].length > 0 ) { var formEvent = document.getElementById( 'i_event' ); formEvent.value = eventDataA["Title"]; var formDate = document.getElementById( 'i_date' ); formDate.value = eventDataA["Date"]; var formEventTickets = document.getElementById( 'eventformtickets' ); if ( formEventTickets ) { var formRateA = eventDataA["Categories"]; var oldContainer = document.getElementById( 'ticketcontainer' ); if ( oldContainer ) { formEventTickets.removeChild( oldContainer ) } var ticketContainer = document.createElement('div'); ticketContainer.setAttribute( 'id', 'ticketcontainer', 0 ); formEventTickets.appendChild( ticketContainer ); for (i = 0; i<=formRateA.length-1; i++ ) { var formRateA = eventDataA["Categories"]; var formRateDescA = eventDataA["Descriptions"]; var label = document.createElement('label'); ticketContainer.appendChild( label ); var input = document.createElement('input'); input.className = 'i_ticket'; input.setAttribute( 'id', 'i_ticket'+(i+1), 0 ); input.setAttribute( 'value', '0', 0 ); input.setAttribute( 'name', input.id, 0 ); ticketContainer.appendChild( input ); label.appendChild( document.createTextNode( formRateA[i] ) ); label.setAttribute( 'for', 'i_ticket'+(i+1), 0 ); var inputLabel = document.createElement('input'); inputLabel.setAttribute( 'type', 'hidden', 0 ); inputLabel.setAttribute( 'id', 'i_ticketlabel'+(i+1), 0 ); inputLabel.setAttribute( 'value', formRateA[i], 0 ); inputLabel.setAttribute( 'name', inputLabel.id, 0 ); if ( this.fForm != null ) { this.fForm.ControlAdd( input ); this.fForm.ControlAdd( inputLabel ); } ticketContainer.appendChild( document.createElement('br') ); if ( formRateDescA[i] ) { ticketContainer.appendChild( document.createTextNode( formRateDescA[i] ) ); ticketContainer.appendChild( document.createElement('br') ); } ticketContainer.appendChild( document.createElement('br') ); } } if ( this.fAnimationController != null ) this.fAnimationController.ScrollForm( true ); } else if ( this.fAnimationController != null ) { this.fAnimationController.ScrollForm( false ); } } } } /** */ de.tanzschulerank.gui.PageController.prototype.EventOnHandleFormScroll = function( eventP, control, direction ) { var formdata = null; if ( this.fAnimationController != null ) { if ( control != null ) formdata = document.getElementById( control.id+'_formdata' ); if ( formdata != null ) { var formDataA = null; if ( formdata.firstChild.data != null ) { formDataA = eval( "(" + Base64.Decode( formdata.firstChild.data ) + ")" ); } if ( formDataA != null ) { var formCourse = document.getElementById( 'i_course' ); formCourse.value = formDataA["course"]; var formDate = document.getElementById( 'i_date' ); formDate.value = formDataA["date"]; var formRate = document.getElementById( 'i_rate' ); var formRateA = formDataA["RateArray"]; formRate.length = 0; for (i = 0; i<=formRateA.length-1; i++ ) { var entry = new Option( formRateA[i], formRateA[i], false, false ); formRate.options[formRate.length] = entry; } } } this.fAnimationController.ScrollForm( direction ) } } // Create singleton instance var PageController = new de.tanzschulerank.gui.PageController();