jMA(document).ready(function($) {
"use strict";
// WCAG compatibility
$("#filter_search").attr("title", "Search...");
$("#filter_category").attr("title", "- Select Category -");
$("#filter_date").attr("title", "- All Months & Years -");
$("#filter_orderby").attr("title", "- Ordering -");
$("#filter_author").attr("title", "- Select Author -");
// Search button validation
$('button#search-button-home, button#search-button-page').on('click', function () {
var filter_search = $('#filter_search').val();
var filter_author = $('#filter_author').val();
var filter_category = $('#filter_category').val();
if (
(filter_search === null || filter_search === "") &&
(filter_author === null || filter_author === "") &&
(filter_category === null || filter_category === "")
)
{
$("#filter_search, #filter_author, #filter_category").css("border", "1px solid red");
w357uiUIkit.modal.alert("Please, choose at least one option or type something in the search form field.");
return false;
}
else if (filter_search.length < 3)
{
$("#filter_search").css("border", "1px solid red");
w357uiUIkit.modal.alert("Please, enter at least three characters.");
return false;
}
});
// bind change event to select
$('#filter_date, #filter_orderby, #filter_author, #filter_category').on('change', function () {
var filter_date = $('#filter_date').val(); // get selected value
var filter_orderby = $('#filter_orderby').val(); // get selected value
var filter_category = $('#filter_category').val(); // get selected value
var filter_author = $('#filter_author').val(); // get selected value
var menu_item_id = $('#menu_item_id').val(); // get selected value
var url = 'index.php?option=com_monthlyarchive';
if (filter_date)
{
var date_arr = filter_date.split("-");
var year = date_arr[0];
var month = date_arr[1];
if (year)
{
url += '&year=' + year;
}
if (month)
{
url += '&month=' + month;
}
}
else
{
url += '&year=all';
}
if (filter_orderby)
{
url += '&orderby=' + filter_orderby;
}
if (filter_category)
{
url += '&category=' + filter_category;
}
if (filter_author)
{
url += '&author=' + filter_author;
}
if (menu_item_id)
{
url += '&Itemid=' + menu_item_id;
}
url += '&task=archive.goToURL';
$('#adminForm').attr('action', url);
$('#adminForm').submit();
});
// CLEAR FILTERS
$('button#clear-search-button-home, #back-to-monthly-archive').on('click', function () {
$('#filter_search').val('');
$('#filter_orderby').val('most_recent_first');
$('#filter_author').val('');
$('#filter_category').val('');
$('#filter_date').val('all');
$('#filter_year').val('');
$('#filter_month').val('');
$('#adminForm').attr('action', '/flash-news/archivio-flash-news');
$('#adminForm').submit();
});
$('button#clear-search-button-page').on('click', function () {
$('#filter_search').val('');
$('#filter_orderby').val('most_recent_first');
$('#filter_author').val('');
$('#filter_category').val('');
$('#filter_date').val('all');
$('#filter_year').val('');
$('#filter_month').val('');
$('#adminForm').attr('action', '/flash-news/archivio-flash-news/all');
$('#adminForm').submit();
});
});
if (typeof RokBoxSettings == 'undefined') RokBoxSettings = {pc: '100'};
jMA(document).ready(function($) {
"use strict";
// bind change event to select
$('#filter_date_module').on('change', function () {
var filter_date_module = $('#filter_date_module').val(); // get selected value
var menu_item_id = $('#menu_item_id_module').val(); // get selected value
var url = 'index.php?option=com_monthlyarchive';
if (filter_date_module)
{
var date_arr = filter_date_module.split("-");
var year = date_arr[0];
var month = date_arr[1];
if (year)
{
url += '&year=' + year;
}
if (month)
{
url += '&month=' + month;
}
}
else
{
url += '&year=all';
}
if (menu_item_id)
{
url += '&Itemid=' + menu_item_id;
}
url += '&task=archive.goToURL';
$('#maModuleForm').attr('action', url);
$('#maModuleForm').submit();
});
});