mirror of
https://github.com/pterodactyl/documentation.git
synced 2025-12-10 10:44:43 -06:00
add SlickCarousel directly to theme to fix shitty compile errors and the gallery
This commit is contained in:
parent
ff036025a7
commit
146b452d3f
@ -126,10 +126,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NavLink from './NavLink.vue';
|
import NavLink from './NavLink.vue';
|
||||||
// import Slick from 'vue-slick';
|
import Slick from './SlickCarousel.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { NavLink },
|
components: { NavLink, Slick },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
slickOptions: {
|
slickOptions: {
|
||||||
|
|||||||
176
.vuepress/theme/SlickCarousel.vue
Normal file
176
.vuepress/theme/SlickCarousel.vue
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
/* from https://github.com/staskjs/vue-slick */
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import Vue from 'vue';
|
||||||
|
import $ from 'jquery';
|
||||||
|
|
||||||
|
// Check if the request came from the browser and is not server rendered
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
const slick = require('slick-carousel');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: function() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted: function() {
|
||||||
|
this.create();
|
||||||
|
},
|
||||||
|
|
||||||
|
destroyed: function() {
|
||||||
|
$(this.$el).slick('unslick');
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
create: function() {
|
||||||
|
const $slick = $(this.$el);
|
||||||
|
|
||||||
|
$slick.on('afterChange', this.onAfterChange);
|
||||||
|
$slick.on('beforeChange', this.onBeforeChange);
|
||||||
|
$slick.on('breakpoint', this.onBreakpoint);
|
||||||
|
$slick.on('destroy', this.onDestroy);
|
||||||
|
$slick.on('edge', this.onEdge);
|
||||||
|
$slick.on('init', this.onInit);
|
||||||
|
$slick.on('reInit', this.onReInit);
|
||||||
|
$slick.on('setPosition', this.onSetPosition);
|
||||||
|
$slick.on('swipe', this.onSwipe);
|
||||||
|
$slick.on('lazyLoaded', this.onLazyLoaded);
|
||||||
|
$slick.on('lazyLoadError', this.onLazyLoadError);
|
||||||
|
|
||||||
|
$slick.slick(this.options);
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
const $slick = $(this.$el);
|
||||||
|
|
||||||
|
$slick.off('afterChange', this.onAfterChange);
|
||||||
|
$slick.off('beforeChange', this.onBeforeChange);
|
||||||
|
$slick.off('breakpoint', this.onBreakpoint);
|
||||||
|
$slick.off('destroy', this.onDestroy);
|
||||||
|
$slick.off('edge', this.onEdge);
|
||||||
|
$slick.off('init', this.onInit);
|
||||||
|
$slick.off('reInit', this.onReInit);
|
||||||
|
$slick.off('setPosition', this.onSetPosition);
|
||||||
|
$slick.off('swipe', this.onSwipe);
|
||||||
|
$slick.off('lazyLoaded', this.onLazyLoaded);
|
||||||
|
$slick.off('lazyLoadError', this.onLazyLoadError);
|
||||||
|
$(this.$el).slick('unslick');
|
||||||
|
},
|
||||||
|
|
||||||
|
reSlick: function() {
|
||||||
|
this.destroy();
|
||||||
|
this.create();
|
||||||
|
},
|
||||||
|
|
||||||
|
next: function() {
|
||||||
|
$(this.$el).slick('slickNext');
|
||||||
|
},
|
||||||
|
|
||||||
|
prev: function() {
|
||||||
|
$(this.$el).slick('slickPrev');
|
||||||
|
},
|
||||||
|
|
||||||
|
pause: function() {
|
||||||
|
$(this.$el).slick('slickPause');
|
||||||
|
},
|
||||||
|
|
||||||
|
play: function() {
|
||||||
|
$(this.$el).slick('slickPlay');
|
||||||
|
},
|
||||||
|
|
||||||
|
goTo: function(index, dontAnimate) {
|
||||||
|
$(this.$el).slick('slickGoTo', index, dontAnimate);
|
||||||
|
},
|
||||||
|
|
||||||
|
currentSlide: function() {
|
||||||
|
return $(this.$el).slick('slickCurrentSlide');
|
||||||
|
},
|
||||||
|
|
||||||
|
add: function(element, index, addBefore) {
|
||||||
|
$(this.$el).slick('slickAdd', element, index, addBefore);
|
||||||
|
},
|
||||||
|
|
||||||
|
remove: function(index, removeBefore) {
|
||||||
|
$(this.$el).slick('slickRemove', index, removeBefore);
|
||||||
|
},
|
||||||
|
|
||||||
|
filter: function(filterData) {
|
||||||
|
$(this.$el).slick('slickFilter', filterData);
|
||||||
|
},
|
||||||
|
|
||||||
|
unfilter: function() {
|
||||||
|
$(this.$el).slick('slickUnfilter');
|
||||||
|
},
|
||||||
|
|
||||||
|
getOption: function(option) {
|
||||||
|
$(this.$el).slick('slickGetOption', option);
|
||||||
|
},
|
||||||
|
|
||||||
|
setOption: function(option, value, refresh) {
|
||||||
|
$(this.$el).slick('slickSetOption', option, value, refresh);
|
||||||
|
},
|
||||||
|
|
||||||
|
setPosition: function() {
|
||||||
|
$(this.$el).slick('setPosition');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Events
|
||||||
|
onAfterChange: function(event, slick, currentSlide) {
|
||||||
|
this.$emit('afterChange', event, slick, currentSlide);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeChange: function(event, slick, currentSlide, nextSlide) {
|
||||||
|
this.$emit('beforeChange', event, slick, currentSlide, nextSlide);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBreakpoint: function(event, slick, breakpoint) {
|
||||||
|
this.$emit('breakpoint', event, slick, breakpoint);
|
||||||
|
},
|
||||||
|
|
||||||
|
onDestroy: function(event, slick) {
|
||||||
|
this.$emit('destroy', event, slick);
|
||||||
|
},
|
||||||
|
|
||||||
|
onEdge: function(event, slick, direction) {
|
||||||
|
this.$emit('edge', event, slick, direction);
|
||||||
|
},
|
||||||
|
|
||||||
|
onInit: function(event, slick) {
|
||||||
|
this.$emit('init', event, slick);
|
||||||
|
},
|
||||||
|
|
||||||
|
onReInit: function(event, slick) {
|
||||||
|
this.$emit('reInit', event, slick);
|
||||||
|
},
|
||||||
|
|
||||||
|
onSetPosition: function(event, slick) {
|
||||||
|
this.$emit('setPosition', event, slick);
|
||||||
|
},
|
||||||
|
|
||||||
|
onSwipe: function(event, slick, direction) {
|
||||||
|
this.$emit('swipe', event, slick, direction);
|
||||||
|
},
|
||||||
|
|
||||||
|
onLazyLoaded: function(event, slick, image, imageSource) {
|
||||||
|
this.$emit('lazyLoaded', event, slick, image, imageSource);
|
||||||
|
},
|
||||||
|
|
||||||
|
onLazyLoadError: function(event, slick, image, imageSource) {
|
||||||
|
this.$emit('lazyLoadError', event, slick, image, imageSource);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
"vue-slick": "^1.1.13",
|
"slick-carousel": "^1.8.1",
|
||||||
"vuepress": "^0.13.0"
|
"vuepress": "^0.13.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -5873,7 +5873,7 @@ slice-ansi@1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-fullwidth-code-point "^2.0.0"
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
|
||||||
slick-carousel@^1.6.0:
|
slick-carousel@^1.8.1:
|
||||||
version "1.8.1"
|
version "1.8.1"
|
||||||
resolved "https://registry.yarnpkg.com/slick-carousel/-/slick-carousel-1.8.1.tgz#a4bfb29014887bb66ce528b90bd0cda262cc8f8d"
|
resolved "https://registry.yarnpkg.com/slick-carousel/-/slick-carousel-1.8.1.tgz#a4bfb29014887bb66ce528b90bd0cda262cc8f8d"
|
||||||
|
|
||||||
@ -6619,12 +6619,6 @@ vue-server-renderer@^2.5.16:
|
|||||||
serialize-javascript "^1.3.0"
|
serialize-javascript "^1.3.0"
|
||||||
source-map "0.5.6"
|
source-map "0.5.6"
|
||||||
|
|
||||||
vue-slick@^1.1.13:
|
|
||||||
version "1.1.13"
|
|
||||||
resolved "https://registry.yarnpkg.com/vue-slick/-/vue-slick-1.1.13.tgz#e7555c49f7e70880aa3b85b91422154667d5218f"
|
|
||||||
dependencies:
|
|
||||||
slick-carousel "^1.6.0"
|
|
||||||
|
|
||||||
vue-style-loader@^4.1.0:
|
vue-style-loader@^4.1.0:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.1.tgz#7c1d051b24f60b1707602b549ed50b4c8111d316"
|
resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.1.tgz#7c1d051b24f60b1707602b549ed50b4c8111d316"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user