/*globals jQuery:false Node:false */;(function(e){"use strict";var t="secretSource";e[t]=function(n,r){var i=e(n),s=i.data(t),o,u;if(s)return s;r=e.extend({},e[t].defaultOptions,r);o=e[t].getSource(i,r);u=e[t].wrap(i,o,r);u.insertAfter(i);s={original:i,source:o,display:u};i.data(t,s);return s};e[t].getSource=function(n,r){var i=r.includeTag?n[0].outerHTML:i=n.html();r.fixWhitespace&&(i=e[t].fixWhitespace(n,i,r));return i};e[t].fixWhitespace=function(n,r,i){r=e[t].fixWhitespace.trim(n,r,i);r=e[t].fixWhitespace.fixIndent(n,r,i);return r},e[t].fixWhitespace.trim=function(e,t,n){return t.replace(/^\s*\n|\n\s*$/g,"")},e[t].fixWhitespace.fixIndent=function(e,t,n){if(n.includeTag){var r=e.parent();if(r.length===0)return t;r.get(0).normalize();var i=e.get(0).previousSibling;if(!i||i.nodeType!==Node.TEXT_NODE)return t;var s=i.nodeValue.match(/\n\r?([ \t]+)$/);return s?t.replace(new RegExp("^"+s[1],"mg"),""):t}var o=t.match(/^\s+/);return o?t.replace(new RegExp("^"+o[0],"mg"),""):t},e[t].wrap=function(t,n,r){var i=e("<pre>").addClass(r.className),s=e("<code>").appendTo(i),o=t.data("language")||t.attr("type")||"";s.text(n);if(o){o="language-"+o.replace(/^.*\/(.*)$/,"$1");s.addClass(o)}return i};e[t].defaultOptions={className:"secret-source",includeTag:!1,fixWhitespace:!0};e.fn[t]=function(n){return this.map(function(){var r=e[t](this,n);return r.display})}})(jQuery);
|