294 var result = []; |
294 var result = []; |
295 for (var i = start; i < stop; i += step) { |
295 for (var i = start; i < stop; i += step) { |
296 result.push(lst[i]); |
296 result.push(lst[i]); |
297 } |
297 } |
298 return result; |
298 return result; |
|
299 }, |
|
300 |
|
301 /** |
|
302 * .. function:: domid(string) |
|
303 * |
|
304 * return a valid DOM id from a string (should also be usable in jQuery |
|
305 * search expression...). This is the javascript implementation of |
|
306 * :func:`cubicweb.uilib.domid`. |
|
307 */ |
|
308 domid: function (string) { |
|
309 var newstring = string.replace(".", "_").replace("-", "_"); |
|
310 while (newstring != string) { |
|
311 string = newstring; |
|
312 newstring = newstring.replace(".", "_").replace("-", "_"); |
|
313 } |
|
314 return newstring; // XXX |
|
315 }, |
|
316 |
|
317 /** |
|
318 * .. function:: strFuncCall(fname, *args) |
|
319 * |
|
320 * return a string suitable to call the `fname` javascript function with the |
|
321 * given arguments (which should be correctly typed).. This is providing |
|
322 * javascript implementation equivalent to :func:`cubicweb.uilib.js`. |
|
323 */ |
|
324 strFuncCall: function(fname /* ...*/) { |
|
325 return (fname + '(' + |
|
326 $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON).join(',') |
|
327 + ')' |
|
328 ); |
299 } |
329 } |
300 |
|
301 |
330 |
302 }); |
331 }); |
303 |
332 |
304 String.prototype.startsWith = cw.utils.deprecatedFunction('[3.9] str.startsWith() is deprecated, use str.startswith() instead', function (prefix) { |
333 String.prototype.startsWith = cw.utils.deprecatedFunction('[3.9] str.startsWith() is deprecated, use str.startswith() instead', function (prefix) { |
305 return this.startswith(prefix); |
334 return this.startswith(prefix); |