├── CSS └── styles.css ├── .gitattributes ├── visualization.html ├── README.md ├── index.php ├── highlighter ├── themes │ ├── prism-okaidia.css │ ├── prism-tomorrow.css │ ├── prism-funky.css │ ├── prism-dark.css │ ├── prism.css │ ├── prism-twilight.css │ └── prism-coy.css ├── prefixfree.min.js ├── style.css └── prism.js ├── JS ├── canvas-toBlob.js ├── filesaver.js └── index.js └── .gitignore /CSS/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color:black; 3 | } 4 | 5 | .button { 6 | margin:5px 0px 0px 15px; 7 | background-color:#fb0; 8 | color: black; 9 | border-radius: 3px; 10 | padding:10px; 11 | width:auto; 12 | display:inline-block; 13 | cursor:pointer; 14 | } 15 | 16 | 17 | .save { 18 | 19 | width:100px; 20 | } 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /visualization.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Visualization of an irrational number 4 | 5 | 6 | 7 | 8 | 9 | Fork me on GitHub 10 | 11 | 12 |
13 |
Save as png
14 | 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Irrational2Chart 2 | ======= 3 | *Simple visualize irrational numbers like e and pi* 4 | [github.wikunia.de/Irrational2Chart](http://github.wikunia.de/Irrational2Chart) 5 | 6 | Get variables: 7 | 8 | nods = show ... number of digits (?nods=50 => show 50 digits (empty => 800)) 9 | 10 | n = number (?n=e&nods=1000 => show 1000 digits of e (empty => pi)) 11 | 12 | with show dots you can see sequences like '99999' in a better way (big dot => long sequence) (?show_dots=false (empty => true)) 13 | 14 | 15 | ![Pi (750 digits)](http://github.wikunia.de/images/irrational2chart.jpg "") 16 | 17 | Thanks [@LeaVerou](https://github.com/LeaVerou/prism) for your syntax highlighter! 18 | 19 | Thanks [@Regaddi](https://github.com/Regaddi/Chart.js) for your tooltip function! 20 | 21 | Thanks [@eligrey](https://github.com/eligrey/FileSaver.js) for your FileSaver.js! 22 | 23 | License 24 | ====== 25 | [MIT license] (http://opensource.org/licenses/MIT) 26 | 27 | 28 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Visualization of an irrational number 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ´ 13 | 14 | 15 |
16 |
Pi
17 |
e
18 |
Golden ratio
19 |
Sqrt(2)
20 |
21 |
Save as png
22 | 23 |

24 |
25 | 	
26 | 	 2000) { // irrational numbers
30 | 			echo substr($line,0,45).'...\';';
31 | 		} else { echo $line; }
32 | 	}
33 | 	?>
34 | 	
35 | 
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /highlighter/themes/prism-okaidia.css: -------------------------------------------------------------------------------- 1 | /** 2 | * okaidia theme for JavaScript, CSS and HTML 3 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/ 4 | * @author ocodia 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: #f8f8f2; 10 | text-shadow: 0 1px rgba(0,0,0,0.3); 11 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 12 | direction: ltr; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | 18 | -moz-tab-size: 4; 19 | -o-tab-size: 4; 20 | tab-size: 4; 21 | 22 | -webkit-hyphens: none; 23 | -moz-hyphens: none; 24 | -ms-hyphens: none; 25 | hyphens: none; 26 | } 27 | 28 | /* Code blocks */ 29 | pre[class*="language-"] { 30 | padding: 1em; 31 | margin: .5em 0; 32 | overflow: auto; 33 | border-radius: 0.3em; 34 | } 35 | 36 | :not(pre) > code[class*="language-"], 37 | pre[class*="language-"] { 38 | background: #272822; 39 | } 40 | 41 | /* Inline code */ 42 | :not(pre) > code[class*="language-"] { 43 | padding: .1em; 44 | border-radius: .3em; 45 | } 46 | 47 | .token.comment, 48 | .token.prolog, 49 | .token.doctype, 50 | .token.cdata { 51 | color: slategray; 52 | } 53 | 54 | .token.punctuation { 55 | color: #f8f8f2; 56 | } 57 | 58 | .namespace { 59 | opacity: .7; 60 | } 61 | 62 | .token.property, 63 | .token.tag, 64 | .token.constant, 65 | .token.symbol { 66 | color: #f92672; 67 | } 68 | 69 | .token.boolean, 70 | .token.number{ 71 | color: #ae81ff; 72 | } 73 | 74 | .token.selector, 75 | .token.attr-name, 76 | .token.string, 77 | .token.builtin { 78 | color: #a6e22e; 79 | } 80 | 81 | 82 | .token.operator, 83 | .token.entity, 84 | .token.url, 85 | .language-css .token.string, 86 | .style .token.string, 87 | .token.variable { 88 | color: #f8f8f2; 89 | } 90 | 91 | .token.atrule, 92 | .token.attr-value 93 | { 94 | color: #e6db74; 95 | } 96 | 97 | 98 | .token.keyword{ 99 | color: #66d9ef; 100 | } 101 | 102 | .token.regex, 103 | .token.important { 104 | color: #fd971f; 105 | } 106 | 107 | .token.important { 108 | font-weight: bold; 109 | } 110 | 111 | .token.entity { 112 | cursor: help; 113 | } 114 | -------------------------------------------------------------------------------- /highlighter/themes/prism-tomorrow.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML 3 | * Based on https://github.com/chriskempson/tomorrow-theme 4 | * @author Rose Pritchard 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: #ccc; 10 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 11 | direction: ltr; 12 | text-align: left; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | 17 | -moz-tab-size: 4; 18 | -o-tab-size: 4; 19 | tab-size: 4; 20 | 21 | -webkit-hyphens: none; 22 | -moz-hyphens: none; 23 | -ms-hyphens: none; 24 | hyphens: none; 25 | 26 | } 27 | 28 | /* Code blocks */ 29 | pre[class*="language-"] { 30 | padding: 1em; 31 | margin: .5em 0; 32 | overflow: auto; 33 | } 34 | 35 | :not(pre) > code[class*="language-"], 36 | pre[class*="language-"] { 37 | background: #2d2d2d; 38 | } 39 | 40 | /* Inline code */ 41 | :not(pre) > code[class*="language-"] { 42 | padding: .1em; 43 | border-radius: .3em; 44 | } 45 | 46 | .token.comment, 47 | .token.block-comment, 48 | .token.prolog, 49 | .token.doctype, 50 | .token.cdata { 51 | color: #999; 52 | } 53 | 54 | .token.punctuation { 55 | color: #ccc; 56 | } 57 | 58 | 59 | .token.tag, 60 | .token.attr-name, 61 | .token.namespace { 62 | color: #e2777a; 63 | } 64 | 65 | .token.function-name { 66 | color: #6196cc; 67 | } 68 | 69 | 70 | .token.boolean, 71 | .token.number, 72 | .token.function { 73 | color: #f08d49; 74 | } 75 | 76 | .token.property, 77 | .token.class-name, 78 | .token.constant, 79 | .token.symbol { 80 | color: #f8c555; 81 | } 82 | 83 | .token.selector, 84 | .token.important, 85 | .token.atrule, 86 | .token.keyword, 87 | .token.builtin { 88 | color: #cc99cd; 89 | } 90 | 91 | .token.string, 92 | .token.attr-value, 93 | .token.regex, 94 | .token.variable { 95 | color: #7ec699; 96 | } 97 | 98 | .token.operator, 99 | .token.entity, 100 | .token.url 101 | { 102 | color: #67cdcc; 103 | } 104 | 105 | 106 | .token.important { 107 | font-weight: bold; 108 | } 109 | 110 | .token.entity { 111 | cursor: help; 112 | } 113 | -------------------------------------------------------------------------------- /highlighter/themes/prism-funky.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Funky theme 3 | * Based on “Polyfilling the gaps” talk slides http://lea.verou.me/polyfilling-the-gaps/ 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 10 | direction: ltr; 11 | text-align: left; 12 | white-space: pre; 13 | word-spacing: normal; 14 | word-break: normal; 15 | 16 | -moz-tab-size: 4; 17 | -o-tab-size: 4; 18 | tab-size: 4; 19 | 20 | -webkit-hyphens: none; 21 | -moz-hyphens: none; 22 | -ms-hyphens: none; 23 | hyphens: none; 24 | } 25 | 26 | /* Code blocks */ 27 | pre[class*="language-"] { 28 | padding: .4em .8em; 29 | margin: .5em 0; 30 | overflow: auto; 31 | background: url('data:image/svg+xml;charset=utf-8,%0D%0A%0D%0A%0D%0A<%2Fsvg>'); 32 | background-size: 1em 1em; 33 | } 34 | 35 | code[class*="language-"] { 36 | background: black; 37 | color: white; 38 | box-shadow: -.3em 0 0 .3em black, .3em 0 0 .3em black; 39 | } 40 | 41 | /* Inline code */ 42 | :not(pre) > code[class*="language-"] { 43 | padding: .2em; 44 | border-radius: .3em; 45 | box-shadow: none; 46 | } 47 | 48 | .token.comment, 49 | .token.prolog, 50 | .token.doctype, 51 | .token.cdata { 52 | color: #aaa; 53 | } 54 | 55 | .token.punctuation { 56 | color: #999; 57 | } 58 | 59 | .namespace { 60 | opacity: .7; 61 | } 62 | 63 | .token.property, 64 | .token.tag, 65 | .token.boolean, 66 | .token.number, 67 | .token.constant, 68 | .token.symbol { 69 | color: #0cf; 70 | } 71 | 72 | .token.selector, 73 | .token.attr-name, 74 | .token.string, 75 | .token.builtin { 76 | color: yellow; 77 | } 78 | 79 | .token.operator, 80 | .token.entity, 81 | .token.url, 82 | .language-css .token.string, 83 | .toke.variable { 84 | color: yellowgreen; 85 | } 86 | 87 | .token.atrule, 88 | .token.attr-value, 89 | .token.keyword { 90 | color: deeppink; 91 | } 92 | 93 | 94 | .token.regex, 95 | .token.important { 96 | color: orange; 97 | } 98 | 99 | .token.important { 100 | font-weight: bold; 101 | } 102 | 103 | .token.entity { 104 | cursor: help; 105 | } 106 | -------------------------------------------------------------------------------- /highlighter/themes/prism-dark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Dark theme for JavaScript, CSS and HTML 3 | * Based on the slides of the talk “/Reg(exp){2}lained/” 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: white; 10 | text-shadow: 0 -.1em .2em black; 11 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 12 | direction: ltr; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | 18 | -moz-tab-size: 4; 19 | -o-tab-size: 4; 20 | tab-size: 4; 21 | 22 | -webkit-hyphens: none; 23 | -moz-hyphens: none; 24 | -ms-hyphens: none; 25 | hyphens: none; 26 | } 27 | 28 | @media print { 29 | code[class*="language-"], 30 | pre[class*="language-"] { 31 | text-shadow: none; 32 | } 33 | } 34 | 35 | pre[class*="language-"], 36 | :not(pre) > code[class*="language-"] { 37 | background: hsl(30,20%,25%); 38 | } 39 | 40 | /* Code blocks */ 41 | pre[class*="language-"] { 42 | padding: 1em; 43 | margin: .5em 0; 44 | overflow: auto; 45 | border: .3em solid hsl(30,20%,40%); 46 | border-radius: .5em; 47 | box-shadow: 1px 1px .5em black inset; 48 | } 49 | 50 | /* Inline code */ 51 | :not(pre) > code[class*="language-"] { 52 | padding: .15em .2em .05em; 53 | border-radius: .3em; 54 | border: .13em solid hsl(30,20%,40%); 55 | box-shadow: 1px 1px .3em -.1em black inset; 56 | } 57 | 58 | .token.comment, 59 | .token.prolog, 60 | .token.doctype, 61 | .token.cdata { 62 | color: hsl(30,20%,50%); 63 | } 64 | 65 | .token.punctuation { 66 | opacity: .7; 67 | } 68 | 69 | .namespace { 70 | opacity: .7; 71 | } 72 | 73 | .token.property, 74 | .token.tag, 75 | .token.boolean, 76 | .token.number, 77 | .token.constant, 78 | .token.symbol { 79 | color: hsl(350, 40%, 70%); 80 | } 81 | 82 | .token.selector, 83 | .token.attr-name, 84 | .token.string, 85 | .token.builtin { 86 | color: hsl(75, 70%, 60%); 87 | } 88 | 89 | .token.operator, 90 | .token.entity, 91 | .token.url, 92 | .language-css .token.string, 93 | .style .token.string, 94 | .token.variable { 95 | color: hsl(40, 90%, 60%); 96 | } 97 | 98 | .token.atrule, 99 | .token.attr-value, 100 | .token.keyword { 101 | color: hsl(350, 40%, 70%); 102 | } 103 | 104 | 105 | .token.regex, 106 | .token.important { 107 | color: #e90; 108 | } 109 | 110 | .token.important { 111 | font-weight: bold; 112 | } 113 | 114 | .token.entity { 115 | cursor: help; 116 | } 117 | -------------------------------------------------------------------------------- /highlighter/themes/prism.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js default theme for JavaScript, CSS and HTML 3 | * Based on dabblet (http://dabblet.com) 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: black; 10 | text-shadow: 0 1px white; 11 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 12 | direction: ltr; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | 18 | 19 | -moz-tab-size: 4; 20 | -o-tab-size: 4; 21 | tab-size: 4; 22 | 23 | -webkit-hyphens: none; 24 | -moz-hyphens: none; 25 | -ms-hyphens: none; 26 | hyphens: none; 27 | } 28 | 29 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 30 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 31 | text-shadow: none; 32 | background: #b3d4fc; 33 | } 34 | 35 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 36 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 37 | text-shadow: none; 38 | background: #b3d4fc; 39 | } 40 | 41 | @media print { 42 | code[class*="language-"], 43 | pre[class*="language-"] { 44 | text-shadow: none; 45 | } 46 | } 47 | 48 | /* Code blocks */ 49 | pre[class*="language-"] { 50 | padding: 1em; 51 | overflow: auto; 52 | } 53 | 54 | :not(pre) > code[class*="language-"], 55 | pre[class*="language-"] { 56 | background: #f5f2f0; 57 | } 58 | 59 | /* Inline code */ 60 | :not(pre) > code[class*="language-"] { 61 | padding: .1em; 62 | border-radius: .3em; 63 | } 64 | 65 | .token.comment, 66 | .token.prolog, 67 | .token.doctype, 68 | .token.cdata { 69 | color: slategray; 70 | } 71 | 72 | .token.punctuation { 73 | color: #999; 74 | } 75 | 76 | .namespace { 77 | opacity: .7; 78 | } 79 | 80 | .token.property, 81 | .token.tag, 82 | .token.boolean, 83 | .token.number, 84 | .token.constant, 85 | .token.symbol { 86 | color: #905; 87 | } 88 | 89 | .token.selector, 90 | .token.attr-name, 91 | .token.string, 92 | .token.builtin { 93 | color: #690; 94 | } 95 | 96 | .token.operator, 97 | .token.entity, 98 | .token.url, 99 | .language-css .token.string, 100 | .style .token.string, 101 | .token.variable { 102 | color: #a67f59; 103 | background: hsla(0,0%,100%,.5); 104 | } 105 | 106 | .token.atrule, 107 | .token.attr-value, 108 | .token.keyword { 109 | color: #07a; 110 | } 111 | 112 | 113 | .token.regex, 114 | .token.important { 115 | color: #e90; 116 | } 117 | 118 | .token.important { 119 | font-weight: bold; 120 | } 121 | 122 | .token.entity { 123 | cursor: help; 124 | } 125 | -------------------------------------------------------------------------------- /JS/canvas-toBlob.js: -------------------------------------------------------------------------------- 1 | /* canvas-toBlob.js 2 | * A canvas.toBlob() implementation. 3 | * 2011-07-13 4 | * 5 | * By Eli Grey, http://eligrey.com and Devin Samarin, https://github.com/eboyjr 6 | * License: X11/MIT 7 | * See LICENSE.md 8 | */ 9 | 10 | /*global self */ 11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, 12 | plusplus: true */ 13 | 14 | /*! @source http://purl.eligrey.com/github/canvas-toBlob.js/blob/master/canvas-toBlob.js */ 15 | 16 | (function(view) { 17 | "use strict"; 18 | var 19 | Uint8Array = view.Uint8Array 20 | , HTMLCanvasElement = view.HTMLCanvasElement 21 | , is_base64_regex = /\s*;\s*base64\s*(?:;|$)/i 22 | , base64_ranks 23 | , decode_base64 = function(base64) { 24 | var 25 | len = base64.length 26 | , buffer = new Uint8Array(len / 4 * 3 | 0) 27 | , i = 0 28 | , outptr = 0 29 | , last = [0, 0] 30 | , state = 0 31 | , save = 0 32 | , rank 33 | , code 34 | , undef 35 | ; 36 | while (len--) { 37 | code = base64.charCodeAt(i++); 38 | rank = base64_ranks[code-43]; 39 | if (rank !== 255 && rank !== undef) { 40 | last[1] = last[0]; 41 | last[0] = code; 42 | save = (save << 6) | rank; 43 | state++; 44 | if (state === 4) { 45 | buffer[outptr++] = save >>> 16; 46 | if (last[1] !== 61 /* padding character */) { 47 | buffer[outptr++] = save >>> 8; 48 | } 49 | if (last[0] !== 61 /* padding character */) { 50 | buffer[outptr++] = save; 51 | } 52 | state = 0; 53 | } 54 | } 55 | } 56 | // 2/3 chance there's going to be some null bytes at the end, but that 57 | // doesn't really matter with most image formats. 58 | // If it somehow matters for you, truncate the buffer up outptr. 59 | return buffer.buffer; 60 | } 61 | ; 62 | if (Uint8Array) { 63 | base64_ranks = new Uint8Array([ 64 | 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1 65 | , -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 66 | , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 67 | , -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 68 | , 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 69 | ]); 70 | } 71 | if (HTMLCanvasElement && !HTMLCanvasElement.prototype.toBlob) { 72 | HTMLCanvasElement.prototype.toBlob = function(callback, type /*, ...args*/) { 73 | if (!type) { 74 | type = "image/png"; 75 | } if (this.mozGetAsFile) { 76 | callback(this.mozGetAsFile("canvas", type)); 77 | return; 78 | } 79 | var 80 | args = Array.prototype.slice.call(arguments, 1) 81 | , dataURI = this.toDataURL.apply(this, args) 82 | , header_end = dataURI.indexOf(",") 83 | , data = dataURI.substring(header_end + 1) 84 | , is_base64 = is_base64_regex.test(dataURI.substring(0, header_end)) 85 | , blob 86 | ; 87 | if (Blob.fake) { 88 | // no reason to decode a data: URI that's just going to become a data URI again 89 | blob = new Blob 90 | if (is_base64) { 91 | blob.encoding = "base64"; 92 | } else { 93 | blob.encoding = "URI"; 94 | } 95 | blob.data = data; 96 | blob.size = data.length; 97 | } else if (Uint8Array) { 98 | if (is_base64) { 99 | blob = new Blob([decode_base64(data)], {type: type}); 100 | } else { 101 | blob = new Blob([decodeURIComponent(data)], {type: type}); 102 | } 103 | } 104 | callback(blob); 105 | }; 106 | } 107 | }(self)); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /highlighter/themes/prism-twilight.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Twilight theme 3 | * Based (more or less) on the Twilight theme originally of Textmate fame. 4 | * @author Remy Bach 5 | */ 6 | code[class*="language-"], 7 | pre[class*="language-"] { 8 | color: white; 9 | direction: ltr; 10 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 11 | text-align: left; 12 | text-shadow: 0 -.1em .2em black; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | 17 | -moz-tab-size: 4; 18 | -o-tab-size: 4; 19 | tab-size: 4; 20 | 21 | -webkit-hyphens: none; 22 | -moz-hyphens: none; 23 | -ms-hyphens: none; 24 | hyphens: none; 25 | } 26 | 27 | pre[class*="language-"], 28 | :not(pre) > code[class*="language-"] { 29 | background:hsl(0, 0%, 8%); /* #141414 */ 30 | } 31 | 32 | /* Code blocks */ 33 | pre[class*="language-"] { 34 | border-radius: .5em; 35 | border: .3em solid hsl(0,0%,33%); /* #282A2B */ 36 | box-shadow: 1px 1px .5em black inset; 37 | overflow: auto; 38 | padding: 1em; 39 | } 40 | pre[class*="language-"]::selection { /* Safari */ 41 | background:hsl(200, 4%, 16%); /* #282A2B */ 42 | } 43 | pre[class*="language-"]::selection { /* Firefox */ 44 | background:hsl(200, 4%, 16%); /* #282A2B */ 45 | } 46 | 47 | /* Text Selection colour */ 48 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 49 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 50 | text-shadow: none; 51 | background: hsla(0,0%,93%,0.15); /* #EDEDED */ 52 | } 53 | 54 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 55 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 56 | text-shadow: none; 57 | background: hsla(0,0%,93%,0.15); /* #EDEDED */ 58 | } 59 | 60 | /* Inline code */ 61 | :not(pre) > code[class*="language-"] { 62 | border-radius: .3em; 63 | border: .13em solid hsl(0,0%,33%); /* #545454 */ 64 | box-shadow: 1px 1px .3em -.1em black inset; 65 | padding: .15em .2em .05em; 66 | } 67 | 68 | .token.comment, 69 | .token.prolog, 70 | .token.doctype, 71 | .token.cdata { 72 | color: hsl(0, 0%, 47%); /* #777777 */ 73 | } 74 | 75 | .token.punctuation { 76 | opacity: .7; 77 | } 78 | 79 | .namespace { 80 | opacity: .7; 81 | } 82 | 83 | .token.tag, 84 | .token.boolean, 85 | .token.number { 86 | color: hsl(14, 58%, 55%); /* #CF6A4C */ 87 | } 88 | 89 | .token.keyword, 90 | .token.property, 91 | .token.selector, 92 | .token.constant, 93 | .token.symbol, 94 | .token.builtin { 95 | color:hsl(53, 89%, 79%); /* #F9EE98 */ 96 | } 97 | .token.attr-name, 98 | .token.attr-value, 99 | .token.string, 100 | .token.operator, 101 | .token.entity, 102 | .token.url, 103 | .language-css .token.string, 104 | .style .token.string, 105 | .token.variable { 106 | color:hsl(76, 21%, 52%); /* #8F9D6A */ 107 | } 108 | 109 | .token.atrule { 110 | color:hsl(218, 22%, 55%); /* #7587A6 */ 111 | } 112 | 113 | .token.regex, 114 | .token.important { 115 | color: hsl(42, 75%, 65%); /* #E9C062 */ 116 | } 117 | 118 | .token.important { 119 | font-weight: bold; 120 | } 121 | 122 | .token.entity { 123 | cursor: help; 124 | } 125 | pre[data-line] { 126 | padding: 1em 0 1em 3em; 127 | position: relative; 128 | } 129 | 130 | /* Markup */ 131 | .language-markup .token.tag, 132 | .language-markup .token.attr-name, 133 | .language-markup .token.punctuation { 134 | color: hsl(33, 33%, 52%); /* #AC885B */ 135 | } 136 | 137 | /* Make the tokens sit above the line highlight so the colours don't look faded. */ 138 | .token { 139 | position:relative; 140 | z-index:1; 141 | } 142 | .line-highlight { 143 | background: -moz-linear-gradient(left, hsla(0, 0%, 33%,.1) 70%, hsla(0, 0%, 33%,0)); /* #545454 */ 144 | background: -o-linear-gradient(left, hsla(0, 0%, 33%,.1) 70%, hsla(0, 0%, 33%,0)); /* #545454 */ 145 | background: -webkit-linear-gradient(left, hsla(0, 0%, 33%,.1) 70%, hsla(0, 0%, 33%,0)); /* #545454 */ 146 | background: hsla(0, 0%, 33%, 0.25); /* #545454 */ 147 | background: linear-gradient(left, hsla(0, 0%, 33%,.1) 70%, hsla(0, 0%, 33%,0)); /* #545454 */ 148 | border-bottom:1px dashed hsl(0, 0%, 33%); /* #545454 */ 149 | border-top:1px dashed hsl(0, 0%, 33%); /* #545454 */ 150 | left: 0; 151 | line-height: inherit; 152 | margin-top: 0.75em; /* Same as .prism’s padding-top */ 153 | padding: inherit 0; 154 | pointer-events: none; 155 | position: absolute; 156 | right: 0; 157 | white-space: pre; 158 | z-index:0; 159 | } 160 | .line-highlight:before, 161 | .line-highlight[data-end]:after { 162 | background-color: hsl(215, 15%, 59%); /* #8794A6 */ 163 | border-radius: 999px; 164 | box-shadow: 0 1px white; 165 | color: hsl(24, 20%, 95%); /* #F5F2F0 */ 166 | content: attr(data-start); 167 | font: bold 65%/1.5 sans-serif; 168 | left: .6em; 169 | min-width: 1em; 170 | padding: 0 .5em; 171 | position: absolute; 172 | text-align: center; 173 | text-shadow: none; 174 | top: .4em; 175 | vertical-align: .3em; 176 | } 177 | .line-highlight[data-end]:after { 178 | bottom: .4em; 179 | content: attr(data-end); 180 | top: auto; 181 | } 182 | -------------------------------------------------------------------------------- /highlighter/themes/prism-coy.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Coy theme for JavaScript, CoffeeScript, CSS and HTML 3 | * Based on https://github.com/tshedor/workshop-wp-theme (Example: http://workshop.kansan.com/category/sessions/basics or http://workshop.timshedor.com/category/sessions/basics); 4 | * @author Tim Shedor 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: black; 10 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 11 | direction: ltr; 12 | text-align: left; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | 17 | -moz-tab-size: 4; 18 | -o-tab-size: 4; 19 | tab-size: 4; 20 | 21 | -webkit-hyphens: none; 22 | -moz-hyphens: none; 23 | -ms-hyphens: none; 24 | hyphens: none; 25 | } 26 | 27 | /* Code blocks */ 28 | pre[class*="language-"] { 29 | position:relative; 30 | padding: 1em; 31 | margin: .5em 0; 32 | -webkit-box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 33 | -moz-box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 34 | box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 35 | border-left: 10px solid #358ccb; 36 | background-color: #fdfdfd; 37 | background-image: -webkit-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 38 | background-image: -moz-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 39 | background-image: -ms-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 40 | background-image: -o-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 41 | background-image: linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 42 | background-size: 3em 3em; 43 | background-origin:content-box; 44 | overflow:visible; 45 | max-height:30em; 46 | } 47 | 48 | code[class*="language"] { 49 | max-height:29em; 50 | display:block; 51 | overflow:scroll; 52 | } 53 | 54 | /* Margin bottom to accomodate shadow */ 55 | :not(pre) > code[class*="language-"], 56 | pre[class*="language-"] { 57 | background-color:#fdfdfd; 58 | -webkit-box-sizing: border-box; 59 | -moz-box-sizing: border-box; 60 | box-sizing: border-box; 61 | margin-bottom: 1em; 62 | } 63 | 64 | /* Inline code */ 65 | :not(pre) > code[class*="language-"] { 66 | position:relative; 67 | padding: .2em; 68 | -webkit-border-radius: 0.3em; 69 | -moz-border-radius: 0.3em; 70 | -ms-border-radius: 0.3em; 71 | -o-border-radius: 0.3em; 72 | border-radius: 0.3em; 73 | color: #c92c2c; 74 | border: 1px solid rgba(0, 0, 0, 0.1); 75 | } 76 | 77 | pre[class*="language-"]:before, 78 | pre[class*="language-"]:after { 79 | content: ''; 80 | z-index: -2; 81 | display:block; 82 | position: absolute; 83 | bottom: 0.75em; 84 | left: 0.18em; 85 | width: 40%; 86 | height: 20%; 87 | -webkit-box-shadow: 0px 13px 8px #979797; 88 | -moz-box-shadow: 0px 13px 8px #979797; 89 | box-shadow: 0px 13px 8px #979797; 90 | -webkit-transform: rotate(-2deg); 91 | -moz-transform: rotate(-2deg); 92 | -ms-transform: rotate(-2deg); 93 | -o-transform: rotate(-2deg); 94 | transform: rotate(-2deg); 95 | } 96 | 97 | :not(pre) > code[class*="language-"]:after, 98 | pre[class*="language-"]:after { 99 | right: 0.75em; 100 | left: auto; 101 | -webkit-transform: rotate(2deg); 102 | -moz-transform: rotate(2deg); 103 | -ms-transform: rotate(2deg); 104 | -o-transform: rotate(2deg); 105 | transform: rotate(2deg); 106 | } 107 | 108 | .token.comment, 109 | .token.block-comment, 110 | .token.prolog, 111 | .token.doctype, 112 | .token.cdata { 113 | color: #7D8B99; 114 | } 115 | 116 | .token.punctuation { 117 | color: #5F6364; 118 | } 119 | 120 | .token.property, 121 | .token.tag, 122 | .token.boolean, 123 | .token.number, 124 | .token.function-name, 125 | .token.constant, 126 | .token.symbol { 127 | color: #c92c2c; 128 | } 129 | 130 | .token.selector, 131 | .token.attr-name, 132 | .token.string, 133 | .token.function, 134 | .token.builtin { 135 | color: #2f9c0a; 136 | } 137 | 138 | .token.operator, 139 | .token.entity, 140 | .token.url, 141 | .token.variable { 142 | color: #a67f59; 143 | background: rgba(255, 255, 255, 0.5); 144 | } 145 | 146 | .token.atrule, 147 | .token.attr-value, 148 | .token.keyword, 149 | .token.class-name { 150 | color: #1990b8; 151 | } 152 | 153 | .token.regex, 154 | .token.important { 155 | color: #e90; 156 | } 157 | .language-css .token.string, 158 | .style .token.string { 159 | color: #a67f59; 160 | background: rgba(255, 255, 255, 0.5); 161 | } 162 | 163 | .token.important { 164 | font-weight: normal; 165 | } 166 | 167 | .token.entity { 168 | cursor: help; 169 | } 170 | 171 | .namespace { 172 | opacity: .7; 173 | } 174 | 175 | @media screen and (max-width:767px){ 176 | pre[class*="language-"]:before, 177 | pre[class*="language-"]:after { 178 | bottom:14px; 179 | -webkit-box-shadow:none; 180 | -moz-box-shadow:none; 181 | box-shadow:none; 182 | } 183 | 184 | } 185 | 186 | /* Plugin styles */ 187 | .token.tab:not(:empty):before, 188 | .token.cr:before, 189 | .token.lf:before { 190 | color: #e0d7d1; 191 | } 192 | -------------------------------------------------------------------------------- /highlighter/prefixfree.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * StyleFix 1.0.3 & PrefixFree 1.0.7 3 | * @author Lea Verou 4 | * MIT license 5 | */(function(){function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}if(!window.addEventListener)return;var e=window.StyleFix={link:function(t){try{if(t.rel!=="stylesheet"||t.hasAttribute("data-noprefix"))return}catch(n){return}var r=t.href||t.getAttribute("data-href"),i=r.replace(/[^\/]+$/,""),s=t.parentNode,o=new XMLHttpRequest,u;o.onreadystatechange=function(){o.readyState===4&&u()};u=function(){var n=o.responseText;if(n&&t.parentNode&&(!o.status||o.status<400||o.status>600)){n=e.fix(n,!0,t);if(i){n=n.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,t,n){return/^([a-z]{3,10}:|\/|#)/i.test(n)?e:'url("'+i+n+'")'});var r=i.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");n=n.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+r,"gi"),"$1")}var u=document.createElement("style");u.textContent=n;u.media=t.media;u.disabled=t.disabled;u.setAttribute("data-href",t.getAttribute("href"));s.insertBefore(u,t);s.removeChild(t);u.media=t.media}};try{o.open("GET",r);o.send(null)}catch(n){if(typeof XDomainRequest!="undefined"){o=new XDomainRequest;o.onerror=o.onprogress=function(){};o.onload=u;o.open("GET",r);o.send(null)}}t.setAttribute("data-inprogress","")},styleElement:function(t){if(t.hasAttribute("data-noprefix"))return;var n=t.disabled;t.textContent=e.fix(t.textContent,!0,t);t.disabled=n},styleAttribute:function(t){var n=t.getAttribute("style");n=e.fix(n,!1,t);t.setAttribute("style",n)},process:function(){t('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link);t("style").forEach(StyleFix.styleElement);t("[style]").forEach(StyleFix.styleAttribute)},register:function(t,n){(e.fixers=e.fixers||[]).splice(n===undefined?e.fixers.length:n,0,t)},fix:function(t,n,r){for(var i=0;i-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig,function(e,t,n,r){r=Math.abs(r-450)%360;return t+(n||"")+"linear-gradient("+r+"deg"}));e=t("functions","(\\s|:|,)","\\s*\\(","$1"+s+"$2(",e);e=t("keywords","(\\s|:)","(\\s|;|\\}|$)","$1"+s+"$2$3",e);e=t("properties","(^|\\{|\\s|;)","\\s*:","$1"+s+"$2:",e);if(n.properties.length){var o=RegExp("\\b("+n.properties.join("|")+")(?!:)","gi");e=t("valueProperties","\\b",":(.+?);",function(e){return e.replace(o,s+"$1")},e)}if(r){e=t("selectors","","\\b",n.prefixSelector,e);e=t("atrules","@","\\b","@"+s+"$1",e)}e=e.replace(RegExp("-"+s,"g"),"-");e=e.replace(/-\*-(?=[a-z]+)/gi,n.prefix);return e},property:function(e){return(n.properties.indexOf(e)?n.prefix:"")+e},value:function(e,r){e=t("functions","(^|\\s|,)","\\s*\\(","$1"+n.prefix+"$2(",e);e=t("keywords","(^|\\s)","(\\s|$)","$1"+n.prefix+"$2$3",e);return e},prefixSelector:function(e){return e.replace(/^:{1,2}/,function(e){return e+n.prefix})},prefixProperty:function(e,t){var r=n.prefix+e;return t?StyleFix.camelCase(r):r}};(function(){var e={},t=[],r={},i=getComputedStyle(document.documentElement,null),s=document.createElement("div").style,o=function(n){if(n.charAt(0)==="-"){t.push(n);var r=n.split("-"),i=r[1];e[i]=++e[i]||1;while(r.length>3){r.pop();var s=r.join("-");u(s)&&t.indexOf(s)===-1&&t.push(s)}}},u=function(e){return StyleFix.camelCase(e)in s};if(i.length>0)for(var a=0;a a { 53 | text-decoration: none; 54 | } 55 | 56 | section h1 > a:before { 57 | content: '§'; 58 | position: absolute; 59 | padding: 0 .2em; 60 | margin-left: -1em; 61 | border-radius: .2em; 62 | color: silver; 63 | text-shadow: 0 1px white; 64 | } 65 | 66 | section h1 > a:hover:before { 67 | color: black; 68 | background: #f1ad26; 69 | } 70 | 71 | p { 72 | margin: 1em 0; 73 | } 74 | 75 | section h1, 76 | h2 { 77 | margin: 1em 0 .3em; 78 | } 79 | 80 | dt { 81 | margin: 1em 0 0 0; 82 | font-size: 130%; 83 | } 84 | 85 | dt:after { 86 | content: ':'; 87 | } 88 | 89 | dd { 90 | margin-left: 2em; 91 | } 92 | 93 | strong { 94 | font-weight: bold; 95 | } 96 | 97 | code, pre { 98 | font-family: Consolas, Monaco, 'Andale Mono', 'Lucida Console', monospace; 99 | hyphens: none; 100 | } 101 | 102 | pre { 103 | margin:0px 10px; 104 | /* max-height: 550px; */ 105 | overflow: auto; 106 | } 107 | 108 | pre > code.highlight { 109 | outline: .4em solid red; 110 | outline-offset: .4em; 111 | } 112 | 113 | header, 114 | body > section { 115 | display: block; 116 | max-width: 900px; 117 | margin: auto; 118 | } 119 | 120 | header, footer { 121 | position: relative; 122 | padding: 30px -webkit-calc(50% - 450px); /* Workaround for bug */ 123 | padding: 30px calc(50% - 450px); 124 | color: white; 125 | text-shadow: 0 -1px 2px black; 126 | background: url(img/spectrum.png) fixed; 127 | } 128 | 129 | header:before, 130 | footer:before { 131 | content: ''; 132 | position: absolute; 133 | bottom: 0; left: 0; right: 0; 134 | height: 20px; 135 | background-size: 20px 40px; 136 | background-repeat: repeat-x; 137 | background-image: linear-gradient(45deg, transparent 34%, white 34%, white 66%, transparent 66%), 138 | linear-gradient(135deg, transparent 34%, white 34%, white 66%, transparent 66%); 139 | } 140 | 141 | header { 142 | 143 | } 144 | 145 | header .intro, 146 | html.simple header { 147 | overflow: hidden; 148 | } 149 | 150 | header h1 { 151 | float: left; 152 | margin-right: 30px; 153 | color: #7fab14; 154 | text-align: center; 155 | font-size: 140%; 156 | text-transform: uppercase; 157 | letter-spacing: .25em; 158 | } 159 | 160 | header h2 { 161 | margin-top: .5em; 162 | color: #f1ad26; 163 | } 164 | 165 | header h1 a { 166 | text-decoration: none; 167 | } 168 | 169 | header img { 170 | display: block; 171 | width: 150px; 172 | height: 128px; 173 | margin-bottom: .3em; 174 | border: 0; 175 | } 176 | 177 | header h2 { 178 | font-size: 300%; 179 | } 180 | 181 | header .intro p { 182 | margin: 0; 183 | font: 150%/1.4 Questrial, sans-serif; 184 | font-size: 150%; 185 | } 186 | 187 | #features { 188 | width: 66em; 189 | margin-top: 2em; 190 | font-size: 80%; 191 | } 192 | 193 | #features li { 194 | margin: 0 0 2em 0; 195 | list-style: none; 196 | display: inline-block; 197 | width: 27em; 198 | vertical-align: top; 199 | } 200 | 201 | #features li:nth-child(odd) { 202 | margin-right: 5em; 203 | } 204 | 205 | #features li:before { 206 | content: '✓'; 207 | float: left; 208 | margin-left: -.8em; 209 | color: #7fab14; 210 | font-size: 400%; 211 | line-height: 1; 212 | } 213 | 214 | #features li strong { 215 | display: block; 216 | margin-bottom: .1em; 217 | font-size: 200%; 218 | } 219 | 220 | header .download-button { 221 | float: right; 222 | margin: 0 0 .5em .5em; 223 | } 224 | 225 | #theme { 226 | position: relative; 227 | z-index: 1; 228 | float: right; 229 | margin-right: -1em; 230 | text-align: center; 231 | text-transform: uppercase; 232 | letter-spacing: .2em; 233 | } 234 | 235 | #theme > p { 236 | position: absolute; 237 | left: 100%; 238 | transform: translateX(50%) rotate(90deg) ; 239 | transform-origin: top left; 240 | font-size: 130%; 241 | } 242 | 243 | #theme > label { 244 | position: relative; 245 | display: block; 246 | width: 7em; 247 | line-height: 1em; 248 | padding: 3em 0; 249 | border-radius: 50%; 250 | background: hsla(0,0%,100%,.5); 251 | cursor: pointer; 252 | font-size: 110%; 253 | } 254 | 255 | #theme > label:before { 256 | content: ''; 257 | position: absolute; 258 | top: 0; right: 0; bottom: 0; left: 0; 259 | z-index: -1; 260 | border-radius: inherit; 261 | background: url(img/spectrum.png) fixed; 262 | } 263 | 264 | #theme > label:nth-of-type(n+2) { 265 | margin-top: -2.5em; 266 | } 267 | 268 | #theme > input:not(:checked) + label:hover { 269 | background: hsla(77, 80%, 60%, .5); 270 | } 271 | 272 | #theme > input { 273 | position: absolute; 274 | clip: rect(0,0,0,0); 275 | } 276 | 277 | #theme > input:checked + label { 278 | background: #7fab14; 279 | } 280 | 281 | footer { 282 | margin-top: 2em; 283 | background-position: bottom; 284 | color: white; 285 | text-shadow: 0 -1px 2px black; 286 | } 287 | 288 | footer:before { 289 | bottom: auto; 290 | top: 0; 291 | background-position: bottom; 292 | } 293 | 294 | footer p { 295 | font-size: 150%; 296 | } 297 | 298 | footer ul { 299 | column-count: 3; 300 | } 301 | 302 | .download-button { 303 | display: block; 304 | padding: .2em .8em .1em; 305 | border: 1px solid rgba(0,0,0,0.5); 306 | border-radius: 10px; 307 | background: #39a1cf; 308 | box-shadow: 0 2px 10px black, 309 | inset 0 1px hsla(0,0%,100%,.3), 310 | inset 0 .4em hsla(0,0%,100%,.2), 311 | inset 0 10px 20px hsla(0,0%,100%,.25), 312 | inset 0 -15px 30px rgba(0,0,0,0.3); 313 | color: white; 314 | text-shadow: 0 -1px 2px black; 315 | text-align: center; 316 | font-size: 250%; 317 | line-height: 1.5; 318 | text-transform: uppercase; 319 | text-decoration: none; 320 | hyphens: manual; 321 | } 322 | 323 | .download-button:hover { 324 | background-color: #7fab14; 325 | } 326 | 327 | .download-button:active { 328 | box-shadow: inset 0 2px 8px rgba(0,0,0,.8); 329 | } 330 | 331 | #toc { 332 | position: fixed; 333 | left: 1%; 334 | max-width: calc(48% - 450px); 335 | font-size: 80%; 336 | opacity: .3; 337 | } 338 | 339 | @media (max-width: 1200px) { 340 | #toc { 341 | display: none; 342 | } 343 | } 344 | 345 | #toc:hover { 346 | opacity: 1; 347 | } 348 | 349 | #toc h1 { 350 | font-size: 180%; 351 | } 352 | 353 | #toc li { 354 | list-style: none; 355 | } 356 | 357 | #logo:before { 358 | content: '☠'; 359 | float: right; 360 | font: 100px/1.6 LeaVerou; 361 | } 362 | 363 | #used-by img { 364 | max-width: 200px; 365 | margin-right: 20px; 366 | vertical-align: middle; 367 | } -------------------------------------------------------------------------------- /JS/filesaver.js: -------------------------------------------------------------------------------- 1 | /* FileSaver.js 2 | * A saveAs() FileSaver implementation. 3 | * 2013-01-23 4 | * 5 | * By Eli Grey, http://eligrey.com 6 | * License: X11/MIT 7 | * See LICENSE.md 8 | */ 9 | 10 | /*global self */ 11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, 12 | plusplus: true */ 13 | 14 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ 15 | 16 | var saveAs = saveAs 17 | || (navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator)) 18 | || (function(view) { 19 | "use strict"; 20 | var 21 | doc = view.document 22 | // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet 23 | , get_URL = function() { 24 | return view.URL || view.webkitURL || view; 25 | } 26 | , URL = view.URL || view.webkitURL || view 27 | , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") 28 | , can_use_save_link = !view.externalHost && "download" in save_link 29 | , click = function(node) { 30 | var event = doc.createEvent("MouseEvents"); 31 | event.initMouseEvent( 32 | "click", true, false, view, 0, 0, 0, 0, 0 33 | , false, false, false, false, 0, null 34 | ); 35 | node.dispatchEvent(event); 36 | } 37 | , webkit_req_fs = view.webkitRequestFileSystem 38 | , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem 39 | , throw_outside = function (ex) { 40 | (view.setImmediate || view.setTimeout)(function() { 41 | throw ex; 42 | }, 0); 43 | } 44 | , force_saveable_type = "application/octet-stream" 45 | , fs_min_size = 0 46 | , deletion_queue = [] 47 | , process_deletion_queue = function() { 48 | var i = deletion_queue.length; 49 | while (i--) { 50 | var file = deletion_queue[i]; 51 | if (typeof file === "string") { // file is an object URL 52 | URL.revokeObjectURL(file); 53 | } else { // file is a File 54 | file.remove(); 55 | } 56 | } 57 | deletion_queue.length = 0; // clear queue 58 | } 59 | , dispatch = function(filesaver, event_types, event) { 60 | event_types = [].concat(event_types); 61 | var i = event_types.length; 62 | while (i--) { 63 | var listener = filesaver["on" + event_types[i]]; 64 | if (typeof listener === "function") { 65 | try { 66 | listener.call(filesaver, event || filesaver); 67 | } catch (ex) { 68 | throw_outside(ex); 69 | } 70 | } 71 | } 72 | } 73 | , FileSaver = function(blob, name) { 74 | // First try a.download, then web filesystem, then object URLs 75 | var 76 | filesaver = this 77 | , type = blob.type 78 | , blob_changed = false 79 | , object_url 80 | , target_view 81 | , get_object_url = function() { 82 | var object_url = get_URL().createObjectURL(blob); 83 | deletion_queue.push(object_url); 84 | return object_url; 85 | } 86 | , dispatch_all = function() { 87 | dispatch(filesaver, "writestart progress write writeend".split(" ")); 88 | } 89 | // on any filesys errors revert to saving with object URLs 90 | , fs_error = function() { 91 | // don't create more object URLs than needed 92 | if (blob_changed || !object_url) { 93 | object_url = get_object_url(blob); 94 | } 95 | if (target_view) { 96 | target_view.location.href = object_url; 97 | } else { 98 | window.open(object_url, "_blank"); 99 | } 100 | filesaver.readyState = filesaver.DONE; 101 | dispatch_all(); 102 | } 103 | , abortable = function(func) { 104 | return function() { 105 | if (filesaver.readyState !== filesaver.DONE) { 106 | return func.apply(this, arguments); 107 | } 108 | }; 109 | } 110 | , create_if_not_found = {create: true, exclusive: false} 111 | , slice 112 | ; 113 | filesaver.readyState = filesaver.INIT; 114 | if (!name) { 115 | name = "download"; 116 | } 117 | if (can_use_save_link) { 118 | object_url = get_object_url(blob); 119 | save_link.href = object_url; 120 | save_link.download = name; 121 | click(save_link); 122 | filesaver.readyState = filesaver.DONE; 123 | dispatch_all(); 124 | return; 125 | } 126 | // Object and web filesystem URLs have a problem saving in Google Chrome when 127 | // viewed in a tab, so I force save with application/octet-stream 128 | // http://code.google.com/p/chromium/issues/detail?id=91158 129 | if (view.chrome && type && type !== force_saveable_type) { 130 | slice = blob.slice || blob.webkitSlice; 131 | blob = slice.call(blob, 0, blob.size, force_saveable_type); 132 | blob_changed = true; 133 | } 134 | // Since I can't be sure that the guessed media type will trigger a download 135 | // in WebKit, I append .download to the filename. 136 | // https://bugs.webkit.org/show_bug.cgi?id=65440 137 | if (webkit_req_fs && name !== "download") { 138 | name += ".download"; 139 | } 140 | if (type === force_saveable_type || webkit_req_fs) { 141 | target_view = view; 142 | } 143 | if (!req_fs) { 144 | fs_error(); 145 | return; 146 | } 147 | fs_min_size += blob.size; 148 | req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) { 149 | fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) { 150 | var save = function() { 151 | dir.getFile(name, create_if_not_found, abortable(function(file) { 152 | file.createWriter(abortable(function(writer) { 153 | writer.onwriteend = function(event) { 154 | target_view.location.href = file.toURL(); 155 | deletion_queue.push(file); 156 | filesaver.readyState = filesaver.DONE; 157 | dispatch(filesaver, "writeend", event); 158 | }; 159 | writer.onerror = function() { 160 | var error = writer.error; 161 | if (error.code !== error.ABORT_ERR) { 162 | fs_error(); 163 | } 164 | }; 165 | "writestart progress write abort".split(" ").forEach(function(event) { 166 | writer["on" + event] = filesaver["on" + event]; 167 | }); 168 | writer.write(blob); 169 | filesaver.abort = function() { 170 | writer.abort(); 171 | filesaver.readyState = filesaver.DONE; 172 | }; 173 | filesaver.readyState = filesaver.WRITING; 174 | }), fs_error); 175 | }), fs_error); 176 | }; 177 | dir.getFile(name, {create: false}, abortable(function(file) { 178 | // delete file if it already exists 179 | file.remove(); 180 | save(); 181 | }), abortable(function(ex) { 182 | if (ex.code === ex.NOT_FOUND_ERR) { 183 | save(); 184 | } else { 185 | fs_error(); 186 | } 187 | })); 188 | }), fs_error); 189 | }), fs_error); 190 | } 191 | , FS_proto = FileSaver.prototype 192 | , saveAs = function(blob, name) { 193 | return new FileSaver(blob, name); 194 | } 195 | ; 196 | FS_proto.abort = function() { 197 | var filesaver = this; 198 | filesaver.readyState = filesaver.DONE; 199 | dispatch(filesaver, "abort"); 200 | }; 201 | FS_proto.readyState = FS_proto.INIT = 0; 202 | FS_proto.WRITING = 1; 203 | FS_proto.DONE = 2; 204 | 205 | FS_proto.error = 206 | FS_proto.onwritestart = 207 | FS_proto.onprogress = 208 | FS_proto.onwrite = 209 | FS_proto.onabort = 210 | FS_proto.onerror = 211 | FS_proto.onwriteend = 212 | null; 213 | 214 | view.addEventListener("unload", process_deletion_queue, false); 215 | return saveAs; 216 | }(self)); 217 | 218 | if (typeof module !== 'undefined') module.exports = saveAs; -------------------------------------------------------------------------------- /highlighter/prism.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* ********************************************** 4 | Begin prism-core.js 5 | ********************************************** */ 6 | 7 | /** 8 | * Prism: Lightweight, robust, elegant syntax highlighting 9 | * MIT license http://www.opensource.org/licenses/mit-license.php/ 10 | * @author Lea Verou http://lea.verou.me 11 | */ 12 | 13 | (function(){ 14 | 15 | // Private helper vars 16 | var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; 17 | 18 | var _ = self.Prism = { 19 | util: { 20 | type: function (o) { 21 | return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1]; 22 | }, 23 | 24 | // Deep clone a language definition (e.g. to extend it) 25 | clone: function (o) { 26 | var type = _.util.type(o); 27 | 28 | switch (type) { 29 | case 'Object': 30 | var clone = {}; 31 | 32 | for (var key in o) { 33 | if (o.hasOwnProperty(key)) { 34 | clone[key] = _.util.clone(o[key]); 35 | } 36 | } 37 | 38 | return clone; 39 | 40 | case 'Array': 41 | return o.slice(); 42 | } 43 | 44 | return o; 45 | } 46 | }, 47 | 48 | languages: { 49 | extend: function (id, redef) { 50 | var lang = _.util.clone(_.languages[id]); 51 | 52 | for (var key in redef) { 53 | lang[key] = redef[key]; 54 | } 55 | 56 | return lang; 57 | }, 58 | 59 | // Insert a token before another token in a language literal 60 | insertBefore: function (inside, before, insert, root) { 61 | root = root || _.languages; 62 | var grammar = root[inside]; 63 | var ret = {}; 64 | 65 | for (var token in grammar) { 66 | 67 | if (grammar.hasOwnProperty(token)) { 68 | 69 | if (token == before) { 70 | 71 | for (var newToken in insert) { 72 | 73 | if (insert.hasOwnProperty(newToken)) { 74 | ret[newToken] = insert[newToken]; 75 | } 76 | } 77 | } 78 | 79 | ret[token] = grammar[token]; 80 | } 81 | } 82 | 83 | return root[inside] = ret; 84 | }, 85 | 86 | // Traverse a language definition with Depth First Search 87 | DFS: function(o, callback) { 88 | for (var i in o) { 89 | callback.call(o, i, o[i]); 90 | 91 | if (_.util.type(o) === 'Object') { 92 | _.languages.DFS(o[i], callback); 93 | } 94 | } 95 | } 96 | }, 97 | 98 | highlightAll: function(async, callback) { 99 | var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'); 100 | 101 | for (var i=0, element; element = elements[i++];) { 102 | _.highlightElement(element, async === true, callback); 103 | } 104 | }, 105 | 106 | highlightElement: function(element, async, callback) { 107 | // Find language 108 | var language, grammar, parent = element; 109 | 110 | while (parent && !lang.test(parent.className)) { 111 | parent = parent.parentNode; 112 | } 113 | 114 | if (parent) { 115 | language = (parent.className.match(lang) || [,''])[1]; 116 | grammar = _.languages[language]; 117 | } 118 | 119 | if (!grammar) { 120 | return; 121 | } 122 | 123 | // Set language on the element, if not present 124 | element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; 125 | 126 | // Set language on the parent, for styling 127 | parent = element.parentNode; 128 | 129 | if (/pre/i.test(parent.nodeName)) { 130 | parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; 131 | } 132 | 133 | var code = element.textContent; 134 | 135 | if(!code) { 136 | return; 137 | } 138 | 139 | code = code.replace(/&/g, '&').replace(/ text.length) { 218 | // Something went terribly wrong, ABORT, ABORT! 219 | break tokenloop; 220 | } 221 | 222 | if (str instanceof Token) { 223 | continue; 224 | } 225 | 226 | pattern.lastIndex = 0; 227 | 228 | var match = pattern.exec(str); 229 | 230 | if (match) { 231 | if(lookbehind) { 232 | lookbehindLength = match[1].length; 233 | } 234 | 235 | var from = match.index - 1 + lookbehindLength, 236 | match = match[0].slice(lookbehindLength), 237 | len = match.length, 238 | to = from + len, 239 | before = str.slice(0, from + 1), 240 | after = str.slice(to + 1); 241 | 242 | var args = [i, 1]; 243 | 244 | if (before) { 245 | args.push(before); 246 | } 247 | 248 | var wrapped = new Token(token, inside? _.tokenize(match, inside) : match); 249 | 250 | args.push(wrapped); 251 | 252 | if (after) { 253 | args.push(after); 254 | } 255 | 256 | Array.prototype.splice.apply(strarr, args); 257 | } 258 | } 259 | } 260 | 261 | return strarr; 262 | }, 263 | 264 | hooks: { 265 | all: {}, 266 | 267 | add: function (name, callback) { 268 | var hooks = _.hooks.all; 269 | 270 | hooks[name] = hooks[name] || []; 271 | 272 | hooks[name].push(callback); 273 | }, 274 | 275 | run: function (name, env) { 276 | var callbacks = _.hooks.all[name]; 277 | 278 | if (!callbacks || !callbacks.length) { 279 | return; 280 | } 281 | 282 | for (var i=0, callback; callback = callbacks[i++];) { 283 | callback(env); 284 | } 285 | } 286 | } 287 | }; 288 | 289 | var Token = _.Token = function(type, content) { 290 | this.type = type; 291 | this.content = content; 292 | }; 293 | 294 | Token.stringify = function(o, language, parent) { 295 | if (typeof o == 'string') { 296 | return o; 297 | } 298 | 299 | if (Object.prototype.toString.call(o) == '[object Array]') { 300 | return o.map(function(element) { 301 | return Token.stringify(element, language, o); 302 | }).join(''); 303 | } 304 | 305 | var env = { 306 | type: o.type, 307 | content: Token.stringify(o.content, language, parent), 308 | tag: 'span', 309 | classes: ['token', o.type], 310 | attributes: {}, 311 | language: language, 312 | parent: parent 313 | }; 314 | 315 | if (env.type == 'comment') { 316 | env.attributes['spellcheck'] = 'true'; 317 | } 318 | 319 | _.hooks.run('wrap', env); 320 | 321 | var attributes = ''; 322 | 323 | for (var name in env.attributes) { 324 | attributes += name + '="' + (env.attributes[name] || '') + '"'; 325 | } 326 | 327 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; 328 | 329 | }; 330 | 331 | if (!self.document) { 332 | // In worker 333 | self.addEventListener('message', function(evt) { 334 | var message = JSON.parse(evt.data), 335 | lang = message.language, 336 | code = message.code; 337 | 338 | self.postMessage(JSON.stringify(_.tokenize(code, _.languages[lang]))); 339 | self.close(); 340 | }, false); 341 | 342 | return; 343 | } 344 | 345 | // Get current script and highlight 346 | var script = document.getElementsByTagName('script'); 347 | 348 | script = script[script.length - 1]; 349 | 350 | if (script) { 351 | _.filename = script.src; 352 | 353 | if (document.addEventListener && !script.hasAttribute('data-manual')) { 354 | document.addEventListener('DOMContentLoaded', _.highlightAll); 355 | } 356 | } 357 | 358 | })(); 359 | 360 | /* ********************************************** 361 | Begin prism-markup.js 362 | ********************************************** */ 363 | 364 | Prism.languages.markup = { 365 | 'comment': /<!--[\w\W]*?-->/g, 366 | 'prolog': /<\?.+?\?>/, 367 | 'doctype': /<!DOCTYPE.+?>/, 368 | 'cdata': /<!\[CDATA\[[\w\W]*?]]>/i, 369 | 'tag': { 370 | pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi, 371 | inside: { 372 | 'tag': { 373 | pattern: /^<\/?[\w:-]+/i, 374 | inside: { 375 | 'punctuation': /^<\/?/, 376 | 'namespace': /^[\w-]+?:/ 377 | } 378 | }, 379 | 'attr-value': { 380 | pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi, 381 | inside: { 382 | 'punctuation': /=|>|"/g 383 | } 384 | }, 385 | 'punctuation': /\/?>/g, 386 | 'attr-name': { 387 | pattern: /[\w:-]+/g, 388 | inside: { 389 | 'namespace': /^[\w-]+?:/ 390 | } 391 | } 392 | 393 | } 394 | }, 395 | 'entity': /&#?[\da-z]{1,8};/gi 396 | }; 397 | 398 | // Plugin to make entity title show the real entity, idea by Roman Komarov 399 | Prism.hooks.add('wrap', function(env) { 400 | 401 | if (env.type === 'entity') { 402 | env.attributes['title'] = env.content.replace(/&/, '&'); 403 | } 404 | }); 405 | 406 | /* ********************************************** 407 | Begin prism-css.js 408 | ********************************************** */ 409 | 410 | Prism.languages.css = { 411 | 'comment': /\/\*[\w\W]*?\*\//g, 412 | 'atrule': { 413 | pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi, 414 | inside: { 415 | 'punctuation': /[;:]/g 416 | } 417 | }, 418 | 'url': /url\((["']?).*?\1\)/gi, 419 | 'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/g, 420 | 'property': /(\b|\B)[\w-]+(?=\s*:)/ig, 421 | 'string': /("|')(\\?.)*?\1/g, 422 | 'important': /\B!important\b/gi, 423 | 'ignore': /&(lt|gt|amp);/gi, 424 | 'punctuation': /[\{\};:]/g 425 | }; 426 | 427 | if (Prism.languages.markup) { 428 | Prism.languages.insertBefore('markup', 'tag', { 429 | 'style': { 430 | pattern: /(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig, 431 | inside: { 432 | 'tag': { 433 | pattern: /(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig, 434 | inside: Prism.languages.markup.tag.inside 435 | }, 436 | rest: Prism.languages.css 437 | } 438 | } 439 | }); 440 | } 441 | 442 | /* ********************************************** 443 | Begin prism-clike.js 444 | ********************************************** */ 445 | 446 | Prism.languages.clike = { 447 | 'comment': { 448 | pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g, 449 | lookbehind: true 450 | }, 451 | 'string': /("|')(\\?.)*?\1/g, 452 | 'class-name': { 453 | pattern: /((?:class|interface|extends|implements|trait|instanceof|new)\s+)[a-z0-9_\.\\]+/ig, 454 | lookbehind: true, 455 | inside: { 456 | punctuation: /(\.|\\)/ 457 | } 458 | }, 459 | 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g, 460 | 'boolean': /\b(true|false)\b/g, 461 | 'function': { 462 | pattern: /[a-z0-9_]+\(/ig, 463 | inside: { 464 | punctuation: /\(/ 465 | } 466 | }, 467 | 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, 468 | 'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g, 469 | 'ignore': /&(lt|gt|amp);/gi, 470 | 'punctuation': /[{}[\];(),.:]/g 471 | }; 472 | 473 | /* ********************************************** 474 | Begin prism-javascript.js 475 | ********************************************** */ 476 | 477 | Prism.languages.javascript = Prism.languages.extend('clike', { 478 | 'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g, 479 | 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g 480 | }); 481 | 482 | Prism.languages.insertBefore('javascript', 'keyword', { 483 | 'regex': { 484 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g, 485 | lookbehind: true 486 | } 487 | }); 488 | 489 | if (Prism.languages.markup) { 490 | Prism.languages.insertBefore('markup', 'tag', { 491 | 'script': { 492 | pattern: /(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig, 493 | inside: { 494 | 'tag': { 495 | pattern: /(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig, 496 | inside: Prism.languages.markup.tag.inside 497 | }, 498 | rest: Prism.languages.javascript 499 | } 500 | } 501 | }); 502 | } 503 | 504 | /* ********************************************** 505 | Begin prism-file-highlight.js 506 | ********************************************** */ 507 | 508 | (function(){ 509 | 510 | if (!self.Prism || !self.document || !document.querySelector) { 511 | return; 512 | } 513 | 514 | var Extensions = { 515 | 'js': 'javascript', 516 | 'html': 'markup', 517 | 'svg': 'markup' 518 | }; 519 | 520 | Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { 521 | var src = pre.getAttribute('data-src'); 522 | var extension = (src.match(/\.(\w+)$/) || [,''])[1]; 523 | var language = Extensions[extension] || extension; 524 | 525 | var code = document.createElement('code'); 526 | code.className = 'language-' + language; 527 | 528 | pre.textContent = ''; 529 | 530 | code.textContent = 'Loading…'; 531 | 532 | pre.appendChild(code); 533 | 534 | var xhr = new XMLHttpRequest(); 535 | 536 | xhr.open('GET', src, true); 537 | 538 | xhr.onreadystatechange = function() { 539 | if (xhr.readyState == 4) { 540 | 541 | if (xhr.status < 400 && xhr.responseText) { 542 | code.textContent = xhr.responseText; 543 | 544 | Prism.highlightElement(code); 545 | } 546 | else if (xhr.status >= 400) { 547 | code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; 548 | } 549 | else { 550 | code.textContent = '✖ Error: File does not exist or is empty'; 551 | } 552 | } 553 | }; 554 | 555 | xhr.send(null); 556 | }); 557 | 558 | })(); -------------------------------------------------------------------------------- /JS/index.js: -------------------------------------------------------------------------------- 1 | var canvas = document.getElementById('irrationalCanvas'); 2 | /* Colors for 0 to 9 */ 3 | var color_arr = new Array( "#FFFFFF", 4 | "#FFBB00", 5 | "#FF4500", 6 | "#FF0000", 7 | "#D02090", 8 | "#7B68EE", 9 | "#0000FF", 10 | "#7FFFD4", 11 | "#00FF00", 12 | "#ADFF2F"); 13 | var dots = new Array; 14 | var number_dots = 0; 15 | /* 16 | sA = start at the top (270 degrees) 17 | pA = one part is 36 degrees 18 | ld = last digit (array (last digit, in a row) (5999 => last digit = 9,in a row = 3) 19 | mp = midpoint (arc) 20 | br = big radius (from mp to arc) 21 | sr = small radius (from mp to end of lines) 22 | nods = number of digits 23 | irrat_name = name of irrational number (pi,e,golden_ratio,...) 24 | show_dots = true or false for a visualtization of sequences (see ld) 25 | */ 26 | var sA = (Math.PI / 180) * 270, 27 | pA = (Math.PI / 180) * 36, 28 | ld, 29 | mp = 350, 30 | br = 320, 31 | sr = 270, 32 | nods = GET("nods") ? parseInt(GET("nods")) : 800, 33 | irrat_name = GET("n") ? GET("n") : "pi", 34 | show_dots; 35 | var irrat_number,irrat_label; 36 | nods = nods+2; // +2 because nods = digits after point 37 | 38 | switch(GET("show_dots")) { 39 | case "true": 40 | show_dots = true; 41 | break; 42 | case "false": 43 | show_dots = false; 44 | sr = Math.floor((sr+br)/2); 45 | break; 46 | default: 47 | show_dots = true; 48 | } 49 | if (canvas && canvas.getContext) { 50 | var ctx = canvas.getContext("2d"); 51 | if (ctx) { 52 | draw_diagram(irrat_name,nods,show_dots); 53 | } 54 | } 55 | 56 | function draw_diagram(func_irrat_name,func_nods,func_show_dots) { 57 | irrat_name = func_irrat_name ? func_irrat_name : "pi"; 58 | nods = func_nods ? func_nods : 800; 59 | show_dots = func_show_dots ? func_show_dots : true; 60 | 61 | 62 | /* Black background */ 63 | ctx.fillStyle = "black"; 64 | ctx.fillRect(0,0,ctx.canvas.width, ctx.canvas.height); 65 | 66 | ctx.fillStyle = "white"; 67 | ctx.strokeStyle = "white"; 68 | ctx.font = "italic 60pt Arial"; 69 | switch (irrat_name) { 70 | case "pi": 71 | irrat_label = String.fromCharCode(parseInt('03C0', 16)); 72 | break; 73 | case "golden_ratio": 74 | irrat_label = String.fromCharCode(parseInt('03A6', 16)); // Phi 75 | break; 76 | case "e": 77 | irrat_label = "e"; 78 | break; 79 | default: 80 | var sqrt = irrat_name.substr(0,4); 81 | var sqrt_of = parseInt(irrat_name.substr(4)); 82 | if (sqrt == "sqrt" && sqrt_of >=2 && sqrt_of <=8 && sqrt_of !=4) { 83 | irrat_label = String.fromCharCode(parseInt('221A', 16))+irrat_name.substr(4); 84 | } else { 85 | alert("We don't have this number in our database :/"); 86 | // using pi instead because pi is awesome :D 87 | irrat_label = String.fromCharCode(parseInt('03C0', 16)); 88 | irrat_name = "pi"; 89 | } 90 | } 91 | 92 | // write irrat_label in the "middle" 93 | ctx.fillText(irrat_label, mp-35,mp+30); 94 | 95 | for (var i=0; i <= 9; i++) { 96 | // every digit has a color 97 | ctx.strokeStyle = color_arr[i]; 98 | ctx.lineWidth = 5; 99 | ctx.beginPath(); 100 | ctx.arc (mp, mp, br, sA+(i)*pA, sA+(i+1)*pA, false); 101 | ctx.stroke(); 102 | ctx.closePath(); 103 | ctx.fillStyle = "white"; 104 | ctx.strokeStyle = "white"; 105 | ctx.font = "italic 12pt Arial"; 106 | if (i > 4 && i < 7) { 107 | ctx.fillText(i.toString(), mp+(br+40)*Math.cos(sA+(i+0.5)*pA),mp+(br+40)*Math.sin(sA+(i+0.5)*pA)); 108 | } else { 109 | if (i == 3 || i == 4 || i == 7 || i == 8) { 110 | ctx.fillText(i.toString(), mp+(br+25)*Math.cos(sA+(i+0.5)*pA),mp+(br+25)*Math.sin(sA+(i+0.5)*pA)); 111 | } else { 112 | ctx.fillText(i.toString(), mp+(br+10)*Math.cos(sA+(i+0.5)*pA),mp+(br+10)*Math.sin(sA+(i+0.5)*pA)); 113 | } 114 | } 115 | } 116 | 117 | 118 | // supported irrational numbers (first 9999 digits) 119 | switch(irrat_name) { 120 | case "pi" : 121 | irrat_number = '3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796782354781636009341721641219924586315030286182974555706749838505494588586926995690927210797509302955321165344987202755960236480665499119881834797753566369807426542527862551818417574672890977772793800081647060016145249192173217214772350141441973568548161361157352552133475741849468438523323907394143334547762416862518983569485562099219222184272550254256887671790494601653466804988627232791786085784383827967976681454100953883786360950680064225125205117392984896084128488626945604241965285022210661186306744278622039194945047123713786960956364371917287467764657573962413890865832645995813390478027590099465764078951269468398352595709825822620522489407726719478268482601476990902640136394437455305068203496252451749399651431429809190659250937221696461515709858387410597885959772975498930161753928468138268683868942774155991855925245953959431049972524680845987273644695848653836736222626099124608051243884390451244136549762780797715691435997700129616089441694868555848406353422072225828488648158456028506016842739452267467678895252138522549954666727823986456596116354886230577456498035593634568174324112515076069479451096596094025228879710893145669136867228748940560101503308617928680920874760917824938589009714909675985261365549781893129784821682998948722658804857564014270477555132379641451523746234364542858444795265867821051141354735739523113427166102135969536231442952484937187110145765403590279934403742007310578539062198387447808478489683321445713868751943506430218453191048481005370614680674919278191197939952061419663428754440643745123718192179998391015919561814675142691239748940907186494231961567945208095146550225231603881930142093762137855956638937787083039069792077346722182562599661501421503068038447734549202605414665925201497442850732518666002132434088190710486331734649651453905796268561005508106658796998163574736384052571459102897064140110971206280439039759515677157700420337869936007230558763176359421873125147120532928191826186125867321579198414848829164470609575270695722091756711672291098169091528017350671274858322287183520935396572512108357915136988209144421006751033467110314126711136990865851639831501970165151168517143765761835155650884909989859982387345528331635507647918535893226185489632132933089857064204675259070915481416549859461637180270981994309924488957571282890592323326097299712084433573265489382391193259746366730583604142813883032038249037589852437441702913276561809377344403070746921120191302033038019762110110044929321516084244485963766983895228684783123552658213144957685726243344189303968642624341077322697802807318915441101044682325271620105265227211166039666557309254711055785376346682065310989652691862056476931257058635662018558100729360659876486117910453348850346113657686753249441668039626579787718556084552965412665408530614344431858676975145661406800700237877659134401712749470420562230538994561314071127000407854733269939081454664645880797270826683063432858785698305235808933065757406795457163775254202114955761581400250126228594130216471550979259230990796547376125517656751357517829666454779174501129961489030463994713296210734043751895735961458901938971311179042978285647503203198691514028708085990480109412147221317947647772622414254854540332157185306142288137585043063321751829798662237172159160771669254748738986654949450114654062843366393790039769265672146385306736096571209180763832716641627488880078692560290228472104031721186082041900042296617119637792133757511495950156604963186294726547364252308177036751590673502350728354056704038674351362222477158915049530984448933309634087807693259939780541934144737744184263129860809988868741326047215695162396586457302163159819319516735381297416772947867242292465436680098067692823828068996400482435403701416314965897940924323789690706977942236250822168895738379862300159377647165122893578601588161755782973523344604281512627203734314653197777416031990665541876397929334419521541341899485444734567383162499341913181480927777103863877343177207545654532207770921201905166096280490926360197598828161332316663652861932668633606273567630354477628035045077723554710585954870279081435624014517180624643626794561275318134078330336254232783944975382437205835311477119926063813346776879695970309833913077109870408591337464144282277263465947047458784778720192771528073176790770715721344473060570073349243693113835049316312840425121925651798069411352801314701304781643788518529092854520116583934196562134914341595625865865570552690496520985803385072242648293972858478316305777756068887644624824685792603953527734803048029005876075825104747091643961362676044925627420420832085661190625454337213153595845068772460290161876679524061634252257719542916299193064553779914037340432875262888963995879475729174642635745525407909145135711136941091193932519107602082520261879853188770584297259167781314969900901921169717372784768472686084900337702424291651300500516832336435038951702989392233451722013812806965011784408745196012122859937162313017114448464090389064495444006198690754851602632750529834918740786680881833851022833450850486082503930213321971551843063545500766828294930413776552793975175461395398468339363830474611996653858153842056853386218672523340283087112328278921250771262946322956398989893582116745627010218356462201349671518819097303811980049734072396103685406643193950979019069963955245300545058068550195673022921913933918568034490398205955100226353536192041994745538593810234395544959778377902374216172711172364343543947822181852862408514006660443325888569867054315470696574745855033232334210730154594051655379068662733379958511562578432298827372319898757141595781119635833005940873068121602876496286744604774649159950549737425626901049037781986835938146574126804925648798556145372347867330390468838343634655379498641927056387293174872332083760112302991136793862708943879936201629515413371424892830722012690147546684765357616477379467520049075715552781965362132392640616013635815590742202020318727760527721900556148425551879253034351398442532234157623361064250639049750086562710953591946589751413103482276930624743536325691607815478181152843667957061108615331504452127473924544945423682886061340841486377670096120715124914043027253860764823634143346235189757664521641376796903149501910857598442391986291642193994907236234646844117394032659184044378051333894525742399508296591228508555821572503107125701266830240292952522011872676756220415420516184163484756516999811614101002996078386909291603028840026910414079288621507842451670908700069928212066041837180653556725253256753286129104248776182582976515795984703562226293486003415872298053498965022629174878820273420922224533985626476691490556284250391275771028402799806636582548892648802545661017296702664076559042909945681506526530537182941270336931378517860904070866711496558343434769338578171138645587367812301458768712660348913909562009939361031029161615288138437909904231747336394804575931493140529763475748119356709110137751721008031559024853090669203767192203322909433467685142214477379393751703443661991040337511173547191855046449026365512816228824462575916333039107225383742182140883508657391771509682887478265699599574490661758344137522397096834080053559849175417381883999446974867626551658276584835884531427756879002909517028352971634456212964043523117600665101241200659755851276178583829204197484423608007193045761893234922927965019875187212726750798125547095890455635792122103334669749923563025494780249011419521238281530911407907386025152274299581807247162591668545133312394804947079119153267343028244186041426363954800044800267049624820179289647669758318327131425170296923488962766844032326092752496035799646925650493681836090032380929345958897069536534940603402166544375589004563288225054525564056448246515187547119621844396582533754388569094113031509526179378002974120766514793942590298969594699556576121865619673378623625612521632086286922210327488921865436480229678070576561514463204692790682120738837781423356282360896320806822246801224826117718589638140918390367367222088832151375560037279839400415297002878307667094447456013455641725437090697939612257142989467154357846878861444581231459357198492252847160504922124247014121478057345510500801908699603302763478708108175450119307141223390866393833952942578690507643100638351983438934159613185434754649556978103829309716465143840700707360411237359984345225161050702705623526601276484830840761183013052793205427462865403603674532865105706587488225698157936789766974220575059683440869735020141020672358502007245225632651341055924019027421624843914035998953539459094407046912091409387001264560016237428802109276457931065792295524988727584610126483699989225695968815920560010165525637568'; 122 | break; 123 | case "golden_ratio": 124 | irrat_number = '1.618033988749894848204586834365638117720309179805762862135448622705260462818902449707207204189391137484754088075386891752126633862223536931793180060766726354433389086595939582905638322661319928290267880675208766892501711696207032221043216269548626296313614438149758701220340805887954454749246185695364864449241044320771344947049565846788509874339442212544877066478091588460749988712400765217057517978834166256249407589069704000281210427621771117778053153171410117046665991466979873176135600670874807101317952368942752194843530567830022878569978297783478458782289110976250030269615617002504643382437764861028383126833037242926752631165339247316711121158818638513316203840052221657912866752946549068113171599343235973494985090409476213222981017261070596116456299098162905552085247903524060201727997471753427775927786256194320827505131218156285512224809394712341451702237358057727861600868838295230459264787801788992199027077690389532196819861514378031499741106926088674296226757560523172777520353613936210767389376455606060592165894667595519004005559089502295309423124823552122124154440064703405657347976639723949499465845788730396230903750339938562102423690251386804145779956981224457471780341731264532204163972321340444494873023154176768937521030687378803441700939544096279558986787232095124268935573097045095956844017555198819218020640529055189349475926007348522821010881946445442223188913192946896220023014437702699230078030852611807545192887705021096842493627135925187607778846658361502389134933331223105339232136243192637289106705033992822652635562090297986424727597725655086154875435748264718141451270006023890162077732244994353088999095016803281121943204819643876758633147985719113978153978074761507722117508269458639320456520989698555678141069683728840587461033781054443909436835835813811311689938555769754841491445341509129540700501947754861630754226417293946803673198058618339183285991303960720144559504497792120761247856459161608370594987860069701894098864007644361709334172709191433650137157660114803814306262380514321173481510055901345610118007905063814215270930858809287570345050780814545881990633612982798141174533927312080928972792221329806429468782427487401745055406778757083237310975915117762978443284747908176518097787268416117632503861211291436834376702350371116330725869883258710336322238109809012110198991768414917512331340152733843837234500934786049792945991582201258104598230925528721241370436149102054718554961180876426576511060545881475604431784798584539731286301625448761148520217064404111660766950597757832570395110878230827106478939021115691039276838453863333215658296597731034360323225457436372041244064088826737584339536795931232213437320995749889469956564736007295999839128810319742631251797141432012311279551894778172691415891177991956481255800184550656329528598591000908621802977563789259991649946428193022293552346674759326951654214021091363018194722707890122087287361707348649998156255472811373479871656952748900814438405327483781378246691744422963491470815700735254570708977267546934382261954686153312095335792380146092735102101191902183606750973089575289577468142295433943854931553396303807291691758461014609950550648036793041472365720398600735507609023173125016132048435836481770484818109916024425232716721901893345963786087875287017393593030133590112371023917126590470263494028307668767436386513271062803231740693173344823435645318505813531085497333507599667787124490583636754132890862406324563953572125242611702780286560432349428373017255744058372782679960317393640132876277012436798311446436947670531272492410471670013824783128656506493434180390041017805339505877245866557552293915823970841772983372823115256926092995942240000560626678674357923972454084817651973436265268944888552720274778747335983536727761407591712051326934483752991649980936024617844267572776790019191907038052204612324823913261043271916845123060236278935454324617699757536890417636502547851382463146583363833760235778992672988632161858395903639981838458276449124598093704305555961379734326134830494949686810895356963482817812886253646084203394653819441945714266682371839491832370908574850266568039897440662105360306400260817112665995419936873160945722888109207788227720363668448153256172841176909792666655223846883113718529919216319052015686312228207155998764684235520592853717578076560503677313097519122397388722468258057159744574048429878073522159842667662578077062019430400542550158312503017534094117191019298903844725033298802450143679684416947959545304591031381162187045679978663661746059570003445970113525181346006565535203478881174149941274826415213556776394039071038708818233806803350038046800174808220591096844202644640218770534010031802881664415309139394815640319282278548241451050318882518997007486228794215589574282021665706218809057808805032467699129728721038707369740643566745892025865657397856085956653410703599783204463363464854894976638853510455272982422906998488536968280464597457626514343590509383212437433338705166571490059071056702488798580437181512610044038148804072524406164290224782271527241120850657888387124936351068063651667432223277677557973992703762319147047323955120607055039920884426037087908433342618384135970781648295537143219611895037977146300075559753795703552271449319132172556440128309180504500899218705121186069335731538959350790300736727023314165320423401553741442687154055116479611433230248544040940691145613987302603951828168034482525432673857590056043202453727192912486458133344169852993913574786989579864394980230471169671573622839120181273129165899527599192203183723568272793856373312654799859124632750300605925674549794350881192950568549325935531872914180113641218747075262810686983013576052471944559321955359610452830314883911769301196585834314424894898565584250834109429502771975833522442912573649380754171137392437601435068298784932712997512286881960498357751587717804106971319667534771947922636519016339771284739079336111191408998305603361060987171783055435403560895292908184641437139294378135604820389479125745077075575103002420726629001809042293424942590606661413322872269806901459945119954780163991514126125257282806643312616574693881951064421673871800011004218483025809165433837492364118388856468514315006373190429514814694243146089525470720374055669130692209908048194529751106504642810541775525909518713188835914765996041317960209415308585533238772538023272763297737214312796821671623442118320180288141274744316884721845939278143547409999907223320305926297661123832798331698825393126200650370288447828666940447307947104761255865837529862362509998232335971550723383833244081525778193364262630433026589581708004512788731159355877472172564947000516366725771539209840950327451121536873009121996295227659131637093968607271342692623154753304379933165811073696431421719794340563915512108108136262688856974806806011691894175027229874158699179145349946244419401219785860137366082869072236514771391268742096651378756205918543288883417429209015631332831935756220897137656309785015631549824564458654247929357228287506084814533513521817295879329911710032476222052194645105362450512988430871344439507244267351462861799183233645983696376327225756915972395438305208664747423815110792734948369523964792689936983249179995027895000604596613134633630249499514808053290179029751825158750490074351879835118360327227726017174045355716588555782972910619581935171055482579307091005763586990192972179951687311755631444856481002200142545405542927345883711602099479457208237804368718944805636891825802444996318783420274910153357910727336253289069334741238022220116262771193085448502954191320040099986556665177566409536561978978183804510303565101315894589028718610869058939471368014845700183664956472032943343742989464274125514359058434840919548701523614031739139036164401984550510491211697920012019996050699496640303508636929039410070194505320162348727632327324494396304808905542513797233147518520709102506368598167953048181007394245317002388047598343234504142584314063612721096022824233782280902797659607771084939151748873168777135223900911711735091860065462009902497585277925427816597038349505801062615533369109378465977105297502231730741217783441894118459658610298018778742744563866966127724503845860526415103040898257777544741153320764075881677514975538047116296677710058766461595496776927054962393985709255070274069978140843124965363071866533718060587422425981653070525738345415770542921629981149175086113117657731720956156564786954744892713206080635457794624145310669837421137981689638235333044778831693397287289181036640832698569882544385166758622899306964346848975148408790396476042036102060217173944702634876336543931952290773836167389811781242483655781050341694515636260430036657431084766548777801285779236454185224472361713742292558415931356128663716703280721715533926463257306730639108541088680857428385882806023033414085503909735387261345119629264159952127893113544314601527309025538271043259662267439037455636122861390783194335705900381487008986613153981958574423304419708566967222931427307413848827889755888607997387044702031668348569419909654802982493198176579268298556297230106827772351627407838074318778273182119196952800516087915721288263379682312725628700015001829297577299935790949196407634428615757135444278983830404547027101945800425820212023445806303450336581472185492036799899729353539196812133195165379745399111494244451830338588412904018178188213760066592849413677543174516054093871103687152116404058219344712044827759605416948645398783262695480139150190389959313067031866167066371964025692867138871466311891926856826919952764579977182787594609616172188681094546515788691224106098141972686192554787899263153594729228250805425169068140107817960218853307623055638163164019224545032576567392599765175308014271607143087188628598360374650571342046700834327542302770477933111836669032328853068738799071359007403049074598895136476876086784432382482189306175703195638032308197193635672741964387262587061543307296370381275151704060050575948827238563451563905265771042645947604055695095984088890376207995663880178618559159441117250923132797711380'; 125 | break; 126 | case "e": 127 | irrat_number = '2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592714563549061303107208510383750510115747704171898610687396965521267154688957035035402123407849819334321068170121005627880235193033224745015853904730419957777093503660416997329725088687696640355570716226844716256079882651787134195124665201030592123667719432527867539855894489697096409754591856956380236370162112047742722836489613422516445078182442352948636372141740238893441247963574370263755294448337998016125492278509257782562092622648326277933386566481627725164019105900491644998289315056604725802778631864155195653244258698294695930801915298721172556347546396447910145904090586298496791287406870504895858671747985466775757320568128845920541334053922000113786300945560688166740016984205580403363795376452030402432256613527836951177883863874439662532249850654995886234281899707733276171783928034946501434558897071942586398772754710962953741521115136835062752602326484728703920764310059584116612054529703023647254929666938115137322753645098889031360205724817658511806303644281231496550704751025446501172721155519486685080036853228183152196003735625279449515828418829478761085263981395599006737648292244375287184624578036192981971399147564488262603903381441823262515097482798777996437308997038886778227138360577297882412561190717663946507063304527954661855096666185664709711344474016070462621568071748187784437143698821855967095910259686200235371858874856965220005031173439207321139080329363447972735595527734907178379342163701205005451326383544000186323991490705479778056697853358048966906295119432473099587655236812859041383241160722602998330535370876138939639177957454016137223618789365260538155841587186925538606164779834025435128439612946035291332594279490433729908573158029095863138268329147711639633709240031689458636060645845925126994655724839186564209752685082307544254599376917041977780085362730941710163434907696423722294352366125572508814779223151974778060569672538017180776360346245927877846585065605078084421152969752189087401966090665180351650179250461950136658543663271254963990854914420001457476081930221206602433009641270489439039717719518069908699860663658323227870937650226014929101151717763594460202324930028040186772391028809786660565118326004368850881715723866984224220102495055188169480322100251542649463981287367765892768816359831247788652014117411091360116499507662907794364600585194199856016264790761532103872755712699251827568798930276176114616254935649590379804583818232336861201624373656984670378585330527583333793990752166069238053369887956513728559388349989470741618155012539706464817194670834819721448889879067650379590366967249499254527903372963616265897603949857674139735944102374432970935547798262961459144293645142861715858733974679189757121195618738578364475844842355558105002561149239151889309946342841393608038309166281881150371528496705974162562823609216807515017772538740256425347087908913729172282861151591568372524163077225440633787593105982676094420326192428531701878177296023541306067213604600038966109364709514141718577701418060644363681546444005331608778314317444081194942297559931401188868331483280270655383300469329011574414756313999722170380461709289457909627166226074071874997535921275608441473782330327033016823719364800217328573493594756433412994302485023573221459784328264142168487872167336701061509424345698440187331281010794512722373788612605816566805371439612788873252737389039289050686532413806279602593038772769778379286840932536588073398845721874602100531148335132385004782716937621800490479559795929059165547050577751430817511269898518840871856402603530558373783242292418562564425502267215598027401261797192804713960068916382866527700975276706977703643926022437284184088325184877047263844037953016690546593746161932384036389313136432713768884102681121989127522305625675625470172508634976536728860596675274086862740791285657699631378975303466061666980421826772456053066077389962421834085988207186468262321508028828635974683965435885668550377313129658797581050121491620765676995065971534476347032085321560367482860837865680307306265763346977429563464371670939719306087696349532884683361303882943104080029687386911706666614680001512114344225602387447432525076938707777519329994213727721125884360871583483562696166198057252661220679754062106208064988291845439530152998209250300549825704339055357016865312052649561485724925738620691740369521353373253166634546658859728665945113644137033139367211856955395210845840724432383558606310680696492485123263269951460359603729725319836842336390463213671011619282171115028280160448805880238203198149309636959673583274202498824568494127386056649135252670604623445054922758115170931492187959271800194096886698683703730220047531433818109270803001720593553052070070607223399946399057131158709963577735902719628506114651483752620956534671329002599439766311454590268589897911583709341937044115512192011716488056694593813118384376562062784631049034629395002945834116482411496975832601180073169943739350696629571241027323913874175492307186245454322203955273529524024590380574450289224688628533654221381572213116328811205214648980518009202471939171055539011394331668151582884368760696110250517100739276238555338627255353883096067164466237092264680967125406186950214317621166814009759528149390722260111268115310838731761732323526360583817315103459573653822353499293582283685100781088463434998351840445170427018938199424341009057537625776757111809008816418331920196262341628816652137471732547772778348877436651882875215668571950637193656539038944936642176400312152787022236646363575550356557694888654950027085392361710550213114741374410613444554419210133617299628569489919336918472947858072915608851039678195942983318648075608367955149663644896559294818785178403877332624705194505041984774201418394773120281588684570729054405751060128525805659470304683634459265255213700806875200959345360731622611872817392807462309468536782310609792159936001994623799343421068781349734695924646975250624695861690917857397659519939299399556754271465491045686070209901260681870498417807917392407194599632306025470790177452751318680998228473086076653686685551646770291133682756310722334672611370549079536583453863719623585631261838715677411873852772292259474337378569553845624680101390572787101651296663676445187246565373040244368414081448873295784734849000301947788802046032466084287535184836495919508288832320652212810419044804724794929134228495197002260131043006241071797150279343326340799596053144605323048852897291765987601666781193793237245385720960758227717848336161358261289622611812945592746276713779448758675365754486140761193112595851265575973457301533364263076798544338576171533346232527057200530398828949903425956623297578248873502925916682589445689465599265845476269452878051650172067478541788798227680653665064191097343452887833862172615626958265447820567298775642632532159429441803994321700009054265076309558846589517170914760743713689331946909098190450129030709956622662030318264936573369841955577696378762491885286568660760056602560544571133728684020557441603083705231224258722343885412317948138855007568938112493538631863528708379984569261998179452336408742959118074745341955142035172618420084550917084568236820089773945584267921427347756087964427920270831215015640634134161716644806981548376449157390012121704154787259199894382536495051477137939914720521952907939613762110723849429061635760459623125350606853765142311534966568371511660422079639446662116325515772907097847315627827759878813649195125748332879377157145909106484164267830994972367442017586226940215940792448054125536043131799269673915754241929660731239376354213923061787675395871143610408940996608947141834069836299367536262154524729846421375289107988438130609555262272083751862983706678722443019579379378607210725427728907173285487437435578196651171661833088112912024520404868220007234403502544820283425418788465360259150644527165770004452109773558589762265548494162171498953238342160011406295071849042778925855274303522139683567901807640604213830730877446017084268827226117718084266433365178000217190344923426426629226145600433738386833555534345300426481847398921562708609565062934040526494324426144566592129122564889356965500915430642613425266847259491431423939884543248632746184284665598533231221046625989014171210344608427161661900125719587079321756969854401339762209674945418540711844643394699016269835160784892451405894094639526780735457970030705116368251948770118976400282764841416058720618418529718915401968825328930914966534575357142731848201638464483249903788606900807270932767312758196656394114896171683298045513972950668760474091542042842999354102582911350224169076943166857424252250902693903481485645130306992519959043638402842926741257342244776558417788617173726546208549829449894678735092958165263207225899236876845701782303809656788311228930580914057261086588484587310165815116753332767488701482916741970151255978257270740643180860142814902414678047232759768426963393577354293018673943971638861176420900406866339885684168100387238921448317607011668450388721236436704331409115573328018297798873659091665961240202177855885487617616198937079438005666336488436508914480557103976521469602766258359905198704230017946553679'; 128 | break; 129 | case "sqrt2": 130 | irrat_number = '1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846230912297024924836055850737212644121497099935831413222665927505592755799950501152782060571470109559971605970274534596862014728517418640889198609552329230484308714321450839762603627995251407989687253396546331808829640620615258352395054745750287759961729835575220337531857011354374603408498847160386899970699004815030544027790316454247823068492936918621580578463111596668713013015618568987237235288509264861249497715421833420428568606014682472077143585487415565706967765372022648544701585880162075847492265722600208558446652145839889394437092659180031138824646815708263010059485870400318648034219489727829064104507263688131373985525611732204024509122770022694112757362728049573810896750401836986836845072579936472906076299694138047565482372899718032680247442062926912485905218100445984215059112024944134172853147810580360337107730918286931471017111168391658172688941975871658215212822951848847208969463386289156288276595263514054226765323969461751129160240871551013515045538128756005263146801712740265396947024030051749531886292563138518816347800156936917688185237868405228783762938921430065586956868596459515550164472450983689603688732311438941557665104088391429233811320605243362948531704991577175622854974143899918802176243096520656421182731672625753959471725593463723863226148274262220867115583959992652117625269891754098815934864008345708518147223181420407042650905653233339843645786579679651926729239987536661721598257886026336361782749599421940377775368142621773879919455139723127406689832998989538672882285637869774966251996658352577619893932284534473569479496295216889148549253890475582883452609652409654288939453864662574492755638196441031697983306185201937938494005715633372054806854057586799967012137223947582142630658513221740883238294728761739364746783743196000159218880734785761725221186749042497736692920731109636972160893370866115673458533483329525467585164471075784860246360083444911481858765555428645512331421992631133251797060843655970435285641008791850076036100915946567067688360557174007675690509613671940132493560524018599910506210816359772643138060546701029356997104242510578174953105725593498445112692278034491350663756874776028316282960553242242695753452902883876844642917328277088831808702533985233812274999081237189254072647536785030482159180188616710897286922920119759988070381854333253646021108229927929307287178079988809917674177410898306080032631181642798823117154363869661702999934161614878686018045505553986913115186010386375325004558186044804075024119518430567453368361367459737442398855328517930896037389891517319587413442881784212502191695187559344438739618931454999990610758704909026088351763622474975785885836803745793115733980209998662218694992259591327642361941059210032802614987456659968887406795616739185957288864247346358588686449682238600698335264279905628316561391394255764906206518602164726303336297507569787060660685649816009271870929215313236828135698893709741650447459096053747279652447709409924123871061447054398674364733847745481910087288622214958952959118789214917983398108378827815306556231581036064867587303601450227320882935134138722768417667843690529428698490838455744579409598626074249954916802853077398938296036213353987532050919989360751390644449576845699347127636450716327915470159773354863893942325727754003826027478567417258095141630715959784981800944356037939098559016827215403458158152100493666295344882710729239660232163823826661262683050257278116945103537937156882336593229782319298606467978986409208560955814261436363100461559433255047449397593399912541953230093217530447653396470662761166175351875464620967634558738616488019884849747926404506544489691004079421181692579685756378488149898641685499491635761448404702103398921534237703723335311564594438970365316672194904935188290580630740134686264167247011065346349391640714628556798017793381442404526913706660977763878486623800339232437047411533187253190601916599645538115788841380843323210533767461812178014296092832411362752540887372905129407339479433061943956936702079429515878228349321931666411130154959469837897767434443539337709957134988407890850815892366070088658105470949790465722988880892461282816013133701029080290999745647849581545614648715516390502419857906131093458783306200262207372471676685455499904994085710809925759928893236615438271955005781625133038153146577907926868500806984428479152424275441026805756321565322061885751225113063937025362927161968251259192025216058701189596732244239267423734490764646727375347964598819149807931718002423855453886038368310800779182466462754117444250018727779518164383451463461299020763343017968554385631667723518389336667042222110939144930287963812839889311731308430042125550185498506529455637766031461255909104611384768282359592477228629042642736163264585443392877263860343149804896397363329754885925681149296836126725898573833216436663487023477302610106130507298611534129948808774473111229542652751653665911730142360626525869077198217037098104644360477226739282987415259306956206384710827408218490673723305874302970924289948173924407869375284401044399048520878851914193541512900681735170306938697059004742515765524807844736214410501620084544412225595620298472594035280190679806809830039645398568593045862526063779745355992774729906488874545124249607637801086390019105809287476472075110923860595019543228160208879621516233852161287522851802529287618325703717285740676394490982546442218465430880661058020158472840671263025459379890650816857137165668594130053319703659640337667414610495637651030836613489310947802681293557331890551970520184515039969098663152512411611192594055280856498931958983456233198368349488080617156243911286631279784837197895336901527760054980551663501978555711014055529763384127504468604647663183266116518206750120476699109872191044474403268943641595942792199442355371870429955924031409171284815854386600538571358363981630945240755700932516824344168240836197927337282521546224696153321702682995097908903459485887834943961620435842249739718711395892730509219705491717696160044558089942787888036916943289459514722672292612485069617316380941082186004528610269654757630431025602715231396948213551982140971654909731999283492567409749039229712634869341457493319804171807611196390227866407592243416776246623623891311027034330457636814112832132630858223945621959808661293999620123415617631817431242008901498384856048087986460839359649236651429681257731432291456871682762199611827826953157498380262465175905410397618128760421638613450221326272775661244113361077519555774950865636067378665062318564069912280187574178549466125327599769796059776059075648910666101583841720281853043211904465775255427754379872605488173619826758168628329526078993222668360283851351228105931859102864150815705631971731518313625024359041463212239217663398268936825315053005989154702909537193266207341123494743367884690201390497842852163414429214589558287847669394646426781221904978563635526336827805186009869924893778600239876916980765662194389854437080594643336233381058745816235475600136592435242657143083465545768002370814675732525470255074763747163506785159917369379325103268276062864591461820472148637037077192692682362333472037924596469181052613915308628029144096548256387309273042654466292904589606375191871146934536197332478957270703153093090192119919999361576500350398405406742538792752792272473356677060783791138448893626136765706026360031513295209539520285489738448625613492441470860708660267634997879342087583612194711699422384848259591430452810706260150896913530301772006271705440209066951491527459771970594769547409521028787255785688002219371774355811079393088338455864827729100862955456614130672123084874022712105868632338823741388442893815544464710575565146843570294663506289387356986868837648032651952841465351739530273612013742030098673983851432190043602898269829352939941412923058038456502270721681516194101144982630136490087704839848838609065336859905458389520318564804149327214239086516499943165920796595356943072311291162928679751715668890543932203569129332457020806719444049730494398140822782960279942454108316667592142483518272381720504103927428880155622338079614751243351473102128454594489944499600075243751957011668341744749079588209951783676802323651767497230148745774272599476096219843271483529861119027287358490521797590837419748602670605374623153003937521236786775284869219585713755426968482783631786110993368014391590597484285805451613023014397905701610889862777961075067333267604865492925139978139053588227689373220494148394013556035656044214017612060513180689198996260618483185340183623782172663758045524719626617492542285280457144204857834211322800852870420548899234127855481236761537707104254469868521991122835426634999712748366076246241820736466617128394748473280474430403344107200428727127567027956758242926271945458053002666489965079569778178621942172005237165369467704195111912704624836051130289046437751148694887849615118841471910001255883836660677208411235153558811267789571558590412576261601067513153580212427331871000635824954504099579407254798900316826512373119055668291519430537084893078691974282904903860372311609928342431712225099454715019286664878710795199518005463388384431548172463548024451803084527343100062137103462573306001234973744355818096567846464153390514656919324562353140577919369898842364718352537580525771331120079710406831549266540202604680681839143782721476906324246951712863673844313983337117615941869993466262345373452356794012416809229116360956372167452839170990914664850739205151605604737871061547021699607465693097944261214692561593425649401912298951473254471518126325836889728226283329524035970072786336460459470712417472946877570595815734996284809956783925547424044899188707106967524250774520122936081057414265323472406416214103335334055110452126175035902840374545918645047276243420717709297935401021409646450283683418040758608100140721619247717980985968111540446443728568959286831977797786934641598469745133917741537904877880830022058335046746555323028587325835'; 131 | break; 132 | case "sqrt3": 133 | irrat_number = '1.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938145757671853373633125910899655424624834787197605235997769192323570220305302840385915414971072429559206706202509520175963185872766359975283663431080150665853710647328538625922260582220510403680270297504798728079461658100417052681940019095733462175943893670249320422691034369812463720111185261084268910299720311202100063507176374582405203847555197279933797614906107894985544223326004018851303631561144886847281589288163245187265066645384877599162576642872111240842068016763517100102943180715515190961642460907039408129216903517492961364004139670431041253632327030922577327960292376597745537095469115742140424230781992327617401906424512454877516862696105333694216213605394604245654140128533007813633449856736406703977342229811961042925534501601405940479547154534548407271737656262366549166640233006013265744070107836858468452313160467754480500402240639911970362218602920238867150711017169400296868759663500040895316214233425227956834067013470185902028360716762147743493449563595808082130442586469468522610908263353008756612603460672195404055984128912975994810000772057440230047673258800091514371489475444879157191294659083570873961515537797640262068370848046072969382719585689759759626104159152657577790782334980567840022901532052138935373775536566427046826874289963441395743666073744445583086477893212985302148197395341478170516614952551763291993699565744522639112519093541386989366817430938226424736926202072990967831154131946484377915459915923928287714695149274026409213645654041644581490201945749419305269002613972646081065071439603206077510594187798284793986195249964165213139715293599421897416647075187235788629466108560170428869605798394052906407430811833388677881562635867156008396760245349229943938867059754315442943430957258470988215463111260766774067864571578060647447499750354544559313286549189849336572747626297414738235686914837831363361283627903824840163806671607179848728555842931349226093240565957553651136754644387834283313466644554180390821898983294626345016171122016929619460169320621033039744866231656003566781813443100896568706742965658177445572685015631594412507361198063472886466241327193669426712951450397518928313486192841303255188431169014671423794374728334344652482043796059732870616274910941596862625302558889768470417502003140262284691048046984032437906606737749627102512710602060862662843666050192890893838320006091228691881836842361693903523126930368613796811526946997891926635284389927016519825502252923579366281634568108913074112678378199449772765448294920438801301783546499213574032791577507786002296423504275996997626918738414847394773851563552091220963315839034567189415294357040653076085290174249768185502885276344949577449110422502453723156063618103504871759158032791798367510067136100066217566049573766777112925287302479926720158996418937762016114118289899682955902511656391422364995062850030696812973507251727918598301115277542298851885311763594786003123063726098369850308310852145595748359555715739356633680864821078791247051031631569581604348748829614894154585355561974999296877955099285527423590251810323766861609592552544319954907420679739157072614245328950428097351037967736660135917522627061232312589450697634813177754456066603576220483006904225389494867729521325719769245927670660765816558298675056572894658860919029644381285057859759437506402446062121456085608545249251368328754843438733720201692311630432705648060137587936856721535087816844078023292064623163811291772297752725531075161383682134604577799854625622081960631636019206330968516216231660683468863116621501323854287391304495123155216365621295187475530976570639955029880425647340557785191349533039888643071431785052007986242468481382976340802176297056457213162198306829364628682222279923816416353172598273213079714192676286915681181839966515100307010826703128664015918312719604038923540682591504595764918368552614803465109289896559961829716408498135702922729622140263750595519947501618105854474019764971593766342388569701982214045410209642908388248860987218876494800835944491934478931331080777740838035601892228537110093898091204853232990455598524096889180504497043838415045586150130902907091306156469685958969228276473764261083791700284689036668670497679170399954436330425855797794077269935288950837827114357125780631282729349883385045927110609526062879059715054945907279841681751687041505072957723365201003263831478479410794607656506369332663038206021719551471952041208479627248539111589302866641079696991524811276979149995102660574531123881393934919708926940735738491944291963007280950338654302137812339456142472424586825005490509782168419895154077663046648660253211821517058546481699010351020406040779053482395457081103662802419307833539518597508847118544793150345001580384709447854602092161934402798458912472052941776762506497961858234776556280824940544437650597779439080197924300154959936710407983913033119996866535017872308995874345981050410546853618716669008602651872709506307892209449850428619343629495429310972099408595585896796000425822959426943909574110166784798090792890754084338798997585569009471963248904323366036372887420477179897787319674789334640099238795928413280479076582258181183540591455395810029729132679714194354057353161415847980294411862031322519054091589019122255319653737392856310390787757920503439443610560728204865743914647280480723365927320176656223005701114685591214450995505364985643365509525473974996502828824922856959093188033794992264659862068823401174394496293131985985880254199347096201038949171977062258657266707618728353902334806925083435649537445628310757587186877538159397085400698899220166054425026312832880789794907045544329548492870187596100762027461311058672024649539970560477439601070677420574723587570759024726518532288910223630374462004719642400758541636765726892037163539219477428690685888815809704248358215149135699281075072307826447406718734809484544537264931062922580337258517145144805462076646086736427250483015812043421751869316708560008335295934426745872998735071625170300571157138175301302407011029660250955862422560289064674131908000682128984594066091487347598861395910049396065914517216530677681935572187655860065307738893120925049062804376001777854452265015206218505020438314950613721027080139203770756297830653607775736632592864736585895301156180017817036902280660710076441006254000316884037752998124945554719004248954149482241055947835787572003255966447123768440333531554321404257417457980060298308291771308271425542469232666444148362798525717975258224681220471956484671739892041087919384450786335769786888793914723176816815216706810214555598133352126063672655392136952255122818916717426718903555974152910467258069243862506098603871358867229314289239162034332739310392579643586655581342530172510423849606810290219324124788330451974631601707465226034298916454070948456229074179174009011233862395384545294973224293397306200271688265880011208985226125337807028455581448577751811935334558123538018435432296215284836962998919261565716416977466168244520311448716278066949726554837191991467614810797468495214414497191266124258209334038408435153619698962218737471928474471924073026312829794461570159696747688148437922575573503278944489603012657592199800298772012290539654233631798150362169688599183870495897032507059139657134431133435500776729491890270768614954833994667724162765514731195167511681718998875787982178391089760065710008376769429534350552888108658911706758721195159361489112823082306843321196072050218635318399221099714826615108369065711100630141510704075711085481373570334484736386128973807170651264496478839340250121137258483942385699581395465756563747606366397154802563573736399649847255432858858709495446990631685255118599877971074544158828756390386685624045627377140357608225194894648532758509646135351610864380606204739052823604053014706912323032636557053851755375864010248567111408373108906937774684792995636886177071188664077388146229483712818019171032155924150060798705722914354391251957368768223808898244895974697476781022726203514912904936882288911507749046386972301788252888706432486798314996711993510261548209307384397532266800587384309407578948075198163816856104514178374428640041561357741112691299329388959692290096040531003231833821857778799348218402291334737068921889820714355129864315508778507993701535229570998843782958817370884720700044671618700284314375344174419498974828148386643492741817980451021795298952911529535866201038223377187917498695532283164306156645936093457367622020953383831133745543557069333352360541097580806251507569082018488774733352689124246378746329829720703684819427992012273665336822499743175584189601562040576480296573770641163928360065612427452793024271878190718285651448469895898930784416676321988573332086640349160325821877167265004656302792274657390679444654885688846995270196061119942760195715001069960613187691725593898690715131894766441022913262339796228747051945277137351683562025074527566498235871910012533924011031324029353072705845387895559662035656086344581372260926945169885615585672724591846723237672388902404630147827209056907327435750851263388215320381801796701230402'; 134 | break; 135 | case "sqrt5": 136 | irrat_number = '2.236067977499789696409173668731276235440618359611525724270897245410520925637804899414414408378782274969508176150773783504253267724447073863586360121533452708866778173191879165811276645322639856580535761350417533785003423392414064442086432539097252592627228876299517402440681611775908909498492371390729728898482088641542689894099131693577019748678884425089754132956183176921499977424801530434115035957668332512498815178139408000562420855243542235556106306342820234093331982933959746352271201341749614202635904737885504389687061135660045757139956595566956917564578221952500060539231234005009286764875529722056766253666074485853505262330678494633422242317637277026632407680104443315825733505893098136226343198686471946989970180818952426445962034522141192232912598196325811104170495807048120403455994943506855551855572512388641655010262436312571024449618789424682903404474716115455723201737676590460918529575603577984398054155380779064393639723028756062999482213852177348592453515121046345555040707227872421534778752911212121184331789335191038008011118179004590618846249647104244248308880129406811314695953279447898998931691577460792461807500679877124204847380502773608291559913962448914943560683462529064408327944642680888989746046308353537875042061374757606883401879088192559117973574464190248537871146194090191913688035110397638436041281058110378698951852014697045642021763892890884446377826385893792440046028875405398460156061705223615090385775410042193684987254271850375215557693316723004778269866662446210678464272486385274578213410067985645305271124180595972849455195451310172309750871496529436282902540012047780324155464489988706177998190033606562243886409639287753517266295971438227956307956149523015444235016538917278640913041979397111356282139367457681174922067562108887818873671671627622623379877111539509682982890683018259081401003895509723261508452834587893607346396117236678366571982607921440289119008995584241522495712918323216741189975720139403788197728015288723418668345418382867300274315320229607628612524761028642346963020111802691220236015810127628430541861717618575140690101561629091763981267225965596282349067854624161857945584442659612858937564854974803490110813557514166474621951830235525956886569495816353036195574536832235265007722422582873668753404700742232661451739766517420672644476219618024220397983536829835024662680305467687674469001869572099585891983164402516209196461851057442482740872298204109437109922361752853153022121091762951208863569597169079462572603250897522297040434128808223321533901195515665140790221756461654212957878042231382078553676907726666431316593195462068720646450914872744082488128177653475168679073591862464426874641991499778939913129472014591999678257620639485262503594282864024622559103789556345382831782355983912962511600369101312659057197182001817243605955127578519983299892856386044587104693349518653903308428042182726036389445415780244174574723414697299996312510945622746959743313905497801628876810654967562756493383488845926982941631401470509141417954535093868764523909372306624190671584760292185470204202383804367213501946179150579154936284590867887709863106792607614583383516922029219901101296073586082944731440797201471015218046346250032264096871672963540969636219832048850465433443803786691927572175750574034787186060267180224742047834253180940526988056615337534872773026542125606463481386346689646871290637011627062170994667015199335574248981167273508265781724812649127907144250485223405560573120864698856746034511488116745565359920634787280265752554024873596622892873895341062544984820943340027649566257313012986868360780082035610679011754491733115104587831647941683545966745646230513852185991884480001121253357348715847944908169635303946872530537889777105440549557494671967073455522815183424102653868967505983299961872049235688535145553580038383814076104409224649647826522086543833690246120472557870908649235399515073780835273005095702764926293166727667520471557985345977264323716791807279963676916552898249196187408611111922759468652269660989899373621790713926965635625772507292168406789307638883891428533364743678983664741817149700533136079794881324210720612800521634225331990839873746321891445776218415576455440727336896306512345682353819585333310447693766227437059838432638104031372624456414311997529368471041185707435156153121007354626195038244794777444936516114319489148096859756147044319685335325156154124038860801085100316625006035068188234382038597807689450066597604900287359368833895919090609182062762324374091359957327323492119140006891940227050362692013131070406957762348299882549652830427113552788078142077417636467613606700076093600349616441182193688405289280437541068020063605763328830618278789631280638564557096482902100637765037994014972457588431179148564043331412437618115617610064935398259457442077414739481287133491784051731314795712171913306821407199566408926726929709789953277707020910545964845813996977073936560929194915253028687181018766424874866677410333142980118142113404977597160874363025220088076297608145048812328580449564543054482241701315776774249872702136127303334864446555355115947985407524638294094647910241214110079841768852074175816866685236768271941563296591074286439223790075954292600151119507591407104542898638264345112880256618361009001798437410242372138671463077918701580601473454046628330640846803107482885374308110232959222866460497088081881382291227974605207903656336068965050865347715180112086404907454385824972916266688339705987827149573979159728789960460942339343147245678240362546258331799055198384406367447136545587712746625309599718249265500601211851349099588701762385901137098651871063745828360227282437494150525621373966027152104943889118643910719220905660629767823538602393171668628849789797131168501668218859005543951667044885825147298761508342274784875202870136597569865425995024573763920996715503175435608213942639335069543895845273038032679542569478158672222382817996611206722121974343566110870807121790585816369282874278588756271209640778958251490154151150206004841453258003618084586849885181213322826645744539613802919890239909560327983028252250514565613286625233149387763902128843347743600022008436966051618330867674984728236777712937028630012746380859029629388486292179050941440748111338261384419816096389059502213009285621083551051819037426377671829531992082635920418830617171066477545076046545526595474428625593643343246884236640360576282549488633769443691878556287094819999814446640611852595322247665596663397650786252401300740576895657333880894615894209522511731675059724725019996464671943101446767666488163051556386728525260866053179163416009025577462318711754944345129894001032733451543078419681900654902243073746018243992590455318263274187937214542685385246309506608759866331622147392862843439588681127831024216216272525377713949613612023383788350054459748317398358290699892488838802439571720274732165738144473029542782537484193302757512411837086577766834858418031262665663871512441794275312619570031263099649128917308495858714456575012169629067027043634591758659823420064952444104389290210724901025976861742688879014488534702925723598366467291967392752654451513831944790876610417329494847630221585469896739047929585379873966498359990055790001209193226269267260498999029616106580358059503650317500980148703759670236720654455452034348090711433177111565945821239163870342110965158614182011527173980385944359903374623511262889712962004400285090811085854691767423204198958914416475608737437889611273783651604889992637566840549820306715821454672506578138669482476044440232525542386170897005908382640080199973113330355132819073123957956367609020607130202631789178057437221738117878942736029691400367329912944065886687485978928548251028718116869681839097403047228063478278072328803969101020982423395840024039992101398993280607017273858078820140389010640324697455264654648988792609617811085027594466295037041418205012737196335906096362014788490634004776095196686469008285168628127225442192045648467564561805595319215542169878303497746337554270447801823423470183720130924019804995170555850855633194076699011602125231066738218756931954210595004463461482435566883788236919317220596037557485489127733932255449007691721052830206081796515555089482306641528151763355029951076094232593355420117532923190993553854109924787971418510140548139956281686249930726143733067436121174844851963306141051476690831541085843259962298350172226235315463441912313129573909489785426412161270915589248290621339674842275963379276470666089557663386794574578362073281665397139765088770333517245798613928693697950296817580792952084072204120434347889405269752673087863904581547672334779623562484967311562100683389031272520860073314862169533097555602571558472908370448944723427484585116831862712257327433406561443431067852926514613461278217082177361714856771765612046066828171007819470774522690239258528319904255786227088629203054618051076542086519324534878074911272245722781566388671411800762974017973226307963917148846608839417133934445862854614827697655779511777215994774089404063336697138839819309605964986396353158536597112594460213655544703254815676148637556546364238393905601032175831442576526759364625451257400030003658595154599871581898392815268857231514270888557967660809094054203891600851640424046891612606900673162944370984073599799458707078393624266390330759490798222988488903660677176825808036356376427520133185698827355086349032108187742207374304232808116438689424089655519210833897290797566525390960278300380779918626134063732334132743928051385734277742932623783853713653839905529159954365575189219232344377362189093031577382448212196283945372385109575798526307189458456501610850338136280215635920437706615246111276326328038449090065153134785199530350616028543214286174377257196720749301142684093401668655084605540955866223673338064657706137477598142718014806098149197790272953752173568864764964378612351406391276064616394387271345483928774525174123086614592740762550303408120101151897654477126903127810531542085291895208111390191968177780752415991327760357237118318882234501846265595422761'; 137 | break; 138 | case "sqrt6": 139 | irrat_number = '2.449489742783178098197284074705891391965947480656670128432692567250960377457315026539859433104640234818594601226614189124858865459837757341625783951237278552828912747527676571247630105270911770223481310678986690853632443352545604033808808939374585567846574724361304144270270216174201838300081589807838013089700728693993630837158094400800443738687549164514653939145012044726448133316293510944741813513285495044466171726631425497648318124504011566045364590093435861679319836656662669091319065358637661052581561793662361791102946720883545755128835529898324100558690205006415466124117353399410431057992898467339532552787360418296551718303910367800383623166297323302829049773910474263600705126376975468886770064099295592571732846450288809151442574630260295296323707552503422755991545426281298003064672079942425302287842620534067947860046596939979935597540616713586546534562482082562768863692809413063724335088648015724846337232447379545488144384793363700919741014778523287559106315984607831036700953532472642316714188758623741506504435040374725535497411142192394243153077360327509553325786889847836191120374116031947936824640252527726851044355755352537450350395304712321758289904548698592356390123275063290358182953378299816376311563708636584240536318776869230504126890319731342124852438330794967512415853943140633834891170210521025772596434062471274990297394166163421452359873120300102056799879380527604281282001996273968010437864283137728824658567138112510508564351273301566028350388563826231562795672489279646383686267427306681847529790526938681538858933549259857617862340639985853145560184948483512399275093859268729733548816477748844624877049770200018318428809518204001157449796070420673380574450720313426891561792141130059058651762294321550656410957227415836788171795154122702410593696442721864393920197142667033423630109077048647194122995655689053370290065687016435580717459463748803378433106157203438980044441946526401596816765444422785151680820487918254544896204497102423218380143846121761883296413487742451342416863123875898749020675512464410123015956176321847750600243770427700456304481288484729319572303565397559816460405333984411967181344811449864938622731327596683323958786810222032339325329366151007432572893433786411144190776854723400919637796732478972302928033867198368333730764006431294006372279595228377141847543760813870482857683504885726239745660242384016037009932965279005295634303519754852017472817378542256007209759582080364888169914264144996239438546954790930473524399203764437538196242739736038603901157209498116714894734168261275751085742657045964510020511089501986856092388983365369669240585272618590182658063609281571997382264216758766963445916401205189750392754414459431728663077718044104669109498482738749105892813399067752150682687876077027331348867906040207128899564895895224504077585044184666742001331301307724395439588545713531685192275084553542189727037842902542310783196730604771814289166685427120330554241906312068744815469254121762463775848287546522925751277215309265420739627920079459961546667997244409417092925312823313946013306564409159737611347740146690962916333212266190713338661316100702470675708468058993263263860455619994395448321998969789996576925225813459513368186443304705710174343174455494703153170399025503788278841380935404955120333109081636235005303582055244635387218751264122348042954559454592686192238479130166242892965144469159652787019534907181791740195247112325229229374164583743292676186323214075645981041059777316504288216981663708951614569014139841591262703390949919366193191904690219314411705833992643554567918975951858749523741699135177201869787660029320360600613446521290777388386396937323925008642773145750397883611466576403548993853285584629064970918254656345498599342630265915241909578426053499818442198348356174130078234309891314223520787637444056131070749271203222969709033860052788542800295047018450446914764968909207912122176893516002777442998091406802068242307236122946171983372602831450385604795279465117734603388091006835226138212870483763350627067551701317813204725326120484493196358811976099159491632157065503768102687656249747990395546278280241037991228713532794136808956309769832859579437267802824315737868229530386939883830445141490845214240967750285489468386423986277147354217041508430238683233533056541440054697790119568566239494145041339837341091200532641485392053042240407258431452558409448286503466326149961754231121153500033436924891652052338706474912240387508909169168643845124897536015993156728907456936371683445123080089780368283390174987826114168238950400263755463990237595457041532280797978162203212421733656192688405754422133768398264811510264044191779650782217475402298023238666752424142344231283986168016636813383671448409620920816962031421760821536857739867091518130820666851429659521644395210076486929974433283600654212417236965360191622815429088977665283281233985437534914410337784905148162072236632776726079646747217649096478217730937617129190998235305440942940997887376066877922313269799100962522339512063238715605991145824132668092859143877040336733265206247392610145390120840758326544993635125500295851568809397727074396544491751338520327400086966325417218279705816696179514002649477183048841945340548462107031020298877792569825961247502381780415708619678189776751138243901716933132199290539255210449335761455033619226278574785374311799532933012427434212908857908384227766237900397379672600561419668215482726559453999011654562574138704510630261158904675231506980455749390312821362344206205220814997373018092501542648084203076662389945770660306333960628889852744830151580542923985245169003595677184934512841781757653244920745492377783952804365043496170859401860029030307705887192603624314711242772474016448989626499867168777133455263018133715834615526608754230557370958046910625166189084672164980824143845435263220456811710320379451505649051701742051668463879538652088117769126842476115859830461745271507764131961720826497794256427418338477136532594816786003308929529554619570280948126214031433455311162471464529786595115375093351580726772271167419132306788998528968442641336179283023819560294795697092916402389062448484757600073455495606149549929469615567508539829546333564691252712082012612389029787053303657533438039982650460424368883976522037039733768274835016808348178365106800245087698163372583316627417984301430606484643121068282317034357670068887630712294887454285930340829723467677155262519968016035482079823035594298092120057027962664993732981809568299904621226800222493869756937206827011630259088205269982634942314832184653013694545327805229919865660314649579815551490117241952889241809939828855651285204886337561319518448828044262452905346759125348350758590816264311209624721759613929567891236251254085330774973982775040823598851169710017928056719331357574283638048238232221779692892520547910813486154072332324528844341134459823360640692000648614238194257447030880754602071813243779956868813670830888045017830926124558634666621595471794617823023802448439200293710512571779639591596994829690745020375254062922704375213628667517685774630133690316345822290843482398121323560114501703779553741367949547575797243581631239825204399774396252231241518486611546847689898111321998075354190113383428195636260532612166996951718268943452951826977651117645728627925050378961993010212499896447457059164954386312869757226200003989802253783431063119423019212637907068438686339734163777571726243863786392662656105257653381067388096252674677621855482755209365060502443753961812090953879074555847291922970458892510888126022313879652936101790812485029491101982254201311307207598519938210040525541163843221281423537044092684420738244016864025367521959101669016099902304747417984379662954255383701138843625464491534678970646260334162760527083619216010049590557001857750350096946318320234987756908914462996412567615718640932206556453637684165655640135794379865742032462571520823394082562414933896114488688822467964993850285102048082722842380606848634433892325684281936332660119937059484047466896337147040161688114568968591156914146089283894328740496635163893136293322998875513326080519409893859995766990834459757377104065817749460530191799261935990141510994772101013275029714551275405428747383944490228125637034279640771882870637747650811285976241864531495754705270790721179122953652759132481492575242362638615353295230163946813115251529106264561825568064326355823704258441015255547972485459798830562876871239693625789332077594471464949451514184917984242762422958013097322447181567701468928734619200761493881667471129779630238938974802627761367979206991465782426208763891879172127885764318787839801758939362873546698779284684752802332381176894527024282187710480870050981131419125494245772609471159447503562435400478651475850521110321000502435152071774737617328656107045529492138904466977995600794454019415371471820159773690218289826653807953315370562082804147910706546985741091186809851938592748507600614279774542665478506177045867929744092650363756778373714076723226408719087548199488127440071727947826164898798459314561072485323755111732332534688653497321674112457957827761017934210219602261654627286229010934974546546702703752987502842870493452132535158703831576864691690652636634162286839917206795616971586729989279822647953146058170927161771280811286853928530045418553443283744300049203519612203887000767176123554092934348486979279903913487945962267827879197448118575101877484004022676181063290851186182180885257543903564634361208088497699214730244103670890441030350173363697515094993556499779728012504755982450582531039408245328547435627478762435524294984635360476634281442431028799177995149840505970015545138993427677597112670388974769345838273490557045486029976641397349304872324432442631545137635790614773238312838790468976919934251745455348907604841894891152407004480550863602638870104551619742709288894658093105507649107144089705332128710554280047849524202230012153097602205947292394370923965970408258705359931262779067231615954335823575038163478484474413986872872472443993781648204917341444044832621069777'; 140 | break; 141 | case "sqrt7": 142 | irrat_number = '2.645751311064590590501615753639260425710259183082450180368334459201068823230283627760392886474543610615064578338497463095743529888627214784427390555880107722717150729728323892299689594865087260700978054203723828023715941100341939116001578525596305945741035152396802716407373799074041581519904403474319453671399730597005051399692237545616097119027378154991633288287704000657570674651963497752083793818114613090876473786595624330579947981281632307054836501077156179463611915534545364774948205930904948498340339890021047861667332795036939246225717053716492578754832290732492671346980298949908037748251109227895568897919808814834090831685251335358295391722117707144149745769070819894444414589722847414003035023532037194870738262931851936409083228059646278376102195979419708909635469586134118179306781621360849101677835321255633463490021898146042255929503669562418692737327715022087523099664698132032128189454785680209506359624466285500761905041393504474371234885223327736251004505962108067233469812000430051449025120625731175911542319445967260497833404344683725636178255048160879406205511486397833055016369470076387773745195116580952204742020649821024440560019965909041002855340691101022611668072007748307033261384282629680950247079465649634433683051970882034805048644726231793087695722489377521119788376007845603903658809421599292501057753682356001720074065236924732099674197780025357085406177944428866815897311849381016381620730156426470162984109969007134132379818847764776995439111194596767033697245247536774010024582651593077528163005479339717508017899520565284447796194304512502890432970610508746044929668975422571333806332470345088882342754098062145114395538033931907053927381452060433523818038933329473147905805567070416106872287810452995769663303513329504704245502510500789645502552271857923370921821991843932537781386785650143790894130020990408601866052281313298217352517164196336178530801790228734003371095272573642865092203591634382027397633655096671417781629289427988485395107681910216811699677176780863793410667897509217050421558644370687652934899322442240273649792906668420703057822571105379442157900132803040784945794315181204663092841525924046836528280272245853077841589423897395559095956349135749510975767478197559053372693936521431268222909570986506137179452721677198255442288046052307455488310813325041499327834681820665834473833668624544561694972517742702546885917462319423093550603889923535563446587292250736222828429821528790362384759555586164375547202736151800826144981691174794610631845652307625691344410868551999982851633960745717970829727764956451426556582051262403059616338683387461342374635264312965945270102137217217489914355293204957509711425942720798892966523049887593952537812145572319331030690840194942118708515205734116214105775416917245804962369512932926647583857193343125506160975090039575120634875759795492954992247266340740188156349405310529604465875564620943338947941762395628356349713801694732220066791621293435973671100587608647371575881684122969500862937088695418127695765706218647593705890746227177674315989867934955423190387742224446136993060888756395652843391274399232387968832906207071598123918140197532376623874218833710703285322771142186264479238443931230317870021802156263998733847453103345993606899837633245900690816758898827355721304788511327144687241520353111338592288651345874819553041264322213678583855423590638618452700487231832136684265554753667165760425744959823608640542890447143374413527216575973366727564720357457321402931064380350431323788424731514549384903622426849768122808352574866163546646010620175786052993048378210387191117674718316840267143474839354390876792673862085122636674199255108677682336995949767664130615461747219560627489330736537532202056798649880001671863618041955309396028757283709888318004585769283563572097327049988024818622254114445188211812396056809102453283729690436738951943637997079341974788168885139428215328113423555715996732375739529137268807984747292245466870530936722514896271417869980500986002976964399874240236749129336888862332000291880996962271949986510924694867687893935461097268191476537583989507447113490414817455171869253859459591406692158039259150200251233841771532335377771441133562623485744370057936674882686357744269817392446075271575254145214453269672977196708317754248517376333044949903502139078141112089271184202122989519450984107822959655314980705636858421164047096965559849599650219606644389127462654913795145250696216490279586061067753708277274582900137716610589203916087776132735772018007762008467256113972695544632129805026246243755967488328449842162440716762569896296303765707261679502460078979197841773862596299531222067563316483973318489852265398165212376051648275412296241825243571649098629157872387564320229645113094736976037742258960665170713858206085945904439302758064720076077242085026875085054098045522064130392719051307751601950066177113335220294857981033416275657093398039516124042717351513332630177574641739426802204936108332643844702150525250280000631375821855226793326606927200078066975096981241212683884536969022355380120565398755290441622898303878504589253133207213113997911820236415222965163886116994709493957791339479276218550756216216209697645177428331876248945467953178903992008193959403210310790653540815607217656002628651066858334816905836392518024860312847329626547271683726594116720954682357322814031380917749454908600420166879375247348533858056677058541408042124916415231717570106062160546999810729767225121183067315005034685995516701968051317559753622351601297333163992381918279893372956943266221754913636727940496793761358777675628416390601772431036320605712165331232229570942438013812723107240517288411013737616135380955808932247723569730050534124089860063237421220262844538031656017699002317861148863053999206860142853693286197690606203959906145185273942808641918396474035825795806430571984845652110920058455681781914675085096210003735220675439318675013094837257535813476410172638335224856994460068840297946669638399708740810797261385302460786358230931170547074503408741797594283973053227965165462872006255460473888091472904139114590210209845375052541063485472950059411129900908318154293737430344916285541875301936718273904395039783362364980724027263837332533031898480092324763285769204626157988159562362654797754612834109154571105892270631921417992012344505479482390215936802209190912367144889334715425046063717646649420333679454681814286096275078901726394838917676410853523135337623134666657082717788331941088811151290034088950596806727232173855251816791477663602920083932266078674308371598326767758651623047551815571039234344989662326598864712076099020006621754954139478008157629315332123170534454501756089069297073021117781524319039414323872919385135326400244141301532757718708373138628837077557377550151098576238441234929066868632976729288200026707269803761085144956481370706403748276113974628241590760584270301737898491593263790212234464820228999301833677385590100084246670979830738859298390975575960118486078515926511530519450037717006920766565969625045582330117294534795540311990721861829585827532392929717397139368803786289604739278430103040382236207507493365481612063224267065251845971785297508473087429118698282619262334047577505016671568983361453913542090619703628927768395570537056827059221178013279212812747291748669390288072517136221751551624349181642740516899791680344243484529108052122656637090347059037578760410656229994577533269489710172866983188837156622172886752186246001266662136768830214106899507441168302547214550109300078970804361542174933232351165089109578029001323643355408867793877741529765306288960003652641499544869644827281459863971828823907604712639853351305264961297589292155461585982236196210334906357704114156678334410584977844782157977303327288769414012119499568522079447227431768128893548609797467891277830663382197162994755883402126143408438544578485614986094734597436112494133315562296273850463940514366326090607193684781457462592307913764153586568333556524377291258593896527871270050551601024435524884277499940014587653613322468700900664317717860534558719172279740108496590416709657242405573211318263778610730079889195461911929917597120925969648676369998002171075484065796851984768361697908619677007135834565852440299574420935175287328004609314899903178759658188610048971117317106048366601487174480752897998782553381104304817695804582027774770489150085104377075257227123548007237712086585401584570878697112950092404668280725006794531512206594317013091252435135680076500252708495798427421783933180723041463432349100118931373011641327930932013868817470775836373169726951868270435051576692281618526424767110503024931704286760131795738464455796115871317428273935803103843119387910076831840070252863894073059994877941659918471144241278086456273878925566156350764394829576260537929680552372645393728198188125861937589627244612671953603617876166976812502509475009015100629843398962835714621296851152715699279620897455949014251228449209580647983216564650591713271548205530943628633531894500922767763362366254093881474673170987201374186532487577091691581177965494058704038689964700984868681258926455113718920872766119116466390692679358362328028287050318499727379236455728397178350820081430826339074341187286144658481718878385452194452375299682672141920696541809090074387574013325374235022637287666645682706788931333593008336698955708756466645112114989579187284767956864355310789844556004498476104772104546511218001509665403712123872051986219143271028003614260436497412665251153454621084465209547132954296698544956432708218069243250946228614370986081041500463153860447622208181575501101005967219299377665706660425509878244973074444827975618331686938351016864918443385276807469215087600612829302925721916523356188489821919889086362544238306312998128430409851531236004060378688194119909548909762722744738641063686120627661849841650344369059048450964106672441136007721327658552298059728755847984732050231949831957389149778271702829165518760102678129055620628182116868811036470212421051260468363703773556551863754718757431482087380943451'; 143 | break; 144 | case "sqrt8": 145 | irrat_number = '2.828427124746190097603377448419396157139343750753896146353359475981464956924214077700775068655283145470027692461824594049849672111701474425288242994199871662826445331855011185511599901002305564121142940219119943211940549069193724029457034837281778397219104658460968617428642901679525207255990502815979374506793092663617659281241230516704790109491500575519923459671150440675063714022708749206816997694320773799941398009630061088055580632908495646136985873837243161156926223193337426026031237137974474470577018529722498995430843666840857137212029364944154287170974831131413935530744045297089403171760324151694984531445200417116893304291679778788874185318360062277649293631416526020118971740800637296068438979455658128209014527376262747971051223464408049018245540045388225514725456099147621793500803673973673690145159872945812152599388276095130964745799436065360494884125853824971810436200891968430118224049888268345706295621160720674215461836573862942034222336783316345377883951743316430425645903697694417938926772578312576553190527028108453530647938923502258320481743102027030091076257512010526293603425480530793894048060103499063772585126277037632695600313873835376370475736810457567525877842860131173913737192919031100328944901967379207377464622877883115330208176782858467622641210486725897063409983154351245709948287799837604352486193041312842365463345251507918943451186927447726452296548524441734231167919985304235250539783508197631869728016691417036294446362840814085301811306466679687291573159359303853458479975073323443196515772052672723565499198843880755550736285243547759838910279446254813379665997979077345764571275739549932503993316705155239787864569068947138958992590433778297098507780951165766905219304819308577878907729325148985511276392882063395966612370403875876988011431266744109613708115173599934024274447895164285261317026443481766476589457523478729493567486392000318437761469571523450442373498084995473385841462219273944321786741732231346917066966659050935170328942151569720492720166889822963717531110857291024662843985262266503594121687311940870571282017583700152072201831893134135376721114348015351381019227343880264987121048037199821012421632719545286276121093402058713994208485021156349906211451186996890225384556068982701327513749552056632565921106484485391506905805767753689285834656554177663617405067970467624549998162474378508145295073570060964318360377233421794573845840239519976140763708666507292042216459855858614574356159977619835348354821796612160065262363285597646234308727739323405999868323229757372036091011107973826230372020772750650009116372089608150048239036861134906736722734919474884797710657035861792074779783034639174826885763568425004383390375118688877479237862909999981221517409818052176703527244949951571771673607491586231467960419997324437389984519182655284723882118420065605229974913319937774813591233478371914577728494692717177372899364477201396670528559811256633122782788511529812413037204329452606672595015139574121321371299632018543741858430626473656271397787419483300894918192107494559304895418819848247742122894108797348729467695490963820174577244429917905918237578429835966796216757655630613112463162072129735174607202900454641765870268277445536835335687381058857396981676911489158819197252148499909833605706154797876592072426707975064101839978721502781288899153691398694255272901432655830940319546709727787884651455508007652054957134834516190283261431919569963601888712075878197118033654430806916316304200987332590689765421458479320464327647653322525366100514556233890207075874313764673186459564638597212935957972818417121911628522872726200923118866510094898795186799825083906460186435060895306792941325522332350703750929241935269117477232976039769699495852809013088979382008158842363385159371512756976299797283370998983271522896809404206797843068475407446670623129188877940730633344389809870376581161261480269372528334494022130692698783281429257113596035586762884809053827413321955527756973247600678464874094823066374506381203833199291076231577682761686646421067534923624356028592185664822725505081774745810258814678958866123887913873404158859031756456698643863332822260309918939675795534868887078675419914269976815781701631784732140177316210941899580931445977761784922565632026267402058160581999491295699163091229297431032781004839715812262186917566612400524414744943353370910999809988171421619851519857786473230876543910011563250266076306293155815853737001613968856958304848550882053611512643130644123771502450226127874050725854323936502518384050432117402379193464488478534847468981529293454750695929197638299615863436004847710907772076736621601558364932925508234888500037455559036328766902926922598041526686035937108771263335447036778673334084444221878289860575927625679778623462616860084251100370997013058911275532062922511818209222769536564719184954457258085285472326529170886785754527720686299609792794726659509771851362298593672253451797147666432873326974046954605220212261014597223068259897617548946222459085305503307331823460284721253051738154396434074196209288720954453478565974830518613912412769421654816436981347446611748605941848579896347848815738750568802088798097041757703828387083025801363470340613877394118009485031531049615689472428821003240169088824451191240596945188070560381359613619660079290797137186091725052127559490711985549459812977749090248499215275602172780038211618574952944150221847721190039086456320417759243032467704322575045703605058575236651407434571481352788981965092884436930861761322116040316945681342526050918759781301633714274331337188260106639407319280675334829220991275302061673226978621895605362587114663781103941040369030079938197326305024823222385188110561712997863917966912466396736698976161234312487822573262559569674395790673803055520109961103327003957111422028111059526768255008937209295326366532233036413500240953398219744382088948806537887283191885584398884710743740859911848062818342569631708773201077142716727963261890481511401865033648688336481672395854674565043092449392306643405365990195817806918971775669887923240871684499479437422791785461018439410983435392320089116179885575776073833886578919029445344585224970139234632761882164372009057220539309515260862051205430462793896427103964281943309819463998566985134819498078459425269738682914986639608343615222392780455732815184486833552493247247782622054068660915273628225664265261716447891243919617322587999240246831235263634862484017802996769712096175972921678719298473302859362515462864582913743365524399223655653906314996760524930351810820795236257520843277226900442652545551322488226722155039111549901731272134757330124637128139824560375148357098932250655199539592119552118151297821332203167683440563706086423808931550510855508759745210976347239653516337256659052157986445336720567702702456211863718205728301631411263943463036627250048718082926424478435326796537873650630106011978309405819074386532414682246989486735769380402780995685704326828858429179116575695338789292853562443809957127271052673655610372019739849787557200479753833961531324388779708874161189286672466762117491632470951200273184870485314286166931091536004741629351465050940510149527494327013570319834738758650206536552125729182923640944297274074154385385364724666944075849192938362105227830617256058288193096512774618546085308932585809179212750383742293869072394664957914541406306186180384239839998723153000700796810813485077585505584544946713354121567582276897787252273531412052720063026590419079040570979476897251226984882941721417320535269995758684175167224389423398844769696519182860905621412520301793827060603544012543410880418133902983054919543941189539094819042057574511571376004438743548711622158786176676911729655458201725910913228261344246169748045424211737264677647482776885787631088929421151130293687140589327012578774713973737675296065303905682930703479060547224027484060197347967702864380087205796539658705879882825846116076913004541443363032388202289965260272980175409679697677218130673719810916779040637129608298654428478173032999886331841593190713886144622582325857359503431337781087864407138258664914041613438888099460988796281645565920559884908216633335184284967036544763441008207854857760311244676159229502486702946204256909188979888999200150487503914023336683489498159176419903567353604647303534994460297491548545198952192439686542967059722238054574716981043595181674839497205341210749246306007875042473573550569738439171427510853936965567263572221986736028783181194968571610903226046028795811403221779725555922150134666535209730985850279956278107176455378746440988296788027112071312088428035224121026361378397992521236966370680367247564345327516091049439253234985084570560914288409715668422645601705740841097798468255710962473523075414208508939737043982245670853269999425496732152492483641472933234256789496946560948860806688214400857454255134055913516485852543890916106005332979930159139556357243884344010474330738935408390223825409249672102260578092875502297389775699230237682943820002511767673321354416822470307117622535579143117180825152523202135026307160424854663742001271649909008199158814509597800633653024746238111336583038861074169786157383948565809807720744623219856684863424450198909430038573329757421590399036010926776768863096344927096048903606169054686200124274206925146612002469947488711636193135692928306781029313838649124706281155838739797684729436705075161051542662240159420813663098533080405209361363678287565442953812648493903425727347688627966674235231883739986932524690746904713588024833618458232721912744334905678341981829329701478410303211209475742123094043399214931386195888522429385123186851298803824597902946508943036252651673779456452566659048071940145572672920918941424834945893755141191631469992569619913567851094848089798377414213935048501549040245872162114828530646944812832428206670668110220904252350071805680749091837290094552486841435418595870802042819292900567366836081517216200281443238495435961971936223080892887457137918573663955595573869283196939490267835483075809755761660044116670093493110646057174651670'; 146 | break; 147 | } 148 | 149 | ld = new Array('',0); // last digit not set and the sequence has the length 0 150 | if (nods >= 10000) { nods = 9999; alert("Showing only 9999 decimal places..."); } 151 | for (i = 0; i < nods; i++) { 152 | if (i != 1) { // decimal point 153 | if (i == 0) { 154 | ld = line(1,parseInt(irrat_number.substr(i,1)),parseInt(irrat_number.substr(2,1)),ld); 155 | } else { 156 | ld = line(i,parseInt(irrat_number.substr(i,1)),parseInt(irrat_number.substr(i+1,1)),ld); 157 | } 158 | } 159 | } 160 | } 161 | 162 | function line(dp,no_1,no_2,ld) { 163 | if (show_dots) { 164 | if (no_2 == ld[0]) { 165 | ld[1]++; // increment in a row 166 | } else { 167 | ld[1]++; 168 | if (ld[1] >= 2) { 169 | ctx.strokeStyle = color_arr[ld[0]]; 170 | ctx.beginPath(); 171 | ctx.fillStyle = color_arr[ld[0]]; 172 | ctx.arc( 173 | mp+((sr+br)/2)*Math.cos(sA+(ld[0]+(dp-ld[1]/2)/nods)*pA), // midpoint x 174 | mp+((sr+br)/2)*Math.sin(sA+(ld[0]+(dp-ld[1]/2)/nods)*pA), // midpoint y 175 | Math.min(2*Math.PI*sr*((ld[1]/2)/nods),(br-sr)/2-2), // radius should not be bigger than ((big radius)-(small-radius))/2-2 176 | 0, 2*Math.PI); 177 | ctx.fill(); 178 | ctx.closePath(); 179 | dots[number_dots] = new Array( 180 | mp+((sr+br)/2)*Math.cos(sA+(ld[0]+(dp-ld[1]/2)/nods)*pA), // midpoint x 181 | mp+((sr+br)/2)*Math.sin(sA+(ld[0]+(dp-ld[1]/2)/nods)*pA), // midpoint y 182 | Math.min(2*Math.PI*sr*((ld[1]/2)/nods),(br-sr)/2-2), // radius 183 | (dp-ld[1]).toString()+' - '+(dp-1).toString()); // decimal place begin - end 184 | number_dots++; 185 | } 186 | ld[1] = 0; 187 | ld[0] = no_2; 188 | } 189 | } 190 | 191 | var nod_1 = dp/nods; 192 | var nod_2 = (dp+1)/nods; 193 | // get the middle of no_1+nod_1 and no_2+nod_2 (middle of 9 and 0 isn't 4.5 it's 9.5) 194 | var quadcurve_int = middle(no_1+nod_1,no_2+nod_2); 195 | 196 | var grad = ctx.createLinearGradient( 197 | mp+sr*Math.cos(sA+(no_1+nod_1)*pA), 198 | mp+sr*Math.sin(sA+(no_1+nod_1)*pA), 199 | mp+sr*Math.cos(sA+(no_2+nod_2)*pA), 200 | mp+sr*Math.sin(sA+(no_2+nod_2)*pA) 201 | ); 202 | grad.addColorStop(0, color_arr[no_2]); // can be switched so no_2 = no_1 and no_1 = no_2 but I think this is prettier 203 | grad.addColorStop(1, color_arr[no_1]); 204 | 205 | ctx.lineWidth = 1; 206 | ctx.strokeStyle = grad; 207 | ctx.beginPath(); 208 | 209 | // drawing a curved line from no_1 to no_2 210 | ctx.moveTo(mp+sr*Math.cos(sA+(no_1+nod_1)*pA), mp+sr*Math.sin(sA+(no_1+nod_1)*pA)); 211 | ctx.quadraticCurveTo( 212 | mp+0.7*sr*Math.cos(sA+(quadcurve_int)*pA), 213 | mp+0.7*sr*Math.sin(sA+(quadcurve_int)*pA), 214 | mp+sr*Math.cos(sA+(no_2+nod_2)*pA), 215 | mp+sr*Math.sin(sA+(no_2+nod_2)*pA) 216 | ); 217 | ctx.stroke(); 218 | return ld; 219 | } 220 | 221 | 222 | 223 | function middle(no_1,no_2) { 224 | var min = Math.min(no_1,no_2); 225 | var max = Math.max(no_1,no_2); 226 | var i = max-min; // counterclockwise 227 | var j = 10+Math.floor(min) - Math.floor(max); // clockwise 228 | if (i < j) { 229 | return min+i/2; 230 | } else { 231 | return max+j/2; 232 | } 233 | } 234 | 235 | 236 | 237 | /* Tooltip function */ 238 | var width = ctx.canvas.width, 239 | height = ctx.canvas.height; 240 | 241 | savedState = null; 242 | 243 | var tooltips = [], 244 | defaults = { 245 | tooltips: { 246 | background: 'rgba(0,0,0,0.6)', 247 | fontFamily : "'Times New Roman'", 248 | fontStyle : "normal", 249 | fontColor: 'white', 250 | fontSize: '12px', 251 | labelTemplate: '<%=label%>', 252 | padding: { 253 | top: 10, 254 | right: 10, 255 | bottom: 10, 256 | left: 10 257 | }, 258 | offset: { 259 | left: 0, 260 | top: 0 261 | }, 262 | border: { 263 | width: 0, 264 | color: '#000' 265 | }, 266 | showHighlight: true, 267 | highlight: { 268 | stroke: { 269 | width: 1, 270 | color: 'rgba(230,230,230,0.25)' 271 | }, 272 | fill: 'rgba(255,255,255,0.25)' 273 | } 274 | } 275 | }, 276 | options = (options) ? mergeChartConfig(defaults, options) : defaults; 277 | 278 | function registerTooltip(ctx,areaObj,data) { 279 | tooltips.push(new Tooltip( 280 | ctx, 281 | areaObj, 282 | data 283 | )); 284 | } 285 | 286 | var Tooltip = function(ctx, areaObj, data) { 287 | this.ctx = ctx; 288 | this.areaObj = areaObj; 289 | this.data = data; 290 | this.savedState = null; 291 | this.highlightState = null; 292 | this.x = null; 293 | this.y = null; 294 | 295 | this.inRange = function(x,y) { 296 | if(this.areaObj.type) { 297 | switch(this.areaObj.type) { 298 | case 'rect': 299 | return (x >= this.areaObj.x && x <= this.areaObj.x+this.areaObj.width) && 300 | (y >= this.areaObj.y && y <= this.areaObj.y+this.areaObj.height); 301 | break; 302 | case 'circle': 303 | return ((Math.pow(x-this.areaObj.x, 2)+Math.pow(y-this.areaObj.y, 2)) < Math.pow(this.areaObj.r,2)); 304 | break; 305 | case 'shape': 306 | var poly = this.areaObj.points; 307 | for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) 308 | ((poly[i].y <= y && y < poly[j].y) || (poly[j].y <= y && y < poly[i].y)) 309 | && (x < (poly[j].x - poly[i].x) * (y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) 310 | && (c = !c); 311 | return c; 312 | break; 313 | } 314 | } 315 | } 316 | 317 | this.render = function(x,y) { 318 | if(this.savedState == null) { 319 | this.ctx.putImageData(savedState,0,0); 320 | this.savedState = this.ctx.getImageData(0,0,this.ctx.canvas.width,this.ctx.canvas.height); 321 | } 322 | this.ctx.putImageData(this.savedState,0,0); 323 | if(options.tooltips.showHighlight) { 324 | if(this.highlightState == null) { 325 | this.ctx.strokeStyle = options.tooltips.highlight.stroke.color; 326 | this.ctx.lineWidth = options.tooltips.highlight.stroke.width; 327 | this.ctx.fillStyle = options.tooltips.highlight.fill; 328 | switch(this.areaObj.type) { 329 | case 'rect': 330 | this.ctx.strokeRect(this.areaObj.x, this.areaObj.y, this.areaObj.width, this.areaObj.height); 331 | this.ctx.fillStyle = options.tooltips.highlight.fill; 332 | this.ctx.fillRect(this.areaObj.x, this.areaObj.y, this.areaObj.width, this.areaObj.height); 333 | break; 334 | case 'circle': 335 | this.ctx.beginPath(); 336 | this.ctx.arc(this.areaObj.x, this.areaObj.y, this.areaObj.r, 0, 2*Math.PI, false); 337 | this.ctx.stroke(); 338 | this.ctx.fill(); 339 | break; 340 | case 'shape': 341 | this.ctx.beginPath(); 342 | this.ctx.moveTo(this.areaObj.points[0].x, this.areaObj.points[0].y); 343 | for(var p in this.areaObj.points) { 344 | this.ctx.lineTo(this.areaObj.points[p].x, this.areaObj.points[p].y); 345 | } 346 | this.ctx.stroke(); 347 | this.ctx.fill(); 348 | break; 349 | } 350 | this.highlightState = this.ctx.getImageData(0,0,this.ctx.canvas.width,this.ctx.canvas.height); 351 | } else { 352 | this.ctx.putImageData(this.highlightState,0,0); 353 | } 354 | } 355 | //if(this.x != x || this.y != y) { 356 | var posX = x+options.tooltips.offset.left, 357 | posY = y+options.tooltips.offset.top, 358 | tpl = tmpl(options.tooltips.labelTemplate, this.data), 359 | rectWidth = options.tooltips.padding.left+this.ctx.measureText(tpl).width+options.tooltips.padding.right; 360 | if(posX + rectWidth > ctx.canvas.width) { 361 | posX -= posX-rectWidth < 0 ? posX : rectWidth; 362 | } 363 | if(posY + 24 > ctx.canvas.height) { 364 | posY -= 24; 365 | } 366 | this.ctx.fillStyle = options.tooltips.background; 367 | this.ctx.fillRect(posX, posY, rectWidth, 24); 368 | if(options.tooltips.border.width > 0) { 369 | this.ctx.fillStyle = options.tooltips.order.color; 370 | this.ctx.lineWidth = options.tooltips.border.width; 371 | this.ctx.strokeRect(posX, posY, rectWidth, 24); 372 | } 373 | this.ctx.font = options.tooltips.fontStyle+ " "+options.tooltips.fontSize+" " + options.tooltips.fontFamily; 374 | this.ctx.fillStyle = options.tooltips.fontColor; 375 | this.ctx.textAlign = 'center'; 376 | this.ctx.textBaseline = 'middle'; 377 | this.ctx.fillText(tpl, posX+rectWidth/2, posY+12); 378 | this.x = x; 379 | this.y = y; 380 | //} 381 | } 382 | } 383 | 384 | function getPosition(e) { 385 | var xPosition = 0; 386 | var yPosition = 0; 387 | 388 | while(e) { 389 | xPosition += (e.offsetLeft + e.clientLeft); 390 | yPosition += (e.offsetTop + e.clientTop); 391 | e = e.offsetParent; 392 | } 393 | if(window.pageXOffset > 0 || window.pageYOffset > 0) { 394 | xPosition -= window.pageXOffset; 395 | yPosition -= window.pageYOffset; 396 | } else if(document.body.scrollLeft > 0 || document.body.scrollTop > 0) { 397 | xPosition -= document.body.scrollLeft; 398 | yPosition -= document.body.scrollTop; 399 | } 400 | return { x: xPosition, y: yPosition }; 401 | } 402 | 403 | function tooltipEventHandler(e) { 404 | if(tooltips.length > 0) { 405 | savedState = savedState == null ? ctx.getImageData(0,0,ctx.canvas.width,ctx.canvas.height) : savedState; 406 | var rendered = 0; 407 | for(var i in tooltips) { 408 | var position = getPosition(ctx.canvas), 409 | mx = (e.clientX)-position.x, 410 | my = (e.clientY)-position.y; 411 | if(tooltips[i].inRange(mx,my)) { 412 | tooltips[i].render(mx,my); 413 | rendered++; 414 | } 415 | } 416 | if(rendered == 0) { 417 | ctx.putImageData(savedState,0,0); 418 | } 419 | } 420 | } 421 | 422 | if (is_touch_device()) { 423 | ctx.canvas.ontouchstart = function(e) { 424 | e.clientX = e.targetTouches[0].clientX; 425 | e.clientY = e.targetTouches[0].clientY; 426 | tooltipEventHandler(e); 427 | } 428 | ctx.canvas.ontouchmove = function(e) { 429 | e.clientX = e.targetTouches[0].clientX; 430 | e.clientY = e.targetTouches[0].clientY; 431 | tooltipEventHandler(e); 432 | } 433 | } else { 434 | ctx.canvas.onmousemove = function(e) { 435 | tooltipEventHandler(e); 436 | } 437 | } 438 | 439 | function is_touch_device() { 440 | return !!('ontouchstart' in window) // works on most browsers 441 | || !!('onmsgesturechange' in window); // works on ie10 442 | }; 443 | 444 | function tmpl(str, data){ 445 | // Figure out if we're getting a template, or if we need to 446 | // load the template - and be sure to cache the result. 447 | var fn = !/\W/.test(str) ? 448 | cache[str] = cache[str] || 449 | tmpl(document.getElementById(str).innerHTML) : 450 | 451 | // Generate a reusable function that will serve as a template 452 | // generator (and which will be cached). 453 | new Function("obj", 454 | "var p=[],print=function(){p.push.apply(p,arguments);};" + 455 | 456 | // Introduce the data as local variables using with(){} 457 | "with(obj){p.push('" + 458 | 459 | // Convert the template into pure JavaScript 460 | str 461 | .replace(/[\r\t\n]/g, " ") 462 | .split("<%").join("\t") 463 | .replace(/((^|%>)[^\t]*)'/g, "$1\r") 464 | .replace(/\t=(.*?)%>/g, "',$1,'") 465 | .split("\t").join("');") 466 | .split("%>").join("p.push('") 467 | .split("\r").join("\\'") 468 | + "');}return p.join('');"); 469 | 470 | // Provide some basic currying to the user 471 | return data ? fn( data ) : fn; 472 | }; 473 | 474 | 475 | for(var i = 0; i < number_dots; i++) { 476 | registerTooltip(ctx,{type:'circle',x:dots[i][0],y:dots[i][1],r:dots[i][2]},{label:dots[i][3]}); 477 | } 478 | 479 | /* Save diagram */ 480 | function save() { 481 | var save_nods = nods-2; 482 | var canvas = document.getElementById("irrationalCanvas"); 483 | canvas.toBlob(function(blob) { 484 | saveAs(blob, irrat_name+"_"+save_nods+".png"); 485 | }); 486 | }; 487 | 488 | 489 | 490 | function GET(name) { 491 | var result = (RegExp(name + '=' + '(.+?)(&|$)'). 492 | exec(location.search)||[,undefined])[1]; 493 | return result; 494 | } 495 | 496 | 497 | --------------------------------------------------------------------------------