├── .gitignore ├── README.md ├── _css ├── bootstrap.min.css ├── fonts.css ├── hl.css ├── solarized_dark.min.css └── style.css ├── _js ├── app.js ├── bootstrap.min.js ├── highlight.js ├── highlight.min.js ├── jquery-1.10.2.min.js ├── jquery-1.10.2.min.map ├── markdown.js ├── marked.js ├── sammy-latest.min.js └── sammy.storage.js ├── _pages ├── accounting.md ├── accounting_fr.md ├── default.md ├── default_fr.md ├── help.md └── help_fr.md ├── ajax-loader.gif ├── config.json ├── favicon.ico ├── fonts ├── CosmicSansNeueMono.otf ├── CosmicSansNeueMono.ttf ├── CosmicSansNeueMonoBold.otf ├── CosmicSansNeueMonoBold.ttf ├── SourceCodePro-Black-webfont.eot ├── SourceCodePro-Black-webfont.svg ├── SourceCodePro-Black-webfont.ttf ├── SourceCodePro-Black-webfont.woff ├── SourceCodePro-Bold-webfont.eot ├── SourceCodePro-Bold-webfont.svg ├── SourceCodePro-Bold-webfont.ttf ├── SourceCodePro-Bold-webfont.woff ├── SourceCodePro-ExtraLight-webfont.eot ├── SourceCodePro-ExtraLight-webfont.svg ├── SourceCodePro-ExtraLight-webfont.ttf ├── SourceCodePro-ExtraLight-webfont.woff ├── SourceCodePro-Light-webfont.eot ├── SourceCodePro-Light-webfont.svg ├── SourceCodePro-Light-webfont.ttf ├── SourceCodePro-Light-webfont.woff ├── SourceCodePro-Regular-webfont.eot ├── SourceCodePro-Regular-webfont.svg ├── SourceCodePro-Regular-webfont.ttf ├── SourceCodePro-Regular-webfont.woff ├── SourceCodePro-Semibold-webfont.eot ├── SourceCodePro-Semibold-webfont.svg ├── SourceCodePro-Semibold-webfont.ttf ├── SourceCodePro-Semibold-webfont.woff ├── SourceSansPro-Black-webfont.eot ├── SourceSansPro-Black-webfont.svg ├── SourceSansPro-Black-webfont.ttf ├── SourceSansPro-Black-webfont.woff ├── SourceSansPro-BlackIt-webfont.eot ├── SourceSansPro-BlackIt-webfont.svg ├── SourceSansPro-BlackIt-webfont.ttf ├── SourceSansPro-BlackIt-webfont.woff ├── SourceSansPro-Bold-webfont.eot ├── SourceSansPro-Bold-webfont.svg ├── SourceSansPro-Bold-webfont.ttf ├── SourceSansPro-Bold-webfont.woff ├── SourceSansPro-BoldIt-webfont.eot ├── SourceSansPro-BoldIt-webfont.svg ├── SourceSansPro-BoldIt-webfont.ttf ├── SourceSansPro-BoldIt-webfont.woff ├── SourceSansPro-ExtraLight-webfont.eot ├── SourceSansPro-ExtraLight-webfont.svg ├── SourceSansPro-ExtraLight-webfont.ttf ├── SourceSansPro-ExtraLight-webfont.woff ├── SourceSansPro-ExtraLightIt-webfont.eot ├── SourceSansPro-ExtraLightIt-webfont.svg ├── SourceSansPro-ExtraLightIt-webfont.ttf ├── SourceSansPro-ExtraLightIt-webfont.woff ├── SourceSansPro-It-webfont.eot ├── SourceSansPro-It-webfont.svg ├── SourceSansPro-It-webfont.ttf ├── SourceSansPro-It-webfont.woff ├── SourceSansPro-Light-webfont.eot ├── SourceSansPro-Light-webfont.svg ├── SourceSansPro-Light-webfont.ttf ├── SourceSansPro-Light-webfont.woff ├── SourceSansPro-LightIt-webfont.eot ├── SourceSansPro-LightIt-webfont.svg ├── SourceSansPro-LightIt-webfont.ttf ├── SourceSansPro-LightIt-webfont.woff ├── SourceSansPro-Regular-webfont.eot ├── SourceSansPro-Regular-webfont.svg ├── SourceSansPro-Regular-webfont.ttf ├── SourceSansPro-Regular-webfont.woff ├── SourceSansPro-Semibold-webfont.eot ├── SourceSansPro-Semibold-webfont.svg ├── SourceSansPro-Semibold-webfont.ttf ├── SourceSansPro-Semibold-webfont.woff ├── SourceSansPro-SemiboldIt-webfont.eot ├── SourceSansPro-SemiboldIt-webfont.svg ├── SourceSansPro-SemiboldIt-webfont.ttf ├── SourceSansPro-SemiboldIt-webfont.woff ├── glyphicons-halflings-regular.eot ├── glyphicons-halflings-regular.svg ├── glyphicons-halflings-regular.ttf └── glyphicons-halflings-regular.woff ├── gitrss.rb ├── i18n.json ├── index.html ├── index.php ├── logo.png ├── markdown.php └── save.php /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | ./feed.rss 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Simone 2 | ====== 3 | 4 | 5 | Installation 6 | ------------ 7 | 8 | * Clone 9 | * Chown www 10 | * Protect save.php with .htpasswd 11 | * git init in _pages 12 | -------------------------------------------------------------------------------- /_css/fonts.css: -------------------------------------------------------------------------------- 1 | 2 | /* Source Code Pro */ 3 | 4 | @font-face { 5 | font-family: 'Source Code Pro'; 6 | src: url('../fonts/SourceCodePro-ExtraLight-webfont.eot'); 7 | src: url('../fonts/SourceCodePro-ExtraLight-webfont.eot?#iefix') format('embedded-opentype'), 8 | url('../fonts/SourceCodePro-ExtraLight-webfont.woff') format('woff'), 9 | url('../fonts/SourceCodePro-ExtraLight-webfont.ttf') format('truetype'), 10 | url('../fonts/SourceCodePro-ExtraLight-webfont.svg#fonts/SourceCodeProExtraLight') format('svg'); 11 | font-weight: 200; 12 | font-style: normal; 13 | 14 | } 15 | 16 | @font-face { 17 | font-family: 'Source Code Pro'; 18 | src: url('../fonts/SourceCodePro-Light-webfont.eot'); 19 | src: url('../fonts/SourceCodePro-Light-webfont.eot?#iefix') format('embedded-opentype'), 20 | url('../fonts/SourceCodePro-Light-webfont.woff') format('woff'), 21 | url('../fonts/SourceCodePro-Light-webfont.ttf') format('truetype'), 22 | url('../fonts/SourceCodePro-Light-webfont.svg#fonts/SourceCodeProLight') format('svg'); 23 | font-weight: 300; 24 | font-style: normal; 25 | 26 | } 27 | 28 | @font-face { 29 | font-family: 'Source Code Pro'; 30 | src: url('../fonts/SourceCodePro-Regular-webfont.eot'); 31 | src: url('../fonts/SourceCodePro-Regular-webfont.eot?#iefix') format('embedded-opentype'), 32 | url('../fonts/SourceCodePro-Regular-webfont.woff') format('woff'), 33 | url('../fonts/SourceCodePro-Regular-webfont.ttf') format('truetype'), 34 | url('../fonts/SourceCodePro-Regular-webfont.svg#fonts/SourceCodeProRegular') format('svg'); 35 | font-weight: 400; 36 | font-style: normal; 37 | 38 | } 39 | 40 | @font-face { 41 | font-family: 'Source Code Pro'; 42 | src: url('../fonts/SourceCodePro-Semibold-webfont.eot'); 43 | src: url('../fonts/SourceCodePro-Semibold-webfont.eot?#iefix') format('embedded-opentype'), 44 | url('../fonts/SourceCodePro-Semibold-webfont.woff') format('woff'), 45 | url('../fonts/SourceCodePro-Semibold-webfont.ttf') format('truetype'), 46 | url('../fonts/SourceCodePro-Semibold-webfont.svg#fonts/SourceCodeProSemibold') format('svg'); 47 | font-weight: 500; 48 | font-style: normal; 49 | 50 | } 51 | 52 | @font-face { 53 | font-family: 'Source Code Pro'; 54 | src: url('../fonts/SourceCodePro-Bold-webfont.eot'); 55 | src: url('../fonts/SourceCodePro-Bold-webfont.eot?#iefix') format('embedded-opentype'), 56 | url('../fonts/SourceCodePro-Bold-webfont.woff') format('woff'), 57 | url('../fonts/SourceCodePro-Bold-webfont.ttf') format('truetype'), 58 | url('../fonts/SourceCodePro-Bold-webfont.svg#fonts/SourceCodeProBold') format('svg'); 59 | font-weight: 700; 60 | font-style: normal; 61 | 62 | } 63 | 64 | @font-face { 65 | font-family: 'Source Code Pro'; 66 | src: url('../fonts/SourceCodePro-Black-webfont.eot'); 67 | src: url('../fonts/SourceCodePro-Black-webfont.eot?#iefix') format('embedded-opentype'), 68 | url('../fonts/SourceCodePro-Black-webfont.woff') format('woff'), 69 | url('../fonts/SourceCodePro-Black-webfont.ttf') format('truetype'), 70 | url('../fonts/SourceCodePro-Black-webfont.svg#fonts/SourceCodeProBlack') format('svg'); 71 | font-weight: 800; 72 | font-style: normal; 73 | 74 | } 75 | 76 | 77 | /* Source Sans Pro */ 78 | 79 | @font-face { 80 | font-family: 'Source Sans Pro'; 81 | src: url('../fonts/SourceSansPro-SemiboldIt-webfont.eot'); 82 | src: url('../fonts/SourceSansPro-SemiboldIt-webfont.eot?#iefix') format('embedded-opentype'), 83 | url('../fonts/SourceSansPro-SemiboldIt-webfont.woff') format('woff'), 84 | url('../fonts/SourceSansPro-SemiboldIt-webfont.ttf') format('truetype'), 85 | url('../fonts/SourceSansPro-SemiboldIt-webfont.svg#fonts/SourceSansProSemiboldItalic') format('svg'); 86 | font-weight: 600; 87 | font-style: italic; 88 | 89 | } 90 | 91 | @font-face { 92 | font-family: 'Source Sans Pro'; 93 | src: url('../fonts/SourceSansPro-Bold-webfont.eot'); 94 | src: url('../fonts/SourceSansPro-Bold-webfont.eot?#iefix') format('embedded-opentype'), 95 | url('../fonts/SourceSansPro-Bold-webfont.woff') format('woff'), 96 | url('../fonts/SourceSansPro-Bold-webfont.ttf') format('truetype'), 97 | url('../fonts/SourceSansPro-Bold-webfont.svg#fonts/SourceSansProBold') format('svg'); 98 | font-weight: 700; 99 | font-style: normal; 100 | 101 | } 102 | 103 | @font-face { 104 | font-family: 'Source Sans Pro'; 105 | src: url('../fonts/SourceSansPro-BoldIt-webfont.eot'); 106 | src: url('../fonts/SourceSansPro-BoldIt-webfont.eot?#iefix') format('embedded-opentype'), 107 | url('../fonts/SourceSansPro-BoldIt-webfont.woff') format('woff'), 108 | url('../fonts/SourceSansPro-BoldIt-webfont.ttf') format('truetype'), 109 | url('../fonts/SourceSansPro-BoldIt-webfont.svg#fonts/SourceSansProBoldItalic') format('svg'); 110 | font-weight: 700; 111 | font-style: italic; 112 | 113 | } 114 | 115 | @font-face { 116 | font-family: 'Source Sans Pro'; 117 | src: url('../fonts/SourceSansPro-Black-webfont.eot'); 118 | src: url('../fonts/SourceSansPro-Black-webfont.eot?#iefix') format('embedded-opentype'), 119 | url('../fonts/SourceSansPro-Black-webfont.woff') format('woff'), 120 | url('../fonts/SourceSansPro-Black-webfont.ttf') format('truetype'), 121 | url('../fonts/SourceSansPro-Black-webfont.svg#fonts/SourceSansProBlack') format('svg'); 122 | font-weight: 900; 123 | font-style: normal; 124 | 125 | } 126 | 127 | @font-face { 128 | font-family: 'Source Sans Pro'; 129 | src: url('../fonts/SourceSansPro-BlackIt-webfont.eot'); 130 | src: url('../fonts/SourceSansPro-BlackIt-webfont.eot?#iefix') format('embedded-opentype'), 131 | url('../fonts/SourceSansPro-BlackIt-webfont.woff') format('woff'), 132 | url('../fonts/SourceSansPro-BlackIt-webfont.ttf') format('truetype'), 133 | url('../fonts/SourceSansPro-BlackIt-webfont.svg#fonts/SourceSansProBlackItalic') format('svg'); 134 | font-weight: 900; 135 | font-style: italic; 136 | 137 | } 138 | 139 | @font-face { 140 | font-family: 'Source Sans Pro'; 141 | src: url('../fonts/SourceSansPro-ExtraLight-webfont.eot'); 142 | src: url('../fonts/SourceSansPro-ExtraLight-webfont.eot?#iefix') format('embedded-opentype'), 143 | url('../fonts/SourceSansPro-ExtraLight-webfont.woff') format('woff'), 144 | url('../fonts/SourceSansPro-ExtraLight-webfont.ttf') format('truetype'), 145 | url('../fonts/SourceSansPro-ExtraLight-webfont.svg#fonts/SourceSansProExtraLight') format('svg'); 146 | font-weight: 200; 147 | font-style: normal; 148 | 149 | } 150 | 151 | @font-face { 152 | font-family: 'Source Sans Pro'; 153 | src: url('../fonts/SourceSansPro-ExtraLightIt-webfont.eot'); 154 | src: url('../fonts/SourceSansPro-ExtraLightIt-webfont.eot?#iefix') format('embedded-opentype'), 155 | url('../fonts/SourceSansPro-ExtraLightIt-webfont.woff') format('woff'), 156 | url('../fonts/SourceSansPro-ExtraLightIt-webfont.ttf') format('truetype'), 157 | url('../fonts/SourceSansPro-ExtraLightIt-webfont.svg#fonts/SourceSansProExtraLightItalic') format('svg'); 158 | font-weight: 200; 159 | font-style: italic; 160 | 161 | } 162 | 163 | @font-face { 164 | font-family: 'Source Sans Pro'; 165 | src: url('../fonts/SourceSansPro-Light-webfont.eot'); 166 | src: url('../fonts/SourceSansPro-Light-webfont.eot?#iefix') format('embedded-opentype'), 167 | url('../fonts/SourceSansPro-Light-webfont.woff') format('woff'), 168 | url('../fonts/SourceSansPro-Light-webfont.ttf') format('truetype'), 169 | url('../fonts/SourceSansPro-Light-webfont.svg#fonts/SourceSansProLight') format('svg'); 170 | font-weight: 300; 171 | font-style: normal; 172 | 173 | } 174 | 175 | @font-face { 176 | font-family: 'Source Sans Pro'; 177 | src: url('../fonts/SourceSansPro-LightIt-webfont.eot'); 178 | src: url('../fonts/SourceSansPro-LightIt-webfont.eot?#iefix') format('embedded-opentype'), 179 | url('../fonts/SourceSansPro-LightIt-webfont.woff') format('woff'), 180 | url('../fonts/SourceSansPro-LightIt-webfont.ttf') format('truetype'), 181 | url('../fonts/SourceSansPro-LightIt-webfont.svg#fonts/SourceSansProLightItalic') format('svg'); 182 | font-weight: 300; 183 | font-style: italic; 184 | 185 | } 186 | 187 | @font-face { 188 | font-family: 'Source Sans Pro'; 189 | src: url('../fonts/SourceSansPro-Regular-webfont.eot'); 190 | src: url('../fonts/SourceSansPro-Regular-webfont.eot?#iefix') format('embedded-opentype'), 191 | url('../fonts/SourceSansPro-Regular-webfont.woff') format('woff'), 192 | url('../fonts/SourceSansPro-Regular-webfont.ttf') format('truetype'), 193 | url('../fonts/SourceSansPro-Regular-webfont.svg#fonts/SourceSansProRegular') format('svg'); 194 | font-weight: 400; 195 | font-style: normal; 196 | 197 | } 198 | 199 | @font-face { 200 | font-family: 'Source Sans Pro'; 201 | src: url('../fonts/SourceSansPro-It-webfont.eot'); 202 | src: url('../fonts/SourceSansPro-It-webfont.eot?#iefix') format('embedded-opentype'), 203 | url('../fonts/SourceSansPro-It-webfont.woff') format('woff'), 204 | url('../fonts/SourceSansPro-It-webfont.ttf') format('truetype'), 205 | url('../fonts/SourceSansPro-It-webfont.svg#fonts/SourceSansProItalic') format('svg'); 206 | font-weight: 400; 207 | font-style: italic; 208 | 209 | } 210 | 211 | @font-face { 212 | font-family: 'Source Sans Pro'; 213 | src: url('../fonts/SourceSansPro-Semibold-webfont.eot'); 214 | src: url('../fonts/SourceSansPro-Semibold-webfont.eot?#iefix') format('embedded-opentype'), 215 | url('../fonts/SourceSansPro-Semibold-webfont.woff') format('woff'), 216 | url('../fonts/SourceSansPro-Semibold-webfont.ttf') format('truetype'), 217 | url('../fonts/SourceSansPro-Semibold-webfont.svg#fonts/SourceSansProSemibold') format('svg'); 218 | font-weight: 600; 219 | font-style: normal; 220 | 221 | } 222 | 223 | /* Source Sans Pro */ 224 | @font-face { 225 | font-family: 'CosmicSansNeueMono'; 226 | src: url('../fonts/CosmicSansNeueMonoBold.otf') format('opentype'); 227 | font-weight: bold; 228 | font-style: normal; 229 | } 230 | 231 | @font-face { 232 | font-family: 'CosmicSansNeueMono'; 233 | src: url('../fonts/CosmicSansNeueMono.otf') format('opentype'); 234 | font-weight: normal; 235 | font-style: normal; 236 | } 237 | 238 | @font-face { 239 | font-family: 'CosmicSansNeueMono'; 240 | src: url('../fonts/CosmicSansNeueMono.ttf') format('truetype'); 241 | font-weight: normal; 242 | font-style: normal; 243 | } 244 | 245 | @font-face { 246 | font-family: 'CosmicSansNeueMono'; 247 | src: url('../fonts/CosmicSansNeueMonoBold.ttf') format('truetype'); 248 | font-weight: bold; 249 | font-style: normal; 250 | } 251 | -------------------------------------------------------------------------------- /_css/hl.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #F0F0F0; 10 | } 11 | 12 | pre code, 13 | pre .subst, 14 | pre .tag .title, 15 | pre .lisp .title, 16 | pre .clojure .built_in, 17 | pre .nginx .title { 18 | color: black; 19 | } 20 | 21 | pre .string, 22 | pre .title, 23 | pre .constant, 24 | pre .parent, 25 | pre .tag .value, 26 | pre .rules .value, 27 | pre .rules .value .number, 28 | pre .preprocessor, 29 | pre .haml .symbol, 30 | pre .ruby .symbol, 31 | pre .ruby .symbol .string, 32 | pre .aggregate, 33 | pre .template_tag, 34 | pre .django .variable, 35 | pre .smalltalk .class, 36 | pre .addition, 37 | pre .flow, 38 | pre .stream, 39 | pre .bash .variable, 40 | pre .apache .tag, 41 | pre .apache .cbracket, 42 | pre .tex .command, 43 | pre .tex .special, 44 | pre .erlang_repl .function_or_atom, 45 | pre .asciidoc .header, 46 | pre .markdown .header, 47 | pre .coffeescript .attribute { 48 | color: #800; 49 | } 50 | 51 | pre .smartquote, 52 | pre .comment, 53 | pre .annotation, 54 | pre .template_comment, 55 | pre .diff .header, 56 | pre .chunk, 57 | pre .asciidoc .blockquote, 58 | pre .markdown .blockquote { 59 | color: #888; 60 | } 61 | 62 | pre .number, 63 | pre .date, 64 | pre .regexp, 65 | pre .literal, 66 | pre .hexcolor, 67 | pre .smalltalk .symbol, 68 | pre .smalltalk .char, 69 | pre .go .constant, 70 | pre .change, 71 | pre .lasso .variable, 72 | pre .makefile .variable, 73 | pre .asciidoc .bullet, 74 | pre .markdown .bullet, 75 | pre .asciidoc .link_url, 76 | pre .markdown .link_url { 77 | color: #080; 78 | } 79 | 80 | pre .label, 81 | pre .javadoc, 82 | pre .ruby .string, 83 | pre .decorator, 84 | pre .filter .argument, 85 | pre .localvars, 86 | pre .array, 87 | pre .attr_selector, 88 | pre .important, 89 | pre .pseudo, 90 | pre .pi, 91 | pre .haml .bullet, 92 | pre .doctype, 93 | pre .deletion, 94 | pre .envvar, 95 | pre .shebang, 96 | pre .apache .sqbracket, 97 | pre .nginx .built_in, 98 | pre .tex .formula, 99 | pre .erlang_repl .reserved, 100 | pre .prompt, 101 | pre .asciidoc .link_label, 102 | pre .markdown .link_label, 103 | pre .vhdl .attribute, 104 | pre .clojure .attribute, 105 | pre .asciidoc .attribute, 106 | pre .lasso .attribute, 107 | pre .coffeescript .property, 108 | pre .makefile .phony { 109 | color: #88F 110 | } 111 | 112 | pre .keyword, 113 | pre .id, 114 | pre .title, 115 | pre .built_in, 116 | pre .aggregate, 117 | pre .css .tag, 118 | pre .javadoctag, 119 | pre .phpdoc, 120 | pre .yardoctag, 121 | pre .smalltalk .class, 122 | pre .winutils, 123 | pre .bash .variable, 124 | pre .apache .tag, 125 | pre .go .typename, 126 | pre .tex .command, 127 | pre .asciidoc .strong, 128 | pre .markdown .strong, 129 | pre .request, 130 | pre .status { 131 | font-weight: bold; 132 | } 133 | 134 | pre .asciidoc .emphasis, 135 | pre .markdown .emphasis { 136 | font-style: italic; 137 | } 138 | 139 | pre .nginx .built_in { 140 | font-weight: normal; 141 | } 142 | 143 | pre .coffeescript .javascript, 144 | pre .javascript .xml, 145 | pre .lasso .markup, 146 | pre .tex .formula, 147 | pre .xml .javascript, 148 | pre .xml .vbscript, 149 | pre .xml .css, 150 | pre .xml .cdata { 151 | opacity: 0.5; 152 | } 153 | -------------------------------------------------------------------------------- /_css/solarized_dark.min.css: -------------------------------------------------------------------------------- 1 | pre code{display:block;padding:.5em;background:#002b36;color:#839496}pre .comment,pre .template_comment,pre .diff .header,pre .doctype,pre .pi,pre .lisp .string,pre .javadoc{color:#586e75;font-style:italic}pre .keyword,pre .winutils,pre .method,pre .addition,pre .css .tag,pre .request,pre .status,pre .nginx .title{color:#859900}pre .number,pre .command,pre .string,pre .tag .value,pre .rules .value,pre .phpdoc,pre .tex .formula,pre .regexp,pre .hexcolor{color:#2aa198}pre .title,pre .localvars,pre .chunk,pre .decorator,pre .built_in,pre .identifier,pre .vhdl .literal,pre .id,pre .css .function{color:#268bd2}pre .attribute,pre .variable,pre .lisp .body,pre .smalltalk .number,pre .constant,pre .class .title,pre .parent,pre .haskell .type{color:#b58900}pre .preprocessor,pre .preprocessor .keyword,pre .shebang,pre .symbol,pre .symbol .string,pre .diff .change,pre .special,pre .attr_selector,pre .important,pre .subst,pre .cdata,pre .clojure .title,pre .css .pseudo{color:#cb4b16}pre .deletion{color:#dc322f}pre .tex .formula{background:#073642} -------------------------------------------------------------------------------- /_css/style.css: -------------------------------------------------------------------------------- 1 | *, *:before, *:after { 2 | box-sizing: content-box; 3 | -moz-box-sizing: content-box; 4 | -webkit-box-sizing: content-box; 5 | } 6 | 7 | .panel-body *, 8 | .panel-body *:before, 9 | .panel-body *:after { 10 | box-sizing: border-box; 11 | -moz-box-sizing: border-box; 12 | -webkit-box-sizing: border-box; 13 | } 14 | 15 | body { 16 | font-family: 'Source Sans Pro', sans-serif; 17 | } 18 | 19 | h1, h2, h3, h4, h5, h6 { 20 | font-family: 'Source Sans Pro', sans-serif; 21 | } 22 | 23 | h2, h3 { 24 | margin-top: 40px; 25 | } 26 | 27 | h1 { 28 | margin: 30px 0; 29 | } 30 | 31 | pre { 32 | padding: 0; 33 | } 34 | 35 | pre code { 36 | font-family: 'CosmicSansNeueMono', monospace; 37 | } 38 | 39 | p { 40 | margin: 18px 0 13px; 41 | } 42 | 43 | .glyphicon { 44 | top: 2px; 45 | } 46 | 47 | #wrapper { 48 | max-width: 920px; 49 | padding: 10px 20px 50px; 50 | margin: 0 auto; 51 | } 52 | 53 | #wrapper #win { 54 | z-index: 1000; 55 | position: absolute; 56 | width: 880px; 57 | top: 23px; 58 | } 59 | 60 | #wrapper #fail { 61 | z-index: 1000; 62 | position: absolute; 63 | width: 880px; 64 | top: 23px; 65 | } 66 | 67 | @media all and (min-width: 640px) { 68 | #content { 69 | /*text-align: justify;*/ 70 | } 71 | } 72 | 73 | @media all and (max-width: 640px) { 74 | body { 75 | font-size: 1.6em; 76 | } 77 | h1 { font-size: 200%; } 78 | h2 { font-size: 160%; } 79 | h3 { font-size: 120%; } 80 | h4 { font-size: 100%; } 81 | } 82 | 83 | #form { 84 | position: absolute; 85 | top: 1%; 86 | margin-left: -20px; 87 | padding: 20px; 88 | height: 88%; 89 | width: 100%; 90 | max-width: 920px; 91 | z-index: 1; 92 | } 93 | 94 | #form textarea { 95 | font-family: 'CosmicSansNeueMono', monospace; 96 | border: none; 97 | width: 100%; 98 | height: 100%; 99 | } 100 | 101 | #form textarea:focus { 102 | border: none; 103 | } 104 | 105 | .actions { 106 | position: fixed; 107 | bottom: 5px; 108 | right: 15px; 109 | /*width: 120px;*/ 110 | text-align: right; 111 | z-index: 2; 112 | visibility: hidden; 113 | opacity: 0; 114 | transition: all .5s ease; 115 | } 116 | 117 | .actions.show { 118 | opacity: 1; 119 | visibility: visible; 120 | } 121 | 122 | .actions a, .actions button { 123 | display: inline-block; 124 | width: 120px; 125 | margin-bottom: 10px; 126 | } 127 | 128 | .languages { 129 | position: fixed; 130 | bottom: 5px; 131 | left: 15px; 132 | /*width: 120px;*/ 133 | text-align: left; 134 | z-index: 2; 135 | visibility: hidden; 136 | opacity: 0; 137 | transition: all .5s ease; 138 | } 139 | 140 | .languages.show { 141 | opacity: 1; 142 | visibility: visible; 143 | } 144 | 145 | .languages.hide { 146 | opacity: 0; 147 | visibility: hidden; 148 | } 149 | 150 | .languages button { 151 | display: inline-block; 152 | margin-bottom: 10px; 153 | margin-left: 5px; 154 | } 155 | 156 | .languages a { 157 | font-weight: bold; 158 | display: inline-block; 159 | margin-bottom: 10px; 160 | } 161 | 162 | #gitarea { 163 | width: 100%; 164 | border-color: #CCC; 165 | height: 5em; 166 | color: #666; 167 | font-size: 0.7em; 168 | font-family: 'CosmicSansNeueMono', monospace; 169 | } 170 | 171 | #previous { 172 | color: #999; 173 | font-size: 65%; 174 | padding-right: 10px; 175 | } 176 | 177 | #previous:hover { 178 | text-decoration: none; 179 | color: black; 180 | } 181 | 182 | .loader-content { 183 | position: fixed; 184 | top: 0; 185 | bottom: 0; 186 | left: 0; 187 | right: 0; 188 | z-index: 2000; 189 | text-align: center; 190 | background: rgba(255, 255, 255, 0.5); 191 | padding-top: 10%; 192 | } 193 | .loader-content img { 194 | display: inline-block; 195 | vertical-align: middle; 196 | } 197 | 198 | #logo { 199 | position: relative; 200 | float: right; 201 | margin: 15px; 202 | } 203 | 204 | #logo img { 205 | width: 80px; 206 | } 207 | 208 | #logo a { 209 | opacity: 0.2; 210 | } 211 | 212 | #logo a:hover { 213 | opacity: 0.4; 214 | } 215 | -------------------------------------------------------------------------------- /_js/app.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $('#logo a').tooltip(); 3 | $('#logo a').attr('href', '#/'); 4 | $('#content').hide(); 5 | 6 | marked.setOptions({ 7 | highlight: function (code, lang) { 8 | return hljs.highlight(lang, code).value; 9 | } 10 | }); 11 | 12 | // Look for supported type of storage to use 13 | var storageType; 14 | if (Sammy.Store.isAvailable('session')) { 15 | storageType = 'session'; 16 | } else if (Sammy.Store.isAvailable('cookie')) { 17 | storageType = 'cookie'; 18 | } else { 19 | storageType = 'memory'; 20 | } 21 | 22 | var store = new Sammy.Store({name: 'storage', type: storageType}); 23 | 24 | var app = Sammy('#content', function(sam) { 25 | 26 | sam.helpers({ 27 | view: function (page) { 28 | var c = this; 29 | anchor = page.split('#')[1]; 30 | page = page.split('#')[0]; 31 | absolutePage = location.href.split('#/')[0].split('/').pop(); 32 | if (absolutePage !== "" && absolutePage !== page) { 33 | c.redirect('/#/'+ absolutePage); 34 | } 35 | if (page.substr(page.length - 3, 1) != '_') { 36 | currentLang = store.get('lang'); 37 | if (currentLang != conf.defaultLanguage) { 38 | page = page +'_'+ currentLang; 39 | } 40 | } else if (page.substr(page.length - 2) == conf.defaultLanguage) { 41 | // Indicate page specifically 42 | page = page.substr(0, page.length - 3); 43 | } 44 | store.set('page', page); 45 | 46 | var d = store.get('data-'+ page); 47 | if (d !== null) { 48 | loadMD(c, d); 49 | } else { 50 | $("#wrapper").fadeOut(150, function() { 51 | $.get('_pages/'+ page +'.md', function(data) { 52 | loadMD(c, data); 53 | }).fail(function() { 54 | var append = ''; 55 | if (store.get('lang') != conf.defaultLanguage) { 56 | append = '_'+ store.get('lang'); 57 | } 58 | $.get('_pages/default'+ append +'.md', function(data) { 59 | loadMD(c, data); 60 | }); 61 | }); 62 | }); 63 | } 64 | }, 65 | viewPage: function(page) { 66 | var c = this; 67 | c.view(page); 68 | // Get current page 69 | page = store.get('page') 70 | title = page +' • '+ conf.siteName; 71 | $('#sendModal').modal('hide'); 72 | $('.actions').children().hide(); 73 | $('#form').hide(); 74 | $('#edit').attr('href', '#/'+ page +'/edit').fadeIn('fast'); 75 | $('#content').fadeIn('fast'); 76 | 77 | defaultLanguage = conf.defaultLanguage; 78 | languages = conf.languages; 79 | var href = '#/'+ page; 80 | if (href.substr(href.length - 3, 1) == '_') { 81 | href = href.substr(0, href.length - 3); 82 | } 83 | $(".languages ul.dropdown-menu").html(''); 84 | $.each( languages, function( key, val ) { 85 | $(".languages ul.dropdown-menu").append('
  • '+ val +'
  • '); 86 | }); 87 | $(".languages").removeClass('hide').fadeIn('fast'); 88 | } 89 | }); 90 | 91 | sam.get('#/', function (c) { 92 | absolutePage = location.href.split('#/')[0].split('/').pop(); 93 | if (absolutePage !== "") { 94 | c.redirect('/#/'+ absolutePage); 95 | } else { 96 | c.viewPage('index'); 97 | } 98 | }); 99 | 100 | sam.get('#/:name', function (c) { 101 | c.viewPage(c.params['name']); 102 | }); 103 | 104 | sam.get('#/:name/edit', function (c) { 105 | c.view(c.params['name']); 106 | document.title = 'Edit '+ c.params['name']; 107 | $('#sendModal').modal('hide'); 108 | $('.actions').children().hide(); 109 | $('.languages').addClass('hide'); 110 | $('#content').hide(); 111 | $('#preview').attr('href', '#/'+ c.params['name'] +'/preview').fadeIn('fast'); 112 | $('#back').attr('href', '#/'+ c.params['name']).fadeIn('fast'); 113 | $('#send').fadeIn('fast'); 114 | $('#form').fadeIn('fast'); 115 | $('#sendModal form').attr('action', '#/'+ c.params['name'] +'/save'); 116 | }); 117 | 118 | sam.get('#/:name/preview', function (c) { 119 | c.view(c.params['name']); 120 | document.title = 'Preview '+ c.params['name']; 121 | $('#sendModal').modal('hide'); 122 | $('.actions').children().hide(); 123 | $('.languages').addClass('hide'); 124 | $('#form').hide(); 125 | $('#edit').attr('href', '#/'+ c.params['name'] +'/edit').fadeIn('fast'); 126 | $('#back').attr('href', '#/'+ c.params['name']).fadeIn('fast'); 127 | $('#send').fadeIn('fast'); 128 | $('#content').fadeIn('fast'); 129 | $('#sendModal form').attr('action', '#/'+ c.params['name'] +'/save'); 130 | }); 131 | 132 | }); 133 | 134 | function sendModifications(page) { 135 | auth = "Basic "+ btoa($('#user').val() +':'+ $('#password').val()); 136 | $('#reallysend').after(' '); 137 | $.ajax({ 138 | url: 'save.php', 139 | type: 'POST', 140 | data: { 'page': page, 'content': store.get('data-'+ page) }, 141 | beforeSend: function(req) { 142 | req.setRequestHeader('Authorization', auth); 143 | } 144 | }) 145 | .success(function(data) { 146 | $('#sendModal').modal('hide'); 147 | $('.ajax-loader').remove(); 148 | $('#win').fadeIn('fast', function() { 149 | setTimeout(function() { 150 | $('#win').fadeOut(); 151 | }, 3000); 152 | }); 153 | return true; 154 | }) 155 | .fail(function(xhr) { 156 | $('.ajax-loader').remove(); 157 | if (xhr.status == 401) { 158 | $('#sendModal alert p').html('Wrong username/password combination'); 159 | } else { 160 | $('#sendModal').modal('hide'); 161 | $('#fail').fadeIn('fast', function() { 162 | setTimeout(function() { 163 | $('#fail').fadeOut(); 164 | }, 3000); 165 | }); 166 | return false; 167 | } 168 | }); 169 | } 170 | 171 | function loadMD(c, data) { 172 | html = marked(data); 173 | $('#form textarea').val(data); 174 | $('#content').html(''); 175 | c.swap(html, function() { 176 | if ($("h1").length > 0) { 177 | title = $("h1:first").text(); 178 | // Add return button before page title 179 | if (!store.get('page').match(/^index/g)) { 180 | $("h1:first").prepend(''); 181 | } 182 | } 183 | $('table').addClass('table').addClass('table-bordered'); 184 | document.title = title +' • '+ conf.siteName; 185 | 186 | // Rewrite links 187 | $('#content a').each(function () { 188 | if ($(this).attr('href').match(/^\/?[a-zA-Z0-9_\-]*$/g)) { 189 | $(this).attr('href', '/#/'+ $(this).attr('href').replace(/^\//g, '')); 190 | } 191 | }); 192 | 193 | // Scroll to anchor 194 | if (typeof anchor !== 'undefined' && $('#'+ anchor).length > 0) { 195 | $('html, body').animate({ 196 | 'scrollTop': $('#'+ anchor).offset().top - 10 197 | }, 500); 198 | } else { 199 | $(window).scrollTop(0); 200 | } 201 | $("#wrapper").show(); 202 | 203 | }); 204 | } 205 | 206 | function changeLanguage(lang) { 207 | $('[data-i18n]').each( function() { 208 | key = $( this ).attr('data-i18n'); 209 | $( this ).html(i18n[lang][key]); 210 | }); 211 | store.set('lang', lang); 212 | } 213 | 214 | $(document).keyup(function(e) { 215 | if (e.keyCode == 27) { 216 | page = store.get('page'); 217 | store.set('data-'+ page, $('#form textarea').val()); 218 | href = document.location.href; 219 | if (href.substr(href.length - 5) == '/edit') { 220 | document.location.href = '#/'+ page +'/preview'; 221 | } else { 222 | document.location.href = '#/'+ page +'/edit'; 223 | } 224 | } else if (e.keyCode == 13 && $('#sendModal input.form-control:focus').length > 0) { 225 | $('#reallysend').trigger('click'); 226 | } 227 | }); 228 | 229 | $('#back').on('click', function() { 230 | store.set('data-'+ store.get('page'), null); 231 | }); 232 | $('#preview').on('click', function() { 233 | store.set('data-'+ store.get('page'), $('#form textarea').val()); 234 | }); 235 | $('#send').on('click', function() { 236 | store.set('data-'+ store.get('page'), $('#form textarea').val()); 237 | $("#filename").text(store.get('page') +'.md'); 238 | $("#repogit").text(conf.gitRepository).attr('href', conf.gitRepository); 239 | $("#gitarea").val($('#form textarea').val()); 240 | }); 241 | $('#reallysend').on('click', function() { 242 | page = store.get('page'); 243 | if (sendModifications(page)) { 244 | document.location.href = '#/'+ page; 245 | } 246 | }); 247 | 248 | $('#sendMail').on('click', function() { 249 | var w = window.open('', '', 'width=600,height=400,resizeable,scrollbars'); 250 | w.document.write(''+ i18n[store.get('lang')].to + ': '+ conf.requestEmail +'
    ' 251 | + ''+ i18n[store.get('lang')].subject + ': [' + conf.siteName +" Doc Request] "+ escape(store.get('page')) + '.md
    ' 252 | +''+ i18n[store.get('lang')].body + ':
    ' + $('#form textarea').val() +'
    '); 253 | w.document.close(); 254 | }); 255 | 256 | $('ul.dropdown-menu').on('click', '.change-language', function() { 257 | changeLanguage($( this ).attr('data-lang')); 258 | $('.dropdown-toggle').dropdown('toggle'); 259 | }); 260 | 261 | $('#gitarea').focus(function() { 262 | $(this).select(); 263 | }); 264 | 265 | var timer; 266 | 267 | $(window).mousemove(function () { 268 | $('.actions').addClass('show'); 269 | $('.languages').addClass('show'); 270 | try { 271 | clearTimeout(timer); 272 | } catch (e) {} 273 | timer = setTimeout(function () { 274 | $('.actions').removeClass('show'); 275 | $('.languages').removeClass('show'); 276 | }, 1000); 277 | }); 278 | 279 | $.getJSON('i18n.json', function(lng) { 280 | i18n = lng; 281 | $.getJSON('config.json', function(data) { 282 | conf = data; 283 | if (store.get('lang') !== null) { 284 | changeLanguage(store.get('lang')); 285 | } else { 286 | language = window.navigator.language.substr(0, 2); 287 | if (typeof i18n[language] !== 'undefined') { 288 | changeLanguage(language); 289 | } else { 290 | changeLanguage(conf.defaultLanguage); 291 | } 292 | } 293 | if (location.href.split('#').length > 1 && !location.href.match(/\/#\//g)) { 294 | window.location.replace(location.href.split('#')[0]); 295 | } else { 296 | app.run('#/'); 297 | } 298 | }); 299 | }); 300 | }); 301 | -------------------------------------------------------------------------------- /_js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.2 by @fat and @mdo 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | * 6 | * Designed and built with all the love in the world by @mdo and @fat. 7 | */ 8 | 9 | if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); -------------------------------------------------------------------------------- /_js/highlight.js: -------------------------------------------------------------------------------- 1 | /* 2 | Syntax highlighting with language autodetection. 3 | http://highlightjs.org/ 4 | */ 5 | 6 | function() { 7 | 8 | /* Utility functions */ 9 | 10 | function escape(value) { 11 | return value.replace(/&/gm, '&').replace(//gm, '>'); 12 | } 13 | 14 | function findCode(pre) { 15 | for (var node = pre.firstChild; node; node = node.nextSibling) { 16 | if (node.nodeName.toUpperCase () == 'CODE') 17 | return node; 18 | if (!(node.nodeType == 3 && node.nodeValue.match(/\s+/))) 19 | break; 20 | } 21 | } 22 | 23 | function blockText(block, ignoreNewLines) { 24 | return Array.prototype.map.call(block.childNodes, function(node) { 25 | if (node.nodeType == 3) { 26 | return ignoreNewLines ? node.nodeValue.replace(/\n/g, '') : node.nodeValue; 27 | } 28 | if (node.nodeName.toUpperCase () == 'BR') { 29 | return '\n'; 30 | } 31 | return blockText(node, ignoreNewLines); 32 | }).join(''); 33 | } 34 | 35 | function blockLanguage(block) { 36 | var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/); 37 | classes = classes.map(function(c) {return c.replace(/^language-/, '');}); 38 | for (var i = 0; i < classes.length; i++) { 39 | if (languages[classes[i]] || classes[i] == 'no-highlight') { 40 | return classes[i]; 41 | } 42 | } 43 | } 44 | 45 | /* Stream merging */ 46 | 47 | function nodeStream(node) { 48 | var result = []; 49 | (function _nodeStream(node, offset) { 50 | for (var child = node.firstChild; child; child = child.nextSibling) { 51 | if (child.nodeType == 3) 52 | offset += child.nodeValue.length; 53 | else if (child.nodeName.toUpperCase() == 'BR') 54 | offset += 1; 55 | else if (child.nodeType == 1) { 56 | result.push({ 57 | event: 'start', 58 | offset: offset, 59 | node: child 60 | }); 61 | offset = _nodeStream(child, offset); 62 | result.push({ 63 | event: 'stop', 64 | offset: offset, 65 | node: child 66 | }); 67 | } 68 | } 69 | return offset; 70 | })(node, 0); 71 | return result; 72 | } 73 | 74 | function mergeStreams(stream1, stream2, value) { 75 | var processed = 0; 76 | var result = ''; 77 | var nodeStack = []; 78 | 79 | function selectStream() { 80 | if (stream1.length && stream2.length) { 81 | if (stream1[0].offset != stream2[0].offset) 82 | return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2; 83 | else { 84 | /* 85 | To avoid starting the stream just before it should stop the order is 86 | ensured that stream1 always starts first and closes last: 87 | 88 | if (event1 == 'start' && event2 == 'start') 89 | return stream1; 90 | if (event1 == 'start' && event2 == 'stop') 91 | return stream2; 92 | if (event1 == 'stop' && event2 == 'start') 93 | return stream1; 94 | if (event1 == 'stop' && event2 == 'stop') 95 | return stream2; 96 | 97 | ... which is collapsed to: 98 | */ 99 | return stream2[0].event == 'start' ? stream1 : stream2; 100 | } 101 | } else { 102 | return stream1.length ? stream1 : stream2; 103 | } 104 | } 105 | 106 | function open(node) { 107 | function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} 108 | return '<' + node.nodeName + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; 109 | } 110 | 111 | while (stream1.length || stream2.length) { 112 | var current = selectStream().splice(0, 1)[0]; 113 | result += escape(value.substr(processed, current.offset - processed)); 114 | processed = current.offset; 115 | if ( current.event == 'start') { 116 | result += open(current.node); 117 | nodeStack.push(current.node); 118 | } else if (current.event == 'stop') { 119 | var node, i = nodeStack.length; 120 | do { 121 | i--; 122 | node = nodeStack[i]; 123 | result += (''); 124 | } while (node != current.node); 125 | nodeStack.splice(i, 1); 126 | while (i < nodeStack.length) { 127 | result += open(nodeStack[i]); 128 | i++; 129 | } 130 | } 131 | } 132 | return result + escape(value.substr(processed)); 133 | } 134 | 135 | /* Initialization */ 136 | 137 | function compileLanguage(language) { 138 | 139 | function reStr(re) { 140 | return (re && re.source) || re; 141 | } 142 | 143 | function langRe(value, global) { 144 | return RegExp( 145 | reStr(value), 146 | 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') 147 | ); 148 | } 149 | 150 | function compileMode(mode, parent) { 151 | if (mode.compiled) 152 | return; 153 | mode.compiled = true; 154 | 155 | var keywords = []; // used later with beginWithKeyword but filled as a side-effect of keywords compilation 156 | if (mode.keywords) { 157 | var compiled_keywords = {}; 158 | 159 | function flatten(className, str) { 160 | if (language.case_insensitive) { 161 | str = str.toLowerCase(); 162 | } 163 | str.split(' ').forEach(function(kw) { 164 | var pair = kw.split('|'); 165 | compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; 166 | keywords.push(pair[0]); 167 | }); 168 | } 169 | 170 | mode.lexemsRe = langRe(mode.lexems || '\\b' + hljs.IDENT_RE + '\\b(?!\\.)', true); 171 | if (typeof mode.keywords == 'string') { // string 172 | flatten('keyword', mode.keywords); 173 | } else { 174 | for (var className in mode.keywords) { 175 | if (!mode.keywords.hasOwnProperty(className)) 176 | continue; 177 | flatten(className, mode.keywords[className]); 178 | } 179 | } 180 | mode.keywords = compiled_keywords; 181 | } 182 | if (parent) { 183 | if (mode.beginWithKeyword) { 184 | mode.begin = '\\b(' + keywords.join('|') + ')\\b(?!\\.)\\s*'; 185 | } 186 | mode.beginRe = langRe(mode.begin ? mode.begin : '\\B|\\b'); 187 | if (!mode.end && !mode.endsWithParent) 188 | mode.end = '\\B|\\b'; 189 | if (mode.end) 190 | mode.endRe = langRe(mode.end); 191 | mode.terminator_end = reStr(mode.end) || ''; 192 | if (mode.endsWithParent && parent.terminator_end) 193 | mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; 194 | } 195 | if (mode.illegal) 196 | mode.illegalRe = langRe(mode.illegal); 197 | if (mode.relevance === undefined) 198 | mode.relevance = 1; 199 | if (!mode.contains) { 200 | mode.contains = []; 201 | } 202 | for (var i = 0; i < mode.contains.length; i++) { 203 | if (mode.contains[i] == 'self') { 204 | mode.contains[i] = mode; 205 | } 206 | compileMode(mode.contains[i], mode); 207 | } 208 | if (mode.starts) { 209 | compileMode(mode.starts, parent); 210 | } 211 | 212 | var terminators = []; 213 | for (var i = 0; i < mode.contains.length; i++) { 214 | terminators.push(reStr(mode.contains[i].begin)); 215 | } 216 | if (mode.terminator_end) { 217 | terminators.push(reStr(mode.terminator_end)); 218 | } 219 | if (mode.illegal) { 220 | terminators.push(reStr(mode.illegal)); 221 | } 222 | mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}}; 223 | } 224 | 225 | compileMode(language); 226 | } 227 | 228 | /* 229 | Core highlighting function. Accepts a language name and a string with the 230 | code to highlight. Returns an object with the following properties: 231 | 232 | - relevance (int) 233 | - keyword_count (int) 234 | - value (an HTML string with highlighting markup) 235 | 236 | */ 237 | function highlight(language_name, value, ignore_illegals, continuation) { 238 | 239 | function subMode(lexem, mode) { 240 | for (var i = 0; i < mode.contains.length; i++) { 241 | var match = mode.contains[i].beginRe.exec(lexem); 242 | if (match && match.index == 0) { 243 | return mode.contains[i]; 244 | } 245 | } 246 | } 247 | 248 | function endOfMode(mode, lexem) { 249 | if (mode.end && mode.endRe.test(lexem)) { 250 | return mode; 251 | } 252 | if (mode.endsWithParent) { 253 | return endOfMode(mode.parent, lexem); 254 | } 255 | } 256 | 257 | function isIllegal(lexem, mode) { 258 | return !ignore_illegals && mode.illegal && mode.illegalRe.test(lexem); 259 | } 260 | 261 | function keywordMatch(mode, match) { 262 | var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; 263 | return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; 264 | } 265 | 266 | function processKeywords() { 267 | var buffer = escape(mode_buffer); 268 | if (!top.keywords) 269 | return buffer; 270 | var result = ''; 271 | var last_index = 0; 272 | top.lexemsRe.lastIndex = 0; 273 | var match = top.lexemsRe.exec(buffer); 274 | while (match) { 275 | result += buffer.substr(last_index, match.index - last_index); 276 | var keyword_match = keywordMatch(top, match); 277 | if (keyword_match) { 278 | keyword_count += keyword_match[1]; 279 | result += '' + match[0] + ''; 280 | } else { 281 | result += match[0]; 282 | } 283 | last_index = top.lexemsRe.lastIndex; 284 | match = top.lexemsRe.exec(buffer); 285 | } 286 | return result + buffer.substr(last_index); 287 | } 288 | 289 | function processSubLanguage() { 290 | if (top.subLanguage && !languages[top.subLanguage]) { 291 | return escape(mode_buffer); 292 | } 293 | var continuation = top.subLanguageMode == 'continuous' ? top.top : undefined; 294 | var result = top.subLanguage ? highlight(top.subLanguage, mode_buffer, true, continuation) : highlightAuto(mode_buffer); 295 | // Counting embedded language score towards the host language may be disabled 296 | // with zeroing the containing mode relevance. Usecase in point is Markdown that 297 | // allows XML everywhere and makes every XML snippet to have a much larger Markdown 298 | // score. 299 | if (top.relevance > 0) { 300 | keyword_count += result.keyword_count; 301 | relevance += result.relevance; 302 | } 303 | top.top = result.top; 304 | return '' + result.value + ''; 305 | } 306 | 307 | function processBuffer() { 308 | return top.subLanguage !== undefined ? processSubLanguage() : processKeywords(); 309 | } 310 | 311 | function startNewMode(mode, lexem) { 312 | var markup = mode.className? '': ''; 313 | if (mode.returnBegin) { 314 | result += markup; 315 | mode_buffer = ''; 316 | } else if (mode.excludeBegin) { 317 | result += escape(lexem) + markup; 318 | mode_buffer = ''; 319 | } else { 320 | result += markup; 321 | mode_buffer = lexem; 322 | } 323 | top = Object.create(mode, {parent: {value: top}}); 324 | } 325 | 326 | function processLexem(buffer, lexem) { 327 | mode_buffer += buffer; 328 | if (lexem === undefined) { 329 | result += processBuffer(); 330 | return 0; 331 | } 332 | 333 | var new_mode = subMode(lexem, top); 334 | if (new_mode) { 335 | result += processBuffer(); 336 | startNewMode(new_mode, lexem); 337 | return new_mode.returnBegin ? 0 : lexem.length; 338 | } 339 | 340 | var end_mode = endOfMode(top, lexem); 341 | if (end_mode) { 342 | var origin = top; 343 | if (!(origin.returnEnd || origin.excludeEnd)) { 344 | mode_buffer += lexem; 345 | } 346 | result += processBuffer(); 347 | do { 348 | if (top.className) { 349 | result += ''; 350 | } 351 | relevance += top.relevance; 352 | top = top.parent; 353 | } while (top != end_mode.parent); 354 | if (origin.excludeEnd) { 355 | result += escape(lexem); 356 | } 357 | mode_buffer = ''; 358 | if (end_mode.starts) { 359 | startNewMode(end_mode.starts, ''); 360 | } 361 | return origin.returnEnd ? 0 : lexem.length; 362 | } 363 | 364 | if (isIllegal(lexem, top)) 365 | throw new Error('Illegal lexem "' + lexem + '" for mode "' + (top.className || '') + '"'); 366 | 367 | /* 368 | Parser should not reach this point as all types of lexems should be caught 369 | earlier, but if it does due to some bug make sure it advances at least one 370 | character forward to prevent infinite looping. 371 | */ 372 | mode_buffer += lexem; 373 | return lexem.length || 1; 374 | } 375 | 376 | var language = languages[language_name]; 377 | if (!language) { 378 | throw new Error('Unknown language: "' + language_name + '"'); 379 | } 380 | 381 | compileLanguage(language); 382 | var top = continuation || language; 383 | var result = ''; 384 | for(var current = top; current != language; current = current.parent) { 385 | if (current.className) { 386 | result = '' + result; 387 | } 388 | } 389 | var mode_buffer = ''; 390 | var relevance = 0; 391 | var keyword_count = 0; 392 | try { 393 | var match, count, index = 0; 394 | while (true) { 395 | top.terminators.lastIndex = index; 396 | match = top.terminators.exec(value); 397 | if (!match) 398 | break; 399 | count = processLexem(value.substr(index, match.index - index), match[0]); 400 | index = match.index + count; 401 | } 402 | processLexem(value.substr(index)); 403 | for(var current = top; current.parent; current = current.parent) { // close dangling modes 404 | if (current.className) { 405 | result += ''; 406 | } 407 | }; 408 | return { 409 | relevance: relevance, 410 | keyword_count: keyword_count, 411 | value: result, 412 | language: language_name, 413 | top: top 414 | }; 415 | } catch (e) { 416 | if (e.message.indexOf('Illegal') != -1) { 417 | return { 418 | relevance: 0, 419 | keyword_count: 0, 420 | value: escape(value) 421 | }; 422 | } else { 423 | throw e; 424 | } 425 | } 426 | } 427 | 428 | /* 429 | Highlighting with language detection. Accepts a string with the code to 430 | highlight. Returns an object with the following properties: 431 | 432 | - language (detected language) 433 | - relevance (int) 434 | - keyword_count (int) 435 | - value (an HTML string with highlighting markup) 436 | - second_best (object with the same structure for second-best heuristically 437 | detected language, may be absent) 438 | 439 | */ 440 | function highlightAuto(text) { 441 | var result = { 442 | keyword_count: 0, 443 | relevance: 0, 444 | value: escape(text) 445 | }; 446 | var second_best = result; 447 | for (var key in languages) { 448 | if (!languages.hasOwnProperty(key)) 449 | continue; 450 | var current = highlight(key, text, false); 451 | current.language = key; 452 | if (current.keyword_count + current.relevance > second_best.keyword_count + second_best.relevance) { 453 | second_best = current; 454 | } 455 | if (current.keyword_count + current.relevance > result.keyword_count + result.relevance) { 456 | second_best = result; 457 | result = current; 458 | } 459 | } 460 | if (second_best.language) { 461 | result.second_best = second_best; 462 | } 463 | return result; 464 | } 465 | 466 | /* 467 | Post-processing of the highlighted markup: 468 | 469 | - replace TABs with something more useful 470 | - replace real line-breaks with '
    ' for non-pre containers 471 | 472 | */ 473 | function fixMarkup(value, tabReplace, useBR) { 474 | if (tabReplace) { 475 | value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) { 476 | return p1.replace(/\t/g, tabReplace); 477 | }); 478 | } 479 | if (useBR) { 480 | value = value.replace(/\n/g, '
    '); 481 | } 482 | return value; 483 | } 484 | 485 | /* 486 | Applies highlighting to a DOM node containing code. Accepts a DOM node and 487 | two optional parameters for fixMarkup. 488 | */ 489 | function highlightBlock(block, tabReplace, useBR) { 490 | var text = blockText(block, useBR); 491 | var language = blockLanguage(block); 492 | if (language == 'no-highlight') 493 | return; 494 | var result = language ? highlight(language, text, true) : highlightAuto(text); 495 | language = result.language; 496 | var original = nodeStream(block); 497 | if (original.length) { 498 | var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'); 499 | pre.innerHTML = result.value; 500 | result.value = mergeStreams(original, nodeStream(pre), text); 501 | } 502 | result.value = fixMarkup(result.value, tabReplace, useBR); 503 | 504 | var class_name = block.className; 505 | if (!class_name.match('(\\s|^)(language-)?' + language + '(\\s|$)')) { 506 | class_name = class_name ? (class_name + ' ' + language) : language; 507 | } 508 | block.innerHTML = result.value; 509 | block.className = class_name; 510 | block.result = { 511 | language: language, 512 | kw: result.keyword_count, 513 | re: result.relevance 514 | }; 515 | if (result.second_best) { 516 | block.second_best = { 517 | language: result.second_best.language, 518 | kw: result.second_best.keyword_count, 519 | re: result.second_best.relevance 520 | }; 521 | } 522 | } 523 | 524 | /* 525 | Applies highlighting to all
    ..
    blocks on a page. 526 | */ 527 | function initHighlighting() { 528 | if (initHighlighting.called) 529 | return; 530 | initHighlighting.called = true; 531 | Array.prototype.map.call(document.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'pre'), findCode). 532 | filter(Boolean). 533 | forEach(function(code){highlightBlock(code, hljs.tabReplace);}); 534 | } 535 | 536 | /* 537 | Attaches highlighting to the page load event. 538 | */ 539 | function initHighlightingOnLoad() { 540 | window.addEventListener('DOMContentLoaded', initHighlighting, false); 541 | window.addEventListener('load', initHighlighting, false); 542 | } 543 | 544 | var languages = {}; // a shortcut to avoid writing "this." everywhere 545 | 546 | /* Interface definition */ 547 | 548 | this.LANGUAGES = languages; 549 | this.highlight = highlight; 550 | this.highlightAuto = highlightAuto; 551 | this.fixMarkup = fixMarkup; 552 | this.highlightBlock = highlightBlock; 553 | this.initHighlighting = initHighlighting; 554 | this.initHighlightingOnLoad = initHighlightingOnLoad; 555 | 556 | // Common regexps 557 | this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*'; 558 | this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*'; 559 | this.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; 560 | this.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float 561 | this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... 562 | this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; 563 | 564 | // Common modes 565 | this.BACKSLASH_ESCAPE = { 566 | begin: '\\\\[\\s\\S]', relevance: 0 567 | }; 568 | this.APOS_STRING_MODE = { 569 | className: 'string', 570 | begin: '\'', end: '\'', 571 | illegal: '\\n', 572 | contains: [this.BACKSLASH_ESCAPE], 573 | relevance: 0 574 | }; 575 | this.QUOTE_STRING_MODE = { 576 | className: 'string', 577 | begin: '"', end: '"', 578 | illegal: '\\n', 579 | contains: [this.BACKSLASH_ESCAPE], 580 | relevance: 0 581 | }; 582 | this.C_LINE_COMMENT_MODE = { 583 | className: 'comment', 584 | begin: '//', end: '$' 585 | }; 586 | this.C_BLOCK_COMMENT_MODE = { 587 | className: 'comment', 588 | begin: '/\\*', end: '\\*/' 589 | }; 590 | this.HASH_COMMENT_MODE = { 591 | className: 'comment', 592 | begin: '#', end: '$' 593 | }; 594 | this.NUMBER_MODE = { 595 | className: 'number', 596 | begin: this.NUMBER_RE, 597 | relevance: 0 598 | }; 599 | this.C_NUMBER_MODE = { 600 | className: 'number', 601 | begin: this.C_NUMBER_RE, 602 | relevance: 0 603 | }; 604 | this.BINARY_NUMBER_MODE = { 605 | className: 'number', 606 | begin: this.BINARY_NUMBER_RE, 607 | relevance: 0 608 | }; 609 | this.REGEXP_MODE = { 610 | className: 'regexp', 611 | begin: /\//, end: /\/[gim]*/, 612 | illegal: /\n/, 613 | contains: [ 614 | this.BACKSLASH_ESCAPE, 615 | { 616 | begin: /\[/, end: /\]/, 617 | relevance: 0, 618 | contains: [this.BACKSLASH_ESCAPE] 619 | } 620 | ] 621 | }; 622 | 623 | // Utility functions 624 | this.inherit = function(parent, obj) { 625 | var result = {}; 626 | for (var key in parent) 627 | result[key] = parent[key]; 628 | if (obj) 629 | for (var key in obj) 630 | result[key] = obj[key]; 631 | return result; 632 | }; 633 | } 634 | -------------------------------------------------------------------------------- /_js/highlight.min.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+(q.parentNode?q.parentNode.className:"")).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("")}while(o!=u.node);r.splice(q,1);while(q'+M[0]+""}else{r+=M[0]}O=A.lR.lastIndex;M=A.lR.exec(L)}return r+L.substr(O)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function K(){return A.sL!==undefined?z():H()}function J(M,r){var L=M.cN?'':"";if(M.rB){x+=L;w=""}else{if(M.eB){x+=l(r)+L;w=""}else{x+=L;w=r}}A=Object.create(M,{parent:{value:A}})}function D(L,r){w+=L;if(r===undefined){x+=K();return 0}var N=o(r,A);if(N){x+=K();J(N,r);return N.rB?0:r.length}var O=s(A,r);if(O){var M=A;if(!(M.rE||M.eE)){w+=r}x+=K();do{if(A.cN){x+=""}B+=A.r;A=A.parent}while(A!=O.parent);if(M.eE){x+=l(r)}w="";if(O.starts){J(O.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw new Error('Illegal lexem "'+r+'" for mode "'+(A.cN||"")+'"')}w+=r;return r.length||1}var G=e[E];f(G);var A=G;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(F);if(!u){break}q=D(F.substr(p,u.index-p),u[0]);p=u.index+q}D(F.substr(p));return{r:B,keyword_count:v,value:x,language:E}}catch(I){if(I.message.indexOf("Illegal")!=-1){return{r:0,keyword_count:0,value:l(F)}}else{throw I}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s,false);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
    ")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v,true):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.bash=function(a){var c={cN:"variable",b:/\$[\w\d#@][\w\d_]*/};var b={cN:"variable",b:/\$\{(.*?)\}/};var e={cN:"string",b:/"/,e:/"/,c:[a.BE,c,b,{cN:"variable",b:/\$\(/,e:/\)/,c:a.BE}],r:0};var d={cN:"string",b:/'/,e:/'/,r:0};return{l:/-?[a-z]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[{cN:"title",b:/\w[\w\d_]*/}],r:0},a.HCM,a.NM,e,d,c,b]}}(hljs);hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|"},{cN:"xmlDocTag",b:""}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/;/,sL:"xml"}],r:0},{cN:"function",bWK:true,e:/{/,k:"function",c:[{cN:"title",b:/[A-Za-z$_][0-9A-Za-z$_]*/},{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/}]}}(hljs);hljs.LANGUAGES.css=function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.NM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,r:0,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",r:0,c:[{cN:"title",b:"[^ /><]+"},b]}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",eE:true,i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var c=[{cN:"string",b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{cN:"string",b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{cN:"string",b:/(u|r|ur)'/,e:/'/,c:[a.BE],r:10},{cN:"string",b:/(u|r|ur)"/,e:/"/,c:[a.BE],r:10},{cN:"string",b:/(b|br)'/,e:/'/,c:[a.BE]},{cN:"string",b:/(b|br)"/,e:/"/,c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:/\(/,e:/\)/,c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:/:/,i:/[${=;\n]/,c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}])}}(hljs);hljs.LANGUAGES.sql=function(a){return{cI:true,c:[{cN:"operator",b:"(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number trigger if before after each row",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}}(hljs);hljs.LANGUAGES.ini=function(a){return{cI:true,i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10,c:["self"]}]}}(hljs); -------------------------------------------------------------------------------- /_js/marked.js: -------------------------------------------------------------------------------- 1 | /** 2 | * marked - a markdown parser 3 | * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed) 4 | * https://github.com/chjj/marked 5 | */ 6 | 7 | ;(function() { 8 | 9 | /** 10 | * Block-Level Grammar 11 | */ 12 | 13 | var block = { 14 | newline: /^\n+/, 15 | code: /^( {4}[^\n]+\n*)+/, 16 | fences: noop, 17 | hr: /^( *[-*_]){3,} *(?:\n+|$)/, 18 | heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, 19 | nptable: noop, 20 | lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, 21 | blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/, 22 | list: /^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, 23 | html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, 24 | def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, 25 | table: noop, 26 | paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, 27 | text: /^[^\n]+/ 28 | }; 29 | 30 | block.bullet = /(?:[*+-]|\d+\.)/; 31 | block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; 32 | block.item = replace(block.item, 'gm') 33 | (/bull/g, block.bullet) 34 | (); 35 | 36 | block.list = replace(block.list) 37 | (/bull/g, block.bullet) 38 | ('hr', /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/) 39 | (); 40 | 41 | block._tag = '(?!(?:' 42 | + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' 43 | + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' 44 | + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b'; 45 | 46 | block.html = replace(block.html) 47 | ('comment', //) 48 | ('closed', /<(tag)[\s\S]+?<\/\1>/) 49 | ('closing', /])*?>/) 50 | (/tag/g, block._tag) 51 | (); 52 | 53 | block.paragraph = replace(block.paragraph) 54 | ('hr', block.hr) 55 | ('heading', block.heading) 56 | ('lheading', block.lheading) 57 | ('blockquote', block.blockquote) 58 | ('tag', '<' + block._tag) 59 | ('def', block.def) 60 | (); 61 | 62 | /** 63 | * Normal Block Grammar 64 | */ 65 | 66 | block.normal = merge({}, block); 67 | 68 | /** 69 | * GFM Block Grammar 70 | */ 71 | 72 | block.gfm = merge({}, block.normal, { 73 | fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/, 74 | paragraph: /^/ 75 | }); 76 | 77 | block.gfm.paragraph = replace(block.paragraph) 78 | ('(?!', '(?!' 79 | + block.gfm.fences.source.replace('\\1', '\\2') + '|' 80 | + block.list.source.replace('\\1', '\\3') + '|') 81 | (); 82 | 83 | /** 84 | * GFM + Tables Block Grammar 85 | */ 86 | 87 | block.tables = merge({}, block.gfm, { 88 | nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, 89 | table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ 90 | }); 91 | 92 | /** 93 | * Block Lexer 94 | */ 95 | 96 | function Lexer(options) { 97 | this.tokens = []; 98 | this.tokens.links = {}; 99 | this.options = options || marked.defaults; 100 | this.rules = block.normal; 101 | 102 | if (this.options.gfm) { 103 | if (this.options.tables) { 104 | this.rules = block.tables; 105 | } else { 106 | this.rules = block.gfm; 107 | } 108 | } 109 | } 110 | 111 | /** 112 | * Expose Block Rules 113 | */ 114 | 115 | Lexer.rules = block; 116 | 117 | /** 118 | * Static Lex Method 119 | */ 120 | 121 | Lexer.lex = function(src, options) { 122 | var lexer = new Lexer(options); 123 | return lexer.lex(src); 124 | }; 125 | 126 | /** 127 | * Preprocessing 128 | */ 129 | 130 | Lexer.prototype.lex = function(src) { 131 | src = src 132 | .replace(/\r\n|\r/g, '\n') 133 | .replace(/\t/g, ' ') 134 | .replace(/\u00a0/g, ' ') 135 | .replace(/\u2424/g, '\n'); 136 | 137 | return this.token(src, true); 138 | }; 139 | 140 | /** 141 | * Lexing 142 | */ 143 | 144 | Lexer.prototype.token = function(src, top) { 145 | var src = src.replace(/^ +$/gm, '') 146 | , next 147 | , loose 148 | , cap 149 | , bull 150 | , b 151 | , item 152 | , space 153 | , i 154 | , l; 155 | 156 | while (src) { 157 | // newline 158 | if (cap = this.rules.newline.exec(src)) { 159 | src = src.substring(cap[0].length); 160 | if (cap[0].length > 1) { 161 | this.tokens.push({ 162 | type: 'space' 163 | }); 164 | } 165 | } 166 | 167 | // code 168 | if (cap = this.rules.code.exec(src)) { 169 | src = src.substring(cap[0].length); 170 | cap = cap[0].replace(/^ {4}/gm, ''); 171 | this.tokens.push({ 172 | type: 'code', 173 | text: !this.options.pedantic 174 | ? cap.replace(/\n+$/, '') 175 | : cap 176 | }); 177 | continue; 178 | } 179 | 180 | // fences (gfm) 181 | if (cap = this.rules.fences.exec(src)) { 182 | src = src.substring(cap[0].length); 183 | this.tokens.push({ 184 | type: 'code', 185 | lang: cap[2], 186 | text: cap[3] 187 | }); 188 | continue; 189 | } 190 | 191 | // heading 192 | if (cap = this.rules.heading.exec(src)) { 193 | src = src.substring(cap[0].length); 194 | this.tokens.push({ 195 | type: 'heading', 196 | depth: cap[1].length, 197 | text: cap[2] 198 | }); 199 | continue; 200 | } 201 | 202 | // table no leading pipe (gfm) 203 | if (top && (cap = this.rules.nptable.exec(src))) { 204 | src = src.substring(cap[0].length); 205 | 206 | item = { 207 | type: 'table', 208 | header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), 209 | align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), 210 | cells: cap[3].replace(/\n$/, '').split('\n') 211 | }; 212 | 213 | for (i = 0; i < item.align.length; i++) { 214 | if (/^ *-+: *$/.test(item.align[i])) { 215 | item.align[i] = 'right'; 216 | } else if (/^ *:-+: *$/.test(item.align[i])) { 217 | item.align[i] = 'center'; 218 | } else if (/^ *:-+ *$/.test(item.align[i])) { 219 | item.align[i] = 'left'; 220 | } else { 221 | item.align[i] = null; 222 | } 223 | } 224 | 225 | for (i = 0; i < item.cells.length; i++) { 226 | item.cells[i] = item.cells[i].split(/ *\| */); 227 | } 228 | 229 | this.tokens.push(item); 230 | 231 | continue; 232 | } 233 | 234 | // lheading 235 | if (cap = this.rules.lheading.exec(src)) { 236 | src = src.substring(cap[0].length); 237 | this.tokens.push({ 238 | type: 'heading', 239 | depth: cap[2] === '=' ? 1 : 2, 240 | text: cap[1] 241 | }); 242 | continue; 243 | } 244 | 245 | // hr 246 | if (cap = this.rules.hr.exec(src)) { 247 | src = src.substring(cap[0].length); 248 | this.tokens.push({ 249 | type: 'hr' 250 | }); 251 | continue; 252 | } 253 | 254 | // blockquote 255 | if (cap = this.rules.blockquote.exec(src)) { 256 | src = src.substring(cap[0].length); 257 | 258 | this.tokens.push({ 259 | type: 'blockquote_start' 260 | }); 261 | 262 | cap = cap[0].replace(/^ *> ?/gm, ''); 263 | 264 | // Pass `top` to keep the current 265 | // "toplevel" state. This is exactly 266 | // how markdown.pl works. 267 | this.token(cap, top); 268 | 269 | this.tokens.push({ 270 | type: 'blockquote_end' 271 | }); 272 | 273 | continue; 274 | } 275 | 276 | // list 277 | if (cap = this.rules.list.exec(src)) { 278 | src = src.substring(cap[0].length); 279 | bull = cap[2]; 280 | 281 | this.tokens.push({ 282 | type: 'list_start', 283 | ordered: bull.length > 1 284 | }); 285 | 286 | // Get each top-level item. 287 | cap = cap[0].match(this.rules.item); 288 | 289 | next = false; 290 | l = cap.length; 291 | i = 0; 292 | 293 | for (; i < l; i++) { 294 | item = cap[i]; 295 | 296 | // Remove the list item's bullet 297 | // so it is seen as the next token. 298 | space = item.length; 299 | item = item.replace(/^ *([*+-]|\d+\.) +/, ''); 300 | 301 | // Outdent whatever the 302 | // list item contains. Hacky. 303 | if (~item.indexOf('\n ')) { 304 | space -= item.length; 305 | item = !this.options.pedantic 306 | ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') 307 | : item.replace(/^ {1,4}/gm, ''); 308 | } 309 | 310 | // Determine whether the next list item belongs here. 311 | // Backpedal if it does not belong in this list. 312 | if (this.options.smartLists && i !== l - 1) { 313 | b = block.bullet.exec(cap[i + 1])[0]; 314 | if (bull !== b && !(bull.length > 1 && b.length > 1)) { 315 | src = cap.slice(i + 1).join('\n') + src; 316 | i = l - 1; 317 | } 318 | } 319 | 320 | // Determine whether item is loose or not. 321 | // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ 322 | // for discount behavior. 323 | loose = next || /\n\n(?!\s*$)/.test(item); 324 | if (i !== l - 1) { 325 | next = item.charAt(item.length - 1) === '\n'; 326 | if (!loose) loose = next; 327 | } 328 | 329 | this.tokens.push({ 330 | type: loose 331 | ? 'loose_item_start' 332 | : 'list_item_start' 333 | }); 334 | 335 | // Recurse. 336 | this.token(item, false); 337 | 338 | this.tokens.push({ 339 | type: 'list_item_end' 340 | }); 341 | } 342 | 343 | this.tokens.push({ 344 | type: 'list_end' 345 | }); 346 | 347 | continue; 348 | } 349 | 350 | // html 351 | if (cap = this.rules.html.exec(src)) { 352 | src = src.substring(cap[0].length); 353 | this.tokens.push({ 354 | type: this.options.sanitize 355 | ? 'paragraph' 356 | : 'html', 357 | pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style', 358 | text: cap[0] 359 | }); 360 | continue; 361 | } 362 | 363 | // def 364 | if (top && (cap = this.rules.def.exec(src))) { 365 | src = src.substring(cap[0].length); 366 | this.tokens.links[cap[1].toLowerCase()] = { 367 | href: cap[2], 368 | title: cap[3] 369 | }; 370 | continue; 371 | } 372 | 373 | // table (gfm) 374 | if (top && (cap = this.rules.table.exec(src))) { 375 | src = src.substring(cap[0].length); 376 | 377 | item = { 378 | type: 'table', 379 | header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), 380 | align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), 381 | cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') 382 | }; 383 | 384 | for (i = 0; i < item.align.length; i++) { 385 | if (/^ *-+: *$/.test(item.align[i])) { 386 | item.align[i] = 'right'; 387 | } else if (/^ *:-+: *$/.test(item.align[i])) { 388 | item.align[i] = 'center'; 389 | } else if (/^ *:-+ *$/.test(item.align[i])) { 390 | item.align[i] = 'left'; 391 | } else { 392 | item.align[i] = null; 393 | } 394 | } 395 | 396 | for (i = 0; i < item.cells.length; i++) { 397 | item.cells[i] = item.cells[i] 398 | .replace(/^ *\| *| *\| *$/g, '') 399 | .split(/ *\| */); 400 | } 401 | 402 | this.tokens.push(item); 403 | 404 | continue; 405 | } 406 | 407 | // top-level paragraph 408 | if (top && (cap = this.rules.paragraph.exec(src))) { 409 | src = src.substring(cap[0].length); 410 | this.tokens.push({ 411 | type: 'paragraph', 412 | text: cap[1].charAt(cap[1].length - 1) === '\n' 413 | ? cap[1].slice(0, -1) 414 | : cap[1] 415 | }); 416 | continue; 417 | } 418 | 419 | // text 420 | if (cap = this.rules.text.exec(src)) { 421 | // Top-level should never reach here. 422 | src = src.substring(cap[0].length); 423 | this.tokens.push({ 424 | type: 'text', 425 | text: cap[0] 426 | }); 427 | continue; 428 | } 429 | 430 | if (src) { 431 | throw new 432 | Error('Infinite loop on byte: ' + src.charCodeAt(0)); 433 | } 434 | } 435 | 436 | return this.tokens; 437 | }; 438 | 439 | /** 440 | * Inline-Level Grammar 441 | */ 442 | 443 | var inline = { 444 | escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, 445 | autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, 446 | url: noop, 447 | tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, 448 | link: /^!?\[(inside)\]\(href\)/, 449 | reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, 450 | nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, 451 | strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, 452 | em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, 453 | code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, 454 | br: /^ {2,}\n(?!\s*$)/, 455 | del: noop, 456 | text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; 461 | 462 | inline.link = replace(inline.link) 463 | ('inside', inline._inside) 464 | ('href', inline._href) 465 | (); 466 | 467 | inline.reflink = replace(inline.reflink) 468 | ('inside', inline._inside) 469 | (); 470 | 471 | /** 472 | * Normal Inline Grammar 473 | */ 474 | 475 | inline.normal = merge({}, inline); 476 | 477 | /** 478 | * Pedantic Inline Grammar 479 | */ 480 | 481 | inline.pedantic = merge({}, inline.normal, { 482 | strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, 483 | em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ 484 | }); 485 | 486 | /** 487 | * GFM Inline Grammar 488 | */ 489 | 490 | inline.gfm = merge({}, inline.normal, { 491 | escape: replace(inline.escape)('])', '~|])')(), 492 | url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, 493 | del: /^~~(?=\S)([\s\S]*?\S)~~/, 494 | text: replace(inline.text) 495 | (']|', '~]|') 496 | ('|', '|https?://|') 497 | () 498 | }); 499 | 500 | /** 501 | * GFM + Line Breaks Inline Grammar 502 | */ 503 | 504 | inline.breaks = merge({}, inline.gfm, { 505 | br: replace(inline.br)('{2,}', '*')(), 506 | text: replace(inline.gfm.text)('{2,}', '*')() 507 | }); 508 | 509 | /** 510 | * Inline Lexer & Compiler 511 | */ 512 | 513 | function InlineLexer(links, options) { 514 | this.options = options || marked.defaults; 515 | this.links = links; 516 | this.rules = inline.normal; 517 | 518 | if (!this.links) { 519 | throw new 520 | Error('Tokens array requires a `links` property.'); 521 | } 522 | 523 | if (this.options.gfm) { 524 | if (this.options.breaks) { 525 | this.rules = inline.breaks; 526 | } else { 527 | this.rules = inline.gfm; 528 | } 529 | } else if (this.options.pedantic) { 530 | this.rules = inline.pedantic; 531 | } 532 | } 533 | 534 | /** 535 | * Expose Inline Rules 536 | */ 537 | 538 | InlineLexer.rules = inline; 539 | 540 | /** 541 | * Static Lexing/Compiling Method 542 | */ 543 | 544 | InlineLexer.output = function(src, links, options) { 545 | var inline = new InlineLexer(links, options); 546 | return inline.output(src); 547 | }; 548 | 549 | /** 550 | * Lexing/Compiling 551 | */ 552 | 553 | InlineLexer.prototype.output = function(src) { 554 | var out = '' 555 | , link 556 | , text 557 | , href 558 | , cap; 559 | 560 | while (src) { 561 | // escape 562 | if (cap = this.rules.escape.exec(src)) { 563 | src = src.substring(cap[0].length); 564 | out += cap[1]; 565 | continue; 566 | } 567 | 568 | // autolink 569 | if (cap = this.rules.autolink.exec(src)) { 570 | src = src.substring(cap[0].length); 571 | if (cap[2] === '@') { 572 | text = cap[1].charAt(6) === ':' 573 | ? this.mangle(cap[1].substring(7)) 574 | : this.mangle(cap[1]); 575 | href = this.mangle('mailto:') + text; 576 | } else { 577 | text = escape(cap[1]); 578 | href = text; 579 | } 580 | out += '' 583 | + text 584 | + ''; 585 | continue; 586 | } 587 | 588 | // url (gfm) 589 | if (cap = this.rules.url.exec(src)) { 590 | src = src.substring(cap[0].length); 591 | text = escape(cap[1]); 592 | href = text; 593 | out += '' 596 | + text 597 | + ''; 598 | continue; 599 | } 600 | 601 | // tag 602 | if (cap = this.rules.tag.exec(src)) { 603 | src = src.substring(cap[0].length); 604 | out += this.options.sanitize 605 | ? escape(cap[0]) 606 | : cap[0]; 607 | continue; 608 | } 609 | 610 | // link 611 | if (cap = this.rules.link.exec(src)) { 612 | src = src.substring(cap[0].length); 613 | out += this.outputLink(cap, { 614 | href: cap[2], 615 | title: cap[3] 616 | }); 617 | continue; 618 | } 619 | 620 | // reflink, nolink 621 | if ((cap = this.rules.reflink.exec(src)) 622 | || (cap = this.rules.nolink.exec(src))) { 623 | src = src.substring(cap[0].length); 624 | link = (cap[2] || cap[1]).replace(/\s+/g, ' '); 625 | link = this.links[link.toLowerCase()]; 626 | if (!link || !link.href) { 627 | out += cap[0].charAt(0); 628 | src = cap[0].substring(1) + src; 629 | continue; 630 | } 631 | out += this.outputLink(cap, link); 632 | continue; 633 | } 634 | 635 | // strong 636 | if (cap = this.rules.strong.exec(src)) { 637 | src = src.substring(cap[0].length); 638 | out += '' 639 | + this.output(cap[2] || cap[1]) 640 | + ''; 641 | continue; 642 | } 643 | 644 | // em 645 | if (cap = this.rules.em.exec(src)) { 646 | src = src.substring(cap[0].length); 647 | out += '' 648 | + this.output(cap[2] || cap[1]) 649 | + ''; 650 | continue; 651 | } 652 | 653 | // code 654 | if (cap = this.rules.code.exec(src)) { 655 | src = src.substring(cap[0].length); 656 | out += '' 657 | + escape(cap[2], true) 658 | + ''; 659 | continue; 660 | } 661 | 662 | // br 663 | if (cap = this.rules.br.exec(src)) { 664 | src = src.substring(cap[0].length); 665 | out += '
    '; 666 | continue; 667 | } 668 | 669 | // del (gfm) 670 | if (cap = this.rules.del.exec(src)) { 671 | src = src.substring(cap[0].length); 672 | out += '' 673 | + this.output(cap[1]) 674 | + ''; 675 | continue; 676 | } 677 | 678 | // text 679 | if (cap = this.rules.text.exec(src)) { 680 | src = src.substring(cap[0].length); 681 | out += escape(this.smartypants(cap[0])); 682 | continue; 683 | } 684 | 685 | if (src) { 686 | throw new 687 | Error('Infinite loop on byte: ' + src.charCodeAt(0)); 688 | } 689 | } 690 | 691 | return out; 692 | }; 693 | 694 | /** 695 | * Compile Link 696 | */ 697 | 698 | InlineLexer.prototype.outputLink = function(cap, link) { 699 | if (cap[0].charAt(0) !== '!') { 700 | return '' 709 | + this.output(cap[1]) 710 | + ''; 711 | } else { 712 | return ''
 715 |       + escape(cap[1])
 716 |       + ''; 723 | } 724 | }; 725 | 726 | /** 727 | * Smartypants Transformations 728 | */ 729 | 730 | InlineLexer.prototype.smartypants = function(text) { 731 | if (!this.options.smartypants) return text; 732 | return text 733 | // em-dashes 734 | .replace(/--/g, '\u2014') 735 | // opening singles 736 | .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') 737 | // closing singles & apostrophes 738 | .replace(/'/g, '\u2019') 739 | // opening doubles 740 | .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') 741 | // closing doubles 742 | .replace(/"/g, '\u201d') 743 | // ellipses 744 | .replace(/\.{3}/g, '\u2026'); 745 | }; 746 | 747 | /** 748 | * Mangle Links 749 | */ 750 | 751 | InlineLexer.prototype.mangle = function(text) { 752 | var out = '' 753 | , l = text.length 754 | , i = 0 755 | , ch; 756 | 757 | for (; i < l; i++) { 758 | ch = text.charCodeAt(i); 759 | if (Math.random() > 0.5) { 760 | ch = 'x' + ch.toString(16); 761 | } 762 | out += '&#' + ch + ';'; 763 | } 764 | 765 | return out; 766 | }; 767 | 768 | /** 769 | * Parsing & Compiling 770 | */ 771 | 772 | function Parser(options) { 773 | this.tokens = []; 774 | this.token = null; 775 | this.options = options || marked.defaults; 776 | } 777 | 778 | /** 779 | * Static Parse Method 780 | */ 781 | 782 | Parser.parse = function(src, options) { 783 | var parser = new Parser(options); 784 | return parser.parse(src); 785 | }; 786 | 787 | /** 788 | * Parse Loop 789 | */ 790 | 791 | Parser.prototype.parse = function(src) { 792 | this.inline = new InlineLexer(src.links, this.options); 793 | this.tokens = src.reverse(); 794 | 795 | var out = ''; 796 | while (this.next()) { 797 | out += this.tok(); 798 | } 799 | 800 | return out; 801 | }; 802 | 803 | /** 804 | * Next Token 805 | */ 806 | 807 | Parser.prototype.next = function() { 808 | return this.token = this.tokens.pop(); 809 | }; 810 | 811 | /** 812 | * Preview Next Token 813 | */ 814 | 815 | Parser.prototype.peek = function() { 816 | return this.tokens[this.tokens.length - 1] || 0; 817 | }; 818 | 819 | /** 820 | * Parse Text Tokens 821 | */ 822 | 823 | Parser.prototype.parseText = function() { 824 | var body = this.token.text; 825 | 826 | while (this.peek().type === 'text') { 827 | body += '\n' + this.next().text; 828 | } 829 | 830 | return this.inline.output(body); 831 | }; 832 | 833 | /** 834 | * Parse Current Token 835 | */ 836 | 837 | Parser.prototype.tok = function() { 838 | switch (this.token.type) { 839 | case 'space': { 840 | return ''; 841 | } 842 | case 'hr': { 843 | return '
    \n'; 844 | } 845 | case 'heading': { 846 | return '' 852 | + this.inline.output(this.token.text) 853 | + '\n'; 856 | } 857 | case 'code': { 858 | if (this.options.highlight) { 859 | var code = this.options.highlight(this.token.text, this.token.lang); 860 | if (code != null && code !== this.token.text) { 861 | this.token.escaped = true; 862 | this.token.text = code; 863 | } 864 | } 865 | 866 | if (!this.token.escaped) { 867 | this.token.text = escape(this.token.text, true); 868 | } 869 | 870 | return '
    '
     878 |         + this.token.text
     879 |         + '
    \n'; 880 | } 881 | case 'table': { 882 | var body = '' 883 | , heading 884 | , i 885 | , row 886 | , cell 887 | , j; 888 | 889 | // header 890 | body += '\n\n'; 891 | for (i = 0; i < this.token.header.length; i++) { 892 | heading = this.inline.output(this.token.header[i]); 893 | body += '\n'; 898 | } 899 | body += '\n\n'; 900 | 901 | // body 902 | body += '\n' 903 | for (i = 0; i < this.token.cells.length; i++) { 904 | row = this.token.cells[i]; 905 | body += '\n'; 906 | for (j = 0; j < row.length; j++) { 907 | cell = this.inline.output(row[j]); 908 | body += '\n'; 913 | } 914 | body += '\n'; 915 | } 916 | body += '\n'; 917 | 918 | return '\n' 919 | + body 920 | + '
    \n'; 921 | } 922 | case 'blockquote_start': { 923 | var body = ''; 924 | 925 | while (this.next().type !== 'blockquote_end') { 926 | body += this.tok(); 927 | } 928 | 929 | return '
    \n' 930 | + body 931 | + '
    \n'; 932 | } 933 | case 'list_start': { 934 | var type = this.token.ordered ? 'ol' : 'ul' 935 | , body = ''; 936 | 937 | while (this.next().type !== 'list_end') { 938 | body += this.tok(); 939 | } 940 | 941 | return '<' 942 | + type 943 | + '>\n' 944 | + body 945 | + '\n'; 948 | } 949 | case 'list_item_start': { 950 | var body = ''; 951 | 952 | while (this.next().type !== 'list_item_end') { 953 | body += this.token.type === 'text' 954 | ? this.parseText() 955 | : this.tok(); 956 | } 957 | 958 | return '
  • ' 959 | + body 960 | + '
  • \n'; 961 | } 962 | case 'loose_item_start': { 963 | var body = ''; 964 | 965 | while (this.next().type !== 'list_item_end') { 966 | body += this.tok(); 967 | } 968 | 969 | return '
  • ' 970 | + body 971 | + '
  • \n'; 972 | } 973 | case 'html': { 974 | return !this.token.pre && !this.options.pedantic 975 | ? this.inline.output(this.token.text) 976 | : this.token.text; 977 | } 978 | case 'paragraph': { 979 | return '

    ' 980 | + this.inline.output(this.token.text) 981 | + '

    \n'; 982 | } 983 | case 'text': { 984 | return '

    ' 985 | + this.parseText() 986 | + '

    \n'; 987 | } 988 | } 989 | }; 990 | 991 | /** 992 | * Helpers 993 | */ 994 | 995 | function escape(html, encode) { 996 | return html 997 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 998 | .replace(//g, '>') 1000 | .replace(/"/g, '"') 1001 | .replace(/'/g, '''); 1002 | } 1003 | 1004 | function replace(regex, opt) { 1005 | regex = regex.source; 1006 | opt = opt || ''; 1007 | return function self(name, val) { 1008 | if (!name) return new RegExp(regex, opt); 1009 | val = val.source || val; 1010 | val = val.replace(/(^|[^\[])\^/g, '$1'); 1011 | regex = regex.replace(name, val); 1012 | return self; 1013 | }; 1014 | } 1015 | 1016 | function noop() {} 1017 | noop.exec = noop; 1018 | 1019 | function merge(obj) { 1020 | var i = 1 1021 | , target 1022 | , key; 1023 | 1024 | for (; i < arguments.length; i++) { 1025 | target = arguments[i]; 1026 | for (key in target) { 1027 | if (Object.prototype.hasOwnProperty.call(target, key)) { 1028 | obj[key] = target[key]; 1029 | } 1030 | } 1031 | } 1032 | 1033 | return obj; 1034 | } 1035 | 1036 | /** 1037 | * Marked 1038 | */ 1039 | 1040 | function marked(src, opt, callback) { 1041 | if (callback || typeof opt === 'function') { 1042 | if (!callback) { 1043 | callback = opt; 1044 | opt = null; 1045 | } 1046 | 1047 | opt = merge({}, marked.defaults, opt || {}); 1048 | 1049 | var highlight = opt.highlight 1050 | , tokens 1051 | , pending 1052 | , i = 0; 1053 | 1054 | try { 1055 | tokens = Lexer.lex(src, opt) 1056 | } catch (e) { 1057 | return callback(e); 1058 | } 1059 | 1060 | pending = tokens.length; 1061 | 1062 | var done = function() { 1063 | var out, err; 1064 | 1065 | try { 1066 | out = Parser.parse(tokens, opt); 1067 | } catch (e) { 1068 | err = e; 1069 | } 1070 | 1071 | opt.highlight = highlight; 1072 | 1073 | return err 1074 | ? callback(err) 1075 | : callback(null, out); 1076 | }; 1077 | 1078 | if (!highlight || highlight.length < 3) { 1079 | return done(); 1080 | } 1081 | 1082 | delete opt.highlight; 1083 | 1084 | if (!pending) return done(); 1085 | 1086 | for (; i < tokens.length; i++) { 1087 | (function(token) { 1088 | if (token.type !== 'code') { 1089 | return --pending || done(); 1090 | } 1091 | return highlight(token.text, token.lang, function(err, code) { 1092 | if (code == null || code === token.text) { 1093 | return --pending || done(); 1094 | } 1095 | token.text = code; 1096 | token.escaped = true; 1097 | --pending || done(); 1098 | }); 1099 | })(tokens[i]); 1100 | } 1101 | 1102 | return; 1103 | } 1104 | try { 1105 | if (opt) opt = merge({}, marked.defaults, opt); 1106 | return Parser.parse(Lexer.lex(src, opt), opt); 1107 | } catch (e) { 1108 | e.message += '\nPlease report this to https://github.com/chjj/marked.'; 1109 | if ((opt || marked.defaults).silent) { 1110 | return '

    An error occured:

    '
    1111 |         + escape(e.message + '', true)
    1112 |         + '
    '; 1113 | } 1114 | throw e; 1115 | } 1116 | } 1117 | 1118 | /** 1119 | * Options 1120 | */ 1121 | 1122 | marked.options = 1123 | marked.setOptions = function(opt) { 1124 | merge(marked.defaults, opt); 1125 | return marked; 1126 | }; 1127 | 1128 | marked.defaults = { 1129 | gfm: true, 1130 | tables: true, 1131 | breaks: false, 1132 | pedantic: false, 1133 | sanitize: false, 1134 | smartLists: false, 1135 | silent: false, 1136 | highlight: null, 1137 | langPrefix: 'lang-', 1138 | smartypants: false, 1139 | headerPrefix: '' 1140 | }; 1141 | 1142 | /** 1143 | * Expose 1144 | */ 1145 | 1146 | marked.Parser = Parser; 1147 | marked.parser = Parser.parse; 1148 | 1149 | marked.Lexer = Lexer; 1150 | marked.lexer = Lexer.lex; 1151 | 1152 | marked.InlineLexer = InlineLexer; 1153 | marked.inlineLexer = InlineLexer.output; 1154 | 1155 | marked.parse = marked; 1156 | 1157 | if (typeof exports === 'object') { 1158 | module.exports = marked; 1159 | } else if (typeof define === 'function' && define.amd) { 1160 | define(function() { return marked; }); 1161 | } else { 1162 | this.marked = marked; 1163 | } 1164 | 1165 | }).call(function() { 1166 | return this || (typeof window !== 'undefined' ? window : global); 1167 | }()); 1168 | -------------------------------------------------------------------------------- /_js/sammy-latest.min.js: -------------------------------------------------------------------------------- 1 | // -- Sammy.js -- /sammy.js 2 | // http://sammyjs.org 3 | // Version: 0.7.4 4 | // Built: 2013-01-27 13:34:16 -0500 5 | // name: sammy 6 | // version: 0.7.4 7 | // Sammy.js / http://sammyjs.org 8 | (function(e,t){(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):e.sammy=t.Sammy=n(e)})(function(e){var n,r="([^/]+)",i=/:([\w\d]+)/g,s=/\?([^#]*)?$/,o=function(e){return Array.prototype.slice.call(e)},u=function(e){return Object.prototype.toString.call(e)==="[object Function]"},a=function(e){return Object.prototype.toString.call(e)==="[object Array]"},f=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},l=function(e){return decodeURIComponent((e||"").replace(/\+/g," "))},c=encodeURIComponent,h=function(e){return String(e).replace(/&(?!\w+;)/g,"&").replace(//g,">").replace(/"/g,""")},p=function(e){return function(){return this.route.apply(this,[e].concat(Array.prototype.slice.call(arguments)))}},d={},v=!!t.history&&!!history.pushState,m=[];return n=function(){var t=o(arguments),r,i;n.apps=n.apps||{};if(t.length===0||t[0]&&u(t[0]))return n.apply(n,["body"].concat(t));if(typeof (i=t.shift())=="string")return r=n.apps[i]||new n.Application,r.element_selector=i,t.length>0&&e.each(t,function(e,t){r.use(t)}),r.element_selector!=i&&delete n.apps[i],n.apps[r.element_selector]=r,r},n.VERSION="0.7.4",n.addLogger=function(e){m.push(e)},n.log=function(){var t=o(arguments);t.unshift("["+Date()+"]"),e.each(m,function(e,r){r.apply(n,t)})},typeof t.console!="undefined"?u(t.console.log.apply)?n.addLogger(function(){t.console.log.apply(t.console,arguments)}):n.addLogger(function(){t.console.log(arguments)}):typeof console!="undefined"&&n.addLogger(function(){console.log.apply(console,arguments)}),e.extend(n,{makeArray:o,isFunction:u,isArray:a}),n.Object=function(t){return e.extend(this,t||{})},e.extend(n.Object.prototype,{escapeHTML:h,h:h,toHash:function(){var t={};return e.each(this,function(e,n){u(n)||(t[e]=n)}),t},toHTML:function(){var t="";return e.each(this,function(e,n){u(n)||(t+=""+e+" "+n+"
    ")}),t},keys:function(e){var t=[];for(var n in this)(!u(this[n])||!e)&&t.push(n);return t},has:function(t){return this[t]&&e.trim(this[t].toString())!==""},join:function(){var e=o(arguments),t=e.shift();return e.join(t)},log:function(){n.log.apply(n,arguments)},toString:function(t){var n=[];return e.each(this,function(e,r){(!u(r)||t)&&n.push('"'+e+'": '+r.toString())}),"Sammy.Object: {"+n.join(",")+"}"}}),n.targetIsThisWindow=function(r){var i=e(r.target).attr("target");return!i||i===t.name||i==="_self"?!0:i==="_blank"?!1:i==="top"&&t===t.top?!0:!1},n.DefaultLocationProxy=function(e,t){this.app=e,this.is_native=!1,this.has_history=v,this._startPolling(t)},n.DefaultLocationProxy.fullPath=function(e){var t=e.toString().match(/^[^#]*(#.+)$/),n=t?t[1]:"";return[e.pathname,e.search,n].join("")},e.extend(n.DefaultLocationProxy.prototype,{bind:function(){var r=this,i=this.app,s=n.DefaultLocationProxy;e(t).bind("hashchange."+this.app.eventNamespace(),function(e,n){r.is_native===!1&&!n&&(r.is_native=!0,t.clearInterval(s._interval),s._interval=null),i.trigger("location-changed")}),v&&!i.disable_push_state&&(e(t).bind("popstate."+this.app.eventNamespace(),function(e){i.trigger("location-changed")}),e(document).delegate("a","click.history-"+this.app.eventNamespace(),function(e){if(e.isDefaultPrevented()||e.metaKey||e.ctrlKey)return;var o=s.fullPath(this);if(this.hostname==t.location.hostname&&i.lookupRoute("get",o)&&n.targetIsThisWindow(e))return e.preventDefault(),r.setLocation(o),!1})),s._bindings||(s._bindings=0),s._bindings++},unbind:function(){e(t).unbind("hashchange."+this.app.eventNamespace()),e(t).unbind("popstate."+this.app.eventNamespace()),e(document).undelegate("a","click.history-"+this.app.eventNamespace()),n.DefaultLocationProxy._bindings--,n.DefaultLocationProxy._bindings<=0&&(t.clearInterval(n.DefaultLocationProxy._interval),n.DefaultLocationProxy._interval=null)},getLocation:function(){return n.DefaultLocationProxy.fullPath(t.location)},setLocation:function(e){/^([^#\/]|$)/.test(e)&&(v&&!this.app.disable_push_state?e="/"+e:e="#!/"+e);if(e!=this.getLocation()){if(!(v&&!this.app.disable_push_state&&/^\//.test(e)))return t.location=e;history.pushState({path:e},t.title,e),this.app.trigger("location-changed")}},_startPolling:function(r){var i=this;if(!n.DefaultLocationProxy._interval){r||(r=10);var s=function(){var r=i.getLocation();(typeof n.DefaultLocationProxy._last_location=="undefined"||r!=n.DefaultLocationProxy._last_location)&&t.setTimeout(function(){e(t).trigger("hashchange",[!0])},0),n.DefaultLocationProxy._last_location=r};s(),n.DefaultLocationProxy._interval=t.setInterval(s,r)}}}),n.Application=function(e){var t=this;this.routes={},this.listeners=new n.Object({}),this.arounds=[],this.befores=[],this.namespace=(new Date).getTime()+"-"+parseInt(Math.random()*1e3,10),this.context_prototype=function(){n.EventContext.apply(this,arguments)},this.context_prototype.prototype=new n.EventContext,u(e)&&e.apply(this,[this]),this._location_proxy||this.setLocationProxy(new n.DefaultLocationProxy(this,this.run_interval_every)),this.debug&&this.bindToAllEvents(function(e,n){t.log(t.toString(),e.cleaned_type,n||{})})},n.Application.prototype=e.extend({},n.Object.prototype,{ROUTE_VERBS:["get","post","put","delete"],APP_EVENTS:["run","unload","lookup-route","run-route","route-found","event-context-before","event-context-after","changed","error","check-form-submission","redirect","location-changed"],_last_route:null,_location_proxy:null,_running:!1,element_selector:"body",debug:!1,raise_errors:!1,run_interval_every:50,disable_push_state:!1,template_engine:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(t){return t?e(this.element_selector).find(t):e(this.element_selector)},use:function(){var e=o(arguments),t=e.shift(),r=t||"";try{e.unshift(this),typeof t=="string"&&(r="Sammy."+t,t=n[t]),t.apply(this,e)}catch(i){typeof t=="undefined"?this.error("Plugin Error: called use() but plugin ("+r.toString()+") is not defined",i):u(t)?this.error("Plugin Error",i):this.error("Plugin Error: called use() but '"+r.toString()+"' is not a function",i)}return this},setLocationProxy:function(e){var t=this._location_proxy;this._location_proxy=e,this.isRunning()&&(t&&t.unbind(),this._location_proxy.bind())},log:function(){n.log.apply(n,Array.prototype.concat.apply([this.element_selector],arguments))},route:function(t,n){var s=this,o=[],a,f,l=Array.prototype.slice.call(arguments,2);l.length===0&&u(n)&&(n=t,l=[n],t="any"),t=t.toLowerCase();if(n.constructor==String){i.lastIndex=0;while((f=i.exec(n))!==null)o.push(f[1]);n=new RegExp(n.replace(i,r)+"$")}return e.each(l,function(e,t){typeof t=="string"&&(l[e]=s[t])}),a=function(e){var t={verb:e,path:n,callback:l,param_names:o};s.routes[e]=s.routes[e]||[],s.routes[e].push(t)},t==="any"?e.each(this.ROUTE_VERBS,function(e,t){a(t)}):a(t),this},get:p("get"),post:p("post"),put:p("put"),del:p("delete"),any:p("any"),mapRoutes:function(t){var n=this;return e.each(t,function(e,t){n.route.apply(n,t)}),this},eventNamespace:function(){return["sammy-app",this.namespace].join("-")},bind:function(e,t,n){var r=this;typeof n=="undefined"&&(n=t);var i=function(){var e,t,i;e=arguments[0],i=arguments[1],i&&i.context?(t=i.context,delete i.context):t=new r.context_prototype(r,"bind",e.type,i,e.target),e.cleaned_type=e.type.replace(r.eventNamespace(),""),n.apply(t,[e,i])};return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(i),this.isRunning()&&this._listen(e,i),this},trigger:function(e,t){return this.$element().trigger([e,this.eventNamespace()].join("."),[t]),this},refresh:function(){return this.last_location=null,this.trigger("location-changed"),this},before:function(e,t){return u(e)&&(t=e,e={}),this.befores.push([e,t]),this},after:function(e){return this.bind("event-context-after",e)},around:function(e){return this.arounds.push(e),this},onComplete:function(e){return this._onComplete=e,this},isRunning:function(){return this._running},helpers:function(t){return e.extend(this.context_prototype.prototype,t),this},helper:function(e,t){return this.context_prototype.prototype[e]=t,this},run:function(r){if(this.isRunning())return!1;var i=this;return e.each(this.listeners.toHash(),function(t,n){e.each(n,function(e,n){i._listen(t,n)})}),this.trigger("run",{start_url:r}),this._running=!0,this.last_location=null,!/\#(.+)/.test(this.getLocation())&&typeof r!="undefined"&&this.setLocation(r),this._checkLocation(),this._location_proxy.bind(),this.bind("location-changed",function(){i._checkLocation()}),this.bind("submit",function(t){if(!n.targetIsThisWindow(t))return!0;var r=i._checkFormSubmission(e(t.target).closest("form"));return r===!1?t.preventDefault():!1}),e(t).bind("unload",function(){i.unload()}),this.trigger("changed")},unload:function(){if(!this.isRunning())return!1;var t=this;return this.trigger("unload"),this._location_proxy.unbind(),this.$element().unbind("submit").removeClass(t.eventNamespace()),e.each(this.listeners.toHash(),function(n,r){e.each(r,function(e,r){t._unlisten(n,r)})}),this._running=!1,this},destroy:function(){return this.unload(),delete n.apps[this.element_selector],this},bindToAllEvents:function(t){var n=this;return e.each(this.APP_EVENTS,function(e,r){n.bind(r,t)}),e.each(this.listeners.keys(!0),function(r,i){e.inArray(i,n.APP_EVENTS)==-1&&n.bind(i,t)}),this},routablePath:function(e){return e.replace(s,"")},lookupRoute:function(e,t){var n=this,r=!1,i=0,s,o;if(typeof this.routes[e]!="undefined"){s=this.routes[e].length;for(;i0){p=h.shift();if(s.contextMatchesOptions(u,p[0])){e=p[1].apply(u,[u]);if(e===!1)return!1}}return s.last_route=o,u.trigger("event-context-before",{context:u}),typeof o.callback=="function"&&(o.callback=[o.callback]),o.callback&&o.callback.length&&(t=-1,n=function(){t++,o.callback[t]?e=o.callback[t].apply(u,d):s._onComplete&&typeof (s._onComplete==="function")&&s._onComplete(u)},d.push(n),n()),u.trigger("event-context-after",{context:u}),e},e.each(f.reverse(),function(e,t){var n=a;a=function(){return t.apply(u,[n])}});try{m=a()}catch(g){this.error(["500 Error",t,n].join(" "),g)}return m}return this.notFound(t,n)},contextMatchesOptions:function(t,n,r){var i=n;if(typeof i=="string"||f(i))i={path:i};typeof r=="undefined"&&(r=!0);if(e.isEmptyObject(i))return!0;if(a(i.path)){var s,o,u,l;s=[];for(o=0,l=i.path.length;o-1?!0:!1;return r?c:!c}if(i.only)return this.contextMatchesOptions(t,i.only,!0);if(i.except)return this.contextMatchesOptions(t,i.except,!1);var h=!0,p=!0;return i.path&&(f(i.path)||(i.path=new RegExp(i.path.toString()+"$")),h=i.path.test(t.path)),i.verb&&(typeof i.verb=="string"?p=i.verb===t.verb:p=i.verb.indexOf(t.verb)>-1),r?p&&h:!p||!h},getLocation:function(){return this._location_proxy.getLocation()},setLocation:function(e){return this._location_proxy.setLocation(e)},swap:function(e,t){var n=this.$element().html(e);return u(t)&&t(e),n},templateCache:function(e,t){return typeof t!="undefined"?d[e]=t:d[e]},clearTemplateCache:function(){return d={}},notFound:function(e,t){var n=this.error(["404 Not Found",e,t].join(" "));return e==="get"?n:!0},error:function(e,t){t||(t=new Error),t.message=[e,t.message].join(" "),this.trigger("error",{message:t.message,error:t});if(this.raise_errors)throw t;this.log(t.message,t)},_checkLocation:function(){var e,t;e=this.getLocation();if(!this.last_location||this.last_location[0]!="get"||this.last_location[1]!=e)this.last_location=["get",e],t=this.runRoute("get",e);return t},_getFormVerb:function(t){var n=e(t),r,i;i=n.find('input[name="_method"]'),i.length>0&&(r=i.val()),r||(r=n[0].getAttribute("method"));if(!r||r==="")r="get";return e.trim(r.toString().toLowerCase())},_checkFormSubmission:function(t){var n,r,i,s,o;return this.trigger("check-form-submission",{form:t}),n=e(t),r=n.attr("action")||"",i=this._getFormVerb(n),this.debug&&this.log("_checkFormSubmission",n,r,i),i==="get"?(s=this._serializeFormParams(n),s!==""&&(r+="?"+s),this.setLocation(r),o=!1):(s=e.extend({},this._parseFormParams(n)),o=this.runRoute(i,r,s,t.get(0))),typeof o=="undefined"?!1:o},_serializeFormParams:function(e){var t="",n=e.serializeArray(),r;if(n.length>0){t=this._encodeFormPair(n[0].name,n[0].value);for(r=1;r0&&this.then(this.callbacks.shift())},load:function(t,n,r){var i=this;return this.then(function(){var s,o,a,f;u(n)?(r=n,n={}):n=e.extend({},n),r&&this.then(r);if(typeof t=="string")return a=t.match(/\.json$/)||n.json,s=a?n.cache===!0:n.cache!==!1,i.next_engine=i.event_context.engineFor(t),delete n.cache,delete n.json,n.engine&&(i.next_engine=n.engine,delete n.engine),s&&(o=this.event_context.app.templateCache(t))?o:(this.wait(),e.ajax(e.extend({url:t,data:{},dataType:a?"json":"text",type:"get",success:function(e){s&&i.event_context.app.templateCache(t,e),i.next(e)}},n)),!1);if(t.nodeType)return t.innerHTML;if(t.selector)return i.next_engine=t.attr("data-engine"),n.clone===!1?t.remove()[0].innerHTML.toString():t[0].innerHTML.toString()})},loadPartials:function(e){var t;if(e){this.partials=this.partials||{};for(t in e)(function(t,n){t.load(e[n]).then(function(e){this.partials[n]=e})})(this,t)}return this},render:function(e,t,n,r){return u(e)&&!t?this.then(e):(u(t)?(r=n,n=t,t=null):n&&!u(n)&&(r=n,n=null),this.loadPartials(r).load(e).interpolate(t,e).then(n))},partial:function(e,t,n,r){return u(n)?this.render(e,t,r).swap(n):u(t)?this.render(e,{},n).swap(t):this.render(e,t,n).swap()},send:function(){var e=this,t=o(arguments),n=t.shift();return a(t[0])&&(t=t[0]),this.then(function(r){return t.push(function(t){e.next(t)}),e.wait(),n.apply(n,t),!1})},collect:function(t,n,r){var i=this,s=function(){u(t)&&(n=t,t=this.content);var r=[],s=!1;return e.each(t,function(e,t){var o=n.apply(i,[e,t]);return o.jquery&&o.length==1&&(o=o[0],s=!0),r.push(o),o}),s?r:r.join("")};return r?s():this.then(s)},renderEach:function(t,n,r,i){return a(n)&&(i=r,r=n,n=null),this.load(t).then(function(s){var o=this;r||(r=a(this.previous_content)?this.previous_content:[]);if(!i)return this.collect(r,function(e,r){var i={},o=this.next_engine||t;return n?i[n]=r:i=r,this.event_context.interpolate(s,i,o)},!0);e.each(r,function(e,r){var u={},a=this.next_engine||t;n?u[n]=r:u=r,i(r,o.event_context.interpolate(s,u,a))})})},interpolate:function(e,t,n){var r=this;return this.then(function(i,s){!e&&s&&(e=s),this.next_engine&&(t=this.next_engine,this.next_engine=!1);var o=r.event_context.interpolate(i,e,t,this.partials);return n?s+o:o})},swap:function(e){return this.then(function(t){return this.event_context.swap(t,e),t}).trigger("changed",{})},appendTo:function(t){return this.then(function(n){e(t).append(n)}).trigger("changed",{})},prependTo:function(t){return this.then(function(n){e(t).prepend(n)}).trigger("changed",{})},replace:function(t){return this.then(function(n){e(t).html(n)}).trigger("changed",{})},trigger:function(e,t){return this.then(function(n){return typeof t=="undefined"&&(t={content:n}),this.event_context.trigger(e,t),n})}}),n.EventContext=function(e,t,r,i,s){this.app=e,this.verb=t,this.path=r,this.params=new n.Object(i),this.target=s},n.EventContext.prototype=e.extend({},n.Object.prototype,{$element:function(){return this.app.$element(o(arguments).shift())},engineFor:function(e){var t=this,n;if(u(e))return e;e=(e||t.app.template_engine).toString();if(n=e.match(/\.([^\.\?\#]+)$/))e=n[1];return e&&u(t[e])?t[e]:t.app.template_engine?this.engineFor(t.app.template_engine):function(e,t){return e}},interpolate:function(e,t,n,r){return this.engineFor(n).apply(this,[e,t,r])},render:function(e,t,r,i){return(new n.RenderContext(this)).render(e,t,r,i)},renderEach:function(e,t,r,i){return(new n.RenderContext(this)).renderEach(e,t,r,i)},load:function(e,t,r){return(new n.RenderContext(this)).load(e,t,r)},loadPartials:function(e){return(new n.RenderContext(this)).loadPartials(e)},partial:function(e,t,r,i){return(new n.RenderContext(this)).partial(e,t,r,i)},send:function(){var e=new n.RenderContext(this);return e.send.apply(e,arguments)},redirect:function(){var t,n=o(arguments),r=this.app.getLocation(),i=n.length;if(i>1){var s=0,u=[],a=[],f={},l=!1;for(;s 'bar' 28 | // store.set('json', {obj: 'this is an obj'}); 29 | // store.get('json'); //=> {obj: 'this is an obj'} 30 | // store.keys(); //=> ['foo','json'] 31 | // store.clear('foo'); 32 | // store.keys(); //=> ['json'] 33 | // store.clearAll(); 34 | // store.keys(); //=> [] 35 | // 36 | // ### Arguments 37 | // 38 | // The constructor takes a single argument which is a Object containing these possible options. 39 | // 40 | // * `name` The name/namespace of this store. Stores are unique by name/type. (default 'store') 41 | // * `element` A selector for the element that the store is bound to. (default 'body') 42 | // * `type` The type of storage/proxy to use (default 'memory') 43 | // 44 | // Extra options are passed to the storage constructor. 45 | // Sammy.Store supports the following methods of storage: 46 | // 47 | // * `memory` Basic object storage 48 | // * `data` jQuery.data DOM Storage 49 | // * `cookie` Access to document.cookie. Limited to 2K 50 | // * `local` HTML5 DOM localStorage, browswer support is currently limited. 51 | // * `session` HTML5 DOM sessionStorage, browswer support is currently limited. 52 | // 53 | Sammy.Store = function(options) { 54 | var store = this; 55 | this.options = options || {}; 56 | this.name = this.options.name || 'store'; 57 | this.element = this.options.element || 'body'; 58 | this.$element = $(this.element); 59 | if ($.isArray(this.options.type)) { 60 | $.each(this.options.type, function(i, type) { 61 | if (Sammy.Store.isAvailable(type)) { 62 | store.type = type; 63 | return false; 64 | } 65 | }); 66 | } else { 67 | this.type = this.options.type || 'memory'; 68 | } 69 | this.meta_key = this.options.meta_key || '__keys__'; 70 | this.storage = new Sammy.Store[Sammy.Store.stores[this.type]](this.name, this.element, this.options); 71 | }; 72 | 73 | Sammy.Store.stores = { 74 | 'memory': 'Memory', 75 | 'data': 'Data', 76 | 'local': 'LocalStorage', 77 | 'session': 'SessionStorage', 78 | 'cookie': 'Cookie' 79 | }; 80 | 81 | $.extend(Sammy.Store.prototype, { 82 | // Checks for the availability of the current storage type in the current browser/config. 83 | isAvailable: function() { 84 | if ($.isFunction(this.storage.isAvailable)) { 85 | return this.storage.isAvailable(); 86 | } else { 87 | return true; 88 | } 89 | }, 90 | // Checks for the existance of `key` in the current store. Returns a boolean. 91 | exists: function(key) { 92 | return this.storage.exists(key); 93 | }, 94 | // Sets the value of `key` with `value`. If `value` is an 95 | // object, it is turned to and stored as a string with `JSON.stringify`. 96 | // It also tries to conform to the KVO pattern triggering jQuery events on the 97 | // element that the store is bound to. 98 | // 99 | // ### Example 100 | // 101 | // var store = new Sammy.Store({name: 'kvo'}); 102 | // $('body').bind('set-kvo-foo', function(e, data) { 103 | // Sammy.log(data.key + ' changed to ' + data.value); 104 | // }); 105 | // store.set('foo', 'bar'); // logged: foo changed to bar 106 | // 107 | set: function(key, value) { 108 | var string_value = (typeof value == 'string') ? value : JSON.stringify(value); 109 | key = key.toString(); 110 | this.storage.set(key, string_value); 111 | if (key != this.meta_key) { 112 | this._addKey(key); 113 | this.$element.trigger('set-' + this.name, {key: key, value: value}); 114 | this.$element.trigger('set-' + this.name + '-' + key, {key: key, value: value}); 115 | } 116 | // always return the original value 117 | return value; 118 | }, 119 | // Returns the set value at `key`, parsing with `JSON.parse` and 120 | // turning into an object if possible 121 | get: function(key) { 122 | var value = this.storage.get(key); 123 | if (typeof value == 'undefined' || value == null || value == '') { 124 | return value; 125 | } 126 | try { 127 | return JSON.parse(value); 128 | } catch(e) { 129 | return value; 130 | } 131 | }, 132 | // Removes the value at `key` from the current store 133 | clear: function(key) { 134 | this._removeKey(key); 135 | return this.storage.clear(key); 136 | }, 137 | // Clears all the values for the current store. 138 | clearAll: function() { 139 | var self = this; 140 | this.each(function(key, value) { 141 | self.clear(key); 142 | }); 143 | }, 144 | // Returns the all the keys set for the current store as an array. 145 | // Internally Sammy.Store keeps this array in a 'meta_key' for easy access. 146 | keys: function() { 147 | return this.get(this.meta_key) || []; 148 | }, 149 | // Iterates over each key value pair passing them to the `callback` function 150 | // 151 | // ### Example 152 | // 153 | // store.each(function(key, value) { 154 | // Sammy.log('key', key, 'value', value); 155 | // }); 156 | // 157 | each: function(callback) { 158 | var i = 0, 159 | keys = this.keys(), 160 | returned; 161 | 162 | for (i; i < keys.length; i++) { 163 | returned = callback(keys[i], this.get(keys[i])); 164 | if (returned === false) { return false; } 165 | } 166 | }, 167 | // Filters the store by a filter function that takes a key value. 168 | // Returns an array of arrays where the first element of each array 169 | // is the key and the second is the value of that key. 170 | // 171 | // ### Example 172 | // 173 | // var store = new Sammy.Store; 174 | // store.set('one', 'two'); 175 | // store.set('two', 'three'); 176 | // store.set('1', 'two'); 177 | // var returned = store.filter(function(key, value) { 178 | // // only return 179 | // return value === 'two'; 180 | // }); 181 | // // returned => [['one', 'two'], ['1', 'two']]; 182 | // 183 | filter: function(callback) { 184 | var found = []; 185 | this.each(function(key, value) { 186 | if (callback(key, value)) { 187 | found.push([key, value]); 188 | } 189 | return true; 190 | }); 191 | return found; 192 | }, 193 | // Works exactly like filter except only returns the first matching key 194 | // value pair instead of all of them 195 | first: function(callback) { 196 | var found = false; 197 | this.each(function(key, value) { 198 | if (callback(key, value)) { 199 | found = [key, value]; 200 | return false; 201 | } 202 | }); 203 | return found; 204 | }, 205 | // Returns the value at `key` if set, otherwise, runs the callback 206 | // and sets the value to the value returned in the callback. 207 | // 208 | // ### Example 209 | // 210 | // var store = new Sammy.Store; 211 | // store.exists('foo'); //=> false 212 | // store.fetch('foo', function() { 213 | // return 'bar!'; 214 | // }); //=> 'bar!' 215 | // store.get('foo') //=> 'bar!' 216 | // store.fetch('foo', function() { 217 | // return 'baz!'; 218 | // }); //=> 'bar! 219 | // 220 | fetch: function(key, callback) { 221 | if (!this.exists(key)) { 222 | return this.set(key, callback.apply(this)); 223 | } else { 224 | return this.get(key); 225 | } 226 | }, 227 | // loads the response of a request to `path` into `key`. 228 | // 229 | // ### Example 230 | // 231 | // In /mytemplate.tpl: 232 | // 233 | // My Template 234 | // 235 | // In app.js: 236 | // 237 | // var store = new Sammy.Store; 238 | // store.load('mytemplate', '/mytemplate.tpl', function() { 239 | // s.get('mytemplate') //=> My Template 240 | // }); 241 | // 242 | load: function(key, path, callback) { 243 | var s = this; 244 | $.get(path, function(response) { 245 | s.set(key, response); 246 | if (callback) { callback.apply(this, [response]); } 247 | }); 248 | }, 249 | 250 | _addKey: function(key) { 251 | var keys = this.keys(); 252 | if ($.inArray(key, keys) == -1) { keys.push(key); } 253 | this.set(this.meta_key, keys); 254 | }, 255 | _removeKey: function(key) { 256 | var keys = this.keys(); 257 | var index = $.inArray(key, keys); 258 | if (index != -1) { keys.splice(index, 1); } 259 | this.set(this.meta_key, keys); 260 | } 261 | }); 262 | 263 | // Tests if the type of storage is available/works in the current browser/config. 264 | // Especially useful for testing the availability of the awesome, but not widely 265 | // supported HTML5 DOM storage 266 | Sammy.Store.isAvailable = function(type) { 267 | try { 268 | return Sammy.Store[Sammy.Store.stores[type]].prototype.isAvailable(); 269 | } catch(e) { 270 | return false; 271 | } 272 | }; 273 | 274 | // Memory ('memory') is the basic/default store. It stores data in a global 275 | // JS object. Data is lost on refresh. 276 | Sammy.Store.Memory = function(name, element) { 277 | this.name = name; 278 | this.element = element; 279 | this.namespace = [this.element, this.name].join('.'); 280 | Sammy.Store.Memory.store = Sammy.Store.Memory.store || {}; 281 | Sammy.Store.Memory.store[this.namespace] = Sammy.Store.Memory.store[this.namespace] || {}; 282 | this.store = Sammy.Store.Memory.store[this.namespace]; 283 | }; 284 | $.extend(Sammy.Store.Memory.prototype, { 285 | isAvailable: function() { return true; }, 286 | exists: function(key) { 287 | return (typeof this.store[key] != "undefined"); 288 | }, 289 | set: function(key, value) { 290 | return this.store[key] = value; 291 | }, 292 | get: function(key) { 293 | return this.store[key]; 294 | }, 295 | clear: function(key) { 296 | delete this.store[key]; 297 | } 298 | }); 299 | 300 | // Data ('data') stores objects using the jQuery.data() methods. This has the advantadge 301 | // of scoping the data to the specific element. Like the 'memory' store its data 302 | // will only last for the length of the current request (data is lost on refresh/etc). 303 | Sammy.Store.Data = function(name, element) { 304 | this.name = name; 305 | this.element = element; 306 | this.$element = $(element); 307 | }; 308 | $.extend(Sammy.Store.Data.prototype, { 309 | isAvailable: function() { return true; }, 310 | exists: function(key) { 311 | return !!this.$element.data(this._key(key)); 312 | }, 313 | set: function(key, value) { 314 | return this.$element.data(this._key(key), value); 315 | }, 316 | get: function(key) { 317 | return this.$element.data(this._key(key)); 318 | }, 319 | clear: function(key) { 320 | this.$element.removeData(this._key(key)); 321 | }, 322 | _key: function(key) { 323 | return ['store', this.name, key].join('.'); 324 | } 325 | }); 326 | 327 | // LocalStorage ('local') makes use of HTML5 DOM Storage, and the window.localStorage 328 | // object. The great advantage of this method is that data will persist beyond 329 | // the current request. It can be considered a pretty awesome replacement for 330 | // cookies accessed via JS. The great disadvantage, though, is its only available 331 | // on the latest and greatest browsers. 332 | // 333 | // For more info on DOM Storage: 334 | // https://developer.mozilla.org/en/DOM/Storage 335 | // http://www.w3.org/TR/2009/WD-webstorage-20091222/ 336 | // 337 | Sammy.Store.LocalStorage = function(name, element) { 338 | this.name = name; 339 | this.element = element; 340 | }; 341 | $.extend(Sammy.Store.LocalStorage.prototype, { 342 | isAvailable: function() { 343 | return ('localStorage' in window) && (window.location.protocol != 'file:'); 344 | }, 345 | exists: function(key) { 346 | return (this.get(key) != null); 347 | }, 348 | set: function(key, value) { 349 | return window.localStorage.setItem(this._key(key), value); 350 | }, 351 | get: function(key) { 352 | return window.localStorage.getItem(this._key(key)); 353 | }, 354 | clear: function(key) { 355 | window.localStorage.removeItem(this._key(key));; 356 | }, 357 | _key: function(key) { 358 | return ['store', this.element, this.name, key].join('.'); 359 | } 360 | }); 361 | 362 | // .SessionStorage ('session') is similar to LocalStorage (part of the same API) 363 | // and shares similar browser support/availability. The difference is that 364 | // SessionStorage is only persistant through the current 'session' which is defined 365 | // as the length that the current window is open. This means that data will survive 366 | // refreshes but not close/open or multiple windows/tabs. For more info, check out 367 | // the `LocalStorage` documentation and links. 368 | Sammy.Store.SessionStorage = function(name, element) { 369 | this.name = name; 370 | this.element = element; 371 | }; 372 | $.extend(Sammy.Store.SessionStorage.prototype, { 373 | isAvailable: function() { 374 | return ('sessionStorage' in window) && 375 | (window.location.protocol != 'file:') && 376 | ($.isFunction(window.sessionStorage.setItem)); 377 | }, 378 | exists: function(key) { 379 | return (this.get(key) != null); 380 | }, 381 | set: function(key, value) { 382 | return window.sessionStorage.setItem(this._key(key), value); 383 | }, 384 | get: function(key) { 385 | var value = window.sessionStorage.getItem(this._key(key)); 386 | if (value && typeof value.value != "undefined") { value = value.value } 387 | return value; 388 | }, 389 | clear: function(key) { 390 | window.sessionStorage.removeItem(this._key(key));; 391 | }, 392 | _key: function(key) { 393 | return ['store', this.element, this.name, key].join('.'); 394 | } 395 | }); 396 | 397 | // .Cookie ('cookie') storage uses browser cookies to store data. JavaScript 398 | // has access to a single document.cookie variable, which is limited to 2Kb in 399 | // size. Cookies are also considered 'unsecure' as the data can be read easily 400 | // by other sites/JS. Cookies do have the advantage, though, of being widely 401 | // supported and persistent through refresh and close/open. Where available, 402 | // HTML5 DOM Storage like LocalStorage and SessionStorage should be used. 403 | // 404 | // .Cookie can also take additional options: 405 | // 406 | // * `expires_in` Number of seconds to keep the cookie alive (default 2 weeks). 407 | // * `path` The path to activate the current cookie for (default '/'). 408 | // 409 | // For more information about document.cookie, check out the pre-eminint article 410 | // by ppk: http://www.quirksmode.org/js/cookies.html 411 | // 412 | Sammy.Store.Cookie = function(name, element, options) { 413 | this.name = name; 414 | this.element = element; 415 | this.options = options || {}; 416 | this.path = this.options.path || '/'; 417 | // set the expires in seconds or default 14 days 418 | this.expires_in = this.options.expires_in || (14 * 24 * 60 * 60); 419 | }; 420 | $.extend(Sammy.Store.Cookie.prototype, { 421 | isAvailable: function() { 422 | return ('cookie' in document) && (window.location.protocol != 'file:'); 423 | }, 424 | exists: function(key) { 425 | return (this.get(key) != null); 426 | }, 427 | set: function(key, value) { 428 | return this._setCookie(key, value); 429 | }, 430 | get: function(key) { 431 | return this._getCookie(key); 432 | }, 433 | clear: function(key) { 434 | this._setCookie(key, "", -1); 435 | }, 436 | _key: function(key) { 437 | return ['store', this.element, this.name, key].join('.'); 438 | }, 439 | _getCookie: function(key) { 440 | var escaped = this._key(key).replace(/(\.|\*|\(|\)|\[|\])/g, '\\$1'); 441 | var match = document.cookie.match("(^|;\\s)" + escaped + "=([^;]*)(;|$)"); 442 | return (match ? match[2] : null); 443 | }, 444 | _setCookie: function(key, value, expires) { 445 | if (!expires) { expires = (this.expires_in * 1000) } 446 | var date = new Date(); 447 | date.setTime(date.getTime() + expires); 448 | var set_cookie = [ 449 | this._key(key), "=", value, 450 | "; expires=", date.toGMTString(), 451 | "; path=", this.path 452 | ].join(''); 453 | document.cookie = set_cookie; 454 | } 455 | }); 456 | 457 | // Sammy.Storage is a plugin that provides shortcuts for creating and using 458 | // Sammy.Store objects. Once included it provides the `store()` app level 459 | // and helper methods. Depends on Sammy.JSON (or json2.js). 460 | Sammy.Storage = function(app) { 461 | this.use(Sammy.JSON); 462 | 463 | this.stores = this.stores || {}; 464 | 465 | // `store()` creates and looks up existing `Sammy.Store` objects 466 | // for the current application. The first time used for a given `'name'` 467 | // initializes a `Sammy.Store` and also creates a helper under the store's 468 | // name. 469 | // 470 | // ### Example 471 | // 472 | // var app = $.sammy(function() { 473 | // this.use(Sammy.Storage); 474 | // 475 | // // initializes the store on app creation. 476 | // this.store('mystore', {type: 'cookie'}); 477 | // 478 | // this.get('#/', function() { 479 | // // returns the Sammy.Store object 480 | // this.store('mystore'); 481 | // // sets 'foo' to 'bar' using the shortcut/helper 482 | // // equivilent to this.store('mystore').set('foo', 'bar'); 483 | // this.mystore('foo', 'bar'); 484 | // // returns 'bar' 485 | // // equivilent to this.store('mystore').get('foo'); 486 | // this.mystore('foo'); 487 | // // returns 'baz!' 488 | // // equivilent to: 489 | // // this.store('mystore').fetch('foo!', function() { 490 | // // return 'baz!'; 491 | // // }) 492 | // this.mystore('foo!', function() { 493 | // return 'baz!'; 494 | // }); 495 | // 496 | // this.clearMystore(); 497 | // // equivilent to: 498 | // // this.store('mystore').clearAll() 499 | // }); 500 | // 501 | // }); 502 | // 503 | // ### Arguments 504 | // 505 | // * `name` The name of the store and helper. the name must be unique per application. 506 | // * `options` A JS object of options that can be passed to the Store constuctor on initialization. 507 | // 508 | this.store = function(name, options) { 509 | // if the store has not been initialized 510 | if (typeof this.stores[name] == 'undefined') { 511 | // create initialize the store 512 | var clear_method_name = "clear" + name.substr(0,1).toUpperCase() + name.substr(1); 513 | this.stores[name] = new Sammy.Store($.extend({ 514 | name: name, 515 | element: this.element_selector 516 | }, options || {})); 517 | // app.name() 518 | this[name] = function(key, value) { 519 | if (typeof value == 'undefined') { 520 | return this.stores[name].get(key); 521 | } else if ($.isFunction(value)) { 522 | return this.stores[name].fetch(key, value); 523 | } else { 524 | return this.stores[name].set(key, value) 525 | } 526 | }; 527 | // app.clearName(); 528 | this[clear_method_name] = function() { 529 | return this.stores[name].clearAll(); 530 | } 531 | // context.name() 532 | this.helper(name, function() { 533 | return this.app[name].apply(this.app, arguments); 534 | }); 535 | // context.clearName(); 536 | this.helper(clear_method_name, function() { 537 | return this.app[clear_method_name](); 538 | }); 539 | } 540 | return this.stores[name]; 541 | }; 542 | 543 | this.helpers({ 544 | store: function() { 545 | return this.app.store.apply(this.app, arguments); 546 | } 547 | }); 548 | }; 549 | 550 | // Sammy.Session is an additional plugin for creating a common 'session' store 551 | // for the given app. It is a very simple wrapper around `Sammy.Storage` 552 | // that provides a simple fallback mechanism for trying to provide the best 553 | // possible storage type for the session. This means, `LocalStorage` 554 | // if available, otherwise `Cookie`, otherwise `Memory`. 555 | // It provides the `session()` helper through `Sammy.Storage#store()`. 556 | // 557 | // See the `Sammy.Storage` plugin for full documentation. 558 | // 559 | Sammy.Session = function(app, options) { 560 | this.use(Sammy.Storage); 561 | // check for local storage, then cookie storage, then just use memory 562 | this.store('session', $.extend({type: ['local', 'cookie', 'memory']}, options)); 563 | }; 564 | 565 | // Sammy.Cache provides helpers for caching data within the lifecycle of a 566 | // Sammy app. The plugin provides two main methods on `Sammy.Application`, 567 | // `cache` and `clearCache`. Each app has its own cache store so that 568 | // you dont have to worry about collisions. As of 0.5 the original Sammy.Cache module 569 | // has been deprecated in favor of this one based on Sammy.Storage. The exposed 570 | // API is almost identical, but Sammy.Storage provides additional backends including 571 | // HTML5 Storage. `Sammy.Cache` will try to use these backends when available 572 | // (in this order) `LocalStorage`, `SessionStorage`, and `Memory` 573 | Sammy.Cache = function(app, options) { 574 | this.use(Sammy.Storage); 575 | // set cache_partials to true 576 | this.cache_partials = true; 577 | // check for local storage, then session storage, then just use memory 578 | this.store('cache', $.extend({type: ['local', 'session', 'memory']}, options)); 579 | }; 580 | 581 | return Sammy.Storage; 582 | 583 | })); 584 | -------------------------------------------------------------------------------- /_pages/accounting.md: -------------------------------------------------------------------------------- 1 | #Accounting 2 | 3 | If you want to contribute to this documentation, you have to ask an admin to create an account **OR** send merge requests to the pages' git repository. 4 | -------------------------------------------------------------------------------- /_pages/accounting_fr.md: -------------------------------------------------------------------------------- 1 | #Comptes utilisateur 2 | 3 | Si vous voulez contribuer à cette documentation, vous devez demander à un administrateur de vous créer un compte, ou modifier directement le répertoire des pages via Git. -------------------------------------------------------------------------------- /_pages/default.md: -------------------------------------------------------------------------------- 1 | #New page 2 | 3 | This page is not created yet, you can edit it by pressing `````` on your keyboard or by clicking the "edit" button on the bottom-right side of your screen. You will be able to preview your changes by pressing `````` again or by clicking the "preview" button. 4 | 5 | ** Note: ** If you don't have any account you will have to send the modifications manually. 6 | 7 | ###Syntax 8 | 9 | This page use the markdown syntax, please refer to the documentation for further informations: 10 | 11 | http://daringfireball.net/projects/markdown/syntax -------------------------------------------------------------------------------- /_pages/default_fr.md: -------------------------------------------------------------------------------- 1 | #Nouvelle page 2 | 3 | Cette page n'existe pas encore, vous pouvez l'éditer en appuyant sur la touche `````` de votre clavier, ou en cliquant sur le bouton "edit" en bas à droite de votre écran. Vous pourrez avoir un aperçu de vos changements en appuyant à nouveau sur la touche `````` ou en cliquant sur le bouton "preview". 4 | 5 | ** Note: ** Si vous n'avez pas de compte vous devrez envoyer vos modifications manuellement. 6 | 7 | 8 | ### Syntaxe 9 | Cette page utilise la syntaxe Markdown, veuillez vous référer à la documentation pour plus d'informations: 10 | 11 | http://daringfireball.net/projects/markdown/syntax -------------------------------------------------------------------------------- /_pages/help.md: -------------------------------------------------------------------------------- 1 | #About this site 2 | 3 | Unless specifically mentioned, the content of this website is licensed under the Creative Commons ```CC-By-SA``` license. 4 | 5 | http://creativecommons.org/licenses/by-sa/3.0/ 6 | 7 | This wiki is powered by [Simone](https://github.com/Kloadut/Simone) -------------------------------------------------------------------------------- /_pages/help_fr.md: -------------------------------------------------------------------------------- 1 | #À propos de ce site 2 | 3 | Sauf mention contraire, le contenu de ce site est sous licence Creative Common ```CC-By-Sa```. 4 | 5 | http://creativecommons.org/licenses/by-sa/3.0/fr/ 6 | 7 | Ce wiki est propulsé par [Simone](https://github.com/Kloadut/Simone) -------------------------------------------------------------------------------- /ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/ajax-loader.gif -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "siteName": "YunoHost", 3 | "requestEmail": "doc-request@yunohost.org", 4 | "gitRepository": "https://github.com/YunoHost/doc", 5 | "defaultLanguage": "en", 6 | "languages": { 7 | "en": "English", 8 | "fr": "Français" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/favicon.ico -------------------------------------------------------------------------------- /fonts/CosmicSansNeueMono.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/CosmicSansNeueMono.otf -------------------------------------------------------------------------------- /fonts/CosmicSansNeueMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/CosmicSansNeueMono.ttf -------------------------------------------------------------------------------- /fonts/CosmicSansNeueMonoBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/CosmicSansNeueMonoBold.otf -------------------------------------------------------------------------------- /fonts/CosmicSansNeueMonoBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/CosmicSansNeueMonoBold.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Black-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Black-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-Black-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Black-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Black-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Black-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceCodePro-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Bold-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-Bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Bold-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Bold-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceCodePro-ExtraLight-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-ExtraLight-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-ExtraLight-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-ExtraLight-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-ExtraLight-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-ExtraLight-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceCodePro-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Light-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-Light-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Light-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Light-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceCodePro-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Regular-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-Regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Regular-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Regular-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceCodePro-Semibold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Semibold-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceCodePro-Semibold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Semibold-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceCodePro-Semibold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceCodePro-Semibold-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-Black-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Black-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-Black-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Black-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-Black-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Black-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-BlackIt-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BlackIt-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-BlackIt-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BlackIt-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-BlackIt-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BlackIt-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Bold-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-Bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Bold-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Bold-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-BoldIt-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BoldIt-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-BoldIt-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BoldIt-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-BoldIt-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-BoldIt-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLight-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLight-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLight-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLight-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLight-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLight-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLightIt-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLightIt-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLightIt-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLightIt-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-ExtraLightIt-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-ExtraLightIt-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-It-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-It-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-It-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-It-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-It-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-It-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Light-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-Light-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Light-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Light-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-LightIt-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-LightIt-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-LightIt-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-LightIt-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-LightIt-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-LightIt-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Regular-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-Regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Regular-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Regular-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-Semibold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Semibold-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-Semibold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Semibold-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-Semibold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-Semibold-webfont.woff -------------------------------------------------------------------------------- /fonts/SourceSansPro-SemiboldIt-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-SemiboldIt-webfont.eot -------------------------------------------------------------------------------- /fonts/SourceSansPro-SemiboldIt-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-SemiboldIt-webfont.ttf -------------------------------------------------------------------------------- /fonts/SourceSansPro-SemiboldIt-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/SourceSansPro-SemiboldIt-webfont.woff -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /gitrss.rb: -------------------------------------------------------------------------------- 1 | # Adapted by Ryan Florence (http://ryanflorence.com) 2 | # original by Chris Dinger: http://www.houseofding.com/2009/03/create-an-rss-feed-of-your-git-commits/ 3 | # 4 | # Takes one, two, or three arguments 5 | # 1. Repository path (required) - the path to the repository 6 | # 2. The url to put as the for both channel and items 7 | # 3. the repository name, defaults to directory name of the repository 8 | # 9 | # Command line usage: 10 | # ruby gitrss.rb /path/to/repo > feed.rss 11 | # ruby gitrss.rb /path/to/repo http://example.com > feed.rss 12 | # ruby gitrss.rb /path/to/repo http://example.com repo_name > feed.rss 13 | 14 | repository_path = $*[0] 15 | url = $*[1] || 'http://example.com/rss/' 16 | Dir.chdir repository_path 17 | repository_name = $*[2] || `pwd`.split('/').last.chop 18 | 19 | git_history = `git log --max-count=10 --name-status` 20 | entries = git_history.split("\ncommit ") 21 | 22 | rss = " 23 | 24 | 25 | 26 | #{repository_name} commits 27 | Git commits to #{repository_name} 28 | #{url} 29 | #{Time.now} 30 | #{Time.now} 31 | " 32 | 33 | entries.each do |entry| 34 | guid = entry.gsub(/^.*commit /ms, '').gsub(/\n.*$/ms, '') 35 | author_name = entry.gsub(/^.*Author: /ms, '').gsub(/ <.*$/ms, '') 36 | date = entry.gsub(/^.*Date: +/ms, '').gsub(/\n.*$/ms, '') 37 | comments = entry.gsub(/^.*Date[^\n]*/ms, '') 38 | 39 | rss += " 40 | 41 | Commit by #{author_name} 42 | #{author_name} made a commit on #{date} 43 | 45 | SHA#{guid} 46 | Author#{author_name} 47 | Date#{date} 48 | 49 |
    #{comments}
    50 | ]]>
    51 | #{url} 52 | #{guid} 53 | #{date} 54 |
    " 55 | end 56 | 57 | rss += " 58 |
    59 |
    " 60 | 61 | puts rss 62 | -------------------------------------------------------------------------------- /i18n.json: -------------------------------------------------------------------------------- 1 | { 2 | "en": { 3 | "edit": "Edit", 4 | "preview": "Preview", 5 | "send": "Send", 6 | "revert": "Revert", 7 | "languages": "Languages", 8 | "sendModifications": "Send Modifications", 9 | "email": "Email", 10 | "password": "Password", 11 | "youDontHaveAccount": "You don't have an account ?", 12 | "close": "Close", 13 | "sendChanges": "Send changes", 14 | "modificationSaved": "Modifications successfully saved", 15 | "modificationFailed": "An error occured on modification saving", 16 | "withAccount": "With account", 17 | "byEmail": "By Email", 18 | "viaGit": "Via Git", 19 | "launchMail": "This will launch a pop-up containing the required details to send by mail. Copy/paste the content and be careful not to spam :)", 20 | "gitInstructions": "Create or modify with the below text and send a pull-request to .", 21 | "to": "To", 22 | "subject": "Subject", 23 | "body": "Body" 24 | }, 25 | "fr": { 26 | "edit": "Éditer", 27 | "preview": "Aperçu", 28 | "send": "Envoyer", 29 | "revert": "Annuler", 30 | "languages": "Langues", 31 | "sendModifications": "Envoyer les modifications", 32 | "email": "Email", 33 | "password": "Mot de passe", 34 | "youDontHaveAccount": "Vous n'avez pas de compte ?", 35 | "close": "Fermer", 36 | "sendChanges": "Envoyer", 37 | "modificationSaved": "Les modifications ont été enregistrées", 38 | "modificationFailed": "Une erreur est survenu pendant l'enregistrement", 39 | "withAccount": "Avec un compte", 40 | "byEmail": "Par email", 41 | "viaGit": "Via Git", 42 | "launchMail": "Ce bouton va lancer un pop-up contenant les détails à envoyer par email. Copiez/collez le contenu et relisez-vous bien :)", 43 | "gitInstructions": "Créez ou modifiez avec le texte ci-dessous puis envoyez une pull-request sur .", 44 | "to": "À", 45 | "subject": "Sujet", 46 | "body": "Corps" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    19 | 20 | 21 |
    22 | 23 |
    24 |
    25 |
    26 | 27 |
    28 | 29 |   30 | 31 | 32 |   33 | 34 | 37 | 38 |   39 | 40 |
    41 | 42 |
    43 | ? 44 |
    45 | 48 | 50 |
    51 |
    52 | 53 | 54 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 45 | 46 | 47 | 48 | <?php echo $title ?> 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 76 | 77 | 78 | 79 | 80 | 81 |
    82 | 83 | 84 | 87 | 88 |
    89 | 90 |
    91 |
    92 | 93 | 107 | 108 | 118 | 119 | 120 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kloadut/Simone/81035ec9d6a8a647ba794e4815280771f480489c/logo.png -------------------------------------------------------------------------------- /save.php: -------------------------------------------------------------------------------- 1 | " && '. 34 | 'git push'); 35 | exec('rm '.$path.'/commit.lock'); 36 | 37 | exec('ruby '.$path.'/gitrss.rb '.$path.'/_pages http://doc.yunohost.org/ "YunoHost documentation" > '.$path.'/feed.rss', $result, $result_code); 38 | } else { 39 | header($_SERVER['SERVER_PROTOCOL'].' 401 UNAUTHORIZED'); 40 | } 41 | 42 | ?> 43 | --------------------------------------------------------------------------------