PageSourceSearch

https://www.ramafoundation.or.th/assets/js/home.js?v=1790315934

js ramafoundation.or.th collected 2026-09-25 05:59:23 UTC 4,247 bytes, 97 lines download raw bytes

1$(document).ready(function () {
2    var max_donate_project = 3;
3
4    $(".allownumericwithdecimal").on("keypress keyup blur", function (e) {
5        $(this).val($(this).val().replace(/(?!^[\-\d\.])[^\d\.]/g, "")), 46 == e.which && -1 == $(this).val().indexOf(".") || !(e.which < 48 || 57 < e.which) || e.preventDefault()
6    }), $(".allownumericwithdecimal").each(function () {
7        $(this).keyup(function () {
8            var e;
9            var invalid_len = false;
10            e = 0, $(".allownumericwithdecimal").each(function () {
11                var val=$(this).val();
12
13                // strip out extra dots. Here I admit regex defeat and resort to slice-and-dice:
14                var firstDot = val.indexOf('.');
15                if (firstDot > -1) {
16                    val = val.substr(0,firstDot+1) + val.substring(firstDot+1,firstDot+3).replace(/\./g,'')
17                }
18                if(val.substr(0,1)==0&&val!=0){
19                    val=parseFloat(val)
20                    val.toFixed(2)
21                }
22
23                if(((val+"").split("0").length - 1)==(val+"").length){
24                    val = 0;
25                }
26                // Finally the easy part: set the precision
27                $(this).val(val);
28
29                if($(this).val()>999999999){
30                    invalid_len = true;
31                    $(this).val(999999999);
32                }
33            })
34
35            if($(this).val()==''){
36                $(this).val(0) ;
37            }
38
39            if(invalid_len){
40                swal("จำกัดยอดบริจาคสูงสุด 999,999,999 บาทค่ะ", "", "warning");
41            }
42        })
43        $(this).change(function () {
44            if($(this).val()<100&&$(this).val()!=0&&$(this).val()!=''){
45                swal("บริจาคขั้นต่ำ 100 บาทค่ะ", "", "warning");
46                $(this).val(100);
47                var e;
48                var invalid_len = false;
49                e = 0, $(".allownumericwithdecimal").each(function () {
50                    var val=$(this).val();
51                    // strip out extra dots. Here I admit regex defeat and resort to slice-and-dice:
52                    var firstDot = val.indexOf('.');
53                    if (firstDot > -1) {
54                        val = val.substr(0,firstDot+1) + val.substring(firstDot+1,firstDot+3).replace(/\./g,'')
55                    }
56                    if(val.substr(0,1)==0&&val!=0){
57                        val=parseFloat(val)
58                        val.toFixed(2)
59                    }
60
61                    if(((val+"").split("0").length - 1)==(val+"").length){
62                        val = 0;
63                    }
64                    // Finally the easy part: set the precision
65                    $(this).val(val);
66
67                    if($(this).val()>999999999){
68                        invalid_len = true;
69                        $(this).val(999999999);
70                    }
71                })
72
73                if(invalid_len){
74                    swal("จำกัดยอดบริจาคสูงสุด 999,999,999 บาทค่ะ", "", "warning");
75                }
76            }
77
78            var countDonateOrder = 0;
79            $(".myDonatfel .donat-amount").each(function () {
80                if ($(this).val() > 0) {
81                    countDonateOrder ++;
82                }
83            });
84            if (countDonateOrder>max_donate_project) {
85                swal("คุณสามารถบริจาคได้สูงสุด "+max_donate_project+" โครงการ ต่อหนึ่งใบเสร็จ", "กรุณาแก้ไขแล้วลองใหม่อีกครั้ง", "warning");
86                $(this).val(0);
87                return false;
88            }
89        });
90    }), $(function () {
91        $("a[href*=#]:not([href=#])").click(function () {
92            var e = $(this.hash);
93            if ((e = e.length ? e : $("[name=" + this.hash.substr(1) + "]")).length)return $("html,body").animate({scrollTop: e.offset().top + -140 }, 1e3), !1
94        })
95    })
96
97});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.