summaryrefslogtreecommitdiffstats
path: root/system/libraries/javascript
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2011-07-02 00:40:48 +0200
committerDerek Jones <derek.jones@ellislab.com>2011-07-02 00:40:48 +0200
commit4b9c62980599228f070b401c7673dce8085b0c61 (patch)
tree314bd87831a09913cbbfd1ffe1447b3c38b394c5 /system/libraries/javascript
parent114ab0988e20ac6be39ad363ff897a1a3b85e565 (diff)
backed out 648b42a75739, which was a NON-trivial whitespace commit. It broke the Typography class's string replacements, for instance
Diffstat (limited to 'system/libraries/javascript')
-rw-r--r--system/libraries/javascript/Jquery.php218
1 files changed, 109 insertions, 109 deletions
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index 97107f0cc..baab83d25 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
@@ -23,7 +23,7 @@
* @category Loader
* @link http://www.codeigniter.com/user_guide/libraries/javascript.html
*/
-
+
class CI_Jquery extends CI_Javascript {
var $_javascript_folder = 'js';
@@ -36,20 +36,20 @@ class CI_Jquery extends CI_Javascript {
public function __construct($params)
{
- $this->CI =& get_instance();
+ $this->CI =& get_instance();
extract($params);
if ($autoload === TRUE)
{
- $this->script();
+ $this->script();
}
-
+
log_message('debug', "Jquery Class Initialized");
}
-
- // --------------------------------------------------------------------
+
+ // --------------------------------------------------------------------
// Event Code
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
/**
* Blur
@@ -65,9 +65,9 @@ class CI_Jquery extends CI_Javascript {
{
return $this->_add_event($element, $js, 'blur');
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Change
*
@@ -82,9 +82,9 @@ class CI_Jquery extends CI_Javascript {
{
return $this->_add_event($element, $js, 'change');
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Click
*
@@ -112,7 +112,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Double Click
*
@@ -129,7 +129,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Error
*
@@ -146,7 +146,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Focus
*
@@ -163,7 +163,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Hover
*
@@ -185,7 +185,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Keydown
*
@@ -202,7 +202,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Keyup
*
@@ -216,10 +216,10 @@ class CI_Jquery extends CI_Javascript {
function _keyup($element = 'this', $js = '')
{
return $this->_add_event($element, $js, 'keyup');
- }
+ }
// --------------------------------------------------------------------
-
+
/**
* Load
*
@@ -233,10 +233,10 @@ class CI_Jquery extends CI_Javascript {
function _load($element = 'this', $js = '')
{
return $this->_add_event($element, $js, 'load');
- }
-
+ }
+
// --------------------------------------------------------------------
-
+
/**
* Mousedown
*
@@ -253,7 +253,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Mouse Out
*
@@ -270,7 +270,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Mouse Over
*
@@ -321,7 +321,7 @@ class CI_Jquery extends CI_Javascript {
{
$array_js = array($array_js);
}
-
+
foreach ($array_js as $js)
{
$this->jquery_code_for_compile[] = "\t$js\n";
@@ -361,7 +361,7 @@ class CI_Jquery extends CI_Javascript {
{
return $this->_add_event($element, $js, 'scroll');
}
-
+
// --------------------------------------------------------------------
/**
@@ -379,10 +379,10 @@ class CI_Jquery extends CI_Javascript {
return $this->_add_event($element, $js, 'unload');
}
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
// Effects
- // --------------------------------------------------------------------
-
+ // --------------------------------------------------------------------
+
/**
* Add Class
*
@@ -395,7 +395,7 @@ class CI_Jquery extends CI_Javascript {
function _addClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- $str = "$({$element}).addClass(\"$class\");";
+ $str = "$({$element}).addClass(\"$class\");";
return $str;
}
@@ -416,9 +416,9 @@ class CI_Jquery extends CI_Javascript {
{
$element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
$animations = "\t\t\t";
-
+
foreach ($params as $param=>$value)
{
$animations .= $param.': \''.$value.'\', ';
@@ -430,19 +430,19 @@ class CI_Jquery extends CI_Javascript {
{
$speed = ', '.$speed;
}
-
+
if ($extra != '')
{
$extra = ', '.$extra;
}
-
- $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
-
+
+ $str = "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
+
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Fade In
*
@@ -456,21 +456,21 @@ class CI_Jquery extends CI_Javascript {
*/
function _fadeIn($element = 'this', $speed = '', $callback = '')
{
- $element = $this->_prep_element($element);
+ $element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).fadeIn({$speed}{$callback});";
-
+
+ $str = "$({$element}).fadeIn({$speed}{$callback});";
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Fade Out
*
@@ -486,14 +486,14 @@ class CI_Jquery extends CI_Javascript {
{
$element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).fadeOut({$speed}{$callback});";
-
+
+ $str = "$({$element}).fadeOut({$speed}{$callback});";
+
return $str;
}
@@ -512,19 +512,19 @@ class CI_Jquery extends CI_Javascript {
*/
function _hide($element = 'this', $speed = '', $callback = '')
{
- $element = $this->_prep_element($element);
+ $element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).hide({$speed}{$callback});";
+
+ $str = "$({$element}).hide({$speed}{$callback});";
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -539,12 +539,12 @@ class CI_Jquery extends CI_Javascript {
function _removeClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- $str = "$({$element}).removeClass(\"$class\");";
+ $str = "$({$element}).removeClass(\"$class\");";
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Slide Up
*
@@ -558,21 +558,21 @@ class CI_Jquery extends CI_Javascript {
*/
function _slideUp($element = 'this', $speed = '', $callback = '')
{
- $element = $this->_prep_element($element);
+ $element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).slideUp({$speed}{$callback});";
-
+
+ $str = "$({$element}).slideUp({$speed}{$callback});";
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Slide Down
*
@@ -588,19 +588,19 @@ class CI_Jquery extends CI_Javascript {
{
$element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).slideDown({$speed}{$callback});";
-
+
+ $str = "$({$element}).slideDown({$speed}{$callback});";
+
return $str;
}
// --------------------------------------------------------------------
-
+
/**
* Slide Toggle
*
@@ -616,19 +616,19 @@ class CI_Jquery extends CI_Javascript {
{
$element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).slideToggle({$speed}{$callback});";
-
+
+ $str = "$({$element}).slideToggle({$speed}{$callback});";
+
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Toggle
*
@@ -641,12 +641,12 @@ class CI_Jquery extends CI_Javascript {
function _toggle($element = 'this')
{
$element = $this->_prep_element($element);
- $str = "$({$element}).toggle();";
+ $str = "$({$element}).toggle();";
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Toggle Class
*
@@ -659,12 +659,12 @@ class CI_Jquery extends CI_Javascript {
function _toggleClass($element = 'this', $class='')
{
$element = $this->_prep_element($element);
- $str = "$({$element}).toggleClass(\"$class\");";
+ $str = "$({$element}).toggleClass(\"$class\");";
return $str;
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Show
*
@@ -678,16 +678,16 @@ class CI_Jquery extends CI_Javascript {
*/
function _show($element = 'this', $speed = '', $callback = '')
{
- $element = $this->_prep_element($element);
+ $element = $this->_prep_element($element);
$speed = $this->_validate_speed($speed);
-
+
if ($callback != '')
{
$callback = ", function(){\n{$callback}\n}";
}
-
- $str = "$({$element}).show({$speed}{$callback});";
-
+
+ $str = "$({$element}).show({$speed}{$callback});";
+
return $str;
}
@@ -696,7 +696,7 @@ class CI_Jquery extends CI_Javascript {
/**
* Updater
*
- * An Ajax call that populates the designated DOM node with
+ * An Ajax call that populates the designated DOM node with
* returned content
*
* @access private
@@ -705,13 +705,13 @@ class CI_Jquery extends CI_Javascript {
* @param string optional parameters
* @return string
*/
-
+
function _updater($container = 'this', $controller, $options = '')
- {
+ {
$container = $this->_prep_element($container);
-
+
$controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller);
-
+
// ajaxStart and ajaxStop are better choices here... but this is a stop gap
if ($this->CI->config->item('javascript_ajax_img') == '')
{
@@ -721,7 +721,7 @@ class CI_Jquery extends CI_Javascript {
{
$loading_notifier = '<img src=\'' . $this->CI->config->slash_item('base_url') . $this->CI->config->item('javascript_ajax_img') . '\' alt=\'Loading\' />';
}
-
+
$updater = "$($container).empty();\n"; // anything that was in... get it out
$updater .= "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image
@@ -741,7 +741,7 @@ class CI_Jquery extends CI_Javascript {
// --------------------------------------------------------------------
// Pre-written handy stuff
// --------------------------------------------------------------------
-
+
/**
* Zebra tables
*
@@ -753,8 +753,8 @@ class CI_Jquery extends CI_Javascript {
function _zebraTables($class = '', $odd = 'odd', $hover = '')
{
$class = ($class != '') ? '.'.$class : '';
-
- $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");";
+
+ $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");";
$this->jquery_code_for_compile[] = $zebra;
@@ -771,7 +771,7 @@ class CI_Jquery extends CI_Javascript {
// --------------------------------------------------------------------
// Plugins
// --------------------------------------------------------------------
-
+
/**
* Corner Plugin
*
@@ -793,7 +793,7 @@ class CI_Jquery extends CI_Javascript {
return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");";
}
-
+
// --------------------------------------------------------------------
/**
@@ -805,7 +805,7 @@ class CI_Jquery extends CI_Javascript {
* @return void
*/
function modal($src, $relative = FALSE)
- {
+ {
$this->jquery_code_for_load[] = $this->external($src, $relative);
}
@@ -897,7 +897,7 @@ class CI_Jquery extends CI_Javascript {
{
$this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n";
}
-
+
// --------------------------------------------------------------------
// Class functions
// --------------------------------------------------------------------
@@ -912,7 +912,7 @@ class CI_Jquery extends CI_Javascript {
* @param string The code to execute
* @param string The event to pass
* @return string
- */
+ */
function _add_event($element, $js, $event)
{
if (is_array($js))
@@ -953,15 +953,15 @@ class CI_Jquery extends CI_Javascript {
$script = '$(document).ready(function() {' . "\n";
$script .= implode('', $this->jquery_code_for_compile);
$script .= '});';
-
+
$output = ($script_tags === FALSE) ? $script : $this->inline($script);
$this->CI->load->vars(array($view_var => $output));
}
-
+
// --------------------------------------------------------------------
-
+
/**
* Clear Compile
*
@@ -976,7 +976,7 @@ class CI_Jquery extends CI_Javascript {
}
// --------------------------------------------------------------------
-
+
/**
* Document Ready
*
@@ -992,7 +992,7 @@ class CI_Jquery extends CI_Javascript {
$js = array ($js);
}
-
+
foreach ($js as $script)
{
$this->jquery_code_for_compile[] = $script;
@@ -1016,7 +1016,7 @@ class CI_Jquery extends CI_Javascript {
$this->jquery_code_for_load[] = $library_src;
return $library_src;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1036,10 +1036,10 @@ class CI_Jquery extends CI_Javascript {
{
$element = '"'.$element.'"';
}
-
+
return $element;
}
-
+
// --------------------------------------------------------------------
/**
@@ -1050,7 +1050,7 @@ class CI_Jquery extends CI_Javascript {
* @access private
* @param string
* @return string
- */
+ */
function _validate_speed($speed)
{
if (in_array($speed, array('slow', 'normal', 'fast')))
@@ -1061,7 +1061,7 @@ class CI_Jquery extends CI_Javascript {
{
$speed = '';
}
-
+
return $speed;
}