-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
5 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
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
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,34 @@ | ||
.autocomplete-suggestions { | ||
border: 1px solid #999; | ||
background: #FFF; | ||
cursor: default; | ||
overflow: auto; | ||
-webkit-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); | ||
-moz-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); | ||
box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); | ||
} | ||
.autocomplete-suggestion { | ||
padding: 2px 5px; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
} | ||
.autocomplete-no-suggestion { | ||
padding: 2px 5px; | ||
} | ||
.autocomplete-selected { | ||
background: #F0F0F0; | ||
} | ||
.autocomplete-suggestions strong { | ||
font-weight: bold; | ||
color: #000; | ||
} | ||
.autocomplete-group { | ||
padding: 2px 5px; | ||
} | ||
.autocomplete-group strong { | ||
font-weight: bold; | ||
font-size: 16px; | ||
color: #000; | ||
display: block; | ||
border-bottom: 1px solid #000; | ||
} |
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,52 @@ | ||
/** | ||
* Autocomplete | ||
* | ||
* @module ls/autocomplete | ||
* | ||
* @license GNU General Public License, version 2 | ||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com} | ||
* @author Denis Shakhov <denis.shakhov@gmail.com> | ||
*/ | ||
|
||
(function($) { | ||
"use strict"; | ||
|
||
$.widget( "livestreet.lsAutocomplete", { | ||
/** | ||
* Дефолтные опции | ||
*/ | ||
options: { | ||
multiple: false, | ||
// Ссылки | ||
urls: { | ||
load: null | ||
}, | ||
responseName: 'aItems', | ||
params: {} | ||
}, | ||
|
||
/** | ||
* Конструктор | ||
* | ||
* @constructor | ||
* @private | ||
*/ | ||
_create: function () { | ||
this.element.autocomplete({ | ||
serviceUrl: this.option( 'urls.load' ), | ||
type: 'POST', | ||
dataType: 'json', | ||
paramName: 'value', | ||
delimiter: this.option( 'multiple' ) ? ',' : null, | ||
transformResult: function(response) { | ||
return { | ||
suggestions: response[ this.option( 'responseName' ) ] | ||
}; | ||
}.bind(this), | ||
params: { | ||
security_ls_key: LIVESTREET_SECURITY_KEY | ||
} | ||
}); | ||
} | ||
}); | ||
})(jQuery); |
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 |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
"ls-core": "*" | ||
}, | ||
"scripts": { | ||
"vendor-widget": "vendor/widget.js", | ||
"ls-component": "js/ls-component.js" | ||
} | ||
} |
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