first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,391 @@
/**
* @copyright Commercial License By LeoTheme.Com
* @email leotheme.com
* @visit http://www.leotheme.com
*/
(function($) {
$.fn.PavMegaMenuList = function(opts) {
// default configuration
var config = $.extend({}, {
action:null,
addnew:null,
confirm_del:'Are you sure delete this?',
confirm_duplicate:'Are you sure duplicate this?'
}, opts);
function checkInputHanlder(){
var _updateMenuType = function(){
$(".menu-type-group").parent().parent().hide();
if($("[id^=url_type_]").closest('.form-group').find('.translatable-field').length)
$("[id^=url_type_]").closest('.form-group').parent().parent().hide();
else
$("[id^=url_type_]").closest('.form-group').hide();
if($("[id^=content_text_]").closest('.form-group').hasClass('translatable-field'))
$("[id^=content_text_]").closest('.form-group').parent().parent().hide();
else
$("[id^=content_text_]").closest('.form-group').hide();
if( $("#menu_type").val() =='html' ){
if($("[id^=content_text_]").closest('.form-group').hasClass('translatable-field'))
$("[id^=content_text_]").closest('.form-group').parent().parent().show();
else
$("[id^=content_text_]").closest('.form-group').show();
}else if( $("#menu_type").val() =='url' ){
if($("[id^=url_type_]").closest('.form-group').find('.translatable-field').length)
$("[id^=url_type_]").closest('.form-group').parent().parent().show();
else
$("[id^=url_type_]").closest('.form-group').show();
}
else {
$("#"+$("#menu_type").val()+"_type").parent().parent().show();
if($("#menu_type").val() == 'controller')
$("#"+$("#menu_type").val()+"_type_parameter").parent().parent().show();
}
};
_updateMenuType();
$("#menu_type").change( _updateMenuType );
// var _updateSubmenuType = function(){
// if( $("#type_submenu").val() =='html' ){
// $("[for^=submenu_content_text_]").parent().show();
// }else{
// $("[for^=submenu_content_text_]").parent().hide();
// }
// };
// _updateSubmenuType();
// $("#type_submenu").change( _updateSubmenuType );
}
function manageTreeMenu(){
if($('ol').hasClass("sortable")){
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
startCollapsed: true,
stop: function(){
var serialized = $(this).nestedSortable('serialize');
// console.log(serialized);
$.ajax({
type: 'POST',
url: config.action+"&ajax=1&doupdatepos=1&rand="+Math.random(),
data : serialized+'&updatePosition=1',
dataType: 'json',
cache: false,
}).done( function (json) {
if (json && json.hasError == true){
alert(json.errors);
}else{
showSuccessMessage(json.errors);
}
if ($('#id_btmegamenu').val() != 0)
{
var id_btmegamenu = $('#id_btmegamenu').val();
var id_parent;
// console.log($('#list_'+id_btmegamenu).parent().parent('li'));
if ($('#list_'+id_btmegamenu).parent().parent('li').length)
{
id_parent = $('#list_'+id_btmegamenu).parent().parent('li').data('id-menu');
}
else
{
id_parent = 0;
};
$('#id_parent').find('option[selected=selected]').removeAttr("selected");
$('#id_parent').find('option[value='+id_parent+']').attr('selected','selected');
}
});
}
});
$('#addcategory').click(function(){
location.href=config.addnew;
});
}
$('.show_cavas').change(function(){
var show_cavas = $(this).val();
//var text = $(this).val();
//var $this = $(this);
//$(this).val( $(this).data('loading-text') );
$.ajax({
type: 'POST',
url: config.action+"&show_cavas=1&rand="+Math.random(),
data : 'show='+show_cavas+'&updatecavas=1'
}).done( function (msg) {
//$this.val( msg );
showSuccessMessage(msg);
});
});
}
/**
* initialize every element
*/
this.each(function() {
$(".quickedit",this).click( function(){
location.href=config.action+"&id_btmegamenu="+$(this).attr('rel').replace("id_","");
} );
$(".quickdel",this).click( function(){
if( confirm(config.confirm_del) ){
location.href=config.action+"&dodel=1&id_btmegamenu="+$(this).attr('rel').replace("id_","");
}
} );
$(".quickduplicate",this).click( function(){
if( confirm(config.confirm_duplicate) ){
location.href=config.action+"&doduplicate=1&id_btmegamenu="+$(this).attr('rel').replace("id_","");
}
} );
manageTreeMenu();
checkInputHanlder();
});
return this;
};
})(jQuery);
jQuery(document).ready(function(){
$("#widgetds a.btn").fancybox( {'type':'iframe'} );
$(".leo-modal-action, #widgets a.btn").fancybox({
'type':'iframe',
'width':950,
'height':500,
beforeLoad:function(){
$('.inject_widget').empty().append('<option value="">Loading...</option>').attr('disabled', 'disabled');;
},
afterLoad:function(){
hideSomeElement();
$('.fancybox-iframe').load( hideSomeElement );
},
afterClose: function (event, ui) {
// location.reload();
// console.log(ui);
if(typeof _action_loadwidget !== 'undefined')
{
$.ajax({
type: 'POST',
url: _action_loadwidget,
}).done( function (result) {
$('.inject_widget').empty().append(result).show().removeAttr('disabled');
$('#btn-inject-widget').show();
// console.log('Load widgets sucessfull');
//$this.val( msg );
//showSuccessMessage(msg);
}
);
}
// console.log(_action_loadwidget);
},
});
$(".leo-col-class input[type=radio]").click(function() {
if (!$(this).hasClass('active'))
{
// classChk = $(this).attr("name").replace("col_", "");
classChk = $(this).data("name");
elementText = $(this).closest('.well').find('.group-class').first();
if ($(elementText).val() != "")
{
var check_class_exists = false;
if ($(".leo-col-class input[type=radio]:checked").length)
{
// console.log($(".leo-col-class input[type=radio]:checked").data("name"));
// console.log($(elementText).val());
$(".leo-col-class input[type=radio]:not(:checked)").each(function(){
// console.log($(this).data("name"));
// console.log($(elementText).val());
var e_val = $(elementText).val();
// $(elementText).val(e_val.replace($(this).data("name"),""));
// console.log($(elementText).val());
// console.log(e_val.indexOf($(this).data("name")));
if (e_val.indexOf($(this).data("name")) != -1) {
$(elementText).val(e_val.replace($(this).data("name"),classChk));
check_class_exists = true;
}
})
}
if (check_class_exists == false)
{
// $(elementText).val($(elementText).val() + " " + classChk);
if ($(elementText).val() != "")
{
$(elementText).val($(elementText).val() + " " + classChk);
}
else
{
$(elementText).val(classChk);
}
}
}
else
{
$(elementText).val(classChk);
}
$(".leo-col-class input.active").removeClass('active');
$(this).addClass('active');
}
// $(elementText).val('');
// $(elementText).val(classChk);
//add
// if ($(this).is(':checked')) {
// if ($(elementText).val().indexOf(classChk) == -1) {
// if ($(elementText).val() != "") {
// $(elementText).val($(elementText).val() + " " + classChk);
// } else {
// $(elementText).val(classChk);
// }
// }
// } else {
//remove
// if ($(elementText).val().indexOf(classChk) != -1) {
// $(elementText).val($(elementText).val().replace(classChk + " ", ""));
// $(elementText).val($(elementText).val().replace(" " + classChk, ""));
// $(elementText).val($(elementText).val().replace(classChk, ""));
// }
// }
});
$(".group-class").change(function() {
elementChk = $(this).closest('.well').find('input[type=checkbox]');
classText = $(this).val();
$(elementChk).each(function() {
classChk = $(this).attr("name").replace("col_", "");
if (classText.indexOf(classChk) != -1) {
if (!$(this).is(':checked'))
$(this).prop("checked", true);
} else {
$(this).prop("checked", false);
}
});
});
$(".group-class").trigger('change');
var _updateGroupType = function(){
// console.log('test');
if( $("#group_type").val() =='horizontal' ){
$("#show_cavas").parent().parent().show();
$("#type_sub").parent().parent().hide();
}else if ( $("#group_type").val() =='vertical' ){
$("#show_cavas").parent().parent().hide();
$("#type_sub").parent().parent().show();
}
};
_updateGroupType();
$("#group_type").change( _updateGroupType );
if($('#megamenu').length)
{
$("html, body").animate({ scrollTop: $('#megamenu').offset().top - 150 }, 2000);
}
//DONGND:: add hook to clear cache
// $('.list_hook').change(function(){
// });
$('.clear_cache').click(function(e){
// console.log('aaa');
// e.stopPropagation();
var hook_name = $('.list_hook').val();
var href_attr = $(this).attr('href')+$('.list_hook').val();
// console.log(href_attr);
$(this).attr('href',href_attr);
// location.reload(href_attr);
// window.location.href(href_attr);
// return false;
})
//DONGND:: update position for group
if($('ol').hasClass("tree-group")){
$('ol.tree-group').nestedSortable({
forcePlaceholderSize: true,
// handle: 'div',
helper: 'clone',
items: 'li.nav-item',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 600,
// tolerance: 'pointer',
// toleranceElement: '> div',
maxLevels: 1,
isTree: false,
expandOnHover: 700,
// startCollapsed: true,
stop: function(){
var serialized = $(this).nestedSortable('serialize');
// console.log(serialized);
$.ajax({
type: 'POST',
url: update_group_position_link+"&ajax=1&doupdategrouppos=1&rand="+Math.random(),
data : serialized+'&updateGroupPosition=1',
dataType: 'json',
cache: false,
}).done( function (json) {
if (json && json.hasError == true){
alert(json.errors);
}else{
showSuccessMessage(json.errors);
}
});
}
});
}
//DONGND:: disable click when editting group
$('.editting').click(function(){
return false;
})
});
var hideSomeElement = function(){
$('body',$('.fancybox-iframe').contents()).find("#header").hide();
$('body',$('.fancybox-iframe').contents()).find("#footer").hide();
$('body',$('.fancybox-iframe').contents()).find(".page-head, #nav-sidebar ").hide();
$('body',$('.fancybox-iframe').contents()).find("#content.bootstrap").css( 'padding',0).css('margin',0);
//DONGND:: remove responsive table
$('body',$('.fancybox-iframe').contents()).find('.table.btmegamenu_widgets').parent().removeClass('table-responsive-row');
};
jQuery(document).ready(function(){
if($("#image-images-thumbnails img").length){
$("#image-images-thumbnails").append('<a class="del-img btn color_danger" href="#"><i class="icon-remove-sign"></i> delete image</a>');
}
$(".del-img").click(function(){
if (confirm('Are you sure to delete this image?')) {
$(this).parent().parent().html('<input type="hidden" value="1" name="delete_icon"/>');
}
return false;
});
$(".leobootstrapmenu td").attr('onclick','').unbind('click');
});

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 13573 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

View File

@@ -0,0 +1,15 @@
.jscom, .mix htcom { color: #4040c2; }
.com { color: green; }
.regexp { color: maroon; }
.string { color: teal; }
.keywords { color: blue; }
.global { color: #008; }
.numbers { color: #880; }
.comm { color: green; }
.tag { color: blue; }
.entity { color: blue; }
.string { color: teal; }
.aname { color: maroon; }
.avalue { color: maroon; }
.jquery { color: #00a; }
.plugin { color: red; }

View File

@@ -0,0 +1,47 @@
/**********************************
Name: cmxform Styles
***********************************/
form.cmxform {
width: 370px;
font-size: 1.0em;
color: #333;
}
form.cmxform legend {
padding-left: 0;
}
form.cmxform legend, form.cmxform label {
color: #333;
}
form.cmxform fieldset {
border: none;
border-top: 1px solid #C9DCA6;
background: url(../images/cmxform-fieldset.gif) left bottom repeat-x;
background-color: #F8FDEF;
}
form.cmxform fieldset fieldset {
background: none;
}
form.cmxform fieldset p, form.cmxform fieldset fieldset {
padding: 5px 10px 7px;
background: url(../images/cmxform-divider.gif) left bottom repeat-x;
}
form.cmxform label.error, label.error {
/* remove the next line when you have trouble in IE6 with labels in list */
color: red;
font-style: italic;
font-weight: normal;
}
div.error { display: none; }
input { border: 1px solid black; }
input.checkbox { border: none }
input:focus { border: 1px dotted black; }
input.error { border: 1px dotted red; }
form.cmxform .gray * { color: gray; }

View File

@@ -0,0 +1,55 @@
/**********************************
Use: cmxform template
***********************************/
form.cmxform fieldset {
margin-bottom: 10px;
}
form.cmxform legend {
padding: 0 2px;
font-weight: bold;
_margin: 0 -7px; /* IE Win */
}
form.cmxform label {
display: inline-block;
line-height: 1.8;
vertical-align: top;
cursor: hand;
}
form.cmxform fieldset p {
list-style: none;
padding: 5px;
margin: 0;
}
form.cmxform fieldset fieldset {
border: none;
margin: 3px 0 0;
}
form.cmxform fieldset fieldset legend {
padding: 0 0 5px;
font-weight: normal;
}
form.cmxform fieldset fieldset label {
display: block;
width: auto;
}
form.cmxform label { width: 100px; } /* Width of labels */
form.cmxform fieldset fieldset label { margin-left: 103px; } /* Width plus 3 (html space) */
form.cmxform label.error {
margin-left: 103px;
width: 220px;
}
form.cmxform input.submit {
margin-left: 103px;
}
/*\*//*/ form.cmxform legend { display: inline-block; } /* IE Mac legend fix */

View File

@@ -0,0 +1,21 @@
body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
body { margin: 0; padding: 0; font-size: small; color: #333 }
h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
h1 { font-size: large }
#main { padding: 1em; }
#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
background: url(../images/bg.gif) repeat-x; text-align: center }
#banner a { color: white; }
p { margin: 10px 0; }
li { margin-left: 10px; }
h3 { margin: 1em 0 0; }
h1 { font-size: 2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.6em; }
h4 { font-size: 1.4em; }
h5 { font-size: 1.2em; }

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2014 PrestaShop
*
* 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.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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 it is too large Load Diff

View File

@@ -0,0 +1,51 @@
/**
* jQuery Validation Plugin 1.9.0
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
*
* Copyright (c) 2006 - 2011 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/,
"");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=
this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",
a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=
a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?
this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==
0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+
a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a]},defaultMessage:function(a,
b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=
d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);
if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=
this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,
e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};
var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?
e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;
return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,
b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,
mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,
b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);

View File

@@ -0,0 +1,61 @@
/**********************************
Use: Reset Styles for all browsers
***********************************/
body, p, blockquote {
margin: 0;
padding: 0;
}
a img, iframe { border: none; }
/* Headers
------------------------------*/
h1, h2, h3, h4, h5, h6 {
margin: 0;
padding: 0;
font-size: 100%;
}
/* Lists
------------------------------*/
ul, ol, dl, li, dt, dd {
margin: 0;
padding: 0;
}
/* Links
------------------------------*/
a, a:link {}
a:visited {}
a:hover {}
a:active {}
/* Forms
------------------------------*/
form, fieldset {
margin: 0;
padding: 0;
}
fieldset { border: 1px solid #000; }
legend {
padding: 0;
color: #000;
}
input, textarea, select {
margin: 0;
padding: 1px;
font-size: 100%;
font-family: inherit;
}
select { padding: 0; }

View File

@@ -0,0 +1,11 @@
/**********************************
Use: Main Screen Import
***********************************/
@import "reset.css";
/*@import "core.css";*/
@import "cmxformTemplate.css";
@import "cmxform.css";

View File

@@ -0,0 +1,11 @@
/**********************************
Use: Main Screen Import
***********************************/
@import "reset.css";
@import "core.css";
@import "cmxformTemplate.css";
@import "cmxform.css";

View File

@@ -0,0 +1,429 @@
/*
* jQuery UI Nested Sortable
* v 1.3.5 / 21 jun 2012
* http://mjsarfatti.com/code/nestedSortable
*
* Depends on:
* jquery.ui.sortable.js 1.8+
*
* Copyright (c) 2010-2012 Manuele J Sarfatti
* Licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
options: {
tabSize: 20,
disableNesting: 'mjs-nestedSortable-no-nesting',
errorClass: 'mjs-nestedSortable-error',
doNotClear: false,
listType: 'ol',
maxLevels: 0,
protectRoot: false,
rootID: null,
rtl: false,
isAllowed: function(item, parent) { return true; }
},
_create: function() {
this.element.data('sortable', this.element.data('nestedSortable'));
if (!this.element.is(this.options.listType))
throw new Error('nestedSortable: Please check the listType option is set to your actual list type');
return $.ui.sortable.prototype._create.apply(this, arguments);
},
destroy: function() {
this.element
.removeData("nestedSortable")
.unbind(".nestedSortable");
return $.ui.sortable.prototype.destroy.apply(this, arguments);
},
_mouseDrag: function(event) {
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
if (!this.lastPositionAbs) {
this.lastPositionAbs = this.positionAbs;
}
var o = this.options;
//Do scrolling
if(this.options.scroll) {
var scrolled = false;
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
} else {
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
}
//Regenerate the absolute position used for position checks
this.positionAbs = this._convertPositionTo("absolute");
// Find the top offset before rearrangement,
var previousTopOffset = this.placeholder.offset().top;
//Set the helper position
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
//Rearrange
for (var i = this.items.length - 1; i >= 0; i--) {
//Cache variables and intersection, continue if no intersection
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
if (!intersection) continue;
if(itemElement != this.currentItem[0] //cannot intersect with itself
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
) {
$(itemElement).mouseenter();
this.direction = intersection == 1 ? "down" : "up";
if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
$(itemElement).mouseleave();
this._rearrange(event, item);
} else {
break;
}
// Clear emtpy ul's/ol's
this._clearEmpty(itemElement);
this._trigger("change", event, this._uiHash());
break;
}
}
var parentItem = (this.placeholder[0].parentNode.parentNode &&
$(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
? $(this.placeholder[0].parentNode.parentNode)
: null,
level = this._getLevel(this.placeholder),
childLevels = this._getChildLevels(this.helper);
// To find the previous sibling in the list, keep backtracking until we hit a valid list item.
var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
if (previousItem != null) {
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
if (previousItem[0].previousSibling) {
previousItem = $(previousItem[0].previousSibling);
} else {
previousItem = null;
break;
}
}
}
// To find the next sibling in the list, keep stepping forward until we hit a valid list item.
var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
if (nextItem != null) {
while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
if (nextItem[0].nextSibling) {
nextItem = $(nextItem[0].nextSibling);
} else {
nextItem = null;
break;
}
}
}
var newList = document.createElement(o.listType);
this.beyondMaxLevels = 0;
// If the item is moved to the left, send it to its parent's level unless there are siblings below it.
if (parentItem != null && nextItem == null &&
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
!o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
parentItem.after(this.placeholder[0]);
this._clearEmpty(parentItem[0]);
this._trigger("change", event, this._uiHash());
}
// If the item is below a sibling and is moved to the right, make it a child of that sibling.
else if (previousItem != null &&
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) ||
!o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) {
this._isAllowed(previousItem, level, level+childLevels+1);
if (!previousItem.children(o.listType).length) {
previousItem[0].appendChild(newList);
}
// If this item is being moved from the top, add it to the top of the list.
if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
previousItem.children(o.listType).prepend(this.placeholder);
}
// Otherwise, add it to the bottom of the list.
else {
previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
}
this._trigger("change", event, this._uiHash());
}
else {
this._isAllowed(parentItem, level, level+childLevels);
}
//Post events to containers
this._contactContainers(event);
//Interconnect with droppables
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
//Call callbacks
this._trigger('sort', event, this._uiHash());
this.lastPositionAbs = this.positionAbs;
return false;
},
_mouseStop: function(event, noPropagation) {
// If the item is in a position not allowed, send it back
if (this.beyondMaxLevels) {
this.placeholder.removeClass(this.options.errorClass);
if (this.domPosition.prev) {
$(this.domPosition.prev).after(this.placeholder);
} else {
$(this.domPosition.parent).prepend(this.placeholder);
}
this._trigger("revert", event, this._uiHash());
}
// Clean last empty ul/ol
for (var i = this.items.length - 1; i >= 0; i--) {
var item = this.items[i].item[0];
this._clearEmpty(item);
}
$.ui.sortable.prototype._mouseStop.apply(this, arguments);
},
serialize: function(options) {
var o = $.extend({}, this.options, options),
items = this._getItemsAsjQuery(o && o.connected),
str = [];
$(items).each(function() {
var res = ($(o.item || this).attr(o.attribute || 'id') || '')
.match(o.expression || (/(.+)[-=_](.+)/)),
pid = ($(o.item || this).parent(o.listType)
.parent(o.items)
.attr(o.attribute || 'id') || '')
.match(o.expression || (/(.+)[-=_](.+)/));
if (res) {
str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
+ '='
+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
}
});
if(!str.length && o.key) {
str.push(o.key + '=');
}
return str.join('&');
},
toHierarchy: function(options) {
var o = $.extend({}, this.options, options),
sDepth = o.startDepthCount || 0,
ret = [];
$(this.element).children(o.items).each(function () {
var level = _recursiveItems(this);
ret.push(level);
});
return ret;
function _recursiveItems(item) {
var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
if (id) {
var currentItem = {"id" : id[2]};
if ($(item).children(o.listType).children(o.items).length > 0) {
currentItem.children = [];
$(item).children(o.listType).children(o.items).each(function() {
var level = _recursiveItems(this);
currentItem.children.push(level);
});
}
return currentItem;
}
}
},
toArray: function(options) {
var o = $.extend({}, this.options, options),
sDepth = o.startDepthCount || 0,
ret = [],
left = 2;
ret.push({
"item_id": o.rootID,
"parent_id": 'none',
"depth": sDepth,
"left": '1',
"right": ($(o.items, this.element).length + 1) * 2
});
$(this.element).children(o.items).each(function () {
left = _recursiveArray(this, sDepth + 1, left);
});
ret = ret.sort(function(a,b){ return (a.left - b.left); });
return ret;
function _recursiveArray(item, depth, left) {
var right = left + 1,
id,
pid;
if ($(item).children(o.listType).children(o.items).length > 0) {
depth ++;
$(item).children(o.listType).children(o.items).each(function () {
right = _recursiveArray($(this), depth, right);
});
depth --;
}
id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
if (depth === sDepth + 1) {
pid = o.rootID;
} else {
var parentItem = ($(item).parent(o.listType)
.parent(o.items)
.attr(o.attribute || 'id'))
.match(o.expression || (/(.+)[-=_](.+)/));
pid = parentItem[2];
}
if (id) {
ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
}
left = right + 1;
return left;
}
},
_clearEmpty: function(item) {
var emptyList = $(item).children(this.options.listType);
if (emptyList.length && !emptyList.children().length && !this.options.doNotClear) {
emptyList.remove();
}
},
_getLevel: function(item) {
var level = 1;
if (this.options.listType) {
var list = item.closest(this.options.listType);
while (list && list.length > 0 &&
!list.is('.ui-sortable')) {
level++;
list = list.parent().closest(this.options.listType);
}
}
return level;
},
_getChildLevels: function(parent, depth) {
var self = this,
o = this.options,
result = 0;
depth = depth || 0;
$(parent).children(o.listType).children(o.items).each(function (index, child) {
result = Math.max(self._getChildLevels(child, depth + 1), result);
});
return depth ? result + 1 : result;
},
_isAllowed: function(parentItem, level, levels) {
var o = this.options,
isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false,
maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
// Is the root protected?
// Are we trying to nest under a no-nest?
// Are we nesting too deep?
if (!o.isAllowed(this.currentItem, parentItem) ||
parentItem && parentItem.hasClass(o.disableNesting) ||
o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) {
this.placeholder.addClass(o.errorClass);
if (maxLevels < levels && maxLevels != 0) {
this.beyondMaxLevels = levels - maxLevels;
} else {
this.beyondMaxLevels = 1;
}
} else {
if (maxLevels < levels && maxLevels != 0) {
this.placeholder.addClass(o.errorClass);
this.beyondMaxLevels = levels - maxLevels;
} else {
this.placeholder.removeClass(o.errorClass);
this.beyondMaxLevels = 0;
}
}
}
}));
$.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
})(jQuery);

View File

@@ -0,0 +1,645 @@
/**
* @copyright Commercial License By LeoTheme.Com
* @email leotheme.com
* @visit http://www.leotheme.com
*/
(function($) {
$.fn.PavMegamenuEditor = function(opts) {
// default configuration
var config = $.extend({}, {
lang:null,
opt1: null,
action:null,
action_menu:null,
id_shop:null,
text_warning_select:'Please select One to remove?',
text_confirm_remove:'Are you sure to remove footer row?',
JSON:null
}, opts);
/**
* active menu
*/
var activeMenu = null;
/**
* fill data values for top level menu when clicked menu.
*/
function processMenu( item , _parent, _megamenu ){
$(".form-setting").hide();
$("#menu-form").show();
$.each( $("#menu-form form").serializeArray(), function(i, input ){
var val = '';
if( $(_parent).data( input.name.replace("menu_","")) ){
val = $(_parent).data( input.name.replace("menu_",""));
}
$('[name='+input.name+']',"#menu-form").val( val );
});
}
/**
* fill data values for top level menu when clicked Sub menu.
*/
function processSubMenu( item , _parent, _megamenu ){
var pos = $(item).offset();
$('#submenu-form').css('left',pos.left - 30 );
$('#submenu-form').css('top',pos.top - $('#submenu-form').height() );
$("#submenu-form").show();
$.each( $("#submenu-form form").serializeArray(), function(i, input ){
$('[name='+input.name+']',"#submenu-form").val( $(_parent).data( input.name.replace("submenu_","")) );
} ) ;
}
/**
* menu form handler
*/
function menuForm(){
$("input, select","#menu-form").change( function (){
if( activeMenu ){
if( $(this).hasClass('menu_submenu') ) {
var item = $("a",activeMenu);
if( $(this).val() && $(this).val() == 1 && !$(item).hasClass( 'dropdown-toggle' ) ) {
$(item).addClass( 'dropdown-toggle' );
$(item).attr( 'data-toggle', 'leo-dropdown' );
var div = '<div class="dropdown-sub dropdown-menu"><div class="dropdown-menu-inner"><div class="row active"></div></div></div>';
$(activeMenu).addClass('parent').addClass('dropdown');
$(activeMenu).append( div );
} else {
if($(activeMenu).find(".dropdown-menu").length != 0){
if(!confirm('Remove Sub Menu ?')) return false;
$(".dropdown-menu",activeMenu).remove();
$(".caret",activeMenu).remove();
}
}
$(activeMenu).data('submenu', $(this).val() );
}else if( $(this).hasClass('menu_subwidth') ){
var width = parseInt( $(this).val() );
if( width > 200 ){
$(".dropdown-menu", activeMenu ).width( width );
$(activeMenu).data('subwidth', width );
}
}
else if( $(this).attr('name') == 'submenu_group' ){
if( $(this).val() == 1 ){
$(activeMenu).addClass('mega-group');
$(activeMenu).children(".dropdown-menu").addClass('dropdown-sub dropdown-mega').removeClass('dropdown-menu');
}else {
$(activeMenu).removeClass('mega-group');
$(activeMenu).children(".dropdown-mega").addClass('dropdown-sub dropdown-menu').removeClass('dropdown-mega');
}
$( activeMenu ).data('group', $(this).val() );
}
}
} );
}
/**
* submenu handler.
*/
/**
* listen Events to operator Elements of MegaMenu such as link, colum, row and Process Events of buttons of setting forms.
*/
function listenEvents( $megamenu ){
/**
* Link Action Event Handler.
*/
$('.form-setting').hide();
$( 'a', $megamenu ).click( function(event){
if($(this).hasClass("has-subhtml")){
alert("Can not add widget beacause: this menu have sub menu type is html");
// event.stopPropagation();
return false;
}
if($(this).parent().data("subwith") != 'widget'){
alert("Can not add widget beacause: this menu have sub menu type with none or submenu");
// event.stopPropagation();
// console.log('aaa');
return false;
}
// console.log('test');
var $this = this;
var $parent = $(this).parent();
/* remove all current row and column are actived */
$(".row", $megamenu).removeClass('active');
$(".mega-col", $megamenu).removeClass('active');
// if( $parent.parent().hasClass('megamenu') ){
var pos = $(this).offset();
$('#menu-form').css('left',pos.left - 30 );
$('#menu-form').css('top',pos.top - $('#menu-form').height() );
// }
activeMenu = $parent;
if($parent.data("submenu") != 1){
$(".menu_submenu").val(0);
}
else{
$(".menu_submenu").val(1);
}
if($parent.data("group") != 1){
$(".submenu_group").val(0);
}
else{
$(".submenu_group").val(1);
}
if( activeMenu.data("align") ){
$(".button-alignments button").removeClass("active");
$( '[data-option="'+activeMenu.data("align") +'"]').addClass("active");
}
$(".menu_subwidth").val($parent.data("subwidth"));
if( $parent.hasClass('dropdown-submenu') ){
$( ".dropdown-submenu", $parent.parent() ).removeClass( 'open' );
// console.log('test');
$parent.addClass('open');
processSubMenu( $this, $parent, $megamenu );
}else {
if( $parent.parent().hasClass('megamenu') ){
$("ul.navbar-nav > li" ).removeClass('open');
}
// console.log('test1');
$parent.addClass('open');
processMenu ( $this, $parent, $megamenu );
}
if($(this).hasClass("has-category")){
$(".group-submenu").hide();
}
else{
$(".group-submenu").show();
}
event.stopPropagation();
return false;
});
/**
* Row action Events Handler
*/
$("#menu-form .add-row").click( function(){
var row = $( '<div class="row"></div>' );
var child = $(activeMenu).children('.dropdown-menu').children('.dropdown-menu-inner');
child.append( row );
child.children(".row").removeClass('active');
row.addClass('active');
});
$("#menu-form .remove-row").click( function(){
if( activeMenu ){
var hasMenuType = false;
$(".row.active", activeMenu).children('.mega-col').each( function(){
if( $(this).data('type') == 'menu' ){
hasMenuType = true;
}
});
if( hasMenuType == false ){
$(".row.active", activeMenu).remove();
}else {
alert( 'You can remove Row having Menu Item(s) Inside Columns' );
return true;
}
removeRowActive();
}
});
$($megamenu).delegate( '.row', 'click', function(e){
$(".row",$megamenu).removeClass('active');
$(this).addClass('active');
e.stopPropagation();
});
/**
* Column action Events Handler
*/
$("#menu-form .add-col").click( function(){
if ( activeMenu ){
var num = 6;
var col = $( '<div class="col-sm-'+num+' mega-col active"><div></div></div>' );
$(".mega-col",activeMenu).removeClass('active');
$( ".row.active", activeMenu ).append( col );
col.data( 'colwidth', num );
var cols = $(".dropdown-menu .mega-col", activeMenu ).length;
$(activeMenu).data('cols', cols);
}
} );
$(".remove-col").click( function(){
if( activeMenu ){
if( $(".mega-col.active", activeMenu).data('type') == 'menu' ) {
alert('You could not remove this column having menu item(s)');
return true;
}else {
$(".mega-col.active", activeMenu).remove();
}
}
removeColumnActive();
} );
$($megamenu).delegate( '.mega-col', 'click', function(e){
if($(this).data('widgets')){
var keywidget = $(this).data('widgets').replace("wid-","");
if(keywidget)
$(".inject_widget option").each(
function(){
var value = $(this).val();
if(value && value == keywidget)
$(this).attr('selected', 'selected');
}
);
}
$(".mega-col",$megamenu).removeClass('active');
$(this).addClass('active');
var pos = $(this).offset();
$("#column-form").css({'top':pos.top-$("#column-form").height(), 'left':pos.left}).show();
if( $(this).data('type') != 'menu' ){
$("#widget-form").css({'top':pos.top+$(this).height(), 'left':pos.left}).show();
}else{
$("#widget-form").hide();
}
$(".row",$megamenu).removeClass('active');
$(this).parent().addClass('active');
$.each( $(this).data(), function( i, val ){
$('[name='+i+']','#column-form').val( val );
} );
e.stopPropagation();
} );
/**
* Column Form Action Event Handler
*/
$('input, select', '#column-form').change( function(){
if( activeMenu ) {
var col = $( ".mega-col.active", activeMenu );
if( $(this).hasClass('colwidth') ){
var cls = $(col).attr('class').replace(/col-sm-\d+/,'');
$(col).attr('class', cls + ' col-sm-' + $(this).val() );
$(col).attr('data-colwidth', $(this).val() );
}
$(col).data( $(this).attr('name') ,$(this).val() );
}
} );
$(".form-setting").each( function(){
var $p = $(this);
$(".popover-title span",this).click( function(){
if( $p.attr('id') == 'menu-form' ){
removeMenuActive();
}else if( $p.attr('id') == 'column-form' ){
removeColumnActive();
}else {
$('#widget-form').hide();
}
} );
} );
$( ".form-setting" ).draggable();
/**
* inject widgets
*/
$("#btn-inject-widget").click( function(){
var wid = $('select', $(this).parent() ).val();
if( wid > 0 ){
var col = $( ".mega-col.active", activeMenu );
var a = $(col).data( 'widgets') ;
if( $(col).data( 'widgets') ){
if( $(col).data( 'widgets').indexOf("wid-"+wid ) == -1 ) {
$(col).data( 'widgets', a +"|wid-"+wid );
}
}else {
$(col).data( 'widgets', "wid-"+wid );
}
$(col).children('div').html('<div class="loading">Loading....</div>');
$.ajax({
url: config.action_widget,
data:'widgets='+$(col).data( 'widgets')+'&id_shop='+config.id_shop,
type:'POST',
}).done(function( data ) {
$(col).children('div').html( data );
runEventTabWidget();
});
}else {
alert( 'Please select a widget to inject' );
}
} );
/**
* create new widget
*/
$("#btn-create-widget").click( function(){
$(".leo-modal-action").trigger('click');
});
/**
* unset mega menu setting
*/
$("#unset-data-menu").click( function(){
if( confirm('Are you sure to reset megamenu configuration') ){
$.ajax({
url: config.action,
data: 'doreset=1&id_shop='+config.id_shop,
type:'POST',
}).done(function( data ) {
location.reload();
});
}
return false;
} );
$($megamenu).delegate( '.leo-widget', 'hover', function(){
//$(".row",$megamenu).removeClass('active');
// $(this).addClass('active');
var w = $(this);
var col = $(this).parent().parent();
if( $(this).find('.w-setting').length<= 0 ){
var _s = $('<span class="w-setting"></span>');
$(w).append(_s);
_s.click( function(){
var dws = col.data('widgets')+"|";
var dws = dws.replace( $(w).attr('id')+"|",'' ).replace(/\|$/,'');
col.data('widgets',dws);
$(w).remove();
} );
}
});
$(".button-aligned button").click( function(){
if( activeMenu ){
$(".button-aligned button").removeClass( "active");
$(this).addClass( 'active' );
$(activeMenu).data( 'align', $(this).data("option") );
var cls = $( activeMenu ).attr("class").replace(/aligned-\w+/,"");
$( activeMenu ).attr( 'class', cls );
$( activeMenu ).addClass( $(this).data("option") );
}
} );
}
/**
* remove active status for current row.
*/
function removeRowActive(){
$('#column-form').hide();
$( "#mainmenutop .row.active" ).removeClass('active');
}
/**
* remove column active and hidden column form.
*/
function removeColumnActive(){
$('#column-form').hide();$('#widget-form').hide();
$( "#mainmenutop .mega-col.active" ).removeClass('active');
}
/**
* remove active status for current menu, row and column and hidden all setting forms.
*/
function removeMenuActive(){
$('.form-setting').hide();
$( "#mainmenutop .open" ).removeClass('open');
$( "#mainmenutop .row.active" ).removeClass('active');
$( "#mainmenutop .mega-col.active" ).removeClass('active');
if( activeMenu ) {
activeMenu = null;
}
}
/**
* process saving menu data using ajax request. Data Post is json string
*/
function saveMenuData(){
// var output = new Array();
var output = {};
$("#megamenu-content #mainmenutop li.parent.enablewidget").each( function() {
var data = $(this).data();
var id_menu = data.id;
data.rows = new Array();
//DONGND:: remove id property
delete data.id;
$(this).children('.dropdown-menu').children('div').children('.row').each( function(){
var row = new Object();
row.cols = new Array();
$(this).children(".mega-col" ).each( function(){
row.cols.push( $(this).data() );
} );
data.rows.push(row);
} );
// output.push( data );
output[id_menu] = data;
} );
// console.log(output);
// console.log(JSON.stringify( output ));
// return false;
var j = JSON.stringify( output );
var params = 'params='+j;
$.ajax({
url: config.action_menu,
data:params+'&id_shop='+config.id_shop,
type:'POST',
}).done(function( data ) {
location.reload();
});
}
/**
* Make Ajax request to fill widget content into column
*/
function loadWidgets(){
$("#leo-progress").hide();
var ajaxCols = new Array();
$("#megamenu-content #mainmenutop .mega-col").each( function() {
var col = $(this);
if( $(col).data( 'widgets') && $(col).data("type") != "menu" ){
ajaxCols.push( col );
}
});
var cnt = 0;
if( ajaxCols.length > 0 ){
$("#leo-progress").show();
$("#megamenu-content").hide();
}
var check_end = 0;
$.each( ajaxCols, function (i, col) {
$.ajax({
url: config.action_widget,
data:'widgets='+$(col).data( 'widgets')+'&id_shop='+config.id_shop,
type:'POST',
}).done(function( data ) {
col.children('div').html( data );
cnt++;
$("#leo-progress .progress-bar").css("width", (cnt*100)/ajaxCols.length+"%" );
if( ajaxCols.length == cnt ){
$("#megamenu-content").delay(1000).fadeIn();
$("#leo-progress").delay(1000).fadeOut();
}
$( "a", col ).not(".tab-link").attr( 'href', '#megamenu-content' );
if (check_end === ajaxCols.length-1)
{
runEventTabWidget();
}
check_end++;
});
});
}
/**
* reload menu data using in ajax complete and add healders to process events.
*/
function reloadMegamenu(){
var megamenu = $("#megamenu-content #mainmenutop");
$( "a", megamenu ).attr( 'href', '#' );
$( '[data-toggle="dropdown"]', megamenu ).attr('data-toggle','leo-dropdown');
listenEvents( megamenu );
//submenuForm();
menuForm();
loadWidgets();
}
/**
* initialize every element
*/
this.each(function() {
var megamenu = this;
$("#form-setting").hide();
$.ajax({
url: config.action,
}).done(function( data ) {
$("#megamenu-content").html( data );
reloadMegamenu( );
$("#save-data-menu").click( function(){
saveMenuData();
} );
});
});
return this;
};
})(jQuery);
$(document).ready(function(){
//DONGND:: js for widget image gallery product
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none'
});
//DONGND:: js for widget newsletter
if ( typeof placeholder !== 'undefined')
{
$('#newsletter-input-footer').on({
focus: function() {
if ($(this).val() == placeholder) {
$(this).val('');
}
},
blur: function() {
if ($(this).val() == '') {
$(this).val(placeholder);
}
}
});
$("#newsletter_block_footer form").submit( function(){
if ( $('#newsletter-input-footer').val() == placeholder) {
$("#newsletter_block_footer .alert").removeClass("hide");
return false;
}else {
$("#newsletter_block_footer .alert").addClass("hide");
return true;
}
} );
}
//DONGND:: js for tab html
// if ( typeof list_tab_live_editor !== 'undefined' && list_tab_live_editor.length > 0)
// {
// $.each(list_tab_live_editor,function(key, val){
// $('#tabhtml'+val+' .nav a').click(function (e) {
// e.preventDefault();
// $(this).tab('show');
// })
// });
// }
})
//DONGND:: call event for tab widget at live editor
function runEventTabWidget()
{
if ( typeof list_tab_live_editor !== 'undefined' && list_tab_live_editor.length > 0)
{
$.each(list_tab_live_editor,function(key, val){
$('#tabhtml'+val+' .nav a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
});
}
//DONGND:: js for widget image gallery category
if ( typeof level !== 'undefined' && typeof limit !== 'undefined')
{
$('.widget-category_image ul.level0').each(function(){
$(this).find('ul').removeClass('dropdown-sub dropdown-menu');
});
$(".widget-category_image ul.level0").each(function() {
var check_level = $(this).parents('.widget-category_image').data('level');
var check_limit = $(this).parents('.widget-category_image').data('limit');
//DONGND:: remove .caret by check level
$(this).find("ul.level" + check_level).parent().find('.caret').remove();
//DONGND:: remove ul by check level
$(this).find("ul.level" + check_level + " li").remove();
var element = $(this).find("ul.level" + (check_level - 1) + " li").length;
var count = 0;
if(check_level > 0) {
$(this).find("ul.level" + (check_level - 1) + " >li").each(function(){
count = count + 1;
if(count > check_limit){
$(this).remove();
}
});
}
});
}
}

View File

@@ -0,0 +1,669 @@
/**
* @copyright Commercial License By LeoTheme.Com
* @email leotheme.com
* @visit http://www.leotheme.com
*/
$(document).ready(function(){
$("#pcategories").closest(".form-group").hide();
$("#ptype").closest(".form-group").hide();
$("#pproductids").closest(".form-group").hide();
$("#pmanufacturers").closest(".form-group").hide();
$( "#source option:selected" ).each(function() {
$("#limit").closest(".form-group").hide();
var val = $(this).val();
$("#"+val).closest(".form-group").show(500);
if( val != 'pproductids'){
$("#limit").closest(".form-group").show(500);
}
});
$("#source").change(function(){
$("#pcategories").closest(".form-group").hide();
$("#ptype").closest(".form-group").hide();
$("#pproductids").closest(".form-group").hide();
$("#pmanufacturers").closest(".form-group").hide();
$("#limit").closest(".form-group").hide();
var val = $(this).val();
$("#"+val).closest(".form-group").show(500);
if(val != 'pproductids')
$("#limit").closest(".form-group").show(500);
});
//for imageproduct widget
$("#ip_pcategories").closest(".form-group").hide();
$("#ip_pproductids").closest(".form-group").hide();
$( "#ip_source option:selected" ).each(function() {
var val = $(this).val();
$("#"+val).closest(".form-group").show();
});
$("#ip_source").change(function(){
$("#ip_pcategories").closest(".form-group").hide();
$("#ip_pproductids").closest(".form-group").hide();
var val = $(this).val();
$("#"+val).closest(".form-group").show(500);
});
//done for imageproduct widget
//for category_image widget
//hide checkbox of root node
$("input[type=checkbox]", "#image_cate_tree").first().hide();
var root_id = $("input[type=checkbox]", "#image_cate_tree").first().val();
Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); }
var selected_images = {};
if($("#category_img").val()){
selected_images = JSON.parse($("#category_img").val());
}
$("input[type=checkbox]", "#image_cate_tree").click(function(){
if($(this).is(":checked")){
//find parent category
//all parent category must be not checked
var check = checkParentNodes($(this));
if(!check){
$(this).prop("checked",false);
alert("All parent of this category must be not checked");
}
}else{
$(".list-image-"+$(this).val()).remove();
delete selected_images[$(this).val()];
}
});
$(".list-image a").click(function(){
var selText = $(this).text();
$(this).parents('.btn-group').find('.dropdown-toggle').html(selText+' <span class="caret"></span>');
$(this).parents('.btn-group').find('.dropdown-menu').hide();
if(selText != "none"){
cate_id = $(this).parents('.btn-group').find('.dropdown-toggle').closest("li").find("input[type=checkbox]").val();
selected_images[cate_id] = selText.trim();
}
return false;
});
$(".dropdown-toggle").click(function(){
$(this).parents('.btn-group').find('.dropdown-menu').show();
return false;
});
$(".list-image .dropdown-menu").mouseleave(function(){
$(".list-image .dropdown-menu").hide();
return false;
});
$('[name="saveleowidget"].sub_categories').click(
function(){
$("#category_img").val(JSON.stringify(selected_images));
});
$('[name="saveandstayleowidget"].sub_categories').click(
function(){
$("#category_img").val(JSON.stringify(selected_images));
});
// show selected_image when loaded page
$("input[type=checkbox]", $(".form-select-icon")).each(function(){
if($(this).val() != root_id){
listImage = $(".list-image","#list_image_wrapper").clone(1);
listImage.addClass("list-image-"+$(this).val());
listImage.appendTo($(this).closest("li").find("span").first());
}
for(var key in selected_images){
if(key == $(this).val()){
image_name = selected_images[key];
listImage.find(".dropdown-toggle").html(image_name+' <span class="caret"></span>');
break;
}
}
//$(this).closest("ul.tree").css("display", "none");
});
//$("ul.tree").css("display", "none");
function checkParentNodes(obj){
var flag = true;
if(parent = obj.closest("ul").closest("li").find("input[type=checkbox]")){
if(parent.val() != root_id){
if($("input[value=" + parent.val() + "]","#image_cate_tree").is(":checked")){
flag = false;
}else{
flag = checkParentNodes(parent);
}
}
}
return flag;
}
//DONGND:: update link type
_updateLinkType();
$("#link_type").on('change',_updateLinkType);
var array_id_lang = [];
if (typeof list_id_lang !== "undefined")
{
array_id_lang = $.parseJSON(list_id_lang);
}
//DONGND:: hiden tmp form
$('.tmp').each(function(){
if($(this).closest(".translatable-field").length)
{
// console.log($(this).closest(".form-group"));
// console.log($(this).closest(".form-group").closest(".form-group"));
if($(this).hasClass('element'))
{
var id = $(this).attr('id');
id = id.substring(0, id.lastIndexOf('_'));
var index = id.substring(id.lastIndexOf('_')+1);;
// console.log(index);
$(this).closest(".form-group").parents(".form-group").addClass('element-tmp hidden element-'+index);
}
else
{
$(this).closest(".form-group").parents(".form-group").addClass('parent-tmp hidden');
}
if(!$(this).closest(".form-group").find('.copy_lang_value').length)
$(this).closest(".form-group").append("<button class='btn btn-info copy_lang_value'>"+copy_lang_button_text+"</button>");
}
else
{
if($(this).hasClass('element'))
{
var id = $(this).attr('id');
if(array_id_lang.length == 1 && $(this).hasClass('element-lang'))
{
// console.log(array_id_lang.length);
id = id.substring(0, id.lastIndexOf('_'));
}
var index = id.substring(id.lastIndexOf('_')+1);;
// console.log(index);
$(this).closest(".form-group").addClass('element-tmp hidden element-'+index);
}
else
{
$(this).closest(".form-group").addClass('parent-tmp hidden');
}
}
});
//DONGND:: display link group when edit block link
if ($('#list_id_link').length && $('#list_id_link').val() != '')
{
var list_id_link = $('#list_id_link').val().split(',');
var button_tmp = "<div class='form-group'>";
button_tmp += "<div class='col-lg-3'></div>";
button_tmp += "<div class='col-lg-9'>";
button_tmp += "<button class='btn btn-primary duplicate_link'>"+duplicate_button_text+"</button>";
button_tmp += "<button class='btn btn-danger remove_link'>"+remove_button_text+"</button>";
button_tmp += '</div>';
button_tmp += '</div>';
button_tmp += '</div>';
$.each(list_id_link, function( index, value ) {
if (value != '')
{
//$("[id^=text_link_"+value+"]");
// if($("[id^=text_link_"+value+"]").closest('.form-group').find('.translatable-field').length)
// $("[id^=text_link_"+value+"]").closest('.form-group').parents('.element-tmp').before('<div class="link_group new"><hr>');
// else
// $("[id^=text_link_"+value+"]").closest('.element-tmp').before('<div class="link_group new"><hr>');
// if($("[id^=controller_type_parameter_"+value+"]").closest('.form-group').find('.translatable-field').length)
// $("[id^=controller_type_parameter_"+value+"]").closest('.form-group').parents('.element-tmp').after(button_tmp);
// else
// $("[id^=controller_type_parameter_"+value+"]").closest('.element-tmp').after(button_tmp);
$('.element-'+value).wrapAll('<div class="link_group new">');
$('.link_group.new').prepend('<hr>');
$('.link_group.new').append(button_tmp);
$('.link_group.new').data('index',value);
$('.link_group.new .element-tmp').removeClass('element-tmp hidden');
$('.link_group.new').removeClass('new');
_updateLinkType(value);
$("#link_type_"+value).on('change',function(){
_updateLinkType(value);
});
}
});
$(".link_group:odd").css("background-color", "#DAE4F0");
$(".link_group:even").css("background-color", "#FFFFFF");
}
//DONGND:: add new link
// console.log(array_id_lang[0]);
// console.log(array_id_lang[1]);
$('.add-new-link').on('click',function(e){
e.preventDefault();
// var total_link = parseInt($("#total_link").val()) + 1;
var total_link = getMaxIndex();
var i=0;
var new_link_tmp = '';
$('.parent-tmp.hidden').each(function(){
if (i == 0)
{
//$('.add-new-link').closest('.form-group').parent().append('<div class="link_group"><hr>');
new_link_tmp += '<div class="link_group new"><hr>';
}
new_link_tmp += '<div class="form-group">'+$(this).html()+'</div>';
// $('.add-new-link').closest('.form-group').parent().append('<div class="form-group new">'+$(this).html()+'</div>');
i++;
if (i == $('.parent-tmp.hidden').length)
{
// console.log('test');
// $('.add-new-link').closest('.form-group').parent().append('</div>');
new_link_tmp += "<div class='form-group'>";
new_link_tmp += "<div class='col-lg-3'></div>";
new_link_tmp += "<div class='col-lg-9'>";
new_link_tmp += "<button class='btn btn-primary duplicate_link'>"+duplicate_button_text+"</button>";
new_link_tmp += "<button class='btn btn-danger remove_link'>"+remove_button_text+"</button>";
new_link_tmp += '</div>';
new_link_tmp += '</div>';
new_link_tmp += '</div>';
}
});
$('.add-new-link').closest('.form-group').parent().append(new_link_tmp);
$('.link_group.new').data('index',total_link);
updateNewLink(total_link, true , 0);
});
//DONGND:: duplicate link - block link
$('.duplicate_link').live('click',function(e){
e.preventDefault();
//var html_duplicate = $(this).closest('.link_group').html();
var html_duplicate = $(this).closest('.link_group').clone().prop('class', 'link_group new');
// console.log(html_duplicate);
//html_duplicate.filter('.link_group').prop('class', 'link_group new');
//var total_link = parseInt($("#total_link").val()) + 1;
var total_link = getMaxIndex();
$(this).closest('.link_group').after(html_duplicate);
var current_index = $(this).closest('.link_group').data('index');
$('.link_group.new').data('index',total_link);
updateNewLink(total_link, false, current_index);
});
//DONGND:: remove link - block link
$('.remove_link').live('click',function(e){
e.preventDefault();
if (confirm('Are you sure you want to delete?')) {
//console.log($(this).find('.tmp'));
$(this).closest('.link_group').find('.tmp').each(function(){
// console.log($(this).attr('name'));
var name_val = $(this).attr('name');
if($(this).closest(".translatable-field").length)
{
name_val = name_val.substring(0, name_val.lastIndexOf('_'));
updateField('remove',name_val,true);
}
else
{
updateField('remove',name_val,false);
}
});
$(this).closest('.link_group').fadeOut(function(){
$(this).remove();
$(".link_group:odd").css( "background-color", "#DAE4F0" );
$(".link_group:even").css( "background-color", "#FFFFFF" );
var total_link = parseInt($("#total_link").val())-1;
$("#total_link").val(total_link);
$('#list_id_link').val('');
$('.link_group').each(function(){
$('#list_id_link').val($('#list_id_link').val()+$(this).data('index')+',');
})
});
}
});
//DONGND:: copy to other language - block link
$('.copy_lang_value').live('click',function(e){
e.preventDefault();
// console.log('test');
// console.log($(this).parent().find('.translatable-field:visible'));
var value_copy = $(this).parent().find('.translatable-field:visible input').val();
// console.log($(this).parent().find('.translatable-field:hidden'));
$(this).parent().find('.translatable-field:hidden input').val(value_copy);
$(this).text(copy_lang_button_text_done);
var ele_obj = $(this);
// console.log(value_copy);
//copy_lang_button_text_done
setTimeout(function(){
ele_obj.text(copy_lang_button_text);
}, 2000);
});
//DONGND:: update value of input select - block link
// $('.link_group input').live('keyup',function(){
// console.log($(this).val());
// })
$('.link_group select').live('change',function(){
if($(this).val() != $(this).find('option[selected=selected]').val())
{
$(this).find('option[selected=selected]').removeAttr("selected");
$(this).find('option[value='+$(this).val()+']').attr('selected','selected');
}
});
//done for category_image widget
// Check type of Carousel type - BEGIN
$('.form-action').change(function(){
elementName = $(this).attr('name');
$('.'+elementName+'_sub').hide(300);
$('.'+elementName+'-'+$(this).val()).show(500);
});
$('.form-action').trigger("change");
// Check type of Carousel type - END
$("#configuration_form").validate({
rules : {
owl_items : {
min : 1,
},
owl_rows : {
min : 1,
}
}
});
});
function getMaxIndex()
{
if($('.link_group').length == 0)
{
return 1;
}
else
{
var list_index = [];
$('.link_group').each(function(){
list_index.push($(this).data('index'));
})
// console.log(list_index);
return Math.max.apply(Math,list_index) + 1;
// console.log(total_link);
}
}
//DONGND:: update when add a new link
function updateNewLink(total_link, scroll_to_new_e, current_index)
{
// console.log(id_language);
var array_id_lang = $.parseJSON(list_id_lang);
updateField('add','text_link_'+total_link,true);
updateField('add','url_type_'+total_link,true);
updateField('add','controller_type_parameter_'+total_link,true);
// console.log($('.link_group.new .form-group .tmp').closest(".translatable-field").length);
$('.link_group.new .form-group .tmp').each(function(){
var e_obj = $(this);
if($(this).closest(".translatable-field").length)
{
// console.log('aaaa');
$.each(array_id_lang, function( index, value ) {
// if (current_index == 0)
// {
// switch(e_obj.attr('id'))
// {
// case 'text_link_'+value:
// e_obj.attr('id','text_link_'+total_link+'_'+value);
// e_obj.attr('name','text_link_'+total_link+'_'+value);
// break;
// case 'url_type_'+value:
// e_obj.attr('id','url_type_'+total_link+'_'+value);
// e_obj.attr('name','url_type_'+total_link+'_'+value);
// break;
// case 'controller_type_parameter_'+value:
// e_obj.attr('id','controller_type_parameter_'+total_link+'_'+value);
// e_obj.attr('name','controller_type_parameter_'+total_link+'_'+value);
// break;
// }
// }
// else
// {
// console.log('test');
// console.log(e_obj.attr('id'));
switch(e_obj.attr('id'))
{
case 'text_link_'+current_index+'_'+value:
e_obj.attr('id','text_link_'+total_link+'_'+value);
e_obj.attr('name','text_link_'+total_link+'_'+value);
break;
case 'url_type_'+current_index+'_'+value:
e_obj.attr('id','url_type_'+total_link+'_'+value);
e_obj.attr('name','url_type_'+total_link+'_'+value);
break;
case 'controller_type_parameter_'+current_index+'_'+value:
e_obj.attr('id','controller_type_parameter_'+total_link+'_'+value);
e_obj.attr('name','controller_type_parameter_'+total_link+'_'+value);
break;
}
// }
});
}
else
{
// console.log(array_id_lang.length);
if(array_id_lang.length == 1)
{
switch(e_obj.attr('id'))
{
case 'text_link_'+current_index+'_'+id_lang:
e_obj.attr('id','text_link_'+total_link+'_'+id_lang);
e_obj.attr('name','text_link_'+total_link+'_'+id_lang);
break;
case 'url_type_'+current_index+'_'+id_lang:
e_obj.attr('id','url_type_'+total_link+'_'+id_lang);
e_obj.attr('name','url_type_'+total_link+'_'+id_lang);
break;
case 'controller_type_parameter_'+current_index+'_'+id_lang:
e_obj.attr('id','controller_type_parameter_'+total_link+'_'+id_lang);
e_obj.attr('name','controller_type_parameter_'+total_link+'_'+id_lang);
break;
default:
var old_id = e_obj.attr('id');
var old_name = e_obj.attr('name');
old_id = old_id.substring(0, old_id.lastIndexOf('_'));
old_name = old_name.substring(0, old_name.lastIndexOf('_'));
e_obj.attr('id',old_id+'_'+total_link);
e_obj.attr('name',old_name+'_'+total_link);
updateField('add',old_name+'_'+total_link, false);
if(old_id == 'product_type' || old_id == 'cms_type' || old_id == 'category_type' || old_id == 'manufacture_type' || old_id == 'supplier_type' || old_id == 'controller_type')
{
if (e_obj.is( "input" ))
{
e_obj.attr('class','link_type_group_'+total_link+' tmp');
}
if (e_obj.is( "select" ))
{
e_obj.attr('class','link_type_group_'+total_link+' tmp fixed-width-xl');
}
}
break;
}
}
else
{
// if(scroll_to_new_e == true)
// {
// var old_id = e_obj.attr('id');
// var old_name = e_obj.attr('name');
// }
// else
// {
var old_id = e_obj.attr('id');
var old_name = e_obj.attr('name');
old_id = old_id.substring(0, old_id.lastIndexOf('_'));
old_name = old_name.substring(0, old_name.lastIndexOf('_'));
// }
e_obj.attr('id',old_id+'_'+total_link);
e_obj.attr('name',old_name+'_'+total_link);
updateField('add',old_name+'_'+total_link, false);
if(old_id == 'product_type' || old_id == 'cms_type' || old_id == 'category_type' || old_id == 'manufacture_type' || old_id == 'supplier_type' || old_id == 'controller_type')
{
if (e_obj.is( "input" ))
{
e_obj.attr('class','link_type_group_'+total_link+' tmp');
}
if (e_obj.is( "select" ))
{
e_obj.attr('class','link_type_group_'+total_link+' tmp fixed-width-xl');
}
}
}
}
});
_updateLinkType(total_link);
$("#link_type_"+total_link).on('change',function(){
_updateLinkType(total_link);
});
if(scroll_to_new_e == true)
{
$(".link_group:odd").css("background-color", "#DAE4F0");
$(".link_group:even").css("background-color", "#FFFFFF");
}
if(scroll_to_new_e == true)
{
$('html, body').animate({
scrollTop: $('.link_group.new').offset().top
}, 500, function (){
$('.link_group.new').removeClass('new');
});
}
else
{
setTimeout(function(){
$('.link_group.new').removeClass('new');
$(".link_group:odd").css("background-color", "#DAE4F0");
$(".link_group:even").css("background-color", "#FFFFFF");
}, 500);
}
$("#total_link").val(total_link);
}
//DONGND:: update list field
function updateField(action, value, is_lang)
{
// console.log('test');
if (action == 'add')
{
if (is_lang == true)
{
$('#list_field_lang').val($('#list_field_lang').val()+value+',');
}
else
{
$('#list_field').val($('#list_field').val()+value+',');
}
}
else
{
// console.log('test');
if (is_lang == true)
{
var old_list_field_lang = $('#list_field_lang').val();
var new_list_field_lang = old_list_field_lang.replace(value,'');
$('#list_field_lang').val(new_list_field_lang);
}
else
{
var old_list_field = $('#list_field').val();
var new_list_field = old_list_field.replace(value,'');
$('#list_field').val(new_list_field);
}
}
$('#list_id_link').val('');
$('.link_group').each(function(){
$('#list_id_link').val($('#list_id_link').val()+$(this).data('index')+',');
})
}
//DONGND:: update link type
function _updateLinkType(total_link)
{
if (typeof total_link === "undefined" || total_link === null) {
var total_link_new = "";
total_link = "";
}
else
{
// var total_link_old = total_link;
var total_link_new = '_'+total_link;
}
$(".link_type_group"+total_link_new).parent().parent().hide();
if($("[id^=url_type_"+total_link+"]").closest('.form-group').find('.translatable-field').length)
$("[id^=url_type_"+total_link+"]").closest('.form-group').parent().parent().hide();
else
$("[id^=url_type_"+total_link+"]").closest('.form-group').hide();
if($("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').find('.translatable-field').length)
$("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').parent().parent().hide();
else
$("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').hide();
if($("[id^=content_text_"+total_link+"]").closest('.form-group').find('.translatable-field').length)
$("[id^=content_text_"+total_link+"]").closest('.form-group').parent().parent().hide();
else
$("[id^=content_text_"+total_link+"]").closest('.form-group').hide();
// console.log(total_link);
// console.log(total_link_new);
// console.log($("#link_type"+total_link_new).val());
if( $("#link_type"+total_link_new).val() =='url' ){
if($("[id^=url_type_"+total_link+"]").closest('.form-group').find('.translatable-field').length)
$("[id^=url_type_"+total_link+"]").closest('.form-group').parent().parent().show();
else
$("[id^=url_type_"+total_link+"]").closest('.form-group').show();
}
else {
$("#"+$("#link_type"+total_link_new).val()+"_type"+total_link_new).parent().parent().show();
if($("#link_type"+total_link_new).val() == 'controller')
{
// $("#"+$("#link_type").val()+"_type_parameter").parent().parent().show();
if($("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').find('.translatable-field').length)
$("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').parent().parent().show();
else
$("[id^=controller_type_parameter_"+total_link+"]").closest('.form-group').show();
}
}
}
/*
* Owl carousel
*/
// $(document).ready(function(){
// });
$.validator.addMethod("owl_items_custom", function(value, element) {
pattern_en = /^\[\[[0-9]+, [0-9]+\](, [\[[0-9]+, [0-9]+\])*\]$/; // [[320, 1], [360, 1]]
pattern_dis = /^0?$/
//console.clear();
//console.log (pattern.test(value));
return (pattern_en.test(value) || pattern_dis.test(value));
//return false;
}, "Please enter correctly config follow under example.");

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* 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.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

View File

@@ -0,0 +1,275 @@
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
.fancybox-wrap,
.fancybox-skin,
.fancybox-outer,
.fancybox-inner,
.fancybox-image,
.fancybox-wrap iframe,
.fancybox-wrap object,
.fancybox-nav,
.fancybox-nav span,
.fancybox-tmp
{
padding: 0;
margin: 0;
border: 0;
outline: none;
vertical-align: top;
}
.fancybox-wrap {
position: absolute;
top: 0;
left: 0;
z-index: 8020;
}
.fancybox-skin {
position: relative;
background: #f9f9f9;
color: #444;
text-shadow: none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.fancybox-opened {
z-index: 8030;
}
.fancybox-opened .fancybox-skin {
-webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.fancybox-outer, .fancybox-inner {
position: relative;
}
.fancybox-inner {
overflow: hidden;
}
.fancybox-type-iframe .fancybox-inner {
-webkit-overflow-scrolling: touch;
}
.fancybox-error {
color: #444;
font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
margin: 0;
padding: 15px;
white-space: nowrap;
}
.fancybox-image, .fancybox-iframe {
display: block;
width: 100%;
height: 100%;
}
.fancybox-image {
max-width: 100%;
max-height: 100%;
}
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
background-image: url('fancybox_sprite.png');
}
#fancybox-loading {
position: fixed;
top: 50%;
left: 50%;
margin-top: -22px;
margin-left: -22px;
background-position: 0 -108px;
opacity: 0.8;
cursor: pointer;
z-index: 8060;
}
#fancybox-loading div {
width: 44px;
height: 44px;
background: url('fancybox_loading.gif') center center no-repeat;
}
.fancybox-close {
position: absolute;
top: -18px;
right: -18px;
width: 36px;
height: 36px;
cursor: pointer;
z-index: 8040;
}
.fancybox-nav {
position: absolute;
top: 0;
width: 40%;
height: 100%;
cursor: pointer;
text-decoration: none;
background: transparent url('blank.gif'); /* helps IE */
-webkit-tap-highlight-color: rgba(0,0,0,0);
z-index: 8040;
}
.fancybox-prev {
left: 0;
}
.fancybox-next {
right: 0;
}
.fancybox-nav span {
position: absolute;
top: 50%;
width: 36px;
height: 34px;
margin-top: -18px;
cursor: pointer;
z-index: 8040;
visibility: hidden;
}
.fancybox-prev span {
left: 10px;
background-position: 0 -36px;
}
.fancybox-next span {
right: 10px;
background-position: 0 -72px;
}
.fancybox-nav:hover span {
visibility: visible;
}
.fancybox-tmp {
position: absolute;
top: -99999px;
left: -99999px;
visibility: hidden;
max-width: 99999px;
max-height: 99999px;
overflow: visible !important;
}
/* Overlay helper */
.fancybox-lock {
overflow: hidden !important;
width: auto;
height: auto;
}
.fancybox-lock body {
overflow: hidden !important;
}
.fancybox-lock-test {
overflow-y: hidden !important;
}
.fancybox-overlay {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
display: none;
z-index: 8010;
background: url('fancybox_overlay.png');
}
.fancybox-overlay-fixed {
position: fixed;
bottom: 0;
right: 0;
}
.fancybox-lock .fancybox-overlay {
overflow: auto;
overflow-y: scroll;
}
/* Title helper */
.fancybox-title {
visibility: hidden;
font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
position: relative;
text-shadow: none;
z-index: 8050;
}
.fancybox-opened .fancybox-title {
visibility: visible;
}
.fancybox-title-float-wrap {
position: absolute;
bottom: 0;
right: 50%;
margin-bottom: -35px;
z-index: 8050;
text-align: center;
}
.fancybox-title-float-wrap .child {
display: inline-block;
margin-right: -100%;
padding: 2px 20px;
background: transparent; /* Fallback for web browsers that doesn't support RGBa */
background: rgba(0, 0, 0, 0.8);
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
text-shadow: 0 1px 2px #222;
color: #FFF;
font-weight: bold;
line-height: 24px;
white-space: nowrap;
}
.fancybox-title-outside-wrap {
position: relative;
margin-top: 10px;
color: #fff;
}
.fancybox-title-inside-wrap {
padding-top: 10px;
}
.fancybox-title-over-wrap {
position: absolute;
bottom: 0;
left: 0;
color: #fff;
padding: 10px;
background: #000;
background: rgba(0, 0, 0, .8);
}
/*Retina graphics!*/
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5){
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
background-image: url('fancybox_sprite@2x.png');
background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
}
#fancybox-loading div {
background-image: url('fancybox_loading@2x.gif');
background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
}
}

View File

@@ -0,0 +1,53 @@
/**
* @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com>
* @copyright 2007-2018 Apollotheme
* @description:
*/
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 13573 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

View File

@@ -0,0 +1,562 @@
/**
* @copyright Commercial License By LeoTheme.Com
* @email leotheme.com
* @visit http://www.leotheme.com
*/
$(document).ready(function() {
$.each(list_menu,function(index,value){
// console.log(value.type);
if (value.type == "horizontal")
{
var megamenu_element = $('.cavas_menu[data-megamenu-id='+value.id+']');
// console.log(megamenu_element);
//DONGND:: type horizontal menu
//DONGND:: check active link
if($("body").attr("id")=="index") isHomeMenu = 1;
megamenu_element.find(".megamenu > li > a").each(function() {
menuURL = $(this).attr("href").replace("https://","").replace("http://","").replace("www.","").replace( /#\w*/, "" );
if( (currentURL == menuURL) || (currentURL.replace(current_link,"") == menuURL) || isHomeMenu){
$(this).parent().addClass("active");
return false;
}
});
//DONGND:: check target
// console.log($(window).width());
if($(window).width() <= 767){
set_target_blank(false, megamenu_element); // set cavas NO
}else{
set_target_blank(true, megamenu_element); // set cavas Yes
}
// console.log('test');
// console.log(show_cavas);
//DONGND:: off canvas menu
if(value.show_cavas == 1)
{
// console.log('test');
$.fn.OffCavasmenu = function(opts) {
// default configuration
var config = $.extend({}, {
opt1: null,
text_warning_select: text_warning_select_txt,
text_confirm_remove: text_confirm_remove_txt,
JSON: null
}, opts);
// main function
// initialize every element
this.each(function() {
// console.log('test');
var $btn = megamenu_element.find('.navbar-toggler');
// console.log($btn);
var $nav = null;
if (!$btn.length)
return;
var $nav = $("<section class='off-canvas-nav-megamenu' data-megamenu-id="+value.id+"><nav class='offcanvas-mainnav' ><div class='off-canvas-button-megamenu'><span class='off-canvas-nav'></span>"+close_bt_txt+"</div></nav></section>");
// console.log($($btn.data('target')).find('.megamenu'));
var $menucontent = $($btn.data('target')).find('.megamenu').clone();
$("body").append($nav);
$('body main').append("<div class='megamenu-overlay' data-megamenu-id="+value.id+"></div>");
$(".megamenu-overlay[data-megamenu-id="+value.id+"]").click(function(){
$btn.trigger('click');
});
// console.log('test');
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").append($menucontent);
$("html").addClass ("off-canvas");
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"]").find(".off-canvas-button-megamenu").click( function(){
off_canvas_active();
} );
if($btn.is(':visible')) {
$("body").removeClass("off-canvas-active").addClass("off-canvas-inactive");
}
$btn.click(function(){
// if (!$(".off-canvas-megamenu[data-megamenu-id="+value.id+"]").hasClass('off-canvas-nav-megamenu'))
// {
// $(".off-canvas-megamenu[data-megamenu-id="+value.id+"]").addClass('off-canvas-nav-megamenu');
// }
// console.log($(window).height());
// console.log($('.offcanvas-mainnav').height());
// if($(window).height() > $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height())
// {
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height($(window).height());
// }
// else
// {
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height('auto');
// }
off_canvas_active();
$('.off-canvas-nav-megamenu').removeClass('active');
if (!$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"]").hasClass('active') && $('body').hasClass('off-canvas-active'))
{
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"]").addClass('active');
auto_height(value.id);
}
// $(".off-canvas-megamenu[data-megamenu-id!="+value.id+"]").removeClass('off-canvas-nav-megamenu');
});
});
return this;
}
// console.log(megamenu_element);
megamenu_element.OffCavasmenu();
megamenu_element.find('.navbar-toggler').click(function() {
$('body,html').animate({
scrollTop: 0
}, 0);
return false;
});
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"]").find('.offcanvas-mainnav .caret').click(function(){
if($(this).parent('li').hasClass('open-sub'))
{
$(this).parent('li').find('.dropdown-menu').first().slideUp('fast',function (){
// console.log($(window).height());
// console.log($(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height());
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height('auto');
// if($(window).height() > $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height())
// {
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height($(window).height());
// }
auto_height(value.id);
});
$(this).parent('li').removeClass('open-sub');
}
else
{
// $('.offcanvas-mainnav li.open-sub').find('.dropdown-menu').first().slideUp('fast');
$(this).parent('li').siblings('.open-sub').find('.dropdown-menu').first().slideUp('fast');
$(this).parent('li').siblings().removeClass('open-sub');
$(this).parent('li').find('.dropdown-menu').first().slideDown('fast',function (){
// console.log($(window).height());
// console.log($(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height());
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height('auto');
// if($(window).height() > $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height())
// {
// $(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").height($(window).height());
// }
auto_height(value.id);
});
$(this).parent('li').addClass('open-sub');
}
});
$(window).resize(function() {
// console.log($(window).width());
// if( $(window).width() > 523 ){
if( $(window).width() > 991 ){
$("body").removeClass("off-canvas-active").addClass("off-canvas-inactive");
}
else
{
auto_height(value.id);
}
});
}
else
{
var $bt = megamenu_element.find('.navbar-toggler');
var $menu = megamenu_element.find('.leo-top-menu');
//DONGND:: add class for menu element when click button to show menu at mobile, tablet
$bt.click(function(){
if ($menu.hasClass('in'))
{
megamenu_element.removeClass('active');
}
else
{
if (!megamenu_element.hasClass('active'))
{
megamenu_element.addClass('active');
}
}
});
megamenu_element.find('.leo-top-menu .dropdown-toggle').removeAttr("disabled");
megamenu_element.find(".dropdown-toggle").click(function() {
if($(window).width() <= 767){
if($(this).parent("li").find("div:first").hasClass("level2"))
return false;
else
return true;
}
});
//DONGND::
megamenu_element.find(".leo-top-menu li a").each(function(){
// console.log($(this));
// console.log((this).hasAttribute('data-toggle'));
if((this).hasAttribute('data-toggle')){
$(this).removeAttr('data-toggle');
}
});
megamenu_element.find(".leo-top-menu li a.dropdown-toggle").click(function(){
if(!$(this).parent().hasClass('open') && this.href && this.href != '#'){
window.location.href = this.href;
}
})
// console.log('aaa');
megamenu_element.find(".leo-top-menu .caret").click(function(){
// console.log('test');
if($(this).parent('li').hasClass('open-sub'))
{
$(this).parent('li').find('.dropdown-menu').first().slideUp('fast', function(){
auto_height_off(megamenu_element);
});
$(this).parent('li').removeClass('open-sub');
}
else
{
// $('.offcanvas-mainnav li.open-sub').find('.dropdown-menu').first().slideUp('fast');
$(this).parent('li').siblings('.open-sub').find('.dropdown-menu').first().slideUp('fast');
$(this).parent('li').siblings().removeClass('open-sub');
$(this).parent('li').find('.dropdown-menu').first().slideDown('fast', function(){
auto_height_off(megamenu_element);
});
$(this).parent('li').addClass('open-sub');
}
});
if ($(document).width() >543)
{
megamenu_element.find('.leo-top-menu .dropdown-menu').css('display', '');
}
auto_height_off(megamenu_element);
$(window).resize(function(){
auto_height_off(megamenu_element);
if ($(document).width() >543)
{
megamenu_element.find('.leo-top-menu .dropdown').removeClass('open-sub');
megamenu_element.find('.leo-top-menu .dropdown-submenu').removeClass('open-sub');
megamenu_element.find('.leo-top-menu .dropdown-menu').css('display', '');
}
});
}
}
else
{
//DONGND:: type vertical menu
var megamenu_element = $('.leo-verticalmenu[data-megamenu-id='+value.id+']');
megamenu_element.find('.verticalmenu .dropdown-toggle').removeAttr("disabled");
megamenu_element.find(".verticalmenu .dropdown-toggle").click(function() {
if($(window).width() <= 767){
if($(this).parent("li").find("div:first").hasClass("level2"))
return false;
else
return true;
}
});
// megamenu_element.find('.verticalmenu .dropdown-toggle').prop('disabled', true);
// megamenu_element.find('.verticalmenu .dropdown-toggle').data('toggle', '');
megamenu_element.find('.verticalmenu .dropdown-toggle').removeAttr('data-toggle');
megamenu_element.find(".verticalmenu .caret").click(function(){
if($(this).parents('.verticalmenu').hasClass('active-button'))
{
// console.log('test');
var $parent = $(this).parent('li');
// console.log($parent.hasClass('open-sub'));
// $parent.toggleClass('open-sub');
if($parent.hasClass('open-sub'))
{
// console.log('test');
$parent.find('.dropdown-menu').first().slideUp('fast',function(){
$parent.removeClass('open-sub');
});
}
else
{
if($parent.siblings('.open-sub').length > 0)
{
$parent.siblings('.open-sub').find('.dropdown-menu').first().slideUp('fast',function(){
$parent.siblings('.open-sub').removeClass('open-sub');
});
$parent.find('.dropdown-menu').first().slideDown('fast',function(){
$parent.addClass('open-sub');
});
}
else
{
$parent.find('.dropdown-menu').first().slideDown('fast',function(){
$parent.addClass('open-sub');
});
}
}
return false;
}
});
if ($(window).width() >991)
{
megamenu_element.find('.verticalmenu').addClass('active-hover');
megamenu_element.find('.verticalmenu').removeClass('active-button');
megamenu_element.find('.verticalmenu .dropdown-menu').css('display', '');
megamenu_element.find('.leo-verticalmenu').removeClass('active');
}
else
{
megamenu_element.find('.verticalmenu').removeClass('active-hover');
megamenu_element.find('.verticalmenu').addClass('active-button');
}
$(window).resize(function(){
if ($(window).width() >991)
{
megamenu_element.find('.verticalmenu .dropdown').removeClass('open-sub');
megamenu_element.find('.verticalmenu .dropdown-submenu').removeClass('open-sub');
megamenu_element.find('.verticalmenu').addClass('active-hover');
megamenu_element.find('.verticalmenu').removeClass('active-button');
megamenu_element.find('.verticalmenu .dropdown-menu').css('display', '');
megamenu_element.removeClass('active');
}else{
megamenu_element.find('.verticalmenu').removeClass('active-hover');
megamenu_element.find('.verticalmenu').addClass('active-button');
}
});
scrollSliderBarMenu(megamenu_element);
}
//DONGND:: js for tab html
if ( typeof value.list_tab !== 'undefined' && value.list_tab.length > 0)
{
$.each(value.list_tab,function(key,val){
megamenu_element.find('#tabhtml'+val+' .nav a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
//DONGND:: fix for widget tab of off canvas menu on mobile
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"]").find('#tabhtml'+val+' .nav a').click(function (e) {
e.preventDefault();
if (!$(this).hasClass('active'))
{
var wrapper_tab = $(this).closest('.panel-group');
var tab_href = $(this).attr('href');
wrapper_tab.find('.nav-link').removeClass('active');
wrapper_tab.find('.nav-item').removeClass('active');
wrapper_tab.find('.tab-pane').removeClass('active');
$(this).addClass('active');
$(this).parents('.nav-item').addClass('active');
wrapper_tab.find(tab_href).addClass('active');
}
})
});
}
//DONGND:: js for widget image gallery category
if ( typeof value.level !== 'undefined' && typeof value.limit !== 'undefined')
{
megamenu_element.find('.widget-category_image ul.level0').each(function(){
$(this).find('ul').removeClass('dropdown-sub dropdown-menu');
});
megamenu_element.find(".widget-category_image ul.level0").each(function() {
var check_level = $(this).parents('.widget-category_image').data('level');
var check_limit = $(this).parents('.widget-category_image').data('limit');
//DONGND:: remove .caret by check level
$(this).find("ul.level" + check_level).parent().find('.caret').remove();
//DONGND:: remove ul by check level
$(this).find("ul.level" + check_level + " li").remove();
var element = $(this).find("ul.level" + (check_level - 1) + " li").length;
var count = 0;
if(check_level > 0) {
$(this).find("ul.level" + (check_level - 1) + " >li").each(function(){
count = count + 1;
if(count > check_limit){
$(this).remove();
}
});
}
});
//DONGND:: add for off canvas menu
$(".off-canvas-nav-megamenu[data-megamenu-id="+value.id+"] .offcanvas-mainnav").find(".widget-category_image ul.level0").each(function() {
var check_level = $(this).parents('.widget-category_image').data('level');
var check_limit = $(this).parents('.widget-category_image').data('limit');
//DONGND:: remove .caret by check level
$(this).find("ul.level" + check_level).parent().find('.caret').remove();
//DONGND:: remove ul by check level
$(this).find("ul.level" + check_level + " li").remove();
var element = $(this).find("ul.level" + (check_level - 1) + " li").length;
var count = 0;
if(check_level > 0) {
$(this).find("ul.level" + (check_level - 1) + " >li").each(function(){
count = count + 1;
if(count > check_limit){
$(this).remove();
}
});
}
});
}
if (value.type == "horizontal")
{
$(window).resize(function() {
// console.log($(window).width());
if( $(window).width() <= 767 ){
set_target_blank(false, megamenu_element); // set cavas NO
}
else {
set_target_blank(true, megamenu_element); // set cavas Yes
}
});
}
//if (value.type == "horizontal" && value.show_cavas == 1)
if (value.type == "horizontal" && value.show_cavas == 1)
{
$(document.body).on('click', '[data-toggle="dropdown"]' ,function(){
if(!$(this).parent().hasClass('open') && this.href && this.href != '#'){
window.location.href = this.href;
}
});
}
})
//DONGND:: js for widget image gallery product
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none'
});
})
//DONGND:: auto calculate height of off canvas menu off
function auto_height_off(menu_object)
{
wrapper_height = $("#page").innerHeight();
ul_height = menu_object.find(".leo-top-menu ul").innerHeight();
ul_offset_top = menu_object.find(".leo-top-menu ul").offset().top;
// console.log('test1');
// console.log(megamenu_element.find(".leo-top-menu ul").height());
// console.log(megamenu_element.find(".leo-top-menu ul").offset().top);
// console.log($("#page").height());
// $(".off-canvas-nav-megamenu[data-megamenu-id="+menu_id+"] .offcanvas-mainnav").css('min-height', windowHeight);
if (ul_offset_top + ul_height > wrapper_height)
{
if (!$("#page").hasClass('megamenu-autoheight'))
{
$("#page").addClass('megamenu-autoheight');
}
}
else
{
$("#page").removeClass('megamenu-autoheight');
}
}
//DONGND:: auto calculate height of off canvas menu
function auto_height(menu_id)
{
windowHeight = $(window).innerHeight();
$(".off-canvas-nav-megamenu[data-megamenu-id="+menu_id+"] .offcanvas-mainnav").css('min-height', windowHeight);
}
function off_canvas_active()
{
// console.log($(window).height());
if($('body').hasClass('off-canvas-active'))
{
$("body").removeClass("off-canvas-active").addClass("off-canvas-inactive");
}
else if($('body').hasClass('off-canvas-inactive'))
{
$("body").removeClass("off-canvas-inactive").addClass("off-canvas-active");
}
else
{
$("body").addClass("off-canvas-active");
}
}
function set_target_blank( show, megamenu_element)
{
if (show)
{
megamenu_element.find(".leo-top-menu li a").each(function(){
if( $(this).hasClass('has-category') && (this).hasAttribute('data-toggle') && $(this).attr('target')== '_blank' ){
var value = $(this).attr('data-toggle');
$(this).removeAttr('data-toggle');
$(this).attr('remove-data-toggle', value);
}
})
}else
{
// console.log('test');
megamenu_element.find(".leo-top-menu li a").each(function(){
if( $(this).hasClass('has-category') && (this).hasAttribute('remove-data-toggle') && $(this).attr('target')== '_blank' ){
var value = $(this).attr('remove-data-toggle');
$(this).removeAttr('remove-data-toggle');
$(this).attr('data-toggle', value);
}
})
}
}
function scrollSliderBarMenu(megamenu_element){
var menuElement = megamenu_element;
var columnElement = null;
var maxWindowSize = 991;
// if($(menuElement).hasClass('float-vertical-right'))
// columnElement = $("#right_column");
// else if($(menuElement).hasClass('float-vertical-left'))
// columnElement = $("#left_column");
//auto display slider bar menu when have left or right column
if($(columnElement).length && $(window).width()>=maxWindowSize) showOrHideSliderBarMenu(columnElement, menuElement, 1);
megamenu_element.find(".verticalmenu-button").click(function(){
if($(menuElement).hasClass('active'))
{
showOrHideSliderBarMenu(columnElement, menuElement, 0);
}
else
{
showOrHideSliderBarMenu(columnElement, menuElement, 1);
}
});
var lastWidth = $(window).width();
$(window).resize(function() {
if($(window).width()!=lastWidth){
if($(window).width()<maxWindowSize) {
if($(menuElement).hasClass('active')) showOrHideSliderBarMenu(columnElement, menuElement, 0);
}else{
if($(columnElement).length && !$(menuElement).hasClass('active')) showOrHideSliderBarMenu(columnElement, menuElement, 1);
}
lastWidth = $(window).width();
}
});
}
function showOrHideSliderBarMenu(columnElement, menuElement, active){
if(active){
$(menuElement).addClass('active');
if($(columnElement).length && $(window).width()>=991)
columnElement.css('padding-top',($('.block_content',$(menuElement)).height())+'px');
}else{
$(menuElement).removeClass('active');
if($(columnElement).length) columnElement.css('padding-top','');
}
}