first commit

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

View File

@@ -0,0 +1,259 @@
if (typeof(treeViewSetting) == 'undefined') {
var treeViewSetting = new Array();
}
function formatCategoryIdTreeView(category_id) {
if (typeof(category_id) != 'undefined' && category_id.indexOf("-") != -1)
category_id = category_id.substring(0, category_id.indexOf("-"));
return parseInt(category_id);
}
function loadTreeView(inputName, categoryRootId, selectedCategories, selectedLabel, home, use_radio) {
treeViewSetting[inputName] = new Array();
treeViewSetting[inputName]['categoryRootId'] = categoryRootId;
treeViewSetting[inputName]['selectedCategories'] = selectedCategories;
treeViewSetting[inputName]['selectedLabel'] = selectedLabel;
treeViewSetting[inputName]['readyToExpand'] = true;
treeViewSetting[inputName]['categoryBoxName'] = 'categoryBox[]';
treeViewSetting[inputName]['needCheckAll'] = false;
treeViewSetting[inputName]['needUncheckAll'] = false;
treeViewSetting[inputName]['arrayCatToExpand'] = new Array();
treeViewSetting[inputName]['id'] = 0;
treeViewSetting[inputName]['interval'] = null;
treeViewSetting[inputName]['home'] = home;
treeViewSetting[inputName]['use_radio'] = use_radio;
treeViewSetting[inputName]['selector'] = '#categories-treeview-'+inputName;
treeViewSetting[inputName]['selector'] = treeViewSetting[inputName]['selector'].replace('[', '').replace(']', '');
treeViewSetting[inputName]['inputNameSelector'] = inputName.replace('[', '').replace(']', '');
$(document).ready(function() {
$(treeViewSetting[inputName]['selector']).treeview({
inputNameValue: inputName,
inputNameSelector: inputName.replace('[', '').replace(']', ''),
categoryRootId: categoryRootId,
checkAllChildrenLabel: (typeof(checkAllChildrenLabel) != 'undefined' ? checkAllChildrenLabel : 'Check all children'),
selectedLabel: selectedLabel,
use_radio: use_radio,
url : _base_config_url+'&getPanel=getChildrenCategories',
toggle: function () { callbackToggle($(this), inputName); },
ajax : {
type: 'POST',
async: true,
data: { selectedCat: selectedCategories }
}
});
$(treeViewSetting[inputName]['selector'] + ' li#'+categoryRootId+'-'+treeViewSetting[inputName]['inputNameSelector']+' span').trigger('click');
$(treeViewSetting[inputName]['selector'] + ' li#'+categoryRootId+'-'+treeViewSetting[inputName]['inputNameSelector']).children('div').remove();
$(treeViewSetting[inputName]['selector'] + ' li#'+categoryRootId+'-'+treeViewSetting[inputName]['inputNameSelector']).
removeClass('collapsable lastCollapsable').
addClass('last static');
$('#expand_all-'+treeViewSetting[inputName]['inputNameSelector']).click( function () {
if ($(this).attr('rel') != '') treeViewSetting[inputName]['categoryBoxName'] = $(this).attr('rel');
expandAllCategories(inputName);
return false;
});
$('#collapse_all-'+treeViewSetting[inputName]['inputNameSelector']).click( function () {
if ($(this).attr('rel') != '') treeViewSetting[inputName]['categoryBoxName'] = $(this).attr('rel');
collapseAllCategories(inputName);
return false;
});
$('#check_all-'+treeViewSetting[inputName]['inputNameSelector']).click( function () {
if ($(this).attr('rel') != '') treeViewSetting[inputName]['categoryBoxName'] = $(this).attr('rel');
treeViewSetting[inputName]['needCheckAll'] = true;
checkAllCategories(inputName);
return false;
});
$('#uncheck_all-'+treeViewSetting[inputName]['inputNameSelector']).click( function () {
if ($(this).attr('rel') != '') treeViewSetting[inputName]['categoryBoxName'] = $(this).attr('rel');
treeViewSetting[inputName]['needUncheckAll'] = true;
uncheckAllCategories(inputName);
return false;
});
});
}
function callbackToggle(element, inputName) {
if (!element.is('.expandable'))
return false;
if (element.children('ul').children('li.collapsable').length != 0)
closeChildrenCategories(element, inputName);
}
function closeChildrenCategories(element, inputName) {
var arrayLevel = new Array();
if (element.children('ul').find('li.collapsable').length == 0) {
return false;
}
element.children('ul').find('li.collapsable').each(function() {
var level = $(this).children('span.category_level').html();
if (arrayLevel[level] == undefined)
arrayLevel[level] = new Array();
arrayLevel[level].push(formatCategoryIdTreeView($(this).attr('id')));
});
for(i=arrayLevel.length-1;i!=0;i--)
if (arrayLevel[i] != undefined)
for(j=0;j<arrayLevel[i].length;j++)
{
$('li#'+arrayLevel[i][j]+'-'+treeViewSetting[inputName]['inputNameSelector']+'.collapsable').children('span.category_label').trigger('click');
$('li#'+arrayLevel[i][j]+'-'+treeViewSetting[inputName]['inputNameSelector']+'.expandable').children('ul').hide();
}
}
function setCategoryToExpand(inputName) {
var ret = false;
treeViewSetting[inputName]['id'] = 0;
treeViewSetting[inputName]['arrayCatToExpand'] = new Array();
$(treeViewSetting[inputName]['selector'] + ' li.expandable:visible').each(function() {
treeViewSetting[inputName]['arrayCatToExpand'].push($(this).attr('id'));
ret = true;
});
return ret;
}
function needExpandAllCategories(inputName) {
return $(treeViewSetting[inputName]['selector'] + ' li').is('.expandable');
}
function expandAllCategories(inputName) {
// if no category to expand, no action
if (!needExpandAllCategories(inputName)) return;
// force to open main category
if ($('li#'+treeViewSetting[inputName]['categoryRootId']+'-'+treeViewSetting[inputName]['inputNameSelector']).is('.expandable'))
$('li#'+treeViewSetting[inputName]['categoryRootId']+'-'+treeViewSetting[inputName]['inputNameSelector']).children('span.folder').trigger('click');
treeViewSetting[inputName]['readyToExpand'] = true;
if (setCategoryToExpand(inputName)) {
treeViewSetting[inputName]['interval'] = setInterval('openCategory("'+inputName+'")', 10);
}
}
function openCategory(inputName) {
// Check readyToExpand in order to don't clearInterval if AJAX request is in progress
// readyToExpand = category has been expanded, go to next ;)
if (treeViewSetting[inputName]['id'] >= treeViewSetting[inputName]['arrayCatToExpand'].length && treeViewSetting[inputName]['readyToExpand']) {
if (!setCategoryToExpand(inputName)) {
clearInterval(treeViewSetting[inputName]['interval']);
// delete interval value
treeViewSetting[inputName]['interval'] = null;
treeViewSetting[inputName]['readyToExpand'] = false;
if (treeViewSetting[inputName]['needCheckAll']) {
checkAllCategories(inputName);
treeViewSetting[inputName]['needCheckAll'] = false;
}
else if (treeViewSetting[inputName]['needUncheckAll']) {
uncheckAllCategories(inputName);
treeViewSetting[inputName]['needUncheckAll'] = false;
}
}
else
treeViewSetting[inputName]['readyToExpand'] = true;
}
if (treeViewSetting[inputName]['readyToExpand']) {
if ($('li#'+treeViewSetting[inputName]['arrayCatToExpand'][treeViewSetting[inputName]['id']]+'.hasChildren').length > 0)
treeViewSetting[inputName]['readyToExpand'] = false;
$('li#'+treeViewSetting[inputName]['arrayCatToExpand'][treeViewSetting[inputName]['id']]+'.expandable:visible span.category_label').trigger('click');
treeViewSetting[inputName]['id']++;
}
}
function collapseAllCategories(inputName) {
closeChildrenCategories($('li#'+treeViewSetting[inputName]['categoryRootId']+'-'+treeViewSetting[inputName]['inputNameSelector']), inputName);
}
function checkAllCategories(inputName) {
if (needExpandAllCategories(inputName)) {
expandAllCategories(inputName);
} else {
$('input[name="'+treeViewSetting[inputName]['categoryBoxName']+'"]').not(':checked').each(function () {
$(this).attr('checked', 'checked');
clickOnCategoryBox($(this), inputName);
});
}
}
function uncheckAllCategories(inputName) {
if (needExpandAllCategories(inputName))
expandAllCategories(inputName);
else
{
$('input[name="'+treeViewSetting[inputName]['categoryBoxName']+'"]:checked').each(function () {
$(this).removeAttr('checked');
clickOnCategoryBox($(this), inputName);
});
}
}
function clickOnCategoryBox(category, inputName) {
if (category.is(':checked')) {
$('select#id_category_default').append('<option value="'+category.val()+'">'+(category.val() != treeViewSetting[inputName]['categoryRootId'] ? category.parent().find('span').html() : treeViewSetting[inputName]['home'])+'</option>');
updateNbSubCategorySelected(category, true, inputName);
if ($('select#id_category_default option').length > 0)
{
$('select#id_category_default').show();
$('#no_default_category').hide();
}
}
else
{
$('select#id_category_default option[value='+category.val()+']').remove();
updateNbSubCategorySelected(category, false, inputName);
if ($('select#id_category_default option').length == 0)
{
$('select#id_category_default').hide();
$('#no_default_category').show();
}
}
}
function updateNbSubCategorySelected(category, add, inputName) {
var currentSpan = category.parent().parent().parent().children('.nb_sub_cat_selected');
var parentNbSubCategorySelected = currentSpan.children('.nb_sub_cat_selected_value').html();
if (treeViewSetting[inputName]['use_radio']) {
$('.nb_sub_cat_selected').hide();
return false;
}
if (add)
var newValue = parseInt(parentNbSubCategorySelected)+1;
else
var newValue = parseInt(parentNbSubCategorySelected)-1;
currentSpan.children('.nb_sub_cat_selected_value').html(newValue);
currentSpan.children('.nb_sub_cat_selected_word').html(treeViewSetting[inputName]['selectedLabel']);
if (newValue == 0)
currentSpan.hide();
else
currentSpan.show();
if (currentSpan.parent().children('.nb_sub_cat_selected').length != 0)
updateNbSubCategorySelected(currentSpan.parent().children('input'), add, inputName);
}
function checkChildrenCategory(e, id_category, inputName) {
if($(e).attr('checked')) {
$('li#'+id_category+'-'+treeViewSetting[inputName]['inputNameSelector']+'.expandable:visible span.category_label').trigger('click');
treeViewSetting[inputName]['interval'] = setInterval(function() {
if($(e).parent('li').children('ul').children('li').children('input:not([value="undefined"]):not(.check_all_children)').length) {
$(e).parent('li').children('ul').children('li').children('input:not(.check_all_children)').attr('checked','checked');
clearInterval(treeViewSetting[inputName]['interval']);
}
}, 200);
}else {
$(e).parent('li').children('ul').children('li').children('input:not(.check_all_children)').attr('checked','');
}
}

View File

@@ -0,0 +1,985 @@
/**
*
* @author Presta-Module.com <support@presta-module.com>
* @copyright Presta-Module
*
****/
function deleteCriterionImg(id_criterion, id_search, id_lang) {
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=processDeleteCriterionImg&id_criterion=" + id_criterion + "&id_search=" + id_search + "&id_lang=" + id_lang,
dataType : "script",
error : function (XMLHttpRequest, textStatus, errorThrown) {
// alert("ERROR : " + errorThrown);
}
});
}
function displayHideBar(e) {
var itemType = $(e).val();
var itemName = $(e).attr("name");
if ($(e).is(":checked")) {
$("#hide_after_" + itemType).show("fast");
} else {
$("#hide_after_" + itemType).hide("fast");
}
saveCriterionsGroupSorting(itemType);
}
function saveCriterionsGroupSorting(id_search) {
var order = $("#searchTabContainer-" + id_search + " .connectedSortableIndex").sortable({
items: "> li",
axis: "y",
}).sortable("toArray");
var auto_hide = $("#searchTabContainer-" + id_search + " input[name=auto_hide]").is(":checked");
saveOrder(order.join(","), "orderCriterionGroup", id_search, auto_hide);
}
function showRelatedOptions(e, groupType) {
var itemType = $(e).val();
var itemName = $(e).attr("name");
var allowCombineCriterions = true;
var isColorGroup = false;
if ($('#display_type option[value=7]').size() > 0) {
isColorGroup = true;
}
// Init items display status
$('#display_type-menu li').show();
$('.blc_range, .blc_range_nb, .blc_range_interval, .blc_range_sign, .multicrit, .combined_criterion, .max_display_container, .overflow_height_container, .blc_with_search_area, .all_label, .blc_category_tree_options').hide();
if (groupType != 'attribute' && groupType != 'feature' && groupType != 'price' && groupType != 'depth' && groupType != 'height' && groupType != 'width' & groupType != 'weight') {
$('#display_type option[value=5]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type option[value=8]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type').pm_selectMenu();
}
if (groupType == 'category' || groupType == 'subcategory' || groupType == 'manufacturer' || groupType == 'supplier') {
if ($("#range_on:checked").length) {
$("#range_off").attr('checked', 'checked');
}
$(".multicrit, .combined_criterion").show();
}
if (groupType == 'price') {
$('#display_type option[value=2]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type').pm_selectMenu();
if (itemType != "5" && $("#range_off:checked").length) {
$("#range_on").attr('checked', 'checked');
}
}
if (groupType == 'online_only' || groupType == 'pack' || groupType == 'on_sale' || groupType == 'available_for_order' || groupType == 'stock' || groupType == 'new_products' || groupType == 'prices_drop') {
$('#display_type option[value=2]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type').pm_selectMenu();
}
switch (itemType) {
// Select
case '1':
if (groupType == 'price') {
$('.blc_range_interval, .max_display_container, .overflow_height_container').show();
} else if (groupType == 'category' || groupType == 'subcategory' || groupType == 'manufacturer' || groupType == 'supplier' || groupType == 'on_sale' || groupType == 'condition' || groupType == 'online_only' || groupType == 'available_for_order' || groupType == 'stock' || groupType == 'new_products' || groupType == 'prices_drop' || groupType == 'pack') {
$('.max_display_container, .overflow_height_container, .blc_with_search_area').show();
} else {
$('.blc_range, .blc_range_interval, .blc_range_sign, .max_display_container, .overflow_height_container, .blc_with_search_area, .all_label').show();
}
if ($('.blc_category_options').length) {
$('.blc_category_options').show();
}
$('.sort_criteria_container, .custom_criteria_container').show();
$(".multicrit, .combined_criterion").show();
break;
// Image
case '2':
if ($("#range_on:checked").length) {
$("#range_off").attr('checked', 'checked');
}
$(".multicrit, .max_display_container, .overflow_height_container, .combined_criterion").show();
if ($('.blc_category_options').length) {
$('.blc_category_options').show();
}
$('.sort_criteria_container, .custom_criteria_container').show();
break;
// Link
case '3':
$(".multicrit, .max_display_container, .overflow_height_container, .combined_criterion").show();
// Checkbox
case '4':
$(".multicrit, .combined_criterion").show();
if (groupType == 'price') {
$('.blc_range_interval, .max_display_container, .overflow_height_container').show();
} else if (groupType == 'category' || groupType == 'subcategory' || groupType == 'manufacturer' || groupType == 'supplier' || groupType == 'on_sale' || groupType == 'condition' || groupType == 'online_only' || groupType == 'available_for_order' || groupType == 'stock' || groupType == 'new_products' || groupType == 'prices_drop' || groupType == 'pack') {
$('.max_display_container, .overflow_height_container').show();
} else {
$('.blc_range, .blc_range_interval, .blc_range_sign, .max_display_container, .overflow_height_container').show();
}
if ($('.blc_category_options').length) {
$('.blc_category_options').show();
}
$('.sort_criteria_container, .custom_criteria_container').show();
break;
// Cursor, Slider
case '5':
$(".blc_range_nb").show();
if (groupType != 'price') {
$(".blc_range_sign").show();
}
if ($("#range_on:checked").length) {
$("#range_off").attr('checked', 'checked');
}
if ($('.blc_category_options').length) {
$('.blc_category_options').show();
}
$('.sort_criteria_container, .custom_criteria_container').show();
break;
// Reserved
case '6':
break;
// Color square
case '7':
$(".multicrit, .max_display_container, .overflow_height_container, .combined_criterion").show();
$('.sort_criteria_container, .custom_criteria_container').show();
break;
// Ranges
case '8':
$(".blc_range_nb").show();
if (groupType != 'price') $(".blc_range_sign").show();
if ($("#range_on:checked").length) {
$("#range_off").attr('checked', 'checked');
}
if ($('.blc_category_options').length) {
$('.blc_category_options').show();
}
$('.sort_criteria_container, .custom_criteria_container').show();
break;
// Level Depth
case '9':
$('.blc_category_tree_options').show();
$('.blc_category_options').hide();
$('.sort_criteria_container, .custom_criteria_container').hide();
$('.multicrit').hide();
$('.combined_criterion').hide();
$("#show_all_depth_on").attr('checked', 'checked');
$("#show_all_depth_off").removeAttr('checked');
$("#is_multicriteria_off").attr('checked', 'checked');
$("#is_multicriteria_on").removeAttr('checked');
$("#is_combined_off").attr('checked', 'checked');
$("#is_combined_on").removeAttr('checked');
allowCombineCriterions = false;
// @todo: better way for this
reorderCriteria('position', 'ASC', $('input[name=id_criterion_group').val(), $('input[name=id_search').val());
break;
}
if (groupType == 'on_sale' || groupType == 'condition' || groupType == 'online_only' || groupType == 'available_for_order' || groupType == 'stock' || groupType == 'new_products' || groupType == 'prices_drop' || groupType == 'pack') {
$(".combined_criterion").hide();
allowCombineCriterions = false;
}
if (allowCombineCriterions && $("#is_multicriteria_on:checked").length) {
$(".combined_criterion").show();
} else {
$(".combined_criterion").hide();
$("#is_combined_off").attr('checked', 'checked');
$("#is_combined_on").removeAttr('checked');
}
if (itemType == 1) {
$('.max_display_container, .overflow_height_container').hide();
if ($("#is_multicriteria_on:checked").length) {
$(".blc_with_search_area").hide();
$(".all_label").hide();
} else {
$(".blc_with_search_area").show();
$(".all_label").show();
}
}
// Reset change items
if ($("#range_on:checked").length) {
if (groupType != 'price') {
$(".blc_range_interval, .blc_range_sign").show();
} else {
$(".blc_range_interval").show();
$(".blc_range_sign").hide();
}
} else {
if (itemType != 5 && itemType != 8) {
$(".blc_range_interval, .blc_range_sign").hide();
}
}
if (isColorGroup) {
if ($("#range_on:checked").length) {
$("#range_off").attr('checked', 'checked');
}
$('.blc_range, .blc_range_nb, .blc_range_interval, .blc_range_sign').hide();
$('#display_type option[value=5]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type option[value=8]').removeAttr('selected').attr('disabled', 'disabled');
$('#display_type').pm_selectMenu();
}
}
function displayRangeOptions(e, groupType) {
var valRange = parseInt($(e).val());
if (valRange) {
$(".blc_range_interval, .blc_range_sign").slideDown("fast");
$('#display_type-menu li').show();
$('#display_type-menu li.display_type-5').hide();
if ($('#display_type').val() == 5) {
$('#display_type').val(1);
}
$('#display_type').trigger('click');
} else {
$(".blc_range_interval, .blc_range_sign").slideUp("fast");
$('#display_type-menu li.display_type-5').show();
}
}
function convertToPointDecimal(e) {
var valRange = $(e).val();
valRange = valRange.replace(/,/g, ".");
valRange = parseFloat(valRange);
if (isNaN(valRange)) {
valRange = 0;
}
$(e).val(valRange);
}
var original_search_results_selector = false;
function updateHookOptions(e, hookIds) {
defaultSearchResultsSelector = $('#blc_search_results_selector').data('default-selector');
if (!original_search_results_selector && $('#search_results_selector').val() != '#as_home_content_results' && $('#search_results_selector').val() != '#as_custom_content_results') {
original_search_results_selector = $('#search_results_selector').val();
} else if (!original_search_results_selector && ($('#search_results_selector').val() == '#as_home_content_results' || $('#search_results_selector').val() == '#as_custom_content_results')) {
original_search_results_selector = defaultSearchResultsSelector;
}
var current_search_results_selector = $('#search_results_selector').val();
var selectedHook = $(e).val();
var selectedHookLabel = typeof(hookIds[selectedHook]) != 'undefined' ? hookIds[selectedHook] : selectedHook;
$('.hookOptions').slideUp('fast');
//Hide content selector if hook home
if (selectedHookLabel == 'displayhome') {
$('#blc_search_results_selector').hide();
$('#search_results_selector').val('#as_home_content_results');
$('.hookOption-' + selectedHook).slideDown('fast');
} else if (selectedHook < 0) {
$("#custom_content_area_results").show();
$('.hookOption' + selectedHook).slideDown('fast');
displayRelatedSmartyVarOptions();
} else {
if (selectedHook >= 0 || !parseInt($("input[name=insert_in_center_column]").val())) {
$('#blc_search_results_selector').show();
}
if (original_search_results_selector == defaultSearchResultsSelector || current_search_results_selector == '#as_home_content_results' || current_search_results_selector == '#as_custom_content_results') {
$('#search_results_selector').val(original_search_results_selector);
}
if (selectedHookLabel == 'Advanced Top Menu') {
selectedHookLabel = 'ATM';
$('.fieldsetAssociations').hide();
} else {
$('.fieldsetAssociations').show();
}
$('.hookOption-' + selectedHook).slideDown('fast');
}
}
function setCriterionGroupActions(key_criterions_group, show) {
$('#' + key_criterions_group).append(
'<div class="blocCriterionGroupActions">' +
'<a title="' + editTranlate + '" ' + (typeof(show) == 'undefined' ? 'style="display:none;"' : '') + ' class="getCriterionGroupActions" id="action-' + key_criterions_group + '"><span class="ui-icon ui-icon-gear"></span></a>' +
'<a title="' + deleteTranlate + '" ' + (typeof(show) == 'undefined' ? 'style="display:none;"' : '') + ' class="getCriterionGroupActions" id="delete-' + key_criterions_group + '"><span class="ui-icon ui-icon-trash"></span></a>' +
'</div>'
);
if (typeof(show) == 'undefined') {
$("#action-" + key_criterions_group).fadeIn("fast");
$("#delete-" + key_criterions_group).fadeIn("fast");
}
$("#delete-" + key_criterions_group).click(function () {
deleteCriterion($('li#' + key_criterions_group));
});
$("#action-" + key_criterions_group).click(function () {
var id_criterion_group = $('#' + key_criterions_group).attr('rel');
var id_search = $('#' + key_criterions_group).children('input[name=id_search]').val();
openDialogIframe(_base_config_url + "&id_search=" + id_search + "&pm_load_function=displayCriterionGroupForm&class=AdvancedSearchCriterionGroupClass&id_criterion_group=" + id_criterion_group, 980, 540, 1);
});
}
function getCriterionGroupActions(key_criterions_group, refresh) {
if ((typeof(refresh) == 'undefined') && $('#' + key_criterions_group + ' .blocCriterionGroupActions div').length) {
if ($('#' + key_criterions_group + ' .blocCriterionGroupActions:visible').length) {
$('#' + key_criterions_group + ' .blocCriterionGroupActions').slideUp('slow');
} else {
$('#' + key_criterions_group + ' .blocCriterionGroupActions').slideDown('slow');
}
}
return;
}
function saveOrder(order, actionType, curId_search, auto_hide) {
$.post(_base_config_url, {
action : actionType,
order : order,
id_search : curId_search,
auto_hide : auto_hide
}, function (data) {
parent.show_info(data);
});
}
function receiveCriteria(item) {
var curAction = $(item).parent("ul").parent("div").attr("id");
if (curAction == "DesindexCriterionsGroup") {
$(item).children(".blocCriterionGroupActions").remove();
}
if (curAction == "DesindexCriterionsGroup" && $(item).data('id-criterion-group-type') == 'category') {
$(item).hide();
}
$(item).append("<div class='loadingOnConnectList'><img src='" + _modulePath + "views/img/snake_transparent.gif' /></div>");
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=process" + curAction + "&id_employee=" + _id_employee + "&key_criterions_group=" + $(item).attr("id"),
dataType : "script",
complete: function (data, textStatus, errorThrown) {
addDeleteInProgress = false;
if (curAction == "DesindexCriterionsGroup" && $(item).data('id-criterion-group-type') == 'category') {
$(item).remove();
}
$('ul.connectedSortable li.ui-state-disabled').toggleClass('ui-state-disabled');
}
});
}
var addDeleteInProgress = false;
function addCriterion(item) {
if (!addDeleteInProgress) {
addDeleteInProgress = true;
parentTab = '#' + $(item).parents('.ui-tabs-panel').attr('id');
removeAfter = true;
if ($(item).data('id-criterion-group-type') == 'category') {
removeAfter = false;
}
$('.availableCriterionGroups ul li').toggleClass('ui-state-disabled');
$(item).animateAppendTo($(parentTab + ' #IndexCriterionsGroup ul'), 600, removeAfter, function(originalItem, newItem) {
receiveCriteria(newItem);
});
}
}
function deleteCriterion(item) {
if (!addDeleteInProgress) {
if (confirm(alertDeleteCriterionGroup)) {
addDeleteInProgress = true;
parentTab = '#' + $(item).parents('.ui-tabs-panel').attr('id');
$('.indexedCriterionGroups ul li').toggleClass('ui-state-disabled');
$(item).animateAppendTo($(parentTab + ' ul.availableCriterionGroups-' + $(item).data('id-criterion-group-unit')), 600, true, function(originalItem, newItem) {
receiveCriteria(newItem);
});
}
}
}
function loadTabPanel(tabPanelId, li) {
var indexTab = $(li).index();
$(li + ' a').trigger('click');
$(tabPanelId).tabs("load", indexTab);
}
function updateSearchNameIntoTab(tabPanelId, newName) {
$(tabPanelId + ' a').html(newName);
}
function updateCriterionGroupName(criterionGroupId, newName) {
$('ul.connectedSortable li[rel="' + criterionGroupId + '"] .as4-criterion-group-name').html(newName);
}
function addTabPanel(tabPanelId, label, id_search, load_after) {
$("#msgNoResults").hide();
if (typeof(load_after) != 'undefined' && load_after == true) {
$(tabPanelId).unbind("tabsadd").bind("tabsadd", function (event, ui) {
$(tabPanelId).tabs('select', '#' + ui.panel.id);
});
}
$(tabPanelId + ' > ul').append('<li id="TabSearchAdminPanel' + id_search + '"><a href="' + _base_config_url + '&pm_load_function=displaySearchAdminPanel&id_search=' + id_search + '">' + label + '</a></li>');
$(tabPanelId).append('<div id="TabSearchAdminPanel' + id_search + '"></div>');
$(tabPanelId).tabs('refresh');
}
function removeTabPanel(tabPanelId, li, ul) {
var indexTab = $(li).index();
$(li).remove();
$(tabPanelId + ' div#ui-tabs-' + indexTab).remove();
$(tabPanelId).tabs('refresh');
}
var defaultValueSubmit = false;
function showRequest(formData, jqForm, options) {
var btn_submit = $(jqForm).find('input[type=submit]');
defaultValueSubmit = $(btn_submit).attr('value');
$(btn_submit).attr('disabled', 'disabled');
$(btn_submit).attr('value', msgWait);
return true;
}
// post-submit callback
function showResponse(responseText, statusText, xhr, $form) {
var btn_submit = $form.find('input[type=submit]');
if (defaultValueSubmit) {
$(btn_submit).removeAttr('disabled');
$(btn_submit).attr('value', defaultValueSubmit);
defaultValueSubmit = false;
}
}
function removeSelectedSeoCriterion(e) {
var curId = $(e).parent('li').attr('rel').replace(/(~)/g, "\\$1");
$('#' + curId).fadeIn('fast');
$('#bis' + curId).remove();
seoSearchCriteriaUpdate();
}
function seoSearchCriteriaUpdate() {
var order = $("#seoSearchPanelCriteriaSelected ul").sortable("toArray");
$("#posted_id_currency").val($("#id_currency").val());
$("#seoSearchCriteriaInput").val(order);
checkSeoCriteriaCombination();
}
var id_currency = 0;
function massSeoSearchCriteriaGroupUpdate() {
var order = $("#seoMassSearchPanelCriteriaGroupsTabs ul").sortable("toArray");
$("#posted_id_currency").val($("#id_currency").val());
$("#massSeoSearchCriterionGroupsInput").val(order);
id_currency = $("#id_currency").val();
}
function fillSeoFields() {
var criteria = $("#seoSearchPanelCriteriaSelected ul").sortable("toArray");
if (criteria == '') {
show_info(msgNoSeoCriterion);
return;
}
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=processFillSeoFields&criteria=" + $("#seoSearchCriteriaInput").val() + "&id_search=" + $("#id_search").val() + "&id_currency=" + id_currency,
dataType : "script",
error : function (XMLHttpRequest, textStatus, errorThrown) {
// alert("ERROR : " + errorThrown);
}
});
}
function checkChildrenCheckbox(e) {
if (fromMassAction) {
if ($(e).children('input[type=checkbox]:checked').length) {
$(e).children('input[type=checkbox]').prop('checked', allCriterionEnable);
} else {
$(e).children('input[type=checkbox]').prop('checked', allCriterionEnable);
}
} else {
if ($(e).children('input[type=checkbox]:checked').length) {
$(e).children('input[type=checkbox]').prop('checked', false);
} else {
$(e).children('input[type=checkbox]').prop('checked', true);
}
}
}
function unCheckAllChildrenCheckbox(e) {
$(e).find('input[type=checkbox]').removeAttr('checked');
}
var allCriterionEnable = false;
var fromMassAction = false;
function enableAllCriterion4MassSeo(e) {
allCriterionEnable = !allCriterionEnable;
var parentDiv = $(e).parent('div');
var id_criterion_group = $(parentDiv).children('input[name=id_criterion_group]').val();
if (!$('#criterion_group_' + id_criterion_group + ':visible').length && $('.seoSearchCriterionGroupSortable:visible').length >= 3) {
unCheckAllChildrenCheckbox(parentDiv);
alert(msgMaxCriteriaForMass);
return false;
}
fromMassAction = true;
$(parentDiv).find('li.massSeoSearchCriterion').trigger('click');
fromMassAction = false;
}
function enableCriterion4MassSeo(e) {
checkChildrenCheckbox(e, true);
var parentDiv = $(e).parent('ul').parent('div');
var id_criterion_group = $(parentDiv).children('input[name=id_criterion_group]').val();
if ($(parentDiv).find('input[type=checkbox]:checked').length) {
if ($(e).children('input[type=checkbox]:checked').length) {
if (!$('#criterion_group_' + id_criterion_group + ':visible').length) {
if ($('.seoSearchCriterionGroupSortable:visible').length >= 3) {
unCheckAllChildrenCheckbox(parentDiv);
alert(msgMaxCriteriaForMass);
return false;
}
$('#criterion_group_' + id_criterion_group).removeClass('ui-state-disabled').fadeIn('fast');
$('#seoMassSearchPanelCriteriaGroupsTabs ul').sortable('refresh');
massSeoSearchCriteriaGroupUpdate();
}
}
} else {
$('#criterion_group_' + id_criterion_group).addClass('ui-state-disabled').fadeOut('fast');
$('#seoMassSearchPanelCriteriaGroupsTabs ul').sortable('refresh');
massSeoSearchCriteriaGroupUpdate();
}
}
function checkSeoCriteriaCombination() {
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=checkSeoCriteriaCombination&criteria=" + $("#seoSearchCriteriaInput").val() + "&id_search=" + $("#id_search").val() + "&id_currency=" + $("#posted_id_currency").val(),
dataType : "script",
error : function (XMLHttpRequest, textStatus, errorThrown) {
// alert("ERROR : " + errorThrown);
}
});
}
function ASStr2url(e) {
if (typeof str2url == 'function')
return str2url($(e).val(), 'UTF-8');
str = $(e).val();
// From admin.js - 1.6.1.0
if (typeof(PS_ALLOW_ACCENTED_CHARS_URL) != 'undefined' && PS_ALLOW_ACCENTED_CHARS_URL) {
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]\\u00A1-\\uFFFF/g,'');
} else {
/* Lowercase */
str = str.replace(/[\u00E0\u00E1\u00E2\u00E3\u00E5\u0101\u0103\u0105\u0430]/g, 'a');
str = str.replace(/[\u0431]/g, 'b');
str = str.replace(/[\u00E7\u0107\u0109\u010D\u0446]/g, 'c');
str = str.replace(/[\u010F\u0111\u0434]/g, 'd');
str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u0113\u0115\u0117\u0119\u011B\u0435\u044D]/g, 'e');
str = str.replace(/[\u0444]/g, 'f');
str = str.replace(/[\u011F\u0121\u0123\u0433\u0491]/g, 'g');
str = str.replace(/[\u0125\u0127]/g, 'h');
str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u0129\u012B\u012D\u012F\u0131\u0438\u0456]/g, 'i');
str = str.replace(/[\u0135\u0439]/g, 'j');
str = str.replace(/[\u0137\u0138\u043A]/g, 'k');
str = str.replace(/[\u013A\u013C\u013E\u0140\u0142\u043B]/g, 'l');
str = str.replace(/[\u043C]/g, 'm');
str = str.replace(/[\u00F1\u0144\u0146\u0148\u0149\u014B\u043D]/g, 'n');
str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F8\u014D\u014F\u0151\u043E]/g, 'o');
str = str.replace(/[\u043F]/g, 'p');
str = str.replace(/[\u0155\u0157\u0159\u0440]/g, 'r');
str = str.replace(/[\u015B\u015D\u015F\u0161\u0441]/g, 's');
str = str.replace(/[\u00DF]/g, 'ss');
str = str.replace(/[\u0163\u0165\u0167\u0442]/g, 't');
str = str.replace(/[\u00F9\u00FA\u00FB\u0169\u016B\u016D\u016F\u0171\u0173\u0443]/g, 'u');
str = str.replace(/[\u0432]/g, 'v');
str = str.replace(/[\u0175]/g, 'w');
str = str.replace(/[\u00FF\u0177\u00FD\u044B]/g, 'y');
str = str.replace(/[\u017A\u017C\u017E\u0437]/g, 'z');
str = str.replace(/[\u00E4\u00E6]/g, 'ae');
str = str.replace(/[\u0447]/g, 'ch');
str = str.replace(/[\u0445]/g, 'kh');
str = str.replace(/[\u0153\u00F6]/g, 'oe');
str = str.replace(/[\u00FC]/g, 'ue');
str = str.replace(/[\u0448]/g, 'sh');
str = str.replace(/[\u0449]/g, 'ssh');
str = str.replace(/[\u044F]/g, 'ya');
str = str.replace(/[\u0454]/g, 'ye');
str = str.replace(/[\u0457]/g, 'yi');
str = str.replace(/[\u0451]/g, 'yo');
str = str.replace(/[\u044E]/g, 'yu');
str = str.replace(/[\u0436]/g, 'zh');
/* Uppercase */
str = str.replace(/[\u0100\u0102\u0104\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u0410]/g, 'A');
str = str.replace(/[\u0411]/g, 'B');
str = str.replace(/[\u00C7\u0106\u0108\u010A\u010C\u0426]/g, 'C');
str = str.replace(/[\u010E\u0110\u0414]/g, 'D');
str = str.replace(/[\u00C8\u00C9\u00CA\u00CB\u0112\u0114\u0116\u0118\u011A\u0415\u042D]/g, 'E');
str = str.replace(/[\u0424]/g, 'F');
str = str.replace(/[\u011C\u011E\u0120\u0122\u0413\u0490]/g, 'G');
str = str.replace(/[\u0124\u0126]/g, 'H');
str = str.replace(/[\u0128\u012A\u012C\u012E\u0130\u0418\u0406]/g, 'I');
str = str.replace(/[\u0134\u0419]/g, 'J');
str = str.replace(/[\u0136\u041A]/g, 'K');
str = str.replace(/[\u0139\u013B\u013D\u0139\u0141\u041B]/g, 'L');
str = str.replace(/[\u041C]/g, 'M');
str = str.replace(/[\u00D1\u0143\u0145\u0147\u014A\u041D]/g, 'N');
str = str.replace(/[\u00D3\u014C\u014E\u0150\u041E]/g, 'O');
str = str.replace(/[\u041F]/g, 'P');
str = str.replace(/[\u0154\u0156\u0158\u0420]/g, 'R');
str = str.replace(/[\u015A\u015C\u015E\u0160\u0421]/g, 'S');
str = str.replace(/[\u0162\u0164\u0166\u0422]/g, 'T');
str = str.replace(/[\u00D9\u00DA\u00DB\u0168\u016A\u016C\u016E\u0170\u0172\u0423]/g, 'U');
str = str.replace(/[\u0412]/g, 'V');
str = str.replace(/[\u0174]/g, 'W');
str = str.replace(/[\u0176\u042B]/g, 'Y');
str = str.replace(/[\u0179\u017B\u017D\u0417]/g, 'Z');
str = str.replace(/[\u00C4\u00C6]/g, 'AE');
str = str.replace(/[\u0427]/g, 'CH');
str = str.replace(/[\u0425]/g, 'KH');
str = str.replace(/[\u0152\u00D6]/g, 'OE');
str = str.replace(/[\u00DC]/g, 'UE');
str = str.replace(/[\u0428]/g, 'SH');
str = str.replace(/[\u0429]/g, 'SHH');
str = str.replace(/[\u042F]/g, 'YA');
str = str.replace(/[\u0404]/g, 'YE');
str = str.replace(/[\u0407]/g, 'YI');
str = str.replace(/[\u0401]/g, 'YO');
str = str.replace(/[\u042E]/g, 'YU');
str = str.replace(/[\u0416]/g, 'ZH');
str = str.toLowerCase();
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]/g,'');
}
str = str.replace(/[\u0028\u0029\u0021\u003F\u002E\u0026\u005E\u007E\u002B\u002A\u002F\u003A\u003B\u003C\u003D\u003E]/g, '');
str = str.replace(/[\s\'\:\/\[\]-]+/g, ' ');
// Add special char not used for url rewrite
str = str.replace(/[ ]/g, '-');
str = str.replace(/[\/\\"'|,;%]*/g, '');
// From admin.js - 1.6.1.0
$(e).val(str)
return true;
}
function displayRelatedFilterByEmplacementOptions() {
if (parseInt($('select[name="filter_by_emplacement"]').val())) {
$('div.id_category_root_container').show();
} else {
$('div.id_category_root_container').hide();
}
}
function displayRelatedSmartyVarOptions() {
defaultSearchResultsSelector = $('#blc_search_results_selector').data('default-selector');
if (parseInt($("input[name=insert_in_center_column]:checked").val())) {
$("#custom_content_area_results").show();
$("#blc_search_results_selector").hide();
$("#search_results_selector").val("#as_custom_content_results");
} else {
$("#custom_content_area_results").hide();
$("#blc_search_results_selector").show();
if ($("#search_results_selector").val() == '' || $("#search_results_selector").val() == '#as_home_content_results' || $("#search_results_selector").val() == '#as_custom_content_results') {
$("#search_results_selector").val(defaultSearchResultsSelector);
}
}
updateSmartyVarNamePicker();
}
function updateSmartyVarNamePicker() {
if ($("#smarty_var_name").size() > 0) {
var smartyVarName = $("#smarty_var_name").val();
$("#smarty_var_name_picker").html(
'{* Advanced Search 4 - Start of custom search variable *}'
+ "\n" + '{if isset($' + smartyVarName + ')}' + '{$' + smartyVarName + '}'
+ ($('input[name="insert_in_center_column"]:checked').val() == 1 ? '&lt;div id="as_custom_content_results"&gt;&lt;/div&gt;' : '')
+ '{/if}'
+ "\n" + '{* /Advanced Search 4 - End of custom search variable *}'
);
}
}
function selectText(element) {
var doc = document;
var text = doc.getElementById(element);
if (doc.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
if (selection.setBaseAndExtent) {
selection.setBaseAndExtent(text, 0, text, 1);
} else {
var range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
}
var checkAllState = true;
function checkAllSeoItems(id_search) {
$('#dataTable' + id_search + ' input[name="seo_group_action[]"]').prop('checked', checkAllState);
checkAllState = !checkAllState;
}
function deleteSeoItems(id_search) {
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=processDeleteMassSeo&id_search=" + id_search + '&' + $('#dataTable' + id_search + ' input[name="seo_group_action[]"]:checked').serialize(),
dataType : "script",
error : function (XMLHttpRequest, textStatus, errorThrown) {}
});
}
function reorderCriteria(sort_by, sort_way, id_criterion_group, id_search) {
$('#sortCriteriaPanel').load(_base_config_url + "&pm_load_function=displaySortCriteriaPanel&id_criterion_group=" + id_criterion_group + '&sort_by=' + sort_by + '&sort_way=' + sort_way + '&id_search=' + id_search);
}
function display_cat_picker() {
var val = parseInt($('input[name="bool_cat"]:checked').val());
if (val) {
$('#category_picker').show('medium');
} else {
$('#category_picker').hide('medium');
}
}
function display_cat_prod_picker() {
var val = parseInt($('input[name="bool_cat_prod"]:checked').val());
if (val) {
$('#category_product_picker').show('medium');
} else {
$('#category_product_picker').hide('medium');
}
}
function display_prod_picker() {
var val = parseInt($('input[name="bool_prod"]:checked').val());
if (val) {
$('#product_picker').show('medium');
} else {
$('#product_picker').hide('medium');
}
}
function display_manu_picker() {
var val = parseInt($('input[name="bool_manu"]:checked').val());
if (val) {
$('#manu_picker').show('medium');
} else {
$('#manu_picker').hide('medium');
}
}
function display_supp_picker() {
var val = parseInt($('input[name="bool_supp"]:checked').val());
if (val) {
$('#supp_picker').show('medium');
} else {
$('#supp_picker').hide('medium');
}
}
function display_cms_picker() {
var val = parseInt($('input[name="bool_cms"]:checked').val());
if (val) {
$('#cms_picker').show('medium');
} else {
$('#cms_picker').hide('medium');
}
}
function display_spe_picker() {
var val = parseInt($('input[name="bool_spe"]:checked').val());
if (val) {
$('#special_pages').show('medium');
} else {
$('#special_pages').hide('medium');
}
}
function toggleSearchEngineSettings(realChange) {
var searchType = parseInt($('select[name="search_type"]').val());
if (searchType == 0) {
// Classic
$('input[name="step_search"]').val(0);
$('.enabled-option-step-search').hide('medium');
// Only apply presets if value is changed from the select
if (realChange == true) {
$('select[name="filter_by_emplacement"]').val(1).trigger("change").trigger("chosen:updated");
}
$('select[name="search_method"] option[value="3"]').removeAttr('selected').attr('disabled', 'disabled').hide();
$('select[name="search_method"]').trigger("change").trigger("chosen:updated");
} else if (searchType == 1) {
// Global
$('input[name="step_search"]').val(0);
$('.enabled-option-step-search').hide('medium');
// Only apply presets if value is changed from the select
if (realChange == true) {
$('select[name="filter_by_emplacement"]').val(0).trigger("change").trigger("chosen:updated");
}
$('select[name="search_method"] option[value="3"]').removeAttr('selected').attr('disabled', 'disabled').hide();
$('select[name="search_method"]').trigger("change").trigger("chosen:updated");
} else if (searchType == 2) {
// Step by step
$('input[name="step_search"]').val(1);
$('.enabled-option-step-search').show('medium');
// Only apply presets if value is changed from the select
if (realChange == true) {
$('input[name="hide_empty_crit_group"][value=0]').attr('checked', 'checked');
$('input[name="hide_criterions_group_with_no_effect"][value=0]').attr('checked', 'checked');
$('input[name="display_empty_criteria"][value=0]').attr('checked', 'checked');
$('input[name="step_search_next_in_disabled"][value=0]').attr('checked', 'checked');
$('select[name="filter_by_emplacement"]').val(0).trigger("change").trigger("chosen:updated");
}
$('select[name="search_method"] option[value=3]').removeAttr('disabled').show();
$('select[name="search_method"]').trigger("change").trigger("chosen:updated");
}
var stepSearch = parseInt($('input[name="step_search"]').val());
var displayEmptyCriterion = parseInt($('input[name="display_empty_criteria"]:checked').val());
$('select[name="search_method"] option').removeAttr('disabled');
$('select[name="search_method"]').trigger('change').trigger("chosen:updated");
if (displayEmptyCriterion) {
$('.hide-empty-criterion-group').hide('medium');
} else {
$('.hide-empty-criterion-group').show('medium');
}
}
function display_search_method_options() {
var val = parseInt($('select[name="search_method"]').val());
if (val == 2) {
$('.search_method_options_1').hide('medium');
$('.search_method_options_2').show('medium');
} else {
$('.search_method_options_1').show('medium');
$('.search_method_options_2').hide('medium');
}
}
var currentCriteriaGroupIndex = 0;
var prevCriteriaGroupIndex = -1;
var reindexation_in_progress = false;
function reindexSearchCriterionGroups(e, criterionGroups, wrapperProgress) {
if (reindexation_in_progress) {
alert(reindexationInprogressMsg);
return;
}
reindexation_in_progress = true;
var nbCriteriaGroupsTotal = criterionGroups.length;
var nbCriteriaGroupsReindexed = 0;
$('.progressbarReindexSpecificSearch').css('display', 'inline-block');
$(e).hide();
var reindexationInterval = setInterval(function () {
if (typeof(criterionGroups[currentCriteriaGroupIndex]) != 'undefined' && currentCriteriaGroupIndex != prevCriteriaGroupIndex) {
// Reindexation in progress
prevCriteriaGroupIndex++;
$(wrapperProgress).progressbar({
value : Math.round((currentCriteriaGroupIndex * 100) / nbCriteriaGroupsTotal)
});
$(wrapperProgress).next('.progressbarpercent').html(reindexingCriteriaMsg + ' ' + currentCriteriaGroupIndex + ' ' + reindexingCriteriaOfMsg + ' ' + nbCriteriaGroupsTotal + ' (' + Math.round((currentCriteriaGroupIndex * 100) / nbCriteriaGroupsTotal) + '%)');
reindexSearchCritriaGroup(criterionGroups[currentCriteriaGroupIndex].id_criterion_group, criterionGroups[currentCriteriaGroupIndex].id_search);
} else if (typeof(criterionGroups[currentCriteriaGroupIndex]) == 'undefined') {
// Reindexation done
$(wrapperProgress).progressbar({
value : 100
});
clearInterval(reindexationInterval);
$(e).show();
$(wrapperProgress).next('.progressbarpercent').text("");
$(wrapperProgress).progressbar("destroy");
$('.progressbarReindexSpecificSearch').hide();
currentCriteriaGroupIndex = 0;
prevCriteriaGroupIndex = -1;
reindexation_in_progress = false;
}
}, 500);
}
function reindexSearchCritriaGroup(id_criterion_group, id_search) {
$.ajax({
type : "GET",
url : _base_config_url + "&pm_load_function=reindexCriteriaGroup&id_criterion_group=" + id_criterion_group + "&id_search=" + id_search,
dataType : "script",
success : function (data) {
currentCriteriaGroupIndex++;
},
error : function (XMLHttpRequest, textStatus, errorThrown) {
alert("ERROR : " + errorThrown);
}
});
}
function processAddCustomCriterionToGroup(e, id_search, id_criterion_group) {
var idCriterionListTmp = new Array;
$('select[name^="custom_group_link_id_"]').each(function() {
idCriterionListTmp.push($(this).attr('name').replace('custom_group_link_id_', '') + '-' + $(this).val());
});
$.ajax({
type : "POST",
url : _base_config_url + "&pm_load_function=processAddCustomCriterionToGroup&id_search="+ id_search,
data : 'id_criterion_group=' + id_criterion_group + '&criterionsGroupList=' + idCriterionListTmp.join(','),
dataType : "script",
success : function (data) {},
error : function (XMLHttpRequest, textStatus, errorThrown) {
alert("ERROR : " + errorThrown);
}
});
}
$.fn.animateAppendTo = function(whereToAppend, duration, removeOld, callback) {
var $this = this,
newEle = $this.clone(true).appendTo(whereToAppend),
newWidth = $this.width(),
newHeight = $this.height(),
newOffset = $this.position(),
newPos = newEle.position();
if (removeOld) {
elementToAnimate = $this;
newEle.css('visibility', 'hidden');
newEle.removeClass('ui-state-disabled');
} else {
elementToAnimate = newEle;
}
elementToAnimate.removeClass('ui-state-disabled');
elementToAnimate.width(newWidth);
elementToAnimate.height(newHeight);
elementToAnimate.css('left', newOffset.left);
elementToAnimate.css('top', newOffset.top);
elementToAnimate.css('position', 'absolute').animate(newPos, duration, function() {
callback($this, newEle);
if (removeOld) {
newEle.css('visibility', 'visible');
elementToAnimate.remove();
} else {
elementToAnimate.css('position', '');
elementToAnimate.css('left', '');
elementToAnimate.css('top', '');
elementToAnimate.css('width', '');
elementToAnimate.css('width', '');
}
});
return newEle;
};
$(document).ready(function() {
// Criterions groups
$(document).on('click', '.availableCriterionGroups ul li', function() {
addCriterion($(this));
});
// Use context for search
$(document).on('change', 'select[name="filter_by_emplacement"]', function() {
displayRelatedFilterByEmplacementOptions();
});
$(document).on('change', 'input[name=insert_in_center_column]', function() {
displayRelatedSmartyVarOptions();
});
$(document).on('keyup', '#smarty_var_name', function() {
updateSmartyVarNamePicker();
});
$(document).on('click', 'div#addCustomCriterionContainer input[name="submitAddCustomCriterionForm"]', function(e) {
var idCriterionGroup = parseInt($(this).parent().parent().parent().data('id-criterion-group'));
var idSearch = parseInt($(this).parent().parent().parent().data('id-search'));
$.ajax({
type : "POST",
url : _base_config_url + "&pm_load_function=processAddCustomCriterion&id_criterion_group=" + idCriterionGroup + '&id_search='+ idSearch,
data : $(this).parent().parent().parent().find('input').serialize(),
dataType : "script",
success : function (data) {},
error : function (XMLHttpRequest, textStatus, errorThrown) {
alert("ERROR : " + errorThrown);
}
});
});
$(document).on('click', 'table.criterionsList input[name="submitCustomCriterionForm"]', function(e) {
if (typeof($(this).parent().parent().data('id-criterion')) != 'undefined') {
var idCriterion = parseInt($(this).parent().parent().data('id-criterion'));
var idSearch = parseInt($(this).parent().parent().data('id-search'));
$.ajax({
type : "POST",
url : _base_config_url + "&pm_load_function=processUpdateCustomCriterion&id_criterion=" + idCriterion + '&id_search='+ idSearch,
data : $(this).parent().parent().find('input').serialize(),
dataType : "script",
success : function (data) {},
error : function (XMLHttpRequest, textStatus, errorThrown) {
alert("ERROR : " + errorThrown);
$('li#criterion_'+$(this).parent().parent().data('id-criterion')).removeClass('customCriterionEditState');
}
});
}
e.preventDefault();
});
$(document).on('click', 'input[name="submitSearch"], input[name="submitCriteriaGroupOptions"]', function(e) {
// Add a small blur effect on the dialog's form, and display the loading animation
$('body > form[target="dialogIframePostForm"]').css('filter', 'blur(2px)');
$('body').append('<div class="as4-loader-bo"></div>');
});
});

View File

@@ -0,0 +1,438 @@
/**
*
* @author Presta-Module.com <support@presta-module.com>
* @copyright Presta-Module
*
****/
var currentColorPicker = false;
function initColorPicker() {
$("input.colorPickerInput").ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
$(el).val("#"+hex);
$(el).ColorPickerHide();
},
onBeforeShow: function () {
currentColorPicker = $(this);
$(this).ColorPickerSetColor(this.value);
},
onChange: function (hsb, hex, rgb) {
$(currentColorPicker).val("#"+hex);
if ($(currentColorPicker).parent("div").find("span input.colorPickerInput").length) $(currentColorPicker).parent("div").find("span input.colorPickerInput").val("#"+hex);
}
})
.bind("keyup", function() {
$(this).ColorPickerSetColor(this.value);
});
initMakeGradient();
}
function initFlags(flag_key, default_language) {
currentFlag = $("#" + flag_key);
currentFlag.val(default_language);
currentFlag.unbind("change").on("change", function(e, p) {
currentIdLang = $(this).val();
$(".pmFlag").hide();
$(".pmFlagLang_" + currentIdLang).show();
$(".pmSelectFlag").val(currentIdLang);
$(".pmSelectFlag").trigger("click");
});
}
function initUploader(inputName, destinationUrl, allowedExtensionList, isImage, callBack) {
var uploader = new plupload.Uploader({
runtimes : 'html5,html4',
browse_button : inputName + '_pickfiles',
container: document.getElementById(inputName + '_container'),
url : destinationUrl,
file_data_name : 'fileUpload',
filters : {
// max_file_size : '10mb',
mime_types: [
{title : "Allowed file type", extensions : allowedExtensionList}
]
},
multi_selection : false,
init: {
PostInit: function() { },
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
$("input[type=submit].ui-state-default").attr("disabled", "disabled").removeClass("ui-state-default").addClass("ui-state-disabled");
document.getElementById(inputName + '_filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
uploader.start();
});
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
FileUploaded: function(up, file, httpResult) {
responseJson = $.parseJSON(httpResult.response);
$('#' + inputName).val(responseJson.filename);
$('#' + inputName + '_file').remove();
if (isImage) {
$('#preview-' + inputName).prepend('<img src="' + _modulePath + 'uploads/temp/' + responseJson.filename + '" id="' + inputName + '_file" />');
} else {
$('#preview-' + inputName).prepend('<a href="' + _modulePath + 'uploads/temp/' + responseJson.filename + '" target="_blank" class="pm_view_file_upload_link" id="' + inputName + '_file">' + pm_viewFileLabel + '</a>');
}
$("input[name=" + inputName + "_unlink_lang]").attr("checked","").removeAttr("checked");
$("#preview-" + inputName).slideDown("fast");
$("input[type=submit].ui-state-disabled").removeAttr("disabled").removeClass("ui-state-disabled").addClass("ui-state-default");
document.getElementById(inputName + '_filelist').innerHTML = '';
if (typeof(callBack) == 'function') {
callBack(responseJson.filename);
}
},
Error: function(up, err) {
alert('Error Code #' + err.code + ' : ' + err.message);
}
}
});
uploader.init();
}
(function(){
var old = $.ui.dialog.prototype._create;
$.ui.dialog.prototype._create = function(d){
old.call(this, d);
var self = this;
var options = self.options,
oldHeight = options.height,
oldWidth = options.width;
fixDialogSize(self,options,oldHeight,oldWidth);
$(window).unbind('resize.uidialog').bind('resize.uidialog', function() {
fixDialogSize(self,options,oldHeight,oldWidth);
});
};
})();
function fixDialogSize(self,options,oldHeight,oldWidth) {
var fitHeight = options.fitHeight,
screenHeight = $(window).height(),
screenWidth = $(window).width(),
dialogHeight = options.height,
dialogWidth = options.width;
if(!fitHeight && (screenHeight < oldHeight)) {
fitHeight = true;
}else if(!fitHeight && (dialogHeight < oldHeight) && (screenHeight < oldHeight)) {
$(self).dialog( "option", "height", screenHeight);
}
uiDialogTitlebarFull = $('<a href="#"><span class="ui-icon ui-icon-newwin"></span></a>')
.addClass(
'ui-dialog-titlebar-full ' +
'ui-corner-all'
)
.attr('role', 'button')
.hover(
function() {
uiDialogTitlebarFull.addClass('ui-state-hover');
},
function() {
uiDialogTitlebarFull.removeClass('ui-state-hover');
}
)
.toggle(
function() {
self._setOptions({
height : window.innerHeight - 10,
width : oldWidth
});
self._position('center');
return false;
},
function() {
self._setOptions({
height : oldHeight,
width : oldWidth
});
self._position('center');
return false;
}
)
.focus(function() {
uiDialogTitlebarFull.addClass('ui-state-focus');
})
.blur(function() {
uiDialogTitlebarFull.removeClass('ui-state-focus');
})
.appendTo(self.uiDialogTitlebar),
uiDialogTitlebarFullText = $('<span></span>')
.addClass(
'ui-icon ' +
'ui-icon-newwin'
)
.text(options.fullText);
if(fitHeight) {
self._setOptions({
height : window.innerHeight - 10,
width : oldWidth
});
self._position('center');
}
self._position('center');
}
function hideNextIfTrue(e) {
var val = parseInt($(e).val());
if (val) {
$(e).parent('.margin-form').next('div').slideUp('fast');
} else {
$(e).parent('.margin-form').next('div').slideDown('fast');
}
}
function showNextIfTrue(e) {
var val = parseInt($(e).val());
if (val) {
showNext(e);
} else {
hideNext(e);
}
}
function showNext(e) {
$(e).parent('.margin-form').next('div').slideDown('fast');
}
function hideNext(e) {
$(e).parent('.margin-form').next('div').slideUp('fast');
}
function showSpanIfChecked(e, idToShow) {
var val = $(e).attr('checked');
if (val) {
$(idToShow).css('display', 'inline');
} else {
$(idToShow).hide();
}
}
var dialogIframe;
function openDialogIframe(url,dialogWidth,dialogHeight,fitScreenHeight) {
$('body').css('overflow','hidden');
dialogIframe = $('<iframe class="dialogIFrame" frameborder="0" marginheight="0" marginwidth="0" src="'+url+'"></iframe>').dialog({
bgiframe: true,
modal: true,
width:dialogWidth,
height:dialogHeight,
fitHeight:(typeof(fitScreenHeight)!='undefined' && fitScreenHeight ? true:false),
close: function(event, ui) {$('body').css('overflow','');},
open: function (event,ui) {$(this).css('width','97%');}
});
}
function closeDialogIframe() {
// Remove spinner as the iframe is not deleted, but hidden
$('.dialogIFrame').contents().find(".as4-loader-bo").remove();
$(dialogIframe).dialog("close");
}
var dialogInline;
function openDialogInline(contentId,dialogWidth,dialogHeight,fitScreenHeight) {
$('body').css('overflow','hidden');
dialogInline = $(contentId).dialog({
modal: true,
width:dialogWidth,
height:dialogHeight,
fitHeight:(typeof(fitScreenHeight)!='undefined' && fitScreenHeight ? true:false),
close: function(event, ui) {$('body').css('overflow',''); },
open: function (event,ui) {$(this).css('width','93%');}
});
}
function closeDialogInline() {
$(dialogInline).dialog("close");
}
function reloadPanel(idPanel) {
var url = $('#'+idPanel).attr('rel');
if(!url) show_info('Attribute rel is not set for panel '+idPanel);
$('#'+idPanel).load(url);
}
function loadPanel(idPanel,url) {
$('#'+idPanel).attr('rel',url);
reloadPanel(idPanel);
}
function loadTabPanel(tabPanelId,li,ul) {
var indexTab = $(li).index(ul);
$(tabPanelId).tabs( "load" , indexTab, function(response, status, xhr) {
if (status == "error") {
//alert(msgAjaxError);
return;
}
} );
}
function show_info(content) {
$.jGrowl(content,{ themeState: 'ui-state-highlight' });
}
function show_error(content) {
$.jGrowl(content,{ sticky: true, themeState: 'ui-state-error' });
}
function objectToarray (o,e) {
a = new Array;
for (var i=1; i<o.length; i++) {
a.push(parseInt(o[i][e]));
}
return a;
}
$.fn.extend({
pm_selectMenu: function() {
$(this).chosen({ disable_search: true, max_selected_options: 1, inherit_select_classes: true });
$(this).trigger('chosen:updated');
},
pm_ajaxScriptLoad: function(event) {
if($(this).hasClass('pm_confirm') && !confirm($("<textarea />").html($(this).attr('title')).val())) {
event.preventDefault();
return false;
}
if($(this).next('.progressbar_wrapper').length) {
var curLink = $(this);
$(curLink).hide();
var progressbar = $(this).next('.progressbar_wrapper').children('.progressbar');
$(progressbar).progressbar({
value: 0,
complete: function(event, ui) { clearInterval(progressbarInterval);$(progressbar).text("");$(this).progressbar( "destroy" );$(curLink).show();}
});
var progressbarInterval = setInterval(function() {
if($(progressbar).progressbar('value') == 99) $(progressbar).progressbar('value',0);
$(progressbar).progressbar('value',$(progressbar).progressbar('value') + 9);
}, 100);
}
var rel = $(this).attr('rel');
if(rel) {
var relSplit = rel.split(/_/g);
if(relSplit[0] == 'tab') {
var tabId = '#'+relSplit[1];
var tabIndex = parseInt(relSplit[2]);
$(tabId).unbind( "tabsload").bind( "tabsload", function(event, ui) {
$(window).scrollTo("#wrapConfigTab",1000);
});
$(tabId).tabs( "url" , tabIndex , $(this).attr('href') );
$(tabId).tabs( "load" , tabIndex );
event.preventDefault();
return false;
}
}
$.ajax( {
type : "GET",
url : $(this).attr('href'),
dataType : "script",
error: function(XMLHttpRequest, textStatus, errorThrown) {
//alert(msgAjaxError);
}
});
event.preventDefault();
return false;
},
pm_openOnDialogIframe: function(event) {
var rel = $(this).attr('rel');
var dialogWidth = 900;
var dialogHeight = 600;
var dialogFixHeight = false;
if(rel) {
var relSplit = rel.split(/_/g);
if(typeof(relSplit[0]) != 'undefined' && typeof(relSplit[1]) != 'undefined') {
dialogWidth = relSplit[0];
dialogHeight = relSplit[1];
dialogFixHeight = (typeof(relSplit[2])!='undefined' && relSplit[2] ? true:false);
}
}
openDialogIframe($(this).attr('href'),dialogWidth,dialogHeight,dialogFixHeight);
return false;
},
pm_ajaxLoadOnBlc: function(event) {
var rel = $(this).attr('rel');
if (rel) {
loadPanel(rel,$(this).attr('href'));
}
return false;
},
pm_hideClassShowId: function(event) {
var rel = $(this).attr('rel');
if (typeof(rel) != 'undefined' && rel.length > 0) {
var relSplit = rel.split(/@/g);
if (typeof(relSplit[0]) != 'undefined' && typeof(relSplit[1]) != 'undefined') {
class_to_hide = relSplit[0];
id_to_show = relSplit[1];
}
// Hide other block
$('.'+class_to_hide).slideUp('fast', function() {
// Show selected block
$('#'+id_to_show).slideDown('fast');
});
}
return false;
}
});
function loadAjaxLink() {
$(document).off('click', '.ajax_script_load').on('click', '.ajax_script_load', function(e) {
if ($(this).hasClass('disabledAction')) {
e.preventDefault();
} else {
return $(this).pm_ajaxScriptLoad(e);
}
});
$(document).off('click', '.open_on_dialog_iframe').on('click', '.open_on_dialog_iframe', function(e) {
return $(this).pm_openOnDialogIframe(e);
});
$(document).off('click', '.ajax_load_on_blc').on('click', '.ajax_load_on_blc', function(e) {
return $(this).pm_ajaxLoadOnBlc(e);
});
$(document).off('click', '.hide_class_show_id').on('click', '.hide_class_show_id', function(e) {
return $(this).pm_hideClassShowId(e);
});
}
function bindFillNextSize() {
$('.fill_next_size').unbind('click').click(function() {
$(this).nextAll('input.ui-input-pm-size[type=text]').val($(this).prev('input[type=text]').val());
})
}
function initMakeGradient() {
$('.makeGradient').unbind('click').click(function() {
var e = $(this).parent('span').prev('span');
if($(e).css('display') == 'inline')
$(this).parent('span').prev('span').hide();
else
$(this).parent('span').prev('span').show();
});
}
function checkChildrenCheckbox(e) {
if($(e).children('input[type=checkbox]:checked').length)
$(e).children('input[type=checkbox]').removeAttr('checked');
else
$(e).children('input[type=checkbox]').attr('checked','checked');
}
function unCheckAllChildrenCheckbox(e) {
$(e).find('input[type=checkbox]').removeAttr('checked');
}
function display(message) {
$.jGrowl(message, { sticky: true, themeState: 'ui-state-highlight' });
}
function hide(message) {
$.jGrowl('close');
}
function displayGroupBoxFromPermissions(id) {
if($(id).val() == 2)
$('#blc_groupBox').slideDown("fast");
else $('#blc_groupBox').slideUp("fast");
}
function initTips(e) {
$(document).ready(function() {
$(e+"-tips").tipTip();
});
}
$(document).ready(function() {
// Add class if we are into an iframe context
if (window != window.parent) {
$('body').addClass('pm_iframe');
}
loadAjaxLink();
$(".pm_tips").tipTip();
$('link[href$="js/jquery/datepicker/datepicker.css"]').remove();
$('div#addons-rating-container p.dismiss a').click(function() {
$('div#addons-rating-container').hide(500);
$.ajax({type : "GET", url : window.location+'&dismissRating=1' });
return false;
});
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
CodeMirror.defineMode("css", function(config) {
var indentUnit = config.indentUnit, type;
function ret(style, tp) {type = tp; return style;}
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == "@") {stream.eatWhile(/\w/); return ret("meta", stream.current());}
else if (ch == "/" && stream.eat("*")) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
else if (ch == "<" && stream.eat("!")) {
state.tokenize = tokenSGMLComment;
return tokenSGMLComment(stream, state);
}
else if (ch == "=") ret(null, "compare");
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
else if (ch == "\"" || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
else if (ch == "#") {
stream.eatWhile(/\w/);
return ret("atom", "hash");
}
else if (ch == "!") {
stream.match(/^\s*\w*/);
return ret("keyword", "important");
}
else if (/\d/.test(ch)) {
stream.eatWhile(/[\w.%]/);
return ret("number", "unit");
}
else if (/[,.+>*\/]/.test(ch)) {
return ret(null, "select-op");
}
else if (/[;{}:\[\]]/.test(ch)) {
return ret(null, ch);
}
else {
stream.eatWhile(/[\w\\\-_]/);
return ret("variable", "variable");
}
}
function tokenCComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == "/") {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenSGMLComment(stream, state) {
var dashes = 0, ch;
while ((ch = stream.next()) != null) {
if (dashes >= 2 && ch == ">") {
state.tokenize = tokenBase;
break;
}
dashes = (ch == "-") ? dashes + 1 : 0;
}
return ret("comment", "comment");
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped)
break;
escaped = !escaped && ch == "\\";
}
if (!escaped) state.tokenize = tokenBase;
return ret("string", "string");
};
}
return {
startState: function(base) {
return {tokenize: tokenBase,
baseIndent: base || 0,
stack: []};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
var context = state.stack[state.stack.length-1];
if (type == "hash" && context == "rule") style = "atom";
else if (style == "variable") {
if (context == "rule") style = "number";
else if (!context || context == "@media{") style = "tag";
}
if (context == "rule" && /^[\{\};]$/.test(type))
state.stack.pop();
if (type == "{") {
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
else state.stack.push("{");
}
else if (type == "}") state.stack.pop();
else if (type == "@media") state.stack.push("@media");
else if (context == "{" && type != "comment") state.stack.push("rule");
return style;
},
indent: function(state, textAfter) {
var n = state.stack.length;
if (/^\}/.test(textAfter))
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
return state.baseIndent + n * indentUnit;
},
electricChars: "}"
};
});
CodeMirror.defineMIME("text/css", "css");

View File

@@ -0,0 +1,83 @@
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
var jsMode = CodeMirror.getMode(config, "javascript");
var cssMode = CodeMirror.getMode(config, "css");
function html(stream, state) {
var style = htmlMode.token(stream, state.htmlState);
if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
if (/^script$/i.test(state.htmlState.context.tagName)) {
state.token = javascript;
state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
state.mode = "javascript";
}
else if (/^style$/i.test(state.htmlState.context.tagName)) {
state.token = css;
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
state.mode = "css";
}
}
return style;
}
function maybeBackup(stream, pat, style) {
var cur = stream.current();
var close = cur.search(pat);
if (close > -1) stream.backUp(cur.length - close);
return style;
}
function javascript(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html;
state.curState = null;
state.mode = "html";
return html(stream, state);
}
return maybeBackup(stream, /<\/\s*script\s*>/,
jsMode.token(stream, state.localState));
}
function css(stream, state) {
if (stream.match(/^<\/\s*style\s*>/i, false)) {
state.token = html;
state.localState = null;
state.mode = "html";
return html(stream, state);
}
return maybeBackup(stream, /<\/\s*style\s*>/,
cssMode.token(stream, state.localState));
}
return {
startState: function() {
var state = htmlMode.startState();
return {token: html, localState: null, mode: "html", htmlState: state};
},
copyState: function(state) {
if (state.localState)
var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
return {token: state.token, localState: local, mode: state.mode,
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
},
token: function(stream, state) {
return state.token(stream, state);
},
indent: function(state, textAfter) {
if (state.token == html || /^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState, textAfter);
else if (state.token == javascript)
return jsMode.indent(state.localState, textAfter);
else
return cssMode.indent(state.localState, textAfter);
},
compareStates: function(a, b) {
return htmlMode.compareStates(a.htmlState, b.htmlState);
},
electricChars: "/{}:"
}
});
CodeMirror.defineMIME("text/html", "htmlmixed");

View File

@@ -0,0 +1,8 @@
<?php
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,352 @@
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var jsonMode = parserConfig.json;
// Tokenizer
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
return {
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
"var": kw("var"), "function": kw("function"), "catch": kw("catch"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "typeof": operator, "instanceof": operator,
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
};
}();
var isOperatorChar = /[+\-*&%=<>!?|]/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
function nextUntilUnescaped(stream, end) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (next == end && !escaped)
return false;
escaped = !escaped && next == "\\";
}
return escaped;
}
// Used as scratch variables to communicate multiple values without
// consing up tons of objects.
var type, content;
function ret(tp, style, cont) {
type = tp; content = cont;
return style;
}
function jsTokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'")
return chain(stream, state, jsTokenString(ch));
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
return ret(ch);
else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i);
return ret("number", "number");
}
else if (/\d/.test(ch)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
return ret("number", "number");
}
else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, jsTokenComment);
}
else if (stream.eat("/")) {
stream.skipToEnd();
return ret("comment", "comment");
}
else if (state.reAllowed) {
nextUntilUnescaped(stream, "/");
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
return ret("regexp", "string");
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
}
else if (ch == "#") {
stream.skipToEnd();
return ret("error", "error");
}
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
else {
stream.eatWhile(/[\w\$_]/);
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return known ? ret(known.type, known.style, word) :
ret("variable", "variable", word);
}
}
function jsTokenString(quote) {
return function(stream, state) {
if (!nextUntilUnescaped(stream, quote))
state.tokenize = jsTokenBase;
return ret("string", "string");
};
}
function jsTokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = jsTokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
// Parser
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
function JSLexical(indented, column, type, align, prev, info) {
this.indented = indented;
this.column = column;
this.type = type;
this.prev = prev;
this.info = info;
if (align != null) this.align = align;
}
function inScope(state, varname) {
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return true;
}
function parseJS(state, style, type, content, stream) {
var cc = state.cc;
// Communicate our context to the combinators.
// (Less wasteful than consing up a hundred closures on every call.)
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = true;
while(true) {
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
if (combinator(type, content)) {
while(cc.length && cc[cc.length - 1].lex)
cc.pop()();
if (cx.marked) return cx.marked;
if (type == "variable" && inScope(state, content)) return "variable-2";
return style;
}
}
}
// Combinator utils
var cx = {state: null, column: null, marked: null, cc: null};
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function register(varname) {
var state = cx.state;
if (state.context) {
cx.marked = "def";
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return;
state.localVars = {name: varname, next: state.localVars};
}
}
// Combinators
var defaultVars = {name: "this", next: {name: "arguments"}};
function pushcontext() {
if (!cx.state.context) cx.state.localVars = defaultVars;
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
}
function popcontext() {
cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev;
}
function pushlex(type, info) {
var result = function() {
var state = cx.state;
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
};
result.lex = true;
return result;
}
function poplex() {
var state = cx.state;
if (state.lexical.prev) {
if (state.lexical.type == ")")
state.indented = state.lexical.indented;
state.lexical = state.lexical.prev;
}
}
poplex.lex = true;
function expect(wanted) {
return function expecting(type) {
if (type == wanted) return cont();
else if (wanted == ";") return pass();
else return cont(arguments.callee);
};
}
function statement(type) {
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
if (type == "{") return cont(pushlex("}"), block, poplex);
if (type == ";") return cont();
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
poplex, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext);
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function expression(type) {
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
if (type == "function") return cont(functiondef);
if (type == "keyword c") return cont(expression);
if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
if (type == "operator") return cont(expression);
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
return cont();
}
function maybeoperator(type, value) {
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
if (type == "operator") return cont(expression);
if (type == ";") return;
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
if (type == ".") return cont(property, maybeoperator);
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
}
function maybelabel(type) {
if (type == ":") return cont(poplex, statement);
return pass(maybeoperator, expect(";"), poplex);
}
function property(type) {
if (type == "variable") {cx.marked = "property"; return cont();}
}
function objprop(type) {
if (type == "variable") cx.marked = "property";
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
}
function commasep(what, end) {
function proceed(type) {
if (type == ",") return cont(what, proceed);
if (type == end) return cont();
return cont(expect(end));
}
return function commaSeparated(type) {
if (type == end) return cont();
else return pass(what, proceed);
};
}
function block(type) {
if (type == "}") return cont();
return pass(statement, block);
}
function vardef1(type, value) {
if (type == "variable"){register(value); return cont(vardef2);}
return cont();
}
function vardef2(type, value) {
if (value == "=") return cont(expression, vardef2);
if (type == ",") return cont(vardef1);
}
function forspec1(type) {
if (type == "var") return cont(vardef1, forspec2);
if (type == ";") return pass(forspec2);
if (type == "variable") return cont(formaybein);
return pass(forspec2);
}
function formaybein(type, value) {
if (value == "in") return cont(expression);
return cont(maybeoperator, forspec2);
}
function forspec2(type, value) {
if (type == ";") return cont(forspec3);
if (value == "in") return cont(expression);
return cont(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type != ")") cont(expression);
}
function functiondef(type, value) {
if (type == "variable") {register(value); return cont(functiondef);}
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
}
function funarg(type, value) {
if (type == "variable") {register(value); return cont();}
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: jsTokenBase,
reAllowed: true,
cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: null,
context: null,
indented: 0
};
},
token: function(stream, state) {
if (stream.sol()) {
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = false;
state.indented = stream.indentation();
}
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
if (type == "comment") return style;
state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
return parseJS(state, style, type, content, stream);
},
indent: function(state, textAfter) {
if (state.tokenize != jsTokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
type = lexical.type, closing = firstChar == type;
if (type == "vardef") return lexical.indented + 4;
else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit);
},
electricChars: ":{}"
};
});
CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});

View File

@@ -0,0 +1,233 @@
CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
"meta": true, "col": true, "frame": true, "base": true, "area": true},
doNotIndent: {"pre": true, "!cdata": true},
allowUnquoted: true
} : {autoSelfClosers: {}, doNotIndent: {"!cdata": true}, allowUnquoted: false};
var alignCDATA = parserConfig.alignCDATA;
// Return variables for tokenizers
var tagName, type;
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
var ch = stream.next();
if (ch == "<") {
if (stream.eat("!")) {
if (stream.eat("[")) {
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
else return null;
}
else if (stream.match("--")) return chain(inBlock("comment", "-->"));
else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/);
return chain(inBlock("meta", ">"));
}
else return null;
}
else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>");
return "meta";
}
else {
type = stream.eat("/") ? "closeTag" : "openTag";
stream.eatSpace();
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
state.tokenize = inTag;
return "tag";
}
}
else if (ch == "&") {
stream.eatWhile(/[^;]/);
stream.eat(";");
return "atom";
}
else {
stream.eatWhile(/[^&<]/);
return null;
}
}
function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag";
}
else if (ch == "=") {
type = "equals";
return null;
}
else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
return state.tokenize(stream, state);
}
else {
stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
return "word";
}
}
function inAttribute(quote) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
};
}
function inBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = inText;
break;
}
stream.next();
}
return style;
};
}
var curState, setStyle;
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function pushContext(tagName, startOfLine) {
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
curState.context = {
prev: curState.context,
tagName: tagName,
indent: curState.indented,
startOfLine: startOfLine,
noIndent: noIndent
};
}
function popContext() {
if (curState.context) curState.context = curState.context.prev;
}
function element(type) {
if (type == "openTag") {curState.tagName = tagName; return cont(attributes, endtag(curState.startOfLine));}
else if (type == "closeTag") {
var err = false;
if (curState.context) {
err = curState.context.tagName != tagName;
} else {
err = true;
}
if (err) setStyle = "error";
return cont(endclosetag(err));
}
else if (type == "string") {
if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
if (curState.tokenize == inText) popContext();
return cont();
}
else return cont();
}
function endtag(startOfLine) {
return function(type) {
if (type == "selfcloseTag" ||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
return cont();
if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
return cont();
};
}
function endclosetag(err) {
return function(type) {
if (err) setStyle = "error";
if (type == "endTag") { popContext(); return cont(); }
setStyle = "error";
return cont(arguments.callee);
}
}
function attributes(type) {
if (type == "word") {setStyle = "attribute"; return cont(attributes);}
if (type == "equals") return cont(attvalue, attributes);
if (type == "string") {setStyle = "error"; return cont(attributes);}
return pass();
}
function attvalue(type) {
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
if (type == "string") return cont(attvaluemaybe);
return pass();
}
function attvaluemaybe(type) {
if (type == "string") return cont(attvaluemaybe);
else return pass();
}
return {
startState: function() {
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
},
token: function(stream, state) {
if (stream.sol()) {
state.startOfLine = true;
state.indented = stream.indentation();
}
if (stream.eatSpace()) return null;
setStyle = type = tagName = null;
var style = state.tokenize(stream, state);
state.type = type;
if ((style || type) && style != "comment") {
curState = state;
while (true) {
var comb = state.cc.pop() || element;
if (comb(type || style)) break;
}
}
state.startOfLine = false;
return setStyle || style;
},
indent: function(state, textAfter) {
var context = state.context;
if (context && context.noIndent) return 0;
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter))
context = context.prev;
while (context && !context.startOfLine)
context = context.prev;
if (context) return context.indent + indentUnit;
else return 0;
},
compareStates: function(a, b) {
if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
if (!ca || !cb) return ca == cb;
if (ca.tagName != cb.tagName) return false;
}
},
electricChars: "/"
};
});
CodeMirror.defineMIME("application/xml", "xml");
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});

View File

@@ -0,0 +1,484 @@
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dual licensed under the MIT and GPL licenses
*
*/
(function ($) {
var ColorPicker = function () {
var
ids = {},
inAction,
charMin = 65,
visible,
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
defaults = {
eventName: 'click',
onShow: function () {},
onBeforeShow: function(){},
onHide: function () {},
onChange: function () {},
onSubmit: function () {},
color: 'ff0000',
livePreview: true,
flat: false
},
fillRGBFields = function (hsb, cal) {
var rgb = HSBToRGB(hsb);
$(cal).data('colorpicker').fields
.eq(1).val(rgb.r).end()
.eq(2).val(rgb.g).end()
.eq(3).val(rgb.b).end();
},
fillHSBFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(4).val(hsb.h).end()
.eq(5).val(hsb.s).end()
.eq(6).val(hsb.b).end();
},
fillHexFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(0).val(HSBToHex(hsb)).end();
},
setSelector = function (hsb, cal) {
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
$(cal).data('colorpicker').selectorIndic.css({
left: parseInt(150 * hsb.s/100, 10),
top: parseInt(150 * (100-hsb.b)/100, 10)
});
},
setHue = function (hsb, cal) {
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
},
setCurrentColor = function (hsb, cal) {
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
setNewColor = function (hsb, cal) {
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
keyDown = function (ev) {
var pressedKey = ev.charCode || ev.keyCode || -1;
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
var cal = $(this).parent().parent();
if (cal.data('colorpicker').livePreview === true) {
change.apply(this);
}
},
change = function (ev) {
var cal = $(this).parent().parent(), col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpicker').color = col = fixHSB({
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
});
} else {
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
}));
}
if (ev) {
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
},
blur = function (ev) {
var cal = $(this).parent().parent();
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
},
focus = function () {
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
$(this).parent().addClass('colorpicker_focus');
},
downIncrement = function (ev) {
var field = $(this).parent().find('input').focus();
var current = {
el: $(this).parent().addClass('colorpicker_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpicker').livePreview
};
$(document).bind('mouseup', current, upIncrement);
$(document).bind('mousemove', current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function (ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
$(document).unbind('mouseup', upIncrement);
$(document).unbind('mousemove', moveIncrement);
return false;
},
downHue = function (ev) {
var current = {
cal: $(this).parent(),
y: $(this).offset().top
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upHue);
$(document).bind('mousemove', current, moveHue);
},
moveHue = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(4)
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upHue = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upHue);
$(document).unbind('mousemove', moveHue);
return false;
},
downSelector = function (ev) {
var current = {
cal: $(this).parent(),
pos: $(this).offset()
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upSelector);
$(document).bind('mousemove', current, moveSelector);
},
moveSelector = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(6)
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
.end()
.eq(5)
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upSelector = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upSelector);
$(document).unbind('mousemove', moveSelector);
return false;
},
enterSubmit = function (ev) {
$(this).addClass('colorpicker_focus');
},
leaveSubmit = function (ev) {
$(this).removeClass('colorpicker_focus');
},
clickSubmit = function (ev) {
var cal = $(this).parent();
var col = cal.data('colorpicker').color;
cal.data('colorpicker').origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
},
show = function (ev) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
var viewPort = getViewport();
var top = pos.top + this.offsetHeight;
var left = pos.left;
if (top + 176 > viewPort.t + viewPort.h) {
top -= this.offsetHeight + 176;
}
if (left + 356 > viewPort.l + viewPort.w) {
left -= 356;
}
cal.css({left: left + 'px', top: top + 'px'});
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document).bind('mousedown', {cal: cal}, hide);
return false;
},
hide = function (ev) {
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$(document).unbind('mousedown', hide);
}
},
isChildOf = function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (parentEl.contains) {
return parentEl.contains(el);
}
if ( parentEl.compareDocumentPosition ) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while(prEl && prEl != container) {
if (prEl == parentEl)
return true;
prEl = prEl.parentNode;
}
return false;
},
getViewport = function () {
var m = document.compatMode == 'CSS1Compat';
return {
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
};
},
fixHSB = function (hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function (rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function (hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i=0; i<len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
HexToRGB = function (hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
},
HexToHSB = function (hex) {
return RGBToHSB(HexToRGB(hex));
},
RGBToHSB = function (rgb) {
var hsb = {
h: 0,
s: 0,
b: 0
};
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
if (max != 0) {
}
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) {
hsb.h = (rgb.g - rgb.b) / delta;
} else if (rgb.g == max) {
hsb.h = 2 + (rgb.b - rgb.r) / delta;
} else {
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
} else {
hsb.h = -1;
}
hsb.h *= 60;
if (hsb.h < 0) {
hsb.h += 360;
}
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
},
HSBToRGB = function (hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s*255/100);
var v = Math.round(hsb.b*255/100);
if(s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255-s)*v/255;
var t3 = (t1-t2)*(h%60)/60;
if(h==360) h = 0;
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
else {rgb.r=0; rgb.g=0; rgb.b=0}
}
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
},
RGBToHex = function (rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function (nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
},
HSBToHex = function (hsb) {
return RGBToHex(HSBToRGB(hsb));
},
restoreOriginal = function () {
var cal = $(this).parent();
var col = cal.data('colorpicker').origColor;
cal.data('colorpicker').color = col;
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
};
return {
init: function (opt) {
opt = $.extend({}, defaults, opt||{});
if (typeof opt.color == 'string') {
opt.color = HexToHSB(opt.color);
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
opt.color = RGBToHSB(opt.color);
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
opt.color = fixHSB(opt.color);
} else {
return this;
}
return this.each(function () {
if (!$(this).data('colorpickerId')) {
var options = $.extend({}, opt);
options.origColor = opt.color;
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this).data('colorpickerId', id);
var cal = $(tpl).attr('id', id);
if (options.flat) {
cal.appendTo(this).show();
} else {
cal.appendTo(document.body);
}
options.fields = cal
.find('input')
.bind('keyup', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
cal
.find('span').bind('mousedown', downIncrement).end()
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.el = this;
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
if (options.flat) {
cal.css({
position: 'relative',
display: 'block'
});
} else {
$(this).bind(options.eventName, show);
}
}
});
},
showPicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
show.apply(this);
}
});
},
hidePicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
$('#' + $(this).data('colorpickerId')).hide();
}
});
},
setColor: function(col) {
if (typeof col == 'string') {
col = HexToHSB(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = RGBToHSB(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function(){
if ($(this).data('colorpickerId')) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').color = col;
cal.data('colorpicker').origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setCurrentColor(col, cal.get(0));
setNewColor(col, cal.get(0));
}
});
}
};
}();
$.fn.extend({
ColorPicker: ColorPicker.init,
ColorPickerHide: ColorPicker.hidePicker,
ColorPickerShow: ColorPicker.showPicker,
ColorPickerSetColor: ColorPicker.setColor
});
})($)

View File

@@ -0,0 +1,34 @@
/**
*
* Zoomimage
* Author: Stefan Petre www.eyecon.ro
*
*/
(function($){
var EYE = window.EYE = function() {
var _registered = {
init: []
};
return {
init: function() {
$.each(_registered.init, function(nr, fn){
fn.call();
});
},
extend: function(prop) {
for (var i in prop) {
if (prop[i] != undefined) {
this[i] = prop[i];
}
}
},
register: function(fn, type) {
if (!_registered[type]) {
_registered[type] = [];
}
_registered[type].push(fn);
}
};
}();
$(EYE.init);
})(jQuery);

View File

@@ -0,0 +1,8 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
(function($){
var initLayout = function() {
var hash = window.location.hash.replace('#', '');
var currentTab = $('ul.navigationTabs a')
.bind('click', showTab)
.filter('a[rel=' + hash + ']');
if (currentTab.size() == 0) {
currentTab = $('ul.navigationTabs a:first');
}
showTab.apply(currentTab.get(0));
$('#colorpickerHolder').ColorPicker({flat: true});
$('#colorpickerHolder2').ColorPicker({
flat: true,
color: '#00ff00',
onSubmit: function(hsb, hex, rgb) {
$('#colorSelector2 div').css('backgroundColor', '#' + hex);
}
});
$('#colorpickerHolder2>div').css('position', 'absolute');
var widt = false;
$('#colorSelector2').bind('click', function() {
$('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500);
widt = !widt;
});
$('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
$(el).val(hex);
$(el).ColorPickerHide();
},
onBeforeShow: function () {
$(this).ColorPickerSetColor(this.value);
}
})
.bind('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
$('#colorSelector').ColorPicker({
color: '#0000ff',
onShow: function (colpkr) {
$(colpkr).fadeIn(500);
return false;
},
onHide: function (colpkr) {
$(colpkr).fadeOut(500);
return false;
},
onChange: function (hsb, hex, rgb) {
$('#colorSelector div').css('backgroundColor', '#' + hex);
}
});
};
var showTab = function(e) {
var tabIndex = $('ul.navigationTabs a')
.removeClass('active')
.index(this);
$(this)
.addClass('active')
.blur();
$('div.tab')
.hide()
.eq(tabIndex)
.show();
};
EYE.register(initLayout, 'init');
})(jQuery)

View File

@@ -0,0 +1,252 @@
/**
*
* Utilities
* Author: Stefan Petre www.eyecon.ro
*
*/
(function($) {
EYE.extend({
getPosition : function(e, forceIt)
{
var x = 0;
var y = 0;
var es = e.style;
var restoreStyles = false;
if (forceIt && jQuery.curCSS(e,'display') == 'none') {
var oldVisibility = es.visibility;
var oldPosition = es.position;
restoreStyles = true;
es.visibility = 'hidden';
es.display = 'block';
es.position = 'absolute';
}
var el = e;
if (el.getBoundingClientRect) { // IE
var box = el.getBoundingClientRect();
x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2;
y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2;
} else {
x = el.offsetLeft;
y = el.offsetTop;
el = el.offsetParent;
if (e != el) {
while (el) {
x += el.offsetLeft;
y += el.offsetTop;
el = el.offsetParent;
}
}
if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) {
x -= document.body.offsetLeft;
y -= document.body.offsetTop;
}
el = e.parentNode;
while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML')
{
if (jQuery.curCSS(el, 'display') != 'inline') {
x -= el.scrollLeft;
y -= el.scrollTop;
}
el = el.parentNode;
}
}
if (restoreStyles == true) {
es.display = 'none';
es.position = oldPosition;
es.visibility = oldVisibility;
}
return {x:x, y:y};
},
getSize : function(e)
{
var w = parseInt(jQuery.curCSS(e,'width'), 10);
var h = parseInt(jQuery.curCSS(e,'height'), 10);
var wb = 0;
var hb = 0;
if (jQuery.curCSS(e, 'display') != 'none') {
wb = e.offsetWidth;
hb = e.offsetHeight;
} else {
var es = e.style;
var oldVisibility = es.visibility;
var oldPosition = es.position;
es.visibility = 'hidden';
es.display = 'block';
es.position = 'absolute';
wb = e.offsetWidth;
hb = e.offsetHeight;
es.display = 'none';
es.position = oldPosition;
es.visibility = oldVisibility;
}
return {w:w, h:h, wb:wb, hb:hb};
},
getClient : function(e)
{
var h, w;
if (e) {
w = e.clientWidth;
h = e.clientHeight;
} else {
var de = document.documentElement;
w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
}
return {w:w,h:h};
},
getScroll : function (e)
{
var t=0, l=0, w=0, h=0, iw=0, ih=0;
if (e && e.nodeName.toLowerCase() != 'body') {
t = e.scrollTop;
l = e.scrollLeft;
w = e.scrollWidth;
h = e.scrollHeight;
} else {
if (document.documentElement) {
t = document.documentElement.scrollTop;
l = document.documentElement.scrollLeft;
w = document.documentElement.scrollWidth;
h = document.documentElement.scrollHeight;
} else if (document.body) {
t = document.body.scrollTop;
l = document.body.scrollLeft;
w = document.body.scrollWidth;
h = document.body.scrollHeight;
}
if (typeof pageYOffset != 'undefined') {
t = pageYOffset;
l = pageXOffset;
}
iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
}
return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
},
getMargins : function(e, toInteger)
{
var t = jQuery.curCSS(e,'marginTop') || '';
var r = jQuery.curCSS(e,'marginRight') || '';
var b = jQuery.curCSS(e,'marginBottom') || '';
var l = jQuery.curCSS(e,'marginLeft') || '';
if (toInteger)
return {
t: parseInt(t, 10)||0,
r: parseInt(r, 10)||0,
b: parseInt(b, 10)||0,
l: parseInt(l, 10)
};
else
return {t: t, r: r, b: b, l: l};
},
getPadding : function(e, toInteger)
{
var t = jQuery.curCSS(e,'paddingTop') || '';
var r = jQuery.curCSS(e,'paddingRight') || '';
var b = jQuery.curCSS(e,'paddingBottom') || '';
var l = jQuery.curCSS(e,'paddingLeft') || '';
if (toInteger)
return {
t: parseInt(t, 10)||0,
r: parseInt(r, 10)||0,
b: parseInt(b, 10)||0,
l: parseInt(l, 10)
};
else
return {t: t, r: r, b: b, l: l};
},
getBorder : function(e, toInteger)
{
var t = jQuery.curCSS(e,'borderTopWidth') || '';
var r = jQuery.curCSS(e,'borderRightWidth') || '';
var b = jQuery.curCSS(e,'borderBottomWidth') || '';
var l = jQuery.curCSS(e,'borderLeftWidth') || '';
if (toInteger)
return {
t: parseInt(t, 10)||0,
r: parseInt(r, 10)||0,
b: parseInt(b, 10)||0,
l: parseInt(l, 10)||0
};
else
return {t: t, r: r, b: b, l: l};
},
traverseDOM : function(nodeEl, func)
{
func(nodeEl);
nodeEl = nodeEl.firstChild;
while(nodeEl){
EYE.traverseDOM(nodeEl, func);
nodeEl = nodeEl.nextSibling;
}
},
getInnerWidth : function(el, scroll) {
var offsetW = el.offsetWidth;
return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth;
},
getInnerHeight : function(el, scroll) {
var offsetH = el.offsetHeight;
return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight;
},
getExtraWidth : function(el) {
if($.boxModel)
return (parseInt($.curCSS(el, 'paddingLeft'))||0)
+ (parseInt($.curCSS(el, 'paddingRight'))||0)
+ (parseInt($.curCSS(el, 'borderLeftWidth'))||0)
+ (parseInt($.curCSS(el, 'borderRightWidth'))||0);
return 0;
},
getExtraHeight : function(el) {
if($.boxModel)
return (parseInt($.curCSS(el, 'paddingTop'))||0)
+ (parseInt($.curCSS(el, 'paddingBottom'))||0)
+ (parseInt($.curCSS(el, 'borderTopWidth'))||0)
+ (parseInt($.curCSS(el, 'borderBottomWidth'))||0);
return 0;
},
isChildOf: function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (!el || !el.nodeType || el.nodeType != 1) {
return false;
}
if (parentEl.contains && !$.browser.safari) {
return parentEl.contains(el);
}
if ( parentEl.compareDocumentPosition ) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while(prEl && prEl != container) {
if (prEl == parentEl)
return true;
prEl = prEl.parentNode;
}
return false;
},
centerEl : function(el, axis)
{
var clientScroll = EYE.getScroll();
var size = EYE.getSize(el);
if (!axis || axis == 'vertically')
$(el).css(
{
top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px'
}
);
if (!axis || axis == 'horizontally')
$(el).css(
{
left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px'
}
);
}
});
if (!$.easing.easeout) {
$.easing.easeout = function(p, n, firstNum, delta, duration) {
return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum;
};
}
})(jQuery);

View File

@@ -0,0 +1,8 @@
<?php
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,151 @@
/*
* File: jquery.dataTables.min.js
* Version: 1.8.1
* Author: Allan Jardine (www.sprymedia.co.uk)
* Info: www.datatables.net
*
* Copyright 2008-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
(function(i,wa,p){i.fn.dataTableSettings=[];var D=i.fn.dataTableSettings;i.fn.dataTableExt={};var o=i.fn.dataTableExt;o.sVersion="1.8.1";o.sErrMode="alert";o.iApiIndex=0;o.oApi={};o.afnFiltering=[];o.aoFeatures=[];o.ofnSearch={};o.afnSortData=[];o.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",
sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",
sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};o.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",
sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",
sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",
sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollWrapper:"dataTables_scroll",
sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};o.oPagination={two_button:{fnInit:function(g,l,r){var s,w,y;if(g.bJUI){s=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;
s.appendChild(y)}else{s=p.createElement("div");w=p.createElement("div")}s.className=g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;s.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;l.appendChild(s);l.appendChild(w);i(s).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&r(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&r(g)});i(s).bind("selectstart.DT",function(){return false});i(w).bind("selectstart.DT",function(){return false});
if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");s.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l=g.aanFeatures.p,r=0,s=l.length;r<s;r++)if(l[r].childNodes.length!==0){l[r].childNodes[0].className=g._iDisplayStart===0?g.oClasses.sPagePrevDisabled:g.oClasses.sPagePrevEnabled;l[r].childNodes[1].className=g.fnDisplayEnd()==g.fnRecordsDisplay()?g.oClasses.sPageNextDisabled:
g.oClasses.sPageNextEnabled}}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(g,l,r){var s=p.createElement("span"),w=p.createElement("span"),y=p.createElement("span"),G=p.createElement("span"),x=p.createElement("span");s.innerHTML=g.oLanguage.oPaginate.sFirst;w.innerHTML=g.oLanguage.oPaginate.sPrevious;G.innerHTML=g.oLanguage.oPaginate.sNext;x.innerHTML=g.oLanguage.oPaginate.sLast;var v=g.oClasses;s.className=v.sPageButton+" "+v.sPageFirst;w.className=v.sPageButton+" "+v.sPagePrevious;G.className=
v.sPageButton+" "+v.sPageNext;x.className=v.sPageButton+" "+v.sPageLast;l.appendChild(s);l.appendChild(w);l.appendChild(y);l.appendChild(G);l.appendChild(x);i(s).bind("click.DT",function(){g.oApi._fnPageChange(g,"first")&&r(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&r(g)});i(G).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&r(g)});i(x).bind("click.DT",function(){g.oApi._fnPageChange(g,"last")&&r(g)});i("span",l).bind("mousedown.DT",function(){return false}).bind("selectstart.DT",
function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");s.setAttribute("id",g.sTableId+"_first");w.setAttribute("id",g.sTableId+"_previous");G.setAttribute("id",g.sTableId+"_next");x.setAttribute("id",g.sTableId+"_last")}},fnUpdate:function(g,l){if(g.aanFeatures.p){var r=o.oPagination.iFullNumbersShowPages,s=Math.floor(r/2),w=Math.ceil(g.fnRecordsDisplay()/g._iDisplayLength),y=Math.ceil(g._iDisplayStart/g._iDisplayLength)+1,G=
"",x,v=g.oClasses;if(w<r){s=1;x=w}else if(y<=s){s=1;x=r}else if(y>=w-s){s=w-r+1;x=w}else{s=y-Math.ceil(r/2)+1;x=s+r-1}for(r=s;r<=x;r++)G+=y!=r?'<span class="'+v.sPageButton+'">'+r+"</span>":'<span class="'+v.sPageButtonActive+'">'+r+"</span>";x=g.aanFeatures.p;var z,Y=function(L){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;l(g);L.preventDefault()},V=function(){return false};r=0;for(s=x.length;r<s;r++)if(x[r].childNodes.length!==0){z=i("span:eq(2)",x[r]);z.html(G);i("span",z).bind("click.DT",
Y).bind("mousedown.DT",V).bind("selectstart.DT",V);z=x[r].getElementsByTagName("span");z=[z[0],z[1],z[z.length-2],z[z.length-1]];i(z).removeClass(v.sPageButton+" "+v.sPageButtonActive+" "+v.sPageButtonStaticDisabled);if(y==1){z[0].className+=" "+v.sPageButtonStaticDisabled;z[1].className+=" "+v.sPageButtonStaticDisabled}else{z[0].className+=" "+v.sPageButton;z[1].className+=" "+v.sPageButton}if(w===0||y==w||g._iDisplayLength==-1){z[2].className+=" "+v.sPageButtonStaticDisabled;z[3].className+=" "+
v.sPageButtonStaticDisabled}else{z[2].className+=" "+v.sPageButton;z[3].className+=" "+v.sPageButton}}}}}};o.oSort={"string-asc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?-1:g>l?1:0},"string-desc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?1:g>l?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<
l?-1:g>l?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<l?1:g>l?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return l-
g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};o.aTypes=[function(g){if(typeof g=="number")return"numeric";else if(typeof g!="string")return null;var l,r=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var s=1;s<g.length;s++){l=g.charAt(s);if("0123456789.".indexOf(l)==-1)return null;if(l=="."){if(r)return null;r=true}}return"numeric"},function(g){var l=Date.parse(g);
if(l!==null&&!isNaN(l)||typeof g=="string"&&g.length===0)return"date";return null},function(g){if(typeof g=="string"&&g.indexOf("<")!=-1&&g.indexOf(">")!=-1)return"html";return null}];o.fnVersionCheck=function(g){var l=function(x,v){for(;x.length<v;)x+="0";return x},r=o.sVersion.split(".");g=g.split(".");for(var s="",w="",y=0,G=g.length;y<G;y++){s+=l(r[y],3);w+=l(g[y],3)}return parseInt(s,10)>=parseInt(w,10)};o._oExternConfig={iNextUnique:0};i.fn.dataTable=function(g){function l(){this.fnRecordsTotal=
function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance=
this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false,bDeferRender:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",
sLoadingRecords:"Loading...",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.aoHeader=[];this.aoFooter=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,
bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=this.fnPreDrawCallback=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=this.bDeferLoading=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button";
this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.sAjaxDataProp="aaData";this.bAjaxDataGet=true;this.jqXHR=null;this.fnServerData=function(a,b,c,d){d.jqXHR=i.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(f,e){e=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})};
this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d<b;d++){if(d%3===0&&d!==0)c=","+c;c=a[b-d-1]+c}}return c};this.aLengthMenu=[10,25,50,100];this.bDrawing=this.iDraw=0;this.iDrawError=-1;this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;this._iRecordsDisplay=this._iRecordsTotal=0;this.bJUI=false;this.oClasses=o.oStdClasses;this.bSortCellsTop=this.bSorted=this.bFiltered=false;this.oInit=null}function r(a){return function(){var b=
[A(this[o.iApiIndex])].concat(Array.prototype.slice.call(arguments));return o.oApi[a].apply(this,b)}}function s(a){var b,c,d=a.iInitDisplayStart;if(a.bInitialised===false)setTimeout(function(){s(a)},200);else{xa(a);V(a);L(a,a.aoHeader);a.nTFoot&&L(a,a.aoFooter);K(a,true);a.oFeatures.bAutoWidth&&ea(a);b=0;for(c=a.aoColumns.length;b<c;b++)if(a.aoColumns[b].sWidth!==null)a.aoColumns[b].nTh.style.width=u(a.aoColumns[b].sWidth);if(a.oFeatures.bSort)R(a);else if(a.oFeatures.bFilter)M(a,a.oPreviousSearch);
else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}if(a.sAjaxSource!==null&&!a.oFeatures.bServerSide)a.fnServerData.call(a.oInstance,a.sAjaxSource,[],function(f){var e=f;if(a.sAjaxDataProp!=="")e=Z(a.sAjaxDataProp)(f);for(b=0;b<e.length;b++)v(a,e[b]);a.iInitDisplayStart=d;if(a.oFeatures.bSort)R(a);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}K(a,false);w(a,f)},a);else if(!a.oFeatures.bServerSide){K(a,false);w(a)}}}function w(a,b){a._bInitComplete=true;if(typeof a.fnInitComplete=="function")typeof b!=
"undefined"?a.fnInitComplete.call(a.oInstance,a,b):a.fnInitComplete.call(a.oInstance,a)}function y(a,b,c){n(a.oLanguage,b,"sProcessing");n(a.oLanguage,b,"sLengthMenu");n(a.oLanguage,b,"sEmptyTable");n(a.oLanguage,b,"sLoadingRecords");n(a.oLanguage,b,"sZeroRecords");n(a.oLanguage,b,"sInfo");n(a.oLanguage,b,"sInfoEmpty");n(a.oLanguage,b,"sInfoFiltered");n(a.oLanguage,b,"sInfoPostFix");n(a.oLanguage,b,"sSearch");if(typeof b.oPaginate!="undefined"){n(a.oLanguage.oPaginate,b.oPaginate,"sFirst");n(a.oLanguage.oPaginate,
b.oPaginate,"sPrevious");n(a.oLanguage.oPaginate,b.oPaginate,"sNext");n(a.oLanguage.oPaginate,b.oPaginate,"sLast")}typeof b.sEmptyTable=="undefined"&&typeof b.sZeroRecords!="undefined"&&n(a.oLanguage,b,"sZeroRecords","sEmptyTable");typeof b.sLoadingRecords=="undefined"&&typeof b.sZeroRecords!="undefined"&&n(a.oLanguage,b,"sZeroRecords","sLoadingRecords");c&&s(a)}function G(a,b){var c=a.aoColumns.length;b={sType:null,_bAutoType:true,bVisible:true,bSearchable:true,bSortable:true,asSorting:["asc","desc"],
sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,sTitle:b?b.innerHTML:"",sName:"",sWidth:null,sWidthOrig:null,sClass:null,fnRender:null,bUseRendered:true,iDataSort:c,mDataProp:c,fnGetData:null,fnSetData:null,sSortDataType:"std",sDefaultContent:null,sContentPadding:"",nTh:b?b:p.createElement("th"),nTf:null};a.aoColumns.push(b);if(typeof a.aoPreSearchCols[c]=="undefined"||a.aoPreSearchCols[c]===null)a.aoPreSearchCols[c]={sSearch:"",bRegex:false,bSmart:true};else{if(typeof a.aoPreSearchCols[c].bRegex==
"undefined")a.aoPreSearchCols[c].bRegex=true;if(typeof a.aoPreSearchCols[c].bSmart=="undefined")a.aoPreSearchCols[c].bSmart=true}x(a,c,null)}function x(a,b,c){b=a.aoColumns[b];if(typeof c!="undefined"&&c!==null){if(typeof c.sType!="undefined"){b.sType=c.sType;b._bAutoType=false}n(b,c,"bVisible");n(b,c,"bSearchable");n(b,c,"bSortable");n(b,c,"sTitle");n(b,c,"sName");n(b,c,"sWidth");n(b,c,"sWidth","sWidthOrig");n(b,c,"sClass");n(b,c,"fnRender");n(b,c,"bUseRendered");n(b,c,"iDataSort");n(b,c,"mDataProp");
n(b,c,"asSorting");n(b,c,"sSortDataType");n(b,c,"sDefaultContent");n(b,c,"sContentPadding")}b.fnGetData=Z(b.mDataProp);b.fnSetData=ya(b.mDataProp);if(!a.oFeatures.bSort)b.bSortable=false;if(!b.bSortable||i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableNone;b.sSortingClassJUI=""}else if(b.bSortable||i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortable;b.sSortingClassJUI=a.oClasses.sSortJUI}else if(i.inArray("asc",
b.asSorting)!=-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableAsc;b.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed}else if(i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)!=-1){b.sSortingClass=a.oClasses.sSortableDesc;b.sSortingClassJUI=a.oClasses.sSortJUIDescAllowed}}function v(a,b){var c;c=typeof b.length=="number"?b.slice():i.extend(true,{},b);b=a.aoData.length;var d={nTr:null,_iId:a.iNextId++,_aData:c,_anHidden:[],_sRowStripe:""};a.aoData.push(d);for(var f,
e=0,h=a.aoColumns.length;e<h;e++){c=a.aoColumns[e];typeof c.fnRender=="function"&&c.bUseRendered&&c.mDataProp!==null&&N(a,b,e,c.fnRender({iDataRow:b,iDataColumn:e,aData:d._aData,oSettings:a}));if(c._bAutoType&&c.sType!="string"){f=H(a,b,e,"type");if(f!==null&&f!==""){f=fa(f);if(c.sType===null)c.sType=f;else if(c.sType!=f)c.sType="string"}}}a.aiDisplayMaster.push(b);a.oFeatures.bDeferRender||z(a,b);return b}function z(a,b){var c=a.aoData[b],d;if(c.nTr===null){c.nTr=p.createElement("tr");typeof c._aData.DT_RowId!=
"undefined"&&c.nTr.setAttribute("id",c._aData.DT_RowId);typeof c._aData.DT_RowClass!="undefined"&&i(c.nTr).addClass(c._aData.DT_RowClass);for(var f=0,e=a.aoColumns.length;f<e;f++){var h=a.aoColumns[f];d=p.createElement("td");d.innerHTML=typeof h.fnRender=="function"&&(!h.bUseRendered||h.mDataProp===null)?h.fnRender({iDataRow:b,iDataColumn:f,aData:c._aData,oSettings:a}):H(a,b,f,"display");if(h.sClass!==null)d.className=h.sClass;if(h.bVisible){c.nTr.appendChild(d);c._anHidden[f]=null}else c._anHidden[f]=
d}}}function Y(a){var b,c,d,f,e,h,j,k,m;if(a.bDeferLoading||a.sAjaxSource===null){j=a.nTBody.childNodes;b=0;for(c=j.length;b<c;b++)if(j[b].nodeName.toUpperCase()=="TR"){k=a.aoData.length;a.aoData.push({nTr:j[b],_iId:a.iNextId++,_aData:[],_anHidden:[],_sRowStripe:""});a.aiDisplayMaster.push(k);h=j[b].childNodes;d=e=0;for(f=h.length;d<f;d++){m=h[d].nodeName.toUpperCase();if(m=="TD"||m=="TH"){N(a,k,e,i.trim(h[d].innerHTML));e++}}}}j=$(a);h=[];b=0;for(c=j.length;b<c;b++){d=0;for(f=j[b].childNodes.length;d<
f;d++){e=j[b].childNodes[d];m=e.nodeName.toUpperCase();if(m=="TD"||m=="TH")h.push(e)}}h.length!=j.length*a.aoColumns.length&&J(a,1,"Unexpected number of TD elements. Expected "+j.length*a.aoColumns.length+" and got "+h.length+". DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.");d=0;for(f=a.aoColumns.length;d<f;d++){if(a.aoColumns[d].sTitle===null)a.aoColumns[d].sTitle=a.aoColumns[d].nTh.innerHTML;j=a.aoColumns[d]._bAutoType;
m=typeof a.aoColumns[d].fnRender=="function";e=a.aoColumns[d].sClass!==null;k=a.aoColumns[d].bVisible;var t,q;if(j||m||e||!k){b=0;for(c=a.aoData.length;b<c;b++){t=h[b*f+d];if(j&&a.aoColumns[d].sType!="string"){q=H(a,b,d,"type");if(q!==""){q=fa(q);if(a.aoColumns[d].sType===null)a.aoColumns[d].sType=q;else if(a.aoColumns[d].sType!=q)a.aoColumns[d].sType="string"}}if(m){q=a.aoColumns[d].fnRender({iDataRow:b,iDataColumn:d,aData:a.aoData[b]._aData,oSettings:a});t.innerHTML=q;a.aoColumns[d].bUseRendered&&
N(a,b,d,q)}if(e)t.className+=" "+a.aoColumns[d].sClass;if(k)a.aoData[b]._anHidden[d]=null;else{a.aoData[b]._anHidden[d]=t;t.parentNode.removeChild(t)}}}}}function V(a){var b,c,d;a.nTHead.getElementsByTagName("tr");if(a.nTHead.getElementsByTagName("th").length!==0){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);if(a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}}else{var f=p.createElement("tr");b=0;
for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;c.innerHTML=a.aoColumns[b].sTitle;a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);f.appendChild(c)}i(a.nTHead).html("")[0].appendChild(f);W(a.aoHeader,a.nTHead)}if(a.bJUI){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;f=p.createElement("div");f.className=a.oClasses.sSortJUIWrapper;i(c).contents().appendTo(f);var e=p.createElement("span");e.className=a.oClasses.sSortIcon;f.appendChild(e);c.appendChild(f)}}d=function(){this.onselectstart=
function(){return false};return false};if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable!==false){ga(a,a.aoColumns[b].nTh,b);i(a.aoColumns[b].nTh).bind("mousedown.DT",d)}else i(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);a.oClasses.sFooterTH!==""&&i(">tr>th",a.nTFoot).addClass(a.oClasses.sFooterTH);if(a.nTFoot!==null){c=S(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b<d;b++)if(typeof c[b]!="undefined")a.aoColumns[b].nTf=c[b]}}function L(a,b,c){var d,f,
e,h=[],j=[],k=a.aoColumns.length;if(typeof c=="undefined")c=false;d=0;for(f=b.length;d<f;d++){h[d]=b[d].slice();h[d].nTr=b[d].nTr;for(e=k-1;e>=0;e--)!a.aoColumns[e].bVisible&&!c&&h[d].splice(e,1);j.push([])}d=0;for(f=h.length;d<f;d++){if(h[d].nTr){a=0;for(e=h[d].nTr.childNodes.length;a<e;a++)h[d].nTr.removeChild(h[d].nTr.childNodes[0])}e=0;for(b=h[d].length;e<b;e++){k=c=1;if(typeof j[d][e]=="undefined"){h[d].nTr.appendChild(h[d][e].cell);for(j[d][e]=1;typeof h[d+c]!="undefined"&&h[d][e].cell==h[d+
c][e].cell;){j[d+c][e]=1;c++}for(;typeof h[d][e+k]!="undefined"&&h[d][e].cell==h[d][e+k].cell;){for(a=0;a<c;a++)j[d+a][e+k]=1;k++}h[d][e].cell.setAttribute("rowspan",c);h[d][e].cell.setAttribute("colspan",k)}}}}function C(a){var b,c,d=[],f=0,e=false;b=a.asStripClasses.length;c=a.aoOpenRows.length;if(!(a.fnPreDrawCallback!==null&&a.fnPreDrawCallback.call(a.oInstance,a)===false)){a.bDrawing=true;if(typeof a.iInitDisplayStart!="undefined"&&a.iInitDisplayStart!=-1){a._iDisplayStart=a.oFeatures.bServerSide?
a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!za(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var h=a._iDisplayStart,j=a._iDisplayEnd;if(a.oFeatures.bServerSide){h=0;j=a.aoData.length}for(h=h;h<j;h++){var k=a.aoData[a.aiDisplay[h]];k.nTr===null&&z(a,a.aiDisplay[h]);var m=k.nTr;if(b!==0){var t=a.asStripClasses[f%b];if(k._sRowStripe!=
t){i(m).removeClass(k._sRowStripe).addClass(t);k._sRowStripe=t}}if(typeof a.fnRowCallback=="function"){m=a.fnRowCallback.call(a.oInstance,m,a.aoData[a.aiDisplay[h]]._aData,f,h);if(!m&&!e){J(a,0,"A node was not returned by fnRowCallback");e=true}}d.push(m);f++;if(c!==0)for(k=0;k<c;k++)m==a.aoOpenRows[k].nParent&&d.push(a.aoOpenRows[k].nTr)}}else{d[0]=p.createElement("tr");if(typeof a.asStripClasses[0]!="undefined")d[0].className=a.asStripClasses[0];e=a.oLanguage.sZeroRecords.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()));
if(a.iDraw==1&&a.sAjaxSource!==null&&!a.oFeatures.bServerSide)e=a.oLanguage.sLoadingRecords;else if(typeof a.oLanguage.sEmptyTable!="undefined"&&a.fnRecordsTotal()===0)e=a.oLanguage.sEmptyTable;b=p.createElement("td");b.setAttribute("valign","top");b.colSpan=X(a);b.className=a.oClasses.sRowEmpty;b.innerHTML=e;d[f].appendChild(b)}typeof a.fnHeaderCallback=="function"&&a.fnHeaderCallback.call(a.oInstance,i(">tr",a.nTHead)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback==
"function"&&a.fnFooterCallback.call(a.oInstance,i(">tr",a.nTFoot)[0],aa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b<c;b++)f.appendChild(d[b]);a.nTBody.appendChild(f);e!==null&&e.appendChild(a.nTBody)}for(b=a.aoDrawCallback.length-
1;b>=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function ba(a){if(a.oFeatures.bSort)R(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)M(a,a.oPreviousSearch);else{E(a);C(a)}}function za(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d,f;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:ha(a)});
c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:-1});for(f=0;f<b;f++){d=a.aoColumns[f].mDataProp;c.push({name:"mDataProp_"+f,value:typeof d=="function"?"function":d})}if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(f=0;f<b;f++){c.push({name:"sSearch_"+f,value:a.aoPreSearchCols[f].sSearch});c.push({name:"bRegex_"+
f,value:a.aoPreSearchCols[f].bRegex});c.push({name:"bSearchable_"+f,value:a.aoColumns[f].bSearchable})}}if(a.oFeatures.bSort!==false){d=a.aaSortingFixed!==null?a.aaSortingFixed.length:0;var e=a.aaSorting.length;c.push({name:"iSortingCols",value:d+e});for(f=0;f<d;f++){c.push({name:"iSortCol_"+f,value:a.aaSortingFixed[f][0]});c.push({name:"sSortDir_"+f,value:a.aaSortingFixed[f][1]})}for(f=0;f<e;f++){c.push({name:"iSortCol_"+(f+d),value:a.aaSorting[f][0]});c.push({name:"sSortDir_"+(f+d),value:a.aaSorting[f][1]})}for(f=
0;f<b;f++)c.push({name:"bSortable_"+f,value:a.aoColumns[f].bSortable})}a.fnServerData.call(a.oInstance,a.sAjaxSource,c,function(h){Aa(a,h)},a);return false}else return true}function Aa(a,b){if(typeof b.sEcho!="undefined")if(b.sEcho*1<a.iDraw)return;else a.iDraw=b.sEcho*1;if(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))ia(a);a._iRecordsTotal=b.iTotalRecords;a._iRecordsDisplay=b.iTotalDisplayRecords;var c=ha(a);if(c=typeof b.sColumns!="undefined"&&c!==""&&b.sColumns!=c)var d=
Ba(a,b.sColumns);b=Z(a.sAjaxDataProp)(b);for(var f=0,e=b.length;f<e;f++)if(c){for(var h=[],j=0,k=a.aoColumns.length;j<k;j++)h.push(b[f][d[j]]);v(a,h)}else v(a,b[f]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=false;C(a);a.bAjaxDataGet=true;K(a,false)}function xa(a){var b=p.createElement("div");a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=p.createElement("div");a.nTableWrapper.className=a.oClasses.sWrapper;a.sTableId!==""&&a.nTableWrapper.setAttribute("id",a.sTableId+"_wrapper");
a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,e,h,j,k,m,t,q=0;q<d.length;q++){e=0;h=d[q];if(h=="<"){j=p.createElement("div");k=d[q+1];if(k=="'"||k=='"'){m="";for(t=2;d[q+t]!=k;){m+=d[q+t];t++}if(m=="H")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix";else if(m=="F")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix";if(m.indexOf(".")!=-1){k=m.split(".");j.setAttribute("id",k[0].substr(1,
k[0].length-1));j.className=k[1]}else if(m.charAt(0)=="#")j.setAttribute("id",m.substr(1,m.length-1));else j.className=m;q+=t}c.appendChild(j);c=j}else if(h==">")c=c.parentNode;else if(h=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=Ca(a);e=1}else if(h=="f"&&a.oFeatures.bFilter){f=Da(a);e=1}else if(h=="r"&&a.oFeatures.bProcessing){f=Ea(a);e=1}else if(h=="t"){f=Fa(a);e=1}else if(h=="i"&&a.oFeatures.bInfo){f=Ga(a);e=1}else if(h=="p"&&a.oFeatures.bPaginate){f=Ha(a);e=1}else if(o.aoFeatures.length!==
0){j=o.aoFeatures;t=0;for(k=j.length;t<k;t++)if(h==j[t].cFeature){if(f=j[t].fnInit(a))e=1;break}}if(e==1&&f!==null){if(typeof a.aanFeatures[h]!="object")a.aanFeatures[h]=[];a.aanFeatures[h].push(f);c.appendChild(f)}}b.parentNode.replaceChild(a.nTableWrapper,b)}function Fa(a){if(a.oScroll.sX===""&&a.oScroll.sY==="")return a.nTable;var b=p.createElement("div"),c=p.createElement("div"),d=p.createElement("div"),f=p.createElement("div"),e=p.createElement("div"),h=p.createElement("div"),j=a.nTable.cloneNode(false),
k=a.nTable.cloneNode(false),m=a.nTable.getElementsByTagName("thead")[0],t=a.nTable.getElementsByTagName("tfoot").length===0?null:a.nTable.getElementsByTagName("tfoot")[0],q=typeof g.bJQueryUI!="undefined"&&g.bJQueryUI?o.oJUIClasses:o.oStdClasses;c.appendChild(d);e.appendChild(h);f.appendChild(a.nTable);b.appendChild(c);b.appendChild(f);d.appendChild(j);j.appendChild(m);if(t!==null){b.appendChild(e);h.appendChild(k);k.appendChild(t)}b.className=q.sScrollWrapper;c.className=q.sScrollHead;d.className=
q.sScrollHeadInner;f.className=q.sScrollBody;e.className=q.sScrollFoot;h.className=q.sScrollFootInner;if(a.oScroll.bAutoCss){c.style.overflow="hidden";c.style.position="relative";e.style.overflow="hidden";f.style.overflow="auto"}c.style.border="0";c.style.width="100%";e.style.border="0";d.style.width="150%";j.removeAttribute("id");j.style.marginLeft="0";a.nTable.style.marginLeft="0";if(t!==null){k.removeAttribute("id");k.style.marginLeft="0"}d=i(">caption",a.nTable);h=0;for(k=d.length;h<k;h++)j.appendChild(d[h]);
if(a.oScroll.sX!==""){c.style.width=u(a.oScroll.sX);f.style.width=u(a.oScroll.sX);if(t!==null)e.style.width=u(a.oScroll.sX);i(f).scroll(function(){c.scrollLeft=this.scrollLeft;if(t!==null)e.scrollLeft=this.scrollLeft})}if(a.oScroll.sY!=="")f.style.height=u(a.oScroll.sY);a.aoDrawCallback.push({fn:Ia,sName:"scrolling"});a.oScroll.bInfinite&&i(f).scroll(function(){if(!a.bDrawing)if(i(this).scrollTop()+i(this).height()>i(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()<a.fnRecordsDisplay()){ja(a,
"next");E(a);C(a)}});a.nScrollHead=c;a.nScrollFoot=e;return b}function Ia(a){var b=a.nScrollHead.getElementsByTagName("div")[0],c=b.getElementsByTagName("table")[0],d=a.nTable.parentNode,f,e,h,j,k,m,t,q,I=[];h=a.nTable.getElementsByTagName("thead");h.length>0&&a.nTable.removeChild(h[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}h=a.nTHead.cloneNode(true);a.nTable.insertBefore(h,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);
a.nTable.insertBefore(k,a.nTable.childNodes[1])}if(a.oScroll.sX===""){d.style.width="100%";b.parentNode.style.width="100%"}var O=S(a,h);f=0;for(e=O.length;f<e;f++){t=Ja(a,f);O[f].style.width=a.aoColumns[t].sWidth}a.nTFoot!==null&&P(function(B){B.style.width=""},k.getElementsByTagName("tr"));f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){a.nTable.style.width="100%";if(i.browser.msie&&i.browser.version<=7)a.nTable.style.width=u(i(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sXInner!==
"")a.nTable.style.width=u(a.oScroll.sXInner);else if(f==i(d).width()&&i(d).height()<i(a.nTable).height()){a.nTable.style.width=u(f-a.oScroll.iBarWidth);if(i(a.nTable).outerWidth()>f-a.oScroll.iBarWidth)a.nTable.style.width=u(f)}else a.nTable.style.width=u(f);f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){d.style.width=u(f+a.oScroll.iBarWidth);b.parentNode.style.width=u(f+a.oScroll.iBarWidth)}e=a.nTHead.getElementsByTagName("tr");h=h.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop=
"0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},h,e);i(h).height(0);if(a.nTFoot!==null){j=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");P(function(B,F){m=B.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;q=i(B).width();F.style.width=u(q);I.push(q)},j,k);i(j).height(0)}P(function(B){B.innerHTML="";B.style.width=u(I.shift())},h);a.nTFoot!==null&&P(function(B){B.innerHTML=
"";B.style.width=u(I.shift())},j);if(i(a.nTable).outerWidth()<f)if(a.oScroll.sX==="")J(a,1,"The table cannot fit into the current element which will cause column misalignment. It is suggested that you enable x-scrolling or increase the width the table has in which to be drawn");else a.oScroll.sXInner!==""&&J(a,1,"The table cannot fit into the current element which will cause column misalignment. It is suggested that you increase the sScrollXInner property to allow it to draw in a larger area, or simply remove that parameter to allow automatic calculation");
if(a.oScroll.sY==="")if(i.browser.msie&&i.browser.version<=7)d.style.height=u(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(a.oScroll.sY!==""&&a.oScroll.bCollapse){d.style.height=u(a.oScroll.sY);j=a.oScroll.sX!==""&&a.nTable.offsetWidth>d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight<d.offsetHeight)d.style.height=u(i(a.nTable).height()+j)}j=i(a.nTable).outerWidth();c.style.width=u(j);b.style.width=u(j+a.oScroll.iBarWidth);if(a.nTFoot!==null){b=a.nScrollFoot.getElementsByTagName("div")[0];
c=b.getElementsByTagName("table")[0];b.style.width=u(a.nTable.offsetWidth+a.oScroll.iBarWidth);c.style.width=u(a.nTable.offsetWidth)}if(a.bSorted||a.bFiltered)d.scrollTop=0}function ca(a){if(a.oFeatures.bAutoWidth===false)return false;ea(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function Da(a){var b=a.oLanguage.sSearch;b=b.indexOf("_INPUT_")!==-1?b.replace("_INPUT_",'<input type="text" />'):b===""?'<input type="text" />':b+' <input type="text" />';
var c=p.createElement("div");c.className=a.oClasses.sFilter;c.innerHTML="<label>"+b+"</label>";a.sTableId!==""&&typeof a.aanFeatures.f=="undefined"&&c.setAttribute("id",a.sTableId+"_filter");b=i("input",c);b.val(a.oPreviousSearch.sSearch.replace('"',"&quot;"));b.bind("keyup.DT",function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f<e;f++)d[f]!=this.parentNode&&i("input",d[f]).val(this.value);this.value!=a.oPreviousSearch.sSearch&&M(a,{sSearch:this.value,bRegex:a.oPreviousSearch.bRegex,bSmart:a.oPreviousSearch.bSmart})});
b.bind("keypress.DT",function(d){if(d.keyCode==13)return false});return c}function M(a,b,c){Ka(a,b.sSearch,c,b.bRegex,b.bSmart);for(b=0;b<a.aoPreSearchCols.length;b++)La(a,a.aoPreSearchCols[b].sSearch,b,a.aoPreSearchCols[b].bRegex,a.aoPreSearchCols[b].bSmart);o.afnFiltering.length!==0&&Ma(a);a.bFiltered=true;a._iDisplayStart=0;E(a);C(a);ka(a,0)}function Ma(a){for(var b=o.afnFiltering,c=0,d=b.length;c<d;c++)for(var f=0,e=0,h=a.aiDisplay.length;e<h;e++){var j=a.aiDisplay[e-f];if(!b[c](a,da(a,j,"filter"),
j)){a.aiDisplay.splice(e-f,1);f++}}}function La(a,b,c,d,f){if(b!==""){var e=0;b=la(b,d,f);for(d=a.aiDisplay.length-1;d>=0;d--){f=ma(H(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Ka(a,b,c,d,f){var e=la(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(o.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>
b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);ka(a,1);for(c=0;c<a.aiDisplayMaster.length;c++)e.test(a.asDataSearch[c])&&a.aiDisplay.push(a.aiDisplayMaster[c])}else{var h=0;for(c=0;c<a.asDataSearch.length;c++)if(!e.test(a.asDataSearch[c])){a.aiDisplay.splice(c-h,1);h++}}a.oPreviousSearch.sSearch=b;a.oPreviousSearch.bRegex=d;a.oPreviousSearch.bSmart=f}function ka(a,b){a.asDataSearch.splice(0,a.asDataSearch.length);b=typeof b!="undefined"&&b==1?a.aiDisplayMaster:
a.aiDisplay;for(var c=0,d=b.length;c<d;c++)a.asDataSearch[c]=na(a,da(a,b[c],"filter"))}function na(a,b){var c="";if(typeof a.__nTmpFilter=="undefined")a.__nTmpFilter=p.createElement("div");for(var d=a.__nTmpFilter,f=0,e=a.aoColumns.length;f<e;f++)if(a.aoColumns[f].bSearchable)c+=ma(b[f],a.aoColumns[f].sType)+" ";if(c.indexOf("&")!==-1){d.innerHTML=c;c=d.textContent?d.textContent:d.innerText;c=c.replace(/\n/g," ").replace(/\r/g,"")}return c}function la(a,b,c){if(c){a=b?a.split(" "):oa(a).split(" ");
a="^(?=.*?"+a.join(")(?=.*?")+").*$";return new RegExp(a,"i")}else{a=b?a:oa(a);return new RegExp(a,"i")}}function ma(a,b){if(typeof o.ofnSearch[b]=="function")return o.ofnSearch[b](a);else if(b=="html")return a.replace(/\n/g," ").replace(/<.*?>/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");else if(a===null)return"";return a}function R(a,b){var c,d,f,e,h=[],j=[],k=o.oSort;d=a.aoData;var m=a.aoColumns;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){h=a.aaSortingFixed!==
null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<h.length;c++){var t=h[c][0];f=pa(a,t);e=a.aoColumns[t].sSortDataType;if(typeof o.afnSortData[e]!="undefined"){var q=o.afnSortData[e](a,t,f);f=0;for(e=d.length;f<e;f++)N(a,f,t,q[f])}}c=0;for(d=a.aiDisplayMaster.length;c<d;c++)j[a.aiDisplayMaster[c]]=c;var I=h.length;a.aiDisplayMaster.sort(function(O,B){var F,qa;for(c=0;c<I;c++){F=m[h[c][0]].iDataSort;qa=m[F].sType;F=k[(qa?qa:"string")+"-"+h[c][1]](H(a,O,F,"sort"),H(a,B,F,"sort"));
if(F!==0)return F}return k["numeric-asc"](j[O],j[B])})}if((typeof b=="undefined"||b)&&!a.oFeatures.bDeferRender)T(a);a.bSorted=true;if(a.oFeatures.bFilter)M(a,a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;E(a);C(a)}}function ga(a,b,c,d){i(b).bind("click.DT",function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var h,j;if(f.shiftKey){for(var k=false,m=0;m<a.aaSorting.length;m++)if(a.aaSorting[m][0]==c){k=true;h=a.aaSorting[m][0];j=a.aaSorting[m][2]+
1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")a.aaSorting.splice(m,1);else{a.aaSorting[m][1]=a.aoColumns[h].asSorting[j];a.aaSorting[m][2]=j}break}k===false&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}else if(a.aaSorting.length==1&&a.aaSorting[0][0]==c){h=a.aaSorting[0][0];j=a.aaSorting[0][2]+1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")j=0;a.aaSorting[0][1]=a.aoColumns[h].asSorting[j];a.aaSorting[0][2]=j}else{a.aaSorting.splice(0,a.aaSorting.length);a.aaSorting.push([c,a.aoColumns[c].asSorting[0],
0])}R(a)};if(a.oFeatures.bProcessing){K(a,true);setTimeout(function(){e();a.oFeatures.bServerSide||K(a,false)},0)}else e();typeof d=="function"&&d(a)}})}function T(a){var b,c,d,f,e,h=a.aoColumns.length,j=a.oClasses;for(b=0;b<h;b++)a.aoColumns[b].bSortable&&i(a.aoColumns[b].nTh).removeClass(j.sSortAsc+" "+j.sSortDesc+" "+a.aoColumns[b].sSortingClass);f=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){e=a.aoColumns[b].sSortingClass;
d=-1;for(c=0;c<f.length;c++)if(f[c][0]==b){e=f[c][1]=="asc"?j.sSortAsc:j.sSortDesc;d=c;break}i(a.aoColumns[b].nTh).addClass(e);if(a.bJUI){c=i("span",a.aoColumns[b].nTh);c.removeClass(j.sSortJUIAsc+" "+j.sSortJUIDesc+" "+j.sSortJUI+" "+j.sSortJUIAscAllowed+" "+j.sSortJUIDescAllowed);c.addClass(d==-1?a.aoColumns[b].sSortingClassJUI:f[d][1]=="asc"?j.sSortJUIAsc:j.sSortJUIDesc)}}else i(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);e=j.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){d=
Q(a);if(a.oFeatures.bDeferRender)i(d).removeClass(e+"1 "+e+"2 "+e+"3");else if(d.length>=h)for(b=0;b<h;b++)if(d[b].className.indexOf(e+"1")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"1",""))}else if(d[b].className.indexOf(e+"2")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"2",""))}else if(d[b].className.indexOf(e+"3")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(" "+
e+"3",""))}j=1;var k;for(b=0;b<f.length;b++){k=parseInt(f[b][0],10);c=0;for(a=d.length/h;c<a;c++)d[h*c+k].className+=" "+e+j;j<3&&j++}}}function Ha(a){if(a.oScroll.bInfinite)return null;var b=p.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;o.oPagination[a.sPaginationType].fnInit(a,b,function(c){E(c);C(c)});typeof a.aanFeatures.p=="undefined"&&a.aoDrawCallback.push({fn:function(c){o.oPagination[c.sPaginationType].fnUpdate(c,function(d){E(d);C(d)})},sName:"pagination"});return b}
function ja(a,b){var c=a._iDisplayStart;if(b=="first")a._iDisplayStart=0;else if(b=="previous"){a._iDisplayStart=a._iDisplayLength>=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay())a._iDisplayStart+=a._iDisplayLength}else a._iDisplayStart=0;else if(b=="last")if(a._iDisplayLength>=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=
0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function Ga(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Na,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b}function Na(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),h=a.fnFormatNumber(c),j=
a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",j)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",e).replace("_END_",h).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",
e).replace("_END_",h).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)i(a[b]).html(e)}}function Ca(a){if(a.oScroll.bInfinite)return null;var b='<select size="1" '+(a.sTableId===""?"":'name="'+a.sTableId+'_length"')+">",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]==
"object"){c=0;for(d=a.aLengthMenu[0].length;c<d;c++)b+='<option value="'+a.aLengthMenu[0][c]+'">'+a.aLengthMenu[1][c]+"</option>"}else{c=0;for(d=a.aLengthMenu.length;c<d;c++)b+='<option value="'+a.aLengthMenu[c]+'">'+a.aLengthMenu[c]+"</option>"}b+="</select>";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");f.className=a.oClasses.sLength;f.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";i('select option[value="'+
a._iDisplayLength+'"]',f).attr("selected",true);i("select",f).bind("change.DT",function(){var e=i(this).val(),h=a.aanFeatures.l;c=0;for(d=h.length;c<d;c++)h[c]!=this.parentNode&&i("select",h[c]).val(e);a._iDisplayLength=parseInt(e,10);E(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()){a._iDisplayStart=a.fnDisplayEnd()-a._iDisplayLength;if(a._iDisplayStart<0)a._iDisplayStart=0}if(a._iDisplayLength==-1)a._iDisplayStart=0;C(a)});return f}function Ea(a){var b=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.r==
"undefined"&&b.setAttribute("id",a.sTableId+"_processing");b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,a.nTable);return b}function K(a,b){if(a.oFeatures.bProcessing){a=a.aanFeatures.r;for(var c=0,d=a.length;c<d;c++)a[c].style.visibility=b?"visible":"hidden"}}function Ja(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++){a.aoColumns[d].bVisible===true&&c++;if(c==b)return d}return null}function pa(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++){a.aoColumns[d].bVisible===
true&&c++;if(d==b)return a.aoColumns[d].bVisible===true?c:null}return null}function U(a,b){var c,d;c=a._iDisplayStart;for(d=a._iDisplayEnd;c<d;c++)if(a.aoData[a.aiDisplay[c]].nTr==b)return a.aiDisplay[c];c=0;for(d=a.aoData.length;c<d;c++)if(a.aoData[c].nTr==b)return c;return null}function X(a){for(var b=0,c=0;c<a.aoColumns.length;c++)a.aoColumns[c].bVisible===true&&b++;return b}function E(a){a._iDisplayEnd=a.oFeatures.bPaginate===false?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||
a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Oa(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=u(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,h=i("th",a.nTHead);for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d++;if(a.aoColumns[e].sWidth!==null){c=Oa(a.aoColumns[e].sWidthOrig,a.nTable.parentNode);if(c!==
null)a.aoColumns[e].sWidth=u(c);b++}}if(f==h.length&&b===0&&d==f&&a.oScroll.sX===""&&a.oScroll.sY==="")for(e=0;e<a.aoColumns.length;e++){c=i(h[e]).width();if(c!==null)a.aoColumns[e].sWidth=u(c)}else{b=a.nTable.cloneNode(false);e=a.nTHead.cloneNode(true);d=p.createElement("tbody");c=p.createElement("tr");b.removeAttribute("id");b.appendChild(e);if(a.nTFoot!==null){b.appendChild(a.nTFoot.cloneNode(true));P(function(k){k.style.width=""},b.getElementsByTagName("tr"))}b.appendChild(d);d.appendChild(c);
d=i("thead th",b);if(d.length===0)d=i("tbody tr:eq(0)>td",b);h=S(a,e);for(e=d=0;e<f;e++){var j=a.aoColumns[e];if(j.bVisible&&j.sWidthOrig!==null&&j.sWidthOrig!=="")h[e-d].style.width=u(j.sWidthOrig);else if(j.bVisible)h[e-d].style.width="";else d++}for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d=Pa(a,e);if(d!==null){d=d.cloneNode(true);if(a.aoColumns[e].sContentPadding!=="")d.innerHTML+=a.aoColumns[e].sContentPadding;c.appendChild(d)}}f=a.nTable.parentNode;f.appendChild(b);if(a.oScroll.sX!==""&&a.oScroll.sXInner!==
"")b.style.width=u(a.oScroll.sXInner);else if(a.oScroll.sX!==""){b.style.width="";if(i(b).width()<f.offsetWidth)b.style.width=u(f.offsetWidth)}else if(a.oScroll.sY!=="")b.style.width=u(f.offsetWidth);b.style.visibility="hidden";Qa(a,b);f=i("tbody tr:eq(0)",b).children();if(f.length===0)f=S(a,i("thead",b)[0]);if(a.oScroll.sX!==""){for(e=d=c=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c+=a.aoColumns[e].sWidthOrig===null?i(f[d]).outerWidth():parseInt(a.aoColumns[e].sWidth.replace("px",""),
10)+(i(f[d]).outerWidth()-i(f[d]).width());d++}b.style.width=u(c);a.nTable.style.width=u(c)}for(e=d=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c=i(f[d]).width();if(c!==null&&c>0)a.aoColumns[e].sWidth=u(c);d++}a.nTable.style.width=u(i(b).outerWidth());b.parentNode.removeChild(b)}}function Qa(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=u(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=u(i(b).outerWidth())}function Pa(a,b){var c=
Ra(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=p.createElement("td");d.innerHTML=H(a,c,b,"");return d}return Q(a,c)[b]}function Ra(a,b){for(var c=-1,d=-1,f=0;f<a.aoData.length;f++){var e=H(a,f,b,"display")+"";e=e.replace(/<.*?>/g,"");if(e.length>c){c=e.length;d=f}}return d}function u(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+"px"}function Va(a,b){if(a.length!=b.length)return 1;for(var c=
0;c<a.length;c++)if(a[c]!=b[c])return 2;return 0}function fa(a){for(var b=o.aTypes,c=b.length,d=0;d<c;d++){var f=b[d](a);if(f!==null)return f}return"string"}function A(a){for(var b=0;b<D.length;b++)if(D[b].nTable==a)return D[b];return null}function aa(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function $(a){for(var b=[],c=0,d=a.aoData.length;c<d;c++)a.aoData[c].nTr!==null&&b.push(a.aoData[c].nTr);return b}function Q(a,b){var c=[],d,f,e,h,j;f=0;var k=a.aoData.length;
if(typeof b!="undefined"){f=b;k=b+1}for(f=f;f<k;f++){j=a.aoData[f];if(j.nTr!==null){b=[];e=0;for(h=j.nTr.childNodes.length;e<h;e++){d=j.nTr.childNodes[e].nodeName.toLowerCase();if(d=="td"||d=="th")b.push(j.nTr.childNodes[e])}e=d=0;for(h=a.aoColumns.length;e<h;e++)if(a.aoColumns[e].bVisible)c.push(b[e-d]);else{c.push(j._anHidden[e]);d++}}}return c}function oa(a){return a.replace(new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)","g"),"\\$1")}function ra(a,b){for(var c=-1,d=
0,f=a.length;d<f;d++)if(a[d]==b)c=d;else a[d]>b&&a[d]--;c!=-1&&a.splice(c,1)}function Ba(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d<f;d++)for(var e=0;e<f;e++)if(a.aoColumns[d].sName==b[e]){c.push(e);break}return c}function ha(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";if(b.length==d)return"";return b.slice(0,-1)}function J(a,b,c){a=a.sTableId===""?"DataTables warning: "+c:"DataTables warning (table id = '"+a.sTableId+"'): "+c;if(b===0)if(o.sErrMode==
"alert")alert(a);else throw a;else typeof console!="undefined"&&typeof console.log!="undefined"&&console.log(a)}function ia(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);E(a)}function sa(a){if(!(!a.oFeatures.bStateSave||typeof a.bDestroying!="undefined")){var b,c,d,f="{";f+='"iCreate":'+(new Date).getTime()+",";f+='"iStart":'+(a.oScroll.bInfinite?0:a._iDisplayStart)+",";f+='"iEnd":'+(a.oScroll.bInfinite?a._iDisplayLength:
a._iDisplayEnd)+",";f+='"iLength":'+a._iDisplayLength+",";f+='"sFilter":"'+encodeURIComponent(a.oPreviousSearch.sSearch)+'",';f+='"sFilterEsc":'+!a.oPreviousSearch.bRegex+",";f+='"aaSorting":[ ';for(b=0;b<a.aaSorting.length;b++)f+="["+a.aaSorting[b][0]+',"'+a.aaSorting[b][1]+'"],';f=f.substring(0,f.length-1);f+="],";f+='"aaSearchCols":[ ';for(b=0;b<a.aoPreSearchCols.length;b++)f+='["'+encodeURIComponent(a.aoPreSearchCols[b].sSearch)+'",'+!a.aoPreSearchCols[b].bRegex+"],";f=f.substring(0,f.length-
1);f+="],";f+='"abVisCols":[ ';for(b=0;b<a.aoColumns.length;b++)f+=a.aoColumns[b].bVisible+",";f=f.substring(0,f.length-1);f+="]";b=0;for(c=a.aoStateSave.length;b<c;b++){d=a.aoStateSave[b].fn(a,f);if(d!=="")f=d}f+="}";Sa(a.sCookiePrefix+a.sInstance,f,a.iCookieDuration,a.sCookiePrefix,a.fnCookieCallback)}}function Ta(a,b){if(a.oFeatures.bStateSave){var c,d,f;d=ta(a.sCookiePrefix+a.sInstance);if(d!==null&&d!==""){try{c=typeof i.parseJSON=="function"?i.parseJSON(d.replace(/'/g,'"')):eval("("+d+")")}catch(e){return}d=
0;for(f=a.aoStateLoad.length;d<f;d++)if(!a.aoStateLoad[d].fn(a,c))return;a.oLoadedState=i.extend(true,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.oPreviousSearch.sSearch=decodeURIComponent(c.sFilter);a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();if(typeof c.sFilterEsc!="undefined")a.oPreviousSearch.bRegex=!c.sFilterEsc;if(typeof c.aaSearchCols!="undefined")for(d=0;d<c.aaSearchCols.length;d++)a.aoPreSearchCols[d]=
{sSearch:decodeURIComponent(c.aaSearchCols[d][0]),bRegex:!c.aaSearchCols[d][1]};if(typeof c.abVisCols!="undefined"){b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++){b.saved_aoColumns[d]={};b.saved_aoColumns[d].bVisible=c.abVisCols[d]}}}}}function Sa(a,b,c,d,f){var e=new Date;e.setTime(e.getTime()+c*1E3);c=wa.location.pathname.split("/");a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase();var h;if(f!==null){h=typeof i.parseJSON=="function"?i.parseJSON(b):eval("("+b+")");b=f(a,h,e.toGMTString(),
c.join("/")+"/")}else b=a+"="+encodeURIComponent(b)+"; expires="+e.toGMTString()+"; path="+c.join("/")+"/";f="";e=9999999999999;if((ta(a)!==null?p.cookie.length:b.length+p.cookie.length)+10>4096){a=p.cookie.split(";");for(var j=0,k=a.length;j<k;j++)if(a[j].indexOf(d)!=-1){var m=a[j].split("=");try{h=eval("("+decodeURIComponent(m[1])+")")}catch(t){continue}if(typeof h.iCreate!="undefined"&&h.iCreate<e){f=m[0];e=h.iCreate}}if(f!=="")p.cookie=f+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+c.join("/")+
"/"}p.cookie=b}function ta(a){var b=wa.location.pathname.split("/");a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=";b=p.cookie.split(";");for(var c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return decodeURIComponent(d.substring(a.length,d.length))}return null}function W(a,b){b=b.getElementsByTagName("tr");var c,d,f,e,h,j,k,m,t=function(O,B,F){for(;typeof O[B][F]!="undefined";)F++;return F};a.splice(0,a.length);d=0;for(j=b.length;d<
j;d++)a.push([]);d=0;for(j=b.length;d<j;d++){f=0;for(k=b[d].childNodes.length;f<k;f++){c=b[d].childNodes[f];if(c.nodeName.toUpperCase()=="TD"||c.nodeName.toUpperCase()=="TH"){var q=c.getAttribute("colspan")*1,I=c.getAttribute("rowspan")*1;q=!q||q===0||q===1?1:q;I=!I||I===0||I===1?1:I;m=t(a,d,0);for(h=0;h<q;h++)for(e=0;e<I;e++){a[d+e][m+h]={cell:c,unique:q==1?true:false};a[d+e].nTr=b[d]}}}}}function S(a,b,c){var d=[];if(typeof c=="undefined"){c=a.aoHeader;if(typeof b!="undefined"){c=[];W(c,b)}}b=0;
for(var f=c.length;b<f;b++)for(var e=0,h=c[b].length;e<h;e++)if(c[b][e].unique&&(typeof d[e]=="undefined"||!a.bSortCellsTop))d[e]=c[b][e].cell;return d}function Ua(){var a=p.createElement("p"),b=a.style;b.width="100%";b.height="200px";var c=p.createElement("div");b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";b.height="150px";b.overflow="hidden";c.appendChild(a);p.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";a=a.offsetWidth;if(b==a)a=
c.clientWidth;p.body.removeChild(c);return b-a}function P(a,b,c){for(var d=0,f=b.length;d<f;d++)for(var e=0,h=b[d].childNodes.length;e<h;e++)if(b[d].childNodes[e].nodeType==1)typeof c!="undefined"?a(b[d].childNodes[e],c[d].childNodes[e]):a(b[d].childNodes[e])}function n(a,b,c,d){if(typeof d=="undefined")d=c;if(typeof b[c]!="undefined")a[d]=b[c]}function da(a,b,c){for(var d=[],f=0,e=a.aoColumns.length;f<e;f++)d.push(H(a,b,f,c));return d}function H(a,b,c,d){var f=a.aoColumns[c];if((c=f.fnGetData(a.aoData[b]._aData))===
undefined){if(a.iDrawError!=a.iDraw&&f.sDefaultContent===null){J(a,0,"Requested unknown parameter '"+f.mDataProp+"' from the data source for row "+b);a.iDrawError=a.iDraw}return f.sDefaultContent}if(c===null&&f.sDefaultContent!==null)c=f.sDefaultContent;if(d=="display"&&c===null)return"";return c}function N(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function Z(a){if(a===null)return function(){return null};else if(typeof a=="function")return function(c){return a(c)};else if(typeof a==
"string"&&a.indexOf(".")!=-1){var b=a.split(".");return b.length==2?function(c){return c[b[0]][b[1]]}:b.length==3?function(c){return c[b[0]][b[1]][b[2]]}:function(c){for(var d=0,f=b.length;d<f;d++)c=c[b[d]];return c}}else return function(c){return c[a]}}function ya(a){if(a===null)return function(){};else if(typeof a=="function")return function(c,d){return a(c,d)};else if(typeof a=="string"&&a.indexOf(".")!=-1){var b=a.split(".");return b.length==2?function(c,d){c[b[0]][b[1]]=d}:b.length==3?function(c,
d){c[b[0]][b[1]][b[2]]=d}:function(c,d){for(var f=0,e=b.length-1;f<e;f++)c=c[b[f]];c[b[b.length-1]]=d}}else return function(c,d){c[a]=d}}this.oApi={};this.fnDraw=function(a){var b=A(this[o.iApiIndex]);if(typeof a!="undefined"&&a===false){E(b);C(b)}else ba(b)};this.fnFilter=function(a,b,c,d,f){var e=A(this[o.iApiIndex]);if(e.oFeatures.bFilter){if(typeof c=="undefined")c=false;if(typeof d=="undefined")d=true;if(typeof f=="undefined")f=true;if(typeof b=="undefined"||b===null){M(e,{sSearch:a,bRegex:c,
bSmart:d},1);if(f&&typeof e.aanFeatures.f!="undefined"){b=e.aanFeatures.f;c=0;for(d=b.length;c<d;c++)i("input",b[c]).val(a)}}else{e.aoPreSearchCols[b].sSearch=a;e.aoPreSearchCols[b].bRegex=c;e.aoPreSearchCols[b].bSmart=d;M(e,e.oPreviousSearch,1)}}};this.fnSettings=function(){return A(this[o.iApiIndex])};this.fnVersionCheck=o.fnVersionCheck;this.fnSort=function(a){var b=A(this[o.iApiIndex]);b.aaSorting=a;R(b)};this.fnSortListener=function(a,b,c){ga(A(this[o.iApiIndex]),a,b,c)};this.fnAddData=function(a,
b){if(a.length===0)return[];var c=[],d,f=A(this[o.iApiIndex]);if(typeof a[0]=="object")for(var e=0;e<a.length;e++){d=v(f,a[e]);if(d==-1)return c;c.push(d)}else{d=v(f,a);if(d==-1)return c;c.push(d)}f.aiDisplay=f.aiDisplayMaster.slice();if(typeof b=="undefined"||b)ba(f);return c};this.fnDeleteRow=function(a,b,c){var d=A(this[o.iApiIndex]);a=typeof a=="object"?U(d,a):a;var f=d.aoData.splice(a,1),e=i.inArray(a,d.aiDisplay);d.asDataSearch.splice(e,1);ra(d.aiDisplayMaster,a);ra(d.aiDisplay,a);typeof b==
"function"&&b.call(this,d,f);if(d._iDisplayStart>=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[o.iApiIndex]);ia(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[o.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=X(d);if(typeof b.jquery!="undefined"||typeof b==
"object")e.appendChild(b);else e.innerHTML=b;b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[o.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a){(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr);b.aoOpenRows.splice(c,1);return 0}return 1};this.fnGetData=function(a,b){var c=A(this[o.iApiIndex]);if(typeof a!="undefined"){a=typeof a=="object"?U(c,a):a;if(typeof b!=
"undefined")return H(c,a,b,"");return typeof c.aoData[a]!="undefined"?c.aoData[a]._aData:null}return aa(c)};this.fnGetNodes=function(a){var b=A(this[o.iApiIndex]);if(typeof a!="undefined")return typeof b.aoData[a]!="undefined"?b.aoData[a].nTr:null;return $(b)};this.fnGetPosition=function(a){var b=A(this[o.iApiIndex]),c=a.nodeName.toUpperCase();if(c=="TR")return U(b,a);else if(c=="TD"||c=="TH"){c=U(b,a.parentNode);for(var d=Q(b,c),f=0;f<b.aoColumns.length;f++)if(d[f]==a)return[c,pa(b,f),f]}return null};
this.fnUpdate=function(a,b,c,d,f){var e=A(this[o.iApiIndex]);b=typeof b=="object"?U(e,b):b;if(i.isArray(a)&&typeof a=="object"){e.aoData[b]._aData=a.slice();for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(H(e,b,c),b,c,false,false)}else if(typeof a=="object"){e.aoData[b]._aData=i.extend(true,{},a);for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(H(e,b,c),b,c,false,false)}else{a=a;N(e,b,c,a);if(e.aoColumns[c].fnRender!==null){a=e.aoColumns[c].fnRender({iDataRow:b,iDataColumn:c,aData:e.aoData[b]._aData,
oSettings:e});e.aoColumns[c].bUseRendered&&N(e,b,c,a)}if(e.aoData[b].nTr!==null)Q(e,b)[c].innerHTML=a}c=i.inArray(b,e.aiDisplay);e.asDataSearch[c]=na(e,da(e,b,"filter"));if(typeof f=="undefined"||f)ca(e);if(typeof d=="undefined"||d)ba(e);return 0};this.fnSetColumnVis=function(a,b,c){var d=A(this[o.iApiIndex]),f,e;e=d.aoColumns.length;var h,j;if(d.aoColumns[a].bVisible!=b){if(b){for(f=j=0;f<a;f++)d.aoColumns[f].bVisible&&j++;j=j>=X(d);if(!j)for(f=a;f<e;f++)if(d.aoColumns[f].bVisible){h=f;break}f=0;
for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null)j?d.aoData[f].nTr.appendChild(d.aoData[f]._anHidden[a]):d.aoData[f].nTr.insertBefore(d.aoData[f]._anHidden[a],Q(d,f)[h])}else{f=0;for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null){h=Q(d,f)[a];d.aoData[f]._anHidden[a]=h;h.parentNode.removeChild(h)}}d.aoColumns[a].bVisible=b;L(d,d.aoHeader);d.nTFoot&&L(d,d.aoFooter);f=0;for(e=d.aoOpenRows.length;f<e;f++)d.aoOpenRows[f].nTr.colSpan=X(d);if(typeof c=="undefined"||c){ca(d);C(d)}sa(d)}};this.fnPageChange=
function(a,b){var c=A(this[o.iApiIndex]);ja(c,a);E(c);if(typeof b=="undefined"||b)C(c)};this.fnDestroy=function(){var a=A(this[o.iApiIndex]),b=a.nTableWrapper.parentNode,c=a.nTBody,d,f;a.bDestroying=true;d=0;for(f=a.aoColumns.length;d<f;d++)a.aoColumns[d].bVisible===false&&this.fnSetColumnVis(d,true);i(a.nTableWrapper).find("*").andSelf().unbind(".DT");i("tbody>tr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();if(a.nTable!=a.nTHead.parentNode){i(">thead",a.nTable).remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&&
a.nTable!=a.nTFoot.parentNode){i(">tfoot",a.nTable).remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);i(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];T(a);i($(a)).removeClass(a.asStripClasses.join(" "));if(a.bJUI){i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oJUIClasses.sSortableAsc,o.oJUIClasses.sSortableDesc,o.oJUIClasses.sSortableNone].join(" "));i("th span."+o.oJUIClasses.sSortIcon,a.nTHead).remove();i("th",a.nTHead).each(function(){var e=
i("div."+o.oJUIClasses.sSortJUIWrapper,this),h=e.contents();i(this).append(h);e.remove()})}else i("th",a.nTHead).removeClass([o.oStdClasses.sSortable,o.oStdClasses.sSortableAsc,o.oStdClasses.sSortableDesc,o.oStdClasses.sSortableNone].join(" "));a.nTableReinsertBefore?b.insertBefore(a.nTable,a.nTableReinsertBefore):b.appendChild(a.nTable);d=0;for(f=a.aoData.length;d<f;d++)a.aoData[d].nTr!==null&&c.appendChild(a.aoData[d].nTr);if(a.oFeatures.bAutoWidth===true)a.nTable.style.width=u(a.sDestroyWidth);
i(">tr:even",c).addClass(a.asDestoryStrips[0]);i(">tr:odd",c).addClass(a.asDestoryStrips[1]);d=0;for(f=D.length;d<f;d++)D[d]==a&&D.splice(d,1);a=null};this.fnAdjustColumnSizing=function(a){var b=A(this[o.iApiIndex]);ca(b);if(typeof a=="undefined"||a)this.fnDraw(false);else if(b.oScroll.sX!==""||b.oScroll.sY!=="")this.oApi._fnScrollDraw(b)};for(var ua in o.oApi)if(ua)this[ua]=r(ua);this.oApi._fnExternApiFunc=r;this.oApi._fnInitalise=s;this.oApi._fnInitComplete=w;this.oApi._fnLanguageProcess=y;this.oApi._fnAddColumn=
G;this.oApi._fnColumnOptions=x;this.oApi._fnAddData=v;this.oApi._fnCreateTr=z;this.oApi._fnGatherData=Y;this.oApi._fnBuildHead=V;this.oApi._fnDrawHead=L;this.oApi._fnDraw=C;this.oApi._fnReDraw=ba;this.oApi._fnAjaxUpdate=za;this.oApi._fnAjaxUpdateDraw=Aa;this.oApi._fnAddOptionsHtml=xa;this.oApi._fnFeatureHtmlTable=Fa;this.oApi._fnScrollDraw=Ia;this.oApi._fnAjustColumnSizing=ca;this.oApi._fnFeatureHtmlFilter=Da;this.oApi._fnFilterComplete=M;this.oApi._fnFilterCustom=Ma;this.oApi._fnFilterColumn=La;
this.oApi._fnFilter=Ka;this.oApi._fnBuildSearchArray=ka;this.oApi._fnBuildSearchRow=na;this.oApi._fnFilterCreateSearch=la;this.oApi._fnDataToSearch=ma;this.oApi._fnSort=R;this.oApi._fnSortAttachListener=ga;this.oApi._fnSortingClasses=T;this.oApi._fnFeatureHtmlPaginate=Ha;this.oApi._fnPageChange=ja;this.oApi._fnFeatureHtmlInfo=Ga;this.oApi._fnUpdateInfo=Na;this.oApi._fnFeatureHtmlLength=Ca;this.oApi._fnFeatureHtmlProcessing=Ea;this.oApi._fnProcessingDisplay=K;this.oApi._fnVisibleToColumnIndex=Ja;this.oApi._fnColumnIndexToVisible=
pa;this.oApi._fnNodeToDataIndex=U;this.oApi._fnVisbleColumns=X;this.oApi._fnCalculateEnd=E;this.oApi._fnConvertToWidth=Oa;this.oApi._fnCalculateColumnWidths=ea;this.oApi._fnScrollingWidthAdjust=Qa;this.oApi._fnGetWidestNode=Pa;this.oApi._fnGetMaxLenString=Ra;this.oApi._fnStringToCss=u;this.oApi._fnArrayCmp=Va;this.oApi._fnDetectType=fa;this.oApi._fnSettingsFromNode=A;this.oApi._fnGetDataMaster=aa;this.oApi._fnGetTrNodes=$;this.oApi._fnGetTdNodes=Q;this.oApi._fnEscapeRegex=oa;this.oApi._fnDeleteIndex=
ra;this.oApi._fnReOrderIndex=Ba;this.oApi._fnColumnOrdering=ha;this.oApi._fnLog=J;this.oApi._fnClearTable=ia;this.oApi._fnSaveState=sa;this.oApi._fnLoadState=Ta;this.oApi._fnCreateCookie=Sa;this.oApi._fnReadCookie=ta;this.oApi._fnDetectHeader=W;this.oApi._fnGetUniqueThs=S;this.oApi._fnScrollBarWidth=Ua;this.oApi._fnApplyToChildren=P;this.oApi._fnMap=n;this.oApi._fnGetRowData=da;this.oApi._fnGetCellData=H;this.oApi._fnSetCellData=N;this.oApi._fnGetObjectDataFn=Z;this.oApi._fnSetObjectDataFn=ya;var va=
this;return this.each(function(){var a=0,b,c,d,f;a=0;for(b=D.length;a<b;a++){if(D[a].nTable==this)if(typeof g=="undefined"||typeof g.bRetrieve!="undefined"&&g.bRetrieve===true)return D[a].oInstance;else if(typeof g.bDestroy!="undefined"&&g.bDestroy===true){D[a].oInstance.fnDestroy();break}else{J(D[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).");
return}if(D[a].sTableId!==""&&D[a].sTableId==this.getAttribute("id")){D.splice(a,1);break}}var e=new l;D.push(e);var h=false,j=false;a=this.getAttribute("id");if(a!==null){e.sTableId=a;e.sInstance=a}else e.sInstance=o._oExternConfig.iNextUnique++;if(this.nodeName.toLowerCase()!="table")J(e,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{e.nTable=this;e.oInstance=va.length==1?va:i(this).dataTable();e.oApi=va.oApi;e.sDestroyWidth=i(this).width();if(typeof g!=
"undefined"&&g!==null){e.oInit=g;n(e.oFeatures,g,"bPaginate");n(e.oFeatures,g,"bLengthChange");n(e.oFeatures,g,"bFilter");n(e.oFeatures,g,"bSort");n(e.oFeatures,g,"bInfo");n(e.oFeatures,g,"bProcessing");n(e.oFeatures,g,"bAutoWidth");n(e.oFeatures,g,"bSortClasses");n(e.oFeatures,g,"bServerSide");n(e.oFeatures,g,"bDeferRender");n(e.oScroll,g,"sScrollX","sX");n(e.oScroll,g,"sScrollXInner","sXInner");n(e.oScroll,g,"sScrollY","sY");n(e.oScroll,g,"bScrollCollapse","bCollapse");n(e.oScroll,g,"bScrollInfinite",
"bInfinite");n(e.oScroll,g,"iScrollLoadGap","iLoadGap");n(e.oScroll,g,"bScrollAutoCss","bAutoCss");n(e,g,"asStripClasses");n(e,g,"fnPreDrawCallback");n(e,g,"fnRowCallback");n(e,g,"fnHeaderCallback");n(e,g,"fnFooterCallback");n(e,g,"fnCookieCallback");n(e,g,"fnInitComplete");n(e,g,"fnServerData");n(e,g,"fnFormatNumber");n(e,g,"aaSorting");n(e,g,"aaSortingFixed");n(e,g,"aLengthMenu");n(e,g,"sPaginationType");n(e,g,"sAjaxSource");n(e,g,"sAjaxDataProp");n(e,g,"iCookieDuration");n(e,g,"sCookiePrefix");
n(e,g,"sDom");n(e,g,"bSortCellsTop");n(e,g,"oSearch","oPreviousSearch");n(e,g,"aoSearchCols","aoPreSearchCols");n(e,g,"iDisplayLength","_iDisplayLength");n(e,g,"bJQueryUI","bJUI");n(e.oLanguage,g,"fnInfoCallback");typeof g.fnDrawCallback=="function"&&e.aoDrawCallback.push({fn:g.fnDrawCallback,sName:"user"});typeof g.fnStateSaveCallback=="function"&&e.aoStateSave.push({fn:g.fnStateSaveCallback,sName:"user"});typeof g.fnStateLoadCallback=="function"&&e.aoStateLoad.push({fn:g.fnStateLoadCallback,sName:"user"});
if(e.oFeatures.bServerSide&&e.oFeatures.bSort&&e.oFeatures.bSortClasses)e.aoDrawCallback.push({fn:T,sName:"server_side_sort_classes"});else e.oFeatures.bDeferRender&&e.aoDrawCallback.push({fn:T,sName:"defer_sort_classes"});if(typeof g.bJQueryUI!="undefined"&&g.bJQueryUI){e.oClasses=o.oJUIClasses;if(typeof g.sDom=="undefined")e.sDom='<"H"lfr>t<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ua();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=
g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ta(e,g);e.aoDrawCallback.push({fn:sa,sName:"state_save"})}if(typeof g.iDeferLoading!="undefined"){e.bDeferLoading=true;e._iRecordsTotal=g.iDeferLoading;e._iRecordsDisplay=g.iDeferLoading}if(typeof g.aaData!="undefined")j=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!==
""){e.oLanguage.sUrl=g.oLanguage.sUrl;i.getJSON(e.oLanguage.sUrl,null,function(t){y(e,t,true)});h=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=i(">tbody>tr",this);a=0;for(b=e.asStripClasses.length;a<b;a++)if(d.filter(":lt(2)").hasClass(e.asStripClasses[a])){c=true;break}if(c){e.asDestoryStrips=["",""];if(i(d[0]).hasClass(e.oClasses.sStripOdd))e.asDestoryStrips[0]+=
e.oClasses.sStripOdd+" ";if(i(d[0]).hasClass(e.oClasses.sStripEven))e.asDestoryStrips[0]+=e.oClasses.sStripEven;if(i(d[1]).hasClass(e.oClasses.sStripOdd))e.asDestoryStrips[1]+=e.oClasses.sStripOdd+" ";if(i(d[1]).hasClass(e.oClasses.sStripEven))e.asDestoryStrips[1]+=e.oClasses.sStripEven;d.removeClass(e.asStripClasses.join(" "))}c=[];var k;a=this.getElementsByTagName("thead");if(a.length!==0){W(e.aoHeader,a[0]);c=S(e)}if(typeof g.aoColumns=="undefined"){k=[];a=0;for(b=c.length;a<b;a++)k.push(null)}else k=
g.aoColumns;a=0;for(b=k.length;a<b;a++){if(typeof g.saved_aoColumns!="undefined"&&g.saved_aoColumns.length==b){if(k[a]===null)k[a]={};k[a].bVisible=g.saved_aoColumns[a].bVisible}G(e,c?c[a]:null)}if(typeof g.aoColumnDefs!="undefined")for(a=g.aoColumnDefs.length-1;a>=0;a--){var m=g.aoColumnDefs[a].aTargets;i.isArray(m)||J(e,1,"aTargets must be an array of targets, not a "+typeof m);c=0;for(d=m.length;c<d;c++)if(typeof m[c]=="number"&&m[c]>=0){for(;e.aoColumns.length<=m[c];)G(e);x(e,m[c],g.aoColumnDefs[a])}else if(typeof m[c]==
"number"&&m[c]<0)x(e,e.aoColumns.length+m[c],g.aoColumnDefs[a]);else if(typeof m[c]=="string"){b=0;for(f=e.aoColumns.length;b<f;b++)if(m[c]=="_all"||i(e.aoColumns[b].nTh).hasClass(m[c]))x(e,b,g.aoColumnDefs[a])}}if(typeof k!="undefined"){a=0;for(b=k.length;a<b;a++)x(e,a,k[a])}a=0;for(b=e.aaSorting.length;a<b;a++){if(e.aaSorting[a][0]>=e.aoColumns.length)e.aaSorting[a][0]=0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&&
typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;c<d;c++)if(e.aaSorting[a][1]==k.asSorting[c]){e.aaSorting[a][2]=c;break}}T(e);a=i(">thead",this);if(a.length===0){a=[p.createElement("thead")];this.appendChild(a[0])}e.nTHead=a[0];a=i(">tbody",this);if(a.length===0){a=[p.createElement("tbody")];this.appendChild(a[0])}e.nTBody=a[0];a=i(">tfoot",this);if(a.length>0){e.nTFoot=a[0];W(e.aoFooter,e.nTFoot)}if(j)for(a=0;a<g.aaData.length;a++)v(e,g.aaData[a]);
else Y(e);e.aiDisplay=e.aiDisplayMaster.slice();e.bInitialised=true;h===false&&s(e)}})}})($,window,document);

View File

@@ -0,0 +1,8 @@
<?php
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,8 @@
<?php
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,355 @@
(function($) {
$.jGrowl = function(m, o) {
if ($('#jGrowl').size() == 0)
$('<div id="jGrowl"></div>').addClass(
(o && o.position) ? o.position
: $.jGrowl.defaults.position).appendTo('body');
$('#jGrowl').jGrowl(m, o);
};
$.fn.jGrowl = function(m, o) {
if ($.isFunction(this.each)) {
var args = arguments;
return this.each(function() {
var self = this;
if ($(this).data('jGrowl.instance') == undefined) {
$(this).data('jGrowl.instance',
$.extend(new $.fn.jGrowl(), {
notifications : [],
element : null,
interval : null
}));
$(this).data('jGrowl.instance').startup(this);
}
if ($.isFunction($(this).data('jGrowl.instance')[m])) {
$(this).data('jGrowl.instance')[m].apply($(this)
.data('jGrowl.instance'), $.makeArray(args)
.slice(1));
} else {
$(this).data('jGrowl.instance').create(m, o);
}
});
}
;
};
$
.extend(
$.fn.jGrowl.prototype,
{
defaults : {
pool : 0,
header : '',
group : '',
sticky : false,
position : 'top-right',
glue : 'after',
theme : 'default',
themeState : 'highlight',
corners : '10px',
check : 250,
life : 3000,
closeDuration : 'normal',
openDuration : 'normal',
easing : 'swing',
closer : true,
closeTemplate : '&times;',
closerTemplate : '<div>[ close all ]</div>',
log : function(e, m, o) {
},
beforeOpen : function(e, m, o) {
},
afterOpen : function(e, m, o) {
},
open : function(e, m, o) {
},
beforeClose : function(e, m, o) {
},
close : function(e, m, o) {
},
animateOpen : {
opacity : 'show'
},
animateClose : {
opacity : 'hide'
}
},
notifications : [],
element : null,
interval : null,
create : function(message, o) {
var o = $.extend({}, this.defaults, o);
if (typeof o.speed !== 'undefined') {
o.openDuration = o.speed;
o.closeDuration = o.speed;
}
this.notifications.push({
message : message,
options : o
});
o.log.apply(this.element, [ this.element, message,
o ]);
},
render : function(notification) {
var self = this;
var message = notification.message;
var o = notification.options;
var notification = $(
'<div class="jGrowl-notification '
+ o.themeState
+ ' ui-corner-all'
+ ((o.group != undefined && o.group != '') ? ' '
+ o.group
: '') + '">'
+ '<div class="jGrowl-close">'
+ o.closeTemplate + '</div>'
+ '<div class="jGrowl-header">'
+ o.header + '</div>'
+ '<div class="jGrowl-message">'
+ message + '</div></div>').data(
"jGrowl", o).addClass(o.theme).children(
'div.jGrowl-close').bind(
"click.jGrowl",
function() {
$(this).parent().trigger(
'jGrowl.close');
}).parent();
$(notification)
.bind(
"mouseover.jGrowl",
function() {
$(
'div.jGrowl-notification',
self.element).data(
"jGrowl.pause", true);
})
.bind(
"mouseout.jGrowl",
function() {
$(
'div.jGrowl-notification',
self.element).data(
"jGrowl.pause", false);
})
.bind(
'jGrowl.beforeOpen',
function() {
if (o.beforeOpen.apply(
notification, [
notification,
message, o,
self.element ]) != false) {
$(this).trigger(
'jGrowl.open');
}
})
.bind(
'jGrowl.open',
function() {
if (o.open.apply(notification,
[ notification,
message, o,
self.element ]) != false) {
if (o.glue == 'after') {
$(
'div.jGrowl-notification:last',
self.element)
.after(
notification);
} else {
$(
'div.jGrowl-notification:first',
self.element)
.before(
notification);
}
$(this)
.animate(
o.animateOpen,
o.openDuration,
o.easing,
function() {
if ($.browser.msie
&& (parseInt(
$(
this)
.css(
'opacity'),
10) === 1 || parseInt(
$(
this)
.css(
'opacity'),
10) === 0))
this.style
.removeAttribute('filter');
if ($(
this)
.data(
"jGrowl") != null)
$(
this)
.data(
"jGrowl").created = new Date();
$(
this)
.trigger(
'jGrowl.afterOpen');
});
}
})
.bind(
'jGrowl.afterOpen',
function() {
o.afterOpen.apply(notification,
[ notification,
message, o,
self.element ]);
})
.bind(
'jGrowl.beforeClose',
function() {
if (o.beforeClose.apply(
notification, [
notification,
message, o,
self.element ]) != false)
$(this).trigger(
'jGrowl.close');
})
.bind(
'jGrowl.close',
function() {
$(this).data(
'jGrowl.pause', true);
$(this)
.animate(
o.animateClose,
o.closeDuration,
o.easing,
function() {
if ($
.isFunction(o.close)) {
if (o.close
.apply(
notification,
[
notification,
message,
o,
self.element ]) !== false)
$(
this)
.remove();
} else {
$(
this)
.remove();
}
});
}).trigger('jGrowl.beforeOpen');
if (o.corners != '' && $.fn.corner != undefined)
$(notification).corner(o.corners);
if ($('div.jGrowl-notification:parent',
self.element).size() > 1
&& $('div.jGrowl-closer', self.element)
.size() == 0
&& this.defaults.closer != false) {
$(this.defaults.closerTemplate)
.addClass(
'jGrowl-closer ui-state-highlight ui-corner-all')
.addClass(this.defaults.theme)
.appendTo(self.element)
.animate(this.defaults.animateOpen,
this.defaults.speed,
this.defaults.easing)
.bind(
"click.jGrowl",
function() {
$(this)
.siblings()
.trigger(
"jGrowl.beforeClose");
if ($
.isFunction(self.defaults.closer)) {
self.defaults.closer
.apply(
$(
this)
.parent()[0],
[ $(
this)
.parent()[0] ]);
}
});
}
;
},
update : function() {
$(this.element)
.find('div.jGrowl-notification:parent')
.each(
function() {
if ($(this).data("jGrowl") != undefined
&& $(this).data(
"jGrowl").created != undefined
&& ($(this).data(
"jGrowl").created
.getTime() + parseInt($(
this).data(
"jGrowl").life)) < (new Date())
.getTime()
&& $(this).data(
"jGrowl").sticky != true
&& ($(this).data(
"jGrowl.pause") == undefined || $(
this).data(
"jGrowl.pause") != true)) {
$(this)
.trigger(
'jGrowl.beforeClose');
}
});
if (this.notifications.length > 0
&& (this.defaults.pool == 0 || $(
this.element).find(
'div.jGrowl-notification:parent')
.size() < this.defaults.pool))
this.render(this.notifications.shift());
if ($(this.element).find(
'div.jGrowl-notification:parent').size() < 2) {
$(this.element).find('div.jGrowl-closer')
.animate(this.defaults.animateClose,
this.defaults.speed,
this.defaults.easing,
function() {
$(this).remove();
});
}
},
startup : function(e) {
this.element = $(e).addClass('jGrowl').append(
'<div class="jGrowl-notification"></div>');
this.interval = setInterval(function() {
$(e).data('jGrowl.instance').update();
}, parseInt(this.defaults.check));
if ($.browser.msie
&& parseInt($.browser.version) < 7
&& !window["XMLHttpRequest"]) {
$(this.element).addClass('ie6');
}
},
shutdown : function() {
$(this.element).removeClass('jGrowl').find(
'div.jGrowl-notification').remove();
clearInterval(this.interval);
},
close : function() {
$(this.element).find('div.jGrowl-notification')
.each(
function() {
$(this).trigger(
'jGrowl.beforeClose');
});
}
});
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
})($)

View File

@@ -0,0 +1,14 @@
/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1.0.16
*
* Requires: jQuery >= 1.2.3
*/
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
}else{a(jQuery);}}(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';
}var f={absolute:false,clone:false,includeMargin:false,display:"block"};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";
e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");
d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");
}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));

View File

@@ -0,0 +1,826 @@
/*!
* jQuery Form Plugin
* version: 2.73 (03-MAY-2011)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are intended to be exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function() {
$('#myForm').bind('submit', function(e) {
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#output'
});
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#output'
});
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
*/
$.fn.ajaxSubmit = function(options) {
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
if (typeof options == 'function') {
options = { success: options };
}
var action = this.attr('action');
var url = (typeof action === 'string') ? $.trim(action) : '';
if (url) {
// clean url (don't include hash vaue)
url = (url.match(/^([^#]+)/)||[])[1];
}
url = url || window.location.href || '';
options = $.extend(true, {
url: url,
success: $.ajaxSettings.success,
type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
}, options);
// hook for manipulating the form data before it is extracted;
// convenient for use with rich editors like tinyMCE or FCKEditor
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
// provide opportunity to alter form data before it is serialized
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var n,v,a = this.formToArray(options.semantic);
if (options.data) {
options.extraData = options.data;
for (n in options.data) {
if(options.data[n] instanceof Array) {
for (var k in options.data[n]) {
a.push( { name: n, value: options.data[n][k] } );
}
}
else {
v = options.data[n];
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
a.push( { name: n, value: v } );
}
}
}
// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a);
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
}
else {
options.data = q; // data is the query string for 'post'
}
var $form = this, callbacks = [];
if (options.resetForm) {
callbacks.push(function() { $form.resetForm(); });
}
if (options.clearForm) {
callbacks.push(function() { $form.clearForm(); });
}
// perform a load on the target only if dataType is not provided
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};
callbacks.push(function(data) {
var fn = options.replaceTarget ? 'replaceWith' : 'html';
$(options.target)[fn](data).each(oldSuccess, arguments);
});
}
else if (options.success) {
callbacks.push(options.success);
}
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
var context = options.context || options; // jQuery 1.4+ supports scope context
for (var i=0, max=callbacks.length; i < max; i++) {
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
}
};
// are there files to upload?
var fileInputs = $('input:file', this).length > 0;
var mp = 'multipart/form-data';
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
// options.iframe allows user to force iframe mode
// 06-NOV-09: now defaulting to iframe mode if file input is detected
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
// hack to fix Safari hang (thanks to Tim Molendijk for this)
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
if (options.closeKeepAlive) {
$.get(options.closeKeepAlive, fileUpload);
}
else {
fileUpload();
}
}
else {
$.ajax(options);
}
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
return this;
// private function for handling file uploads (hat tip to YAHOO!)
function fileUpload() {
var form = $form[0];
if ($(':input[name=submit],:input[id=submit]', form).length) {
// if there is an input with a name or id of 'submit' then we won't be
// able to invoke the submit fn on the form (at least not x-browser)
alert('Error: Form elements must not have name or id of "submit".');
return;
}
var s = $.extend(true, {}, $.ajaxSettings, options);
s.context = s.context || s;
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
var io = $io[0];
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
var xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function(status) {
var e = (status === 'timeout' ? 'timeout' : 'aborted');
log('aborting upload... ' + e);
this.aborted = 1;
$io.attr('src', s.iframeSrc); // abort op in progress
xhr.error = e;
s.error && s.error.call(s.context, xhr, e, e);
g && $.event.trigger("ajaxError", [xhr, s, e]);
s.complete && s.complete.call(s.context, xhr, e);
}
};
var g = s.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && ! $.active++) {
$.event.trigger("ajaxStart");
}
if (g) {
$.event.trigger("ajaxSend", [xhr, s]);
}
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
if (s.global) {
$.active--;
}
return;
}
if (xhr.aborted) {
return;
}
var timedOut = 0, timeoutHandle;
// add submitting element to data if we know it
var sub = form.clk;
if (sub) {
var n = sub.name;
if (n && !sub.disabled) {
s.extraData = s.extraData || {};
s.extraData[n] = sub.value;
if (sub.type == "image") {
s.extraData[n+'.x'] = form.clk_x;
s.extraData[n+'.y'] = form.clk_y;
}
}
}
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (form.getAttribute('method') != 'POST') {
form.setAttribute('method', 'POST');
}
if (form.getAttribute('action') != s.url) {
form.setAttribute('action', s.url);
}
// ie borks in some cases when setting encoding
if (! s.skipEncodingOverride) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (s.timeout) {
timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
}
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (s.extraData) {
for (var n in s.extraData) {
extraInputs.push(
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
.appendTo(form)[0]);
}
}
// add iframe to doc and submit the form
$io.appendTo('body');
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
form.submit();
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
if(t) {
form.setAttribute('target', t);
} else {
$form.removeAttr('target');
}
$(extraInputs).remove();
}
}
if (s.forceSync) {
doSubmit();
}
else {
setTimeout(doSubmit, 10); // this lets dom updates render
}
var data, doc, domCheckCount = 50, callbackProcessed;
function cb(e) {
if (xhr.aborted || callbackProcessed) {
return;
}
if (e === true && xhr) {
xhr.abort('timeout');
return;
}
var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
if (!doc || doc.location.href == s.iframeSrc) {
// response not received yet
if (!timedOut)
return;
}
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
var ok = true;
try {
if (timedOut) {
throw 'timeout';
}
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml='+isXml);
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
if (--domCheckCount) {
// in some browsers (Opera) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}
// let this fall through because server response could be an empty document
//log('Could not access iframe DOM after mutiple tries.');
//throw 'DOMException: not available';
}
//log('response detected');
xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
if (isXml)
s.dataType = 'xml';
xhr.getResponseHeader = function(header){
var headers = {'content-type': s.dataType};
return headers[header];
};
var scr = /(json|script|text)/.test(s.dataType);
if (scr || s.textarea) {
// see if user embedded response in textarea
var ta = doc.getElementsByTagName('textarea')[0];
if (ta) {
xhr.responseText = ta.value;
}
else if (scr) {
// account for browsers injecting pre around json response
var pre = doc.getElementsByTagName('pre')[0];
var b = doc.getElementsByTagName('body')[0];
if (pre) {
xhr.responseText = pre.textContent;
}
else if (b) {
xhr.responseText = b.innerHTML;
}
}
}
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
xhr.responseXML = toXml(xhr.responseText);
}
data = httpData(xhr, s.dataType, s);
}
catch(e){
log('error caught:',e);
ok = false;
xhr.error = e;
s.error && s.error.call(s.context, xhr, 'error', e);
g && $.event.trigger("ajaxError", [xhr, s, e]);
}
if (xhr.aborted) {
log('upload aborted');
ok = false;
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
s.success && s.success.call(s.context, data, 'success', xhr);
g && $.event.trigger("ajaxSuccess", [xhr, s]);
}
g && $.event.trigger("ajaxComplete", [xhr, s]);
if (g && ! --$.active) {
$.event.trigger("ajaxStop");
}
s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
callbackProcessed = true;
if (s.timeout)
clearTimeout(timeoutHandle);
// clean up
setTimeout(function() {
$io.removeData('form-plugin-onload');
$io.remove();
xhr.responseXML = null;
}, 100);
}
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else {
doc = (new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
};
var parseJSON = $.parseJSON || function(s) {
return window['eval']('(' + s + ')');
};
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
var ct = xhr.getResponseHeader('content-type') || '',
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.nodeName === 'parsererror') {
$.error && $.error('parsererror');
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
}
if (typeof data === 'string') {
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
data = parseJSON(data);
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
$.globalEval(data);
}
}
return data;
};
}
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
// in jQuery 1.3+ we can fix mistakes with the ready state
if (this.length === 0) {
var o = { s: this.selector, c: this.context };
if (!$.isReady && o.s) {
log('DOM not ready, queuing ajaxForm');
$(function() {
$(o.s,o.c).ajaxForm(options);
});
return this;
}
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
e.preventDefault();
$(this).ajaxSubmit(options);
}
}).bind('click.form-plugin', function(e) {
var target = e.target;
var $el = $(target);
if (!($el.is(":submit,input:image"))) {
// is this a child element of the submit el? (ex: a span within a button)
var t = $el.closest(':submit');
if (t.length == 0) {
return;
}
target = t[0];
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
});
};
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
return this.unbind('submit.form-plugin click.form-plugin');
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic) {
var a = [];
if (this.length === 0) {
return a;
}
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) {
return a;
}
var i,j,n,v,el,max,jmax;
for(i=0, max=els.length; i < max; i++) {
el = els[i];
n = el.name;
if (!n) {
continue;
}
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
a.push({name: n, value: $(el).val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
for(j=0, jmax=v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: n, value: v});
}
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0];
n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) {
return;
}
var v = $.fieldValue(this, ful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++) {
a.push({name: n, value: v[i]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: this.name, value: v});
}
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $(':text').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $(':checkbox').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $(':radio').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
v.constructor == Array ? $.merge(val, v) : val.push(v);
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (successful === undefined) {
successful = true;
}
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1)) {
return null;
}
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) {
return null;
}
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) { // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
}
if (one) {
return v;
}
a.push(v);
}
}
return a;
}
return $(el).val();
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea') {
this.value = '';
}
else if (t == 'checkbox' || t == 'radio') {
this.checked = false;
}
else if (tag == 'select') {
this.selectedIndex = -1;
}
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
this.reset();
}
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b === undefined) {
b = true;
}
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select === undefined) {
select = true;
}
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio') {
this.checked = select;
}
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
if ($.fn.ajaxSubmit.debug) {
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}
};
})($);

View File

@@ -0,0 +1,191 @@
/*
* TipTip
* Copyright 2010 Drew Wilson
* www.drewwilson.com
* code.drewwilson.com/entry/tiptip-jquery-plugin
*
* Version 1.3 - Updated: Mar. 23, 2010
*
* This Plug-In will create a custom tooltip to replace the default
* browser tooltip. It is extremely lightweight and very smart in
* that it detects the edges of the browser window and will make sure
* the tooltip stays within the current window size. As a result the
* tooltip will adjust itself to be displayed above, below, to the left
* or to the right depending on what is necessary to stay within the
* browser window. It is completely customizable as well via CSS.
*
* This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($){
$.fn.tipTip = function(options) {
var defaults = {
activation: "hover",
keepAlive: false,
maxWidth: "200px",
edgeOffset: 3,
defaultPosition: "bottom",
delay: 400,
fadeIn: 200,
fadeOut: 200,
attribute: "title",
content: false, // HTML or String to fill TipTIp with
enter: function(){},
exit: function(){}
};
var opts = $.extend(defaults, options);
// Setup tip tip elements and render them to the DOM
if($("#tiptip_holder").length <= 0){
var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
var tiptip_content = $('<div id="tiptip_content"></div>');
var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
} else {
var tiptip_holder = $("#tiptip_holder");
var tiptip_content = $("#tiptip_content");
var tiptip_arrow = $("#tiptip_arrow");
}
return this.each(function(){
var org_elem = $(this);
if(opts.content){
var org_title = opts.content;
} else {
var org_title = org_elem.attr(opts.attribute);
}
if(org_title != ""){
if(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute
}
var timeout = false;
if(opts.activation == "hover"){
org_elem.hover(function(){
active_tiptip();
}, function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
deactive_tiptip();
});
}
} else if(opts.activation == "focus"){
org_elem.focus(function(){
active_tiptip();
}).blur(function(){
deactive_tiptip();
});
} else if(opts.activation == "click"){
org_elem.click(function(){
active_tiptip();
return false;
}).hover(function(){},function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
deactive_tiptip();
});
}
}
function active_tiptip(){
opts.enter.call(this);
tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin","0");
tiptip_arrow.removeAttr("style");
var top = parseInt(org_elem.offset()['top']);
var left = parseInt(org_elem.offset()['left']);
var org_width = parseInt(org_elem.outerWidth());
var org_height = parseInt(org_elem.outerHeight());
var tip_w = tiptip_holder.outerWidth();
var tip_h = tiptip_holder.outerHeight();
var w_compare = Math.round((org_width - tip_w) / 2);
var h_compare = Math.round((org_height - tip_h) / 2);
var marg_left = Math.round(left + w_compare);
var marg_top = Math.round(top + org_height + opts.edgeOffset);
var t_class = "";
var arrow_top = "";
var arrow_left = Math.round(tip_w - 12) / 2;
if(opts.defaultPosition == "bottom"){
t_class = "_bottom";
} else if(opts.defaultPosition == "top"){
t_class = "_top";
} else if(opts.defaultPosition == "left"){
t_class = "_left";
} else if(opts.defaultPosition == "right"){
t_class = "_right";
}
var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
var left_compare = (tip_w + left) > parseInt($(window).width());
if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
t_class = "_right";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = -12;
marg_left = Math.round(left + org_width + opts.edgeOffset);
marg_top = Math.round(top + h_compare);
} else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
t_class = "_left";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = Math.round(tip_w);
marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
marg_top = Math.round(top + h_compare);
}
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
if(t_class == "_top" || t_class == "_bottom"){
t_class = "_top";
} else {
t_class = t_class+"_top";
}
arrow_top = tip_h;
marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
} else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
if(t_class == "_top" || t_class == "_bottom"){
t_class = "_bottom";
} else {
t_class = t_class+"_bottom";
}
arrow_top = -12;
marg_top = Math.round(top + org_height + opts.edgeOffset);
}
if(t_class == "_right_top" || t_class == "_left_top"){
marg_top = marg_top + 5;
} else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
marg_top = marg_top - 5;
}
if(t_class == "_left_top" || t_class == "_left_bottom"){
marg_left = marg_left + 5;
}
tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
if (timeout){ clearTimeout(timeout); }
timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
}
function deactive_tiptip(){
opts.exit.call(this);
if (timeout){ clearTimeout(timeout); }
tiptip_holder.fadeOut(opts.fadeOut);
}
}
});
}
})($);

View File

@@ -0,0 +1,11 @@
/*
* jQuery UI Touch Punch 0.2.2
*
* Copyright 2011, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);

View File

@@ -0,0 +1,8 @@
<?php
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,417 @@
/*
* jQuery blockUI plugin
* Version 2.20 (19-MAY-2009)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
;(function($) {
$.fn._fadeIn = $.fn.fadeIn;
var setExpr = (function() {
if (!$.browser.msie) return false;
var div = document.createElement('div');
try { div.style.setExpression('width','0+0'); }
catch(e) { return false; }
return true;
})();
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};
// plugin method for blocking element content
$.fn.block = function(opts) {
return this.unblock({ fadeOut: 0 }).each(function() {
if ($.css(this,'position') == 'static')
this.style.position = 'relative';
if ($.browser.msie)
this.style.zoom = 1; // force 'hasLayout'
install(this, opts);
});
};
// plugin method for unblocking element content
$.fn.unblock = function(opts) {
return this.each(function() {
remove(this, opts);
});
};
$.blockUI.version = 2.20; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// message displayed when blocking (use null for no message)
message: '<h1>Please wait...</h1>',
// styles for the message when blocking; if you wish to disable
// these and use an external stylesheet then do this in your code:
// $.blockUI.defaults.css = {};
css: {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: '3px solid #aaa',
backgroundColor:'#fff',
cursor: 'wait'
},
// styles for the overlay
overlayCSS: {
backgroundColor: '#000',
opacity: 0.6,
cursor: 'wait'
},
// styles applied when using $.growlUI
growlCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.6,
cursor: null,
color: '#fff',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px'
},
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
// (hat tip to Jorge H. N. de Vasconcelos)
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
// force usage of iframe in non-IE browsers (handy for blocking applets)
forceIframe: false,
// z-index for the blocking overlay
baseZ: 1000,
// set these to true to have the message automatically centered
centerX: true, // <-- only effects element blocking (page block controlled via css above)
centerY: true,
// allow body element to be stetched in ie6; this makes blocking look better
// on "short" pages. disable if you wish to prevent changes to the body height
allowBodyStretch: true,
// enable if you want key and mouse events to be disabled for content that is blocked
bindEvents: true,
// be default blockUI will supress tab navigation from leaving blocking content
// (if bindEvents is true)
constrainTabKey: true,
// fadeIn time in millis; set to 0 to disable fadeIn on block
fadeIn: 200,
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
fadeOut: 400,
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
timeout: 0,
// disable if you don't want to show the overlay
showOverlay: true,
// if true, focus will be placed in the first available input field when
// page blocking
focusInput: true,
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
applyPlatformOpacityRules: true,
// callback method invoked when unblocking has completed; the callback is
// passed the element that has been unblocked (which is the window object for page
// blocks) and the options that were passed to the unblock call:
// onUnblock(element, options)
onUnblock: null,
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
quirksmodeOffsetHack: 4
};
// private data and functions follow...
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
var full = (el == window);
var msg = opts && opts.message !== undefined ? opts.message : undefined;
opts = $.extend({}, $.blockUI.defaults, opts || {});
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
msg = msg === undefined ? opts.message : msg;
// remove the current block (if there is one)
if (full && pageBlock)
remove(window, {fadeOut:0});
// if an existing element is being used as the blocking content then we capture
// its current place in the DOM (and current display style) so we can restore
// it when we unblock
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
var node = msg.jquery ? msg[0] : msg;
var data = {};
$(el).data('blockUI.history', data);
data.el = node;
data.parent = node.parentNode;
data.display = node.style.display;
data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
}
var z = opts.baseZ;
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
// layer1 is the iframe layer which is used to supress bleed through of underlying content
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
// layer3 is the message content that is displayed while blocking
var lyr1 = ($.browser.msie || opts.forceIframe)
? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
: $('<div class="blockUI" style="display:none"></div>');
var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
: $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
// if we have a message, style it
if (msg)
lyr3.css(css);
// style the overlay
if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
lyr2.css(opts.overlayCSS);
lyr2.css('position', full ? 'fixed' : 'absolute');
// make iframe layer transparent in IE
if ($.browser.msie || opts.forceIframe)
lyr1.css('opacity',0.0);
$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
var expr = $.browser.msie && ($.browser.version < 8 || !$.boxModel) && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
if (ie6 || (expr && setExpr)) {
// give body 100% height
if (full && opts.allowBodyStretch && $.boxModel)
$('html,body').css('height','100%');
// fix ie6 issue when blocked element has a border width
if ((ie6 || !$.boxModel) && !full) {
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
var fixT = t ? '(0 - '+t+')' : 0;
var fixL = l ? '(0 - '+l+')' : 0;
}
// simulate fixed position
$.each([lyr1,lyr2,lyr3], function(i,o) {
var s = o[0].style;
s.position = 'absolute';
if (i < 2) {
full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
: s.setExpression('height','this.parentNode.offsetHeight + "px"');
full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
: s.setExpression('width','this.parentNode.offsetWidth + "px"');
if (fixL) s.setExpression('left', fixL);
if (fixT) s.setExpression('top', fixT);
}
else if (opts.centerY) {
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
s.marginTop = 0;
}
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
s.setExpression('top',expression);
}
});
}
// show the message
if (msg) {
lyr3.append(msg);
if (msg.jquery || msg.nodeType)
$(msg).show();
}
if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn);
if (msg)
lyr3.fadeIn(opts.fadeIn);
}
else {
if (opts.showOverlay)
lyr2.show();
if (msg)
lyr3.show();
}
// bind key and mouse events
bind(1, el, opts);
if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(':input:enabled:visible',pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else
center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
// auto-unblock
var to = setTimeout(function() {
full ? $.unblockUI(opts) : $(el).unblock(opts);
}, opts.timeout);
$(el).data('blockUI.timeout', to);
}
};
// remove the block
function remove(el, opts) {
var full = el == window;
var $el = $(el);
var data = $el.data('blockUI.history');
var to = $el.data('blockUI.timeout');
if (to) {
clearTimeout(to);
$el.removeData('blockUI.timeout');
}
opts = $.extend({}, $.blockUI.defaults, opts || {});
bind(0, el, opts); // unbind events
var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
if (full)
pageBlock = pageBlockEls = null;
if (opts.fadeOut) {
els.fadeOut(opts.fadeOut);
setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
}
else
reset(els, data, opts, el);
};
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
els.each(function(i,o) {
// remove via DOM calls so we don't lose event handlers
if (this.parentNode)
this.parentNode.removeChild(this);
});
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
if (data.parent)
data.parent.appendChild(data.el);
$(data.el).removeData('blockUI.history');
}
if (typeof opts.onUnblock == 'function')
opts.onUnblock(el,opts);
};
// bind/unbind the handler
function bind(b, el, opts) {
var full = el == window, $el = $(el);
// don't bother unbinding if there is nothing to unbind
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
if (!full)
$el.data('blockUI.isBlocked', b);
// don't bind events when overlay is not in use or if bindEvents is false
if (!opts.bindEvents || (b && !opts.showOverlay))
return;
// bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress';
b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
// former impl...
// var $e = $('a,:input');
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
// allow tab navigation (conditionally)
if (e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target == els[els.length-1];
var back = e.shiftKey && e.target == els[0];
if (fwd || back) {
setTimeout(function(){focus(back)},10);
return false;
}
}
}
// allow events within the message content
if ($(e.target).parents('div.blockMsg').length > 0)
return true;
// allow events for content that is not being blocked
return $(e.target).parents().children().filter('div.blockUI').length == 0;
};
function focus(back) {
if (!pageBlockEls)
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
};
function center(el, x, y) {
var p = el.parentNode, s = el.style;
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
if (x) s.left = l > 0 ? (l+'px') : '0';
if (y) s.top = t > 0 ? (t+'px') : '0';
};
function sz(el, p) {
return parseInt($.css(el,p))||0;
};
})($);

View File

@@ -0,0 +1,38 @@
/*
* jQuery Simple Templates plugin 1.1.1
*
* http://andrew.hedges.name/tmpl/
* http://docs.jquery.com/Plugins/Tmpl
*
* Copyright (c) 2008 Andrew Hedges, andrew@hedges.name
*
* Usage: $.tmpl('<div class="#{classname}">#{content}</div>', { 'classname' : 'my-class', 'content' : 'My content.' });
* $.tmpl('<div class="#{1}">#{0}</div>', 'My content', 'my-class'); // placeholder order not important
*
* The changes for version 1.1 were inspired by the discussion at this thread:
* http://groups.google.com/group/jquery-ui/browse_thread/thread/45d0f5873dad0178/0f3c684499d89ff4
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($) {
// regular expression for matching our placeholders; e.g., #{my-cLaSs_name77}
var regx = /#\{([^{}]*)}/g;
$.extend({
// public interface: $.tmpl
tmpl : function(tmpl) {
// default to doing no harm
tmpl = tmpl || '';
var vals = (2 === arguments.length && 'object' === typeof arguments[1] ? arguments[1] : Array.prototype.slice.call(arguments,1));
// function to making replacements
var repr = function (str, match) {
return typeof vals[match] === 'string' || typeof vals[match] === 'number' ? vals[match] : str;
};
return tmpl.replace(regx, repr);
}
});
})($);

View File

@@ -0,0 +1,967 @@
/*
* jQuery UI Multiselect
*
* Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://yanickrochon.uuuq.com/multiselect/
*
*
* Depends:
* ui.core.js
* ui.draggable.js
* ui.droppable.js
* ui.sortable.js
* jquery.blockUI (http://github.com/malsup/blockui/)
* jquery.tmpl (http://andrew.hedges.name/blog/2008/09/03/introducing-jquery-simple-templates
*
* Optional:
* localization (http://plugins.jquery.com/project/localisation)
*
* Notes:
* The strings in this plugin use a templating engine to enable localization
* and allow flexibility in the messages. Read the documentation for more details.
*
* Todo:
* restore selected items on remote searchable multiselect upon page reload (same behavior as local mode)
* (is it worth it??) add a public function to apply the nodeComparator to all items (when using nodeComparator setter)
* support for option groups, disabled options, etc.
* speed improvements
* tests and optimizations
* - test getters/setters (including options from the defaults)
*/
// objectKeys return
$.extend({ objectKeys: function(obj){ if (typeof Object.keys == 'function') return Object.keys(obj); var a = []; $.each(obj, function(k){ a.push(k) }); return a; }});
/********************************
* Default callbacks
********************************/
// expect data to be "val1=text1[\nval2=text2[\n...]]"
var defaultDataParser = function(data) {
if ( typeof data == 'string' ) {
var pattern = /^(\s\n\r\t)*\+?$/;
var selected, line, lines = data.split(/\n/);
data = {};
for (var i in lines) {
line = lines[i].split("=");
// make sure the key is not empty
if (!pattern.test(line[0])) {
selected = (line[0].lastIndexOf('+') == line.length - 1);
if (selected) line[0] = line.substr(0,line.length-1);
// if no value is specified, default to the key value
data[line[0]] = {
selected: false,
value: line[1] || line[0]
};
}
}
} else {
this._messages($.ui.multiselect.constante.MESSAGE_ERROR, $.ui.multiselect.locale.errorDataFormat);
data = false;
}
return data;
};
var defaultNodeComparator = function(node1,node2) {
var text1 = node1.text(),
text2 = node2.text();
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
};
(function($) {
$.widget("ui.multiselect", {
options: {
// sortable and droppable
sortable: 'none',
droppable: 'none',
// searchable
searchable: true,
searchDelay: 400,
searchAtStart: false,
remoteUrl: null,
remoteParams: {},
remoteLimit: 50,
remoteLimitIncrement: 50,
remoteStart: 0,
displayMore: false,
// animated
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
// ui
dividerLocation: 0.6,
// callbacks
dataParser: defaultDataParser,
nodeComparator: defaultNodeComparator,
nodeInserted: null,
// Add Vincent - Permet le click sur le li pour le passer d'un côté à un autre
triggerOnLiClick: false,
// Add Vincent - Permet le choix de la langue... en fonction de l'iso_code de PrestaShop (en, fr)
localeIsoCode: 'en'
},
_create: function() {
if (this.options.locale != undefined) {
$.ui.multiselect.locale = this.options.locale;
} else {
$.ui.multiselect.locale = {
addAll:'Add all',
removeAll:'Remove all',
itemsCount:'#{count} items selected',
itemsTotal:'#{count} items total',
busy:'please wait...',
errorDataFormat:"Cannot add options, unknown data format",
errorInsertNode:"There was a problem trying to add the item:\n\n\t[#{key}] => #{value}\n\nThe operation was aborted.",
errorReadonly:"The option #{option} is readonly",
errorRequest:"Sorry! There seemed to be a problem with the remote call. (Type: #{status})",
sInputSearch:'Please enter the first letters of the search item',
sInputShowMore: 'Show more'
};
}
this.element.hide();
this.busy = false; // busy state
this.idMultiSelect = this._uniqid(); // busy state
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
this.selectedContainer = $('<div class="ui-widget-content list-container selected"></div>').appendTo(this.container);
this.availableContainer = $('<div class="ui-widget-content list-container available"></div>').appendTo(this.container);
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">'+$.tmpl($.ui.multiselect.locale.itemsCount,{count:0})+'</span><a href="#" class="remove-all">'+$.tmpl($.ui.multiselect.locale.removeAll)+'</a></div>').appendTo(this.selectedContainer);
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="busy">'+$.tmpl($.ui.multiselect.locale.busy)+'</span><input type="text" class="search ui-widget-content ui-corner-all" value="'+$.tmpl($.ui.multiselect.locale.sInputSearch)+'" onfocus="javascript:if(this.value==\''+$.tmpl($.ui.multiselect.locale.sInputSearch)+'\')this.value=\'\';" onblur="javascript:if(this.value==\'\')this.value=\''+$.tmpl($.ui.multiselect.locale.sInputSearch)+'\';" /><a href="#" class="add-all">'+$.tmpl($.ui.multiselect.locale.addAll)+'</a></div>').appendTo(this.availableContainer);
this.selectedList = $('<ul class="list selected"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
this.availableList = $('<ul class="list available"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
var that = this;
// initialize data cache
this.availableList.data('multiselect.cache', {});
this.selectedList.data('multiselect.cache', {});
if ( !this.options.animated ) {
this.options.show = 'show';
this.options.hide = 'hide';
}
// sortable / droppable / draggable
var dragOptions = {
selected: {
sortable: ('both' == this.options.sortable || 'left' == this.options.sortable),
droppable: ('both' == this.options.droppable || 'left' == this.options.droppable)
},
available: {
sortable: ('both' == this.options.sortable || 'right' == this.options.sortable),
droppable: ('both' == this.options.droppable || 'right' == this.options.droppable)
}
};
this._prepareLists('selected', 'available', dragOptions);
this._prepareLists('available', 'selected', dragOptions);
// set up livesearch
this._registerSearchEvents(this.availableContainer.find('input.search'), this.options.searchAtStart);
//
// make sure that we're not busy yet
this._setBusy(false);
// batch actions
this.container.find(".remove-all").bind('click.multiselect', function() { that.selectNone(); return false; });
this.container.find(".add-all").bind('click.multiselect', function() { that.selectAll(); return false; });
// set dimensions
this.container.width(this.element.width()+1);
this._refreshDividerLocation();
// set max width of search input dynamically
this.availableActions.find('input').width(Math.max(this.availableActions.width() - this.availableActions.find('a.add-all').width() - 30, 20));
// fix list height to match <option> depending on their individual header's heights
this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
// init lists
this._populateLists(this.element.find('option'));
},
_uniqid: function() {
var newDate = new Date;
return newDate.getTime();
},
/**************************************
* Public
**************************************/
destroy: function() {
this.container.remove();
this.element.show();
$.widget.prototype.destroy.apply(this, arguments);
},
isBusy: function() {
return !!this.busy;
},
isSelected: function(item) {
if (this.enabled()) {
return !!this._findItem(item, this.selectedList);
} else {
return null;
}
},
// get all selected values in an array
selectedValues: function() {
return $.map( this.element.find('option[selected]'), function(item,i) { return $(item).val(); });
},
// get/set enable state
enabled: function(state, msg) {
if (undefined !== state) {
if (state) {
this.container.unblock();
this.element.removeAttr('disabled');
} else {
this.container.block({message:msg||null,overlayCSS:{backgroundColor:'#fff',opacity:0.4,cursor:'default'}});
this.element.attr('disabled', true);
}
}
return !this.element.attr('disabled');
},
selectAll: function() {
if (this.enabled()) {
this._batchSelect(this.availableList.children('li.ui-element:visible'), true);
}
},
selectNone: function() {
if (this.enabled()) {
this._batchSelect(this.selectedList.children('li.ui-element:visible'), false);
}
},
select: function(text) {
if (this.enabled()) {
var available = this._findItem(text, this.availableList);
if ( available ) {
this._setSelected(available, true);
}
}
},
deselect: function(text) {
if (this.enabled()) {
var selected = this._findItem(text, this.selectedList);
if ( selected ) {
this._setSelected(selected, false);
}
}
},
search: function(query) {
if (!this.busy && this.enabled() && this.options.searchable) {
var input = this.availableActions.children('input:first');
input.val(query);
input.trigger('keydown.multiselect');
}
},
// insert new <option> and _populate
// @return int the number of options added
addOptions: function(data) {
if (this.enabled()) {
this._setBusy(true);
// format data
var elements = [];
if (data = this.options.dataParser.call(this, data)) {
for (var key in data) {
// check if the option does not exist already
if (this.element.find('option[value="'+key+'"]').size()==0) {
elements.push( $('<option value="'+key+'"/>').text(data[key].value).appendTo(this.element)[0] );
}
}
}
if (elements.length>0) {
this._populateLists($(elements));
}
this._filter(this.availableList.children('li.ui-element'), data);
var availableItemsCount = $.objectKeys(data).length;
if(availableItemsCount >= this.options.remoteLimit && this.options.displayMore == true) {
if (!$('#multiselectShowMore_'+this.idMultiSelect).length) {
var showMoreLink = $('<p id="multiselectShowMore_'+this.idMultiSelect+'"><a href="javascript:void(0);">'+$.tmpl($.ui.multiselect.locale.sInputShowMore)+'</a></p>');
this.availableList.after(showMoreLink);
} else {
var showMoreLink = $('#multiselectShowMore_'+this.idMultiSelect);
}
var that = this;
showMoreLink.unbind('click').bind('click', function() {
that.options.remoteStart += that.options.remoteLimit;
that.options.remoteLimit = that.options.remoteLimitIncrement;
that._registerSearchEvents(that.availableContainer.find('input.search'), true);
});
}
else if(this.options.displayMore == false || availableItemsCount < this.options.remoteLimit) {
$('#multiselectShowMore_'+this.idMultiSelect).fadeOut('fast',function() {$(this).remove();});
}
this._setBusy(false);
return elements.length;
} else {
return false;
}
},
/**************************************
* Private
**************************************/
_setData: function(key, value) {
switch (key) {
// special treatement must be done for theses values when changed
case 'dividerLocation':
this.options.dividerLocation = value;
this._refreshDividerLocation();
break;
case 'searchable':
this.options.searchable = value;
this._registerSearchEvents(this.availableContainer.find('input.search'), false);
break;
case 'droppable':
case 'sortable':
// readonly options
this._messages(
$.ui.multiselect.constants.MESSAGE_WARNING,
$.ui.multiselect.locale.errorReadonly,
{option: key}
);
default:
// default behavior
this.options[key] = value;
break;
}
},
_ui: function(type) {
var uiObject = {sender: this.element};
switch (type) {
// events: messages
case 'message':
uiObject.type = arguments[1];
uiObject.message = arguments[2];
break;
// events: selected, deselected
case 'selection':
uiObject.option = arguments[1];
break;
}
return uiObject;
},
_messages: function(type, msg, params) {
this._trigger('messages', null, this._ui('message', type, $.tmpl(msg, params)));
},
_refreshDividerLocation: function() {
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
},
_prepareLists: function(side, otherSide, opts) {
var that = this;
var itemSelected = ('selected' == side);
var list = this[side+'List'];
var otherList = this[otherSide+'List'];
var listDragHelper = opts[otherSide].sortable ? _dragHelper : 'clone';
list
.data('multiselect.sortable', opts[side].sortable )
.data('multiselect.droppable', opts[side].droppable )
.data('multiselect.draggable', !opts[side].sortable && (opts[otherSide].sortable || opts[otherSide].droppable) );
if (opts[side].sortable) {
list.sortable({
appendTo: this.container,
connectWith: otherList,
containment: this.container,
helper: listDragHelper,
items: 'li.ui-element',
revert: !(opts[otherSide].sortable || opts[otherSide].droppable),
receive: function(event, ui) {
// DEBUG
//that._messages(0, "Receive : " + ui.item.data('multiselect.optionLink') + ":" + ui.item.parent()[0].className + " = " + itemSelected);
// we received an element from a sortable to another sortable...
if (opts[otherSide].sortable) {
var optionLink = ui.item.data('multiselect.optionLink');
that._applyItemState(ui.item.hide(), itemSelected);
// if the cache already contain an element, remove it
if (otherList.data('multiselect.cache')[optionLink.val()]) {
delete otherList.data('multiselect.cache')[optionLink.val()];
}
ui.item.hide();
that._setSelected(ui.item, itemSelected, true);
} else {
// the other is droppable only, so merely select the element...
setTimeout(function() {
that._setSelected(ui.item, itemSelected);
}, 10);
}
},
stop: function(event, ui) {
// DEBUG
//that._messages(0, "Stop : " + (ui.item.parent()[0] == otherList[0]));
that._moveOptionNode(ui.item);
}
});
}
// cannot be droppable if both lists are sortable, it breaks the receive function
if (!(opts[side].sortable && opts[otherSide].sortable)
&& (opts[side].droppable || opts[otherSide].sortable || opts[otherSide].droppable)) {
//alert( side + " is droppable ");
list.droppable({
accept: '.ui-multiselect li.ui-element',
hoverClass: 'ui-state-highlight',
revert: !(opts[otherSide].sortable || opts[otherSide].droppable),
greedy: true,
drop: function(event, ui) {
// DEBUG
//that._messages(0, "drop " + side + " = " + ui.draggable.data('multiselect.optionLink') + ":" + ui.draggable.parent()[0].className);
//alert( "drop " + itemSelected );
// if no optionLink is defined, it was dragged in
if (!ui.draggable.data('multiselect.optionLink')) {
var optionLink = ui.helper.data('multiselect.optionLink');
ui.draggable.data('multiselect.optionLink', optionLink);
// if the cache already contain an element, remove it
if (list.data('multiselect.cache')[optionLink.val()]) {
delete list.data('multiselect.cache')[optionLink.val()];
}
list.data('multiselect.cache')[optionLink.val()] = ui.draggable;
that._applyItemState(ui.draggable, itemSelected);
// received an item from a sortable to a droppable
} else if (!opts[side].sortable) {
setTimeout(function() {
ui.draggable.hide();
that._setSelected(ui.draggable, itemSelected);
}, 10);
}
}
});
}
},
_populateLists: function(options) {
this._setBusy(true);
var that = this;
// do this async so the browser actually display the waiting message
setTimeout(function() {
$(options.each(function(i) {
var list = (this.selected ? that.selectedList : that.availableList);
var item = that._getOptionNode(this).show();
that._applyItemState(item, this.selected);
item.data('multiselect.idx', i);
// cache
list.data('multiselect.cache')[item.data('multiselect.optionLink').val()] = item;
that._insertToList(item, list);
}));
// update count
that._setBusy(false);
that._updateCount();
}, 1);
},
_insertToList: function(node, list) {
// Add Vincent - Permet le click sur le li pour le passer d'un côté à un autre
if (this.options.triggerOnLiClick == true) {
node.unbind('click.multiselect').bind('click.multiselect', function() { node.find('a.action').trigger('click.multiselect'); });
}
// End Vincent - Permet le click sur le li pour le passer d'un côté à un autre
var that = this;
this._setBusy(true);
// the browsers don't like batch node insertion...
var _addNodeRetry = 0;
var _addNode = function() {
var succ = (that.options.nodeComparator ? that._getSuccessorNode(node, list) : null);
try {
if (succ) {
node.insertBefore(succ);
} else {
list.append(node);
}
if (list === that.selectedList) that._moveOptionNode(node);
// callback after node insertion
if ('function' == typeof that.options.nodeInserted) that.options.nodeInserted(node);
that._setBusy(false);
} catch (e) {
// if this problem did not occur too many times already
if ( _addNodeRetry++ < 10 ) {
// try again later (let the browser cool down first)
setTimeout(function() { _addNode(); }, 1);
} else {
that._messages(
$.ui.multiselect.constants.MESSAGE_EXCEPTION,
$.ui.multiselect.locale.errorInsertNode,
{key:node.data('multiselect.optionLink').val(), value:node.text()}
);
that._setBusy(false);
}
}
};
_addNode();
},
_updateCount: function() {
var that = this;
// defer until system is not busy
if (this.busy) setTimeout(function() { that._updateCount(); }, 100);
// count only visible <li> (less .ui-helper-hidden*)
var count = this.selectedList.children('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible').size();
var total = this.availableList.children('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder,.shadowed)').size() + count;
this.selectedContainer.find('span.count')
.html($.tmpl($.ui.multiselect.locale.itemsCount, {count:count}))
.attr('title', $.tmpl($.ui.multiselect.locale.itemsTotal, {count:total}));
},
_getOptionNode: function(option) {
option = $(option);
var node = $('<li class="ui-state-default ui-element"><span class="ui-icon"/>'+option.text()+'<a href="#" class="ui-state-default action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
// Add Vincent - Permet le click sur le li pour le passer d'un côté à un autre
if (this.options.triggerOnLiClick == true) {
node.unbind('click.multiselect').bind('click.multiselect', function() { node.find('a.action').trigger('click.multiselect'); });
}
// End Vincent - Permet le click sur le li pour le passer d'un côté à un autre
node.data('multiselect.optionLink', option);
return node;
},
_moveOptionNode: function(item) {
// call this async to let the item be placed correctly
setTimeout( function() {
var optionLink = item.data('multiselect.optionLink');
if (optionLink) {
var prevItem = item.prev('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible');
var prevOptionLink = prevItem.size() ? prevItem.data('multiselect.optionLink') : null;
if (prevOptionLink) {
optionLink.insertAfter(prevOptionLink);
} else {
optionLink.prependTo(optionLink.parent());
}
}
}, 100);
},
// used by select and deselect, etc.
_findItem: function(text, list) {
var found = null;
list.children('li.ui-element:visible').each(function(i,el) {
el = $(el);
if (el.text().toLowerCase() === text.toLowerCase()) {
found = el;
}
});
if (found && found.size()) {
return found;
} else {
return false;
}
},
// clones an item with
// didn't find a smarter away around this (michael)
// now using cache to speed up the process (yr)
_cloneWithData: function(clonee, cacheName, insertItem) {
var that = this;
var id = clonee.data('multiselect.optionLink').val();
var selected = ('selected' == cacheName);
var list = (selected ? this.selectedList : this.availableList);
var clone = list.data('multiselect.cache')[id];
if (!clone) {
clone = clonee.clone().hide();
this._applyItemState(clone, selected);
// update cache
list.data('multiselect.cache')[id] = clone;
// update <option> and idx
clone.data('multiselect.optionLink', clonee.data('multiselect.optionLink'));
// need this here because idx is needed in _getSuccessorNode
clone.data('multiselect.idx', clonee.data('multiselect.idx'));
// insert the node into it's list
if (insertItem) {
this._insertToList(clone, list);
}
} else {
// update idx
clone.data('multiselect.idx', clonee.data('multiselect.idx'));
}
return clone;
},
_batchSelect: function(elements, state) {
this._setBusy(true);
var that = this;
// do this async so the browser actually display the waiting message
setTimeout(function() {
var _backup = {
animated: that.options.animated,
hide: that.options.hide,
show: that.options.show
};
that.options.animated = null;
that.options.hide = 'hide';
that.options.show = 'show';
elements.each(function(i,element) {
that._setSelected($(element), state);
});
// filter available items
if (!state) that._filter(that.availableList.find('li.ui-element'));
// restore
$.extend(that.options, _backup);
that._updateCount();
that._setBusy(false);
}, 10);
},
// find the best successor the given item in the specified list
// TODO implement a faster sorting algorithm (and remove the idx dependancy)
_getSuccessorNode: function(item, list) {
// look for successor based on initial option index
var items = list.find('li.ui-element'), comparator = this.options.nodeComparator;
var itemsSize = items.size();
// no successor, list is null
if (items.size() == 0) return null;
var succ, i = Math.min(item.data('multiselect.idx'),itemsSize-1), direction = comparator(item, $(items[i]));
if ( direction ) {
// quick checks
if (0>direction && 0>=i) {
succ = items[0];
} else if (0<direction && itemsSize-1<=i) {
i++;
succ = null;
} else {
while (i>=0 && i<items.length) {
direction > 0 ? i++ : i--;
if (i<0) {
succ = item[0]
}
if ( direction != comparator(item, $(items[i])) ) {
// going up, go back one item down, otherwise leave as is
succ = items[direction > 0 ? i : i+1];
break;
}
}
}
} else {
succ = items[i];
}
// update idx
item.data('multiselect.idx', i);
return succ;
},
// @param DOMElement item is the item to set
// @param bool selected true|false (state)
// @param bool noclone (optional) true only if item should not be cloned on the other list
_setSelected: function(item, selected, noclone) {
var that = this, otherItem;
var optionLink = item.data('multiselect.optionLink');
if (selected) {
// already selected
if (optionLink.attr('selected')) return;
optionLink.attr('selected','selected');
if (noclone) {
otherItem = item;
} else {
// retrieve associatd or cloned item
otherItem = this._cloneWithData(item, 'selected', true).hide();
item.addClass('shadowed')[this.options.hide](this.options.animated, function() { that._updateCount(); });
}
otherItem[this.options.show](this.options.animated);
} else {
// already deselected
if (!optionLink.attr('selected')) return;
optionLink.removeAttr('selected');
if (noclone) {
otherItem = item;
} else {
// retrieve associated or clone the item
otherItem = this._cloneWithData(item, 'available', true).hide().removeClass('shadowed');
item[this.options.hide](this.options.animated, function() { that._updateCount() });
}
if (!otherItem.is('.filtered')) otherItem[this.options.show](this.options.animated);
}
if (!this.busy) {
if (this.options.animated) {
// pulse
//otherItem.effect("pulsate", { times: 1, mode: 'show' }, 400); // pulsate twice???
otherItem.fadeTo('fast', 0.3, function() { $(this).fadeTo('fast', 1); });
}
}
// fire selection event
this._trigger(selected ? 'selected' : 'deselected', null, this._ui('selection', optionLink));
return otherItem;
},
_setBusy: function(state) {
var input = this.availableActions.children('input.search');
var busy = this.availableActions.children('.busy');
this.busy = Math.max(state ? ++this.busy : --this.busy, 0);
this.container.find("a.remove-all, a.add-all")[this.busy ? 'hide' : 'show']();
if (state && (1 == this.busy)) {
if (this.options.searchable) {
// backup input state
input.data('multiselect.hadFocus', input.data('multiselect.hasFocus'));
// webkit needs to blur before hiding or it won't fire focus again in the else block
input.blur().hide();
}
busy.show();
} else if(!this.busy) {
if (this.options.searchable) {
input.show();
if (input.data('multiselect.hadFocus')) input.focus();
}
busy.hide();
}
// DEBUG
//this._messages(0, "Busy state changed to : " + this.busy);
},
_applyItemState: function(item, selected) {
if (selected) {
item.children('span').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
this._registerRemoveEvents(item.find('a.action'));
} else {
item.children('span').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
this._registerAddEvents(item.find('a.action'));
}
this._registerHoverEvents(item);
return item;
},
// apply filter and return elements
_filter: function(elements, data) {
var input = this.availableActions.children('input.search');
var term = $.trim( input.val().toLowerCase() );
if ( !term ) {
elements.removeClass('filtered');
} else {
elements.each(function(i,element) {
element = $(element);
if (data != undefined) {
if (data[element.data('multiselect.optionLink').val()] != undefined) {
element['removeClass']('filtered');
} else {
element['addClass']('filtered');
}
} else {
element[(element.text().toLowerCase().indexOf(term)>=0 ? 'remove' : 'add')+'Class']('filtered');
}
});
}
return elements.not('.filtered, .shadowed').show().end().filter('.filtered, .shadowed').hide().end();
},
_registerHoverEvents: function(elements) {
elements
.unbind('mouseover.multiselect').bind('mouseover.multiselect', function() {
$(this).find('a').andSelf().addClass('ui-state-hover');
})
.unbind('mouseout.multiselect').bind('mouseout.multiselect', function() {
$(this).find('a').andSelf().removeClass('ui-state-hover');
})
.find('a').andSelf().removeClass('ui-state-hover')
;
},
_registerAddEvents: function(elements) {
var that = this;
elements.unbind('click.multiselect').bind('click.multiselect', function() {
// ignore if busy...
if (!this.busy) {
that._setSelected($(this).parent(), true);
}
return false;
});
if (this.availableList.data('multiselect.draggable')) {
// make draggable
elements.each(function() {
$(this).parent().draggable({
connectToSortable: that.selectedList,
helper: _dragHelper,
appendTo: that.container,
containment: that.container,
revert: 'invalid'
});
});
// refresh the selected list or the draggable will not connect to it first hand
if (this.selectedList.data('multiselect.sortable')) {
this.selectedList.sortable('refresh');
}
}
},
_registerRemoveEvents: function(elements) {
var that = this;
elements.unbind('click.multiselect').bind('click.multiselect', function() {
// ignore if busy...
if (!that.busy) {
that._setSelected($(this).parent(), false);
}
return false;
});
if (this.selectedList.data('multiselect.draggable')) {
// make draggable
elements.each(function() {
$(this).parent().draggable({
connectToSortable: that.availableList,
helper: _dragHelper,
appendTo: that.container,
containment: that.container,
revert: 'invalid'
});
});
// refresh the selected list or the draggable will not connect to it first hand
if (this.availableList.data('multiselect.sortable')) {
this.availableList.sortable('refresh');
}
}
},
_registerSearchEvents: function(input, searchNow) {
var that = this;
var previousValue = input.val(), timer;
var _searchNow = function(forceUpdate) {
if (that.busy) return;
var value = input.val();
if ((value != previousValue) || (forceUpdate)) {
that._setBusy(true);
if (that.options.remoteUrl) {
var params = $.extend({}, that.options.remoteParams);
try {
$.ajax({
url: that.options.remoteUrl,
data: $.extend(params, {q:value, start:that.options.remoteStart, limit:that.options.remoteLimit}),
success: function(data) {
that.addOptions(data);
that._setBusy(false);
},
error: function(request,status,e) {
that._messages(
$.ui.multiselect.constants.MESSAGE_ERROR,
$.ui.multiselect.locale.errorRequest,
{status:status}
);
that._setBusy(false);
}
});
} catch (e) {
that._messages($.ui.multiselect.constants.MESSAGE_EXCEPTION, e.message); // error message template ??
that._setBusy(false);
}
} else {
that._filter(that.availableList.children('li.ui-element'));
that._setBusy(false);
}
previousValue = value;
}
};
// reset any events... if any
input.unbind('focus.multiselect blur.multiselect keydown.multiselect keypress.multiselect');
if (this.options.searchable) {
input
.bind('focus.multiselect', function() {
$(this).addClass('ui-state-active').data('multiselect.hasFocus', true);
})
.bind('blur.multiselect', function() {
$(this).removeClass('ui-state-active').data('multiselect.hasFocus', false);
})
.bind('keydown.multiselect keypress.multiselect', function(e) {
if (timer) clearTimeout(timer);
switch (e.which) {
case 13: // enter
_searchNow(true);
return false;
default:
timer = setTimeout(function() { _searchNow(); }, Math.max(that.options.searchDelay,1));
}
})
.show();
} else {
input.val('').hide();
this._filter(that.availableList.find('li.ui-element'))
}
// initiate search filter (delayed)
var _initSearch = function() {
if (that.busy) {
setTimeout(function() { _initSearch(); }, 100);
}
_searchNow(true);
};
if (searchNow) _initSearch();
}
});
// END ui.multiselect
/********************************
* Internal functions
********************************/
var _dragHelper = function(event, ui) {
var item = $(event.target);
var clone = item.clone().width(item.width());
if (clone.data('multiselect.optionLink') != undefined && item.data('multiselect.optionLink') != undefined) {
clone
.data('multiselect.optionLink', item.data('multiselect.optionLink'))
.data('multiselect.list', item.parent() )
// node ui cleanup
.find('a').remove()
;
}
return clone;
};
/****************************
* Settings
****************************/
$.extend($.ui.multiselect, {
getter: 'selectedValues enabled isBusy',
constants: {
MESSAGE_WARNING: 0,
MESSAGE_EXCEPTION: 1,
MESSAGE_ERROR: 2
}
});
})($);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,288 @@
/**
*
* Advanced Search 4
*
* @author Presta-Module.com <support@presta-module.com>
* @copyright Presta-Module
*
* ____ __ __
* | _ \ | \/ |
* | |_) | | |\/| |
* | __/ | | | |
* |_| |_| |_|
*
****/
/* Events than can be implemented for custom integration or interaction (with Google Analytics Events for example) */
/*
$(document).on('as4-Before-Init-Search-Block', function(e, idSearch, searchMethod, stepSearch) {});
$(document).on('as4-After-Init-Search-Block', function(e, idSearch, searchMethod, stepSearch) {});
$(document).on('as4-Before-Init-Search-Results', function(e, idSearch, searchMethod, stepSearch) {});
$(document).on('as4-After-Init-Search-Results', function(e, idSearch, searchMethod, stepSearch) {});
$(document).on('as4-Criterion-Change', function(e, idSearch, idCriterionGroup, idCriterion, criterionName, groupType) {});
$(document).on('as4-Before-Response-Callback', function(e) {});
$(document).on('as4-After-Response-Callback', function(e) {});
$(document).on('as4-Before-Set-Results-Contents', function(e, idSearch, context) {});
$(document).on('as4-After-Set-Results-Contents', function(e, idSearch, context) {});
$(document).on('as4-Search-Reset', function(e, idSearch) {});
$(document).on('as4-Criterion-Group-Reset', function(e, idSearch, idCriterionGroup) {});
$(document).on('as4-Criterion-Group-Skip', function(e, idSearch, idCriterionGroup, searchMethod) {});
*/
/*!
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
*
* You may use hoverIntent under the terms of the MIT license. Basically that
* means you are free to use hoverIntent as long as this header is left intact.
* Copyright 2007, 2014 Brian Cherne
*/
(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);
/**
* https://github.com/SaneMethod/jquery-ajax-localstorage-cache
*/
;
(function($, window) {
/**
* Generate the cache key under which to store the local data - either the cache key supplied,
* or one generated from the url, the type and, if present, the data.
*/
var genCacheKey = function(options) {
var url = options.url.replace(/jQuery.*/, '');
// Strip _={timestamp}, if cache is set to false
if (options.cache === false) {
url = url.replace(/([?&])_=[^&]*/, '');
}
if (options.data) {
return (as4Plugin.localCacheKey || '') + (options.cacheKey || url + '?' + options.data + options.type);
} else {
return (as4Plugin.localCacheKey || '') + (options.cacheKey || url + options.type + (options.data || ''));
}
};
/**
* Prefilter for caching ajax calls.
* See also $.ajaxTransport for the elements that make this compatible with jQuery Deferred.
* New parameters available on the ajax call:
* localCache : true // required - either a boolean (in which case localStorage is used), or an object
* implementing the Storage interface, in which case that object is used instead.
* cacheTTL : 5, // optional - cache time in hours, default is 5.
* cacheKey : 'post', // optional - key under which cached string will be stored
* isCacheValid : function // optional - return true for valid, false for invalid
* @method $.ajaxPrefilter
* @param options {Object} Options for the ajax call, modified with ajax standard settings
*/
$.ajaxPrefilter(function(options) {
var storage = (options.localCache === true) ? window.localStorage : options.localCache,
hourstl = options.cacheTTL || 5,
cacheKey = genCacheKey(options),
cacheValid = options.isCacheValid,
ttl,
value;
// Check if localStorage is available
if (!storage || (storage && !as4Plugin.isLocalStorageAvailable())) {
return;
}
ttl = storage.getItem(cacheKey + 'cachettl');
if (cacheValid && typeof cacheValid === 'function' && !cacheValid()) {
storage.removeItem(cacheKey);
}
if (ttl && ttl < +new Date()) {
storage.removeItem(cacheKey);
storage.removeItem(cacheKey + 'cachettl');
ttl = 0;
}
value = storage.getItem(cacheKey);
if (!value) {
// If it not in the cache, we store the data, add success callback - normal callback will proceed
if (options.success) {
options.realsuccess = options.success;
}
options.success = function(data) {
var strdata = data;
if (this.dataType.toLowerCase().indexOf('json') === 0) strdata = JSON.stringify(data);
// Save the data to storage catching exceptions (possibly QUOTA_EXCEEDED_ERR)
try {
storage.setItem(cacheKey, strdata);
} catch (e) {
// Remove any incomplete data that may have been saved before the exception was caught
storage.removeItem(cacheKey);
storage.removeItem(cacheKey + 'cachettl');
}
if (options.realsuccess) options.realsuccess(data);
};
// store timestamp
if (!ttl) {
storage.setItem(cacheKey + 'cachettl', +new Date() + 1000 * 60 * 60 * hourstl);
}
}
});
/**
* This function performs the fetch from cache portion of the functionality needed to cache ajax
* calls and still fulfill the jqXHR Deferred Promise interface.
* See also $.ajaxPrefilter
* @method $.ajaxTransport
* @params options {Object} Options for the ajax call, modified with ajax standard settings
*/
$.ajaxTransport("+*", function(options) {
if (options.localCache) {
var cacheKey = genCacheKey(options),
storage = (options.localCache === true) ? window.localStorage : options.localCache,
value = (storage) ? storage.getItem(cacheKey) : false;
if (value) {
// In the cache? Get it, parse it to json if the dataType is JSON,
// and call the completeCallback with the fetched value.
if (options.dataType.toLowerCase().indexOf('json') === 0) value = JSON.parse(value);
return {
send: function(headers, completeCallback) {
var response = {};
response[options.dataType] = value;
completeCallback(200, 'success', response, '');
},
abort: function() {
console.log("Aborted ajax transport for json cache.");
}
};
}
}
});
})(jQuery, window);
window.onload = function () {
// Fix Safari issue that is firing onpopstate on page load (instead of all other browsers)
setTimeout(function() {
window.onpopstate = function(event) {
if (typeof(event.state) != 'undefined' && event.state != null && typeof(event.state.id_search) != 'undefined' && !isNaN(event.state.id_search)) {
if (typeof(event.state.stateFromInit) != 'undefined' && event.state.stateFromInit && as4Plugin.isSafari()) {
if (!isNaN(as4Plugin.previousOnPopState) && as4Plugin.previousOnPopState != null && as4Plugin.previousOnPopState > 0) {
// Previous page was generated by AS4, refresh this one
as4Plugin.previousOnPopState = null;
// Reload current page
location.reload();
} else {
as4Plugin.previousOnPopState = null;
}
return;
}
// Set event source flag
as4Plugin.fromBackForwardEvent = true;
formOptionsObject = as4Plugin.getASFormOptions(event.state.id_search);
// Replace data from the old one
formOptionsObject.data = $.param(event.state.formSerializedArray) + '&' + $.param(event.state.formOptionsData);
formOptionsObject.url = $('#PM_ASForm_' + event.state.id_search).attr('action');
formOptionsObject.form = $('#PM_ASForm_' + event.state.id_search);
// Submit new search query (data from history)
$.ajax(formOptionsObject);
as4Plugin.previousOnPopState = event.state.id_search;
} else {
if (typeof(prestashop) != 'object') {
if (!isNaN(as4Plugin.previousOnPopState) && as4Plugin.previousOnPopState != null && as4Plugin.previousOnPopState > 0) {
// Previous page was generated by AS4, refresh this one
as4Plugin.previousOnPopState = null;
// Reload current page
location.reload();
} else {
as4Plugin.previousOnPopState = null;
}
}
}
};
}, 500);
};
$(document).on('as4-After-Init-Search-Block', function(e, idSearch, searchMethod, stepSearch) {
// Let's save form state after search engine init, only if it's not coming from a back/forward browser event
if (typeof(prestashop) == 'object') {
if (!as4Plugin.fromBackForwardEvent) {
as4Plugin.pushNewState(idSearch, true);
}
}
});
$(document).on('as4-Before-Set-Results-Contents', function(e, idSearch, context) {
// Let's save form state just before result is updated, only if it's not coming from a back/forward browser event
if (!as4Plugin.fromBackForwardEvent) {
as4Plugin.pushNewState(idSearch);
}
// Let's prepare GA event to announce a that search results is available
eventLabel = [];
availableCriterionsGroups = as4Plugin.getParamValue(idSearch, 'availableCriterionsGroups');
$.each(as4Plugin.getParamValue(idSearch, 'selectedCriterions'), function(idCriterionGroup, selectedCriterions) {
$.each(selectedCriterions, function(index2, selectedCriterion) {
eventLabel.push(availableCriterionsGroups[idCriterionGroup] + ': ' + selectedCriterion.value);
});
});
// Send GA Event
as4Plugin.sendGAEvent('Advanced Search', 'Show Results', eventLabel.join(', '))
});
// Do something when a new criterion is selected
$(document).on('as4-Criterion-Change', function(e, idSearch, idCriterionGroup, idCriterion, criterionName, groupType) {
step_search = as4Plugin.getParamValue(idSearch, 'stepSearch');
search_method = as4Plugin.getParamValue(idSearch, 'searchMethod');
// Send GA Event
availableCriterionsGroups = as4Plugin.getParamValue(idSearch, 'availableCriterionsGroups');
as4Plugin.sendGAEvent('Advanced Search', 'Criterion Selected', availableCriterionsGroups[idCriterionGroup] + ': ' + criterionName)
if (step_search == 1) {
as4Plugin.nextStep(idSearch, search_method);
} else {
as4Plugin.runSearch(idSearch, search_method);
}
});
// PrestaShop 1.7 specific
if (typeof(prestashop) == 'object') {
prestashop.on('responsive update', function(event) {
as4Plugin.initMobileStyles();
});
prestashop.on('updateProductList', function(event) {
if (typeof(as4Plugin) == 'object' && typeof(event.id_search) != 'undefined' && !isNaN(event.id_search)) {
scrollTopActive = as4Plugin.getParamValue(event.id_search, 'scrollTopActive');
if (!scrollTopActive) {
if (typeof(event.without_products) == 'undefined') {
// Native ajax call
as4Plugin.scrollTop(event.id_search, 'updateProductList', (scrollTopActive == false));
}
} else {
if (typeof(event.without_products) == 'undefined') {
as4Plugin.scrollTop(event.id_search, 'updateProductList', (scrollTopActive == false));
} else {
if (!event.without_products) {
as4Plugin.scrollTop(event.id_search, 'updateProductList', (event.without_products == false));
}
}
}
}
// Retrieve 'order' parameter from URL in case the order is changed by the user
// and assign it to our 'orderby' hidden input
if (typeof(as4Plugin) == 'object') {
setTimeout(function() {
var currentUrlParams = window.location.href.substring(window.location.href.indexOf('?', 0));
var orderRegexp = new RegExp(/[?&]order=\w+\.\w+\.\w+/);
// If we find a order parameter in the URL, we retrieve its value, and assign it to our input
if (currentUrlParams.match(orderRegexp)) {
var matchedOrder = currentUrlParams.match(orderRegexp)[0];
var cleanedMatchedOrder = matchedOrder.substr(matchedOrder.indexOf('=', 0) + 1);
if (cleanedMatchedOrder.length > 0) {
$('.PM_ASForm input[name="orderby"]').prop('disabled', false);
$('.PM_ASForm input[name="orderby"]').val(cleanedMatchedOrder);
}
}
}, 100);
}
});
}

View File

@@ -0,0 +1,57 @@
if (typeof(tinySetup) != 'undefined') {
tinySetup({editor_selector : "rte"});
} else {
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "rte",
theme : "advanced",
skin : "cirkuit",
plugins : "safari,pagebreak,style,table,advimage,advlink,inlinepopups,media,contextmenu,paste,fullscreen,xhtmlxtras,preview",
// Theme options
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
content_css : pathCSS + "global.css",
document_base_url : ad,
width : "100%",
height : "auto",
font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt",
elements : "nourlconvert,ajaxfilemanager",
file_browser_callback : "ajaxfilemanager",
entity_encoding : "raw",
convert_urls : false,
language : iso,
});
function ajaxfilemanager(field_name, url, type, win) {
var ajaxfilemanagerurl = ad + "/ajaxfilemanager/ajaxfilemanager.php";
switch (type) {
case "image":
break;
case "media":
break;
case "flash":
break;
case "file":
break;
default:
return false;
}
tinyMCE.activeEditor.windowManager.open({
url : ajaxfilemanagerurl,
width : 782,
height : 440,
inline : "yes",
close_previous : "no"
}, {
window : win,
input : field_name
});
}
}

View File

@@ -0,0 +1,137 @@
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery. Copyright (c)
* 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com |
* http://flesler.blogspot.com Dual licensed under MIT and GPL. Date: 5/25/2009
*
* @author Ariel Flesler
* @version 1.4.2
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
;
(function(d) {
var k = d.scrollTo = function(a, i, e) {
d(window).scrollTo(a, i, e)
};
k.defaults = {
axis : 'xy',
duration : parseFloat(d.fn.jquery) >= 1.3 ? 0 : 1
};
k.window = function(a) {
return d(window)._scrollable()
};
d.fn._scrollable = function() {
return this.map(function() {
var a = this, i = !a.nodeName
|| d.inArray(a.nodeName.toLowerCase(), [ 'iframe',
'#document', 'html', 'body' ]) != -1;
if (!i)
return a;
var e = (a.contentWindow || a).document || a.ownerDocument || a;
return d.browser.safari || e.compatMode == 'BackCompat' ? e.body
: e.documentElement
})
};
d.fn.scrollTo = function(n, j, b) {
if (typeof j == 'object') {
b = j;
j = 0
}
if (typeof b == 'function')
b = {
onAfter : b
};
if (n == 'max')
n = 9e9;
b = d.extend({}, k.defaults, b);
j = j || b.speed || b.duration;
b.queue = b.queue && b.axis.length > 1;
if (b.queue)
j /= 2;
b.offset = p(b.offset);
b.over = p(b.over);
return this
._scrollable()
.each(
function() {
var q = this, r = d(q), f = n, s, g = {}, u = r
.is('html,body');
switch (typeof f) {
case 'number':
case 'string':
if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)) {
f = p(f);
break
}
f = d(f, this);
case 'object':
if (f.is || f.style)
s = (f = d(f)).offset()
}
d
.each(
b.axis.split(''),
function(a, i) {
var e = i == 'x' ? 'Left'
: 'Top', h = e
.toLowerCase(), c = 'scroll'
+ e, l = q[c], m = k
.max(q, i);
if (s) {
g[c] = s[h]
+ (u ? 0
: l
- r
.offset()[h]);
if (b.margin) {
g[c] -= parseInt(f
.css('margin'
+ e)) || 0;
g[c] -= parseInt(f
.css('border'
+ e
+ 'Width')) || 0
}
g[c] += b.offset[h] || 0;
if (b.over[h])
g[c] += f[i == 'x' ? 'width'
: 'height']()
* b.over[h]
} else {
var o = f[h];
g[c] = o.slice
&& o.slice(-1) == '%' ? parseFloat(o)
/ 100 * m
: o
}
if (/^\d+$/.test(g[c]))
g[c] = g[c] <= 0 ? 0 : Math
.min(g[c], m);
if (!a && b.queue) {
if (l != g[c])
t(b.onAfterFirst);
delete g[c]
}
});
t(b.onAfter);
function t(a) {
r.animate(g, j, b.easing, a && function() {
a.call(this, n, b)
})
}
}).end()
};
k.max = function(a, i) {
var e = i == 'x' ? 'Width' : 'Height', h = 'scroll' + e;
if (!d(a).is('html,body'))
return a[h] - d(a)[e.toLowerCase()]();
var c = 'client' + e, l = a.ownerDocument.documentElement, m = a.ownerDocument.body;
return Math.max(l[h], m[h]) - Math.min(l[c], m[c])
};
function p(a) {
return typeof a == 'object' ? a : {
top : a,
left : a
}
}
})($jqPm);

View File

@@ -0,0 +1,8 @@
<?php
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,209 @@
/* jquery.scrollToFixed * code copyright 2010 David Vedder / changeMode design */
(function(a) {
a.ScrollToFixed = function(c, f) {
var i = this;
i.$el = a(c);
i.el = c;
i.$el.data("ScrollToFixed", i);
var b = false;
var u = i.$el;
var t = 0;
var l = 0;
var g = -1;
var d = -1;
var n = null;
function o() {
h();
d = -1;
t = u.offset().top;
l = u.offset().left;
if (g == -1) {
orginalOffsetLeft = l
}
b = true;
if (i.options.bottom != -1) {
q()
}
}
function k() {
return u.css("position") == "fixed"
}
function r() {
return u.css("position") == "absolute"
}
function e() {
return !(k() || r())
}
function q() {
if (!k()) {
n.css({
display : u.css("display"),
width : u.outerWidth(true),
height : u.outerHeight(true),
"float" : u.css("float")
});
u.css({
width : u.width(),
position : "fixed",
top : i.options.bottom == -1 ? m() : "",
bottom : i.options.bottom == -1 ? "" : i.options.bottom
})
}
}
function h() {
if (!e()) {
d = -1;
n.css("display", "none");
u.css({
width : "",
position : "",
left : "",
top : ""
})
}
}
function p(v) {
if (v != d) {
u.css("left", l - v);
d = v
}
}
function m() {
return i.options.marginTop
}
function s() {
if (!b) {
o()
}
var v = a(window).scrollLeft();
var w = a(window).scrollTop();
if (i.options.bottom == -1) {
if (i.options.limit > 0 && w >= i.options.limit - m()) {
if (!r()) {
j();
u.trigger("preAbsolute");
u.css({
width : u.width(),
position : "absolute",
top : i.options.limit,
left : l
});
u.trigger("unfixed")
}
} else {
if (w >= t - m()) {
if (!k()) {
j();
u.trigger("preFixed");
q();
d = -1;
u.trigger("fixed")
}
p(v)
} else {
if (k()) {
j();
u.trigger("preUnfixed");
h();
u.trigger("unfixed")
}
}
}
} else {
if (i.options.limit > 0) {
if (w + a(window).height() - u.outerHeight(true) >= i.options.limit
- m()) {
if (k()) {
j();
u.trigger("preUnfixed");
h();
u.trigger("unfixed")
}
} else {
if (!k()) {
j();
u.trigger("preFixed");
q()
}
p(v);
u.trigger("fixed")
}
} else {
p(v)
}
}
}
function j() {
var v = u.css("position");
if (v == "absolute") {
u.trigger("postAbsolute")
} else {
if (v == "fixed") {
u.trigger("postFixed")
} else {
u.trigger("postUnfixed")
}
}
}
i.init = function() {
i.options = a.extend({}, a.ScrollToFixed.defaultOptions, f);
if (navigator.platform == "iPad" || navigator.platform == "iPhone"
|| navigator.platform == "iPod") {
return
}
i.$el.css("z-index", i.options.zIndex);
n = a("<div/>");
i.$el.after(n);
a(window).bind("resize", function(v) {
o();
s()
});
a(window).bind("scroll", function(v) {
s()
});
if (i.options.preFixed) {
u.bind("preFixed", i.options.preFixed)
}
if (i.options.postFixed) {
u.bind("postFixed", i.options.postFixed)
}
if (i.options.preUnfixed) {
u.bind("preUnfixed", i.options.preUnfixed)
}
if (i.options.postUnfixed) {
u.bind("postUnfixed", i.options.postUnfixed)
}
if (i.options.preAbsolute) {
u.bind("preAbsolute", i.options.preAbsolute)
}
if (i.options.postAbsolute) {
u.bind("postAbsolute", i.options.postAbsolute)
}
if (i.options.fixed) {
u.bind("fixed", i.options.fixed)
}
if (i.options.unfixed) {
u.bind("unfixed", i.options.unfixed)
}
if (i.options.bottom != -1) {
if (!k()) {
j();
u.trigger("preFixed");
q()
}
}
};
i.init()
};
a.ScrollToFixed.defaultOptions = {
marginTop : 0,
limit : 0,
bottom : -1,
zIndex : 1000
};
a.fn.scrollToFixed = function(b) {
return this.each(function() {
(new a.ScrollToFixed(this, b))
})
}
})($jqPm);

View File

@@ -0,0 +1,8 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
<?php
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,87 @@
/*
* Async Treeview 0.1 - Lazy-loading extension for Treeview
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
*
* Copyright (c) 2007 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
*
* Revision: $Id: jquery.treeview.async.js 8040 2011-08-11 15:21:09Z aFolletete $
*
*/
;(function($) {
function load(settings, root, child, container) {
root = formatCategoryIdTreeView(root);
function createNode(parent) {
var id_category = this.id_category;
var checked = false;
$('input[name="'+settings.inputNameValue+'"][type=hidden]').each( function () {
if ($(this).attr('value') == id_category)
{
checked = true;
$(this).remove();
}
});
var current = $("<li/>").addClass(settings.inputNameSelector).attr("id", (this.id_category + '-' + settings.inputNameSelector) || "").html(" <input type=\""+(!settings.use_radio ? 'checkbox' : 'radio')+"\" value=\""+this.id_category+"\"/ name=\""+settings.inputNameValue+"\" "+(checked ? 'checked' : '')+" onclick=\"clickOnCategoryBox($(this), '"+ settings.inputNameValue +"');\"/> <span class=\"category_label\">" + this.name +"</span>"+(this.has_children>0 && !settings.use_radio?" <input type=\"checkbox\" class=\"check_all_children\" onclick=\"checkChildrenCategory(this,"+this.id_category+", '"+ settings.inputNameValue +"')\" /> <small>" + settings.checkAllChildrenLabel + "</small> ":'')+" <span class=\"category_level\" style=\"display: none;\">" + this.level_depth +"</span> <span class=\"nb_sub_cat_selected\" style=\"font-weight: bold;"+(this.nbSelectedSubCat == 0 ? 'display: none;' : '')+"\">(<span class=\"nb_sub_cat_selected_value\">"+this.nbSelectedSubCat+"</span> "+settings.selectedLabel+")</span>").appendTo(parent);
if (this.classes) {
current.children("span").addClass(this.classes);
}
if (this.has_children > 0) {
var branch = $("<ul/>").hide().appendTo(current);
current.addClass("hasChildren");
createNode.call({
classes: "placeholder",
name: "&nbsp;",
children:[]
}, branch);
branch.children().children('.nb_sub_cat_selected').remove();
}
}
$.ajax($.extend(true, {
url: settings.url,
dataType: "json",
data: {
id_category_parent: root
},
success: function(response) {
child.empty();
$.each(response, createNode, [child]);
$(container).treeview({
add: child
});
treeViewSetting[settings.inputNameValue]['readyToExpand'] = true;
}
}, settings.ajax));
}
var proxied = $.fn.treeview;
$.fn.treeview = function(settings) {
if (!settings.url) {
return proxied.apply(this, arguments);
}
var container = this;
if (!container.children().size())
load(settings, "source", this, container);
var userToggle = settings.toggle;
return proxied.call(this, $.extend({}, settings, {
collapsed: true,
toggle: function() {
var $this = $(this);
if ($this.hasClass("hasChildren")) {
var childList = $this.removeClass("hasChildren").find("ul");
load(settings, this.id, childList, container);
}
if (userToggle) {
userToggle.apply(this, arguments);
}
}
}));
};
})($);

View File

@@ -0,0 +1,37 @@
(function($) {
var CLASSES = $.treeview.classes;
var proxied = $.fn.treeview;
$.fn.treeview = function(settings) {
settings = $.extend({}, settings);
if (settings.add) {
return this.trigger("add", [settings.add]);
}
if (settings.remove) {
return this.trigger("remove", [settings.remove]);
}
return proxied.apply(this, arguments).bind("add", function(event, branches) {
$(branches).prev()
.removeClass(CLASSES.last)
.removeClass(CLASSES.lastCollapsable)
.removeClass(CLASSES.lastExpandable)
.find(">.hitarea")
.removeClass(CLASSES.lastCollapsableHitarea)
.removeClass(CLASSES.lastExpandableHitarea);
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, $(this).data("toggler"));
}).bind("remove", function(event, branches) {
var prev = $(branches).prev();
var parent = $(branches).parent();
$(branches).remove();
prev.filter(":last-child").addClass(CLASSES.last)
.filter("." + CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable).end()
.find(">.hitarea").replaceClass(CLASSES.expandableHitarea, CLASSES.lastExpandableHitarea).end()
.filter("." + CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable).end()
.find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.lastCollapsableHitarea);
if (parent.is(":not(:has(>))") && parent[0] != this) {
parent.parent().removeClass(CLASSES.collapsable).removeClass(CLASSES.expandable)
parent.siblings(".hitarea").andSelf().remove();
}
});
};
})($);

View File

@@ -0,0 +1,259 @@
/*
* Treeview 1.5pre - jQuery plugin to hide and show branches of a tree
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
* http://docs.jquery.com/Plugins/Treeview
*
* Copyright (c) 2007 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
*
* Revision: $Id: jquery.treeview.js 8130 2011-08-20 09:37:39Z aFolletete $
*
*/
;(function($) {
// TODO rewrite as a widget, removing all the extra plugins
$.extend($.fn, {
swapClass: function(c1, c2) {
var c1Elements = this.filter('.' + c1);
this.filter('.' + c2).removeClass(c2).addClass(c1);
c1Elements.removeClass(c1).addClass(c2);
return this;
},
replaceClass: function(c1, c2) {
return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
},
hoverClass: function(className) {
className = className || "hover";
return this.hover(function() {
$(this).addClass(className);
}, function() {
$(this).removeClass(className);
});
},
heightToggle: function(animated, callback) {
animated ?
this.animate({ height: "toggle" }, animated, callback) :
this.each(function(){
$(this)[ $(this).is(":hidden") ? "show" : "hide" ]();
if(callback)
callback.apply(this, arguments);
});
},
heightHide: function(animated, callback) {
if (animated) {
this.animate({ height: "hide" }, animated, callback);
} else {
this.hide();
if (callback)
this.each(callback);
}
},
prepareBranches: function(settings) {
if (!settings.prerendered) {
// mark last tree items
this.filter(":last-child:not(ul)").addClass(CLASSES.last);
// collapse whole tree, or only those marked as closed, anyway except those marked as open
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
}
// return all items with sublists
return this.filter(":has(>ul)");
},
applyClasses: function(settings, toggler) {
// TODO use event delegation
this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) {
// don't handle click events on children, eg. checkboxes
if ( this == event.target )
toggler.apply($(this).next());
}).add( $("a", this) ).hoverClass();
if (!settings.prerendered) {
// handle closed ones first
this.filter(":has(>ul:hidden)")
.addClass(CLASSES.expandable)
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
// handle open ones
this.not(":has(>ul:hidden)")
.addClass(CLASSES.collapsable)
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
// create hitarea if not present
var hitarea = this.find("div." + CLASSES.hitarea);
if (!hitarea.length)
hitarea = this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea);
hitarea.removeClass().addClass(CLASSES.hitarea).each(function() {
var classes = "";
$.each($(this).parent().attr("class").split(" "), function() {
classes += this + "-hitarea ";
});
$(this).addClass( classes );
})
}
// apply event to hitarea
this.find("div." + CLASSES.hitarea).click( toggler );
},
treeview: function(settings) {
settings = $.extend({
cookieId: "treeview"
}, settings);
if ( settings.toggle ) {
var callback = settings.toggle;
settings.toggle = function() {
return callback.apply($(this).parent()[0], arguments);
};
}
// factory for treecontroller
function treeController(tree, control) {
// factory for click handlers
function handler(filter) {
return function() {
// reuse toggle event handler, applying the elements to toggle
// start searching for all hitareas
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
// for plain toggle, no filter is provided, otherwise we need to check the parent element
return filter ? $(this).parent("." + filter).length : true;
}) );
return false;
};
}
// click on first element to collapse tree
$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
// click on second to expand tree
$("a:eq(1)", control).click( handler(CLASSES.expandable) );
// click on third to toggle tree
$("a:eq(2)", control).click( handler() );
}
// handle toggle event
function toggler() {
// Added by Prestashop
if ($(this).parent().is('.static'))
return;
$(this)
.parent()
// swap classes for hitarea
.find(">.hitarea")
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
// swap classes for parent li
.swapClass( CLASSES.collapsable, CLASSES.expandable )
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
// find child lists
.find( ">ul" )
// toggle them
.heightToggle( settings.animated, settings.toggle );
if ( settings.unique ) {
$(this).parent()
.siblings()
// swap classes for hitarea
.find(">.hitarea")
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
.find( ">ul" )
.heightHide( settings.animated, settings.toggle );
}
}
this.data("toggler", toggler);
function serialize() {
function binary(arg) {
return arg ? 1 : 0;
}
var data = [];
branches.each(function(i, e) {
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
});
$.cookie(settings.cookieId, data.join(""), settings.cookieOptions );
}
function deserialize() {
var stored = $.cookie(settings.cookieId);
if ( stored ) {
var data = stored.split("");
branches.each(function(i, e) {
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
});
}
}
// add treeview class to activate styles
this.addClass("treeview");
// prepare branches and find all tree items with child lists
var branches = this.find("li").prepareBranches(settings);
switch(settings.persist) {
case "cookie":
var toggleCallback = settings.toggle;
settings.toggle = function() {
serialize();
if (toggleCallback) {
toggleCallback.apply(this, arguments);
}
};
deserialize();
break;
case "location":
var current = this.find("a").filter(function() {
return this.href.toLowerCase() == location.href.toLowerCase();
});
if ( current.length ) {
// TODO update the open/closed classes
var items = current.addClass("selected").parents("ul, li").add( current.next() ).show();
if (settings.prerendered) {
// if prerendered is on, replicate the basic class swapping
items.filter("li")
.swapClass( CLASSES.collapsable, CLASSES.expandable )
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
.find(">.hitarea")
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea );
}
}
break;
}
branches.applyClasses(settings, toggler);
// if control option is set, create the treecontroller and show it
if ( settings.control ) {
treeController(this, settings.control);
$(settings.control).show();
}
return this;
}
});
// classes used by the plugin
// need to be styled via external stylesheet, see first example
$.treeview = {};
var CLASSES = ($.treeview.classes = {
open: "open",
closed: "closed",
expandable: "expandable",
expandableHitarea: "expandable-hitarea",
lastExpandableHitarea: "lastExpandable-hitarea",
collapsable: "collapsable",
collapsableHitarea: "collapsable-hitarea",
lastCollapsableHitarea: "lastCollapsable-hitarea",
lastCollapsable: "lastCollapsable",
lastExpandable: "lastExpandable",
last: "last",
hitarea: "hitarea"
});
})($);