From ece8c849cad75e65c1f88575d926d4b22a8843c0 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 10 Mar 2010 18:09:37 +0200 Subject: [PATCH] added "No Results" label --- demo/demo.js | 200 ++++++++++----------- demo/index.html | 4 +- demo/server-side.php | 44 ++--- suggest_results/jquery.suggest_results.css | 10 +- suggest_results/jquery.suggest_results.js | 27 +-- 5 files changed, 146 insertions(+), 139 deletions(-) diff --git a/demo/demo.js b/demo/demo.js index de57dea..eea54df 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -1,102 +1,102 @@ var data = [ - {"title": "Ädams, Egbert", "info": "Bedfordshire", "href": "/demo/user/1"}, - {"title": "Altman, Alisha", "info": "Buckinghamshire", "href": "/demo/user/2"}, - {"title": "Archibald, Janna", "info": "Cambridgeshire", "href": "/demo/user/3"}, - {"title": "Auman, Cody", "info": "Cheshire", "href": "/demo/user/4"}, - {"title": "Bagley, Sheree", "info": "Cornwall", "href": "/demo/user/5"}, - {"title": "Ballou, Wilmot", "info": "Cumbria", "href": "/demo/user/6"}, - {"title": "Bard, Cassian", "info": "Derbyshire", "href": "/demo/user/1"}, - {"title": "Bash, Latanya", "info": "Devon", "href": "/demo/user/2"}, - {"title": "Beail, May", "info": "Dorset", "href": "/demo/user/3"}, - {"title": "Black, Lux", "info": "Durham", "href": "/demo/user/4"}, - {"title": "Bloise, India", "info": "East Sussex", "href": "/demo/user/5"}, - {"title": "Blyant, Nora", "info": "Essex", "href": "/demo/user/6"}, - {"title": "Bollinger, Carter", "info": "Gloucestershire", "href": "/demo/user/1"}, - {"title": "Burns, Jaycob", "info": "Hampshire", "href": "/demo/user/2"}, - {"title": "Carden, Preston", "info": "Hertfordshire", "href": "/demo/user/3"}, - {"title": "Carter, Merrilyn", "info": "Kent", "href": "/demo/user/4"}, - {"title": "Christner, Addie", "info": "Lancashire", "href": "/demo/user/5"}, - {"title": "Churchill, Mirabelle", "info": "Leicestershire", "href": "/demo/user/6"}, - {"title": "Conkle, Erin", "info": "Lincolnshire", "href": "/demo/user/1"}, - {"title": "Countryman, Abner", "info": "Norfolk", "href": "/demo/user/2"}, - {"title": "Courtney, Edgar", "info": "Northamptonshire", "href": "/demo/user/3"}, - {"title": "Cowher, Antony", "info": "Northumberland", "href": "/demo/user/4"}, - {"title": "Craig, Charlie", "info": "North Yorkshire", "href": "/demo/user/5"}, - {"title": "Cram, Zacharias", "info": "Nottinghamshire", "href": "/demo/user/6"}, - {"title": "Cressman, Ted", "info": "Oxfordshire", "href": "/demo/user/1"}, - {"title": "Crissman, Annie", "info": "Shropshire", "href": "/demo/user/2"}, - {"title": "Davis, Palmer", "info": "Somerset", "href": "/demo/user/3"}, - {"title": "Downing, Casimir", "info": "Staffordshire", "href": "/demo/user/4"}, - {"title": "Earl, Missie", "info": "Suffolk", "href": "/demo/user/5"}, - {"title": "Eckert, Janele", "info": "Surrey", "href": "/demo/user/6"}, - {"title": "Eisenman, Briar", "info": "Warwickshire", "href": "/demo/user/1"}, - {"title": "Fitzgerald, Love", "info": "West Sussex", "href": "/demo/user/2"}, - {"title": "Fleming, Sidney", "info": "Wiltshire", "href": "/demo/user/3"}, - {"title": "Fuchs, Bridger", "info": "Worcestershire", "href": "/demo/user/4"}, - {"title": "Fulton, Rosalynne", "info": "Durham", "href": "/demo/user/5"}, - {"title": "Fye, Webster", "info": "East Sussex", "href": "/demo/user/6"}, - {"title": "Geyer, Rylan", "info": "Essex", "href": "/demo/user/1"}, - {"title": "Greene, Charis", "info": "Gloucestershire", "href": "/demo/user/2"}, - {"title": "Greif, Jem", "info": "Hampshire", "href": "/demo/user/3"}, - {"title": "Guest, Sarahjeanne", "info": "Hertfordshire", "href": "/demo/user/4"}, - {"title": "Harper, Phyllida", "info": "Kent", "href": "/demo/user/5"}, - {"title": "Hildyard, Erskine", "info": "Lancashire", "href": "/demo/user/6"}, - {"title": "Hoenshell, Eulalia", "info": "Leicestershire", "href": "/demo/user/1"}, - {"title": "Isaman, Lalo", "info": "Lincolnshire", "href": "/demo/user/2"}, - {"title": "James, Diamond", "info": "Norfolk", "href": "/demo/user/3"}, - {"title": "Jenkins, Merrill", "info": "Northamptonshire", "href": "/demo/user/4"}, - {"title": "Jube, Bennett", "info": "Northumberland", "href": "/demo/user/5"}, - {"title": "Kava, Marianne", "info": "North Yorkshire", "href": "/demo/user/6"}, - {"title": "Kern, Linda", "info": "Nottinghamshire", "href": "/demo/user/1"}, - {"title": "Klockman, Jenifer", "info": "Oxfordshire", "href": "/demo/user/2"}, - {"title": "Lacon, Quincy", "info": "Shropshire", "href": "/demo/user/3"}, - {"title": "Laurenzi, Leland", "info": "Somerset", "href": "/demo/user/4"}, - {"title": "Leichter, Jeane", "info": "Staffordshire", "href": "/demo/user/5"}, - {"title": "Leslie, Kerrie", "info": "Suffolk", "href": "/demo/user/6"}, - {"title": "Lester, Noah", "info": "Surrey", "href": "/demo/user/1"}, - {"title": "Llora, Roxana", "info": "Warwickshire", "href": "/demo/user/2"}, - {"title": "Lombardi, Polly", "info": "West Sussex", "href": "/demo/user/3"}, - {"title": "Lowstetter, Louisa", "info": "Wiltshire", "href": "/demo/user/4"}, - {"title": "Mays, Emery", "info": "Worcestershire", "href": "/demo/user/5"}, - {"title": "Mccullough, Bernadine", "info": "Durham", "href": "/demo/user/6"}, - {"title": "Mckinnon, Kristie", "info": "East Sussex", "href": "/demo/user/1"}, - {"title": "Meyers, Hector", "info": "Essex", "href": "/demo/user/2"}, - {"title": "Monahan, Penelope", "info": "Gloucestershire", "href": "/demo/user/3"}, - {"title": "Mull, Kaelea", "info": "Hampshire", "href": "/demo/user/4"}, - {"title": "Newbiggin, Osmond", "info": "Hertfordshire", "href": "/demo/user/5"}, - {"title": "Nickolson, Alfreda", "info": "Kent", "href": "/demo/user/6"}, - {"title": "Pawle, Jacki", "info": "Lancashire", "href": "/demo/user/1"}, - {"title": "Paynter, Nerissa", "info": "Leicestershire", "href": "/demo/user/2"}, - {"title": "Pinney, Wilkie", "info": "Lincolnshire", "href": "/demo/user/3"}, - {"title": "Pratt, Ricky", "info": "Norfolk", "href": "/demo/user/4"}, - {"title": "Putnam, Stephanie", "info": "Northamptonshire", "href": "/demo/user/5"}, - {"title": "Ream, Terrence", "info": "Northumberland", "href": "/demo/user/6"}, - {"title": "Rumbaugh, Noelle", "info": "North Yorkshire", "href": "/demo/user/1"}, - {"title": "Ryals, Titania", "info": "Nottinghamshire", "href": "/demo/user/2"}, - {"title": "Saylor, Lenora", "info": "Oxfordshire", "href": "/demo/user/3"}, - {"title": "Schofield, Denice", "info": "Shropshire", "href": "/demo/user/4"}, - {"title": "Schuck, John", "info": "Somerset", "href": "/demo/user/5"}, - {"title": "Scott, Clover", "info": "Staffordshire", "href": "/demo/user/6"}, - {"title": "Smith, Estella", "info": "Suffolk", "href": "/demo/user/1"}, - {"title": "Smothers, Matthew", "info": "Surrey", "href": "/demo/user/2"}, - {"title": "Stainforth, Maurene", "info": "Warwickshire", "href": "/demo/user/3"}, - {"title": "Stephenson, Phillipa", "info": "West Sussex", "href": "/demo/user/4"}, - {"title": "Stewart, Hyram", "info": "Wiltshire", "href": "/demo/user/5"}, - {"title": "Stough, Gussie", "info": "Worcestershire", "href": "/demo/user/6"}, - {"title": "Strickland, Temple", "info": "Durham", "href": "/demo/user/1"}, - {"title": "Sullivan, Gertie", "info": "East Sussex", "href": "/demo/user/2"}, - {"title": "Swink, Stefanie", "info": "Essex", "href": "/demo/user/3"}, - {"title": "Tavoularis, Terance", "info": "Gloucestershire", "href": "/demo/user/4"}, - {"title": "Taylor, Kizzy", "info": "Hampshire", "href": "/demo/user/5"}, - {"title": "Thigpen, Alwyn", "info": "Hertfordshire", "href": "/demo/user/6"}, - {"title": "Treeby, Jim", "info": "Kent", "href": "/demo/user/1"}, - {"title": "Trevithick, Jayme", "info": "Lancashire", "href": "/demo/user/2"}, - {"title": "Waldron, Ashley", "info": "Leicestershire", "href": "/demo/user/3"}, - {"title": "Wheeler, Bysshe", "info": "Lincolnshire", "href": "/demo/user/4"}, - {"title": "Whishaw, Dodie", "info": "Norfolk", "href": "/demo/user/5"}, - {"title": "Whitehead, Jericho", "info": "Northamptonshire", "href": "/demo/user/6"}, - {"title": "Wilks, Debby", "info": "Northumberland", "href": "/demo/user/1"}, - {"title": "Wire, Tallulah", "info": "North Yorkshire", "href": "/demo/user/2"}, - {"title": "Woodworth, Alexandria", "info": "Nottinghamshire", "href": "/demo/user/3"}, - {"title": "Zaun, Jillie", "info": "", "href": ""} + {"title": "Ädams, Egbert", "info": "Bedfordshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Altman, Alisha", "info": "Buckinghamshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Archibald, Janna", "info": "Cambridgeshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Auman, Cody", "info": "Cheshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Bagley, Sheree", "info": "Cornwall", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Ballou, Wilmot", "info": "Cumbria", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Bard, Cassian", "info": "Derbyshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Bash, Latanya", "info": "Devon", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Beail, May", "info": "Dorset", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Black, Lux", "info": "Durham", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Bloise, India", "info": "East Sussex", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Blyant, Nora", "info": "Essex", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Bollinger, Carter", "info": "Gloucestershire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Burns, Jaycob", "info": "Hampshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Carden, Preston", "info": "Hertfordshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Carter, Merrilyn", "info": "Kent", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Christner, Addie", "info": "Lancashire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Churchill, Mirabelle", "info": "Leicestershire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Conkle, Erin", "info": "Lincolnshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Countryman, Abner", "info": "Norfolk", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Courtney, Edgar", "info": "Northamptonshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Cowher, Antony", "info": "Northumberland", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Craig, Charlie", "info": "North Yorkshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Cram, Zacharias", "info": "Nottinghamshire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Cressman, Ted", "info": "Oxfordshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Crissman, Annie", "info": "Shropshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Davis, Palmer", "info": "Somerset", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Downing, Casimir", "info": "Staffordshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Earl, Missie", "info": "Suffolk", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Eckert, Janele", "info": "Surrey", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Eisenman, Briar", "info": "Warwickshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Fitzgerald, Love", "info": "West Sussex", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Fleming, Sidney", "info": "Wiltshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Fuchs, Bridger", "info": "Worcestershire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Fulton, Rosalynne", "info": "Durham", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Fye, Webster", "info": "East Sussex", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Geyer, Rylan", "info": "Essex", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Greene, Charis", "info": "Gloucestershire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Greif, Jem", "info": "Hampshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Guest, Sarahjeanne", "info": "Hertfordshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Harper, Phyllida", "info": "Kent", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Hildyard, Erskine", "info": "Lancashire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Hoenshell, Eulalia", "info": "Leicestershire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Isaman, Lalo", "info": "Lincolnshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "James, Diamond", "info": "Norfolk", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Jenkins, Merrill", "info": "Northamptonshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Jube, Bennett", "info": "Northumberland", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Kava, Marianne", "info": "North Yorkshire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Kern, Linda", "info": "Nottinghamshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Klockman, Jenifer", "info": "Oxfordshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Lacon, Quincy", "info": "Shropshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Laurenzi, Leland", "info": "Somerset", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Leichter, Jeane", "info": "Staffordshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Leslie, Kerrie", "info": "Suffolk", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Lester, Noah", "info": "Surrey", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Llora, Roxana", "info": "Warwickshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Lombardi, Polly", "info": "West Sussex", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Lowstetter, Louisa", "info": "Wiltshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Mays, Emery", "info": "Worcestershire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Mccullough, Bernadine", "info": "Durham", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Mckinnon, Kristie", "info": "East Sussex", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Meyers, Hector", "info": "Essex", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Monahan, Penelope", "info": "Gloucestershire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Mull, Kaelea", "info": "Hampshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Newbiggin, Osmond", "info": "Hertfordshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Nickolson, Alfreda", "info": "Kent", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Pawle, Jacki", "info": "Lancashire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Paynter, Nerissa", "info": "Leicestershire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Pinney, Wilkie", "info": "Lincolnshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Pratt, Ricky", "info": "Norfolk", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Putnam, Stephanie", "info": "Northamptonshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Ream, Terrence", "info": "Northumberland", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Rumbaugh, Noelle", "info": "North Yorkshire", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Ryals, Titania", "info": "Nottinghamshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Saylor, Lenora", "info": "Oxfordshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Schofield, Denice", "info": "Shropshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Schuck, John", "info": "Somerset", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Scott, Clover", "info": "Staffordshire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Smith, Estella", "info": "Suffolk", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Smothers, Matthew", "info": "Surrey", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Stainforth, Maurene", "info": "Warwickshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Stephenson, Phillipa", "info": "West Sussex", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Stewart, Hyram", "info": "Wiltshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Stough, Gussie", "info": "Worcestershire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Strickland, Temple", "info": "Durham", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Sullivan, Gertie", "info": "East Sussex", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Swink, Stefanie", "info": "Essex", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Tavoularis, Terance", "info": "Gloucestershire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Taylor, Kizzy", "info": "Hampshire", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Thigpen, Alwyn", "info": "Hertfordshire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Treeby, Jim", "info": "Kent", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Trevithick, Jayme", "info": "Lancashire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Waldron, Ashley", "info": "Leicestershire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Wheeler, Bysshe", "info": "Lincolnshire", "href": "/demo/user/4", "match": "zzzz"}, + {"title": "Whishaw, Dodie", "info": "Norfolk", "href": "/demo/user/5", "match": "zzzz"}, + {"title": "Whitehead, Jericho", "info": "Northamptonshire", "href": "/demo/user/6", "match": "zzzz"}, + {"title": "Wilks, Debby", "info": "Northumberland", "href": "/demo/user/1", "match": "zzzz"}, + {"title": "Wire, Tallulah", "info": "North Yorkshire", "href": "/demo/user/2", "match": "zzzz"}, + {"title": "Woodworth, Alexandria", "info": "Nottinghamshire", "href": "/demo/user/3", "match": "zzzz"}, + {"title": "Zaun, Jillie", "info": "", "href": "/demo/user/4", "match": "zzzz"} ]; \ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 2836de1..cd2817f 100644 --- a/demo/index.html +++ b/demo/index.html @@ -9,8 +9,8 @@ - + @@ -29,6 +29,7 @@ $("#example3").suggest_results({ url: "server-side.php", name: "example3", + empty: false, limit: 4, tpl_result_body: '{{title}}{{info}}' }); @@ -41,7 +42,6 @@ /* Example 3 */ #suggest_results.example3 ol li span.info { color: #888; - font-size: 12px; } diff --git a/demo/server-side.php b/demo/server-side.php index ea0fde1..5c3711b 100644 --- a/demo/server-side.php +++ b/demo/server-side.php @@ -57,27 +57,27 @@ "North Yorkshire", "Nottinghamshire" ); - $aImg = array( - "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", - "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", - "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", - "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", - "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", - "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", - "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", - "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", - "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", - "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", - "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", - "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", - "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", - "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", - "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", - "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", "demo/cast2", - "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", "demo/cast1", - "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", "demo/cast6", - "demo/cast1", "demo/cast2", "demo/cast3", "demo/cast4", "demo/cast5", - "demo/cast6", "demo/cast1", "demo/cast2", "demo/cast3", + $aHref = array( + "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", + "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", + "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", + "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", + "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", + "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", + "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", + "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", + "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", + "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", + "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", + "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", + "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", + "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", + "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", + "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", "/demo/user/2", + "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", "/demo/user/1", + "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", "/demo/user/6", + "/demo/user/1", "/demo/user/2", "/demo/user/3", "/demo/user/4", "/demo/user/5", + "/demo/user/6", "/demo/user/1", "/demo/user/2", "/demo/user/3", ); @@ -104,7 +104,7 @@ "id"=>($i+1), "title"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]), - "href"=>$aImg[$i], + "href"=>$aHref[$i], ); } diff --git a/suggest_results/jquery.suggest_results.css b/suggest_results/jquery.suggest_results.css index e6dc6ed..9f93e99 100644 --- a/suggest_results/jquery.suggest_results.css +++ b/suggest_results/jquery.suggest_results.css @@ -1,6 +1,6 @@ #suggest_results { - border-bottom: 1px solid #efefef; + border-bottom: 1px solid rgba(187,187,187,0.5); display: none; position: absolute; z-index: 1000; @@ -21,7 +21,12 @@ } #suggest_results li.result { - display: block; + +} + +#suggest_results li.label { + padding: 3px 5px; + color: #888; } #suggest_results li.first { @@ -33,6 +38,7 @@ } #suggest_results li.result a { + color: #000; display: block; padding: 3px 5px; text-decoration: none; diff --git a/suggest_results/jquery.suggest_results.js b/suggest_results/jquery.suggest_results.js index 5d0414e..d720492 100644 --- a/suggest_results/jquery.suggest_results.js +++ b/suggest_results/jquery.suggest_results.js @@ -65,7 +65,7 @@ self.query_for_data(elm, options); } else { self.current_results = self.filter_data(terms, options.data, options); - self.prerender(self.current_results, options); + self.prerender(elm, self.current_results, options); }; }; @@ -76,22 +76,24 @@ self.selected_result = null; }; - $.fn.suggest_results.no_results = function(options){ + $.fn.suggest_results.no_results = function(elm, options){ var self = $.fn.suggest_results; - if (options.empty) { - //TODO display "No Results" label. + if (options.empty && elm.val() !== "") { + var meta = {label: options.empty_label, "class": "last"}; + self.list.html(self.mustache(options.tpl_label, meta)); + self.show(); } else { self.hide(0); }; }; - $.fn.suggest_results.prerender = function(results, options){ + $.fn.suggest_results.prerender = function(elm, results, options){ var self = $.fn.suggest_results; if (results.length > 0) { self.render(results, options); self.show(); } else { - self.no_results(options); + self.no_results(elm, options); }; }; @@ -107,8 +109,7 @@ html += self.mustache(options.tpl_result_body, meta); html += self.mustache(options.tpl_result_end, meta); }; - self.list.html(""); - self.list.append(html); + self.list.html(html); $(".result", self.list).click(function(){ self.redirect_to($("a", $(this)).attr("href")); }); @@ -237,7 +238,7 @@ if (term !== "") { if (self.query_cache.hasOwnProperty(uid)) { self.current_results = self.query_cache[uid]; - self.prerender(self.current_results, options); + self.prerender(elm, self.current_results, options); } else { var data = { limit: options.limit }; data[options.url_query_var] = term; @@ -249,12 +250,12 @@ success: function(response){ self.current_results = response.results; self.query_cache[uid] = self.current_results; - self.prerender(self.current_results, options); + self.prerender(elm, self.current_results, options); } }); }; } else { - self.no_results(options); + self.no_results(elm, options); }; return []; }; @@ -329,7 +330,7 @@ url: null, url_query_var: "search", url_method: "get", - empty: false, + empty: true, empty_label: "No Results", name: "", delay: 100, @@ -341,7 +342,7 @@ tpl_result_begin: '
  • ', tpl_result_body: '{{title}}', tpl_result_end: '
  • ', - tpl_label: '
  • ' //TODO add support for labels/categories + tpl_label: '
  • {{label}}
  • ' //TODO add support for labels/categories }; })(jQuery);