-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d760a04
commit 4369dad
Showing
8 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
body { | ||
width: 768px; | ||
background-color: #333; | ||
overflow-x: hidden; | ||
-ms-overflow-x: hidden; | ||
} | ||
|
||
#searchbar { | ||
border-style: none; | ||
padding: 5px; | ||
width: 758px; | ||
font-size: 20px; | ||
background-color: inherit; | ||
color: #3CF; | ||
} | ||
|
||
#searchresults { | ||
width: inherit; | ||
font-size: 20px; | ||
} | ||
|
||
.result { | ||
font-family: "Helvetica", sans-serif; | ||
border-width: 1px; | ||
border-style: none none dotted none; | ||
border-color: #3CF; | ||
color: #CCC; | ||
} | ||
|
||
.match { | ||
color: #3CF; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="/css/options.css"> | ||
<script type="text/javascript" src="/js/options.js"></script> | ||
</head> | ||
<body> | ||
<h1>Options</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="/css/popup.css"> | ||
<script src="/js/jquery-1.11.0.min.js"></script> | ||
<script src="/js/popup.js"></script> | ||
</head> | ||
<body> | ||
<input id="searchbar" | ||
type="text" | ||
autocomplete="on" | ||
autofocus | ||
name="search" | ||
placeholder="What can I get you?"> | ||
<div id="searchresults"> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) | ||
{ | ||
switch(request.type) | ||
{ | ||
|
||
} | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
$(document).ready(function() | ||
{ | ||
var $searchbar = $("#searchbar"); | ||
var $searchresults = $("#searchresults"); | ||
|
||
var results = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', | ||
'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', | ||
'rho', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']; | ||
|
||
updateresults(results, ""); | ||
|
||
$searchbar.on("input", function() | ||
{ | ||
var text = $searchbar.val(); | ||
|
||
/*function validate(value, index, array) | ||
{ | ||
var pattern = /[\w ():-]/gi; | ||
var check = pattern.test(value); | ||
return check; | ||
} | ||
var text = $searchbar.val(); | ||
var filtered = [].filter.call(text, validate).join(""); | ||
$searchbar.val(filtered);*/ | ||
updateresults(results, text.split("")); | ||
}); | ||
|
||
function updateresults(results, chars) | ||
{ | ||
$searchresults.empty(); | ||
|
||
if (chars.length === 0) | ||
{ | ||
addresults(results); | ||
} | ||
else | ||
{ | ||
var patternstring = ""; | ||
for (var i in chars) | ||
{ | ||
var c = chars[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
patternstring += "([^" + c + "]*)(" + c + ")"; | ||
} | ||
patternstring += "(.*)"; | ||
var pattern = new RegExp(patternstring, "i"); | ||
for (var i in results) | ||
{ | ||
var result = results[i]; | ||
var matches = pattern.exec(result); | ||
if (!matches) continue; | ||
var divcontents = ""; | ||
for (var j = 1; j < matches.length - 2; j += 2) | ||
{ | ||
divcontents += matches[j] + "<span class='match'>" + matches[j + 1] + "</span>"; | ||
} | ||
divcontents += matches[j]; | ||
$searchresults.append("<div class='result'>" + divcontents + "</div>"); | ||
} | ||
} | ||
|
||
if ($searchresults.is(":empty")) | ||
{ | ||
$searchresults.hide(); | ||
} | ||
else | ||
{ | ||
$searchresults.show(); | ||
} | ||
} | ||
|
||
function addresults(results) | ||
{ | ||
for (var i in results) | ||
{ | ||
var result = results[i]; | ||
$searchresults.append("<div class='result'>" + result + "</div>"); | ||
} | ||
} | ||
}); |