Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
General checks and fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
creesch committed Jun 16, 2017
1 parent 7226a9e commit e17d25b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
12 changes: 10 additions & 2 deletions extension/data/modules/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,16 @@ self.init = function () {
});
}
}

commentSearch();
TBUtils.modSubCheck(function(result){
if ($body.hasClass('profile-page')) {
if($body.find('#header-bottom-right .user a').text() === $body.find('#header-bottom-left .pagename').text()) {
result = true;
}
}
if(result) {
commentSearch();
}
});

var hidden = false;
function addHideModButton(){
Expand Down
6 changes: 5 additions & 1 deletion extension/data/modules/historybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,10 @@ TB.register_module(self);

(function () {
window.addEventListener("TBModuleLoaded", function () {
historybutton();
TBUtils.modSubCheck(function(result){
if(result) {
historybutton();
}
});
});
})();
17 changes: 17 additions & 0 deletions extension/data/tbutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,23 @@ function initwrapper() {
}
};

TBUtils.modSubCheck = function(callback) {
TBUtils.getModSubs(function () {
const subCount = TBUtils.mySubsData.length;
let subscriberCount = 0;
TBUtils.mySubsData.forEach(function(subreddit) {
subscriberCount += subreddit.subscribers;
});
subscriberCount -= subCount;
if (subscriberCount > 25) {
return callback(true);
} else {
return callback(false);
}

});
};

TBUtils.modsSub = function (subreddit) {
return $.inArray(subreddit, TBUtils.mySubs) > -1;
};
Expand Down

0 comments on commit e17d25b

Please sign in to comment.