1/** 2 * Created by quvsoftware on 2019-07-25. 3 */ 4/** 5 * Created by Gram.Sim on 2018-03-07. 6 */ 7/* WRITE FORM */ 8function initWriteForm(bid, callback) { 9 var arr_auth = auth.split(','); 10 if ($.inArray('1', arr_auth) >= 0 11 || $.inArray('2', arr_auth) >= 0 12 || $.inArray('30', arr_auth) >= 0) { 13 var html = '<div class="write-title-options-notice">'; 14 html += '<input id="write-title-options-notice" type="checkbox" value="0">'; 15 html += '<span>' + lang.notice +'</span>'; 16 html += '</div>'; 17 $('.write-title-options-secret').before(html); 18 } 19 20 qvjax_direct( 21 "select_board_info", 22 "/module/board/board.php", 23 'bid=' + bid, 24 function (data) { 25 if (data.length > 0) { 26 $.each(data, function() { 27 if (parseInt(this.use_category) == 1) { 28 $('.write-category').addClass('write-category-show'); 29 setCategory(function() {}); 30 } 31 else { 32 $('.write-category').removeClass('write-category-show'); 33 $('.write-category').remove(); 34 } 35 36 var subject = this.placeholder_subject.trim() == '' ? lang.subject : this.placeholder_subject; 37 $('#write-title-input').attr('placeholder', subject); 38 CKEDITOR.instances['write-content-textarea'].setData(this.placeholder_content); 39 40 callback(this); 41 }); 42 } 43 }, 44 function (xhr) { } 45 ); 46 47 $('.footer-fixed-contents').remove(); 48} 49 50function initUploadFileSettings() { 51 var upload_size_limit = QV_BASE_OBJ.is_free_version == "1" ? 10 : 30; 52 // íì¼ ì ë¡ë 53 var fileUploadSettings = { 54 url: "//" + QV_BASE_OBJ.dev + "g" + QV_BASE_OBJ.svid + "m.quv.kr" + "/aws/board_upload_file.php", 55 formData: {"sskey":QV_BASE_OBJ.sskey, "token":QV_BASE_OBJ.token, "stid":QV_BASE_OBJ.stid, "svid":QV_BASE_OBJ.svid, "bid": __BID, "aid": __AID}, 56 dragDrop: false, 57 dragDropStr: "", 58 multiple: true, 59 fileName: "file", 60 maxFileSize: 1024*1024*upload_size_limit, 61 acceptFiles: "*", 62 showStatusAfterSuccess: false, 63 showDone: false, 64 showDelete: false, 65 uploadButtonClass: "write-files", 66 onSelect: function(files) { 67 var fileStatusError=0; 68 $('#loading-mask').addClass('loading-mask-show'); 69 $.each(files, function() { 70 //console.log(this); 71 if(this.size > 1024*1024*upload_size_limit){ 72 fileStatusError=1; 73 return false; 74 } 75 }); 76 if(fileStatusError>0){ 77 alert(lang.upload_size_limit_file(upload_size_limit)); 78 $('#loading-mask').removeClass('loading-mask-show'); 79 return false; 80 } 81 }, 82 onSuccess: function(files,data,xhr) { 83 if (data == 'overflow') { 84 alert(lang.upload_overflow_file); 85 $('#loading-mask').removeClass('loading-mask-show'); 86 }else if(data == 'token_failed'){ 87 alert(lang.upload_expired); 88 $('#loading-mask').removeClass('loading-mask-show'); 89 } 90 else { 91 setAttachments(__BID, __AID, function() { 92 $('#loading-mask').removeClass('loading-mask-show'); 93 // alert('íì¼ ì ë¡ë ìë£'); 94 }); 95 } 96 }, 97 onError: function(files,status,errMsg,pd) { 98 $('#loading-mask').removeClass('loading-mask-show'); 99 alert(lang.upload_error(upload_size_limit)); 100 } 101 }; 102 var fileUploadObj = $(".write-files").uploadFile(fileUploadSettings); 103 104 // ì´ë¯¸ì§ ì ë¡ë 105 var imageUploadSettings = { 106 url: "//" + QV_BASE_OBJ.dev + "g" + QV_BASE_OBJ.svid + "m.quv.kr" + "/aws/board_upload_image.php", 107 //formData: {"stid":QV_BASE_OBJ.stid, "svid":QV_BASE_OBJ.svid, "token":token}, 108 formData: {"sskey":QV_BASE_OBJ.sskey, "token":QV_BASE_OBJ.token, "stid":QV_BASE_OBJ.stid, "svid":QV_BASE_OBJ.svid}, 109 dragDrop: false, 110 dragDropStr: "", 111 multiple: true, 112 fileName: "file", 113 maxFileSize: 1024*1024*10, 114 //allowedTypes:"jpg,png", 115 acceptFiles: "image/*", 116 showStatusAfterSuccess: false, 117 showDone: false, 118 showDelete: false, 119 uploadButtonClass: "write-images", 120 onSelect: function(files) { 121 var fileStatusError=0; 122 $('#loading-mask').addClass('loading-mask-show'); 123 $.each(files, function() { 124 //console.log(this); 125 if(this.size>10000000){ 126 fileStatusError=1; 127 return false; 128 } 129 }); 130 if(fileStatusError>0){ 131 alert(lang.upload_size_limit_image); 132 $('#loading-mask').removeClass('loading-mask-show'); 133 return false; 134 } 135 }, 136 onSuccess: function(files,data,xhr) { 137 if (data == 'overflow') { 138 alert(lang.upload_overflow_image); 139 $('#loading-mask').removeClass('loading-mask-show'); 140 }else if(data == 'token_failed'){ 141 alert(lang.upload_expired); 142 $('#loading-mask').removeClass('loading-mask-show'); 143 } 144 else { 145 var id = qv_func.randomId(); 146 // ckeditorì 커ìê° íì±í ëì´ìì ë 147 if (CKEDITOR.instances['write-content-textarea'].get
147Selection().getStartElement() != null) { 148 var html = '<img style="max-width:100%;" src="' + data + '" id="' + id + '"><p><br></p>'; 149 $(CKEDITOR.instances['write-content-textarea'].getSelection().getStartElement().$).after(html); 150 } 151 else { 152 var html = CKEDITOR.instances['write-content-textarea'].getData(); 153 html += '<img style="max-width:100%;" src="' + data + '" id="' + id + '"><p><br></p>'; 154 CKEDITOR.instances['write-content-textarea'].setData(html); 155 } 156 157 /* 2020.02.11 ì¬í 158 * ì²¨ë¶ ì´ë¯¸ì§ íë¡ì¸ì¤ ë³ê²½ 159 */ 160 var imageItem = '<div class="write-upload-image-item" data-id="' + id + '" style="background-image:url(' + data + ')" data-active-text="' + lang.representative_image + '">' + 161 '<div class="write-upload-image-item-delete"><i class="fa fa-close"></i>' + 162 '</div></div>'; 163 $('.write-upload-images-list').append(imageItem); 164 $('.write-upload-images').show(); 165 166 $('#loading-mask').removeClass('loading-mask-show'); 167 } 168 }, 169 onError: function(files,status,errMsg,pd) { 170 $('#loading-mask').removeClass('loading-mask-show'); 171 alert(lang.upload_error(10)); 172 } 173 174 }; 175 var imageUploadObj = $(".write-images").uploadFile(imageUploadSettings); 176} 177 178function initReply(bid, aid, callback) { 179 qvjax_direct( 180 "select_board_article_contentless", 181 "/module/board/board.php", 182 'bid=' + bid + '&aid=' + aid, 183 function (data) { 184 if (data.length > 0) { 185 $.each(data, function () { 186 $('.write-body').data('article', this); 187 $('#write-title-input').val("re: " + this.subject); 188 $('#write-title-options-notice').prop('checked', false); 189 $('#write-title-options-secret').prop('checked', false); 190 CKEDITOR.instances['write-content-textarea'].setData(''); 191 192 if (this.category == null || this.category == '' || this.category == undefined) { 193 $('.write-category-select option[value="0"]').prop('selected',true); 194 } 195 else { 196 $('.write-category-select option[value=' + this.category + ']').prop('selected',true); 197 } 198 }); 199 200 callback(); 201 } 202 }, 203 function (xhr) {} 204 ); 205} 206 207function initModify(bid, aid, callback) { 208 checkAuth(bid, aid, 209 function(data) { 210 $('.write-body').data('article', data); 211 initModifyForm(data); 212 callback(); 213 }, 214 function() { 215 alert(lang.no_permission); 216 location.href='/'; 217 }, 218 function() { 219 $('#WritePasswordCheckModal').modal('show'); 220 callback(); 221 } 222 ); 223 // qvjax_direct( 224 // "select_board_article", 225 // "/module/board/board.php", 226 // 'bid=' + bid + '&aid=' + aid, 227 // function (data) { 228 // if (data.length > 0) { 229 // $.each(data, function () { 230 // $('.write-body').data('article', this); 231 // var articleData = this; 232 // if (articleData.category != '') { 233 // $('.write-category-select option[value="' + articleData.category + '"]').prop('selected', true) 234 // } 235 // 236 // // ê´ë¦¬ì 237 // var arr_auth = auth.split(','); 238 // if ($.inArray('1', arr_auth) >= 0 239 // || $.inArray('2', arr_auth) >= 0 240 // || $.inArray('30', arr_auth) >= 0) { 241 // initModifyForm(articleData); 242 // } 243 // // ë¹íì 244 // else if (this.writer_account == null) { 245 // $('#WritePasswordCheckModal').modal('show'); 246 // } 247 // // ì¼ë°íì 248 // else { 249 // qvjax_direct( 250 // "check_board_article_owner", 251 // "/module/board/board.php", 252 // 'bid=' + bid + '&aid=' + aid, 253 // function (data) { 254 // if (data) { initModifyForm(articleData); } 255 // else { 256 // alert(lang.no_permission); 257 // location.href='/'; 258 // } 259 // }, 260 // function (xhr) {} 261 // ); 262 // } 263 // }); 264 // 265 // callback(); 266 // } 267 // }, 268 // function (xhr) {} 269 // ); 270} 271 272function initModifyForm(data) { 273 $('#write-title-input').val(data.subject); 274 $('#write-title-options-notice').prop('checked', data.is_notice == 1 ? true : false); 275 $('#write-title-options-secret').prop('checked', data.is_secret == 1 ? true : false); 276 277 /* 2020.02.11 ì¬í 278 * ì²¨ë¶ ì´ë¯¸ì§ íë¡ì¸ì¤ ë³ê²½ 279 */ 280 var content = $('<div>' + data.content + '</div>'); 281 if (content.find('img').length > 0) { 282 $.each(content.find('img'), function () { 283 var id = qv_func.randomId(); 284 this.id = id; 285 286 if ($(this).hasClass('board-thumbnail')) { 287 var imageItem = '<div class="write-upload-image-item active" data-id="' + id + '" data-active-text="' + lang.representative_image + '" style="background-image:url(' + $(this).attr('src') + ')">' + 288 '<div class="write-upload-image-item-delete"><i class="fa fa-close"></i></div>' + 289 '</div>'; 290 } else { 291 var imageItem = '<div class="write-upload-image-item" data-id="' + id + '" data-active-text="' + lang.representative_image + '" style="background-image:url(' + $(this).attr('src') + ')">' + 292 '<div class="write-upload-image-item-delete"><i class="fa fa-close"></i></div>' + 293 '</div>'; 294 } 295 $('.write-upload-images-list').append(imageItem); 296 }); 297 $('.write-upload-images').show(); 298 } 299 300 CKEDITOR.instances['write-content-textarea'].setData(content.html()); 301 if (data.category == null || data.category == '' || data.category == undefined) {
302 $('.write-category-select option[value="0"]').prop('selected',true); 303 } 304 else { 305 $('.write-category-select option[value=' + data.category + ']').prop('selected',true); 306 } 307 308 // ëê¸ì ê³µì§ë¡ ì§ì í ì ìì 309 if (data.reply.length > 0) { 310 $('#write-title-options-notice').prop('disabled', true); 311 } 312} 313 314function setCategory(callback) { 315 qvjax_direct( 316 "select_board_category", 317 "/module/board/board.php", 318 'bid=' + __BID, 319 function (data) { 320 if (data.length > 0) { 321 $('.write-category-select option').remove(); 322 $.each(data, function() { 323 var html = '<option value="' + this.category_id + '">' + this.category_name + '</option>'; 324 $('.write-category-select').append(html); 325 }); 326 } 327 callback(); 328 }, 329 function (xhr) {} 330 ); 331} 332 333function setAttachments(bid, aid, callback) { 334 qvjax_direct( 335 "select_board_file", 336 "/module/board/board.php", 337 'bid=' + bid + '&aid=' + aid, 338 function (data) { 339 $('.write-attachments-list ul li').remove(); 340 if (data.length > 0) { 341 var html = '<div class="write-attatchments-title">' + lang.attachment +'</div>'; 342 $.each(data, function() { 343 html += '<li id="' + this.file_id + '" data-type="' + this.file_name.split('.').pop() + '">' + 344 '<div class="write-attachments-filename"><i class="fa fa-download" aria-hidden="true"></i>' + this.file_name + '</div>' + 345 '<div class="write-attachments-filesize">' + bytesToSize(this.file_size) + '</div>' + 346 '<div class="write-attachments-delete"><i class="material-icons">clear</i></div>' + 347 '</li>'; 348 }); 349 $('.write-attachments-list ul').children('li').remove(); 350 $('.write-attachments-list ul').find('.write-attatchments-title').remove(); 351 $('.write-attachments-list ul').append(html); 352 } 353 callback(); 354 }, 355 function (xhr) {} 356 ); 357} 358 359function bytesToSize(bytes) { 360 var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; 361 if (bytes == 0) return '0 Byte'; 362 var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); 363 return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; 364} 365 366function generateRandomId() { 367 var text = ""; 368 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 369 for (var i = 0; i < 6; i++) 370 text += possible.charAt(Math.floor(Math.random() * possible.length)); 371 372 return text; 373} 374 375$('.write-body').delegate('.write-attachments-delete', 'click', function() { 376 var fid = $(this).parents('li')[0].id; 377 var ftype = $(this).parents('li').data('type'); 378 var result = confirm(lang.remove_attachment); 379 if(result) { 380 $.ajax({
381 type: "POST", 382 url: "//" + QV_BASE_OBJ.dev + "g" + QV_BASE_OBJ.svid + "m.quv.kr" + "/aws/board_remove_file.php", 383 data: 'stid=' + QV_BASE_OBJ.stid + '&bid=' + __BID + '&fid=' + fid + '&ftype=' + ftype, 384 dataType: "json", 385 success: function (data) { 386 if (data) { 387 setAttachments(__BID, __AID, function() { 388 alert(lang.remove_complete); 389 }); 390 } 391 }, 392 error: function (xhr) { 393 } 394 }); 395 } 396}); 397 398$('#main_container').delegate('.write-button-confirm', 'click', function() { 399 var result = []; 400 var obj = new Object(); 401 402 if ($('.write-service input').length > 0 || __SERVICE == 1) { 403 if (!$('.write-service input').prop('checked')) { 404 alert(lang.agree_privacy_info); 405 return; 406 } 407 } 408 409 // ìì 410 if (__W.toLowerCase() == 'u' &&(__AID != '' && __AID != undefined)) { 411 obj.bid = __BID; 412 obj.aid = __AID; 413 obj.category = $('.write-category-select option:selected').val(); 414 obj.subject = $('#write-title-input').val(); 415 obj.content = CKEDITOR.instances['write-content-textarea'].getData(); 416 obj.password = $('#write-nonmember-options-password').val(); 417 obj.is_secret = $('#write-title-options-secret').prop('checked') ? 1 : 0; 418 if ($('#write-title-options-notice').length > 0) { 419 obj.is_notice = $('#write-title-options-notice').prop('checked') ? 1 : 0; 420 421 if ($('.write-body').data('article').reply.length > 0) { 422 obj.is_notice = 0; 423 } 424 } 425 426 if (obj.subject.trim() == '') { 427 alert(lang.enter_subject); return; 428 } 429 else if (obj.content.trim() == '') { 430 alert(lang.enter_contents); return; 431 } 432 433 $('#loading-mask').addClass('loading-mask-show'); 434 435 result.push(obj); 436 437 // ê²ìê¸ ì ë°ì´í¸ ì ê¶íì ë¤ì í ë² íì¸íë¤. 438 checkAuth(obj.bid, obj.aid, 439 function() { 440 qvjax_direct( 441 "update_board_article", 442 "/module/board/board.php", 443 'json_result=' + encodeURIComponent(JSON.stringify(result)), 444 function (data) { 445 if (data) { 446 $('#loading-mask').removeClass('loading-mask-show'); 447 if (data.message == 'ERROR') { 448 alert(lang.no_permission); 449 } 450 else { 451 alert(lang.complete_modify); 452 location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + __AID + "&pn=" + __PN; 453 } 454 $('#loading-mask').removeClass('loading-mask-show'); 455 } 456 }, 457 function (xhr) { 458 $('#loading-mask').removeClass('loading-mask-show'); 459 } 460 ); 461 }, 462 function() { $('#loading-mask').removeClass('loading-mask-show'); alert(lang.no_permission); }, 463 function() { 464 var password = $('.write-body').data('password'); 465 var article_array = []; 466 var article_obj = new Object(); 467 article_obj.aid = obj.aid; 468 article_obj.bid = obj.bid; 469 article_obj.password = password; 470 article_array.push(article_obj); 471 472 checkArticlePassword( 473 article_array, 474 function() { 475 qvjax_direct( 476 "update_board_article", 477 "/module/board/board.php", 478 'json_result=' + encodeURIComponent(JSON.stringify(result)), 479 function (data) { 480 if (data) { 481 $('#loading-mask').removeClass('loading-mask-show'); 482 if (data.message == 'ERROR') { 483 alert(lang.no_permission); 484 } 485 else { 486 alert(lang.complete_modify); 487 location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + __AID + "&pn=" + __PN; 488 } 489 $('#loading-mask').removeClass('loading-mask-show'); 490 } 491 }, 492 function (xhr) { 493 $('#loading-mask').removeClass('loading-mask-show'); 494 } 495 ); 496 }, 497 function() {
498 alert(lang.invalid_password); 499 parent.history.back(); 500 } 501 ); 502 } 503 ); 504 } 505 // ëµê¸ 506 else if (__W.toLowerCase() == 'r' &&(__AID != '' && __AID != undefined)) { 507 // íì 508 if ($('.write-body').data('type') == 'member') { 509 var aid = generateRandomId(); 510 obj.bid = __BID; 511 obj.aid = aid; 512 obj.category = $('.write-body').data('article').category; 513 obj.subject = $('#write-title-input').val(); 514 obj.content = CKEDITOR.instances['write-content-textarea'].getData(); 515 obj.is_secret = $('#write-title-options-secret').prop('checked') ? 1 : 0; 516 517 if (obj.subject.trim() == '') { 518 alert(lang.enter_subject); return; 519 } 520 else if (obj.content.trim() == '') { 521 alert(lang.enter_contents); return; 522 } 523 524 $('#loading-mask').addClass('loading-mask-show'); 525 526 result.push(obj); 527 528 qvjax_direct( 529 "insert_board_reply", 530 "/module/board/board.php", 531 'pid=' + __AID + '&json_result=' + encodeURIComponent(JSON.stringify(result)), 532 function (data) { 533 if (data) { 534 $('#loading-mask').removeClass('loading-mask-show'); 535 if (data.message == 'ERROR' && data.code == 1355) { 536 alert(lang.no_more_reply); 537 } 538 else if (data.message == 'ERROR') { 539 alert(lang.no_permission); 540 } 541 else { 542 pushNotification('', obj.subject, 'board'); 543 544 alert(lang.complete_regist); 545 location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + aid + "&pn=" + __PN; 546 } 547 $('#loading-mask').removeClass('loading-mask-show'); 548 } 549 }, 550 function (xhr) { 551 $('#loading-mask').removeClass('loading-mask-show'); 552 } 553 ); 554 } 555 // ë¹íì 556 else { 557 var aid = generateRandomId(); 558 obj.bid = __BID; 559 obj.aid = aid; 560 obj.category = $('.write-body').data('article').category; 561 obj.subject = $('#write-title-input').val(); 562 //obj.content = encodeURIComponent(CKEDITOR.instances['write-content-textarea'].getData()); 563 obj.content = CKEDITOR.instances['write-content-textarea'].getData(); 564 obj.writer = $('#write-nonmember-options-writer').val(); 565 obj.password = $('#write-nonmember-options-password').val(); 566 obj.is_secret = $('#write-title-options-secret').prop('checked') ? 1 : 0; 567 568 if (obj.subject.trim() == '') { 569 alert(lang.enter_subject); return; 570 } 571 else if (obj.writer.trim() == '') { 572 alert(lang.enter_writer); return; 573 } 574 else if (obj.content.trim() == '') { 575 alert(lang.enter_contents); return; 576 } 577 578 $('#loading-mask').addClass('loading-mask-show'); 579 580 result.push(obj); 581 582 qvjax_direct( 583 "insert_board_reply_nonmember", 584 "/module/board/board.php", 585 'pid=' + __AID + '&json_result=' + encodeURIComponent(JSON.stringify(result)), 586 function (data) { 587 if (data) { 588 $('#loading-mask').removeClass('loading-mask-show'); 589 if (data.message == 'ERROR' && data.code == 1355) { 590 alert(lang.no_more_reply); 591 } 592 else if (data.message == 'ERROR') { 593 alert(lang.no_permission); 594 } 595 else { 596 pushNotification('', obj.subject, 'board'); 597 598 alert(lang.complete_regist); 599 //location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + aid;
600 // ë¹íì ê¸ ìì± ìë£ ì 목ë¡ì¼ë¡ ì´ëíëë¡ ìì 601 redirectPrevPage(); 602 } 603 $('#loading-mask').removeClass('loading-mask-show'); 604 } 605 }, 606 function (xhr) { 607 $('#loading-mask').removeClass('loading-mask-show'); 608 } 609 ); 610 } 611 } 612 // ì ê· 613 else { 614 // íìupload 615 if ($('.write-body').data('type') == 'member') { 616 obj.aid = __AID; 617 obj.bid = __BID; 618 obj.category = $('.write-category-select option:selected').val(); 619 obj.subject = $('#write-title-input').val(); 620 obj.content = CKEDITOR.instances['write-content-textarea'].getData(); 621 obj.views = 0; 622 obj.hits = 0; 623 obj.is_secret = $('#write-title-options-secret').prop('checked') ? 1 : 0; 624 obj.is_notice = $('#write-title-options-notice').prop('checked') ? 1 : 0; 625 obj.parent = 1; 626 obj.is_comment = 0; 627 obj.comment = 0; 628 629 if (obj.subject.trim() == '') { 630 alert(lang.enter_subject); return; 631 } 632 else if (obj.content.trim() == '') { 633 alert(lang.enter_contents); return; 634 } 635 636 $('#loading-mask').addClass('loading-mask-show'); 637 638 result.push(obj); 639 640 qvjax_direct( 641 "insert_board_article", 642 "/module/board/board.php", 643 'json_result=' + encodeURIComponent(JSON.stringify(result)), 644 function (data) { 645 if (data.message == 'ERROR') { 646 alert(lang.no_permission); 647 } 648 else { 649 pushNotification('', obj.subject, 'board'); 650 651 qv_func.conversion('board', function() { 652 alert(lang.complete_regist); 653 location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + __AID + "&pn=" + __PN; 654 }); 655 } 656 $('#loading-mask').removeClass('loading-mask-show'); 657 }, 658 function (xhr) { 659 $('#loading-mask').removeClass('loading-mask-show'); 660 } 661 ); 662 } 663 // ë¹íì 664 else { 665 obj.aid = __AID; 666 obj.bid = __BID; 667 obj.category = $('.write-category-select option:selected').val(); 668 obj.subject = $('#write-title-input').val(); 669 //obj.content = encodeURIComponent(CKEDITOR.instances['write-content-textarea'].getData()); 670 obj.content = CKEDITOR.instances['write-content-textarea'].getData(); 671 obj.views = 0; 672 obj.hits = 0; 673 obj.writer = $('#write-nonmember-options-writer').val(); 674 obj.password = $('#write-nonmember-options-password').val(); 675 obj.is_secret = $('#write-title-options-secret').prop('checked') ? 1 : 0; 676 obj.parent = 1; 677 obj.is_comment = 0; 678 obj.comment = 0; 679 680 if (obj.subject.trim() == '') { 681 alert(lang.enter_subject); return; 682 } 683 else if (obj.writer.trim() == '') { 684 alert(lang.enter_writer); return; 685 } 686 else if (obj.content.trim() == '') { 687 alert(lang.enter_contents); return; 688 } 689 else if (obj.password.trim() == '') { 690 alert(lang.enter_password); return; 691 } 692 else if (obj.password.length > 20) { 693 alert(lang.invalid_password_limit); return; 694 } 695 696 $('#loading-mask').addClass('loading-mask-show'); 697 698 result.push(obj); 699 700 qvjax_direct( 701 "insert_board_article_nonmember", 702 "/module/board/board.php", 703 'json_result=' + encodeURIComponent(JSON.stringify(result)), 704 function (data) { 705 if (data.message == 'ERROR') { 706 alert(lang.no_permission); 707 } 708 else { 709 pushNotification('', obj.subject, 'board'); 710 711 qv_func.conversion('board', function() { 712 alert(lang.complete_regist); 713 //location.href = "/module/board/read_form.html?bid=" + __BID + "&aid=" + __AID + "&pn=" + __PN; 714 // ë¹íì ê¸ ìì± ìë£ ì 목ë¡ì¼ë¡ ì´ëíëë¡ ìì 715 redirectPrevPage(); 716 }); 717 } 718 $('#loading-mask').removeClass('loading-mask-show'); 719 }, 720 function (xhr) { 721 $('#loading-mask').removeClass('loading-mask-show'); 722 } 723 ) 724 } 725 } 726}); 727 728// $('#write-title-options-secret').change(function() { 729// if($(this).is(":checked")) { 730// $('#write-nonmember-options-password').show();
731// } 732// else { 733// $('#write-nonmember-options-password').hide(); 734// } 735// }); 736 737$("#WritePasswordCheckModal").delegate("#WritePasswordCheckModalBtnSave", "click", function(e) { 738 var password = $('#WritePasswordCheck').val(); 739 var array = []; 740 var obj = new Object(); 741 obj.aid = __AID; 742 obj.bid = __BID; 743 obj.password = password; 744 array.push(obj); 745 746 checkArticlePassword( 747 array, 748 function() { 749 initModifyForm($('.write-body').data('article')); 750 $('.write-body').data('password', obj.password); 751 $('#WritePasswordCheckModal').data('certification', true); 752 $('#WritePasswordCheckModal').modal('hide'); 753 }, 754 function() { 755 $('#WritePasswordCheckModal').data('certification', false); 756 alert(lang.invalid_password); 757 parent.history.back(); 758 }); 759 760 // qvjax_direct( 761 // "check_board_article_password", 762 // "/module/board/board.php", 763 // 'json_result=' + encodeURIComponent(JSON.stringify(array)), 764 // function (data) { 765 // if (data > 0) { 766 // initModifyForm($('.write-body').data('article')); 767 // $('.write-body').data('password', obj.password); 768 // $('#WritePasswordCheckModal').data('certification', true); 769 // $('#WritePasswordCheckModal').modal('hide'); 770 // } 771 // else { 772 // $('#WritePasswordCheckModal').data('certification', false); 773 // alert(lang.invalid_password); 774 // parent.history.back(); 775 // } 776 // }, 777 // function (xhr) { } 778 // ); 779}); 780 781$("#WritePasswordCheckModal").on('hide.bs.modal', function () { 782 if (!$('#WritePasswordCheckModal').data('certification')) { 783 parent.history.back(); 784 } 785}); 786 787 788// ë¹ëì¤ í´ë¦½ 789$('.write-videos').on('click', function() { 790 $('#WriteVideoModal').modal('show'); 791}); 792 793$(".modal").delegate("#WriteVideoModalBtnSave", "click", function(e) { 794 // url ë³ê²½ 795 var videoUrl = $('#video-url').val(); 796 if (videoUrl.trim() != "") { 797 var pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g; 798 var pattern2 = /(?:http?s?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g; 799 var pattern3 = /([-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?(?:jpg|jpeg|gif|png))/gi; 800 801 var videoId = ''; 802 // youtube 803 if (pattern2.test(videoUrl) && (videoUrl.indexOf('//www.youtube.com/watch') > -1 || videoUrl.indexOf('//youtu.be/') > -1)) { 804 var replacement = 'https://www.youtube.com/embed/$1'; 805 var replacementUrl = videoUrl.replace(pattern2, replacement); 806 807 videoId = videoUrl.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 808 videoId = videoId[1]; 809 var videoType = 'youtube'; 810 } 811 // vimeo 812 else if (pattern1.test(videoUrl) && videoUrl.indexOf('//vimeo.com/') > -1) { 813 var replacement = 'https://player.vimeo.com/video/$1'; 814 var replacementUrl = videoUrl.replace(pattern1, replacement); 815 816 videoId = videoUrl.match(/(?:https?:\/{2})?(?:w{3}\.)?vimeo.com\/(\d+)($|\/)/); 817 videoId = videoId[1]; 818 var videoType = 'vimeo'; 819 } 820 // etc 821 else if (pattern3.test(videoUrl)) { 822 var replacement = '$1'; 823 var replacementUrl = videoUrl.replace(pattern3, replacement); 824 825 var videoType = 'etc'; 826 } 827 828 replacementUrl = typeof(replacementUrl) == "undefined" ? videoUrl : replacementUrl; 829 replacementUrl += '?frameborder=0&autoplay=1'; 830 831 var iframeHtml = '<iframe class="qv-video" data-id="' + videoId + '" data-type="' + videoType + '" src="' + replacementUrl + '" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:480px;width:100%;" height="480px" width="100%"></iframe>'; 832 833 // ckeditorì 커ìê° íì±í ëì´ìì ë
834 if (CKEDITOR.instances['write-content-textarea'].getSelection().getStartElement() != null) { 835 $(CKEDITOR.instances['write-content-textarea'].getSelection().getStartElement().$).after(iframeHtml); 836 } 837 else { 838 var html = CKEDITOR.instances['write-content-textarea'].getData(); 839 html += iframeHtml; 840 CKEDITOR.instances['write-content-textarea'].setData(html); 841 } 842 843 $('#WriteVideoModal').modal('hide'); 844 } 845}); 846 847$('#WritePasswordCheckModal').keyup(function(event){ 848 // press enter in modal 849 if(event.keyCode == 13) { $('#WritePasswordCheckModalBtnSave').trigger( "click" ); } 850}); 851 852$('.write-close, .write-button-cancel').on('click', function() { 853 redirectPrevPage(); 854}); 855 856function redirectPrevPage() { 857 var query = qv_func.getUrlParams(); 858 var prevUrl = query.prev; 859 if (prevUrl == undefined || prevUrl == '') { 860 parent.history.back(); 861 } 862 else { 863 location.href = decodeURIComponent(prevUrl); 864 } 865} 866 867 868 869/* 2020.02.11 ì¬í 870 * ì²¨ë¶ ì´ë¯¸ì§ íë¡ì¸ì¤ ë³ê²½ 871 */ 872$('.write-body').delegate('.write-upload-image-item', 'click', function(e) { 873 if ($(e.target).is('.write-upload-image-item-delete') || 874 $(e.target).parents('.write-upload-image-item-delete').length > 0) return; 875 876 var id = $(this).attr('data-id'); 877 var data = $('<div>' + CKEDITOR.instances['write-content-textarea'].getData() + '</div>'); 878 879 if ($(this).hasClass('active')) { 880 data.find('img').removeClass('board-thumbnail'); 881 $(this).removeClass('active'); 882 CKEDITOR.instances['write-content-textarea'].setData(data.html()); 883 } 884 else { 885 data.find('img').removeClass('board-thumbnail'); 886 data.find('img#' + id).addClass('board-thumbnail'); 887 888 $('.write-upload-image-item.active').removeClass('active'); 889 $(this).addClass('active'); 890 CKEDITOR.instances['write-content-textarea'].setData(data.html()); 891 } 892}); 893$('.write-body').delegate('.write-upload-image-item-delete', 'click', function(e) { 894 var result = confirm('í´ë¹ ì´ë¯¸ì§ë¥¼ ìì íìê² ìµëê¹?'); 895 if (result) { 896 var target = $(this).parent('.write-upload-image-item'); 897 var id = target.attr('data-id'); 898 var data = $('<div>' + CKEDITOR.instances['write-content-textarea'].getData() + '</div>'); 899 900 data.find('img#' + id).remove(); 901 target.remove(); 902 CKEDITOR.instances['write-content-textarea'].setData(data.html()); 903 } 904});
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.