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 event.preventDefault(); 32 let text = event.originalEvent.clipboardData.getData('text/plain').trim(); 33 console.info(text) 34 document.execCommand('insertText', false, text); 35 }).find('pre').each(function(){ 36 if (themeData.page.view != 'gridbox' && this.querySelector('code')) { 37 let span = document.createElement('span'); 38 span.className = 'ba-copy-to-clipboard'; 39 span.innerHTML = '<i class="ba-icons ba-icon-copy"></i><span class="ba-tooltip">'+ 40 app._('COPY_TO_CLIPBOARD')+'</span>'; 41 this.append(span); 42 } 43 }); 44 initItems(); 45} 46 47if (app.modules.initText) { 48 app.initText(app.modules.initText.data, app.modules.initText.selector); 49}
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.