<commit_before>
(function(){

  var addOrRemoveAfterSettingsChange = function() {
    if(mentionsTabEnabled() === 'disabled'){
      window.SteemMoreInfo.Tabs.disableTab('mentions');
    }else{
      window.SteemMoreInfo.Tabs.enableTab('mentions');
    }
  };

  window.SteemMoreInfo.Utils.addSettings({
    title: 'Mentions Tab',
    settings: [{
      title: '',
      key: 'MentionsTab',
      defaultValue: 'enabled',
      options: [{
        title: 'Disabled',
        value: 'disabled'
      }, {
        title: 'Enabled',
        value: 'enabled'
      }],
      description: 'Adds a tab where you can see the posts and comments where the user was mentioned',
      onChange: addOrRemoveAfterSettingsChange
    }]
  });

  var mentionsTabEnabled = function() {
    var value = window.SteemMoreInfo.Utils.getSettingsValue('MentionsTab');
    return value;
  };



  var createMentionsTab = function(mentionsTab) {
    mentionsTab.html('<div class="row">\
       <div class="UserProfile__tab_content UserProfile__tab_content_smi UserProfile__tab_content_MentionsTab column">\
          <div class="MentionsTab" style="display: none;">\
            <div id="posts_list" class="PostsList">\
              <ul class="PostsList__summaries hfeed" itemscope="" itemtype="http://schema.org/blogPosts">\
              </ul>\
            </div>\
          </div>\
          <center class="MentionsTabLoading">\
             <div class="LoadingIndicator circle">\
                <div></div>\
             </div>\
          </center>\
          <center class="MentionsTabLoadMore" style="display: none;">\
             <button>\
              Load more... \
            </button>\
          </center>\
       </div>\
    </div>');
    
    mentionsTab.find('.MentionsTabLoadMore button').on('click', function(){
      var loadMore = $(this).parent();
      loadMore.hide();
      mentionsTab.find('.MentionsTabLoading').show();
      var from = parseInt(loadMore.data('from'), 10);
      getPosts(mentionsTab, window.SteemMoreInfo.Utils.getPageAccountName(), from);
    });    

    getPosts(mentionsTab, window.SteemMoreInfo.Utils.getPageAccountName());
  };  



  var getPosts = function(mentionsTab, name, fromOrNull) {
    fromOrNull = fromOrNull || 0;
    window.SMI_AJAX({
      url: 'https://webapi.steemdata.com/Comments?where={"$text":{"$search":"\\"@' + name + '\\""}}&sort=-created&page=' + (fromOrNull+1),
      type: 'GET',
      error: function(err){
        console.log(err);
        //TODO: error
      },
      success: function(data) {
        var posts = data._items;
        var postsList = mentionsTab.find('.PostsList__summaries');
        if(postsList.length){
          posts.forEach(function(post) {
            var el = window.SteemMoreInfo.Utils.createPostSummary(post);
            postsList.append(el);
          });

          mentionsTab.find('.MentionsTabLoading').hide();
          mentionsTab.find('.MentionsTab').show();
          if(data._links.next){
            var from = fromOrNull + 1;
            var loadMore = mentionsTab.find('.MentionsTabLoadMore');
            loadMore.data('from', from);
            loadMore.show();
          }

        }
      }
    });

  };





  window.SteemMoreInfo.Tabs.createTab({
    id: 'mentions',
    title: 'Mentions',
    enabled: (mentionsTabEnabled() !== 'disabled'),
    createTab: createMentionsTab
  });



})();
<commit_msg>Start adding mentions options for posts/comments/both<commit_after>
(function(){

  var addOrRemoveAfterSettingsChange = function() {
    if(mentionsTabEnabled() === 'disabled'){
      window.SteemMoreInfo.Tabs.disableTab('mentions');
    }else{
      window.SteemMoreInfo.Tabs.enableTab('mentions');
    }
  };

  window.SteemMoreInfo.Utils.addSettings({
    title: 'Mentions Tab',
    settings: [{
      title: '',
      key: 'MentionsTab',
      defaultValue: 'enabled',
      options: [{
        title: 'Disabled',
        value: 'disabled'
      }, {
        title: 'Enabled',
        value: 'enabled'
      }],
      description: 'Adds a tab where you can see the posts and comments where the user was mentioned',
      onChange: addOrRemoveAfterSettingsChange
    }]
  });

  var mentionsTabEnabled = function() {
    var value = window.SteemMoreInfo.Utils.getSettingsValue('MentionsTab');
    return value;
  };



  var createMentionsTab = function(mentionsTab) {
    mentionsTab.html('<div class="row">\
       <div class="UserProfile__tab_content UserProfile__tab_content_smi UserProfile__tab_content_MentionsTab column">\
          <div class="MentionsTab" style="display: none;">\
            <h4 class="uppercase">\
              Mentions\
              <div class="switch-field" style="margin-bottom: -4px; margin-left: 20px;">\
                <input type="radio" id="mentions-type-posts" name="mentions-type" class="mentions-type" value="0" checked/>\
                <label for="mentions-type-posts">Posts</label>\
                <input type="radio" id="mentions-type-comments" name="mentions-type"- class="mentions-type" value="1" />\
                <label for="mentions-type-comments">Comments</label>\
                <input type="radio" id="mentions-type-both" name="mentions-type" class="mentions-type" value="2" />\
                <label for="mentions-type-both">Both</label>\
              </div>\
            </h4>\
            <div id="posts_list" class="PostsList" style="margin-top: 30px;">\
              <ul class="PostsList__summaries hfeed" itemscope="" itemtype="http://schema.org/blogPosts">\
              </ul>\
            </div>\
          </div>\
          <center class="MentionsTabLoading">\
             <div class="LoadingIndicator circle">\
                <div></div>\
             </div>\
          </center>\
          <center class="MentionsTabLoadMore" style="display: none;">\
             <button>\
              Load more... \
            </button>\
          </center>\
       </div>\
    </div>');
    
    mentionsTab.find('.MentionsTabLoadMore button').on('click', function(){
      var loadMore = $(this).parent();
      loadMore.hide();
      mentionsTab.find('.MentionsTabLoading').show();
      var from = parseInt(loadMore.data('from'), 10);
      getPosts(mentionsTab, window.SteemMoreInfo.Utils.getPageAccountName(), from);
    });    

    getPosts(mentionsTab, window.SteemMoreInfo.Utils.getPageAccountName());
  };  



  var getPosts = function(mentionsTab, name, fromOrNull) {
    fromOrNull = fromOrNull || 0;
    window.SMI_AJAX({
      // url: 'https://webapi.steemdata.com/Comments?where={"$text":{"$search":"\\"@' + name + '\\""}}&sort=-created&page=' + (fromOrNull+1),
      url: 'https://webapi.steemdata.com/Posts?where={"$text":{"$search":"\\"@' + name + '\\""}}&sort=-created&page=' + (fromOrNull+1),
      type: 'GET',
      error: function(err){
        console.log(err);
        //TODO: error
      },
      success: function(data) {
        var posts = data._items;
        var postsList = mentionsTab.find('.PostsList__summaries');
        if(postsList.length){
          posts.forEach(function(post) {
            var el = window.SteemMoreInfo.Utils.createPostSummary(post);
            postsList.append(el);
          });

          mentionsTab.find('.MentionsTabLoading').hide();
          mentionsTab.find('.MentionsTab').show();
          if(data._links.next){
            var from = fromOrNull + 1;
            var loadMore = mentionsTab.find('.MentionsTabLoadMore');
            loadMore.data('from', from);
            loadMore.show();
          }

        }
      }
    });

  };





  window.SteemMoreInfo.Tabs.createTab({
    id: 'mentions',
    title: 'Mentions',
    enabled: (mentionsTabEnabled() !== 'disabled'),
    createTab: createMentionsTab
  });



})();

{'fraction_non_alphanumeric': 0.15761708697889862, 'fraction_numerical': 0.0027020072053525477, 'mean_word_length': 2.388404533565824, 'pattern_counts': {'":': 6, '<': 56, '<?xml version=': 0, '>': 56, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6158685', 'n_tokens_mistral': 2411, 'n_tokens_neox': 2317, 'n_words': 398}