Skip to content

Commit

Permalink
Update OnlyStarter.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SwaggyMacro committed Apr 22, 2022
1 parent b629b42 commit bfee6d3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions js/src/forum/components/OnlyStarter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import DiscussionPage from 'flarum/components/DiscussionPage';
import Button from 'flarum/components/Button'
import app from 'flarum/app';
import PostUser from 'flarum/components/PostUser';
import PostStream from 'flarum/components/PostStream';

var onlyStarter = false;

Expand All @@ -27,14 +28,15 @@ export default function () {
try{
$(this).find('.PostUser .topicStarter')[0].className;
}catch(e){
$(this).css("display", "none");
if ($(this).parent().attr("data-index") != 0){
$(this).css("display", "none");
}
}

});
onlyStarter = true;
$(".OnlyStarter span").text(textNotOnlyStarter);
}else{
$(".CommentPost").each(function(){
$(".PostStream").each(function(){
$(this).css("display", "block");
});
onlyStarter = false;
Expand All @@ -44,6 +46,10 @@ export default function () {
});
});

extend(PostStream.prototype, 'oninit', function () {
onlyStarter = false;
});

extend(PostUser.prototype, 'view', function (vnode) {
if (app.forum.attribute('showTopicStarter') == 0) return;
const routeName = app.current.get('routeName');
Expand Down Expand Up @@ -75,9 +81,10 @@ export default function () {
try{
$(this).find('.PostUser .topicStarter')[0].className;
}catch(e){
$(this).css("display", "none");
if ($(this).parent().attr("data-index") != 0){
$(this).css("display", "none");
}
}

});
}
}
Expand All @@ -103,4 +110,4 @@ export default function () {


});
}
}

0 comments on commit bfee6d3

Please sign in to comment.