Skip to content

Commit

Permalink
diffing
Browse files Browse the repository at this point in the history
  • Loading branch information
whackashoe committed Jan 9, 2017
1 parent 8ba56ea commit 5970278
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Not only does this software come with no warranty, it is pretty much guaranteed to fuck up your server. Do whatever the fuck you want with it

The LaRue License for a shitty tomorrow
11 changes: 8 additions & 3 deletions app/controllers/PasteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ public function diff($slug, $modslug)

$diff = (new Differ)->diff($paste->code, $mod->code);
$diff_exploded = explode("\n", $diff);
$diff_lines = array_slice($diff_exploded, 3, count($diff_exploded) - 4);
$diff_lines = array_slice($diff_exploded, 2, count($diff_exploded) - 1);
$diff_line_list = [];
foreach($diff_lines as &$line) {
$diff_line_list[] = substr($line, 0, 1);
$line = substr($line, 1);
if($line == '@@ @@') {
$diff_line_list[] = '@';
$line = "________________________________________________________________________________";
} else {
$diff_line_list[] = substr($line, 0, 1);
$line = substr($line, 1);
}
}
$diff_str = implode("\n", $diff_lines);

Expand Down
9 changes: 8 additions & 1 deletion app/views/diff.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
@endif
@stop

@section ('menu_title')
killr.io :: comparing /{{ $paste->slug }} to /{{ $mod->slug }}
@stop

@section ('menu_items')
<a href="{{ url($paste->slug . '/mods') }}"><button id="back">back</button></a>
<a href="{{ url($mod->slug) }}"><button id="tomod">mod</button></a>
<a href="{{ url($paste->slug) }}"><button id="topaste">paste</button></a>
@stop

@section ('content')
Expand All @@ -38,6 +43,8 @@
$(v).css('color', 'rgba(250, 35, 35, 0.7)');
} else if(val == '+') {
$(v).css('color', 'rgba(10, 175, 10, 0.7)');
} else if(val == '@') {
$(v).text('@');
} else {
$(v).text('.');
}
Expand Down
3 changes: 2 additions & 1 deletion app/views/editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
@if (isset($paste->id) && !empty($paste->id))
<a href="{{ url($paste->slug . '/raw') }}"><button id="raw">raw</button></a>
@endif
@if (isset($paste->parent_id) && $paste->parent_id != null)
@if (isset($paste->parent_id) && $paste->parent != null)
<a href="{{ url($paste->parent->slug . '/diff/' . $paste->slug) }}"><button id="parent">diff</button></a>
<a href="{{ url($paste->parent->slug) }}"><button id="parent">parent</button></a>
@endif
@if (isset($paste->id) && isset($paste->modsCount) && $paste->modsCount > 0)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<body>
<menu id="mainmenu">
<div id="linepadder"></div>
<a href="{{ url('/') }}"><button id="logo">killr.io</button></a>
<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>
Expand Down
4 changes: 4 additions & 0 deletions app/views/mods.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
view the modification tree for {{ $paste->slug }}
@stop

@section ('menu_title')
killr.io :: viewing mods of {{ $paste->slug }}
@stop

@section ('menu_items')
@if (isset($paste->parent_slug) && !empty($paste->parent_slug))
<a href="{{ url($paste->parent_slug) }}"><button id="parent">parent</button></a>
Expand Down

0 comments on commit 5970278

Please sign in to comment.