dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14646
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5046: simplified :containsNC filter
------------------------------------------------------------
revno: 5046
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-26 14:44:55 +0200
message:
simplified :containsNC filter
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js 2011-08-23 10:07:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js 2011-10-26 12:44:55 +0000
@@ -99,8 +99,8 @@
* sorted fashion. Both the select and array is assumed to be sorted to start
* with.
*
- * @param $select {jQuery}�A select which acts as the target
- * @param $array {jQuery}�An array of child elements to move
+ * @param $select {jQuery} A select which acts as the target
+ * @param $array {jQuery} An array of child elements to move
*/
dhis2.select.moveSorted = function( $select, $array )
{
@@ -158,7 +158,7 @@
/**
* Mark all options in a select as selected.
*
- * @param $select {jQuery}�The select
+ * @param $select {jQuery} The select
*/
dhis2.select.selectAll = function( $select )
{
@@ -168,7 +168,7 @@
/**
* Mark all options as not selected.
*
- * @param $select {jQuery}�The select
+ * @param $select {jQuery} The select
*/
dhis2.select.selectNone = function( $select )
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2011-09-14 08:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2011-10-26 12:44:55 +0000
@@ -31,7 +31,7 @@
/**
* Creates namespace object based on path
*
- * @param path {String}�The path of the namespace, i.e. 'a.b.c'
+ * @param path {String}�The path of the namespace, i.e. 'a.b.c'
*
* @returns {object} Namespace object
*/
@@ -55,19 +55,10 @@
* adds ':containsNC' to filtering.
* $(sel).find(':containsNC(key)').doSomething();
*/
-$.expr[":"].containsNC = function( el, i, m )
+$.expr[":"].containsNC = function( a, i, m, r )
{
- // http://www.west-wind.com/weblog/posts/2008/Oct/24/Using-jQuery-to-search-Content-and-creating-custom-Selector-Filters
- var search = m[3];
-
- if ( !search )
- {
- return false;
- }
-
- search = dhis2.util.escape( search );
-
- return eval( '/' + search + '/i' ).test( $( el ).text() );
+ var search = dhis2.util.escape( m[3] );
+ return jQuery(a).text().toUpperCase().indexOf(m[search].toUpperCase())>=0;
};
/**