added on/off switch to corpus-map, added loader svg for ajax (remains to animate it
This commit is contained in:
@@ -2,37 +2,34 @@
|
||||
|
||||
EdlpTheme = function(){
|
||||
|
||||
var _is_front = $('body').is('.path-frontpage');
|
||||
var _$body = $('body');
|
||||
var _is_front = _$body.is('.path-frontpage');
|
||||
var _$corpus_map;
|
||||
var _$content_container = $('.layout-container>main>.layout-content');
|
||||
|
||||
function init(){
|
||||
console.log("EdlpTheme init()");
|
||||
// if(_is_front) initFront();
|
||||
|
||||
$('body').on('corpus-map-ready', onCorpusMapReady);
|
||||
|
||||
_$body.on('corpus-map-ready', onCorpusMapReady);
|
||||
initScrollbars();
|
||||
|
||||
initAjaxLinks();
|
||||
};
|
||||
|
||||
|
||||
|
||||
// function initFront(){
|
||||
// console.log('theme : initFront');
|
||||
// };
|
||||
|
||||
// ___ _ _ ___
|
||||
// / __| __ _ _ ___| | | _ ) __ _ _ _ ___
|
||||
// \__ \/ _| '_/ _ \ | | _ \/ _` | '_(_-<
|
||||
// |___/\__|_| \___/_|_|___/\__,_|_| /__/
|
||||
function initScrollbars(){
|
||||
console.log("initScrollbars");
|
||||
$('.os-scroll').overlayScrollbars({
|
||||
overflowBehavior:{x:'h',y:'scroll'}
|
||||
});
|
||||
// $('.row .col>*', 'main[role="main"]').overlayScrollbars({
|
||||
// overflowBehavior:{x:'h',y:'scroll'}
|
||||
// });
|
||||
};
|
||||
|
||||
// ajax
|
||||
// _ _
|
||||
// /_\ (_)__ ___ __
|
||||
// / _ \ | / _` \ \ /
|
||||
// /_/ \_\/ \__,_/_\_\
|
||||
// |__/
|
||||
function initAjaxLinks(){
|
||||
console.log('initAjaxLinks');
|
||||
$('a', '#block-mainnavigation').on('click', onClickAjaxLink);
|
||||
@@ -41,22 +38,29 @@
|
||||
function onClickAjaxLink(e){
|
||||
e.preventDefault();
|
||||
// TODO: drupal settings not defined on NOT front page
|
||||
var path = window.location.origin + drupalSettings.basepath + $(this).attr('data-drupal-link-system-path')+'/ajax';
|
||||
$.getJSON(path, {}, onAjaxLinkLoaded);
|
||||
var sys_path = $(this).attr('data-drupal-link-system-path');
|
||||
var path = window.location.origin + drupalSettings.basepath + sys_path +'/ajax';
|
||||
closeAllModals();
|
||||
_$body.addClass('ajax-loading');
|
||||
$.getJSON(path, {}, function(data){
|
||||
onAjaxLinkLoaded(data, sys_path);
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function onAjaxLinkLoaded(data){
|
||||
function onAjaxLinkLoaded(data, sys_path){
|
||||
console.log('ajax link loaded : data', data);
|
||||
$('main[role="main"] .layout-content').html(data.rendered);
|
||||
_$content_container.html(data.rendered);
|
||||
_$body.removeClass().addClass('path-'+sys_path);
|
||||
_$body.removeClass('ajax-loading');
|
||||
initScrollbars();
|
||||
};
|
||||
|
||||
// corpus
|
||||
function onCorpusMapReady(e){
|
||||
console.log('theme : onCorpusReady');
|
||||
_$corpus_map = $('canvas#edlp-map');
|
||||
_$corpus_map = $('canvas#corpus-map');
|
||||
_$corpus_map.on('corpus-cliked-on-map', function(e) {
|
||||
console.log('theme : corpus-cliked-on-map');
|
||||
closeAllModals();
|
||||
@@ -66,7 +70,7 @@
|
||||
//modals
|
||||
function closeAllModals(){
|
||||
console.log('theme : closeAllModals');
|
||||
// TODO: animate the remove
|
||||
// TODO: animate the remove
|
||||
_$content_container.html('');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user