dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14647
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5047: added filter for regex in dhis2.util
------------------------------------------------------------
revno: 5047
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-26 14:55:00 +0200
message:
added filter for regex in dhis2.util
modified:
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.util.js'
--- 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
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2011-10-26 12:55:00 +0000
@@ -58,7 +58,27 @@
$.expr[":"].containsNC = function( a, i, m, r )
{
var search = dhis2.util.escape( m[3] );
- return jQuery(a).text().toUpperCase().indexOf(m[search].toUpperCase())>=0;
+ return jQuery( a ).text().toUpperCase().indexOf( m[search].toUpperCase() ) >= 0;
+};
+
+/**
+ * adds ':regex' to filtering, use to filter by regular expression
+ */
+$.expr[":"].regex = function( a, i, m, r )
+{
+ var re = new RegExp( m[3], 'i' );
+ return re.test( jQuery( a ).text() );
+};
+
+/**
+ * adds ':regex' to filtering, use to filter by regular expression
+ *
+ * (this is the case sensitive version)
+ */
+$.expr[":"].regexCS = function( a, i, m, r )
+{
+ var re = new RegExp( m[3] );
+ return re.test( jQuery( a ).text() );
};
/**