1/* ************************************************************************** */ 2// Firma: Hehner Reus Systems GmbH 3// Projekt: com.cerno.newsletter 4// Datei: ibox.js 5// Erstellung: 27.11.2009 6// Verwendung: Zur Darstellung von Multimedia-Inhalten, wie Bilder, Musik, Videos und Internetseiten. Die 7// iBox kann aber dazu verwendet werden, Fehlermeldungen anzuzeigen. 8// 9// $Id: ibox.js,v 1.69 2025/02/06 10:30:29 whe Exp $ 10// $Author: whe $ 11// $Log: ibox.js,v $ 12// Revision 1.69 2025/02/06 10:30:29 whe 13// Auch alte iBoxen werden nun von einer Singleton-iBox blockiert, bzw. wieder geschlossen. 14// 15// Revision 1.68 2024/03/04 15:44:14 lpo 16// Das Bild braucht manchmal ein wenig zum Laden. Die onclick-Funktion auf den Pfeilnavigationsbuttons nur dann ergänzen, wenn das Bild auch vorhanden ist. 17// 18// Revision 1.67 2023/09/14 09:26:49 lpo 19// Die openImageLink-Funktion brauchen wir auch nur dann, wenn ein Bildlink übergeben wurde. 20// 21// Revision 1.66 2023/09/08 15:13:00 lri 22// Fokus bleibt nun beim Element, wo auch die iBox ausgelöst wird. Bildlink kann auch per Tastatur ausgelöst werden. 23// 24// Revision 1.65 2023/08/31 09:53:26 lpo 25// Das Erstellen eines umgebenden Links bei Bildern wird doch wieder eingeschränkt auf den Fall, dass ein Link hinterlegt ist. 26// 27// Revision 1.64 2023/08/28 15:02:53 lri 28// Schließen iBox auch auf Enter (Barrierefreiheit). 29// 30// Revision 1.63 2023/08/28 12:11:06 lpo 31// Nochmal etwas optimiert. 32// 33// Revision 1.62 2023/08/18 12:47:59 lri 34// iBox wird oben angehangen + Callbackfunktion für das Schließen bei Escape + optionaler aTag um ein Bild 35// 36// Revision 1.61 2023/05/16 14:25:51 rst 37// neue Function um eine extra Css-Klasse mitzugeben. 38// 39// Revision 1.60 2022/11/04 12:10:31 whe 40// Reihenfolge beim Aufruf von setNumber() und setDescription() beachten. 41// 42// Revision 1.59 2019/12/18 14:44:58 vyu 43// Die überprüfung von m_IBoxContentHTMLElement vor die remove Funktionen verschoben, da es sonst zu "spät" war. 44// 45// Revision 1.58 2019/12/18 14:03:01 jcz 46// Wenn beim body eine max-width gesetzt ist, die Breite für die Positionierung über den body-Tag berechnen. 47// 48// Revision 1.57 2019/11/19 14:56:16 lpo 49// Erweiterung: Neue Konfigurationsparameter "widthInProcent" und "widthInProcent" (zuächst einmal nur für das iframe eingebaut). 50// 51// Revision 1.56 2019/11/19 12:48:31 lpo 52// Erweiterung: Neuer Konfigurationsparameter "onClose" = Callback-Funktion für das Schließen der i-Box. 53// 54// Revision 1.55 2019/11/12 15:08:01 lpo 55// Bugfix: Wenn der Konfigurationsparameter "isReplaceable" nicht gesetzt wurde, darf das übliche Verhalten des Überschreibens nicht verändert werden. 56// 57// Revision 1.54 2019/11/07 10:11:50 lpo 58// Neuer Konfigurationsparameter "isReplaceable" und das Auslesen des Parameters "draggableAllowed" verschoben. 59// 60// Revision 1.53 2019/07/10 08:47:59 lpo 61// Bugfix: Spezialfall nur ein Bild in der Gallerie. Verhindern, dass in Bildgallerie die Anzahl der Bilder beliebig hochgezählt werden kann, obwohl nur ein Bild gegeben ist. 62// 63// Revision 1.52 2019/06/04 07:46:57 lpo 64// Neue CSS-Klasse "overlay-open" für den Body bei geöffneter iBox. 65// 66// Revision 1.51 2018/10/18 15:36:10 lpo 67// Bugfix: Wiederholtes Öffnen einer i-Box mit HTMLElement-Content ist nun auch möglich. 68// 69// Revision 1.50 2018/10/18 12:38:14 lpo 70// Bugfix bei der i-Box mit HTML-Element als Content: HTML-Content wird beim Schließen der i-Box für erneutes Öffnen im "display: none"-Style an den body gehangen. 71// 72// Revision 1.49 2018/06/26 09:54:59 sam 73// Überflüssige Slashes in den Kommentaren haben zu einem Fehler bei der Komprimierung geführt. Korrigiert! 74// 75// Revision 1.48 2016/06/20 16:10:24 whe 76// Bei Bild-iBoxen die Größe des Bildes über ein "Dummy"-Objekt ermitteln, damit evtl. CSS-Angaben sich nicht auswirken. 77// 78// Revision 1.47 2016/04/02 21:15:06 mhu 79// Auch bei iBoxen ohne iFrame kann das Drag-And-Drop nun deaktiviert werden. 80// 81// Revision 1.46 2016/02/12 12:26:22 fmu 82// Nur Formatierung verbessert. 83// 84// Revision 1.45 2016/02/12 11:43:30 ske 85// Bugfix: Spinner hat gesponnen (haha.) wenn PDFs per Ibox geöffnet wurden. 86// 87// Revision 1.44 2015/12/11 15:57:14 ske 88// Iboxen, die externe Seiten anzeigen (via iframe), wurde ein lade-Spinner verpasst. 89// 90// Revision 1.43 2015/09/17 12:28:12 lpo 91// Bemerkung hinzugefügt, dass ein "nicht angegebener" Parameter der Funktion hier bedeutet, dass man "null" an die Funktion übergibt. 92// 93// Revision 1.42 2015/04/28 15:07:09 mhu 94// Erst mal wieder auf Version 1.40 zurück gesetzt, bis die Signaturänderung von 95// HRAddOnLoad geprüft wurde. 96// 97// Revision 1.40 2015/04/16 09:16:24 ske 98// redirectUrlOnClose in config-Parameter gepackt 99// 100// Revision 1.39 2015/03/19 12:49:43 fmu 101// Versehentlich überschriebene Änderungen wiederhergestellt, kleine Korrekturen, u.a. am Code-Stil. 102// 103// Revision 1.38 2015/03/19 12:08:22 ske 104// Argument zum Angeben von Weiterleitungs-URLs nach schliessen der Ibox in die open-Methoden eingefuegt. 105//
106// Revision 1.37 2015/03/19 09:41:07 fmu 107// Erscheinungsbild von iBox-Fehlermeldungen etwas verschönert. 108// 109// Revision 1.36 2015/02/09 14:02:36 fmu 110// Neuer optionaler Parameter für Methode openUrlInIbox, um eine minimale Fensterbreite angeben zu können, die für die iBox erforderlich (ansonsten wird das Ziel in neuem Fenster geöffnet). Für responsive Design auf sehr kleinen Geräten, wo eine iBox unschön ist. 111// 112// Revision 1.35 2014/08/25 14:31:36 whe 113// Funktion openHtmlElementInIbox() um optionale Konfiguration ergänzt. 114// 115// Revision 1.34 2014/08/13 07:22:43 mhu 116// Fehler in Funktion getBodyWidth korrigiert. 117// 118// Revision 1.33 2013/09/08 17:26:00 whe 119// Angabe der Größe der iBox ist nun fehlertoleranter. 120// 121// Revision 1.32 2013/07/18 18:55:46 whe 122// return false; in event-Funktion ergänzt. 123// 124// Revision 1.31 2013/04/04 09:53:25 whe 125// Zusätzlicher optionaler Parameter, um bei übergebenem Link das Target-Verhalten zu übersteuern. 126// 127// Revision 1.30 2012/07/30 14:31:46 csc 128// Cursor ändern, wenn Bild Link ist. 129// 130// Revision 1.29 2012/07/19 14:10:10 whe 131// Bildunterschriften. Bild bei Bedarf anklickbar. 132// 133// Revision 1.28 2012/03/08 01:01:15 whe 134// Angabe für maximale Breite/Höhe wird nicht mehr ignoriert. 135// Draggable Eigenschaft ist jetzt ausschaltbar. 136// 137// Revision 1.27 2012/02/22 19:02:05 whe 138// IFrame bei openURLInIBox hat nun keinen Border mehr. 139// 140// Revision 1.26 2011/10/11 17:31:57 whe 141// Optimierungen für openUrlInIbox(): blackOverlay, Default- und Maximalwerte für die Größenangaben. 142// 143// Revision 1.25 2011/09/20 20:28:50 whe 144// Erweiterte Variante die Sichtbarkeit von HTMLElementen zu aktivieren, die in einer iBox dargestellt werden sollen. 145// 146// Revision 1.24 2011/06/30 16:59:11 whe 147// Kleine Korrektur für den IE (Schreibweise von clientHeight) 148// 149// Revision 1.23 2011/06/29 17:30:56 whe 150// Kleine Korrektur für den IE (Schreibweise von clientHeight) 151// 152// Revision 1.22 2011/06/17 15:17:18 imo 153// iBox Bilder sind jetzt maximal so groß wie 80% der Client-Höhe und -Breite 154// 155// Revision 1.21 2011/05/20 13:38:29 imo 156// Wenn in der iBox Title fehlt wird das DIV auf display:none gesetzt. Ebenso mit der Description. Das heisst, wenn Bildname fehlt und Bildbeschreibung fehlt, wird die iBox um diesen Bereich verkleinert. 157// 158// Revision 1.20 2011/03/18 12:49:00 imo 159// iBox: Bei der Positionierung wird jetzt die aktuelle Scroll-Position mit einbezogen 160// 161// Revision 1.19 2011/03/09 12:34:43 imo 162// Höhen- und Breiten-Berechnung in der iBox angepasst. 163// 164// Revision 1.18 2011/02/23 14:57:14 imo 165// Die Höhe des schwarzes Overlays bei der iBox wird jetzt anders berechnet 166// 167// Revision 1.17 2011/02/15 18:43:24 whe 168// Kleinere Schönheitsänderungen an der Fehlerhinweis-Box 169// 170// Revision 1.16 2011/02/01 13:46:38 imo 171// BlackOverlay wird gefaded. Try-Catch-Blöcke eingebaut für den Fall, dass die includes vom Draggable oder Animator vergessen wurden. 172// 173// Revision 1.15 2011/01/26 21:24:24 whe 174// Variable close in closediv umbenannt, da es sonst im IE Probleme gab. 175// Ein Klick auf das Bild in der iBox führt nun auch zur Anzeige des nächsten. 176// 177// Revision 1.14 2010/08/22 13:33:42 imo 178// Der Close-Button beim der iBox für Bilder gilt jetzt als ein spezieller Close-Button. OpenUrlIniBox hat jetzt auch einen Close-Button bekommen und zwar den Default-Close-Button. 179// 180// Revision 1.13 2010/07/14 09:46:34 imo 181// Die ID wird dem Draggable übergeben und nicht das HTML-Element 182// 183// Revision 1.12 2010/07/07 09:33:44 imo 184// Zwei TODOs eingefügt 185// 186// Revision 1.11 2010/07/07 07:52:16 imo 187// Wenn keine URL angegeben wurde wird href="#" gesetzt 188// 189// Revision 1.10 2010/07/06 14:17:50 imo 190// Kleine Verbesserungen 191// 192// Revision 1.9 2010/07/06 09:11:40 imo 193// html element wird immer sichtbar gemacht 194// 195// Revision 1.8 2010/07/06 09:05:55 imo 196// Andere Webseiten können jetzt auch mittels iFrame in die iBox geöffnet werden. HTML-Elemente auf der gleichen Page können jetzt auch in die iBox verschoben werden. 197// 198// Revision 1.7 2010/07/06 07:57:45 imo 199// falschen Funktionsaufruf korrigiert 200// 201// Revision 1.6 2010/07/06 07:49:14 imo 202// Konsolenausgaben entfernt 203// 204// Revision 1.5 2010/07/06 07:48:17 imo 205// Urls und Events für die Buttons werden jetzt korrekt ausgeführt 206// 207// Revision 1.4 2010/07/06 07:13:38 imo 208// Ausrichtung korrigiert, Timeout wird jetzt gelöscht bevor er neu gesetzt wird. so gibt es nicht mehrere gleichzeitig. die iBox erscheint nur einmal wenn man mehrfach klickt. 209// 210// Revision 1.3 2010/07/05 15:13:21 imo 211// Parameter für das align hinzugefügt 212// 213// Revision 1.2 2010/07/05 12:02:45 imo 214// weitere schritte zur Fertigstellung der iBox 215// 216// Revision 1.1 2010/07/02 14:51:09 whe 217// Eigene JavaScript-Library ins Verzeichnis js verschoben 218// 219// Revision 1.1 2010/07/02 14:33:39 imo 220// Layout-Ordner erstellt und HR-Sys-Lib eingefügt 221// 222// Revision 1.7 2010/07/02 14:30:45 imo 223// Further steps 224// 225// Revision 1.6 2010/06/30 14:05:04 imo 226// Die Wiedergeburt der iBox 227// 228// Revision 1.5 2009/12/09 15:22:24 imo 229// Alle IDs global gesetzt und zwei Bugs behoben. 230// 231// Revision 1.4 2009/12/09 11:22:38 imo 232// Beim Wechsel von einem Bild zum nächsten entstehen jetzt keine Scrollbalken mehr. Bim schliessen der iBox wird auch der onresize-Handler gelöscht, damit es beim Fenstergröße verändern keine Fehler mehr gibt. 233// 234// Revision 1.3 2009/12/08 15:46:12 imo 235// Breite des iFrames ist jetzt immer 4 Pixel kleiner als das transparente Überlagerungs-Div. Das führt dazu, dass keine Scrollbalken mehr erscheinen. 236// Die Höhe des Bodys wird jetzt anders berechnet, so dass der Hintergrund großflächiger abgedunktelt wird. 237// 238// Revision 1.2 2009/12/08 13:44:08 imo 239// Kommentare ergänzt 240// 241// Revision 1.1 2009/12/08 11:09:43 imo 242// Neue iBox 243// 244/* ************************************************************************** */ 245 246 247// - - - - - - - - - - - - - - - - - Member - - - - - - - - - - - - - - - - - - - - - - - - 248var m_iBox; // das HTML-Element der iBox selbst 249var m_BlackOverlay; // DIV zum Abdunkeln des Hintergrunds 250var m_iFrame; // iFrame was unter dem DIV zum Abdunkeln des Hintergrunds liegt um alle(!) Elemente auch im IE abzudunkeln 251var m_iBoxDivClose; // Der Close Button 252var m_minImageWidth = 100; // Defaultwert für die minimale Breite des Anzeigebereichs der iBox. Diese verändert sich, wenn viel Text in der Beschreibung vorhanden ist. 253var m_maxImageWidth = 1000; // Defaultwert für die maximale Breite eines Bildes 254var m_maxImageHeight = 600; // Defaultwert für die maximale Höhe eines Bildes 255 256var m_CurrentContentWidth; // die aktuelle Breite des anzuzeigenden Inhalts, z.B. des Bildes 257var m_CurrentContentHeight; // die aktuelle Höhe des anzuzeigenden Inhalts, z.B. des Bildes 258 259var m_BilderArray; // das der Funktion openImagesInIbox() Array mit Bildern 260var m_IndexOfImagesToShow = 0; // der aktuelle Index im Array des zu zeigenden Bildes 261var m_BildNamenArray; // Namen bzw Titel der Bilder im Array, welches auch der openImagesInIbox()-Funktion übergeben wird 262var m_BildunterschriftArray; // 263 264var m_IdDiv = "idHrSysGipsDivBlackTransparentOverlay"; // id für das Div zum Abdunkeln des Hintergrunds 265var m_IdIFrame = "idHrSysGipsIFrameOverlay"; // id für das iFrame hinter dem Div zum Abdunkeln des Hintergrunds 266var m_IdIBoxDivTitle = "idIBoxDivTitle"; // id für das Div welches den Bildtitel enthält 267var m_IdIBoxDivDescription = "idIBoxDivDescription"; // id für das Div welches die Bildbeschreibung enthält 268var m_IdIBoxDivCaption = "idIBoxDivCaption"; // id für den Bereich in dem der Titel und die Beschreibung sind 269var m_IdIBoxDivInnerCaption= "idIBoxDivInnerCaption"; // id für den 270var m_IdIBoxDivNext = "idIBoxDivNext"; // id für das Div welches den Next-Button repräsentiert 271var m_IdIBoxDivPrev = "idIBoxDivPrevious"; // id für das Div welches den Previous-Button repräsentiert 272var m_IdIBoxDivClose = "idIBoxDivClose"; // id für das Div welches den Close-Button repräsentiert 273var m_IdIBoxDivNumber = "idIBoxDivNumber"; // id für das Div welches die Nummer des Bildes enthält 274var m_IdIBoxContentImage = "idIBoxContentImage"; // 275var m_IdIBoxDiv4Image = "idIBoxDiv4Image"; // id für das Div welches das eigentliche Bild enthält 276var m_IdIBoxDiv4Text = "idIBoxDiv4Text"; // id für das Div welches Text in der iBox enthält 277var m_IdIBoxDiv4Url = "idIBoxDiv4Url"; // id für das Div welches Text in der iBox enthält 278var m_IdIBoxContent = "idIBoxContent"; // id für das Div welches das eigentliche Bild enthält 279var m_IdIBox = "idHrSysGipsDivIBox"; 280 281var m_TimeoutToDisappear = null; // Das Timeout-Objekt 282var m_TimeToDisappear = 5000; // 5 Sekunden^ 283var m_isIBoxDraggableAllowed = true; 284 285var m_RedirectUrlOnClose = null; //Fuer Aktualisierung etc: Bei Schliessen der Ibox wird auf die gesetzte Url weitergeleitet falls gesetzt und ungleich "" 286 287// Wenn der Content der i-Box als HTML-Element geladen werden soll, steht hier das HTML-Element drin. 288var m_IBoxContentHTMLElement = null; 289 290// Animations-Objekte 291var m_Animator = null; 292 293var m_AdditionalCssClass = ""; // CSS Klasse für das äußerste Div der i-Box. 294var m_LastFocusedElement = null; // Speichert Element, welches die iBox auslöst. 295 296var m_BodyClass = "overlay-open"; 297 298// Flag, um zu entscheiden, ob die aktuelle i-Box ersetzt werden darf, oder nicht. 299var m_IsReplaceable = true; 300 301// Callback-Funktion für das Schließen der i-Box.
302var m_OnClose = null; 303 304//Spinner-Styling 305var m_SpinnerOpts = { 306 lines: 9, // The number of lines to draw 307 length: 20, // The length of each line 308 width: 12, // The line thickness 309 radius: 23, // The radius of the inner circle 310 corners: 0.7, // Corner roundness (0..1) 311 rotate: 0, // The rotation offset 312 direction: 1, // 1: clockwise, -1: counterclockwise 313 color: '\#000', // rgb or rrggbb 314 speed: 1, // Rounds per second 315 trail: 46, // Afterglow percentage 316 shadow: true, // Whether to render a shadow 317 hwaccel: false, // Whether to use hardware acceleration 318 className: 'spinner', // The CSS class to assign to the spinner 319 zIndex: 2e9, // The z-index (defaults to 2000000000) 320 top: 'auto', // Top position relative to parent in px 321 left: 'auto' // Left position relative to parent in px 322 } 323 324 325/** 326 * Allgemeine Funktion zum Erstellen der iBox. Als Parameter wird eine Propertylist erwartet. 327 * 328 * @param {Object} configuration ist eine property list 329 */ 330var openInIbox = function (configuration) 331{ 332 try 333 { 334 if (window.HRIBoxRegistry) 335 { 336 window.HRIBoxRegistry.forEach(ibox => { 337 if (ibox.m_Singleton) 338 return; 339 }); 340 } 341 } 342 catch(e) {} 343 344 if (!m_IsReplaceable || !configuration) 345 { 346 return; 347 } 348 // Merkt sich das letzte angesehene Element, um beim Schließen der iBox zurück zu diesem Element zu gelangen. 349 m_LastFocusedElement = document.activeElement; 350 m_Animator = null; 351 if(configuration.animation && configuration.animation == true) 352 { 353 try { 354 m_Animator = new Animator({ 355 duration: 550 356 }); 357 } 358 catch(e) 359 { 360 m_Animator = null; 361 } 362 } 363 364 if (configuration.isReplaceable === false && configuration.isReplaceable != null && typeof(configuration.isReplaceable) !== 'undefined') 365 { 366 m_IsReplaceable = false; 367 } 368 369 if (configuration && !configuration.draggableAllowed) 370 m_isIBoxDraggableAllowed = false; 371 372 if(configuration.blackOverlay && configuration.blackOverlay == true) 373 { 374 createBlackOverlay(); 375 resizeBlackOverlayWidthToDocumentBody(); 376 } 377 378 if(configuration.closingEventsOnBlackOverlay && configuration.closingEventsOnBlackOverlay == true) 379 { 380 if(m_BlackOverlay) 381 m_BlackOverlay.onmouseup = removeAllIBoxElements; 382 383 if(m_BlackOverlay) 384 m_iFrame.onmouseup = removeAllIBoxElements; 385 } 386 387 388 if (configuration.additionalCssClass) 389 m_AdditionalCssClass = configuration.additionalCssClass; 390 391 createIBoxMinimalSkeleton(configuration.cssSuffix); 392 393 if(configuration.htmlElement) 394 { 395 setIBoxContentHtmlElementID(configuration.htmlElement); 396 } 397 398 if(configuration.iframeSrc) 399 { 400 if (configuration.widthInProcent && configuration.widthInProcent > 0) 401 { 402 configuration.iframeWidth = getClientWidthInPercentage(configuration.widthInProcent); 403 } 404 405 // Breite nicht zwischen 0 - 85 % der Fensterbreite, dann setze die Breite auf 85 % des Viewports. 406 if (!configuration.iframeWidth || configuration.iframeWidth <= 0 || configuration.iframeWidth > getClientWidthInPercentage(85)) 407 { 408 configuration.iframeWidth = getClientWidthInPercentage(85); 409 } 410 411 if (configuration.heightInProcent && configuration.heightInProcent > 0) 412 { 413 configuration.iframeHeight = getClientHeightInPercentage(configuration.heightInProcent); 414 } 415 416 // Höhe nicht zwischen 0 - 85 % der Fensterbreite, dann setze die Höhe auf 85 % des Viewports. 417 if (!configuration.iframeHeight || configuration.iframeHeight <= 0 || configuration.iframeHeight > getClientWidthInPercentage(85)) 418 { 419 configuration.iframeHeight = getClientHeightInPercentage(85); 420 } 421 422 setIBoxContentURL(configuration.iframeSrc, configuration.iframeHeight, configuration.iframeWidth, configuration.cssSuffix); 423 } 424 425 if(configuration.meldung) 426 { 427 setIBoxContentText(configuration.meldung,configuration.cssSuffix); 428 } 429 430 if(m_TimeoutToDisappear) 431 deleteTimeout(m_TimeoutToDisappear); 432 433 if(configuration.timeout) 434 { 435 setTimeToDisappear(configuration.timeout); 436 } 437 438 var length = 0; 439 for(var key in configuration) 440 { 441 //configuration[key]; 442 length++; 443 } 444 445 if(configuration.button && configuration.url) 446 { 447 addButtonToIBox(configuration.button, configuration["url"], "", configuration.cssSuffix); 448 } 449 450 if(configuration.closeButton == true) 451 { 452 createIBoxCloseButton(); 453 } 454 455 if (configuration.onClose) 456 { 457 m_OnClose = configuration.onClose; 458 } 459 460 for(var i = 0; i < length; i++) 461 { 462 if(configuration["button" + i]) 463 { 464 var url; 465 var buttonEvent; 466 467 if(configuration["url" + i]) 468 url = configuration["url" + i]; 469 else 470 url = "#";; 471 472 if(configuration["button"+i+"Event"]) 473 buttonEvent = configuration["button"+i+"Event"] 474 else 475 buttonEvent = ""; 476 477 addButtonToIBox(configuration["button" + i], url, buttonEvent); 478 } 479 } 480 481 if(configuration.checkbox == true) 482 { 483 var checkBoxText = ""; 484 var checkBoxOnclickFunction = ""; 485 var checkBoxName = ""; 486 var checkBoxValue = ""; 487 488 if(configuration.checkboxText) 489 checkBoxText = configuration.checkboxText; 490 491 if(configuration.checkBoxOnclickFunction) 492 checkBoxOnclickFunction = configuration.checkBoxOnclickFunction; 493 494 if(configuration.checkBoxName) 495 checkBoxName = configuration.checkBoxName; 496 497 if(configuration.checkBoxValue) 498 checkBoxValue = configuration.checkBoxValue; 499 500 createIBoxCheckBox(checkBoxText , "idIBoxInputCheckbox" , checkBoxOnclickFunction, checkBoxName, checkBoxValue); 501 } 502 503 if (configuration.alignY) 504 { 505 alignIBoxVerticalTo(configuration.alignY); 506 } 507 else 508 { 509 alignIBoxVerticalTo("center"); 510 } 511 512 if (configuration.alignX) 513 { 514 alignIBoxHorizontalTo(configuration.alignX); 515 } 516 else 517 { 518 alignIBoxHorizontalTo("center"); 519 } 520 521 if (configuration.redirectUrlOnClose) 522 m_RedirectUrlOnClose = configuration.redirectUrlOnClose; 523 524 if (configuration.bodyClass) 525 m_BodyClass = configuration.bodyClass; 526 527 addCSSClass(document.getElementsByTagName("body")[0], this.m_BodyClass); 528} 529 530 531// - - - - - - - - - - - - - - - - - Dialog-Fenster - - - - - - - - - - - - - - - - - - - - - - - - 532var iboxEntscheidung = function (fragetext, urlA, textButtonA, urlB, textButtonB, redirectUrlOnClose) 533{ 534 535 openInIbox({ alignX : "center", 536 alignY : "center",
537 meldung : fragetext, 538 /*timeout : "5",*/ 539 cssSuffix : "-DialogBox", 540 button1 : textButtonA, 541 url1 : urlA, 542 button2 : textButtonB, 543 url2 : urlB, 544 blackOverlay : true, 545 closingEventsOnBlackOverlay : false, 546 redirectUrlOnClose: redirectUrlOnClose 547 }); 548} 549 550 551var iboxWollenSieWirklich = function (fragetext, url, textOk, textCancel, auswahlDesUsersAlsCookieSpeichern, redirectUrlOnClose) 552{ 553 if(!textOk) 554 textOk = "Ja" 555 if(!textCancel) 556 textCancel = "Nein"; 557 if(!auswahlDesUsersAlsCookieSpeichern) 558 auswahlDesUsersAlsCookieSpeichern = false; 559 560 openInIbox({ alignX : "center", 561 alignY : "center", 562 meldung : fragetext, 563 /*timeout : "5",*/ 564 cssSuffix : "-DialogBox", 565 button1 : textOk, 566 url1 : url, 567 button2 : textCancel, 568 button2Event : "onclick='removeAllIBoxElements();'", 569 checkbox : auswahlDesUsersAlsCookieSpeichern, 570 checkboxText : "Nicht nochmal fragen!", 571 /*checkBoxOnclickFunction : "keine",*/ 572 checkBoxName : "CheckBoxDontAskAgain", 573 checkBoxValue : "true", 574 blackOverlay : true, 575 closingEventsOnBlackOverlay : false, 576 redirectUrlOnClose: redirectUrlOnClose 577 }); 578} 579 580 581var iboxHinweis = function (hinweisText, textOk, obenunten, linksrechts, timeToDisapear, redirectUrlOnClose) 582{ 583 if(!obenunten) 584 obenunten = ""; 585 if(!linksrechts) 586 linksrechts = ""; 587 if(!textOk) 588 textOk = "OK"; 589 590 openInIbox({ alignX : linksrechts, 591 alignY : obenunten, 592 meldung : hinweisText, 593 timeout : timeToDisapear, 594 cssSuffix : "-DialogBox", 595 button1 : textOk, 596 button1Event : "onclick='removeAllIBoxElements();'", 597 checkbox : false, 598 checkboxText : "Nicht nochmal fragen!", 599 /*checkBoxOnclickFunction : "keine",*/ 600 checkBoxName : "CheckBoxDontAskAgain", 601 checkBoxValue : "true", 602 blackOverlay : true, 603 closingEventsOnBlackOverlay : false, 604 redirectUrlOnClose: redirectUrlOnClose 605 }); 606} 607 608 609 610// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 611 612 613/** 614 * Funktion öffnet eine URL in einer iBox. 615 * 616 * @param url Die zu öffnende URL 617 * @param width Die Breite der iBox (85% wenn nicht angegeben) 618 * @param height Die Höhe der iBox (85% wenn nicht angegeben) 619 * @param minWidth Die minimale Fensterbreite zur Ausgabe der iBox (wenn Breite kleiner wird neues Fenster geöffnet) 620 * @param redirectUrlOnClose setzt URL fuer automatische Weiterleitung bei schliessen der Ibox. Nuetzlich z.B. fuer Aktualisierung der Seite. 621 * 622 * Bemerkung: "nicht angegeben" bedeutet null übergeben. 623 */ 624var openUrlInIboxWithAdditionalCssClass = function (url, width, height, minWidth, redirectUrlOnClose, cssClass) 625{ 626 if (minWidth && (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) < minWidth) 627 { 628 window.open(url); 629 } 630 else 631 { 632 openInIbox({ alignX : "center", 633 alignY : "center", 634 iframeSrc : url, 635 iframeHeight : height, 636 iframeWidth : width, 637 closeButton : true, 638 cssSuffix : "-DialogBox", 639 blackOverlay : true, 640 closingEventsOnBlackOverlay : true, 641 additionalCssClass : cssClass, 642 redirectUrlOnClose: redirectUrlOnClose 643 }); 644 } 645} 646 647var openUrlInIbox = function (url, width, height, minWidth, redirectUrlOnClose) 648{ 649 if (minWidth && (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) < minWidth) 650 { 651 window.open(url); 652 } 653 else 654 { 655 openInIbox({ alignX : "center", 656 alignY : "center", 657 iframeSrc : url, 658 iframeHeight : height, 659 iframeWidth : width, 660 closeButton : true, 661 cssSuffix : "-DialogBox", 662 blackOverlay : true, 663 closingEventsOnBlackOverlay : true, 664 redirectUrlOnClose: redirectUrlOnClose 665 }); 666 } 667}
668// - - - - - - - - - - - - - - - - - - - HTML - - - - - - - - - - - - - - - - - - - - - - 669var openHtmlElementInIbox = function (idVomElement,configuration) 670{ 671 var config = configuration; 672 if (!config) 673 { 674 config = {}; 675 } 676 config.alignX = "center"; 677 config.alignY = "center"; 678 config.htmlElement = idVomElement; 679 680 if (configuration && configuration.redirectUrlOnClose) 681 config.redirectUrlOnClose = configuration.redirectUrlOnClose; 682 683 // beim div sollte display immer auf visible gestellt werden 684 openInIbox(config); 685} 686 687// - - - - - - - - - - - - - - - - - - - MultiMedia - - - - - - - - - - - - - - - - - - - - - - 688var openMultiMediaInIbox = function (param, redirectUrlOnClose) 689{ 690 // ... 691} 692 693var openMultiMediasInIbox = function (array, redirectUrlOnClose) 694{ 695 // ... 696} 697 698// - - - - - - - - - - - - - - - - - - - Bilder - - - - - - - - - - - - - - - - - - - - - - 699 700/** 701 * Funktion öffnet die iBox, welche das übergebene Bild anzeigt. Bildname, bzw. Titel und Beschreibung sind optionale Parameter. 702 * Die maximale Höhe und Breite muss auch nicht mit angegeben werden. 703 * Überschreitet das anzuzeigende Bild die zulässige Maximalgröße, werden die height- und width-Parameter verkleinert. Das geschieht 704 * proportional zu einander. 705 * @param {Object} bild Im moment relative(!) und absolute url. Später möglicherweise auch img-Tag oder a-Tag und dessen href oder id 706 * @param {Object} bildUnterschrift die Bildbeschreibung 707 * @param {Object} bildName der Name bzw der Titel des Bildes 708 * @param {Object} maxImageHeight die maximale Höhe des Bildes 709 * @param {Object} maxImageWidth die maximale Breite des Bildes 710 * @param redirectUrlOnClose setzt URL fuer automatische Weiterleitung bei schliessen der Ibox. Nuetzlich z.B. fuer Aktualisierung der Seite. 711 */ 712var openImageInIbox = function (bild, bildUnterschrift, bildName, maxImageHeight, maxImageWidth, bildLink, linkTarget, redirectUrlOnClose) 713{ 714 try 715 { 716 if (window.HRIBoxRegistry) 717 { 718 window.HRIBoxRegistry.forEach(ibox => { 719 if (ibox.m_Singleton) 720 return; 721 }); 722 } 723 if ((navigator.userAgent.indexOf('MSIE 8.0') > -1) || (navigator.userAgent.indexOf('MSIE 9.0') > -1)) 724 { 725 m_Animator = null; 726 } 727 else 728 { 729 m_Animator = new Animator({duration: 650}); 730 } 731 } 732 catch(e) 733 { 734 m_Animator = null; 735 } 736 737 m_maxImageHeight = getClientHeightInPercentage(80); 738 m_maxImageWidth = getClientWidthInPercentage(80); 739 740 if (maxImageHeight && maxImageHeight > 0) 741 m_maxImageHeight = maxImageHeight; 742 if (maxImageWidth && maxImageWidth > 0) 743 m_maxImageWidth = maxImageWidth; 744 745 // if (param.toLowerCase().indexOf("http") > -1) // absolute URL zum Bild 746 // else if (param.tagName == img) // das Bild als HTML-img-Tag 747 // else if (param.tagName == a) // HTML-Link zum Bild 748 // else if (document.getElementById(param)) // param == id 749 // else if param == relative url, z.b. "images/img001.jpg" oder nur "img001.jpg" 750 // 751 752 createBlackOverlay(); 753 resizeBlackOverlayWidthToDocumentBody(); 754 755 if (bildLink && bildLink.length > 4) 756 m_isIBoxDraggableAllowed = false; 757 758 createIBoxMinimalSkeleton(); 759 createIBoxPrevAndNextButtons(); 760 761 // Bildernamen 762 if(m_BildNamenArray && m_BildNamenArray.length > 0 ) 763 { 764 createIBoxTitleWithNumberAndDescription(); 765 // Namen des Bildes setzen 766 setTitle(bildName); 767 } 768 else 769 { 770 createIBoxDescriptionWithNumber(); 771 } 772 773 createIBoxImageCloseButton(); 774 775 // Beschreibung des Bildes setzen 776 setDescription(bildUnterschrift); 777 778 // 779 setIBoxContentImage(bild, bildLink, linkTarget); 780 781 // prev und next-Button verstecken 782 hidePrevAndNextButtons(); 783 784 m_BlackOverlay.onmouseup = removeAllIBoxElements; 785 m_iFrame.onmouseup = removeAllIBoxElements; 786 //m_iBox.onmouseup = removeAllIBoxElements; 787 788 // 789 // Animierten Fade 790 // 791 animateFadeIn(); 792 793 if (redirectUrlOnClose) 794 m_RedirectUrlOnClose = redirectUrlOnClose; 795} 796 797 798 799/**
800 * Funktion öffnet die iBox, welche das übergebene Bild anzeigt. Bildname, bzw. Titel und Beschreibung sind optionale Parameter. 801 * Die maximale Höhe und Breite muss auch nicht mit angegeben werden. 802 * Überschreitet das anzuzeigende Bild die zulässige Maximalgröße, werden die height- und width-Parameter verkleinert. Das geschieht 803 * proportional zu einander. 804 * @param {Object} array Array mit relativen oder absoluten URLs zu Bildern. 805 * @param {Object} showFirst relative oder absolute URL zu dem Bild aus dem Array, welches zu erst angezeigt werden soll 806 * @param {Object} bildNamenArray die Namen bzw die Titel der Bilder 807 * @param {Object} bildunterschriftArray die Bildunterschriften 808 * @param {Object} maxImageHeight die maximale Höhe aller Bilder 809 * @param {Object} maxImageWidth die maximale Breite aller Bilder 810 * @param redirectUrlOnClose setzt URL fuer automatische Weiterleitung bei schliessen der Ibox. Nuetzlich z.B. fuer Aktualisierung der Seite. 811 */ 812var openImagesInIbox = function(array, showFirst, bildNamenArray, bildunterschriftArray, maxImageHeight, maxImageWidth, redirectUrlOnClose) 813{ 814 try 815 { 816 if ((navigator.userAgent.indexOf('MSIE 8.0') > -1) || (navigator.userAgent.indexOf('MSIE 9.0') > -1)) 817 { 818 m_Animator = null; 819 } 820 else 821 { 822 m_Animator = new Animator({duration: 650}); 823 } 824 } 825 catch(e) 826 { 827 m_Animator = null; 828 } 829 830 m_BilderArray = array; 831 m_IndexOfImagesToShow = 0; 832 m_BildNamenArray = bildNamenArray; 833 m_BildunterschriftArray = bildunterschriftArray; 834 835 m_maxImageHeight = getClientHeightInPercentage(80); 836 m_maxImageWidth = getClientWidthInPercentage(80); 837 838 if (maxImageHeight && maxImageHeight > 0) 839 m_maxImageHeight = maxImageHeight; 840 if (maxImageWidth && maxImageWidth > 0) 841 m_maxImageWidth = maxImageWidth; 842 843 // if (param.toLowerCase().indexOf("http") > -1) // absolute URL zum Gruppierungselement/Container also <div oder xml><img><img><img><img>...</div> 844 // else if (param.length && param.length > 0) // JavaScript-Array mit Bildern als IDs/URLs 845 // else if (param.tagName == div) // div als Gruppierungselement/Container 846 // else if (param.tagName == a) // HTML-Link zum Bild 847 // else if (document.getElementById(param)) // param == id 848 // else if param == relative url, z.b. "images/img001.jpg" oder nur "img001.jpg" 849 // 850 851 // wenn showFirst eine (positive) ganze Zahl ist 852 if (isUnsignedInteger(showFirst)) 853 { 854 m_IndexOfImagesToShow = showFirst; 855 } 856 else 857 { 858 for (var i = 0; i < m_BilderArray.length; i++) 859 { 860 if (m_BilderArray[i] == showFirst) 861 { 862 m_IndexOfImagesToShow = i; 863 break; 864 } 865 } 866 } 867 868 // Hintergrund abdunklen 869 createBlackOverlay(); 870 resizeBlackOverlayWidthToDocumentBody(); 871 872 createIBoxMinimalSkeleton(); 873 createIBoxPrevAndNextButtons(); 874 875 // Bildernamen 876 if(m_BildNamenArray && m_BildNamenArray.length > 0 ) 877 { 878 createIBoxTitleWithNumberAndDescription(); 879 // Namen des Bildes setzen 880 setTitle(bildNamenArray[m_IndexOfImagesToShow]); 881 } 882 else 883 { 884 createIBoxDescriptionWithNumber(); 885 } 886 887 createIBoxImageCloseButton(); 888 889 // Beschreibung des Bildes setzen 890 if(m_BildunterschriftArray && m_BildunterschriftArray.length > 0 ) 891 setDescription(bildunterschriftArray[m_IndexOfImagesToShow]); 892 893 // Anzahl 894 setNumber(m_IndexOfImagesToShow); 895 //document.getElementById(m_IdIBoxDivNumber).innerHTML = ""+ m_IndexOfImagesToShow + " von " + m_BilderArray.length; 896 //document.getElementById(m_IdIBoxDivNumber).innerHTML = "test"; 897 898 // 899 setIBoxContentImage(m_BilderArray[m_IndexOfImagesToShow]); 900 901 reinitializePrevNextButtons(); 902 903 m_BlackOverlay.onmouseup = removeAllIBoxElements; 904 m_iFrame.onmouseup = removeAllIBoxElements; 905 //m_iBox.onmouseup = removeAllIBoxElements; 906 907// 908 // Animierten Fade 909 // 910 animateFadeIn(); 911 912 if (redirectUrlOnClose) 913 m_RedirectUrlOnClose = redirectUrlOnClose; 914} 915 916 917 918 919 920 921 922// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 923// - - - - - - - - - - - - - - - - - - - iBox erstellen - - - - - - - - - - - - - - - - - - - - - - 924// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 925/** 926 * Erstellt einen schwarz-transparenten Hintergrund 927 */ 928var createBlackOverlay = function () 929{ 930 var idDiv = m_IdDiv; 931 var idIFrame = m_IdIFrame; 932 m_BlackOverlay = document.getElementById(idDiv); 933 m_iFrame = document.getElementById(idIFrame); 934 935 if (m_BlackOverlay) 936 { 937 remove(m_BlackOverlay); 938 } 939 if (m_iFrame) 940 { 941 remove(m_iFrame); 942 } 943 944 var width = getBodyWidth(); 945 var height = getBodyHeight(); 946 947 // div-overlay erstellen 948 m_BlackOverlay = createFloatingElement("div",width + "px",height,0,0,idDiv); 949 m_BlackOverlay.className = "HrSys-Gips-iBoxIFrameOverlay"; 950 951 // iframe erstellen 952 m_iFrame = createFloatingIFrame((width-4) + "px",(height-4) +"px",0,0,idIFrame); 953 m_iFrame.className = "HrSys-Gips-iBoxDivOverlay"; 954 955 window.onresize = resizeBlackOverlayWidthToDocumentBody; 956 957 if(window.getComputedStyle) // W3C-style 958 { 959 if(m_Animator == null) 960 m_BlackOverlay.style.opacity = "0.6"; 961 else 962 m_BlackOverlay.style.opacity = "0"; 963 964 m_iFrame.style.opacity = "0"; 965 } 966 else if(m_BlackOverlay.currentStyle ) // IE-style 967 { 968 if(m_Animator == null) 969 m_BlackOverlay.style.filter = "alpha(opacity=60)"; 970 else 971 m_BlackOverlay.style.filter = "alpha(opacity=0)"; 972 973 m_iFrame.style.filter = "alpha(opacity=0)"; 974 } 975 976 document.getElementsByTagName("BODY")[0].appendChild(m_BlackOverlay); // und an den BODY hängen 977 m_BlackOverlay.style.backgroundColor = "#000000"; 978 m_BlackOverlay.style.visibility = 'visible'; // 979 980 // Animierten Fade 981 if(m_Animator) 982 m_Animator.addSubject(new NumericalStyleSubject(m_BlackOverlay, 'opacity', 0, 0.6)); 983 984} 985 986 987 988// ------- neu ------------------------------------------------------- 989 990var createIBoxMinimalSkeleton = function (cssSuffix) 991{ 992 if (!cssSuffix) 993 cssSuffix = ""; 994 995 // 996 // Ist schon eine I-Box geöffnet? Dann schmeißen wir diese erst weg. 997 // 998 m_iBox = document.getElementById(m_IdIBox); 999 if (m_iBox) 1000 {
1001 // i-Box-Content darf mit dem Wegwerfen der i-Box nicht wegfallen. 1002 var contentNode = document.getElementById(m_IdIBoxContent).firstChild; 1003 1004 remove(m_iBox); 1005 1006 // Hänge den Content wieder an den Body. 1007 if (contentNode) 1008 { 1009 contentNode.style.display = "none"; 1010 document.getElementsByTagName("body")[0].appendChild(contentNode); 1011 } 1012 } 1013 1014 m_iBox = document.createElement("div"); // DIV für die iBox erstellen 1015 document.getElementsByTagName("BODY")[0].appendChild(m_iBox); // und an den BODY hängen 1016 if (m_AdditionalCssClass) 1017 { 1018 m_iBox.className = "HrSys-Gips-DivIBox" + cssSuffix + " " + m_AdditionalCssClass; 1019 } 1020 else 1021 { 1022 m_iBox.className = "HrSys-Gips-DivIBox" + cssSuffix; 1023 } 1024 m_iBox.id = m_IdIBox; 1025 1026 var content = document.createElement("div"); 1027 content.id = m_IdIBoxContent; 1028 content.className = "HrSys-Gips-iBoxDivContent" + cssSuffix; 1029 m_iBox.appendChild(content); 1030 1031 try 1032 { 1033 if (m_isIBoxDraggableAllowed) 1034 new Draggable(content.id); 1035 } 1036 catch(e) 1037 { 1038 } 1039 1040 var caption = document.createElement("div"); 1041 caption.id = m_IdIBoxDivCaption; 1042 caption.className = "HrSys-Gips-iBoxDivCaption" + cssSuffix; 1043 m_iBox.appendChild(caption); 1044} 1045 1046 1047var createIBoxImageCloseButton = function (cssSuffix) 1048{ 1049 if(!cssSuffix) 1050 cssSuffix = ""; 1051 1052 // close button erstellen 1053 m_iBox = document.getElementById(m_IdIBox); 1054 closediv = document.createElement("div"); 1055 closediv.id = m_IdIBoxDivClose; 1056 closediv.className = "HrSys-Gips-iBoxDivCloseImage" + cssSuffix; 1057 closediv.innerHTML = '<a href="#" onkeydown="if (event.key === \'Enter\') {removeAllIBoxElements(); return false;}" onmouseup="removeAllIBoxElements(); return false;"></a>'; 1058 m_iBox.appendChild(closediv); 1059 1060 // Sorgt dafür, dass bei Escape die i-Box geschlossen wird. 1061 HRAddEventListener(m_iBox.contentWindow, 'keydown', (event) => { 1062 1063 if (event.key === 'Escape') 1064 { 1065 removeAllIBoxElements(); 1066 return false; 1067 } 1068 }); 1069} 1070 1071var createIBoxCloseButton = function (cssSuffix) 1072{ 1073 if(!cssSuffix) 1074 cssSuffix = ""; 1075 1076 // close button erstellen 1077 m_iBox = document.getElementById(m_IdIBox); 1078 closediv = document.createElement("div"); 1079 closediv.id = m_IdIBoxDivClose; 1080 closediv.className = "HrSys-Gips-iBoxDivClose" + cssSuffix; 1081 closediv.innerHTML = '<a href="#" onkeydown="if (event.key === \'Enter\') {removeAllIBoxElements(); return false;}" onmouseup="removeAllIBoxElements(); return false;"></a>'; 1082 m_iBox.appendChild(closediv); 1083} 1084 1085var createIBoxDescription = function () 1086{ 1087} 1088 1089var createIBoxCheckBox = function (text,id,onlickFunction,name, value) 1090{ 1091 if(onlickFunction) 1092 onlickFunction += "();"; 1093 1094 var textKnoten = document.createElement("DIV"); 1095 textKnoten.innerHTML = '<input id="'+id+'" onclick="'+onlickFunction+'" type="checkbox" name="'+name+'" value="'+value+'">'+text+'</input>'; 1096 var content = document.getElementById(m_IdIBoxContent); 1097 content.appendChild(textKnoten); 1098} 1099 1100 1101 1102 1103var createIBoxDescriptionWithNumber = function () 1104{ 1105 // wenn der Bildtitel nicht vorhanden ist, kommt die Zahl in die Beschreibung. 1106 // ein Div für den Bildtitel gibt es dann nicht 1107 var innerCaption = document.getElementById(m_IdIBoxDivInnerCaption); 1108 innerCaption.innerHTML = ' <div id="idIBoxDivDescription" class="HrSys-Gips-iBoxDivDescription">' 1109 + ' <div id="idIBoxDivNumber" class="HrSys-Gips-iBoxDivNumber"></div>' 1110 + ' </div>'; 1111} 1112 1113var createIBoxTitleWithNumberAndDescription = function () 1114{ 1115 var innerCaption = document.getElementById(m_IdIBoxDivInnerCaption); 1116 innerCaption.innerHTML = ' <div id="idIBoxDivTitle" class="HrSys-Gips-iBoxDivTitle">' 1117 + ' <div id="idIBoxDivNumber" class="HrSys-Gips-iBoxDivNumber"></div>' 1118 + ' </div>' 1119 + ' <div id="idIBoxDivDescription" class="HrSys-Gips-iBoxDivDescription"></div>'; 1120 1121} 1122 1123var createIBoxPrevAndNextButtons = function () 1124{ 1125 var caption = document.getElementById(m_IdIBoxDivCaption); 1126 1127 var previous = document.createElement("div"); 1128 previous.id = m_IdIBoxDivPrev; 1129 previous.className = "HrSys-Gips-iBoxDivPrev"; 1130 previous.onclick = showPrevImageInIBox; 1131 1132 var next = document.createElement("div"); 1133 next.id = m_IdIBoxDivNext; 1134 next.className = "HrSys-Gips-iBoxDivNext"; 1135 next.onclick = showNextImageInIBox; 1136 1137 var innerCaption = document.createElement("div"); 1138 innerCaption.id = m_IdIBoxDivInnerCaption; 1139 innerCaption.className = "HrSys-Gips-iBoxDivInnerCaption"; 1140 1141 caption.appendChild(previous); 1142 caption.appendChild(next); 1143 caption.appendChild(innerCaption); 1144} 1145 1146/** 1147 * Nimmt eine beliebige Anzahl von Parametern an und erstellt damit Buttons al
1147s DIV in dem Caption-Feld der iBox. 1148 * @param {Object} cssSuffix 1149 * @param {Object} urlA 1150 * @param {Object} textButtonA 1151 * @param {Object} urlB 1152 * @param {Object} textButtonB 1153 * @param {Object} urlC 1154 * @param {Object} textButtonC 1155 * @param {Object} .... 1156 * @param {Object} urlN 1157 * @param {Object} textButtonN 1158 */ 1159var createIBoxClickButtons = function (cssSuffix, urlA, textButtonA, urlB, textButtonB, urlC, textButtonC) 1160{ 1161 if(!cssSuffix) 1162 cssSuffix = ""; 1163 1164 var html = ''; 1165 1166 for(var i = 0; i < createIBoxClickButtons.arguments.length; i+=2) 1167 { 1168 if(createIBoxClickButtons.arguments[i]) 1169 { 1170 html += '<a href="#" class="HrSys-Gips-AHrefButton'+cssSuffix+'" onclick="openURL('+createIBoxClickButtons.arguments[i]+');"><div class="HrSys-Gips-iBoxDivButton'+cssSuffix+'">'; 1171 if(createIBoxClickButtons.arguments[i+1]) 1172 { 1173 html += createIBoxClickButtons.arguments[i+1]; 1174 } 1175 html += '</div></a>'; 1176 } 1177 } 1178 1179 var caption = document.getElementById(m_IdIBoxDivCaption); 1180 caption.innerHTML = html; 1181} 1182 1183/** 1184 * Fügt der iBox einen Button hinzu 1185 * @param {Object} textButton 1186 * @param {Object} url 1187 */ 1188var addButtonToIBox = function(textButton, url, buttonEvent, cssSuffix) 1189{ 1190 if(!cssSuffix) 1191 cssSuffix = ''; 1192 1193 if(!buttonEvent) 1194 buttonEvent = ''; 1195 //buttonEvent = 'onclick="removeAllIBoxElements();"'; 1196 1197 if(!url) 1198 url = ''; 1199 1200 var caption = document.getElementById(m_IdIBoxDivCaption); 1201 var html = caption.innerHTML; 1202 1203 html += '<a href="'+url+'" '+ buttonEvent +' class="HrSys-Gips-AHrefButton'+cssSuffix+'"><div class="HrSys-Gips-iBoxDivButton'+cssSuffix+'">'; 1204 html += textButton; 1205 html += '</div></a>'; 1206 1207 caption.innerHTML = html; 1208} 1209 1210 1211// ------- ende neu ------------------------------------------------------- 1212 1213 1214// - - - - - - - - - - - - - Hilfsmethoden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1215 1216 1217var animateFadeIn = function() 1218{ 1219 // 1220 // Animierten Fade 1221 // 1222 if(m_Animator) 1223 { 1224 if(window.getComputedStyle) // W3C-style 1225 { 1226 m_iBox.style.opacity = "0"; 1227 m_iFrame.style.opacity = "0"; 1228 } 1229 else if(m_iBox.currentStyle ) // IE-style 1230 { 1231 m_iBox.style.filter = "alpha(opacity=0)"; 1232 m_iFrame.style.filter = "alpha(opacity=0)"; 1233 } 1234 } 1235 1236 if(m_Animator) 1237 m_Animator.addSubject(new NumericalStyleSubject(m_iBox, 'opacity', 0, 1)); 1238 1239 if(m_Animator) 1240 m_Animator.play(); 1241} 1242 1243 1244 1245/** 1246 * Setzt die Vorwärts und Rückwärstbuttons auf hidden 1247 */ 1248var hidePrevAndNextButtons = function() 1249{ 1250 hideElement(m_IdIBoxDivPrev); 1251 hideElement(m_IdIBoxDivNext); 1252} 1253 1254var hideElement = function(id) 1255{ 1256 document.getElementById(id).style.display = "none"; 1257} 1258 1259/** 1260 * Setzt den Bildnamen, bzw. Titel. 1261 * @param {Object} name 1262 */ 1263var setTitle = function(name) 1264{ 1265 var titleElement = document.getElementById(m_IdIBoxDivTitle); 1266 if(name && name.length > 0) 1267 { 1268 titleElement.innerHTML = name; 1269 titleElement.style.display = "block"; 1270 } 1271 else 1272 { 1273 titleElement.innerHTML = ""; 1274 titleElement.style.display = "none"; 1275 } 1276 1277} 1278 1279/** 1280 * Setzt die aktuelle Zahl, bzw. den Index, von dem Bild welches angezeigt werden soll. 1281 * @param {Object} numberOfNumber 1282 */ 1283var setNumber = function(numberOfNumber) 1284{ 1285 var numberDiv = document.getElementById(m_IdIBoxDivNumber); 1286 var titleDiv = document.getElementById(m_IdIBoxDivTitle); 1287 var descriptionDiv = document.getElementById(m_IdIBoxDivDescription); 1288 1289 if (!numberDiv) 1290 { 1291 numberDiv = document.createElement("div"); 1292 numberDiv.id = m_IdIBoxDivNumber; 1293 numberDiv.className = "HrSys-Gips-iBoxDivNumber"; 1294 if(titleDiv) 1295 titleDiv.appendChild(numberDiv); 1296 else if(descriptionDiv) 1297 descriptionDiv.appendChild(numberDiv); 1298 } 1299 1300 numberDiv.innerHTML = numberOfNumber + 1 + " von " + m_BilderArray.length; 1301} 1302 1303/** 1304 * Setzt die Beschreibung des Bildes in der iBox. 1305 * @param {Object} description 1306 */ 1307var setDescription = function(description) 1308{ 1309 var descriptionElement = document.getElementById(m_IdIBoxDivDescription); 1310 if(description && description.length > 0) 1311 { 1312 if(description.length > 60) 1313 m_minImageWidth = 450; 1314 else 1315 m_minImageWidth = 300; 1316 1317 descriptionElement.innerHTML = description; 1318 descriptionElement.style.display = "block"; 1319 1320 } 1321 else 1322 { 1323 descriptionElement.innerHTML = ""; 1324 descriptionElement.style.display = "none"; 1325 } 1326} 1327 1328 1329 1330 1331var setIBoxContentText = function(text,cssSuffix) 1332{ 1333 var contentBereich = document.getElementById(m_IdIBoxContent); 1334 1335 var div4Text = document.getElementById(m_IdIBoxDiv4Text); 1336 if (div4Text) 1337 remove(div4Text); 1338 div4Text = document.createElement("DIV"); 1339 div4Text.id = m_IdIBoxDiv4Text; 1340 div4Text.className = "HrSys-Gips-iBoxDiv4Text"+cssSuffix; 1341 div4Text.innerHTML = '<span class="HrSys-Gips-iBoxContentText'+cssSuffix+'">'+text+'</span>'; 1342 1343 contentBereich.appendChild(div4Text); 1344} 1345 1346 1347var setIBoxContentURL = function(url, height, width, cssSuffix) 1348{ 1349 if(!cssSuffix) 1350 cssSuffix = ""; 1351 1352 var contentBereich = document.getElementById(m_IdIBoxContent); 1353 1354 var div4IFrame = document.getElementById(m_IdIBoxDiv4Url); 1355 if (div4IFrame) 1356 remove(div4IFrame); 1357 div4IFrame = document.createElement("DIV"); 1358 div4IFrame.id = m_IdIBoxDiv4Url; 1359 div4IFrame.className = "HrSys-Gips-iBoxDiv4Url"+cssSuffix; 1360 div4IFrame.innerHTML = '<iframe frameborder="0" src="'+url+'" height="'+height+'" width="'+width+'">'; 1361 var iframe = contentBereich.appendChild(div4IFrame).getElementsByTagName('iframe')[0]; 1362 1363 //Weil externe Inhalt erstmal geladen werden muessen, den Spinner anzeigen: 1364 //Falls Spinner.js nicht verfuegbar: Abfangen. 1365 try 1366 {
1367 var spinner = new Spinner(m_SpinnerOpts); 1368 if(spinner) 1369 { 1370 spinner.spin(div4IFrame); 1371 //Wenn fertig geladen ist, den Spinner wieder stoppen: 1372 window.iframe = iframe; 1373 //Dafuer regelmaessig iframe pruefen 1374 var interval = window.setInterval(function () 1375 { 1376 if (this.iframe) 1377 { 1378 var iFrameBody; 1379 try 1380 { 1381 if (iframe.contentDocument) 1382 { // FF 1383 iFrameBody = iframe.contentDocument.getElementsByTagName('body')[0]; 1384 } 1385 else if (iframe.contentWindow && iframe.contentWindow.document) 1386 { // IE 1387 iFrameBody = iframe.contentWindow.document.getElementsByTagName('body')[0]; 1388 } 1389 } 1390 catch (e2) 1391 { 1392 // Sonderfall: Wenn wir z.B. einen PDF-Viewer oeffnen, gibt es zwar ein content-document, 1393 // wir werden aber rausgeworfen weil uns der Zugang verweigert wird. In diesem Fall 1394 // brechen wir hier einfach ab. 1395 iFrameBody = {"innerHTML":"dummyContent"}; 1396 } 1397 if(iFrameBody) 1398 { 1399 var content = iFrameBody.innerHTML; 1400 if(content&&content.length>0) 1401 { 1402 // Der Frame hat Inhalt! Also weg mit dem Spinner. 1403 clearInterval(interval); 1404 spinner.stop(); 1405 } 1406 } 1407 } 1408 }, 100); 1409 } 1410 } 1411 catch(e) 1412 { 1413 //muss ja niemand wissen... 1414 } 1415} 1416 1417var setIBoxContentHtmlElementID = function(htmlElementID) 1418{ 1419 var contentBereich = document.getElementById(m_IdIBoxContent); 1420 1421 m_IBoxContentHTMLElement = document.getElementById(htmlElementID); 1422 m_IBoxContentHTMLElement.style.visibility = 'visible'; 1423 // 1424 // Da häufig auch mit display: none; zum Verstecken von 1425 // Divs gearbeitet wird, setzen wir ggfs auch diesen Schalter um. 1426 // 1427 if (m_IBoxContentHTMLElement.style.display == 'none') 1428 m_IBoxContentHTMLElement.style.display = 'block'; 1429 1430 contentBereich.appendChild(m_IBoxContentHTMLElement); 1431} 1432 1433/** 1434 * Setzt den darzustellenden Inhalt der iBox 1435 * @param {Object} bild 1436 */ 1437var setIBoxContentImage = function(bild, bildLink, linkTarget) 1438{ 1439 m_iBox.style.visibility = 'hidden'; 1440 var content = document.getElementById(m_IdIBoxContent); 1441 1442 var div4Image = document.getElementById(m_IdIBoxDiv4Image); 1443 if (div4Image) 1444 remove(div4Image); 1445 div4Image = document.createElement("DIV"); 1446 div4Image.id = m_IdIBoxDiv4Image; 1447 div4Image.className = "HrSys-Gips-iBoxDiv4Image"; 1448 content.appendChild(div4Image); 1449 1450 var img = document.getElementById(m_IdIBoxContentImage); 1451 if (img) 1452 remove(img); 1453 img = document.createElement("img"); 1454 img.id = m_IdIBoxContentImage; 1455 img.className = "HrSys-Gips-iBoxImage"; 1456 img.src = bild; 1457 1458 if (bildLink) 1459 { 1460 img.tabIndex = "0"; 1461 const openImageLink = () => { 1462 var newWindow = bildLink.toLowerCase().indexOf("http") == 0; 1463 if (linkTarget) 1464 { 1465 if (linkTarget == "_self") 1466 newWindow = false; 1467 else if (linkTarget == "_blank") 1468 newWindow = true; 1469 } 1470 if (newWindow) 1471 { 1472 window.open(bildLink, "_blank"); 1473 removeAllIBoxElements(); 1474 } 1475 else 1476 window.location.href = bildLink; 1477 }; 1478 1479 img.onclick = openImageLink; 1480 img.onkeydown = () => { 1481 if (event.key == 'Enter') 1482 openImageLink(); 1483 }; 1484 img.style.cursor = "pointer"; 1485 } 1486 1487 img.src = bild; 1488 var dummyImg = new Image(); 1489 // Bildgröße ermitteln. Wichtig für den IE ist dabei, dass der onload-event vor dem Setzen des src-Attribut gesetzt wird!!!! 1490 dummyImg.onload = function() 1491 { 1492 try 1493 { 1494 m_CurrentContentWidth = dummyImg.width; 1495 m_CurrentContentHeight = dummyImg.height; 1496 1497 // Bild zu hoch? 1498 if(m_CurrentContentHeight > m_maxImageHeight) // 1499 { 1500 // verkleinern und seitenverhältnis beibehalten 1501 m_CurrentContentHeight = m_maxImageHeight; // maximale Höhe setzen 1502 m_CurrentContentWidth = img.width / (img.height / m_maxImageHeight); // Breite berechnen, damit Seitenverhältnis erhalten bleibt 1503 } 1504 // Bild zu breit 1505 if (m_CurrentContentWidth > m_maxImageWidth) // wenn die Bildbreite höher ist als die maximal zulässige 1506 { 1507 // verkleinern
1508 m_CurrentContentHeight = img.height / (img.width / m_maxImageWidth); 1509 m_CurrentContentWidth = m_maxImageWidth; 1510 } 1511 // Bild skalieren 1512 img.height = m_CurrentContentHeight; 1513 img.width = m_CurrentContentWidth; 1514 1515 // Breite zu klein? 1516 var divWidth = m_CurrentContentWidth; 1517 if (m_CurrentContentWidth < m_minImageWidth) // wenn die Breite des Bildes kleiner ist als die minimal zulässige Breite 1518 { 1519 divWidth = m_minImageWidth; // wird die Größe der inneren Divs auf die minimal zulässige Breite gestellt 1520 } 1521 1522 // die Breite der Divs für das Bild und Titel/Beschreibung unter dem Bild 1523 document.getElementById(m_IdIBoxContent).style.width = divWidth +"px"; 1524 document.getElementById(m_IdIBoxDivCaption).style.width = divWidth +"px"; 1525 1526 // Bild dran hängen 1527 document.getElementById(m_IdIBoxDiv4Image).appendChild(img); 1528 1529 alignIBoxVerticalTo("center"); 1530 alignIBoxHorizontalTo("center"); 1531 m_iBox.style.visibility = 'visible'; 1532 } 1533 catch(e) 1534 { 1535 } 1536 }; 1537 dummyImg.src = bild; 1538} 1539 1540 1541/** 1542 * Re-initialisiert die Button zum Weiter und Zurück-klicken 1543 */ 1544var reinitializePrevNextButtons = function() 1545{ 1546 var nextDiv = document.getElementById(m_IdIBoxDivNext); 1547 var prevDiv = document.getElementById(m_IdIBoxDivPrev); 1548 var theImage = document.getElementById(m_IdIBoxContentImage); 1549 1550 // anzuzeigende Bild ist das erste 1551 if (m_IndexOfImagesToShow == 0) 1552 { 1553 nextDiv.className = "HrSys-Gips-iBoxDivNext"; 1554 prevDiv.className = "HrSys-Gips-iBoxDivPreviousInactive"; 1555 nextDiv.onclick = showNextImageInIBox; 1556 prevDiv.onclick = ""; 1557 if (theImage) 1558 theImage.onclick = showNextImageInIBox; 1559 1560 // Spezialfall: Nur ein einziges Bild vorhanden: 1561 // Dannn brauchen wir keinen aktiven Prev- und Next-Button. 1562 if (m_IndexOfImagesToShow == m_BilderArray.length - 1) 1563 { 1564 prevDiv.className = "HrSys-Gips-iBoxDivPreviousInactive"; 1565 nextDiv.className = "HrSys-Gips-iBoxDivNextInactive"; 1566 prevDiv.onclick = ""; 1567 nextDiv.onclick = ""; 1568 } 1569 } 1570 // anzuzeigende Bild ist das letzte 1571 else if (m_IndexOfImagesToShow == m_BilderArray.length - 1) 1572 { 1573 nextDiv.className = "HrSys-Gips-iBoxDivNextInactive"; 1574 prevDiv.className = "HrSys-Gips-iBoxDivPrevious"; 1575 nextDiv.onclick = ""; 1576 prevDiv.onclick = showPrevImageInIBox; 1577 if (theImage) 1578 theImage.onclick = ""; 1579 } 1580 // ansonsten 1581 else 1582 { 1583 nextDiv.className = "HrSys-Gips-iBoxDivNext"; 1584 prevDiv.className = "HrSys-Gips-iBoxDivPrevious"; 1585 nextDiv.onclick = showNextImageInIBox; 1586 prevDiv.onclick = showPrevImageInIBox; 1587 if (theImage) 1588 theImage.onclick = showNextImageInIBox; 1589 } 1590} 1591 1592/** 1593 * Zeigt das nächste Bild in der iBox an. 1594 */ 1595var showNextImageInIBox = function() 1596{ 1597 var index = ++m_IndexOfImagesToShow; 1598 1599 if(m_BilderArray && m_BilderArray.length > m_IndexOfImagesToShow) setIBoxContentImage( m_BilderArray[index]); 1600 if(m_BildNamenArray && m_BildNamenArray.length > m_IndexOfImagesToShow) setTitle( m_BildNamenArray [index] ); 1601 if(m_BildunterschriftArray && m_BildunterschriftArray.length > m_IndexOfImagesToShow) setDescription( m_BildunterschriftArray[index] ); 1602 if(m_BilderArray && m_BilderArray.length > m_IndexOfImagesToShow) setNumber( m_IndexOfImagesToShow); 1603 1604 reinitializePrevNextButtons(); 1605} 1606 1607/** 1608 * Zeigt das vorgänger Bild in der iBox an 1609 */ 1610var showPrevImageInIBox = function() 1611{ 1612 var prevDiv = document.getElementById(m_IdIBoxDivPrev); 1613 var index = --m_IndexOfImagesToShow; 1614 1615 if(m_BilderArray && m_BilderArray.length > m_IndexOfImagesToShow) setIBoxContentImage( m_BilderArray [index] ); 1616 if(m_BildNamenArray && m_BildNamenArray.length > m_IndexOfImagesToShow) setTitle( m_BildNamenArray [index] ); 1617 if(m_BildunterschriftArray && m_BildunterschriftArray.length > m_IndexOfImagesToShow) setDescription( m_BildunterschriftArray[index] ); 1618 setNumber(m_IndexOfImagesToShow); 1619 1620 reinitializePrevNextButtons(); 1621} 1622 1623/** 1624 * Erstellt ein HTML-Element vom übergebenen Typ mit absoluter Positionierung und hier übergebener Größe. 1625 * @param {Object} tagName 1626 * @param {Object} xwidth 1627 * @param {Object} yheight 1628 * @param {Object} xpos 1629 * @param {Object} ypos 1630 * @param {Object} id 1631 */ 1632function createFloatingElement(tagName, xwidth, yheight, xpos, ypos, id) 1633{ 1634 var element = createFloatingElementAtPosition(tagName, xpos, ypos, id) 1635 element.style.width = xwidth; // 1636 element.style.height = yheight; // 1637 return element; 1638} 1639
1640/** 1641 * Erstellt ein iFrame mit absoluter Positionierung und hier übergebener Größe. 1642 * @param {Object} xwidth 1643 * @param {Object} yheight 1644 * @param {Object} xpos 1645 * @param {Object} ypos 1646 * @param {Object} id 1647 */ 1648function createFloatingIFrame(xwidth, yheight, xpos, ypos, id) 1649{ 1650 var element = createFloatingElementAtPosition("iframe", xpos, ypos, id) 1651 element.width = xwidth; // 1652 element.height = yheight; // 1653 return element; 1654} 1655 1656/** 1657 * Erstellt ein HTML-Element vom übergebenen Typ mit absoluter Positionierung. 1658 * @param {Object} tagName Name des Tags 1659 * @param {Object} xpos x-Position 1660 * @param {Object} ypos y-Position 1661 * @param {Object} id die ID des Elements 1662 */ 1663function createFloatingElementAtPosition(tagName, xpos, ypos, id) 1664{ 1665 var element = document.createElement(tagName); 1666 element.id = id; // 1667 element.style.position = 'absolute'; // die Positionierung vom element auf absolut stellen 1668 element.style.left = xpos + "px"; // 1669 element.style.top = ypos + "px"; // 1670 //element.scrolling = "auto" // 1671 document.getElementsByTagName("BODY")[0].appendChild(element); // 1672 1673 return element; 1674} 1675 1676 1677// ----------------- remove ------------------------------- 1678/** 1679 * Entfernt das übergebene HTML-Element und löscht es aus dem Dombaum. 1680 * @param {Object} element 1681 */ 1682function remove(element) 1683{ 1684 if(element && element.parentNode) 1685 { 1686 element.parentNode.removeChild(element); 1687 } 1688} 1689 1690/** 1691 * Löscht und entfernt die iBox. 1692 */ 1693function removeAllIBoxElements() 1694{ 1695 removeCSSClass(document.getElementsByTagName("body")[0], m_BodyClass); 1696 1697 if (m_IBoxContentHTMLElement) 1698 { 1699 m_IBoxContentHTMLElement.style.display = "none"; 1700 document.getElementsByTagName("body")[0].appendChild(m_IBoxContentHTMLElement); 1701 } 1702 1703 remove(m_BlackOverlay); 1704 remove(m_iFrame); 1705 remove(m_iBox); 1706 window.onresize = ""; 1707 1708 // Leitet auf gesetzte Url weiter, falls m_RedirectUrlOnClose einen nicht-leeren String enthaelt 1709 if (m_RedirectUrlOnClose && (typeof m_RedirectUrlOnClose == "string" || (typeof m_RedirectUrlOnClose == "object" && m_RedirectUrlOnClose.constructor === String)) && m_RedirectUrlOnClose != "") 1710 { 1711 top.location.href=m_RedirectUrlOnClose; 1712 // Anschliessend wieder resetten, muss also fuer jede Ibox separat angegeben werden. 1713 m_RedirectUrlOnClose = null; 1714 } 1715 1716 // Ausführen einer eventuell übergebenen Callback-Funktion. 1717 if (m_OnClose && typeof(m_OnClose) === 'function') 1718 { 1719 this.m_OnClose(); 1720 } 1721 1722 // Setzt den Fokus zurück auf das letzte angesehene Element. 1723 if (m_LastFocusedElement) 1724 m_LastFocusedElement.focus(); 1725} 1726 1727// ----------------- align ------------------------------- 1728 1729/** 1730 * Richtet die iBox vertikal aus 1731 * @param {Object} positionAlsWort 1732 */ 1733var alignIBoxVerticalTo = function(positionAlsWort) 1734{ 1735 var iBoxHeight = m_iBox.offsetHeight; 1736 var innerHeight; 1737 1738 1739 // Fensterhöhe browserabhängig bestimmen 1740 if(window.innerHeight) // nicht IE6 1741 { 1742 innerHeight = window.innerHeight; 1743 } 1744 else if(document.documentElement) // IE6 1745 { 1746 if (document.documentElement.clientHeight) 1747 { 1748 innerHeight = document.documentElement.clientHeight; 1749 } 1750 else 1751 { 1752 innerHeight = document.documentElement.clientheight; 1753 } 1754 } 1755 1756 // ScrollPosition mit einberechnen 1757 var scrollPos = getScrollPosition(); 1758 1759 // Positionierung 1760 if ( positionAlsWort.toUpperCase() == "TOP" || positionAlsWort.toUpperCase() == "OBEN") 1761 { 1762 m_iBox.style.top = 0 + scrollPos.y + "px"; 1763 } 1764 else if ( positionAlsWort.toUpperCase() == "CENTER" || positionAlsWort.toUpperCase() == "MITTE") 1765 { 1766 m_iBox.style.top = ((innerHeight - iBoxHeight) / 2) + scrollPos.y + "px"; 1767 } 1768 else if ( positionAlsWort.toUpperCase() == "BOTTOM" || positionAlsWort.toUpperCase() == "UNTEN") 1769 { 1770 m_iBox.style.top = (innerHeight - iBoxHeight) + scrollPos.y + "px"; 1771 } 1772} 1773 1774/** 1775 * Richtet die iBox horizontal aus 1776 * @param {Object} positionAlsWort 1777 */ 1778var alignIBoxHorizontalTo = function(positionAlsWort) 1779{ 1780 var iBoxWidth = m_iBox.offsetWidth; 1781 var innerWidth; 1782 1783 // ((window.width - ibox.width) / 2) = Abstand nach links und rechts! 1784 if(window.innerWidth) // nicht IE6 1785 { 1786 var cssStyles = window.getComputedStyle(document.body, null); 1787 if (cssStyles != null && cssStyles["max-width"] != null && cssStyles["max-width"] != "" && cssStyles["max-width"] != "none") 1788 innerWidth = Math.min(window.innerWidth, document.body.getBoundingClientRect().width); 1789 else 1790 innerWidth = window.innerWidth; 1791 } 1792 else if(document.body.clientWidth) // IE6 1793 { 1794 innerWidth = document.body.clientWidth; 1795 } 1796 1797 // TODO: ScrollPosition mit einberechnen 1798 // Positionierung 1799 if ( positionAlsWort.toUpperCase() == "LEFT" || positionAlsWort.toUpperCase() == "LINKS") 1800 { 1801 m_iBox.style.left = 0 + "px"; 1802 } 1803 else if ( positionAlsWort.toUpperCase() == "CENTER" || positionAlsWort.toUpperCase() == "MITTE") 1804 { 1805 m_iBox.style.left = ((innerWidth - iBoxWidth) / 2) + "px"; 1806 } 1807 else if ( positionAlsWort.toUpperCase() == "RIGHT" || positionAlsWort.toUpperCase() == "RECHT
1807S") 1808 { 1809 m_iBox.style.left = (innerWidth - iBoxWidth) + "px"; 1810 } 1811} 1812 1813 1814// ----------------- resize ------------------------------- 1815 1816/** 1817 * Setzt die Größe des tranzparenten Hintergrund-Divs auf die Größe des Browserfensters 1818 */ 1819var resizeBlackOverlayWidthToDocumentBody = function() 1820{ 1821 var width = getBodyWidth(); 1822 var height = getBodyHeight(); 1823 1824 document.getElementById(m_IdDiv).style.width = width + "px"; 1825 document.getElementById(m_IdDiv).style.height = height + "px"; 1826 document.getElementById(m_IdIFrame).width = (width-4) + "px"; 1827 document.getElementById(m_IdIFrame).height = (height-4) + "px"; 1828} 1829 1830// ----------------- getter - width / height / size ------------------------------- 1831 1832/** 1833 * Gibt die Breite des Document-Bodys zurück 1834 */ 1835var getBodyWidth = function() 1836{ 1837 if (document.documentElement.scrollWidth) 1838 { 1839 return document.documentElement.scrollWidth; 1840 } 1841 else if (document.documentElement.offsetWidth) 1842 { 1843 return document.documentElement.offsetWidth; 1844 } 1845 1846 var theBody = document.getElementsByTagName("BODY")[0]; 1847 return getElementWidthValue(theBody); 1848} 1849 1850 1851 1852/** 1853 * Gibt die Höhe des Document-Bodys zurück. Wenn jedoch die Fensterhöhe größer ist als 1854 * der gerenderte Body, wird die Fenstergröße zurück gegeben. 1855 */ 1856var getBodyHeight = function() 1857{ 1858 if (document.documentElement.scrollHeight) 1859 { 1860 return document.documentElement.scrollHeight; 1861 } 1862 else if (document.documentElement.offsetHeight) 1863 { 1864 return document.documentElement.offsetHeight; 1865 } 1866 1867 var theBody = document.getElementsByTagName("BODY")[0]; 1868 return getElementHeightValue(theBody); 1869} 1870 1871 1872/** 1873 * Gibt die (prozentuale) Breite des Client-Windows zurück. 1874 */ 1875var getClientWidthInPercentage = function(percentage) 1876{ 1877 var innerWidth = 0; 1878 percentage = percentage / 100; 1879 1880 // Fensterbreite browserabhängig bestimmen 1881 if(window.innerWidth) // nicht IE6 1882 { 1883 innerWidth = window.innerWidth; 1884 } 1885 else if(document.body.clientWidth) // IE6 1886 { 1887 innerWidth = document.body.clientWidth; 1888 } 1889 1890 return (percentage * innerWidth); 1891} 1892 1893/** 1894 * Gibt die (prozentuale) Höhe des Client-Windows zurück. 1895 */ 1896var getClientHeightInPercentage = function(percentage) 1897{ 1898 var innerHeight = 0; 1899 percentage = percentage / 100; 1900 1901 // Fensterhöhe browserabhängig bestimmen 1902 if(window.innerHeight) // nicht IE6 1903 { 1904 innerHeight = window.innerHeight; 1905 } 1906 else if(document.documentElement) // IE6 1907 { 1908 if (document.documentElement.clientHeight) 1909 { 1910 innerHeight = document.documentElement.clientHeight; 1911 } 1912 else 1913 { 1914 innerHeight = document.documentElement.clientheight; 1915 } 1916 } 1917
1918 return (percentage * innerHeight); 1919} 1920 1921// ----------------- isInteger-Funktionen ------------------------------- 1922/** 1923 * Prüft ob die übergebene Zahl eine positive ganze Zahl ist 1924 * @param {Object} s 1925 */ 1926function isUnsignedInteger(s) 1927{ 1928 return (s.toString().search(/^[0-9]+$/) == 0); 1929} 1930 1931/** 1932 * Prüft ob die übergebene Zahl eine Ganzzahl ist 1933 * @param {Object} s 1934 */ 1935function isInteger(s) 1936{ 1937 return (s.toString().search(/^-?[0-9]+$/) == 0); 1938} 1939 1940// ----------------- Timer-Funktionen ------------------------------- 1941/** 1942 * 1943 * @param {Object} timeToDisappear 1944 */ 1945var setTimeToDisappear = function (timeToDisappear) 1946{ 1947 m_TimeoutToDisappear = setTimeout("removeAllIBoxElements();",timeToDisappear*1000); 1948} 1949 1950var deleteTimeout = function (timeout) 1951{ 1952 window.clearTimeout(timeout); 1953} 1954 1955
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.