1/** 2* @package Gridbox 3* @author Balbooa http://www.balbooa.com/ 4* @copyright Copyright @ Balbooa 5* @license http://www.gnu.org/licenses/gpl.html GNU/GPL 6*/ 7 8app.initText = function(obj, key){ 9 $g('#'+key).on('click', 'a[href]', function(event){ 10 if (this.hash && this.href == window.location.href.replace(window.location.hash, '')+this.hash) { 11 let target = $g(this.hash+', [name="'+this.hash.replace('#', '')+'"]'); 12 if (target.length) { 13 event.preventDefault(); 14 window.history.replaceState(null, null, this.href); 15 let position = window.compileOnePageValue ? compileOnePageValue(target) : target.offset().top; 16 $g('html, body').stop().animate({ 17 scrollTop: position 18 }, 500); 19 } 20 } 21 }).on('click', '.ba-copy-to-clipboard', function(event){ 22 var textarea = document.createElement('textarea'), 23 text = this.closest('pre').querySelector('code').textContent; 24 document.body.appendChild(textarea); 25 textarea.value = text; 26 textarea.select() 27 document.execCommand('copy'); 28 textarea.remove(); 29 app.showNotice(app._('SUCCESSFULLY_COPIED_TO_CLIPBOARD')); 30 }).on('paste', function(event){ 31 if (!this.querySelector('.content-text').classList.contains('cke_editable_inline')) { 32 event.preventDefault(); 33 let text = event.originalEvent.clipboardData.getData('text/plain').trim(); 34 document.execCommand('insertText', false, text); 35 } 36 }).find('pre').each(function(){ 37 if (themeData.page.view != 'gridbox' && this.querySelector('code')) { 38 let span = document.createElement('span'); 39 span.className = 'ba-copy-to-clipboard'; 40 span.innerHTML = '<i class="ba-icons ba-icon-copy"></i><span class="ba-tooltip">'+ 41 app._('COPY_TO_CLIPBOARD')+'</span>'; 42 this.append(span); 43 } 44 }); 45 initItems(); 46} 47 48if (app.modules.initText) { 49 app.initText(app.modules.initText.data, app.modules.initText.selector); 50}
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.