From 957cae41f1cc57a23e4ad4fd7307c2cdbd77a61c Mon Sep 17 00:00:00 2001
From: "Tate, Hongliang Tian" <tatetian@gmail.com>
Date: Wed, 18 Mar 2015 21:14:01 +0800
Subject: [PATCH] Remove dependency on Google CDN and mimize js files

---
 index.html                   |  26 ++++---
 javascripts/autosize.js      | 141 -----------------------------------
 javascripts/autosize.min.js  |   1 +
 javascripts/html5shiv.min.js |   4 +
 4 files changed, 19 insertions(+), 153 deletions(-)
 delete mode 100755 javascripts/autosize.js
 create mode 100644 javascripts/autosize.min.js
 create mode 100644 javascripts/html5shiv.min.js

diff --git a/index.html b/index.html
index 31b7a7d..675f2d8 100644
--- a/index.html
+++ b/index.html
@@ -9,13 +9,12 @@
     <link rel="stylesheet" href="stylesheets/pygment_trac.css">
     <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
     <link rel="stylesheet" href="pseudocode/pseudocode.min.css">
-    <script src="javascripts/autosize.js"></script>
-    <script src="pseudocode/pseudocode.min.js"></script>
-    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
     <!--[if lt IE 9]>
-    <!-- TODO: do not rely on google -->
-    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <script src="javascripts/html5.js"></script>
     <![endif]-->
+    <script src="javascripts/autosize.min.js"></script>
+    <script src="pseudocode/pseudocode.min.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
     <style type="text/css"> 
         body {
             color: #333;
@@ -164,7 +163,7 @@
             <li><strong>Print quality:</strong>
             The HTML output produced by pseudocode.js is (almost) identical 
             with the pretty algorithms printed on publications that
-            are typesetted by LaTeX.</li>
+            are typeset by LaTeX.</li>
             <li><strong>Math formula support:</strong>
             Inserting math formulas in pseudocode.js is as easy as LaTeX. Just
             enclose math expression in <code>$...$</code> or 
@@ -215,13 +214,16 @@ pseudocode.render(code, parentEl, options);</code></pre>
         <a href="https://github.com/tatetian/pseudocode.js#features">features section of README</a>.
         </p>
 
-        <h3>Author and Acknowledgement</h3>
+        <h3>Author</h3>
         <p>Tate Tian(<a href="https://github.com/tatetian" 
-        class="user-mention">@tatetian</a>) creates Pseudocode.js. Any suggestions 
-        are welcome.</p>
+        class="user-mention">@tatetian</a>) creates pseudocode.js. Any suggestions 
+        and bug reports are welcome.</p>
 
-        <p>Pseudocode.js is inspired by <a href="khan.github.io/KaTeX/">KaTeX</a> and 
-        relies on it to render math formulas. 
+        <h3>Acknowledgement</h3>
+        <p>Pseudocode.js is partially inspired by <a href="khan.github.io/KaTeX/">KaTeX</a> and 
+        relies on it to render math formulas.
+        Thanks Emily Eisenberg(<a href="https://github.com/xymostech">@xymostech</a>)
+        and other contributers for building such a wonderful project.
         </p>
     </section>
 
@@ -245,7 +247,7 @@ pseudocode.render(code, parentEl, options);</code></pre>
         var resultEl = document.getElementsByClassName('demo-result')[0];
         resultEl.innerHTML = '';
         var options = {
-            algNum: 0,
+            captionCount: 0,
             lineNumber: true
         };
         pseudocode.render(code, resultEl, options);
diff --git a/javascripts/autosize.js b/javascripts/autosize.js
deleted file mode 100755
index f776beb..0000000
--- a/javascripts/autosize.js
+++ /dev/null
@@ -1,141 +0,0 @@
-(function (root, factory) {
-	'use strict';
-
-	if (typeof define === 'function' && define.amd) {
-		// AMD. Register as an anonymous module.
-		define([], factory);
-	} else if (typeof exports === 'object') {
-		// Node. Does not work with strict CommonJS, but
-		// only CommonJS-like environments that support module.exports,
-		// like Node.
-		module.exports = factory();
-	} else {
-		// Browser globals (root is window)
-		root.autosize = factory();
-  }
-}(this, function () {
-	function main(ta) {
-		if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || ta.hasAttribute('data-autosize-on')) { return; }
-
-		var maxHeight;
-		var heightOffset;
-
-		function init() {
-			var style = window.getComputedStyle(ta, null);
-
-			if (style.resize === 'vertical') {
-				ta.style.resize = 'none';
-			} else if (style.resize === 'both') {
-				ta.style.resize = 'horizontal';
-			}
-
-			// horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
-			ta.style.wordWrap = 'break-word';
-
-			// Chrome/Safari-specific fix:
-			// When the textarea y-overflow is hidden, Chrome/Safari doesn't reflow the text to account for the space
-			// made available by removing the scrollbar. This workaround will cause the text to reflow.
-			var width = ta.style.width;
-			ta.style.width = '0px';
-			// Force reflow:
-			/* jshint ignore:start */
-			ta.offsetWidth;
-			/* jshint ignore:end */
-			ta.style.width = width;
-
-			maxHeight = style.maxHeight !== 'none' ? parseFloat(style.maxHeight) : false;
-			
-			if (style.boxSizing === 'content-box') {
-				heightOffset = -(parseFloat(style.paddingTop)+parseFloat(style.paddingBottom));
-			} else {
-				heightOffset = parseFloat(style.borderTopWidth)+parseFloat(style.borderBottomWidth);
-			}
-
-			adjust();
-		}
-
-		function adjust() {
-			var startHeight = ta.style.height;
-			var htmlTop = document.documentElement.scrollTop;
-			var bodyTop = document.body.scrollTop;
-			
-			ta.style.height = 'auto';
-
-			var endHeight = ta.scrollHeight+heightOffset;
-
-			if (maxHeight !== false && maxHeight < endHeight) {
-				endHeight = maxHeight;
-				if (ta.style.overflowY !== 'scroll') {
-					ta.style.overflowY = 'scroll';
-				}
-			} else if (ta.style.overflowY !== 'hidden') {
-				ta.style.overflowY = 'hidden';
-			}
-
-			ta.style.height = endHeight+'px';
-
-			// prevents scroll-position jumping
-			document.documentElement.scrollTop = htmlTop;
-			document.body.scrollTop = bodyTop;
-
-			if (startHeight !== ta.style.height) {
-				var evt = document.createEvent('Event');
-				evt.initEvent('autosize.resized', true, false);
-				ta.dispatchEvent(evt);
-			}
-		}
-
-		// IE9 does not fire onpropertychange or oninput for deletions,
-		// so binding to onkeyup to catch most of those events.
-		// There is no way that I know of to detect something like 'cut' in IE9.
-		if ('onpropertychange' in ta && 'oninput' in ta) {
-			ta.addEventListener('keyup', adjust);
-		}
-
-		window.addEventListener('resize', adjust);
-		ta.addEventListener('input', adjust);
-
-		ta.addEventListener('autosize.update', adjust);
-
-		ta.addEventListener('autosize.destroy', function(style){
-			window.removeEventListener('resize', adjust);
-			ta.removeEventListener('input', adjust);
-			ta.removeEventListener('keyup', adjust);
-			ta.removeEventListener('autosize.destroy');
-
-			Object.keys(style).forEach(function(key){
-				ta.style[key] = style[key];
-			});
-
-			ta.removeAttribute('data-autosize-on');
-		}.bind(ta, {
-			height: ta.style.height,
-			overflow: ta.style.overflow,
-			overflowY: ta.style.overflowY,
-			wordWrap: ta.style.wordWrap,
-			resize: ta.style.resize
-		}));
-
-		ta.setAttribute('data-autosize-on', true);
-		ta.style.overflow = 'hidden';
-		ta.style.overflowY = 'hidden';
-
-		init();		
-	}
-
-	// Do nothing in IE8 or lower
-	if (typeof window.getComputedStyle !== 'function') {
-		return function(elements) {
-			return elements;
-		};
-	} else {
-		return function(elements) {
-			if (elements && elements.length) {
-				Array.prototype.forEach.call(elements, main);
-			} else if (elements && elements.nodeName) {
-				main(elements);
-			}
-			return elements;
-		};
-	}
-}));
diff --git a/javascripts/autosize.min.js b/javascripts/autosize.min.js
new file mode 100644
index 0000000..5a43e0b
--- /dev/null
+++ b/javascripts/autosize.min.js
@@ -0,0 +1 @@
+!function(a,b){"use strict";"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.autosize=b()}(this,function(){function a(a){function b(){var b=window.getComputedStyle(a,null);"vertical"===b.resize?a.style.resize="none":"both"===b.resize&&(a.style.resize="horizontal"),a.style.wordWrap="break-word";var f=a.style.width;a.style.width="0px",a.offsetWidth,a.style.width=f,d="none"!==b.maxHeight?parseFloat(b.maxHeight):!1,e="content-box"===b.boxSizing?-(parseFloat(b.paddingTop)+parseFloat(b.paddingBottom)):parseFloat(b.borderTopWidth)+parseFloat(b.borderBottomWidth),c()}function c(){var b=a.style.height,c=document.documentElement.scrollTop,f=document.body.scrollTop;a.style.height="auto";var g=a.scrollHeight+e;if(d!==!1&&g>d?(g=d,"scroll"!==a.style.overflowY&&(a.style.overflowY="scroll")):"hidden"!==a.style.overflowY&&(a.style.overflowY="hidden"),a.style.height=g+"px",document.documentElement.scrollTop=c,document.body.scrollTop=f,b!==a.style.height){var h=document.createEvent("Event");h.initEvent("autosize.resized",!0,!1),a.dispatchEvent(h)}}if(a&&a.nodeName&&"TEXTAREA"===a.nodeName&&!a.hasAttribute("data-autosize-on")){var d,e;"onpropertychange"in a&&"oninput"in a&&a.addEventListener("keyup",c),window.addEventListener("resize",c),a.addEventListener("input",c),a.addEventListener("autosize.update",c),a.addEventListener("autosize.destroy",function(b){window.removeEventListener("resize",c),a.removeEventListener("input",c),a.removeEventListener("keyup",c),a.removeEventListener("autosize.destroy"),Object.keys(b).forEach(function(c){a.style[c]=b[c]}),a.removeAttribute("data-autosize-on")}.bind(a,{height:a.style.height,overflow:a.style.overflow,overflowY:a.style.overflowY,wordWrap:a.style.wordWrap,resize:a.style.resize})),a.setAttribute("data-autosize-on",!0),a.style.overflow="hidden",a.style.overflowY="hidden",b()}}return"function"!=typeof window.getComputedStyle?function(a){return a}:function(b){return b&&b.length?Array.prototype.forEach.call(b,a):b&&b.nodeName&&a(b),b}});
\ No newline at end of file
diff --git a/javascripts/html5shiv.min.js b/javascripts/html5shiv.min.js
new file mode 100644
index 0000000..d4c731a
--- /dev/null
+++ b/javascripts/html5shiv.min.js
@@ -0,0 +1,4 @@
+/**
+* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
\ No newline at end of file
-- 
GitLab