Version 5.1 - All the GraphQL #32
@ -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
|
||||
|
@ -56,4 +56,4 @@ $path_to = '';
|
||||
| The folder where javascript files exist, in relation to the document root
|
||||
|
|
||||
*/
|
||||
$js_root = $config['asset_dir'] . '/js/';
|
||||
$js_root = $config['asset_dir'] . '/';
|
@ -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
|
@ -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: <input type="search" id="search" /></label>
|
||||
<section id="series_list" class="media-wrap">
|
||||
</section>
|
||||
@ -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}}" /> <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
app/views/anime/details.php
Normal file
11
app/views/anime/details.php
Normal file
@ -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>
|
@ -11,7 +11,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if($auth->is_authenticated()): ?>
|
||||
<th> </th>
|
||||
<td class="no_border"> </td>
|
||||
<?php endif ?>
|
||||
<th>Title</th>
|
||||
<th>Airing Status</th>
|
||||
@ -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>
|
||||
@ -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> / <span class="total_number"><?= $item['episodes']['total'] ?></span>
|
||||
</td>
|
||||
|
@ -1,2 +1,3 @@
|
||||
<script src="<?= $urlGenerator->asset_url('js.php?g=event') ?>"></script>
|
||||
</body>
|
||||
</html>
|
@ -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>
|
||||
@ -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
app/views/message.ms
Normal file
5
app/views/message.ms
Normal file
@ -0,0 +1,5 @@
|
||||
<div class="message {{message_type}}">
|
||||
<span class="icon"></span>
|
||||
{{message}}
|
||||
<span class="close">x</span>
|
||||
</div>
|
@ -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
public/bower.json
Normal file
20
public/bower.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
0
public/cache/.gitkeep
vendored
Normal file
0
public/cache/.gitkeep
vendored
Normal file
@ -6,67 +6,46 @@ body {
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active {
|
||||
color: #7d12db;
|
||||
button {
|
||||
background: rgba(255,255,255,0.65);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 85%;
|
||||
/*width:85%;*/
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
tbody > tr:nth-child(odd) {
|
||||
background: #ddd;
|
||||
td {
|
||||
padding: 1em;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
/* Table sorting styles */
|
||||
|
||||
th.sorting::after {
|
||||
content: " ↕ ";
|
||||
}
|
||||
|
||||
th.sorting_asc::after {
|
||||
content: " ↑ ";
|
||||
}
|
||||
|
||||
th.sorting_desc::after {
|
||||
content: " ↓ ";
|
||||
thead td,
|
||||
thead th {
|
||||
padding: 0.5em;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
.form {
|
||||
width: 100%;
|
||||
tbody > tr:nth-child(odd) {
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.form tr > td:nth-child(odd) {
|
||||
text-align: right;
|
||||
min-width: 25px;
|
||||
max-width: 30%;
|
||||
a:hover,
|
||||
a:active {
|
||||
color: #7d12db;
|
||||
}
|
||||
|
||||
.form tr > td:nth-child(even) {
|
||||
text-align: left;
|
||||
min-width: 70%;
|
||||
}
|
||||
/* -----------------------------------------------------------------------------
|
||||
Utility classes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.form thead th,
|
||||
.form thead tr {
|
||||
background: inherit;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.form.invisible tr:nth-child(odd) {
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
.form.invisible tr,
|
||||
.form.invisible td,
|
||||
.form.invisible th {
|
||||
border: 0;
|
||||
.bracketed {
|
||||
color: #12db18;
|
||||
}
|
||||
|
||||
.bracketed,
|
||||
@ -82,10 +61,6 @@ h1 a {
|
||||
content: '\00a0]';
|
||||
}
|
||||
|
||||
.bracketed {
|
||||
color: #12db18;
|
||||
}
|
||||
|
||||
.bracketed:hover,
|
||||
.bracketed:active {
|
||||
color: #db7d12;
|
||||
@ -146,6 +121,10 @@ h1 a {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.justify {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.align_center {
|
||||
text-align: center;
|
||||
}
|
||||
@ -158,11 +137,257 @@ h1 a {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.no_border {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.media-wrap {
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
CSS loading icon
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.cssload-loader {
|
||||
position: relative;
|
||||
left: calc(50% - 31px);
|
||||
width: 62px;
|
||||
height: 62px;
|
||||
border-radius: 50%;
|
||||
-webkit-perspective: 780px;
|
||||
perspective: 780px;
|
||||
}
|
||||
|
||||
.cssload-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-one {
|
||||
left: 0%;
|
||||
top: 0%;
|
||||
-webkit-animation: cssload-rotate-one 1.15s linear infinite;
|
||||
animation: cssload-rotate-one 1.15s linear infinite;
|
||||
border-bottom: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-two {
|
||||
right: 0%;
|
||||
top: 0%;
|
||||
-webkit-animation: cssload-rotate-two 1.15s linear infinite;
|
||||
animation: cssload-rotate-two 1.15s linear infinite;
|
||||
border-right: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-three {
|
||||
right: 0%;
|
||||
bottom: 0%;
|
||||
-webkit-animation: cssload-rotate-three 1.15s linear infinite;
|
||||
animation: cssload-rotate-three 1.15s linear infinite;
|
||||
border-top: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
@-webkit-keyframes cssload-rotate-one {
|
||||
0% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-one {
|
||||
0% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes cssload-rotate-two {
|
||||
0% {
|
||||
-webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-two {
|
||||
0% {
|
||||
-webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes cssload-rotate-three {
|
||||
0% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-three {
|
||||
0% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Table sorting and form styles
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.sorting,
|
||||
.sorting_asc,
|
||||
.sorting_desc {
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.sorting::before {
|
||||
content: " ↕\00a0";
|
||||
}
|
||||
|
||||
.sorting_asc::before {
|
||||
content: " ↑\00a0";
|
||||
}
|
||||
|
||||
.sorting_desc::before {
|
||||
content: " ↓\00a0";
|
||||
}
|
||||
|
||||
.form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form thead th,
|
||||
.form thead tr {
|
||||
background: inherit;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.form tr > td:nth-child(odd) {
|
||||
text-align: right;
|
||||
min-width: 25px;
|
||||
max-width: 30%;
|
||||
}
|
||||
|
||||
.form tr > td:nth-child(even) {
|
||||
text-align: left;
|
||||
min-width: 70%;
|
||||
}
|
||||
|
||||
.form.invisible tr:nth-child(odd) {
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
.form.invisible tr,
|
||||
.form.invisible td,
|
||||
.form.invisible th {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Message boxes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.message {
|
||||
position: relative;
|
||||
margin: 0.5em auto;
|
||||
padding: 0.5em;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.message .close {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
position: absolute;
|
||||
right: 0.5em;
|
||||
top: 0.5em;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
/*.message .close:after {
|
||||
content: '☐';
|
||||
}*/
|
||||
|
||||
.message:hover .close:after {
|
||||
content: '☒';
|
||||
}
|
||||
|
||||
.message:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.message .icon {
|
||||
left: 0.5em;
|
||||
top: 0.5em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
border: 1px solid #924949;
|
||||
background: #f3e6e6;
|
||||
}
|
||||
|
||||
.message.error .icon::after {
|
||||
content: '✘';
|
||||
}
|
||||
|
||||
.message.success {
|
||||
border: 1px solid #1f8454;
|
||||
background: #70dda9;
|
||||
}
|
||||
|
||||
.message.success .icon::after {
|
||||
content: '✔';
|
||||
}
|
||||
|
||||
.message.info {
|
||||
border: 1px solid #bfbe3a;
|
||||
background: #FFFFCC;
|
||||
}
|
||||
|
||||
.message.info .icon::after {
|
||||
content: '⚠';
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Base list styles
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.media {
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
@ -173,11 +398,6 @@ h1 a {
|
||||
margin: 0.25em;
|
||||
}
|
||||
|
||||
button {
|
||||
background: rgba(255,255,255,0.65);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.media .edit_buttons > button {
|
||||
margin: 0.5em auto;
|
||||
}
|
||||
@ -238,53 +458,6 @@ button {
|
||||
text-shadow: 1px 2px 1px rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Message boxes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.message {
|
||||
position: relative;
|
||||
margin: 0.5em auto;
|
||||
padding: 0.5em;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.message .close {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
position: absolute;
|
||||
right: 0.5em;
|
||||
top: 0.5em;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
.message .close:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.message .icon {
|
||||
left: 0.5em;
|
||||
top: 0.5em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
border: 1px solid #924949;
|
||||
background: #f3e6e6;
|
||||
}
|
||||
|
||||
.message.success {
|
||||
border: 1px solid #1f8454;
|
||||
background: #70dda9;
|
||||
}
|
||||
|
||||
.message.info {
|
||||
border: 1px solid #bfbe3a;
|
||||
background: #FFFFCC;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Anime-list-specific styles
|
||||
------------------------------------------------------------------------------*/
|
||||
@ -384,4 +557,53 @@ button {
|
||||
top: calc(50% - 58.5px);
|
||||
left: 5px;
|
||||
left: calc(50% - 95px);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Page-specific styles
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.media.search > .name {
|
||||
background-color: #555;
|
||||
background-color: rgba(000,000,000,0.35);
|
||||
background-size: cover;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.big-check {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.big-check:checked + label {
|
||||
-webkit-transition: .25s ease;
|
||||
transition: .25s ease;
|
||||
background: rgba(0,0,0,0.75);
|
||||
}
|
||||
|
||||
.big-check:checked + label:after {
|
||||
content: '✓';
|
||||
font-size: 15em;
|
||||
font-size: 15rem;
|
||||
text-align: center;
|
||||
color: greenyellow;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#series_list article.media {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#series_list .name,
|
||||
#series_list .name label {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
@ -13,65 +13,51 @@ template {display:none}
|
||||
|
||||
body {margin: 0.5em;}
|
||||
|
||||
a:hover, a:active {
|
||||
color: var(--link-hover-color)
|
||||
button {
|
||||
background:rgba(255,255,255,0.65);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width:85%;
|
||||
/*width:85%;*/
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
tbody > tr:nth-child(odd) {
|
||||
background: #ddd;
|
||||
td {
|
||||
padding:1em;
|
||||
padding:1rem;
|
||||
}
|
||||
|
||||
/* Table sorting styles */
|
||||
th.sorting::after {
|
||||
content: " ↕ ";
|
||||
}
|
||||
th.sorting_asc::after {
|
||||
content: " ↑ ";
|
||||
}
|
||||
th.sorting_desc::after {
|
||||
content: " ↓ ";
|
||||
thead td, thead th {
|
||||
padding:0.5em;
|
||||
padding:0.5rem;
|
||||
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
.form { width:100%; }
|
||||
.form tr > td:nth-child(odd) {
|
||||
text-align:right;
|
||||
min-width:25px;
|
||||
max-width:30%;
|
||||
}
|
||||
.form tr > td:nth-child(even) {
|
||||
text-align:left;
|
||||
min-width:70%;
|
||||
tbody > tr:nth-child(odd) {
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.form thead th, .form thead tr {
|
||||
background: inherit;
|
||||
border:0;
|
||||
a:hover, a:active {
|
||||
color: var(--link-hover-color)
|
||||
}
|
||||
|
||||
.form.invisible tr:nth-child(odd) {
|
||||
background: inherit;
|
||||
}
|
||||
.form.invisible tr, .form.invisible td, .form.invisible th {
|
||||
border:0;
|
||||
}
|
||||
/* -----------------------------------------------------------------------------
|
||||
Utility classes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.bracketed {
|
||||
color: var(--edit-link-color);
|
||||
}
|
||||
.bracketed, h1 a {
|
||||
text-shadow: var(--link-shadow);
|
||||
}
|
||||
.bracketed:before {content: '[\00a0'}
|
||||
.bracketed:after {content: '\00a0]'}
|
||||
.bracketed {
|
||||
color: var(--edit-link-color);
|
||||
}
|
||||
.bracketed:hover, .bracketed:active {
|
||||
color: var(--edit-link-hover-color)
|
||||
}
|
||||
@ -89,15 +75,202 @@ input[type=number] {
|
||||
font-size:1.6rem;
|
||||
}
|
||||
|
||||
.justify {text-align:justify}
|
||||
.align_center {text-align:center}
|
||||
.align_left {text-align:left;}
|
||||
.align_right {text-align:right;}
|
||||
.align_left {text-align:left}
|
||||
.align_right {text-align:right}
|
||||
|
||||
.no_border {border:none}
|
||||
|
||||
.media-wrap {
|
||||
text-align:center;
|
||||
margin:0 auto;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
CSS loading icon
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.cssload-loader {
|
||||
position: relative;
|
||||
left: calc(50% - 31px);
|
||||
width: 62px;
|
||||
height: 62px;
|
||||
border-radius: 50%;
|
||||
perspective: 780px;
|
||||
}
|
||||
|
||||
.cssload-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-one {
|
||||
left: 0%;
|
||||
top: 0%;
|
||||
animation: cssload-rotate-one 1.15s linear infinite;
|
||||
border-bottom: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-two {
|
||||
right: 0%;
|
||||
top: 0%;
|
||||
animation: cssload-rotate-two 1.15s linear infinite;
|
||||
border-right: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
.cssload-inner.cssload-three {
|
||||
right: 0%;
|
||||
bottom: 0%;
|
||||
animation: cssload-rotate-three 1.15s linear infinite;
|
||||
border-top: 3px solid rgb(0,0,0);
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-one {
|
||||
0% {
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-two {
|
||||
0% {
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cssload-rotate-three {
|
||||
0% {
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Table sorting and form styles
|
||||
------------------------------------------------------------------------------*/
|
||||
.sorting,
|
||||
/*.sorting::before,*/
|
||||
.sorting_asc,
|
||||
/*.sorting_asc::before,*/
|
||||
.sorting_desc
|
||||
/*.sorting_desc::before*/ {
|
||||
vertical-align:text-bottom;
|
||||
}
|
||||
.sorting::before {
|
||||
content: " ↕\00a0";
|
||||
}
|
||||
.sorting_asc::before {
|
||||
content: " ↑\00a0";
|
||||
}
|
||||
.sorting_desc::before {
|
||||
content: " ↓\00a0";
|
||||
}
|
||||
|
||||
.form { width:100%; }
|
||||
|
||||
.form thead th, .form thead tr {
|
||||
background: inherit;
|
||||
border:0;
|
||||
}
|
||||
|
||||
.form tr > td:nth-child(odd) {
|
||||
text-align:right;
|
||||
min-width:25px;
|
||||
max-width:30%;
|
||||
}
|
||||
.form tr > td:nth-child(even) {
|
||||
text-align:left;
|
||||
min-width:70%;
|
||||
}
|
||||
|
||||
.form.invisible tr:nth-child(odd) {
|
||||
background: inherit;
|
||||
}
|
||||
.form.invisible tr, .form.invisible td, .form.invisible th {
|
||||
border:0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Message boxes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.message{
|
||||
position:relative;
|
||||
margin:0.5em auto;
|
||||
padding:0.5em;
|
||||
width:95%;
|
||||
}
|
||||
|
||||
.message .close{
|
||||
width:1em;
|
||||
height:1em;
|
||||
position:absolute;
|
||||
right:0.5em;
|
||||
top:0.5em;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
line-height:1em;
|
||||
}
|
||||
|
||||
/*.message .close:after {
|
||||
content: '☐';
|
||||
}*/
|
||||
|
||||
.message:hover .close:after {
|
||||
content: '☒';
|
||||
}
|
||||
|
||||
.message:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.message .icon{
|
||||
left:0.5em;
|
||||
top:0.5em;
|
||||
margin-right:1em;
|
||||
}
|
||||
|
||||
.message.error{
|
||||
border:1px solid #924949;
|
||||
background: #f3e6e6;
|
||||
}
|
||||
|
||||
.message.error .icon::after {
|
||||
content: '✘';
|
||||
}
|
||||
|
||||
.message.success{
|
||||
border:1px solid #1f8454;
|
||||
background: #70dda9;
|
||||
}
|
||||
.message.success .icon::after {
|
||||
content: '✔'
|
||||
}
|
||||
|
||||
.message.info{
|
||||
border:1px solid #bfbe3a;
|
||||
background: #FFFFCC;
|
||||
}
|
||||
|
||||
.message.info .icon::after {
|
||||
content: '⚠';
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Base list styles
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.media {
|
||||
position:relative;
|
||||
vertical-align:top;
|
||||
@ -108,11 +281,6 @@ input[type=number] {
|
||||
margin: var(--normal-padding);
|
||||
}
|
||||
|
||||
button {
|
||||
background:rgba(255,255,255,0.65);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.media .edit_buttons > button {
|
||||
margin:0.5em auto;
|
||||
}
|
||||
@ -172,52 +340,7 @@ button {
|
||||
text-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Message boxes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.message{
|
||||
position:relative;
|
||||
margin:0.5em auto;
|
||||
padding:0.5em;
|
||||
width:95%;
|
||||
}
|
||||
|
||||
.message .close{
|
||||
width:1em;
|
||||
height:1em;
|
||||
position:absolute;
|
||||
right:0.5em;
|
||||
top:0.5em;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
line-height:1em;
|
||||
}
|
||||
|
||||
.message .close:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.message .icon{
|
||||
left:0.5em;
|
||||
top:0.5em;
|
||||
margin-right:1em;
|
||||
}
|
||||
|
||||
.message.error{
|
||||
border:1px solid #924949;
|
||||
background: #f3e6e6;
|
||||
}
|
||||
|
||||
.message.success{
|
||||
border:1px solid #1f8454;
|
||||
background: #70dda9;
|
||||
}
|
||||
|
||||
.message.info{
|
||||
border:1px solid #bfbe3a;
|
||||
background: #FFFFCC;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Anime-list-specific styles
|
||||
@ -304,3 +427,52 @@ button {
|
||||
left: 5px;
|
||||
left: calc(50% - 95px);
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Page-specific styles
|
||||
------------------------------------------------------------------------------*/
|
||||
.media.search > .name {
|
||||
background-color:#555;
|
||||
background-color: rgba(000,000,000,0.35);
|
||||
background-size: cover;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.big-check {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.big-check:checked + label {
|
||||
transition: .25s ease;
|
||||
background:rgba(0,0,0,0.75);
|
||||
}
|
||||
|
||||
.big-check:checked + label:after {
|
||||
content: '✓';
|
||||
font-size: 15em;
|
||||
font-size: 15rem;
|
||||
text-align:center;
|
||||
color: greenyellow;
|
||||
position:absolute;
|
||||
top:5px;
|
||||
left:0;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#series_list article.media {
|
||||
position:relative;
|
||||
}
|
||||
#series_list .name, #series_list .name label {
|
||||
position:absolute;
|
||||
display:block;
|
||||
top:0;
|
||||
height:100%;
|
||||
width:100%;
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -111,7 +111,6 @@ button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
/*background-color: transparent;*/
|
||||
border: .1rem solid #ccc;
|
||||
color: inherit;
|
||||
font-family: inherit;
|
||||
@ -507,7 +506,7 @@ textarea {
|
||||
|
||||
input[type=submit],
|
||||
button {
|
||||
background-color: transparent;
|
||||
/*background-color: transparent;*/
|
||||
border: .2rem solid #444;
|
||||
border-radius: 0;
|
||||
color: #444;
|
||||
|
@ -78,7 +78,6 @@ audio, canvas, iframe, img, svg, video {
|
||||
vertical-align: middle; }
|
||||
|
||||
button, input, select, textarea {
|
||||
/*background-color: transparent;*/
|
||||
border: .1rem solid #ccc;
|
||||
color: inherit;
|
||||
font-family: inherit;
|
||||
@ -342,7 +341,7 @@ textarea {
|
||||
vertical-align: middle; }
|
||||
|
||||
input[type=submit], button {
|
||||
background-color: transparent;
|
||||
/*background-color: transparent;*/
|
||||
border: .2rem solid #444;
|
||||
border-radius: 0;
|
||||
color: #444;
|
||||
|
@ -19,7 +19,7 @@ use GuzzleHttp\Psr7\Request;
|
||||
require_once('../app/config/minify_config.php');
|
||||
|
||||
//Include the js groups
|
||||
$groups_file = "../app/config/minify_js_groups.php";
|
||||
$groups_file = '../app/config/minify_js_groups.php';
|
||||
$groups = require_once($groups_file);
|
||||
|
||||
// Include guzzle
|
||||
@ -67,8 +67,9 @@ function google_min($new_file)
|
||||
'output_info' => 'errors',
|
||||
'output_format' => 'json',
|
||||
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
|
||||
//'compilation_level' => 'ADVANCED_OPTIMIZATIONS',
|
||||
'js_code' => $new_file,
|
||||
'language' => 'ECMASCRIPT5',
|
||||
'language' => 'ECMASCRIPT6_STRICT',
|
||||
'language_out' => 'ECMASCRIPT5_STRICT'
|
||||
];
|
||||
|
||||
@ -77,17 +78,18 @@ function google_min($new_file)
|
||||
$error_res = $error_client->post('http://closure-compiler.appspot.com/compile', [
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
"Content-type" => "application/x-www-form-urlencoded"
|
||||
'Content-type' => 'application/x-www-form-urlencoded'
|
||||
],
|
||||
'form_params' => $options
|
||||
]);
|
||||
|
||||
$error_json = $error_res->getBody();
|
||||
$error_obj = json_decode($error_json);
|
||||
$error_obj = json_decode($error_json) ?: (object)[];
|
||||
|
||||
// Show error if exists
|
||||
if ( ! empty($error_obj->errors))
|
||||
{
|
||||
?><pre><?= json_encode($err_obj, JSON_PRETTY_PRINT) ?></pre><?php
|
||||
echo json_encode($error_obj, JSON_PRETTY_PRINT);
|
||||
die();
|
||||
}
|
||||
|
||||
@ -97,7 +99,7 @@ function google_min($new_file)
|
||||
$res = $client->post('http://closure-compiler.appspot.com/compile', [
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
"Content-type" => "application/x-www-form-urlencoded"
|
||||
'Content-type' => 'application/x-www-form-urlencoded'
|
||||
],
|
||||
'form_params' => $options
|
||||
]);
|
||||
@ -163,7 +165,7 @@ if(isset($groups[$_GET['g']]))
|
||||
}
|
||||
else //Nothing to display? Just exit
|
||||
{
|
||||
die("You must specify a group that exists");
|
||||
die('You must specify a group that exists');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -180,7 +182,7 @@ $requested_time=(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
||||
// don't resend the file
|
||||
if($last_modified === $requested_time)
|
||||
{
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -188,7 +190,7 @@ if($last_modified === $requested_time)
|
||||
|
||||
//Determine what to do: rebuild cache, send files as is, or send cache.
|
||||
// If debug is set, just concatenate
|
||||
if(isset($_GET['debug']))
|
||||
if(array_key_exists('debug', $_GET))
|
||||
{
|
||||
$js = get_files();
|
||||
}
|
||||
@ -199,7 +201,7 @@ else if($cache_modified < $last_modified)
|
||||
//Make sure cache file gets created/updated
|
||||
if(file_put_contents($cache_file, $js) === FALSE)
|
||||
{
|
||||
die("Cache file was not created. Make sure you have the correct folder permissions.");
|
||||
die('Cache file was not created. Make sure you have the correct folder permissions.');
|
||||
}
|
||||
}
|
||||
// Otherwise, send the cached file
|
||||
@ -212,13 +214,13 @@ else
|
||||
|
||||
//This GZIPs the js for transmission to the user
|
||||
//making file size smaller and transfer rate quicker
|
||||
ob_start("ob_gzhandler");
|
||||
ob_start('ob_gzhandler');
|
||||
|
||||
// Set important caching headers
|
||||
header("Content-Type: application/javascript; charset=utf8");
|
||||
header("Cache-control: public, max-age=691200, must-revalidate");
|
||||
header("Last-Modified: ".gmdate('D, d M Y H:i:s', $last_modified)." GMT");
|
||||
header("Expires: ".gmdate('D, d M Y H:i:s', (filemtime($this_file) + 691200))." GMT");
|
||||
header('Content-Type: application/javascript; charset=utf8');
|
||||
header('Cache-control: public, max-age=691200, must-revalidate');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s', (filemtime($this_file) + 691200)).' GMT');
|
||||
|
||||
echo $js;
|
||||
|
||||
|
@ -1,17 +1,46 @@
|
||||
(function($, undefined) {
|
||||
(($, AnimeClient) => {
|
||||
|
||||
'use strict';
|
||||
|
||||
function search(query, callback)
|
||||
{
|
||||
$.get(BASE_URL + 'collection/search', {'query':query}, callback);
|
||||
var endpoint = '//' + document.location.host + '/collection/search';
|
||||
return $.get(AnimeClient.url('/collection/search'), {'query':query}, callback);
|
||||
}
|
||||
|
||||
$("#search").on('keypress', $.throttle(750, function(e) {
|
||||
var query = encodeURIComponent($(this).val());
|
||||
search(query, function(res) {
|
||||
var template = $.templates("#show_list");
|
||||
var html = template.render(res);
|
||||
$('#series_list').html(html);
|
||||
});
|
||||
}));
|
||||
$.get('/public/templates/ajax-search-results.html').done(tempHtml => {
|
||||
$('#search').on('keypress', $.throttle(750, function(e) {
|
||||
$('.cssload-loader').removeAttr('hidden');
|
||||
let query = encodeURIComponent($(this).val());
|
||||
$.get(AnimeClient.url('/collection/search'), {'query':query}).done((searchResults) => {
|
||||
$('.cssload-loader').attr('hidden', 'hidden');
|
||||
|
||||
}(jQuery));
|
||||
// Give mustache a key to iterate over
|
||||
searchResults = {
|
||||
anime: searchResults
|
||||
};
|
||||
|
||||
Mustache.parse(tempHtml);
|
||||
$('#series_list').html(Mustache.render(tempHtml, searchResults));
|
||||
}).fail(() => {
|
||||
$('.cssload-loader').attr('hidden', 'hidden');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
/*$.get('/public/templates/ajax-search-results.html', tempHtml => {
|
||||
$('#search').on('keypress', $.throttle(750, function(e) {
|
||||
var query = encodeURIComponent($(this).val());
|
||||
search(query, function(searchResults) {
|
||||
// Give mustache a key to iterate over
|
||||
searchResults = {
|
||||
anime: searchResults
|
||||
};
|
||||
|
||||
Mustache.parse(tempHtml);
|
||||
var rendered = Mustache.render(tempHtml, searchResults);
|
||||
$('#series_list').html(rendered);
|
||||
});
|
||||
}));
|
||||
});*/
|
||||
})(jQuery, AnimeClient);
|
@ -1,42 +1,38 @@
|
||||
/**
|
||||
* Javascript for editing anime, if logged in
|
||||
*/
|
||||
(function($){
|
||||
(($, AnimeClient, w) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
if (CONTROLLER !== "anime") return;
|
||||
'use strict';
|
||||
|
||||
// Action to increment episode count
|
||||
$(".plus_one").on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
$('body.anime.list').on('click', '.plus_one', function(e) {
|
||||
//e.stopPropagation();
|
||||
|
||||
var self = this;
|
||||
var this_sel = $(this);
|
||||
var parent_sel = $(this).closest("article, td");
|
||||
let self = this;
|
||||
let this_sel = $(this);
|
||||
let parent_sel = $(this).closest('article, td');
|
||||
|
||||
var watched_count = parseInt(parent_sel.find('.completed_number').text(), 10);
|
||||
var total_count = parseInt(parent_sel.find('.total_number').text(), 10);
|
||||
var title = parent_sel.find('.name a').text();
|
||||
let watched_count = parseInt(parent_sel.find('.completed_number').text(), 10);
|
||||
let total_count = parseInt(parent_sel.find('.total_number').text(), 10);
|
||||
let title = parent_sel.find('.name a').text();
|
||||
|
||||
// Setup the update data
|
||||
var data = {
|
||||
let data = {
|
||||
id: this_sel.parent('article, td').attr('id'),
|
||||
increment_episodes: true
|
||||
};
|
||||
|
||||
// If the episode count is 0, and incremented,
|
||||
// change status to currently watching
|
||||
if (isNaN(watched_count) || watched_count === 0)
|
||||
{
|
||||
data.status = "currently-watching";
|
||||
if (isNaN(watched_count) || watched_count === 0) {
|
||||
data.status = 'currently-watching';
|
||||
}
|
||||
|
||||
// If you increment at the last episode, mark as completed
|
||||
if (( ! isNaN(watched_count)) && (watched_count + 1) === total_count)
|
||||
{
|
||||
if (( ! isNaN(watched_count)) && (watched_count + 1) === total_count) {
|
||||
delete data.increment_episodes;
|
||||
data.status = "completed";
|
||||
data.status = 'completed';
|
||||
}
|
||||
|
||||
// okay, lets actually make some changes!
|
||||
@ -45,18 +41,20 @@
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
mimeType: 'application/json',
|
||||
url: BASE_URL + CONTROLLER + '/update'
|
||||
}).done(function(res) {
|
||||
if (res.status === 'completed')
|
||||
{
|
||||
$(self).closest('article, tr').hide();
|
||||
url: AnimeClient.url('/anime/update'),
|
||||
}).done((res) => {
|
||||
if (res.status === 'completed') {
|
||||
$(this).closest('article, tr').hide();
|
||||
}
|
||||
|
||||
add_message('success', "Sucessfully updated " + title);
|
||||
AnimeClient.showMessage('success', `Sucessfully updated ${title}`);
|
||||
parent_sel.find('.completed_number').text(++watched_count);
|
||||
}).fail(function() {
|
||||
add_message('error', "Failed to updated " + title);
|
||||
|
||||
// scroll to top
|
||||
w.scroll(0,0);
|
||||
}).fail(() => {
|
||||
AnimeClient.showMessage('error', `Failed to updated ${title}`);
|
||||
});
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
})(jQuery, AnimeClient, window);
|
45
public/js/base.js
Normal file
45
public/js/base.js
Normal file
@ -0,0 +1,45 @@
|
||||
const AnimeClient = (function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
/**
|
||||
* Display a message box
|
||||
*
|
||||
* @param {String} type - message type: info, error, success
|
||||
* @param {String} message - the message itself
|
||||
* @return {void}
|
||||
*/
|
||||
showMessage(type, message) {
|
||||
let template = `
|
||||
<div class="message ${type}">
|
||||
<span class="icon"></span>
|
||||
${message}
|
||||
<span class="close"></span>
|
||||
</div>`;
|
||||
|
||||
if ($(".message").length > 0)
|
||||
{
|
||||
$(".message").replaceWith(template);
|
||||
$(".message").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("header").append(template);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Generate a full url from a relative path
|
||||
*
|
||||
* @param {String} path - url path
|
||||
* @return {String} - full url
|
||||
*/
|
||||
url(path) {
|
||||
let uri = `//${document.location.host}`;
|
||||
uri += (path.charAt(0) === '/') ? path : `/${path}`;
|
||||
|
||||
return uri;
|
||||
},
|
||||
};
|
||||
|
||||
})(jQuery);
|
13
public/js/events.js
Normal file
13
public/js/events.js
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* jQuery event handlers
|
||||
*/
|
||||
(($) => {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Close event for messages
|
||||
$('header').on('click', '.message', function() {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
})(jQuery);
|
File diff suppressed because it is too large
Load Diff
1
public/js/lib/jquery.min.js
vendored
1
public/js/lib/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,252 +0,0 @@
|
||||
/*!
|
||||
* jQuery throttle / debounce - v1.1 - 3/7/2010
|
||||
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
|
||||
// Script: jQuery throttle / debounce: Sometimes, less is more!
|
||||
//
|
||||
// *Version: 1.1, Last updated: 3/7/2010*
|
||||
//
|
||||
// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
||||
// GitHub - http://github.com/cowboy/jquery-throttle-debounce/
|
||||
// Source - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
|
||||
// (Minified) - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
|
||||
//
|
||||
// About: License
|
||||
//
|
||||
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
||||
// Dual licensed under the MIT and GPL licenses.
|
||||
// http://benalman.com/about/license/
|
||||
//
|
||||
// About: Examples
|
||||
//
|
||||
// These working examples, complete with fully commented code, illustrate a few
|
||||
// ways in which this plugin can be used.
|
||||
//
|
||||
// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
|
||||
// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
|
||||
//
|
||||
// About: Support and Testing
|
||||
//
|
||||
// Information about what version or versions of jQuery this plugin has been
|
||||
// tested with, what browsers it has been tested in, and where the unit tests
|
||||
// reside (so you can test it yourself).
|
||||
//
|
||||
// jQuery Versions - none, 1.3.2, 1.4.2
|
||||
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
|
||||
// Unit Tests - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
|
||||
//
|
||||
// About: Release History
|
||||
//
|
||||
// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
|
||||
// executed later than they should. Reworked a fair amount of internal
|
||||
// logic as well.
|
||||
// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
|
||||
// from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
|
||||
// no_trailing throttle parameter and debounce functionality.
|
||||
//
|
||||
// Topic: Note for non-jQuery users
|
||||
//
|
||||
// jQuery isn't actually required for this plugin, because nothing internal
|
||||
// uses any jQuery methods or properties. jQuery is just used as a namespace
|
||||
// under which these methods can exist.
|
||||
//
|
||||
// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
|
||||
// when this plugin is loaded, the method described below will be created in
|
||||
// the `Cowboy` namespace. Usage will be exactly the same, but instead of
|
||||
// $.method() or jQuery.method(), you'll need to use Cowboy.method().
|
||||
|
||||
(function(window,undefined){
|
||||
'$:nomunge'; // Used by YUI compressor.
|
||||
|
||||
// Since jQuery really isn't required for this plugin, use `jQuery` as the
|
||||
// namespace only if it already exists, otherwise use the `Cowboy` namespace,
|
||||
// creating it if necessary.
|
||||
var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
|
||||
|
||||
// Internal method reference.
|
||||
jq_throttle;
|
||||
|
||||
// Method: jQuery.throttle
|
||||
//
|
||||
// Throttle execution of a function. Especially useful for rate limiting
|
||||
// execution of handlers on events like resize and scroll. If you want to
|
||||
// rate-limit execution of a function to a single time, see the
|
||||
// <jQuery.debounce> method.
|
||||
//
|
||||
// In this visualization, | is a throttled-function call and X is the actual
|
||||
// callback execution:
|
||||
//
|
||||
// > Throttled with `no_trailing` specified as false or unspecified:
|
||||
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
||||
// > X X X X X X X X X X X X
|
||||
// >
|
||||
// > Throttled with `no_trailing` specified as true:
|
||||
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
||||
// > X X X X X X X X X X
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
|
||||
// >
|
||||
// > jQuery('selector').bind( 'someevent', throttled );
|
||||
// > jQuery('selector').unbind( 'someevent', throttled );
|
||||
//
|
||||
// This also works in jQuery 1.4+:
|
||||
//
|
||||
// > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
|
||||
// > jQuery('selector').unbind( 'someevent', callback );
|
||||
//
|
||||
// Arguments:
|
||||
//
|
||||
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
||||
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
||||
// no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
|
||||
// true, callback will only execute every `delay` milliseconds while the
|
||||
// throttled-function is being called. If no_trailing is false or
|
||||
// unspecified, callback will be executed one final time after the last
|
||||
// throttled-function call. (After the throttled-function has not been
|
||||
// called for `delay` milliseconds, the internal counter is reset)
|
||||
// callback - (Function) A function to be executed after delay milliseconds.
|
||||
// The `this` context and all arguments are passed through, as-is, to
|
||||
// `callback` when the throttled-function is executed.
|
||||
//
|
||||
// Returns:
|
||||
//
|
||||
// (Function) A new, throttled, function.
|
||||
|
||||
$.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
|
||||
// After wrapper has stopped being called, this timeout ensures that
|
||||
// `callback` is executed at the proper times in `throttle` and `end`
|
||||
// debounce modes.
|
||||
var timeout_id,
|
||||
|
||||
// Keep track of the last time `callback` was executed.
|
||||
last_exec = 0;
|
||||
|
||||
// `no_trailing` defaults to falsy.
|
||||
if ( typeof no_trailing !== 'boolean' ) {
|
||||
debounce_mode = callback;
|
||||
callback = no_trailing;
|
||||
no_trailing = undefined;
|
||||
}
|
||||
|
||||
// The `wrapper` function encapsulates all of the throttling / debouncing
|
||||
// functionality and when executed will limit the rate at which `callback`
|
||||
// is executed.
|
||||
function wrapper() {
|
||||
var that = this,
|
||||
elapsed = +new Date() - last_exec,
|
||||
args = arguments;
|
||||
|
||||
// Execute `callback` and update the `last_exec` timestamp.
|
||||
function exec() {
|
||||
last_exec = +new Date();
|
||||
callback.apply( that, args );
|
||||
};
|
||||
|
||||
// If `debounce_mode` is true (at_begin) this is used to clear the flag
|
||||
// to allow future `callback` executions.
|
||||
function clear() {
|
||||
timeout_id = undefined;
|
||||
};
|
||||
|
||||
if ( debounce_mode && !timeout_id ) {
|
||||
// Since `wrapper` is being called for the first time and
|
||||
// `debounce_mode` is true (at_begin), execute `callback`.
|
||||
exec();
|
||||
}
|
||||
|
||||
// Clear any existing timeout.
|
||||
timeout_id && clearTimeout( timeout_id );
|
||||
|
||||
if ( debounce_mode === undefined && elapsed > delay ) {
|
||||
// In throttle mode, if `delay` time has been exceeded, execute
|
||||
// `callback`.
|
||||
exec();
|
||||
|
||||
} else if ( no_trailing !== true ) {
|
||||
// In trailing throttle mode, since `delay` time has not been
|
||||
// exceeded, schedule `callback` to execute `delay` ms after most
|
||||
// recent execution.
|
||||
//
|
||||
// If `debounce_mode` is true (at_begin), schedule `clear` to execute
|
||||
// after `delay` ms.
|
||||
//
|
||||
// If `debounce_mode` is false (at end), schedule `callback` to
|
||||
// execute after `delay` ms.
|
||||
timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
|
||||
}
|
||||
};
|
||||
|
||||
// Set the guid of `wrapper` function to the same of original callback, so
|
||||
// it can be removed in jQuery 1.4+ .unbind or .die by using the original
|
||||
// callback as a reference.
|
||||
if ( $.guid ) {
|
||||
wrapper.guid = callback.guid = callback.guid || $.guid++;
|
||||
}
|
||||
|
||||
// Return the wrapper function.
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
// Method: jQuery.debounce
|
||||
//
|
||||
// Debounce execution of a function. Debouncing, unlike throttling,
|
||||
// guarantees that a function is only executed a single time, either at the
|
||||
// very beginning of a series of calls, or at the very end. If you want to
|
||||
// simply rate-limit execution of a function, see the <jQuery.throttle>
|
||||
// method.
|
||||
//
|
||||
// In this visualization, | is a debounced-function call and X is the actual
|
||||
// callback execution:
|
||||
//
|
||||
// > Debounced with `at_begin` specified as false or unspecified:
|
||||
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
||||
// > X X
|
||||
// >
|
||||
// > Debounced with `at_begin` specified as true:
|
||||
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
||||
// > X X
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
|
||||
// >
|
||||
// > jQuery('selector').bind( 'someevent', debounced );
|
||||
// > jQuery('selector').unbind( 'someevent', debounced );
|
||||
//
|
||||
// This also works in jQuery 1.4+:
|
||||
//
|
||||
// > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
|
||||
// > jQuery('selector').unbind( 'someevent', callback );
|
||||
//
|
||||
// Arguments:
|
||||
//
|
||||
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
||||
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
||||
// at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
|
||||
// unspecified, callback will only be executed `delay` milliseconds after
|
||||
// the last debounced-function call. If at_begin is true, callback will be
|
||||
// executed only at the first debounced-function call. (After the
|
||||
// throttled-function has not been called for `delay` milliseconds, the
|
||||
// internal counter is reset)
|
||||
// callback - (Function) A function to be executed after delay milliseconds.
|
||||
// The `this` context and all arguments are passed through, as-is, to
|
||||
// `callback` when the debounced-function is executed.
|
||||
//
|
||||
// Returns:
|
||||
//
|
||||
// (Function) A new, debounced, function.
|
||||
|
||||
$.debounce = function( delay, at_begin, callback ) {
|
||||
return callback === undefined
|
||||
? jq_throttle( delay, at_begin, false )
|
||||
: jq_throttle( delay, callback, at_begin !== false );
|
||||
};
|
||||
|
||||
})(this);
|
File diff suppressed because it is too large
Load Diff
@ -1,29 +1,24 @@
|
||||
/**
|
||||
* Javascript for editing manga, if logged in
|
||||
*/
|
||||
(function ($) {
|
||||
(($, AnimeClient, w) => {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
if (CONTROLLER !== "manga") return;
|
||||
|
||||
$(".edit_buttons button").on("click", function(e) {
|
||||
var this_sel = $(this);
|
||||
var parent_sel = $(this).closest("article");
|
||||
var manga_id = parent_sel.attr("id").replace("manga-", "");
|
||||
var type = this_sel.is(".plus_one_chapter") ? 'chapter' : 'volume';
|
||||
var completed = parseInt(parent_sel.find("." + type + "s_read").text(), 10);
|
||||
var total = parseInt(parent_sel.find("."+type+"_count").text(), 10);
|
||||
|
||||
console.log(completed);
|
||||
console.log(total);
|
||||
$('body.manga.list').on('click', '.edit_buttons button', function(e) {
|
||||
let this_sel = $(this);
|
||||
let parent_sel = $(this).closest("article");
|
||||
let manga_id = parent_sel.attr("id").replace("manga-", "");
|
||||
let type = this_sel.is(".plus_one_chapter") ? 'chapter' : 'volume';
|
||||
let completed = parseInt(parent_sel.find(`.${type}s_read`).text(), 10);
|
||||
let total = parseInt(parent_sel.find(`.${type}_count`).text(), 10);
|
||||
|
||||
if (isNaN(completed))
|
||||
{
|
||||
completed = 0;
|
||||
}
|
||||
|
||||
var data = {
|
||||
let data = {
|
||||
id: manga_id
|
||||
};
|
||||
|
||||
@ -35,14 +30,16 @@
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
mimeType: 'application/json',
|
||||
url: BASE_URL + CONTROLLER + '/update'
|
||||
}).done(function(res) {
|
||||
console.table(res);
|
||||
parent_sel.find("."+type+"s_read").text(completed);
|
||||
add_message('success', "Sucessfully updated " + res.manga[0].romaji_title);
|
||||
}).fail(function() {
|
||||
add_message('error', "Failed to updated " + res.manga[0].romaji_title);
|
||||
url: AnimeClient.url('/manga/update'),
|
||||
}).done((res) => {
|
||||
parent_sel.find(`.${type}s_read`).text(completed);
|
||||
AnimeClient.showMessage('success', `Sucessfully updated ${res.body.manga[0].romaji_title}`);
|
||||
|
||||
// scroll to top
|
||||
w.scroll(0,0);
|
||||
}).fail(() => {
|
||||
AnimeClient.showMessage('error', `Failed to updated ${res.body.manga[0].romaji_title}`);
|
||||
});
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
})(jQuery, AnimeClient, window);
|
@ -1,13 +0,0 @@
|
||||
function add_message(type, message)
|
||||
{
|
||||
var template = '<div class="message ' + type + '"><span class="icon"></span>' + message + '<span class="close" onclick="this.parentElement.style.display=\'none\'">x</span></div>';
|
||||
|
||||
if ($(".message").length > 0)
|
||||
{
|
||||
$(".message").replaceWith(template);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("main").prepend(template);
|
||||
}
|
||||
}
|
@ -1,8 +1,75 @@
|
||||
const LightTableSorter = (function() {
|
||||
let _cellIndex, _onClickEvent, _order, _reset, _sort, _text, _th, _toggle;
|
||||
_th = null;
|
||||
_cellIndex = null;
|
||||
_order = '';
|
||||
_text = function(row) {
|
||||
return row.cells.item(_cellIndex).textContent.toLowerCase();
|
||||
};
|
||||
_sort = function(a, b) {
|
||||
let n, textA, textB;
|
||||
textA = _text(a);
|
||||
textB = _text(b);
|
||||
n = parseInt(textA, 10);
|
||||
if (n) {
|
||||
textA = n;
|
||||
textB = parseInt(textB, 10);
|
||||
}
|
||||
if (textA > textB) {
|
||||
return 1;
|
||||
}
|
||||
if (textA < textB) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
_toggle = function() {
|
||||
let c;
|
||||
c = _order !== 'sorting_asc' ? 'sorting_asc' : 'sorting_desc';
|
||||
_th.className = (_th.className.replace(_order, '') + ' ' + c).trim();
|
||||
return _order = c;
|
||||
};
|
||||
_reset = function() {
|
||||
_th.className = _th.className.replace('sorting_asc', 'sorting').replace('sorting_desc', 'sorting');
|
||||
return _order = '';
|
||||
};
|
||||
_onClickEvent = function(e) {
|
||||
let row, rows, tbody, _i, _len;
|
||||
if (_th && (_cellIndex !== e.target.cellIndex)) {
|
||||
_reset();
|
||||
}
|
||||
_th = e.target;
|
||||
if (_th.nodeName.toLowerCase() === 'th') {
|
||||
_cellIndex = _th.cellIndex;
|
||||
tbody = _th.offsetParent.getElementsByTagName('tbody')[0];
|
||||
rows = tbody.rows;
|
||||
if (rows) {
|
||||
rows = Array.prototype.slice.call(rows, 0);
|
||||
rows = Array.prototype.sort.call(rows, _sort);
|
||||
if (_order === 'sorting_asc') {
|
||||
Array.prototype.reverse.call(rows);
|
||||
}
|
||||
_toggle();
|
||||
tbody.innerHtml = '';
|
||||
for (_i = 0, _len = rows.length; _i < _len; _i++) {
|
||||
row = rows[_i];
|
||||
tbody.appendChild(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
init: function() {
|
||||
let ths = document.getElementsByTagName('th');
|
||||
let _results = [];
|
||||
for (let _i = 0, _len = ths.length; _i < _len; _i++) {
|
||||
let th = ths[_i];
|
||||
th.className = 'sorting';
|
||||
_results.push(th.onclick = _onClickEvent);
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
$('table').DataTable({
|
||||
paging: false,
|
||||
searching: false,
|
||||
language: {
|
||||
info: ""
|
||||
}
|
||||
});
|
||||
LightTableSorter.init();
|
10
public/templates/ajax-search-results.html
Normal file
10
public/templates/ajax-search-results.html
Normal file
@ -0,0 +1,10 @@
|
||||
{{#anime}}
|
||||
<article class="media search">
|
||||
<div class="name" style="background-image:url({{cover_image}})">
|
||||
<input type="radio" class="big-check" id="{{slug}}" name="id" value="{{slug}}" />
|
||||
<label for="{{slug}}">
|
||||
<span>{{title}}<br />{{alternate_title}}</span>
|
||||
</label>
|
||||
</div>
|
||||
</article>
|
||||
{{/anime}}
|
@ -65,7 +65,7 @@ class HttpView extends BaseView {
|
||||
*/
|
||||
protected function output()
|
||||
{
|
||||
$this->response->headers->set('Content-Security-Policy', 'script-src self');
|
||||
$this->response->headers->set('Content-Security-Policy', "script-src 'self'");
|
||||
$this->response->headers->set('X-Content-Type-Options', 'nosniff');
|
||||
$this->response->headers->set('X-XSS-Protection', '1;mode=block');
|
||||
$this->response->headers->set('X-Frame-Options', 'SAMEORIGIN');
|
||||
|
Loading…
Reference in New Issue
Block a user