1 // http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855
2 String.prototype.format = function() { return formatstr(this, arguments) }
3 function formatstr(str, col) {
4 col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1);
6 return str.replace(/%%|%s|%(\d+)\$s/g, function (m, n) {
7 if (m == "%%") { return "%"; }
8 if (m == "%s") { return col[idx++]; }
13 function confirmDelete(message) {
14 return (confirm(message) ? true : false);
17 function Dopop(link) {
18 newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes');
21 jQuery.fn.preventDoubleFormSubmit = function() {
22 jQuery(this).submit(function() {
23 if (this.beenSubmitted)
26 this.beenSubmitted = true;
30 function prefixOf (s, tok) {
31 var index = s.indexOf(tok);
32 return s.substring(0, index);
34 function suffixOf (s, tok) {
35 var index = s.indexOf(tok);
36 return s.substring(index + 1);