forked from aristus/sweet-justice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sweet-justice.min.js
1 lines (1 loc) · 3.88 KB
/
sweet-justice.min.js
1
!function(){var h=6;var p={code:true,pre:true,abbr:true};function b(v){var c=v.childNodes;for(var e=0;e<c.length;e++){var y=c[e];switch(y.nodeType){case 3:y.nodeValue=d(y.nodeValue);break;case 1:if(!p[y.nodeName.toLowerCase()]&&y.className.indexOf("justice-denied")===-1){b(y)}break}}}var t=/[ \s\n\r\v\t]+/;function d(v){var e=v.split(t);for(var c=0;c<e.length;c++){if(n(e[c])){e[c]=q(e[c])}}return e.join(" ")}function n(c){return(/\w{6,}/.test(c))&&(!/^[0-9\&]|@|\-|\u00AD/.test(c))}var x="aeiouyAEIOUYẚÁáÀàĂăẮắẰằẴẵẲẳÂâẤấẦầẪẫẨẩǍǎÅåǺǻÄäǞǟÃãȦȧǠǡĄąĀāẢảȀȁȂȃẠạẶặẬậḀḁȺⱥǼǽǢǣÉƏƎǝéÈèĔĕÊêẾếỀềỄễỂểĚěËëẼẽĖėȨȩḜḝĘęĒēḖḗḔḕẺẻȄȅȆȇẸẹỆệḘḙḚḛɆɇɚɝÍíÌìĬĭÎîǏǐÏïḮḯĨĩİiĮįĪīỈỉȈȉȊȋỊịḬḭIıƗɨÓóÒòŎŏÔôỐốỒồỖỗỔổǑǒÖöȪȫŐőÕõṌṍṎṏȬȭȮȯȰȱØøǾǿǪǫǬǭŌōṒṓṐṑỎỏȌȍȎȏƠơỚớỜờỠỡỞởỢợỌọỘộƟɵÚúÙùŬŭÛûǓǔŮůÜüǗǘǛǜǙǚǕǖŰűŨũṸṹŲųŪūṺṻỦủȔȕȖȗƯưỨứỪừỮữỬửỰựỤụṲṳṶṷṴṵɄʉÝýỲỳŶŷY̊ẙŸÿỸỹẎẏȲȳỶỷỴỵʏɎɏƳƴ";var w="[^"+x+"]";var k="["+x+"]";var l=new RegExp("("+k+w+")("+w+k+")","g");var o=new RegExp("(.{2,4}"+k+")("+w+")","g");var m=/\u00AD(.?)|$\u00AD(.{0,2}\w+)$/;function a(c){return c.replace(l,"$1\u00AD$2").replace(o,"$1\u00AD$2").replace(m,"$1")}var g=/^(\W*)(anti|auto|ab|an|ax|al|as|bi|bet|be|contra|cat|cath|cir|cum|cog|col|com|con|cor|could|co|desk|de|dis|did|dif|di|eas|every|ever|extra|ex|end|en|em|epi|evi|func|fund|fin|hyst|hy|han|il|in|im|ir|just|jus|loc|lig|lit|li|mech|manu|man|mal|mis|mid|mono|multi|mem|micro|non|nano|ob|oc|of|opt|op|over|para|per|post|pre|peo|pro|retro|rea|re|rhy|should|some|semi|sen|sol|sub|suc|suf|super|sup|sur|sus|syn|sym|syl|tech|trans|tri|typo|type|uni|un|van|vert|with|would|won)?(.*?)(weens?|widths?|icals?|ables?|ings?|tions?|ions?|ies|isms?|ists?|ful|ness|ments?|ly|ify|ize|ise|ity|en|ers?|ences?|tures?|ples?|als?|phy|puts?|phies|ry|ries|cy|cies|mums?|ous|cents?)?(\W*)$/i;function q(v){var e=g.exec(v);var c=[];if(e[2]){c.push(e[2])}if(e[3]){c.push(e[3].replace(l,"$1\u00AD$2"))}if(e[4]){c.push(e[4])}return(e[1]||"")+c.join("\u00AD")+(e[5]||"")}function i(A){var v=document.getElementsByTagName("body")[0];var y=/(?:\u00AD|\­|\­)/g;var B=document.createElement("div");B.style.overflow="hidden";B.style.position="absolute";B.style.top="-5000px";B.style.height="1px";v.appendChild(B);if(typeof window.getSelection!=="undefined"){sel=window.getSelection();var z=sel.getRangeAt(0);B.appendChild(z.cloneContents());B.innerHTML=B.innerHTML.replace(y,"");sel.selectAllChildren(B);window.setTimeout(function(){B.parentNode.removeChild(B);if(typeof window.getSelection().setBaseAndExtent!=="undefined"){sel.setBaseAndExtent(z.startContainer,z.startOffset,z.endContainer,z.endOffset)}},0)}else{sel=document.selection;var z=sel.createRange();B.innerHTML=z.htmlText.replace(y,"");var c=v.createTextRange();c.moveToElementText(B);c.select();window.setTimeout(function(){B.parentNode.removeChild(B);if(z.text!==""){z.select()}},0)}return}function f(){jQuery(".sweet-justice, .sweet-hyphens").each(function(c,e){b(e)});jQuery("body").bind("copy",i)}function s(c){c.all(".sweet-justice, .sweet-hyphens").each(function(e){b(c.Node.getDOMNode(e))});c.Node.DOM_EVENTS.copy=1;c.one("body").on("copy",i)}try{var r=document.createElement("style");r.type="text/css";var j=".sweet-justice {text-align:justify;text-justify:distribute} .justice-denied {text-align:left;text-justify:normal}";if(!!(window.attachEvent&&!window.opera)){r.styleSheet.cssText=j}else{r.appendChild(document.createTextNode(j))}document.getElementsByTagName("head")[0].appendChild(r)}catch(u){}if(window.jQuery){jQuery(window).load(f)}else{if(window.YUI){YUI().use("node",function(c){s(c)})}}}();