@php

$admin = 0;
$isManagerOrHigher = false;
$isDeveloperOrHigher = false;
$isModOrHigher = false;
$mod = 0;
$council = 0;
if($myUser != null){
    $admin = $myUser->isAdmin();
    $isManagerOrHigher = $myUser->isManager(true);
    $isDeveloperOrHigher = $myUser->isDeveloper(true);
    $isModOrHigher = $myUser->isMod(true);
    $mod = $myUser->isMod();
    $council = $myUser->isCouncil();
}

$time = 0;
if($council == 1){
    $time = floor(microtime(true) * 1000);
}





@endphp
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Doxbin - {{$title}}</title>
    <meta name="description" content="{{$title}} - Paste created by {{ $created_by == null || $created_by == '[deleted]' ? 'Anonymous' : $created_by->username }} on {{ $date }}">

    @if($paste->unlisted)
        <meta name="robots" content="noindex">
    @endif

    <link rel="stylesheet" href="{{ asset('/legacy/app.css?r=46') }}">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
    <link href="/legacy/css/show.css?r=44" rel="stylesheet">
    <link href="{{ asset('/legacy/google-code-prettify/tomorrow-night.css') }}" rel="stylesheet">
    <link href="{{ asset('/legacy/toastr/toastr.min.css') }}" rel="stylesheet">
    <script src="{{ asset('/legacy/custom.modernizr.js') }}"></script>
    <script src="{{ asset('/legacy/jquery.min.js') }}"></script>
    <link href="/files/doxbin.css?r=32" rel="stylesheet">

	<style>
    select, option{
        line-height: 1.2;
        color: white;
        background: #282828;
        border: 0;
        border-radius: 2px;
        display: inline-block;
        -webkit-font-smoothing: antialiased;
        outline: none;
        padding: 7px 5px;
        width: 50%;
        /* margin-bottom: 10px; */
    }
    .right{
        text-align: right;
        width: 100%;
    }
    select, option{
        font-size: 100%;
    }
    input#paste-password:disabled{
        color: rgb(190, 190, 190);
    }
    pre a:hover{
        text-decoration: underline;
    }
    @font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url(https://example.com/MaterialIcons-Regular.eot); /* For IE6-8 */
    src: local('Material Icons'),
        local('MaterialIcons-Regular'),
        url(https://{{$currentDomain}}/MaterialIcons-Regular.woff2) format('woff2'),
        url(https://{{$currentDomain}}/MaterialIcons-Regular.woff) format('woff'),
        url(https://{{$currentDomain}}/MaterialIcons-Regular.ttf) format('truetype');
    }


    .material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  /* Preferred icon size */
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;

  /* Support for all WebKit browsers. */
  -webkit-font-smoothing: antialiased;
  /* Support for Safari and Chrome. */
  text-rendering: optimizeLegibility;

  /* Support for Firefox. */
  -moz-osx-font-smoothing: grayscale;

  /* Support for IE. */
  font-feature-settings: 'liga';
}


    .like-dislike-paste a, .like-dislike-paste span{
        display: inline-block;
    }
    .like-dislike-paste a span.material-icons, .like-dislike-paste span span.material-icons{
        font-size: 17px;
        margin-right: 3px;
    }
    .like-dislike-paste a span.paste-likes, .like-dislike-paste a span.paste-dislikes{
        font-size: 13px;
    }



    .like-dislike-comment a, .like-dislike-comment span{
        display: inline-block;
    }
    .like-dislike-comment a span.material-icons, .like-dislike-comment span span.material-icons{
        font-size: 15px;
        margin-right: 2px;
    }
    .like-dislike-comment a span.comment-likes, .like-dislike-comment a span.comment-dislikes{
        font-size: 11px;
    }



    #like-paste, #dislike-paste, a.like-comment, a.dislike-comment{
        color: white;
    }
    #like-paste:hover, #dislike-paste:hover, .like-comment:hover, div.like-dislike-comment .dislike-comment:hover{
        color: rgb(161, 161, 161) !important;
    }
    a.button{
        font-size: 14px !important;
        text-transform: none !important;
    }
    </style>
	<script>
	var doxid = {{ $id }};
    var cnum = 10;
    var banned = {{ $paste->banned }};
    var uName = "{{ ($myUser != null ? $myUser->username : '') }}";
    var uAdmin = {{ $admin ? 1 : 0 }};
    var chc = {{ !is_null($myUser) && $myUser->isDeveloper(true) == 1 ? 1 : 0 }};

// @if($isDeveloperOrHigher)

    var reasonForced = {{ $myUser->admin == 0 && $myUser->isDeveloper(true) == 0 ? 1 : 0}};

// @endif

</script>
    @include('_favicons')
</head>
<body class="bin" style="overflow-x: hidden;">
    <div class="wrapper">
        <div class="table">

        @include('_sidebar_toggle')

    <div class="sidebar">
        @include('_logo')
        <div class="right">
            @if($myUser != null && ($paste->created_by == $myUser->id && $myUser->role >= 2|| $isManagerOrHigher)) {{-- Allow Manager+ to edit other's pastes. Reiko, Mar 15th 2024 --}}
            <a href="#" style="color: rgb(184, 0, 0);float: right;" id="paste-manage"><i class="material-icons" style="right: 10px;top:none;">settings</i></a>
            @endif
        </div>

        @if(!is_null($myUser) && $isDeveloperOrHigher)
            @if(!is_null($staff_notes) && $staff_notes->count() > 0)
                <a href="#" class="btn staff-notes staff-notes-btn">View {{ $staff_notes->count() }} staff {{ str_plural('note', $staff_notes->count()) }}</a>
            @else
                <a href="#" class="btn staff-notes-lighter staff-notes-btn">Add Staff Note</a>
            @endif
        @endif
        @if(!is_null($myUser) && $myUser->isCouncil(true))
        <div style="display: flex; margin-top: 5px;">
            <div style="flex: 1;margin-right: 3px;">
                <a href="#" class="btn staff-notes-lighter staff-previous-btn"><span class="material-icons" style="vertical-align:middle;font-size: 16px;margin-right: 5px;margin-bottom:1px;">arrow_back</span>Previous</a>
            </div>
            <div style="flex: 1;margin-left: 3px;">
                <a href="#" class="btn staff-notes-lighter staff-next-btn">Next<span class="material-icons" style="vertical-align:middle;font-size: 16px;margin-left:5px;margin-bottom:1px;">arrow_forward</span></a>
            </div>
        </div>
        @endif

        @if($isDeveloperOrHigher)
        <div id="staffnotes" style="display: none;">
            <div class="options" style="border-bottom: 2px solid #753b3b;">
                <h3 style="margin: 5px 0 0 0; text-align: center;">Staff Notes</h3>
                <p style="margin: 0;text-align: center;">Viewable by all mods, managers and admins</p><br>
                <ul>
                <p id="staff-error-msg" style="color: red; padding: 0px; text-align: center; margin: 0;"></p>
                <li><textarea id="note" style="width: 100%;max-width: 100%;" placeholder="Note..."></textarea></li>
                <li><a class="btn" id="create-note" style="cursor: pointer;">Add Note</a></li>
                </ul>
                <div class="comment-container">
                    <div class="b-comments staff-notes-cont">
                @if($staff_notes->count() == 0)
                    <p style="text-align: center;">No notes</p>
                @endif
                @foreach ($staff_notes as $note)


                <div class="b-comments b-comment staff-note" style="padding-left: 10px; position: relative;" id="note{{$note->id}}">
                    <b>
                    @php
                    $commenter = App\User::find($note->uid);
                    @endphp
                    @if (!is_null($commenter))
                        {!! $commenter->getNameHtml(true) !!}
                    @else
                        [deleted]
                    @endif
                    </b> - <p title="{{ date('M jS, Y - g:iA', floor($note->date / 1000)) }}" style="display: inline;">
                    @php
                    echo age($note->date)
                    @endphp</p>
                    @if($isManagerOrHigher == 1)
                    <a href="#" data-nid="{{ $note->id }}" class="deletenote hidecomment">Delete</a>
                    @endif
                    <br>
                    <div class="b-content">{{$note->comment}}</div>
                    <br>
                </div>


                @endforeach
                    </div>
                </div>
            </div>
        </div>
        @endif
        <div class="options" style="padding-top:3px;">
            <div class="paste-properties">
            @if($paste->pinned)
            <span><i class="material-icons">push_pin</i><span>Pinned</span></span><br>
            @endif
            @if($paste->password != null)
            <span><i class="material-icons">password</i><span>Password protected</span></span><br>
            @endif
            @if($paste->private)
            <span><i class="material-icons">lock</i><span>Private</span></span><br>
            @endif
            @if($paste->unlisted)
            <span><i class="material-icons">visibility_off</i><span>Unlisted</span></span><br>
            @endif
            </div>

            @if ($isManagerOrHigher == 1) <p><span style="font-weight:bold; color: white;">ID:</span> <span style="float: right;">{{$id}}</span></p>@endif
            <p><span style="font-weight:bold; color: white;">Title:</span><span style="float: right;">{{$title}}</span></p>
            <p><span style="font-weight:bold; color: white;">Created:</span><span style="float: right;">{{$date}}</span></p>

            <p><span style="font-weight:bold; color: white;">Created by:</span><span style="float: right;">
            @if ($created_by == null)
                Anonymous
            @elseif ($created_by == "[deleted]")
                [deleted]
            @else
                {!! $created_by->getNameHtml(true) !!}
            @endif

            @if ($isManagerOrHigher == 1) - <a id="edit-owner-btn" class="cmt-name-link" href="#">(Change)</a>@endif
            </span>
            </p>
            <p><span style="font-weight:bold; color: white;">Views:</span> <span style="float: right;">@if ($isManagerOrHigher == 1)<a id="edit-views-btn" class="cmt-name-link" href="#">{{ number_format($views) }}</a>@else{{ number_format($views) }}@endif</span></p>
            @if($paste->disable_cmts == 0)
                <p><span style="font-weight:bold; color: white;">Comments:</span> <span style="float: right;">{{ $paste->comments }}</span></p>
            @endif
            @if($last_edited != null)
            <p><span style="font-weight:bold; color: white;">Edited at:</span> <span style="float: right;">{{ date('M jS, Y', floor($last_edited / 1000)) }}</span></p>
            @endif
            @if(!is_null($myUser) && $myUser->id != $paste->created_by)
            <div class="like-dislike-paste" style="margin-top: 10px;">
                <a href="javascript:void(0)" id="like-paste"><span class="material-icons">thumb_up</span><span id="paste-likes">{{ $paste->likes}}</span></a>

                <a href="javascript:void(0)" id="dislike-paste"><span class="material-icons">thumb_down</span><span id="paste-dislikes">{{ $paste->dislikes}}</span></a>
            </div>
            @else
            <div class="like-dislike-paste" style="margin-top: 10px;">
                <span id="like-paste"><span class="material-icons">thumb_up</span><span id="paste-likes">{{ $paste->likes}}</span></span>

                <span id="dislike-paste"><span class="material-icons">thumb_down</span><span id="paste-dislikes">{{ $paste->dislikes}}</span></span>
            </div>

            @endif
        </div>

        @if(!is_null($myUser) && $myUser->role >= 2 && ($paste->created_by == $myUser->id || $isManagerOrHigher))
        <div id="paste-manager" style="display: none;">
            @if($myUser->role >= 3)
            <div class="options">
                <p style="font-size: 18px;font-weight:bold;margin-top:0;">Paste Password</p>
                <p style="margin-top: 5px;">Paste is only viewable by people with the password</p>
                <div id="password-options" style="float:right;text-align: center;{{$paste->password == null ? 'display: none;' : ''}}"><a href="#" id="edit-password">Edit</a> - <a href="#" id="remove-password">Remove</a></div>
                <input type="text" id="paste-password" style="margin: 5px 0;"@if($paste->password != null) value="{{$paste->password}}" disabled @endif placeholder="Password...">
                <a class="btn" id="paste-password-submit" href="#"@if($paste->password != null) style="display: none;" @endif>Password protect paste</a>
            </div>
            @endif
            {{-- This allows for all staff (hence the true statement for the lowest staff rank) to have these options. this does not effect pastes not owned by staff. Reiko, Mar 15th --}}
            @if($myUser->role >= 2 || $myUser->isCouncil(true))
            <div class="options">
                @if (!is_null($created_by) && $created_by != "[deleted]" && !is_null($myUser) && $created_by->id == $myUser->id && $myUser->role >= 2 && $myUser->role <= 95 || $myUser->isCouncil(true)) {{-- changed isAdmin to isCouncil for the same reason. Reiko, Mar 15th  --}}
                    <select name="vis" id="vis" style="width: 100%;">
                        <option disabled selected value="0">Paste Visibility</option>
                        <option value="1">{{ !$paste->unlisted && !$paste->private ? '> Public <' : 'Public'}}</option>
                        <option value="2">{{ $paste->unlisted && !$paste->private ? '> Unlisted <' : 'Unlisted'}}</option>
                        <option value="3">{{ !$paste->unlisted && $paste->private ? '> Private <' : 'Private'}}</option>
                    </select>
                @endif
            </div>
            @endif
            @if($myUser->isAdmin())
            <div class="admin-options">
                <p style="font-size: 18px;font-weight:bold;margin-top:0;">Blacklist</p>
                <p style="margin-top: 5px;">Blacklist the paste</p>
                <input type="text" id="alias" style="margin: 5px 0;" placeholder="Alias">
                <input type="text" id="email" style="margin: 5px 0;" placeholder="Email">
                <textarea id="words" style="margin: 5px 0;width: 100%;max-width: 100%;" placeholder="Blacklisted words (1 per line)"></textarea>
                <textarea id="info" style="margin: 5px 0 10px;width: 100%;max-width: 100%;" placeholder="Contact info"></textarea>
                <a class="btn" id="blacklist-add" href="#">Add to Blacklist</a>
            </div>
            @endif
        </div>
        @endif
        @if($blacklisted == 1 && $admin == 1)
        <div class="options">
            <p style="margin: 0 0 10px 0; font-weight: bold; font-size: 14px;text-align:center;text-decoration:underline;color: white;">Blacklisted Paste</p>
            <table style="width:100%;">
            <tr>
                <th style="text-align: left;">Alias</th>
                <th style="text-align: left;">Words</th>
            </tr>
@foreach($tableoutput as $output)
            <tr>
    @if(!$output->inBlacklist) {{-- not in new blacklst--}}
                <td><p style="color: #ff6969;margin-top:3px;margin-left:5px;">N/A</p></td>
                <td><p style="color: #ff6969;margin-top: 3px;margin-left: 5px">{{$output->words}}</p></td>
    @else
                <td><p style="color: #ff6969;margin-top: 3px;margin-left: 5px">{{$output->alias}}</p></td>
                <td>
                @foreach($output->words as $word)
                    @if(in_array($word->blid, $contains))
                    <p style="color: #ff6969;margin-top: 3px;margin-left: 5px;"><u>{{$word->word}}</u></p>
                    @else
                    <p style="color: #ff6969;margin-top: 3px;margin-left: 5px;">{{$word->word}}</p>
                    @endif
                @endforeach
            </td>
    @endif
            </tr>
@endforeach
            </table>
        </div>
        @endif
        @if($council == 1)
        <div class="options" style="text-align: center;">
            @if($paste->flagged == 2 && ($paste->last_edited == null || $paste->last_edited < $paste->flagdate))
                This dox was previously flagged {{ age($paste->flagdate) }} and cannot be flagged again.
            @else
            <ul class="admin-options">
                <select id="flag-dropdown" style="background: #282828;border: 0;border-radius: 2px;display: inline-block;-webkit-font-smoothing: antialiased;outline: none;padding: 7px 5px;width: 100%; color: white;">
                    <option value="" selected></option>
                @if(isset($reason))
                    <option value="{{$reason}}" style="font-style: italic;">Use council's reason</option>
                @endif
                    <option value="Insufficient info{{$paste->created_by != 0 ? ' - Read TOS' : '' }}"><i>Insufficient</i></option>
                    <option value="Contains info on a minor{{$paste->created_by != 0 ? ' - Read TOS' : '' }}"><i>Underage</i></option>
                    <option value="Spam{{$paste->created_by != 0 ? ' - Read TOS' : '' }}"><i>Spam / Irrelevant</i></option>
                    <option value="Threats{{$paste->created_by != 0 ? ' - Read TOS' : '' }}"><i>Threats</i></option> 
                    <option value="Contains explicit imagery of a minor. Do not reupload."><i>CP</i></option> {{-- New Button for council --}} 
                    <option value="Contains a lack of information. Please provide more information."><i>Lack of effort</i></option> {{-- New Button for council --}}
                    {{-- Old option has been removed as it is uneeded--}} 
                </select>
                <li id="flag-reason-box" {!! $paste->flagged == 1 ? 'style="display:none;"' : '' !!}><textarea id="flag-reason" placeholder="Reason (optional)" style="width: 100%;max-width: 100%;"></textarea></li>
                <li><a id="flag" href="#" class="btn">{{ ($paste->flagged == 1 ? 'Unflag dox' : 'Flag dox') }}</a></li>
            </ul>
            @endif
        </div>
        @endif
    {{-- This will allow the "Developer" to view the staff buttons--}}
    @if($isDeveloperOrHigher)
        <div class="options" id="staff-btns">
            <ul class="admin-options">
        @if($admin == 1)
            @if($blacklisted == 1)
                <li><a id="unblacklistdox" href="#" class="btn">Remove from Blacklist</a></li>
            @endif
        @endif
            <li id="hide-reason-box" {!! $paste->hidden == 1 ? 'style="display:none;"' : '' !!}>

@if($isDeveloperOrHigher && !is_null($created_by))
                <div id="removal-info"><input type="checkbox" id="notifyUser" val="0" style="width:auto;margin-right:3px;vertical-align:top;"><label for="notifyUser">Notify user</label></div>
@endif
{{-- @elseif($mod && !is_null($created_by))
                <div id="removal-info"><input type="hidden" id="notifyUser" val="1">User will be notified with the removal reason</div>
@endif --}}

                @include('layouts.admin.remove_paste', ['required' => false, 'paste' => $paste])
            </li>

                <li><a id="hidedox" href="#" class="btn">{{ ($hidden == 1 ? 'Unhide' : 'Hide') }}</a></li>
                <li><a id="edittoggle" href="#" class="btn">{{ ($paste->editbanned == 1 ? 'Edit Unban' : 'Edit ban') }}</a></li>
                @if($isManagerOrHigher)
                    <li><a id="pindox" href="#" class="btn">{{ ($pinned == 1 ? 'Unpin' : 'Pin') }}</a></li>
                    <li><a id="togglecmts" href="#" class="btn">{{ ($paste->disable_cmts == 1 ? 'Enable Comments' : 'Disable Comments') }}</a></li>
                    <li><a href="/edit/{{$paste->link}}" class="btn">Edit</a></li>
                @endif
	        </ul>
        </div>
    @endif
{{-- Permission issues fixed for Developer role --}}
@if($paste->hidden == 1 && !is_null($paste->hidden_by) && $isDeveloperOrHigher)
@php
$hider = App\User::find($paste->hidden_by);
if($isDeveloperOrHigher && !is_null($hider) && $hider->isAdmin()){
    $hider = null;
}
$reason = $paste->hidden_reason;
if(is_null($reason)){
    $reason = "No reason";
}

@endphp
@if(!is_null($hider))
        <div class="options" id="hidden-by">
            <p style="margin: 0;color: white; font-weight:bold;">Hidden by {!! $hider->getNameHtml(false) !!}:</p>
            <p style="margin: 0;">{{ $reason }}</p>
        </div>
@endif
@endif
        <div class="options" id="btns">
            <ul>
        @if (!is_null($created_by) && $created_by != "[deleted]" && !is_null($myUser) && $created_by->id == $myUser->id)
            @if ($edit == true)
                <li id="edit-paste-list">
                    <a class="btn green" style="cursor: not-allowed;" title="You already have a pending edit request.">Edit Paste</a>
                    <p id="edit-info" style="color: #cccccc; text-align: center;margin: 0;">You already have a pending edit request. <a class="cmt-name-link" id="cancel-edit-request" href="#">Cancel edit request</a></p>
                </li>
            @elseif ($paste->editbanned == 1)
                <li id="edit-paste-list"><a class="btn green" style="cursor: not-allowed;" title="You can't edit this paste.">Edit Paste</a>
                <p id="edit-info" style="color: #cccccc; text-align: center;margin: 0;">You can't edit this paste.</p></li>
            @else
                <li id="edit-paste-list"><a href="/edit/{{ $link }}" class="btn green">Edit Paste</a></li>
            @endif

        @endif
                <li><a href="/upload" class="btn new">New (N)</a></li>
                <li><a target="_blank" href="/upload/{{ $link }}/raw" class="btn raw">Raw (R)</a></li>

            </ul>
        </div>

		<div class="options" id="cmntsctn">
            <ul>
		@if($paste->disable_cmts == 0)
            <p id="error-msg" style="color: red; padding: 0px; text-align: center; margin: 0;"></p>
            @if ($myUser == null)
            <li><p style="width: 100%; color: #b7b7b7; margin: 0;"><b>Username:</b> Anonymous - <a class="cmt-name-link" href="/login">(Login)</a></p></li>
            @else
            <li><p style="width: 100%; color: #b7b7b7; margin: 0;"><b>Username:</b> {{ $myUser->username }} - <a class="cmt-name-link" id="logout-btn" href="#">(Logout)</a></p></li>
            @endif
            <li><textarea id="comment" placeholder="Your comment"></textarea></li>
            @include('layouts.captcha')
            <li><a class="btn raw" id="create" style="cursor: pointer;">Submit Comment</a></li>
		@else
		    <p style="text-align: center;">Comments are disabled.</p>
		@endif
                {!! csrf_field() !!}
            </ul>
	@if($paste->disable_cmts == 0)
            <div class="comment-container">
                <div class="b-comments" id="paste-comments">
@if (count($comments) > 0)
	@php
		$count = 1;
	@endphp
    @foreach ($comments as $comment)
        @if (($myUser != null && $isDeveloperOrHigher) || $comment->hidden == 0)
            @if ($count <= 10)
                <div class="b-comments b-comment" style="padding-left: 10px; position: relative;{!! $comment->hidden == 1 ? 'background-color: #421414;' : '' !!}" id="{{$comment->id}}">
                <b>
                @if ($comment->created_by != 0)
                    @php
                    $commenter = App\User::find($comment->created_by);
                    @endphp
                    @if(!is_null($commenter))
                        <a style="{!! $commenter->getNameStyle() !!}" href="/user/{{$commenter->username}}">{{$commenter->username}} {!! $commenter->role >= RoleId::DEVELOPER ? $commenter->getRankHtml() : '' !!}</a>
                    @else
                        [deleted]
                    @endif
                @else
                Anonymous <!-- change to anon when done -->
                @endif
        </b> - <p title="{{ date('M jS, Y - g:iA', floor($comment->date / 1000)) }}" style="display: inline;">
        @php
        echo age($comment->date)
        @endphp</p>
        @if($myUser != null && $myUser->isDeveloper(true))
        <a href="javascript:void(0)" onclick="hideComment(this, {{ $comment->id }})" class="hidecomment">{{ $comment->hidden == 0 ? 'Hide' : 'Show' }}</a>
        @endif
        <br>
        <div class="b-content">{{$comment->comment}}</div>
    @if($myUser != null && $myUser->admin && false)
        @if(!is_null($myUser) && $myUser->id != $comment->created_by)
        <div class="like-dislike-comment" style="position: absolute; bottom: 3px; padding-top: 10px;">
            <a href="javascript:void(0)" class="like-comment" data-id="{{ $comment->id }}"><span class="material-icons">thumb_up</span><span id="comment-likes">{{ $comment->likes}}</span></a>

            <a href="javascript:void(0)" class="dislike-comment" data-id="{{ $comment->id }}"><span class="material-icons">thumb_down</span><span id="comment-dislikes">{{ $comment->dislikes}}</span></a>
        </div>
        @else
        <div class="like-dislike-comment" style="position: absolute; bottom: 3px;">
            <span class="like-comment" data-id="{{ $comment->id }}"><span class="material-icons">thumb_up</span><span class="comment-likes">{{ $comment->likes}}</span></span>

            <span class="dislike-comment" data-id="{{ $comment->id }}"><span class="material-icons">thumb_down</span><span class="comment-dislikes">{{ $comment->dislikes}}</span></span>
        </div>

        @endif
    @endif
        <br>

    </div>
            @else
                @break
            @endif
        @endif
        @php
            if((!$admin || $myUser == null) && $comment->hidden == 1){
                $count += 1;
            }
		@endphp
	@endforeach

@endif
@if ($commentCount > 10)
	<a class="btn raw" id="more" style="cursor: pointer;">Load More Comments</a>
@endif
				</div>
			</div>
			@endif
        </div>
        <div class="options r-hide" id="tos-display">
        <p style="margin-top: 0;color: white;">Please note that all posted information is publicly available and must follow our <a href="https://{{$currentDomain}}/tos" style="text-decoration: underline;">TOS.</a></p>
        </div>

    </div>

    <div class="show-container" style="padding-left: 20px;">
<pre style="color: white; margin: 0;"> <!-- clickable links -->
{!! preg_replace("/((http|https|ftp|ftps)\:\/\/)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,13}(\:[0-9]+)?(\/[\/a-zA-Z0-9\?\=\@\_\.\-\;\'\[\]\#\!\&]*)?/", '<a href="$0" target="_blank" rel="noopener noreferrer">$0</a>', $content) !!}
</pre>
        </div>
        </div>
    </div>

    <script src="{{ asset('/legacy/mousetrap.min.js') }}"></script>
    <script src="{{ asset('/legacy/google-code-prettify/prettify.js') }}"></script>
    <script src="{{ asset('/legacy/tabby.js') }}"></script>
    <script src="{{ asset('/legacy/zclip.min.js') }}"></script>
    <script src="{{ asset('/legacy/toastr/toastr.min.js') }}"></script>
    <script src="{{ asset('/legacy/bin.js') }}"></script>
    <script src="{{ asset('/legacy/logout.js') }}"></script>
    <script src="{{ asset('/legacy/paste.js') }}"></script>
    @if($isManagerOrHigher)
    <div id="modal">
        <div id="modal-bg" class="modal-background">
        </div>
        <div class="modal-container" style="height: 220px;">
            <p style="font-size: 20px; font-weight: bold; margin-top: 0px;">View Count</p>
            <p>Edit the paste's view count.</p>
            <input id="new-view-count" type="number" value="{{ $views }}">
            <a class="button confirm" id="view-confirm" href="#">Confirm</a>
            <a style="right: 0; position: absolute; margin-right: 15px;" class="button cancel" id="view-cancel" href="#">Cancel</a>
        </div>
    </div>
    <div id="modal2">
        <div id="modal2-bg" class="modal-background">
        </div>
        <div class="modal-container">
            <p style="font-size: 20px; font-weight: bold; margin-top: 0px;">Change Owner</p>
            <p>Change the owner of the dox. Leave empty for Anonymous.</p>
            <label for="new-owner"><b>New Owner</b></label>
            <input style="margin-top: 4px; padding: 8px;" id="new-owner" type="text" value="{{ ($created_by != null && $created_by != "[deleted]" ? $created_by->username : '') }}" placeholder="Username...">
            <p id="owner-error" style="color: red; margin: 0;"></p>
            <a class="button confirm" id="owner-confirm" href="#">Confirm</a>
            <a style="right: 0; position: absolute; margin-right: 15px;" class="button cancel" id="owner-cancel" href="#">Cancel</a>
        </div>
    </div>
    @endif
    <script>
        var pastelink = "{!! urlencode($paste->link) !!}";

        var captcha = '{{ env("CAPTCHA") == "RECAPTCHA" ? "recaptcha" : (env("CAPTCHA") == "TURNSTILE" ? "turnstile" : "hcaptcha") }}';

        // @if(!is_null($myUser) && $myUser->id != $paste->created_by) ? if User != p.cb

        var liked = {{ $rate === 1 ? 1 : 0 }};
        var disliked = {{ $rate === 0 ? 1 : 0}};

        $('#like-paste').on('click', function(e){
            $.post('/api/rate-paste', {
                _token: $('input[name=_token]').val(),
                pname: '{{ $paste->link }}',
                rating: 1
            }, function(resp){
                if(resp.status == "done"){
                    if(resp.l){
                        $('#paste-likes').text(parseInt($('#paste-likes').text()) + 1);
                        if(disliked){
                            $('#paste-dislikes').text(parseInt($('#paste-dislikes').text()) - 1);
                        }
                        liked = 1;
                        disliked = 0;
                    }else{
                        $('#paste-likes').text(parseInt($('#paste-likes').text()) - 1);
                        disliked = 0;
                        liked = 0;
                    }
                }
            });
        });
        $('#dislike-paste').on('click', function(e){
            $.post('/api/rate-paste', {
                _token: $('input[name=_token]').val(),
                pname: '{{ $paste->link }}',
                rating: 0
            }, function(resp){
                if(resp.status == "done"){
                    if(resp.d){
                        $('#paste-dislikes').text(parseInt($('#paste-dislikes').text()) + 1);
                        if(liked){
                            $('#paste-likes').text(parseInt($('#paste-likes').text()) - 1);
                        }
                        disliked = 1;
                        liked = 0;
                    }else{
                        $('#paste-dislikes').text(parseInt($('#paste-dislikes').text()) - 1);
                        disliked = 0;
                        liked = 0;
                    }
                }
            });
        });


        // @else

        $('#like-paste, #dislike-paste').on('click', function(e){
            window.location = '/register';
        });

        // @endif





        // @if(!is_null($myUser) && $isDeveloperOrHigher) ?if staff

        function hideComment(el, id){
            $.post('/admin/api/delete-comment', {
                _token: $('input[name=_token]').val(),
                id: id
            }, function(resp){
                if(resp.hidden == 1){
                    $('#' + id).css('background', '#421414');
                    $(el).text('Show');
                }else{
                    $('#' + id).css('background', 'none');
                    $(el).text('Hide');
                }
            });
        }

        // @endif ?endif

        $('#paste-password-submit').on('click', function(e){
            $(this).text('Submitting...');
            $.post('/upload/{{$link}}/manage', {
                _token: $('input[name=_token]').val(),
                action: 'edit-password',
                value: $('#paste-password').val()
            }, function(resp){
                if(resp.status == "err"){
                    if(resp.msg){
                        $(this).text(resp.msg);
                    }else{
                        $(this).text('Error');
                    }
                }else{
                    $('#password-options').show();
                    $('#paste-password-submit').hide();
                    $('#paste-password').prop('disabled', true);
                }
            });
            e.preventDefault();
        });
        $('#edit-password').on('click', function(e){
            // $('#password-options').hide();
            $('#paste-password-submit').text('Save password').show();
            $('#paste-password').prop('disabled', false).focus();
            e.preventDefault();
        });
        $('#remove-password').on('click', function(e){
            $.post('/upload/{{$link}}/manage', {
                _token: $('input[name=_token]').val(),
                action: 'remove-password'
            }, function(resp){
                if(resp.status == "err"){
                    alert(resp);
                }else{
                    $('#password-options').hide();
                    $('#paste-password-submit').text('Password protect paste').show();
                    $('#paste-password').val('');
                    $('#paste-password').prop('disabled', false);
                }
            });
            e.preventDefault();
        });
        $('#fpblacklist').on('click', function(e){
            $.post('/admin/api/ban', {
                _token: $('input[name=_token]').val(),
                pid: doxid,
                val: !banned
            }, function(resp){
                if(resp.status == "done"){
                    location.reload();
                }else{
                    alert(resp.status);
                }
            });
            e.preventDefault();
        });

    $('#vis').on('change', function(e){
        $.post('/api/pastes/visibility', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
            val: this.value
        }, function(resp){
            if(resp.status == 1){
                location.reload();
            }
        });
        e.preventDefault();
    });

// @if($isDeveloperOrHigher == 1)

    $('#hidedox').on('click', function(e){
        if($(this).text() == "Hide" && $('#hide-reason').val().length < 2 && reasonForced){
            alert('Reason is required. Pastes created by a user will be notified');
        }else if($(this).text() == "Hide" && $('#hide-reason').val().length > 255){
            alert('Hide reason is too long');
        }else{
            $.post('/admin/api/paste/hide', {
                _token: $('input[name=_token]').val(),
                pid: doxid,
                reason: $('#hide-reason').val(),
                notifyUser: $('#notifyUser').prop('checked')
            }, function(resp){
                if(resp.status == "done"){
                    if(resp.hidden == 1){
                        $('#hide-reason-box').hide();
                        $('#hidedox').text('Unhide');
                    }else{
                        $('#hide-reason-box').show();
                        $('#hidedox').text('Hide');
                    }
                }
            });
        }
        e.preventDefault();
    });

// @endif

// @if($isDeveloperOrHigher)

    var staff_notes_default = "{{ $staff_notes->count() > 0 ? 'View ' . $staff_notes->count() . ' staff notes' : 'Add Staff ' . str_plural('Note', $staff_notes->count()) }}";
    var staff_notes_opened = false;
    $('.staff-notes-btn').on('click', function(e){
        if(!staff_notes_opened){
            $('#staffnotes').show();
            $('.staff-notes-btn').text("Close");
            staff_notes_opened = true;
        }else{
            $('#staffnotes').hide();
            $('.staff-notes-btn').text(staff_notes_default);
            staff_notes_opened = false;
        }
        e.preventDefault();
    });

// @endif



    $('#paste-manage').on('click', function(e){ // br3nnnt0n
        if(b1){
            $('#paste-manager').hide();
            $('#tos-display').show();
            $('#staff-btns, #btns, #hidden-by, #cmntsctn, .staff-notes').show();
        }else{
            $('#paste-manager').show();
            $('#tos-display').hide();
            $('#staff-btns, #btns, #hidden-by, #cmntsctn, .staff-notes').hide();
        }
        b1 = !b1;
        e.preventDefault();
    });

    $('#hide-dropdown').on('change', function(){ // Hide dropdown
        $('#hide-reason').val(this.value);
    });


// @if($council == 1)


    $('#flag-dropdown').on('change', function(){ // Hide dropdown
        $('#flag-reason').val(this.value);
    });

    $('#flag').on('click', function(e){
        if($('#flag-reason').val().length > 500){
            alert('Flag reason too long; ' + $('#flag-reason').val().length + ' chars');
        }
        $.post('/api/flag-paste', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
            reason: $('#flag-reason').val()
        }, function(resp){
            if(resp.status == "done"){
                if(resp.flagged == 1){
                    $('#flag-reason-box').hide();
                    $('#flag').text('Unflag dox');
                }else{
                    $('#flag-reason-box').show();
                    $('#flag').text('Flag dox');
                }
            }
        });
        e.preventDefault();
    });



// @endif

// @if(!is_null($myUser) && $myUser->isCouncil(true))

    $('.staff-next-btn').on('click', function(e){
        $.get('/api/next-paste', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
        }, function(resp){
            if(resp.status == "done"){
                window.location = resp.redirect;
            }
        });
        e.preventDefault();
    });

    $('.staff-previous-btn').on('click', function(e){
        $.get('/api/previous-paste', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
        }, function(resp){
            if(resp.status == "done"){
                window.location = resp.redirect;
            }
        });
        e.preventDefault();
    });

    $('#edittoggle').on('click', function(e){
        $.post('/', {
            _token: $('input[name=_token]').val(),
            edit_toggle: 1,
            dox_id: doxid,
        }, function(resp){
            if(resp.status == "done"){
                document.location.reload();
            }
        });
        e.preventDefault();
    });
// @endif


    var b1 = false;

    $('#create-note').on('click', function(e){
		var username = "Anonymous";
		var note = $('#note').val();
        $.post('/admin/api/staff-comment', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
            action: 'create',
            note: $('#note').val(),
            nid: 0
        }, function(resp){
            if(resp.status == "done"){
                $('#note').val('');
                username = htmlspecialchars(username.trim());
                note = htmlspecialchars(note.trim());
                if(uName != ""){
                    username = htmlspecialchars(uName);
                }
                if(username.length == 0){
                    username = "Anonymous";
                }
				$('.staff-notes-cont').append('<div class="b-comments b-comment" style="padding-left: 10px;"><b>' + (uName != "" ? '<a ' + (uAdmin != 0 ? 'style="color: red;"' : '') + 'href="/user/' + username + '">' + username + '</a>' : username) + '</b> - <p style="display: inline;">now</p><br><div class="b-content">' + note + '</div><br></div>');
            }else{
                alert('Error');
            }
        });
    });
    $('.deletenote').on('click', function(e){
        var th = $(this);
        $.post('/admin/api/staff-comment', {
            _token: $('input[name=_token]').val(),
            pid: doxid,
            action: 'remove',
            nid: $(this).attr('data-nid')
        }, function(resp){
            if(resp.status == "done"){
                th.parent().remove();
            }else{
                alert('Error');
            }
        });
        e.preventDefault();
    });
    </script>
    @include('layouts.captchascript')
    @if(!is_null($myUser) && $isManagerOrHigher)
    <script src="{{ asset('/legacy/paste-admin.js') }}"></script>
    @endif
</body>
</html>

<!-- brenton / b@doxbin.org t.me/brenton -->