<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://consolidatedpower.co/~donald/zero/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3ACommon.js</id>
	<title>MediaWiki:Common.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://consolidatedpower.co/~donald/zero/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3ACommon.js"/>
	<link rel="alternate" type="text/html" href="https://consolidatedpower.co/~donald/zero/index.php?title=MediaWiki:Common.js&amp;action=history"/>
	<updated>2026-05-03T16:44:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://consolidatedpower.co/~donald/zero/index.php?title=MediaWiki:Common.js&amp;diff=2679&amp;oldid=prev</id>
		<title>Eli: Replaced content with &quot;/* Any JavaScript here will be loaded for all users on every page load. */&quot;</title>
		<link rel="alternate" type="text/html" href="https://consolidatedpower.co/~donald/zero/index.php?title=MediaWiki:Common.js&amp;diff=2679&amp;oldid=prev"/>
		<updated>2020-01-14T14:53:33Z</updated>

		<summary type="html">&lt;p&gt;Replaced content with &amp;quot;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Any JavaScript here will be loaded for all users on every page load.: &lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 14:53, 14 January 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/* Any JavaScript here will be loaded for all users on every page load. */&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/* Any JavaScript here will be loaded for all users on every page load. */&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/* https://github.com/adobe/balance-text */&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(function(root,factory){if(typeof define===&amp;quot;function&amp;quot;&amp;amp;&amp;amp;define.amd){define([],factory)}else if(typeof module===&amp;quot;object&amp;quot;&amp;amp;&amp;amp;module.exports){module.exports=factory()}else{root.balanceText=factory()}})(this,()=&amp;gt;{let breakMatches,wsnwMatches,wsnwOffset;const watching={sel:[],el:[]};let handlersInitialized=false;let polyfilled=false;function noop(){}function forEach(elements,callback){Array.prototype.forEach.call(elements,callback)}function ready(fn){if(document.readyState!==&amp;quot;loading&amp;quot;){fn()}else if(document.addEventListener){document.addEventListener(&amp;quot;DOMContentLoaded&amp;quot;,fn)}else{document.attachEvent(&amp;quot;onreadystatechange&amp;quot;,()=&amp;gt;{if(document.readyState!==&amp;quot;loading&amp;quot;){fn()}})}}function debounce(func,threshold,execAsap,...args){let timeout;return function(){const obj=this;function delayed(){if(!execAsap){func.apply(obj,args)}timeout=null}if(timeout){clearTimeout(timeout)}else if(execAsap){func.apply(obj,args)}timeout=setTimeout(delayed,threshold||100)}}function hasTextWrap(){if(typeof window===&amp;quot;undefined&amp;quot;){return false}const{style:style}=document.documentElement;return style.textWrap||style.WebkitTextWrap||style.MozTextWrap||style.MsTextWrap}function NextWS_params(){this.reset()}NextWS_params.prototype.reset=function(){this.index=0;this.width=0};function isWhiteSpaceNoWrap(index){return wsnwMatches.some(range=&amp;gt;range.start&amp;lt;index&amp;amp;&amp;amp;index&amp;lt;range.end)}function recursiveCalcNoWrapOffsetsForLine(el,includeTag){if(el.nodeType===el.ELEMENT_NODE){const style=window.getComputedStyle(el);if(style.whiteSpace===&amp;quot;nowrap&amp;quot;){const len=el.outerHTML.length;wsnwMatches.push({start:wsnwOffset,end:wsnwOffset+len});wsnwOffset+=len}else{forEach(el.childNodes,child=&amp;gt;{recursiveCalcNoWrapOffsetsForLine(child,true)});if(includeTag){wsnwOffset+=el.outerHTML.length-el.innerHTML.length}}}else if(el.nodeType===el.COMMENT_NODE){wsnwOffset+=el.length+7}else if(el.nodeType===el.PROCESSING_INSTRUCTION_NODE){wsnwOffset+=el.length+2}else{wsnwOffset+=el.length}}function calcNoWrapOffsetsForLine(el,oldWS,lineCharOffset){if(lineCharOffset===0){el.style.whiteSpace=oldWS;wsnwOffset=0;wsnwMatches=[];recursiveCalcNoWrapOffsetsForLine(el,false);el.style.whiteSpace=&amp;quot;nowrap&amp;quot;}else{const newMatches=[];wsnwMatches.forEach(match=&amp;gt;{if(match.start&amp;gt;lineCharOffset){newMatches.push({start:match.start-lineCharOffset,end:match.end-lineCharOffset})}});wsnwMatches=newMatches}}function removeTags(el){let brs=el.querySelectorAll('br[data-owner=&amp;quot;balance-text-hyphen&amp;quot;]');forEach(brs,br=&amp;gt;{br.outerHTML=&amp;quot;&amp;quot;});brs=el.querySelectorAll('br[data-owner=&amp;quot;balance-text&amp;quot;]');forEach(brs,br=&amp;gt;{br.outerHTML=&amp;quot; &amp;quot;});let spans=el.querySelectorAll('span[data-owner=&amp;quot;balance-text-softhyphen&amp;quot;]');if(spans.length&amp;gt;0){forEach(spans,span=&amp;gt;{const textNode=document.createTextNode(&amp;quot;­&amp;quot;);span.parentNode.insertBefore(textNode,span);span.parentNode.removeChild(span)})}spans=el.querySelectorAll('span[data-owner=&amp;quot;balance-text-justify&amp;quot;]');if(spans.length&amp;gt;0){let txt=&amp;quot;&amp;quot;;forEach(spans,span=&amp;gt;{txt+=span.textContent;span.parentNode.removeChild(span)});el.innerHTML=txt}}const isJustified=function(el){const style=el.currentStyle||window.getComputedStyle(el,null);return style.textAlign===&amp;quot;justify&amp;quot;};function justify(el,txt,conWidth){txt=txt.trim();const words=txt.split(&amp;quot; &amp;quot;).length;txt=`${txt} `;if(words&amp;lt;2){return txt}const tmp=document.createElement(&amp;quot;span&amp;quot;);tmp.innerHTML=txt;el.appendChild(tmp);const size=tmp.offsetWidth;tmp.parentNode.removeChild(tmp);const wordSpacing=Math.floor((conWidth-size)/(words-1));tmp.style.wordSpacing=`${wordSpacing}px`;tmp.setAttribute(&amp;quot;data-owner&amp;quot;,&amp;quot;balance-text-justify&amp;quot;);const div=document.createElement(&amp;quot;div&amp;quot;);div.appendChild(tmp);return div.innerHTML}function isBreakChar(txt,index){const re=/([^\S\u00a0]|-|\u2014|\u2013|\u00ad)(?![^&amp;lt;]*&amp;gt;)/g;let match;if(!breakMatches){breakMatches=[];match=re.exec(txt);while(match!==null){if(!isWhiteSpaceNoWrap(match.index)){breakMatches.push(match.index)}match=re.exec(txt)}}return breakMatches.indexOf(index)!==-1}function isBreakOpportunity(txt,index){return index===0||index===txt.length||isBreakChar(txt,index-1)&amp;amp;&amp;amp;!isBreakChar(txt,index)}function findBreakOpportunity(el,txt,conWidth,desWidth,dir,c,ret){let w;if(txt&amp;amp;&amp;amp;typeof txt===&amp;quot;string&amp;quot;){for(;;){while(!isBreakOpportunity(txt,c)){c+=dir}el.innerHTML=txt.substr(0,c);w=el.offsetWidth;if(dir&amp;lt;0){if(w&amp;lt;=desWidth||w&amp;lt;=0||c===0){break}}else if(desWidth&amp;lt;=w||conWidth&amp;lt;=w||c===txt.length){break}c+=dir}}ret.index=c;ret.width=w}function getSpaceWidth(el,h){const container=document.createElement(&amp;quot;div&amp;quot;);container.style.display=&amp;quot;block&amp;quot;;container.style.position=&amp;quot;absolute&amp;quot;;container.style.bottom=0;container.style.right=0;container.style.width=0;container.style.height=0;container.style.margin=0;container.style.padding=0;container.style.visibility=&amp;quot;hidden&amp;quot;;container.style.overflow=&amp;quot;hidden&amp;quot;;const space=document.createElement(&amp;quot;span&amp;quot;);space.style.fontSize=&amp;quot;2000px&amp;quot;;space.innerHTML=&amp;quot;&amp;amp;nbsp;&amp;quot;;container.appendChild(space);el.appendChild(container);const dims=space.getBoundingClientRect();container.parentNode.removeChild(container);const spaceRatio=dims.height/dims.width;return h/spaceRatio}function getElementsList(elements){if(!elements){return[]}if(typeof elements===&amp;quot;string&amp;quot;){return document.querySelectorAll(elements)}if(elements.tagName&amp;amp;&amp;amp;elements.querySelectorAll){return[elements]}return elements}function balanceText(elements){forEach(getElementsList(elements),el=&amp;gt;{const maxTextWidth=5e3;removeTags(el);const oldWS=el.style.whiteSpace;const oldFloat=el.style.float;const oldDisplay=el.style.display;const oldPosition=el.style.position;const oldLH=el.style.lineHeight;el.style.lineHeight=&amp;quot;normal&amp;quot;;const containerWidth=el.offsetWidth;const containerHeight=el.offsetHeight;el.style.whiteSpace=&amp;quot;nowrap&amp;quot;;el.style.float=&amp;quot;none&amp;quot;;el.style.display=&amp;quot;inline&amp;quot;;el.style.position=&amp;quot;static&amp;quot;;let nowrapWidth=el.offsetWidth;const nowrapHeight=el.offsetHeight;const spaceWidth=oldWS===&amp;quot;pre-wrap&amp;quot;?0:getSpaceWidth(el,nowrapHeight);if(containerWidth&amp;gt;0&amp;amp;&amp;amp;nowrapWidth&amp;gt;containerWidth&amp;amp;&amp;amp;nowrapWidth&amp;lt;maxTextWidth){let remainingText=el.innerHTML;let newText=&amp;quot;&amp;quot;;let lineText=&amp;quot;&amp;quot;;const shouldJustify=isJustified(el);const totLines=Math.round(containerHeight/nowrapHeight);let remLines=totLines;let lineCharOffset=0;let desiredWidth,guessIndex,le,ge,splitIndex,isHyphen,isSoftHyphen;while(remLines&amp;gt;1){breakMatches=null;calcNoWrapOffsetsForLine(el,oldWS,lineCharOffset);desiredWidth=Math.round((nowrapWidth+spaceWidth)/remLines-spaceWidth);guessIndex=Math.round((remainingText.length+1)/remLines)-1;le=new NextWS_params;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,-1,guessIndex,le);ge=new NextWS_params;guessIndex=le.index;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,+1,guessIndex,ge);le.reset();guessIndex=ge.index;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,-1,guessIndex,le);if(le.index===0){splitIndex=ge.index}else if(containerWidth&amp;lt;ge.width||le.index===ge.index){splitIndex=le.index}else{splitIndex=Math.abs(desiredWidth-le.width)&amp;lt;Math.abs(ge.width-desiredWidth)?le.index:ge.index}lineText=remainingText.substr(0,splitIndex).replace(/\s$/,&amp;quot;&amp;quot;);isSoftHyphen=Boolean(lineText.match(/\u00ad$/));if(isSoftHyphen){lineText=lineText.replace(/\u00ad$/,'&amp;lt;span data-owner=&amp;quot;balance-text-softhyphen&amp;quot;&amp;gt;-&amp;lt;/span&amp;gt;')}if(shouldJustify){newText+=justify(el,lineText,containerWidth)}else{newText+=lineText;isHyphen=isSoftHyphen||Boolean(lineText.match(/(-|\u2014|\u2013)$/));newText+=isHyphen?'&amp;lt;br data-owner=&amp;quot;balance-text-hyphen&amp;quot; /&amp;gt;':'&amp;lt;br data-owner=&amp;quot;balance-text&amp;quot; /&amp;gt;'}remainingText=remainingText.substr(splitIndex);lineCharOffset=splitIndex;remLines--;el.innerHTML=remainingText;nowrapWidth=el.offsetWidth}if(shouldJustify){el.innerHTML=newText+justify(el,remainingText,containerWidth)}else{el.innerHTML=newText+remainingText}}el.style.whiteSpace=oldWS;el.style.float=oldFloat;el.style.display=oldDisplay;el.style.position=oldPosition;el.style.lineHeight=oldLH})}function updateWatched(){const selectors=watching.sel.join(&amp;quot;,&amp;quot;);const selectedElements=getElementsList(selectors);const elements=Array.prototype.concat.apply(watching.el,selectedElements);balanceText(elements)}function initHandlers(){if(handlersInitialized){return}ready(updateWatched);window.addEventListener(&amp;quot;load&amp;quot;,updateWatched);window.addEventListener(&amp;quot;resize&amp;quot;,debounce(updateWatched));handlersInitialized=true}function balanceTextAndWatch(elements){if(typeof elements===&amp;quot;string&amp;quot;){watching.sel.push(elements)}else{forEach(getElementsList(elements),el=&amp;gt;{watching.el.push(el)})}initHandlers();updateWatched()}function unwatch(elements){if(typeof elements===&amp;quot;string&amp;quot;){watching.sel=watching.sel.filter(el=&amp;gt;el!==elements)}else{elements=getElementsList(elements);watching.el=watching.el.filter(el=&amp;gt;elements.indexOf(el)===-1)}}function polyfill(){if(polyfilled){return}watching.sel.push(&amp;quot;.balance-text&amp;quot;);initHandlers();polyfilled=true}function publicInterface(elements,options){if(!elements){polyfill()}else if(options&amp;amp;&amp;amp;options.watch===true){balanceTextAndWatch(elements)}else if(options&amp;amp;&amp;amp;options.watch===false){unwatch(elements)}else{balanceText(elements)}}publicInterface.updateWatched=updateWatched;if(hasTextWrap()){noop.updateWatched=noop;return noop}return publicInterface});&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;balanceText();&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key krzwiki:diff::1.12:old-2676:rev-2679 --&gt;
&lt;/table&gt;</summary>
		<author><name>Eli</name></author>
		
	</entry>
	<entry>
		<id>https://consolidatedpower.co/~donald/zero/index.php?title=MediaWiki:Common.js&amp;diff=2676&amp;oldid=prev</id>
		<title>Eli: try out balance-text</title>
		<link rel="alternate" type="text/html" href="https://consolidatedpower.co/~donald/zero/index.php?title=MediaWiki:Common.js&amp;diff=2676&amp;oldid=prev"/>
		<updated>2020-01-14T14:49:38Z</updated>

		<summary type="html">&lt;p&gt;try out balance-text&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/* Any JavaScript here will be loaded for all users on every page load. */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* https://github.com/adobe/balance-text */&lt;br /&gt;
&lt;br /&gt;
(function(root,factory){if(typeof define===&amp;quot;function&amp;quot;&amp;amp;&amp;amp;define.amd){define([],factory)}else if(typeof module===&amp;quot;object&amp;quot;&amp;amp;&amp;amp;module.exports){module.exports=factory()}else{root.balanceText=factory()}})(this,()=&amp;gt;{let breakMatches,wsnwMatches,wsnwOffset;const watching={sel:[],el:[]};let handlersInitialized=false;let polyfilled=false;function noop(){}function forEach(elements,callback){Array.prototype.forEach.call(elements,callback)}function ready(fn){if(document.readyState!==&amp;quot;loading&amp;quot;){fn()}else if(document.addEventListener){document.addEventListener(&amp;quot;DOMContentLoaded&amp;quot;,fn)}else{document.attachEvent(&amp;quot;onreadystatechange&amp;quot;,()=&amp;gt;{if(document.readyState!==&amp;quot;loading&amp;quot;){fn()}})}}function debounce(func,threshold,execAsap,...args){let timeout;return function(){const obj=this;function delayed(){if(!execAsap){func.apply(obj,args)}timeout=null}if(timeout){clearTimeout(timeout)}else if(execAsap){func.apply(obj,args)}timeout=setTimeout(delayed,threshold||100)}}function hasTextWrap(){if(typeof window===&amp;quot;undefined&amp;quot;){return false}const{style:style}=document.documentElement;return style.textWrap||style.WebkitTextWrap||style.MozTextWrap||style.MsTextWrap}function NextWS_params(){this.reset()}NextWS_params.prototype.reset=function(){this.index=0;this.width=0};function isWhiteSpaceNoWrap(index){return wsnwMatches.some(range=&amp;gt;range.start&amp;lt;index&amp;amp;&amp;amp;index&amp;lt;range.end)}function recursiveCalcNoWrapOffsetsForLine(el,includeTag){if(el.nodeType===el.ELEMENT_NODE){const style=window.getComputedStyle(el);if(style.whiteSpace===&amp;quot;nowrap&amp;quot;){const len=el.outerHTML.length;wsnwMatches.push({start:wsnwOffset,end:wsnwOffset+len});wsnwOffset+=len}else{forEach(el.childNodes,child=&amp;gt;{recursiveCalcNoWrapOffsetsForLine(child,true)});if(includeTag){wsnwOffset+=el.outerHTML.length-el.innerHTML.length}}}else if(el.nodeType===el.COMMENT_NODE){wsnwOffset+=el.length+7}else if(el.nodeType===el.PROCESSING_INSTRUCTION_NODE){wsnwOffset+=el.length+2}else{wsnwOffset+=el.length}}function calcNoWrapOffsetsForLine(el,oldWS,lineCharOffset){if(lineCharOffset===0){el.style.whiteSpace=oldWS;wsnwOffset=0;wsnwMatches=[];recursiveCalcNoWrapOffsetsForLine(el,false);el.style.whiteSpace=&amp;quot;nowrap&amp;quot;}else{const newMatches=[];wsnwMatches.forEach(match=&amp;gt;{if(match.start&amp;gt;lineCharOffset){newMatches.push({start:match.start-lineCharOffset,end:match.end-lineCharOffset})}});wsnwMatches=newMatches}}function removeTags(el){let brs=el.querySelectorAll('br[data-owner=&amp;quot;balance-text-hyphen&amp;quot;]');forEach(brs,br=&amp;gt;{br.outerHTML=&amp;quot;&amp;quot;});brs=el.querySelectorAll('br[data-owner=&amp;quot;balance-text&amp;quot;]');forEach(brs,br=&amp;gt;{br.outerHTML=&amp;quot; &amp;quot;});let spans=el.querySelectorAll('span[data-owner=&amp;quot;balance-text-softhyphen&amp;quot;]');if(spans.length&amp;gt;0){forEach(spans,span=&amp;gt;{const textNode=document.createTextNode(&amp;quot;­&amp;quot;);span.parentNode.insertBefore(textNode,span);span.parentNode.removeChild(span)})}spans=el.querySelectorAll('span[data-owner=&amp;quot;balance-text-justify&amp;quot;]');if(spans.length&amp;gt;0){let txt=&amp;quot;&amp;quot;;forEach(spans,span=&amp;gt;{txt+=span.textContent;span.parentNode.removeChild(span)});el.innerHTML=txt}}const isJustified=function(el){const style=el.currentStyle||window.getComputedStyle(el,null);return style.textAlign===&amp;quot;justify&amp;quot;};function justify(el,txt,conWidth){txt=txt.trim();const words=txt.split(&amp;quot; &amp;quot;).length;txt=`${txt} `;if(words&amp;lt;2){return txt}const tmp=document.createElement(&amp;quot;span&amp;quot;);tmp.innerHTML=txt;el.appendChild(tmp);const size=tmp.offsetWidth;tmp.parentNode.removeChild(tmp);const wordSpacing=Math.floor((conWidth-size)/(words-1));tmp.style.wordSpacing=`${wordSpacing}px`;tmp.setAttribute(&amp;quot;data-owner&amp;quot;,&amp;quot;balance-text-justify&amp;quot;);const div=document.createElement(&amp;quot;div&amp;quot;);div.appendChild(tmp);return div.innerHTML}function isBreakChar(txt,index){const re=/([^\S\u00a0]|-|\u2014|\u2013|\u00ad)(?![^&amp;lt;]*&amp;gt;)/g;let match;if(!breakMatches){breakMatches=[];match=re.exec(txt);while(match!==null){if(!isWhiteSpaceNoWrap(match.index)){breakMatches.push(match.index)}match=re.exec(txt)}}return breakMatches.indexOf(index)!==-1}function isBreakOpportunity(txt,index){return index===0||index===txt.length||isBreakChar(txt,index-1)&amp;amp;&amp;amp;!isBreakChar(txt,index)}function findBreakOpportunity(el,txt,conWidth,desWidth,dir,c,ret){let w;if(txt&amp;amp;&amp;amp;typeof txt===&amp;quot;string&amp;quot;){for(;;){while(!isBreakOpportunity(txt,c)){c+=dir}el.innerHTML=txt.substr(0,c);w=el.offsetWidth;if(dir&amp;lt;0){if(w&amp;lt;=desWidth||w&amp;lt;=0||c===0){break}}else if(desWidth&amp;lt;=w||conWidth&amp;lt;=w||c===txt.length){break}c+=dir}}ret.index=c;ret.width=w}function getSpaceWidth(el,h){const container=document.createElement(&amp;quot;div&amp;quot;);container.style.display=&amp;quot;block&amp;quot;;container.style.position=&amp;quot;absolute&amp;quot;;container.style.bottom=0;container.style.right=0;container.style.width=0;container.style.height=0;container.style.margin=0;container.style.padding=0;container.style.visibility=&amp;quot;hidden&amp;quot;;container.style.overflow=&amp;quot;hidden&amp;quot;;const space=document.createElement(&amp;quot;span&amp;quot;);space.style.fontSize=&amp;quot;2000px&amp;quot;;space.innerHTML=&amp;quot;&amp;amp;nbsp;&amp;quot;;container.appendChild(space);el.appendChild(container);const dims=space.getBoundingClientRect();container.parentNode.removeChild(container);const spaceRatio=dims.height/dims.width;return h/spaceRatio}function getElementsList(elements){if(!elements){return[]}if(typeof elements===&amp;quot;string&amp;quot;){return document.querySelectorAll(elements)}if(elements.tagName&amp;amp;&amp;amp;elements.querySelectorAll){return[elements]}return elements}function balanceText(elements){forEach(getElementsList(elements),el=&amp;gt;{const maxTextWidth=5e3;removeTags(el);const oldWS=el.style.whiteSpace;const oldFloat=el.style.float;const oldDisplay=el.style.display;const oldPosition=el.style.position;const oldLH=el.style.lineHeight;el.style.lineHeight=&amp;quot;normal&amp;quot;;const containerWidth=el.offsetWidth;const containerHeight=el.offsetHeight;el.style.whiteSpace=&amp;quot;nowrap&amp;quot;;el.style.float=&amp;quot;none&amp;quot;;el.style.display=&amp;quot;inline&amp;quot;;el.style.position=&amp;quot;static&amp;quot;;let nowrapWidth=el.offsetWidth;const nowrapHeight=el.offsetHeight;const spaceWidth=oldWS===&amp;quot;pre-wrap&amp;quot;?0:getSpaceWidth(el,nowrapHeight);if(containerWidth&amp;gt;0&amp;amp;&amp;amp;nowrapWidth&amp;gt;containerWidth&amp;amp;&amp;amp;nowrapWidth&amp;lt;maxTextWidth){let remainingText=el.innerHTML;let newText=&amp;quot;&amp;quot;;let lineText=&amp;quot;&amp;quot;;const shouldJustify=isJustified(el);const totLines=Math.round(containerHeight/nowrapHeight);let remLines=totLines;let lineCharOffset=0;let desiredWidth,guessIndex,le,ge,splitIndex,isHyphen,isSoftHyphen;while(remLines&amp;gt;1){breakMatches=null;calcNoWrapOffsetsForLine(el,oldWS,lineCharOffset);desiredWidth=Math.round((nowrapWidth+spaceWidth)/remLines-spaceWidth);guessIndex=Math.round((remainingText.length+1)/remLines)-1;le=new NextWS_params;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,-1,guessIndex,le);ge=new NextWS_params;guessIndex=le.index;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,+1,guessIndex,ge);le.reset();guessIndex=ge.index;findBreakOpportunity(el,remainingText,containerWidth,desiredWidth,-1,guessIndex,le);if(le.index===0){splitIndex=ge.index}else if(containerWidth&amp;lt;ge.width||le.index===ge.index){splitIndex=le.index}else{splitIndex=Math.abs(desiredWidth-le.width)&amp;lt;Math.abs(ge.width-desiredWidth)?le.index:ge.index}lineText=remainingText.substr(0,splitIndex).replace(/\s$/,&amp;quot;&amp;quot;);isSoftHyphen=Boolean(lineText.match(/\u00ad$/));if(isSoftHyphen){lineText=lineText.replace(/\u00ad$/,'&amp;lt;span data-owner=&amp;quot;balance-text-softhyphen&amp;quot;&amp;gt;-&amp;lt;/span&amp;gt;')}if(shouldJustify){newText+=justify(el,lineText,containerWidth)}else{newText+=lineText;isHyphen=isSoftHyphen||Boolean(lineText.match(/(-|\u2014|\u2013)$/));newText+=isHyphen?'&amp;lt;br data-owner=&amp;quot;balance-text-hyphen&amp;quot; /&amp;gt;':'&amp;lt;br data-owner=&amp;quot;balance-text&amp;quot; /&amp;gt;'}remainingText=remainingText.substr(splitIndex);lineCharOffset=splitIndex;remLines--;el.innerHTML=remainingText;nowrapWidth=el.offsetWidth}if(shouldJustify){el.innerHTML=newText+justify(el,remainingText,containerWidth)}else{el.innerHTML=newText+remainingText}}el.style.whiteSpace=oldWS;el.style.float=oldFloat;el.style.display=oldDisplay;el.style.position=oldPosition;el.style.lineHeight=oldLH})}function updateWatched(){const selectors=watching.sel.join(&amp;quot;,&amp;quot;);const selectedElements=getElementsList(selectors);const elements=Array.prototype.concat.apply(watching.el,selectedElements);balanceText(elements)}function initHandlers(){if(handlersInitialized){return}ready(updateWatched);window.addEventListener(&amp;quot;load&amp;quot;,updateWatched);window.addEventListener(&amp;quot;resize&amp;quot;,debounce(updateWatched));handlersInitialized=true}function balanceTextAndWatch(elements){if(typeof elements===&amp;quot;string&amp;quot;){watching.sel.push(elements)}else{forEach(getElementsList(elements),el=&amp;gt;{watching.el.push(el)})}initHandlers();updateWatched()}function unwatch(elements){if(typeof elements===&amp;quot;string&amp;quot;){watching.sel=watching.sel.filter(el=&amp;gt;el!==elements)}else{elements=getElementsList(elements);watching.el=watching.el.filter(el=&amp;gt;elements.indexOf(el)===-1)}}function polyfill(){if(polyfilled){return}watching.sel.push(&amp;quot;.balance-text&amp;quot;);initHandlers();polyfilled=true}function publicInterface(elements,options){if(!elements){polyfill()}else if(options&amp;amp;&amp;amp;options.watch===true){balanceTextAndWatch(elements)}else if(options&amp;amp;&amp;amp;options.watch===false){unwatch(elements)}else{balanceText(elements)}}publicInterface.updateWatched=updateWatched;if(hasTextWrap()){noop.updateWatched=noop;return noop}return publicInterface});&lt;br /&gt;
&lt;br /&gt;
balanceText();&lt;/div&gt;</summary>
		<author><name>Eli</name></author>
		
	</entry>
</feed>