first commit
186
modules/higallery/views/css/admin.css
Normal file
@@ -0,0 +1,186 @@
|
||||
.addons-style-img_preview-theme{
|
||||
max-width: 100%;
|
||||
}
|
||||
.hide{
|
||||
display: none;
|
||||
}
|
||||
.tabs {
|
||||
margin: 0px 0px 5px 2px;
|
||||
}
|
||||
.tabs a.list-group-item {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*Gallery image*/
|
||||
.gallery-image-container .panel{
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.gallery-image-container .sortable{
|
||||
padding: 0px;
|
||||
}
|
||||
.gallery-image-container .item-block{
|
||||
display: inline-block;
|
||||
margin: 5px 10px;
|
||||
border-top: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
vertical-align: text-bottom;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
width: 85px;
|
||||
height: 105px;
|
||||
}
|
||||
.gallery-image-container .item-block img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.gallery-image-container .item-block .action-block{
|
||||
position: absolute;
|
||||
left: -16px;
|
||||
top: -3px;
|
||||
}
|
||||
.gallery-image-container .item-block .action-block a{
|
||||
display: block;
|
||||
padding: 0px;
|
||||
}
|
||||
#gallery_modal_container .modal .modal-dialog {
|
||||
width: 850px;
|
||||
}
|
||||
|
||||
.bootstrap .hipresta-modules-ad .module-sorting-menu {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-item-wrapper-grid {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
||||
min-height: 415px;
|
||||
padding: .625rem;
|
||||
position: relative;
|
||||
display: block;
|
||||
margin-bottom: .625rem;
|
||||
background-color: #fff;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-item-heading-grid {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-logo-thumb-grid {
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
border-radius: 0;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-logo-thumb-grid img {
|
||||
max-width: 55px;
|
||||
max-height: 55px;
|
||||
}
|
||||
#content.bootstrap .hipresta-modules-ad h3.module-name-grid {
|
||||
border: none;
|
||||
font-size: 1.2em;
|
||||
padding: 0 0 0 5px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
font-weight: bolder;
|
||||
margin: 1rem 0 .5rem;
|
||||
min-height: 24px;
|
||||
font-family: Open Sans,Helvetica,Arial,sans-serif;
|
||||
line-height: 1.2;
|
||||
color: #363a41;
|
||||
text-transform: none;
|
||||
border-bottom: none;
|
||||
height: inherit;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-quick-description-grid {
|
||||
margin: 15px 0;
|
||||
text-align: center;
|
||||
min-height: 100px;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-read-more-grid {
|
||||
display: inline-block;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-price {
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
position: relative;
|
||||
margin-right: 5px;
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad hr {
|
||||
margin-top: 1.875rem;
|
||||
margin-bottom: 1.875rem;
|
||||
border: 0;
|
||||
border-top: 1px solid #bbcdd2;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .form-action-button-container {
|
||||
display: flex;
|
||||
-webkit-box-pack: end;
|
||||
justify-content: flex-end;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .btn {
|
||||
height: 32px;
|
||||
font-size: .625rem;
|
||||
padding: .5rem;
|
||||
float: none;
|
||||
margin: 0 auto;
|
||||
color: #25b9d7;
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
border-color: #25b9d7;
|
||||
border-width: 1px;
|
||||
font-weight: 600;
|
||||
border-radius: .063rem;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
user-select: none;
|
||||
text-transform: none;
|
||||
border-left: 1px solid #25b9d7;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .btn:hover {
|
||||
color: #fff;
|
||||
background-color: #19a9c6;
|
||||
border-color: #19a9c6;
|
||||
box-shadow: none;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .badges-container {
|
||||
min-height: 30px;
|
||||
font-size: 14px;
|
||||
line-height: 50%;
|
||||
text-align: center;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .badges-container img {
|
||||
width: 22px;
|
||||
}
|
||||
.bootstrap .hipresta-modules-ad .module-quick-action-grid {
|
||||
color: #363a41;
|
||||
}
|
||||
|
||||
#instagram_authorize a {
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
#instagram_authorize a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.social-account-image-item {
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.social-account-image-item img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.social-account-image-item input[type="checkbox"] {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 10px;
|
||||
right: 20px;
|
||||
}
|
||||
109
modules/higallery/views/css/front.css
Normal file
@@ -0,0 +1,109 @@
|
||||
.higallery-masonry.column-3 .higallery-masonry-item{
|
||||
width: 33%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media(max-width: 600px) {
|
||||
.higallery-masonry.column-3 .higallery-masonry-item{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
/*Controller page*/
|
||||
#galleries .galleries-block{
|
||||
padding: 5px;
|
||||
}
|
||||
#galleries .galleries-block > a {
|
||||
border: 1px solid #ccc;
|
||||
display: block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
#galleries .galleries-block img{
|
||||
max-width: 100%;
|
||||
}
|
||||
#galleries .galleries-block h4{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 11px 20px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
filter: alpha(opacity=90);
|
||||
font-family: "Noto Sans", sans-serif;
|
||||
transform: translateY(0%);
|
||||
-webkit-transition: transform 0.3s;
|
||||
-moz-transition: transform 0.3s;
|
||||
-ms-transition: transform 0.3s;
|
||||
-o-transition: transform 0.3s;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
/*End*/
|
||||
|
||||
.gallerys-container{
|
||||
clear: both;
|
||||
}
|
||||
.gallery-main{
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.gallery-main .image-content{
|
||||
padding: 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.gallery-main .image-content > a{
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.gallery-main .image-content img{
|
||||
max-width: 100%;
|
||||
}
|
||||
.gallery-main .image-content .caption{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 11px 20px;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
filter: alpha(opacity=90);
|
||||
font-family: "Noto Sans", sans-serif;
|
||||
transform: translateY(100%);
|
||||
-webkit-transition: transform 0.3s;
|
||||
-moz-transition: transform 0.3s;
|
||||
-ms-transition: transform 0.3s;
|
||||
-o-transition: transform 0.3s;
|
||||
transition: transform 0.3s;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.gallery-main .image-content > a:hover .caption {
|
||||
transform: translateY(0%);
|
||||
}
|
||||
|
||||
|
||||
.higallery-loader,
|
||||
.hi-gallery-ajax-loader {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: url(../img/loader.gif) no-repeat;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@media ( -webkit-min-device-pixel-ratio : 1.5) {
|
||||
.higallery-loader,
|
||||
.hi-gallery-ajax-loader {
|
||||
background: url(../img/loader@2x.gif) no-repeat;
|
||||
background-size: 60px 60px;
|
||||
}
|
||||
}
|
||||
|
||||
.gallery-title{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
27
modules/higallery/views/css/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
351
modules/higallery/views/css/jquery.magnific-popup.css
Normal file
@@ -0,0 +1,351 @@
|
||||
/* Magnific Popup CSS */
|
||||
.mfp-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 6042;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
background: #0b0b0b;
|
||||
opacity: 0.8; }
|
||||
|
||||
.mfp-wrap {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 6042;
|
||||
position: fixed;
|
||||
outline: none !important;
|
||||
-webkit-backface-visibility: hidden; }
|
||||
|
||||
.mfp-container {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.mfp-container:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle; }
|
||||
|
||||
.mfp-align-top .mfp-container:before {
|
||||
display: none; }
|
||||
|
||||
.mfp-content {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
z-index: 1045; }
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress; }
|
||||
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: -moz-zoom-out;
|
||||
cursor: -webkit-zoom-out;
|
||||
cursor: zoom-out; }
|
||||
|
||||
.mfp-zoom {
|
||||
cursor: pointer;
|
||||
cursor: -webkit-zoom-in;
|
||||
cursor: -moz-zoom-in;
|
||||
cursor: zoom-in; }
|
||||
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none; }
|
||||
|
||||
.mfp-loading.mfp-figure {
|
||||
display: none; }
|
||||
|
||||
.mfp-hide {
|
||||
display: none !important; }
|
||||
|
||||
.mfp-preloader {
|
||||
color: #CCC;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin-top: -0.8em;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
z-index: 1044; }
|
||||
.mfp-preloader a {
|
||||
color: #CCC; }
|
||||
.mfp-preloader a:hover {
|
||||
color: #FFF; }
|
||||
|
||||
.mfp-s-ready .mfp-preloader {
|
||||
display: none; }
|
||||
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none; }
|
||||
|
||||
button.mfp-close,
|
||||
button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046;
|
||||
box-shadow: none;
|
||||
touch-action: manipulation; }
|
||||
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0; }
|
||||
|
||||
.mfp-close {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
padding: 0 0 18px 10px;
|
||||
color: #FFF;
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace; }
|
||||
.mfp-close:hover,
|
||||
.mfp-close:focus {
|
||||
opacity: 1; }
|
||||
.mfp-close:active {
|
||||
top: 1px; }
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: #333; }
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
color: #FFF;
|
||||
right: -6px;
|
||||
text-align: right;
|
||||
padding-right: 6px;
|
||||
width: 100%; }
|
||||
|
||||
.mfp-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
color: #CCC;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap; }
|
||||
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
padding: 0;
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: transparent; }
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px; }
|
||||
.mfp-arrow:hover,
|
||||
.mfp-arrow:focus {
|
||||
opacity: 1; }
|
||||
.mfp-arrow:before,
|
||||
.mfp-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-left: 35px;
|
||||
border: medium inset transparent; }
|
||||
.mfp-arrow:after {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px; }
|
||||
.mfp-arrow:before {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7; }
|
||||
|
||||
.mfp-arrow-left {
|
||||
left: 0; }
|
||||
.mfp-arrow-left:after {
|
||||
border-right: 17px solid #FFF;
|
||||
margin-left: 31px; }
|
||||
.mfp-arrow-left:before {
|
||||
margin-left: 25px;
|
||||
border-right: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-arrow-right {
|
||||
right: 0; }
|
||||
.mfp-arrow-right:after {
|
||||
border-left: 17px solid #FFF;
|
||||
margin-left: 39px; }
|
||||
.mfp-arrow-right:before {
|
||||
border-left: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px; }
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px; }
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px; }
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%; }
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #000; }
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 40px 0 40px;
|
||||
margin: 0 auto; }
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0; }
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 40px;
|
||||
bottom: 40px;
|
||||
display: block;
|
||||
right: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #444; }
|
||||
.mfp-figure small {
|
||||
color: #BDBDBD;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px; }
|
||||
.mfp-figure figure {
|
||||
margin: 0; }
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-title {
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
color: #F3F3F3;
|
||||
word-wrap: break-word;
|
||||
padding-right: 36px; }
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%; }
|
||||
|
||||
.mfp-gallery .mfp-image-holder .mfp-figure {
|
||||
cursor: pointer; }
|
||||
|
||||
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
||||
/**
|
||||
* Remove all paddings around the image on small screen
|
||||
*/
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-left: 0;
|
||||
padding-right: 0; }
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0; }
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px; }
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
top: auto;
|
||||
padding: 3px 5px;
|
||||
position: fixed;
|
||||
box-sizing: border-box; }
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
right: 5px;
|
||||
top: 3px; }
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0; } }
|
||||
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
-webkit-transform: scale(0.75);
|
||||
transform: scale(0.75); }
|
||||
.mfp-arrow-left {
|
||||
-webkit-transform-origin: 0;
|
||||
transform-origin: 0; }
|
||||
.mfp-arrow-right {
|
||||
-webkit-transform-origin: 100%;
|
||||
transform-origin: 100%; }
|
||||
.mfp-container {
|
||||
padding-left: 6px;
|
||||
padding-right: 6px; } }
|
||||
27
modules/higallery/views/img/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
BIN
modules/higallery/views/img/loader.gif
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
modules/higallery/views/img/loader@2x.gif
Normal file
|
After Width: | Height: | Size: 62 KiB |
27
modules/higallery/views/img/upload/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 228 KiB |
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 184 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 196 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 203 KiB |
1
modules/higallery/views/img/upload/original/fileType
Normal file
@@ -0,0 +1 @@
|
||||
jpg
|
||||
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 221 KiB |
27
modules/higallery/views/img/upload/original/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 221 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 201 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
After Width: | Height: | Size: 203 KiB |
|
After Width: | Height: | Size: 232 KiB |
BIN
modules/higallery/views/img/upload/placeholder.jpg
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 66 KiB |
1
modules/higallery/views/img/upload/small/fileType
Normal file
@@ -0,0 +1 @@
|
||||
jpg
|
||||
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 73 KiB |
27
modules/higallery/views/img/upload/small/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
1
modules/higallery/views/img/upload/thumbnail/fileType
Normal file
@@ -0,0 +1 @@
|
||||
jpg
|
||||
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
27
modules/higallery/views/img/upload/thumbnail/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
27
modules/higallery/views/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
715
modules/higallery/views/js/admin.js
Normal file
@@ -0,0 +1,715 @@
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
$.fn.position_sort = function(name) {
|
||||
var sortable_item = [];
|
||||
var sortable = $(this);
|
||||
|
||||
sortable.each(function(i) {
|
||||
$('li', this).each(function(e) {
|
||||
var data_id = $(this).attr('data-id-image');
|
||||
sortable_item.push(name+'['+e+'][id_item] ='+data_id);
|
||||
});
|
||||
});
|
||||
return sortable_item.join('&');
|
||||
}
|
||||
|
||||
// initSortableMenuItems('.sortable', 'menu_item', 'sortable_change_position');
|
||||
function initSortableItems(){
|
||||
$('.sortable').sortable({
|
||||
stop: function(event, ui) {
|
||||
var position = $('.sortable').position_sort('gallery_item')+"&id_parent="+$(this).attr('data-id-parent')+"&action=sortable_change_position&secure_key="+gallery_secure_key+"&psv="+psv;
|
||||
$.post(gallery_admin_controller_dir+"&ajax=1", position);
|
||||
}
|
||||
}).disableSelection();
|
||||
}
|
||||
|
||||
function HiInitGalleriesSort() {
|
||||
if ($('#table-higallery').length) {
|
||||
var $galleriesTable = $('#table-higallery');
|
||||
} else {
|
||||
var $galleriesTable = $('.table.higallery');
|
||||
}
|
||||
$galleriesTable.find('tbody').sortable({
|
||||
handle: '.icon-move',
|
||||
stop: function(event, ui) {
|
||||
var sorted_items = [];
|
||||
$galleriesTable.find('tbody tr').each(function(e) {
|
||||
var id_gallery = parseInt($(this).find('td:eq(1)').text());
|
||||
sorted_items.push('sortedGalleries['+e+']=' + id_gallery);
|
||||
});
|
||||
|
||||
var params = sorted_items.join('&');
|
||||
params += '&ajax=1&secure_key=' + gallery_secure_key + '&action=sortGalleries'
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
async: true,
|
||||
data: params,
|
||||
success: function(response){
|
||||
if (response.error != '') {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function update_helper_list(action){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir+"&ajax=1",
|
||||
data: {
|
||||
action : action,
|
||||
secure_key : gallery_secure_key,
|
||||
psv: psv,
|
||||
},
|
||||
success: function(response){
|
||||
$("#form-higallery").replaceWith(response.content);
|
||||
|
||||
HiInitGalleriesSort();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function show_gallery_form(th, action, action_type, id){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir,
|
||||
data: {
|
||||
ajax : true,
|
||||
action : action,
|
||||
action_type : action_type,
|
||||
id : id,
|
||||
secure_key : gallery_secure_key,
|
||||
psv: psv,
|
||||
},
|
||||
beforeSend: function(){
|
||||
if (th.hasClass("edit")){
|
||||
th.find('i').removeClass('icon-pencil').addClass('icon-refresh icon-spin');
|
||||
} else {
|
||||
th.find('i').removeClass('process-icon-new').addClass('process-icon-refresh icon-spin');
|
||||
}
|
||||
},
|
||||
success: function(response){
|
||||
if (th.hasClass("edit")){
|
||||
th.find('i').removeClass('icon-refresh icon-spin').addClass('icon-pencil');
|
||||
} else {
|
||||
th.find('i').removeClass('process-icon-refresh icon-spin').addClass('process-icon-new');
|
||||
}
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
$("#modal_form .content").html(response.content);
|
||||
$('#modal_form').modal('show');
|
||||
if ($('[name=position]').val() != 'gallery_page' && $('[name=position]').val() != 'single_gallery_page') {
|
||||
$('.gallery_page_content').hide();
|
||||
} else {
|
||||
$('.gallery_page_content').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function save_gallery_form(form, action, helper_action){
|
||||
$('.tagify').each(function(){
|
||||
var input_id = $(this).attr('id');
|
||||
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
|
||||
});
|
||||
var formdata = new FormData($(form)[0])
|
||||
formdata.append("action", action);
|
||||
formdata.append("secure_key", gallery_secure_key);
|
||||
formdata.append("psv", psv);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir+"&ajax=1",
|
||||
data: formdata,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function(){
|
||||
form.find('i.process-icon-save').removeClass('process-icon-save').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
form.find('i.process-icon-refresh').removeClass('process-icon-refresh icon-spin').addClass('process-icon-save');
|
||||
if (response.error) {
|
||||
showErrorMessage(response.errors.error);
|
||||
} else {
|
||||
showSuccessMessage('Successful Save');
|
||||
$('#modal_form').modal('hide');
|
||||
update_helper_list(helper_action);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_list_item(th, action, id){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir+"&ajax=1",
|
||||
data: {
|
||||
action : action,
|
||||
id : id,
|
||||
secure_key : gallery_secure_key,
|
||||
psv: psv,
|
||||
},
|
||||
success: function(response){
|
||||
showSuccessMessage('Successful delete');
|
||||
th.closest('tr').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
HiInitGalleriesSort();
|
||||
|
||||
$('.fake_desc').closest('form').hide();
|
||||
$(document).on('click', '[name=submit_gallery_cancel]', function(){
|
||||
$('#modal_form').modal('hide');
|
||||
return false;
|
||||
});
|
||||
$(document).on('change', '[name=position]', function(){
|
||||
if ($(this).val() != 'gallery_page' && $(this).val() != 'single_gallery_page') {
|
||||
$('.gallery_page_content').hide();
|
||||
} else {
|
||||
$('.gallery_page_content').show();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '#desc-higallery-new', function(e){
|
||||
e.preventDefault();
|
||||
show_gallery_form($(this), 'show_gallery_add_form', 'add', null);
|
||||
});
|
||||
|
||||
$(document).on('click', '.higallery .edit', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr("href").match(/id_gallery=([0-9]+)/)[1];
|
||||
show_gallery_form($(this), 'show_gallery_update_form', 'update', id);
|
||||
});
|
||||
|
||||
$(document).on('submit', '#modal_form form.gallery_form', function(e){
|
||||
e.preventDefault();
|
||||
save_gallery_form($(this), 'save_gallery', 'update_helper_list');
|
||||
});
|
||||
|
||||
$(document).on('click', '.higallery .delete', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr("href").match(/id_gallery=([0-9]+)/)[1];
|
||||
delete_list_item($(this), 'delete_gallery_list_item', id)
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.higallery .status', function(e){
|
||||
e.preventDefault();
|
||||
var th = $(this);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : "update_status",
|
||||
id : $(this).attr('data-id'),
|
||||
status : $(this).attr('data-status'),
|
||||
secure_key : gallery_secure_key,
|
||||
},
|
||||
beforeSend: function(){
|
||||
if (th.hasClass('btn-success')){
|
||||
th.find('i').removeClass('icon-check').addClass('icon-refresh icon-spin');
|
||||
} else {
|
||||
th.find('i').removeClass('icon-remove').addClass('icon-refresh icon-spin');
|
||||
}
|
||||
},
|
||||
success: function(response){
|
||||
if (th.hasClass('btn-success')){
|
||||
th.find('i').removeClass('icon-refresh icon-spin').addClass('icon-check');
|
||||
} else {
|
||||
th.find('i').removeClass('icon-refresh icon-spin').addClass('icon-remove');
|
||||
}
|
||||
$("#form-higallery").replaceWith(response.content);
|
||||
|
||||
HiInitGalleriesSort();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
/*Show Gallery image add form*/
|
||||
$(document).on('click', '.higallery .gallery_manage_image', function(e){
|
||||
e.preventDefault();
|
||||
var th = $(this);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : "gallery_manage_image",
|
||||
id_gallery : $(this).attr('data-id-gallery'),
|
||||
secure_key : gallery_secure_key,
|
||||
},
|
||||
beforeSend: function(){
|
||||
th.find('i').removeClass('icon-image').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
th.find('i').removeClass('icon-refresh icon-spin').addClass('icon-image');
|
||||
$('#form-higallery').replaceWith(response.content);
|
||||
// $("#modal_form .content").html(response.content);
|
||||
initSortableItems();
|
||||
// $('#modal_form').modal('show');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.back-to-upload-image', function(e){
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax: true,
|
||||
action: 'gallery_manage_image',
|
||||
id_gallery: $('.gallery-image-container').attr('data-id-gallery'),
|
||||
secure_key : gallery_secure_key
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i').removeClass('process-icon-back').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
$('.gallery-image-container').remove();
|
||||
$('.gallery-social-accounts-container').replaceWith(response.content);
|
||||
initSortableItems();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '[name="submit_gallery_cancel"]', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data: {
|
||||
ajax: true,
|
||||
action : 'update_helper_list',
|
||||
secure_key : gallery_secure_key,
|
||||
psv: psv
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i').removeClass('process-icon-cancel').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
$this.find('i').removeClass('process-icon-refresh icon-spin').addClass('process-icon-cancel');
|
||||
|
||||
$('.gallery-image-container').remove();
|
||||
$('.gallery_image_form').replaceWith(response.content);
|
||||
|
||||
HiInitGalleriesSort();
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*Save gallery image*/
|
||||
$(document).on('submit', 'form.gallery_image_form', function(e){
|
||||
e.preventDefault();
|
||||
var form = $(this);
|
||||
var formdata = new FormData($(form)[0])
|
||||
formdata.append("action", 'add_gallery_image');
|
||||
formdata.append("secure_key", gallery_secure_key);
|
||||
formdata.append("psv", psv);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir+"&ajax=1",
|
||||
data: formdata,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function(){
|
||||
form.find('i.process-icon-save').removeClass('process-icon-save').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
form.find('i.process-icon-refresh').removeClass('process-icon-refresh icon-spin').addClass('process-icon-save');
|
||||
if (response.error) {
|
||||
showErrorMessage(error);
|
||||
} else {
|
||||
showSuccessMessage('Successful Save');
|
||||
$('.gallery_image_form').remove();
|
||||
$('.gallery-image-container').replaceWith(response.content);
|
||||
initSortableItems();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
/*Show gallery image update form*/
|
||||
$(document).on('click', '.edit-gallery-image', function(e){
|
||||
e.preventDefault();
|
||||
var th = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : "show_update_gallery_image",
|
||||
id_image : $(this).closest('li').attr('data-id-image'),
|
||||
id_gallery : $(this).closest('ul').attr('data-id-parent'),
|
||||
secure_key : gallery_secure_key,
|
||||
},
|
||||
beforeSend: function(){
|
||||
th.find('i.icon-edit').removeClass('icon-edit').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
th.find('i.icon-refresh').removeClass('icon-refresh icon-spin').addClass('icon-edit');
|
||||
$(".gallery_image_form").replaceWith(response.content);
|
||||
initSortableItems();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
/*Delete gallery image */
|
||||
$(document).on('click', '.delete-gallery-image', function(e){
|
||||
e.preventDefault();
|
||||
var th = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: "JSON",
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : "delete_gallery_image",
|
||||
id_image : $(this).closest('li').attr('data-id-image'),
|
||||
id_gallery : $(this).closest('ul').attr('data-id-parent'),
|
||||
secure_key : gallery_secure_key,
|
||||
},
|
||||
beforeSend: function(){
|
||||
th.find('i.icon-trash').removeClass('icon-trash').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage('Deleted with success');
|
||||
$('.gallery-image-container').replaceWith(response.content);
|
||||
initSortableItems();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '#desc-higallerysocialnetwork-new', function() {
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : "displaySocialAccountForm",
|
||||
secure_key : gallery_secure_key
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i.process-icon-new').removeClass('process-icon-new').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
$this.find('i.process-icon-refresh').removeClass('process-icon-refresh icon-spin').addClass('process-icon-new');
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
$('#modal_form .content').html(response.content);
|
||||
$('#modal_form').modal('show');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '[name="submit_cancel_social_account"]', function(){
|
||||
$('#modal_form').modal('hide');
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', 'button[name="submit_social_network_form"]', function(e){
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action: 'displaySelectedSocialForm',
|
||||
social_network: $('#social_network').val(),
|
||||
secure_key: gallery_secure_key
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i').removeClass('process-icon-save').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
$this.find('i').removeClass('process-icon-refresh icon-spin').addClass('process-icon-save');
|
||||
$('#modal_form .content').html(response.content);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', 'button[name="submit_instagram_save"]', function(e){
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
var form = $this.closest('form');
|
||||
var formdata = new FormData($(form)[0])
|
||||
formdata.append('action', 'saveSocialAccount');
|
||||
formdata.append('secure_key', gallery_secure_key);
|
||||
formdata.append('ajax', true);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: gallery_admin_controller_dir,
|
||||
data: formdata,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function(){
|
||||
$this.find('i').removeClass('process-icon-save').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response){
|
||||
$this.find('i').removeClass('process-icon-refresh icon-spin').addClass('process-icon-save');
|
||||
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
$('#modal_form').modal('hide');
|
||||
$('#form-higallerysocialnetwork').replaceWith(response.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.higallerysocialnetwork .edit', function(e) {
|
||||
var $this = $(this);
|
||||
var id_social_account = $(this).attr('href').match(/id_higallerysocialnetwork=([0-9]+)/)[1];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : 'displaySocialAccountEditForm',
|
||||
id_social_account: id_social_account,
|
||||
secure_key : gallery_secure_key
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i.icon-pencil').removeClass('icon-pencil').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
$this.find('i.icon-refresh').removeClass('icon-refresh icon-spin').addClass('icon-pencil');
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
$('#modal_form .content').html(response.content);
|
||||
$('#modal_form').modal('show');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '.higallerysocialnetwork .delete', function(e){
|
||||
var $this = $(this);
|
||||
var id_social_account = $(this).attr('href').match(/id_higallerysocialnetwork=([0-9]+)/)[1];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : 'deleteSocialAccount',
|
||||
id_social_account: id_social_account,
|
||||
secure_key : gallery_secure_key
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
$('#form-higallerysocialnetwork').replaceWith(response.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '#social_import, .back-to-select-social-accounts', function(e) {
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax : true,
|
||||
action : 'selectSocialAccount',
|
||||
secure_key : gallery_secure_key
|
||||
},
|
||||
beforeSend: function(){
|
||||
// .back-to-select-social-accounts
|
||||
$this.find('i.process-icon-back').removeClass('process-icon-back').addClass('process-icon-refresh icon-spin');
|
||||
// #social_import
|
||||
$this.find('i.icon-instagram').removeClass('icon-instagram').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
$('.gallery_image_form, .gallery-social-account-images-container').replaceWith(response.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '.load-social-images', function(e) {
|
||||
var id_social_account = $(this).attr('data-social-id');
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax: true,
|
||||
action: 'loadSocialImages',
|
||||
secure_key: gallery_secure_key,
|
||||
id_social_account: id_social_account
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i.icon-instagram').removeClass('icon-instagram').addClass('icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
$('.gallery-social-accounts-container').replaceWith(response.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '.social-account-image-item img', function(){
|
||||
$(this).parent().find('input[type="checkbox"]').click();
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '.import-social-images', function(e) {
|
||||
var $this = $(this);
|
||||
var selected_images = new Array();
|
||||
$("input:checkbox[name=social_account_image]:checked").each(function() {
|
||||
selected_images.push($(this).val());
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax: true,
|
||||
action: 'importSocialImages',
|
||||
secure_key: gallery_secure_key,
|
||||
id_gallery: $('.gallery-image-container').attr('data-id-gallery'),
|
||||
images: selected_images
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i.process-icon-import').removeClass('process-icon-import').addClass('process-icon-refresh icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
$this.find('i.process-icon-refresh').removeClass('process-icon-refresh').removeClass('icon-spin').addClass('process-icon-import');
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
|
||||
$("input:checkbox[name=social_account_image]:checked").parent().remove();
|
||||
|
||||
$('.gallery-image-container').replaceWith(response.content);
|
||||
|
||||
initSortableItems();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '.load-more-ig-images', function() {
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: gallery_admin_controller_dir,
|
||||
data:{
|
||||
ajax: true,
|
||||
action: 'loadMoreImagesIG',
|
||||
secure_key: gallery_secure_key,
|
||||
next: $(this).attr('href')
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.find('i.icon-refresh').addClass('icon-spin');
|
||||
},
|
||||
success: function(response) {
|
||||
$this.find('i.icon-refresh').removeClass('icon-spin');
|
||||
|
||||
if (response.error) {
|
||||
showErrorMessage(response.error);
|
||||
} else {
|
||||
showSuccessMessage(response.message);
|
||||
|
||||
if (response.ig_next_page) {
|
||||
$('.load-more-ig-images').attr('href', response.ig_next_page);
|
||||
} else {
|
||||
$('.load-more-ig-images').remove();
|
||||
}
|
||||
|
||||
$('.load-more-images-container').append(response.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
866
modules/higallery/views/js/front.js
Normal file
@@ -0,0 +1,866 @@
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
$(document).ready(function(){
|
||||
var $gallery_items = $('.higallery-masonry-item');
|
||||
var $gallery_loader = $('.higallery-loader');
|
||||
$gallery_items.hide();
|
||||
|
||||
var $gallery_container = $('.higallery-masonry');
|
||||
$gallery_container.imagesLoaded( function() {
|
||||
$gallery_loader.hide();
|
||||
$gallery_items.fadeIn();
|
||||
$gallery_container.masonry({
|
||||
itemSelector : '.higallery-masonry-item'
|
||||
});
|
||||
});
|
||||
|
||||
$('.gallery-main').each(function(){
|
||||
var id_gallery = $(this).attr('data-id-gallery');
|
||||
var $gallery_main = $(".gallery-main-"+id_gallery);
|
||||
|
||||
$gallery_main.find(".gallery-image-block").find(".image-content > a").magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('scroll', function(){
|
||||
$('.higallery-masonry').masonry({
|
||||
itemSelector : '.higallery-masonry-item'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Load gallery with ajax from html element
|
||||
$('.hi-gallery-ajax-loader').each(function() {
|
||||
$this = $(this);
|
||||
var element_id = $(this).attr('id');
|
||||
if (typeof element_id != 'undefined') {
|
||||
element_id = element_id.split('-');
|
||||
var id_gallery = element_id[1];
|
||||
} else {
|
||||
var id_gallery = 0;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
// async: false,
|
||||
dataType: 'json',
|
||||
url: higallery.ajax_url,
|
||||
data: {
|
||||
ajax: true,
|
||||
secure_key: higallery.secure_key,
|
||||
action: 'renderGallery',
|
||||
id_gallery: id_gallery
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.error) {
|
||||
$('.hi-gallery-ajax-loader#higallery-' + id_gallery).remove();
|
||||
} else {
|
||||
$('.hi-gallery-ajax-loader#higallery-' + id_gallery).replaceWith(response.content);
|
||||
|
||||
var $gallery = $('[data-id-loaded-gallery="'+id_gallery+'"]');
|
||||
var $gallery_items = $gallery.find('.higallery-masonry-item');
|
||||
|
||||
var $gallery_container = $gallery.find('.higallery-masonry');
|
||||
$gallery_container.imagesLoaded( function() {
|
||||
$gallery_items.fadeIn();
|
||||
$gallery_container.masonry({
|
||||
itemSelector : '.higallery-masonry-item'
|
||||
});
|
||||
});
|
||||
|
||||
$gallery.find('.gallery-image-block').find('.image-content > a').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Load gallery with ajax from shortcode
|
||||
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var lazyImages = [].slice.call(document.querySelectorAll("img.hi-lazy"));
|
||||
|
||||
if ("IntersectionObserver" in window) {
|
||||
let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.isIntersecting) {
|
||||
let lazyImage = entry.target;
|
||||
lazyImage.src = lazyImage.dataset.src;
|
||||
lazyImage.srcset = lazyImage.dataset.srcset;
|
||||
lazyImage.classList.remove("hi-lazy");
|
||||
lazyImageObserver.unobserve(lazyImage);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
lazyImages.forEach(function(lazyImage) {
|
||||
lazyImageObserver.observe(lazyImage);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Copyright 2016 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
|
||||
*
|
||||
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
||||
*
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Exit early if we're not running in a browser.
|
||||
if (typeof window !== 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Exit early if all IntersectionObserver and IntersectionObserverEntry
|
||||
// features are natively supported.
|
||||
if ('IntersectionObserver' in window &&
|
||||
'IntersectionObserverEntry' in window &&
|
||||
'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
|
||||
|
||||
// Minimal polyfill for Edge 15's lack of `isIntersecting`
|
||||
// See: https://github.com/w3c/IntersectionObserver/issues/211
|
||||
if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
|
||||
Object.defineProperty(window.IntersectionObserverEntry.prototype,
|
||||
'isIntersecting', {
|
||||
get: function () {
|
||||
return this.intersectionRatio > 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A local reference to the document.
|
||||
*/
|
||||
var document = window.document;
|
||||
|
||||
|
||||
/**
|
||||
* An IntersectionObserver registry. This registry exists to hold a strong
|
||||
* reference to IntersectionObserver instances currently observing a target
|
||||
* element. Without this registry, instances without another reference may be
|
||||
* garbage collected.
|
||||
*/
|
||||
var registry = [];
|
||||
|
||||
|
||||
/**
|
||||
* Creates the global IntersectionObserverEntry constructor.
|
||||
* https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
|
||||
* @param {Object} entry A dictionary of instance properties.
|
||||
* @constructor
|
||||
*/
|
||||
function IntersectionObserverEntry(entry) {
|
||||
this.time = entry.time;
|
||||
this.target = entry.target;
|
||||
this.rootBounds = entry.rootBounds;
|
||||
this.boundingClientRect = entry.boundingClientRect;
|
||||
this.intersectionRect = entry.intersectionRect || getEmptyRect();
|
||||
this.isIntersecting = !!entry.intersectionRect;
|
||||
|
||||
// Calculates the intersection ratio.
|
||||
var targetRect = this.boundingClientRect;
|
||||
var targetArea = targetRect.width * targetRect.height;
|
||||
var intersectionRect = this.intersectionRect;
|
||||
var intersectionArea = intersectionRect.width * intersectionRect.height;
|
||||
|
||||
// Sets intersection ratio.
|
||||
if (targetArea) {
|
||||
// Round the intersection ratio to avoid floating point math issues:
|
||||
// https://github.com/w3c/IntersectionObserver/issues/324
|
||||
this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));
|
||||
} else {
|
||||
// If area is zero and is intersecting, sets to 1, otherwise to 0
|
||||
this.intersectionRatio = this.isIntersecting ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the global IntersectionObserver constructor.
|
||||
* https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
|
||||
* @param {Function} callback The function to be invoked after intersection
|
||||
* changes have queued. The function is not invoked if the queue has
|
||||
* been emptied by calling the `takeRecords` method.
|
||||
* @param {Object=} opt_options Optional configuration options.
|
||||
* @constructor
|
||||
*/
|
||||
function IntersectionObserver(callback, opt_options) {
|
||||
|
||||
var options = opt_options || {};
|
||||
|
||||
if (typeof callback != 'function') {
|
||||
throw new Error('callback must be a function');
|
||||
}
|
||||
|
||||
if (options.root && options.root.nodeType != 1) {
|
||||
throw new Error('root must be an Element');
|
||||
}
|
||||
|
||||
// Binds and throttles `this._checkForIntersections`.
|
||||
this._checkForIntersections = throttle(
|
||||
this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);
|
||||
|
||||
// Private properties.
|
||||
this._callback = callback;
|
||||
this._observationTargets = [];
|
||||
this._queuedEntries = [];
|
||||
this._rootMarginValues = this._parseRootMargin(options.rootMargin);
|
||||
|
||||
// Public properties.
|
||||
this.thresholds = this._initThresholds(options.threshold);
|
||||
this.root = options.root || null;
|
||||
this.rootMargin = this._rootMarginValues.map(function(margin) {
|
||||
return margin.value + margin.unit;
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The minimum interval within which the document will be checked for
|
||||
* intersection changes.
|
||||
*/
|
||||
IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;
|
||||
|
||||
|
||||
/**
|
||||
* The frequency in which the polyfill polls for intersection changes.
|
||||
* this can be updated on a per instance basis and must be set prior to
|
||||
* calling `observe` on the first target.
|
||||
*/
|
||||
IntersectionObserver.prototype.POLL_INTERVAL = null;
|
||||
|
||||
/**
|
||||
* Use a mutation observer on the root element
|
||||
* to detect intersection changes.
|
||||
*/
|
||||
IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;
|
||||
|
||||
|
||||
/**
|
||||
* Starts observing a target element for intersection changes based on
|
||||
* the thresholds values.
|
||||
* @param {Element} target The DOM element to observe.
|
||||
*/
|
||||
IntersectionObserver.prototype.observe = function(target) {
|
||||
var isTargetAlreadyObserved = this._observationTargets.some(function(item) {
|
||||
return item.element == target;
|
||||
});
|
||||
|
||||
if (isTargetAlreadyObserved) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(target && target.nodeType == 1)) {
|
||||
throw new Error('target must be an Element');
|
||||
}
|
||||
|
||||
this._registerInstance();
|
||||
this._observationTargets.push({element: target, entry: null});
|
||||
this._monitorIntersections();
|
||||
this._checkForIntersections();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stops observing a target element for intersection changes.
|
||||
* @param {Element} target The DOM element to observe.
|
||||
*/
|
||||
IntersectionObserver.prototype.unobserve = function(target) {
|
||||
this._observationTargets =
|
||||
this._observationTargets.filter(function(item) {
|
||||
|
||||
return item.element != target;
|
||||
});
|
||||
if (!this._observationTargets.length) {
|
||||
this._unmonitorIntersections();
|
||||
this._unregisterInstance();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stops observing all target elements for intersection changes.
|
||||
*/
|
||||
IntersectionObserver.prototype.disconnect = function() {
|
||||
this._observationTargets = [];
|
||||
this._unmonitorIntersections();
|
||||
this._unregisterInstance();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns any queue entries that have not yet been reported to the
|
||||
* callback and clears the queue. This can be used in conjunction with the
|
||||
* callback to obtain the absolute most up-to-date intersection information.
|
||||
* @return {Array} The currently queued entries.
|
||||
*/
|
||||
IntersectionObserver.prototype.takeRecords = function() {
|
||||
var records = this._queuedEntries.slice();
|
||||
this._queuedEntries = [];
|
||||
return records;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accepts the threshold value from the user configuration object and
|
||||
* returns a sorted array of unique threshold values. If a value is not
|
||||
* between 0 and 1 and error is thrown.
|
||||
* @private
|
||||
* @param {Array|number=} opt_threshold An optional threshold value or
|
||||
* a list of threshold values, defaulting to [0].
|
||||
* @return {Array} A sorted list of unique and valid threshold values.
|
||||
*/
|
||||
IntersectionObserver.prototype._initThresholds = function(opt_threshold) {
|
||||
var threshold = opt_threshold || [0];
|
||||
if (!Array.isArray(threshold)) threshold = [threshold];
|
||||
|
||||
return threshold.sort().filter(function(t, i, a) {
|
||||
if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {
|
||||
throw new Error('threshold must be a number between 0 and 1 inclusively');
|
||||
}
|
||||
return t !== a[i - 1];
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accepts the rootMargin value from the user configuration object
|
||||
* and returns an array of the four margin values as an object containing
|
||||
* the value and unit properties. If any of the values are not properly
|
||||
* formatted or use a unit other than px or %, and error is thrown.
|
||||
* @private
|
||||
* @param {string=} opt_rootMargin An optional rootMargin value,
|
||||
* defaulting to '0px'.
|
||||
* @return {Array<Object>} An array of margin objects with the keys
|
||||
* value and unit.
|
||||
*/
|
||||
IntersectionObserver.prototype._parseRootMargin = function(opt_rootMargin) {
|
||||
var marginString = opt_rootMargin || '0px';
|
||||
var margins = marginString.split(/\s+/).map(function(margin) {
|
||||
var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin);
|
||||
if (!parts) {
|
||||
throw new Error('rootMargin must be specified in pixels or percent');
|
||||
}
|
||||
return {value: parseFloat(parts[1]), unit: parts[2]};
|
||||
});
|
||||
|
||||
// Handles shorthand.
|
||||
margins[1] = margins[1] || margins[0];
|
||||
margins[2] = margins[2] || margins[0];
|
||||
margins[3] = margins[3] || margins[1];
|
||||
|
||||
return margins;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Starts polling for intersection changes if the polling is not already
|
||||
* happening, and if the page's visibility state is visible.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._monitorIntersections = function() {
|
||||
if (!this._monitoringIntersections) {
|
||||
this._monitoringIntersections = true;
|
||||
|
||||
// If a poll interval is set, use polling instead of listening to
|
||||
// resize and scroll events or DOM mutations.
|
||||
if (this.POLL_INTERVAL) {
|
||||
this._monitoringInterval = setInterval(
|
||||
this._checkForIntersections, this.POLL_INTERVAL);
|
||||
}
|
||||
else {
|
||||
addEvent(window, 'resize', this._checkForIntersections, true);
|
||||
addEvent(document, 'scroll', this._checkForIntersections, true);
|
||||
|
||||
if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in window) {
|
||||
this._domObserver = new MutationObserver(this._checkForIntersections);
|
||||
this._domObserver.observe(document, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
characterData: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stops polling for intersection changes.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._unmonitorIntersections = function() {
|
||||
if (this._monitoringIntersections) {
|
||||
this._monitoringIntersections = false;
|
||||
|
||||
clearInterval(this._monitoringInterval);
|
||||
this._monitoringInterval = null;
|
||||
|
||||
removeEvent(window, 'resize', this._checkForIntersections, true);
|
||||
removeEvent(document, 'scroll', this._checkForIntersections, true);
|
||||
|
||||
if (this._domObserver) {
|
||||
this._domObserver.disconnect();
|
||||
this._domObserver = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Scans each observation target for intersection changes and adds them
|
||||
* to the internal entries queue. If new entries are found, it
|
||||
* schedules the callback to be invoked.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._checkForIntersections = function() {
|
||||
var rootIsInDom = this._rootIsInDom();
|
||||
var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect();
|
||||
|
||||
this._observationTargets.forEach(function(item) {
|
||||
var target = item.element;
|
||||
var targetRect = getBoundingClientRect(target);
|
||||
var rootContainsTarget = this._rootContainsTarget(target);
|
||||
var oldEntry = item.entry;
|
||||
var intersectionRect = rootIsInDom && rootContainsTarget &&
|
||||
this._computeTargetAndRootIntersection(target, rootRect);
|
||||
|
||||
var newEntry = item.entry = new IntersectionObserverEntry({
|
||||
time: now(),
|
||||
target: target,
|
||||
boundingClientRect: targetRect,
|
||||
rootBounds: rootRect,
|
||||
intersectionRect: intersectionRect
|
||||
});
|
||||
|
||||
if (!oldEntry) {
|
||||
this._queuedEntries.push(newEntry);
|
||||
} else if (rootIsInDom && rootContainsTarget) {
|
||||
// If the new entry intersection ratio has crossed any of the
|
||||
// thresholds, add a new entry.
|
||||
if (this._hasCrossedThreshold(oldEntry, newEntry)) {
|
||||
this._queuedEntries.push(newEntry);
|
||||
}
|
||||
} else {
|
||||
// If the root is not in the DOM or target is not contained within
|
||||
// root but the previous entry for this target had an intersection,
|
||||
// add a new record indicating removal.
|
||||
if (oldEntry && oldEntry.isIntersecting) {
|
||||
this._queuedEntries.push(newEntry);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (this._queuedEntries.length) {
|
||||
this._callback(this.takeRecords(), this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accepts a target and root rect computes the intersection between then
|
||||
* following the algorithm in the spec.
|
||||
* TODO(philipwalton): at this time clip-path is not considered.
|
||||
* https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo
|
||||
* @param {Element} target The target DOM element
|
||||
* @param {Object} rootRect The bounding rect of the root after being
|
||||
* expanded by the rootMargin value.
|
||||
* @return {?Object} The final intersection rect object or undefined if no
|
||||
* intersection is found.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._computeTargetAndRootIntersection =
|
||||
function(target, rootRect) {
|
||||
|
||||
// If the element isn't displayed, an intersection can't happen.
|
||||
if (window.getComputedStyle(target).display == 'none') return;
|
||||
|
||||
var targetRect = getBoundingClientRect(target);
|
||||
var intersectionRect = targetRect;
|
||||
var parent = getParentNode(target);
|
||||
var atRoot = false;
|
||||
|
||||
while (!atRoot) {
|
||||
var parentRect = null;
|
||||
var parentComputedStyle = parent.nodeType == 1 ?
|
||||
window.getComputedStyle(parent) : {};
|
||||
|
||||
// If the parent isn't displayed, an intersection can't happen.
|
||||
if (parentComputedStyle.display == 'none') return;
|
||||
|
||||
if (parent == this.root || parent == document) {
|
||||
atRoot = true;
|
||||
parentRect = rootRect;
|
||||
} else {
|
||||
// If the element has a non-visible overflow, and it's not the <body>
|
||||
// or <html> element, update the intersection rect.
|
||||
// Note: <body> and <html> cannot be clipped to a rect that's not also
|
||||
// the document rect, so no need to compute a new intersection.
|
||||
if (parent != document.body &&
|
||||
parent != document.documentElement &&
|
||||
parentComputedStyle.overflow != 'visible') {
|
||||
parentRect = getBoundingClientRect(parent);
|
||||
}
|
||||
}
|
||||
|
||||
// If either of the above conditionals set a new parentRect,
|
||||
// calculate new intersection data.
|
||||
if (parentRect) {
|
||||
intersectionRect = computeRectIntersection(parentRect, intersectionRect);
|
||||
|
||||
if (!intersectionRect) break;
|
||||
}
|
||||
parent = getParentNode(parent);
|
||||
}
|
||||
return intersectionRect;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the root rect after being expanded by the rootMargin value.
|
||||
* @return {Object} The expanded root rect.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._getRootRect = function() {
|
||||
var rootRect;
|
||||
if (this.root) {
|
||||
rootRect = getBoundingClientRect(this.root);
|
||||
} else {
|
||||
// Use <html>/<body> instead of window since scroll bars affect size.
|
||||
var html = document.documentElement;
|
||||
var body = document.body;
|
||||
rootRect = {
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: html.clientWidth || body.clientWidth,
|
||||
width: html.clientWidth || body.clientWidth,
|
||||
bottom: html.clientHeight || body.clientHeight,
|
||||
height: html.clientHeight || body.clientHeight
|
||||
};
|
||||
}
|
||||
return this._expandRectByRootMargin(rootRect);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accepts a rect and expands it by the rootMargin value.
|
||||
* @param {Object} rect The rect object to expand.
|
||||
* @return {Object} The expanded rect.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._expandRectByRootMargin = function(rect) {
|
||||
var margins = this._rootMarginValues.map(function(margin, i) {
|
||||
return margin.unit == 'px' ? margin.value :
|
||||
margin.value * (i % 2 ? rect.width : rect.height) / 100;
|
||||
});
|
||||
var newRect = {
|
||||
top: rect.top - margins[0],
|
||||
right: rect.right + margins[1],
|
||||
bottom: rect.bottom + margins[2],
|
||||
left: rect.left - margins[3]
|
||||
};
|
||||
newRect.width = newRect.right - newRect.left;
|
||||
newRect.height = newRect.bottom - newRect.top;
|
||||
|
||||
return newRect;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accepts an old and new entry and returns true if at least one of the
|
||||
* threshold values has been crossed.
|
||||
* @param {?IntersectionObserverEntry} oldEntry The previous entry for a
|
||||
* particular target element or null if no previous entry exists.
|
||||
* @param {IntersectionObserverEntry} newEntry The current entry for a
|
||||
* particular target element.
|
||||
* @return {boolean} Returns true if a any threshold has been crossed.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._hasCrossedThreshold =
|
||||
function(oldEntry, newEntry) {
|
||||
|
||||
// To make comparing easier, an entry that has a ratio of 0
|
||||
// but does not actually intersect is given a value of -1
|
||||
var oldRatio = oldEntry && oldEntry.isIntersecting ?
|
||||
oldEntry.intersectionRatio || 0 : -1;
|
||||
var newRatio = newEntry.isIntersecting ?
|
||||
newEntry.intersectionRatio || 0 : -1;
|
||||
|
||||
// Ignore unchanged ratios
|
||||
if (oldRatio === newRatio) return;
|
||||
|
||||
for (var i = 0; i < this.thresholds.length; i++) {
|
||||
var threshold = this.thresholds[i];
|
||||
|
||||
// Return true if an entry matches a threshold or if the new ratio
|
||||
// and the old ratio are on the opposite sides of a threshold.
|
||||
if (threshold == oldRatio || threshold == newRatio ||
|
||||
threshold < oldRatio !== threshold < newRatio) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the root element is an element and is in the DOM.
|
||||
* @return {boolean} True if the root element is an element and is in the DOM.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._rootIsInDom = function() {
|
||||
return !this.root || containsDeep(document, this.root);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the target element is a child of root.
|
||||
* @param {Element} target The target element to check.
|
||||
* @return {boolean} True if the target element is a child of root.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._rootContainsTarget = function(target) {
|
||||
return containsDeep(this.root || document, target);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Adds the instance to the global IntersectionObserver registry if it isn't
|
||||
* already present.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._registerInstance = function() {
|
||||
if (registry.indexOf(this) < 0) {
|
||||
registry.push(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes the instance from the global IntersectionObserver registry.
|
||||
* @private
|
||||
*/
|
||||
IntersectionObserver.prototype._unregisterInstance = function() {
|
||||
var index = registry.indexOf(this);
|
||||
if (index != -1) registry.splice(index, 1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result of the performance.now() method or null in browsers
|
||||
* that don't support the API.
|
||||
* @return {number} The elapsed time since the page was requested.
|
||||
*/
|
||||
function now() {
|
||||
return window.performance && performance.now && performance.now();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Throttles a function and delays its execution, so it's only called at most
|
||||
* once within a given time period.
|
||||
* @param {Function} fn The function to throttle.
|
||||
* @param {number} timeout The amount of time that must pass before the
|
||||
* function can be called again.
|
||||
* @return {Function} The throttled function.
|
||||
*/
|
||||
function throttle(fn, timeout) {
|
||||
var timer = null;
|
||||
return function () {
|
||||
if (!timer) {
|
||||
timer = setTimeout(function() {
|
||||
fn();
|
||||
timer = null;
|
||||
}, timeout);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds an event handler to a DOM node ensuring cross-browser compatibility.
|
||||
* @param {Node} node The DOM node to add the event handler to.
|
||||
* @param {string} event The event name.
|
||||
* @param {Function} fn The event handler to add.
|
||||
* @param {boolean} opt_useCapture Optionally adds the even to the capture
|
||||
* phase. Note: this only works in modern browsers.
|
||||
*/
|
||||
function addEvent(node, event, fn, opt_useCapture) {
|
||||
if (typeof node.addEventListener == 'function') {
|
||||
node.addEventListener(event, fn, opt_useCapture || false);
|
||||
}
|
||||
else if (typeof node.attachEvent == 'function') {
|
||||
node.attachEvent('on' + event, fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a previously added event handler from a DOM node.
|
||||
* @param {Node} node The DOM node to remove the event handler from.
|
||||
* @param {string} event The event name.
|
||||
* @param {Function} fn The event handler to remove.
|
||||
* @param {boolean} opt_useCapture If the event handler was added with this
|
||||
* flag set to true, it should be set to true here in order to remove it.
|
||||
*/
|
||||
function removeEvent(node, event, fn, opt_useCapture) {
|
||||
if (typeof node.removeEventListener == 'function') {
|
||||
node.removeEventListener(event, fn, opt_useCapture || false);
|
||||
}
|
||||
else if (typeof node.detatchEvent == 'function') {
|
||||
node.detatchEvent('on' + event, fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the intersection between two rect objects.
|
||||
* @param {Object} rect1 The first rect.
|
||||
* @param {Object} rect2 The second rect.
|
||||
* @return {?Object} The intersection rect or undefined if no intersection
|
||||
* is found.
|
||||
*/
|
||||
function computeRectIntersection(rect1, rect2) {
|
||||
var top = Math.max(rect1.top, rect2.top);
|
||||
var bottom = Math.min(rect1.bottom, rect2.bottom);
|
||||
var left = Math.max(rect1.left, rect2.left);
|
||||
var right = Math.min(rect1.right, rect2.right);
|
||||
var width = right - left;
|
||||
var height = bottom - top;
|
||||
|
||||
return (width >= 0 && height >= 0) && {
|
||||
top: top,
|
||||
bottom: bottom,
|
||||
left: left,
|
||||
right: right,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shims the native getBoundingClientRect for compatibility with older IE.
|
||||
* @param {Element} el The element whose bounding rect to get.
|
||||
* @return {Object} The (possibly shimmed) rect of the element.
|
||||
*/
|
||||
function getBoundingClientRect(el) {
|
||||
var rect;
|
||||
|
||||
try {
|
||||
rect = el.getBoundingClientRect();
|
||||
} catch (err) {
|
||||
// Ignore Windows 7 IE11 "Unspecified error"
|
||||
// https://github.com/w3c/IntersectionObserver/pull/205
|
||||
}
|
||||
|
||||
if (!rect) return getEmptyRect();
|
||||
|
||||
// Older IE
|
||||
if (!(rect.width && rect.height)) {
|
||||
rect = {
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
width: rect.right - rect.left,
|
||||
height: rect.bottom - rect.top
|
||||
};
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an empty rect object. An empty rect is returned when an element
|
||||
* is not in the DOM.
|
||||
* @return {Object} The empty rect.
|
||||
*/
|
||||
function getEmptyRect() {
|
||||
return {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a parent element contains a child element (including inside
|
||||
* shadow DOM).
|
||||
* @param {Node} parent The parent element.
|
||||
* @param {Node} child The child element.
|
||||
* @return {boolean} True if the parent node contains the child node.
|
||||
*/
|
||||
function containsDeep(parent, child) {
|
||||
var node = child;
|
||||
while (node) {
|
||||
if (node == parent) return true;
|
||||
|
||||
node = getParentNode(node);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the parent node of an element or its host element if the parent node
|
||||
* is a shadow root.
|
||||
* @param {Node} node The node whose parent to get.
|
||||
* @return {Node|null} The parent node or null if no parent exists.
|
||||
*/
|
||||
function getParentNode(node) {
|
||||
var parent = node.parentNode;
|
||||
|
||||
if (parent && parent.nodeType == 11 && parent.host) {
|
||||
// If the parent is a shadow root, return the host element.
|
||||
return parent.host;
|
||||
}
|
||||
|
||||
if (parent && parent.assignedSlot) {
|
||||
// If the parent is distributed in a <slot>, return the parent of a slot.
|
||||
return parent.assignedSlot.parentNode;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
// Exposes the constructors globally.
|
||||
window.IntersectionObserver = IntersectionObserver;
|
||||
window.IntersectionObserverEntry = IntersectionObserverEntry;
|
||||
|
||||
}());
|
||||
7
modules/higallery/views/js/imagesloaded.pkgd.min.js
vendored
Normal file
27
modules/higallery/views/js/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
1860
modules/higallery/views/js/jquery.magnific-popup.js
Normal file
4
modules/higallery/views/js/jquery.magnific-popup.min.js
vendored
Normal file
9
modules/higallery/views/js/masonry.pkgd.min.js
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
{**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*}
|
||||
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="script"}
|
||||
var ps_force_friendly_product = false;
|
||||
{/block}
|
||||
{block name="input" prepend}
|
||||
<script type="text/javascript">
|
||||
var PS_ALLOW_ACCENTED_CHARS_URL;
|
||||
{if isset($PS_ALLOW_ACCENTED_CHARS_URL) && $PS_ALLOW_ACCENTED_CHARS_URL}
|
||||
PS_ALLOW_ACCENTED_CHARS_URL = 1;
|
||||
{else}
|
||||
PS_ALLOW_ACCENTED_CHARS_URL = 0;
|
||||
{/if}
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
{if $input.type == 'file_multiple'}
|
||||
<div class="col-lg-8 {$input.class|escape:'htmlall':'UTF-8'}">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<input id="{$input.name|escape:'htmlall':'UTF-8'}" type="file" data-url="{$gallery_controller_url|escape:'html':'UTF-8'}" multiple="multiple" style="width:0px;height:0px;" />
|
||||
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}-add-button">
|
||||
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files...' mod='higallery'}{else}{l s='Add file...' mod='higallery'}{/if}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="well" style="display:none">
|
||||
<div id="{$input.name|escape:'htmlall':'UTF-8'}-files-list"></div>
|
||||
<button class="ladda-button btn btn-primary" data-style="expand-right" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}-upload-button" style="display:none;">
|
||||
<span class="ladda-label"><i class="icon-check"></i>{l s='Upload files' mod='higallery'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function humanizeSize(bytes)
|
||||
{
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
{if isset($multiple) && isset($max_files)}
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_max_files = {$max_files - $files|count};
|
||||
{/if}
|
||||
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_upload_button = Ladda.create(document.querySelector('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button'));
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_total_files = 0;
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}').fileupload({
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
autoUpload: false,
|
||||
singleFileUploads: true,
|
||||
{if isset($post_max_size)}maxFileSize: {$post_max_size},{/if}
|
||||
{if isset($drop_zone)}dropZone: {$drop_zone},{/if}
|
||||
start: function (e) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_upload_button.start();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').unbind('click'); //Important as we bind it for every elements in add function
|
||||
},
|
||||
fail: function (e, data) {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-errors').html(data.errorThrown.message).parent().show();
|
||||
},
|
||||
done: function (e, data) {
|
||||
if (data.result.error) {
|
||||
showErrorMessage(data.result.error);
|
||||
} else {
|
||||
showSuccessMessage('Successful upload');
|
||||
$('.gallery-image-container').remove();
|
||||
$('.gallery_image_form').replaceWith(data.result.content);
|
||||
initSortableItems();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').html('').parent().hide();
|
||||
}
|
||||
},
|
||||
}).on('fileuploadalways', function (e, data) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files--;
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_max_files--;
|
||||
|
||||
if ({$input.name|escape:'htmlall':'UTF-8'}_total_files == 0) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_upload_button.stop();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').unbind('click');
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().hide();
|
||||
}
|
||||
}).on('fileuploadadd', function(e, data) {
|
||||
data.context = $('<div/>').addClass('form-group').appendTo($('#{$input.name|escape:'htmlall':'UTF-8'}-files-list'));
|
||||
var file_name = $('<span/>').append('<strong>'+data.files[0].name+'</strong> ('+humanizeSize(data.files[0].size)+')').appendTo(data.context);
|
||||
|
||||
var button = $('<button/>').addClass('btn btn-default pull-right').prop('type', 'button').html('<i class="icon-trash"></i> Remove file').appendTo(data.context).on('click', function() {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files--;
|
||||
data.files = null;
|
||||
|
||||
var total_elements = $(this).parent().siblings('div.form-group').length;
|
||||
$(this).parent().remove();
|
||||
|
||||
if (total_elements == 0) {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').html('').parent().hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().show();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').show().bind('click', function () {
|
||||
if (data.files != null)
|
||||
data.submit();
|
||||
});
|
||||
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files++;
|
||||
}).on('fileuploadprocessalways', function (e, data) {});
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().hide();
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files = 0;
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-add-button').on('click', function() {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}').trigger('click');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{elseif $input.type == 'button'}
|
||||
<div class="col-lg-8 {$input.class|escape:'htmlall':'UTF-8'}">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<button class="btn btn-default" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}">
|
||||
<i class="icon-instagram"></i> {$input.title|escape:'htmlall':'UTF-8'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||