123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * @file
- * Provides the DOM Window library.
- */
- /**
- * Implements hook_library().
- */
- function domwindow_library() {
- $libraries = array();
- $libraries['domwindow'] = array(
- 'title' => 'DOM Window',
- 'website' => 'http://swip.codylindley.com/DOMWindowDemo.html',
- 'version' => 1,
- 'js' => array(
- _domwindow_library_path() => array(
- 'group' => JS_LIBRARY,
- ),
- ),
- 'dependencies' => array(
- // jquery.DOMWindow.js relies on jQuery in jquery.js
- array('system', 'jquery'),
- ),
- );
- return $libraries;
- }
- /**
- * Gets the path to the jQuery DOMWindow library.
- *
- * @return
- * The path to the DOMWindow library js file, or FALSE if not found.
- */
- function _domwindow_library_path() {
- $domwindow_path = libraries_get_path('jquery.domwindow');
- $result = FALSE;
- if (!empty($domwindow_path)) {
- // Attempt to use minified version of jQuery DOMWindow plugin.
- if (file_exists($domwindow_path . '/jquery.DOMWindow.min.js')) {
- $result = $domwindow_path . '/jquery.DOMWindow.min.js';
- }
- // Otherwise use non-minified version if available.
- elseif (file_exists($domwindow_path . '/jquery.DOMWindow.js')) {
- $result = $domwindow_path . '/jquery.DOMWindow.js';
- }
- }
- return $result;
- }
|