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

Added default exclusion path for path which usually are unwanted for loading animation:

admin/*
panels/*
node/*/panelizer/*
js/*
ajax/*
parent 70e3e178
No related branches found
No related tags found
1 merge request!2Issue #3342445: jQuery .live() is deprecated
<?php
/**
* @file
* JQuery Loadinganimation admin/configuration functionality.
*/
/**
* jquery_loadinganimation admin settings form.
*/
function jquery_loadinganimation_settings_form() {
$module_path = drupal_get_path('module', 'jquery_loadinganimation');
$img_src_default = $module_path . '/images/ajax-loader.gif';
$form['jquery_loadinganimation_show_on_ajax'] = array(
'#type' => 'checkbox',
'#title' => t('Show during AJAX requests'),
'#description' => t(
"Display the loading animation during AJAX requests too. Notice: Use with caution, may be disturbing."),
'#default_value' => variable_get('jquery_loadinganimation_show_on_ajax', FALSE));
$form['jquery_loadinganimation_show_on_form_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Show after form submission'),
'#description' => t("Display the loading animation on form submit. <em>Important:</em> Buttons with further JS events registered are excluded from this trigger."),
'#default_value' => variable_get(
'jquery_loadinganimation_show_on_form_submit', TRUE));
$form['jquery_loadinganimation_show_on_href'] = array(
'#type' => 'checkbox',
'#title' => t('Show on href click'),
'#description' => t(
"Display the loading animation after a link has been clicked."),
'#default_value' => variable_get('jquery_loadinganimation_show_on_href', TRUE));
$form['jquery_loadinganimation_subselector'] = array(
'#type' => 'textfield',
'#title' => t('JQuery subselector'),
'#description' => t(
"You may optionally use this subselector to reduce the DOM context which to register loading animation to."),
'#required' => FALSE,
'#default_value' => variable_get('jquery_loadinganimation_subselector', ''));
// Exclude
$form['jquery_loadinganimation_path_match_exclude'] = array(
'#type' => 'textarea',
'#title' => t('Exclude the following path(s)'),
'#description' => t(
"jQuery Loadinganimation will not be used for paths that match these patterns.") . ' ' . t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.") . ' ' . t("Default: 'admin/*'"),
'#required' => TRUE,
'#default_value' => variable_get('jquery_loadinganimation_path_match_exclude', 'admin/*'));
$form['jquery_loadinganimation_close_on_click'] = array(
'#type' => 'checkbox',
'#title' => t('Close on layer click'),
'#description' => t(
"Close the layer if user clicks on it while loading process is still in progress."),
'#default_value' => variable_get('jquery_loadinganimation_close_on_click', TRUE));
$form['jquery_loadinganimation_close_on_esc'] = array(
'#type' => 'checkbox',
'#title' => t('Close on ESC press'),
'#description' => t(
"Close the layer if user presses ESC while loading process is still in progress."),
'#default_value' => variable_get('jquery_loadinganimation_close_on_esc', TRUE));
return system_settings_form($form);
<?php
/**
* @file
* JQuery Loadinganimation admin/configuration functionality.
*/
/**
* jquery_loadinganimation admin settings form.
*/
function jquery_loadinganimation_settings_form() {
$module_path = drupal_get_path('module', 'jquery_loadinganimation');
$img_src_default = $module_path . '/images/ajax-loader.gif';
$form['jquery_loadinganimation_show_on_ajax'] = array(
'#type' => 'checkbox',
'#title' => t('Show during AJAX requests'),
'#description' => t(
"Display the loading animation during AJAX requests too. Notice: Use with caution, may be disturbing."),
'#default_value' => variable_get('jquery_loadinganimation_show_on_ajax', FALSE));
$form['jquery_loadinganimation_show_on_form_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Show after form submission'),
'#description' => t("Display the loading animation on form submit. <em>Important:</em> Buttons with further JS events registered are excluded from this trigger."),
'#default_value' => variable_get(
'jquery_loadinganimation_show_on_form_submit', TRUE));
$form['jquery_loadinganimation_show_on_href'] = array(
'#type' => 'checkbox',
'#title' => t('Show on href click'),
'#description' => t(
"Display the loading animation after a link has been clicked."),
'#default_value' => variable_get('jquery_loadinganimation_show_on_href', TRUE));
$form['jquery_loadinganimation_subselector'] = array(
'#type' => 'textfield',
'#title' => t('JQuery subselector'),
'#description' => t(
"You may optionally use this subselector to reduce the DOM context which to register loading animation to."),
'#required' => FALSE,
'#default_value' => variable_get('jquery_loadinganimation_subselector', ''));
// Exclude
$form['jquery_loadinganimation_path_match_exclude'] = array(
'#type' => 'textarea',
'#title' => t('Exclude the following path(s)'),
'#description' => t(
"jQuery Loadinganimation will not be used for paths that match these patterns.") . ' ' . t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.") . ' ' . t("Default: 'admin/*'"),
'#required' => TRUE,
'#default_value' => variable_get('jquery_loadinganimation_path_match_exclude', ''));
$form['jquery_loadinganimation_close_on_click'] = array(
'#type' => 'checkbox',
'#title' => t('Close on layer click'),
'#description' => t(
"Close the layer if user clicks on it while loading process is still in progress."),
'#default_value' => variable_get('jquery_loadinganimation_close_on_click', TRUE));
$form['jquery_loadinganimation_close_on_esc'] = array(
'#type' => 'checkbox',
'#title' => t('Close on ESC press'),
'#description' => t(
"Close the layer if user presses ESC while loading process is still in progress."),
'#default_value' => variable_get('jquery_loadinganimation_close_on_esc', TRUE));
return system_settings_form($form);
}
\ No newline at end of file
......@@ -16,6 +16,15 @@ function jquery_loadinganimation_install() {
variable_set('jquery_loadinganimation_close_on_click', TRUE);
variable_set('jquery_loadinganimation_close_on_esc', TRUE);
variable_set('jquery_loadinganimation_subselector', '');
/*
* By default exclude the following path:
* admin/ *
* panels/ *
* node/ * /panelizer
* js/ *
* ajax/ *
*/
variable_set('jquery_loadinganimation_path_match_exclude', "admin/*\npanels/*\nnode/*/panelizer/*\njs/*\najax/*");
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment