Update Semantic
Fixes #40,#24
This commit is contained in:
parent
1715f27f44
commit
2027b94179
621 changed files with 172488 additions and 15939 deletions
127
web/semantic/src/README.md
Normal file
127
web/semantic/src/README.md
Normal file
|
@ -0,0 +1,127 @@
|
|||
## Setup
|
||||
|
||||
### Built-In Tools
|
||||
|
||||
From the Semantic directory you can setup gulp to build Semantic by running.
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Semantic will automatically configure itself using a `post-install` script built into the package.
|
||||
|
||||
After set-up can use gulp to build your project's css:
|
||||
```bash
|
||||
/* Watch files */
|
||||
gulp watch
|
||||
|
||||
/* Build all files */
|
||||
gulp build
|
||||
```
|
||||
|
||||
Visit the [Getting Started Guide](http://learnsemantic.com/guide/expert.html) for more details on set-up
|
||||
|
||||
### Custom Pipelines
|
||||
|
||||
#### Importing Gulp Tasks
|
||||
|
||||
Each gulp task can be imported into your own Gulpfile using `require`
|
||||
|
||||
```javascript
|
||||
var
|
||||
watch = require('path/to/semantic/tasks/watch')
|
||||
;
|
||||
gulp.task('watch ui', 'Watch Semantic UI', watch));
|
||||
```
|
||||
|
||||
#### Importing LESS
|
||||
|
||||
> LESS files do not contain vendor prefixes. If you are to use these files directly you must add them during your build step.
|
||||
|
||||
Before using source files you will need to create a `theme.config` by renaming `theme.config.example`, and a site folder by renaming `_site/` to `site/`
|
||||
|
||||
You can then import Semantic from your own LESS files:
|
||||
```less
|
||||
/* Import all components */
|
||||
@import 'src/semantic';
|
||||
```
|
||||
|
||||
To import individual components you will have to create a scope for each import using `& {}`
|
||||
```less
|
||||
/* Import a specific component */
|
||||
& { @import 'src/definitions/elements/button'; }
|
||||
```
|
||||
|
||||
### Config Files
|
||||
|
||||
These files are generated automatically using install scripts, but must be manually renamed if you are using installing manually.
|
||||
|
||||
filename | usage | Initial Name
|
||||
--- | --- | ---
|
||||
**theme.config** | config file that stores each element's current theme for LESS | theme.config.example
|
||||
**site/** | folder storing all your site's variables and css overrides for each UI component | _site/
|
||||
**semantic.json** | stores folder paths for build tools and current installed version for updates. Only necessary when using build tools | semantic.json.example
|
||||
|
||||
|
||||
### Workflow
|
||||
|
||||
You will only need to use Semantic's build tools while refining your UI. When designing pages, you can rely on the compiled css packages in `dist/`.
|
||||
|
||||
When creating your UI you can try <a href="http://www.learnsemantic.com/themes/creating.html">downloading different themes</a>, adjusting your <a href="http://www.learnsemantic.com/developing/customizing.html#setting-global-variables">site-wide settings</a> (font-family, colors, etc) and tweaking components in your site's <a href="http://www.learnsemantic.com/developing/customizing.html#designing-for-the-long-now">component overrides</a>.
|
||||
|
||||
Files in the `examples/` folder of your project can be useful for testing out changes in your UI. For example, you might run `gulp watch` download a new theme to `src/site/themes/` then adjust your `theme.config` file with the name of the new theme and refresh `examples/kitchensink.html` to inspect changes in the theme.
|
||||
|
||||
## Theming
|
||||
|
||||
### Concepts
|
||||
|
||||
#### Inheritance
|
||||
|
||||
There are three levels of inheritance in Semantic
|
||||
* Default theme - Semantic UI's neutral default theme
|
||||
* Packaged theme - A specified packaged theme, like "amazon", or "material"
|
||||
* Site theme - A theme specific to your site
|
||||
|
||||
#### Folder Structure
|
||||
|
||||
* `definitions/` contains the `css` and `javascript` definitions for each component
|
||||
* `themes/` contains *pre-packaged themes* including Semantic's default theme
|
||||
* `site/` contains your current site's theme
|
||||
|
||||
View the [Theming Guide](http://learnsemantic.com/themes/overview.html) for a more in-depth look
|
||||
|
||||
## Customizing
|
||||
|
||||
#### Basic Customization
|
||||
|
||||
The best way to start customizing is to specify overriding variables in your site's `site.variables` file.
|
||||
|
||||
This is a blank stub file that lets you specify variables that overriding variables.
|
||||
|
||||
Some important values to customize:
|
||||
* Base font size
|
||||
* Named color hex codes
|
||||
* Header/Page Font-families
|
||||
* Primary and secondary colors
|
||||
* Grid column count
|
||||
|
||||
To find out what variables are available to modify, you can inspect the variables in the default theme in `themes/default/`
|
||||
|
||||
#### Advanced Configuration
|
||||
|
||||
Each component has its own variable file, which can be used to modify any of the underlying variables for that component.
|
||||
|
||||
For example `/site/elements/button.variables`.
|
||||
|
||||
You may also specify your own custom LESS in `site/elements/button.overrides`. This file will have access to all underlying variables available for that component.
|
||||
|
||||
#### Using Pre-Packaged Themes
|
||||
|
||||
You can modify `theme.config` to use any prepackaged theme available in `src/themes/`.
|
||||
|
||||
For example you can modify `theme.config` to use a `github` button theme by changing
|
||||
```less
|
||||
@button: 'github';
|
||||
```
|
||||
|
||||
View the [Customization Guide](http://learnsemantic.com/developing/customizing.html) to learn more
|
||||
|
3
web/semantic/src/_site/collections/breadcrumb.overrides
Normal file
3
web/semantic/src/_site/collections/breadcrumb.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/breadcrumb.variables
Normal file
3
web/semantic/src/_site/collections/breadcrumb.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/form.overrides
Normal file
3
web/semantic/src/_site/collections/form.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/form.variables
Normal file
3
web/semantic/src/_site/collections/form.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/grid.overrides
Normal file
3
web/semantic/src/_site/collections/grid.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/grid.variables
Normal file
3
web/semantic/src/_site/collections/grid.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/menu.overrides
Normal file
3
web/semantic/src/_site/collections/menu.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/menu.variables
Normal file
3
web/semantic/src/_site/collections/menu.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/message.overrides
Normal file
3
web/semantic/src/_site/collections/message.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/message.variables
Normal file
3
web/semantic/src/_site/collections/message.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/table.overrides
Normal file
3
web/semantic/src/_site/collections/table.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/collections/table.variables
Normal file
3
web/semantic/src/_site/collections/table.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/button.overrides
Normal file
3
web/semantic/src/_site/elements/button.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/button.variables
Normal file
3
web/semantic/src/_site/elements/button.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/divider.overrides
Normal file
3
web/semantic/src/_site/elements/divider.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/divider.variables
Normal file
3
web/semantic/src/_site/elements/divider.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/flag.overrides
Normal file
3
web/semantic/src/_site/elements/flag.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/flag.variables
Normal file
3
web/semantic/src/_site/elements/flag.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*-------------------
|
||||
Flag Variables
|
||||
--------------------*/
|
3
web/semantic/src/_site/elements/header.overrides
Normal file
3
web/semantic/src/_site/elements/header.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/header.variables
Normal file
3
web/semantic/src/_site/elements/header.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/icon.overrides
Normal file
3
web/semantic/src/_site/elements/icon.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/icon.variables
Normal file
3
web/semantic/src/_site/elements/icon.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/image.overrides
Normal file
3
web/semantic/src/_site/elements/image.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/image.variables
Normal file
3
web/semantic/src/_site/elements/image.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/input.overrides
Normal file
3
web/semantic/src/_site/elements/input.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/input.variables
Normal file
3
web/semantic/src/_site/elements/input.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/label.overrides
Normal file
3
web/semantic/src/_site/elements/label.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/label.variables
Normal file
3
web/semantic/src/_site/elements/label.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/list.overrides
Normal file
3
web/semantic/src/_site/elements/list.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/list.variables
Normal file
3
web/semantic/src/_site/elements/list.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/loader.overrides
Normal file
3
web/semantic/src/_site/elements/loader.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/loader.variables
Normal file
3
web/semantic/src/_site/elements/loader.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/rail.overrides
Normal file
3
web/semantic/src/_site/elements/rail.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/rail.variables
Normal file
3
web/semantic/src/_site/elements/rail.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/reveal.overrides
Normal file
3
web/semantic/src/_site/elements/reveal.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/reveal.variables
Normal file
3
web/semantic/src/_site/elements/reveal.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/segment.overrides
Normal file
3
web/semantic/src/_site/elements/segment.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/segment.variables
Normal file
3
web/semantic/src/_site/elements/segment.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/step.overrides
Normal file
3
web/semantic/src/_site/elements/step.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/elements/step.variables
Normal file
3
web/semantic/src/_site/elements/step.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/globals/reset.overrides
Normal file
3
web/semantic/src/_site/globals/reset.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/globals/reset.variables
Normal file
3
web/semantic/src/_site/globals/reset.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Global Variables
|
||||
*******************************/
|
3
web/semantic/src/_site/globals/site.overrides
Normal file
3
web/semantic/src/_site/globals/site.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/globals/site.variables
Normal file
3
web/semantic/src/_site/globals/site.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Global Variables
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/accordion.overrides
Normal file
3
web/semantic/src/_site/modules/accordion.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/accordion.variables
Normal file
3
web/semantic/src/_site/modules/accordion.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/chatroom.overrides
Normal file
3
web/semantic/src/_site/modules/chatroom.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/chatroom.variables
Normal file
3
web/semantic/src/_site/modules/chatroom.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/checkbox.overrides
Normal file
3
web/semantic/src/_site/modules/checkbox.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/checkbox.variables
Normal file
3
web/semantic/src/_site/modules/checkbox.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/dimmer.overrides
Normal file
3
web/semantic/src/_site/modules/dimmer.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/dimmer.variables
Normal file
3
web/semantic/src/_site/modules/dimmer.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/dropdown.overrides
Normal file
3
web/semantic/src/_site/modules/dropdown.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/dropdown.variables
Normal file
3
web/semantic/src/_site/modules/dropdown.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/modal.overrides
Normal file
3
web/semantic/src/_site/modules/modal.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/modal.variables
Normal file
3
web/semantic/src/_site/modules/modal.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/nag.overrides
Normal file
3
web/semantic/src/_site/modules/nag.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/nag.variables
Normal file
3
web/semantic/src/_site/modules/nag.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/popup.overrides
Normal file
3
web/semantic/src/_site/modules/popup.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/popup.variables
Normal file
3
web/semantic/src/_site/modules/popup.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/progress.overrides
Normal file
3
web/semantic/src/_site/modules/progress.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/progress.variables
Normal file
3
web/semantic/src/_site/modules/progress.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/rating.overrides
Normal file
3
web/semantic/src/_site/modules/rating.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/rating.variables
Normal file
3
web/semantic/src/_site/modules/rating.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/search.overrides
Normal file
3
web/semantic/src/_site/modules/search.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/search.variables
Normal file
3
web/semantic/src/_site/modules/search.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/shape.overrides
Normal file
3
web/semantic/src/_site/modules/shape.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/shape.variables
Normal file
3
web/semantic/src/_site/modules/shape.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/sidebar.overrides
Normal file
3
web/semantic/src/_site/modules/sidebar.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/sidebar.variables
Normal file
3
web/semantic/src/_site/modules/sidebar.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/sticky.overrides
Normal file
3
web/semantic/src/_site/modules/sticky.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/sticky.variables
Normal file
3
web/semantic/src/_site/modules/sticky.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/tab.overrides
Normal file
3
web/semantic/src/_site/modules/tab.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/tab.variables
Normal file
3
web/semantic/src/_site/modules/tab.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/transition.overrides
Normal file
3
web/semantic/src/_site/modules/transition.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/transition.variables
Normal file
3
web/semantic/src/_site/modules/transition.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/modules/video.overrides
Normal file
3
web/semantic/src/_site/modules/video.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
Site Overrides
|
||||
*******************************/
|
0
web/semantic/src/_site/modules/video.variables
Normal file
0
web/semantic/src/_site/modules/video.variables
Normal file
3
web/semantic/src/_site/views/ad.overrides
Normal file
3
web/semantic/src/_site/views/ad.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/ad.variables
Normal file
3
web/semantic/src/_site/views/ad.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/card.overrides
Normal file
3
web/semantic/src/_site/views/card.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/card.variables
Normal file
3
web/semantic/src/_site/views/card.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/comment.overrides
Normal file
3
web/semantic/src/_site/views/comment.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/comment.variables
Normal file
3
web/semantic/src/_site/views/comment.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/feed.overrides
Normal file
3
web/semantic/src/_site/views/feed.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/feed.variables
Normal file
3
web/semantic/src/_site/views/feed.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/item.overrides
Normal file
3
web/semantic/src/_site/views/item.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/item.variables
Normal file
3
web/semantic/src/_site/views/item.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/statistic.overrides
Normal file
3
web/semantic/src/_site/views/statistic.overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
3
web/semantic/src/_site/views/statistic.variables
Normal file
3
web/semantic/src/_site/views/statistic.variables
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*******************************
|
||||
User Variable Overrides
|
||||
*******************************/
|
871
web/semantic/src/definitions/behaviors/api.js
Normal file
871
web/semantic/src/definitions/behaviors/api.js
Normal file
|
@ -0,0 +1,871 @@
|
|||
/*!
|
||||
* # Semantic UI - API
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
;(function ( $, window, document, undefined ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$.api = $.fn.api = function(parameters) {
|
||||
|
||||
var
|
||||
// use window context if none specified
|
||||
$allModules = $.isFunction(this)
|
||||
? $(window)
|
||||
: $(this),
|
||||
moduleSelector = $allModules.selector || '',
|
||||
time = new Date().getTime(),
|
||||
performance = [],
|
||||
|
||||
query = arguments[0],
|
||||
methodInvoked = (typeof query == 'string'),
|
||||
queryArguments = [].slice.call(arguments, 1),
|
||||
|
||||
returnedValue
|
||||
;
|
||||
|
||||
$allModules
|
||||
.each(function() {
|
||||
var
|
||||
settings = ( $.isPlainObject(parameters) )
|
||||
? $.extend(true, {}, $.fn.api.settings, parameters)
|
||||
: $.extend({}, $.fn.api.settings),
|
||||
|
||||
// internal aliases
|
||||
namespace = settings.namespace,
|
||||
metadata = settings.metadata,
|
||||
selector = settings.selector,
|
||||
error = settings.error,
|
||||
className = settings.className,
|
||||
|
||||
// define namespaces for modules
|
||||
eventNamespace = '.' + namespace,
|
||||
moduleNamespace = 'module-' + namespace,
|
||||
|
||||
// element that creates request
|
||||
$module = $(this),
|
||||
$form = $module.closest(selector.form),
|
||||
|
||||
// context used for state
|
||||
$context = (settings.stateContext)
|
||||
? $(settings.stateContext)
|
||||
: $module,
|
||||
|
||||
// request details
|
||||
ajaxSettings,
|
||||
requestSettings,
|
||||
url,
|
||||
data,
|
||||
|
||||
// standard module
|
||||
element = this,
|
||||
context = $context.get(),
|
||||
instance = $module.data(moduleNamespace),
|
||||
module
|
||||
;
|
||||
|
||||
module = {
|
||||
|
||||
initialize: function() {
|
||||
var
|
||||
triggerEvent = module.get.event()
|
||||
;
|
||||
// bind events
|
||||
if(!methodInvoked) {
|
||||
if( triggerEvent ) {
|
||||
module.debug('Attaching API events to element', triggerEvent);
|
||||
$module
|
||||
.on(triggerEvent + eventNamespace, module.event.trigger)
|
||||
;
|
||||
}
|
||||
else if(settings.on == 'now') {
|
||||
module.debug('Querying API now', triggerEvent);
|
||||
module.query();
|
||||
}
|
||||
}
|
||||
module.instantiate();
|
||||
},
|
||||
|
||||
instantiate: function() {
|
||||
module.verbose('Storing instance of module', module);
|
||||
instance = module;
|
||||
$module
|
||||
.data(moduleNamespace, instance)
|
||||
;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
module.verbose('Destroying previous module for', element);
|
||||
$module
|
||||
.removeData(moduleNamespace)
|
||||
.off(eventNamespace)
|
||||
;
|
||||
},
|
||||
|
||||
query: function() {
|
||||
|
||||
if(module.is.disabled()) {
|
||||
module.debug('Element is disabled API request aborted');
|
||||
return;
|
||||
}
|
||||
// determine if an api event already occurred
|
||||
if(module.is.loading() && settings.throttle === 0 ) {
|
||||
module.debug('Cancelling request, previous request is still pending');
|
||||
return;
|
||||
}
|
||||
|
||||
// pass element metadata to url (value, text)
|
||||
if(settings.defaultData) {
|
||||
$.extend(true, settings.urlData, module.get.defaultData());
|
||||
}
|
||||
|
||||
// Add form content
|
||||
if(settings.serializeForm !== false || $context.is('form')) {
|
||||
if(settings.serializeForm == 'json') {
|
||||
$.extend(true, settings.data, module.get.formData());
|
||||
}
|
||||
else {
|
||||
settings.data = module.get.formData();
|
||||
}
|
||||
}
|
||||
|
||||
// call beforesend and get any settings changes
|
||||
requestSettings = module.get.settings();
|
||||
|
||||
// check if before send cancelled request
|
||||
if(requestSettings === false) {
|
||||
module.cancelled = true;
|
||||
module.error(error.beforeSend);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
module.cancelled = false;
|
||||
}
|
||||
|
||||
if(settings.url) {
|
||||
// override with url if specified
|
||||
module.debug('Using specified url', url);
|
||||
url = module.add.urlData( settings.url );
|
||||
}
|
||||
else {
|
||||
// otherwise find url from api endpoints
|
||||
url = module.add.urlData( module.get.templateURL() );
|
||||
module.debug('Added URL Data to url', url);
|
||||
}
|
||||
|
||||
// exit conditions reached, missing url parameters
|
||||
if( !url ) {
|
||||
if( module.is.form() ) {
|
||||
url = $module.attr('action') || '';
|
||||
module.debug('No url or action specified, defaulting to form action', url);
|
||||
}
|
||||
else {
|
||||
module.error(error.missingURL, settings.action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// add loading state
|
||||
module.set.loading();
|
||||
|
||||
// look for jQuery ajax parameters in settings
|
||||
ajaxSettings = $.extend(true, {}, settings, {
|
||||
type : settings.method || settings.type,
|
||||
data : data,
|
||||
url : settings.base + url,
|
||||
beforeSend : settings.beforeXHR,
|
||||
success : function() {},
|
||||
failure : function() {},
|
||||
complete : function() {}
|
||||
});
|
||||
|
||||
module.debug('Querying URL', ajaxSettings.url);
|
||||
module.debug('Sending data', data, ajaxSettings.method);
|
||||
module.verbose('Using AJAX settings', ajaxSettings);
|
||||
|
||||
if( module.is.loading() ) {
|
||||
// throttle additional requests
|
||||
module.timer = setTimeout(function() {
|
||||
module.request = module.create.request();
|
||||
module.xhr = module.create.xhr();
|
||||
settings.onRequest.call(context, module.request, module.xhr);
|
||||
}, settings.throttle);
|
||||
}
|
||||
else {
|
||||
// immediately on first request
|
||||
module.request = module.create.request();
|
||||
module.xhr = module.create.xhr();
|
||||
settings.onRequest.call(context, module.request, module.xhr);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
is: {
|
||||
disabled: function() {
|
||||
return ($module.filter(settings.filter).length > 0);
|
||||
},
|
||||
form: function() {
|
||||
return $module.is('form');
|
||||
},
|
||||
input: function() {
|
||||
return $module.is('input');
|
||||
},
|
||||
loading: function() {
|
||||
return (module.request && module.request.state() == 'pending');
|
||||
}
|
||||
},
|
||||
|
||||
was: {
|
||||
cancelled: function() {
|
||||
return (module.cancelled || false);
|
||||
},
|
||||
succesful: function() {
|
||||
return (module.request && module.request.state() == 'resolved');
|
||||
},
|
||||
failure: function() {
|
||||
return (module.request && module.request.state() == 'rejected');
|
||||
},
|
||||
complete: function() {
|
||||
return (module.request && (module.request.state() == 'resolved' || module.request.state() == 'rejected') );
|
||||
}
|
||||
},
|
||||
|
||||
add: {
|
||||
urlData: function(url, urlData) {
|
||||
var
|
||||
requiredVariables,
|
||||
optionalVariables
|
||||
;
|
||||
if(url) {
|
||||
requiredVariables = url.match(settings.regExp.required);
|
||||
optionalVariables = url.match(settings.regExp.optional);
|
||||
urlData = urlData || settings.urlData;
|
||||
if(requiredVariables) {
|
||||
module.debug('Looking for required URL variables', requiredVariables);
|
||||
$.each(requiredVariables, function(index, templatedString) {
|
||||
var
|
||||
// allow legacy {$var} style
|
||||
variable = (templatedString.indexOf('$') !== -1)
|
||||
? templatedString.substr(2, templatedString.length - 3)
|
||||
: templatedString.substr(1, templatedString.length - 2),
|
||||
value = ($.isPlainObject(urlData) && urlData[variable] !== undefined)
|
||||
? urlData[variable]
|
||||
: ($module.data(variable) !== undefined)
|
||||
? $module.data(variable)
|
||||
: ($context.data(variable) !== undefined)
|
||||
? $context.data(variable)
|
||||
: urlData[variable]
|
||||
;
|
||||
// remove value
|
||||
if(value === undefined) {
|
||||
module.error(error.requiredParameter, variable, url);
|
||||
url = false;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
module.verbose('Found required variable', variable, value);
|
||||
url = url.replace(templatedString, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(optionalVariables) {
|
||||
module.debug('Looking for optional URL variables', requiredVariables);
|
||||
$.each(optionalVariables, function(index, templatedString) {
|
||||
var
|
||||
// allow legacy {/$var} style
|
||||
variable = (templatedString.indexOf('$') !== -1)
|
||||
? templatedString.substr(3, templatedString.length - 4)
|
||||
: templatedString.substr(2, templatedString.length - 3),
|
||||
value = ($.isPlainObject(urlData) && urlData[variable] !== undefined)
|
||||
? urlData[variable]
|
||||
: ($module.data(variable) !== undefined)
|
||||
? $module.data(variable)
|
||||
: ($context.data(variable) !== undefined)
|
||||
? $context.data(variable)
|
||||
: urlData[variable]
|
||||
;
|
||||
// optional replacement
|
||||
if(value !== undefined) {
|
||||
module.verbose('Optional variable Found', variable, value);
|
||||
url = url.replace(templatedString, value);
|
||||
}
|
||||
else {
|
||||
module.verbose('Optional variable not found', variable);
|
||||
// remove preceding slash if set
|
||||
if(url.indexOf('/' + templatedString) !== -1) {
|
||||
url = url.replace('/' + templatedString, '');
|
||||
}
|
||||
else {
|
||||
url = url.replace(templatedString, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
},
|
||||
|
||||
event: {
|
||||
trigger: function(event) {
|
||||
module.query();
|
||||
if(event.type == 'submit' || event.type == 'click') {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
xhr: {
|
||||
always: function() {
|
||||
// calculate if loading time was below minimum threshold
|
||||
},
|
||||
done: function(response) {
|
||||
var
|
||||
context = this,
|
||||
elapsedTime = (new Date().getTime() - time),
|
||||
timeLeft = (settings.loadingDuration - elapsedTime)
|
||||
;
|
||||
timeLeft = (timeLeft > 0)
|
||||
? timeLeft
|
||||
: 0
|
||||
;
|
||||
setTimeout(function() {
|
||||
module.request.resolveWith(context, [response]);
|
||||
}, timeLeft);
|
||||
},
|
||||
fail: function(xhr, status, httpMessage) {
|
||||
var
|
||||
context = this,
|
||||
elapsedTime = (new Date().getTime() - time),
|
||||
timeLeft = (settings.loadingDuration - elapsedTime)
|
||||
;
|
||||
timeLeft = (timeLeft > 0)
|
||||
? timeLeft
|
||||
: 0
|
||||
;
|
||||
// page triggers abort on navigation, dont show error
|
||||
setTimeout(function() {
|
||||
if(status !== 'abort') {
|
||||
module.request.rejectWith(context, [xhr, status, httpMessage]);
|
||||
}
|
||||
else {
|
||||
module.reset();
|
||||
}
|
||||
}, timeLeft);
|
||||
}
|
||||
},
|
||||
request: {
|
||||
complete: function(response) {
|
||||
module.remove.loading();
|
||||
settings.onComplete.call(context, response, $module);
|
||||
},
|
||||
done: function(response) {
|
||||
module.debug('API Response Received', response);
|
||||
if(settings.dataType == 'json') {
|
||||
if( $.isFunction(settings.successTest) ) {
|
||||
module.debug('Checking JSON returned success', settings.successTest, response);
|
||||
if( settings.successTest(response) ) {
|
||||
settings.onSuccess.call(context, response, $module);
|
||||
}
|
||||
else {
|
||||
module.debug('JSON test specified by user and response failed', response);
|
||||
settings.onFailure.call(context, response, $module);
|
||||
}
|
||||
}
|
||||
else {
|
||||
settings.onSuccess.call(context, response, $module);
|
||||
}
|
||||
}
|
||||
else {
|
||||
settings.onSuccess.call(context, response, $module);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, httpMessage) {
|
||||
var
|
||||
errorMessage = (settings.error[status] !== undefined)
|
||||
? settings.error[status]
|
||||
: httpMessage,
|
||||
response
|
||||
;
|
||||
// let em know unless request aborted
|
||||
if(xhr !== undefined) {
|
||||
// readyState 4 = done, anything less is not really sent
|
||||
if(xhr.readyState !== undefined && xhr.readyState == 4) {
|
||||
|
||||
// if http status code returned and json returned error, look for it
|
||||
if( xhr.status != 200 && httpMessage !== undefined && httpMessage !== '') {
|
||||
module.error(error.statusMessage + httpMessage, ajaxSettings.url);
|
||||
}
|
||||
else {
|
||||
if(status == 'error' && settings.dataType == 'json') {
|
||||
try {
|
||||
response = $.parseJSON(xhr.responseText);
|
||||
if(response && response.error !== undefined) {
|
||||
errorMessage = response.error;
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
module.error(error.JSONParse);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.remove.loading();
|
||||
module.set.error();
|
||||
// show error state only for duration specified in settings
|
||||
if(settings.errorDuration) {
|
||||
setTimeout(module.remove.error, settings.errorDuration);
|
||||
}
|
||||
module.debug('API Request error:', errorMessage);
|
||||
settings.onError.call(context, errorMessage, $module);
|
||||
}
|
||||
else {
|
||||
settings.onAbort.call(context, errorMessage, $module);
|
||||
module.debug('Request Aborted (Most likely caused by page change or CORS Policy)', status, httpMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
create: {
|
||||
request: function() {
|
||||
return $.Deferred()
|
||||
.always(module.event.request.complete)
|
||||
.done(module.event.request.done)
|
||||
.fail(module.event.request.error)
|
||||
;
|
||||
},
|
||||
xhr: function() {
|
||||
return $.ajax(ajaxSettings)
|
||||
.always(module.event.xhr.always)
|
||||
.done(module.event.xhr.done)
|
||||
.fail(module.event.xhr.fail)
|
||||
;
|
||||
}
|
||||
},
|
||||
|
||||
set: {
|
||||
error: function() {
|
||||
module.verbose('Adding error state to element', $context);
|
||||
$context.addClass(className.error);
|
||||
},
|
||||
loading: function() {
|
||||
module.verbose('Adding loading state to element', $context);
|
||||
$context.addClass(className.loading);
|
||||
}
|
||||
},
|
||||
|
||||
remove: {
|
||||
error: function() {
|
||||
module.verbose('Removing error state from element', $context);
|
||||
$context.removeClass(className.error);
|
||||
},
|
||||
loading: function() {
|
||||
module.verbose('Removing loading state from element', $context);
|
||||
$context.removeClass(className.loading);
|
||||
}
|
||||
},
|
||||
|
||||
get: {
|
||||
request: function() {
|
||||
return module.request || false;
|
||||
},
|
||||
xhr: function() {
|
||||
return module.xhr || false;
|
||||
},
|
||||
settings: function() {
|
||||
var
|
||||
runSettings
|
||||
;
|
||||
runSettings = settings.beforeSend.call($module, settings);
|
||||
if(runSettings) {
|
||||
if(runSettings.success !== undefined) {
|
||||
module.debug('Legacy success callback detected', runSettings);
|
||||
module.error(error.legacyParameters, runSettings.success);
|
||||
runSettings.onSuccess = runSettings.success;
|
||||
}
|
||||
if(runSettings.failure !== undefined) {
|
||||
module.debug('Legacy failure callback detected', runSettings);
|
||||
module.error(error.legacyParameters, runSettings.failure);
|
||||
runSettings.onFailure = runSettings.failure;
|
||||
}
|
||||
if(runSettings.complete !== undefined) {
|
||||
module.debug('Legacy complete callback detected', runSettings);
|
||||
module.error(error.legacyParameters, runSettings.complete);
|
||||
runSettings.onComplete = runSettings.complete;
|
||||
}
|
||||
}
|
||||
if(runSettings === undefined) {
|
||||
module.error(error.noReturnedValue);
|
||||
}
|
||||
return (runSettings !== undefined)
|
||||
? runSettings
|
||||
: settings
|
||||
;
|
||||
},
|
||||
defaultData: function() {
|
||||
var
|
||||
data = {}
|
||||
;
|
||||
if( !$.isWindow(element) ) {
|
||||
if( module.is.input() ) {
|
||||
data.value = $module.val();
|
||||
}
|
||||
else if( !module.is.form() ) {
|
||||
|
||||
}
|
||||
else {
|
||||
data.text = $module.text();
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
event: function() {
|
||||
if( $.isWindow(element) || settings.on == 'now' ) {
|
||||
module.debug('API called without element, no events attached');
|
||||
return false;
|
||||
}
|
||||
else if(settings.on == 'auto') {
|
||||
if( $module.is('input') ) {
|
||||
return (element.oninput !== undefined)
|
||||
? 'input'
|
||||
: (element.onpropertychange !== undefined)
|
||||
? 'propertychange'
|
||||
: 'keyup'
|
||||
;
|
||||
}
|
||||
else if( $module.is('form') ) {
|
||||
return 'submit';
|
||||
}
|
||||
else {
|
||||
return 'click';
|
||||
}
|
||||
}
|
||||
else {
|
||||
return settings.on;
|
||||
}
|
||||
},
|
||||
formData: function() {
|
||||
var
|
||||
formData
|
||||
;
|
||||
if($module.serializeObject !== undefined) {
|
||||
formData = $form.serializeObject();
|
||||
}
|
||||
else {
|
||||
module.error(error.missingSerialize);
|
||||
formData = $form.serialize();
|
||||
}
|
||||
module.debug('Retrieved form data', formData);
|
||||
return formData;
|
||||
},
|
||||
templateURL: function(action) {
|
||||
var
|
||||
url
|
||||
;
|
||||
action = action || $module.data(metadata.action) || settings.action || false;
|
||||
if(action) {
|
||||
module.debug('Looking up url for action', action, settings.api);
|
||||
if(settings.api[action] !== undefined) {
|
||||
url = settings.api[action];
|
||||
module.debug('Found template url', url);
|
||||
}
|
||||
else if( !module.is.form() ) {
|
||||
module.error(error.missingAction, settings.action, settings.api);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
},
|
||||
|
||||
abort: function() {
|
||||
var
|
||||
xhr = module.get.xhr()
|
||||
;
|
||||
if( xhr && xhr.state() !== 'resolved') {
|
||||
module.debug('Cancelling API request');
|
||||
xhr.abort();
|
||||
module.request.rejectWith(settings.apiSettings);
|
||||
}
|
||||
},
|
||||
|
||||
// reset state
|
||||
reset: function() {
|
||||
module.remove.error();
|
||||
module.remove.loading();
|
||||
},
|
||||
|
||||
setting: function(name, value) {
|
||||
module.debug('Changing setting', name, value);
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, settings, name);
|
||||
}
|
||||
else if(value !== undefined) {
|
||||
settings[name] = value;
|
||||
}
|
||||
else {
|
||||
return settings[name];
|
||||
}
|
||||
},
|
||||
internal: function(name, value) {
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, module, name);
|
||||
}
|
||||
else if(value !== undefined) {
|
||||
module[name] = value;
|
||||
}
|
||||
else {
|
||||
return module[name];
|
||||
}
|
||||
},
|
||||
debug: function() {
|
||||
if(settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.debug.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
verbose: function() {
|
||||
if(settings.verbose && settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.verbose.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
||||
module.error.apply(console, arguments);
|
||||
},
|
||||
performance: {
|
||||
log: function(message) {
|
||||
var
|
||||
currentTime,
|
||||
executionTime,
|
||||
previousTime
|
||||
;
|
||||
if(settings.performance) {
|
||||
currentTime = new Date().getTime();
|
||||
previousTime = time || currentTime;
|
||||
executionTime = currentTime - previousTime;
|
||||
time = currentTime;
|
||||
performance.push({
|
||||
'Name' : message[0],
|
||||
'Arguments' : [].slice.call(message, 1) || '',
|
||||
//'Element' : element,
|
||||
'Execution Time' : executionTime
|
||||
});
|
||||
}
|
||||
clearTimeout(module.performance.timer);
|
||||
module.performance.timer = setTimeout(module.performance.display, 100);
|
||||
},
|
||||
display: function() {
|
||||
var
|
||||
title = settings.name + ':',
|
||||
totalTime = 0
|
||||
;
|
||||
time = false;
|
||||
clearTimeout(module.performance.timer);
|
||||
$.each(performance, function(index, data) {
|
||||
totalTime += data['Execution Time'];
|
||||
});
|
||||
title += ' ' + totalTime + 'ms';
|
||||
if(moduleSelector) {
|
||||
title += ' \'' + moduleSelector + '\'';
|
||||
}
|
||||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
||||
console.groupCollapsed(title);
|
||||
if(console.table) {
|
||||
console.table(performance);
|
||||
}
|
||||
else {
|
||||
$.each(performance, function(index, data) {
|
||||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
||||
});
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
performance = [];
|
||||
}
|
||||
},
|
||||
invoke: function(query, passedArguments, context) {
|
||||
var
|
||||
object = instance,
|
||||
maxDepth,
|
||||
found,
|
||||
response
|
||||
;
|
||||
passedArguments = passedArguments || queryArguments;
|
||||
context = element || context;
|
||||
if(typeof query == 'string' && object !== undefined) {
|
||||
query = query.split(/[\. ]/);
|
||||
maxDepth = query.length - 1;
|
||||
$.each(query, function(depth, value) {
|
||||
var camelCaseValue = (depth != maxDepth)
|
||||
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
||||
: query
|
||||
;
|
||||
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
||||
object = object[camelCaseValue];
|
||||
}
|
||||
else if( object[camelCaseValue] !== undefined ) {
|
||||
found = object[camelCaseValue];
|
||||
return false;
|
||||
}
|
||||
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
||||
object = object[value];
|
||||
}
|
||||
else if( object[value] !== undefined ) {
|
||||
found = object[value];
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
module.error(error.method, query);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if ( $.isFunction( found ) ) {
|
||||
response = found.apply(context, passedArguments);
|
||||
}
|
||||
else if(found !== undefined) {
|
||||
response = found;
|
||||
}
|
||||
if($.isArray(returnedValue)) {
|
||||
returnedValue.push(response);
|
||||
}
|
||||
else if(returnedValue !== undefined) {
|
||||
returnedValue = [returnedValue, response];
|
||||
}
|
||||
else if(response !== undefined) {
|
||||
returnedValue = response;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
};
|
||||
|
||||
if(methodInvoked) {
|
||||
if(instance === undefined) {
|
||||
module.initialize();
|
||||
}
|
||||
module.invoke(query);
|
||||
}
|
||||
else {
|
||||
if(instance !== undefined) {
|
||||
instance.invoke('destroy');
|
||||
}
|
||||
module.initialize();
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
return (returnedValue !== undefined)
|
||||
? returnedValue
|
||||
: this
|
||||
;
|
||||
};
|
||||
|
||||
$.api.settings = {
|
||||
|
||||
name : 'API',
|
||||
namespace : 'api',
|
||||
|
||||
debug : true,
|
||||
verbose : false,
|
||||
performance : true,
|
||||
|
||||
// event binding
|
||||
on : 'auto',
|
||||
filter : '.disabled',
|
||||
stateContext : false,
|
||||
|
||||
// state
|
||||
loadingDuration : 0,
|
||||
errorDuration : 2000,
|
||||
|
||||
// templating
|
||||
action : false,
|
||||
url : false,
|
||||
base : '',
|
||||
|
||||
// data
|
||||
urlData : {},
|
||||
|
||||
// ui
|
||||
defaultData : true,
|
||||
serializeForm : false,
|
||||
throttle : 0,
|
||||
|
||||
// jQ ajax
|
||||
method : 'get',
|
||||
data : {},
|
||||
dataType : 'json',
|
||||
|
||||
// callbacks
|
||||
beforeSend : function(settings) { return settings; },
|
||||
beforeXHR : function(xhr) {},
|
||||
|
||||
onRequest : function(promise, xhr) {},
|
||||
onSuccess : function(response, $module) {},
|
||||
onComplete : function(response, $module) {},
|
||||
onFailure : function(errorMessage, $module) {},
|
||||
onError : function(errorMessage, $module) {},
|
||||
onAbort : function(errorMessage, $module) {},
|
||||
|
||||
successTest : false,
|
||||
|
||||
// errors
|
||||
error : {
|
||||
beforeSend : 'The before send function has aborted the request',
|
||||
error : 'There was an error with your request',
|
||||
exitConditions : 'API Request Aborted. Exit conditions met',
|
||||
JSONParse : 'JSON could not be parsed during error handling',
|
||||
legacyParameters : 'You are using legacy API success callback names',
|
||||
method : 'The method you called is not defined',
|
||||
missingAction : 'API action used but no url was defined',
|
||||
missingSerialize : 'Required dependency jquery-serialize-object missing, using basic serialize',
|
||||
missingURL : 'No URL specified for api event',
|
||||
noReturnedValue : 'The beforeSend callback must return a settings object, beforeSend ignored.',
|
||||
parseError : 'There was an error parsing your request',
|
||||
requiredParameter : 'Missing a required URL parameter: ',
|
||||
statusMessage : 'Server gave an error: ',
|
||||
timeout : 'Your request timed out'
|
||||
},
|
||||
|
||||
regExp : {
|
||||
required: /\{\$*[A-z0-9]+\}/g,
|
||||
optional: /\{\/\$*[A-z0-9]+\}/g,
|
||||
},
|
||||
|
||||
className: {
|
||||
loading : 'loading',
|
||||
error : 'error'
|
||||
},
|
||||
|
||||
selector: {
|
||||
form: 'form'
|
||||
},
|
||||
|
||||
metadata: {
|
||||
action : 'action'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$.api.settings.api = {};
|
||||
|
||||
|
||||
})( jQuery, window , document );
|
272
web/semantic/src/definitions/behaviors/colorize.js
Normal file
272
web/semantic/src/definitions/behaviors/colorize.js
Normal file
|
@ -0,0 +1,272 @@
|
|||
/*!
|
||||
* # Semantic UI - Colorize
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
;(function ( $, window, document, undefined ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.colorize = function(parameters) {
|
||||
var
|
||||
settings = $.extend(true, {}, $.fn.colorize.settings, parameters),
|
||||
// hoist arguments
|
||||
moduleArguments = arguments || false
|
||||
;
|
||||
$(this)
|
||||
.each(function(instanceIndex) {
|
||||
|
||||
var
|
||||
$module = $(this),
|
||||
|
||||
mainCanvas = $('<canvas />')[0],
|
||||
imageCanvas = $('<canvas />')[0],
|
||||
overlayCanvas = $('<canvas />')[0],
|
||||
|
||||
backgroundImage = new Image(),
|
||||
|
||||
// defs
|
||||
mainContext,
|
||||
imageContext,
|
||||
overlayContext,
|
||||
|
||||
image,
|
||||
imageName,
|
||||
|
||||
width,
|
||||
height,
|
||||
|
||||
// shortucts
|
||||
colors = settings.colors,
|
||||
paths = settings.paths,
|
||||
namespace = settings.namespace,
|
||||
error = settings.error,
|
||||
|
||||
// boilerplate
|
||||
instance = $module.data('module-' + namespace),
|
||||
module
|
||||
;
|
||||
|
||||
module = {
|
||||
|
||||
checkPreconditions: function() {
|
||||
module.debug('Checking pre-conditions');
|
||||
|
||||
if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) {
|
||||
module.error(error.undefinedColors);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
async: function(callback) {
|
||||
if(settings.async) {
|
||||
setTimeout(callback, 0);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
getMetadata: function() {
|
||||
module.debug('Grabbing metadata');
|
||||
image = $module.data('image') || settings.image || undefined;
|
||||
imageName = $module.data('name') || settings.name || instanceIndex;
|
||||
width = settings.width || $module.width();
|
||||
height = settings.height || $module.height();
|
||||
if(width === 0 || height === 0) {
|
||||
module.error(error.undefinedSize);
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
module.debug('Initializing with colors', colors);
|
||||
if( module.checkPreconditions() ) {
|
||||
|
||||
module.async(function() {
|
||||
module.getMetadata();
|
||||
module.canvas.create();
|
||||
|
||||
module.draw.image(function() {
|
||||
module.draw.colors();
|
||||
module.canvas.merge();
|
||||
});
|
||||
$module
|
||||
.data('module-' + namespace, module)
|
||||
;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
redraw: function() {
|
||||
module.debug('Redrawing image');
|
||||
module.async(function() {
|
||||
module.canvas.clear();
|
||||
module.draw.colors();
|
||||
module.canvas.merge();
|
||||
});
|
||||
},
|
||||
|
||||
change: {
|
||||
color: function(colorName, color) {
|
||||
module.debug('Changing color', colorName);
|
||||
if(colors[colorName] === undefined) {
|
||||
module.error(error.missingColor);
|
||||
return false;
|
||||
}
|
||||
colors[colorName] = color;
|
||||
module.redraw();
|
||||
}
|
||||
},
|
||||
|
||||
canvas: {
|
||||
create: function() {
|
||||
module.debug('Creating canvases');
|
||||
|
||||
mainCanvas.width = width;
|
||||
mainCanvas.height = height;
|
||||
imageCanvas.width = width;
|
||||
imageCanvas.height = height;
|
||||
overlayCanvas.width = width;
|
||||
overlayCanvas.height = height;
|
||||
|
||||
mainContext = mainCanvas.getContext('2d');
|
||||
imageContext = imageCanvas.getContext('2d');
|
||||
overlayContext = overlayCanvas.getContext('2d');
|
||||
|
||||
$module
|
||||
.append( mainCanvas )
|
||||
;
|
||||
mainContext = $module.children('canvas')[0].getContext('2d');
|
||||
},
|
||||
clear: function(context) {
|
||||
module.debug('Clearing canvas');
|
||||
overlayContext.fillStyle = '#FFFFFF';
|
||||
overlayContext.fillRect(0, 0, width, height);
|
||||
},
|
||||
merge: function() {
|
||||
if( !$.isFunction(mainContext.blendOnto) ) {
|
||||
module.error(error.missingPlugin);
|
||||
return;
|
||||
}
|
||||
mainContext.putImageData( imageContext.getImageData(0, 0, width, height), 0, 0);
|
||||
overlayContext.blendOnto(mainContext, 'multiply');
|
||||
}
|
||||
},
|
||||
|
||||
draw: {
|
||||
|
||||
image: function(callback) {
|
||||
module.debug('Drawing image');
|
||||
callback = callback || function(){};
|
||||
if(image) {
|
||||
backgroundImage.src = image;
|
||||
backgroundImage.onload = function() {
|
||||
imageContext.drawImage(backgroundImage, 0, 0);
|
||||
callback();
|
||||
};
|
||||
}
|
||||
else {
|
||||
module.error(error.noImage);
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
colors: function() {
|
||||
module.debug('Drawing color overlays', colors);
|
||||
$.each(colors, function(colorName, color) {
|
||||
settings.onDraw(overlayContext, imageName, colorName, color);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
debug: function(message, variableName) {
|
||||
if(settings.debug) {
|
||||
if(variableName !== undefined) {
|
||||
console.info(settings.name + ': ' + message, variableName);
|
||||
}
|
||||
else {
|
||||
console.info(settings.name + ': ' + message);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(errorMessage) {
|
||||
console.warn(settings.name + ': ' + errorMessage);
|
||||
},
|
||||
invoke: function(methodName, context, methodArguments) {
|
||||
var
|
||||
method
|
||||
;
|
||||
methodArguments = methodArguments || Array.prototype.slice.call( arguments, 2 );
|
||||
|
||||
if(typeof methodName == 'string' && instance !== undefined) {
|
||||
methodName = methodName.split('.');
|
||||
$.each(methodName, function(index, name) {
|
||||
if( $.isPlainObject( instance[name] ) ) {
|
||||
instance = instance[name];
|
||||
return true;
|
||||
}
|
||||
else if( $.isFunction( instance[name] ) ) {
|
||||
method = instance[name];
|
||||
return true;
|
||||
}
|
||||
module.error(settings.error.method);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return ( $.isFunction( method ) )
|
||||
? method.apply(context, methodArguments)
|
||||
: false
|
||||
;
|
||||
}
|
||||
|
||||
};
|
||||
if(instance !== undefined && moduleArguments) {
|
||||
// simpler than invoke realizing to invoke itself (and losing scope due prototype.call()
|
||||
if(moduleArguments[0] == 'invoke') {
|
||||
moduleArguments = Array.prototype.slice.call( moduleArguments, 1 );
|
||||
}
|
||||
return module.invoke(moduleArguments[0], this, Array.prototype.slice.call( moduleArguments, 1 ) );
|
||||
}
|
||||
// initializing
|
||||
module.initialize();
|
||||
})
|
||||
;
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.colorize.settings = {
|
||||
name : 'Image Colorizer',
|
||||
debug : true,
|
||||
namespace : 'colorize',
|
||||
|
||||
onDraw : function(overlayContext, imageName, colorName, color) {},
|
||||
|
||||
// whether to block execution while updating canvas
|
||||
async : true,
|
||||
// object containing names and default values of color regions
|
||||
colors : {},
|
||||
|
||||
metadata: {
|
||||
image : 'image',
|
||||
name : 'name'
|
||||
},
|
||||
|
||||
error: {
|
||||
noImage : 'No tracing image specified',
|
||||
undefinedColors : 'No default colors specified.',
|
||||
missingColor : 'Attempted to change color that does not exist',
|
||||
missingPlugin : 'Blend onto plug-in must be included',
|
||||
undefinedHeight : 'The width or height of image canvas could not be automatically determined. Please specify a height.'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
1118
web/semantic/src/definitions/behaviors/form.js
Normal file
1118
web/semantic/src/definitions/behaviors/form.js
Normal file
File diff suppressed because it is too large
Load diff
695
web/semantic/src/definitions/behaviors/state.js
Normal file
695
web/semantic/src/definitions/behaviors/state.js
Normal file
|
@ -0,0 +1,695 @@
|
|||
/*!
|
||||
* # Semantic UI - State
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
;(function ( $, window, document, undefined ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.state = function(parameters) {
|
||||
var
|
||||
$allModules = $(this),
|
||||
|
||||
moduleSelector = $allModules.selector || '',
|
||||
|
||||
hasTouch = ('ontouchstart' in document.documentElement),
|
||||
time = new Date().getTime(),
|
||||
performance = [],
|
||||
|
||||
query = arguments[0],
|
||||
methodInvoked = (typeof query == 'string'),
|
||||
queryArguments = [].slice.call(arguments, 1),
|
||||
|
||||
returnedValue
|
||||
;
|
||||
$allModules
|
||||
.each(function() {
|
||||
var
|
||||
settings = ( $.isPlainObject(parameters) )
|
||||
? $.extend(true, {}, $.fn.state.settings, parameters)
|
||||
: $.extend({}, $.fn.state.settings),
|
||||
|
||||
error = settings.error,
|
||||
metadata = settings.metadata,
|
||||
className = settings.className,
|
||||
namespace = settings.namespace,
|
||||
states = settings.states,
|
||||
text = settings.text,
|
||||
|
||||
eventNamespace = '.' + namespace,
|
||||
moduleNamespace = namespace + '-module',
|
||||
|
||||
$module = $(this),
|
||||
|
||||
element = this,
|
||||
instance = $module.data(moduleNamespace),
|
||||
|
||||
module
|
||||
;
|
||||
module = {
|
||||
|
||||
initialize: function() {
|
||||
module.verbose('Initializing module');
|
||||
|
||||
// allow module to guess desired state based on element
|
||||
if(settings.automatic) {
|
||||
module.add.defaults();
|
||||
}
|
||||
|
||||
// bind events with delegated events
|
||||
if(settings.context && moduleSelector !== '') {
|
||||
$(settings.context)
|
||||
.on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
|
||||
.on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
|
||||
.on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
|
||||
;
|
||||
}
|
||||
else {
|
||||
$module
|
||||
.on('mouseenter' + eventNamespace, module.change.text)
|
||||
.on('mouseleave' + eventNamespace, module.reset.text)
|
||||
.on('click' + eventNamespace, module.toggle.state)
|
||||
;
|
||||
}
|
||||
module.instantiate();
|
||||
},
|
||||
|
||||
instantiate: function() {
|
||||
module.verbose('Storing instance of module', module);
|
||||
instance = module;
|
||||
$module
|
||||
.data(moduleNamespace, module)
|
||||
;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
module.verbose('Destroying previous module', instance);
|
||||
$module
|
||||
.off(eventNamespace)
|
||||
.removeData(moduleNamespace)
|
||||
;
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
module.verbose('Refreshing selector cache');
|
||||
$module = $(element);
|
||||
},
|
||||
|
||||
add: {
|
||||
defaults: function() {
|
||||
var
|
||||
userStates = parameters && $.isPlainObject(parameters.states)
|
||||
? parameters.states
|
||||
: {}
|
||||
;
|
||||
$.each(settings.defaults, function(type, typeStates) {
|
||||
if( module.is[type] !== undefined && module.is[type]() ) {
|
||||
module.verbose('Adding default states', type, element);
|
||||
$.extend(settings.states, typeStates, userStates);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
is: {
|
||||
|
||||
active: function() {
|
||||
return $module.hasClass(className.active);
|
||||
},
|
||||
loading: function() {
|
||||
return $module.hasClass(className.loading);
|
||||
},
|
||||
inactive: function() {
|
||||
return !( $module.hasClass(className.active) );
|
||||
},
|
||||
state: function(state) {
|
||||
if(className[state] === undefined) {
|
||||
return false;
|
||||
}
|
||||
return $module.hasClass( className[state] );
|
||||
},
|
||||
|
||||
enabled: function() {
|
||||
return !( $module.is(settings.filter.active) );
|
||||
},
|
||||
disabled: function() {
|
||||
return ( $module.is(settings.filter.active) );
|
||||
},
|
||||
textEnabled: function() {
|
||||
return !( $module.is(settings.filter.text) );
|
||||
},
|
||||
|
||||
// definitions for automatic type detection
|
||||
button: function() {
|
||||
return $module.is('.button:not(a, .submit)');
|
||||
},
|
||||
input: function() {
|
||||
return $module.is('input');
|
||||
},
|
||||
progress: function() {
|
||||
return $module.is('.ui.progress');
|
||||
}
|
||||
},
|
||||
|
||||
allow: function(state) {
|
||||
module.debug('Now allowing state', state);
|
||||
states[state] = true;
|
||||
},
|
||||
disallow: function(state) {
|
||||
module.debug('No longer allowing', state);
|
||||
states[state] = false;
|
||||
},
|
||||
|
||||
allows: function(state) {
|
||||
return states[state] || false;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
$module.removeClass(className.disabled);
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
$module.addClass(className.disabled);
|
||||
},
|
||||
|
||||
setState: function(state) {
|
||||
if(module.allows(state)) {
|
||||
$module.addClass( className[state] );
|
||||
}
|
||||
},
|
||||
|
||||
removeState: function(state) {
|
||||
if(module.allows(state)) {
|
||||
$module.removeClass( className[state] );
|
||||
}
|
||||
},
|
||||
|
||||
toggle: {
|
||||
state: function() {
|
||||
var
|
||||
apiRequest,
|
||||
requestCancelled
|
||||
;
|
||||
if( module.allows('active') && module.is.enabled() ) {
|
||||
module.refresh();
|
||||
if($.fn.api !== undefined) {
|
||||
apiRequest = $module.api('get request');
|
||||
requestCancelled = $module.api('was cancelled');
|
||||
if( requestCancelled ) {
|
||||
module.debug('API Request cancelled by beforesend');
|
||||
settings.activateTest = function(){ return false; };
|
||||
settings.deactivateTest = function(){ return false; };
|
||||
}
|
||||
else if(apiRequest) {
|
||||
module.listenTo(apiRequest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
module.change.state();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
listenTo: function(apiRequest) {
|
||||
module.debug('API request detected, waiting for state signal', apiRequest);
|
||||
if(apiRequest) {
|
||||
if(text.loading) {
|
||||
module.update.text(text.loading);
|
||||
}
|
||||
$.when(apiRequest)
|
||||
.then(function() {
|
||||
if(apiRequest.state() == 'resolved') {
|
||||
module.debug('API request succeeded');
|
||||
settings.activateTest = function(){ return true; };
|
||||
settings.deactivateTest = function(){ return true; };
|
||||
}
|
||||
else {
|
||||
module.debug('API request failed');
|
||||
settings.activateTest = function(){ return false; };
|
||||
settings.deactivateTest = function(){ return false; };
|
||||
}
|
||||
module.change.state();
|
||||
})
|
||||
;
|
||||
}
|
||||
},
|
||||
|
||||
// checks whether active/inactive state can be given
|
||||
change: {
|
||||
|
||||
state: function() {
|
||||
module.debug('Determining state change direction');
|
||||
// inactive to active change
|
||||
if( module.is.inactive() ) {
|
||||
module.activate();
|
||||
}
|
||||
else {
|
||||
module.deactivate();
|
||||
}
|
||||
if(settings.sync) {
|
||||
module.sync();
|
||||
}
|
||||
settings.onChange.call(element);
|
||||
},
|
||||
|
||||
text: function() {
|
||||
if( module.is.textEnabled() ) {
|
||||
if(module.is.disabled() ) {
|
||||
module.verbose('Changing text to disabled text', text.hover);
|
||||
module.update.text(text.disabled);
|
||||
}
|
||||
else if( module.is.active() ) {
|
||||
if(text.hover) {
|
||||
module.verbose('Changing text to hover text', text.hover);
|
||||
module.update.text(text.hover);
|
||||
}
|
||||
else if(text.deactivate) {
|
||||
module.verbose('Changing text to deactivating text', text.deactivate);
|
||||
module.update.text(text.deactivate);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(text.hover) {
|
||||
module.verbose('Changing text to hover text', text.hover);
|
||||
module.update.text(text.hover);
|
||||
}
|
||||
else if(text.activate){
|
||||
module.verbose('Changing text to activating text', text.activate);
|
||||
module.update.text(text.activate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if( settings.activateTest.call(element) ) {
|
||||
module.debug('Setting state to active');
|
||||
$module
|
||||
.addClass(className.active)
|
||||
;
|
||||
module.update.text(text.active);
|
||||
settings.onActivate.call(element);
|
||||
}
|
||||
},
|
||||
|
||||
deactivate: function() {
|
||||
if( settings.deactivateTest.call(element) ) {
|
||||
module.debug('Setting state to inactive');
|
||||
$module
|
||||
.removeClass(className.active)
|
||||
;
|
||||
module.update.text(text.inactive);
|
||||
settings.onDeactivate.call(element);
|
||||
}
|
||||
},
|
||||
|
||||
sync: function() {
|
||||
module.verbose('Syncing other buttons to current state');
|
||||
if( module.is.active() ) {
|
||||
$allModules
|
||||
.not($module)
|
||||
.state('activate');
|
||||
}
|
||||
else {
|
||||
$allModules
|
||||
.not($module)
|
||||
.state('deactivate')
|
||||
;
|
||||
}
|
||||
},
|
||||
|
||||
get: {
|
||||
text: function() {
|
||||
return (settings.selector.text)
|
||||
? $module.find(settings.selector.text).text()
|
||||
: $module.html()
|
||||
;
|
||||
},
|
||||
textFor: function(state) {
|
||||
return text[state] || false;
|
||||
}
|
||||
},
|
||||
|
||||
flash: {
|
||||
text: function(text, duration, callback) {
|
||||
var
|
||||
previousText = module.get.text()
|
||||
;
|
||||
module.debug('Flashing text message', text, duration);
|
||||
text = text || settings.text.flash;
|
||||
duration = duration || settings.flashDuration;
|
||||
callback = callback || function() {};
|
||||
module.update.text(text);
|
||||
setTimeout(function(){
|
||||
module.update.text(previousText);
|
||||
callback.call(element);
|
||||
}, duration);
|
||||
}
|
||||
},
|
||||
|
||||
reset: {
|
||||
// on mouseout sets text to previous value
|
||||
text: function() {
|
||||
var
|
||||
activeText = text.active || $module.data(metadata.storedText),
|
||||
inactiveText = text.inactive || $module.data(metadata.storedText)
|
||||
;
|
||||
if( module.is.textEnabled() ) {
|
||||
if( module.is.active() && activeText) {
|
||||
module.verbose('Resetting active text', activeText);
|
||||
module.update.text(activeText);
|
||||
}
|
||||
else if(inactiveText) {
|
||||
module.verbose('Resetting inactive text', activeText);
|
||||
module.update.text(inactiveText);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
update: {
|
||||
text: function(text) {
|
||||
var
|
||||
currentText = module.get.text()
|
||||
;
|
||||
if(text && text !== currentText) {
|
||||
module.debug('Updating text', text);
|
||||
if(settings.selector.text) {
|
||||
$module
|
||||
.data(metadata.storedText, text)
|
||||
.find(settings.selector.text)
|
||||
.text(text)
|
||||
;
|
||||
}
|
||||
else {
|
||||
$module
|
||||
.data(metadata.storedText, text)
|
||||
.html(text)
|
||||
;
|
||||
}
|
||||
}
|
||||
else {
|
||||
module.debug('Text is already set, ignoring update', text);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setting: function(name, value) {
|
||||
module.debug('Changing setting', name, value);
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, settings, name);
|
||||
}
|
||||
else if(value !== undefined) {
|
||||
settings[name] = value;
|
||||
}
|
||||
else {
|
||||
return settings[name];
|
||||
}
|
||||
},
|
||||
internal: function(name, value) {
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, module, name);
|
||||
}
|
||||
else if(value !== undefined) {
|
||||
module[name] = value;
|
||||
}
|
||||
else {
|
||||
return module[name];
|
||||
}
|
||||
},
|
||||
debug: function() {
|
||||
if(settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.debug.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
verbose: function() {
|
||||
if(settings.verbose && settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.verbose.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
||||
module.error.apply(console, arguments);
|
||||
},
|
||||
performance: {
|
||||
log: function(message) {
|
||||
var
|
||||
currentTime,
|
||||
executionTime,
|
||||
previousTime
|
||||
;
|
||||
if(settings.performance) {
|
||||
currentTime = new Date().getTime();
|
||||
previousTime = time || currentTime;
|
||||
executionTime = currentTime - previousTime;
|
||||
time = currentTime;
|
||||
performance.push({
|
||||
'Name' : message[0],
|
||||
'Arguments' : [].slice.call(message, 1) || '',
|
||||
'Element' : element,
|
||||
'Execution Time' : executionTime
|
||||
});
|
||||
}
|
||||
clearTimeout(module.performance.timer);
|
||||
module.performance.timer = setTimeout(module.performance.display, 100);
|
||||
},
|
||||
display: function() {
|
||||
var
|
||||
title = settings.name + ':',
|
||||
totalTime = 0
|
||||
;
|
||||
time = false;
|
||||
clearTimeout(module.performance.timer);
|
||||
$.each(performance, function(index, data) {
|
||||
totalTime += data['Execution Time'];
|
||||
});
|
||||
title += ' ' + totalTime + 'ms';
|
||||
if(moduleSelector) {
|
||||
title += ' \'' + moduleSelector + '\'';
|
||||
}
|
||||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
||||
console.groupCollapsed(title);
|
||||
if(console.table) {
|
||||
console.table(performance);
|
||||
}
|
||||
else {
|
||||
$.each(performance, function(index, data) {
|
||||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
||||
});
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
performance = [];
|
||||
}
|
||||
},
|
||||
invoke: function(query, passedArguments, context) {
|
||||
var
|
||||
object = instance,
|
||||
maxDepth,
|
||||
found,
|
||||
response
|
||||
;
|
||||
passedArguments = passedArguments || queryArguments;
|
||||
context = element || context;
|
||||
if(typeof query == 'string' && object !== undefined) {
|
||||
query = query.split(/[\. ]/);
|
||||
maxDepth = query.length - 1;
|
||||
$.each(query, function(depth, value) {
|
||||
var camelCaseValue = (depth != maxDepth)
|
||||
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
||||
: query
|
||||
;
|
||||
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
||||
object = object[camelCaseValue];
|
||||
}
|
||||
else if( object[camelCaseValue] !== undefined ) {
|
||||
found = object[camelCaseValue];
|
||||
return false;
|
||||
}
|
||||
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
||||
object = object[value];
|
||||
}
|
||||
else if( object[value] !== undefined ) {
|
||||
found = object[value];
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
module.error(error.method, query);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if ( $.isFunction( found ) ) {
|
||||
response = found.apply(context, passedArguments);
|
||||
}
|
||||
else if(found !== undefined) {
|
||||
response = found;
|
||||
}
|
||||
if($.isArray(returnedValue)) {
|
||||
returnedValue.push(response);
|
||||
}
|
||||
else if(returnedValue !== undefined) {
|
||||
returnedValue = [returnedValue, response];
|
||||
}
|
||||
else if(response !== undefined) {
|
||||
returnedValue = response;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
};
|
||||
|
||||
if(methodInvoked) {
|
||||
if(instance === undefined) {
|
||||
module.initialize();
|
||||
}
|
||||
module.invoke(query);
|
||||
}
|
||||
else {
|
||||
if(instance !== undefined) {
|
||||
instance.invoke('destroy');
|
||||
}
|
||||
module.initialize();
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
return (returnedValue !== undefined)
|
||||
? returnedValue
|
||||
: this
|
||||
;
|
||||
};
|
||||
|
||||
$.fn.state.settings = {
|
||||
|
||||
// module info
|
||||
name : 'State',
|
||||
|
||||
// debug output
|
||||
debug : false,
|
||||
|
||||
// verbose debug output
|
||||
verbose : true,
|
||||
|
||||
// namespace for events
|
||||
namespace : 'state',
|
||||
|
||||
// debug data includes performance
|
||||
performance : true,
|
||||
|
||||
// callback occurs on state change
|
||||
onActivate : function() {},
|
||||
onDeactivate : function() {},
|
||||
onChange : function() {},
|
||||
|
||||
// state test functions
|
||||
activateTest : function() { return true; },
|
||||
deactivateTest : function() { return true; },
|
||||
|
||||
// whether to automatically map default states
|
||||
automatic : true,
|
||||
|
||||
// activate / deactivate changes all elements instantiated at same time
|
||||
sync : false,
|
||||
|
||||
// default flash text duration, used for temporarily changing text of an element
|
||||
flashDuration : 1000,
|
||||
|
||||
// selector filter
|
||||
filter : {
|
||||
text : '.loading, .disabled',
|
||||
active : '.disabled'
|
||||
},
|
||||
|
||||
context : false,
|
||||
|
||||
// error
|
||||
error: {
|
||||
beforeSend : 'The before send function has cancelled state change',
|
||||
method : 'The method you called is not defined.'
|
||||
},
|
||||
|
||||
// metadata
|
||||
metadata: {
|
||||
promise : 'promise',
|
||||
storedText : 'stored-text'
|
||||
},
|
||||
|
||||
// change class on state
|
||||
className: {
|
||||
active : 'active',
|
||||
disabled : 'disabled',
|
||||
error : 'error',
|
||||
loading : 'loading',
|
||||
success : 'success',
|
||||
warning : 'warning'
|
||||
},
|
||||
|
||||
selector: {
|
||||
// selector for text node
|
||||
text: false
|
||||
},
|
||||
|
||||
defaults : {
|
||||
input: {
|
||||
disabled : true,
|
||||
loading : true,
|
||||
active : true
|
||||
},
|
||||
button: {
|
||||
disabled : true,
|
||||
loading : true,
|
||||
active : true,
|
||||
},
|
||||
progress: {
|
||||
active : true,
|
||||
success : true,
|
||||
warning : true,
|
||||
error : true
|
||||
}
|
||||
},
|
||||
|
||||
states : {
|
||||
active : true,
|
||||
disabled : true,
|
||||
error : true,
|
||||
loading : true,
|
||||
success : true,
|
||||
warning : true
|
||||
},
|
||||
|
||||
text : {
|
||||
disabled : false,
|
||||
flash : false,
|
||||
hover : false,
|
||||
active : false,
|
||||
inactive : false,
|
||||
activate : false,
|
||||
deactivate : false
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
})( jQuery, window , document );
|
1032
web/semantic/src/definitions/behaviors/visibility.js
Normal file
1032
web/semantic/src/definitions/behaviors/visibility.js
Normal file
File diff suppressed because it is too large
Load diff
515
web/semantic/src/definitions/behaviors/visit.js
Normal file
515
web/semantic/src/definitions/behaviors/visit.js
Normal file
|
@ -0,0 +1,515 @@
|
|||
/*!
|
||||
* # Semantic UI - Visit
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
;(function ($, window, document, undefined) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$.visit = $.fn.visit = function(parameters) {
|
||||
var
|
||||
$allModules = $.isFunction(this)
|
||||
? $(window)
|
||||
: $(this),
|
||||
moduleSelector = $allModules.selector || '',
|
||||
|
||||
time = new Date().getTime(),
|
||||
performance = [],
|
||||
|
||||
query = arguments[0],
|
||||
methodInvoked = (typeof query == 'string'),
|
||||
queryArguments = [].slice.call(arguments, 1),
|
||||
returnedValue
|
||||
;
|
||||
$allModules
|
||||
.each(function() {
|
||||
var
|
||||
settings = $.extend(true, {}, $.fn.visit.settings, parameters),
|
||||
|
||||
error = settings.error,
|
||||
namespace = settings.namespace,
|
||||
|
||||
eventNamespace = '.' + namespace,
|
||||
moduleNamespace = namespace + '-module',
|
||||
|
||||
$module = $(this),
|
||||
$displays = $(),
|
||||
|
||||
element = this,
|
||||
instance = $module.data(moduleNamespace),
|
||||
module
|
||||
;
|
||||
module = {
|
||||
|
||||
initialize: function() {
|
||||
if(settings.count) {
|
||||
module.store(settings.key.count, settings.count);
|
||||
}
|
||||
else if(settings.id) {
|
||||
module.add.id(settings.id);
|
||||
}
|
||||
else if(settings.increment && methodInvoked !== 'increment') {
|
||||
module.increment();
|
||||
}
|
||||
module.add.display($module);
|
||||
module.instantiate();
|
||||
},
|
||||
|
||||
instantiate: function() {
|
||||
module.verbose('Storing instance of visit module', module);
|
||||
instance = module;
|
||||
$module
|
||||
.data(moduleNamespace, module)
|
||||
;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
module.verbose('Destroying instance');
|
||||
$module
|
||||
.removeData(moduleNamespace)
|
||||
;
|
||||
},
|
||||
|
||||
increment: function(id) {
|
||||
var
|
||||
currentValue = module.get.count(),
|
||||
newValue = +(currentValue) + 1
|
||||
;
|
||||
if(id) {
|
||||
module.add.id(id);
|
||||
}
|
||||
else {
|
||||
if(newValue > settings.limit && !settings.surpass) {
|
||||
newValue = settings.limit;
|
||||
}
|
||||
module.debug('Incrementing visits', newValue);
|
||||
module.store(settings.key.count, newValue);
|
||||
}
|
||||
},
|
||||
|
||||
decrement: function(id) {
|
||||
var
|
||||
currentValue = module.get.count(),
|
||||
newValue = +(currentValue) - 1
|
||||
;
|
||||
if(id) {
|
||||
module.remove.id(id);
|
||||
}
|
||||
else {
|
||||
module.debug('Removing visit');
|
||||
module.store(settings.key.count, newValue);
|
||||
}
|
||||
},
|
||||
|
||||
get: {
|
||||
count: function() {
|
||||
return +(module.retrieve(settings.key.count)) || 0;
|
||||
},
|
||||
idCount: function(ids) {
|
||||
ids = ids || module.get.ids();
|
||||
return ids.length;
|
||||
},
|
||||
ids: function(delimitedIDs) {
|
||||
var
|
||||
idArray = []
|
||||
;
|
||||
delimitedIDs = delimitedIDs || module.retrieve(settings.key.ids);
|
||||
if(typeof delimitedIDs === 'string') {
|
||||
idArray = delimitedIDs.split(settings.delimiter);
|
||||
}
|
||||
module.verbose('Found visited ID list', idArray);
|
||||
return idArray;
|
||||
},
|
||||
storageOptions: function(data) {
|
||||
var
|
||||
options = {}
|
||||
;
|
||||
if(settings.expires) {
|
||||
options.expires = settings.expires;
|
||||
}
|
||||
if(settings.domain) {
|
||||
options.domain = settings.domain;
|
||||
}
|
||||
if(settings.path) {
|
||||
options.path = settings.path;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
},
|
||||
|
||||
has: {
|
||||
visited: function(id, ids) {
|
||||
var
|
||||
visited = false
|
||||
;
|
||||
ids = ids || module.get.ids();
|
||||
if(id !== undefined && ids) {
|
||||
$.each(ids, function(index, value){
|
||||
if(value == id) {
|
||||
visited = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
return visited;
|
||||
}
|
||||
},
|
||||
|
||||
set: {
|
||||
count: function(value) {
|
||||
module.store(settings.key.count, value);
|
||||
},
|
||||
ids: function(value) {
|
||||
module.store(settings.key.ids, value);
|
||||
}
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
module.store(settings.key.count, 0);
|
||||
module.store(settings.key.ids, null);
|
||||
},
|
||||
|
||||
add: {
|
||||
id: function(id) {
|
||||
var
|
||||
currentIDs = module.retrieve(settings.key.ids),
|
||||
newIDs = (currentIDs === undefined || currentIDs === '')
|
||||
? id
|
||||
: currentIDs + settings.delimiter + id
|
||||
;
|
||||
if( module.has.visited(id) ) {
|
||||
module.debug('Unique content already visited, not adding visit', id, currentIDs);
|
||||
}
|
||||
else if(id === undefined) {
|
||||
module.debug('ID is not defined');
|
||||
}
|
||||
else {
|
||||
module.debug('Adding visit to unique content', id);
|
||||
module.store(settings.key.ids, newIDs);
|
||||
}
|
||||
module.set.count( module.get.idCount() );
|
||||
},
|
||||
display: function(selector) {
|
||||
var
|
||||
$element = $(selector)
|
||||
;
|
||||
if($element.length > 0 && !$.isWindow($element[0])) {
|
||||
module.debug('Updating visit count for element', $element);
|
||||
$displays = ($displays.length > 0)
|
||||
? $displays.add($element)
|
||||
: $element
|
||||
;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
remove: {
|
||||
id: function(id) {
|
||||
var
|
||||
currentIDs = module.get.ids(),
|
||||
newIDs = []
|
||||
;
|
||||
if(id !== undefined && currentIDs !== undefined) {
|
||||
module.debug('Removing visit to unique content', id, currentIDs);
|
||||
$.each(currentIDs, function(index, value){
|
||||
if(value !== id) {
|
||||
newIDs.push(value);
|
||||
}
|
||||
});
|
||||
newIDs = newIDs.join(settings.delimiter);
|
||||
module.store(settings.key.ids, newIDs );
|
||||
}
|
||||
module.set.count( module.get.idCount() );
|
||||
}
|
||||
},
|
||||
|
||||
check: {
|
||||
limit: function(value) {
|
||||
value = value || module.get.count();
|
||||
if(settings.limit) {
|
||||
if(value >= settings.limit) {
|
||||
module.debug('Pages viewed exceeded limit, firing callback', value, settings.limit);
|
||||
settings.onLimit.call(element, value);
|
||||
}
|
||||
module.debug('Limit not reached', value, settings.limit);
|
||||
settings.onChange.call(element, value);
|
||||
}
|
||||
module.update.display(value);
|
||||
}
|
||||
},
|
||||
|
||||
update: {
|
||||
display: function(value) {
|
||||
value = value || module.get.count();
|
||||
if($displays.length > 0) {
|
||||
module.debug('Updating displayed view count', $displays);
|
||||
$displays.html(value);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
store: function(key, value) {
|
||||
var
|
||||
options = module.get.storageOptions(value)
|
||||
;
|
||||
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
||||
window.localStorage.setItem(key, value);
|
||||
module.debug('Value stored using local storage', key, value);
|
||||
}
|
||||
else if($.cookie !== undefined) {
|
||||
$.cookie(key, value, options);
|
||||
module.debug('Value stored using cookie', key, value, options);
|
||||
}
|
||||
else {
|
||||
module.error(error.noCookieStorage);
|
||||
return;
|
||||
}
|
||||
if(key == settings.key.count) {
|
||||
module.check.limit(value);
|
||||
}
|
||||
},
|
||||
retrieve: function(key, value) {
|
||||
var
|
||||
storedValue
|
||||
;
|
||||
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
||||
storedValue = window.localStorage.getItem(key);
|
||||
}
|
||||
// get by cookie
|
||||
else if($.cookie !== undefined) {
|
||||
storedValue = $.cookie(key);
|
||||
}
|
||||
else {
|
||||
module.error(error.noCookieStorage);
|
||||
}
|
||||
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
|
||||
storedValue = undefined;
|
||||
}
|
||||
return storedValue;
|
||||
},
|
||||
|
||||
setting: function(name, value) {
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, settings, name);
|
||||
}
|
||||
else if(value !== undefined) {
|
||||
settings[name] = value;
|
||||
}
|
||||
else {
|
||||
return settings[name];
|
||||
}
|
||||
},
|
||||
internal: function(name, value) {
|
||||
module.debug('Changing internal', name, value);
|
||||
if(value !== undefined) {
|
||||
if( $.isPlainObject(name) ) {
|
||||
$.extend(true, module, name);
|
||||
}
|
||||
else {
|
||||
module[name] = value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return module[name];
|
||||
}
|
||||
},
|
||||
debug: function() {
|
||||
if(settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.debug.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
verbose: function() {
|
||||
if(settings.verbose && settings.debug) {
|
||||
if(settings.performance) {
|
||||
module.performance.log(arguments);
|
||||
}
|
||||
else {
|
||||
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
||||
module.verbose.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
||||
module.error.apply(console, arguments);
|
||||
},
|
||||
performance: {
|
||||
log: function(message) {
|
||||
var
|
||||
currentTime,
|
||||
executionTime,
|
||||
previousTime
|
||||
;
|
||||
if(settings.performance) {
|
||||
currentTime = new Date().getTime();
|
||||
previousTime = time || currentTime;
|
||||
executionTime = currentTime - previousTime;
|
||||
time = currentTime;
|
||||
performance.push({
|
||||
'Name' : message[0],
|
||||
'Arguments' : [].slice.call(message, 1) || '',
|
||||
'Element' : element,
|
||||
'Execution Time' : executionTime
|
||||
});
|
||||
}
|
||||
clearTimeout(module.performance.timer);
|
||||
module.performance.timer = setTimeout(module.performance.display, 100);
|
||||
},
|
||||
display: function() {
|
||||
var
|
||||
title = settings.name + ':',
|
||||
totalTime = 0
|
||||
;
|
||||
time = false;
|
||||
clearTimeout(module.performance.timer);
|
||||
$.each(performance, function(index, data) {
|
||||
totalTime += data['Execution Time'];
|
||||
});
|
||||
title += ' ' + totalTime + 'ms';
|
||||
if(moduleSelector) {
|
||||
title += ' \'' + moduleSelector + '\'';
|
||||
}
|
||||
if($allModules.length > 1) {
|
||||
title += ' ' + '(' + $allModules.length + ')';
|
||||
}
|
||||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
||||
console.groupCollapsed(title);
|
||||
if(console.table) {
|
||||
console.table(performance);
|
||||
}
|
||||
else {
|
||||
$.each(performance, function(index, data) {
|
||||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
||||
});
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
performance = [];
|
||||
}
|
||||
},
|
||||
invoke: function(query, passedArguments, context) {
|
||||
var
|
||||
object = instance,
|
||||
maxDepth,
|
||||
found,
|
||||
response
|
||||
;
|
||||
passedArguments = passedArguments || queryArguments;
|
||||
context = element || context;
|
||||
if(typeof query == 'string' && object !== undefined) {
|
||||
query = query.split(/[\. ]/);
|
||||
maxDepth = query.length - 1;
|
||||
$.each(query, function(depth, value) {
|
||||
var camelCaseValue = (depth != maxDepth)
|
||||
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
||||
: query
|
||||
;
|
||||
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
||||
object = object[camelCaseValue];
|
||||
}
|
||||
else if( object[camelCaseValue] !== undefined ) {
|
||||
found = object[camelCaseValue];
|
||||
return false;
|
||||
}
|
||||
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
||||
object = object[value];
|
||||
}
|
||||
else if( object[value] !== undefined ) {
|
||||
found = object[value];
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if ( $.isFunction( found ) ) {
|
||||
response = found.apply(context, passedArguments);
|
||||
}
|
||||
else if(found !== undefined) {
|
||||
response = found;
|
||||
}
|
||||
if($.isArray(returnedValue)) {
|
||||
returnedValue.push(response);
|
||||
}
|
||||
else if(returnedValue !== undefined) {
|
||||
returnedValue = [returnedValue, response];
|
||||
}
|
||||
else if(response !== undefined) {
|
||||
returnedValue = response;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
};
|
||||
if(methodInvoked) {
|
||||
if(instance === undefined) {
|
||||
module.initialize();
|
||||
}
|
||||
module.invoke(query);
|
||||
}
|
||||
else {
|
||||
if(instance !== undefined) {
|
||||
instance.invoke('destroy');
|
||||
}
|
||||
module.initialize();
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
return (returnedValue !== undefined)
|
||||
? returnedValue
|
||||
: this
|
||||
;
|
||||
};
|
||||
|
||||
$.fn.visit.settings = {
|
||||
|
||||
name : 'Visit',
|
||||
|
||||
debug : false,
|
||||
verbose : true,
|
||||
performance : true,
|
||||
|
||||
namespace : 'visit',
|
||||
|
||||
increment : false,
|
||||
surpass : false,
|
||||
count : false,
|
||||
limit : false,
|
||||
|
||||
delimiter : '&',
|
||||
storageMethod : 'localstorage',
|
||||
|
||||
key : {
|
||||
count : 'visit-count',
|
||||
ids : 'visit-ids'
|
||||
},
|
||||
|
||||
expires : 30,
|
||||
domain : false,
|
||||
path : '/',
|
||||
|
||||
onLimit : function() {},
|
||||
onChange : function() {},
|
||||
|
||||
error : {
|
||||
method : 'The method you called is not defined',
|
||||
missingPersist : 'Using the persist setting requires the inclusion of PersistJS',
|
||||
noCookieStorage : 'The default storage cookie requires $.cookie to be included.'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
122
web/semantic/src/definitions/collections/breadcrumb.less
Normal file
122
web/semantic/src/definitions/collections/breadcrumb.less
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*!
|
||||
* # Semantic UI - Breadcrumb
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
/*******************************
|
||||
Theme
|
||||
*******************************/
|
||||
|
||||
@type : 'collection';
|
||||
@element : 'breadcrumb';
|
||||
|
||||
@import (multiple) '../../theme.config';
|
||||
|
||||
|
||||
/*******************************
|
||||
Breadcrumb
|
||||
*******************************/
|
||||
|
||||
.ui.breadcrumb {
|
||||
margin: @verticalMargin 0em;
|
||||
display: @display;
|
||||
vertical-align: @verticalAlign;
|
||||
}
|
||||
.ui.breadcrumb:first-child {
|
||||
margin-top: 0em;
|
||||
}
|
||||
.ui.breadcrumb:last-child {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Content
|
||||
*******************************/
|
||||
|
||||
/* Divider */
|
||||
.ui.breadcrumb .divider {
|
||||
display: inline-block;
|
||||
opacity: @dividerOpacity;
|
||||
margin: 0em @dividerSpacing 0em;
|
||||
|
||||
font-size: @dividerSize;
|
||||
color: @dividerColor;
|
||||
vertical-align: @dividerVerticalAlign;
|
||||
}
|
||||
|
||||
/* Link */
|
||||
.ui.breadcrumb a {
|
||||
color: @linkColor;
|
||||
}
|
||||
.ui.breadcrumb a:hover {
|
||||
color: @linkHoverColor;
|
||||
}
|
||||
|
||||
|
||||
/* Icon Divider */
|
||||
.ui.breadcrumb .icon.divider {
|
||||
font-size: @iconDividerSize;
|
||||
vertical-align: @iconDividerVerticalAlign;
|
||||
}
|
||||
|
||||
/* Section */
|
||||
.ui.breadcrumb a.section {
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui.breadcrumb .section {
|
||||
display: inline-block;
|
||||
margin: @sectionMargin;
|
||||
padding: @sectionPadding;
|
||||
}
|
||||
|
||||
/* Loose Coupling */
|
||||
.ui.breadcrumb.segment {
|
||||
display: inline-block;
|
||||
padding: @segmentPadding;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
States
|
||||
*******************************/
|
||||
|
||||
.ui.breadcrumb .active.section {
|
||||
font-weight: @activeFontWeight;
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
Variations
|
||||
*******************************/
|
||||
|
||||
.ui.mini.breadcrumb {
|
||||
font-size: @mini;
|
||||
}
|
||||
.ui.tiny.breadcrumb {
|
||||
font-size: @tiny;
|
||||
}
|
||||
.ui.small.breadcrumb {
|
||||
font-size: @small;
|
||||
}
|
||||
.ui.breadcrumb {
|
||||
font-size: @medium;
|
||||
}
|
||||
.ui.large.breadcrumb {
|
||||
font-size: @large;
|
||||
}
|
||||
.ui.big.breadcrumb {
|
||||
font-size: @big;
|
||||
}
|
||||
.ui.huge.breadcrumb {
|
||||
font-size: @huge;
|
||||
}
|
||||
.ui.massive.breadcrumb {
|
||||
font-size: @massive;
|
||||
}
|
||||
|
||||
.loadUIOverrides();
|
894
web/semantic/src/definitions/collections/form.less
Normal file
894
web/semantic/src/definitions/collections/form.less
Normal file
|
@ -0,0 +1,894 @@
|
|||
/*!
|
||||
* # Semantic UI - Form
|
||||
* http://github.com/semantic-org/semantic-ui/
|
||||
*
|
||||
*
|
||||
* Copyright 2014 Contributors
|
||||
* Released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
|
||||
/*******************************
|
||||
Theme
|
||||
*******************************/
|
||||
|
||||
@type : 'collection';
|
||||
@element : 'form';
|
||||
|
||||
@import (multiple) '../../theme.config';
|
||||
|
||||
|
||||
/*******************************
|
||||
Elements
|
||||
*******************************/
|
||||
|
||||
/*--------------------
|
||||
Form
|
||||
---------------------*/
|
||||
|
||||
.ui.form {
|
||||
position: relative;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Content
|
||||
---------------------*/
|
||||
|
||||
.ui.form > p {
|
||||
margin: @paragraphMargin;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Field
|
||||
---------------------*/
|
||||
|
||||
.ui.form .fields .field,
|
||||
.ui.form .field {
|
||||
clear: both;
|
||||
margin: @fieldMargin;
|
||||
}
|
||||
.ui.form .fields:last-child,
|
||||
.ui.form .field:last-child {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Labels
|
||||
---------------------*/
|
||||
|
||||
.ui.form .field > label {
|
||||
display: block;
|
||||
margin: @labelMargin;
|
||||
color: @labelColor;
|
||||
font-size: @labelFontSize;
|
||||
font-weight: @labelFontWeight;
|
||||
text-transform: @labelTextTransform;
|
||||
}
|
||||
.ui.form .grouped.fields > label {
|
||||
margin: @groupedLabelMargin;
|
||||
color: @groupedLabelColor;
|
||||
font-size: @groupedLabelFontSize;
|
||||
font-weight: @groupedLabelFontWeight;
|
||||
text-transform: @groupedLabelTextTransform;
|
||||
}
|
||||
.ui.form .inline.fields > label {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
|
||||
margin: @inlineLabelMargin;
|
||||
color: @inlineLabelColor;
|
||||
font-size: @inlineLabelFontSize;
|
||||
font-weight: @inlineLabelFontWeight;
|
||||
text-transform: @inlineLabelTextTransform;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Standard Inputs
|
||||
---------------------*/
|
||||
|
||||
|
||||
.ui.form textarea,
|
||||
.ui.form input:not([type]),
|
||||
.ui.form input[type="date"],
|
||||
.ui.form input[type="datetime-local"],
|
||||
.ui.form input[type="email"],
|
||||
.ui.form input[type="number"],
|
||||
.ui.form input[type="password"],
|
||||
.ui.form input[type="search"],
|
||||
.ui.form input[type="tel"],
|
||||
.ui.form input[type="time"],
|
||||
.ui.form input[type="text"],
|
||||
.ui.form input[type="url"],
|
||||
.ui.form .ui.input {
|
||||
width: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.ui.form input:not([type]),
|
||||
.ui.form input[type="date"],
|
||||
.ui.form input[type="datetime-local"],
|
||||
.ui.form input[type="email"],
|
||||
.ui.form input[type="number"],
|
||||
.ui.form input[type="password"],
|
||||
.ui.form input[type="search"],
|
||||
.ui.form input[type="tel"],
|
||||
.ui.form input[type="time"],
|
||||
.ui.form input[type="text"],
|
||||
.ui.form input[type="url"] {
|
||||
font-family: @inputFont;
|
||||
margin: 0em;
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
tap-highlight-color: rgba(255, 255, 255, 0);
|
||||
|
||||
line-height: @inputLineHeight;
|
||||
padding: @inputPadding;
|
||||
font-size: @inputFontSize;
|
||||
|
||||
background: @inputBackground;
|
||||
border: @inputBorder;
|
||||
color: @inputColor;
|
||||
border-radius: @inputBorderRadius;
|
||||
box-shadow: @inputBoxShadow;
|
||||
transition: @inputTransition;
|
||||
}
|
||||
|
||||
|
||||
.ui.textarea,
|
||||
.ui.form textarea {
|
||||
margin: 0em;
|
||||
-webkit-appearance: none;
|
||||
tap-highlight-color: rgba(255, 255, 255, 0);
|
||||
|
||||
padding: @textAreaPadding;
|
||||
font-size: @textAreaFontSize;
|
||||
background: @textAreaBackground;
|
||||
border: @textAreaBorder;
|
||||
outline: none;
|
||||
color: @inputColor;
|
||||
border-radius: @inputBorderRadius;
|
||||
box-shadow: @inputBoxShadow;
|
||||
transition: @textAreaTransition;
|
||||
font-size: @textAreaFontSize;
|
||||
height: @textAreaHeight;
|
||||
min-height: @textAreaMinHeight;
|
||||
max-height: @textAreaMaxHeight;
|
||||
line-height: @textAreaLineHeight;
|
||||
resize: @textAreaResize;
|
||||
}
|
||||
|
||||
.ui.form textarea,
|
||||
.ui.form input[type="checkbox"] {
|
||||
vertical-align: @checkboxVerticalAlign;
|
||||
}
|
||||
|
||||
/*--------------------------
|
||||
Input w/ attached Button
|
||||
---------------------------*/
|
||||
|
||||
.ui.form input.attached {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------
|
||||
Basic Select
|
||||
---------------------*/
|
||||
|
||||
.ui.form select {
|
||||
display: block;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
background: @selectBackground;
|
||||
border: @selectBorder;
|
||||
border-radius: @selectBorderRadius;
|
||||
box-shadow: @selectBoxShadow;
|
||||
padding: @selectPadding;
|
||||
color: @selectColor;
|
||||
transition: @selectTransition;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Dropdown
|
||||
---------------------*/
|
||||
|
||||
.ui.form .field > .selection.dropdown {
|
||||
width: 100%;
|
||||
}
|
||||
.ui.form .field > .selection.dropdown > .dropdown.icon {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.ui.form .inline.field > .selection.dropdown {
|
||||
width: auto;
|
||||
}
|
||||
.ui.form .inline.field > .selection.dropdown > .dropdown.icon {
|
||||
float: none;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------
|
||||
Dividers
|
||||
---------------------*/
|
||||
|
||||
.ui.form .divider {
|
||||
clear: both;
|
||||
margin: @dividerMargin;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------
|
||||
Types of Messages
|
||||
---------------------*/
|
||||
|
||||
.ui.form .success.message,
|
||||
.ui.form .warning.message,
|
||||
.ui.form .error.message {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Assumptions */
|
||||
.ui.form .message:first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Validation Prompt
|
||||
---------------------*/
|
||||
|
||||
.ui.form .field .prompt.label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ui.form .inline.field .prompt {
|
||||
margin: @inlineValidationMargin;
|
||||
}
|
||||
.ui.form .inline.field .prompt:before {
|
||||
margin-top: @inlineValidationArrowOffset;
|
||||
bottom: auto;
|
||||
right: auto;
|
||||
top: 50%;
|
||||
left: 0em;
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
States
|
||||
*******************************/
|
||||
|
||||
|
||||
/*--------------------
|
||||
Placeholder
|
||||
---------------------*/
|
||||
|
||||
/* browsers require these rules separate */
|
||||
.ui.form ::-webkit-input-placeholder {
|
||||
color: @inputPlaceholderColor;
|
||||
}
|
||||
.ui.form ::-moz-placeholder {
|
||||
color: @inputPlaceholderColor;
|
||||
}
|
||||
.ui.form :focus::-webkit-input-placeholder {
|
||||
color: @inputPlaceholderFocusColor;
|
||||
}
|
||||
.ui.form :focus::-moz-placeholder {
|
||||
color: @inputPlaceholderFocusColor;
|
||||
}
|
||||
|
||||
/* Error Placeholder */
|
||||
.ui.form .error ::-webkit-input-placeholder {
|
||||
color: @inputErrorPlaceholderColor;
|
||||
}
|
||||
.ui.form .error ::-moz-placeholder {
|
||||
color: @inputErrorPlaceholderColor;
|
||||
}
|
||||
.ui.form .error :focus::-webkit-input-placeholder {
|
||||
color: @inputErrorPlaceholderFocusColor;
|
||||
}
|
||||
.ui.form .error :focus::-moz-placeholder {
|
||||
color: @inputErrorPlaceholderFocusColor;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Focus
|
||||
---------------------*/
|
||||
|
||||
.ui.form input:not([type]):focus,
|
||||
.ui.form input[type="date"]:focus,
|
||||
.ui.form input[type="datetime-local"]:focus,
|
||||
.ui.form input[type="email"]:focus,
|
||||
.ui.form input[type="number"]:focus,
|
||||
.ui.form input[type="password"]:focus,
|
||||
.ui.form input[type="search"]:focus,
|
||||
.ui.form input[type="tel"]:focus,
|
||||
.ui.form input[type="time"]:focus,
|
||||
.ui.form input[type="text"]:focus,
|
||||
.ui.form input[type="url"]:focus {
|
||||
color: @inputFocusColor;
|
||||
border-color: @inputFocusBorderColor;
|
||||
border-radius: @inputFocusBorderRadius;
|
||||
background: @inputFocusBackground;
|
||||
box-shadow: @inputFocusBoxShadow;
|
||||
}
|
||||
.ui.form textarea:focus {
|
||||
color: @textAreaFocusColor;
|
||||
border-color: @textAreaFocusBorderColor;
|
||||
border-radius: @textAreaFocusBorderRadius;
|
||||
background: @textAreaFocusBackground;
|
||||
box-shadow: @textAreaFocusBoxShadow;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Success
|
||||
---------------------*/
|
||||
|
||||
/* On Form */
|
||||
.ui.form.success .success.message {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Error
|
||||
---------------------*/
|
||||
|
||||
/* On Form */
|
||||
.ui.form.warning .warning.message {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Warning
|
||||
---------------------*/
|
||||
|
||||
/* On Form */
|
||||
.ui.form.error .error.message {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* On Field(s) */
|
||||
.ui.form .fields.error .field label,
|
||||
.ui.form .field.error label,
|
||||
.ui.form .fields.error .field .input,
|
||||
.ui.form .field.error .input {
|
||||
color: @formErrorColor;
|
||||
}
|
||||
|
||||
.ui.form .fields.error .field .corner.label,
|
||||
.ui.form .field.error .corner.label {
|
||||
border-color: @formErrorColor;
|
||||
color: @white;
|
||||
}
|
||||
|
||||
.ui.form .fields.error .field textarea,
|
||||
.ui.form .fields.error .field select,
|
||||
.ui.form .fields.error .field input:not([type]),
|
||||
.ui.form .fields.error .field input[type="date"],
|
||||
.ui.form .fields.error .field input[type="datetime-local"],
|
||||
.ui.form .fields.error .field input[type="email"],
|
||||
.ui.form .fields.error .field input[type="number"],
|
||||
.ui.form .fields.error .field input[type="password"],
|
||||
.ui.form .fields.error .field input[type="search"],
|
||||
.ui.form .fields.error .field input[type="tel"],
|
||||
.ui.form .fields.error .field input[type="time"],
|
||||
.ui.form .fields.error .field input[type="text"],
|
||||
.ui.form .fields.error .field input[type="url"],
|
||||
.ui.form .field.error textarea,
|
||||
.ui.form .field.error select,
|
||||
.ui.form .field.error input:not([type]),
|
||||
.ui.form .field.error input[type="date"],
|
||||
.ui.form .field.error input[type="datetime-local"],
|
||||
.ui.form .field.error input[type="email"],
|
||||
.ui.form .field.error input[type="number"],
|
||||
.ui.form .field.error input[type="password"],
|
||||
.ui.form .field.error input[type="search"],
|
||||
.ui.form .field.error input[type="tel"],
|
||||
.ui.form .field.error input[type="time"],
|
||||
.ui.form .field.error input[type="text"],
|
||||
.ui.form .field.error input[type="url"] {
|
||||
background: @formErrorBackground;
|
||||
border-color: @formErrorBorder;
|
||||
color: @formErrorColor;
|
||||
border-radius: @inputErrorBorderRadius;
|
||||
box-shadow: @inputErrorBoxShadow;
|
||||
}
|
||||
.ui.form .field.error textarea:focus,
|
||||
.ui.form .field.error select:focus,
|
||||
.ui.form .field.error input:not([type]):focus,
|
||||
.ui.form .field.error input[type="date"]:focus,
|
||||
.ui.form .field.error input[type="datetime-local"]:focus,
|
||||
.ui.form .field.error input[type="email"]:focus,
|
||||
.ui.form .field.error input[type="number"]:focus,
|
||||
.ui.form .field.error input[type="password"]:focus,
|
||||
.ui.form .field.error input[type="search"]:focus,
|
||||
.ui.form .field.error input[type="tel"]:focus,
|
||||
.ui.form .field.error input[type="time"]:focus,
|
||||
.ui.form .field.error input[type="text"]:focus,
|
||||
.ui.form .field.error input[type="url"]:focus {
|
||||
background: @inputErrorFocusBackground;
|
||||
border-color: @inputErrorFocusBorder;
|
||||
color: @inputErrorFocusColor;
|
||||
|
||||
-webkit-appearance: none;
|
||||
box-shadow: @inputErrorFocusBoxShadow;
|
||||
}
|
||||
|
||||
/* Preserve Native Select Stylings */
|
||||
.ui.form .field.error select {
|
||||
-webkit-appearance: menulist-button;
|
||||
}
|
||||
|
||||
/*------------------
|
||||
Dropdown Error
|
||||
--------------------*/
|
||||
|
||||
.ui.form .fields.error .field .ui.dropdown,
|
||||
.ui.form .fields.error .field .ui.dropdown .item,
|
||||
.ui.form .field.error .ui.dropdown,
|
||||
.ui.form .field.error .ui.dropdown .text,
|
||||
.ui.form .field.error .ui.dropdown .item {
|
||||
background: @formErrorBackground;
|
||||
color: @formErrorColor;
|
||||
}
|
||||
.ui.form .fields.error .field .ui.dropdown,
|
||||
.ui.form .field.error .ui.dropdown {
|
||||
border-color: @formErrorBorder !important;
|
||||
}
|
||||
.ui.form .fields.error .field .ui.dropdown:hover,
|
||||
.ui.form .field.error .ui.dropdown:hover {
|
||||
border-color: @formErrorBorder !important;
|
||||
}
|
||||
.ui.form .fields.error .field .ui.dropdown:hover .menu,
|
||||
.ui.form .field.error .ui.dropdown:hover .menu {
|
||||
border-color: @formErrorBorder;
|
||||
}
|
||||
/* Hover */
|
||||
.ui.form .fields.error .field .ui.dropdown .menu .item:hover,
|
||||
.ui.form .field.error .ui.dropdown .menu .item:hover {
|
||||
background-color: @dropdownErrorHoverBackground;
|
||||
}
|
||||
/* Active */
|
||||
.ui.form .fields.error .field .ui.dropdown .menu .active.item,
|
||||
.ui.form .field.error .ui.dropdown .menu .active.item {
|
||||
background-color: @dropdownErrorActiveBackground !important;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Checkbox Error
|
||||
---------------------*/
|
||||
|
||||
.ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label,
|
||||
.ui.form .field.error .checkbox:not(.toggle):not(.slider) label,
|
||||
.ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box,
|
||||
.ui.form .field.error .checkbox:not(.toggle):not(.slider) .box {
|
||||
color: @formErrorColor;
|
||||
}
|
||||
.ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label:before,
|
||||
.ui.form .field.error .checkbox:not(.toggle):not(.slider) label:before,
|
||||
.ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box:before,
|
||||
.ui.form .field.error .checkbox:not(.toggle):not(.slider) .box:before {
|
||||
background: @formErrorBackground;
|
||||
border-color: @formErrorBorder;
|
||||
}
|
||||
.ui.form .fields.error .field .checkbox label:after,
|
||||
.ui.form .field.error .checkbox label:after,
|
||||
.ui.form .fields.error .field .checkbox .box:after,
|
||||
.ui.form .field.error .checkbox .box:after {
|
||||
color: @formErrorColor;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Disabled
|
||||
---------------------*/
|
||||
|
||||
.ui.form .field :disabled,
|
||||
.ui.form .field.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.ui.form .field.disabled label {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.ui.form .field.disabled :disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/*--------------
|
||||
Loading
|
||||
---------------*/
|
||||
|
||||
.ui.loading.form {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
point-events: none;
|
||||
text-shadow: none !important;
|
||||
color: transparent !important;
|
||||
transition: all 0s linear;
|
||||
z-index: 100;
|
||||
}
|
||||
.ui.loading.form:before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
background: @loaderDimmerColor;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: @loaderDimmerZIndex;
|
||||
}
|
||||
.ui.loading.form:after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
margin: @loaderMargin;
|
||||
width: @loaderSize;
|
||||
height: @loaderSize;
|
||||
|
||||
animation: form-spin @loaderSpeed linear;
|
||||
animation-iteration-count: infinite;
|
||||
|
||||
border-radius: @circularRadius;
|
||||
|
||||
border-color: @loaderLineColor @loaderFillColor @loaderFillColor @loaderFillColor;
|
||||
border-style: solid;
|
||||
border-width: @loaderLineWidth;
|
||||
|
||||
box-shadow: 0px 0px 0px 1px transparent;
|
||||
visibility: visible;
|
||||
z-index: @loaderLineZIndex;
|
||||
}
|
||||
|
||||
@keyframes form-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
Element Types
|
||||
*******************************/
|
||||
|
||||
/*--------------------
|
||||
Required Field
|
||||
---------------------*/
|
||||
|
||||
.ui.form .required.fields > .field > label:after,
|
||||
.ui.form .required.field > label:after,
|
||||
.ui.form .required.fields > .field > .checkbox:after,
|
||||
.ui.form .required.field > .checkbox:after {
|
||||
margin: @requiredMargin;
|
||||
content: @requiredContent;
|
||||
color: @requiredColor;
|
||||
}
|
||||
|
||||
.ui.form .required.fields > .field > label:after,
|
||||
.ui.form .required.field > label:after {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.ui.form .required.fields > .field > .checkbox:after,
|
||||
.ui.form .required.field > .checkbox:after {
|
||||
position: absolute;
|
||||
top: 0%;
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
Variations
|
||||
*******************************/
|
||||
|
||||
|
||||
/*--------------------
|
||||
Inverted Colors
|
||||
---------------------*/
|
||||
|
||||
.ui.inverted.form label,
|
||||
.ui.form .inverted.segment label,
|
||||
.ui.form .inverted.segment .ui.checkbox label,
|
||||
.ui.form .inverted.segment .ui.checkbox .box,
|
||||
.ui.inverted.form .ui.checkbox label,
|
||||
.ui.inverted.form .ui.checkbox .box {
|
||||
color: @invertedLabelColor;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Field Groups
|
||||
---------------------*/
|
||||
|
||||
/* Grouped Vertically */
|
||||
.ui.form .grouped.fields {
|
||||
margin: @groupedMargin;
|
||||
}
|
||||
.ui.form .grouped.fields:last-child {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
.ui.form .grouped.fields > label {
|
||||
font-size: @groupedLabelFontSize;
|
||||
}
|
||||
.ui.form .grouped.fields .field {
|
||||
display: block;
|
||||
float: none;
|
||||
margin: @groupedFieldMargin;
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Fields
|
||||
---------------------*/
|
||||
|
||||
/* Split fields */
|
||||
.ui.form .fields {
|
||||
clear: both;
|
||||
}
|
||||
.ui.form .fields:after {
|
||||
content: ' ';
|
||||
display: block;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
line-height: 0;
|
||||
height: 0;
|
||||
}
|
||||
.ui.form .fields > .field {
|
||||
clear: none;
|
||||
float: left;
|
||||
padding-left: (@gutterWidth / 2);
|
||||
padding-right: (@gutterWidth / 2);
|
||||
}
|
||||
.ui.form .fields > .field:first-child {
|
||||
border-left: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Other Combinations */
|
||||
.ui.form .two.fields > .fields,
|
||||
.ui.form .two.fields > .field {
|
||||
width: @twoColumn;
|
||||
}
|
||||
.ui.form .three.fields > .fields,
|
||||
.ui.form .three.fields > .field {
|
||||
width: @threeColumn;
|
||||
}
|
||||
.ui.form .four.fields > .fields,
|
||||
.ui.form .four.fields > .field {
|
||||
width: @fourColumn;
|
||||
}
|
||||
.ui.form .five.fields > .fields,
|
||||
.ui.form .five.fields > .field {
|
||||
width: @fiveColumn;
|
||||
}
|
||||
.ui.form .six.fields > .fields,
|
||||
.ui.form .six.fields > .field {
|
||||
width: @sixColumn;
|
||||
}
|
||||
.ui.form .seven.fields > .fields,
|
||||
.ui.form .seven.fields > .field {
|
||||
width: @sevenColumn;
|
||||
}
|
||||
.ui.form .eight.fields > .fields,
|
||||
.ui.form .eight.fields > .field {
|
||||
width: @eightColumn;
|
||||
}
|
||||
.ui.form .nine.fields > .fields,
|
||||
.ui.form .nine.fields > .field {
|
||||
width: @nineColumn;
|
||||
}
|
||||
.ui.form .ten.fields > .fields,
|
||||
.ui.form .ten.fields > .field {
|
||||
width: @tenColumn;
|
||||
}
|
||||
|
||||
/* Swap to full width on mobile */
|
||||
@media only screen and (max-width : @largestMobileScreen) {
|
||||
.ui.form .two.fields > .fields,
|
||||
.ui.form .two.fields > .field,
|
||||
.ui.form .three.fields > .fields,
|
||||
.ui.form .three.fields > .field,
|
||||
.ui.form .four.fields > .fields,
|
||||
.ui.form .four.fields > .field,
|
||||
.ui.form .five.fields > .fields,
|
||||
.ui.form .five.fields > .field,
|
||||
.ui.form .six.fields > .fields,
|
||||
.ui.form .six.fields > .field,
|
||||
.ui.form .seven.fields > .fields,
|
||||
.ui.form .seven.fields > .field,
|
||||
.ui.form .eight.fields > .fields,
|
||||
.ui.form .eight.fields > .field,
|
||||
.ui.form .nine.fields > .fields,
|
||||
.ui.form .nine.fields > .field,
|
||||
.ui.form .ten.fields > .fields,
|
||||
.ui.form .ten.fields > .field {
|
||||
width: @oneColumn !important;
|
||||
margin: @fieldMargin;
|
||||
padding-left: 0%;
|
||||
padding-right: 0%;
|
||||
}
|
||||
}
|
||||
|
||||
.ui.form .fields .field:first-child {
|
||||
padding-left: 0%;
|
||||
}
|
||||
.ui.form .fields .field:last-child {
|
||||
padding-right: 0%;
|
||||
}
|
||||
|
||||
|
||||
/* Sizing Combinations */
|
||||
|
||||
.ui.form .fields .wide.field {
|
||||
width: @oneWide;
|
||||
padding-left: (@gutterWidth / 2);
|
||||
padding-right: (@gutterWidth / 2);
|
||||
}
|
||||
.ui.form .fields .wide.field:first-child {
|
||||
padding-left: 0%;
|
||||
}
|
||||
.ui.form .fields .wide.field:last-child {
|
||||
padding-right: 0%;
|
||||
}
|
||||
|
||||
.ui.form .one.wide.field {
|
||||
width: @oneWide !important;
|
||||
}
|
||||
.ui.form .two.wide.field {
|
||||
width: @twoWide !important;
|
||||
}
|
||||
.ui.form .three.wide.field {
|
||||
width: @threeWide !important;
|
||||
}
|
||||
.ui.form .four.wide.field {
|
||||
width: @fourWide !important;
|
||||
}
|
||||
.ui.form .five.wide.field {
|
||||
width: @fiveWide !important;
|
||||
}
|
||||
.ui.form .six.wide.field {
|
||||
width: @sixWide !important;
|
||||
}
|
||||
.ui.form .seven.wide.field {
|
||||
width: @sevenWide !important;
|
||||
}
|
||||
.ui.form .eight.wide.field {
|
||||
width: @eightWide !important;
|
||||
}
|
||||
.ui.form .nine.wide.field {
|
||||
width: @nineWide !important;
|
||||
}
|
||||
.ui.form .ten.wide.field {
|
||||
width: @tenWide !important;
|
||||
}
|
||||
.ui.form .eleven.wide.field {
|
||||
width: @elevenWide !important;
|
||||
}
|
||||
.ui.form .twelve.wide.field {
|
||||
width: @twelveWide !important;
|
||||
}
|
||||
.ui.form .thirteen.wide.field {
|
||||
width: @thirteenWide !important;
|
||||
}
|
||||
.ui.form .fourteen.wide.field {
|
||||
width: @fourteenWide !important;
|
||||
}
|
||||
.ui.form .fifteen.wide.field {
|
||||
width: @fifteenWide !important;
|
||||
}
|
||||
.ui.form .sixteen.wide.field {
|
||||
width: @sixteenWide !important;
|
||||
}
|
||||
|
||||
/* Swap to full width on mobile */
|
||||
@media only screen and (max-width : @largestMobileScreen) {
|
||||
.ui.form .two.fields > .fields,
|
||||
.ui.form .two.fields > .field,
|
||||
.ui.form .three.fields > .fields,
|
||||
.ui.form .three.fields > .field,
|
||||
.ui.form .four.fields > .fields,
|
||||
.ui.form .four.fields > .field,
|
||||
.ui.form .five.fields > .fields,
|
||||
.ui.form .five.fields > .field,
|
||||
.ui.form .fields > .two.wide.field,
|
||||
.ui.form .fields > .three.wide.field,
|
||||
.ui.form .fields > .four.wide.field,
|
||||
.ui.form .fields > .five.wide.field,
|
||||
.ui.form .fields > .six.wide.field,
|
||||
.ui.form .fields > .seven.wide.field,
|
||||
.ui.form .fields > .eight.wide.field,
|
||||
.ui.form .fields > .nine.wide.field,
|
||||
.ui.form .fields > .ten.wide.field,
|
||||
.ui.form .fields > .eleven.wide.field,
|
||||
.ui.form .fields > .twelve.wide.field,
|
||||
.ui.form .fields > .thirteen.wide.field,
|
||||
.ui.form .fields > .fourteen.wide.field,
|
||||
.ui.form .fields > .fifteen.wide.field,
|
||||
.ui.form .fields > .sixteen.wide.field {
|
||||
width: @oneColumn !important;
|
||||
margin: @fieldMargin;
|
||||
padding-left: 0%;
|
||||
padding-right: 0%;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
Inline Fields
|
||||
---------------------*/
|
||||
|
||||
.ui.form .inline.fields {
|
||||
margin: @fieldMargin;
|
||||
}
|
||||
.ui.form .inline.fields .field {
|
||||
display: inline-block;
|
||||
float: none;
|
||||
margin: @inlineFieldsMargin;
|
||||
padding: 0em;
|
||||
}
|
||||
.ui.form .inline.fields .field > label,
|
||||
.ui.form .inline.fields .field > p,
|
||||
.ui.form .inline.fields .field > input,
|
||||
.ui.form .inline.fields .field > .ui.input,
|
||||
.ui.form .inline.field > label,
|
||||
.ui.form .inline.field > p,
|
||||
.ui.form .inline.field > input,
|
||||
.ui.form .inline.field > .ui.input {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
|
||||
margin-top: 0em;
|
||||
margin-bottom: 0em;
|
||||
|
||||
vertical-align: @inlineLabelVerticalAlign;
|
||||
font-size: @inlineLabelFontSize;
|
||||
}
|
||||
.ui.form .inline.fields .field > input,
|
||||
.ui.form .inline.fields .field > .ui.input,
|
||||
.ui.form .inline.field > input,
|
||||
.ui.form .inline.field > .ui.input {
|
||||
font-size: @inlineLabelFontSize;
|
||||
}
|
||||
.ui.form .inline.fields .field > .ui.checkbox label {
|
||||
padding-left: @inlineCheckboxLabelDistance;
|
||||
}
|
||||
|
||||
/* Label */
|
||||
.ui.form .inline.fields .field > :first-child,
|
||||
.ui.form .inline.field > :first-child {
|
||||
margin: 0em @labelDistance 0em 0em;
|
||||
}
|
||||
.ui.form .inline.fields .field > :only-child,
|
||||
.ui.form .inline.field > :only-child {
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------
|
||||
Sizes
|
||||
---------------------*/
|
||||
|
||||
/* Standard */
|
||||
.ui.small.form {
|
||||
font-size: @small;
|
||||
}
|
||||
|
||||
/* Medium */
|
||||
.ui.form {
|
||||
font-size: @medium;
|
||||
}
|
||||
|
||||
/* Large */
|
||||
.ui.large.form {
|
||||
font-size: @large;
|
||||
}
|
||||
|
||||
/* Huge */
|
||||
.ui.huge.form {
|
||||
font-size: @huge;
|
||||
}
|
||||
|
||||
.loadUIOverrides();
|
1802
web/semantic/src/definitions/collections/grid.less
Normal file
1802
web/semantic/src/definitions/collections/grid.less
Normal file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue