1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-31 05:37:59 +01:00

[ticket/12440] Set browser URL to point to specific post when using view=unread

PHPBB3-12440
This commit is contained in:
Cesar G 2014-05-05 15:08:18 -07:00
parent 324daf72fe
commit 7475e05f99
3 changed files with 19 additions and 3 deletions

View File

@ -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

View File

@ -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">

View File

@ -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">