diff options
-rw-r--r-- | phpBB/assets/javascript/core.js | 16 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/viewtopic_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/viewtopic_body.html | 4 |
3 files changed, 19 insertions, 3 deletions
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 @@ -1426,6 +1426,20 @@ phpbb.getFunctionByName = function (functionName) { }; /** +* 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 */ $(document).ready(function() { @@ -1444,6 +1458,8 @@ $(document).ready(function() { $('#color_palette_placeholder').each(function() { phpbb.registerPalette($(this)); }); + + phpbb.setUnreadUrl(); }); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index ed45835da6..f2c553d015 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -115,7 +115,7 @@ <!-- BEGIN postrow --> <!-- EVENT viewtopic_body_postrow_post_before --> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF --> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF -->"> <div class="inner"> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 6ac4e0ea33..f5dab205f0 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -141,7 +141,7 @@ <!-- IF postrow.S_POST_HIDDEN --> <td class="gensmall" colspan="2" height="25" align="center"> - <!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF --> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> <a name="p{postrow.POST_ID}"></a> <!-- IF postrow.S_POST_HIDDEN --> <!-- IF postrow.S_POST_DELETED --> @@ -155,7 +155,7 @@ <!-- ELSE --> <td align="center" valign="middle"> - <!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a> <b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.POST_AUTHOR}</b> </td> <td width="100%" height="25"> |