Loading lib/jsduck/search_data.rb +4 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ module JsDuck :icon => :subclass, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 0, } end Loading @@ -57,6 +58,7 @@ module JsDuck :icon => :class, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 1, } end Loading @@ -70,6 +72,7 @@ module JsDuck :icon => :subclass, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 2, } end Loading @@ -83,6 +86,7 @@ module JsDuck :icon => member[:tagname], :id => cls.full_name + "-" + member[:id], :private => member[:private], :removed => member[:meta][:removed], :sort => 3, } end Loading template/app/ClassRegistry.js +14 −13 Original line number Diff line number Diff line Loading @@ -32,14 +32,14 @@ Ext.define("Docs.ClassRegistry", { * ordered by best matches first. */ search: function(text) { // Each record has its relative sorting order: 0..3 // which is doubled by it being public/private var results = [ // public | private [], [], [], [], [], [], [], [], // First we sort full matches: 0..7 [], [], [], [], [], [], [], [], // Then matches in beginning: 8..15 [], [], [], [], [], [], [], [] // Finally matches in middle: 16..23 ]; // Each record has 1 of 4 possible sorting orders, // which is *3 by it being public/private/removed, // and *3 by full/beginning/middle matches. var results = new Array(4 * 3 * 3); for (var i=0; i<results.length; i++) { results[i] = []; } var searchFull = /[.:]/.test(text); var safeText = Ext.escapeRe(text); var reFull = new RegExp("^" + safeText + "$", "i"); Loading @@ -51,17 +51,18 @@ Ext.define("Docs.ClassRegistry", { // (e.g. "Ext.Component.focus" or "xtype: grid") // Otherwise search from just the member name (e.g. "focus" or "Component") var name = searchFull ? r.cls + (r.type === "class" ? "" : "." + r.member) : r.member; // Shift private items to the end of each match category var priv = r["private"] ? 4 : 0; // Shift private items further back // Shift removed items to the very end of each match category var shift = r["private"] ? 4 : (r["removed"] ? 8 : 0); if (reFull.test(name)) { results[r.sort + priv].push(r); results[r.sort + shift].push(r); } else if (reBeg.test(name)) { results[r.sort + priv + 8].push(r); results[r.sort + shift + 12].push(r); } else if (reMid.test(name)) { results[r.sort + priv + 16].push(r); results[r.sort + shift + 24].push(r); } }, this); Loading template/app/view/search/Dropdown.js +4 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ Ext.define('Docs.view.search.Dropdown', { '<tpl for=".">', '<div class="item">', '<div class="icon icon-{icon}"></div>', '<div class="title {[values.private ? "private" : ""]}">{member}</div>', '<div class="title {[this.getCls(values)]}">{member}</div>', '<div class="class">{cls}</div>', '</div>', '</tpl>', Loading @@ -54,6 +54,9 @@ Ext.define('Docs.view.search.Dropdown', { '<a href="#" class="next">></a>', '</div>', { getCls: function(values) { return values["private"] ? "private" : (values.removed ? "removed" : ""); }, getTotal: Ext.bind(this.getTotal, this), getStart: Ext.bind(this.getStart, this), getEnd: Ext.bind(this.getEnd, this) Loading template/resources/sass/_header.scss +4 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,10 @@ overflow: hidden; text-overflow: ellipsis; &.private { color: gray; } } color: gray; } &.removed { color: gray; text-decoration: line-through; } } .class { font-size: 0.85em; overflow: hidden; Loading Loading
lib/jsduck/search_data.rb +4 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ module JsDuck :icon => :subclass, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 0, } end Loading @@ -57,6 +58,7 @@ module JsDuck :icon => :class, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 1, } end Loading @@ -70,6 +72,7 @@ module JsDuck :icon => :subclass, :id => cls.full_name, :private => cls[:private], :removed => cls[:meta][:removed], :sort => 2, } end Loading @@ -83,6 +86,7 @@ module JsDuck :icon => member[:tagname], :id => cls.full_name + "-" + member[:id], :private => member[:private], :removed => member[:meta][:removed], :sort => 3, } end Loading
template/app/ClassRegistry.js +14 −13 Original line number Diff line number Diff line Loading @@ -32,14 +32,14 @@ Ext.define("Docs.ClassRegistry", { * ordered by best matches first. */ search: function(text) { // Each record has its relative sorting order: 0..3 // which is doubled by it being public/private var results = [ // public | private [], [], [], [], [], [], [], [], // First we sort full matches: 0..7 [], [], [], [], [], [], [], [], // Then matches in beginning: 8..15 [], [], [], [], [], [], [], [] // Finally matches in middle: 16..23 ]; // Each record has 1 of 4 possible sorting orders, // which is *3 by it being public/private/removed, // and *3 by full/beginning/middle matches. var results = new Array(4 * 3 * 3); for (var i=0; i<results.length; i++) { results[i] = []; } var searchFull = /[.:]/.test(text); var safeText = Ext.escapeRe(text); var reFull = new RegExp("^" + safeText + "$", "i"); Loading @@ -51,17 +51,18 @@ Ext.define("Docs.ClassRegistry", { // (e.g. "Ext.Component.focus" or "xtype: grid") // Otherwise search from just the member name (e.g. "focus" or "Component") var name = searchFull ? r.cls + (r.type === "class" ? "" : "." + r.member) : r.member; // Shift private items to the end of each match category var priv = r["private"] ? 4 : 0; // Shift private items further back // Shift removed items to the very end of each match category var shift = r["private"] ? 4 : (r["removed"] ? 8 : 0); if (reFull.test(name)) { results[r.sort + priv].push(r); results[r.sort + shift].push(r); } else if (reBeg.test(name)) { results[r.sort + priv + 8].push(r); results[r.sort + shift + 12].push(r); } else if (reMid.test(name)) { results[r.sort + priv + 16].push(r); results[r.sort + shift + 24].push(r); } }, this); Loading
template/app/view/search/Dropdown.js +4 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ Ext.define('Docs.view.search.Dropdown', { '<tpl for=".">', '<div class="item">', '<div class="icon icon-{icon}"></div>', '<div class="title {[values.private ? "private" : ""]}">{member}</div>', '<div class="title {[this.getCls(values)]}">{member}</div>', '<div class="class">{cls}</div>', '</div>', '</tpl>', Loading @@ -54,6 +54,9 @@ Ext.define('Docs.view.search.Dropdown', { '<a href="#" class="next">></a>', '</div>', { getCls: function(values) { return values["private"] ? "private" : (values.removed ? "removed" : ""); }, getTotal: Ext.bind(this.getTotal, this), getStart: Ext.bind(this.getStart, this), getEnd: Ext.bind(this.getEnd, this) Loading
template/resources/sass/_header.scss +4 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,10 @@ overflow: hidden; text-overflow: ellipsis; &.private { color: gray; } } color: gray; } &.removed { color: gray; text-decoration: line-through; } } .class { font-size: 0.85em; overflow: hidden; Loading