Committer: dpetrov
LJSUP-11099: LJ Shop. Change LJ Tokens mechanicsU trunk/htdocs/js/basic.js U trunk/htdocs/js/jquery/jquery.lj.s2editSearchBox.js
Modified: trunk/htdocs/js/basic.js =================================================================== --- trunk/htdocs/js/basic.js 2012-02-22 08:53:34 UTC (rev 21232) +++ trunk/htdocs/js/basic.js 2012-02-22 09:08:23 UTC (rev 21233) @@ -152,8 +152,27 @@ this._timer = null; } +LJ.commafy = function(num) { + num = "" + num; + if (/^\d+$/.test(num)) { + var delim = LiveJournal.getLocalizedStr('number.punctuation'); + if (delim === '[number.punctuation]') { delim = ','; } + var hasMatches = true; + while (hasMatches) { + hasMatches = false; + num = num.replace(/(\d)(\d{3})(?!\d)/g, function(str, first, group) { + hasMatches = true; + return first + delim + group; + }) + } + } + return num; +}; + + + /* object extensions */ if (!Object.extend) Object.extend = function (d, s){ Modified: trunk/htdocs/js/jquery/jquery.lj.s2editSearchBox.js =================================================================== --- trunk/htdocs/js/jquery/jquery.lj.s2editSearchBox.js 2012-02-22 08:53:34 UTC (rev 21232) +++ trunk/htdocs/js/jquery/jquery.lj.s2editSearchBox.js 2012-02-22 09:08:23 UTC (rev 21233) @@ -221,38 +221,6 @@ this._enabled = false; this.hide(); $.lj.basicWidget.prototype.disable.apply(this); - }, - - /** - * Find element inside the widget and return it. Note, that function caches the elements - * and assigns them ti the widget object with the name _{name} - * - * @param {string} name Name of the selector to search in this.options.selectors - */ - _el: function(name) { - var method = '_' + name; - - if (!this[method]) { this[method] = this.element.find(this.options.selectors[name]); }; - - return this[method]; - }, - - /** - * Fetch the class name from the options. - * - * @param {string} name Name of the class name to search in this.options.classNames. - */ - _cl: function(name) { - return this.options.classNames[name]; - }, - - /** - * Fetch the selector from the options. - * - * @param {string} name Name of the selector to search in this.options.selectors - */ - _s: function(name) { - return this.options.selectors[name]; } });