<commit_before><template>
      <div class="page" data-name="stories">
        <div class="navbar">
          <div class="navbar-inner">
            <div class="title sliding">HackerNews7</div>
            <div class="right">
              <a class="link icon-only searchbar-enable" data-searchbar=".searchbar-components">
                <i class="icon f7-icons ios-only">search_strong</i>
                <i class="icon material-icons md-only">search</i>
              </a>
            </div>
          </div>
        </div>
        <div class="toolbar tabbar">
          <div class="toolbar-inner">
           {{#each endpoints}}
           {{#if this.maxPages}}
            <a href="#tab-{{@index}}" class="tab-link{{#if @first}} tab-link-active{{/if}}" @click="selectTopic({{@index}})">{{this.topic}}</a>
            {{/if}}
            {{/each}}
          </div>
        </div>
        <div class="tabs">
        {{#each endpoints}}
        {{#if this.maxPages}}
        <div id="tab-{{@index}}" data-infinite-distance="50" class="page-content infinite-scroll-content tab{{#if @first}} tab-active{{/if}}" @infinite="loadMore">
            <div class="list">
              <ul>
                {{#each @root.stories}}
                <li>
                <a href="/storie/{{id}}/" class="item-link">
                  <div class="item-content">
                    <div class="item-inner">
                      <div class="item-title">
                      {{title}} ({{domain}})
                      <div class="item-footer">{{points}} {{pluralize points single="point" multiple="points"}} {{#if user}} by {{user}} {{/if}}{{time_ago}}</div>
                      </div>
                      {{#if comments_count}}<div class="item-after"><span class="badge">{{comments_count}}</span></div>{{/if}}
                    </div>
                  </div>
                </a>
                </li>
              {{/each}}
              </ul>
            </div>
            {{#if @root.hasMoreItems}}
            <div class="preloader infinite-scroll-preloader"></div>
            {{/if}}
          </div>
      {{/if}}
      {{/each}}
        </div>
</template>
      <script>
        return {
          data: function () {
            var self = this;
            var app = self.$app;
            var endpoints = app.data.api.endpoints;
            var endpoint = endpoints[0];
            return {
              endpoints: endpoints,
              endpoint : endpoint,
              allowInfinite: true,
              hasMoreItems: true,
              lastPage: 1,
              stories: [],
              indexTopic: 0
            }
          },
          methods: {
            fetchStories() {
                var self = this;
                var app = self.$app;
                var url = self.endpoint.url.substring(0, self.endpoint.url.lastIndexOf('/')+1);
                app.request.json(url + self.lastPage + '.json', (items) => {
                    var stories = self.stories.concat(items);
                    self.$setState({
                        stories: stories,
                        lastPage: self.lastPage + 1
                    })
                })
            },
            loadMore() {
                var self = this;
        
                var $ = self.$$;
                if (!self.allowInfinite) return;
                self.allowInfinite = false;

                if (self.lastPage > self.endpoint.maxPages) {
                    self.$setState({
                        hasMoreItems: false
                    })
                    return
                }

                self.fetchStories()
                self.allowInfinite = true;
            },
            selectTopic(index) {
              var self = this;

              self.$setState({
                endpoint: self.endpoints[index],
                stories: [],
                lastPage: 1,
                allowInfinite: true,
                hasMoreItems: true,
                indexTopic: index
              });
              
              self.fetchStories();
            },
          },
          on: {
            pageInit() {
                var self = this;
                self.fetchStories();
            }, 
          }
        }
      </script><commit_msg>unnecessary searchbar<commit_after><template>
      <div class="page" data-name="stories">
        <div class="navbar">
          <div class="navbar-inner">
            <div class="title sliding">HackerNews7</div>
          </div>
        </div>
        <div class="toolbar tabbar">
          <div class="toolbar-inner">
           {{#each endpoints}}
           {{#if this.maxPages}}
            <a href="#tab-{{@index}}" class="tab-link{{#if @first}} tab-link-active{{/if}}" @click="selectTopic({{@index}})">{{this.topic}}</a>
            {{/if}}
            {{/each}}
          </div>
        </div>
        <div class="tabs">
        {{#each endpoints}}
        {{#if this.maxPages}}
        <div id="tab-{{@index}}" data-infinite-distance="50" class="page-content infinite-scroll-content tab{{#if @first}} tab-active{{/if}}" @infinite="loadMore">
            <div class="list">
              <ul>
                {{#each @root.stories}}
                <li>
                <a href="/storie/{{id}}/" class="item-link">
                  <div class="item-content">
                    <div class="item-inner">
                      <div class="item-title">
                      {{title}} ({{domain}})
                      <div class="item-footer">{{points}} {{pluralize points single="point" multiple="points"}} {{#if user}} by {{user}} {{/if}}{{time_ago}}</div>
                      </div>
                      {{#if comments_count}}<div class="item-after"><span class="badge">{{comments_count}}</span></div>{{/if}}
                    </div>
                  </div>
                </a>
                </li>
              {{/each}}
              </ul>
            </div>
            {{#if @root.hasMoreItems}}
            <div class="preloader infinite-scroll-preloader"></div>
            {{/if}}
          </div>
      {{/if}}
      {{/each}}
        </div>
</template>
      <script>
        return {
          data: function () {
            var self = this;
            var app = self.$app;
            var endpoints = app.data.api.endpoints;
            var endpoint = endpoints[0];
            return {
              endpoints: endpoints,
              endpoint : endpoint,
              allowInfinite: true,
              hasMoreItems: true,
              lastPage: 1,
              stories: [],
              indexTopic: 0
            }
          },
          methods: {
            fetchStories() {
                var self = this;
                var app = self.$app;
                var url = self.endpoint.url.substring(0, self.endpoint.url.lastIndexOf('/')+1);
                app.request.json(url + self.lastPage + '.json', (items) => {
                    var stories = self.stories.concat(items);
                    self.$setState({
                        stories: stories,
                        lastPage: self.lastPage + 1
                    })
                })
            },
            loadMore() {
                var self = this;
        
                var $ = self.$$;
                if (!self.allowInfinite) return;
                self.allowInfinite = false;

                if (self.lastPage > self.endpoint.maxPages) {
                    self.$setState({
                        hasMoreItems: false
                    })
                    return
                }

                self.fetchStories()
                self.allowInfinite = true;
            },
            selectTopic(index) {
              var self = this;

              self.$setState({
                endpoint: self.endpoints[index],
                stories: [],
                lastPage: 1,
                allowInfinite: true,
                hasMoreItems: true,
                indexTopic: index
              });
              
              self.fetchStories();
            },
          },
          on: {
            pageInit() {
                var self = this;
                self.fetchStories();
            }, 
          }
        }
      </script>
{'fraction_non_alphanumeric': 0.14550296574264618, 'fraction_numerical': 0.0025420651252874953, 'mean_word_length': 1.127188465499485, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 101, 'https://': 0, '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': '3912550', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2097, 'n_words': 413}