1(function ($) { 2 // Change images. 3 var emojione = window.emojione; 4 emojione.imagePathPNG = typeof _wpemojiSettings !== 'undefined' ? _wpemojiSettings.baseUrl : 'https://s.w.org/images/core/emoji/12.0.0-1/72x72/'; 5 emojione.imagePathSVG = typeof _wpemojiSettings !== 'undefined' ? _wpemojiSettings.svgUrl : 'https://s.w.org/images/core/emoji/12.0.0-1/svg/'; 6 7 var placeCaretAtEnd = createCaretPlacer(false); 8 9 $(document).ready(function () { 10 11 // for activity post. 12 $('#whats-new').emojioneArea({ 13 standalone: true, 14 hideSource: false, 15 container: '#bp-activity-post-options .bp-emoji-action', 16 autocomplete: false, 17 pickerPosition: 'bottom', 18 useInternalCDN: false, 19 events: { 20 'picker.show': function (picker) { 21 placeCaretAtEnd($('#whats-new')); 22 } 23 } 24 }); 25 26 // hide on blur. 27 $(document).on('focusout', '#whats-new', function (e) { 28 var picker = $(this)[0].emojioneArea.hidePicker(); 29 if ('undefined' !== picker) { 30 picker.hidePicker(); 31 } 32 }); 33 34 // Activity comments 35 $(document).on('activity:reply:form:visible', function (evt, $ac, activity_id) { 36 var $input =$('#ac-input-' + activity_id); 37 if ('undefined' !== typeof $input.data('emojioneArea')) { 38 return; 39 } 40 $input.emojioneArea({ 41 standalone: true, 42 hideSource: false, 43 container: '#bp-ac-comment-options-emoji-action-' + activity_id, 44 autocomplete: false, 45 pickerPosition: 'bottom', 46 hidePickerOnBlur: true, 47 useInternalCDN: false, 48 events: { 49 'picker.show': function (picker) { 50 placeCaretAtEnd( $ac.find('.ac-input')); 51 } 52 } 53 }); 54 }); 55 56 // comment focus out. 57 $(document).on('focusout', '.ac-input', function (e) { 58 var picker = $(this)[0].emojioneArea.hidePicker(); 59 if ('undefined' !== picker) { 60 picker.hidePicker(); 61 } 62 }); 63 }); 64 65 // Utils. 66 // Credit: http://stackoverflow.com/a/4238971/96100 67 function createCaretPlacer(atStart) { 68 return function ($el) { 69 if ($el.is(':focus')) { 70 return;// already focused, do not change. 71 } else { 72 $el.focus(); 73 } 74 75 var el = $el[0]; 76 if (typeof window.getSelection !== 'undefined' && typeof document.createRange !== 'undefined') { 77 var range = document.createRange(); 78 range.selectNodeContents(el); 79 range.collapse(atStart); 80 var sel = window.getSelection(); 81 sel.removeAllRanges(); 82 sel.addRange(range); 83 } else if (typeof document.body.createTextRange !== 'undefined') { 84 var textRange = document.body.createTextRange(); 85 textRange.moveToElementText(el); 86 textRange.collapse(atStart); 87 textRange.select(); 88 } 89 }; 90 } 91})(jQuery);
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.