forked from leftypol/leftypol
show-op.js: format
This commit is contained in:
parent
454405e5f8
commit
4544107e1d
1 changed files with 14 additions and 15 deletions
|
@ -11,12 +11,11 @@
|
||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* $config['additional_javascript'][] = 'js/show-op.js';
|
* $config['additional_javascript'][] = 'js/show-op.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var showOPLinks = function() {
|
let showOPLinks = function() {
|
||||||
var OP;
|
let OP;
|
||||||
|
|
||||||
if ($('div.banner').length == 0) {
|
if ($('div.banner').length == 0) {
|
||||||
OP = parseInt($(this).parent().find('div.post.op a.post_no:eq(1)').text());
|
OP = parseInt($(this).parent().find('div.post.op a.post_no:eq(1)').text());
|
||||||
|
@ -25,12 +24,13 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).find('div.body a:not([rel="nofollow"])').each(function() {
|
$(this).find('div.body a:not([rel="nofollow"])').each(function() {
|
||||||
var postID;
|
let postID = $(this).text().match(/^>>(\d+)$/);
|
||||||
|
|
||||||
if(postID = $(this).text().match(/^>>(\d+)$/))
|
if (postID) {
|
||||||
postID = postID[1];
|
postID = postID[1];
|
||||||
else
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (postID == OP) {
|
if (postID == OP) {
|
||||||
$(this).after(' <small>(OP)</small>');
|
$(this).after(' <small>(OP)</small>');
|
||||||
|
@ -44,8 +44,7 @@ $(document).ready(function(){
|
||||||
$(document).on('new_post', function(e, post) {
|
$(document).on('new_post', function(e, post) {
|
||||||
if ($(post).is('div.post.reply')) {
|
if ($(post).is('div.post.reply')) {
|
||||||
$(post).each(showOPLinks);
|
$(post).each(showOPLinks);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$(post).find('div.post.reply').each(showOPLinks);
|
$(post).find('div.post.reply').each(showOPLinks);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue