Skip to content

Commit f396368

Browse files
committed
bugfix: search filter selectors
1 parent 747cf5d commit f396368

File tree

5 files changed

+585
-18
lines changed

5 files changed

+585
-18
lines changed

genomes.py

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def guess_type(path):
8383
j['url'] = guess_url(d)
8484
j['pre-release'] = 'early_release' in j['path']
8585
j['relpath'] = '/'.join(j['path'].split('/')[3:])
86+
j['basename'] = basename(j['relpath'])
8687
j['loadfn'] = load_fn(j['relpath'], j['type'])
8788
# if 'Hannu' in d:
8889
# print j

static/index.js

+17-13
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,24 @@ function filters_match(filters, element_text) {
128128
// hide examples or module reference blocks that don't match the current filter
129129
// based on: http://jsfiddle.net/reyjose/40u0var6/
130130
function filter_searchable(box_id, element_selector){
131-
var filters = $(box_id).val().toLowerCase();
131+
var filters = document.getElementById(box_id).value.toLowerCase();
132+
console.log(filters);
132133
if(filters == ""){
133134
$(element_selector).show();
134135
} else {
135136
$(element_selector).each(function(){
136137
var text = $(this).text().toLowerCase();
138+
console.log(text);
137139
filters_match(filters, text) ? $(this).show() : $(this).hide();
138140
});
139141
};
140142
}
141143

142-
function filter_scripts() { filter_searchable('#scriptsearch', '#scripts > .codeblock') };
143-
function filter_tutorial() { filter_searchable('#tutorialsearch', '#tutorial > .tutorialsection') };
144-
function filter_modules() { filter_searchable('#modulesearch', '.moduleblock') };
145-
function filter_genomes() { filter_searchable('#genomesearch', '.genomeblock') };
146-
function filter_userscripts() { filter_searchable('#userscriptsearch', '#userscripts > .codeblock') };
144+
function filter_tutorial() { filter_searchable('tutorialsearch' , '#tutorial > .tutorialsection') };
145+
function filter_genomes() { filter_searchable('genomesearch' , '.genomeblock' ) };
146+
function filter_modules() { filter_searchable('modulesearch' , '#modules > .moduleblock' ) };
147+
function filter_scripts() { filter_searchable('scriptsearch' , '#scripts > .codeblock' ) };
148+
function filter_userscripts() { filter_searchable('userscriptsearch', '#userscripts > .codeblock' ) };
147149

148150
function login() {
149151
window.location.href = '/user';
@@ -176,7 +178,8 @@ function logout() {
176178
});
177179
}
178180

179-
$(document).ready(function(){
181+
// TODO update to the new method
182+
$(function(){
180183

181184
// TODO would explicit disconnect help?
182185
SOCKET = io.connect('http://' + document.domain + ':' + location.port);
@@ -335,15 +338,16 @@ $(document).ready(function(){
335338
openTabByName(data['tabName']);
336339
});
337340

338-
filter_scripts();
339341
filter_tutorial();
340-
filter_modules();
341342
filter_genomes();
343+
filter_modules();
344+
filter_scripts();
342345
filter_userscripts();
343-
$('#scriptsearch').keyup(filter_scripts);
344-
$('#tutorialsearch').keyup(filter_tutorial);
345-
$('#modulesearch').keyup(filter_modules);
346-
$('#genomesearch').keyup(filter_genomes);
346+
347+
$('#tutorialsearch' ).keyup(filter_tutorial );
348+
$('#genomesearch' ).keyup(filter_genomes );
349+
$('#modulesearch' ).keyup(filter_modules );
350+
$('#scriptsearch' ).keyup(filter_scripts );
347351
$('#userscriptsearch').keyup(filter_userscripts);
348352

349353
$('#loginbutton').on('click', login);

0 commit comments

Comments
 (0)