FIX pushToHistory

This commit is contained in:
Krivchikov Dmitry 2015-08-13 11:16:26 +03:00
parent 9435ebd29a
commit 1b9c8aa2df
2 changed files with 9 additions and 5 deletions

View File

@ -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'))
{

View File

@ -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;
});