/**
* @class IDU.cardoMap.BergPass.Web.Wilma.Controls.InfoPoint.InfoPointControl
* @extends IDU.Core.Web.Utilities.Base
* Client-Script-Funktionen für das InfoPoint-Control.
* @author Robin
* @date 2014-01-27
*/
(function($) {
var _instance,
_urlReplaceRx = /\{0\}/g,
_ua = navigator.userAgent.toLowerCase(),
_docMode = document.documentMode,
InfoPointControl = Base.extend('IDU.cardoMap.BergPass.Web.Wilma.Controls.InfoPoint.InfoPointControl', {
//////////////////////////////////////////////////
// #region Config
//////////////////////////////////////////////////
/**
* @cfg {String} contextualParagraphUrlPattern (required)
* Pattern zur URL eines Paragraphen für die kontextbezogene Hilfe (Rendert nur den Paragraphen).
*/
/**
* @cfg {String} paragraphUrlPattern (required)
* Pattern zur URL eines Paragraphen (Rendert die gesamte Seite).
*/
/**
* @cfg {String} [overlayCls]
* Zusätzliche CSS-Klasse für das Overlay.
*/
/**
* @cfg {String} [expandedCls]
* Zusätzliche CSS-Klasse für die große Ansicht.
*/
* @cfg {String} [activeMenuItemCls]
* Zusätzliche CSS-Klasse für aktive Menü-Items.
*/
* @cfg {String} [inactiveMenuItemCls]
* Zusätzliche CSS-Klasse für inaktive Menü-Items.
*/
/**
* @cfg {String} [contextualContentCls]
* Zusätzliche CSS-Klasse für kontextbezogenen Inhalt (IFrame).
*/
/**
* @cfg {String} [activeInfoPointLinkCls]
* CSS-Klasse für aktive kontextbezogene InfoPoint-Links
*/
/**
* @cfg {String} paragraphInfoPointLinkDataAttributeName
* Attribut-Name für kontextbezogene Links, die auf einen InfoPoint-Paragraphen verweisen.
*/
/**
* @cfg {String} pageInfoPointLinkDataAttributeName
* Attribut-Name für Links, die auf eine InfoPoint-Seite verweisen.
*/
/**
* @cfg {Boolean} [isMinimized=false]
* Gibt an, ob die minimierte Darstellung verwendet wird.
*/
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region CTOR, Init, Destroy
//////////////////////////////////////////////////
/**
* @constructor
* Erstellt ein neues InfoPointControl.
* @param {String} containerId ID des InfoPoint-Control-Elements.
* @param {Object} [config] Weitere Konfigurationen.
*/
constructor: function(containerId, config)
{
this.base.call(this);
var me = _instance = this;
// Config hinzufügen
$.extend(this, config);
if (!this.paragraphUrlPattern)
throw new Error('InfoPointControl: paragraphUrlPattern ist nicht definiert.');
if (!this.contextualParagraphUrlPattern)
throw new Error('InfoPointControl: contextualParagraphUrlPattern ist nicht definiert.');
this.$win = $(window);
this.$win.one('beforeunload', $.proxy(this.onWindowBeforeUnload, this));
this.blankSrc = $.browser.msie && /^https/i.test(window.location.protocol) ? 'javascript:\'\'' : 'about:blank';
// IE<=9
this.needsContentCellResize = $.browser.msie && (/msie (?:6|7|8|9)/.test(_ua) || _docMode <= 9);
// Delegaten
this.updateElementHeightDelegate = $.proxy(this.updateElementHeight, this);
if (!this.isMinimized)
{
this.onStickDelegate = $.proxy(this.onStick, this);
this.onUnstickDelegate = $.proxy(this.onUnstick, this);
}
this.onIFrameLoadDelegate = $.proxy(this.onIFrameLoad, this);
this.onIFrameUnloadDelegate = $.proxy(this.onIFrameUnload, this);
this.onIFrameLinkClickDelegate = $.proxy(this.onIFrameLinkClick, this);
if (this.needsContentCellResize)
this.updateContentCellSizeDelegate = $.proxy(this.updateContentCellSize, this);
$(function() {
me.$el = $('#' + containerId);
if (!me.$el)
throw new Error('InfoPointControl: Element konnte nicht gefunden werden.');
me.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
me.$contentCell = me.$el.find('.idu-cardomap-bergpass-wilma-controls-infopoint-content-cell');
me.$iframe = me.$contentCell.children('iframe').first();
me.initialSrc = me.$iframe.attr('src');
me.$iframe.on('load', me.onIFrameLoadDelegate);
// Firefox macht beim Reload der Seite die letzte Seite des InfoPoints im IFrame auf.
// Das kann hässliche Effekte haben, wenn es eine normale InfoPoint-Seite (große Ansicht) ist.
// Hier erzwingen, dass die initialSrc aufgeht. Wenn das so ist, ist location.href about:blank.
if (me.$iframe[0].contentWindow.location.href == me.blankSrc && me.initialSrc != me.blankSrc)
me.$iframe.attr('src', me.initialSrc);
me.updateContentHeight(null);
me.$win.on('resize scroll', me.updateElementHeightDelegate);
// Sticky
if (!me.isMinimized)
{
me.$el
.on('sticky:stick', me.onStickDelegate)
.on('sticky:unstick', me.onUnstickDelegate);
me.$el.stick({
parentSelector: '.wilma-container',
stickyClass: 'idu-cardomap-bergpass-wilma-controls-infopoint-sticky'
});
}
// Menü-Klicks auf den Reitern abfangen
$('.idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item > .wilma-menu-item-link')
.on('click', $.proxy(me.onMenuLinkClick, me));
// Klicks auf InfoPoint-Links
if (me.pageInfoPointLinkDataAttributeName)
$('a[href][' + me.pageInfoPointLinkDataAttributeName + ']')
.on('click', $.proxy(me.onPageInfoPointLinkClick, me));
if (me.paragraphInfoPointLinkDataAttributeName)
$('a[href][' + me.paragraphInfoPointLinkDataAttributeName + ']')
.on('click', $.proxy(me.onParagraphInfoPointLinkClick, me));
// Close-Button
$('.idu-cardomap-bergpass-wilma-controls-infopoint-closebutton')
.on('click', $.proxy(me.onCloseButtonClick, me));
// Auf das BergPass-Modul hören
IDU.cardoMap.BergPass.Web.Wilma.Modules.BergPassModule.on('infopointrequest', $.proxy(me.onBergPassModuleInfoPointRequest, me));
});
},
/**
* @inheritdoc
* @protected
*/
destroy: function()
{
this.base.call(this);
if (this.$overlay)
this.$overlay.remove();
this.$win.off('resize', this.updateElementHeightDelegate);
this.$iframe.off('load', this.onIFrameLoad);
this.$iframe.off('unload', this.onIFrameUnload);
this.$el
.off('sticky:stick', this.onStick)
.off('sticky:unstick', this.onUnstick)
.unstick()
.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-expanded')
.removeClass(this.expandedCls)
.css('height', '');
$('.idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item > .wilma-menu-item-link')
.off('click', this.onMenuLinkClick);
IDU.cardoMap.BergPass.Web.Wilma.Modules.BergPassModule.un('infopointrequest', this.onBergPassModuleInfoPointRequest);
delete this.onExpandDelegate;
delete this.onCollapseDelegate;
delete this.updateElementHeightDelegate;
delete this.onStickDelegate;
delete this.onUnstickDelegate;
delete this.onIFrameUnloadDelegate;
delete this.onIFrameLinkClickDelegate;
delete this.$win;
},
/**
* Erstellt einen IFrame zur Anzeige des Inhalts.
* Nach jedem Collapse wird der IFrame neu erstellt, um die History wegzuschmeißen.
* @param {String} src
* @return {IDU.Core.Web.JQuery}
* @private
*/
createIFrame: function(src)
{
if (this.$iframe)
this.$iframe
.off('load', this.onIFrameLoadDelegate)
.off('unload', this.onIFrameUnloadDelegate)
.remove();
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
return (this.$iframe = $('<iframe>', {
frameborder: '0',
border: '0',
src: src || this.blankSrc
})
.appendTo(this.$contentCell)
.on('load', this.onIFrameLoadDelegate));
},
/**
* Setzt den Frame-Inhalt zurück.
* @private
*/
resetIFrame: function()
{
this.createIFrame(this.$iframe.is(':visible') ? this.initialSrc : this.blankSrc);
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region Höhe des InfoPoints
//////////////////////////////////////////////////
/**
* Aktualisiert die Höhe des Elements, passt sich dem Browser-Fenster an.
* @private
*/
updateElementHeight: function()
{
var wh = this.$win.height(),
o = this.$el.offset(),
st = this.$win.scrollTop(),
h = wh - o.top + st;
if (!this.isExpanded())
h = Math.min(h, this.maxHeight);
else if (this.isMinimized)
return;
this.$el.css('height', h + 'px');
if (this.needsContentCellResize)
this.updateContentCellSize();
this.updateContextualElementHeight();
},
/**
* Aktualisiert die Höhe des Elements, passt sich dem Browser-Fenster an.
* @param {Number} contentHeight Höhe des Inhalts im Frame
* @private
*/
updateContentHeight: function(contentHeight)
{
if (this.isExpanded() || this.isMinimized)
return;
if (!contentHeight)
this.maxHeight = Number.MAX_VALUE;
else
this.maxHeight = contentHeight + parseInt(this.$el.css('height'), 10) - this.$iframe.outerHeight(true);
this.updateElementHeight();
$.stickyRefresh();
},
/**
* Aktualisiert die Höhe des Wilma-Page-Elements an die zur Verfügung stehende Höhe.
* @private
*/
updateContextualElementHeight: function()
{
// Höhe im IFrame anpassen, wenn kontextbezogen
if (this.$el.hasClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual'))
{
var ih = this.$iframe.height(),
body = this.getIFrameBody(),
wp = body.find('.wilma-page').first(),
height;
if (body.length && wp.length)
{
// nur Inhalt scrollen lassen
body.css('overflow', 'hidden');
wp.css('overflow', 'auto');
// Höhe zurücksetzen
wp.css('height', 'auto');
height = wp.outerHeight(true);
// Höhe aller Elemente außer dem Page-Element.
// Bei body auch outerHeight nehmen, weil unser Bezug unten dass IFrame-Element ist.
ih -= body.outerHeight(true);
// nur setzen, wenn zu groß
if (ih + height < height)
// Höhe des Page-Elements festlegen auf den zur Verfügung stehenden Platz
// abzüglich der anderen Elementhöhen.
wp.outerHeight(ih + height, true);
}
}
},
/**
* Für IE<=9 wird die Höhe der Content-Table-Cell angepasst, weil sonst 100% des inneren Elements
* auf die gesamte Tabelle geht.
* @private
*/
updateContentCellSize: function()
{
var $parent = this.$iframe.parent();
$parent
.css('height', '')
.height($parent.height() - $parent.position().top);
},
/**
* Wird aufgerufen, wenn das Element fixiert wurde.
* @private
*/
onStick: function()
{
this.updateElementHeight();
this.$win.off('resize scroll', this.updateElementHeightDelegate);
},
/**
* Wird aufgerufen, wenn die Fixierung des Elements gelöst wurde.
* @private
*/
onUnstick: function()
{
this.updateElementHeight();
this.$win.on('resize scroll', this.updateElementHeightDelegate);
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region Menü-Funktionen
//////////////////////////////////////////////////
* Wird beim Klick auf einen Link im Reiter-Menü aufgerufen.
* Hier wird der Klick abgefangen und führt dazu, dass sich der InfoPoint in der großen Ansicht öffnet.
* @param {Object} e Event-Objekt
* @private
*/
onMenuLinkClick: function(e)
{
// Standardaktion (Öffnen der Seite im aktuellen Fenster) verhindern.
e.preventDefault();
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
var $link = $(e.target);
// Link im IFrame öffnen
this.$iframe.attr('src', $link.attr('href'));
this.expand();
// Schon mal den Reiter aktivieren
this.activateTab($link.closest('.idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item'));
},
/**
* Aktiviert ein Menü-Tab.
* @param {IDU.Core.Web.JQuery} tabEl jQuery-Element des Tabs oder null, wenn keins aktiviert werden soll.
* @private
*/
activateTab: function(tabEl)
{
$('.idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-active')
.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-active')
.removeClass(this.activeMenuItemCls)
.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-inactive')
.addClass(this.inactiveMenuItemCls)
if (tabEl)
tabEl.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-inactive')
.removeClass(this.inactiveMenuItemCls)
.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-active')
.addClass(this.activeMenuItemCls);
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region IFrame-Funktionen
//////////////////////////////////////////////////
/**
* Wird aufgerufen, wenn eine URL im IFrame geladen wurde.
* @param {Object} e Event-Objekt
* @private
*/
onIFrameLoad: function(e)
{
this.$el.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
var $iframe = $(e.target);
if ($iframe.attr('src') == this.blankSrc)
return;
var contentWindow = this.getIFrameContentWindow(),
iWeb = contentWindow[0].IDU && contentWindow[0].IDU.Core && contentWindow[0].IDU.Core.Web,
body = this.getIFrameBody(),
$col;
contentWindow.one('beforeunload', this.onIFrameUnloadDelegate);
if (iWeb)
{
var iPageId = iWeb.tryResolve('IDU.cardoMap.BergPass.Web.Wilma.Modules.BergPassModule.infoPointTabNodeId');
if (iPageId)
{
$col = $('.idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item[data-wilma-menu-page-id=' + iPageId + ']');
if ($col.length > 0 && $col.is('idu-cardomap-bergpass-wilma-controls-infopoint-tabmenu-item-active'))
return;
}
}
this.activateTab($col);
// Content-CSS-Klassen dem Body im IFrame zuweisen
body
.addClass(this.$el.find('.idu-cardomap-bergpass-wilma-controls-infopoint-content').attr('class') || '')
.addClass(this.$el.hasClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual') ? 'idu-cardomap-bergpass-wilma-controls-infopoint-contextual ' + (this.contextualContentCls || '') : null)
.one('click', 'a[href]:not([data-wilma-resource-id],[target="_blank"])', this.onIFrameLinkClickDelegate);
this.updateContentHeight(body.outerHeight());
this.updateContextualElementHeight();
},
/**
* Wird aufgerufen, bevor eine URL im IFrame geladen wird.
* @param {Object} e Event-Objekt
* @private
*/
onIFrameUnload: function(e)
{
this.updateContentHeight(null);
//this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
},
/**
* Wird aufgerufen, bevor das Fenster geschlossen wird.
* @private
*/
onWindowBeforeUnload: function()
{
// verhindern, dass beim Seite-Neu-Laden im InfoPoint-IFrame nochmal was passiert... (LoadMask)
this.getIFrameContentWindow().off('beforeunload', this.onIFrameUnloadDelegate);
},
/**
* Wird aufgerufen, wenn im IFrame auf einen Link geklickt wurde und es sich bei diesem
* nicht um einen Download- oder Link mit dem Aufrufziel "_blank" handelt.
* @private
*/
onIFrameLinkClick: function(e)
{
if (this.isExpanded())
return;
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
this.expand();
},
/**
* Gibt das JQuery-Objekt aus dem IFrame zurück.
* @return {IDU.Core.Web.JQuery}
* @private
*/
getIFrameJQuery: function()
{
var contentWindow = this.getIFrameContentWindow(),
iWeb = contentWindow[0].IDU && contentWindow[0].IDU.Core && contentWindow[0].IDU.Core.Web;
if (iWeb && iWeb.JQuery)
return iWeb.JQuery;
return null;
},
/**
* Gibt das Window-Objekt des IFrames als JQuery-Objekt zurück.
* @return {IDU.Core.Web.JQuery}
* @private
*/
getIFrameContentWindow: function()
{
return $(this.$iframe[0].contentWindow);
},
/**
* Gibt das DOM-Dokument des IFrames als JQuery-Objekt zurück.
* @return {IDU.Core.Web.JQuery}
* @private
*/
getIFrameDocument: function()
{
var i$ = this.getIFrameJQuery(),
contentWindow,
doc = this.$iframe[0].contentDocument || ((contentWindow = this.$iframe[0].contentWindow) ? contentWindow.document : this.$iframe[0].document);
if (i$)
return i$(doc);
return $(doc);
},
/**
* Gibt das body-Element des IFrames als JQuery-Objekt zurück.
* @return {IDU.Core.Web.JQuery}
* @private
*/
getIFrameBody: function()
{
var i$ = this.getIFrameJQuery();
if (i$)
return i$('body');
return $(this.getIFrameDocument()[0].body);
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region Klicks auf InfoPoint-Links
//////////////////////////////////////////////////
/**
* Wird aufgerufen, wenn ein Link zu einer InfoPoint-Seite geklickt wurde.
* Hier wird der Klick abgefangen und führt dazu, dass sich der InfoPoint in der großen Ansicht öffnet.
* @param {Object} e Event-Objekt
* @private
*/
onPageInfoPointLinkClick: function(e)
{
// Standardaktion (Öffnen der Seite im aktuellen Fenster) verhindern.
e.preventDefault();
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
this.expand();
// Link im IFrame öffnen
this.$iframe.attr('src', $(e.target).attr('href'));
},
/**
* Wird aufgerufen, wenn ein Link zu einem InfoPoint-Paragraphen geklickt wurde.
* @param {Object} e Event-Objekt
* @private
*/
onParagraphInfoPointLinkClick: function(e)
{
// Standardaktion (Öffnen der Seite im aktuellen Fenster) verhindern.
e.preventDefault();
var $link = $(e.target);
this.showContextualContent(parseInt($link.attr(this.paragraphInfoPointLinkDataAttributeName), 10));
// Link aktiv setzen
//if (this.activeInfoPointLinkCls)
// $link.addClass(this.activeInfoPointLinkCls);
},
/**
* Wird aufgerufen, wenn ein anderes Control über das Modul einen InfoPoint-Paragraphen anfordert.
* @param {Number} paragraphId
* @private
*/
onBergPassModuleInfoPointRequest: function(paragraphId)
{
this.showContextualContent(paragraphId);
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region Aufklappen, Einklappen
//////////////////////////////////////////////////
/**
* Gibt an, ob der InfoPoint in der großen Overlay-Ansicht geöffnet ist.
* @return {Boolean}
*/
isExpanded: function()
{
return this.$el.hasClass('idu-cardomap-bergpass-wilma-controls-infopoint-expanded');
},
/**
* Öffnet die große Overlay-Ansicht des InfoPoints.
*/
expand: function()
{
if (this.isExpanded())
return;
if (!this.$overlay)
this.$overlay = $('<div>')
.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-overlay')
.addClass(this.overlayCls)
.appendTo('body');
this.$win.off('resize scroll', this.updateElementHeightDelegate);
if (!this.isMinimized)
this.$el
.off('sticky:stick', this.onStickDelegate)
.off('sticky:unstick', this.onUnstickDelegate)
.unstick();
this.$overlay.show();
//this.onExpandDelegate = this.onExpandDelegate || $.proxy(this.onExpand, this);
this.getIFrameBody()
.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual')
.removeClass(this.contextualContentCls);
// evtl. aktiven InfoPoint-Link zurücksetzen
if (this.activeInfoPointLinkCls)
$('.' + this.activeInfoPointLinkCls).removeClass(this.activeInfoPointLinkCls);
this.$el
.css('height', '')
.css('position', 'fixed')
.css('zIndex', 40010)
.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual')
.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-expanding')
// das mit der Animation will nur im FF.... später mal probieren
.addClass(
'idu-cardomap-bergpass-wilma-controls-infopoint-expanded ' + (this.expandedCls || '')/*,
800,
'easeInOutQuart',
this.onExpandDelegate*/);
this.onExpand.call(this);
},
/**
* Callback-Funktion für das Aufklappen des InfoPoints.
* @private
*/
onExpand: function()
{
this.$el.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-expanding');
if (this.needsContentCellResize)
{
this.$win.on('resize', this.updateContentCellSizeDelegate);
this.updateContentCellSize();
}
},
/**
* Schließt die große Overlay-Ansicht des InfoPoints.
*/
collapse: function()
{
if (!this.isExpanded())
return;
//this.onCollapseDelegate = this.onCollapseDelegate || $.proxy(this.onCollapse, this);
this.$el
.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-collapsing')
.removeClass(
'idu-cardomap-bergpass-wilma-controls-infopoint-expanded ' + (this.expandedCls || '')/*,
800,
'easeInOutQuart',
this.onCollapseDelegate*/);
if (this.$iframe.attr('src') != this.blankSrc)
this.activateTab(null);
this.onCollapse.call(this);
},
/**
* Callback-Funktion für das Zuklappen des InfoPoints.
* @private
*/
onCollapse: function()
{
this.$overlay.hide();
this.$win.on('resize scroll', this.updateElementHeightDelegate);
this.$el
.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-collapsing')
.css('position', '')
.css('zIndex', '');
if (!this.isMinimized)
this.$el
.on('sticky:stick', this.onStickDelegate)
.on('sticky:unstick', this.onUnstickDelegate)
.stick({
parentSelector: '.wilma-container',
stickyClass: 'idu-cardomap-bergpass-wilma-controls-infopoint-sticky'
});
//this.$iframe.attr('src', this.$iframe.is(':visible') ? this.initialSrc : this.blankSrc);
this.resetIFrame();
if (this.needsContentCellResize)
this.$win.off('resize', this.updateContentCellSizeDelegate);
this.updateElementHeight();
},
/**
* Wird beim Klick auf den Schließen-Button aufgerufen.
* @private
*/
onCloseButtonClick: function()
{
this.collapse();
},
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
// #region ClientScript-API
//////////////////////////////////////////////////
/**
* Zeigt den Inhalt eines Paragraphen als kontextbezogene Hilfe im InfoPoint an.
* @param {Number/Object} paragraphId ID des Paragraphen (oder ein Objekt eines Referenzierten Paragraphen aus der Interaktions-API)
*/
showContextualContent: function(paragraphId)
{
// API-Aufruf
if (paragraphId && typeof paragraphId === 'object')
paragraphId = paragraphId.paragraphId;
// wenn aufgeklappt, dann kann man nix weiter machen, als zu der Seite navigieren, in der der Paragraph steckt.
var url,
src = this.$iframe.attr('src');
// alten aktiven Link zurücksetzen
if (this.activeInfoPointLinkCls)
$('.' + this.activeInfoPointLinkCls).removeClass(this.activeInfoPointLinkCls);
if (this.isExpanded() || this.isMinimized)
{
url = this.paragraphUrlPattern;
// zurücksetzen nicht im aufgeklappten Zustand (?)
if (!paragraphId)
return;
if (this.isMinimized)
this.expand();
}
// ansonsten Inhalt per Ajax laden und im InfoPoint-Content-Element anzeigen
else
{
url = this.contextualParagraphUrlPattern;
this.updateElementHeight();
// Zurücksetzen
if (!paragraphId)
{
if (this.$el.hasClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual'))
{
this.$el.removeClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual');
this.resetIFrame();
}
return;
}
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-contextual');
// alle Links auf diesen Paragraphen aktivieren
if (this.activeInfoPointLinkCls && this.paragraphInfoPointLinkDataAttributeName)
$('a[href][' + this.paragraphInfoPointLinkDataAttributeName + '=' + paragraphId + ']')
.addClass(this.activeInfoPointLinkCls);
}
url = url.replace(_urlReplaceRx, paragraphId);
this.$el.addClass('idu-cardomap-bergpass-wilma-controls-infopoint-loading');
if (url == src)
this.getIFrameContentWindow().get(0).location.reload();
else
this.$iframe.attr('src', url);
}
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
},{
//////////////////////////////////////////////////
// #region Statisches
//////////////////////////////////////////////////
/**
* Gibt die Instanz des InfoPoint-Controls in der Seite zurück (für Scripting).
* @return {IDU.cardoMap.BergPass.Web.Wilma.Controls.InfoPoint.InfoPointControl}
* @private
* @static
*/
getInstance: function()
{
return _instance;
}
//////////////////////////////////////////////////
// #endregion
//////////////////////////////////////////////////
});
})(IDU.Core.Web.JQuery);