This commit is contained in:
vsphim 2026-05-20 11:45:14 +07:00
parent 928b6c8b9b
commit ce6e239a05
38 changed files with 4725 additions and 0 deletions

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# THEME - ANIMEH 2023 - VSMOV CMS
## Demo
### Trang Chủ
![Alt text](https://i.ibb.co/vZrw96p/THEME-ANIMEH-INDEX.png "Home Page")
### Trang Danh Sách Phim
![Alt text](https://i.ibb.co/4NXPwvF/THEME-ANIMEH-CATALOG.png "Catalog Page")
### Trang Thông Tin Phim
![Alt text](https://i.ibb.co/855MgVy/THEME-ANIMEH-SINGLE.png "Single Page")
### Trang Xem Phim
![Alt text](https://i.ibb.co/bj4FpXF/THEME-ANIMEH-EPISODE.png "Episode Page")
## Requirements
https://github.com/vsphim/vsmov-core
## Install
1. Tại thư mục của Project: `composer require vsmov/theme-animeh`
2. Kích hoạt giao diện trong Admin Panel
## Update
1. Tại thư mục của Project: `composer update vsmov/theme-animeh`
2. Re-Activate giao diện trong Admin Panel
## Note
- Một vài lưu ý quan trọng của các nút chức năng:
+ `Activate``Re-Activate` sẽ publish toàn bộ file js,css trong themes ra ngoài public của laravel.
+ `Reset` reset lại toàn bộ cấu hình của themes
## Document
### List
- Home page: `display_label|relation|find_by_field|value|sort_by_field|sort_algo|limit|show_more_url`
####
Phim chiếu rạp mới||is_shown_in_theater|1|created_at|desc|10|/danh-sach/phim-chieu-rap
Phim bộ mới||type|series|updated_at|desc|10|/danh-sach/phim-bo
Phim lẻ mới||type|single|updated_at|desc|10|/danh-sach/phim-le
Phim hoạt hình mới|categories|slug|hoat-hinh|updated_at|desc|10|/the-loai/hoat-hinh
Top phim||is_copyright|0|view_week|desc|10|#
####
### Custom View Blade
- File blade gốc trong Package: `/vendor/vsmov/vsmov-animeh/resources/views/themeanimeh`
- Copy file cần custom đến: `/resources/views/vendor/themes/animeh`

32
composer.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "vsmov/theme-animeh",
"description": "VsMov's animeh theme",
"type": "library",
"authors": [
{
"name": "vsmov",
"email": "vsmov@gmail.com"
}
],
"require": {
"laravel/framework": "^6|^7|^8",
"ckfinder/ckfinder-laravel-package": "v3.5.2.1",
"vsmov/vsmov-core": "^1.0.0"
},
"license": "MIT",
"autoload": {
"psr-4": {
"VsMov\\ThemeAnimeH\\": "src/",
"VsMov\\ThemeAnimeH\\Database\\Factories\\": "database/factories/",
"VsMov\\ThemeAnimeH\\Database\\Seeders\\": "database/seeders/"
}
},
"extra": {
"laravel": {
"providers": [
"VsMov\\ThemeAnimeH\\ThemeAnimeHServiceProvider"
]
}
},
"minimum-stability": "stable"
}

2121
resources/assets/css/css.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
$(document).ready(function () {
$(".parent-menu").click(function () {
$(".parent-menu").each(function () {
$(this).removeClass("active");
})
$(".sub-menu-content").each(function () {
$(this).removeClass("display-block");
})
$(this).addClass("active");
let tabId = $(this).attr("bind").split("-")[1]
$(`#tab-${tabId}`).addClass("display-block");
})
$("#rated").click(function () {
$("#modal").css({ "display": "block", "position": "absolute", "visibility": "visible", "top": "400px", "left": "50%", "transition": "top 0.3s ease 0s", "transform": "translate(-50%, -50%)", "width": "100%" });
})
$("#close-modal-rated").click(function () {
$("#modal").css({ "display": "block", "visibility": "hidden", "top": "0px", "transition": "top 0.3s ease 0s" })
})
$("#report_error").click(function () {
if ($("#episode_error").css('display') != 'block') {
$("#episode_error").css('display', 'block')
} else {
$("#episode_error").css('display', 'none')
}
})
$("input#error_send").click(function () {
console.log(123);
let error_message = $("input[name=error_message]").val();
fetch(ROUTE_REPORT_ERROR, {
method: 'POST',
headers: {
"Content-Type": "application/json",
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute(
'content')
},
body: JSON.stringify({
message: error_message
})
});
$.toast({
heading: 'Thông báo',
text: 'Phản hồi của bạn đã được gửi đi!',
position: 'bottom-right',
icon: 'info',
loader: true,
loaderBg: '#9EC600',
bgColor: '#212121',
textColor: 'white'
})
$("#episode_error").remove();
})
$("#toggle_trailer").click(function () {
$("#modal-trailer").css({ "display": "block", "position": "absolute", "visibility": "visible", "top": "300px", "left": "50%", "transition": "top 0.3s ease 0s", "transform": "translate(-50%, -50%)", "width": "100%" });
})
$("#close-modal-trailer").click(function () {
$("#modal-trailer").css({ "display": "block", "visibility": "hidden", "top": "0px", "transition": "top 0.3s ease 0s" })
})
});
function clickEventDropDown(this_dropdown, icon_default = "Null") {
var _name = this_dropdown.getAttribute("bind");
var _dropdown_menu = document.getElementById(_name);
if (!_dropdown_menu.style.display || _dropdown_menu.style.display === "none") {
this_dropdown.innerHTML = `<span class="material-icons-round">highlight_off</span>`;
if (icon_default !== "expand_more") {
this_dropdown.style.backgroundColor = "#ab3e3e";
}
_dropdown_menu.style.display = "flex";
setTimeout(function () {
_dropdown_menu.style.transform = "scale(1)";
}, 50)
} else {
_dropdown_menu.style = null;
this_dropdown.style = null;
this_dropdown.innerHTML = `<span class="material-icons-round">${icon_default}</span>`;
}
}

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-carousel,.owl-carousel .owl-item{-webkit-tap-highlight-color:transparent;position:relative}.owl-carousel{display:none;width:100%;z-index:1}.owl-carousel .owl-stage{position:relative;-ms-touch-action:pan-Y;touch-action:manipulation;-moz-backface-visibility:hidden}.owl-carousel .owl-stage:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.owl-carousel .owl-stage-outer{position:relative;overflow:hidden;-webkit-transform:translate3d(0,0,0)}.owl-carousel .owl-item,.owl-carousel .owl-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.owl-carousel .owl-item{min-height:1px;float:left;-webkit-backface-visibility:hidden;-webkit-touch-callout:none}.owl-carousel .owl-item img{display:block;width:100%}.owl-carousel .owl-dots.disabled,.owl-carousel .owl-nav.disabled{display:none}.no-js .owl-carousel,.owl-carousel.owl-loaded{display:block}.owl-carousel .owl-dot,.owl-carousel .owl-nav .owl-next,.owl-carousel .owl-nav .owl-prev{cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel .owl-nav button.owl-next,.owl-carousel .owl-nav button.owl-prev,.owl-carousel button.owl-dot{background:0 0;color:inherit;border:none;padding:0!important;font:inherit}.owl-carousel.owl-loading{opacity:0;display:block}.owl-carousel.owl-hidden{opacity:0}.owl-carousel.owl-refresh .owl-item{visibility:hidden}.owl-carousel.owl-drag .owl-item{-ms-touch-action:pan-y;touch-action:pan-y;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel.owl-grab{cursor:move;cursor:grab}.owl-carousel.owl-rtl{direction:rtl}.owl-carousel.owl-rtl .owl-item{float:right}.owl-carousel .animated{animation-duration:1s;animation-fill-mode:both}.owl-carousel .owl-animated-in{z-index:0}.owl-carousel .owl-animated-out{z-index:1}.owl-carousel .fadeOut{animation-name:fadeOut}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.owl-height{transition:height .5s ease-in-out}.owl-carousel .owl-item .owl-lazy{opacity:0;transition:opacity .4s ease}.owl-carousel .owl-item .owl-lazy:not([src]),.owl-carousel .owl-item .owl-lazy[src^=""]{max-height:0}.owl-carousel .owl-item img.owl-lazy{transform-style:preserve-3d}.owl-carousel .owl-video-wrapper{position:relative;height:100%;background:#000}.owl-carousel .owl-video-play-icon{position:absolute;height:80px;width:80px;left:50%;top:50%;margin-left:-40px;margin-top:-40px;background:url(owl.video.play.png) no-repeat;cursor:pointer;z-index:1;-webkit-backface-visibility:hidden;transition:transform .1s ease}.owl-carousel .owl-video-play-icon:hover{-ms-transform:scale(1.3,1.3);transform:scale(1.3,1.3)}.owl-carousel .owl-video-playing .owl-video-play-icon,.owl-carousel .owl-video-playing .owl-video-tn{display:none}.owl-carousel .owl-video-tn{opacity:0;height:100%;background-position:center center;background-repeat:no-repeat;background-size:contain;transition:opacity .4s ease}.owl-carousel .owl-video-frame{position:relative;z-index:1;height:100%;width:100%}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-theme .owl-dots,.owl-theme .owl-nav{text-align:center;-webkit-tap-highlight-color:transparent}.owl-theme .owl-nav{margin-top:10px}.owl-theme .owl-nav [class*=owl-]{color:#FFF;font-size:14px;margin:5px;padding:4px 7px;background:#D6D6D6;display:inline-block;cursor:pointer;border-radius:3px}.owl-theme .owl-nav [class*=owl-]:hover{background:#869791;color:#FFF;text-decoration:none}.owl-theme .owl-nav .disabled{opacity:.5;cursor:default}.owl-theme .owl-nav.disabled+.owl-dots{margin-top:10px}.owl-theme .owl-dots .owl-dot{display:inline-block;zoom:1}.owl-theme .owl-dots .owl-dot span{width:10px;height:10px;margin:5px 7px;background:#D6D6D6;display:block;-webkit-backface-visibility:visible;transition:opacity .2s ease;border-radius:30px}.owl-theme .owl-dots .owl-dot.active span,.owl-theme .owl-dots .owl-dot:hover span{background:#869791}

Binary file not shown.

View File

@ -0,0 +1,15 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="raty" horiz-adv-x="512">
<font-face units-per-em="512" ascent="480" descent="-32" />
<missing-glyph horiz-adv-x="512" />
<glyph unicode="&#x20;" d="" horiz-adv-x="256" />
<glyph unicode="&#xe600;" d="M256 16c-114.88 0-208 93.12-208 208s93.12 208 208 208 208-93.12 208-208-93.12-208-208-208zM351.376 284.656c3.904 3.904 3.904 10.256 0 14.16l-21.248 21.232c-3.904 3.904-10.256 3.904-14.16 0l-60.176-60.176-60.176 60.176c-3.904 3.904-10.256 3.904-14.16 0l-21.248-21.232c-3.904-3.904-3.904-10.256 0-14.16l60.192-60.192-60.192-60.16c-3.904-3.904-3.904-10.256 0-14.16l21.248-21.248c3.904-3.904 10.256-3.904 14.16 0l60.176 60.192 60.176-60.192c3.904-3.904 10.256-3.904 14.16 0l21.248 21.248c3.904 3.904 3.904 10.256 0 14.16l-60.192 60.16 60.192 60.192z" />
<glyph unicode="&#xe601;" d="M256 16c-114.88 0-208 93.12-208 208s93.12 208 208 208 208-93.12 208-208-93.12-208-208-208zM256 384c-88.352 0-160-71.648-160-160s71.648-160 160-160c88.368 0 160 71.648 160 160s-71.632 160-160 160zM328.592 167.44l-16.224-16.224c-2.976-2.976-7.808-2.976-10.8 0l-45.92 45.92-45.92-45.92c-2.992-2.976-7.808-2.976-10.8 0l-16.224 16.224c-2.976 2.976-2.976 7.808 0 10.8l45.936 45.904-45.936 45.92c-2.976 2.992-2.976 7.824 0 10.816l16.224 16.208c2.992 2.992 7.808 2.992 10.8 0l45.92-45.92 45.92 45.92c2.992 2.992 7.824 2.992 10.8 0l16.224-16.208c2.976-2.992 2.976-7.824 0-10.816l-45.936-45.92 45.936-45.904c2.976-2.992 2.976-7.84 0-10.8z" />
<glyph unicode="&#xf005;" d="M475.428 290.572q0-6.286-7.428-13.714l-103.714-101.143 24.572-142.857q0.286-2 0.286-5.714 0-6-3-10.143t-8.714-4.143q-5.428 0-11.428 3.428l-128.286 67.428-128.286-67.428q-6.285-3.428-11.428-3.428-6 0-9 4.143t-3 10.143q0 1.714 0.572 5.714l24.572 142.857-104 101.143q-7.143 7.714-7.143 13.714 0 10.572 16 13.143l143.428 20.857 64.286 130q5.428 11.714 14 11.714t14-11.714l64.286-130 143.429-20.857q16-2.572 16-13.143z" horiz-adv-x="476" />
<glyph unicode="&#xf006;" d="M324.857 188.572l87.428 84.857-120.572 17.715-54 109.143-54-109.143-120.572-17.714 87.428-84.857-20.857-120.286 108 56.857 107.714-56.857zM475.428 290.572q0-6.286-7.428-13.714l-103.714-101.143 24.572-142.857q0.286-2 0.286-5.714 0-14.286-11.714-14.286-5.428 0-11.428 3.428l-128.286 67.428-128.286-67.428q-6.285-3.428-11.428-3.428-6 0-9 4.143t-3 10.143q0 1.714 0.572 5.714l24.572 142.857-104 101.143q-7.143 7.714-7.143 13.714 0 10.572 16 13.143l143.428 20.857 64.286 130q5.428 11.714 14 11.714t14-11.714l64.286-130 143.429-20.857q16-2.572 16-13.143z" horiz-adv-x="476" />
<glyph unicode="&#xf123;" d="M338.857 202l73.428 71.428-120.572 17.714-8.572 17.143-45.428 92v-275.143l16.857-8.857 90.857-48-17.143 101.428-3.428 18.857zM468 276.857l-103.714-101.143 24.572-142.857q1.428-9.428-1.714-14.714t-9.714-5.286q-4.857 0-11.428 3.428l-128.286 67.428-128.286-67.428q-6.572-3.428-11.428-3.428-6.572 0-9.715 5.286t-1.715 14.714l24.572 142.857-104 101.143q-9.143 9.143-6.572 17t15.428 9.857l143.429 20.857 64.286 130q5.714 11.714 14 11.714 8 0 14-11.714l64.286-130 143.429-20.857q12.857-2 15.428-9.857t-6.857-17z" horiz-adv-x="476" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,46 @@
.cancel-on-png, .cancel-off-png, .star-on-png, .star-off-png, .star-half-png {
font-size: 2em;
}
@font-face {
font-family: "raty";
font-style: normal;
font-weight: normal;
src: url("./fonts/raty.eot");
src: url("./fonts/raty.eot?#iefix") format("embedded-opentype");
src: url("./fonts/raty.svg#raty") format("svg");
src: url("./fonts/raty.ttf") format("truetype");
src: url("./fonts/raty.woff") format("woff");
}
.cancel-on-png, .cancel-off-png, .star-on-png, .star-off-png, .star-half-png {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: "raty";
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
speak: none;
text-transform: none;
}
.cancel-on-png:before {
content: "\e600";
}
.cancel-off-png:before {
content: "\e601";
}
.star-on-png:before {
content: "\f005";
}
.star-off-png:before {
content: "\f006";
}
.star-half-png:before {
content: "\f123";
}

View File

@ -0,0 +1,777 @@
/*!
* Raty - A Star Rating Plugin
*
* The MIT License
*
* author: Washington Botelho
* github: wbotelhos/raty
* version: 3.1.0
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('jquery'));
} else {
factory(root.jQuery);
}
}(this, function($) {
'use strict';
$.raty = {
cancelButton: false,
cancelClass: 'raty-cancel',
cancelHint: 'Cancel this rating!',
cancelOff: 'cancel-off.png',
cancelOn: 'cancel-on.png',
cancelPlace: 'left',
click: undefined,
half: false,
halfShow: true,
hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'],
iconRange: undefined,
iconRangeSame: false,
mouseout: undefined,
mouseover: undefined,
noRatedMsg: 'Not rated yet!',
number: 5,
numberMax: 20,
path: undefined,
precision: false,
readOnly: false,
round: { down: 0.25, full: 0.6, up: 0.76 },
score: undefined,
scoreName: 'score',
single: false,
space: true,
starHalf: 'star-half.png',
starOff: 'star-off.png',
starOn: 'star-on.png',
starType: 'img',
target: undefined,
targetFormat: '{score}',
targetKeep: false,
targetScore: undefined,
targetText: '',
targetType: 'hint'
};
$.fn.raty = function(options) {
return this.each(function() {
var instance = new $.raty.Raty(this, options);
return instance._create();
});
};
$.raty.Raty = (function() {
var Raty = function(element, options) {
this.element = element;
this.self = $(element);
this.opt = $.extend(true, {}, $.raty, options, this.self.data());
};
Raty.prototype = {
_create: function() {
this._executeCallbacks();
this._adjustNumber();
this._adjustHints();
this.opt.score = this._adjustedScore(this.opt.score);
if (this.opt.starType !== 'img') {
this._adjustStarName();
}
this._setPath();
this._createStars();
if (this.opt.cancelButton) {
this._createCancel();
}
if (this.opt.precision) {
this._adjustPrecision();
}
this._createScore();
this._apply(this.opt.score);
this._setTitle(this.opt.score);
this._target(this.opt.score);
if (this.opt.readOnly) {
this._lock();
} else {
this.element.style.cursor = 'pointer';
this._binds();
}
this.self.data('raty', this);
},
// TODO: model spec
_adjustedScore: function(score) {
if (score || score === 0) {
return this._between(score, 0, this.opt.number);
}
},
_adjustHints: function() {
if (!this.opt.hints) {
this.opt.hints = [];
}
if (!this.opt.halfShow && !this.opt.half) {
return;
}
var steps = this.opt.precision ? 10 : 2;
for (var i = 0; i < this.opt.number; i++) {
var group = this.opt.hints[i];
if (Object.prototype.toString.call(group) !== '[object Array]') {
group = [group];
}
this.opt.hints[i] = [];
for (var j = 0; j < steps; j++) {
var hint = group[j];
var last = group[group.length - 1];
if (last === undefined) {
last = null;
}
this.opt.hints[i][j] = hint === undefined ? last : hint;
}
}
},
_adjustNumber: function() {
this.opt.number = this._between(this.opt.number, 1, this.opt.numberMax);
},
_adjustPrecision: function() {
this.opt.half = true;
},
_adjustStarName: function() {
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
this.opt.path = '';
for (var i = 0; i < replaces.length; i++) {
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
}
},
// TODO: model spec
_apply: function(score) {
this._fill(score);
if (score) {
if (score > 0) {
this.scoreField.val(score);
}
this._roundStars(score);
}
},
_attributesForIndex: function(i) {
var name = this._nameForIndex(i);
var attributes = { alt: i, src: this.opt.path + this.opt[name] };
if (this.opt.starType !== 'img') {
attributes = { 'data-alt': i, 'class': this.opt[name] };
}
attributes.title = this._getHint(i);
return attributes;
},
_between: function(value, min, max) {
return Math.min(Math.max(parseFloat(value), min), max);
},
// TODO: model spec
_binds: function() {
if (this.cancelButton) {
this._bindOverCancel();
this._bindClickCancel();
this._bindOutCancel();
}
this._bindOver();
this._bindClick();
this._bindOut();
},
// TODO: model spec
_bindClick: function() {
var that = this;
this.stars.on('click.raty', function(evt) {
if (that.self.data('readonly')) {
return;
}
var execute = true;
var score = (that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || $(this).data('alt'));
if (that.opt.half && !that.opt.precision) {
score = that._roundHalfScore(score);
}
if (that.opt.click) {
execute = that.opt.click.call(that.element, +score, evt);
}
if (execute || execute === undefined) {
that._apply(+score);
}
});
},
// TODO: model spec
_bindClickCancel: function() {
this.cancelButton.on('click.raty', function(evt) {
this.scoreField.removeAttr('value');
if (this.opt.click) {
this.opt.click.call(this.element, null, evt);
}
}.bind(this));
},
// TODO: model spec
_bindOut: function() {
this.self.on('mouseleave.raty', function(evt) {
var score = +this.scoreField.val() || undefined;
this._apply(score);
this._target(score, evt);
this._resetTitle();
if (this.opt.mouseout) {
this.opt.mouseout.call(this.element, score, evt);
}
}.bind(this));
},
// TODO: model spec
_bindOutCancel: function() {
var that = this;
this.cancelButton.on('mouseleave.raty', function(evt) {
var icon = that.opt.cancelOff;
if (that.opt.starType !== 'img') {
icon = that.opt.cancelClass + ' ' + icon;
}
that._setIcon(this, icon);
if (that.opt.mouseout) {
var score = +that.scoreField.val() || undefined;
that.opt.mouseout.call(that.element, score, evt);
}
});
},
// TODO: model spec
_bindOver: function() {
var that = this;
var action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
this.stars.on(action, function(evt) {
var score = that._getScoreByPosition(evt, this);
that._fill(score);
if (that.opt.half) {
that._roundStars(score, evt);
that._setTitle(score, evt);
that.self.data('score', score);
}
that._target(score, evt);
if (that.opt.mouseover) {
that.opt.mouseover.call(that.element, score, evt);
}
});
},
// TODO: model spec
_bindOverCancel: function() {
var that = this;
this.cancelButton.on('mouseover.raty', function(evt) {
if (that.self.data('readonly')) {
return;
}
var starOff = that.opt.path + that.opt.starOff;
var icon = that.opt.cancelOn;
if (that.opt.starType === 'img') {
that.stars.attr('src', starOff);
} else {
icon = that.opt.cancelClass + ' ' + icon;
that.stars.attr('class', starOff);
}
that._setIcon(this, icon);
that._target(null, evt);
if (that.opt.mouseover) {
that.opt.mouseover.call(that.element, null);
}
});
},
// TODO: model spec
_buildScoreField: function() {
return $('<input />', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this.self);
},
// TODO: model spec
_createCancel: function() {
var icon = this.opt.path + this.opt.cancelOff;
var button = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': this.opt.cancelClass });
if (this.opt.starType === 'img') {
button.attr({ src: icon, alt: 'x' });
} else {
// TODO: use $.data
button.attr('data-alt', 'x').addClass(icon);
}
if (this.opt.cancelPlace === 'left') {
this.self.prepend('&#160;').prepend(button);
} else {
this.self.append('&#160;').append(button);
}
this.cancelButton = button;
},
// TODO: model spec
_createScore: function() {
var score = $(this.opt.targetScore);
this.scoreField = score.length ? score : this._buildScoreField();
},
_createStars: function() {
for (var i = 1; i <= this.opt.number; i++) {
var attributes = this._attributesForIndex(i);
$('<' + this.opt.starType + ' />', attributes).appendTo(this.element);
if (this.opt.space && i < this.opt.number) {
this.self.append('&#160;');
}
}
this.stars = this.self.children(this.opt.starType);
},
// TODO: model spec
_error: function(message) {
$(this).text(message);
$.error(message);
},
_executeCallbacks: function() {
var options = ['number', 'readOnly', 'score', 'scoreName', 'target', 'path'];
for (var i = 0; i < options.length; i++) {
if (typeof this.opt[options[i]] === 'function') {
var value = this.opt[options[i]].call(this.element);
if (value) {
this.opt[options[i]] = value;
} else {
delete this.opt[options[i]];
}
}
}
},
// TODO: model spec
_fill: function(score) {
var hash = 0;
if (this.opt.iconRangeSame && this.opt.iconRange) {
while (hash < this.opt.iconRange.length && this.opt.iconRange[hash].range < score) {
hash++;
}
}
for (var i = 1; i <= this.stars.length; i++) {
var icon;
var star = this.stars[i - 1];
var turnOn = this._turnOn(i, score);
if (this.opt.iconRange && this.opt.iconRange.length > hash) {
var irange = this.opt.iconRange[hash];
icon = this._getRangeIcon(irange, turnOn);
if (i <= irange.range) {
this._setIcon(star, icon);
}
if (i === irange.range) {
hash++;
}
} else {
icon = this.opt[turnOn ? 'starOn' : 'starOff'];
this._setIcon(star, icon);
}
}
},
_getDecimal: function(number, fractions) {
var decimal = number.toString().split('.')[1];
var result = 0;
if (decimal) {
result = parseInt(decimal.slice(0, fractions), 10);
if (decimal.slice(1, 5) === '9999') {
result++;
}
}
return result;
},
// TODO: model spec
_getRangeIcon: function(irange, turnOn) {
return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff;
},
// TODO: model spec
_getScoreByPosition: function(evt, icon) {
var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10);
if (this.opt.half) {
var size = this._getWidth();
var percent = parseFloat((evt.pageX - $(icon).offset().left) / size);
score = score - 1 + percent;
}
return score;
},
// TODO: model spec
_getHint: function(score, evt) {
if (score !== 0 && !score) {
return this.opt.noRatedMsg;
}
var decimal = this._getDecimal(score, 1);
var integer = Math.ceil(score);
var group = this.opt.hints[(integer || 1) - 1];
var hint = group;
var set = !evt || this.isMove;
if (this.opt.precision) {
if (set) {
decimal = decimal === 0 ? 9 : decimal - 1;
}
hint = group[decimal];
} else if (this.opt.halfShow || this.opt.half) {
decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0;
hint = group[decimal];
}
return hint === '' ? '' : hint || score;
},
// TODO: model spec
_getWidth: function() {
var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size'));
if (!width) {
this._error('Could not get the icon width!');
}
return width;
},
// TODO: model spec
_lock: function() {
var hint = this._getHint(this.scoreField.val());
this.element.style.cursor = '';
this.element.title = hint;
this.scoreField.prop('readonly', true);
this.stars.prop('title', hint);
if (this.cancelButton) {
this.cancelButton.hide();
}
this.self.data('readonly', true);
},
_nameForIndex: function(i) {
return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';
},
// TODO: model spec
_resetTitle: function() {
for (var i = 0; i < this.opt.number; i++) {
this.stars[i].title = this._getHint(i + 1);
}
},
// TODO: model spec
_roundHalfScore: function(score) {
var integer = parseInt(score, 10);
var decimal = this._getDecimal(score, 1);
if (decimal !== 0) {
decimal = decimal > 5 ? 1 : 0.5;
}
return integer + decimal;
},
// TODO: model spec
_roundStars: function(score, evt) {
var name = this._starName(score, evt);
if (name) {
var icon = this.opt[name];
var star = this.stars[Math.ceil(score) - 1];
this._setIcon(star, icon);
} // Full down: [x.00 .. x.25]
},
// TODO: model spec
_setIcon: function(star, icon) {
star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
},
_setPath: function() {
this.opt.path = this.opt.path || '';
if (this.opt.path && this.opt.path.slice(-1)[0] !== '/') {
this.opt.path += '/';
}
},
// TODO: model spec
_setTarget: function(target, score) {
if (score) {
score = this.opt.targetFormat.toString().replace('{score}', score);
}
if (target.is(':input')) {
target.val(score);
} else {
target.html(score);
}
},
// TODO: model spec
_setTitle: function(score, evt) {
if (score) {
var integer = parseInt(Math.ceil(score), 10);
var star = this.stars[integer - 1];
star.title = this._getHint(score, evt);
}
},
_starName: function(score, evt) {
var decimal = +(score % 1).toFixed(2);
if (evt || this.isMove) {
return decimal > 0.5 ? 'starOn' : 'starHalf';
}
if (decimal <= this.opt.round.down) { // Down: [x.00 ... x.25]
return;
}
if (this.opt.halfShow && decimal < this.opt.round.up) { // Half: [x.26 ... x.75]
return 'starHalf';
}
if (decimal < this.opt.round.full) { // Off: [x.26 .. x.6]
return 'starOff';
}
return 'starOn'; // Up: [x.26 ...] || [x.6 ...]
},
// TODO: model spec
_target: function(score, evt) {
if (this.opt.target) {
var target = $(this.opt.target);
if (!target.length) {
this._error('Target selector invalid or missing!');
}
var mouseover = evt && evt.type === 'mouseover';
if (score === undefined) {
score = this.opt.targetText;
} else if (score === null) {
score = mouseover ? this.opt.cancelHint : this.opt.targetText;
} else {
if (this.opt.targetType === 'hint') {
score = this._getHint(score, evt);
} else if (this.opt.precision) {
score = parseFloat(score).toFixed(1);
}
var mousemove = evt && evt.type === 'mousemove';
if (!mouseover && !mousemove && !this.opt.targetKeep) {
score = this.opt.targetText;
}
}
this._setTarget(target, score);
}
},
// TODO: model spec
_turnOn: function(i, score) {
return this.opt.single ? (i === score) : (i <= score);
},
// TODO: model spec
_unlock: function() {
this.element.style.cursor = 'pointer';
this.element.removeAttribute('title');
this.scoreField.removeAttr('readonly');
this.self.data('readonly', false);
this._resetTitle();
if (this.cancelButton) {
this.cancelButton.css('display', '');
}
},
// TODO: model spec
cancel: function(click) {
if (this.self.data('readonly') !== true) {
this[click ? 'click' : 'score'].call(this, null);
this.scoreField.removeAttr('value');
}
},
// TODO: model spec
click: function(score) {
if (this.self.data('readonly') !== true) {
score = this._adjustedScore(score);
this._apply(score);
if (this.opt.click) {
this.opt.click.call(this.element, score, $.Event('click'));
}
this._target(score);
}
},
// TODO: model spec
getScore: function() {
var score = [];
var value ;
value = this.scoreField.val();
score.push(value ? +value : undefined);
return (score.length > 1) ? score : score[0];
},
// TODO: model spec
move: function(score) {
var integer = parseInt(score, 10);
var decimal = this._getDecimal(score, 1);
if (integer >= this.opt.number) {
integer = this.opt.number - 1;
decimal = 10;
}
var width = this._getWidth();
var steps = width / 10;
var star = $(this.stars[integer]);
var percent = star.offset().left + steps * decimal;
var evt = $.Event('mousemove', { pageX: percent });
this.isMove = true;
star.trigger(evt);
this.isMove = false;
},
// TODO: model spec
readOnly: function(readonly) {
if (this.self.data('readonly') !== readonly) {
if (readonly) {
this.self.off('.raty').children(this.opt.starType).off('.raty');
this._lock();
} else {
this._binds();
this._unlock();
}
this.self.data('readonly', readonly);
}
},
// TODO: model spec
score: function() {
return arguments.length ? this.setScore.apply(this, arguments) : this.getScore();
},
setScore: function(score) {
if (this.self.data('readonly') !== true) {
score = this._adjustedScore(score);
this._apply(score);
this._target(score);
}
}
};
return Raty;
})();
}));

View File

@ -0,0 +1,27 @@
@extends('themes::themeanimeh.layout')
@php
$years = Cache::remember('all_years', \Backpack\Settings\app\Models\Setting::get('site_cache_ttl', 5 * 60), function () {
return \VsMov\Core\Models\Movie::select('publish_year')
->distinct()
->pluck('publish_year')
->sortDesc();
});
@endphp
@section('content')
<div class="margin-10-0 bg-gray-2">
<div class="fs-17 fw-700 padding-0-20 color-gray inline-flex height-40 flex-hozi-center bg-black border-l-t">
{{ $section_name }} </div>
</div>
@include('themes::themeanimeh.inc.catalog_filter')
<div class="movies-list">
@if(!count($data))
<p>Không dữ liệu cho mục này!</p>
@endif
@foreach ($data as $movie)
@include('themes::themeanimeh.inc.section_home_item')
@endforeach
</div>
{{ $data->appends(request()->all())->links('themes::themeanimeh.inc.pagination') }}
@endsection

View File

@ -0,0 +1,398 @@
@extends('themes::themeanimeh.layout')
@push('header')
<style>
.watching-movie #video-player {
height: 580px !important;
}
@media only screen and (max-width: 700px) {
.watching-movie #video-player {
height: 210px !important;
}
}
</style>
<script>
const ROUTE_REPORT_ERROR = '{{ route('episodes.report', ['movie' => $currentMovie->slug, 'episode' => $episode->slug, 'id' => $episode->id]) }}';
</script>
@endpush
@section('content')
<div id="modal" class="modal" style="display: block; visibility: hidden; top: 0px; transition: top 0.3s ease 0s;">
<div>
<div>{{$currentMovie->getRatingStar()}} sao / {{$currentMovie->getRatingCount()}} lượt đánh giá</div>
<a id="close-modal-rated" href="javascript:;">
<span class="material-icons-round margin-0-5"> close </span>
</a>
</div>
<div>
<div id="movies-rating-star" class="rated-star flex flex-hozi-center flex-ver-center">
</div>
</div>
</div>
<div class="watching-movie">
<div class="ah-frame-bg fw-700 margin-10-0 bg-black">
<a href="{{$currentMovie->getUrl()}}"
class="fs-16 flex flex-hozi-center color-yellow border-style-1">
<span class="material-icons-round margin-0-5"> movie </span>{{$currentMovie->name}} </a>
<div class="flex flex-space-auto">
<span>Đang xem Tập {{$episode->name}} </span>
</div>
</div>
<div class="control-bar flex flex-space-between bg-cod-gray">
<div class="bg-black flex flex-hozi-center fw-500 fs-17 padding-0-10 height-50 border-l-b-t">
<div class="margin-10-0 bg-gray-2">
<div
class="fs-17 fw-700 padding-0-20 color-gray inline-flex height-40 flex-hozi-center bg-black border-l-t">
Tập {{$episode->name}} </div>
</div>
</div>
<div class="bg-black flex flex-hozi-center fs-17 padding-0-10 height-50 border-r-b-t">
<a href="{{$currentMovie->getUrl()}}"
class="button-default padding-5 bg-brown fs-21" title="Thông tin phim">
<span class="material-icons-round"> info </span>
</a>
<button id="rated" class="button-default padding-5 bg-orange fs-21 color-white">
<span class="material-icons-round"> stars </span>
</button>
<button id="report_error" class="button-default padding-5 bg-red fs-21 color-white">
<span class="material-icons-round"> report_problem </span>
</button>
</div>
</div>
<center id="episode_error">
<input type="text" name="error_message" placeholder="Điền chi tiết lỗi">
<input type="button" id="error_send" value="Gửi">
</center>
<div id="list_sv" class="flex flex-ver-center margin-10">
@foreach ($currentMovie->episodes->where('slug', $episode->slug)->where('server', $episode->server) as $server)
<a onclick="chooseStreamingServer(this)" data-type="{{ $server->type }}" data-id="{{ $server->id }}" data-link="{{ $server->link }}" class="streaming-server button-default">
<span>Nguồn Phát <span>#{{ $loop->index + 1 }}</span></span>
</a>
@endforeach
</div>
<div id="video-player"></div>
@if ($currentMovie->showtimes && $currentMovie->showtimes != '')
<div class="ah-frame-bg">
<div class="heading flex flex-hozi-center fw-700 color-red-2">
<span class="material-icons-round margin-0-5"> note </span>Lịch chiếu
</div>
<div>
<strong style="color:#FFA500">{!! $currentMovie->showtimes !!}</strong>
</div>
</div>
@endif
@if ($currentMovie->notify && $currentMovie->notify != '')
<div class="ah-frame-bg">
<div class="heading flex flex-hozi-center fw-700 color-red-2">
<span class="material-icons-round margin-0-5"> note </span>Ghi chú
</div>
<div>
<strong style="color:#FFA500">{!! $currentMovie->notify !!}</strong>
</div>
</div>
@endif
@foreach ($currentMovie->episodes->sortBy([['server', 'asc']])->groupBy('server') as $server => $data)
<div class="list_episode ah-frame-bg" id="list-episode">
<div class="heading flex flex-space-auto fw-700">
<span>Danh sách tập <span>{{ $server }}</span></span>
<span id="newest-ep-is-readed" class="fs-13"></span>
</div>
<div class="list-item-episode scroll-bar">
@foreach ($data->sortByDesc('name', SORT_NATURAL)->groupBy('name') as $name => $item)
<a href="{{ $item->sortByDesc('type')->first()->getUrl() }}" title="{{ $name }}"><span> {{ $name }} </span></a>
@endforeach
</div>
</div>
@endforeach
@include('themes::themeanimeh.inc.comment')
</div>
@include('themes::themeanimeh.inc.movie_related')
@endsection
@push('scripts')
<script src="/themes/animeh/player/js/p2p-media-loader-core.min.js"></script>
<script src="/themes/animeh/player/js/p2p-media-loader-hlsjs.min.js"></script>
<script src="/js/jwplayer-8.9.3.js"></script>
<script src="/js/hls.min.js"></script>
<script src="/js/jwplayer.hlsjs.min.js"></script>
<script>
var episode_id = {{$episode->id}};
const wrapper = document.getElementById('video-player');
const vastAds = "{{ Setting::get('jwplayer_advertising_file') }}";
function chooseStreamingServer(el) {
const type = el.dataset.type;
const link = el.dataset.link.replace(/^http:\/\//i, 'https://');
const id = el.dataset.id;
const newUrl =
location.protocol +
"//" +
location.host +
location.pathname.replace(`-${episode_id}`, `-${id}`);
history.pushState({
path: newUrl
}, "", newUrl);
episode_id = id;
Array.from(document.getElementsByClassName('streaming-server')).forEach(server => {
server.classList.remove('bg-green');
})
el.classList.add('bg-green');
renderPlayer(type, link, id);
}
function renderPlayer(type, link, id) {
if (type == 'embed') {
if (vastAds) {
wrapper.innerHTML = `<div id="fake_jwplayer"></div>`;
const fake_player = jwplayer("fake_jwplayer");
const objSetupFake = {
key: "{{ Setting::get('jwplayer_license') }}",
aspectratio: "16:9",
width: "100%",
file: "/themes/animeh/player/1s_blank.mp4",
volume: 100,
mute: false,
autostart: true,
advertising: {
tag: "{{ Setting::get('jwplayer_advertising_file') }}",
client: "vast",
vpaidmode: "insecure",
skipoffset: {{ (int) Setting::get('jwplayer_advertising_skipoffset') ?: 5 }}, // Bỏ qua quảng cáo trong vòng 5 giây
skipmessage: "Bỏ qua sau xx giây",
skiptext: "Bỏ qua"
}
};
fake_player.setup(objSetupFake);
fake_player.on('complete', function(event) {
$("#fake_jwplayer").remove();
wrapper.innerHTML = `<iframe width="100%" height="100%" src="${link}" frameborder="0" scrolling="no"
allowfullscreen="" allow='autoplay'></iframe>`
fake_player.remove();
});
fake_player.on('adSkipped', function(event) {
$("#fake_jwplayer").remove();
wrapper.innerHTML = `<iframe width="100%" height="100%" src="${link}" frameborder="0" scrolling="no"
allowfullscreen="" allow='autoplay'></iframe>`
fake_player.remove();
});
fake_player.on('adComplete', function(event) {
$("#fake_jwplayer").remove();
wrapper.innerHTML = `<iframe width="100%" height="100%" src="${link}" frameborder="0" scrolling="no"
allowfullscreen="" allow='autoplay'></iframe>`
fake_player.remove();
});
} else {
if (wrapper) {
wrapper.innerHTML = `<iframe width="100%" height="100%" src="${link}" frameborder="0" scrolling="no"
allowfullscreen="" allow='autoplay'></iframe>`
}
}
return;
}
if (type == 'm3u8' || type == 'mp4') {
wrapper.innerHTML = `<div id="jwplayer"></div>`;
const player = jwplayer("jwplayer");
const objSetup = {
key: "{{ Setting::get('jwplayer_license') }}",
aspectratio: "16:9",
width: "100%",
file: link,
playbackRateControls: true,
playbackRates: [0.25, 0.75, 1, 1.25],
sharing: {
sites: [
"reddit",
"facebook",
"twitter",
"googleplus",
"email",
"linkedin",
],
},
volume: 100,
mute: false,
autostart: true,
logo: {
file: "{{ Setting::get('jwplayer_logo_file') }}",
link: "{{ Setting::get('jwplayer_logo_link') }}",
position: "{{ Setting::get('jwplayer_logo_position') }}",
},
advertising: {
tag: "{{ Setting::get('jwplayer_advertising_file') }}",
client: "vast",
vpaidmode: "insecure",
skipoffset: {{ (int) Setting::get('jwplayer_advertising_skipoffset') ?: 5 }}, // Bỏ qua quảng cáo trong vòng 5 giây
skipmessage: "Bỏ qua sau xx giây",
skiptext: "Bỏ qua"
}
};
if (type == 'm3u8') {
const segments_in_queue = 50;
var engine_config = {
debug: !1,
segments: {
forwardSegmentCount: 50,
},
loader: {
cachedSegmentExpiration: 864e5,
cachedSegmentsCount: 1e3,
requiredSegmentsPriority: segments_in_queue,
httpDownloadMaxPriority: 9,
httpDownloadProbability: 0.06,
httpDownloadProbabilityInterval: 1e3,
httpDownloadProbabilitySkipIfNoPeers: !0,
p2pDownloadMaxPriority: 50,
httpFailedSegmentTimeout: 500,
simultaneousP2PDownloads: 20,
simultaneousHttpDownloads: 2,
// httpDownloadInitialTimeout: 12e4,
// httpDownloadInitialTimeoutPerSegment: 17e3,
httpDownloadInitialTimeout: 0,
httpDownloadInitialTimeoutPerSegment: 17e3,
httpUseRanges: !0,
maxBufferLength: 300,
// useP2P: false,
},
};
if (Hls.isSupported() && p2pml.hlsjs.Engine.isSupported()) {
var engine = new p2pml.hlsjs.Engine(engine_config);
player.setup(objSetup);
jwplayer_hls_provider.attach();
p2pml.hlsjs.initJwPlayer(player, {
liveSyncDurationCount: segments_in_queue, // To have at least 7 segments in queue
maxBufferLength: 300,
loader: engine.createLoaderClass(),
});
} else {
player.setup(objSetup);
}
} else {
player.setup(objSetup);
}
const resumeData = 'OPCMS-PlayerPosition-' + id;
player.on('ready', function() {
if (typeof(Storage) !== 'undefined') {
if (localStorage[resumeData] == '' || localStorage[resumeData] == 'undefined') {
console.log("No cookie for position found");
var currentPosition = 0;
} else {
if (localStorage[resumeData] == "null") {
localStorage[resumeData] = 0;
} else {
var currentPosition = localStorage[resumeData];
}
console.log("Position cookie found: " + localStorage[resumeData]);
}
player.once('play', function() {
console.log('Checking position cookie!');
console.log(Math.abs(player.getDuration() - currentPosition));
if (currentPosition > 180 && Math.abs(player.getDuration() - currentPosition) >
5) {
player.seek(currentPosition);
}
});
window.onunload = function() {
localStorage[resumeData] = player.getPosition();
}
} else {
console.log('Your browser is too old!');
}
});
player.on('complete', function() {
if (typeof(Storage) !== 'undefined') {
localStorage.removeItem(resumeData);
} else {
console.log('Your browser is too old!');
}
})
function formatSeconds(seconds) {
var date = new Date(1970, 0, 1);
date.setSeconds(seconds);
return date.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
}
}
}
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const episode = '{{$episode->id}}';
let playing = document.querySelector(`[data-id="${episode}"]`);
if (playing) {
playing.click();
return;
}
const servers = document.getElementsByClassName('streaming-server');
if (servers[0]) {
servers[0].click();
}
});
</script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.css" integrity="sha512-wJgJNTBBkLit7ymC6vvzM1EcSWeM9mmOu+1USHaRBbHkm6W9EgM0HY27+UtUaprntaYQJF75rc8gjxllKs5OIQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js" integrity="sha512-zlWWyZq71UMApAjih4WkaRpikgY9Bz1oXIW5G0fED4vk14JjGlQ1UmkGM392jEULP8jbNMiwLWdM8Z87Hu88Fw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/themes/animeh/plugins/jquery-raty/jquery.raty.js"></script>
<link href="/themes/animeh/plugins/jquery-raty/jquery.raty.css" rel="stylesheet" type="text/css" />
<script>
var rated = false;
$('#movies-rating-star').raty({
score: {{ $currentMovie->getRatingStar() }},
number: 10,
numberMax: 10,
hints: ['quá tệ', 'tệ', 'không hay', 'không hay lắm', 'bình thường', 'xem được', 'có vẻ hay', 'hay',
'rất hay', 'siêu phẩm'
],
starOff: '/themes/animeh/plugins/jquery-raty/images/star-off.png',
starOn: '/themes/animeh/plugins/jquery-raty/images/star-on.png',
starHalf: '/themes/animeh/plugins/jquery-raty/images/star-half.png',
click: function(score, evt) {
if (rated) return
fetch("{{ route('movie.rating', ['movie' => $currentMovie->slug]) }}", {
method: 'POST',
headers: {
"Content-Type": "application/json",
'X-CSRF-TOKEN': document.querySelector(
'meta[name="csrf-token"]')
.getAttribute(
'content')
},
body: JSON.stringify({
rating: score
})
});
rated = true;
$('#movies-rating-star').data('raty').readOnly(true);
$.toast({
heading: 'Thông báo',
text: 'Đánh giá của bạn đã được gửi đi!',
position: 'bottom-right',
icon: 'info',
loader: true,
loaderBg: '#9EC600',
bgColor: '#212121',
textColor: 'white'
})
}
});
</script>
{!! setting('site_scripts_facebook_sdk') !!}
@endpush

View File

@ -0,0 +1,55 @@
<div class="div_filter">
<form id="form-search" class="form-inline" method="GET" action="/">
<div class="div_filter-main">
<div class="">
<select class="form-control" id="sort" name="filter[sort]" form="form-search">
<option value="">Sắp xếp</option>
<option value="update" @if (isset(request('filter')['sort']) && request('filter')['sort'] == 'update') selected @endif>Thời gian cập nhật</option>
<option value="create" @if (isset(request('filter')['sort']) && request('filter')['sort'] == 'create') selected @endif>Thời gian đăng</option>
<option value="year" @if (isset(request('filter')['sort']) && request('filter')['sort'] == 'year') selected @endif>Năm sản xuất</option>
<option value="view" @if (isset(request('filter')['sort']) && request('filter')['sort'] == 'view') selected @endif>Lượt xem</option>
</select>
</div>
<div class="">
<select class="form-control" id="type" name="filter[type]" form="form-search">
<option value="">Mọi định dạng</option>
<option value="series" @if (isset(request('filter')['type']) && request('filter')['type'] == 'series') selected @endif>Phim bộ</option>
<option value="single" @if (isset(request('filter')['type']) && request('filter')['type'] == 'single') selected @endif>Phim lẻ</option>
</select>
</div>
<div class="">
<select class="form-control" id="category" name="filter[category]" form="form-search">
<option value="">Tất cả thể loại</option>
@foreach (\VsMov\Core\Models\Category::fromCache()->all() as $item)
<option value="{{ $item->id }}" @if ((isset(request('filter')['category']) && request('filter')['category'] == $item->id) ||
(isset($category) && $category->id == $item->id)) selected @endif>
{{ $item->name }}</option>
@endforeach
</select>
</div>
<div class="">
<select class="form-control" name="filter[region]" form="form-search">
<option value="">Tất cả quốc gia</option>
@foreach (\VsMov\Core\Models\Region::fromCache()->all() as $item)
<option value="{{ $item->id }}" @if ((isset(request('filter')['region']) && request('filter')['region'] == $item->id) ||
(isset($region) && $region->id == $item->id)) selected @endif>
{{ $item->name }}</option>
@endforeach
</select>
</div>
<div class="">
<select class="form-control" name="filter[year]" form="form-search">
<option value="">Tất cả năm</option>
@foreach ($years as $year)
<option value="{{ $year }}" @if (isset(request('filter')['year']) && request('filter')['year'] == $year) selected @endif>
{{ $year }}</option>
@endforeach
</select>
</div>
<div class="">
<button class="button-filter bg-red" form="form-search" type="submit"> <span class="material-icons-round">filter_alt</span> Lọc Phim</button>
</div>
<div class="clearfix"></div>
</div>
</form>
</div>

View File

@ -0,0 +1,13 @@
<div class="ah-frame-bg">
<div class="flex flex-space-auto">
<div class="fw-700 fs-16 color-yellow-2 flex flex-hozi-center">
<span class="material-icons-round margin-0-5"> comment </span>Bình luận
</div>
</div>
<div id="comments" class="margin-t-10">
<div style="width: 100%; background-color: #fff">
<div style="width: 100%; background-color: #fff" class="fb-comments" data-href="{{ $currentMovie->getUrl() }}" data-width="100%"
data-colorscheme="light" data-numposts="5" data-order-by="reverse_time" data-lazy="true"></div>
</div>
</div>
</div>

View File

@ -0,0 +1,10 @@
<div class="ah-frame-bg">
<div class="heading flex flex-space-auto fw-700">
<span> thể bạn muốn xem!</span>
</div>
<div class="movies-list">
@foreach ($movie_related as $movie)
@include('themes::themeanimeh.inc.section_home_item')
@endforeach
</div>
</div>

View File

@ -0,0 +1,64 @@
@php
$logo = setting('site_logo', '');
$brand = setting('site_brand', '');
$title = isset($title) ? $title : setting('site_homepage_title', '');
@endphp
<div id="navbar">
<div class="flex flex-hozi-center padding-10">
<div class="logo">
<a href="/" title="{{ $title }}" rel="home">
@if ($logo)
{!! $logo !!}
@else
{!! $brand !!}
@endif
</a>
</div>
<div id="drop-down-4" class="search-bar flex flex-1 margin-0-10 flex-ver-center">
<form class="flex" id="form-search" action="/" method="GET">
<input type="text" placeholder="Nhập từ khoá..." value="{{ request('search') }}" class="padding-10 bg-black color-gray"
name="search">
<button type="submit" class="flex flex-hozi-center bg-black color-gray">
<span class="material-icons-round"> search </span>
</button>
</form>
</div>
<div class="nav-items flex-wrap flex">
<a href="#" onclick="clickEventDropDown(this,'search')" class="toggle-search toggle-dropdown"
bind="drop-down-4">
<span class="material-icons-round"> search </span>
</a>
<a href="#" onclick="clickEventDropDown(this,'reorder')" class="toggle-dropdown" bind="drop-down-1">
<span class="material-icons-round"> reorder </span>
</a>
</div>
</div>
<div id="drop-down-1" class="dropdown-menu bg-black w-100-percent flex-column">
<div class="tab-links flex-1">
@foreach ($menu as $item)
@if (count($item['children']))
<a href="#" class="item-tab-link parent-menu" bind="tab-{{ $item['id'] }}"> <span
class="material-icons-round margin-0-5"> menu </span>{{ $item['name'] }} </a>
@else
<a href="{{ $item['link'] }}" class="item-tab-link"> <span class="material-icons-round margin-0-5">
auto_awesome </span>{{ $item['name'] }} </a>
@endif
@endforeach
</div>
<div class="tab-content">
@foreach ($menu as $item)
@if (count($item['children']))
<div id="tab-{{$item['id']}}" class="item-tab-content sub-menu-content">
<div class="flex flex-wrap">
@foreach ($item['children'] as $children)
<a href="{{$children['link']}}" title="{{$children['name']}}">{{$children['name']}}</a>
@endforeach
</div>
</div>
@endif
@endforeach
</div>
</div>
</div>

View File

@ -0,0 +1,41 @@
@php
$pageRange = 3;
@endphp
@if ($paginator->hasPages())
<div class="pagination">
<div>
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
@else
<a title="Trang trước" href="{{ $paginator->previousPageUrl() }}"> &lt;&lt; </a>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<a class=" disabled" href="#">{{ $element }}</a>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<a class="active_page" title="Trang {{$page}}" href="#">{{$page}}</a>
@else
@if (($page > $paginator->currentPage() && $page < ($paginator->currentPage() + $pageRange)) || $page < $paginator->currentPage() && $page > ($paginator->currentPage() - $pageRange))
<a title="Trang {{$page}}" href="{{$url}}"> {{$page}}</a>
@endif
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a class="page larger" title="Trang tiếp" href="{{ $paginator->nextPageUrl() }}">&gt;&gt;</a>
@else
@endif
</div>
</div>
@endif

View File

@ -0,0 +1,13 @@
<div class="margin-10-0 bg-gray-2 flex flex-space-auto">
<div class="fs-17 fw-700 padding-0-20 color-gray inline-flex height-40 flex-hozi-center bg-black border-l-t">{{$item['label']}}</div>
@if ($item['link'] != "" && $item['link'] != "#")
<div class="margin-r-5 fw-500">
<a href="{{$item['link']}}" class="bg-blue padding-5-10 border-default">Toàn bộ</a>
</div>
@endif
</div>
<div class="movies-list ah-frame-bg">
@foreach ($item['data'] as $movie)
@include('themes::themeanimeh.inc.section_home_item')
@endforeach
</div>

View File

@ -0,0 +1,13 @@
<div class="movie-item" id="movie-id-{{ $movie->id }}">
<a href="{{ $movie->getUrl() }}" title="{{ $movie->name }} - {{ $movie->origin_name }} ({{ $movie->publish_year }})">
<div class="episode-latest">
<span>{{ $movie->episode_current }}</span>
</div>
<div>
<img src="{{ $movie->getThumbUrl() }}"
alt="{{ $movie->name }} - {{ $movie->origin_name }} ({{ $movie->publish_year }})" />
</div>
<div class="score"> {{ $movie->getRatingStar() }} </div>
<div class="name-movie"> {{ $movie->name }} </div>
</a>
</div>

View File

@ -0,0 +1,21 @@
<div class="ah-carousel">
<div class="margin-10-0 bg-gray-2">
<div
class="fs-17 fw-700 padding-0-20 color-gray inline-flex height-40 flex-hozi-center bg-black border-l-t">
Phim đề cử </div>
</div>
<div class="ah-frame-bg owl-carousel owl-theme">
@foreach ($recommendations as $movie)
<div>
<a href="{{$movie->getUrl()}}">
<div>
<img src="{{$movie->getThumbUrl()}}"
alt="{{$movie->name}} - {{$movie->origin_name}} ({{$movie->publish_year}})" />
</div>
<div class="name">{{$movie->name}}</div>
<div class="episode_latest"> {{$movie->episode_current}} </div>
</a>
</div>
@endforeach
</div>
</div>

View File

@ -0,0 +1,85 @@
@extends('themes::themeanimeh.layout')
@php
use VsMov\Core\Models\Movie;
$recommendations = Cache::remember('site.movies.recommendations', setting('site_cache_ttl', 5 * 60), function () {
return Movie::where('is_recommended', true)
->limit(get_theme_option('recommendations_limit', 10))
->orderBy('updated_at', 'desc')
->get();
});
$data = Cache::remember('site.movies.latest', setting('site_cache_ttl', 5 * 60), function () {
$lists = preg_split('/[\n\r]+/', get_theme_option('latest'));
$data = [];
foreach ($lists as $list) {
if (trim($list)) {
$list = explode('|', $list);
[$label, $relation, $field, $val, $sortKey, $alg, $limit, $link] = array_merge($list, ['Phim mới cập nhật', '', 'type', 'series', 'created_at', 'desc', 8, '/']);
try {
$data[] = [
'label' => $label,
'data' => Movie::when($relation, function ($query) use ($relation, $field, $val) {
$query->whereHas($relation, function ($rel) use ($field, $val) {
$rel->where($field, $val);
});
})
->when(!$relation, function ($query) use ($field, $val) {
$query->where($field, $val);
})
->orderBy($sortKey, $alg)
->limit($limit)
->get(),
'link' => $link ?: '#',
];
} catch (\Exception $e) {
}
}
}
return $data;
});
@endphp
@section('content')
@if (count($recommendations))
@include('themes::themeanimeh.inc.slider_recommended')
@endif
@foreach ($data as $item)
@include('themes::themeanimeh.inc.section_home')
@endforeach
@endsection
@push('scripts')
<link rel="stylesheet" href="{{ asset('/themes/animeh/plugins/carousel/owl.carousel.min.css') }}">
<link rel="stylesheet" href="{{ asset('/themes/animeh/plugins/carousel/owl.theme.default.min.css') }}">
<script type="text/javascript">
let item = 4;
let documentWidth = $(document).width();
(documentWidth < 768) ? item = 2: null;
// (documentWidth > 768 && documentWidth < 1000) ? item = 4: null;
$(document).ready(function() {
var owl = $('.owl-carousel');
owl.owlCarousel({
items: item,
lazyLoad: true,
center: true,
loop: true,
responsiveClass: true,
margin: 10,
autoplay: true,
autoplayTimeout: 2000,
autoplayHoverPause: true,
stagePadding: 50,
});
$('.play').on('click', function() {
owl.trigger('play.owl.autoplay', [100])
})
$('.stop').on('click', function() {
owl.trigger('stop.owl.autoplay')
})
});
</script>
<script src="{{ asset('/themes/animeh/plugins/carousel/owl.carousel.min.js') }}"></script>
@endpush

View File

@ -0,0 +1,38 @@
@extends('themes::layout')
@php
$menu = \VsMov\Core\Models\Menu::getTree();
@endphp
@push('header')
<link href="{{ asset('/themes/animeh/css/css.css') }}" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="{{ asset('/themes/animeh/js/functions.js') }}"></script>
@endpush
@section('body')
<div id="ah_wrapper">
@include('themes::themeanimeh.inc.navbar')
@if (get_theme_option('ads_header'))
<div id="top-banner">
{!! get_theme_option('ads_header') !!}
</div>
@endif
<div class="ah_content">
@yield('content')
</div>
{!! get_theme_option('footer') !!}
</div>
@endsection
@push('scripts')
@endpush
@section('footer')
@if (get_theme_option('ads_catfish'))
<div id="catfish-banner">
{!! get_theme_option('ads_catfish') !!}
</div>
@endif
{!! setting('site_scripts_google_analytics') !!}
@endsection

View File

@ -0,0 +1,283 @@
@extends('themes::themeanimeh.layout')
@php
$watch_url = '';
if (!$currentMovie->is_copyright && count($currentMovie->episodes) && $currentMovie->episodes[0]['link'] != '') {
$watch_url = $currentMovie->episodes
->sortBy([['server', 'asc']])
->groupBy('server')
->first()
->sortByDesc('name', SORT_NATURAL)
->groupBy('name')
->last()
->sortByDesc('type')
->first()
->getUrl();
}
@endphp
@push('header')
<style>
.single-button-text {
font-size: 28px !important;
}
@media only screen and (max-width: 600px) {
.single-button-text {
font-size: 14px !important;
}
.hidden-mobile {
display: none;
}
}
</style>
@endpush
@section('content')
<div class="info-movie">
<div id="modal" class="modal" style="display: block; visibility: hidden; top: 0px; transition: top 0.3s ease 0s;">
<div>
<div>{{ $currentMovie->getRatingStar() }} sao / {{ $currentMovie->getRatingCount() }} lượt đánh giá</div>
<a id="close-modal-rated" href="javascript:;">
<span class="material-icons-round margin-0-5"> close </span>
</a>
</div>
<div>
<div id="movies-rating-star" class="rated-star flex flex-hozi-center flex-ver-center">
</div>
</div>
</div>
@if (strpos($currentMovie->trailer_url, 'youtube'))
<div id="modal-trailer" class="modal"
style="display: block; visibility: hidden; top: 0px; transition: top 0.3s ease 0s;">
<div>
<div>Trailer {{ $currentMovie->name }}</div>
<a id="close-modal-trailer" href="javascript:;">
<span class="material-icons-round margin-0-5"> close </span>
</a>
</div>
<div>
@php
try {
parse_str(parse_url($currentMovie->trailer_url, PHP_URL_QUERY), $parse_url);
$trailer_id = $parse_url['v'];
} catch (\Throwable $th) {
$trailer_id = '';
}
@endphp
<iframe width="100%" height="315" src="https://www.youtube.com/embed/{{ $trailer_id }}"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
frameborder="0" scrolling="no" allowfullscreen></iframe>
</div>
</div>
@endif
<h1 class="heading_movie">{{ $currentMovie->name }}</h1>
<div class="head ah-frame-bg">
<div class="first">
<img src="{{ $currentMovie->getThumbUrl() }}" alt="{{ $currentMovie->name }}" />
</div>
<div class="last">
<div class="name_other">
<div>Tên khác</div>
<div>{{ $currentMovie->origin_name }} </div>
</div>
<div class="list_cate">
<div>Thể loại</div>
<div>
{!! $currentMovie->categories->map(function ($category) {
return '<a href="' . $category->getUrl() . '">' . $category->name . '</a>';
})->implode('') !!}
</div>
</div>
<div class="list_cate">
<div>Quốc gia</div>
<div>
{!! $currentMovie->regions->map(function ($region) {
return '<a href="' . $region->getUrl() . '">' . $region->name . '</a>';
})->implode('') !!}
</div>
</div>
<div class="status">
<div>Trạng thái</div>
<div> {{ $currentMovie->episode_current }} {{ $currentMovie->language }} {{ $currentMovie->quality }}
</div>
</div>
<div class="duration">
<div>Thời lượng</div>
<div> {{ $currentMovie->episode_time }} </div>
</div>
<div class="update_time">
<div>Phát hành</div>
<div> {{ $currentMovie->publish_year }} </div>
</div>
</div>
</div>
<div class="flex ah-frame-bg flex-wrap">
<div class="flex flex-wrap flex-1">
@if ($watch_url != '')
<a href="{{ $watch_url }}"
class="padding-5-15 fs-35 button-default fw-500 flex flex-hozi-center bg-lochinvar" title="Xem Ngay">
<span class="material-icons-round">play_circle_outline</span> <span class="single-button-text"> XEM PHIM
</span>
</a>
@endif
@if (strpos($currentMovie->trailer_url, 'youtube'))
<a href="javascript:void(0)" id="toggle_trailer"
class="bg-green padding-5-15 fs-35 button-default fw-500 fs-15 flex flex-hozi-center"
title="Theo dõi phim này" style="">
<span class="material-icons-round"> play_circle_filled </span> <span
class="single-button-text hidden-mobile"> TRAILER </span>
</a>
@endif
</div>
<div class="last">
<div id="rated" class="bg-orange padding-5-15 fs-35 button-default fw-500 fs-15 flex flex-hozi-center">
<span class="material-icons-round"> stars </span> <span class="single-button-text hidden-mobile"> CHẤM
ĐIỂM </span>
</div>
</div>
</div>
<div class="body">
<div class="list_episode ah-frame-bg">
<div class="heading flex flex-space-auto fw-700">
<span>Danh sách tập</span>
<span id="newest-ep-is-readed" class="fs-13"></span>
</div>
<div class="list-item-episode scroll-bar">
@if ($watch_url != '')
@foreach ($currentMovie->episodes->sortBy([['server', 'asc']])->groupBy('server') as $server => $data)
@foreach ($data->sortByDesc('name', SORT_NATURAL)->groupBy('name') as $name => $item)
<a href="{{ $item->sortByDesc('type')->first()->getUrl() }}"
title="{{ $name }}"><span>{{ $name }}</span></a>
@endforeach
@endforeach
@else
Phim đang được cập nhật...
@endif
</div>
</div>
<div class="desc ah-frame-bg">
<div>
<h2 class="heading"> Nội dung </h2>
</div>
<div>
@if ($currentMovie->showtimes && $currentMovie->showtimes != '')
<p>
<strong>
<p>
<span style="color:#FFA500">{!! $currentMovie->showtimes !!} <p>
</strong>
</p>
@endif
@if ($currentMovie->notify && $currentMovie->notify != '')
<p>
<strong>
<p>
<span style="color:#FFA500">{!! $currentMovie->notify !!} <p>
</strong>
</p>
@endif
<p class="Director">
<strong>Đạo diễn:</strong>
@if (count($currentMovie->directors))
{!! $currentMovie->directors->map(function ($director) {
return '<span class="tt-at"><a href="' . $director->getUrl() . '">' . $director->name . '</a></span>';
})->implode(',') !!}
@else
N/A
@endif
</p>
<p class="Cast">
<strong>Diễn viên:</strong>
@if (count($currentMovie->actors))
{!! $currentMovie->actors->map(function ($actor) {
return '<a href="' . $actor->getUrl() . '">' . $actor->name . '</a>';
})->implode('<span class="dot-sh">,</span> ') !!}
@else
N/A
@endif
</p>
<p class="heading"></p>
<div>
<p>{!! strip_tags($currentMovie->content) !!}</p>
</div>
</div>
</div>
</div>
<div class="ah-frame-bg">
<div>
<h2 class="heading"> Tags </h2>
</div>
<div class="">
{!! $currentMovie->tags->map(function ($tag) {
return '<a href="' . $tag->getUrl() . '">' . $tag->name . '</a>';
})->implode(', ') !!}
</div>
</div>
@include('themes::themeanimeh.inc.comment')
@include('themes::themeanimeh.inc.movie_related')
</div>
@endsection
@push('scripts')
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.css"
integrity="sha512-wJgJNTBBkLit7ymC6vvzM1EcSWeM9mmOu+1USHaRBbHkm6W9EgM0HY27+UtUaprntaYQJF75rc8gjxllKs5OIQ=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js"
integrity="sha512-zlWWyZq71UMApAjih4WkaRpikgY9Bz1oXIW5G0fED4vk14JjGlQ1UmkGM392jEULP8jbNMiwLWdM8Z87Hu88Fw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/themes/animeh/plugins/jquery-raty/jquery.raty.js"></script>
<link href="/themes/animeh/plugins/jquery-raty/jquery.raty.css" rel="stylesheet" type="text/css" />
<script>
var rated = false;
$('#movies-rating-star').raty({
score: {{ $currentMovie->getRatingStar() }},
number: 10,
numberMax: 10,
hints: ['quá tệ', 'tệ', 'không hay', 'không hay lắm', 'bình thường', 'xem được', 'có vẻ hay', 'hay',
'rất hay', 'siêu phẩm'
],
starOff: '/themes/animeh/plugins/jquery-raty/images/star-off.png',
starOn: '/themes/animeh/plugins/jquery-raty/images/star-on.png',
starHalf: '/themes/animeh/plugins/jquery-raty/images/star-half.png',
click: function(score, evt) {
if (rated) return
fetch("{{ route('movie.rating', ['movie' => $currentMovie->slug]) }}", {
method: 'POST',
headers: {
"Content-Type": "application/json",
'X-CSRF-TOKEN': document.querySelector(
'meta[name="csrf-token"]')
.getAttribute(
'content')
},
body: JSON.stringify({
rating: score
})
});
rated = true;
$('#movies-rating-star').data('raty').readOnly(true);
$.toast({
heading: 'Thông báo',
text: 'Đánh giá của bạn đã được gửi đi!',
position: 'bottom-right',
icon: 'info',
loader: true,
loaderBg: '#9EC600',
bgColor: '#212121',
textColor: 'white'
})
}
});
</script>
{!! setting('site_scripts_facebook_sdk') !!}
@endpush

54
routes/web.php Normal file
View File

@ -0,0 +1,54 @@
<?php
use Illuminate\Support\Facades\Route;
use VsMov\ThemeAnimeH\Controllers\ThemeAnimeHController;
// --------------------------
// Custom Backpack Routes
// --------------------------
// This route file is loaded automatically by Backpack\Base.
// Routes you generate using Backpack\Generators will be placed here.
Route::group([
'middleware' => array_merge(
(array) config('backpack.base.web_middleware', 'web'),
),
], function () {
Route::get('/', [ThemeAnimeHController::class, 'index']);
Route::get(setting('site_routes_category', '/the-loai/{category}'), [ThemeAnimeHController::class, 'getMovieOfCategory'])
->where(['category' => '.+', 'id' => '[0-9]+'])
->name('categories.movies.index');
Route::get(setting('site_routes_region', '/quoc-gia/{region}'), [ThemeAnimeHController::class, 'getMovieOfRegion'])
->where(['region' => '.+', 'id' => '[0-9]+'])
->name('regions.movies.index');
Route::get(setting('site_routes_tag', '/tu-khoa/{tag}'), [ThemeAnimeHController::class, 'getMovieOfTag'])
->where(['tag' => '.+', 'id' => '[0-9]+'])
->name('tags.movies.index');
Route::get(setting('site_routes_types', '/danh-sach/{type}'), [ThemeAnimeHController::class, 'getMovieOfType'])
->where(['type' => '.+', 'id' => '[0-9]+'])
->name('types.movies.index');
Route::get(setting('site_routes_actors', '/dien-vien/{actor}'), [ThemeAnimeHController::class, 'getMovieOfActor'])
->where(['actor' => '.+', 'id' => '[0-9]+'])
->name('actors.movies.index');
Route::get(setting('site_routes_directors', '/dao-dien/{director}'), [ThemeAnimeHController::class, 'getMovieOfDirector'])
->where(['director' => '.+', 'id' => '[0-9]+'])
->name('directors.movies.index');
Route::get(setting('site_routes_episode', '/phim/{movie}/{episode}-{id}'), [ThemeAnimeHController::class, 'getEpisode'])
->where(['movie' => '.+', 'movie_id' => '[0-9]+', 'episode' => '.+', 'id' => '[0-9]+'])
->name('episodes.show');
Route::post(sprintf('/%s/{movie}/{episode}/report', config('vsmov.routes.movie', 'phim')), [ThemeAnimeHController::class, 'reportEpisode'])->name('episodes.report');
Route::post(sprintf('/%s/{movie}/rate', config('vsmov.routes.movie', 'phim')), [ThemeAnimeHController::class, 'rateMovie'])->name('movie.rating');
Route::get(setting('site_routes_movie', '/phim/{movie}'), [ThemeAnimeHController::class, 'getMovieOverview'])
->where(['movie' => '.+', 'id' => '[0-9]+'])
->name('movies.show');
});

View File

@ -0,0 +1,290 @@
<?php
namespace VsMov\ThemeAnimeH\Controllers;
use Backpack\Settings\app\Models\Setting;
use Illuminate\Http\Request;
use VsMov\Core\Models\Actor;
use VsMov\Core\Models\Catalog;
use VsMov\Core\Models\Category;
use VsMov\Core\Models\Director;
use VsMov\Core\Models\Episode;
use VsMov\Core\Models\Movie;
use VsMov\Core\Models\Region;
use VsMov\Core\Models\Tag;
use Illuminate\Support\Facades\Cache;
class ThemeAnimeHController
{
public function index(Request $request)
{
if ($request['search'] || $request['filter']) {
$data = Movie::when(!empty($request['filter']['category']), function ($movie) {
$movie->whereHas('categories', function ($categories) {
$categories->where('id', request('filter')['category']);
});
})->when(!empty($request['filter']['region']), function ($movie) {
$movie->whereHas('regions', function ($regions) {
$regions->where('id', request('filter')['region']);
});
})->when(!empty($request['filter']['year']), function ($movie) {
$movie->where('publish_year', request('filter')['year']);
})->when(!empty($request['filter']['type']), function ($movie) {
$movie->where('type', request('filter')['type']);
})->when(!empty($request['search']), function ($query) {
$query->where(function ($query) {
$query->where('name', 'like', '%' . request('search') . '%')
->orWhere('origin_name', 'like', '%' . request('search') . '%');
})->orderBy('name', 'desc');
})->when(!empty($request['filter']['sort']), function ($movie) {
if (request('filter')['sort'] == 'create') {
return $movie->orderBy('created_at', 'desc');
}
if (request('filter')['sort'] == 'update') {
return $movie->orderBy('updated_at', 'desc');
}
if (request('filter')['sort'] == 'year') {
return $movie->orderBy('publish_year', 'desc');
}
if (request('filter')['sort'] == 'view') {
return $movie->orderBy('view_total', 'desc');
}
})->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $data,
'search' => $request['search'],
'section_name' => "Tìm kiếm phim: $request->search"
]);
}
return view('themes::themeanimeh.index', [
'title' => Setting::get('site_homepage_title')
]);
}
public function getMovieOverview(Request $request)
{
/** @var Movie */
$movie = Movie::fromCache()->find($request->movie ?: $request->id);
if (is_null($movie)) abort(404);
$movie->generateSeoTags();
$movie->increment('view_total', 1);
$movie->increment('view_day', 1);
$movie->increment('view_week', 1);
$movie->increment('view_month', 1);
$movie_related_cache_key = 'movie_related:' . $movie->id;
$movie_related = Cache::get($movie_related_cache_key);
if(is_null($movie_related)) {
$movie_related = $movie->categories[0]->movies()->inRandomOrder()->limit(get_theme_option('movie_related_limit', 10))->get();
Cache::put($movie_related_cache_key, $movie_related, setting('site_cache_ttl', 5 * 60));
}
return view('themes::themeanimeh.single', [
'currentMovie' => $movie,
'title' => $movie->getTitle(),
'movie_related' => $movie_related
]);
}
public function getEpisode(Request $request)
{
$movie = Movie::fromCache()->find($request->movie ?: $request->movie_id)->load('episodes');
if (is_null($movie)) abort(404);
/** @var Episode */
$episode_id = $request->id;
$episode = $movie->episodes->when($episode_id, function ($collection, $episode_id) {
return $collection->where('id', $episode_id);
})->firstWhere('slug', $request->episode);
if (is_null($episode)) abort(404);
$episode->generateSeoTags();
$movie->increment('view_total', 1);
$movie->increment('view_day', 1);
$movie->increment('view_week', 1);
$movie->increment('view_month', 1);
$movie_related_cache_key = 'movie_related:' . $movie->id;
$movie_related = Cache::get($movie_related_cache_key);
if(is_null($movie_related)) {
$movie_related = $movie->categories[0]->movies()->inRandomOrder()->limit(get_theme_option('movie_related_limit', 10))->get();
Cache::put($movie_related_cache_key, $movie_related, setting('site_cache_ttl', 5 * 60));
}
return view('themes::themeanimeh.episode', [
'currentMovie' => $movie,
'movie_related' => $movie_related,
'episode' => $episode,
'title' => $episode->getTitle()
]);
}
public function getMovieOfCategory(Request $request)
{
/** @var Category */
$category = Category::fromCache()->find($request->category ?: $request->id);
if (is_null($category)) abort(404);
$category->generateSeoTags();
$movies = $category->movies()->orderBy('created_at', 'desc')->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'category' => $category,
'title' => $category->seo_title ?: $category->getTitle(),
'section_name' => "Phim thể loại $category->name"
]);
}
public function getMovieOfRegion(Request $request)
{
/** @var Region */
$region = Region::fromCache()->find($request->region ?: $request->id);
if (is_null($region)) abort(404);
$region->generateSeoTags();
$movies = $region->movies()->orderBy('created_at', 'desc')->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'region' => $region,
'title' => $region->seo_title ?: $region->getTitle(),
'section_name' => "Phim quốc gia $region->name"
]);
}
public function getMovieOfActor(Request $request)
{
/** @var Actor */
$actor = Actor::fromCache()->find($request->actor ?: $request->id);
if (is_null($actor)) abort(404);
$actor->generateSeoTags();
$movies = $actor->movies()->orderBy('created_at', 'desc')->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'person' => $actor,
'title' => $actor->getTitle(),
'section_name' => "Diễn viên $actor->name"
]);
}
public function getMovieOfDirector(Request $request)
{
/** @var Director */
$director = Director::fromCache()->find($request->director ?: $request->id);
if (is_null($director)) abort(404);
$director->generateSeoTags();
$movies = $director->movies()->orderBy('created_at', 'desc')->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'person' => $director,
'title' => $director->getTitle(),
'section_name' => "Đạo diễn $director->name"
]);
}
public function getMovieOfTag(Request $request)
{
/** @var Tag */
$tag = Tag::fromCache()->find($request->tag ?: $request->id);
if (is_null($tag)) abort(404);
$tag->generateSeoTags();
$movies = $tag->movies()->orderBy('created_at', 'desc')->paginate(get_theme_option('per_page_limit'));
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'tag' => $tag,
'title' => $tag->getTitle(),
'section_name' => "Tags: $tag->name"
]);
}
public function getMovieOfType(Request $request)
{
/** @var Catalog */
$catalog = Catalog::fromCache()->find($request->type ?: $request->id);
if (is_null($catalog)) abort(404);
$catalog->generateSeoTags();
$cache_key = 'catalog:' . $catalog->id . ':page:' . ($request['page'] ?: 1);
$movies = Cache::get($cache_key);
if(is_null($movies)) {
$value = explode('|', trim($catalog->value));
[$relation_config, $field, $val, $sortKey, $alg] = array_merge($value, ['', 'is_copyright', 0, 'created_at', 'desc']);
$relation_config = explode(',', $relation_config);
[$relation_table, $relation_field, $relation_val] = array_merge($relation_config, ['', '', '']);
try {
$movies = \VsMov\Core\Models\Movie::when($relation_table, function ($query) use ($relation_table, $relation_field, $relation_val, $field, $val) {
$query->whereHas($relation_table, function ($rel) use ($relation_field, $relation_val, $field, $val) {
$rel->where($relation_field, $relation_val)->where(array_combine(explode(",", $field), explode(",", $val)));
});
})->when(!$relation_table, function ($query) use ($field, $val) {
$query->where(array_combine(explode(",", $field), explode(",", $val)));
})
->orderBy($sortKey, $alg)
->paginate($catalog->paginate);
Cache::put($cache_key, $movies, setting('site_cache_ttl', 5 * 60));
} catch (\Exception $e) {}
}
return view('themes::themeanimeh.catalog', [
'data' => $movies,
'section_name' => "Danh sách $catalog->name"
]);
}
public function reportEpisode(Request $request, $movie, $slug)
{
$movie = Movie::fromCache()->find($movie)->load('episodes');
$episode = $movie->episodes->when(request('id'), function ($collection) {
return $collection->where('id', request('id'));
})->firstWhere('slug', $slug);
$episode->update([
'report_message' => request('message', ''),
'has_report' => true
]);
return response([], 204);
}
public function rateMovie(Request $request, $movie)
{
$movie = Movie::fromCache()->find($movie);
$movie->refresh()->increment('rating_count', 1, [
'rating_star' => $movie->rating_star + ((int) request('rating') - $movie->rating_star) / ($movie->rating_count + 1)
]);
return response([], 204);
}
}

View File

@ -0,0 +1,157 @@
<?php
namespace VsMov\ThemeAnimeH;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class ThemeAnimeHServiceProvider extends ServiceProvider
{
public function register()
{
$this->setupDefaultThemeCustomizer();
}
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'themes');
$this->publishes([
__DIR__ . '/../resources/assets' => public_path('themes/animeh')
], 'animeh-assets');
}
protected function setupDefaultThemeCustomizer()
{
config(['themes' => array_merge(config('themes', []), [
'animeh' => [
'name' => 'Theme AnimeH',
'author' => 'vsmov@gmail.com',
'package_name' => 'vsmov/theme-animeh',
'publishes' => ['animeh-assets'],
'preview_image' => '',
'options' => [
[
'name' => 'recommendations_limit',
'label' => 'Recommended movies limit',
'type' => 'number',
'value' => 10,
'wrapperAttributes' => [
'class' => 'form-group col-md-4',
],
'tab' => 'List'
],
[
'name' => 'per_page_limit',
'label' => 'Pages limit',
'type' => 'number',
'value' => 30,
'wrapperAttributes' => [
'class' => 'form-group col-md-4',
],
'tab' => 'List'
],
[
'name' => 'movie_related_limit',
'label' => 'Movies related limit',
'type' => 'number',
'value' => 10,
'wrapperAttributes' => [
'class' => 'form-group col-md-4',
],
'tab' => 'List'
],
[
'name' => 'latest',
'label' => 'Home Page',
'type' => 'code',
'hint' => 'display_label|relation|find_by_field|value|sort_by_field|sort_algo|limit|show_more_url',
'value' => <<<EOT
Phim chiếu rạp mới||is_shown_in_theater|1|created_at|desc|10|/danh-sach/phim-chieu-rap
Phim bộ mới||type|series|updated_at|desc|10|/danh-sach/phim-bo
Phim lẻ mới||type|single|updated_at|desc|10|/danh-sach/phim-le
Phim hoạt hình mới|categories|slug|hoat-hinh|updated_at|desc|10|/the-loai/hoat-hinh
Top phim||is_copyright|0|view_week|desc|10|#
EOT,
'attributes' => [
'rows' => 5
],
'tab' => 'List'
],
[
'name' => 'additional_css',
'label' => 'Additional CSS',
'type' => 'code',
'value' => "",
'tab' => 'Custom CSS'
],
[
'name' => 'body_attributes',
'label' => 'Body attributes',
'type' => 'text',
'value' => 'class="scroll-bar"',
'tab' => 'Custom CSS'
],
[
'name' => 'additional_header_js',
'label' => 'Header JS',
'type' => 'code',
'value' => "",
'tab' => 'Custom JS'
],
[
'name' => 'additional_body_js',
'label' => 'Body JS',
'type' => 'code',
'value' => "",
'tab' => 'Custom JS'
],
[
'name' => 'additional_footer_js',
'label' => 'Footer JS',
'type' => 'code',
'value' => "",
'tab' => 'Custom JS'
],
[
'name' => 'footer',
'label' => 'Footer',
'type' => 'code',
'value' => <<<EOT
<div class="ah_footer">
<div class="flex flex-hozi-center flex-space-auto">
<div class="logo-footer">
<img src="https://vsmov.com/VSmov.png" alt="Logo" />
</div>
<div>
<a href="#">
<img src="https://animehay.fan/themes/img/ads_click.png?v=1.1.9" alt="contact">
</a>
</div>
</div>
</div>
EOT,
'tab' => 'Custom HTML'
],
[
'name' => 'ads_header',
'label' => 'Ads header',
'type' => 'code',
'value' => <<<EOT
EOT,
'tab' => 'Ads'
],
[
'name' => 'ads_catfish',
'label' => 'Ads catfish',
'type' => 'code',
'value' => <<<EOT
EOT,
'tab' => 'Ads'
]
],
]
])]);
}
}

BIN
src/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 KiB