|
@@ -120,7 +120,7 @@ edlp_vars = {
|
|
// cartel functions
|
|
// cartel functions
|
|
loadNode(nid){
|
|
loadNode(nid){
|
|
this.$cartel.addClass('loading');
|
|
this.$cartel.addClass('loading');
|
|
- $.getJSON('/edlp/node/'+nid+'/ajax/player_cartel', {})
|
|
|
|
|
|
+ $.getJSON('/edlp/ajax/json/node/'+nid+'/player_cartel', {})
|
|
.done(this.onNodeLoaded.bind(this))
|
|
.done(this.onNodeLoaded.bind(this))
|
|
.fail(this.onNodeLoadFail.bind(this));
|
|
.fail(this.onNodeLoadFail.bind(this));
|
|
},
|
|
},
|
|
@@ -242,11 +242,7 @@ edlp_vars = {
|
|
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;
|
|
- var sys_path = $this.attr('data-drupal-link-system-path');
|
|
|
|
- if(sys_path){
|
|
|
|
- // convert node link to edlp_ajax_node module links
|
|
|
|
- m = sys_path.match(/^\/?(node\/\d+)$/g);
|
|
|
|
- if(m) $this.attr('data-drupal-link-system-path', 'edlp/'+m[0]);
|
|
|
|
|
|
+ if($this.attr('data-drupal-link-system-path')){
|
|
$this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
|
$this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -260,19 +256,28 @@ edlp_vars = {
|
|
return false;
|
|
return false;
|
|
|
|
|
|
var sys_path = $(this).attr('data-drupal-link-system-path');
|
|
var sys_path = $(this).attr('data-drupal-link-system-path');
|
|
|
|
+ var ajax_path = sys_path;
|
|
if(sys_path == '<front>'){
|
|
if(sys_path == '<front>'){
|
|
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];
|
|
|
|
+ // check for viewmode attribute
|
|
|
|
+ if($link.attr('viewmode')){
|
|
|
|
+ ajax_path += '/'+$link.attr('viewmode');
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ // convert other link to ajax
|
|
|
|
+ ajax_path += '/ajax'
|
|
|
|
+ }
|
|
|
|
|
|
- var path = window.location.origin + drupalSettings.path.baseUrl + sys_path;
|
|
|
|
_$body.addClass('ajax-loading');
|
|
_$body.addClass('ajax-loading');
|
|
$link.addClass('ajax-loading');
|
|
$link.addClass('ajax-loading');
|
|
- // check for viewmode attribute
|
|
|
|
- path += '/ajax';
|
|
|
|
- if($link.attr('viewmode') != ''){
|
|
|
|
- path += '/'+$link.attr('viewmode');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
|
|
$.getJSON(path, {})
|
|
$.getJSON(path, {})
|
|
.done(function(data){
|
|
.done(function(data){
|
|
onAjaxLinkLoaded(data, $link, sys_path);
|
|
onAjaxLinkLoaded(data, $link, sys_path);
|
|
@@ -298,9 +303,16 @@ edlp_vars = {
|
|
_$content_container.html(data.rendered);
|
|
_$content_container.html(data.rendered);
|
|
|
|
|
|
// add body class for currently loaded content
|
|
// add body class for currently loaded content
|
|
- _$body.removeClass().addClass('path-'+sys_path.replace(/\//g, '-'));
|
|
|
|
|
|
+ var body_classes = [
|
|
|
|
+ 'path-'+sys_path.replace(/\//g, '-'),
|
|
|
|
+ 'entity-type-'+data.entity_type,
|
|
|
|
+ 'bundle-'+data.bundle,
|
|
|
|
+ 'view-mode-'+data.view_mode
|
|
|
|
+ ];
|
|
|
|
+ _$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(/^\/?(edlp\/node\/\d+)$/g);
|
|
|
|
|
|
+ m = sys_path.match(/^\/?(node\/\d+)$/g);
|
|
if(m)
|
|
if(m)
|
|
_$body.addClass('path-edlp-node');
|
|
_$body.addClass('path-edlp-node');
|
|
|
|
|