mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
moved addCommas to app, using addCommas in topic.tpl
This commit is contained in:
@@ -44,6 +44,11 @@ var socket,
|
|||||||
async: false
|
async: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// takes a string like 1000 and returns 1,000
|
||||||
|
app.addCommas = function(text) {
|
||||||
|
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
||||||
|
}
|
||||||
|
|
||||||
// use unique alert_id to have multiple alerts visible at a time, use the same alert_id to fade out the current instance
|
// use unique alert_id to have multiple alerts visible at a time, use the same alert_id to fade out the current instance
|
||||||
// type : error, success, info, warning/notify
|
// type : error, success, info, warning/notify
|
||||||
// title = bolded title text
|
// title = bolded title text
|
||||||
|
|||||||
@@ -74,17 +74,13 @@ var theirid = '{theirid}';
|
|||||||
|
|
||||||
var isFriend = {isFriend};
|
var isFriend = {isFriend};
|
||||||
|
|
||||||
function addCommas(text) {
|
|
||||||
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var rep = $('#reputation');
|
var rep = $('#reputation');
|
||||||
rep.html(addCommas(rep.html()));
|
rep.html(app.addCommas(rep.html()));
|
||||||
|
|
||||||
var postcount = $('#postcount');
|
var postcount = $('#postcount');
|
||||||
postcount.html(addCommas(postcount.html()));
|
postcount.html(app.addCommas(postcount.html()));
|
||||||
|
|
||||||
var editLink = $('#editLink');
|
var editLink = $('#editLink');
|
||||||
var addFriendBtn = $('#add-friend-btn');
|
var addFriendBtn = $('#add-friend-btn');
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ var friendCount = '{friendCount}';
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
function addCommas(text) {
|
|
||||||
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
if(parseInt(friendCount, 10) === 0) {
|
if(parseInt(friendCount, 10) === 0) {
|
||||||
@@ -80,12 +76,12 @@ var friendCount = '{friendCount}';
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('.reputation').each(function(index, element) {
|
$('.reputation').each(function(index, element) {
|
||||||
$(element).html(addCommas($(element).html()));
|
$(element).html(app.addCommas($(element).html()));
|
||||||
})
|
});
|
||||||
|
|
||||||
$('.postcount').each(function(index, element) {
|
$('.postcount').each(function(index, element) {
|
||||||
$(element).html(addCommas($(element).html()));
|
$(element).html(app.addCommas($(element).html()));
|
||||||
})
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<a href="/users/{posts.username}">
|
<a href="/users/{posts.username}">
|
||||||
<img src="{posts.gravatar}?s=80" align="left" />
|
<img src="{posts.gravatar}?s=80" align="left" />
|
||||||
</a>
|
</a>
|
||||||
<i class="icon-star"></i><span class="user_rep_{posts.uid}">{posts.user_rep}</span>
|
<i class="icon-star"></i><span class="user_rep_{posts.uid} user_reputation_text">{posts.user_rep}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="span11">
|
<div class="span11">
|
||||||
<div class="post-block">
|
<div class="post-block">
|
||||||
@@ -126,6 +126,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
jQuery('document').ready(function() {
|
jQuery('document').ready(function() {
|
||||||
|
|
||||||
|
$('.user_reputation_text').each(function(index, element) {
|
||||||
|
$(element).html(app.addCommas($(element).html()));
|
||||||
|
});
|
||||||
|
|
||||||
var room = 'topic_' + '{topic_id}',
|
var room = 'topic_' + '{topic_id}',
|
||||||
adminTools = document.getElementById('thread-tools');
|
adminTools = document.getElementById('thread-tools');
|
||||||
|
|
||||||
|
|||||||
@@ -27,19 +27,17 @@
|
|||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
function addCommas(text) {
|
|
||||||
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('.reputation').each(function(index, element) {
|
$('.reputation').each(function(index, element) {
|
||||||
$(element).html(addCommas($(element).html()));
|
$(element).html(app.addCommas($(element).html()));
|
||||||
})
|
});
|
||||||
|
|
||||||
$('.postcount').each(function(index, element) {
|
$('.postcount').each(function(index, element) {
|
||||||
$(element).html(addCommas($(element).html()));
|
$(element).html(app.addCommas($(element).html()));
|
||||||
})
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user