Showing the changes to assets/javascripts (2 of 4 files). Show all
Unified · Split
| @@ -1,6 +1,7 @@ | |||
| 1 | app.config = { | 1 | app.config = { |
| 2 | db_filename: 'db.json', | 2 | db_filename: 'db.json', |
| 3 | default_docs: <%= App.default_docs.to_json %>, | 3 | default_docs: <%= App.default_docs.to_json %>, |
| 4 | docs_aliases: <%= App.docs_aliases.to_json %>, | ||
| 4 | docs_origin: '<%= App.docs_origin %>', | 5 | docs_origin: '<%= App.docs_origin %>', |
| 5 | env: '<%= App.environment %>', | 6 | env: '<%= App.environment %>', |
| 6 | history_cache_size: 10, | 7 | history_cache_size: 10, |
| @@ -2,14 +2,15 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | app.models.Entry = class Entry extends app.Model { | 3 | app.models.Entry = class Entry extends app.Model { |
| 4 | static applyAliases(string) { | 4 | static applyAliases(string) { |
| 5 | if (Entry.ALIASES.hasOwnProperty(string)) { | 5 | const aliases = app.config.docs_aliases; |
| 6 | return [string, Entry.ALIASES[string]]; | 6 | if (aliases.hasOwnProperty(string)) { |
| 7 | return [string, aliases[string]]; | ||
| 7 | } else { | 8 | } else { |
| 8 | const words = string.split("."); | 9 | const words = string.split("."); |
| 9 | for (let i = 0; i < words.length; i++) { | 10 | for (let i = 0; i < words.length; i++) { |
| 10 | var word = words[i]; | 11 | var word = words[i]; |
| 11 | if (Entry.ALIASES.hasOwnProperty(word)) { | 12 | if (aliases.hasOwnProperty(word)) { |
| 12 | words[i] = Entry.ALIASES[word]; | 13 | words[i] = aliases[word]; |
| 13 | return [string, words.join(".")]; | 14 | return [string, words.join(".")]; |
| 14 | } | 15 | } |
| 15 | } | 16 | } |
| @@ -17,43 +18,7 @@ app.models.Entry = class Entry extends app.Model { · 1 unmodified line | |||
| 17 | return string; | 18 | return string; |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | static ALIASES = { | ||
| 21 | angular: "ng", | ||
| 22 | "angular.js": "ng", | ||
| 23 | "backbone.js": "bb", | ||
| 24 | "c++": "cpp", | ||
| 25 | coffeescript: "cs", | ||
| 26 | crystal: "cr", | ||
| 27 | elixir: "ex", | ||
| 28 | javascript: "js", | ||
| 29 | julia: "jl", | ||
| 30 | jquery: "$", | ||
| 31 | "knockout.js": "ko", | ||
| 32 | kubernetes: "k8s", | ||
| 33 | less: "ls", | ||
| 34 | lodash: "_", | ||
| 35 | löve: "love", | ||
| 36 | marionette: "mn", | ||
| 37 | markdown: "md", | ||
| 38 | matplotlib: "mpl", | ||
| 39 | modernizr: "mdr", | ||
| 40 | "moment.js": "mt", | ||
| 41 | openjdk: "java", | ||
| 42 | nginx: "ngx", | ||
| 43 | numpy: "np", | ||
| 44 | pandas: "pd", | ||
| 45 | postgresql: "pg", | ||
| 46 | python: "py", | ||
| 47 | "ruby.on.rails": "ror", | ||
| 48 | ruby: "rb", | ||
| 49 | rust: "rs", | ||
| 50 | sass: "scss", | ||
| 51 | tensorflow: "tf", | ||
| 52 | typescript: "ts", | ||
| 53 | "underscore.js": "_", | ||
| 54 | }; | ||
| 55 | // Attributes: name, type, path | 21 | // Attributes: name, type, path |
| 56 | |||
| 57 | constructor() { | 22 | constructor() { |
| 58 | super(...arguments); | 23 | super(...arguments); |
| 59 | this.text = Entry.applyAliases(app.Searcher.normalizeString(this.name)); | 24 | this.text = Entry.applyAliases(app.Searcher.normalizeString(this.name)); |