<template>
	<div id="app">
		{{ loc }}

		<hooper :settings="hooperSettings">
			<slide v-for="(n,index) of products" :key="n">
				<img :src="url + 'manga/'+ (index) +'.webp'" />
				<div class="page_n">{{ n }}</div>
			</slide>
			<hooper-navigation slot="hooper-addons"></hooper-navigation>
			<hooper-pagination slot="hooper-addons"></hooper-pagination>
			<hooper-progress slot="hooper-addons"></hooper-progress>
		</hooper>
		<div class="page">
			<a :href="this.url + this.s_a"><img :src="url + 'manga/' + this.s_a + '.webp'" v-on:click="page_run(s_a)"></a>
			<a :href="this.url + this.s_b"><button v-on:click="page_run(s_b)">2</button></a>
			<a :href="this.url + this.s_c"><button v-on:click="page_run(s_c)">3</button></a>
			<a :href="this.url + this.s_d"><button v-on:click="page_run(s_d)">4</button></a>
			<a :href="this.url + this.s_e"><button v-on:click="page_run(s_e)">5</button></a>
		</div>
	</div>
</template>

<script>
import {
  Hooper,
  Slide,
  Progress as HooperProgress,
  Pagination as HooperPagination,
  Navigation as HooperNavigation
} from 'hooper';

import 'hooper/dist/hooper.css';
var page = 107;
var loc = window.location.pathname.split('/').slice(-1)[0];
//let loc = window.location.pathname.split('/').slice(0)[3];

export default {
  name: 'App',
  components: {
    Hooper,
    Slide,
    HooperProgress,
    HooperPagination,
    HooperNavigation
  },
  data() {
    return {
					url: "/",
					s_a: 0,
					s_b: 17,
					s_c: 41,
					s_d: 51,
					s_e: 60,
      products: [...Array(Number(page)).keys()],
      hooperSettings: {
							itemsToShow: 1,
							centerMode: true,
							initialSlide: loc,
						}
    };
		},
		methods: {
			page_run(s) {
				this.loc = s;
				this.hooperSettings.initialSlide = s;
			}
		}
};
</script>

<style>
.page_n{text-align:center;height:50px}
.hooper-pagination{position:fixed}
.hooper-next,.hooper-prev{background-color:rgba(184,207,224,.24)}
.hooper-indicator{
	background-color:#000;
	display:none;
}

.hooper{
	height:100%;
	text-align:center;
}

button {
	padding: 10px;
	margin: 5px;
	background-color: #fff700;
	color: #313131;
	border: solid 2px;
}

ul.hooper-track {
	padding: 0px;
}

img{
	width:500px;
}

.page {
	text-align:center;
	margin:50px 20px 50px 20px;
	background-color: rgba(184, 207, 224, .24);
	padding: 20px;
}

.page a img {
	border: solid 2px #313131;
	width:100px;
	margin: auto;
	display: block;
}

.page a button {
}

footer {
	text-align: center;
}

@media screen and (max-width:1000px) { 
	img{width:100%;}
}
</style>
