On rajoute encore quelques modules

This commit is contained in:
2020-10-13 14:58:11 +02:00
parent c513c15cdc
commit 25cb197711
201 changed files with 22431 additions and 27 deletions

View File

@@ -0,0 +1,836 @@
/**
* 2014-2017 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2017 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*
*/
$(document).ready(function () {
var $myHorizontalTabs = $('#tabs1');
$myHorizontalTabs.sortable({
opacity: 0.6,
cursor: 'move',
update: function() {
var order = $(this).sortable('serialize') + "&action=updateHorizontalTabsPosition&ajax=true";
$.post(iqitsearch_url, order);
}
});
$myHorizontalTabs.hover(function() {
$(this).css("cursor","move");
},
function() {
$(this).css("cursor","auto");
});
var $myVerticalTabs = $('#tabs2');
$myVerticalTabs.sortable({
opacity: 0.6,
cursor: "move",
update: function() {
var order = $(this).sortable("serialize") + "&action=updateVerticalTabsPosition&ajax=true";
$.post(iqitsearch_url, order);
}
});
$myVerticalTabs.hover(function() {
$(this).css("cursor","move");
},
function() {
$(this).css("cursor","auto");
});
$('.list-wrapper').detach().prependTo('#list-container');
$('.icp-auto').iconpicker({
iconBaseClass: 'icon',
iconComponentBaseClass: 'icon',
iconClassPrefix: 'fa-'
});
var p_auto_settings = {
minChars: 1,
cache: 0,
source: function(term, response){
$.getJSON(iqitsearch_url, { q: term, ajax: true, action: 'SearchProducts' }, function(data){ response(data); });
},
renderItem: function (item, search){
return '<div class="autocomplete-suggestion" data-id="' + item.id + '" data-name="' + item.name + '">' +
'<img src="' + item.image + '" style="width: 30px; max-height: 100%; margin-right: 5px; border: 1px dotted #cecece; display: inline-block; vertical-align: middle;" />(ID: ' + item.id + ') ' + item.name + '</div>';
},
onSelect: function(e, term, item){
item.parents('.products-wrapper').first().find('.select-products-ids').first().append('<option value="' + item.data('id') + '">' + '(ID: ' + item.data('id') + ') ' + item.data('name') + '</option>');
}
};
$('.product-autocomplete').autoCompleteIq(p_auto_settings);
//fix for tinymce source code edit
$(document).on('focusin', function (e) {
if ($(e.target).closest(".mce-window").length) {
e.stopImmediatePropagation();
}
});
/**
* Grid creator
* type = 1 = row
* type = 2 = column
*/
//first rows sortable init
$('.first-rows-wrapper').sortable({
items: ".first_rows",
placeholder: "row-placeholder",
handle: ".dragger-handle"
});
//$( '.first-rows-wrapper' ).disableSelection();
//menu row sortable init
$('.menu_row').sortable({
items: ".menu_column",
handle: ".dragger-handle",
forcePlaceholderSize: true,
placeholder: "col-placeholder",
start: function (e, ui) {
ui.placeholder.height(ui.item.outerHeight());
ui.placeholder.addClass('col-xs-' + ui.item.data('width'));
},
connectWith: ".menu_row"
});
//$( '.menu_row' ).disableSelection();
//menu column sortable init
$('.menu_column').sortable({
items: ".menu_row",
handle: ".dragger-handle",
placeholder: "row-placeholder",
connectWith: ".menu_column"
});
//$( '.menu_column' ).disableSelection();
//bind sort update
$('.first-rows-wrapper').on('sortupdate', function (event, ui) {
tmpelementId1 = ui.item.data('elementId');
if (typeof ui.item.parent().data('elementId') === 'undefined') {
tmpparentId = 0;
}
;
tmpparentId = ui.item.parent().data('elementId');
if (submenu_content.hasOwnProperty(tmpelementId1)) {
submenu_content[tmpelementId1].parentId = tmpparentId;
}
updateElementsPositions();
});
//set column width
$('.grid_creator').on('change', '.select-column-width', function () {
$element = $(this).parent().parent().parent();
tmpelementId = $element.data('elementId');
$element.removeClass('col-xs-' + $element.data('width'));
$element.addClass('col-xs-' + this.value);
$element.data('width', this.value);
if (submenu_content.hasOwnProperty(tmpelementId)) {
submenu_content[tmpelementId].width = parseInt(this.value);
}
});
//open content modal
$('.grid_creator').on('click', '.column-content-edit', function () {
$($(this).parent().parent().find('.column-content-modal').first()).modal({
keyboard: false
});
});
//colum type
$('.grid_creator').on('change', '.select-column-content', function () {
$element = $(this).parents('.menu_column').first();
elmid = $element.data('elementId');
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].contentType = parseInt(this.value);
}
setContentForm($element, this.value);
});
//set content options
$('.grid_creator').on('hidden.bs.modal', '.column-content-modal', function (e) {
modid = $(this).parents('.menu_column').first().data('elementId');
if (submenu_content.hasOwnProperty(modid)) {
delete submenu_content[modid].content;
}
switch (parseInt($(this).find('.select-column-content').first().val())) {
case 1:
setHtmlContent(this, modid);
break;
case 2:
setCategoriesContent(this, modid);
break;
case 3:
setLinksContent(this, modid);
break;
case 4:
setProductsContent(this, modid);
break;
case 5:
setManufacturersContent(this, modid);
break;
case 6:
setImagesContent(this, modid);
break;
case 7:
setSuppliersContent(this, modid);
break;
}
setColumnStyle(this, modid);
});
function setCategoriesContent(modal, elmid) {
column_content = {};
if (ids = $(modal).find('.select-categories-ids').first().val()) {
column_content.ids = ids;
column_content.treep = parseInt($(modal).find('.select-categories-treep').first().val());
column_content.thumb = parseInt($(modal).find('.select-categories-thumb').first().val());
column_content.depth = parseInt($(modal).find('.select-categories-depth').first().val());
column_content.line = parseInt($(modal).find('.select-categories-line').first().val());
column_content.sublimit = parseInt($(modal).find('.select-categories-sublimit').first().val());
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function getMeta(url) {
var img = new Image();
img.src = url;
var size = {};
img.addEventListener("load", function () {
size['w'] = this.naturalWidth;
size['h'] = this.naturalHeight;
return size;
});
return size;
}
function setImagesContent(modal, elmid) {
column_content = {};
source = {};
href = {};
alt = {};
size = {};
if (typeof languages != "undefined") {
languages.forEach(function (jsLang) {
source[jsLang.id_lang] = $(modal).find('.image-source-' + jsLang.id_lang).first().val();
href[jsLang.id_lang] = $(modal).find('.image-href-' + jsLang.id_lang).first().val();
alt[jsLang.id_lang] = $(modal).find('.image-alt-' + jsLang.id_lang).first().val();
size[jsLang.id_lang] = getMeta(source[jsLang.id_lang]);
});
} else {
source[id_language] = $(modal).find('.image-source-' + id_language).first().val();
href[id_language] = $(modal).find('.image-href-' + id_language).first().val();
alt[id_language] = $(modal).find('.image-alt-' + id_language).first().val();
size[id_language] = getMeta(source[id_language]);
}
column_content.source = source;
column_content.href = href;
column_content.alt = alt;
column_content.size = size;
if (absolute = parseInt($(modal).find('.select-image-absolute').first().val())) {
column_content.absolute = 1;
column_content.i_a_t = $(modal).find('.image-absolute-t').first().val();
column_content.i_a_r = $(modal).find('.image-absolute-r').first().val();
column_content.i_a_b = $(modal).find('.image-absolute-b').first().val();
column_content.i_a_l = $(modal).find('.image-absolute-l').first().val();
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setProductsContent(modal, elmid) {
column_content = {};
if (ids = serialize_productsselect($(modal).find('.select-products-ids').first().find('option'))) {
column_content.ids = ids;
column_content.line = parseInt($(modal).find('.select-products-line').first().val());
column_content.view = parseInt($(modal).find('.select-products-view').first().val());
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setManufacturersContent(modal, elmid) {
column_content = {};
if (ids = $(modal).find('.select-manufacturers-ids').first().val()) {
column_content.ids = ids;
column_content.line = parseInt($(modal).find('.select-manufacturers-line').first().val());
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setSuppliersContent(modal, elmid) {
column_content = {};
if (ids = $(modal).find('.select-suppliers-ids').first().val()) {
column_content.ids = ids;
column_content.line = parseInt($(modal).find('.select-suppliers-line').first().val());
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setLinksContent(modal, elmid) {
column_content = {};
if (ids = $(modal).find('.select-links-ids').first().val()) {
column_content.ids = ids;
column_content.view = parseInt($(modal).find('.select-links-view').first().val());
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setHtmlContent(modal, elmid) {
column_content = {};
if (ids = $(modal).find('.select-customhtml').first().val()) {
column_content.ids = ids;
}
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content = column_content;
}
}
function setColumnStyle(modal, elmid) {
submenu_style = {};
title = {};
href = {};
legend = {};
if (typeof languages != "undefined") {
languages.forEach(function (jsLang) {
title[jsLang.id_lang] = $(modal).find('.column-title-' + jsLang.id_lang).first().val();
href[jsLang.id_lang] = $(modal).find('.column-href-' + jsLang.id_lang).first().val();
legend[jsLang.id_lang] = $(modal).find('.column-legend-' + jsLang.id_lang).first().val();
});
} else {
title[id_language] = $(modal).find('.column-title-' + id_language).first().val();
href[id_language] = $(modal).find('.column-href-' + id_language).first().val();
legendf[id_language] = $(modal).find('.column-legen-' + id_language).first().val();
}
submenu_style.title = title;
submenu_style.href = href;
submenu_style.legend = legend;
if (bgcolor = $(modal).find('.column_bg_color').first().val())
submenu_style.bg_color = bgcolor;
if (legend_bg = $(modal).find('.legend_bg').first().val())
submenu_style.legend_bg = legend_bg;
if (legend_txt = $(modal).find('.legend_txt').first().val())
submenu_style.legend_txt = legend_txt;
if (title_borderc = $(modal).find('.title_borderc').first().val())
submenu_style.title_borderc = title_borderc;
if (title_color = $(modal).find('.title_color').first().val())
submenu_style.title_color = title_color;
if (title_colorh = $(modal).find('.title_colorh').first().val())
submenu_style.title_colorh = title_colorh;
if (txt_color = $(modal).find('.txt_color').first().val())
submenu_style.txt_color = txt_color;
if (txt_colorh = $(modal).find('.txt_colorh').first().val())
submenu_style.txt_colorh = txt_colorh;
if (br_top_st = parseInt($(modal).find('.br_top_st').first().val())) {
submenu_style.br_top_st = br_top_st;
submenu_style.br_top_wh = parseInt($(modal).find('.br_top_wh').first().val());
submenu_style.br_top_c = $(modal).find('.br_top_c').first().val();
}
if (br_right_st = parseInt($(modal).find('.br_right_st').first().val())) {
submenu_style.br_right_st = br_right_st;
submenu_style.br_right_wh = parseInt($(modal).find('.br_right_wh').first().val());
submenu_style.br_right_c = $(modal).find('.br_right_c').first().val();
}
if (br_bottom_st = parseInt($(modal).find('.br_bottom_st').first().val())) {
submenu_style.br_bottom_st = br_bottom_st;
submenu_style.br_bottom_wh = parseInt($(modal).find('.br_bottom_wh').first().val());
submenu_style.br_bottom_c = $(modal).find('.br_bottom_c').first().val();
}
if (br_left_st = parseInt($(modal).find('.br_left_st').first().val())) {
submenu_style.br_left_st = br_left_st;
submenu_style.br_left_wh = parseInt($(modal).find('.br_left_wh').first().val());
submenu_style.br_left_c = $(modal).find('.br_left_c').first().val();
}
//paddings
if ($(modal).find('.c-padding-top').first().prop('checked'))
submenu_style.c_p_t = 1;
if ($(modal).find('.c-padding-right').first().prop('checked'))
submenu_style.c_p_r = 1;
if ($(modal).find('.c-padding-bottom').first().prop('checked'))
submenu_style.c_p_b = 1;
if ($(modal).find('.c-padding-left').first().prop('checked'))
submenu_style.c_p_l = 1;
//margins
if ($(modal).find('.c-margin-top').first().prop('checked'))
submenu_style.c_m_t = 1;
if ($(modal).find('.c-margin-right').first().prop('checked'))
submenu_style.c_m_r = 1;
if ($(modal).find('.c-margin-bottom').first().prop('checked'))
submenu_style.c_m_b = 1;
if ($(modal).find('.c-margin-left').first().prop('checked'))
submenu_style.c_m_l = 1;
if (submenu_content.hasOwnProperty(elmid)) {
submenu_content[elmid].content_s = submenu_style;
}
}
function serialize_productsselect(element) {
options = [];
element.each(function (i) {
options[i] = $(this).val();
});
return uniqProducts(options);
}
function uniqProducts(a) {
var prims = {"boolean": {}, "number": {}, "string": {}}, objs = [];
return a.filter(function (item) {
var type = typeof item;
if (type in prims)
return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);
else
return objs.indexOf(item) >= 0 ? false : objs.push(item);
});
}
function setContentForm($element, val) {
$element.find('.column-content-info').first().text($element.find('.select-column-content option[value="' + parseInt(val) + '"]').first().text());
switch (parseInt(val)) {
case 0:
$element.find('.content-options-wrapper').hide();
break;
case 1:
$element.find('.content-options-wrapper').not('.htmlcontent-wrapper').hide();
$element.find('.htmlcontent-wrapper').show();
break;
case 2:
$element.find('.content-options-wrapper').not('.categorytree-wrapper').hide();
$element.find('.categorytree-wrapper').show();
break;
case 3:
$element.find('.content-options-wrapper').not('.va-links-wrapper').hide();
$element.find('.va-links-wrapper').show();
break;
case 4:
$element.find('.content-options-wrapper').not('.products-wrapper').hide();
$element.find('.products-wrapper').show();
break;
case 5:
$element.find('.content-options-wrapper').not('.manufacturers-wrapper').hide();
$element.find('.manufacturers-wrapper').show();
break;
case 6:
$element.find('.content-options-wrapper').not('.column-image-wrapper').hide();
$element.find('.column-image-wrapper').show();
break;
case 7:
$element.find('.content-options-wrapper').not('.suppliers-wrapper').hide();
$element.find('.suppliers-wrapper').show();
break;
}
}
//init submenu elements
var submenu_content = {};
var elementId = 0;
if ($('#submenu-elements').length) {
var prev_submenu_val = $('#submenu-elements').val();
if (prev_submenu_val.length !== 0) {
var old_submenu_content = JSON.parse(prev_submenu_val);
$.extend(submenu_content, old_submenu_content);
var ids = $(".menu-element").map(function () {
return parseInt($(this).data('element-id'), 10);
}).get();
elementId = Math.max.apply(Math, ids);
}
}
$('.menu_column').each(function () {
$(this).find('.column_bg_color-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.legend_bg-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.legend_txt-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.br_top_c-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.br_right_c-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.br_bottom_c-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.br_left_c-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.title_borderc-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.title_color-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.title_colorh-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.txt_color-' + $(this).data('element-id')).first().mColorPicker();
$(this).find('.txt_colorh-' + $(this).data('element-id')).first().mColorPicker();
setContentForm($(this), $(this).data('contenttype'));
});
//add first row button
$('#buttons-sample').on('click', '.add-row-action', function () {
$parentElement = $(this).parent().parent().parent().find('.first-rows-wrapper');
$parentElement.append('<div data-element-type="1" data-depth="0" data-element-id="' + (++elementId) + '" class="row menu_row first_rows menu-element menu-element-id-' + (elementId) + '">' + $('#buttons-sample').html() + '</div>');
$('.menu-element-id-' + elementId).sortable({
items: ".menu_column",
handle: ".dragger-handle",
connectWith: ".menu_row",
placeholder: "col-placeholder",
});
//$( '.menu-element-id-' + elementId).disableSelection();
position = $parentElement.children().length;
var newElement = {
'elementId': elementId,
'type': 1,
'depth': 0,
'position': position,
'parentId': 0
};
submenu_content[elementId] = newElement;
});
//add row button
$('.grid_creator').on('click', '.menu-element .add-row-action', function () {
parentId = $(this).parent().parent().data("element-id");
depth = $(this).parent().parent().data("depth") + 1;
$parentElement = $(this).parent().parent();
$parentElement.append('<div data-element-type="1" data-depth="' + depth + '" data-element-id="' + (++elementId) + '" class="row menu_row menu-element menu-element-id-' + (elementId) + '">' + $('#buttons-sample').html() + ' </div>');
$('.menu-element-id-' + elementId).sortable({
items: ".menu_column",
handle: ".dragger-handle",
placeholder: "col-placeholder",
connectWith: ".menu_row"
});
//$( '.menu-element-id-' + elementId).disableSelection();
position = $parentElement.children().length;
var newElement = {
'elementId': elementId,
'type': 1,
'depth': depth,
'position': position,
'parentId': parentId
};
submenu_content[elementId] = newElement;
});
//clone column
$('.grid_creator').on('click', ' .duplicate-element-action', function () {
$brotherElement = $(this).parents('.menu-element').first();
brotherId = $brotherElement.data('element-id');
if (submenu_content.hasOwnProperty(brotherId)) {
clonedElement = clone(submenu_content[brotherId]);
clonedElement.elementId = ++elementId;
$cloneElement = $brotherElement.clone(true);
$cloneElement.data('element-id', elementId);
$cloneElement.removeClass('menu-element-id-' + brotherId);
$cloneElement.addClass('menu-element-id-' + elementId).appendTo($brotherElement.parent());
submenu_content[elementId] = clonedElement;
}
});
//add column button
$('.grid_creator').on('click', '.menu-element .add-column-action', function () {
parentId = $(this).parent().parent().data('element-id');
depth = $(this).parent().parent().data("depth") + 1;
$parentElement = $(this).parent().parent();
$parentElement.append('<div data-element-type="2" data-depth="' + depth + '" data-width="3" data-element-id="' + (++elementId) + '" class="col-xs-3 menu_column menu-element menu-element-id-' + (elementId) + '">' + $('#buttons-sample').html() + $('#column-content-sample').html() + '</div>');
$('.menu-element-id-' + elementId).sortable({
items: ".menu_row",
handle: ".dragger-handle",
placeholder: "row-placeholder",
connectWith: ".menu_column"
});
//$( '.menu-element-id-' + elementId).disableSelection();
position = $parentElement.children().length;
var newElement = {
'elementId': elementId,
'type': 2,
'depth': depth,
'width': 3,
'contentType': 0,
'position': position,
'parentId': parentId
};
$('.menu-element-id-' + elementId + ' .column_bg_color').addClass('column_bg_color-' + elementId);
$('.menu-element-id-' + elementId + ' .column_bg_color-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .legend_bg').addClass('legend_bg-' + elementId);
$('.menu-element-id-' + elementId + ' .legend_bg-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .legend_txt').addClass('legend_txt-' + elementId);
$('.menu-element-id-' + elementId + ' .legend_txt-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .br_top_c').addClass('br_top_c-' + elementId);
$('.menu-element-id-' + elementId + ' .br_top_c-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .br_right_c').addClass('br_right_c-' + elementId);
$('.menu-element-id-' + elementId + ' .br_right_c-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .br_bottom_c').addClass('br_bottom_c-' + elementId);
$('.menu-element-id-' + elementId + ' .br_bottom_c-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .br_left_c').addClass('br_left_c-' + elementId);
$('.menu-element-id-' + elementId + ' .br_left_c-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .title_borderc').addClass('title_borderc-' + elementId);
$('.menu-element-id-' + elementId + ' .title_borderc-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .title_color').addClass('title_color-' + elementId);
$('.menu-element-id-' + elementId + ' .title_color-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .title_colorh').addClass('title_colorh-' + elementId);
$('.menu-element-id-' + elementId + ' .title_colorh-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .txt_color').addClass('txt_color-' + elementId);
$('.menu-element-id-' + elementId + ' .txt_color-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .txt_colorh').addClass('txt_colorh-' + elementId);
$('.menu-element-id-' + elementId + ' .txt_colorh-' + elementId).mColorPicker();
$('.menu-element-id-' + elementId + ' .image-source').attr('id', elementId + '-image-source-' + $(this).data('lang-id'));
$('.menu-element-id-' + elementId + ' .image-source').each(function () {
$(this).attr('id', elementId + '-image-source-' + $(this).data('lang-id'));
$(this).parent().find('.iframe-column-upload').data('input-name', elementId + '-image-source-' + $(this).data('lang-id'));
});
$('.menu-element-id-' + elementId + ' .rte').each(function () {
$(this).attr('id', elementId + '-htmlcontent-' + $(this).data('lang-id'));
});
submenu_content[elementId] = newElement;
setContentForm($('.menu-element-id-' + elementId), 0);
$('.menu-element-id-' + elementId + ' .product-autocomplete').autoCompleteIq(p_auto_settings);
});
//remove element button
$('.grid_creator').on('click', '.remove-element-action', function () {
deleteId = $(this).parent().parent().data('element-id');
$(this).parent().parent().remove();
delete submenu_content[deleteId];
deleteMenuElelement(deleteId)
});
//pass submenu to input field
$('button[name="submitAddTab"]').on("click", function () {
if ($.isEmptyObject(submenu_content))
$('#submenu-elements').val('');
else
$('#submenu-elements').val(encodeURIComponent(JSON.stringify(submenu_content)));
});
//remove product fromc olumn
$('.grid_creator').on('click', '.remove-products-ids', function () {
$(this).parent().find('.select-products-ids option:selected').each(function (i) {
$(this).remove();
});
});
//delete menu elements recursivly
function deleteMenuElelement(id) {
for (var key in submenu_content) {
if (submenu_content.hasOwnProperty(key)) {
if (submenu_content[key].parentId == id) {
tmpelid = submenu_content[key].elementId;
delete submenu_content[key];
deleteMenuElelement(tmpelid);
}
}
}
}
//update all menu positions after drag and drop
function updateElementsPositions() {
for (var key in submenu_content) {
if (submenu_content.hasOwnProperty(key)) {
submenu_content[key].position = $('.menu-element-id-' + submenu_content[key].elementId).index();
}
}
}
function clone(src) {
function mixin(dest, source, copyFunc) {
var name, s, i, empty = {};
for (name in source) {
// the (!(name in empty) || empty[name] !== s) condition avoids copying properties in "source"
// inherited from Object.prototype. For example, if dest has a custom toString() method,
// don't overwrite it with the toString() method that source inherited from Object.prototype
s = source[name];
if (!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
dest[name] = copyFunc ? copyFunc(s) : s;
}
}
return dest;
}
if (!src || typeof src != "object" || Object.prototype.toString.call(src) === "[object Function]") {
// null, undefined, any non-object, or function
return src; // anything
}
if (src.nodeType && "cloneNode" in src) {
// DOM Node
return src.cloneNode(true); // Node
}
if (src instanceof Date) {
// Date
return new Date(src.getTime()); // Date
}
if (src instanceof RegExp) {
// RegExp
return new RegExp(src); // RegExp
}
var r, i, l;
if (src instanceof Array) {
// array
r = [];
for (i = 0, l = src.length; i < l; ++i) {
if (i in src) {
r.push(clone(src[i]));
}
}
// we don't clone functions for performance reasons
// }else if(d.isFunction(src)){
// // function
// r = function(){ return src.apply(this, arguments); };
} else {
// generic objects
r = src.constructor ? new src.constructor() : {};
}
return mixin(r, src, clone);
}
});

View File

@@ -0,0 +1,24 @@
/**
* 2014-2017 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2017 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*
*/
/*!
* Bootstrap v3.3.4 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=996541fddb4cc32bdd52)
* Config saved to config.json and https://gist.github.com/996541fddb4cc32bdd52
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var a=t.fn.jquery.split(" ")[0].split(".");if(a[0]<2&&a[1]<9||1==a[0]&&9==a[1]&&a[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){"use strict";function a(a){return this.each(function(){var n=t(this),r=n.data("bs.tab");r||n.data("bs.tab",r=new e(this)),"string"==typeof a&&r[a]()})}var e=function(a){this.element=t(a)};e.VERSION="3.3.2",e.TRANSITION_DURATION=150,e.prototype.show=function(){var a=this.element,e=a.closest("ul:not(.dropdown-menu)"),n=a.data("target");if(n||(n=a.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,"")),!a.parent("li").hasClass("active")){var r=e.find(".active:last a"),i=t.Event("hide.bs.tab",{relatedTarget:a[0]}),s=t.Event("show.bs.tab",{relatedTarget:r[0]});if(r.trigger(i),a.trigger(s),!s.isDefaultPrevented()&&!i.isDefaultPrevented()){var o=t(n);this.activate(a.closest("li"),e),this.activate(o,o.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:a[0]}),a.trigger({type:"shown.bs.tab",relatedTarget:r[0]})})}}},e.prototype.activate=function(a,n,r){function i(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),a.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),o?(a[0].offsetWidth,a.addClass("in")):a.removeClass("fade"),a.parent(".dropdown-menu").length&&a.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),r&&r()}var s=n.find("> .active"),o=r&&t.support.transition&&(s.length&&s.hasClass("fade")||!!n.find("> .fade").length);s.length&&o?s.one("bsTransitionEnd",i).emulateTransitionEnd(e.TRANSITION_DURATION):i(),s.removeClass("in")};var n=t.fn.tab;t.fn.tab=a,t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=n,this};var r=function(e){e.preventDefault(),a.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',r).on("click.bs.tab.data-api",'[data-toggle="pill"]',r)}(jQuery);

View File

@@ -0,0 +1,31 @@
/**
* 2014-2017 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2017 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*
*/
/**
* jquery.matchHeight-min.js v0.5.2
* http://brm.io/jquery-match-height/
* License: MIT
*/
(function(c){var n=-1,f=-1,r=function(a){var b=null,d=[];c(a).each(function(){var a=c(this),k=a.offset().top-h(a.css("margin-top")),l=0<d.length?d[d.length-1]:null;null===l?d.push(a):1>=Math.floor(Math.abs(b-k))?d[d.length-1]=l.add(a):d.push(a);b=k});return d},h=function(a){return parseFloat(a)||0},p=function(a){var b={byRow:!0,remove:!1,property:"height"};if("object"===typeof a)return c.extend(b,a);"boolean"===typeof a?b.byRow=a:"remove"===a&&(b.remove=!0);return b},b=c.fn.matchHeight=function(a){a=
p(a);if(a.remove){var e=this;this.css(a.property,"");c.each(b._groups,function(a,b){b.elements=b.elements.not(e)});return this}if(1>=this.length)return this;b._groups.push({elements:this,options:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var d=p(e),g=c(a),k=[g],l=c(window).scrollTop(),f=c("html").outerHeight(!0),m=g.parents().filter(":hidden");m.each(function(){var a=c(this);a.data("style-cache",
a.attr("style"))});m.css("display","block");d.byRow&&(g.each(function(){var a=c(this),b="inline-block"===a.css("display")?"inline-block":"block";a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),k=r(g),g.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||"")}));c.each(k,function(a,b){var e=c(b),f=0;d.byRow&&1>=e.length?e.css(d.property,
""):(e.each(function(){var a=c(this),b={display:"inline-block"===a.css("display")?"inline-block":"block"};b[d.property]="";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css("display","")}),e.each(function(){var a=c(this),b=0;"border-box"!==a.css("box-sizing")&&(b+=h(a.css("border-top-width"))+h(a.css("border-bottom-width")),b+=h(a.css("padding-top"))+h(a.css("padding-bottom")));a.css(d.property,f-b)}))});m.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||null)});b._maintainScroll&&
c(window).scrollTop(l/f*c("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};c("[data-match-height], [data-mh]").each(function(){var b=c(this),d=b.attr("data-match-height")||b.attr("data-mh");a[d]=d in a?a[d].add(b):b});c.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);c.each(b._groups,function(){b._apply(this.elements,this.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&"resize"===
e.type){var d=c(window).width();if(d===n)return;n=d}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};c(b._applyDataApi);c(window).bind("load",function(a){b._update(!1,a)});c(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery);
$(document).ready(function(){
$('.cbp-menu-column').matchHeight();
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,355 @@
/**
* 2014-2017 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2017 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*
*/
// classie - class helper functions, from bonzo https://github.com/ded/bonzo
!function(a){"use strict";function b(a){return new RegExp("(^|\\s+)"+a+"(\\s+|$)")}function f(a,b){var f=c(a,b)?e:d;f(a,b)}var c,d,e;"classList"in document.documentElement?(c=function(a,b){return a.classList.contains(b)},d=function(a,b){a.classList.add(b)},e=function(a,b){a.classList.remove(b)}):(c=function(a,c){return b(c).test(a.className)},d=function(a,b){c(a,b)||(a.className=a.className+" "+b)},e=function(a,c){a.className=a.className.replace(b(c)," ")});var g={hasClass:c,addClass:d,removeClass:e,toggleClass:f,has:c,add:d,remove:e,toggle:f};"function"==typeof define&&define.amd?define(g):a.classie=g}(window);
//hover intent
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
//double tap
;(function(e,t,n,r){e.fn.doubleTapToGo=function(r){if(!("ontouchstart"in t)&&!navigator.msMaxTouchPoints&&!navigator.userAgent.toLowerCase().match(/windows phone os 7/i))return false;this.each(function(){var t=false;e(this).on("click",function(n){var r=e(this);if(r[0]!=t[0]){n.preventDefault();t=r}});e(n).on("click touchstart MSPointerDown",function(n){var r=true,i=e(n.target).parents();for(var s=0;s<i.length;s++)if(i[s]==t[0])r=false;if(r)t=false})});return this}})(jQuery,window,document);
var cbpHorizontalMenu, cbpVerticalmenu;
$(document).ready(function(){
cbpHorizontalMenu = (function() {
var menuId = '#cbp-hrmenu',
$listItems = $( menuId + '> ul > li' ),
$menuItems = $listItems.children( 'a, .cbp-main-link' ),
$innerTabs = $( menuId + ' .cbp-hrsub-tabs-names li > a' ),
$body = $( 'body' ),
current = -1;
currentlevel = -1;
$listItems.has('ul').find(' > a').doubleTapToGo();
function init() {
var isTouchDevice = 'ontouchstart' in document.documentElement;
if( isTouchDevice ) {
$menuItems.on( 'mouseover', open );
}
else{
$menuItems.hoverIntent( {
over: open,
out: dnthing,
interval: 30
} );
}
$listItems.on( 'mouseover', function( event ) { event.stopPropagation(); } );
$innerTabs.hover( function(){
$innerTabs.removeClass('active');
$(this).tab('show');
});
}
var setCurrent = function(strName) {
current = strName;
};
function dnthing( event ) {
}
function open( event ) {
$othemenuitem = $('#cbp-hrmenu1').find('.cbp-hropen');
$othemenuitem.find('.cbp-hrsub').removeClass('cbp-show');
$othemenuitem.removeClass( 'cbp-hropen' );
cbpVerticalmenu.setCurrent(-1);
var $item = $( event.currentTarget ).parent( 'li' ),
idx = $item.index();
$submenu = $item.find('.cbp-hrsub');
if(current == idx )
return;
$submenu.removeClass('cbp-notfit');
$submenu.removeClass('cbp-show');
if( current !== -1 ) {
$listItems.eq( current ).removeClass( 'cbp-hropen' );
}
if( current === idx ) {
$item.removeClass( 'cbp-hropen' );
current = -1;
}
else {
$submenu.addClass( 'cbp-show' );
iqitmenuwidth = $(menuId).width();
iqititemposition = $item.position().left;
triangleoffset = iqitmenuwidth-$submenu.width();
if((iqitmenuwidth-iqititemposition)<$submenu.width())
{
$submenu.addClass( 'cbp-notfit' );
$submenu.find('.cbp-triangle-container').css({left: (iqititemposition-12+$item.width()/2)-triangleoffset });
}
else
$submenu.find('.cbp-triangle-container').css({left: (-12+$item.width()/2) });
$item.addClass( 'cbp-hropen' );
current = idx;
$body.off( 'mouseover' ).on( 'mouseover', close );
}
return false;
}
function close( event ) {
$listItems.eq( current ).removeClass( 'cbp-hropen' );
current = -1;
}
return { init : init,
setCurrent: setCurrent
};
})();
cbpHorizontalMenu.init();
if (iqitmegamenu.sticky) {
var s = $("#iqitmegamenu-horizontal");
var pos = s.offset();
var alreadySticky = false;
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
if ( s.length ){
if(!alreadySticky) {
if (windowpos >= pos.top) {
alreadySticky = true;
s.parent().height(s.height());
s.removeClass("cbp-nosticky");
s.addClass("cbp-sticky");
}
}
if(alreadySticky) {
if (windowpos < pos.top) {
alreadySticky = false;
s.removeClass("cbp-sticky");
s.addClass("cbp-nosticky");
s.parent().removeAttr("style");
}}
}
});
}
});
$(document).ready(function(){
$('.cbp-vertical-on-top').on( 'mouseover', function() {
$(this).addClass('cbp-vert-expanded');
});
$('.cbp-vertical-on-top').on( 'mouseleave', function() {
$(this).removeClass('cbp-vert-expanded');
});
cbpVerticalmenu = (function(test) {
var menuId = '#cbp-hrmenu1',
$listItems = $( menuId + '> ul > li' ),
$menuItems = $listItems.children( 'a' ),
$innerTabs = $( menuId + ' .cbp-hrsub-tabs-names li > a' ),
$body = $( 'body' ),
current = -1,
currentlevel = -1;
$listItems.has('ul').find(' > a').doubleTapToGo();
function init() {
var isTouchDevice = 'ontouchstart' in document.documentElement;
if( isTouchDevice ) {
$menuItems.on( 'mouseover', open );
}
else{
$menuItems.hoverIntent( {
over: open,
out: dnthing,
interval: 30
} );
}
$listItems.on( 'mouseover', function( event ) { event.stopPropagation(); } );
$innerTabs.hover( function(){
console.log('aas');
$innerTabs.removeClass('active');
$(this).tab('show');
});
$( window ).resize(function() {
$('cbp-hrmenu-tab').not('.cbp-hropen').find( '.cbp-hrsub-wrapper' ).removeAttr( 'style' );
});
}
function dnthing( event ) {
}
var setCurrent = function(strName) {
current = strName;
};
function open( event ) {
$othemenuitem = $('#cbp-hrmenu').find('.cbp-hropen');
$othemenuitem.find('.cbp-hrsub').removeClass('cbp-show');
closeElement($othemenuitem);
cbpHorizontalMenu.setCurrent(-1);
var $item = $( event.currentTarget ).parent( 'li' ),
idx = $item.index();
if(current == idx )
return;
$submenu = $item.find('.cbp-hrsub');
$submenu.removeClass('cbp-show');
if( current !== -1 ) {
closeElement($listItems.eq( current ));
}
if( current === idx ) {
closeElement($item);
current = -1;
}
else {
$submenu.parent().width($(iqitmegamenu.containerSelector).width()-$(menuId).width());
callerHeight = $item.height();
$submenu.parent().css( { marginLeft : $item.innerWidth()+"px", marginRight : $item.innerWidth()+"px", marginTop : -callerHeight+"px" } );
$submenu.find('.cbp-triangle-container').css({top: (callerHeight-24)/2});
$submenu.addClass( 'cbp-show' );
$item.addClass( 'cbp-hropen' );
current = idx;
$body.off( 'mouseover' ).on( 'mouseover', close );
}
return false;
}
function close( event ) {
closeElement($listItems.eq( current ));
current = -1;
}
function closeElement( $element ) {
$element.removeClass( 'cbp-hropen' );
}
return { init : init,
setCurrent: setCurrent
};
})();
cbpVerticalmenu.init();
});
$(document).ready(function(){
var cbpPush = (function() {
$('body').prepend($('#iqitmegamenu-mobile-content'));
$(".responsiveInykator").on("click", function () {
if (false == $(this).parent().next().is(':visible')) {
$('#iqitmegamenu-accordion > ul').removeClass('cbpm-ul-showed');
}
if ($(this).text() == "+"){
$(this).text("-");
}
else{
$(this).text("+");
}
$(this).parent().children('ul').toggleClass('cbpm-ul-showed');
});
var menuLeft = document.getElementById('iqitmegamenu-accordion'),
showLeftPush = document.getElementById('iqitmegamenu-shower'),
menuoverlay = document.getElementById('cbp-spmenu-overlay'),
body = document.body;
classie.addClass(body, 'cbp-spmenu-body');
$('#iqitmegamenu-shower').on("touchstart click", function (e) {
e.stopPropagation();
e.preventDefault();
classie.toggle(showLeftPush, 'active');
classie.toggle(body, 'cbp-spmenu-push-toright');
classie.toggle(menuLeft, 'cbp-spmenu-open');
classie.toggle(menuoverlay, 'cbp-spmenu-overlay-show');
});
$('#cbp-spmenu-overlay').on("touchstart click", function (e) {
e.stopPropagation();
e.preventDefault();
classie.toggle(this, 'active');
classie.toggle(body, 'cbp-spmenu-push-toright');
classie.toggle(menuLeft, 'cbp-spmenu-open');
classie.toggle(this, 'cbp-spmenu-overlay-show');
});
});
cbpPush();
});

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,146 @@
/*
jQuery autoComplete v1.0.7
Copyright (c) 2014 Simon Steinberger / Pixabay
GitHub: https://github.com/Pixabay/jQuery-autoComplete
License: http://www.opensource.org/licenses/mit-license.php
*/
(function($){
$.fn.autoCompleteIq = function(options){
var o = $.extend({}, $.fn.autoCompleteIq.defaults, options);
// public methods
if (typeof options == 'string') {
this.each(function(){
var that = $(this);
if (options == 'destroy') {
that.off('blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete');
if (that.data('autocomplete'))
that.attr('autocomplete', that.data('autocomplete'));
else
that.removeAttr('autocomplete');
$(that.data('sc')).remove();
that.removeData('sc').removeData('autocomplete');
}
});
return this;
}
return this.each(function(){
var that = $(this);
// sc = 'suggestions container'
that.sc = $('<div class="autocomplete-suggestions '+o.menuClass+'"></div>');
that.data('sc', that.sc).data('autocomplete', that.attr('autocomplete'));
that.attr('autocomplete', 'off');
that.cache = {};
that.last_val = '';
that.updateSC = function(resize, next){
that.sc.show();
};
that.sc.insertAfter(that.parent());
that.sc.on('mouseleave', '.autocomplete-suggestion', function (){
$('.autocomplete-suggestion.selected').removeClass('selected');
});
that.sc.on('mouseenter', '.autocomplete-suggestion', function (){
$('.autocomplete-suggestion.selected').removeClass('selected');
$(this).addClass('selected');
});
that.sc.on('mousedown click', '.autocomplete-suggestion', function (e){
var item = $(this), v = item.data('val');
if (v || item.hasClass('autocomplete-suggestion')) { // else outside click
that.val(v);
o.onSelect(e, v, item);
that.sc.hide();
}
return false;
});
that.on('blur.autocomplete', function(){
that.sc.hide();
});
if (!o.minChars) that.on('focus.autocomplete', function(){ that.last_val = '\n'; that.trigger('keyup.autocomplete'); });
function suggest(data){
var val = that.val();
that.cache[val] = data;
if (data.length && val.length >= o.minChars) {
var s = '';
for (var i=0;i<data.length;i++) s += o.renderItem(data[i], val);
that.sc.html(s);
that.updateSC(0);
}
else
that.sc.hide();
}
that.on('keydown.autocomplete', function(e){
// down (40), up (38)
if ((e.which == 40 || e.which == 38) && that.sc.html()) {
var next, sel = $('.autocomplete-suggestion.selected', that.sc);
if (!sel.length) {
next = (e.which == 40) ? $('.autocomplete-suggestion', that.sc).first() : $('.autocomplete-suggestion', that.sc).last();
that.val(next.addClass('selected').data('val'));
} else {
next = (e.which == 40) ? sel.next('.autocomplete-suggestion') : sel.prev('.autocomplete-suggestion');
if (next.length) { sel.removeClass('selected'); that.val(next.addClass('selected').data('val')); }
else { sel.removeClass('selected'); that.val(that.last_val); next = 0; }
}
that.updateSC(0, next);
return false;
}
// esc
else if (e.which == 27) that.val(that.last_val).sc.hide();
// enter or tab
else if (e.which == 13 || e.which == 9) {
var sel = $('.autocomplete-suggestion.selected', that.sc);
if (sel.length && that.sc.is(':visible')) { o.onSelect(e, sel.data('val'), sel); setTimeout(function(){ that.sc.hide(); }, 20); }
}
});
that.on('keyup.autocomplete', function(e){
if (!~$.inArray(e.which, [13, 27, 35, 36, 37, 38, 39, 40])) {
var val = that.val();
if (val.length >= o.minChars) {
if (val != that.last_val) {
that.last_val = val;
clearTimeout(that.timer);
if (o.cache) {
if (val in that.cache) { suggest(that.cache[val]); return; }
// no requests if previous suggestions were empty
for (var i=1; i<val.length-o.minChars; i++) {
var part = val.slice(0, val.length-i);
if (part in that.cache && !that.cache[part].length) { suggest([]); return; }
}
}
that.timer = setTimeout(function(){ o.source(val, suggest) }, o.delay);
}
} else {
that.last_val = val;
that.sc.hide();
}
}
});
});
}
$.fn.autoCompleteIq.defaults = {
source: 0,
minChars: 3,
delay: 150,
cache: 1,
menuClass: '',
renderItem: function (item, search){
// escape special characters
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
},
onSelect: function(e, term, item){}
};
}(jQuery));