1 2function sendFile(file, editor) { 3 data = new FormData(); 4 data.append("file", file); 5 data.append("_token", $('#token').val()); 6 $.ajax({ 7 data: data, 8 type: "POST", 9 url: '/upload/image', 10 cache: false, 11 contentType: false, 12 processData: false, 13 success: function(url) { 14 $(editor).summernote('editor.insertImage', url); 15 } 16 }); 17} 18 19function articleEditSummernote(editor_selector) { 20 21 var editLocalStorage = localStorage; 22 $('.copy_fragment').each(function(){ 23 var link = $(this); 24 link.click(function(e){ 25 e.preventDefault(); 26 var fragment_id = link.attr('rel'); 27 editLocalStorage.setItem('last_fragment_id', fragment_id); 28 }); 29 }); 30 31 var editor = $(editor_selector); 32 editor.summernote({ 33 height: 400, 34 focus: false, 35 fontNames: ['Arial','Roboto Slab','Slabo 27px'], 36 callbacks : { 37 onImageUpload: function(files) { 38 sendFile(files[0],this); 39 }, 40 onInit: function(){ 41 42 var style = $(".note-editable.panel-body").attr('style'); 43 $(".note-editable.panel-body").attr("style", style + " font-family: 'Slabo 27px', serif;font-size: 17px;"); 44 45 // Add "open" - "save" buttons 46 var noteBtn = '<button id="makeSnote" type="button" class="btn btn-default btn-sm btn-small" data-event="something" tabindex="-1"><i class="fa fa-file-text "></i></button>'; 47 var fileGroup = '<div class="note-file btn-group">' + noteBtn + '</div>'; 48 $(fileGroup).appendTo($('.note-toolbar')); 49 // Button tooltips 50 $('#makeSnote').tooltip({container: 'body', placement: 'bottom'}); 51 // Button events 52 $('#makeSnote').click(function(event) { 53 var fragment_id = editLocalStorage.getItem('last_fragment_id'); 54 55 var range = window.getSelection().getRangeAt(0); 56 var node = $(range.commonAncestorContainer); 57 58 if (node.parent().is('span')) { 59 node.unwrap(); 60 } 61 62 $('span.fragment_id_' + fragment_id).each(function(){ 63 $(this).replaceWith(this.childNodes); 64 }); 65 66 var color = getRandomColor(); 67 68 node = $('<span style="color:' + color + '" rel="' + fragment_id + '" class="fragment_id fragment_id_' + fragment_id + '" />')[0]; 69 $('.copy_fragment_' + fragment_id ).prev().prev().css('background-color', color ).css('font-weight','bold'); 70 71 range.surroundContents(node); 72 73 // a hack to force a save event 74 editor.summernote('editor.insertText', ''); 75 }); 76 } 77 } 78 }); 79} 80 81function getRandomColor() { 82 var letters = '0123456789ABCDEF'; 83 var color = '#'; 84 for (var i = 0; i < 6; i++ ) { 85 color += letters[Math.floor(Math.random() * 16)]; 86 } 87 return color; 88} 89 90function contentEditSummernote(editor_selector) { 91 var editor = $(editor_selector); 92 editor.summernote({ 93 height: 300, 94 focus: false, 95 fontNames: ['Arial','Roboto Slab','Slabo 27px'], 96 callbacks : { 97 onInit: function() { 98 var style = $(".note-editable.panel-body").attr('style'); 99 $(".note-editable.panel-body").attr("style", style + " font-family: 'Slabo 27px', serif;font-size: 17px;"); 100 }, 101 onImageUpload: function(files) { 102 sendFile(files[0],this); 103 }, 104 } 105 }); 106} 107 108function getParameterByName(name) { 109 var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); 110 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); 111} 112
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.