/************************************************ FISCH-O-MAT ************************************************/ /* KLASSENDEFINITIONEN */ ///////////////////////// // KLASSE: FischOMat // Die Hauptklasse, über die die gesamte Bedienung gesteuert wird. ///////////////////////// function FischOMat(seitentyp) { // Attribute this.seitentyp = seitentyp; this.testimonials = new Array(); this.aktuellerTestimonial = -1; this.aktuellerTestimonialIndex = -1; this.animator = new DL.Animator({ duration: 800, transition: DL.Animator.tx.linear }); // HTML-Objekte als Attribute this.imgHauptbild = document.getElementById("hauptbild"); this.imgSeitenbild = document.getElementById("seitenbild"); this.divGambler = document.getElementById("gambler"); this.divThemenBox = document.getElementById("themenbox"); this.ulThemenListe = document.getElementById("themenliste"); this.imgPortrait = document.getElementById("portrait"); this.divBgPerson = document.getElementById("bgperson"); this.divPName = document.getElementById("pname"); this.divPFunktion = document.getElementById("pfunktion"); this.divPBeschreibung = document.getElementById("pbeschreibung"); this.hrefLink = document.getElementById("plink"); } FischOMat.prototype.addTestimonial = AddTestimonial; FischOMat.prototype.initTestimonials = InitTestimonials; FischOMat.prototype.setCurrentTestimonial = SetCurrentTestimonial; FischOMat.prototype.setInitiallySelectedTestimonial = SetInitiallySelectedTestimonial; FischOMat.prototype.setRandomTestimonial = SetRandomTestimonial; FischOMat.prototype.switchTestimonial = SwitchTestimonial; FischOMat.prototype.setHTMLObjects = SetHTMLObjects; FischOMat.prototype.fillThemeList = FillThemeList; FischOMat.prototype.setThemeListPosition = SetThemeListPosition; FischOMat.prototype.switchToNextTestimonial = SwitchToNextTestimonial; FischOMat.prototype.switchToPreviousTestimonial = SwitchToPreviousTestimonial; FischOMat.prototype.adaptUserInferface = AdaptUserInferface; // Füge neuen Testimonial hinzu - dazu einfach Konstruktor aufrufen. Objekt wird dem Array hinzugefügt function AddTestimonial(ID, titel, hauptbild, seitenbild, bgGambler, bgPerson, name, funktion, bild, zitat, linkURL, initiallySelected) { this.testimonials.push(new Testimonial(ID, titel, hauptbild, seitenbild, bgGambler, bgPerson, name, funktion, bild, zitat, linkURL, initiallySelected)); } function InitTestimonials() { // Initialisere den Animator - Themenbox hinzufügen mit O (Start-) und 1 (End-)Wert this.animator.addSubject(new DL.Animator.NumericalStyleSubject(this.divThemenBox, 'top', topOrigin, topOrigin-(themeLineHeight * (this.testimonials.length-1)))); if(this.seitentyp == "homepage") { // Auf der Startseite erstes aktives Thema anwaehlen this.setInitiallySelectedTestimonial(); } else { // Auf der Unterseite zufällige Auswahl treffen this.setRandomTestimonial(); } } // Attribut aktuellerTestimonial mit dem Objekt des akutell gewählten T. füllen function SetCurrentTestimonial(i){ this.aktuellerTestimonial = this.testimonials[i]; this.aktuellerTestimonialIndex = i; } function SetInitiallySelectedTestimonial(){ for(i=0; i"+this.testimonials[i].titel+""; } else { tempListe += "
  • "+this.testimonials[i].titel+"
  • "; } } this.ulThemenListe.innerHTML = tempListe; this.setThemeListPosition(); } // DIV Themenbox an korrekte Y-Position verschieben. Hierzu Abfrage Array-Index. function SetThemeListPosition() { if(this.aktuellerTestimonialIndex != -1) { var newPosY = (this.aktuellerTestimonialIndex * themeLineHeight) / (themeLineHeight * (this.testimonials.length-1)); this.animator.seekTo(newPosY); // var y = topOrigin - (this.aktuellerTestimonialIndex * themeLineHeight); // this.divThemenBox.style.top = y+"px"; } } // Naechstes Array-Element anspringen function SwitchToNextTestimonial() { if(this.aktuellerTestimonialIndex < this.testimonials.length-1) { this.switchTestimonial(this.testimonials[this.aktuellerTestimonialIndex+1].ID) } } // Vorheriges Array-Element anspringen function SwitchToPreviousTestimonial() { if(this.aktuellerTestimonialIndex > 0) { this.switchTestimonial(this.testimonials[this.aktuellerTestimonialIndex-1].ID) } } function AdaptUserInferface() { } ///////////////////////// // KLASSE: Testimonial // Jedes Thema wird als Testimonial per Konstruktor als Objekt angelegt. ///////////////////////// function Testimonial(ID, titel, hauptbild, seitenbild, bgGambler, bgPerson, name, funktion, bild, zitat, linkURL, initiallySelected) { // Attribute this.ID = ID; this.titel = titel; this.hauptbild = hauptbild; this.seitenbild = seitenbild; this.bgGambler = bgGambler; this.bgPerson = bgPerson; this.person = new TestimonialPerson(name, funktion, bild, zitat); this.linkURL = linkURL; this.initiallySelected = initiallySelected; } ///////////////////////// // KLASSE: TestimonialPerson // Bündelung der Eigenschaften einer Person - eigentlich nur zu Ordnungszwecken. ///////////////////////// function TestimonialPerson(name, funktion, bild, zitat) { // Attribute this.name = name; this.funktion = funktion; this.bild = bild; this.zitat = zitat; }