feat: Add YouTube video support and update admin templates

- Introduced a new YouTube tech integration in `youtube.min.js` for enhanced video playback.
- Created new admin template files for managing video settings, including `index.php` and `steasyvideo-pro.tpl`.
- Updated hook templates (`device_mode.tpl`, `forquickview.tpl`, `header.tpl`, `miniature.tpl`, `miniature_tb.tpl`, and predefined templates) to include video functionality.
- Implemented caching headers in several PHP files to improve performance.
- Ensured all new templates include proper licensing information and copyright notices.
This commit is contained in:
2025-05-23 19:27:41 +02:00
parent d485f46a7a
commit eacf500d18
83 changed files with 12143 additions and 3 deletions

View File

@@ -0,0 +1,215 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
jQuery(function($){
$('.st_delete_image').click(function(){
var self = $(this);
var id = self.data('id');
$.getJSON(currentIndex+'&token='+token+'&configure=steasyvideo&id_st_easy_video='+id+'&act=delete_image&ts='+new Date().getTime(),
function(json){
if(json.r) {
self.closest('.form-group').remove();
}
else
alert('Error');
}
);
return false;
});
$(document).on('change', '#st_easy_video_form #url', function(){
var regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/;
var match = $(this).val().match(regExp);
if (match && match[1].length == 11)
$('#youtube_thumbnail').html('<img src="//img.youtube.com/vi/'+match[1]+'/default.jpg">');
else
$('#youtube_thumbnail').empty();
});
if($('#st_easy_video_form #url').val())
$('#st_easy_video_form #url').trigger('change');
/*handle_contr($('[name="contr"]').val());
$(document).on('change', '[name="contr"]', function(){
handle_contr($(this).val());
});*/
$(document).on('click', '.st_ac_del_product', function(){
$(this).closest('li').remove();
var $ac = $(this).closest('.form-group').find('.ac_products');
if(!$ac.hasClass('ac_input'))
steasyvideoo_admin.ac($ac);
$ac.setOptions({
extraParams: {
excludeIds : getProductExcIds($(this).closest('.form-group').find('.curr_products'))
}
});
});
$(document).on('focus', '.ac_products', function(){
if(!$(this).hasClass('ac_input'))
steasyvideoo_admin.ac($(this));
});
$(document).on('click', '.stsb_ac_del_product', function(){
$(this).closest('li').remove();
var $ac = $(this).closest('.form-group').find('.ac_products');
if(!$ac.hasClass('ac_input'))
steasyvideoo_admin.ac($ac, 'product');
$ac.setOptions({
extraParams: {
excludeIds : getProductExcIds($(this).closest('.form-group').find('.curr_product'))
}
});
});
$(document).on('change', 'input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"], input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]', function(){
steasyvideoo_admin.miniature_form();
});
steasyvideoo_admin.miniature_form();
$(document).on('change', 'input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"], input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"], input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]', function(){
steasyvideoo_admin.gallery_form();
});
steasyvideoo_admin.gallery_form();
$(document).on('change', 'input[name="ST_EASY_VIDEO_MINIATURE_PLAY_BTN_POSITION"]', function(){
steasyvideoo_admin.btn_position('MINIATURE');
});
$(document).on('change', 'input[name="ST_EASY_VIDEO_GALLERY_PLAY_BTN_POSITION"]', function(){
steasyvideoo_admin.btn_position('GALLERY');
});
steasyvideoo_admin.btn_position('MINIATURE');
steasyvideoo_admin.btn_position('GALLERY');
});
var steasyvideoo_admin = {
'ac': function($that) {
var $cp = $that.closest('.form-group').find('.curr_products');
$that.autocomplete(currentIndex+'&token='+token+'&ajax_product_list&disableCombination=true', {
minChars: 1,
autoFill: true,
max:200,
matchContains: true,
mustMatch:true,
scroll:true,
cacheLength:0,
extraParams:{ excludeIds:getProductExcIds($cp)},
formatItem: function(item) {
if (item.length == 2) {
return item[1]+' - '+item[0];
} else {
return '--';
}
}
}).result(function(event, data, formatted) {
if (data == null || data.length != 2)
return false;
var id = data[1];
var name = data[0];
$cp.append('<li>'+name+'<a href="javascript:;" class="stsb_ac_del_product"><img src="../img/admin/delete.gif" /></a><input type="hidden" name="st_id_product[]" value="'+id+'" /></li>');
$that.setOptions({
extraParams: {
excludeIds : getProductExcIds($cp)
}
});
});
},
'miniature_form': function(){
var value = 0, device=0;
if($('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"]:checked').length){
value = $('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"]:checked').val();
device = 'DESKTOP';
}else if($('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]:checked').length){
value = $('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]:checked').val();
device = 'MOBILE';
}
$('input[name="ST_EASY_VIDEO_MINIATURE_VIDEO_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_MINIATURE_VIDEO_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_VIDEO_POSITION_'+device+'"]').parents('.form-group').toggle(value=='2' || value=='1' || value=='3' || value=='4');
$('input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_MINIATURE_BUTTON_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_POSITION_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_LAYOUT_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_HIDE_'+device+'"]').parents('.form-group').toggle(value=='1' || value=='4');
if(device=='DESKTOP')
$('input[name="ST_EASY_VIDEO_MINIATURE_HOVER_ELEMENT"]').parents('.form-group').toggle(value=='3' || value=='4');
return true;
},
'btn_position': function(type){
$('input[name="ST_EASY_VIDEO_'+type+'_PLAY_BTN_OFFSET"]').parents('.form-group').toggle($('input[name="ST_EASY_VIDEO_'+type+'_PLAY_BTN_POSITION"]:checked').val()!='0');
},
'gallery_form': function(){
var groups = [];
var display = 0, device=0;
if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"]:checked').length){
display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"]:checked').val();
device = 'DESKTOP';
}else if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"]:checked').length){
display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"]:checked').val();
device = 'MOBILE';
}else if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]:checked').length){
display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]:checked').val();
device = 'QUICKVIEW';
}
if(display==1)
groups.push('button', 'video', 'thumbnail', 'close');
else if(display==2)
groups.push('video');
else if(display==3)
groups.push('gallery');
else if(display==4)
groups.push('video', 'thumbnail', 'close');
else if(display==5)
groups.push('gallery', 'thumbnail');
else if(display==6)
groups.push('video', 'thumbnail');
else if(display==7)
groups.push('button', 'video', 'gallery', 'thumbnail');
$('input[name="ST_EASY_VIDEO_GALLERY_VIDEO_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_GALLERY_VIDEO_APPEND_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_VIDEO_POSITION_'+device+'"]').parents('.form-group').toggle(groups.includes('video'));
$('input[name="ST_EASY_VIDEO_GALLERY_BUTTON_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_GALLERY_BUTTON_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_POSITION_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_LAYOUT_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_HIDE_'+device+'"]').parents('.form-group').toggle(groups.includes('button'));
$('input[name="ST_EASY_VIDEO_GALLERY_TYPE_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_SLIDER_SELECTOR_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_SLIDE_SELECTOR_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_SLIDER_APPEND_'+device+'"]').parents('.form-group').toggle(groups.includes('gallery'));
$('input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_TYPE_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_ITEM_SELECTOR_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_SELECTOR_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_SLIDE_SELECTOR_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_APPEND_'+device+'"]').parents('.form-group').toggle(groups.includes('thumbnail'));
$('input[name="ST_EASY_VIDEO_GALLERY_CLOSE_VIDEO_'+device+'"]').parents('.form-group').toggle(groups.includes('close'));
$('textarea[name="ST_EASY_VIDEO_GALLERY_BUTTON_TEMPLATE_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_BUTTON_IMAGE_TYPE_'+device+'"]').parents('.form-group').toggle(groups.includes('button') || groups.includes('thumbnail'));
return true;
},
'buyaosanchu': 1
};
var getProductExcIds = function(dom)
{
var excludeIds = [];
$(dom).find(':hidden[name="st_id_product[]"]').each(function(){
excludeIds.push($(this).val());
});
return excludeIds.join( ',' );
};
function handle_contr(val)
{
var fm = {'category': 'id_category', 'product': 'ac_products', 'manufacturer': 'id_manufacturer'};
$.each(fm, function(k,v){
$('#'+v).closest('.form-group').toggle(k == val);
$('#sub_category_on').closest('.form-group').toggle(k == val && k=='category');
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
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;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long