From 5970278c27de85ca1310b2fd0d014b4d6ef20859 Mon Sep 17 00:00:00 2001 From: Jett Date: Mon, 9 Jan 2017 16:18:58 -0600 Subject: [PATCH] diffing --- LICENSE | 3 +++ app/controllers/PasteController.php | 11 ++++++++--- app/views/diff.blade.php | 9 ++++++++- app/views/editor.blade.php | 3 ++- app/views/layouts/default.blade.php | 2 +- app/views/mods.blade.php | 4 ++++ 6 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..741e3fd --- /dev/null +++ b/LICENSE @@ -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 diff --git a/app/controllers/PasteController.php b/app/controllers/PasteController.php index 266554f..0124f67 100644 --- a/app/controllers/PasteController.php +++ b/app/controllers/PasteController.php @@ -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); diff --git a/app/views/diff.blade.php b/app/views/diff.blade.php index 6d5e0ed..7f1257a 100644 --- a/app/views/diff.blade.php +++ b/app/views/diff.blade.php @@ -10,8 +10,13 @@ @endif @stop +@section ('menu_title') +killr.io :: comparing /{{ $paste->slug }} to /{{ $mod->slug }} +@stop + @section ('menu_items') - + + @stop @section ('content') @@ -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('.'); } diff --git a/app/views/editor.blade.php b/app/views/editor.blade.php index f72bc4c..f6a5d4c 100644 --- a/app/views/editor.blade.php +++ b/app/views/editor.blade.php @@ -23,7 +23,8 @@ @if (isset($paste->id) && !empty($paste->id)) @endif - @if (isset($paste->parent_id) && $paste->parent_id != null) + @if (isset($paste->parent_id) && $paste->parent != null) + @endif @if (isset($paste->id) && isset($paste->modsCount) && $paste->modsCount > 0) diff --git a/app/views/layouts/default.blade.php b/app/views/layouts/default.blade.php index c807a53..7830761 100644 --- a/app/views/layouts/default.blade.php +++ b/app/views/layouts/default.blade.php @@ -31,7 +31,7 @@
- + @yield ('menu_items') diff --git a/app/views/mods.blade.php b/app/views/mods.blade.php index 97f6885..1dc8dac 100644 --- a/app/views/mods.blade.php +++ b/app/views/mods.blade.php @@ -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))