summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries/javascript.rst
diff options
context:
space:
mode:
authorBrennan Thompson <brenjt@gmail.com>2014-02-14 20:03:57 +0100
committerBrennan Thompson <brenjt@gmail.com>2014-02-14 20:03:57 +0100
commit6949f95f6e21980f36095490bf38fc8a172dbc0f (patch)
treeb3141f390acd0051396cda6a3da51c1f98384cca /user_guide_src/source/libraries/javascript.rst
parent68a02a01a086bbb1b8128ea2744439de84873d11 (diff)
parent81f036753272391360ba5b64e6dd93c4101a8733 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts: system/helpers/form_helper.php
Diffstat (limited to 'user_guide_src/source/libraries/javascript.rst')
-rw-r--r--user_guide_src/source/libraries/javascript.rst77
1 files changed, 49 insertions, 28 deletions
diff --git a/user_guide_src/source/libraries/javascript.rst b/user_guide_src/source/libraries/javascript.rst
index 393d4e321..9d0237e57 100644
--- a/user_guide_src/source/libraries/javascript.rst
+++ b/user_guide_src/source/libraries/javascript.rst
@@ -1,31 +1,52 @@
-.. note:: This driver is experimental. Its feature set and
- implementation may change in future releases.
-
################
Javascript Class
################
+.. note:: This library is DEPRECATED and should not be used. It has always
+ been with an 'experimental' status and is now no longer supported.
+ Currently only kept for backwards compatibility.
+
CodeIgniter provides a library to help you with certain common functions
that you may want to use with Javascript. Please note that CodeIgniter
does not require the jQuery library to run, and that any scripting
library will work equally well. The jQuery library is simply presented
as a convenience if you choose to use it.
+.. contents::
+ :local:
+
+.. raw:: html
+
+ <div class="custom-index container"></div>
+
+**************************
+Using the Javascript Class
+**************************
+
Initializing the Class
======================
To initialize the Javascript class manually in your controller
-constructor, use the $this->load->library function. Currently, the only
-available library is jQuery, which will automatically be loaded like
-this::
+constructor, use the ``$this->load->library()`` method. Currently,
+the only available library is jQuery, which will automatically be
+loaded like this::
$this->load->library('javascript');
-The Javascript class also accepts parameters, js_library_driver
-(string) default 'jquery' and autoload (bool) default TRUE. You may
-override the defaults if you wish by sending an associative array::
+The Javascript class also accepts parameters:
+
+- js_library_driver (string) *default: 'jquery'*
+- autoload (bool) *default: TRUE*
- $this->load->library('javascript', array('js_library_driver' => 'scripto', 'autoload' => FALSE));
+You may override the defaults by sending an associative array::
+
+ $this->load->library(
+ 'javascript',
+ array(
+ 'js_library_driver' => 'scripto',
+ 'autoload' => FALSE
+ )
+ );
Again, presently only 'jquery' is available. You may wish to set
autoload to FALSE, though, if you do not want the jQuery library to
@@ -34,7 +55,8 @@ is useful if you are loading it from a location outside of CodeIgniter,
or already have the script tag in your markup.
Once loaded, the jQuery library object will be available using:
-$this->javascript
+
+ $this->javascript
Setup and Configuration
=======================
@@ -47,8 +69,8 @@ application.
As Javascript is a client side language, the library must be able to
write content into your final output. This generally means a view.
-You'll need to include the following variables in the <head> sections of
-your output.
+You'll need to include the following variables in the ``<head>``
+sections of your output.
::
@@ -56,17 +78,17 @@ your output.
<?php echo $script_head;?>
-$library_src, is where the actual library file will be loaded, as well
-as any subsequent plugin script calls; $script_head is where specific
-events, functions and other commands will be rendered.
+``$library_src``, is where the actual library file will be loaded, as
+well as any subsequent plugin script calls; $script_head is where
+specific events, functions and other commands will be rendered.
Set the path to the librarys with config items
----------------------------------------------
There are some configuration items in Javascript library. These can
-either be set in application/config.php, within its own
-config/javascript.php file, or within any controller usings the
-set_item() function.
+either be set in *application/config.php*, within its own
+*config/javascript.php* file, or within any controller usings the
+``set_item()`` function.
An image to be used as an "ajax loader", or progress indicator. Without
one, the simple text message of "loading" will appear when Ajax calls
@@ -84,7 +106,7 @@ The jQuery Class
================
To initialize the jQuery class manually in your controller constructor,
-use the $this->load->library function::
+use the ``$this->load->library()`` method::
$this->load->library('javascript/jquery');
@@ -96,30 +118,29 @@ library as follows::
$this->load->library('javascript/jquery', FALSE);
Once loaded, the jQuery library object will be available using:
-$this->jquery
+
+ $this->jquery
jQuery Events
=============
Events are set using the following syntax.
-
::
$this->jquery->event('element_path', code_to_run());
-
In the above example:
- "event" is any of blur, change, click, dblclick, error, focus, hover,
keydown, keyup, load, mousedown, mouseup, mouseover, mouseup, resize,
scroll, or unload.
-- "element_path" is any valid `jQuery
- selector <http://docs.jquery.com/Selectors>`_. Due to jQuery's unique
+- "element_path" is any valid `jQuery selector
+ <http://docs.jquery.com/Selectors>`_. Due to jQuery's unique
selector syntax, this is usually an element id, or CSS selector. For
- example "#notice_area" would effect <div id="notice_area">, and
+ example "#notice_area" would effect ``<div id="notice_area">``, and
"#content a.notice" would effect all anchors with a class of "notice"
in the div with id "content".
-- "code_to_run()" is script your write yourself, or an action such as
+- "``code_to_run()``" is script your write yourself, or an action such as
an effect from the jQuery library below.
Effects
@@ -298,4 +319,4 @@ description to come
calendar()
----------
-description to come
+description to come \ No newline at end of file