<commit_before><?php
use RT\Core\FlashMessage;

function hasAudio($url) {
    return isset($url) && strlen($url)>0;
}

$readAction = $asParallel ? "TextController@readParallel" : "TextController@read";

?>
<!DOCTYPE html>
<html>
    <head>
        <title>{{{ $text->title }}}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8"> 
        <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
        {{ HTML::style('css/common.css') }}
        @if(empty($css))
            {{ HTML::style('css/reading.css') }}
        @else
        <style type="text/css">
            {{{ $css }}}
        </style>
        @endif
        {{ HTML::style('css/blue.monday/jplayer.blue.monday.css') }}
        {{ HTML::style('css/bootstrap.css') }}
        
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        {{ HTML::script('js/bootstrap.js') }}
        {{ HTML::script('js/jPlayer/jquery.jplayer.min.js') }}
        {{ HTML::script('js/simplemodal/jquery.simplemodal.1.4.4.min.js') }}
        {{ HTML::script('js/reading/state.js') }}
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <ul class="nav nav-pills">
                        <li><a href="{{ action('AccountController@index') }}">My account</a></li>
                        <li><a href="{{ action('LanguageController@index') }}">Languages</a></li>
                        <li><a href="{{ action('TextController@index') }}">Texts</a></li>
                        <li><a href="{{ action('TermController@index') }}">Terms</a></li>
                        <li><a href="{{ action('GroupController@index') }}">My Groups</a></li>
                        <li><a href="{{ action('GroupController@findGroups') }}">Public Groups</a></li>
                        
                        @if($nextId!=null)
                        <li class="pull-right">
                            <a href="{{ action($readAction, array($groupId, $nextId)) }}">
                                next
                            </a>
                        </li>
                        @endif
                        <li style="margin-top: 2px;" class="pull-right">
                            <div class="btn-group">
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                    more options for this text&nbsp;<span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a href="{{ action("GroupController@texts", array($groupId)) }}">back to group</a>
                                        <a href="{{ action("GroupController@read", array($groupId, $text->id)) }}">read single mode</a>
                                        @if($text->l2_id!=null)
                                            <a href="{{ action("GroupController@readParallel", array($groupId, $text->id)) }}">read in parallel</a>
                                        @endif
                                        <a href="{{ action("GroupController@downloadPdf", array($groupId, $text->id)) }}">download as PDF</a>
                                        @if($nextId!=null)
                                            <a href="{{ action("GroupController@read", $nextId) }}">next text</a>
                                        @endif
                                        @if($previousId!=null)
                                            <a href="{{ action("GroupController@read", $previousId) }}">previous text</a>
                                        @endif
                                        <a href="#stats" onclick="$('#stats').show();">go to statistics</a>
                                        @if(hasAudio($text->audioUrl))
                                            <a href="#" onclick="toggleAudio(); return false;">show/hide audio</a>
                                        @endif
                                    </li>
                                </ul>
                            </div>
                        </li>
                        @if($previousId!=null)
                        <li class="pull-right">
                            <a href="{{ action($readAction, array($groupId, $previousId)) }}">
                                previous
                            </a>
                        </li>
                        @endif
                    </ul>
                </div>
            </div>
        </div>
        
        <div id="dictionary-content" style="display: none; height:90%;">
            <iframe id="dictionaryiframe" width="100%" height="100%" scrolling="auto">
            </iframe>
        </div>

        <div id="readingareaouter">
            <div id="readingareainner">
                {{ $parsed }}
            </div>
            <div style="background-color: #fff; padding-left:15px;">
                <div class="clr50"></div>
                @if($previousId!=null)
                    <a href="{{ action($readAction, array($groupId, $previousId)) }}" class="btn btn-default">previous text</a>
                @endif
                @if($nextId!=null)
                    <a href="{{ action($readAction, array($groupId, $nextId)) }}" class="btn btn-default">next text</a>
                @endif
                <div class="clr10"></div>
                <button type="button" id="btnMarkRemainingAsKnown" class="btn btn-default">mark the remaining words as known</button>
                <div class="clr10"></div>
                <div id="markRemainingAsKnownProgress" class="alert alert-block" style="display: none"></div>
                <div class="clr100"></div>
            </div>
        </div>
        <div id="textModal" style="display: none;">
            <input type="hidden" id="termId" value=""/>
            <div class="row">
                <div class="col-sm-6"><strong><span id="currentWord"></span></strong></div>
                <div class="col-sm-6">
                    <ul class="states">
                        <li class="pull-right"><a id="textModalCloseLink" href="#" onclick="return false;">close</a></li>
                        <li class="pull-right"><a id="increaseWord" href="#" onclick="return false;">increase</a></li>
                        <li class="pull-right"><a id="decreaseWord" href="#" onclick="return false;">decrease</a></li>
                    </ul>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-9"><commit_msg>Mark all as known confirmation, correct CSS classes<commit_after><?php
use RT\Core\FlashMessage;

function hasAudio($url) {
    return isset($url) && strlen($url)>0;
}

$readAction = $asParallel ? "TextController@readParallel" : "TextController@read";

?>
<!DOCTYPE html>
<html>
    <head>
        <title>{{{ $text->title }}}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8"> 
        <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
        {{ HTML::style('css/common.css') }}
        @if(empty($css))
            {{ HTML::style('css/reading.css') }}
        @else
        <style type="text/css">
            {{{ $css }}}
        </style>
        @endif
        {{ HTML::style('css/blue.monday/jplayer.blue.monday.css') }}
        {{ HTML::style('css/bootstrap.css') }}
        
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        {{ HTML::script('js/bootstrap.js') }}
        {{ HTML::script('js/jPlayer/jquery.jplayer.min.js') }}
        {{ HTML::script('js/simplemodal/jquery.simplemodal.1.4.4.min.js') }}
        {{ HTML::script('js/reading/state.js') }}
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <ul class="nav nav-pills">
                        <li><a href="{{ action('AccountController@index') }}">My account</a></li>
                        <li><a href="{{ action('LanguageController@index') }}">Languages</a></li>
                        <li><a href="{{ action('TextController@index') }}">Texts</a></li>
                        <li><a href="{{ action('TermController@index') }}">Terms</a></li>
                        <li><a href="{{ action('GroupController@index') }}">My Groups</a></li>
                        <li><a href="{{ action('GroupController@findGroups') }}">Public Groups</a></li>
                        
                        @if($nextId!=null)
                        <li class="pull-right">
                            <a href="{{ action($readAction, array($groupId, $nextId)) }}">
                                next
                            </a>
                        </li>
                        @endif
                        <li style="margin-top: 2px;" class="pull-right">
                            <div class="btn-group">
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                    more options for this text&nbsp;<span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a href="{{ action("GroupController@texts", array($groupId)) }}">back to group</a>
                                        <a href="{{ action("GroupController@read", array($groupId, $text->id)) }}">read single mode</a>
                                        @if($text->l2_id!=null)
                                            <a href="{{ action("GroupController@readParallel", array($groupId, $text->id)) }}">read in parallel</a>
                                        @endif
                                        <a href="{{ action("GroupController@downloadPdf", array($groupId, $text->id)) }}">download as PDF</a>
                                        @if($nextId!=null)
                                            <a href="{{ action("GroupController@read", $nextId) }}">next text</a>
                                        @endif
                                        @if($previousId!=null)
                                            <a href="{{ action("GroupController@read", $previousId) }}">previous text</a>
                                        @endif
                                        <a href="#stats" onclick="$('#stats').show();">go to statistics</a>
                                        @if(hasAudio($text->audioUrl))
                                            <a href="#" onclick="toggleAudio(); return false;">show/hide audio</a>
                                        @endif
                                    </li>
                                </ul>
                            </div>
                        </li>
                        @if($previousId!=null)
                        <li class="pull-right">
                            <a href="{{ action($readAction, array($groupId, $previousId)) }}">
                                previous
                            </a>
                        </li>
                        @endif
                    </ul>
                </div>
            </div>
        </div>
        
        <div id="dictionary-content" style="display: none; height:90%;">
            <iframe id="dictionaryiframe" width="100%" height="100%" scrolling="auto">
            </iframe>
        </div>

        <div id="readingareaouter">
            <div id="readingareainner">
                {{ $parsed }}
            </div>
            <div style="background-color: #fff; padding-left:15px;">
                <div class="clr50"></div>
                @if($previousId!=null)
                    <a href="{{ action($readAction, array($groupId, $previousId)) }}" class="btn btn-default">previous text</a>
                @endif
                @if($nextId!=null)
                    <a href="{{ action($readAction, array($groupId, $nextId)) }}" class="btn btn-default">next text</a>
                @endif
                <div class="clr10"></div>
                <button type="button" id="btnMarkRemainingAsKnown" class="btn btn-default">mark the remaining words as known</button>
                <div class="clr10"></div>
                <div id="markRemainingAsKnownProgress" class="alert alert-block" style="width:98%; display: none"></div>
                <div class="clr100"></div>
            </div>
        </div>
        <div id="textModal" style="display: none;">
            <input type="hidden" id="termId" value=""/>
            <div class="row">
                <div class="col-sm-6"><strong><span id="currentWord"></span></strong></div>
                <div class="col-sm-6">
                    <ul class="states">
                        <li class="pull-right"><a id="textModalCloseLink" href="#" onclick="return false;">close</a></li>
                        <li class="pull-right"><a id="increaseWord" href="#" onclick="return false;">increase</a></li>
                        <li class="pull-right"><a id="decreaseWord" href="#" onclick="return false;">decrease</a></li>
                    </ul>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-9">
{'fraction_non_alphanumeric': 0.16586874861898798, 'fraction_numerical': 0.005450394048758931, 'mean_word_length': 1.344672768088413, 'pattern_counts': {'":': 0, '<': 277, '<?xml version=': 0, '>': 291, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 62, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7463114', 'n_tokens_mistral': 3513, 'n_tokens_neox': 3299, 'n_words': 625}