Skip to content

Commit

Permalink
bot bar
Browse files Browse the repository at this point in the history
  • Loading branch information
whackashoe committed Jan 11, 2017
1 parent 5970278 commit 6ae1b93
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 57 deletions.
6 changes: 6 additions & 0 deletions app/views/editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
$("#error-modal").hide();
$("#editor").focus();
});
$(window).load(function() {
redraw();
});
$(this).scrollTop(0);
});
</script>
Expand Down
15 changes: 11 additions & 4 deletions app/views/layouts/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<title>@yield ('title')</title>

<link href="{{ asset('build/styles.css?id=' . mt_rand(0, 100000)) }}" rel="stylesheet">
<link href="{{ asset('build/styles.css?id=1020') }}" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
Expand All @@ -33,12 +33,19 @@
<div id="linepadder"></div>
<a href="{{ url('/') }}"><button id="logo">@yield ('menu_title', 'killr.io')</button></a>
@yield ('menu_items')
<a href="{{ url('terms') }}"><button id="terms">terms</button></a>
<a href="{{ url('about') }}"><button id="about">about</button></a>
</menu>
@yield ('content')

<script src="{{ asset('build/scripts.min.js?id=' . mt_rand(0, 100000)) }}"></script>
<footer>
<ul>
<li><a href="/about">about</a></li>
<li><a href="/terms">terms</a></li>
<li><a href="https://github.com/whackashoe/killr-cmdline">cmdline</a></li>
<li><a href="https://github.com/whackashoe/killr">source code</a></li>
</ul>
</footer>

<script src="{{ asset('build/scripts.min.js?id=1020') }}"></script>
@yield ('scripts')
</body>
</html>
70 changes: 37 additions & 33 deletions app/views/mods.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,49 @@
@stop

@section ('content')
<div id="modlisting">
<ul>
@forelse ($paste->children as $mod)
<li>
<a href="{{ url($mod->slug) }}">{{ $mod->created_at }} ({{ $mod->modsCount }} mods) <a href="/{{ $paste->slug }}/diff/{{ $mod->slug }}">[diff]</a>
@if ($mod->modsCount > 0)
<button class="expand-mods" data-slug="{{ $mod->slug }}">+</button>
@endif
</li>
@empty
<li><a href="{{ url($paste->slug) }}">there's been no modifications :( </a></li>
@endforelse
</ul>
</div>
<div id="linenumbers"></div>
<div id="modlisting">
<ul>
@forelse ($paste->children as $mod)
<li>
<a href="{{ url($mod->slug) }}">{{ $mod->created_at }} ({{ $mod->modsCount }} mods) <a href="/{{ $paste->slug }}/diff/{{ $mod->slug }}">[diff]</a>
@if ($mod->modsCount > 0)
<button class="expand-mods" data-slug="{{ $mod->slug }}">+</button>
@endif
</li>
@empty
<li><a href="{{ url($paste->slug) }}">there's been no modifications :( </a></li>
@endforelse
</ul>
</div>
@stop

@section ('scripts')
<script>
function expand_mods(el)
{
el.hide();
var parent = el.parent();
var m_slug = el.data('slug');
console.log(parent);
parent.append($("<ul/>"));
$(document).ready(function() {
function expand_mods(el)
{
el.hide();
var parent = el.parent();
var m_slug = el.data('slug');
console.log(parent);
parent.append($("<ul/>"));
$.getJSON("/" + m_slug + "/mods.json", function(results) {
$.each(results, function(i, v) {
var html = '<li><a href="/' + v.slug + '">' + v.created_at + ' (' + v.mods.length + ' mods)</a> <a href="/{{ $paste->slug }}/diff/' + v.slug +'">[diff]</a>';
if(v.mods.length > 0) {
html += '<button class="expand-mods" data-slug="' + v.slug + '">+</button></li>';
}
var nli = $(html);
nli.click(function() { expand_mods(nli.find("button")); });
parent.find("ul").append(nli);
$.getJSON("/" + m_slug + "/mods.json", function(results) {
$.each(results, function(i, v) {
var html = '<li><a href="/' + v.slug + '">' + v.created_at + ' (' + v.mods.length + ' mods)</a> <a href="/{{ $paste->slug }}/diff/' + v.slug +'">[diff]</a>';
if(v.mods.length > 0) {
html += '<button class="expand-mods" data-slug="' + v.slug + '">+</button></li>';
}
var nli = $(html);
nli.click(function() { expand_mods(nli.find("button")); });
parent.find("ul").append(nli);
});
});
});
}
}
$(".expand-mods").click(function() { expand_mods($(this)); });
$(".expand-mods").click(function() { expand_mods($(this)); });
$("body").css('overflow', 'hidden');
});
</script>
@stop
48 changes: 43 additions & 5 deletions public/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ html, body {
#editor {
background-color:transparent;
color:rgba(255, 255, 255, 0.1);
z-index: 100;
z-index: 12;
resize: none;
width:10000px;
}
Expand All @@ -61,7 +61,7 @@ html, body {
width:1px;
height:1.25em;
background-color: rgba(255, 255, 255, 0.5);
z-index: 50;
z-index: 11;
-webkit-animation: cpulse 1.4s infinite;
line-height: 1.25em;
}
Expand All @@ -81,7 +81,7 @@ html, body {
width:3em;
background-color: #282B2E;
color:#fff;
z-index: 10;
z-index: 13;
min-height: 100vh;
}
#linenumbers table {
Expand Down Expand Up @@ -114,7 +114,7 @@ html, body {
color:#fff;
margin: 0;
padding: 0;
z-index: 500;
z-index: 20;
}

#linepadder {
Expand Down Expand Up @@ -152,7 +152,7 @@ button:hover {
width:100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
z-index: 15;
z-index: 13;
}

.modal {
Expand Down Expand Up @@ -224,3 +224,41 @@ button:hover {
#modlisting ul li a:hover {
opacity: 0.8;
}

footer {
z-index: 12;
position: fixed;
bottom: 0px;
left: 0px;
width: 100vw;
display: inline-block;
background-color:#282B2E;
text-align:center;
padding:0.2rem 0;
}

footer ul {
list-style:none;
padding:0;
margin:0;
}

footer ul li {
display:inline;
margin:0 0.5rem;
padding:0;
}

footer ul li a {
color:rgba(255,255,255,0.5);
text-decoration:none;
font-size:12px;
}


footer ul li a:hover {
cursor:pointer;
color:rgba(255,255,255,0.9);
text-decoration:underline;
}

30 changes: 15 additions & 15 deletions public/js/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

function redraw() {
$("#editor").val($("#editor").val().replaceAll('\t', ' '));
var decoded = $("#editor").val();

$('#content pre code').text(decoded);

$("#content code").each(function(i, block) {
hljs.initHighlighting.called = false;
hljs.highlightBlock(block);
});
$('#content, #content pre, #content code, #editor, #linenumbers').height($('#linenumbers table').height() + 30);
$('#content, #console pre, #content code').css('width', $('#editor')[0].scrollWidth);
$('#editor').css('width', $('#editor')[0].scrollWidth);
}

$(document).ready(function() {
hljs.initHighlightingOnLoad();

Expand All @@ -39,21 +54,6 @@ $(document).ready(function() {
document.querySelector('#editor').addEventListener('keyup', function() { update_caret(this); });
}

function redraw() {
$("#editor").val($("#editor").val().replaceAll('\t', ' '));
var decoded = $("#editor").val();

$('#content pre code').text(decoded);

$("#content code").each(function(i, block) {
hljs.initHighlighting.called = false;
hljs.highlightBlock(block);
});
$('#content, #content pre, #content code, #editor, #linenumbers').height($('#linenumbers table').height() + 1000);
$('#content, #console pre, #content code').css('width', $('#editor')[0].scrollWidth);
$('#editor').css('width', $('#editor')[0].scrollWidth);
}

$("body").on('keydown', '#editor', function(e) {
var keyCode = e.keyCode || e.which;
// catch tab
Expand Down

0 comments on commit 6ae1b93

Please sign in to comment.