<commit_before>﻿require("./res/Carousel.less");

var $ = require("jquery");
var _ = require("lodash");
var classNames = require("classnames");
var React = require("react");

/**
 * 幻灯片指示器。
 */
var CarouselIndicator = React.createClass(
{
    render: function ()
    {
        var indicators = [];
        var length = this.props.length;
        if (length > 0)
        {
            indicators.push(<li className="active" data-target={this.props.target} data-slide-to={0} />);
            for (var i = 1; i < length; i++)
            {
                indicators.push(<li data-target={this.props.target} data-slide-to={i} />);
            }
        }

        // 少于1页时隐藏指示器。
        var classes = classNames(
            "CarouselIndicator", "carousel-indicators",
            {
                "hide": (length <= 1),
            }
        );
        return (
            <ol className={classes}>
                {indicators}
            </ol>
        );
    }
});

/**
 * 幻灯片内容。
 */
var CarouselInner = React.createClass(
{
    handleClick: function (p_storyId, e)
    {
        if (_.isFunction(this.props.onClick))
        {
            this.props.onClick(p_storyId);
        }
    },

    render: function ()
    {
        var that = this;
        var rows = _.map(this.props.data, function (value, key)
        {
            return (
                <div className={key == 0 ? "item active" : "item"}>
                    <a href={"http://daily.zhihu.com/story/" + value.id}
                       target="_blank"
                       data-target={value.id}
                       onClick={that.handleClick.bind(this, value.id)}>
                        <div className="carousel-picture" style={{backgroundImage: "url(" + value.image + ")"}} />
                    </a>
                    <div className="carousel-caption">
                        <h3>{value.title}</h3>
                    </div>
                </div>
            );
        });<commit_msg>update event param<commit_after>﻿require("./res/Carousel.less");

var $ = require("jquery");
var _ = require("lodash");
var classNames = require("classnames");
var React = require("react");

/**
 * 幻灯片指示器。
 */
var CarouselIndicator = React.createClass(
{
    render: function ()
    {
        var indicators = [];
        var length = this.props.length;
        if (length > 0)
        {
            indicators.push(<li className="active" data-target={this.props.target} data-slide-to={0} />);
            for (var i = 1; i < length; i++)
            {
                indicators.push(<li data-target={this.props.target} data-slide-to={i} />);
            }
        }

        // 少于1页时隐藏指示器。
        var classes = classNames(
            "CarouselIndicator", "carousel-indicators",
            {
                "hide": (length <= 1),
            }
        );
        return (
            <ol className={classes}>
                {indicators}
            </ol>
        );
    }
});

/**
 * 幻灯片内容。
 */
var CarouselInner = React.createClass(
{
    handleClick: function (p_storyId, e)
    {
        if (_.isFunction(this.props.onClick))
        {
            this.props.onClick(
            {
                id: p_storyId
            });
        }
    },

    render: function ()
    {
        var that = this;
        var rows = _.map(this.props.data, function (value, key)
        {
            return (
                <div className={key == 0 ? "item active" : "item"}>
                    <a href={"http://daily.zhihu.com/story/" + value.id}
                       target="_blank"
                       data-target={value.id}
                       onClick={that.handleClick.bind(this, value.id)}>
                        <div className="carousel-picture" style={{backgroundImage: "url(" + value.image + ")"}} />
                    </a>
                    <div className="carousel-caption">
                        <h3>{value.title}</h3>
                    </div>
                </div>
            );
        });
{'fraction_non_alphanumeric': 0.15170511534603812, 'fraction_numerical': 0.004012036108324975, 'mean_word_length': 1.375818939845146, 'pattern_counts': {'":': 2, '<': 33, '<?xml version=': 0, '>': 31, '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': '7581771', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1179, 'n_words': 204}