<commit_before>import { DataService } from './../../shared/dataService/data-service.service';
import { Component, OnInit } from '@angular/core';

// declare var angular: any;
declare var $;

@Component({
    selector: 'app-tools',
    templateUrl: './tools.component.html',
    styleUrls: ['./tools.component.scss']
})
export class ToolsComponent implements OnInit {

    private tools_list;
    private tools_detail_list = [];

    constructor(private datasvcHww: DataService) {
    }

    ngOnInit() {
        // how-we-work-tools = 54
        // fetch the title & thumb of tools
        this.datasvcHww.getData("54").subscribe(value => {
            // console.log(this.tools_list);
            this.tools_list = JSON.parse(value.text());
        });

        // how-we-work-tools-detail-version = 208
        this.datasvcHww.getData("208").subscribe(value => {
            var jsdata = JSON.parse(value.text());
            // parsing raw html into param
            jsdata['post_stream']['posts'].forEach(data =>{
                var post = {};
                // var dom = angular.element(data);
                // var dom = $(data["cooked"]);
                // post['title'] = dom.find("h4").text();
                // post['text'] = dom.find("p").html();
                // post['img'] = dom.find("img").attr("src");
                var dom = (new DOMParser()).parseFromString(data["cooked"], "text/html");
                post['title'] = dom.querySelector("h4").innerText;
                post['text'] = dom.querySelector("p").innerHTML;
                post['img'] = dom.querySelector("img") && dom.querySelector("img").src || "/assets/img/placeholder-1000x518.png";
                post['link'] = dom.querySelector("aside header a") && dom.querySelector("aside header a").toString();
                console.log(dom);
                this.tools_detail_list.push(post);
            });
            // this.tools_detail_list['post_stream']['posts'][0]['cooked']

            // console.log(this.tools_detail_list);
        });

    }

}
<commit_msg>update tools page<commit_after>import { DataService } from './../../shared/dataService/data-service.service';
import { Component, OnInit } from '@angular/core';

// declare var angular: any;
declare var $;

@Component({
    selector: 'app-tools',
    templateUrl: './tools.component.html',
    styleUrls: ['./tools.component.scss']
})
export class ToolsComponent implements OnInit {

    private tools_list;
    private tools_detail_list = [];

    constructor(private datasvcHww: DataService) {
    }

    ngOnInit() {
        // how-we-work-tools = 54
        // fetch the title & thumb of tools
        this.datasvcHww.getData("54").subscribe(value => {
            // console.log(this.tools_list);
            this.tools_list = JSON.parse(value.text());
        });

        // how-we-work-tools-detail-version = 208
        this.datasvcHww.getData("208").subscribe(value => {
            var jsdata = JSON.parse(value.text());
            // parsing raw html into param
            jsdata['post_stream']['posts'].forEach(data =>{
                var post = {};
                // var dom = angular.element(data["cooked"]);
                // var dom = $(data["cooked"]);
                // post['title'] = dom.find("h4").text();
                // post['text'] = dom.find("p").html();
                // post['img'] = dom.find("img").attr("src");
                var dom = (new DOMParser()).parseFromString(data["cooked"], "text/html");
                post['title'] = dom.querySelector("h4").innerText;
                post['text'] = dom.querySelector("p").innerHTML;
                post['img'] = dom.querySelector("img") && dom.querySelector("img").src || "/assets/img/placeholder-1000x518.png";
                post['link'] = dom.querySelector("aside header a") && dom.querySelector("aside header a").outerHTML;
                console.log(dom);
                this.tools_detail_list.push(post);
            });
            // this.tools_detail_list['post_stream']['posts'][0]['cooked']

            // console.log(this.tools_detail_list);
        });

    }

}

{'fraction_non_alphanumeric': 0.17429193899782136, 'fraction_numerical': 0.009682885499878963, 'mean_word_length': 2.1374335611237663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3944665', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1151, 'n_words': 196}