1(function($) 2{ 3 $.Redactor.prototype.clips = function() 4 { 5 return { 6 init: function() 7 { 8 redactor_clips_plugin = this; 9 10 this.modal.addTemplate('clips', '<div class="modal-section">' + this.utils.getOuterHtml($('#clipsmodal #redactor_modal_content')) + '</div>'); 11 12 var button = this.button.add('clips', 'Clips'); 13 14 this.button.addCallback(button, this.clips.show); 15 16 }, 17 show: function() 18 { 19 this.modal.load('clips', 'Insert Clips', 1000); 20 21 $('#redactor-modal-body .clipsmodal_box').find('.redactor_clip_link').each($.proxy(this.clips.load, this)); 22 23 this.modal.show(); 24 }, 25 load: function(i,s) 26 { 27 $(s).on('click', $.proxy(function(e) 28 { 29 e.preventDefault(); 30 if ($(s).hasClass('page_target_clip')) { 31 var $clip = $(s).next(); 32 regex = new RegExp($(s).data('regex')); 33 if (regex.test(redactor_clips_plugin.code.get())) { 34 $clip.html($clip.data('match')); 35 } else { 36 $clip.html($clip.data('nomatch')); 37 } 38 } 39 //console.log($(s)); 40 this.clips.insert($(s).next().html()); 41 42 }, this)); 43 }, 44 insert: function(html) 45 { 46 var isCodeMode = this.$box.find(".CodeMirror").is(':visible'); 47 if (isCodeMode) { 48 var cm_box = this.$box.find(".CodeMirror")[0] 49 var cm = cm_box.CodeMirror; 50 cm.doc.replaceSelection(html); 51 $(cm_box).trigger('keyup'); 52 this.modal.close(); 53 return; 54 } 55 this.buffer.set(); 56 this.air.collapsedEnd(); 57 this.insert.html(html); 58 this.$toolbar.parents('.floatlabel-wrapper-redactor').find('.floatlabel-redactor').addClass('floatlabel-label-active floatlabel-label-focus').removeClass('floatlabel-label-inactive'); 59 this.modal.close(); 60 } 61 }; 62 }; 63})(jQuery); 64
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.