PageSourceSearch

https://www.sincharoen.com/modules/flexi/js/velaeasy/ungrouped/webboard.js

js sincharoen.com collected 2026-09-26 00:35:01 UTC 12,411 bytes, 327 lines download raw bytes

1var veWebboard = {};
2
3veWebboard.webboardId = 0;
4veWebboard.topicId = 0;
5
6veWebboard.init
7        = function(options) {
8    this.webboardId = veMain.webboardId;
9    this.topicId    = veMain.webboardTopicId;
10
11    veWebboard.bindCreateWebboardButton();
12    veWebboard.bindCreateTopicButton();
13    veWebboard.bindDeleteTopicById();
14};
15
16veWebboard.bindCreateWebboardButton
17        = function() {
18    $('#frm-webboard #new_webboard').unbind('click').click(function() {
19        $.ajax({
20            type: 'POST',
21            cache: false,
22            url: '/modules/flexi/controllers/webboard-create-controller.php',
23            success: function(data, textStatus) {
24                $.colorbox({href:data});
25                $.colorbox.resize();
26                veWebboard.initCreateWebboardForm();
27            }
28        });
29    });
30};
31
32veWebboard.bindCreateTopicButton
33        = function() {
34    var webboard = $('#topic_webboard_id').val();
35    var captcha_cache = $('.captcha_cache').val();
36    var colorbox_width = '485px';
37    if (document.documentElement.clientWidth < veMain.smallSizeScreenWidth) {
38    	var colorbox_width = '100%';
39    }
40
41    $('#create-topic #new_topic').colorbox({
42        href: '/modules/flexi/views/webboard-topic-create.php?webboard_id=' + webboard,
43        width: colorbox_width,
44        maxWidth: '485px',
45        trapFocus: false,
46        onComplete: function() {
47            veWebboard.initCreateTopicForm();
48            if (veMain.reCaptchaEnable == '1' && captcha_cache == 1 && veMain.member_login == "") {
49                veReCaptcha.initSpecificElement($('#frm-topic-create .reCaptcha-container').attr('id'));
50            }
51            $.colorbox.resize();
52        }
53    });
54};
55
56veWebboard.initCreateTopicForm
57        = function() {
58    if (veMain.reCaptchaEnable != '1') {
59        veCaptcha.init();
60    }
61
62    $("#create_topic")
63            .unbind('click')
64            .click(function(event) {
65        $('#frm-topic-create #title_topic').text('');
66        $('#frm-topic-create #detail_topic').text('');
67        $('#frm-topic-create #user_topic').text('');
68        $('.captcha .error').text('');
69
70        var topic_title = $.trim($('#frm-topic-create input[name=topic_title]').val());
71        var topic_detail = $.trim($('#frm-topic-create textarea[name=topic_detail]').val());
72        var topic_by = $.trim($('#frm-topic-create input[name=topic_by]').val());
73        var webboard_id = $('#create-topic input[name=topic_webboard_id]').val();
74        var webboard_title = $('#frm-topic-create input[name=path_title]').val();
75        var captcha = $.trim($('#frm-topic-create input[name=submitted_captcha]').val());
76        var err = 0;
77        var is_member_login = $('#frm-topic-create input[name=is_member_login]').val();
78        var captcha_cache = $('#frm-topic-create input.captcha_cache').val();
79
80        if (topic_title == "") {
81            $('#frm-topic-create #title_topic').text(_T('__webboard__กรุณาตั้งชื่อกระทู้'));
82            if (err != 1) {
83                $('#frm-topic-create input[name=topic_title]').focus();
84            }
85            err = 1;
86        }
87        if (topic_detail == "") {
88            $('#frm-topic-create #detail_topic').text(_T('__webboard__ข้อความอธิบายกระทู้ต้องไม่เป็นค่าว่าง'));
89            if (err != 1) {
90                $('#frm-topic-create textarea[name=topic_detail]').focus();
91            }
92            err = 1;
93        }
94        if (topic_by == "") {
95            $('#frm-topic-create #user_topic').text(_T('__webboard__กรุณาระบุชื่อผู้ตั้งกระทู้'));
96            if (err != 1) {
97                $('#frm-topic-create input[name=topic_by]').focus();
98            }
99            err = 1;
100        }
101
102        if (veMain.reCaptchaEnable != '1' && captcha_cache == 1 && veMain.member_login == false) {
103            if (captcha == '' && veMain.mode != 'edit') {
104                $('#frm-topic-create .error').text(_T('__webboard__กรอกตัวอักษรในภาพ'));
105
106                if (err != 1) {
107                    $('#frm-topic-create input[name=submitted_captcha]').focus();
108                }
109
110                err = 1;
111            }
112        }
113
114        if (err != 1) {
115            veWebboard.createTopicFormSubmit();
116        } else {
117            return false;
118        }
119
120        return false;
121    });
122};
123
124veWebboard.createTopicFormSubmit
125        = function() {
126    var topic_title = $('#frm-topic-create input[name=topic_title]').val();
127    var topic_detail = $('#frm-topic-create textarea[name=topic_detail]').val();
128    var topic_by = $('#frm-topic-create input[name=topic_by]').val();
129    var webboard_id = $('#create-topic input[name=topic_webboard_id]').val();
130    var webboard_title = $('#frm-topic-create input[name=path_title]').val();
131    var captcha_cache = $('#frm-topic-create input.captcha_cache').val();
132
133    if (veMain.mode != 'edit' && captcha_cache == 1 && veMain.member_login == false) {
134        if (veMain.reCaptchaEnable == '1') {
135            var submitted_captcha   = grecaptcha.getResponse(eval(
136                                        'veReCaptcha.' + $('#frm-topic-create .reCaptcha-container').attr('id')));
137        } else {
138            var submitted_captcha = $('#frm-topic-create input[name=submitted_captcha]').val();
139        }
140    } else {
141        var submitted_captcha = '';
142    }
143
144    var member_id = $('#frm-topic-create input[name=member_id]').val();
145
146    $.ajax({
147        url: '/modules/flexi/controllers/webboard-process-controller.php',
148        type: 'POST',
149        data: {
150            'task': 'new-topic',
151            'topic_title': topic_title,
152            'topic_detail': topic_detail,
153            'topic_by': topic_by,
154            'webboard_id': webboard_id,
155            'webboard_title': webboard_title,
156            'parent_type': 'webboard',
157            'member_id': member_id,
158            'g_recaptcha_response': submitted_captcha,
159            'submitted_captcha': submitted_captcha
160        },
161        async: true,
162        success: function(data, textStatus) {
163            data = eval('(' + data + ')');
164            if (data.status == "1") {
165                alert(_T('__webboard__สร้างกระทู้สำเร็จ'));
166                $.colorbox.close();
167                if (veMain.fb_page_tab != 1) {
168                    document.location.href = '/webboard/' + webboard_id + '/' + webboard_title + '/';
169                } else {
170                    document.location.href = '/webboard/' + webboard_id + '/' + webboard_title + '?fb_page_tab=1';
171                }
172
173            } else {
174                $('#comment-box').text("Error!");
175
176                if (veMain.reCaptchaEnable == '1') {
177                    var $captchaErrorElement = $('#frm-topic-create .webboard-topic-captcha-error');
178                } else {
179                    var $captchaErrorElement = $('#frm-topic-create .error');
180                    veCaptcha.reloadImage();
181                }
182
183                $captchaErrorElement.text(_T('__webboard__รหัสป้องกันสแปมไม่ถูกต้อง กรุณาลองใหม่อีกครั้ง'));
184            }
185        }
186    });
187};
188
189veWebboard.initCreateWebboardForm
190        = function() {
191    var submitHandler = function(event) {
192        var nav_title = $.trim($('#frm-webboard input[name=webboard_title]').val());
193        var title = $.trim($('#frm-webboard input[name=webboard_name]').val());
194        var description = $.trim($('#frm-webboard textarea[name=webboard_desc]').val());
195        var position = $('#frm-webboard input[name=position]').val();
196        var parent_id = $('#frm-webboard input[name=parent_id]').val();
197        var err = 0;
198        var member_only = '';
199
200        if ($('#frm-webboard input[name=member_only]').is(':checked')) {
201            member_only = 1;
202        }
203
204        if (nav_title == "") {
205            $('#msg_nav_title').text(_T('__webboard__กรุณาระบุชื่อเมนู'));
206            if (err != 1) {
207                $('input[name=webboard_title]').focus();
208            }
209            err = 1;
210        } else {
211            $('#msg_nav_title').text('');
212        }
213        if (title == "") {
214            $('#msg_title').text(_T('__webboard__กรุณาระบุชื่อเว็บบอร์ด'));
215            if (err != 1) {
216                $('input[name=webboard_name]').focus();
217            }
218            err = 1;
219        } else {
220            $('#msg_title').text('');
221        }
222        if (description == "") {
223            $('#msg_desc').text(_T('__webboard__ข้อความอธิบายเว็บบอร์ดต้องไม่เป็นค่าว่าง'));
224            if (err != 1) {
225                $('textarea[name=webboard_desc]').focus();
226            }
227            err = 1;
228        } else {
229            $('#msg_desc').text('');
230        }
231
232        if (err == 0) {
233            if(veNav.validateSymbol(nav_title)&&veNav.validateSymbol(title)){
234                $.ajax({
235                    type: 'POST',
236                    cache: false,
237                    url: '/modules/flexi/controllers/webboard-process-controller.php',
238                    data: {
239                        'task': 'new-webboard',
240                        'nav_title': nav_title,
241                        'title': title,
242                        'description': description,
243                        'position': position,
244                        'parent_id': parent_id,
245                        'member_only': member_only
246                    },
247                    async: true,
248                    success: function(data, textStatus) {
249                        data = eval('(' + data + ')');
250                        if (data.status == "1") {
251                            document.location.href = data.href;
252                        }
253                    }
254                });
255            }
256        } else {
257            return false
258        }
259
260        return false;
261    };
262
263    $('#frm-webboard')
264            .unbind('submit', submitHandler)
265            .bind('submit', submitHandler);
266    $('#frm-webboard #new_webboard')
267            .unbind('click', submitHandler)
268            .bind('click', submitHandler);
269
270    //webboard title input synchronize
271    var el_webboard_title_input = $('#frm-webboard input[name=webboard_title]');
272    var el_webboard_name_input = $('#frm-webboard input[name=webboard_name]');
273    var el_webboard_title_sync = $('#frm-webboard input[name=webboard_title_sync]');
274
275    veNav.contentTitleSync(el_webboard_title_input, el_webboard_name_input, el_webboard_title_sync);
276};
277
278veWebboard.bindDeleteTopicById
279        = function() {
280    $('.webboard .delete_topic > a')
281            .unbind('click')
282            .click(function(event) {
283        var confirm_delete = confirm(_T('__webboard__ต้องการลบกระทู้นี้ ?'));
284        if (confirm_delete == true) {
285            var id = $(this).attr('data-id');
286            $.ajax({
287                type: 'POST',
288                cache: false,
289                url: '/modules/flexi/controllers/webboard-process-controller.php',
290                data: {
291                    'task': 'delete-topic',
292                    'topic_delete_id': id
293                },
294                async: true,
295                success: function(data, textStatus) {
296                    data = eval('(' + data + ')');
297                    if (data.status == "1") {
298                        alert(_T('__webboard__ลบกระทู้สำเร็จ'));
299                        document.location.href = document.location.href;
300                    } else {
301                        alert(_T('__webboard__ลบกระทู้ไม่สำเร็จ'));
302                    }
303                }
304            });
305        }
306    });
307};
308
309veWebboard.update
310        = function(field, val, webboard_id) {
311
312    $.ajax({
313        url: '/modules/flexi/controllers/webboard-process-controller.php',
314        type: 'POST',
315        data: {
316            'task': 'update',
317            'field': field,
318            'value': val,
319            'webboard_id': webboard_id
320        },
321        dataType: 'html',
322        async: false,
323        success: function(data) {
324            veEditMode.showSavedSplash();
325        }
326    });
327};

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.