1/*! 2 * Finnish Hyhpenator 3 * 4 * Tavuttajan tavoite on helppokäyttöinen ja kevyt selainpuolen 5 * tekstien tavutus. Scriptin tarkoitus ei ole olla täydellinen 6 * tavuttaja, vaan tavuttaa varmimmat tapaukset. Mielummin 7 * tavuttaja jättää tavuttamatta kuin tavuttaa epävarman paikan. 8 * 9 * 10 * Hyphenation rules: 11 * 12 * [1] Tavuraja on aina konsonantin ja vokaalin yhdistelmän edellä 13 * http://www.kotus.fi/index.phtml?s=4363, Hakupäivä 10.6.2014 14 * 15 * 16 * - Alle kahden merkin tavuja ei tehdä 17 * 18 * Author: Veikko Karsikko 19 */ 20;(function(window){function FinnishHyphenator(){this.vowels="aeiouyåäö";this.consonants="bcdfghjklmnpqrstvwxyz";this.hyphMark="\u00AD";this.rule1RegExp=new RegExp("["+this.consonants+"]["+this.vowels+"]","gi");this.endReg=new RegExp("["+this.consonants+this.vowels+"]{2}$","i");this.wrapperElement=document.createElement("div")} 21FinnishHyphenator.prototype.addHyphen=function(text,idx){var firstPart=text.slice(0,idx);if(this.endReg.exec(firstPart)){return(text.slice(0,idx)+this.hyphMark+text.slice(idx))}else{return!1}};FinnishHyphenator.prototype.hyphenateElement=function(el){for(var i=0;i<el.childNodes.length;i++){var node=el.childNodes[i];if(node.nodeType===3){node.data=this.hyphenateText(node.textContent)}else{this.hyphenateElement(node)}}};FinnishHyphenator.prototype.hyphenateElements=function(els){for(var i=0;i<els.length;i++){this.hyphenateElement(els[i])}};FinnishHyphenator.prototype.hyphenateText=function(text){var hyphenated=text;var hyphPositions=[];while((match=this.rule1RegExp.exec(text))!=null){hyphPositions.push(match.index)} 22var count=0;for(var i=0;i<hyphPositions.length;i++){var position=hyphPositions[i]+count*this.hyphMark.length;var triedHyphenation=this.addHyphen(hyphenated,position);if(triedHyphenation!==!1){count++;hyphenated=triedHyphenation}} 23return hyphenated};window.FinnishHyphenator=FinnishHyphenator})(window); 24/*! 25 * Jquery Plugin for Finnish Hyphenator 26 * 27 * Requires finnish hyphenator class 28 * 29 * Author: Veikko Karsikko 30 */ 31;(function($,window,document,FinnishHyphenator,undefined){var pluginName="finnishHyphenator";var finnishHyphenator=null;function Plugin(element){if(!finnishHyphenator){finnishHyphenator=new FinnishHyphenator()} 32this.element=element;this._name=pluginName;this.init()} 33$.extend(Plugin.prototype,{init:function(){finnishHyphenator.hyphenateElement(this.element)}});$.fn[pluginName]=function(options){this.each(function(){if(!$.data(this,"plugin_"+pluginName)){$.data(this,"plugin_"+pluginName,new Plugin(this,options))}});return this}})(jQuery,window,document,FinnishHyphenator) 34;
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.