projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show arrow before links in notifications that link to the current page.
[Sone.git]
/
src
/
main
/
resources
/
static
/
javascript
/
sone.js
diff --git
a/src/main/resources/static/javascript/sone.js
b/src/main/resources/static/javascript/sone.js
index
db08197
..
d21e6c6
100644
(file)
--- a/
src/main/resources/static/javascript/sone.js
+++ b/
src/main/resources/static/javascript/sone.js
@@
-878,7
+878,7
@@
function ajaxifyNotification(notification) {
if (linkElement.is("[href^='viewPost']")) {
id = linkElement.attr("class").substr(5);
if (hasPost(id)) {
if (linkElement.is("[href^='viewPost']")) {
id = linkElement.attr("class").substr(5);
if (hasPost(id)) {
- linkElement.attr("href", "#post-" + id);
+ linkElement.attr("href", "#post-" + id)
.addClass("in-page-link")
;
}
}
});
}
}
});
@@
-923,8
+923,8
@@
function checkForRemovedSones(oldNotification, newNotification) {
if (getNotificationId(oldNotification) != "new-sone-notification") {
return;
}
if (getNotificationId(oldNotification) != "new-sone-notification") {
return;
}
- oldIds = getElementIds(oldNotification, ".sone-id");
- newIds = getElementIds(newNotification, ".sone-id");
+ oldIds = getElementIds(oldNotification, ".
new-
sone-id");
+ newIds = getElementIds(newNotification, ".
new-
sone-id");
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markSoneAsKnown(getSone(value), true);
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markSoneAsKnown(getSone(value), true);
@@
-996,7
+996,7
@@
function getStatus() {
});
if (!foundNotification) {
if (notificationId == "new-sone-notification") {
});
if (!foundNotification) {
if (notificationId == "new-sone-notification") {
- $(".sone-id", this).each(function(index, element) {
+ $(".
new-
sone-id", this).each(function(index, element) {
soneId = $(this).text();
markSoneAsKnown(getSone(soneId), true);
});
soneId = $(this).text();
markSoneAsKnown(getSone(soneId), true);
});
@@
-1115,14
+1115,19
@@
function isIndexPage() {
}
/**
}
/**
- * Returns the current page of the selected pagination.
+ * Returns the current page of the selected pagination. If no pagination can be
+ * found with the given selector, {@code 1} is returned.
*
* @param paginationSelector
* The pagination selector
* @returns The current page of the pagination
*/
function getPage(paginationSelector) {
*
* @param paginationSelector
* The pagination selector
* @returns The current page of the pagination
*/
function getPage(paginationSelector) {
- return $(".current-page", paginationSelector).text();
+ pagination = $(paginationSelector);
+ if (pagination.length > 0) {
+ return $(".current-page", paginationSelector).text();
+ }
+ return 1;
}
/**
}
/**
@@
-1203,7
+1208,7
@@
function loadNewPost(postId, soneId, recipientId, time) {
if (hasPost(postId)) {
return;
}
if (hasPost(postId)) {
return;
}
- if (!isIndexPage()) {
+ if (!isIndexPage()
|| (getPage(".pagination-index") > 1)
) {
if (!isViewPostPage() || (getShownPostId() != postId)) {
if (!isViewSonePage() || ((getShownSoneId() != soneId) && (getShownSoneId() != recipientId))) {
return;
if (!isViewPostPage() || (getShownPostId() != postId)) {
if (!isViewSonePage() || ((getShownSoneId() != soneId) && (getShownSoneId() != recipientId))) {
return;
@@
-1218,7
+1223,7
@@
function loadNewPost(postId, soneId, recipientId, time) {
if (hasPost(data.post.id)) {
return;
}
if (hasPost(data.post.id)) {
return;
}
- if (
!isIndexPage(
) && !(isViewSonePage() && ((getShownSoneId() == data.post.sone) || (getShownSoneId() == data.post.recipient)))) {
+ if (
(!isIndexPage() || (getPage(".pagination-index") > 1)
) && !(isViewSonePage() && ((getShownSoneId() == data.post.sone) || (getShownSoneId() == data.post.recipient)))) {
return;
}
var firstOlderPost = null;
return;
}
var firstOlderPost = null;