Skip to content
Snippets Groups Projects
Commit c2c8c4bb authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Added further admin options.

parent 451d5afe
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
function jquery_loadinganimation_install() { function jquery_loadinganimation_install() {
// Set general settings. // Set general settings.
variable_set('jquery_loadinganimation_show_on_ajax', TRUE); variable_set('jquery_loadinganimation_show_on_ajax', TRUE);
variable_set('jquery_loadinganimation_show_on_href', TRUE);
variable_set('jquery_loadinganimation_show_on_form_submit', TRUE);
} }
/** /**
...@@ -20,5 +22,7 @@ function jquery_loadinganimation_uninstall() { ...@@ -20,5 +22,7 @@ function jquery_loadinganimation_uninstall() {
// Remove the general settings. // Remove the general settings.
variable_del('jquery_loadinganimation_img_src'); variable_del('jquery_loadinganimation_img_src');
variable_del('jquery_loadinganimation_show_on_ajax'); variable_del('jquery_loadinganimation_show_on_ajax');
variable_del('jquery_loadinganimation_show_on_href');
variable_del('jquery_loadinganimation_show_on_form_submit');
variable_del('jquery_loadinganimation_subselector'); variable_del('jquery_loadinganimation_subselector');
} }
\ No newline at end of file
...@@ -12,42 +12,46 @@ ...@@ -12,42 +12,46 @@
} else { } else {
var subselectorSuffix = ''; var subselectorSuffix = '';
} }
$(context).find("a[href]" + settings.subselector).not( if (Drupal.settings.jquery_loadinganimation.show_on_href) {
"a[href=javascript:;]").not("a[href=#]").not(".noLoadingAnimation").each( $(context).find("a[href]" + settings.subselector).not(
function(i, element) { "a[href=javascript:;]").not("a[href=#]").not(".noLoadingAnimation").each(
// Nur Elemente, die keine JS-Events haben (TODO: Nur function(i, element) {
// click-events beachten) // Nur Elemente, die keine JS-Events haben (TODO: Nur
if (typeof $(element).data("events") == 'undefined' // click-events beachten)
|| $(element).data("events").length == 0) { if (typeof $(element).data("events") == 'undefined'
$(element).click(function(eventObject) { || $(element).data("events").length == 0) {
// Nicht bei Öffnen in neuem Tab (Strg+Klick) $(element).click(function(eventObject) {
if (!eventObject.ctrlKey) { // Nicht bei Öffnen in neuem Tab (Strg+Klick)
Loadinganimation.show(); if (!eventObject.ctrlKey) {
} Loadinganimation.show();
}); }
} });
}); }
});
}
// Bei Formularversand auch ausfuehren, wenn keine anderen Events if (Drupal.settings.jquery_loadinganimation.show_on_form_submit) {
// registriert sind. // Bei Formularversand auch ausfuehren, wenn keine anderen Events
$(context).find("form" + subselectorSuffix).submit( // registriert sind.
function() { $(context).find("form" + subselectorSuffix).submit(
if (typeof $(this).data("events") == 'undefined' function() {
|| $(this).data("events").length == 0 if (typeof $(this).data("events") == 'undefined'
) { || $(this).data("events").length == 0
Loadinganimation.show(); ) {
} else {
var show=true;
jQuery.each($(this).data("events"), function(index, element){
if(element.type != undefined){
show = false;
}
});
if(show){
Loadinganimation.show(); Loadinganimation.show();
} else {
var show=true;
jQuery.each($(this).data("events"), function(index, element){
if(element.type != undefined){
show = false;
}
});
if(show){
Loadinganimation.show();
}
} }
} });
}); }
// Bei Klick auf die Animation ausblenden // Bei Klick auf die Animation ausblenden
$("div#loadinganimation").click(function() { $("div#loadinganimation").click(function() {
......
...@@ -52,5 +52,7 @@ function _jquery_loadinganimation_get_settings() { ...@@ -52,5 +52,7 @@ function _jquery_loadinganimation_get_settings() {
'module_path' => $module_path, 'module_path' => $module_path,
'img_src' => variable_get('jquery_loadinganimation_img_src', $module_path . '/images/ajax-loader.gif'), 'img_src' => variable_get('jquery_loadinganimation_img_src', $module_path . '/images/ajax-loader.gif'),
'show_on_ajax' => variable_get('jquery_loadinganimation_show_on_ajax', TRUE), 'show_on_ajax' => variable_get('jquery_loadinganimation_show_on_ajax', TRUE),
'show_on_href' => variable_get('jquery_loadinganimation_show_on_href', TRUE),
'show_on_form_submit' => variable_get('jquery_loadinganimation_show_on_form_submit', TRUE),
'subselector' => variable_get('jquery_loadinganimation_subselector', '')); 'subselector' => variable_get('jquery_loadinganimation_subselector', ''));
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment