|
@@ -46,7 +46,7 @@
|
|
|
var _nodes = [];
|
|
|
var _articles_nodes = [];
|
|
|
var _no_articles_nodes = [];
|
|
|
- var _articles_filter_on = false;
|
|
|
+ // var _articles_filter_on = false;
|
|
|
var _nodes_by_entries = {};
|
|
|
var _nodes_by_nid = {};
|
|
|
var _nodes_Nid_Id = {};
|
|
@@ -807,7 +807,7 @@
|
|
|
}
|
|
|
};
|
|
|
function filterEntree(t){
|
|
|
- shutDownArticles();
|
|
|
+ // shutDownArticles();
|
|
|
|
|
|
_nodes_centered = [];
|
|
|
for (var n = 0; n < _nodes.length; n++) {
|
|
@@ -850,7 +850,7 @@
|
|
|
// |___/\___\__,_|_| \__|_||_|
|
|
|
// and ajax modal content filtering
|
|
|
function filterByNids(nids){
|
|
|
- shutDownArticles();
|
|
|
+ // shutDownArticles();
|
|
|
|
|
|
_nodes_centered = [];
|
|
|
for (var n = 0; n < _nodes.length; n++) {
|
|
@@ -903,11 +903,14 @@
|
|
|
// /_/ \_\_| \__|_\__|_\___/__/
|
|
|
function initArtilesLink(){
|
|
|
// add "articles link to blockentrees"
|
|
|
+ var href = window.location.origin + drupalSettings.path.baseUrl +_settings.articlesindex_url;
|
|
|
_$articles_link = $('<a>')
|
|
|
.html('Articles')
|
|
|
- .attr("href", "#articles")
|
|
|
- .addClass('articles-link')
|
|
|
- .on('click', onCLickedOnArticles);
|
|
|
+ .attr("href", href)
|
|
|
+ .attr("data-drupal-link-system-path", _settings.articlesindex_url)
|
|
|
+ .addClass('articles-link ajax-link');
|
|
|
+ // main.js from template will load the index then trigger the filter here
|
|
|
+ // .on('click', onCLickedOnArticles);
|
|
|
|
|
|
$('.item-list ul',_$entrees_block).append(
|
|
|
$('<li>').append(
|
|
@@ -915,69 +918,98 @@
|
|
|
)
|
|
|
);
|
|
|
};
|
|
|
- function onCLickedOnArticles(e){
|
|
|
- e.preventDefault();
|
|
|
- $(this).toggleClass('is-active');
|
|
|
- if($(this).is('.is-active')){
|
|
|
- activateArticlesFilter();
|
|
|
- closeAllEntries();
|
|
|
- }else{
|
|
|
- deactivateArticlesFilter();
|
|
|
- }
|
|
|
- // _$canvas.trigger({
|
|
|
- // 'type':'corpus-cliqued-on-articles'
|
|
|
- // });
|
|
|
- return false;
|
|
|
- };
|
|
|
- function activateArticlesFilter(){
|
|
|
- //console.log('activateArticlesFilter');
|
|
|
- _articles_filter_on = true;
|
|
|
- // OPTION 1 : just fade no article nodes
|
|
|
- // for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
- // _no_articles_nodes[i].fade();
|
|
|
- // }
|
|
|
-
|
|
|
- // OPTION 2 : center the articles nodes and aside others
|
|
|
- closeAllEntries();
|
|
|
- _nodes_centered = [];
|
|
|
- for (var i = 0; i < _articles_nodes.length; i++) {
|
|
|
- _articles_nodes[i].setCentered();
|
|
|
- // record centered nodes for inter node repulsions
|
|
|
- _nodes_centered.push(_articles_nodes[i]);
|
|
|
- }
|
|
|
- for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
- _no_articles_nodes[i].setAside();
|
|
|
- }
|
|
|
-
|
|
|
- updateRandomPlaylist(_articles_nodes);
|
|
|
- if(typeof _paq !== 'undefined'){
|
|
|
- // trackEvent(category, action, [name], [value])
|
|
|
- _paq.push(['trackEvent', 'Corpus Articles', 'on']);
|
|
|
- }
|
|
|
- };
|
|
|
- function deactivateArticlesFilter(){
|
|
|
- //console.log('deactivateArticlesFilter');
|
|
|
- _articles_filter_on = false;
|
|
|
-
|
|
|
- // OPTION 1 : just fade no article nodes
|
|
|
- // for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
- // _no_articles_nodes[i].unFade();
|
|
|
- // }
|
|
|
-
|
|
|
- // OPTION 2 : centered / aside
|
|
|
- scrambleCollection();
|
|
|
-
|
|
|
- updateRandomPlaylist(_playlist);
|
|
|
- if(typeof _paq !== 'undefined'){
|
|
|
- // trackEvent(category, action, [name], [value])
|
|
|
- _paq.push(['trackEvent', 'Corpus Articles', 'off']);
|
|
|
- }
|
|
|
- };
|
|
|
- function shutDownArticles(){
|
|
|
+ // function onCLickedOnArticles(e){
|
|
|
+ // e.preventDefault();
|
|
|
+ // $(this).toggleClass('is-active');
|
|
|
+ // if($(this).is('.is-active')){
|
|
|
+ // activateArticlesFilter();
|
|
|
+ // closeAllEntries();
|
|
|
+ // }else{
|
|
|
+ // deactivateArticlesFilter();
|
|
|
+ // }
|
|
|
+ // // _$canvas.trigger({
|
|
|
+ // // 'type':'corpus-cliqued-on-articles'
|
|
|
+ // // });
|
|
|
+ // return false;
|
|
|
+ // };
|
|
|
+ // function activateArticlesFilter(){
|
|
|
+ // //console.log('activateArticlesFilter');
|
|
|
+ // _articles_filter_on = true;
|
|
|
+ // // OPTION 1 : just fade no article nodes
|
|
|
+ // // for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
+ // // _no_articles_nodes[i].fade();
|
|
|
+ // // }
|
|
|
+ // // END OPTION 1
|
|
|
+ //
|
|
|
+ // // OPTION 2 : center the articles nodes and aside others
|
|
|
+ // closeAllEntries();
|
|
|
+ // _nodes_centered = [];
|
|
|
+ // for (var i = 0; i < _articles_nodes.length; i++) {
|
|
|
+ // _articles_nodes[i].setCentered();
|
|
|
+ // // record centered nodes for inter node repulsions
|
|
|
+ // _nodes_centered.push(_articles_nodes[i]);
|
|
|
+ // }
|
|
|
+ // for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
+ // _no_articles_nodes[i].setAside();
|
|
|
+ // }
|
|
|
+ // // TODO: open an index of nodes with articles
|
|
|
+ // // loadArticlesIndex();
|
|
|
+ // // END OPTION 2
|
|
|
+ //
|
|
|
+ // updateRandomPlaylist(_articles_nodes);
|
|
|
+ // if(typeof _paq !== 'undefined'){
|
|
|
+ // // trackEvent(category, action, [name], [value])
|
|
|
+ // _paq.push(['trackEvent', 'Corpus Articles', 'on']);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // function loadArticlesIndex(){
|
|
|
+ // var path = window.location.origin + drupalSettings.path.baseUrl +_settings.articlesindex_url+'/ajax';
|
|
|
+ // $.getJSON(path)
|
|
|
+ // .done(function(data){
|
|
|
+ // onArticlesIndexLoaded(data);
|
|
|
+ // })
|
|
|
+ // .fail(function(jqxhr, textStatus, error){
|
|
|
+ // onArticlesIndexLoadFail(jqxhr, textStatus, error);
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ //
|
|
|
+ // function onArticlesIndexLoaded(data){
|
|
|
+ // // insert index col
|
|
|
+ // _$container.find('main[role="main"] .row').append(data.rendered);
|
|
|
+ //
|
|
|
+ // // trigger event
|
|
|
+ // _$body.trigger({
|
|
|
+ // 'type':'articles-index-loaded',
|
|
|
+ // 'results':data.results_nids
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ //
|
|
|
+ // function onArticlesIndexLoadFail(jqxhr, textStatus, error){
|
|
|
+ // console.warn('EdlpCorpus : articles index ajax load failed : '+error, jqxhr.responseText);
|
|
|
+ // };
|
|
|
+ // function deactivateArticlesFilter(){
|
|
|
+ // //console.log('deactivateArticlesFilter');
|
|
|
+ // _articles_filter_on = false;
|
|
|
+ //
|
|
|
+ // // OPTION 1 : just fade no article nodes
|
|
|
+ // // for (var i = 0; i < _no_articles_nodes.length; i++) {
|
|
|
+ // // _no_articles_nodes[i].unFade();
|
|
|
+ // // }
|
|
|
+ //
|
|
|
+ // // OPTION 2 : centered / aside
|
|
|
+ // scrambleCollection();
|
|
|
+ //
|
|
|
+ // updateRandomPlaylist(_playlist);
|
|
|
+ // if(typeof _paq !== 'undefined'){
|
|
|
+ // // trackEvent(category, action, [name], [value])
|
|
|
+ // _paq.push(['trackEvent', 'Corpus Articles', 'off']);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // function shutDownArticles(){
|
|
|
// shutdown articles if active
|
|
|
- if(_$articles_link.is('.is-active'))
|
|
|
- _$articles_link.trigger('click');
|
|
|
- };
|
|
|
+ // if(_$articles_link.is('.is-active'))
|
|
|
+ // _$articles_link.trigger('click');
|
|
|
+ // };
|
|
|
|
|
|
// ___ _
|
|
|
// | __|_ _____ _ _| |_ ___
|
|
@@ -1009,7 +1041,7 @@
|
|
|
var event = {
|
|
|
'type':'corpus-cliked-on-node',
|
|
|
'target_node':_nodes[_node_hover_id],
|
|
|
- 'article':_articles_filter_on
|
|
|
+ // 'article':_articles_filter_on
|
|
|
};
|
|
|
_$canvas.trigger(event);
|
|
|
// instead of directly opening the doc, create an event listener (e.g. : audio played from random)
|
|
@@ -1017,7 +1049,7 @@
|
|
|
}else{
|
|
|
// console.log('corpus : click on map');
|
|
|
_$canvas.trigger('corpus-cliked-on-map');
|
|
|
- shutDownArticles();
|
|
|
+ // shutDownArticles();
|
|
|
}
|
|
|
}
|
|
|
})
|