mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
last poster is visible, slugify check for latin #777
This commit is contained in:
@@ -14,15 +14,6 @@ define(['notifications', 'chat'], function(Notifications, Chat) {
|
|||||||
count = tids.length;
|
count = tids.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
var postContainer = $('#post-container');
|
|
||||||
if(postContainer.length) {
|
|
||||||
var tid = postContainer.attr('data-tid');
|
|
||||||
if(tids && tids.length > 0 && tids.indexOf(tid) !== -1) {
|
|
||||||
socket.emit('topics.markAsRead', {tid: tid, uid: app.uid});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#unread-count').toggleClass('unread-count', count > 0);
|
$('#unread-count').toggleClass('unread-count', count > 0);
|
||||||
$('#unread-count').attr('data-content', count > 20 ? '20+' : count);
|
$('#unread-count').attr('data-content', count > 20 ? '20+' : count);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -642,6 +642,8 @@ define(['composer'], function(composer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
socket.emit('topics.markAsRead', {tid: tid, uid: app.uid});
|
||||||
|
|
||||||
createNewPosts(data);
|
createNewPosts(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -99,17 +99,21 @@
|
|||||||
return difference + (min ? 'y' : ' year') + (difference !== 1 && !min ? 's' : '');
|
return difference + (min ? 'y' : ' year') + (difference !== 1 && !min ? 's' : '');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
invalidUnicodeChars : XRegExp('[^\\p{L}\\s\\d\\-_]', 'g'),
|
||||||
|
invalidLatinChars : /[^\w\s\d\-_]/g,
|
||||||
|
|
||||||
//http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
|
//http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
|
||||||
slugify: function(str) {
|
slugify: function(str) {
|
||||||
var invalidChars = XRegExp('[^\\p{L}\\s\\d\\-_]', 'g');
|
|
||||||
|
|
||||||
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
str = XRegExp.replace(str, invalidChars, '-');
|
if(/^[\w]+$/.test(str)) {
|
||||||
|
str = str.replace(utils.invalidLatinChars, '-');
|
||||||
|
} else {
|
||||||
|
str = XRegExp.replace(str, utils.invalidUnicodeChars, '-');
|
||||||
|
}
|
||||||
str = str.replace(/\s+/g, '-') // collapse whitespace and replace by -
|
str = str.replace(/\s+/g, '-') // collapse whitespace and replace by -
|
||||||
str = str.replace(/-+/g, '-'); // collapse dashes
|
str = str.replace(/-+/g, '-'); // collapse dashes
|
||||||
str = str.replace(/-$/g, '');
|
str = str.replace(/-$/g, '');
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<!-- BEGIN topics -->
|
<!-- BEGIN topics -->
|
||||||
<li class="category-item {topics.deleted-class}" itemprop="itemListElement">
|
<li class="category-item {topics.deleted-class}" itemprop="itemListElement">
|
||||||
|
|
||||||
<div class="col-md-12 panel panel-default topic-row">
|
<div class="col-md-12 col-xs-12 panel panel-default topic-row">
|
||||||
<a href="../../user/{topics.userslug}" class="pull-left">
|
<a href="../../user/{topics.userslug}" class="pull-left">
|
||||||
<img class="img-rounded user-img" src="{topics.picture}" title="{topics.username}" />
|
<img class="img-rounded user-img" src="{topics.picture}" title="{topics.username}" />
|
||||||
</a>
|
</a>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
[[category:posted]] <span class="timeago" title="{topics.relativeTime}"></span>
|
[[category:posted]] <span class="timeago" title="{topics.relativeTime}"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="pull-right hidden-xs">
|
<span class="pull-right">
|
||||||
<!-- IF topics.unreplied -->
|
<!-- IF topics.unreplied -->
|
||||||
[[category:no_replies]]
|
[[category:no_replies]]
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<!-- END topics -->
|
<!-- END topics -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 {show_sidebar} category-sidebar">
|
<div class="col-md-3 col-xs-12 {show_sidebar} category-sidebar">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">[[category:sidebar.recent_replies]]</div>
|
<div class="panel-heading">[[category:sidebar.recent_replies]]</div>
|
||||||
<div class="panel-body recent-replies">
|
<div class="panel-body recent-replies">
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="pull-right hidden-xs">
|
<span class="pull-right">
|
||||||
<!-- IF topics.unreplied -->
|
<!-- IF topics.unreplied -->
|
||||||
No one has replied
|
No one has replied
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="pull-right hidden-xs">
|
<span class="pull-right">
|
||||||
<!-- IF topics.unreplied -->
|
<!-- IF topics.unreplied -->
|
||||||
No one has replied
|
No one has replied
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
|||||||
Reference in New Issue
Block a user