= $data['title'] ?>
+ += $data['alternate_title'] ?>
+ + + + += nl2br($data['synopsis']) ?>
+= print_r($data, TRUE) ?>+
diff --git a/README.md b/README.md index 4d97aa44..15c8c2de 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ A self-hosted client that allows custom formatting of data from the hummingbird * app/cache * public/images/manga * public/images/anime - * public/js/cache + * public/cache #### Anime Collection Additional Installation * Run `php /vendor/bin/phinx migrate -e development` to create the database tables diff --git a/app/config/minify_config.php b/app/config/minify_config.php index 9fa30251..20d9941a 100644 --- a/app/config/minify_config.php +++ b/app/config/minify_config.php @@ -56,4 +56,4 @@ $path_to = ''; | The folder where javascript files exist, in relation to the document root | */ -$js_root = $config['asset_dir'] . '/js/'; \ No newline at end of file +$js_root = $config['asset_dir'] . '/'; \ No newline at end of file diff --git a/app/config/minify_js_groups.php b/app/config/minify_js_groups.php index f6d0efff..dd1b728f 100644 --- a/app/config/minify_js_groups.php +++ b/app/config/minify_js_groups.php @@ -13,10 +13,57 @@ // -------------------------------------------------------------------------- +$bower_packages = ['jquery', 'datatables', 'mustache.js']; +$bower_file_map = []; + +foreach($bower_packages as $package) +{ + $bower_file_map[$package] = []; + $json = json_decode(file_get_contents(__DIR__ . "/../../public/bower_components/{$package}/bower.json")); + + if ( ! is_array($json->main)) + { + $json->main = [$json->main]; + } + + foreach($json->main as $file) + { + if (stristr($file, '.js') !== FALSE) + { + array_push($bower_file_map[$package], "bower_components/{$package}/{$file}"); + } + } +} + +/** + * Merge together bower configs and local files + * + * @param string|array $bower - array of bower components to include + * @param string|array $local - array of local js files to include + * @return array - group array + */ +function create_group($bower, $local=[]) +{ + global $bower_file_map; + $group = []; + + foreach((array) $bower as $component) + { + $group = array_merge($group, $bower_file_map[$component]); + } + + foreach((array) $local as $file) + { + $group[] = $file; + } + + return $group; +} + /** * This is the config array for javascript files to concatenate and minify */ -return [ +$map = [ /* For each group create an array like so @@ -25,37 +72,33 @@ return [ 'path/to/js/file2.js' ), */ - 'table' => [ - 'lib/jquery.min.js', - 'lib/datatables.js', - 'sort_tables.js' - ], - 'table_edit' => [ - 'lib/jquery.min.js', - 'lib/datatables.js', - 'sort_tables.js', - 'show_message.js', - 'anime_edit.js', - 'manga_edit.js' - ], - 'edit' => [ - 'lib/jquery.min.js', - 'show_message.js', - 'anime_edit.js', - 'manga_edit.js' - ], - 'anime_collection' => [ - 'lib/jquery.min.js', - 'lib/jquery.throttle-debounce.js', - 'lib/jsrender.js', - 'anime_collection.js' - ], - 'manga_collection' => [ - 'lib/jquery.min.js', - 'lib/jquery.throttle-debounce.js', - 'lib/jsrender.js', - 'manga_collection.js' - ] + 'base' => create_group('jquery', [ + 'js/base.js', + ]), + 'event' => create_group([], 'js/events.js'), + 'table' => create_group([], 'js/sort_tables.js'), + 'table_edit' => create_group([], [ + 'js/sort_tables.js', + 'js/anime_edit.js', + 'js/manga_edit.js', + ]), + 'edit' => create_group([],[ + 'js/anime_edit.js', + 'js/manga_edit.js' + ]), + 'anime_collection' => create_group('mustache.js', [ + 'bower_components/jquery-throttle-debounce/jquery.ba-throttle-debounce.js', + 'js/anime_collection.js' + ]), + 'manga_collection' => create_group('mustache.js', [ + 'bower_components/jquery-throttle-debounce/jquery.ba-throttle-debounce.js', + 'js/manga_collection.js' + ]), ]; +//print_r($map); +//die(); + +return $map; + // End of js_groups.php \ No newline at end of file diff --git a/app/views/anime/add.php b/app/views/anime/add.php index 12e88ab3..2fbdd582 100644 --- a/app/views/anime/add.php +++ b/app/views/anime/add.php @@ -3,6 +3,11 @@
= nl2br($data['synopsis']) ?>
+= print_r($data, TRUE) ?>+