From 7475e05f997c780c07111681a78d510930ad2e9a Mon Sep 17 00:00:00 2001 From: Cesar G Date: Mon, 5 May 2014 15:08:18 -0700 Subject: [ticket/12440] Set browser URL to point to specific post when using view=unread PHPBB3-12440 --- phpBB/assets/javascript/core.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index f461d5a175..0b46a1e937 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1425,6 +1425,20 @@ phpbb.getFunctionByName = function (functionName) { return context[func]; }; +/** +* Update browser history URL to point to specific post in viewtopic.php +* when using view=unread#unread link. +* +* @return undefined +*/ +phpbb.setUnreadUrl = function() { + var url = $('#unread[data-url]').data('url'); + + if (url && typeof history !== 'undefined' && typeof history.replaceState !== 'undefined') { + history.replaceState(null, document.title, url); + } +}; + /** * Apply code editor to all textarea elements with data-bbcode attribute */ @@ -1444,6 +1458,8 @@ $(document).ready(function() { $('#color_palette_placeholder').each(function() { phpbb.registerPalette($(this)); }); + + phpbb.setUnreadUrl(); }); })(jQuery); // Avoid conflicts with other libraries -- cgit v1.2.1