Skip to content

Commit

Permalink
Ugly progress commit
Browse files Browse the repository at this point in the history
  • Loading branch information
timw4mail committed Feb 1, 2016
1 parent f007ad9 commit 49bd468
Show file tree
Hide file tree
Showing 30 changed files with 957 additions and 17,781 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/config/minify_config.php
Expand Up @@ -56,4 +56,4 @@
| The folder where javascript files exist, in relation to the document root
|
*/
$js_root = $config['asset_dir'] . '/js/';
$js_root = $config['asset_dir'] . '/';
107 changes: 75 additions & 32 deletions app/config/minify_js_groups.php
Expand Up @@ -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
Expand All @@ -25,37 +72,33 @@
'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
11 changes: 5 additions & 6 deletions app/views/anime/add.php
Expand Up @@ -3,6 +3,11 @@
<h2>Add Anime to your List</h2>
<form action="<?= $action_url ?>" method="post">
<section>
<div class="cssload-loader" hidden="hidden">
<div class="cssload-inner cssload-one"></div>
<div class="cssload-inner cssload-two"></div>
<div class="cssload-inner cssload-three"></div>
</div>
<label for="search">Search for anime by name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="search" id="search" /></label>
<section id="series_list" class="media-wrap">
</section>
Expand Down Expand Up @@ -30,11 +35,5 @@
</table>
</form>
</main>
<template id="show_list">
<article class="media">
<div class="name"><label><input type="radio" name="id" value="{{:slug}}" />&nbsp;<span>{{:title}}<br />{{:alternate_title}}</span></label></div>
<img src="{{:cover_image}}" alt="{{:title}}" />
</article>
</template>
<script src="<?= $urlGenerator->asset_url('js.php?g=anime_collection') ?>"></script>
<?php endif ?>
11 changes: 11 additions & 0 deletions app/views/anime/details.php
@@ -0,0 +1,11 @@
<main>
<h2><a href="<?= $data['url'] ?>"><?= $data['title'] ?></a></h2>
<?php if( ! empty($data['alternate_title'])): ?>
<h3><?= $data['alternate_title'] ?></h3>
<?php endif ?>

<img src="<?= $data['cover_image'] ?>" alt="<?= $data['title'] ?> cover image" />

<p><?= nl2br($data['synopsis']) ?></p>
<pre><?= print_r($data, TRUE) ?></pre>
</main>
6 changes: 3 additions & 3 deletions app/views/anime/list.php
Expand Up @@ -11,7 +11,7 @@
<thead>
<tr>
<?php if($auth->is_authenticated()): ?>
<th>&nbsp;</th>
<td class="no_border">&nbsp;</td>
<?php endif ?>
<th>Title</th>
<th>Airing Status</th>
Expand All @@ -33,7 +33,7 @@
<a class="bracketed" href="<?= $urlGenerator->url("/anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
</td>
<?php endif ?>
<td class="align_left">
<td class="justify">
<a href="<?= $item['anime']['url'] ?>" target="_blank">
<?= $item['anime']['title'] ?>
</a>
Expand All @@ -42,7 +42,7 @@
<td class="align_left"><?= $item['airing']['status'] ?></td>
<td><?= $item['user_rating'] ?> / 10 </td>
<td><?= $item['anime']['type'] ?></td>
<td id="<?= $item['anime']['slug'] ?>">
<td class="align_left" id="<?= $item['anime']['slug'] ?>">
Episodes: <br />
<span class="completed_number"><?= $item['episodes']['watched'] ?></span>&nbsp;/&nbsp;<span class="total_number"><?= $item['episodes']['total'] ?></span>
</td>
Expand Down
1 change: 1 addition & 0 deletions app/views/footer.php
@@ -1,2 +1,3 @@
<script src="<?= $urlGenerator->asset_url('js.php?g=event') ?>"></script>
</body>
</html>
20 changes: 7 additions & 13 deletions app/views/header.php
Expand Up @@ -5,12 +5,9 @@
<title><?= $title ?></title>
<meta charset="utf-8" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="Content-Security-Policy" content="script-src self" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self'" />
<link rel="stylesheet" href="<?= $urlGenerator->asset_url('css.php?g=base') ?>" />
<script>
var BASE_URL = "<?= $urlGenerator->base_url($url_type) ?>";
var CONTROLLER = "<?= $url_type ?>";
</script>
<script src="<?= $urlGenerator->asset_url('js.php?g=base') ?>"></script>
</head>
<body class="<?= $escape->attr($url_type) ?> list">
<header>
Expand Down Expand Up @@ -50,11 +47,8 @@
</ul>
<?php endif ?>
</nav>
</header>
<?php if(isset($message) && is_array($message)): ?>
<div class="message <?= $escape->attr($message['message_type']) ?>">
<span class="icon"></span>
<?= $escape->html($message['message']) ?>
<span class="close" onclick="this.parentElement.style.display='none'">x</span>
</div>
<?php endif ?>
<?php if(isset($message) && is_array($message)):
extract($message);
include 'message.php';
endif ?>
</header>
5 changes: 5 additions & 0 deletions app/views/message.ms
@@ -0,0 +1,5 @@
<div class="message {{message_type}}">
<span class="icon"></span>
{{message}}
<span class="close">x</span>
</div>
2 changes: 1 addition & 1 deletion app/views/message.php
@@ -1,5 +1,5 @@
<div class="message <?= $escape->attr($message_type) ?>">
<span class="icon"></span>
<?= $escape->html($message) ?>
<span class="close" onclick="this.parentElement.style.display='none'">x</span>
<span class="close"></span>
</div>
20 changes: 20 additions & 0 deletions public/bower.json
@@ -0,0 +1,20 @@
{
"name": "HummingbirdAnimeClient",
"homepage": "https://github.com/timw4mail/HummingBirdAnimeClient",
"authors": [
"Timothy J Warren <tim@timshomepage.net>"
],
"description": "Frontend stuff for php app",
"main": "",
"moduleType": [
"globals"
],
"license": "MIT",
"private": true,
"dependencies": {
"jquery": "^2.2.0",
"datatables": "DataTables#^1.10.10",
"jquery-throttle-debounce": "*",
"mustache.js": "mustache#^2.2.1"
}
}
Empty file added public/cache/.gitkeep
Empty file.

0 comments on commit 49bd468

Please sign in to comment.