1$(document).ready( 2 function () { 3 var edit = document.getElementById("edit"); 4 5 if (edit) { 6 // Setup editor 7 var editPost = document.getElementById("Content"); 8 9 tinymce.init({ 10 selector: '#Content', 11 autoresize_min_height: 200, 12 plugins: 'autosave preview searchreplace visualchars image link media fullscreen code table hr pagebreak autoresize nonbreaking anchor insertdatetime advlist lists textcolor wordcount imagetools colorpicker', 13 menubar: "edit view format insert table", 14 toolbar1: 'formatselect | bold italic blockquote forecolor backcolor | imageupload link | alignleft aligncenter alignright | numlist bullist outdent indent | fullscreen', 15 selection_toolbar: 'bold italic | quicklink h2 h3 blockquote', 16 autoresize_bottom_margin: 0, 17 paste_data_images: true, 18 image_advtab: true, 19 file_picker_types: 'image', 20 relative_urls: false, 21 convert_urls: false, 22 branding: false, 23 24 setup: function (editor) { 25 editor.addButton('imageupload', { 26 icon: "image", 27 onclick: function () { 28 var fileInput = document.createElement("input"); 29 fileInput.type = "file"; 30 fileInput.multiple = true; 31 fileInput.accept = "image/*"; 32 fileInput.addEventListener("change", handleFileSelect, false); 33 fileInput.click(); 34 } 35 }); 36 37 } 38 }); 39 40 // Delete post 41 var deleteButton = edit.querySelector(".delete"); 42 if (deleteButton) { 43 deleteButton.addEventListener("click", function (e) { 44 if (!confirm("Are you sure you want to delete the post?")) { 45 e.preventDefault(); 46 } 47 }); 48 } 49 50 // File upload 51 function handleFileSelect(event) { 52 if (window.File && window.FileList && window.FileReader) { 53 54 var files = event.target.files; 55 56 for (var i = 0; i < files.length; i++) { 57 var file = files[i]; 58 59 // Only image uploads supported 60 if (!file.type.match('image')) 61 continue; 62 63 var reader = new FileReader(); 64 reader.addEventListener("load", function (event) { 65 var image = new Image(); 66 image.alt = file.name; 67 image.onload = function (e) { 68 image.setAttribute("data-filename", file.name); 69 image.setAttribute("width", image.width); 70 image.setAttribute("height", image.height); 71 tinymce.activeEditor.execCommand('mceInsertContent', false, image.outerHTML); 72 }; 73 image.src = this.result; 74 75 }); 76 77 reader.readAsDataURL(file); 78 } 79 80 document.body.removeChild(event.target); 81 } 82 else { 83 console.log("Your browser does not support File API"); 84 } 85 } 86 } 87 88 // Delete comments 89 var deleteLinks = document.querySelectorAll("#comments a.delete"); 90 91 for (var i = 0; i < deleteLinks.length; i++) { 92 var link = deleteLinks[i]; 93 94 link.addEventListener("click", function (e) { 95 if (!confirm("Are you sure you want to delete the comment?")) { 96 e.preventDefault(); 97 } 98 }); 99 } 100});
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.