|
@@ -62,19 +62,25 @@ edlp_vars = {
|
|
|
// TODO: implement history.js
|
|
|
function initAjaxLinks(){
|
|
|
console.log('initAjaxLinks');
|
|
|
- $('a', '#block-mainnavigation, #block-footer.menu--footer').addClass('ajax-link');
|
|
|
+ $('a', '#block-mainnavigation, #block-footer.menu--footer, #block-productions').addClass('ajax-link');
|
|
|
|
|
|
_$ajaxLinks = $('.ajax-link')
|
|
|
.each(function(i,e){
|
|
|
var $this = $(this);
|
|
|
+
|
|
|
+ // avoid already ajaxified links
|
|
|
+ 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]);
|
|
|
}
|
|
|
+ $this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
|
|
})
|
|
|
- .on('click', onClickAjaxLink);
|
|
|
+
|
|
|
;
|
|
|
};
|
|
|
|
|
@@ -103,7 +109,7 @@ edlp_vars = {
|
|
|
};
|
|
|
|
|
|
function onAjaxLinkLoaded(data, $link, sys_path){
|
|
|
- console.log('ajax link loaded : data', data);
|
|
|
+ console.log('ajax link loaded');
|
|
|
_$content_container.html(data.rendered);
|
|
|
_$body.removeClass('ajax-loading');
|
|
|
// add body class for currently loaded content
|
|
@@ -118,10 +124,11 @@ edlp_vars = {
|
|
|
$link.removeClass('ajax-loading').addClass('is-active');
|
|
|
|
|
|
initScrollbars();
|
|
|
- console.log(sys_path);
|
|
|
- if(sys_path == "productions"){
|
|
|
- window.requestAnimationFrame(initProductions);
|
|
|
- }
|
|
|
+
|
|
|
+ if(sys_path == "productions")
|
|
|
+ initProductions();
|
|
|
+
|
|
|
+ initAjaxLinks();
|
|
|
|
|
|
};
|
|
|
|