Ignore:
Timestamp:
Dec 24, 2013, 5:50:35 PM (10 years ago)
Author:
mistic100
Message:

add missing str_repeat functions in common.js and use it for batch_manager_global.tpl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r25005 r26179  
    33{include file='include/colorbox.inc.tpl'}
    44{include file='include/add_album.inc.tpl'}
     5
     6{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
    57{combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'}
    68{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
     
    4951        return true;
    5052      });
    51       $(this).click(function(event) {console.log(event.shiftKey);$(this).triggerHandler("shclick",event)});
     53      $(this).click(function(event) { $(this).triggerHandler("shclick",event)});
    5254    });
    5355  }
     
    119121var max_height_str = '{'Maximum height'|@translate}';
    120122{literal}
    121 function str_repeat(i, m) {
    122         for (var o = []; m > 0; o[--m] = i);
    123         return o.join('');
    124 }
    125 
    126 function sprintf() {
    127         var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = '';
    128         while (f) {
    129                 if (m = /^[^\x25]+/.exec(f)) {
    130                         o.push(m[0]);
    131                 }
    132                 else if (m = /^\x25{2}/.exec(f)) {
    133                         o.push('%');
    134                 }
    135                 else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
    136                         if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) {
    137                                 throw('Too few arguments.');
    138                         }
    139                         if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) {
    140                                 throw('Expecting number but found ' + typeof(a));
    141                         }
    142                         switch (m[7]) {
    143                                 case 'b': a = a.toString(2); break;
    144                                 case 'c': a = String.fromCharCode(a); break;
    145                                 case 'd': a = parseInt(a); break;
    146                                 case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
    147                                 case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
    148                                 case 'o': a = a.toString(8); break;
    149                                 case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
    150                                 case 'u': a = Math.abs(a); break;
    151                                 case 'x': a = a.toString(16); break;
    152                                 case 'X': a = a.toString(16).toUpperCase(); break;
    153                         }
    154                         a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a);
    155                         c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
    156                         x = m[5] - String(a).length - s.length;
    157                         p = m[5] ? str_repeat(c, x) : '';
    158                         o.push(s + (m[4] ? a + p : p + a));
    159                 }
    160                 else {
    161                         throw('Huh ?!');
    162                 }
    163                 f = f.substring(m[0].length);
    164         }
    165         return o.join('');
    166 }
    167123
    168124function progress(success) {
Note: See TracChangeset for help on using the changeset viewer.