first commit
This commit is contained in:
412
modules/leobootstrapmenu/views/js/admin/form.js
Normal file
412
modules/leobootstrapmenu/views/js/admin/form.js
Normal file
@@ -0,0 +1,412 @@
|
||||
/**
|
||||
* @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_","");
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
$(".delete_many_menus",this).click( function(){
|
||||
if (confirm('Delete selected items?'))
|
||||
{
|
||||
var list_menu = '';
|
||||
$('.quickselect:checkbox:checked').each(function () {
|
||||
list_menu += $(this).val() + ",";
|
||||
|
||||
});
|
||||
|
||||
if(list_menu != ''){
|
||||
location.href=config.action+"&delete_many_menu=1&list="+list_menu;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".quickduplicate",this).click( function(){
|
||||
if( confirm(config.confirm_duplicate) ){
|
||||
location.href=config.action+"&doduplicate=1&id_btmegamenu="+$(this).attr('rel').replace("id_","");
|
||||
}
|
||||
|
||||
} );
|
||||
$(".quickdeactive",this).click( function(){
|
||||
location.href=config.action+"&dostatus=0&id_btmegamenu="+$(this).attr('rel').replace("id_","");
|
||||
} );
|
||||
$(".quickactive",this).click( function(){
|
||||
location.href=config.action+"&dostatus=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);
|
||||
}
|
||||
|
||||
//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;
|
||||
})
|
||||
|
||||
//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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//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);
|
||||
//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');
|
||||
});
|
||||
36
modules/leobootstrapmenu/views/js/admin/index.php
Normal file
36
modules/leobootstrapmenu/views/js/admin/index.php
Normal 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;
|
||||
@@ -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;
|
||||
1188
modules/leobootstrapmenu/views/js/admin/jquery-validation-1.9.0/jquery.validate.js
vendored
Normal file
1188
modules/leobootstrapmenu/views/js/admin/jquery-validation-1.9.0/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
modules/leobootstrapmenu/views/js/admin/jquery-validation-1.9.0/jquery.validate.min.js
vendored
Normal file
51
modules/leobootstrapmenu/views/js/admin/jquery-validation-1.9.0/jquery.validate.min.js
vendored
Normal 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);
|
||||
422
modules/leobootstrapmenu/views/js/admin/jquery.nestable.js
Normal file
422
modules/leobootstrapmenu/views/js/admin/jquery.nestable.js
Normal file
@@ -0,0 +1,422 @@
|
||||
/**
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
|
||||
(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);
|
||||
722
modules/leobootstrapmenu/views/js/admin/liveeditor.js
Normal file
722
modules/leobootstrapmenu/views/js/admin/liveeditor.js
Normal file
@@ -0,0 +1,722 @@
|
||||
/**
|
||||
* @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('.leo-widget', 'mousemove', function(e){
|
||||
if($(this).data('id_widget')){
|
||||
var keywidget = $(this).data('id_widget');
|
||||
if(keywidget)
|
||||
$(".inject_widget_name option").each(
|
||||
function(){
|
||||
var value = $(this).val();
|
||||
if(value && value == keywidget)
|
||||
$(this).attr('selected', 'selected');
|
||||
}
|
||||
);
|
||||
}
|
||||
$(".leo-widget",$megamenu).removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.inject_widget_name').prop('disabled','disabled');
|
||||
});
|
||||
$($megamenu).delegate('.leo-widget', 'mouseleave', function(e){
|
||||
$('.inject_widget_name').removeAttr('disabled');
|
||||
});
|
||||
$($megamenu).delegate( '.mega-col', 'click', function(e){
|
||||
|
||||
$(".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()-15, 'left':pos.left}).show();
|
||||
$('.inject_widget').removeAttr('disabled');
|
||||
}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>');
|
||||
var allWidgets = {};
|
||||
$("#megamenu-content #mainmenutop .mega-col").each( function() {
|
||||
var objHook = {};
|
||||
var col = $(this);
|
||||
|
||||
if( $(col).data( 'widgets') && $(col).data("type") != "menu" ){
|
||||
objHook['id_widget'] = $(col).data( 'widgets');
|
||||
objHook['id_shop'] = config.id_shop;
|
||||
allWidgets[$(col).data( 'widgets')] = objHook;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: config.action_widget,
|
||||
cache: false,
|
||||
data: {
|
||||
ajax : true,
|
||||
allWidgets : 1,
|
||||
dataForm : JSON.stringify(allWidgets),
|
||||
},
|
||||
type:'POST',
|
||||
}).done(function( jsonData ) {
|
||||
var jsonData = jQuery.parseJSON(jsonData);
|
||||
$(col).children('div').html( jsonData[$(col).data( 'widgets')]['html'] );
|
||||
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');
|
||||
dws = dws.replace("|wid-" + $(w).attr('data-id_widget'),'' ).substring(1);
|
||||
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();
|
||||
//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;
|
||||
|
||||
|
||||
|
||||
// ONE ALL WIDGETS ONE AJAX - BEGIN
|
||||
var allWidgets = {};
|
||||
$("#megamenu-content #mainmenutop .mega-col").each( function() {
|
||||
var objHook = {};
|
||||
var col = $(this);
|
||||
|
||||
if( $(col).data( 'widgets') && $(col).data("type") != "menu" ){
|
||||
objHook['id_widget'] = $(col).data( 'widgets');
|
||||
objHook['id_shop'] = config.id_shop;
|
||||
allWidgets[$(col).data( 'widgets')] = objHook;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: config.action_widget,
|
||||
cache: false,
|
||||
data: {
|
||||
ajax : true,
|
||||
allWidgets : 1,
|
||||
dataForm : JSON.stringify(allWidgets),
|
||||
},
|
||||
type:'POST',
|
||||
}).done(function( jsonData ) {
|
||||
//console.log(jsonData);
|
||||
var jsonData = jQuery.parseJSON(jsonData);
|
||||
$.each( ajaxCols, function (i, col) {
|
||||
col.children('div').html( jsonData[$(col).data( 'widgets')]['html'] );
|
||||
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++;
|
||||
});
|
||||
|
||||
});
|
||||
return;
|
||||
// ONE ALL WIDGETS ONE AJAX - END
|
||||
|
||||
|
||||
// $.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(){
|
||||
//js for widget image gallery product
|
||||
$(".fancybox").fancybox({
|
||||
openEffect : 'none',
|
||||
closeEffect : 'none'
|
||||
});
|
||||
|
||||
//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;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
//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');
|
||||
// })
|
||||
// });
|
||||
// }
|
||||
|
||||
})
|
||||
|
||||
//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');
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
//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');
|
||||
//remove .caret by check level
|
||||
$(this).find("ul.level" + check_level).parent().find('.caret').remove();
|
||||
//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();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
669
modules/leobootstrapmenu/views/js/admin/show.js
Normal file
669
modules/leobootstrapmenu/views/js/admin/show.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
//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');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//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");
|
||||
}
|
||||
|
||||
//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);
|
||||
|
||||
});
|
||||
|
||||
//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);
|
||||
});
|
||||
|
||||
//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')+',');
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//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);
|
||||
});
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
}
|
||||
//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);
|
||||
}
|
||||
|
||||
//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')+',');
|
||||
})
|
||||
}
|
||||
//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.");
|
||||
Reference in New Issue
Block a user