├── README.md ├── demos ├── api.html ├── bg-image.html ├── custom-editor.html ├── fixed-values.html ├── multipage.html ├── size-position.html ├── standard.html └── targets │ ├── complex.html │ ├── css │ └── style.css │ ├── images │ ├── bg1.jpg │ ├── bg2.jpg │ └── bg3.jpg │ └── simple.html ├── dependencies ├── chosen │ ├── chosen-sprite.png │ ├── chosen-sprite@2x.png │ ├── chosen.css │ ├── chosen.jquery.js │ ├── chosen.jquery.min.js │ ├── chosen.min.css │ ├── chosen.proto.js │ └── chosen.proto.min.js ├── jscolor │ ├── arrow.gif │ ├── cross.gif │ ├── hs.png │ ├── hv.png │ └── jscolor.js └── microtpl.js └── source └── livecsseditor ├── editors ├── lceBackground.js ├── lceColor.js ├── lceFont.js ├── lcePosition.js └── lceSize.js ├── livecsseditor-2.0.css └── livecsseditor-2.0.js /README.md: -------------------------------------------------------------------------------- 1 | # Live CSS Editor 2 | 3 | ## Overview 4 | 5 | Live CSS Editor (LCE) is jquery plugin, "themeroller like" tool for customizing your web page design. Basically, you provide json with configuration and LCE shows: live preview and CSS editor with ability to edit properties you defined. So you can control which properties can be customized. 6 | 7 | ## Demo 8 | 9 | http://rukavina.github.com/live-css-editor/demo 10 | 11 | ## Installation and setup 12 | 13 | You have to include this dependencies in your page (head): 14 | 15 | ```html 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ``` 29 | 30 | In the page's body provide div where editor will be placed - give it enough space. Note: there cannot be 2 LCEs on a single page. 31 | 32 | ```html 33 |
34 | ``` 35 | 36 | Init LCE when document is ready, ex. 37 | 38 | ```javascript 39 | $(document).ready(function(){ 40 | $('#livecsseditor').livecsseditor({ 41 | pages: { 42 | 'targets/simple.html': { 43 | name: 'First Page', 44 | def: { 45 | 'h1':{ 46 | name: 'Heading', 47 | props:['color','background-color','font-family','font-weight','text-align'], 48 | labels: ['Color','Background color','Font','Font Weight','Align'], 49 | description: 'Update heading here', 50 | editorsConfig:{ 51 | "font-family": { 52 | "names": ["Verdana","Arial", "Times New Roman"] 53 | } 54 | }, 55 | iconClass: "glyphicon glyphicon-star" 56 | }, 57 | 'p,span':{ 58 | name: 'Text', 59 | props:['font-size','color'], 60 | labels: ['Font size','Color'], 61 | editorsConfig:{ 62 | "font-size": { 63 | "fixedValues": ["original","10px","11px","12px"] 64 | } 65 | }, 66 | iconClass: "glyphicon glyphicon-font" 67 | } 68 | } 69 | } 70 | } 71 | }); 72 | }); 73 | ``` 74 | 75 | ## Options 76 | 77 | 78 | |option | description | default | possible values| 79 | |-------|-------------|---------|----------------| 80 | |**pages**|JSON definition of pages, styles and properties to be customized|null|Object| 81 | |**layout_tpl**|[Micro template](http://ejohn.org/blog/javascript-micro-templating/) layout|__default template__|String| 82 | |**props_tp**l|[Micro template](http://ejohn.org/blog/javascript-micro-templating/) property list layout|__default template__|String| 83 | |**hoverColor**|Background color or selected element in the live preview|#faf3ba|String| 84 | 85 | 86 | ## Methods 87 | 88 | ### getCss( pagePath ) 89 | 90 | Get customized css string for defined page `pagePath` or all pages 91 | 92 | Returns: **String** 93 | 94 | - **pagePath**, Type: String, Default: null 95 | 96 | ```javascript 97 | $('.selector').livecsseditor('getCss','page.html'); 98 | ``` 99 | 100 | * * * 101 | 102 | ### getJson( pagePath ) 103 | 104 | Get customized JSON Object for defined page `pagePath` or all pages 105 | 106 | Returns: **Object** 107 | 108 | - **pagePath**, Type: String, Default: null 109 | 110 | ```javascript 111 | $('.selector').livecsseditor('getJson','page.html'); 112 | ``` 113 | 114 | * * * 115 | 116 | ### setJson( jsonObject ) 117 | 118 | Set JSON Object for customized prepared style 119 | 120 | - **jsonObject**, Type: Object, Default: null 121 | 122 | ```javascript 123 | $('.selector').livecsseditor('setJson',{ 124 | "page.html":{ 125 | "h1": { 126 | "background-color": "#F9FF40", 127 | "color": "#FA2B46" 128 | } 129 | } 130 | }); 131 | ``` 132 | 133 | ## Examples 134 | 135 | * * * 136 | 137 | ### Standard Setup 138 | 139 | [VIEW DEMO](demos/standard.html) 140 | 141 | Follow standard installation. Start livecsseditor when the document is ready. 142 | 143 | ```javascript 144 | $('#livecsseditor').livecsseditor({ 145 | pages: { 146 | 'targets/simple.html': { 147 | name: 'First Page', 148 | def: { 149 | 'h1':{ 150 | name: 'Heading', 151 | props:['color','background-color','font-family','font-weight','text-align'], 152 | labels: ['Color','Background color','Font','Font Weight','Align'], 153 | description: 'Update heading here', 154 | editorsConfig:{ 155 | "font-family": { 156 | "names": ["Verdana","Arial", "Times New Roman"] 157 | } 158 | }, 159 | iconClass: "glyphicon glyphicon-star" 160 | }, 161 | 'p,span':{ 162 | name: 'Text', 163 | props:['font-size','color'], 164 | labels: ['Font size','Color'], 165 | editorsConfig:{ 166 | "font-size": { 167 | "fixedValues": ["original","10px","11px","12px"] 168 | } 169 | }, 170 | iconClass: "glyphicon glyphicon-font" 171 | } 172 | } 173 | } 174 | } 175 | }); 176 | ``` 177 | 178 | Options JSON has the following structure: 179 | 180 | * **pages** 181 | * _page url_ URL to a page to be customized 182 | * **name** Descriptive page name 183 | * **def** 184 | * _element css selector_ CSS selector of a DOM element 185 | * **name** Descriptive element name 186 | * **props** Array of editable CSS properties 187 | * **labels** Array of descriptive names of editable properties 188 | * **description** Description of the current element 189 | * **iconClass** Optional element's icons css class 190 | * **editorsConfig** Optional properties for particular editors 191 | * _property_ Value for each key is configuration for particular editor 192 | 193 | * * * 194 | 195 | ### Multipage Setup 196 | 197 | [VIEW DEMO](demos/multipage.html) 198 | 199 | Livecsseditor let you manage multiple pages from the same screen. 200 | 201 | * * * 202 | 203 | ### Size and Position Editors 204 | 205 | [VIEW DEMO](demos/size-position.html) 206 | 207 | In this example we have included custom position and size editors for in place, WYSIWYG editing. After standard installation you need to include these 2 editors: 208 | 209 | ```html 210 | 211 | 212 | ``` 213 | 214 | Options JSON has to include definition for this properties on proper elements: 215 | 216 | ```javascript 217 | 'div.resizable':{ 218 | name:'Resizable', 219 | props:['width','height'], 220 | iconClass: "glyphicon glyphicon-fullscreen" 221 | }, 222 | 'div.movable':{ 223 | name:'Movable', 224 | props:['left','top'], 225 | iconClass: "glyphicon glyphicon-fullscreen" 226 | } 227 | ``` 228 | 229 | Note that movable element needs to have absolute position in order to be draggable. 230 | 231 | * * * 232 | 233 | ### Background image editor 234 | 235 | [VIEW DEMO](demos/bg-image.html) 236 | 237 | Selecting a background image for your elements is more of a backend task, thus you might want to create custom editor with integrated file manager or similar. 238 | 239 | Still, there's a simple built-in option. Basically, it's a simple select box with predefined options provided by you. 240 | 241 | ```javascript 242 | 'div.resizable':{ 243 | name:'BG Image', 244 | props:['background-image'], 245 | labels: ['Background Image'], 246 | description: 'Choose BG Image', 247 | editorsConfig:{ 248 | "background-image": { 249 | "urls": ["images/bg1.jpg","images/bg2.jpg", "images/bg3.jpg"] 250 | } 251 | }, 252 | iconClass: "glyphicon glyphicon-fullscreen" 253 | } 254 | ``` 255 | * * * 256 | 257 | ### API Interaction 258 | 259 | [VIEW DEMO](demos/api.html) 260 | 261 | livecsseditor has two methods`getCss` and`getJson` for you to store somewhere definition of made customization. On the hand,`setJson` provides a way to load styles from JSON object: 262 | 263 | Options JSON has to include definition for this properties on proper elements: 264 | 265 | ```javascript 266 | //css button 267 | $('#cssBtn').click(function(){ 268 | alert($('#livecsseditor').livecsseditor('getCss','targets/complex.html')); 269 | }); 270 | //json get button 271 | $('#jsonBtn').click(function(){ 272 | console.log($('#livecsseditor').livecsseditor('getJson','targets/complex.html')); 273 | }); 274 | //json set button 275 | $('#jsonSetBtn').click(function(){ 276 | $('#livecsseditor').livecsseditor('setJson',{ 277 | "targets/complex.html":{ 278 | "h1": { 279 | "background-color": "#F9FF40", 280 | "color": "#FA2B46" 281 | } 282 | } 283 | }); 284 | }); 285 | ``` 286 | * * * 287 | 288 | ### Custom Editor 289 | 290 | [VIEW DEMO](demos/custom-editor.html) 291 | 292 | Whenever you are not satisfied with built-in editor or you need some custom editing logic, you can easily plug in your custom editing function. 293 | 294 | In this example we attached our custom color editor. Let's say we want our users to choose just red or green color, peace of cake: 295 | 296 | ```javascript 297 | $.fn.livecsseditor.setPropertyEditor(['color','background-color'], 298 | function customColorEditor(customizer, vars, config){ 299 | var $select = $('<select class="form-control"></select>'), 300 | html = '', 301 | options = { 302 | "original": "", 303 | "#FF0000": "Red", 304 | "#00FF00": "Green" 305 | }; 306 | vars.container.append($select); 307 | for(var value in options){ 308 | var selected = ''; 309 | if (vars.value == value) { 310 | selected = ' selected="selected"'; 311 | } 312 | html += '<option value="' + value + '"' + selected + '">' + options[value] + '</option>'; 313 | } 314 | $select.html(html).change(function(){ 315 | vars.setValue($(this).val()); 316 | }) 317 | }); 318 | ``` 319 | 320 | We attached editor function using`$.fn.livecsseditor.setPropertyEditor`. Basically, we define in this call which properties we edit and callback function. During callback execution, livecsseditor provides 3 arguments: 321 | 322 | * **customizer** - livecsseditor instance 323 | * **vars** - running environment: value, setValue function, etc. 324 | * **config** - editor local configuration 325 | 326 | * * * 327 | 328 | ### Fixed values 329 | 330 | [VIEW DEMO](demos/fixed-values.html) 331 | 332 | Whenever you want to limit available options to predefined set, there's no need to create custom editor, you can just define property editor configuration: 333 | 334 | ```javascript 335 | $('#livecsseditor').livecsseditor({ 336 | pages: { 337 | 'targets/complex.html': { 338 | name: 'Complex page', 339 | def: { 340 | 'h1':{ 341 | name: 'Heading', 342 | props:['font-size'], 343 | labels: ['Font size'], 344 | editorsConfig:{ 345 | "font-size": { 346 | "fixedValues": ["14px","15px", "16px"] 347 | } 348 | }, 349 | iconClass: "glyphicon glyphicon-star" 350 | } 351 | } 352 | } 353 | } 354 | }); 355 | ``` 356 | 357 | ## Credits 358 | 359 | This projects was inspired or uses the following projects: 360 | 361 | * [jquery](http://jquery.com/) 362 | * [JavaScript Micro-Templating](JavaScript Micro-Templating) 363 | * [twitter bootstrap](http://twitter.github.com/bootstrap/) 364 | * [jquery themeroller](http://jqueryui.com/themeroller/) 365 | * [bootstrap colorpicker](http://www.eyecon.ro/bootstrap-colorpicker) 366 | 367 | ## Licence 368 | 369 | The MIT License (MIT) 370 | 371 | Copyright (c) 2012 Milan Rukavina 372 | 373 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 374 | 375 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 376 | 377 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /demos/api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mollis, leo ut hendrerit molestie, nunc velit commodo urna, aliquet vehicula eros quam nec neque. Etiam quis elementum justo. Proin eget nunc erat. Nam et ullamcorper est. Suspendisse tincidunt, odio in varius fringilla, nunc est pellentesque sem, a sagittis libero urna a lacus. Ut sed augue eu massa faucibus pellentesque. Nam vel elit arcu, nec fringilla tellus. Vestibulum quis volutpat elit. Aenean eu odio diam. Aenean imperdiet condimentum tortor, venenatis varius ipsum cursus viverra. Nunc commodo cursus turpis sit amet viverra. Mauris a urna a quam varius consectetur. Duis fringilla erat ac urna ultricies ac adipiscing ipsum tincidunt. Nullam sagittis consectetur lorem in commodo. Aliquam bibendum egestas mi vel lacinia. Mauris non odio odio, faucibus euismod leo.
11 |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mollis, leo ut hendrerit molestie, nunc velit commodo urna, aliquet vehicula eros quam nec neque. Etiam quis elementum justo. Proin eget nunc erat. Nam et ullamcorper est. Suspendisse tincidunt, odio in varius fringilla, nunc est pellentesque sem, a sagittis libero urna a lacus. Ut sed augue eu massa faucibus pellentesque. Nam vel elit arcu, nec fringilla tellus. Vestibulum quis volutpat elit. Aenean eu odio diam. Aenean imperdiet condimentum tortor, venenatis varius ipsum cursus viverra. Nunc commodo cursus turpis sit amet viverra. Mauris a urna a quam varius consectetur. Duis fringilla erat ac urna ultricies ac adipiscing ipsum tincidunt. Nullam sagittis consectetur lorem in commodo. Aliquam bibendum egestas mi vel lacinia. Mauris non odio odio, faucibus euismod leo.
10 | 11 | 12 | -------------------------------------------------------------------------------- /dependencies/chosen/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rukavina/live-css-editor/7f40d64708d85c1ec0708e677b48971fd28aba2b/dependencies/chosen/chosen-sprite.png -------------------------------------------------------------------------------- /dependencies/chosen/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rukavina/live-css-editor/7f40d64708d85c1ec0708e677b48971fd28aba2b/dependencies/chosen/chosen-sprite@2x.png -------------------------------------------------------------------------------- /dependencies/chosen/chosen.css: -------------------------------------------------------------------------------- 1 | /* @group Base */ 2 | .chosen-container { 3 | position: relative; 4 | display: inline-block; 5 | vertical-align: middle; 6 | font-size: 13px; 7 | zoom: 1; 8 | *display: inline; 9 | -webkit-user-select: none; 10 | -moz-user-select: none; 11 | user-select: none; 12 | } 13 | .chosen-container .chosen-drop { 14 | position: absolute; 15 | top: 100%; 16 | left: -9999px; 17 | z-index: 1010; 18 | -webkit-box-sizing: border-box; 19 | -moz-box-sizing: border-box; 20 | box-sizing: border-box; 21 | width: 100%; 22 | border: 1px solid #aaa; 23 | border-top: 0; 24 | background: #fff; 25 | box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); 26 | } 27 | .chosen-container.chosen-with-drop .chosen-drop { 28 | left: 0; 29 | } 30 | .chosen-container a { 31 | cursor: pointer; 32 | } 33 | 34 | /* @end */ 35 | /* @group Single Chosen */ 36 | .chosen-container-single .chosen-single { 37 | position: relative; 38 | display: block; 39 | overflow: hidden; 40 | padding: 0 0 0 8px; 41 | height: 23px; 42 | border: 1px solid #aaa; 43 | border-radius: 5px; 44 | background-color: #fff; 45 | background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); 46 | background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 47 | background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 48 | background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 49 | background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 50 | background-clip: padding-box; 51 | box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); 52 | color: #444; 53 | text-decoration: none; 54 | white-space: nowrap; 55 | line-height: 24px; 56 | } 57 | .chosen-container-single .chosen-default { 58 | color: #999; 59 | } 60 | .chosen-container-single .chosen-single span { 61 | display: block; 62 | overflow: hidden; 63 | margin-right: 26px; 64 | text-overflow: ellipsis; 65 | white-space: nowrap; 66 | } 67 | .chosen-container-single .chosen-single-with-deselect span { 68 | margin-right: 38px; 69 | } 70 | .chosen-container-single .chosen-single abbr { 71 | position: absolute; 72 | top: 6px; 73 | right: 26px; 74 | display: block; 75 | width: 12px; 76 | height: 12px; 77 | background: url('chosen-sprite.png') -42px 1px no-repeat; 78 | font-size: 1px; 79 | } 80 | .chosen-container-single .chosen-single abbr:hover { 81 | background-position: -42px -10px; 82 | } 83 | .chosen-container-single.chosen-disabled .chosen-single abbr:hover { 84 | background-position: -42px -10px; 85 | } 86 | .chosen-container-single .chosen-single div { 87 | position: absolute; 88 | top: 0; 89 | right: 0; 90 | display: block; 91 | width: 18px; 92 | height: 100%; 93 | } 94 | .chosen-container-single .chosen-single div b { 95 | display: block; 96 | width: 100%; 97 | height: 100%; 98 | background: url('chosen-sprite.png') no-repeat 0px 2px; 99 | } 100 | .chosen-container-single .chosen-search { 101 | position: relative; 102 | z-index: 1010; 103 | margin: 0; 104 | padding: 3px 4px; 105 | white-space: nowrap; 106 | } 107 | .chosen-container-single .chosen-search input[type="text"] { 108 | -webkit-box-sizing: border-box; 109 | -moz-box-sizing: border-box; 110 | box-sizing: border-box; 111 | margin: 1px 0; 112 | padding: 4px 20px 4px 5px; 113 | width: 100%; 114 | height: auto; 115 | outline: 0; 116 | border: 1px solid #aaa; 117 | background: white url('chosen-sprite.png') no-repeat 100% -20px; 118 | background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); 119 | background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); 120 | background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); 121 | background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); 122 | background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); 123 | font-size: 1em; 124 | font-family: sans-serif; 125 | line-height: normal; 126 | border-radius: 0; 127 | } 128 | .chosen-container-single .chosen-drop { 129 | margin-top: -1px; 130 | border-radius: 0 0 4px 4px; 131 | background-clip: padding-box; 132 | } 133 | .chosen-container-single.chosen-container-single-nosearch .chosen-search { 134 | position: absolute; 135 | left: -9999px; 136 | } 137 | 138 | /* @end */ 139 | /* @group Results */ 140 | .chosen-container .chosen-results { 141 | position: relative; 142 | overflow-x: hidden; 143 | overflow-y: auto; 144 | margin: 0 4px 4px 0; 145 | padding: 0 0 0 4px; 146 | max-height: 240px; 147 | -webkit-overflow-scrolling: touch; 148 | } 149 | .chosen-container .chosen-results li { 150 | display: none; 151 | margin: 0; 152 | padding: 5px 6px; 153 | list-style: none; 154 | line-height: 15px; 155 | } 156 | .chosen-container .chosen-results li.active-result { 157 | display: list-item; 158 | cursor: pointer; 159 | } 160 | .chosen-container .chosen-results li.disabled-result { 161 | display: list-item; 162 | color: #ccc; 163 | cursor: default; 164 | } 165 | .chosen-container .chosen-results li.highlighted { 166 | background-color: #3875d7; 167 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); 168 | background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); 169 | background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); 170 | background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); 171 | background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); 172 | color: #fff; 173 | } 174 | .chosen-container .chosen-results li.no-results { 175 | display: list-item; 176 | background: #f4f4f4; 177 | } 178 | .chosen-container .chosen-results li.group-result { 179 | display: list-item; 180 | font-weight: bold; 181 | cursor: default; 182 | } 183 | .chosen-container .chosen-results li.group-option { 184 | padding-left: 15px; 185 | } 186 | .chosen-container .chosen-results li em { 187 | font-style: normal; 188 | text-decoration: underline; 189 | } 190 | 191 | /* @end */ 192 | /* @group Multi Chosen */ 193 | .chosen-container-multi .chosen-choices { 194 | position: relative; 195 | overflow: hidden; 196 | -webkit-box-sizing: border-box; 197 | -moz-box-sizing: border-box; 198 | box-sizing: border-box; 199 | margin: 0; 200 | padding: 0; 201 | width: 100%; 202 | height: auto !important; 203 | height: 1%; 204 | border: 1px solid #aaa; 205 | background-color: #fff; 206 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); 207 | background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); 208 | background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); 209 | background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%); 210 | background-image: linear-gradient(#eeeeee 1%, #ffffff 15%); 211 | cursor: text; 212 | } 213 | .chosen-container-multi .chosen-choices li { 214 | float: left; 215 | list-style: none; 216 | } 217 | .chosen-container-multi .chosen-choices li.search-field { 218 | margin: 0; 219 | padding: 0; 220 | white-space: nowrap; 221 | } 222 | .chosen-container-multi .chosen-choices li.search-field input[type="text"] { 223 | margin: 1px 0; 224 | padding: 5px; 225 | height: 15px; 226 | outline: 0; 227 | border: 0 !important; 228 | background: transparent !important; 229 | box-shadow: none; 230 | color: #666; 231 | font-size: 100%; 232 | font-family: sans-serif; 233 | line-height: normal; 234 | border-radius: 0; 235 | } 236 | .chosen-container-multi .chosen-choices li.search-field .default { 237 | color: #999; 238 | } 239 | .chosen-container-multi .chosen-choices li.search-choice { 240 | position: relative; 241 | margin: 3px 0 3px 5px; 242 | padding: 3px 20px 3px 5px; 243 | border: 1px solid #aaa; 244 | border-radius: 3px; 245 | background-color: #e4e4e4; 246 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); 247 | background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 248 | background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 249 | background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 250 | background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 251 | background-clip: padding-box; 252 | box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); 253 | color: #333; 254 | line-height: 13px; 255 | cursor: default; 256 | } 257 | .chosen-container-multi .chosen-choices li.search-choice .search-choice-close { 258 | position: absolute; 259 | top: 4px; 260 | right: 3px; 261 | display: block; 262 | width: 12px; 263 | height: 12px; 264 | background: url('chosen-sprite.png') -42px 1px no-repeat; 265 | font-size: 1px; 266 | } 267 | .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { 268 | background-position: -42px -10px; 269 | } 270 | .chosen-container-multi .chosen-choices li.search-choice-disabled { 271 | padding-right: 5px; 272 | border: 1px solid #ccc; 273 | background-color: #e4e4e4; 274 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); 275 | background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 276 | background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 277 | background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 278 | background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 279 | color: #666; 280 | } 281 | .chosen-container-multi .chosen-choices li.search-choice-focus { 282 | background: #d4d4d4; 283 | } 284 | .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { 285 | background-position: -42px -10px; 286 | } 287 | .chosen-container-multi .chosen-results { 288 | margin: 0; 289 | padding: 0; 290 | } 291 | .chosen-container-multi .chosen-drop .result-selected { 292 | display: list-item; 293 | color: #ccc; 294 | cursor: default; 295 | } 296 | 297 | /* @end */ 298 | /* @group Active */ 299 | .chosen-container-active .chosen-single { 300 | border: 1px solid #5897fb; 301 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 302 | } 303 | .chosen-container-active.chosen-with-drop .chosen-single { 304 | border: 1px solid #aaa; 305 | -moz-border-radius-bottomright: 0; 306 | border-bottom-right-radius: 0; 307 | -moz-border-radius-bottomleft: 0; 308 | border-bottom-left-radius: 0; 309 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); 310 | background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%); 311 | background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); 312 | background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); 313 | background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); 314 | box-shadow: 0 1px 0 #fff inset; 315 | } 316 | .chosen-container-active.chosen-with-drop .chosen-single div { 317 | border-left: none; 318 | background: transparent; 319 | } 320 | .chosen-container-active.chosen-with-drop .chosen-single div b { 321 | background-position: -18px 2px; 322 | } 323 | .chosen-container-active .chosen-choices { 324 | border: 1px solid #5897fb; 325 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 326 | } 327 | .chosen-container-active .chosen-choices li.search-field input[type="text"] { 328 | color: #111 !important; 329 | } 330 | 331 | /* @end */ 332 | /* @group Disabled Support */ 333 | .chosen-disabled { 334 | opacity: 0.5 !important; 335 | cursor: default; 336 | } 337 | .chosen-disabled .chosen-single { 338 | cursor: default; 339 | } 340 | .chosen-disabled .chosen-choices .search-choice .search-choice-close { 341 | cursor: default; 342 | } 343 | 344 | /* @end */ 345 | /* @group Right to Left */ 346 | .chosen-rtl { 347 | text-align: right; 348 | } 349 | .chosen-rtl .chosen-single { 350 | overflow: visible; 351 | padding: 0 8px 0 0; 352 | } 353 | .chosen-rtl .chosen-single span { 354 | margin-right: 0; 355 | margin-left: 26px; 356 | direction: rtl; 357 | } 358 | .chosen-rtl .chosen-single-with-deselect span { 359 | margin-left: 38px; 360 | } 361 | .chosen-rtl .chosen-single div { 362 | right: auto; 363 | left: 3px; 364 | } 365 | .chosen-rtl .chosen-single abbr { 366 | right: auto; 367 | left: 26px; 368 | } 369 | .chosen-rtl .chosen-choices li { 370 | float: right; 371 | } 372 | .chosen-rtl .chosen-choices li.search-field input[type="text"] { 373 | direction: rtl; 374 | } 375 | .chosen-rtl .chosen-choices li.search-choice { 376 | margin: 3px 5px 3px 0; 377 | padding: 3px 5px 3px 19px; 378 | } 379 | .chosen-rtl .chosen-choices li.search-choice .search-choice-close { 380 | right: auto; 381 | left: 4px; 382 | } 383 | .chosen-rtl.chosen-container-single-nosearch .chosen-search, 384 | .chosen-rtl .chosen-drop { 385 | left: 9999px; 386 | } 387 | .chosen-rtl.chosen-container-single .chosen-results { 388 | margin: 0 0 4px 4px; 389 | padding: 0 4px 0 0; 390 | } 391 | .chosen-rtl .chosen-results li.group-option { 392 | padding-right: 15px; 393 | padding-left: 0; 394 | } 395 | .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { 396 | border-right: none; 397 | } 398 | .chosen-rtl .chosen-search input[type="text"] { 399 | padding: 4px 5px 4px 20px; 400 | background: white url('chosen-sprite.png') no-repeat -30px -20px; 401 | background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); 402 | background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); 403 | background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); 404 | background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); 405 | background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); 406 | direction: rtl; 407 | } 408 | .chosen-rtl.chosen-container-single .chosen-single div b { 409 | background-position: 6px 2px; 410 | } 411 | .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { 412 | background-position: -12px 2px; 413 | } 414 | 415 | /* @end */ 416 | /* @group Retina compatibility */ 417 | @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { 418 | .chosen-rtl .chosen-search input[type="text"], 419 | .chosen-container-single .chosen-single abbr, 420 | .chosen-container-single .chosen-single div b, 421 | .chosen-container-single .chosen-search input[type="text"], 422 | .chosen-container-multi .chosen-choices .search-choice .search-choice-close, 423 | .chosen-container .chosen-results-scroll-down span, 424 | .chosen-container .chosen-results-scroll-up span { 425 | background-image: url('chosen-sprite@2x.png') !important; 426 | background-size: 52px 37px !important; 427 | background-repeat: no-repeat !important; 428 | } 429 | } 430 | /* @end */ 431 | -------------------------------------------------------------------------------- /dependencies/chosen/chosen.jquery.min.js: -------------------------------------------------------------------------------- 1 | /* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ 2 | !function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=""!==a.style.cssText?' style="'+a.style+'"':"",'