You are here

page_load_progress.module in Page Load Progress 7

Same filename and directory in other branches
  1. 8 page_load_progress.module

Page Load Progress allows you to set a screen lock showing a spinner when the user clicks on an element that triggers a time consuming task.

File

page_load_progress.module
View source
<?php

/**
 * @file
 * Page Load Progress allows you to set a screen lock showing a spinner when the
 * user clicks on an element that triggers a time consuming task.
 */

/**
 * Implements hook_menu().
 */
function page_load_progress_menu() {
  $items = array();
  $items['admin/config/user-interface/page-load-progress'] = array(
    'title' => 'Page Load Progress',
    'description' => 'Manage the behavior of Page Load Progress.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'page_load_progress_settings',
    ),
    'access arguments' => array(
      'administer Page Load Progress settings',
    ),
    'file' => 'page_load_progress.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

/**
 * Implements hook_permission().
 */
function page_load_progress_permission() {
  return array(
    'administer Page Load Progress settings' => array(
      'title' => t('Administer Page Load Progress settings'),
    ),
  );
}

/**
 * Implements hook_init().
 */
function page_load_progress_init() {
  if (0 !== strpos(current_path(), 'admin/structure/views/')) {
    $settings = array(
      'delay' => variable_get('page_load_progress_time', 10),
      'elements' => variable_get('page_load_progress_elements', '.form-submit'),
    );
    drupal_add_js(array(
      'page_load_progress' => $settings,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'page_load_progress') . '/js/page_load_progress.js', 'file');
  }
}