1// *** begin SpoiledComments 2jQuery.fn.spoil = function() { 3 return this.each(function(){ 4 $(this).addClass('spoiled').wrapInner('<div style="display:none;"></div>').children().hide().end() 5 .prepend('<a class="hide" href="javascript:void(0);">Spoiler</a>') 6 .children(':first').click(function(event){ 7 event.preventDefault(); 8 $(this).toggleClass('hide').siblings().slideToggle('fast'); 9 }); 10 }); 11}; 12 13if('function' === typeof onLoadComments) { 14 onLoadComments(function(data) { 15 $(data).find('div.spoiler').spoil(); 16 }); 17} else { 18 $(function(){ $('div.spoiler').spoil();}); 19} 20 21$(function() { 22 $('#comments-form').bind('form-pre-serialize', function(event, form, opt, veto) { 23 var depth = 0; 24 var a = []; 25 var text = form[0].text.value; 26 var tags = text.match(/<\/?(?:spoiler)>/g); 27 if(!tags) 28 return; 29 $.each(tags, function(i, val) { 30 if(this.match(/\//)) { 31 depth -= 1; 32 if(depth < 0) { 33 a.push(i); 34 return false; 35 } 36 a.pop(i); 37 } else { 38 depth += 1; 39 a.push(i); 40 } 41 }); 42 if(depth == 0) 43 return; 44 var prob = a.pop(); 45 var tag = tags[prob]; 46 var msg = 'unmatched ' + ((depth > 0) ? 'start' : 'end') + ' tag, "' 47 + tag.replace(/</, '<').replace(/>/, '>') + '"'; 48 var texts = text.split(/(<\/?(?:spoiler)>)/); 49 texts = $.map(texts, function(n, i) { 50 n = n.replace(/&/, '&').replace(/</, '<').replace(/>/, '>'); 51 return (i == 2*prob+1) ? '<span class="error-tag">' + n + '</span>' : n; 52 }); 53 texts = texts.join(''); 54 $('#comment-preview-box').html('<div class="comment-invalid"><p>Invalid Comment Format: '+ msg +'</p><pre>'+texts+'</pre></div>'); 55 xommentFormOkay(); 56 veto.veto = true; 57 }); 58}); 59// *** end SpoiledComments
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.