Skip to content
Browse files

Fixing built css image url paths. Fixing timing on hiding autocomplet…

…e menu when switching from input to facet. Fixing select all to highlight input text.
  • Loading branch information...
1 parent a7ad6b5 commit 6e0fc5d23aead9d138b58194a408fd97637b1466 @samuelclay samuelclay committed Jun 21, 2011
View
11 Rakefile
@@ -18,6 +18,17 @@ task :build do
# Move the JSTs back to lib to accomodate the demo page.
FileUtils.mv("build/visualsearch_templates.js", "lib/js/templates/templates.js")
+
+ # Fix image url paths.
+ ['build', 'build-min'].each do |build|
+ File.open("#{build}/visualsearch.css", 'r+') do |file|
+ css = file.read
+ css.gsub!(/url\((.*?)images\/embed\/icons/, 'url(../images/embed/icons')
+ file.rewind
+ file.write(css)
+ file.truncate(css.length)
+ end
+ end
end
desc "Build the docco documentation"
View
BIN build-min/dependencies.js.gz
Binary file not shown.
View
2 build-min/visualsearch-datauri.css
@@ -1 +1 @@
-.VS-search .icon{background-repeat:no-repeat;background-position:center center;vertical-align:middle;width:16px;height:16px}.VS-search .icon.VS-icon-cancel{width:11px;height:11px;background-position:center 0;background-image:url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAWCAYAAAAW5GZjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAb9JREFUeNqUUr1qAkEQ3j0khQp6kihaeGgEEa18gTQR0iRY+BaBSMDGwidIEUKqFL6BopgqBAJ5AMFGjUU0d4WHEvwJarvZ77gRIzGYgb1hZr+Z75vZ40IIzqTNZrPj8Xicn0wmmcViEXS73aaqqq+BQODG6/W+A8MBNk3zfDAY3C6Xy0O2ZS6X6zMSiVwHg8FHLjtq7Xb7RQKj7BeTzVCgJ5PJU2U0GhUk7REuMpkMi8fjFggeMeecrVYrFRId0CgTAgDDMFg4HLbA8IjJgHNgGEr0er0fQIphUmZAwdSUADUB4RFDsz3oSMF6CLzZkQqgGebz+Z75dDqNdTqdp13bgDmdTj2VSp0oWHg0Gr2UNH2Z/9o+yMv7K4/HY/C/XhDUfr//jl7QQVT9fp/V63VWqVRYt9tliUSCZbPZg1wux9Lp9PqFeK1Wu9A0DdXz7YM87i0FrVZLs4Fi1wmFQh/NZjOmVKvVgq7rR/QflMtlixGedjwcDlUpMQ9tbzalkAAB2/R297mNW+sT2wUbUnA//V/nYrH4QOBNABUQuFQq3TNMuc82sDVrz41G42yvPeODAwZQ0QzwiJEnzLcAAwBJ6WXlwoBgZAAAAABJRU5ErkJggg==");cursor:pointer}.VS-search .icon.VS-icon-cancel:hover{background-position:center -11px}.VS-search .icon.VS-icon-search{width:12px;height:12px;background-image:url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAUZJREFUeNpUUM2qgmAQzS8NiUgLzTIXLZQW1QuI9AY9QPSW9gQ9QiriwpJQEBVrVWT2d7p2L9xZzDdzZs7M+YYqy/J8Ptu2vd/v4zgeDAaqqk4mE47jar9GnU6nzWbjOA5FUa/Xq0Jns9l8Pud5vkpp58cwAOzhcBhFkeu6GNztdg3D+Db5vo9nOp2iiWGYTqdDCMFe4LquI0aVpGmKR9M0lmUbjQY8YiBJklTb4YkoilBzOBzq9TogeMQIJEmqmlAlo9EIyXa7tSyrKAp4xEBkWUb5q2k8Hh+PR8/zwjCEgufz+aESstvtoKnVan2GgY31kBkEAfT1ej1FUZDiNIIgrFYr9H1ug3teLpfH43G/3/FBUJGu1+s8z8FZLpc0mmiabrfbf5fEumazuVgsTNO8Xq+3242qRNT+G0CMz7IMzH6//xZgAA60tj6rqzxpAAAAAElFTkSuQmCC")}.VS-search div,.VS-search span,.VS-search a,.VS-search img,.VS-search ul,.VS-search li,.VS-search form,.VS-search label,.ui-autocomplete ul,.ui-autocomplete li,.ui-autocomplete{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}.VS-search :focus{outline:0}.VS-search{line-height:1;color:black}.VS-search ol,.VS-search ul{list-style:none}.VS-search{font-family:Arial,sans-serif;color:#373737;font-size:12px}.VS-search input{display:block;border:none;outline:none;margin:0;padding:4px;background:transparent;font-size:16px;line-height:20px;width:100%}.VS-interface,.VS-search .dialog,.VS-search input{font-family:"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,sans-serif!important;line-height:1.1em}.VS-search .VS-search-box{cursor:text;position:relative;background:transparent;border:2px solid #ccc;border-radius:16px;-webkit-border-radius:16px;-moz-border-radius:16px;background-color:#fafafa;-webkit-box-shadow:inset 0 0 3px #ccc;-moz-box-shadow:inset 0 0 3px #ccc;box-shadow:inset 0 0 3px #ccc;min-height:29px;height:auto}.VS-search .VS-search-box.VS-focus{border-color:#acf;-webkit-box-shadow:inset 0 0 3px #acf;-moz-box-shadow:inset 0 0 3px #acf;box-shadow:inset 0 0 3px #acf}.VS-search .search_inner{position:relative;margin:0 0 0 18px;padding:0 3px;overflow:hidden}.VS-search input{width:100px}.VS-search input,.VS-search .VS-input-width-tester{padding:6px 0;float:left;color:#808080;font:13px/17px Helvetica,Arial}.VS-search.VS-focus input{color:#606060}.VS-search .VS-icon-search{position:absolute;left:9px;top:8px}.VS-search .VS-icon-cancel{position:absolute;right:9px;top:8px}.VS-search .search_facet{float:left;margin:0;padding:0 0 0 13px;position:relative}.VS-search .search_facet.is_selected{margin:5px -3px 5px -3px;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.VS-search .search_facet.is_selected{background-color:#a7b9ff;background-image:-moz-linear-gradient(top,#b0bcff,#7489ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#b0bcff),to(#7489ff));background-image:linear-gradient(top,#b0bcff,#7489ff)}.VS-search .search_facet .category{float:left;text-transform:uppercase;font-weight:bold;font-size:10px;color:#808080;text-shadow:1px 1px 0 #FFF;padding:9px 0 6px;line-height:13px;cursor:pointer}.VS-search .search_facet.is_selected .category{padding:4px 0 0;margin-left:3px;text-shadow:1px 1px 0 #d0d0d0}.VS-search .search_facet .search_facet_input_container{float:left}.VS-search .search_facet input{margin:0;padding:0;color:#000;font-size:13px;line-height:16px;padding:6px 0 7px 4px;height:16px;width:auto;z-index:100;position:relative}.VS-search .search_facet.is_selected input{padding-top:1px;padding-bottom:2px;padding-right:3px}.VS-search .search_facet.is_editing input,.VS-search .search_facet.is_selected input{color:#000}.VS-search .search_facet .search_facet_remove{position:absolute;left:0;top:9px;opacity:.6}.VS-search .search_facet.is_selected .search_facet_remove{top:4px;left:3px}.VS-search .search_facet .search_facet_remove:hover{opacity:1}.VS-search .search_facet.is_editing .category,.VS-search .search_facet.is_selected .category{color:darkblue}.VS-search .search_facet.search_facet_maybe_delete .category,.VS-search .search_facet.search_facet_maybe_delete input{color:darkred}.VS-search .search_input{height:28px;float:left}.VS-search .search_input input{padding:6px 2px 7px 2px;width:10px;z-index:100;position:relative}.VS-search .search_input.is_editing input{color:#202020}.VS-interface.ui-autocomplete{position:absolute;border:1px solid #c0c0c0;border-top:1px solid #d9d9d9;background-color:#f6f6f6;cursor:pointer;z-index:10000;width:auto;min-width:80px;max-width:220px;max-height:240px;overflow-y:auto;overflow-x:hidden;font-size:13px;top:1px;opacity:.97;box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-webkit-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-moz-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5)}.VS-interface.ui-autocomplete .ui-autocomplete-category{text-transform:capitalize;font-size:11px;padding:4px 4px 4px;border-top:1px solid #a2a2a2;border-bottom:1px solid #a2a2a2;background-color:#b7b7b7;text-shadow:0 -1px 0 #999;font-weight:bold;color:white;cursor:default}.VS-interface.ui-autocomplete .ui-menu-item a{outline:none;display:block;padding:3px 4px 5px;background-color:#f8f8f8;background-image:-moz-linear-gradient(top,#f8f8f8,#f3f3f3);background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f3f3f3));background-image:linear-gradient(top,#f8f8f8,#f3f3f3);border-top:1px solid #fafafa;border-bottom:1px solid #f2f2f2}.VS-interface.ui-autocomplete .ui-menu-item a:active{outline:none}.VS-interface.ui-autocomplete .ui-menu-item .ui-state-hover{background-color:#6483f7;background-image:-moz-linear-gradient(top,#6483f7,#2254f6);background-image:-webkit-gradient(linear,left top,left bottom,from(#6483f7),to(#2254f6));background-image:linear-gradient(top,#6483f7,#2254f6);border-top:1px solid #5a7bee;border-bottom:1px solid #1048ec;color:white}.VS-interface.ui-autocomplete li{list-style:none;width:auto}
+.VS-search .icon{background-repeat:no-repeat;background-position:center center;vertical-align:middle;width:16px;height:16px}.VS-search .icon.VS-icon-cancel{width:11px;height:11px;background-position:center 0;background-image:url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAWCAYAAAAW5GZjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAb9JREFUeNqUUr1qAkEQ3j0khQp6kihaeGgEEa18gTQR0iRY+BaBSMDGwidIEUKqFL6BopgqBAJ5AMFGjUU0d4WHEvwJarvZ77gRIzGYgb1hZr+Z75vZ40IIzqTNZrPj8Xicn0wmmcViEXS73aaqqq+BQODG6/W+A8MBNk3zfDAY3C6Xy0O2ZS6X6zMSiVwHg8FHLjtq7Xb7RQKj7BeTzVCgJ5PJU2U0GhUk7REuMpkMi8fjFggeMeecrVYrFRId0CgTAgDDMFg4HLbA8IjJgHNgGEr0er0fQIphUmZAwdSUADUB4RFDsz3oSMF6CLzZkQqgGebz+Z75dDqNdTqdp13bgDmdTj2VSp0oWHg0Gr2UNH2Z/9o+yMv7K4/HY/C/XhDUfr//jl7QQVT9fp/V63VWqVRYt9tliUSCZbPZg1wux9Lp9PqFeK1Wu9A0DdXz7YM87i0FrVZLs4Fi1wmFQh/NZjOmVKvVgq7rR/QflMtlixGedjwcDlUpMQ9tbzalkAAB2/R297mNW+sT2wUbUnA//V/nYrH4QOBNABUQuFQq3TNMuc82sDVrz41G42yvPeODAwZQ0QzwiJEnzLcAAwBJ6WXlwoBgZAAAAABJRU5ErkJggg==");cursor:pointer}.VS-search .icon.VS-icon-cancel:hover{background-position:center -11px}.VS-search .icon.VS-icon-search{width:12px;height:12px;background-image:url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAUZJREFUeNpUUM2qgmAQzS8NiUgLzTIXLZQW1QuI9AY9QPSW9gQ9QiriwpJQEBVrVWT2d7p2L9xZzDdzZs7M+YYqy/J8Ptu2vd/v4zgeDAaqqk4mE47jar9GnU6nzWbjOA5FUa/Xq0Jns9l8Pud5vkpp58cwAOzhcBhFkeu6GNztdg3D+Db5vo9nOp2iiWGYTqdDCMFe4LquI0aVpGmKR9M0lmUbjQY8YiBJklTb4YkoilBzOBzq9TogeMQIJEmqmlAlo9EIyXa7tSyrKAp4xEBkWUb5q2k8Hh+PR8/zwjCEgufz+aESstvtoKnVan2GgY31kBkEAfT1ej1FUZDiNIIgrFYr9H1ug3teLpfH43G/3/FBUJGu1+s8z8FZLpc0mmiabrfbf5fEumazuVgsTNO8Xq+3242qRNT+G0CMz7IMzH6//xZgAA60tj6rqzxpAAAAAElFTkSuQmCC")}.VS-search div,.VS-search span,.VS-search a,.VS-search img,.VS-search ul,.VS-search li,.VS-search form,.VS-search label,.ui-autocomplete ul,.ui-autocomplete li,.ui-autocomplete{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}.VS-search :focus{outline:0}.VS-search{line-height:1;color:black}.VS-search ol,.VS-search ul{list-style:none}.VS-search{font-family:Arial,sans-serif;color:#373737;font-size:12px}.VS-search input{display:block;border:none;outline:none;margin:0;padding:4px;background:transparent;font-size:16px;line-height:20px;width:100%}.VS-interface,.VS-search .dialog,.VS-search input{font-family:"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,sans-serif!important;line-height:1.1em}.VS-search .VS-search-box{cursor:text;position:relative;background:transparent;border:2px solid #ccc;border-radius:16px;-webkit-border-radius:16px;-moz-border-radius:16px;background-color:#fafafa;-webkit-box-shadow:inset 0 0 3px #ccc;-moz-box-shadow:inset 0 0 3px #ccc;box-shadow:inset 0 0 3px #ccc;min-height:29px;height:auto}.VS-search .VS-search-box.VS-focus{border-color:#acf;-webkit-box-shadow:inset 0 0 3px #acf;-moz-box-shadow:inset 0 0 3px #acf;box-shadow:inset 0 0 3px #acf}.VS-search .search_inner{position:relative;margin:0 0 0 18px;padding:0 3px;overflow:hidden}.VS-search input{width:100px}.VS-search input,.VS-search .VS-input-width-tester{padding:6px 0;float:left;color:#808080;font:13px/17px Helvetica,Arial}.VS-search.VS-focus input{color:#606060}.VS-search .VS-icon-search{position:absolute;left:9px;top:8px}.VS-search .VS-icon-cancel{position:absolute;right:9px;top:8px}.VS-search .search_facet{float:left;margin:0;padding:0 0 0 13px;position:relative}.VS-search .search_facet.is_selected{margin:5px -3px 5px -3px;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.VS-search .search_facet.is_selected{background-color:#a7b9ff;background-image:-moz-linear-gradient(top,#b0bcff,#7489ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#b0bcff),to(#7489ff));background-image:linear-gradient(top,#b0bcff,#7489ff)}.VS-search .search_facet .category{float:left;text-transform:uppercase;font-weight:bold;font-size:10px;color:#808080;text-shadow:1px 1px 0 #FFF;padding:9px 0 6px;line-height:13px;cursor:pointer}.VS-search .search_facet.is_selected .category{padding:4px 0 0;margin-left:3px;text-shadow:1px 1px 0 #d0d0d0}.VS-search .search_facet .search_facet_input_container{float:left}.VS-search .search_facet input{margin:0;padding:0;color:#000;font-size:13px;line-height:16px;padding:6px 0 7px 4px;height:16px;width:auto;z-index:100;position:relative}.VS-search .search_facet.is_selected input{padding-top:1px;padding-bottom:2px;padding-right:3px}.VS-search .search_facet.is_editing input,.VS-search .search_facet.is_selected input{color:#000}.VS-search .search_facet .search_facet_remove{position:absolute;left:0;top:9px;opacity:.6}.VS-search .search_facet.is_selected .search_facet_remove{top:4px;left:3px;opacity:.4;background-position:center -11px}.VS-search .search_facet .search_facet_remove:hover{opacity:1}.VS-search .search_facet.is_editing .category,.VS-search .search_facet.is_selected .category{color:darkblue}.VS-search .search_facet.search_facet_maybe_delete .category,.VS-search .search_facet.search_facet_maybe_delete input{color:darkred}.VS-search .search_input{height:28px;float:left}.VS-search .search_input input{padding:6px 2px 7px 2px;width:10px;z-index:100;position:relative}.VS-search .search_input.is_editing input{color:#202020}.VS-interface.ui-autocomplete{position:absolute;border:1px solid #c0c0c0;border-top:1px solid #d9d9d9;background-color:#f6f6f6;cursor:pointer;z-index:10000;width:auto;min-width:80px;max-width:220px;max-height:240px;overflow-y:auto;overflow-x:hidden;font-size:13px;top:1px;opacity:.97;box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-webkit-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-moz-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5)}.VS-interface.ui-autocomplete .ui-autocomplete-category{text-transform:capitalize;font-size:11px;padding:4px 4px 4px;border-top:1px solid #a2a2a2;border-bottom:1px solid #a2a2a2;background-color:#b7b7b7;text-shadow:0 -1px 0 #999;font-weight:bold;color:white;cursor:default}.VS-interface.ui-autocomplete .ui-menu-item a{outline:none;display:block;padding:3px 4px 5px;background-color:#f8f8f8;background-image:-moz-linear-gradient(top,#f8f8f8,#f3f3f3);background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f3f3f3));background-image:linear-gradient(top,#f8f8f8,#f3f3f3);border-top:1px solid #fafafa;border-bottom:1px solid #f2f2f2}.VS-interface.ui-autocomplete .ui-menu-item a:active{outline:none}.VS-interface.ui-autocomplete .ui-menu-item .ui-state-hover{background-color:#6483f7;background-image:-moz-linear-gradient(top,#6483f7,#2254f6);background-image:-webkit-gradient(linear,left top,left bottom,from(#6483f7),to(#2254f6));background-image:linear-gradient(top,#6483f7,#2254f6);border-top:1px solid #5a7bee;border-bottom:1px solid #1048ec;color:white}.VS-interface.ui-autocomplete li{list-style:none;width:auto}
View
BIN build-min/visualsearch-datauri.css.gz
Binary file not shown.
View
2 build-min/visualsearch.css
@@ -1 +1 @@
-.VS-search .icon{background-repeat:no-repeat;background-position:center center;vertical-align:middle;width:16px;height:16px}.VS-search .icon.VS-icon-cancel{width:11px;height:11px;background-position:center 0;background-image:url(../Users/conesus/cloud/visualsearch/lib/images/embed/icons/cancel_search.png?1308268129);cursor:pointer}.VS-search .icon.VS-icon-cancel:hover{background-position:center -11px}.VS-search .icon.VS-icon-search{width:12px;height:12px;background-image:url(../Users/conesus/cloud/visualsearch/lib/images/embed/icons/search_glyph.png?1308268129)}.VS-search div,.VS-search span,.VS-search a,.VS-search img,.VS-search ul,.VS-search li,.VS-search form,.VS-search label,.ui-autocomplete ul,.ui-autocomplete li,.ui-autocomplete{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}.VS-search :focus{outline:0}.VS-search{line-height:1;color:black}.VS-search ol,.VS-search ul{list-style:none}.VS-search{font-family:Arial,sans-serif;color:#373737;font-size:12px}.VS-search input{display:block;border:none;outline:none;margin:0;padding:4px;background:transparent;font-size:16px;line-height:20px;width:100%}.VS-interface,.VS-search .dialog,.VS-search input{font-family:"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,sans-serif!important;line-height:1.1em}.VS-search .VS-search-box{cursor:text;position:relative;background:transparent;border:2px solid #ccc;border-radius:16px;-webkit-border-radius:16px;-moz-border-radius:16px;background-color:#fafafa;-webkit-box-shadow:inset 0 0 3px #ccc;-moz-box-shadow:inset 0 0 3px #ccc;box-shadow:inset 0 0 3px #ccc;min-height:29px;height:auto}.VS-search .VS-search-box.VS-focus{border-color:#acf;-webkit-box-shadow:inset 0 0 3px #acf;-moz-box-shadow:inset 0 0 3px #acf;box-shadow:inset 0 0 3px #acf}.VS-search .search_inner{position:relative;margin:0 0 0 18px;padding:0 3px;overflow:hidden}.VS-search input{width:100px}.VS-search input,.VS-search .VS-input-width-tester{padding:6px 0;float:left;color:#808080;font:13px/17px Helvetica,Arial}.VS-search.VS-focus input{color:#606060}.VS-search .VS-icon-search{position:absolute;left:9px;top:8px}.VS-search .VS-icon-cancel{position:absolute;right:9px;top:8px}.VS-search .search_facet{float:left;margin:0;padding:0 0 0 13px;position:relative}.VS-search .search_facet.is_selected{margin:5px -3px 5px -3px;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.VS-search .search_facet.is_selected{background-color:#a7b9ff;background-image:-moz-linear-gradient(top,#b0bcff,#7489ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#b0bcff),to(#7489ff));background-image:linear-gradient(top,#b0bcff,#7489ff)}.VS-search .search_facet .category{float:left;text-transform:uppercase;font-weight:bold;font-size:10px;color:#808080;text-shadow:1px 1px 0 #FFF;padding:9px 0 6px;line-height:13px;cursor:pointer}.VS-search .search_facet.is_selected .category{padding:4px 0 0;margin-left:3px;text-shadow:1px 1px 0 #d0d0d0}.VS-search .search_facet .search_facet_input_container{float:left}.VS-search .search_facet input{margin:0;padding:0;color:#000;font-size:13px;line-height:16px;padding:6px 0 7px 4px;height:16px;width:auto;z-index:100;position:relative}.VS-search .search_facet.is_selected input{padding-top:1px;padding-bottom:2px;padding-right:3px}.VS-search .search_facet.is_editing input,.VS-search .search_facet.is_selected input{color:#000}.VS-search .search_facet .search_facet_remove{position:absolute;left:0;top:9px;opacity:.6}.VS-search .search_facet.is_selected .search_facet_remove{top:4px;left:3px}.VS-search .search_facet .search_facet_remove:hover{opacity:1}.VS-search .search_facet.is_editing .category,.VS-search .search_facet.is_selected .category{color:darkblue}.VS-search .search_facet.search_facet_maybe_delete .category,.VS-search .search_facet.search_facet_maybe_delete input{color:darkred}.VS-search .search_input{height:28px;float:left}.VS-search .search_input input{padding:6px 2px 7px 2px;width:10px;z-index:100;position:relative}.VS-search .search_input.is_editing input{color:#202020}.VS-interface.ui-autocomplete{position:absolute;border:1px solid #c0c0c0;border-top:1px solid #d9d9d9;background-color:#f6f6f6;cursor:pointer;z-index:10000;width:auto;min-width:80px;max-width:220px;max-height:240px;overflow-y:auto;overflow-x:hidden;font-size:13px;top:1px;opacity:.97;box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-webkit-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-moz-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5)}.VS-interface.ui-autocomplete .ui-autocomplete-category{text-transform:capitalize;font-size:11px;padding:4px 4px 4px;border-top:1px solid #a2a2a2;border-bottom:1px solid #a2a2a2;background-color:#b7b7b7;text-shadow:0 -1px 0 #999;font-weight:bold;color:white;cursor:default}.VS-interface.ui-autocomplete .ui-menu-item a{outline:none;display:block;padding:3px 4px 5px;background-color:#f8f8f8;background-image:-moz-linear-gradient(top,#f8f8f8,#f3f3f3);background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f3f3f3));background-image:linear-gradient(top,#f8f8f8,#f3f3f3);border-top:1px solid #fafafa;border-bottom:1px solid #f2f2f2}.VS-interface.ui-autocomplete .ui-menu-item a:active{outline:none}.VS-interface.ui-autocomplete .ui-menu-item .ui-state-hover{background-color:#6483f7;background-image:-moz-linear-gradient(top,#6483f7,#2254f6);background-image:-webkit-gradient(linear,left top,left bottom,from(#6483f7),to(#2254f6));background-image:linear-gradient(top,#6483f7,#2254f6);border-top:1px solid #5a7bee;border-bottom:1px solid #1048ec;color:white}.VS-interface.ui-autocomplete li{list-style:none;width:auto}
+.VS-search .icon{background-repeat:no-repeat;background-position:center center;vertical-align:middle;width:16px;height:16px}.VS-search .icon.VS-icon-cancel{width:11px;height:11px;background-position:center 0;background-image:url(../images/embed/icons/cancel_search.png?1308268129);cursor:pointer}.VS-search .icon.VS-icon-cancel:hover{background-position:center -11px}.VS-search .icon.VS-icon-search{width:12px;height:12px;background-image:url(../images/embed/icons/search_glyph.png?1308268129)}.VS-search div,.VS-search span,.VS-search a,.VS-search img,.VS-search ul,.VS-search li,.VS-search form,.VS-search label,.ui-autocomplete ul,.ui-autocomplete li,.ui-autocomplete{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}.VS-search :focus{outline:0}.VS-search{line-height:1;color:black}.VS-search ol,.VS-search ul{list-style:none}.VS-search{font-family:Arial,sans-serif;color:#373737;font-size:12px}.VS-search input{display:block;border:none;outline:none;margin:0;padding:4px;background:transparent;font-size:16px;line-height:20px;width:100%}.VS-interface,.VS-search .dialog,.VS-search input{font-family:"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,sans-serif!important;line-height:1.1em}.VS-search .VS-search-box{cursor:text;position:relative;background:transparent;border:2px solid #ccc;border-radius:16px;-webkit-border-radius:16px;-moz-border-radius:16px;background-color:#fafafa;-webkit-box-shadow:inset 0 0 3px #ccc;-moz-box-shadow:inset 0 0 3px #ccc;box-shadow:inset 0 0 3px #ccc;min-height:29px;height:auto}.VS-search .VS-search-box.VS-focus{border-color:#acf;-webkit-box-shadow:inset 0 0 3px #acf;-moz-box-shadow:inset 0 0 3px #acf;box-shadow:inset 0 0 3px #acf}.VS-search .search_inner{position:relative;margin:0 0 0 18px;padding:0 3px;overflow:hidden}.VS-search input{width:100px}.VS-search input,.VS-search .VS-input-width-tester{padding:6px 0;float:left;color:#808080;font:13px/17px Helvetica,Arial}.VS-search.VS-focus input{color:#606060}.VS-search .VS-icon-search{position:absolute;left:9px;top:8px}.VS-search .VS-icon-cancel{position:absolute;right:9px;top:8px}.VS-search .search_facet{float:left;margin:0;padding:0 0 0 13px;position:relative}.VS-search .search_facet.is_selected{margin:5px -3px 5px -3px;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.VS-search .search_facet.is_selected{background-color:#a7b9ff;background-image:-moz-linear-gradient(top,#b0bcff,#7489ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#b0bcff),to(#7489ff));background-image:linear-gradient(top,#b0bcff,#7489ff)}.VS-search .search_facet .category{float:left;text-transform:uppercase;font-weight:bold;font-size:10px;color:#808080;text-shadow:1px 1px 0 #FFF;padding:9px 0 6px;line-height:13px;cursor:pointer}.VS-search .search_facet.is_selected .category{padding:4px 0 0;margin-left:3px;text-shadow:1px 1px 0 #d0d0d0}.VS-search .search_facet .search_facet_input_container{float:left}.VS-search .search_facet input{margin:0;padding:0;color:#000;font-size:13px;line-height:16px;padding:6px 0 7px 4px;height:16px;width:auto;z-index:100;position:relative}.VS-search .search_facet.is_selected input{padding-top:1px;padding-bottom:2px;padding-right:3px}.VS-search .search_facet.is_editing input,.VS-search .search_facet.is_selected input{color:#000}.VS-search .search_facet .search_facet_remove{position:absolute;left:0;top:9px;opacity:.6}.VS-search .search_facet.is_selected .search_facet_remove{top:4px;left:3px;opacity:.4;background-position:center -11px}.VS-search .search_facet .search_facet_remove:hover{opacity:1}.VS-search .search_facet.is_editing .category,.VS-search .search_facet.is_selected .category{color:darkblue}.VS-search .search_facet.search_facet_maybe_delete .category,.VS-search .search_facet.search_facet_maybe_delete input{color:darkred}.VS-search .search_input{height:28px;float:left}.VS-search .search_input input{padding:6px 2px 7px 2px;width:10px;z-index:100;position:relative}.VS-search .search_input.is_editing input{color:#202020}.VS-interface.ui-autocomplete{position:absolute;border:1px solid #c0c0c0;border-top:1px solid #d9d9d9;background-color:#f6f6f6;cursor:pointer;z-index:10000;width:auto;min-width:80px;max-width:220px;max-height:240px;overflow-y:auto;overflow-x:hidden;font-size:13px;top:1px;opacity:.97;box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-webkit-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5);-moz-box-shadow:3px 4px 5px -2px rgba(0,0,0,0.5)}.VS-interface.ui-autocomplete .ui-autocomplete-category{text-transform:capitalize;font-size:11px;padding:4px 4px 4px;border-top:1px solid #a2a2a2;border-bottom:1px solid #a2a2a2;background-color:#b7b7b7;text-shadow:0 -1px 0 #999;font-weight:bold;color:white;cursor:default}.VS-interface.ui-autocomplete .ui-menu-item a{outline:none;display:block;padding:3px 4px 5px;background-color:#f8f8f8;background-image:-moz-linear-gradient(top,#f8f8f8,#f3f3f3);background-image:-webkit-gradient(linear,left top,left bottom,from(#f8f8f8),to(#f3f3f3));background-image:linear-gradient(top,#f8f8f8,#f3f3f3);border-top:1px solid #fafafa;border-bottom:1px solid #f2f2f2}.VS-interface.ui-autocomplete .ui-menu-item a:active{outline:none}.VS-interface.ui-autocomplete .ui-menu-item .ui-state-hover{background-color:#6483f7;background-image:-moz-linear-gradient(top,#6483f7,#2254f6);background-image:-webkit-gradient(linear,left top,left bottom,from(#6483f7),to(#2254f6));background-image:linear-gradient(top,#6483f7,#2254f6);border-top:1px solid #5a7bee;border-bottom:1px solid #1048ec;color:white}.VS-interface.ui-autocomplete li{list-style:none;width:auto}
View
BIN build-min/visualsearch.css.gz
Binary file not shown.
View
35 build-min/visualsearch.js
@@ -5,13 +5,13 @@
For all details and documentation:
http://documentcloud.github.com/visualsearch
*/
-(function(){var c=jQuery;if(!window.VS)window.VS={};if(!VS.app)VS.app={};if(!VS.ui)VS.ui={};if(!VS.model)VS.model={};if(!VS.utils)VS.utils={};VS.init=function(a){var b={container:"",query:"",unquotable:[],callbacks:{search:c.noop,focus:c.noop,categoryMatches:c.noop,facetMatches:c.noop}};VS.options=_.extend({},b,a);VS.options.callbacks=_.extend({},b.callbacks,a.callbacks);VS.app.hotkeys.initialize();VS.app.searchQuery=new VS.model.SearchQuery;VS.app.searchBox=new VS.ui.SearchBox(a);if(a.container){b=
-VS.app.searchBox.render().el;c(a.container).html(b)}VS.app.searchBox.value(a.query||"");c(window).bind("unload",function(){});return VS.app.searchBox}})();
+(function(){var c=jQuery;if(!window.VS)window.VS={};if(!VS.app)VS.app={};if(!VS.ui)VS.ui={};if(!VS.model)VS.model={};if(!VS.utils)VS.utils={};VS.VERSION="0.1.0";VS.init=function(a){var b={container:"",query:"",unquotable:[],callbacks:{search:c.noop,focus:c.noop,categoryMatches:c.noop,facetMatches:c.noop}};VS.options=_.extend({},b,a);VS.options.callbacks=_.extend({},b.callbacks,a.callbacks);VS.app.hotkeys.initialize();VS.app.searchQuery=new VS.model.SearchQuery;VS.app.searchBox=new VS.ui.SearchBox(a);
+if(a.container){b=VS.app.searchBox.render().el;c(a.container).html(b)}VS.app.searchBox.value(a.query||"");c(window).bind("unload",function(){});return VS.app.searchBox}})();
(function(){var c=jQuery;VS.ui.SearchBox=Backbone.View.extend({id:"search",events:{"click .VS-cancel-search-box":"clearSearch","mousedown .VS-search-box":"focusSearch","dblclick .VS-search-box":"highlightSearch","click .VS-search-box":"maybeTripleClick"},initialize:function(){this.flags={allSelected:false};this.facetViews=[];this.inputViews=[];_.bindAll(this,"renderFacets","_maybeDisableFacets","disableFacets");VS.app.searchQuery.bind("refresh",this.renderFacets);c(document).bind("keydown",this._maybeDisableFacets)},
render:function(){c(this.el).append(JST.search_box({}));c(document.body).setMode("no","search");return this},value:function(a){if(a==null)return this.getQuery();return this.setQuery(a)},getQuery:function(){var a=[],b=this.inputViews.length;VS.app.searchQuery.each(_.bind(function(d,e){a.push(this.inputViews[e].value());a.push(d.serialize())},this));b&&a.push(this.inputViews[b-1].value());return _.compact(a).join(" ")},setQuery:function(a){this.currentQuery=a;VS.app.SearchParser.parse(a);this.clearInputs()},
viewPosition:function(a){a=_.indexOf(a.type=="facet"?this.facetViews:this.inputViews,a);if(a==-1)a=0;return a},searchEvent:function(){var a=this.value();this.focusSearch();VS.options.callbacks.search(a)!==false&&this.value(a)},addFacet:function(a,b,d){a=VS.utils.inflector.trim(a);b=VS.utils.inflector.trim(b||"");if(a){var e=new VS.model.SearchFacet({category:a,value:b||""});VS.app.searchQuery.add(e,{at:d});this.renderFacets();_.detect(this.facetViews,function(f){if(f.model==e)return true}).enableEdit()}},
renderFacets:function(){this.facetViews=[];this.inputViews=[];this.$(".search_inner").empty();VS.app.searchQuery.each(_.bind(function(a,b){this.renderFacet(a,b)},this));this.renderSearchInput()},renderFacet:function(a,b){var d=new VS.ui.SearchFacet({model:a,order:b});this.renderSearchInput();this.facetViews.push(d);this.$(".search_inner").children().eq(b*2).after(d.render().el);d.calculateSize();_.defer(_.bind(d.calculateSize,d));return d},renderSearchInput:function(){var a=new VS.ui.SearchInput({position:this.inputViews.length});
-this.$(".search_inner").append(a.render().el);this.inputViews.push(a)},clearSearch:function(a){this.value("");this.flags.allSelected=false;this.focusSearch(a)},clearInputs:function(){_.each(this.inputViews,function(a){a.clear()})},selectAllFacets:function(){this.flags.allSelected=true;_.each(this.inputViews,function(a){a.selectText()});_.each(this.facetViews,function(a){a.selectFacet()});c(document).one("click.selectAllFacets",this.disableFacets)},allSelected:function(a){if(a)this.flags.allSelected=
+this.$(".search_inner").append(a.render().el);this.inputViews.push(a)},clearSearch:function(a){this.value("");this.flags.allSelected=false;this.focusSearch(a)},clearInputs:function(){_.each(this.inputViews,function(a){a.clear()})},selectAllFacets:function(){this.flags.allSelected=true;_.each(this.facetViews,function(a){a.selectFacet()});_.each(this.inputViews,function(a){a.selectText()});c(document).one("click.selectAllFacets",this.disableFacets)},allSelected:function(a){if(a)this.flags.allSelected=
false;return this.flags.allSelected},disableFacets:function(a){_.each(this.inputViews,function(b){if(b!=a&&(b.modes.editing=="is"||b.modes.selected=="is"))b.blur()});_.each(this.facetViews,function(b){if(b!=a&&(b.modes.editing=="is"||b.modes.selected=="is")){b.disableEdit();b.deselectFacet()}});this.flags.allSelected=false;this.removeFocus();c(document).unbind("click.selectAllFacets")},resizeFacets:function(a){_.each(this.facetViews,function(b){if(!a||b==a)b.resize()})},_maybeDisableFacets:function(a){if(this.flags.allSelected&&
VS.app.hotkeys.key(a)=="backspace"){a.preventDefault();this.clearSearch(a);return false}else if(this.flags.allSelected&&VS.app.hotkeys.printable(a))this.clearSearch(a);else if(this.flags.allSelected){this.flags.allSelected=false;this.disableFacets()}},focusNextFacet:function(a,b,d){d=d||{};var e=this.facetViews.length,f=d.viewPosition||this.viewPosition(a);if(d.skipToFacet){if(d.skipToFacet&&a.type=="text"&&e==f&&b>=0)b=f=0}else{if(a.type=="text"&&b>0)b-=1;if(a.type=="facet"&&b<0)b+=1}var g;f=Math.min(e,
f+b);if(a.type=="text"&&f>=0&&f<e){g=this.facetViews[f];if(d.selectFacet)g.selectFacet();else{g.enableEdit();g.setCursorAtEnd(b||d.startAtEnd)}}else if(a.type=="facet")if(d.skipToFacet)if(f>=e||f<0){g=_.last(this.inputViews);g.focus()}else{g=this.facetViews[f];g.enableEdit();g.setCursorAtEnd(b||d.startAtEnd)}else{g=this.inputViews[f];g.focus();d.selectText&&g.selectText()}d.selectText&&g.selectText();this.resizeFacets()},focusSearch:function(a,b){var d=this.inputViews[this.inputViews.length-1];if(!a||
@@ -24,22 +24,23 @@ this),minLength:0,delay:0,autoFocus:true,select:_.bind(function(a,b){a.preventDe
collision:"flip",offset:"0 0"})},searchAutocomplete:function(){var a=this.box.data("autocomplete");if(a){var b=a.menu.element;a.search();b.outerWidth(Math.max(b.width("").outerWidth(),a.element.outerWidth()))}},closeAutocomplete:function(){var a=this.box.data("autocomplete");a&&a.close()},autocompleteValues:function(a,b){var d=this.model.get("category"),e=this.model.get("value"),f=a.term;d=VS.options.callbacks.facetMatches(d)||[];if(f&&e!=f){f=VS.utils.inflector.escapeRegExp(f||"");var g=RegExp("\\b"+
f,"i");d=c.grep(d,function(h){return g.test(h)||g.test(h.value)||g.test(h.label)})}b(_.sortBy(d,function(h){return h==e||h.value==e?"":h}))},set:function(a){a&&this.model.set({value:a})},search:function(a){this.closeAutocomplete();VS.app.searchBox.searchEvent(a)},enableEdit:function(){if(this.modes.editing!="is"){this.setMode("is","editing");this.deselectFacet();this.box.val()==""&&this.box.val(this.model.get("value"))}this.flags.canClose=false;VS.app.searchBox.disableFacets(this);VS.app.searchBox.addFocus();
_.defer(function(){VS.app.searchBox.addFocus()});this.box.is(":focus")||this.box.focus();this.resize();this.searchAutocomplete()},deferDisableEdit:function(){this.flags.canClose=true;_.delay(_.bind(function(){this.flags.canClose&&!this.box.is(":focus")&&this.modes.editing=="is"&&this.modes.selected!="is"&&this.disableEdit()},this),250)},disableEdit:function(){var a=VS.utils.inflector.trim(this.box.val());a!=this.model.get("value")&&this.set(a);this.flags.canClose=false;this.box.selectRange(0,0);this.box.blur();
-this.setMode("not","editing");this.closeAutocomplete();VS.app.searchBox.removeFocus()},selectFacet:function(){var a=VS.app.searchBox.allSelected();this.flags.canClose=false;a||VS.app.searchBox.disableFacets(this);if(this.box.is(":focus")){this.box.setCursorPosition(0);this.box.blur()}this.closeAutocomplete();this.setMode("is","selected");this.setMode("not","editing");if(!a){c(document).unbind("keydown.facet",this.keydown);c(document).unbind("click.facet",this.deselectFacet);_.defer(_.bind(function(){c(document).unbind("keydown.facet").bind("keydown.facet",
-this.keydown);c(document).unbind("click.facet").one("click.facet",this.deselectFacet)},this));VS.app.searchBox.addFocus()}},deselectFacet:function(){if(this.modes.selected=="is"){this.setMode("not","selected");this.closeAutocomplete();VS.app.searchBox.removeFocus()}c(document).unbind("keydown.facet",this.keydown);c(document).unbind("click.facet",this.deselectFacet)},isFocused:function(){return this.box.is(":focus")},showDelete:function(){c(this.el).addClass("search_facet_maybe_delete")},hideDelete:function(){c(this.el).removeClass("search_facet_maybe_delete")},
-setCursorAtEnd:function(a){a==-1?this.box.setCursorPosition(this.box.val().length):this.box.setCursorPosition(0)},remove:function(){var a=this.model.has("value");this.deselectFacet();this.disableEdit();VS.app.searchQuery.remove(this.model);a?this.search():VS.app.searchBox.renderFacets();VS.app.searchBox.focusNextFacet(this,0,{viewPosition:this.options.order})},selectText:function(){this.box.selectRange(0,this.box.val().length)},keydown:function(a){var b=VS.app.hotkeys.key(a);if(b=="enter"&&this.box.val()){this.disableEdit();
-this.search(a)}else if(b=="left"){if(this.box.getCursorPosition()==0&&!this.box.getSelection().length)if(this.modes.selected=="is"){this.deselectFacet();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true})}else this.selectFacet()}else if(b=="right")if(this.modes.selected=="is"){a.preventDefault();this.deselectFacet();this.setCursorAtEnd(0);this.enableEdit()}else{if(this.box.getCursorPosition()==this.box.val().length){a.preventDefault();this.disableEdit();VS.app.searchBox.focusNextFacet(this,
-1)}}else if(VS.app.hotkeys.shift&&b=="tab"){a.preventDefault();this.deselectFacet();this.disableEdit();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true,skipToFacet:true,selectText:true})}else if(b=="tab"){a.preventDefault();this.deselectFacet();this.disableEdit();VS.app.searchBox.focusNextFacet(this,1,{skipToFacet:true,selectText:true})}else if(VS.app.hotkeys.command&&(a.which==97||a.which==65)){a.preventDefault();VS.app.searchBox.selectAllFacets();return false}else if(VS.app.hotkeys.printable(a)&&
-this.modes.selected=="is"){VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true});this.remove()}else if(b=="backspace")if(this.modes.selected=="is"){a.preventDefault();this.remove(a)}else if(this.box.getCursorPosition()==0&&!this.box.getSelection().length){a.preventDefault();this.selectFacet()}this.resize(a)}})})();
+this.setMode("not","editing");this.closeAutocomplete();VS.app.searchBox.removeFocus()},selectFacet:function(){var a=VS.app.searchBox.allSelected();if(this.box.is(":focus")){this.box.setCursorPosition(0);this.box.blur()}this.flags.canClose=false;this.closeAutocomplete();this.setMode("is","selected");this.setMode("not","editing");if(!a){c(document).unbind("keydown.facet",this.keydown);c(document).unbind("click.facet",this.deselectFacet);_.defer(_.bind(function(){c(document).unbind("keydown.facet").bind("keydown.facet",
+this.keydown);c(document).unbind("click.facet").one("click.facet",this.deselectFacet)},this));VS.app.searchBox.disableFacets(this);VS.app.searchBox.addFocus()}},deselectFacet:function(){if(this.modes.selected=="is"){this.setMode("not","selected");this.closeAutocomplete();VS.app.searchBox.removeFocus()}c(document).unbind("keydown.facet",this.keydown);c(document).unbind("click.facet",this.deselectFacet)},isFocused:function(){return this.box.is(":focus")},showDelete:function(){c(this.el).addClass("search_facet_maybe_delete")},
+hideDelete:function(){c(this.el).removeClass("search_facet_maybe_delete")},setCursorAtEnd:function(a){a==-1?this.box.setCursorPosition(this.box.val().length):this.box.setCursorPosition(0)},remove:function(){var a=this.model.has("value");this.deselectFacet();this.disableEdit();VS.app.searchQuery.remove(this.model);a?this.search():VS.app.searchBox.renderFacets();VS.app.searchBox.focusNextFacet(this,0,{viewPosition:this.options.order})},selectText:function(){this.box.selectRange(0,this.box.val().length)},
+keydown:function(a){var b=VS.app.hotkeys.key(a);if(b=="enter"&&this.box.val()){this.disableEdit();this.search(a)}else if(b=="left"){if(this.box.getCursorPosition()==0&&!this.box.getSelection().length)if(this.modes.selected=="is"){this.deselectFacet();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true})}else this.selectFacet()}else if(b=="right")if(this.modes.selected=="is"){a.preventDefault();this.deselectFacet();this.setCursorAtEnd(0);this.enableEdit()}else{if(this.box.getCursorPosition()==
+this.box.val().length){a.preventDefault();this.disableEdit();VS.app.searchBox.focusNextFacet(this,1)}}else if(VS.app.hotkeys.shift&&b=="tab"){a.preventDefault();this.deselectFacet();this.disableEdit();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true,skipToFacet:true,selectText:true})}else if(b=="tab"){a.preventDefault();this.deselectFacet();this.disableEdit();VS.app.searchBox.focusNextFacet(this,1,{skipToFacet:true,selectText:true})}else if(VS.app.hotkeys.command&&(a.which==97||a.which==65)){a.preventDefault();
+VS.app.searchBox.selectAllFacets();return false}else if(VS.app.hotkeys.printable(a)&&this.modes.selected=="is"){VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true});this.remove()}else if(b=="backspace")if(this.modes.selected=="is"){a.preventDefault();this.remove(a)}else if(this.box.getCursorPosition()==0&&!this.box.getSelection().length){a.preventDefault();this.selectFacet()}this.resize(a)}})})();
(function(){var c=jQuery;VS.ui.SearchInput=Backbone.View.extend({type:"text",className:"search_input",events:{"keypress input":"keypress","keydown input":"keydown","click input":"maybeTripleClick","dblclick input":"startTripleClickTimer"},initialize:function(){_.bindAll(this,"removeFocus","addFocus","moveAutocomplete")},render:function(){c(this.el).html(JST.search_input({}));this.setMode("not","editing");this.setMode("not","selected");this.box=this.$("input");this.box.autoGrowInput();this.box.bind("updated.autogrow",
this.moveAutocomplete);this.box.bind("blur",this.removeFocus);this.box.bind("focus",this.addFocus);this.setupAutocomplete();return this},setupAutocomplete:function(){this.box.autocomplete({minLength:1,delay:50,autoFocus:true,source:_.bind(this.autocompleteValues,this),select:_.bind(function(a,b){a.preventDefault();a.stopPropagation();var d=this.addTextFacetRemainder(b.item.value);VS.app.searchBox.addFacet(b.item.value,"",this.options.position+(d?1:0));this.clear();return false},this)});this.box.data("autocomplete")._renderMenu=
function(a,b){var d="";_.each(b,_.bind(function(e){if(e.category&&e.category!=d){a.append('<li class="ui-autocomplete-category">'+e.category+"</li>");d=e.category}this._renderItem(a,e)},this))};this.box.autocomplete("widget").addClass("VS-interface")},autocompleteValues:function(a,b){var d=a.term.match(/\w+$/);d=VS.utils.inflector.escapeRegExp(d&&d[0]||" ");var e=VS.options.callbacks.categoryMatches()||[],f=RegExp("^"+d,"i");d=c.grep(e,function(g){return f.test(g.label||g)});b(_.sortBy(d,function(g){return g.label?
-g.category+"-"+g.label:g}))},moveAutocomplete:function(){var a=this.box.data("autocomplete");a&&a.menu.element.position({my:"left top",at:"left bottom",of:this.box.data("autocomplete").element,collision:"none"})},addTextFacetRemainder:function(a){var b=this.box.val(),d=b.match(/\b(\w+)$/);if(d&&a.indexOf(d[0])==0)b=b.replace(/\b(\w+)$/,"");(b=b.replace("^s+|s+$",""))&&VS.app.searchBox.addFacet("text",b,this.options.position);return b},focus:function(a){this.addFocus();this.box.focus();a&&this.selectText()},
-blur:function(){this.box.blur();this.removeFocus()},removeFocus:function(){VS.app.searchBox.removeFocus();this.setMode("not","editing");this.setMode("not","selected")},addFocus:function(){VS.app.searchBox.disableFacets(this);VS.app.searchBox.addFocus();this.setMode("is","editing");this.setMode("not","selected")},startTripleClickTimer:function(){this.tripleClickTimer=setTimeout(_.bind(function(){this.tripleClickTimer=null},this),500)},maybeTripleClick:function(a){if(this.tripleClickTimer){a.preventDefault();
-VS.app.searchBox.selectAllFacets();return false}},isFocused:function(){return this.box.is(":focus")},clear:function(){this.box.val("")},value:function(){return this.box.val()},setCursorAtEnd:function(a){a==-1?this.box.setCursorPosition(this.box.val().length):this.box.setCursorPosition(0)},selectText:function(){if(VS.app.searchBox.allSelected())this.setMode("is","selected");else{this.box.selectRange(0,this.box.val().length);this.box.focus()}},keypress:function(a){var b=VS.app.hotkeys.key(a);if(b==
-"enter")return VS.app.searchBox.searchEvent(a);else if(VS.app.hotkeys.colon(a)){this.box.trigger("resize.autogrow",a);b=this.box.val();var d=VS.options.callbacks.categoryMatches()||[];d=_.map(d,function(e){return e.label?e.label:e});if(_.contains(d,b)){a.preventDefault();a=this.addTextFacetRemainder(b);VS.app.searchBox.addFacet(b,"",this.options.position+(a?1:0));this.clear();return false}}else if(b=="backspace")if(this.box.getCursorPosition()==0&&!this.box.getSelection().length){a.preventDefault();
-a.stopPropagation();a.stopImmediatePropagation();VS.app.searchBox.resizeFacets();return false}},keydown:function(a){var b=VS.app.hotkeys.key(a);if(b=="left"){if(this.box.getCursorPosition()==0){a.preventDefault();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true})}}else if(b=="right"){if(this.box.getCursorPosition()==this.box.val().length){a.preventDefault();VS.app.searchBox.focusNextFacet(this,1,{selectFacet:true})}}else if(VS.app.hotkeys.shift&&b=="tab"){a.preventDefault();VS.app.searchBox.focusNextFacet(this,
--1,{selectText:true})}else if(b=="tab"){a.preventDefault();b=this.box.val();if(b.length){var d=this.addTextFacetRemainder(b);VS.app.searchBox.addFacet(b,"",this.options.position+(d?1:0))}else VS.app.searchBox.focusNextFacet(this,0,{skipToFacet:true,selectText:true})}else if(VS.app.hotkeys.command&&String.fromCharCode(a.which).toLowerCase()=="a"){a.preventDefault();VS.app.searchBox.selectAllFacets();return false}else if(b=="backspace"&&!VS.app.searchBox.allSelected())if(this.box.getCursorPosition()==
-0&&!this.box.getSelection().length){a.preventDefault();VS.app.searchBox.focusNextFacet(this,-1,{backspace:true});return false}this.box.trigger("resize.autogrow",a)}})})();(function(){var c=jQuery;Backbone.View.prototype.setMode=function(a,b){this.modes||(this.modes={});if(this.modes[b]!==a){c(this.el).setMode(a,b);this.modes[b]=a}}})();
+g.category+"-"+g.label:g}))},closeAutocomplete:function(){var a=this.box.data("autocomplete");a&&a.close()},moveAutocomplete:function(){var a=this.box.data("autocomplete");a&&a.menu.element.position({my:"left top",at:"left bottom",of:this.box.data("autocomplete").element,collision:"none"})},searchAutocomplete:function(){var a=this.box.data("autocomplete");if(a){var b=a.menu.element;a.search();b.outerWidth(Math.max(b.width("").outerWidth(),a.element.outerWidth()))}},addTextFacetRemainder:function(a){var b=
+this.box.val(),d=b.match(/\b(\w+)$/);if(d&&a.indexOf(d[0])==0)b=b.replace(/\b(\w+)$/,"");(b=b.replace("^s+|s+$",""))&&VS.app.searchBox.addFacet("text",b,this.options.position);return b},focus:function(a){this.addFocus();this.box.focus();a&&this.selectText()},blur:function(){this.box.blur();this.removeFocus()},removeFocus:function(){VS.app.searchBox.removeFocus();this.setMode("not","editing");this.setMode("not","selected");this.closeAutocomplete()},addFocus:function(){VS.app.searchBox.allSelected()||
+VS.app.searchBox.disableFacets(this);VS.app.searchBox.addFocus();this.setMode("is","editing");this.setMode("not","selected");this.searchAutocomplete()},startTripleClickTimer:function(){this.tripleClickTimer=setTimeout(_.bind(function(){this.tripleClickTimer=null},this),500)},maybeTripleClick:function(a){if(this.tripleClickTimer){a.preventDefault();VS.app.searchBox.selectAllFacets();return false}},isFocused:function(){return this.box.is(":focus")},clear:function(){this.box.val("")},value:function(){return this.box.val()},
+setCursorAtEnd:function(a){a==-1?this.box.setCursorPosition(this.box.val().length):this.box.setCursorPosition(0)},selectText:function(){this.box.selectRange(0,this.box.val().length);VS.app.searchBox.allSelected()?this.setMode("is","selected"):this.box.focus()},keypress:function(a){var b=VS.app.hotkeys.key(a);if(b=="enter")return VS.app.searchBox.searchEvent(a);else if(VS.app.hotkeys.colon(a)){this.box.trigger("resize.autogrow",a);b=this.box.val();var d=VS.options.callbacks.categoryMatches()||[];d=
+_.map(d,function(e){return e.label?e.label:e});if(_.contains(d,b)){a.preventDefault();a=this.addTextFacetRemainder(b);VS.app.searchBox.addFacet(b,"",this.options.position+(a?1:0));this.clear();return false}}else if(b=="backspace")if(this.box.getCursorPosition()==0&&!this.box.getSelection().length){a.preventDefault();a.stopPropagation();a.stopImmediatePropagation();VS.app.searchBox.resizeFacets();return false}},keydown:function(a){var b=VS.app.hotkeys.key(a);if(b=="left"){if(this.box.getCursorPosition()==
+0){a.preventDefault();VS.app.searchBox.focusNextFacet(this,-1,{startAtEnd:true})}}else if(b=="right"){if(this.box.getCursorPosition()==this.box.val().length){a.preventDefault();VS.app.searchBox.focusNextFacet(this,1,{selectFacet:true})}}else if(VS.app.hotkeys.shift&&b=="tab"){a.preventDefault();VS.app.searchBox.focusNextFacet(this,-1,{selectText:true})}else if(b=="tab"){a.preventDefault();b=this.box.val();if(b.length){var d=this.addTextFacetRemainder(b);VS.app.searchBox.addFacet(b,"",this.options.position+
+(d?1:0))}else VS.app.searchBox.focusNextFacet(this,0,{skipToFacet:true,selectText:true})}else if(VS.app.hotkeys.command&&String.fromCharCode(a.which).toLowerCase()=="a"){a.preventDefault();VS.app.searchBox.selectAllFacets();return false}else if(b=="backspace"&&!VS.app.searchBox.allSelected())if(this.box.getCursorPosition()==0&&!this.box.getSelection().length){a.preventDefault();VS.app.searchBox.focusNextFacet(this,-1,{backspace:true});return false}this.box.trigger("resize.autogrow",a)}})})();
+(function(){var c=jQuery;Backbone.View.prototype.setMode=function(a,b){this.modes||(this.modes={});if(this.modes[b]!==a){c(this.el).setMode(a,b);this.modes[b]=a}}})();
(function(){var c=jQuery;VS.app.hotkeys={KEYS:{"16":"shift","17":"control","91":"command","93":"command","224":"command","13":"enter","37":"left","38":"upArrow","39":"right","40":"downArrow","46":"delete","8":"backspace","9":"tab","188":"comma"},initialize:function(){_.bindAll(this,"down","up","blur");c(document).bind("keydown",this.down);c(document).bind("keyup",this.up)},down:function(a){if(a=this.KEYS[a.which])this[a]=true},up:function(a){if(a=this.KEYS[a.which])this[a]=false},blur:function(){for(var a in this.KEYS)this[this.KEYS[a]]=
false},key:function(a){return this.KEYS[a.which]},colon:function(a){return(a=a.which)&&String.fromCharCode(a)==":"},printable:function(a){var b=a.which;if(a.type=="keydown"){if(b==32||b>=48&&b<=90||b>=96&&b<=111||b>=186&&b<=192||b>=219&&b<=222)return true}else if(b>=32&&b<=126||b>=160&&b<=500||String.fromCharCode(b)==":")return true;return false}}})();
(function(){VS.utils.inflector={trim:function(c){return c.trim?c.trim():c.replace(/^\s+|\s+$/g,"")},escapeRegExp:function(c){return c.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")}}})();
@@ -48,7 +49,7 @@ a.unbind("keydown.autogrow keypress.autogrow resize.autogrow change.autogrow").b
3);a.trigger("updated.autogrow")});a.trigger("resize.autogrow")})},getCursorPosition:function(){var a=0,b=this.get(0);if(document.selection){b.focus();a=document.selection.createRange();var d=document.selection.createRange().text.length;a.moveStart("character",-b.value.length);a=a.text.length-d}else if(b&&c(b).is(":visible")&&b.selectionStart!=null)a=b.selectionStart;return a},setCursorPosition:function(a){return this.each(function(){return c(this).selectRange(a,a)})},selectRange:function(a,b){return this.each(function(){if(this.setSelectionRange){this.focus();
this.setSelectionRange(a,b)}else if(this.createTextRange){var d=this.createTextRange();d.collapse(true);d.moveEnd("character",b);d.moveStart("character",a);d.select()}})},getSelection:function(){var a=this[0];if(a.selectionStart!=null){var b=a.selectionStart,d=a.selectionEnd;return{start:b,end:d,length:d-b,text:a.value.substr(b,d-b)}}else if(document.selection){var e=document.selection.createRange();if(e){a=a.createTextRange();b=a.duplicate();a.moveToBookmark(e.getBookmark());b.setEndPoint("EndToStart",
a);b=b.text.length;d=b+e.text.length;return{start:b,end:d,length:d-b,text:e.text}}}return{start:0,end:0,length:0}}})})();
-(function(){VS.app.SearchParser={ALL_FIELDS:/('.+?'|".+?"|[^'"\s]{2}\S*):\s*('.+?'|".+?"|[^'"\s]{2}\S*)/g,FIELD:/(.+?):\s*/,parse:function(c){c=this._extractAllFacets(c);VS.app.searchQuery.refresh(c);return c},_extractAllFacets:function(c){for(var a=[],b=c;c;){var d,e;b=c;var f=this._extractNextField(c);if(f)if(f.indexOf(":")!=-1){d=f.match(this.FIELD)[1];e=f.replace(this.FIELD,"").replace(/(^['"]|['"]$)/g,"");c=VS.utils.inflector.trim(c.replace(f,""))}else{if(f.indexOf(":")==-1){d="text";e=f;c=VS.utils.inflector.trim(c.replace(e,
+(function(){VS.app.SearchParser={ALL_FIELDS:/('.+?'|".+?"|[^'"\s]{2}\S*):\s*('.+?'|".+?"|[^'"\s]\S*)/g,FIELD:/(.+?):\s*/,parse:function(c){c=this._extractAllFacets(c);VS.app.searchQuery.refresh(c);return c},_extractAllFacets:function(c){for(var a=[],b=c;c;){var d,e;b=c;var f=this._extractNextField(c);if(f)if(f.indexOf(":")!=-1){d=f.match(this.FIELD)[1];e=f.replace(this.FIELD,"").replace(/(^['"]|['"]$)/g,"");c=VS.utils.inflector.trim(c.replace(f,""))}else{if(f.indexOf(":")==-1){d="text";e=f;c=VS.utils.inflector.trim(c.replace(e,
""))}}else{d="text";e=this._extractSearchText(c);c=VS.utils.inflector.trim(c.replace(e,""))}if(d&&e){f=new VS.model.SearchFacet({category:d,value:VS.utils.inflector.trim(e)});a.push(f)}if(b==c)break}return a},_extractNextField:function(c){var a=c.match(/^\s*(\S+)\s+(?=\w+:\s?(('.+?'|".+?")|([^'"]{2}\S*)))/);return a&&a.length>=1?a[1]:this._extractFirstField(c)},_extractFirstField:function(c){return(c=c.match(this.ALL_FIELDS))&&c.length&&c[0]},_extractSearchText:function(c){return VS.utils.inflector.trim((c||
"").replace(this.ALL_FIELDS,""))}}})();(function(){VS.model.SearchFacet=Backbone.Model.extend({serialize:function(){var c=this.get("category"),a=VS.utils.inflector.trim(this.get("value"));if(!a)return"";if(!_.contains(VS.options.unquotable||[],c)&&c!="text")a='"'+a+'"';if(c!="text")c+=": ";else c="";return c+a}})})();
(function(){VS.model.SearchQuery=Backbone.Collection.extend({model:VS.model.SearchFacet,value:function(){return this.map(function(c){return c.serialize()}).join(" ")},find:function(c){var a=this.detect(function(b){return b.get("category")==c});return a&&a.get("value")},count:function(c){return this.select(function(a){return a.get("category")==c}).length},values:function(c){var a=this.select(function(b){return b.get("category")==c});return _.map(a,function(b){return b.get("value")})},has:function(c,
View
BIN build-min/visualsearch.js.gz
Binary file not shown.
View
BIN build-min/visualsearch_templates.js.gz
Binary file not shown.
View
2 build/visualsearch-datauri.css
@@ -196,6 +196,8 @@ Source: http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
.VS-search .search_facet.is_selected .search_facet_remove {
top: 4px;
left: 3px;
+ opacity: .4;
+ background-position: center -11px;
}
.VS-search .search_facet .search_facet_remove:hover {
opacity: 1;
View
6 build/visualsearch.css
@@ -7,15 +7,15 @@
.VS-search .icon.VS-icon-cancel {
width: 11px; height: 11px;
background-position: center 0;
- background-image: url(../Users/conesus/cloud/visualsearch/lib/images/embed/icons/cancel_search.png?1308268129);
+ background-image: url(../images/embed/icons/cancel_search.png?1308268129);
cursor: pointer;
}
.VS-search .icon.VS-icon-cancel:hover {
background-position: center -11px;
}
.VS-search .icon.VS-icon-search {
width: 12px; height: 12px;
- background-image: url(../Users/conesus/cloud/visualsearch/lib/images/embed/icons/search_glyph.png?1308268129);
+ background-image: url(../images/embed/icons/search_glyph.png?1308268129);
}
/*------------------------------ RESET + DEFAULT STYLES ---------------------------------*/
@@ -196,6 +196,8 @@ Source: http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
.VS-search .search_facet.is_selected .search_facet_remove {
top: 4px;
left: 3px;
+ opacity: .4;
+ background-position: center -11px;
}
.VS-search .search_facet .search_facet_remove:hover {
opacity: 1;
View
52 build/visualsearch.js
@@ -23,6 +23,9 @@
if (!VS.model) VS.model = {};
if (!VS.utils) VS.utils = {};
+ // Sets the version for VisualSearch to be used programatically elsewhere.
+ VS.VERSION = '0.1.0';
+
// Entry-point used to tie all parts of VisualSearch together. It will either attach
// itself to `options.container`, or pass back the `searchBox` so it can be rendered
// at will.
@@ -228,12 +231,12 @@ VS.ui.SearchBox = Backbone.View.extend({
// Command+A selects all facets.
selectAllFacets : function() {
this.flags.allSelected = true;
- _.each(this.inputViews, function(inputView, i) {
- inputView.selectText();
- });
_.each(this.facetViews, function(facetView, i) {
facetView.selectFacet();
});
+ _.each(this.inputViews, function(inputView, i) {
+ inputView.selectText();
+ });
$(document).one('click.selectAllFacets', this.disableFacets);
},
@@ -519,6 +522,7 @@ VS.ui.SearchFacet = Backbone.View.extend({
});
}
},
+
// When a user enters a facet and it is being edited, immediately show
// the autocomplete menu and size it to match the contents.
searchAutocomplete : function(e) {
@@ -648,15 +652,12 @@ VS.ui.SearchFacet = Backbone.View.extend({
selectFacet : function() {
var allSelected = VS.app.searchBox.allSelected();
- this.flags.canClose = false;
- if (!allSelected) {
- VS.app.searchBox.disableFacets(this);
- }
if (this.box.is(':focus')) {
this.box.setCursorPosition(0);
this.box.blur();
}
+ this.flags.canClose = false;
this.closeAutocomplete();
this.setMode('is', 'selected');
this.setMode('not', 'editing');
@@ -668,6 +669,7 @@ VS.ui.SearchFacet = Backbone.View.extend({
$(document).unbind('keydown.facet').bind('keydown.facet', this.keydown);
$(document).unbind('click.facet').one('click.facet', this.deselectFacet);
}, this));
+ VS.app.searchBox.disableFacets(this);
VS.app.searchBox.addFocus();
}
},
@@ -899,6 +901,13 @@ VS.ui.SearchInput = Backbone.View.extend({
}));
},
+ // Closes the autocomplete menu. Called on disabling, selecting, deselecting,
+ // and anything else that takes focus out of the facet's input field.
+ closeAutocomplete : function() {
+ var autocomplete = this.box.data('autocomplete');
+ if (autocomplete) autocomplete.close();
+ },
+
// As the input field grows, it may move to the next line in the
// search box. `autoGrowInput` triggers an `updated` event on the input
// field, which is bound to this method to move the autocomplete menu.
@@ -914,6 +923,23 @@ VS.ui.SearchInput = Backbone.View.extend({
}
},
+ // When a user enters a facet and it is being edited, immediately show
+ // the autocomplete menu and size it to match the contents.
+ searchAutocomplete : function(e) {
+ var autocomplete = this.box.data('autocomplete');
+ if (autocomplete) {
+ var menu = autocomplete.menu.element;
+ autocomplete.search();
+
+ // Resize the menu based on the correctly measured width of what's bigger:
+ // the menu's original size or the menu items' new size.
+ menu.outerWidth(Math.max(
+ menu.width('').outerWidth(),
+ autocomplete.element.outerWidth()
+ ));
+ }
+ },
+
// If a user searches for "word word category", the category would be
// matched and autocompleted, and when selected, the "word word" would
// also be caught as the remainder and then added in its own facet.
@@ -948,13 +974,17 @@ VS.ui.SearchInput = Backbone.View.extend({
VS.app.searchBox.removeFocus();
this.setMode('not', 'editing');
this.setMode('not', 'selected');
+ this.closeAutocomplete();
},
addFocus : function(e) {
- VS.app.searchBox.disableFacets(this);
+ if (!VS.app.searchBox.allSelected()) {
+ VS.app.searchBox.disableFacets(this);
+ }
VS.app.searchBox.addFocus();
this.setMode('is', 'editing');
this.setMode('not', 'selected');
+ this.searchAutocomplete();
},
// Starts a timer that will cause a triple-click, which highlights all facets.
@@ -996,8 +1026,8 @@ VS.ui.SearchInput = Backbone.View.extend({
},
selectText : function() {
+ this.box.selectRange(0, this.box.val().length);
if (!VS.app.searchBox.allSelected()) {
- this.box.selectRange(0, this.box.val().length);
this.box.focus();
} else {
this.setMode('is', 'selected');
@@ -1378,10 +1408,10 @@ var $ = jQuery; // Handle namespaced jQuery
VS.app.SearchParser = {
// Matches `category: "free text"`, with and without quotes.
- ALL_FIELDS : /('.+?'|".+?"|[^'"\s]{2}\S*):\s*('.+?'|".+?"|[^'"\s]{2}\S*)/g,
+ ALL_FIELDS : /('.+?'|".+?"|[^'"\s]{2}\S*):\s*('.+?'|".+?"|[^'"\s]\S*)/g,
// Matches a single category without the text. Used to correctly extract facets.
- FIELD : /(.+?):\s*/,
+ FIELD : /(.+?):\s*/,
// Called to parse a query into a collection of `SearchFacet` models.
parse : function(query) {
View
3 lib/js/visualsearch.js
@@ -23,6 +23,9 @@
if (!VS.model) VS.model = {};
if (!VS.utils) VS.utils = {};
+ // Sets the version for VisualSearch to be used programatically elsewhere.
+ VS.VERSION = '0.1.0';
+
// Entry-point used to tie all parts of VisualSearch together. It will either attach
// itself to `options.container`, or pass back the `searchBox` so it can be rendered
// at will.

0 comments on commit 6e0fc5d

Please sign in to comment.
Something went wrong with that request. Please try again.