|
@@ -235,13 +235,22 @@ edlp_vars = {
|
|
// TODO: implement history.js
|
|
// TODO: implement history.js
|
|
function initAjaxLinks(){
|
|
function initAjaxLinks(){
|
|
console.log('initAjaxLinks');
|
|
console.log('initAjaxLinks');
|
|
- $('a', '#block-mainnavigation, #block-footer.menu--footer, #block-productions, article.node h2.node-title, .productions-subtree, .productions-parent').addClass('ajax-link');
|
|
|
|
|
|
+
|
|
|
|
+ $('a', '#block-mainnavigation')
|
|
|
|
+ .add('a', '#block-footer.menu--footer')
|
|
|
|
+ .add('a', '#block-productions')
|
|
|
|
+ .add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
|
|
|
|
+ .add('a', '.productions-subtree')
|
|
|
|
+ .add('a', '.productions-parent')
|
|
|
|
+ // .add('a.index-link, a.notice-link', '#block-edlpentreesblock')
|
|
|
|
+ .addClass('ajax-link');
|
|
|
|
+
|
|
|
|
|
|
_$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
|
|
_$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
|
|
.each(function(i,e){
|
|
.each(function(i,e){
|
|
var $this = $(this);
|
|
var $this = $(this);
|
|
// avoid already ajaxified links
|
|
// avoid already ajaxified links
|
|
- // if($this.is('.ajax-enable')) return;
|
|
|
|
|
|
+ if($this.is('.ajax-enable')) return;
|
|
if($this.attr('data-drupal-link-system-path')){
|
|
if($this.attr('data-drupal-link-system-path')){
|
|
$this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
|
$this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
|
}
|
|
}
|
|
@@ -261,10 +270,19 @@ edlp_vars = {
|
|
backToFrontPage();
|
|
backToFrontPage();
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- m = ajax_path.match(/^\/?(node\/\d+)$/g);
|
|
|
|
- if(m){
|
|
|
|
- // convert node link to edlp_ajax_node module links
|
|
|
|
- ajax_path = 'edlp/ajax/json/'+m[0];
|
|
|
|
|
|
+
|
|
|
|
+ // convert node link to edlp_ajax_node module links
|
|
|
|
+ var node_match = ajax_path.match(/^\/?(node\/\d+)$/g);
|
|
|
|
+ var term_match = ajax_path.match(/^\/?(taxonomy\/term\/\d+)$/g);
|
|
|
|
+ if(node_match){
|
|
|
|
+ ajax_path = 'edlp/ajax/json/'+node_match[0];
|
|
|
|
+ // check for viewmode attribute
|
|
|
|
+ if($link.attr('viewmode')){
|
|
|
|
+ ajax_path += '/'+$link.attr('viewmode');
|
|
|
|
+ }
|
|
|
|
+ }else if(term_match){
|
|
|
|
+ ajax_path = 'edlp/ajax/json/'+term_match[0];
|
|
|
|
+ ajax_path = ajax_path.replace(/taxonomy\/term/, 'taxonomy_term');
|
|
// check for viewmode attribute
|
|
// check for viewmode attribute
|
|
if($link.attr('viewmode')){
|
|
if($link.attr('viewmode')){
|
|
ajax_path += '/'+$link.attr('viewmode');
|
|
ajax_path += '/'+$link.attr('viewmode');
|
|
@@ -310,7 +328,7 @@ edlp_vars = {
|
|
'view-mode-'+data.view_mode
|
|
'view-mode-'+data.view_mode
|
|
];
|
|
];
|
|
_$body.removeClass().addClass(body_classes.join(' '));
|
|
_$body.removeClass().addClass(body_classes.join(' '));
|
|
-
|
|
|
|
|
|
+
|
|
// id node add a generic path-node class to body
|
|
// id node add a generic path-node class to body
|
|
m = sys_path.match(/^\/?(node\/\d+)$/g);
|
|
m = sys_path.match(/^\/?(node\/\d+)$/g);
|
|
if(m)
|
|
if(m)
|