提交 c9ae111a 编写于 作者: D duaraghav8@gmail

Search Feature - Initial Commit

上级 05584964
......@@ -180,6 +180,21 @@ nav h3 {
box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.48), inset 0 -2px 2px rgba(0, 0, 0, 0.36);
}
input.search_bar {
box-sizing: border-box;
background: rgba(0, 0, 0, .10);
border: none;
border-bottom: 2px solid rgb(38, 38, 38);
width: 100%;
height: 30px;
color: white;
padding-left: 10px;
}
input.search_bar:focus {
outline: none;
}
.workspace {
position: absolute;
top: 30px;
......
......@@ -16,6 +16,7 @@ import babelify from 'babelify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import pkg from './package.json';
if (Number (process.version.match (/^v(\d+\.\d+)/) [1]) <= 0.10) var Promise = require ('es6-promise').Promise;
const appName = 'algorithm_visualizer';
const appEntryPoint = './js/index.js';
......
......@@ -61,6 +61,7 @@
</div>
</nav>
<section class="sidemenu active">
<input type = "text" class="search_bar" id="search-bar" autofocus/>
<div id="list">
</div>
<div id="footer">
......
'use strict';
module.exports = () => {
let $buttons = $('[data-category]');
$('#search-bar').keyup (function () {
let re = new RegExp ($(this).val (), 'i');
if ($(this).val ()) $('#footer').hide ();
else $('#footer').show ();
$.each ($('#list .category'), function (i, c) {
let $c = $(c);
!$c.hasClass ('open') && $c.click ();
});
$buttons.show ().filter (function () {
let cName = $(this).attr ('data-category');
if ($(this).hasClass ('category')) {
//return !re.test ($('[data-category="${cName}"]').text ());
return !re.test ($('[data-category="' + cName + '"]').text ());
}
else {
return !(
//re.test ($('.category[data-category="${cName}"]').text()) || re.test ($(this).text ())
re.test ($('.category[data-category="' + cName + '"]').text()) || re.test ($(this).text ())
);
}
}).hide ();
});
};
\ No newline at end of file
......@@ -7,6 +7,7 @@ const addFiles = require('./add_files');
const showFirstAlgorithm = require('./show_first_algorithm');
const showRequestedAlgorithm = require('./show_requested_algorithm');
const showWiki = require('./show_wiki');
const enableSearch = require('./enable_search');
module.exports = {
showAlgorithm,
......@@ -15,5 +16,6 @@ module.exports = {
addFiles,
showFirstAlgorithm,
showRequestedAlgorithm,
showWiki
showWiki,
enableSearch
};
\ No newline at end of file
......@@ -45,6 +45,9 @@ $(() => {
app.setCategories(data);
DOM.addCategories();
//enable search feature
DOM.enableSearch ();
// determine if the app is loading a pre-existing scratch-pad
// or the home page
const {
......
......@@ -300,6 +300,21 @@ nav h3 {
box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.48), inset 0 -2px 2px rgba(0, 0, 0, 0.36);
}
input.search_bar {
box-sizing: border-box;
background: rgba(0, 0, 0, .10);
border: none;
border-bottom: 2px solid rgb(38, 38, 38);
width: 100%;
height: 30px;
color: white;
padding-left: 10px;
}
input.search_bar:focus {
outline: none;
}
.workspace {
position: absolute;
top: 30px;
......
此差异已折叠。
此差异已折叠。
......@@ -13,4 +13,4 @@
* "Fork me on GitHub" CSS ribbon v0.2.0 | MIT License
* https://github.com/simonwhitaker/github-fork-ribbon-css
*/.github-fork-ribbon{width:12.1em;height:12.1em;position:absolute;overflow:hidden;top:0;right:0;z-index:9999;pointer-events:none;font-size:13px;text-decoration:none;text-indent:-999999px}.github-fork-ribbon.fixed{position:fixed}.github-fork-ribbon:after,.github-fork-ribbon:before{position:absolute;display:block;width:15.38em;height:1.54em;top:3.23em;right:-3.23em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.github-fork-ribbon:before{content:"";padding:.38em 0;background-color:#a00;background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,0)),to(rgba(0,0,0,.15)));background-image:-webkit-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.15));background-image:linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,.15));box-shadow:0 .15em .23em 0 rgba(0,0,0,.5);pointer-events:auto}.github-fork-ribbon:after{content:attr(title);color:#fff;font:700 1em "Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.54em;text-decoration:none;text-shadow:0 -.08em rgba(0,0,0,.5);text-align:center;text-indent:0;padding:.15em 0;margin:.15em 0;border-width:.08em 0;border-style:dotted;border-color:#fff;border-color:rgba(255,255,255,.7)}.github-fork-ribbon.left-bottom,.github-fork-ribbon.left-top{right:auto;left:0}.github-fork-ribbon.left-bottom,.github-fork-ribbon.right-bottom{top:auto;bottom:0}.github-fork-ribbon.left-bottom:after,.github-fork-ribbon.left-bottom:before,.github-fork-ribbon.left-top:after,.github-fork-ribbon.left-top:before{right:auto;left:-3.23em}.github-fork-ribbon.left-bottom:after,.github-fork-ribbon.left-bottom:before,.github-fork-ribbon.right-bottom:after,.github-fork-ribbon.right-bottom:before{top:auto;bottom:3.23em}.github-fork-ribbon.left-top:after,.github-fork-ribbon.left-top:before,.github-fork-ribbon.right-bottom:after,.github-fork-ribbon.right-bottom:before{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}
.btn,body,button{background:#3f3f3f}#explanation,.btn,button{white-space:nowrap;text-overflow:ellipsis}.tab>.wrapper,nav,pre,section{box-sizing:border-box}.btn,button,pre{margin:0;outline:0}body,html{margin:0;padding:0;overflow:hidden}body{font-family:Roboto,sans-serif;color:#bbb;-webkit-font-smoothing:subpixel-antialiased}::-webkit-scrollbar{display:none}a{text-decoration:none}*{color:inherit}:not(input){-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn{display:inline-table}.btn>.wrapper{display:table-cell;vertical-align:middle}.btn,button{cursor:pointer;vertical-align:top;border:none;height:100%;padding:0 12px;font-size:12px;overflow:hidden}.btn:hover,button:hover{background:rgba(0,0,0,.15)}.btn.active,button.active{background:#262626}.btn.active:hover,button.active:hover{background:rgba(38,38,38);color:rgba(187,187,187,.8)}button[disabled]{background:#3f3f3f;cursor:not-allowed;opacity:.6}.btn input,button input{outline:0;background:rgba(0,0,0,.3);padding:4px;border:none}.divider{position:absolute!important;z-index:3}.tab,.workspace{position:absolute}.divider.vertical{cursor:ew-resize}.divider.horizontal{cursor:ns-resize}nav{height:30px;width:100%;padding:0 16px}nav h3{display:inline}.nav-arrow{padding:0 4px}#navigation span:empty+.nav-arrow{display:none}.top-menu-buttons{float:right;height:100%}#shared{width:128px}#shared.collapse{display:none}#interval{width:24px;text-align:right}.sidemenu{top:30px;right:85%;visibility:hidden;overflow:scroll;padding-bottom:120px}.sidemenu.active{visibility:visible}.sidemenu #footer{border-top:2px solid #262626}.sidemenu button{display:block;width:100%;height:30px;text-align:left;background:rgba(0,0,0,.15)}.sidemenu button:hover{background:#3f3f3f}.sidemenu button.active,.sidemenu button.active:hover{background:#262626}.sidemenu button.indent{padding-left:28px}.sidemenu .algorithms{display:none;padding:3px 2px;box-shadow:inset 0 2px 2px rgba(0,0,0,.48),inset 0 -2px 2px rgba(0,0,0,.36)}.workspace{top:30px;bottom:0;left:15%;right:0}.editor_container,.viewer_container,nav,section{position:absolute;top:0;bottom:0;left:0;right:0}nav,section{border:1px solid #262626}.viewer_container{right:50%}.editor_container{left:50%}.module_container{overflow:hidden;border:none}.tab_container{top:30px;background:#242424;border:1px solid #505050;border-top:none}.tab{width:100%;height:100%;visibility:hidden;overflow:scroll}.tab>.wrapper{padding:16px}.tab.active{visibility:visible}.module_wrapper{overflow:scroll;font-family:monospace;border:none;border-bottom:1px solid #505050}.module_wrapper .name{position:fixed;z-index:5;padding:4px;font-size:14px;background:rgba(0,0,0,.4)}.files_bar>*,.toast_container{position:absolute}.module_wrapper>.wrapper{padding:24px 16px;box-sizing:border-box}#tab_desc h3{border-bottom:1px solid #515151;padding:5px;margin:2px}#tab_desc>.wrapper a,#tab_doc>.wrapper a{text-decoration:underline}.tab_bar{height:30px;border-left:none;border-bottom:1px solid #505050}.files_bar button,.tab_bar button{height:29px;border-top-left-radius:3px;border-top-right-radius:3px}.files_bar button.active,.tab_bar button.active{border:1px solid #505050;border-bottom:none}.files_bar{height:30px;border-bottom:1px solid #505050}.files_bar>button{width:30px}.files_bar .btn-left{left:0}.files_bar .btn-right{right:0}.files_bar>.wrapper{left:30px;right:30px;overflow:scroll;white-space:nowrap}.files_bar>.wrapper>button{max-width:80%}.files_bar>.wrapper.shadow-left{box-shadow:inset 16px 0 16px -16px rgba(0,0,0,.6)}.files_bar>.wrapper.shadow-right{box-shadow:inset -16px 0 16px -16px rgba(0,0,0,.6)}.files_bar>.wrapper.shadow-left.shadow-right{box-shadow:inset 16px 0 16px -16px rgba(0,0,0,.6),inset -16px 0 16px -16px rgba(0,0,0,.6)}.explanation_container{border:none;top:30px;height:30px;background:#262626;padding:8px;font-size:12px}#explanation:before{font-family:FontAwesome;content:'\f05a\00a0\00a0'}#explanation{display:block;overflow:hidden}.explanation_container:hover{z-index:5;height:auto;bottom:auto;box-shadow:0 8px 8px -8px rgba(0,0,0,.8)}.explanation_container:hover #explanation{white-space:normal}.data_container{top:60px;bottom:60%}.code_container{top:40%}pre{height:100%;width:100%;padding:0;border:1px solid #515151;background:#2b2b2b;resize:none}.toast_container{bottom:0;right:0;padding:12px;z-index:4}.toast{width:280px;border:1px solid;border-radius:4px;padding:16px;margin:16px}.toast.error{border-color:#960000;background:rgba(120,0,0,.8)}.toast.info{border-color:#009600;background:rgba(0,120,0,.8)}.github-fork-ribbon{position:fixed}#loading-slider,.break,.executing,.line{position:absolute}.github-fork-ribbon.left-bottom:before{background-color:#333}.fa-spin-faster{-webkit-animation:fa-spin 1s infinite ease-in-out;animation:fa-spin 1s infinite ease-in-out}.mtbl-wrapper{width:100%;height:100%}.mtbl-table{display:inline-table;color:#fff;table-layout:fixed;border:1px solid #505050}.mtbl-row{display:table-row}.mtbl-col{display:table-cell;vertical-align:middle;text-align:center;background:#888}.mtbl-empty-row{display:table-row;background:#3f3f3f;height:2px}.mtbl-empty-col{display:table-cell;background:#3f3f3f;width:2px}.mtbl-col.selected{background:#2962ff}.mtbl-col.notified{background:#c51162}.mchrt-chart{width:100%;height:100%}#loading-slider{z-index:6;width:100%;height:2px}#loading-slider.loaded{visibility:hidden}.line{background:#4a8df8;width:100%;left:0;right:0;top:0;height:3px}.break{background:#222;width:6px;height:2px}.dot1{-webkit-animation:loading 2s infinite;animation:loading 2s infinite}.dot2{-webkit-animation:loading 2s .5s infinite;animation:loading 2s .5s infinite}.dot3{-webkit-animation:loading 2s 1s infinite;animation:loading 2s 1s infinite}@-webkit-keyframes loading{from{left:0}to{left:100%}}@keyframes loading{from{left:0}to{left:100%}}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.applications li,.complexity{margin:10px 0}.complexity-type,.top-menu-buttons button.active{font-weight:700}.top-menu-buttons button.active .fa{color:#00e676}#btn_pause>.btn-text:before{content:'Pause'}#btn_pause.active>.btn-text:before{content:'Resume'}#btn_pause{width:86px}.top-menu-buttons button.active,.top-menu-buttons button:active{box-shadow:0 0 10px 3px #1a1a1a inset}.executing{background:rgba(0,174,255,.4);border:1px solid #0091ea;width:100%!important;left:0!important;-webkit-animation:line_highlight .1s;animation:line_highlight .1s}@-webkit-keyframes line_highlight{from{background:rgba(0,174,255,.1)}to{background:rgba(0,174,255,.4)}}@keyframes line_highlight{from{background:rgba(0,174,255,.1)}to{background:rgba(0,174,255,.4)}}.ace_editor{border-left:none;border-bottom:none}
\ No newline at end of file
.btn,body,button,html{overflow:hidden;margin:0}.btn,body,button{background:#3f3f3f}#explanation,.btn,button{white-space:nowrap;text-overflow:ellipsis}.tab>.wrapper,input.search_bar,nav,pre,section{box-sizing:border-box}.btn,button,input.search_bar:focus,pre{outline:0}body,html{padding:0}body{font-family:Roboto,sans-serif;color:#bbb;-webkit-font-smoothing:subpixel-antialiased}::-webkit-scrollbar{display:none}a{text-decoration:none}*{color:inherit}:not(input){-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn{display:inline-table}.btn>.wrapper{display:table-cell;vertical-align:middle}.btn,button{cursor:pointer;vertical-align:top;border:none;height:100%;padding:0 12px;font-size:12px}.btn:hover,button:hover{background:rgba(0,0,0,.15)}.btn.active,button.active{background:#262626}.btn.active:hover,button.active:hover{background:rgba(38,38,38);color:rgba(187,187,187,.8)}button[disabled]{background:#3f3f3f;cursor:not-allowed;opacity:.6}.btn input,button input{outline:0;background:rgba(0,0,0,.3);padding:4px;border:none}.divider{position:absolute!important;z-index:3}.tab,.workspace{position:absolute}.divider.vertical{cursor:ew-resize}.divider.horizontal{cursor:ns-resize}nav{height:30px;width:100%;padding:0 16px}nav h3{display:inline}.nav-arrow{padding:0 4px}#navigation span:empty+.nav-arrow{display:none}.top-menu-buttons{float:right;height:100%}#shared{width:128px}#shared.collapse{display:none}#interval{width:24px;text-align:right}.sidemenu{top:30px;right:85%;visibility:hidden;overflow:scroll;padding-bottom:120px}.sidemenu.active{visibility:visible}.sidemenu #footer{border-top:2px solid #262626}.sidemenu button{display:block;width:100%;height:30px;text-align:left;background:rgba(0,0,0,.15)}.sidemenu button:hover{background:#3f3f3f}.sidemenu button.active,.sidemenu button.active:hover{background:#262626}.sidemenu button.indent{padding-left:28px}.sidemenu .algorithms{display:none;padding:3px 2px;box-shadow:inset 0 2px 2px rgba(0,0,0,.48),inset 0 -2px 2px rgba(0,0,0,.36)}input.search_bar{background:rgba(0,0,0,.1);border:none;border-bottom:2px solid #262626;width:100%;height:30px;color:#fff;padding-left:10px}.workspace{top:30px;bottom:0;left:15%;right:0}.editor_container,.viewer_container,nav,section{position:absolute;top:0;bottom:0;left:0;right:0}nav,section{border:1px solid #262626}.viewer_container{right:50%}.editor_container{left:50%}.module_container{overflow:hidden;border:none}.tab_container{top:30px;background:#242424;border:1px solid #505050;border-top:none}.tab{width:100%;height:100%;visibility:hidden;overflow:scroll}.tab>.wrapper{padding:16px}.tab.active{visibility:visible}.module_wrapper{overflow:scroll;font-family:monospace;border:none;border-bottom:1px solid #505050}.module_wrapper .name{position:fixed;z-index:5;padding:4px;font-size:14px;background:rgba(0,0,0,.4)}.files_bar>*,.toast_container{position:absolute}.module_wrapper>.wrapper{padding:24px 16px;box-sizing:border-box}#tab_desc h3{border-bottom:1px solid #515151;padding:5px;margin:2px}#tab_desc>.wrapper a,#tab_doc>.wrapper a{text-decoration:underline}.tab_bar{height:30px;border-left:none;border-bottom:1px solid #505050}.files_bar button,.tab_bar button{height:29px;border-top-left-radius:3px;border-top-right-radius:3px}.files_bar button.active,.tab_bar button.active{border:1px solid #505050;border-bottom:none}.files_bar{height:30px;border-bottom:1px solid #505050}.files_bar>button{width:30px}.files_bar .btn-left{left:0}.files_bar .btn-right{right:0}.files_bar>.wrapper{left:30px;right:30px;overflow:scroll;white-space:nowrap}.files_bar>.wrapper>button{max-width:80%}.files_bar>.wrapper.shadow-left{box-shadow:inset 16px 0 16px -16px rgba(0,0,0,.6)}.files_bar>.wrapper.shadow-right{box-shadow:inset -16px 0 16px -16px rgba(0,0,0,.6)}.files_bar>.wrapper.shadow-left.shadow-right{box-shadow:inset 16px 0 16px -16px rgba(0,0,0,.6),inset -16px 0 16px -16px rgba(0,0,0,.6)}.explanation_container{border:none;top:30px;height:30px;background:#262626;padding:8px;font-size:12px}#explanation:before{font-family:FontAwesome;content:'\f05a\00a0\00a0'}#explanation{display:block;overflow:hidden}.explanation_container:hover{z-index:5;height:auto;bottom:auto;box-shadow:0 8px 8px -8px rgba(0,0,0,.8)}.explanation_container:hover #explanation{white-space:normal}.data_container{top:60px;bottom:60%}.code_container{top:40%}pre{height:100%;width:100%;margin:0;padding:0;border:1px solid #515151;background:#2b2b2b;resize:none}.toast_container{bottom:0;right:0;padding:12px;z-index:4}.toast{width:280px;border:1px solid;border-radius:4px;padding:16px;margin:16px}.toast.error{border-color:#960000;background:rgba(120,0,0,.8)}.toast.info{border-color:#009600;background:rgba(0,120,0,.8)}.github-fork-ribbon{position:fixed}#loading-slider,.break,.executing,.line{position:absolute}.github-fork-ribbon.left-bottom:before{background-color:#333}.fa-spin-faster{-webkit-animation:fa-spin 1s infinite ease-in-out;animation:fa-spin 1s infinite ease-in-out}.mtbl-wrapper{width:100%;height:100%}.mtbl-table{display:inline-table;color:#fff;table-layout:fixed;border:1px solid #505050}.mtbl-row{display:table-row}.mtbl-col{display:table-cell;vertical-align:middle;text-align:center;background:#888}.mtbl-empty-row{display:table-row;background:#3f3f3f;height:2px}.mtbl-empty-col{display:table-cell;background:#3f3f3f;width:2px}.mtbl-col.selected{background:#2962ff}.mtbl-col.notified{background:#c51162}.mchrt-chart{width:100%;height:100%}#loading-slider{z-index:6;width:100%;height:2px}#loading-slider.loaded{visibility:hidden}.line{background:#4a8df8;width:100%;left:0;right:0;top:0;height:3px}.break{background:#222;width:6px;height:2px}.dot1{-webkit-animation:loading 2s infinite;animation:loading 2s infinite}.dot2{-webkit-animation:loading 2s .5s infinite;animation:loading 2s .5s infinite}.dot3{-webkit-animation:loading 2s 1s infinite;animation:loading 2s 1s infinite}@-webkit-keyframes loading{from{left:0}to{left:100%}}@keyframes loading{from{left:0}to{left:100%}}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.applications li,.complexity{margin:10px 0}.complexity-type,.top-menu-buttons button.active{font-weight:700}.top-menu-buttons button.active .fa{color:#00e676}#btn_pause>.btn-text:before{content:'Pause'}#btn_pause.active>.btn-text:before{content:'Resume'}#btn_pause{width:86px}.top-menu-buttons button.active,.top-menu-buttons button:active{box-shadow:0 0 10px 3px #1a1a1a inset}.executing{background:rgba(0,174,255,.4);border:1px solid #0091ea;width:100%!important;left:0!important;-webkit-animation:line_highlight .1s;animation:line_highlight .1s}@-webkit-keyframes line_highlight{from{background:rgba(0,174,255,.1)}to{background:rgba(0,174,255,.4)}}@keyframes line_highlight{from{background:rgba(0,174,255,.1)}to{background:rgba(0,174,255,.4)}}.ace_editor{border-left:none;border-bottom:none}
\ No newline at end of file
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册