X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fcommon.functions.js;h=481e94785af310a892d3c54636340821ecaaa40d;hb=0c34b56ff3e9887a592363ce92753a6a8383aa45;hp=56b02ca95d00c8b9f36aafed6e630fa997b2001c;hpb=a2069daeaa50cf7328f838d4c3f2ca2da0727bbc;p=myslice.git diff --git a/portal/static/js/common.functions.js b/portal/static/js/common.functions.js index 56b02ca9..481e9478 100644 --- a/portal/static/js/common.functions.js +++ b/portal/static/js/common.functions.js @@ -1,6 +1,3 @@ -/* - * This file is included in tophat_render.php - */ // Escape special characters in jQuery Selector function escape_id( myid ) { return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" ); @@ -18,6 +15,20 @@ function getKeySplitId(id,separator){ return key; } +// 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