X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fcommon.functions.js;h=481e94785af310a892d3c54636340821ecaaa40d;hb=f669207a7698921afdaef60a4d25dd8840a46cc5;hp=d6f3f9953281610bbea62b82045dee91b6e14b58;hpb=5d1ad393e97322f88eeee28fe237d85a008cb3b3;p=myslice.git diff --git a/portal/static/js/common.functions.js b/portal/static/js/common.functions.js index d6f3f995..481e9478 100644 --- a/portal/static/js/common.functions.js +++ b/portal/static/js/common.functions.js @@ -15,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