$(function() {
var context = $('.detail-component-wrapper');
var widget = $('.pane');
var vars={};
$('.tag-container').each(function( i, val ) {
var id = $(this).data('labsid');
vars[id] = context.find('#article-'+id);
});
function loadArticle(data) {
emptyArticle();
hideReplacement();
$.each(vars, function (i, val) {
if ($.isArray(data[i])) {
$.each(data[i], function (z, x) {
val.append('
' + x + '
');
});
}
else {
if(i=='url'){
val.append('link to article')
}
else{
if(data[i]){
val.append('' + data[i] + '
');
}
else {
val.append('' + '-' + '
');
}
}
}
});
};
function emptyArticle() {
$.each(vars, function (i, val) {
val.empty();
});
}
function showReplacement() {
$('#article-overview').hide();
$('#article-replacement').show();
}
function hideReplacement() {
$('#article-overview').show();
$('#article-replacement').hide();
}
function filter(active) {
console.log('Filtering: ', active);
emptyArticle();
showReplacement();
if (active) {
widget.addClass('filtering');
}
if (!active) {
widget.removeClass('filtering');
}
}
if ($('#ftrindex').length) {
var ftrindex = $('#ftrindex').data('handle');
ftrindex.attachHook('article-project', 'article', loadArticle);
ftrindex.attachHook('article-project', 'filter', filter);
} else {
console.log('#ftrindex has no length, abort mission.')
}
});
/*******************************************************************/
/* ftrtch dino */
/* [type: JS] [file:project-article] [24.1359] DESIGN*/
/*******************************************************************/
/* 0.6 D>D */
/* db 153 */