diff --git a/Telegram/Resources/iv_html/page.js b/Telegram/Resources/iv_html/page.js index ae6e50519b..1a0ff4af34 100644 --- a/Telegram/Resources/iv_html/page.js +++ b/Telegram/Resources/iv_html/page.js @@ -44,7 +44,10 @@ var IV = { jumpToHash: function (hash, instant) { var current = IV.computeCurrentState(); current.hash = hash; - window.history.replaceState(current, ''); + window.history.replaceState( + current, + '', + 'page' + IV.index + '.html'); if (hash == '') { IV.scrollTo(0, instant); return; @@ -216,11 +219,10 @@ var IV = { } }, init: function () { - IV.platform = window.navigator.platform.toLowerCase(); - IV.mac = IV.platform.startsWith('mac'); - IV.win = IV.platform.startsWith('win'); + var current = IV.computeCurrentState(); + window.history.replaceState(current, '', IV.pageUrl(0)); + IV.jumpToHash(current.hash, true); - window.history.replaceState(IV.computeCurrentState(), ''); IV.lastScrollTop = window.history.state.scroll; IV.findPageScroll().onscroll = IV.frameScrolled; @@ -310,6 +312,13 @@ var IV = { scroll: now ? now.scrollTop : 0 }; }, + pageUrl: function (index, hash) { + var result = 'page' + index + '.html'; + if (hash) { + result += '#' + hash; + } + return result; + }, navigateTo: function (index, hash) { if (!index && !IV.index) { IV.navigateToDOM(IV.index, hash); @@ -401,17 +410,20 @@ var IV = { navigateToDOM: function (index, hash) { IV.pending = null; if (IV.index == index) { - IV.jumpToHash(hash, IV.mac); + IV.jumpToHash(hash); IV.forceScrollFocus(); return; } - window.history.replaceState(IV.computeCurrentState(), ''); + window.history.replaceState( + IV.computeCurrentState(), + '', + IV.pageUrl(IV.index)); IV.position = IV.position + 1; window.history.pushState( { position: IV.position, index: index, hash: hash }, '', - 'page' + index + '.html' + (hash.length ? '#' + hash : '')); + IV.pageUrl(index)); IV.showDOM(index, hash); }, findPageScroll: function () { @@ -492,11 +504,11 @@ var IV = { IV.updateJumpToTop(true); } } else if (scroll !== undefined) { - IV.scrollTo(scroll, IV.mac); + IV.scrollTo(scroll); IV.lastScrollTop = scroll; IV.updateJumpToTop(true); } else { - IV.jumpToHash(hash, IV.mac); + IV.jumpToHash(hash); } IV.forceScrollFocus(); diff --git a/Telegram/lib_webview b/Telegram/lib_webview index cf8ef94d0b..7c346c6b04 160000 --- a/Telegram/lib_webview +++ b/Telegram/lib_webview @@ -1 +1 @@ -Subproject commit cf8ef94d0b12f8484e247d6a2d88dd1c11a6b964 +Subproject commit 7c346c6b042266b5adb116a2114df1d46b37c03f