1$(document).ready(function(){ 2 3 $('.spoiler').each(function () { 4 5 var $this = $(this); 6 7 if( $this.parents( '.cke_wysiwyg_div' ).length ){ 8 return; 9 } 10 11 /* Hide the contents */ 12 $this.contents().hide(); 13 14 /* Do we have an existing citation block? (quotes from older versions won't, newer will) */ 15 var existingHeader = $this.children('.spoiler_title'); 16 17 var spTitle = existingHeader[0].innerText; 18 19 /* Build the header block */ 20 var header = '<div class=\'spoiler_title spoiler_closed\'>' + 21 '<a href=\'#\' data-action=\'toggleSpoiler\'> </a>' + 22 '<span>ÐоказаÑÑ</span>: <span>'+ spTitle +'</span></div>'; 23 /* Add or replace it */ 24 if ( existingHeader.length ) { 25 existingHeader.replaceWith( header ); 26 } else { 27 $this.prepend( header ); 28 } 29 30 $this.find('> .spoiler_body').append('<div class="spoiler_fold">[ÑвеÑнÑÑÑ]</div>'); 31 32 /* Set the event handler for opening/closing */ 33 $this.find('> .spoiler_title').on( 'click', _toggleSpoiler ); 34 }); 35 36 37 function _toggleSpoiler(e) { 38 var header = $( e.currentTarget ); 39 var target = $( e.target ); 40 var spoiler = $( e.target ).closest('[data-spoiler]'); 41 42 if( target.is('a:not( [data-action="toggleSpoiler"] )') || ( target.closest('a').length && !target.closest('a').is('[data-action="toggleSpoiler"]') ) ){ 43 return; 44 } 45 46 e.preventDefault(); 47 48 if( header.hasClass('spoiler_closed') ){ 49 header.siblings().fadeIn(300); 50 header.removeClass('spoiler_closed').addClass('spoiler_open').find('span').first().text( 'СкÑÑÑÑ' ); 51 $( document ).trigger('contentChange', [ spoiler ] ); 52 53 // In firefox, the frame will render because we show it for a split second, but the truncating used inside the frame 54 // won't work because it isn't visible. So, to get around that, we'll have to refresh the iframe here. 55 var iframes = spoiler.find('iframe[data-embedcontent]'); 56 57 if( iframes.length ){ 58 $.each( iframes, function () { 59 this.src = this.src; 60 }); 61 } 62 } else { 63 64 header.siblings().hide(); 65 header.removeClass('spoiler_open').addClass('spoiler_closed').find('span').first().text( 'ÐоказаÑÑ' ); 66 } 67 68 header.siblings().find('.spoiler_fold').on('click', function() { 69 header.siblings().hide(); 70 header.removeClass('spoiler_open').addClass('spoiler_closed').find('span').first().text( 'ÐоказаÑÑ' ); 71 }); 72 73 e.stopPropagation(); 74 } 75});
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.