X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fcommon.functions.js;h=481e94785af310a892d3c54636340821ecaaa40d;hb=1ca2768a7aad52401201b6746e42d51194c00f15;hp=3fe31c44ed2ce939087c3db948935c2beb5262f8;hpb=2f4f816b579ec2fd97dff5a318fe638ed26ebf3c;p=myslice.git diff --git a/portal/static/js/common.functions.js b/portal/static/js/common.functions.js index 3fe31c44..481e9478 100644 --- a/portal/static/js/common.functions.js +++ b/portal/static/js/common.functions.js @@ -1,6 +1,7 @@ -/* - * This file is included in tophat_render.php - */ +// Escape special characters in jQuery Selector +function escape_id( myid ) { + return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" ); +} function getKeySplitId(id,separator){ // id of elements must respect this rule @@ -14,10 +15,19 @@ function getKeySplitId(id,separator){ return key; } -function errorDisplay(error){ - var out = '
Notice
  • ' + error + '
'; - return out; -} +// Adding startsWith & endsWith to the string prototype +if ( typeof String.prototype.startsWith != 'function' ) { + String.prototype.startsWith = function( str ) { + return this.substring( 0, str.length ) === str; + } +}; + +if ( typeof String.prototype.endsWith != 'function' ) { + String.prototype.endsWith = function( str ) { + return this.substring( this.length - str.length, this.length ) === str; + } +}; +// http://stackoverflow.com/questions/646628/javascript-startswith function arrays_equal(a,b) { return !(a