FIX pushToHistory
This commit is contained in:
parent
9435ebd29a
commit
1b9c8aa2df
|
|
@ -146,7 +146,7 @@ window.addEventListener('popstate', function(e)
|
|||
setStatus(statusMovingInHistory);
|
||||
if (e.state.hasOwnProperty('pointId'))
|
||||
{
|
||||
showInfo(e.state.pointId);
|
||||
showInfo(e.state.pointId, false, true);
|
||||
} else
|
||||
if (e.state.hasOwnProperty('zoom'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -229,13 +229,14 @@ function initPoints(useBounds)
|
|||
* @param {type} id
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function showInfo(id, mapClick)
|
||||
function showInfo(id, mapClick,doNotPushToHistory)
|
||||
{
|
||||
if (!(id in points)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mapClick = Boolean(mapClick !== undefined && mapClick === true); // true если это клик по маркеру на карте
|
||||
doNotPushToHistory = Boolean(doNotPushToHistory !== undefined && doNotPushToHistory === true); // true если НЕ добавляем в history
|
||||
marker = points[id];
|
||||
if (!(id in pointsSources))
|
||||
{
|
||||
|
|
@ -248,11 +249,11 @@ function showInfo(id, mapClick)
|
|||
}
|
||||
});
|
||||
} else {
|
||||
drawInfoPopup(id, !mapClick);
|
||||
drawInfoPopup(id, !mapClick, doNotPushToHistory);
|
||||
}
|
||||
}
|
||||
|
||||
function drawInfoPopup(id, showPopup) {
|
||||
function drawInfoPopup(id, showPopup, doNotPushToHistory) {
|
||||
data = pointsSources[id];
|
||||
if (typeof (data.images) == 'object')
|
||||
{
|
||||
|
|
@ -307,7 +308,10 @@ function drawInfoPopup(id, showPopup) {
|
|||
marker.openPopup();
|
||||
}
|
||||
|
||||
if (!doNotPushToHistory) {
|
||||
history.pushState({pointId: id}, document.title, "/?point=" + id);
|
||||
}
|
||||
|
||||
document.title = marker.options.title;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue