1var c_cache = new Array(); 2 3function RunAjaxJS(insertelement, data){ 4 var milisec = new Date; 5 var jsfound = false; 6 milisec = milisec.getTime(); 7 8 var js_reg = /<script.*?>(.|[\r\n])*?<\/script>/ig; 9 10 var js_str = js_reg.exec(data); 11 if (js_str != null) { 12 13 var js_arr = new Array(js_str.shift()); 14 var jsfound = true; 15 16 while(js_str) { 17 js_str = js_reg.exec(data); 18 if (js_str != null) js_arr.push(js_str.shift()); 19 } 20 21 for(var i=0; i<js_arr.length;i++) { 22 data = data.replace(js_arr[i],'<span id="'+milisec+i+'" style="display:none;"></span>'); 23 } 24 } 25 26 $("#" + insertelement).html(data); 27 28 if (jsfound) { 29 30 var js_content_reg = /<script.*?>((.|[\r\n])*?)<\/script>/ig; 31 32 for (i = 0; i < js_arr.length; i++) { 33 var mark_node = document.getElementById(milisec+''+i); 34 var mark_parent_node = mark_node.parentNode; 35 mark_parent_node.removeChild(mark_node); 36 37 js_content_reg.lastIndex = 0; 38 var js_content = js_content_reg.exec(js_arr[i]); 39 var script_node = mark_parent_node.appendChild(document.createElement('script')); 40 script_node.text = js_content[1]; 41 42 var script_params_str = js_arr[i].substring(js_arr[i].indexOf(' ',0),js_arr[i].indexOf('>',0)); 43 var params_arr = script_params_str.split(' '); 44 45 if (params_arr.length > 1) { 46 for (var j=0;j< params_arr.length; j++ ) { 47 48 if(params_arr[j].length > 0){ 49 var param_arr = params_arr[j].split('='); 50 param_arr[1] = param_arr[1].substr(1,(param_arr[1].length-2)); 51 script_node.setAttribute(param_arr[0],param_arr[1]); 52 } 53 54 } 55 } 56 57 } 58 } 59}; 60 61function IPMenu( m_ip, l1, l2, l3 ){ 62 63 var menu=new Array(); 64 65 menu[0]='<a href="https://www.nic.ru/whois/?ip=' + m_ip + '" target="_blank">' + l1 + '</a>'; 66 menu[1]='<a href="' + dle_root + dle_admin + '?mod=iptools&ip=' + m_ip + '" target="_blank">' + l2 + '</a>'; 67 menu[2]='<a href="' + dle_root + dle_admin + '?mod=blockip&ip=' + m_ip + '" target="_blank">' + l3 + '</a>'; 68 69 return menu; 70}; 71 72 73function ajax_save_for_edit( news_id, event ) 74{ 75 var allow_br = 0; 76 var news_txt = ''; 77 78 var params = {}; 79 80 if (quick_wysiwyg == "1") { 81 82 submit_all_data(); 83 84 } 85 86 $.each($('#ajaxnews'+news_id).serializeArray(), function(index,value) { 87 88 if (value.name.indexOf("xfield") != -1) { 89 params[value.name] = value.value; 90 } 91 92 }); 93 94 if (document.getElementById('allow_br_'+news_id).checked) { params['allow_br'] = 1; } 95 96 params['news_txt'] = $('#dleeditnews'+news_id).val(); 97 params['full_txt'] = $('#dleeditfullnews'+news_id).val(); 98 params['title'] = $('#edit-title-'+news_id).val(); 99 params['reason'] = $('#edit-reason-'+news_id).val(); 100 params['id'] = news_id; 101 params['field'] = event; 102 params['action'] = "save"; 103 104 ShowLoading(''); 105 106 $.post(dle_root + "engine/ajax/editnews.php", params, function(data){ 107 108 HideLoading(''); 109 110 if (data != "ok") { 111 112 DLEalert ( data, dle_info ); 113 114 } else { 115 116 $('#dlepopup-news-edit').dialog('close'); 117 DLEconfirm( dle_save_ok, dle_confirm, function () { 118 location.reload(true); 119 } ); 120 121 } 122 123 }); 124 125 return false; 126}; 127 128function ajax_prep_for_edit( news_id, event ) 129{ 130 for (var i = 0, length = c_cache.length; i < length; i++) { 131 if (i in c_cache) { 132 if ( c_cache[ i ] || c_cache[ i ] != '' ) 133 { 134 ajax_cancel_comm_edit( i ); 135 } 136 } 137 } 138 139 ShowLoading(''); 140 141 $.get(dle_root + "engine/ajax/editnews.php", { id: news_id, field: event, action: "edit" }, function(data){ 142 143 HideLoading(''); 144 var shadow = 'none'; 145 146 $('#modal-overlay').remove(); 147 148 $('body').prepend('<div id="modal-overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #666666; opacity: .40;filter:Alpha(Opacity=40); z-index: 999; display:none;"></div>');
149 $('#modal-overlay').css({'filter' : 'alpha(opacity=40)'}).fadeIn(); 150 151 var b = {}; 152 153 b[dle_act_lang[3]] = function() { 154 $(this).dialog('close'); 155 }; 156 157 b[dle_act_lang[4]] = function() { 158 ajax_save_for_edit( news_id, event ); 159 }; 160 161 $('#dlepopup-news-edit').remove(); 162 163 $('body').prepend("<div id='dlepopup-news-edit' class='dlepopupnewsedit' title='"+menu_short+"' style='display:none'></div>"); 164 165 $('.dlepopupnewsedit').html(''); 166 167 $('#dlepopup-news-edit').dialog({ 168 autoOpen: true, 169 width: "800", 170 height: 500, 171 buttons: b, 172 dialogClass: "modalfixed", 173 dragStart: function(event, ui) { 174 shadow = $(".modalfixed").css('box-shadow'); 175 $(".modalfixed").css('box-shadow', 'none'); 176 }, 177 dragStop: function(event, ui) { 178 $(".modalfixed").css('box-shadow', shadow); 179 }, 180 close: function(event, ui) { 181 $(this).dialog('destroy'); 182 $('#modal-overlay').fadeOut(function() { 183 $('#modal-overlay').remove(); 184 }); 185 } 186 }); 187 188 if ($(window).width() > 830 && $(window).height() > 530 ) { 189 $('.modalfixed.ui-dialog').css({position:"fixed"}); 190 $( '#dlepopup-news-edit').dialog( "option", "position", ['0','0'] ); 191 } 192 193 RunAjaxJS('dlepopup-news-edit', data); 194 195 }); 196 197 return false; 198}; 199 200 201function ajax_comm_edit( c_id, area ) 202{ 203 204 for (var i = 0, length = c_cache.length; i < length; i++) { 205 if (i in c_cache) { 206 if ( c_cache[ i ] != '' ) 207 { 208 ajax_cancel_comm_edit( i ); 209 } 210 } 211 } 212 213 if ( ! c_cache[ c_id ] || c_cache[ c_id ] == '' ) 214 { 215 c_cache[ c_id ] = $('#comm-id-'+c_id).html(); 216 } 217 218 ShowLoading(''); 219 220 $.get(dle_root + "engine/ajax/editcomments.php", { id: c_id, area: area, action: "edit" }, function(data){ 221 222 HideLoading(''); 223 224 RunAjaxJS('comm-id-'+c_id, data); 225 226 setTimeout(function() { 227 $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $("#comm-id-" + c_id).offset().top - 70}, 700); 228 }, 100); 229 230 }); 231 return false; 232}; 233 234function ajax_cancel_comm_edit( c_id ) 235{ 236 if ( c_cache[ c_id ] != "" ) 237 { 238 $("#comm-id-"+c_id).html(c_cache[ c_id ]); 239 } 240 241 c_cache[ c_id ] = ''; 242 243 return false; 244}; 245 246function ajax_save_comm_edit( c_id, area ) 247{ 248 if (dle_wysiwyg == "yes") { 249 250 submit_all_data(); 251 252 } 253 254 var comm_txt = $('#dleeditcomments'+c_id).val(); 255 256 ShowLoading(''); 257 258 $.post(dle_root + "engine/ajax/editcomments.php", { id: c_id, comm_txt: comm_txt, area: area, action: "save" }, function(data){ 259 260 HideLoading(''); 261 c_cache[ c_id ] = ''; 262 $("#comm-id-"+c_id).html(data); 263 264 }); 265 return false; 266}; 267 268function DeleteComments(id, hash) { 269 270 DLEconfirm( dle_del_agree, dle_confirm, function () { 271 272 ShowLoading(''); 273 274 $.get(dle_root + "engine/ajax/deletecomments.php", { id: id, dle_allow_hash: hash }, function(r){ 275 276 HideLoading(''); 277 278 r = parseInt(r); 279 280 if (!isNaN(r)) { 281 282 $("html"+( ! $.browser.opera ? ",body" : "")).animate({scrollTop: $("#comment-id-" + r).offset().top - 70}, 700); 283 284 setTimeout(function() { $("#comment-id-" + r).hide('blind',{},1400)}, 700); 285 286 } 287 288 }); 289 290 } ); 291 292}; 293 294function doFavorites( fav_id, event ) 295{ 296 ShowLoading(''); 297 298 $.get(dle_root + "engine/ajax/favorites.php", { fav_id: fav_id, action: event, skin: dle_skin }, function(data){ 299 300 HideLoading(''); 301 302 $("#fav-id-" + fav_id).html(data); 303 304 }); 305 306 return false; 307}; 308 309function CheckLogin() 310{ 311 var name = document.getElementById('name').value; 312 313 ShowLoading(''); 314 315 $.post(dle_root + "engine/ajax/registration.php", { name: name }, function(data){ 316 317 HideLoading(''); 318 319 $("#result-registration").html(data); 320 321 }); 322 323 return false; 324}; 325 326function doCalendar(month, year, effect){ 327 328 ShowLoading(''); 329 330 $.get(dle_root + "engine/ajax/calendar.php", { month: month, year: year }, function(data){ 331 HideLoading(''); 332 333 if (effect == "left" ) { 334 $("#calendar-layer").hide('slide',{ direction: "left" }, 500).html(data).show('slide',{ direction: "right" }, 500); 335 } else { 336 $("#calendar-layer").hide('slide',{ direction: "right" }, 500).html(data).show('slide',{ direction: "left" }, 500); 337 } 338 339 }); 340}; 341 342 343function doRate( rate, id ) { 344 ShowLoading(''); 345 346 $.get(dle_root + "engine/ajax/rating.php", { go_rate: rate, news_id: id, skin: dle_skin }, function(data){ 347 348 HideLoading(''); 349 350 $("#ratig-layer").html(data); 351 352 }); 353}; 354 355function dleRate( rate, id ) { 356 ShowLoading(''); 357 358 $.get(dle_root + "engine/ajax/rating.php", { go_rate: rate, news_id: id, skin: dle_skin, mode: "short" }, function(data){ 359 360 HideLoading(''); 361
362 $("#ratig-layer-" + id).html(data); 363 364 }); 365 366}; 367 368function doAddComments(){ 369 370 var form = document.getElementById('dle-comments-form'); 371 372 if (dle_wysiwyg == "yes") { 373 submit_all_data(); 374 var editor_mode = 'wysiwyg'; 375 } else { var editor_mode = ''; } 376 377 if (form.comments.value == '' || form.name.value == '') 378 { 379 DLEalert ( dle_req_field, dle_info ); 380 return false; 381 } 382 383 if ( form.question_answer ) { 384 385 var question_answer = form.question_answer.value; 386 387 } else { var question_answer = ''; } 388 389 if ( form.sec_code ) { 390 391 var sec_code = form.sec_code.value; 392 393 } else { var sec_code = ''; } 394 395 if ( form.recaptcha_response_field ) { 396 var recaptcha_response_field= Recaptcha.get_response(); 397 var recaptcha_challenge_field= Recaptcha.get_challenge(); 398 } else { 399 var recaptcha_response_field= ''; 400 var recaptcha_challenge_field= ''; 401 } 402 403 if ( form.allow_subscribe ) { 404 405 if ( form.allow_subscribe.checked == true ) { 406 407 var allow_subscribe= "1"; 408 409 } else { 410 411 var allow_subscribe= "0"; 412 413 } 414 415 } else { var allow_subscribe= "0"; } 416 417 ShowLoading(''); 418 419 $.post(dle_root + "engine/ajax/addcomments.php", { post_id: form.post_id.value, comments: form.comments.value, name: form.name.value, mail: form.mail.value, editor_mode: editor_mode, skin: dle_skin, sec_code: sec_code, question_answer: question_answer, recaptcha_response_field: recaptcha_response_field, recaptcha_challenge_field: recaptcha_challenge_field, allow_subscribe: allow_subscribe }, function(data){ 420 421 if ( form.sec_code ) { 422 form.sec_code.value = ''; 423 reload(); 424 } 425 426 HideLoading(''); 427 428 RunAjaxJS('dle-ajax-comments', data); 429 430 if (data != 'error' && document.getElementById('blind-animation')) { 431 432 $("html"+( ! $.browser.opera ? ",body" : "")).animate({scrollTop: $("#dle-ajax-comments").offset().top - 70}, 1100); 433 434 setTimeout(function() { $('#blind-animation').show('blind',{},1500)}, 1100); 435 } 436 437 }); 438 439}; 440 441function CommentsPage( cstart, news_id ) 442{ 443 ShowLoading(''); 444 445 $.get(dle_root + "engine/ajax/comments.php", { cstart: cstart, news_id: news_id, skin: dle_skin }, function(data){ 446 447 HideLoading(''); 448 449 if (!isNaN(cstart) && !isNaN(news_id)) { 450 451 $('#dle-comm-link').unbind('click'); 452 453 $('#dle-comm-link').bind('click', function() { 454 CommentsPage( cstart, news_id ); 455 return false; 456 }); 457 458 459 } 460 461 scroll( 0, $("#dle-comments-list").offset().top - 70 ); 462 463 $("#dle-comments-list").html(data.comments); 464 $(".dle-comments-navigation").html(data.navigation); 465 466 467 }, "json"); 468 469 return false; 470}; 471 472function dle_copy_quote(qname) 473{ 474 dle_txt= ''; 475 476 if (window.getSelection) 477 { 478 dle_txt=window.getSelection(); 479 } 480 else if (document.selection) 481 { 482 dle_txt=document.selection.createRange().text; 483 } 484 if (dle_txt != "") 485 { 486 dle_txt='[quote='+qname+']'+dle_txt+'[/quote]\n'; 487 } 488}; 489 490function dle_ins(name) 491{ 492 if ( !document.getElementById('dle-comments-form') ) return false; 493 494 var input=document.getElementById('dle-comments-form').comments; 495 var finalhtml = ""; 496 497 if (dle_wysiwyg == "no") { 498 if (dle_txt!= "") { 499 input.value += dle_txt; 500 } 501 else { 502 input.value += "[b]"+name+"[/b],"+"\n"; 503 } 504 } else { 505 if (dle_txt!= "") { 506 finalhtml = dle_txt; 507 } 508 else { 509 finalhtml = "<b>"+name+"</b>,"; 510 } 511 512 oUtil.obj.focus(); 513 oUtil.obj.insertHTML(finalhtml+"<br />"); 514 } 515 516}; 517 518function ShowOrHide( id ) { 519 520 var item = $("#" + id); 521 522 if ( document.getElementById('image-'+ id) ) { 523 524 var image = document.getElementById('image-'+ id); 525 526 } else { 527 528 var image = null; 529 } 530 531 var scrolltime = (item.height() / 200) * 1000; 532 533 if (scrolltime > 3000 ) { scrolltime = 3000; } 534 535 if (scrolltime < 250 ) { scrolltime = 250; } 536 537 if (item.css("display") == "none") { 538 539 item.show('blind',{}, scrolltime ); 540 541 if (image) { image.src = dle_root + 'templates/'+ dle_skin + '/dleimages/spoiler-minus.gif';} 542 543 } else { 544 545 if (scrolltime > 2000 ) { scrolltime = 2000; } 546 547 item.hide('blind',{}, scrolltime ); 548 if (image) { image.src = dle_root + 'templates/'+ dle_skin + '/dleimages/spoiler-plus.gif';} 549 } 550 551}; 552 553 554function ckeck_uncheck_all() { 555 var frm = document.pmlist; 556 for (var i=0;i<frm.elements.length;i++) { 557 var elmnt = frm.elements[i]; 558 if (elmnt.type=='checkbox') { 559 if(frm.master_box.checked == true){ elmnt.checked=false; } 560 else{ elmnt.checked=true; } 561 } 562 } 563 if(frm.master_box.checked == true){ frm.master_box.checked = false; } 564 else{ frm.master_box.checked = true; } 565}; 566 567function confirmDelete(url){ 568 569 DLEconfirm( dle_del_agree, dle_confirm, function () { 570 document.location=url; 571 } ); 572};
573 574function setNewField(which, formname) 575{ 576 if (which != selField) 577 { 578 fombj = formname; 579 selField = which; 580 581 } 582}; 583 584function dle_news_delete( id ){ 585 586 var b = {}; 587 588 b[dle_act_lang[1]] = function() { 589 $(this).dialog("close"); 590 }; 591 592 if (allow_dle_delete_news) { 593 594 b[dle_del_msg] = function() { 595 $(this).dialog("close"); 596 597 var bt = {}; 598 599 bt[dle_act_lang[3]] = function() { 600 $(this).dialog('close'); 601 }; 602 603 bt[dle_p_send] = function() { 604 if ( $('#dle-promt-text').val().length < 1) { 605 $('#dle-promt-text').addClass('ui-state-error'); 606 } else { 607 var response = $('#dle-promt-text').val() 608 $(this).dialog('close'); 609 $('#dlepopup').remove(); 610 $.post(dle_root + 'engine/ajax/message.php', { id: id, text: response }, 611 function(data){ 612 if (data == 'ok') { document.location=dle_root + 'index.php?do=deletenews&id=' + id + '&hash=' + dle_login_hash; } else { DLEalert('Send Error', dle_info); } 613 }); 614 615 } 616 }; 617 618 $('#dlepopup').remove(); 619 620 $('body').append("<div id='dlepopup' title='"+dle_notice+"' style='display:none'><br />"+dle_p_text+"<br /><br /><textarea name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%;height:100px; padding: .4em;'></textarea></div>"); 621 622 $('#dlepopup').dialog({ 623 autoOpen: true, 624 width: 500, 625 dialogClass: "modalfixed", 626 buttons: bt 627 }); 628 629 $('.modalfixed.ui-dialog').css({position:"fixed"}); 630 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 631 632 }; 633 } 634 635 b[dle_act_lang[0]] = function() { 636 $(this).dialog("close"); 637 document.location=dle_root + 'index.php?do=deletenews&id=' + id + '&hash=' + dle_login_hash; 638 }; 639 640 $("#dlepopup").remove(); 641 642 $("body").append("<div id='dlepopup' title='"+dle_confirm+"' style='display:none'><br /><div id='dlepopupmessage'>"+dle_del_agree+"</div></div>"); 643 644 $('#dlepopup').dialog({ 645 autoOpen: true, 646 width: 500, 647 dialogClass: "modalfixed", 648 buttons: b 649 }); 650 651 $('.modalfixed.ui-dialog').css({position:"fixed"}); 652 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 653 654 655}; 656 657function MenuNewsBuild( m_id, event ){ 658 659var menu=new Array(); 660 661menu[0]='<a onclick="ajax_prep_for_edit(\'' + m_id + '\', \'' + event + '\'); return false;" href="#">' + menu_short + '</a>'; 662 663if (dle_admin != '') { 664 665 menu[1]='<a href="' + dle_root + dle_admin + '?mod=editnews&action=editnews&id=' + m_id + '" target="_blank">' + menu_full + '</a>'; 666 667} 668 669if (allow_dle_delete_news) { 670 671 menu[2]='<a onclick="sendNotice (\'' + m_id + '\'); return false;" href="#">' + dle_notice + '</a>'; 672 menu[3]='<a onclick="dle_news_delete (\'' + m_id + '\'); return false;" href="#">' + dle_del_news + '</a>'; 673 674} 675 676return menu; 677}; 678 679function sendNotice( id ){ 680 var b = {}; 681 682 b[dle_act_lang[3]] = function() { 683 $(this).dialog('close'); 684 }; 685 686 b[dle_p_send] = function() { 687 if ( $('#dle-promt-text').val().length < 1) { 688 $('#dle-promt-text').addClass('ui-state-error'); 689 } else { 690 var response = $('#dle-promt-text').val() 691 $(this).dialog('close'); 692 $('#dlepopup').remove(); 693 $.post(dle_root + 'engine/ajax/message.php', { id: id, text: response, allowdelete: "no" }, 694 function(data){ 695 if (data == 'ok') { DLEalert(dle_p_send_ok, dle_info); } 696 }); 697 698 } 699 }; 700 701 $('#dlepopup').remove(); 702 703 $('body').append("<div id='dlepopup' title='"+dle_notice+"' style='display:none'><br />"+dle_p_text+"<br /><br /><textarea name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%;height:100px; padding: .4em;'></textarea></div>"); 704 705 $('#dlepopup').dialog({ 706 autoOpen: true, 707 width: 500, 708 dialogClass: "modalfixed", 709 buttons: b 710 }); 711 712 $('.modalfixed.ui-dialog').css({position:"fixed"}); 713 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 714 715}; 716 717function AddComplaint( id, action ){ 718 var b = {}; 719 720 b[dle_act_lang[3]] = function() { 721 $(this).dialog('close'); 722 }; 723 724 b[dle_p_send] = function() { 725 if ( $('#dle-promt-text').val().length < 1) { 726 $('#dle-promt-text').addClass('ui-state-error'); 727 } else { 728 var response = $('#dle-promt-text').val() 729 $(this).dialog('close'); 730 $('#dlepopup').remove(); 731 $.post(dle_root + 'engine/ajax/complaint.php', { id: id, text: response, action: action }, 732 function(data){ 733 if (data == 'ok') { DLEalert(dle_p_send_ok, dle_info); } else { DLEalert(data, dle_info); } 734 }); 735 736 } 737 }; 738 739 $('#dlepopup').remove(); 740 741 $('body').append("<div id='dlepopup' title='"+dle_complaint+"' style='display:none'><br /><textarea name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%;height:100px; padding: .4em;'></textarea></div>"); 742 743 $('#dlepopup').dialog({ 744 autoOpen: true, 745 width: 500, 746 dialogClass: "modalfixed", 747 buttons: b 748 }); 749 750 $('.modalfixed.ui-dialog').css({position:"fixed"});
751 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 752 753}; 754 755function DLEalert(message, title){ 756 757 $("#dlepopup").remove(); 758 759 $("body").append("<div id='dlepopup' title='" + title + "' style='display:none'><br />"+ message +"</div>"); 760 761 $('#dlepopup').dialog({ 762 autoOpen: true, 763 width: 470, 764 dialogClass: "modalfixed", 765 buttons: { 766 "Ok": function() { 767 $(this).dialog("close"); 768 $("#dlepopup").remove(); 769 } 770 } 771 }); 772 773 $('.modalfixed.ui-dialog').css({position:"fixed"}); 774 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 775}; 776 777function DLEconfirm(message, title, callback){ 778 779 var b = {}; 780 781 b[dle_act_lang[1]] = function() { 782 $(this).dialog("close"); 783 $("#dlepopup").remove(); 784 }; 785 786 b[dle_act_lang[0]] = function() { 787 $(this).dialog("close"); 788 $("#dlepopup").remove(); 789 if( callback ) callback(); 790 }; 791 792 $("#dlepopup").remove(); 793 794 $("body").append("<div id='dlepopup' title='" + title + "' style='display:none'><br />"+ message +"</div>"); 795 796 $('#dlepopup').dialog({ 797 autoOpen: true, 798 width: 500, 799 dialogClass: "modalfixed", 800 buttons: b 801 }); 802 803 $('.modalfixed.ui-dialog').css({position:"fixed"}); 804 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 805}; 806 807function DLEprompt(message, d, title, callback, allowempty){ 808 809 var b = {}; 810 811 b[dle_act_lang[3]] = function() { 812 $(this).dialog("close"); 813 }; 814 815 b[dle_act_lang[2]] = function() { 816 if ( !allowempty && $("#dle-promt-text").val().length < 1) { 817 $("#dle-promt-text").addClass('ui-state-error'); 818 } else { 819 var response = $("#dle-promt-text").val() 820 $(this).dialog("close"); 821 $("#dlepopup").remove(); 822 if( callback ) callback( response ); 823 } 824 }; 825 826 $("#dlepopup").remove(); 827 828 $("body").append("<div id='dlepopup' title='" + title + "' style='display:none'><br />"+ message +"<br /><br /><input type='text' name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%; padding: .4em;' value='" + d + "'/></div>"); 829 830 $('#dlepopup').dialog({ 831 autoOpen: true, 832 width: 500, 833 dialogClass: "modalfixed", 834 buttons: b 835 }); 836 837 $('.modalfixed.ui-dialog').css({position:"fixed"}); 838 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 839 840 if (d.length > 0) { 841 $("#dle-promt-text").select().focus(); 842 } else { 843 $("#dle-promt-text").focus(); 844 } 845 846}; 847 848var dle_user_profile = ''; 849var dle_user_profile_link = ''; 850 851function ShowPopupProfile( r, allowedit ) 852{ 853 var b = {}; 854 855 b[menu_profile] = function() { 856 document.location=dle_user_profile_link; 857 }; 858 859 if (dle_group != 5) { 860 861 b[menu_send] = function() { 862 document.location=dle_root + 'index.php?do=pm&doaction=newpm&username=' + dle_user_profile; 863 }; 864 } 865 866 if (allowedit == 1) { 867 868 b[menu_uedit] = function() { 869 $(this).dialog("close"); 870 871 var b1 = {}; 872 873 $('body').append('<div id="modal-overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #666666; opacity: .40;filter:Alpha(Opacity=40); z-index: 999; display:none;"></div>'); 874 $('#modal-overlay').css({'filter' : 'alpha(opacity=40)'}).fadeIn('slow'); 875 876 $("#dleuserpopup").remove(); 877 $("body").append("<div id='dleuserpopup' title='"+menu_uedit+"' style='display:none'></div>"); 878 879 b1[dle_act_lang[3]] = function() { 880 $(this).dialog("close"); 881 $("#dleuserpopup").remove(); 882 }; 883 884 b1[dle_act_lang[4]] = function() { 885 document.getElementById('edituserframe').contentWindow.document.getElementById('saveuserform').submit(); 886 }; 887 888 $('#dleuserpopup').dialog({ 889 autoOpen: true, 890 show: 'fade', 891 width: 560, 892 height: 500, 893 dialogClass: "modalfixed", 894 buttons: b1, 895 open: function(event, ui) { 896 $("#dleuserpopup").html("<iframe name='edituserframe' id='edituserframe' width='100%' height='400' src='" + dle_root + dle_admin + "?mod=editusers&action=edituser&user=" + dle_user_profile + "&skin=" + dle_skin + "' frameborder='0' marginwidth='0' marginheight='0' allowtransparency='true'></iframe>"); 897 }, 898 beforeClose: function(event, ui) { 899 $("#dleuserpopup").html(""); 900 }, 901 close: function(event, ui) {
902 $('#modal-overlay').fadeOut('slow', function() { 903 $('#modal-overlay').remove(); 904 }); 905 } 906 }); 907 908 if ($(window).width() > 830 && $(window).height() > 530 ) { 909 $('.modalfixed.ui-dialog').css({position:"fixed"}); 910 $('#dleuserpopup').dialog( "option", "position", ['0','0'] ); 911 } 912 913 }; 914 915 } 916 917 $("#dleprofilepopup").remove(); 918 919 $("body").append(r); 920 921 $('#dleprofilepopup').dialog({ 922 autoOpen: true, 923 show: 'fade', 924 hide: 'fade', 925 buttons: b, 926 width: 450 927 }); 928 929 return false; 930}; 931 932function ShowProfile( name, url, allowedit ) 933{ 934 935 if (dle_user_profile == name && document.getElementById('dleprofilepopup')) {$('#dleprofilepopup').dialog('open');return false;} 936 937 dle_user_profile = name; 938 dle_user_profile_link = url; 939 940 ShowLoading(''); 941 942 $.get(dle_root + "engine/ajax/profile.php", { name: name, skin: dle_skin }, function(data){ 943 944 HideLoading(''); 945 946 ShowPopupProfile( data, allowedit ); 947 948 }); 949 950 951 return false; 952}; 953 954function FastSearch() 955{ 956 $('#story').attr('autocomplete', 'off'); 957 $('#story').blur(function(){ 958 $('#searchsuggestions').fadeOut(); 959 }); 960 961 $('#story').keyup(function() { 962 var inputString = $(this).val(); 963 964 if(inputString.length == 0) { 965 $('#searchsuggestions').fadeOut(); 966 } else { 967 968 if (dle_search_value != inputString && inputString.length > 3) { 969 clearInterval(dle_search_delay); 970 dle_search_delay = setInterval(function() { dle_do_search(inputString); }, 600); 971 } 972 973 } 974 975 }); 976}; 977 978function dle_do_search( inputString ) 979{ 980 clearInterval(dle_search_delay); 981 982 $('#searchsuggestions').remove(); 983 984 $("body").append("<div id='searchsuggestions' style='display:none'></div>"); 985 986 $.post(dle_root + "engine/ajax/search.php", {query: ""+inputString+""}, function(data) { 987 $('#searchsuggestions').html(data).fadeIn().css({'position' : 'absolute', top:0, left:0}).position({ 988 my: "left top", 989 at: "left bottom", 990 of: "#story", 991 collision: "fit flip" 992 }); 993 }); 994 995 dle_search_value = inputString; 996 997}; 998 999function ShowLoading( message ) 1000{ 1001 1002 if ( message ) 1003 { 1004 $("#loading-layer-text").html(message); 1005 } 1006 1007 var setX = ( $(window).width() - $("#loading-layer").width() ) / 2; 1008 var setY = ( $(window).height() - $("#loading-layer").height() ) / 2; 1009 1010 $("#loading-layer").css( { 1011 left : setX + "px", 1012 top : setY + "px", 1013 position : 'fixed', 1014 zIndex : '99' 1015 }); 1016 1017 $("#loading-layer").fadeTo('slow', 0.6); 1018 1019}; 1020 1021function HideLoading( message ) 1022{ 1023 $("#loading-layer").fadeOut('slow'); 1024}; 1025 1026function ShowAllVotes( ) 1027{ 1028 if (document.getElementById('dlevotespopup')) {$('#dlevotespopup').dialog('open');return false;} 1029 1030 $.ajaxSetup({ 1031 cache: false 1032 }); 1033 1034 ShowLoading(''); 1035 1036 $.get(dle_root + "engine/ajax/allvotes.php?dle_skin=" + dle_skin, function(data){ 1037 1038 HideLoading(''); 1039 $("#dlevotespopup").remove(); 1040 1041 $("body").append( data ); 1042 1043 $(".dlevotebutton").button(); 1044 1045 $('#dlevotespopup').dialog({ 1046 autoOpen: true, 1047 show: 'fade', 1048 hide: 'fade', 1049 width: 600, 1050 height: 150 1051 }); 1052 1053 if ($('#dlevotespopupcontent').height() > 400 ) { 1054 1055 $('#dlevotespopupcontent').height(400); 1056 $('#dlevotespopup').dialog( "option", "height", $('#dlevotespopupcontent').height() + 40 ); 1057 $('#dlevotespopup').dialog( "option", "position", 'center' ); 1058 } else { 1059 1060 $('#dlevotespopup').dialog( "option", "height", $('#dlevotespopupcontent').height() + 40 ); 1061 $('#dlevotespopup').dialog( "option", "position", 'center' ); 1062 1063 } 1064 1065 }); 1066 1067 return false; 1068}; 1069 1070function fast_vote( vote_id ) 1071{ 1072 var vote_check = $('#vote_' + vote_id + ' input:radio[name=vote_check]:checked').val(); 1073 1074 ShowLoading(''); 1075 1076 $.get(dle_root + "engine/ajax/vote.php", { vote_id: vote_id, vote_action: "vote", vote_mode: "fast_vote", vote_check: vote_check, vote_skin: dle_skin }, function(data){ 1077 1078 HideLoading(''); 1079 1080 $("#dle-vote_list-" + vote_id).fadeOut(500, function() { 1081 $(this).html(data); 1082 $(this).fadeIn(500); 1083 }); 1084 1085 }); 1086 1087 return false; 1088}; 1089 1090function AddIgnorePM( id, text ){ 1091 1092 DLEconfirm( text, dle_confirm, function () { 1093 1094 ShowLoading(''); 1095 1096 $.get(dle_root + "engine/ajax/pm.php", { id: id, action: "add_ignore", skin: dle_skin }, function(data){ 1097 1098 HideLoading(''); 1099 1100 DLEalert ( data, dle_info ); 1101 return false; 1102 1103 1104 }); 1105 1106 } ); 1107};
1108 1109function DelIgnorePM( id, text ){ 1110 1111 DLEconfirm( text, dle_confirm, function () { 1112 1113 ShowLoading(''); 1114 1115 $.get(dle_root + "engine/ajax/pm.php", { id: id, action: "del_ignore", skin: dle_skin }, function(data){ 1116 1117 HideLoading(''); 1118 1119 $("#dle-ignore-list-" + id).html(''); 1120 DLEalert ( data, dle_info ); 1121 return false; 1122 1123 1124 }); 1125 1126 } ); 1127}; 1128function dropdownmenu(obj, e, menucontents, menuwidth){ 1129 1130 if (window.event) event.cancelBubble=true; 1131 else if (e.stopPropagation) e.stopPropagation(); 1132 1133 var menudiv = $('#dropmenudiv'); 1134 1135 if (menudiv.is(':visible')) { clearhidemenu(); menudiv.fadeOut('fast'); return false; } 1136 1137 menudiv.remove(); 1138 1139 $('body').append('<div id="dropmenudiv" style="display:none;position:absolute;z-index:100;width:165px;"></div>'); 1140 1141 menudiv = $('#dropmenudiv'); 1142 1143 menudiv.html(menucontents.join("")); 1144 1145 if (menuwidth) menudiv.width(menuwidth); 1146 1147 var windowx = $(document).width() - 30; 1148 var offset = $(obj).offset(); 1149 1150 if (windowx-offset.left < menudiv.width()) 1151 offset.left = offset.left - (menudiv.width()-$(obj).width()); 1152 1153 menudiv.css( { 1154 left : offset.left + "px", 1155 top : offset.top+$(obj).height()+"px" 1156 }); 1157 1158 menudiv.fadeTo('fast', 0.9); 1159 1160 menudiv.mouseenter(function(){ 1161 clearhidemenu(); 1162 }).mouseleave(function(){ 1163 delayhidemenu(); 1164 }); 1165 1166 $(document).one("click", function() { 1167 hidemenu(); 1168 }); 1169 1170 return false; 1171}; 1172 1173function hidemenu(e){ 1174 $("#dropmenudiv").fadeOut("fast"); 1175}; 1176 1177function delayhidemenu(){ 1178 delayhide=setTimeout("hidemenu()",1000); 1179}; 1180 1181function clearhidemenu(){ 1182 1183 if (typeof delayhide!="undefined") 1184 clearTimeout(delayhide); 1185}; 1186 1187jQuery(function($){ 1188 $(document).keydown(function(event){ 1189 if (event.which == 13 && event.ctrlKey) { 1190 if (window.getSelection) { 1191 var selectedText = window.getSelection(); 1192 } 1193 else if (document.getSelection) { 1194 var selectedText = document.getSelection(); 1195 } 1196 else if (document.selection) { 1197 var selectedText = document.selection.createRange().text; 1198 } 1199 1200 if (selectedText == "" ) { return; } 1201 1202 if (selectedText.toString().length > 255 ) {if ($.browser.mozilla) { alert(dle_big_text); } else {DLEalert(dle_big_text, dle_info);} return;} 1203 1204 var b = {}; 1205 1206 b[dle_act_lang[3]] = function() { 1207 $(this).dialog('close'); 1208 }; 1209 1210 b[dle_p_send] = function() { 1211 if ( $('#dle-promt-text').val().length < 1) { 1212 $('#dle-promt-text').addClass('ui-state-error'); 1213 } else { 1214 var response = $('#dle-promt-text').val(); 1215 var selectedText = $('#orfom').text(); 1216 $(this).dialog('close'); 1217 1218 $('#dlepopup').remove(); 1219 1220 $.post(dle_root + 'engine/ajax/complaint.php', { seltext: selectedText, text: response, action: "orfo", url: window.location.href }, 1221 function(data){ 1222 if (data == 'ok') { if ($.browser.mozilla) { alert(dle_p_send_ok); } else { DLEalert(dle_p_send_ok, dle_info);} } else { if ($.browser.mozilla) { alert(data); } else { DLEalert(data, dle_info);} } 1223 }); 1224 1225 } 1226 }; 1227 1228 $('#dlepopup').remove(); 1229 1230 $('body').append("<div id='dlepopup' title='"+dle_orfo_title+"' style='display:none'><br /><textarea name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%;height:80px; padding: .4em;'></textarea><div id='orfom' style='display:none'>"+selectedText+"</div></div>"); 1231 1232 $('#dlepopup').dialog({ 1233 autoOpen: true, 1234 width: 550, 1235 dialogClass: "modalfixed", 1236 buttons: b 1237 }); 1238 1239 $('.modalfixed.ui-dialog').css({position:"fixed"}); 1240 $('#dlepopup').dialog( "option", "position", ['0','0'] ); 1241 1242 1243 }; 1244 }); 1245});
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.