Subversion Repositories SmartDukaan

Rev

Rev 34074 | Rev 34098 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34074 Rev 34075
Line 205... Line 205...
205
    </div>
205
    </div>
206
</section>
206
</section>
207
 
207
 
208
<script>
208
<script>
209
    function formatNumberIndian(num) {
209
    function formatNumberIndian(num) {
-
 
210
        x = num.toString();
-
 
211
        var lastThree = x.substring(x.length - 3);
-
 
212
        var otherNumbers = x.substring(0, x.length - 3);
-
 
213
        if (otherNumbers != '')
-
 
214
            lastThree = ',' + lastThree;
210
        return num.toString().replace(/\B(?=(\d{2})+(?!\d))/g, ",").replace(/,(\d{3})$/, "$1");
215
        var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
-
 
216
        return res;
211
    }
217
    }
212
 
218
 
213
    document.addEventListener("DOMContentLoaded", function () {
219
    document.addEventListener("DOMContentLoaded", function () {
214
        document.querySelectorAll(".format-indian").forEach(function (el) {
220
        document.querySelectorAll(".format-indian").forEach(function (el) {
215
            el.textContent = formatNumberIndian(el.textContent.trim());
221
            el.textContent = formatNumberIndian(el.textContent.trim());