text
stringlengths 2
104M
| meta
dict |
---|---|
import test from 'tape'
import mk from './test-utils/mk'
test('modify properties', function (t) {
var el = mk()
.attr('width', 100)
.attr('height', 200)
.node()
t.plan(2)
t.equal(el.getAttribute('width'), 100)
t.equal(el.getAttribute('height'), 200)
})
test('append children', function (t) {
var el = mk()
el
.append('p')
.attr('foo', 'bar')
el = el.node()
t.plan(3)
t.equal(el.children.length, 1)
t.equal(el.children[0].getAttribute('foo'), 'bar')
t.equal(el.children[0].parentNode, el)
})
test('classes', function (t) {
var el = mk()
.classed('foo bar baz', true)
.classed('bar', false)
.node()
t.plan(1)
t.equal(el.props.className, 'foo baz')
})
test('html', function (t) {
var el = mk()
.html('Hello, World!')
.node()
t.plan(1)
t.equal(el.text, 'Hello, World!')
})
test('some event support', function (t) {
var el = mk()
.on('mouseover', function () {})
.node()
t.plan(1)
t.equal(typeof el.eventListeners.onMouseOver[0], 'function')
})
test('next/previousSibling (used by order?)', function (t) {
var el = mk()
var first = el.append('p').node()
var second = el.append('p').node()
t.plan(2)
t.equal(first.nextSibling, second)
t.equal(second.previousSibling, first)
})
test('removing a child', function (t) {
var el = mk()
var p = el.append('p')
p.remove()
el = el.node()
t.plan(1)
t.equal(el.children.length, 0)
})
test('styles', function (t) {
var el = mk()
.style('stroke-width', '2px')
.style('opacity', 0.5)
t.plan(4)
var styles = el.node().props.style
t.equal(styles.strokeWidth, '2px')
t.equal(styles.opacity, 0.5)
t.equal(el.style('stroke-width'), '2px')
t.equal(el.style('width'), '')
})
test('text', function (t) {
var el = mk()
.text('Hello, World!')
.node()
t.plan(1)
t.equal(el.text, 'Hello, World!')
})
test('selection by class', function (t) {
var el = mk()
el.append('p').classed('one', true)
var two = el.append('p').classed('two', true).node()
el.append('p').classed('three', true)
var match = el.select('.two').node()
t.plan(1)
t.equal(match, two)
})
test('selection by id', function (t) {
var el = mk()
var original = el.append('div').append('p').attr('id', 'find-me').node()
var selected = el.select('#find-me').node()
t.plan(1)
t.equal(selected, original)
})
test('insert before', function (t) {
var el = mk()
el.append('p')
var span = el.insert('span', 'p').node()
el = el.node()
t.plan(1)
t.equal(el.children[0], span)
})
test('NS methods behave the same', function (t) {
var el = mk()
.attr('xlink:href', 'localhost')
.node()
t.plan(1)
t.equal(el.getAttributeNS('xlink', 'href'), 'localhost')
})
test('.enter() weirdness from https://github.com/Olical/react-faux-dom/issues/135', function (t) {
var el = mk()
var calledWith = 'not called'
el
.selectAll('.node')
.data([10])
.enter()
.append('circle')
.attr('r', d => (calledWith = d))
t.plan(1)
t.equal(calledWith, 10)
})
test('cloneNode', function (t) {
var el = mk()
el
.append('div')
.html('Hello!')
.style('width', '100px')
.attr('data-foo', '1234')
.clone()
.html('World!')
.style('width', '200px')
.attr('data-foo', '4321')
var node = el.node()
t.plan(7)
t.equal(node.children.length, 2)
t.equal(node.children[0].text, 'Hello!')
t.equal(node.children[1].text, 'World!')
t.equal(node.children[0].style.width, '100px')
t.equal(node.children[1].style.width, '200px')
t.equal(node.children[0].props['data-foo'], '1234')
t.equal(node.children[1].props['data-foo'], '4321')
})
test('selection order', function (t) {
var el = mk()
var DATA = [1, 2, 3]
el.selectAll('.child')
.data(DATA, d => d)
.enter()
.append('div')
.classed('child', true)
.text(d => d)
t.plan(6)
t.equal(el.selectAll('.child').nodes()[0].textContent, DATA[0])
t.equal(el.selectAll('.child').nodes()[1].textContent, DATA[1])
t.equal(el.selectAll('.child').nodes()[2].textContent, DATA[2])
el.selectAll('.child')
.data(DATA.reverse(), d => d)
.order()
.exit()
.remove()
t.equal(el.selectAll('.child').nodes()[0].textContent, DATA[0])
t.equal(el.selectAll('.child').nodes()[1].textContent, DATA[1])
t.equal(el.selectAll('.child').nodes()[2].textContent, DATA[2])
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import ReactFauxDOM from '../..'
import { select } from 'd3'
import 'd3-selection-multi'
function mk () {
var sel = select(ReactFauxDOM.createElement('div'))
sel.ownerDocument = ReactFauxDOM
return sel
}
export default mk
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
function compareReactElements (t, first, second) {
t.equal(first.$$typeof, second.$$typeof)
t.equal(first._owner, second._owner)
t.deepEqual(first._store, second._store)
t.equal(first.key, second.key)
t.deepEqual(first.props, second.props)
t.equal(first.type, second.type)
}
export default compareReactElements
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import React from 'react'
import sinon from 'sinon'
import './configure'
import { shallow } from 'enzyme'
import withFauxDOM from '../../lib/withFauxDOM'
function Component (noinit) {
class MockComponent extends React.Component {
constructor (props) {
super(props)
this.setState = this.setState.bind(this)
}
render () {
return <div>Fake Component</div>
}
}
MockComponent.someStatics = { foo: 'bar' }
var comp = shallow(React.createElement(withFauxDOM(MockComponent)))
var instance = comp.instance()
instance.setState = sinon.spy()
noinit || instance.componentWillMount()
return instance
}
export default Component
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import isString from '../../lib/utils/isString'
test('not a string', function (t) {
t.plan(1)
t.notOk(isString(123))
})
test('is a string', function (t) {
t.plan(1)
t.ok(isString('123'))
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import mapValues from '../../lib/utils/mapValues'
test('maps to another object', function (t) {
t.plan(1)
var obj = {a: 1, b: 2, c: 3}
var actual = mapValues(obj, function (n) {
return n + 1
})
var expected = {a: 2, b: 3, c: 4}
t.deepEqual(actual, expected)
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import assign from '../../lib/utils/assign'
test('cloning an object keeps all data', function (t) {
t.plan(1)
var expected = {foo: true, bar: false}
var actual = assign({}, {foo: true, bar: false})
t.deepEqual(actual, expected)
})
test('you can not mutate the original', function (t) {
t.plan(2)
var a = {foo: true, bar: false}
var b = assign({}, a)
b.bar = true
t.deepEqual(a, {foo: true, bar: false})
t.deepEqual(b, {foo: true, bar: true})
})
test('you can assign values down from right to left', function (t) {
t.plan(1)
var a = {foo: false, bar: true}
var b = {foo: true}
var c = {baz: true}
var expected = {foo: true, bar: true, baz: true}
var actual = assign({}, a, b, c)
t.deepEqual(actual, expected)
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import camelCase from '../../lib/utils/camelCase'
test('camelCase on a camelCase string does nothing', function (t) {
t.plan(1)
var actual = camelCase('fooBar')
var expected = 'fooBar'
t.strictEqual(actual, expected)
})
test('camelCase on a hyphenated string', function (t) {
t.plan(1)
var actual = camelCase('foo-bar')
var expected = 'fooBar'
t.strictEqual(actual, expected)
})
test('camelCase on a hyphenated string with initial hyphen', function (t) {
t.plan(1)
var actual = camelCase('-foo-bar')
var expected = 'fooBar'
t.strictEqual(actual, expected)
})
test('with an ms vendor prefix', function (t) {
t.plan(1)
var actual = camelCase('-ms-animation')
var expected = 'msAnimation'
t.strictEqual(actual, expected)
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import styleCamelCase from '../../lib/utils/styleCamelCase'
test('works like normal camelCase', function (t) {
t.plan(1)
var expected = 'fooBar'
var actual = styleCamelCase(expected)
t.strictEqual(actual, expected)
})
test('upper case first if starts with hyphen', function (t) {
t.plan(1)
var expected = 'FooBar'
var actual = styleCamelCase('-foo-bar')
t.strictEqual(actual, expected)
})
test('ms is an exception to the upper case first rule', function (t) {
t.plan(1)
var expected = 'msFooBar'
var actual = styleCamelCase('-ms-foo-bar')
t.strictEqual(actual, expected)
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
import test from 'tape'
import isUndefined from '../../lib/utils/isUndefined'
test('not a undefined', function (t) {
t.plan(1)
t.notOk(isUndefined(123))
})
test('is a undefined', function (t) {
t.plan(1)
t.ok(isUndefined(undefined))
})
| {
"repo_name": "Olical/react-faux-dom",
"stars": "1209",
"repo_language": "JavaScript",
"file_name": "isUndefined.js",
"mime_type": "text/plain"
} |
# WrapDemo
This repository demonstrates using Auto Layout with views that wrap.
It contains examples of text wrapping, and a custom view that implements its own wrapping.
These techniques are explained on dev etc: [Auto Layout and Views that Wrap](http://devetc.org/code/2014/07/07/auto-layout-and-views-that-wrap.html).
<img alt="WrapDemo iPhone Simulator Screenshot" src="https://raw.githubusercontent.com/jmah/WrapDemo/screenshots/wrapdemo-screenshot.png" width="386">
## License
This code is released into the public domain, and may be used with or without modification with no restrictions, attribution, or warranty.
Attribution is kindly requested, but not required.
See LICENSE for more details.
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// LabelWrappingSuperview.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import "LabelWrappingSuperview.h"
@implementation LabelWrappingSuperview
- (void)layoutSubviews
{
[super layoutSubviews];
CGFloat availableLabelWidth = self.label.frame.size.width;
self.label.preferredMaxLayoutWidth = availableLabelWidth;
[super layoutSubviews];
}
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// LabelShrinkWrappingSuperview.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import "LabelShrinkWrappingSuperview.h"
@implementation LabelShrinkWrappingSuperview
- (void)layoutSubviews
{
NSLayoutConstraint *labelAsWideAsPossibleConstraint = [NSLayoutConstraint constraintWithItem:self.label attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:0 multiplier:1.0 constant:1e8];
labelAsWideAsPossibleConstraint.priority = [self.label contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisHorizontal];
[self.label addConstraint:labelAsWideAsPossibleConstraint];
[super layoutSubviews];
CGFloat availableLabelWidth = self.label.frame.size.width;
self.label.preferredMaxLayoutWidth = availableLabelWidth;
[self.label removeConstraint:labelAsWideAsPossibleConstraint];
[super layoutSubviews];
}
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// WrapDemoViewController.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-04.
// This is free and unencumbered software released into the public domain.
//
#import "WrapDemoViewController.h"
@implementation WrapDemoViewController
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
[self updatePrimaryViewWidth];
}
- (IBAction)updatePrimaryViewWidth
{
self.primaryWidthConstraint.constant = (self.view.bounds.size.width * self.widthSlider.value);
}
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// CustomWrappingSuperview.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import "CustomWrappingSuperview.h"
#import "MyWrappingView.h"
@implementation CustomWrappingSuperview
- (void)layoutSubviews
{
[super layoutSubviews];
CGFloat availableWidth = self.wrappingView.frame.size.width;
self.wrappingView.preferredMaxLayoutWidth = availableWidth;
[super layoutSubviews];
}
- (IBAction)randomizeItemCount
{
self.wrappingView.itemCount = arc4random_uniform(48);
}
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// WrapDemoViewController.h
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-04.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@interface WrapDemoViewController : UIViewController
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *primaryWidthConstraint;
@property (strong, nonatomic) IBOutlet UISlider *widthSlider;
- (IBAction)updatePrimaryViewWidth;
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// LabelShrinkWrappingSuperview.h
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@interface LabelShrinkWrappingSuperview : UIView
@property (nonatomic) IBOutlet UILabel *label;
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// MyWrappingView.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-06-06.
// This is free and unencumbered software released into the public domain.
//
#import "MyWrappingView.h"
static const CGSize itemSize = {20, 12};
@implementation MyWrappingView
- (void)setItemCount:(NSInteger)itemCount
{
_itemCount = itemCount;
while (self.subviews.count > itemCount) {
[self.subviews.lastObject removeFromSuperview];
}
while (self.subviews.count < itemCount) {
NSUInteger i = self.subviews.count;
UIView *view = [[UIView alloc] initWithFrame:(CGRect){{0, 0}, itemSize}];
view.backgroundColor = [UIColor colorWithHue:((13 + i * 17) % 255) / 255. saturation:0.7 brightness:0.7 alpha:1.0];
// No constraints whatsoever; all layout done with -setFrame: in -layoutSubviews
view.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:view];
}
[self invalidateIntrinsicContentSize];
}
- (void)setPreferredMaxLayoutWidth:(CGFloat)width
{
if (self.preferredMaxLayoutWidth == width)
return;
_preferredMaxLayoutWidth = width;
[self invalidateIntrinsicContentSize];
}
- (CGSize)intrinsicContentSize
{
if (!self.itemCount)
return CGSizeZero;
__block CGRect totalRect = CGRectNull;
[self enumerateItemRectsForLayoutWidth:self.preferredMaxLayoutWidth usingBlock:^(CGRect itemRect) {
totalRect = CGRectUnion(itemRect, totalRect);
}];
return totalRect.size;
}
- (void)layoutSubviews
{
[super layoutSubviews];
// Disable animation during rotation, for example
BOOL wereEnabled = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
NSEnumerator *subviewEnumerator = [self.subviews objectEnumerator];
[self enumerateItemRectsForLayoutWidth:self.bounds.size.width usingBlock:^(CGRect itemRect) {
[[subviewEnumerator nextObject] setFrame:itemRect];
}];
[UIView setAnimationsEnabled:wereEnabled];
}
- (void)enumerateItemRectsForLayoutWidth:(CGFloat)layoutWidth usingBlock:(void (^)(CGRect itemRect))block
{
layoutWidth = MAX(layoutWidth, itemSize.width);
CGFloat x = 0, y = 0;
for (NSUInteger i = 0; i < self.itemCount; i++) {
if (x > layoutWidth - itemSize.width) {
y += itemSize.height;
x = 0;
}
block((CGRect){{x, y}, itemSize});
x += itemSize.width;
}
}
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// main.m
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-04.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@interface WrapDemoAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@implementation WrapDemoAppDelegate
@end
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([WrapDemoAppDelegate class]));
}
}
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.jmah.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// MyWrappingView.h
// WrapDemo
//
// Created by Jonathon Mah on 2014-06-06.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@interface MyWrappingView : UIView
@property (nonatomic) NSInteger itemCount;
@property (nonatomic) CGFloat preferredMaxLayoutWidth;
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// CustomWrappingSuperview.h
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@class MyWrappingView;
@interface CustomWrappingSuperview : UIView
@property (nonatomic) IBOutlet MyWrappingView *wrappingView;
- (IBAction)randomizeItemCount;
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
//
// LabelWrappingSuperview.h
// WrapDemo
//
// Created by Jonathon Mah on 2014-07-06.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@interface LabelWrappingSuperview : UIView
@property (nonatomic) IBOutlet UILabel *label;
@end
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<scenes>
<!--Wrap Demo View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="WrapDemoViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BsU-u9-UyO">
<rect key="frame" x="0.0" y="58" width="320" height="510"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aJg-aJ-Qqk">
<rect key="frame" x="0.0" y="0.0" width="320" height="80"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Just plain constraints. Lorem ipsum dolor sit amet" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="Gbl-BG-UlZ">
<rect key="frame" x="20" y="0.0" width="280" height="41"/>
<color key="backgroundColor" white="0.83823714717741937" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cbH-2A-mLK">
<rect key="frame" x="145" y="49" width="30" height="30"/>
<state key="normal" title="⬆︎">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" white="0.92619077620967749" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Gbl-BG-UlZ" firstAttribute="leading" secondItem="aJg-aJ-Qqk" secondAttribute="leading" constant="20" symbolic="YES" id="JfW-5R-Sqf"/>
<constraint firstAttribute="trailing" secondItem="Gbl-BG-UlZ" secondAttribute="trailing" constant="20" symbolic="YES" id="WeF-jF-Hse"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Gbl-BG-UlZ" secondAttribute="bottom" id="ZRv-Mc-R2R"/>
<constraint firstAttribute="centerX" secondItem="cbH-2A-mLK" secondAttribute="centerX" id="kDk-IG-AOQ"/>
<constraint firstAttribute="height" constant="80" id="tSg-dv-bkl"/>
<constraint firstItem="cbH-2A-mLK" firstAttribute="top" secondItem="Gbl-BG-UlZ" secondAttribute="bottom" constant="8" id="yu6-l3-7pQ"/>
<constraint firstItem="Gbl-BG-UlZ" firstAttribute="top" secondItem="aJg-aJ-Qqk" secondAttribute="top" id="zNr-Aj-zYs"/>
</constraints>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3If-aY-05v" userLabel="Label Wrapping Superview" customClass="LabelWrappingSuperview">
<rect key="frame" x="0.0" y="88" width="320" height="120"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Custom superview that sets preferred max layout width." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="YZM-mP-hUu">
<rect key="frame" x="20" y="0.0" width="280" height="41"/>
<color key="backgroundColor" white="0.83823714719999998" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="If6-uM-G0e">
<rect key="frame" x="145" y="49" width="30" height="30"/>
<state key="normal" title="⬆︎">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" white="0.92619077620000001" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="YZM-mP-hUu" secondAttribute="bottom" id="597-QY-2tA"/>
<constraint firstItem="If6-uM-G0e" firstAttribute="top" secondItem="YZM-mP-hUu" secondAttribute="bottom" constant="8" symbolic="YES" id="5k1-4D-4kY"/>
<constraint firstAttribute="trailing" secondItem="YZM-mP-hUu" secondAttribute="trailing" constant="20" symbolic="YES" id="agb-oV-1fL"/>
<constraint firstItem="YZM-mP-hUu" firstAttribute="leading" secondItem="3If-aY-05v" secondAttribute="leading" constant="20" symbolic="YES" id="qJh-zi-Zze"/>
<constraint firstAttribute="centerX" secondItem="If6-uM-G0e" secondAttribute="centerX" id="rmA-dC-n7W"/>
<constraint firstItem="YZM-mP-hUu" firstAttribute="top" secondItem="3If-aY-05v" secondAttribute="top" id="sVN-28-v3m"/>
<constraint firstAttribute="height" constant="120" id="wZK-OI-kIW"/>
</constraints>
<connections>
<outlet property="label" destination="YZM-mP-hUu" id="gg0-qr-OGh"/>
</connections>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Diy-yh-Sfz" userLabel="Custom Wrapping Superview" customClass="CustomWrappingSuperview">
<rect key="frame" x="0.0" y="216" width="320" height="120"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QcE-uN-UnZ">
<rect key="frame" x="135" y="32" width="51" height="30"/>
<state key="normal" title="Update">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="randomizeItemCount" destination="Diy-yh-Sfz" eventType="touchUpInside" id="ztu-OA-vDq"/>
</connections>
</button>
<view clipsSubviews="YES" contentMode="scaleToFill" placeholderIntrinsicWidth="280" placeholderIntrinsicHeight="24" translatesAutoresizingMaskIntoConstraints="NO" id="tHs-CU-RIP" customClass="MyWrappingView">
<rect key="frame" x="20" y="0.0" width="280" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.83823714719999998" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="0.92619077620000001" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="QcE-uN-UnZ" firstAttribute="top" secondItem="tHs-CU-RIP" secondAttribute="bottom" constant="8" symbolic="YES" id="A1h-3z-Zz9"/>
<constraint firstAttribute="height" constant="120" id="Hr1-lv-Q3k"/>
<constraint firstAttribute="trailing" secondItem="tHs-CU-RIP" secondAttribute="trailing" constant="20" symbolic="YES" id="Imj-eR-RtR"/>
<constraint firstItem="tHs-CU-RIP" firstAttribute="leading" secondItem="Diy-yh-Sfz" secondAttribute="leading" constant="20" symbolic="YES" id="MRq-9R-E3Y"/>
<constraint firstAttribute="centerX" secondItem="QcE-uN-UnZ" secondAttribute="centerX" id="QX5-sG-Bps"/>
<constraint firstItem="tHs-CU-RIP" firstAttribute="top" secondItem="Diy-yh-Sfz" secondAttribute="top" id="VZF-GW-cJz"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="QcE-uN-UnZ" secondAttribute="bottom" id="sXB-AL-RHi"/>
</constraints>
<connections>
<outlet property="wrappingView" destination="tHs-CU-RIP" id="hxK-yl-qdd"/>
</connections>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="I5T-M6-Mdw" userLabel="Label Shrink-Wrapping Superview" customClass="LabelShrinkWrappingSuperview">
<rect key="frame" x="0.0" y="344" width="320" height="80"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Custom shrink wrapping" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="188" translatesAutoresizingMaskIntoConstraints="NO" id="ZQW-kb-AOK">
<rect key="frame" x="66" y="0.0" width="188" height="21"/>
<color key="backgroundColor" white="0.83823714719999998" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fmF-hK-ak0">
<rect key="frame" x="145" y="29" width="30" height="30"/>
<state key="normal" title="⬆︎">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" white="0.92619077620000001" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="ZQW-kb-AOK" secondAttribute="centerX" id="26o-ZO-N7T"/>
<constraint firstAttribute="height" constant="80" id="TRM-MF-Y6Q"/>
<constraint firstItem="fmF-hK-ak0" firstAttribute="top" secondItem="ZQW-kb-AOK" secondAttribute="bottom" constant="8" symbolic="YES" id="hIp-4S-v6M"/>
<constraint firstItem="ZQW-kb-AOK" firstAttribute="top" secondItem="I5T-M6-Mdw" secondAttribute="top" id="lvo-P6-eM5"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="ZQW-kb-AOK" secondAttribute="bottom" id="nz4-pd-I93"/>
<constraint firstAttribute="centerX" secondItem="fmF-hK-ak0" secondAttribute="centerX" id="rcF-xb-Wsh"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ZQW-kb-AOK" secondAttribute="trailing" constant="20" symbolic="YES" id="sXX-ub-t9E"/>
</constraints>
<connections>
<outlet property="label" destination="ZQW-kb-AOK" id="z51-aH-idx"/>
</connections>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="I5T-M6-Mdw" firstAttribute="leading" secondItem="BsU-u9-UyO" secondAttribute="leading" id="0dw-f3-ZU5"/>
<constraint firstItem="Diy-yh-Sfz" firstAttribute="top" secondItem="3If-aY-05v" secondAttribute="bottom" constant="8" symbolic="YES" id="0ge-Jx-p4q"/>
<constraint firstItem="aJg-aJ-Qqk" firstAttribute="top" secondItem="BsU-u9-UyO" secondAttribute="top" id="2lG-ov-N8a"/>
<constraint firstItem="3If-aY-05v" firstAttribute="top" secondItem="aJg-aJ-Qqk" secondAttribute="bottom" constant="8" symbolic="YES" id="5Dw-p9-Q7p"/>
<constraint firstItem="I5T-M6-Mdw" firstAttribute="top" secondItem="Diy-yh-Sfz" secondAttribute="bottom" constant="8" symbolic="YES" id="8Y2-G3-INb"/>
<constraint firstAttribute="trailing" secondItem="Diy-yh-Sfz" secondAttribute="trailing" id="HDr-PB-TNt"/>
<constraint firstAttribute="width" priority="900" constant="320" id="I9o-Eu-2Cj"/>
<constraint firstItem="aJg-aJ-Qqk" firstAttribute="leading" secondItem="BsU-u9-UyO" secondAttribute="leading" id="LsV-6P-4DR"/>
<constraint firstAttribute="trailing" secondItem="3If-aY-05v" secondAttribute="trailing" id="MY9-Yy-klf"/>
<constraint firstItem="Diy-yh-Sfz" firstAttribute="leading" secondItem="BsU-u9-UyO" secondAttribute="leading" id="YeV-7B-xzK"/>
<constraint firstAttribute="trailing" secondItem="aJg-aJ-Qqk" secondAttribute="trailing" id="gpw-ll-GuA"/>
<constraint firstItem="3If-aY-05v" firstAttribute="leading" secondItem="BsU-u9-UyO" secondAttribute="leading" id="rkI-4w-Za9"/>
<constraint firstAttribute="trailing" secondItem="I5T-M6-Mdw" secondAttribute="trailing" id="yif-2Y-TlF"/>
</constraints>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="PGz-g8-Hnp">
<rect key="frame" x="18" y="20" width="284" height="31"/>
<connections>
<action selector="updatePrimaryViewWidth" destination="vXZ-lx-hvc" eventType="valueChanged" id="wP3-Zu-jDI"/>
</connections>
</slider>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="jyV-Pf-zRb" firstAttribute="bottom" secondItem="PGz-g8-Hnp" secondAttribute="top" id="FXU-2E-ZD7"/>
<constraint firstAttribute="trailing" secondItem="BsU-u9-UyO" secondAttribute="trailing" priority="800" id="aAg-dl-9Zn"/>
<constraint firstItem="BsU-u9-UyO" firstAttribute="top" secondItem="PGz-g8-Hnp" secondAttribute="bottom" constant="8" symbolic="YES" id="fK9-lw-79e"/>
<constraint firstAttribute="trailing" secondItem="PGz-g8-Hnp" secondAttribute="trailing" constant="20" symbolic="YES" id="gi3-7Q-0Ek"/>
<constraint firstItem="PGz-g8-Hnp" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="20" symbolic="YES" id="hLJ-pY-8al"/>
<constraint firstItem="BsU-u9-UyO" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="hcW-o2-6KA"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="BsU-u9-UyO" secondAttribute="bottom" id="mHQ-35-stq"/>
<constraint firstItem="PGz-g8-Hnp" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="vgC-qc-NH2"/>
</constraints>
</view>
<connections>
<outlet property="primaryWidthConstraint" destination="I9o-Eu-2Cj" id="YaV-OF-1EV"/>
<outlet property="widthSlider" destination="PGz-g8-Hnp" id="Upu-Tg-bPf"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-34" y="148"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0B43733A19679953007B2F74 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B43733919679953007B2F74 /* Foundation.framework */; };
0B43733C19679953007B2F74 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B43733B19679953007B2F74 /* CoreGraphics.framework */; };
0B43733E19679953007B2F74 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B43733D19679953007B2F74 /* UIKit.framework */; };
0B43734619679953007B2F74 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B43734519679953007B2F74 /* main.m */; };
0B43734D19679953007B2F74 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B43734B19679953007B2F74 /* Main.storyboard */; };
0B43735019679953007B2F74 /* WrapDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B43734F19679953007B2F74 /* WrapDemoViewController.m */; };
0B43736F196799F0007B2F74 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B43736E196799F0007B2F74 /* Images.xcassets */; };
0BB3D5B1196A438700A9AC5C /* LabelWrappingSuperview.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB3D5B0196A438700A9AC5C /* LabelWrappingSuperview.m */; };
0BB3D5B4196A43AC00A9AC5C /* LabelShrinkWrappingSuperview.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB3D5B3196A43AC00A9AC5C /* LabelShrinkWrappingSuperview.m */; };
0BB3D5B7196A5D2500A9AC5C /* MyWrappingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB3D5B6196A5D2500A9AC5C /* MyWrappingView.m */; };
0BB3D5BA196A5D3E00A9AC5C /* CustomWrappingSuperview.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB3D5B9196A5D3E00A9AC5C /* CustomWrappingSuperview.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0B43733619679953007B2F74 /* WrapDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WrapDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
0B43733919679953007B2F74 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
0B43733B19679953007B2F74 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
0B43733D19679953007B2F74 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
0B43734119679953007B2F74 /* WrapDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WrapDemo-Info.plist"; sourceTree = "<group>"; };
0B43734519679953007B2F74 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
0B43734C19679953007B2F74 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
0B43734E19679953007B2F74 /* WrapDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WrapDemoViewController.h; sourceTree = "<group>"; };
0B43734F19679953007B2F74 /* WrapDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WrapDemoViewController.m; sourceTree = "<group>"; };
0B43736E196799F0007B2F74 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
0BB3D5AF196A438700A9AC5C /* LabelWrappingSuperview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelWrappingSuperview.h; sourceTree = "<group>"; };
0BB3D5B0196A438700A9AC5C /* LabelWrappingSuperview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LabelWrappingSuperview.m; sourceTree = "<group>"; };
0BB3D5B2196A43AB00A9AC5C /* LabelShrinkWrappingSuperview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelShrinkWrappingSuperview.h; sourceTree = "<group>"; };
0BB3D5B3196A43AC00A9AC5C /* LabelShrinkWrappingSuperview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LabelShrinkWrappingSuperview.m; sourceTree = "<group>"; };
0BB3D5B5196A5D2500A9AC5C /* MyWrappingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyWrappingView.h; sourceTree = "<group>"; };
0BB3D5B6196A5D2500A9AC5C /* MyWrappingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyWrappingView.m; sourceTree = "<group>"; };
0BB3D5B8196A5D3E00A9AC5C /* CustomWrappingSuperview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomWrappingSuperview.h; sourceTree = "<group>"; };
0BB3D5B9196A5D3E00A9AC5C /* CustomWrappingSuperview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomWrappingSuperview.m; sourceTree = "<group>"; };
0BB3D5BB196B242800A9AC5C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0B43733319679953007B2F74 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0B43733C19679953007B2F74 /* CoreGraphics.framework in Frameworks */,
0B43733E19679953007B2F74 /* UIKit.framework in Frameworks */,
0B43733A19679953007B2F74 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0B43732D19679953007B2F74 = {
isa = PBXGroup;
children = (
0BB3D5BB196B242800A9AC5C /* LICENSE */,
0B43733F19679953007B2F74 /* WrapDemo */,
0B43733819679953007B2F74 /* Frameworks */,
0B43733719679953007B2F74 /* Products */,
);
sourceTree = "<group>";
};
0B43733719679953007B2F74 /* Products */ = {
isa = PBXGroup;
children = (
0B43733619679953007B2F74 /* WrapDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
0B43733819679953007B2F74 /* Frameworks */ = {
isa = PBXGroup;
children = (
0B43733919679953007B2F74 /* Foundation.framework */,
0B43733B19679953007B2F74 /* CoreGraphics.framework */,
0B43733D19679953007B2F74 /* UIKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0B43733F19679953007B2F74 /* WrapDemo */ = {
isa = PBXGroup;
children = (
0B43734519679953007B2F74 /* main.m */,
0B43734B19679953007B2F74 /* Main.storyboard */,
0B43734E19679953007B2F74 /* WrapDemoViewController.h */,
0B43734F19679953007B2F74 /* WrapDemoViewController.m */,
0BB3D5AF196A438700A9AC5C /* LabelWrappingSuperview.h */,
0BB3D5B0196A438700A9AC5C /* LabelWrappingSuperview.m */,
0BB3D5B5196A5D2500A9AC5C /* MyWrappingView.h */,
0BB3D5B6196A5D2500A9AC5C /* MyWrappingView.m */,
0BB3D5B8196A5D3E00A9AC5C /* CustomWrappingSuperview.h */,
0BB3D5B9196A5D3E00A9AC5C /* CustomWrappingSuperview.m */,
0BB3D5B2196A43AB00A9AC5C /* LabelShrinkWrappingSuperview.h */,
0BB3D5B3196A43AC00A9AC5C /* LabelShrinkWrappingSuperview.m */,
0B43734119679953007B2F74 /* WrapDemo-Info.plist */,
0B43736E196799F0007B2F74 /* Images.xcassets */,
);
path = WrapDemo;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0B43733519679953007B2F74 /* WrapDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0B43736819679953007B2F74 /* Build configuration list for PBXNativeTarget "WrapDemo" */;
buildPhases = (
0B43733219679953007B2F74 /* Sources */,
0B43733319679953007B2F74 /* Frameworks */,
0B43733419679953007B2F74 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = WrapDemo;
productName = WrapDemo;
productReference = 0B43733619679953007B2F74 /* WrapDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0B43732E19679953007B2F74 /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = WrapDemo;
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Jonathon Mah";
};
buildConfigurationList = 0B43733119679953007B2F74 /* Build configuration list for PBXProject "WrapDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 0B43732D19679953007B2F74;
productRefGroup = 0B43733719679953007B2F74 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0B43733519679953007B2F74 /* WrapDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
0B43733419679953007B2F74 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0B43734D19679953007B2F74 /* Main.storyboard in Resources */,
0B43736F196799F0007B2F74 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
0B43733219679953007B2F74 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0BB3D5B1196A438700A9AC5C /* LabelWrappingSuperview.m in Sources */,
0BB3D5B4196A43AC00A9AC5C /* LabelShrinkWrappingSuperview.m in Sources */,
0BB3D5BA196A5D3E00A9AC5C /* CustomWrappingSuperview.m in Sources */,
0B43734619679953007B2F74 /* main.m in Sources */,
0BB3D5B7196A5D2500A9AC5C /* MyWrappingView.m in Sources */,
0B43735019679953007B2F74 /* WrapDemoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
0B43734B19679953007B2F74 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
0B43734C19679953007B2F74 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
0B43736619679953007B2F74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
0B43736719679953007B2F74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
0B43736919679953007B2F74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
INFOPLIST_FILE = "WrapDemo/WrapDemo-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
0B43736A19679953007B2F74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
INFOPLIST_FILE = "WrapDemo/WrapDemo-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0B43733119679953007B2F74 /* Build configuration list for PBXProject "WrapDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0B43736619679953007B2F74 /* Debug */,
0B43736719679953007B2F74 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0B43736819679953007B2F74 /* Build configuration list for PBXNativeTarget "WrapDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0B43736919679953007B2F74 /* Debug */,
0B43736A19679953007B2F74 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0B43732E19679953007B2F74 /* Project object */;
}
| {
"repo_name": "jmah/WrapDemo",
"stars": "267",
"repo_language": "Objective-C",
"file_name": "project.pbxproj",
"mime_type": "text/plain"
} |
-- SQLITE event store
PRAGMA foreign_keys = ON;
DROP TABLE IF EXISTS events;
DROP TABLE IF EXISTS entity_events;
CREATE TABLE entity_events
(
entity TEXT NOT NULL,
event TEXT NOT NULL,
PRIMARY KEY (entity, event) ON CONFLICT IGNORE
);
CREATE TABLE events
(
entity TEXT NOT NULL,
entityKey TEXT NOT NULL,
event TEXT NOT NULL,
data TEXT NOT NULL,
eventId TEXT NOT NULL UNIQUE CHECK (eventId LIKE '________-____-____-____-____________'),
commandId TEXT NOT NULL UNIQUE CHECK (commandId LIKE '________-____-____-____-____________'),
-- previous event uuid; null for first event; null does not trigger UNIQUE constraint
previousId TEXT UNIQUE,
timestamp TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- ordering sequence
sequence INTEGER PRIMARY KEY, -- sequence for all events in all entities
FOREIGN KEY (entity, event) REFERENCES entity_events (entity, event)
);
CREATE INDEX entity_index ON events (entityKey, entity);
-- immutable entity_events
CREATE TRIGGER no_delete_entity_events
BEFORE DELETE
ON entity_events
BEGIN
SELECT RAISE(FAIL, 'Cannot delete entity_events');
END;
CREATE TRIGGER no_update_entity_events
BEFORE UPDATE
ON entity_events
BEGIN
SELECT RAISE(FAIL, 'Cannot update entity_events');
END;
-- immutable events
CREATE TRIGGER no_delete_events
BEFORE DELETE
ON events
BEGIN
SELECT RAISE(FAIL, 'Cannot delete events');
END;
CREATE TRIGGER no_update_events
BEFORE UPDATE
ON events
BEGIN
SELECT RAISE(FAIL, 'Cannot update events');
END;
-- Can only use null previousId for first event in an entity
CREATE TRIGGER first_event_for_entity
BEFORE INSERT
ON events
FOR EACH ROW
WHEN NEW.previousId IS NULL
AND EXISTS (SELECT 1
FROM events
WHERE NEW.entityKey = entityKey
AND NEW.entity = entity)
BEGIN
SELECT RAISE(FAIL, 'previousId can only be null for first entity event');
END;
-- previousId must be in the same entity as the event
CREATE TRIGGER previousId_in_same_entity
BEFORE INSERT
ON events
FOR EACH ROW
WHEN NEW.previousId IS NOT NULL
AND NOT EXISTS (SELECT 1
FROM events
WHERE NEW.previousId = eventId
AND NEW.entityKey = entityKey
AND NEW.entity = entity)
BEGIN
SELECT RAISE(FAIL, 'previousId must be in same entity');
END;
| {
"repo_name": "mattbishop/sql-event-store",
"stars": "49",
"repo_language": "JavaScript",
"file_name": "README.md",
"mime_type": "text/plain"
} |
/*
This test suite exercises the database schema with incorrect data, duplicate data and other likely real-world problems.
*/
const test = require('tape');
const fs = require('fs');
const initSqlJs = require('sql.js');
const uuid = require('uuid');
const thingEntity = 'thing';
const thingCreatedEvent = 'thing-created';
const thingDeletedEvent = 'thing-deleted';
const tableTennisEntity = 'table-tennis';
const pingEvent = 'ball-pinged';
const pongEvent = 'ball-ponged';
async function initDb() {
const SQL = await initSqlJs();
const db = new SQL.Database();
loadDdl(db);
return db;
}
function loadDdl(db) {
const createScript = fs.readFileSync('./sqlite-event-store.ddl', 'utf8');
return db.run(createScript);
}
function shutdownDb(db) {
const data = db.export();
const buffer = Buffer.from(data);
fs.writeFileSync('test-event-store.sqlite', buffer);
db.close();
}
test('setup', async setup => {
const db = await initDb();
setup.test('running setup on existing db succeeds', t => {
t.doesNotThrow(() => loadDdl(db));
t.end();
});
setup.test('insert entity_events', t => {
const stmt = db.prepare('INSERT INTO entity_events (entity, event) VALUES (?, ?)');
t.test('cannot insert null fields', assert => {
assert.throws(
() => stmt.run([null, thingCreatedEvent]),
/Error: NOT NULL constraint failed: entity_events\.entity/,
'cannot insert null entity');
assert.throws(
() => stmt.run([thingEntity, null]),
/Error: NOT NULL constraint failed: entity_events\.event/,
'cannot insert null entity');
assert.end();
});
t.test('insert entity_events', assert => {
assert.doesNotThrow(() => stmt.run([thingEntity, thingCreatedEvent]));
assert.doesNotThrow(() => stmt.run([thingEntity, thingDeletedEvent]));
assert.doesNotThrow(() => stmt.run([tableTennisEntity, pingEvent]));
assert.doesNotThrow(() => stmt.run([tableTennisEntity, pongEvent]));
assert.end();
});
t.test('insert duplicate entity events does not throw an Error', assert => {
assert.doesNotThrow(() => stmt.run([thingEntity, thingCreatedEvent]));
assert.doesNotThrow(() => stmt.run([thingEntity, thingCreatedEvent]));
const result = db.exec(`SELECT COUNT(*) FROM entity_events WHERE entity = '${thingEntity}' AND event = '${thingCreatedEvent}'`);
assert.equal(result[0].values[0][0], 1);
assert.end();
});
});
setup.test('insert events', t => {
const stmt = db.prepare('INSERT INTO events (entity, entityKey, event, data, eventId, commandId, previousId) VALUES (?, ?, ?, ?, ?, ?, ?)');
const thingKey = '1';
const homeTableKey = 'home';
const workTableKey = 'work';
const commandId1 = uuid.v4();
const commandId2 = uuid.v4();
const thingEventId1 = uuid.v4();
const thingEventId2 = uuid.v4();
const pingEventHomeId = uuid.v4();
const pingEventWorkId = uuid.v4();
const data = '{}';
t.test('cannot insert empty columns', assert => {
assert.throws(
() => stmt.run([null, thingKey, thingCreatedEvent, data, thingEventId1, commandId1]),
/NOT NULL constraint failed: events\.entity/,
'cannot insert null entity');
assert.throws(
() => stmt.run([thingEntity, null, thingCreatedEvent, data, thingEventId1, commandId1]),
/NOT NULL constraint failed: events\.entityKey/,
'cannot insert null entity key');
assert.throws(
() => stmt.run([thingEntity, thingKey, null, data, thingEventId1, commandId1]),
/NOT NULL constraint failed: events\.event/,
'cannot insert null event');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, null, thingEventId1, commandId1]),
/NOT NULL constraint failed: events\.data/,
'cannot insert null event data');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, null, commandId1]),
/NOT NULL constraint failed: events\.eventId/,
'cannot insert null event id');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, null]),
/NOT NULL constraint failed: events\.commandId/,
'cannot insert null command');
assert.end();
});
t.test('UUIDs format for IDs', assert => {
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, 'not-a-uuid', commandId1]),
/CHECK constraint failed: eventId/,
'eventId must be a UUID');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, 'not-a-uuid']),
/CHECK constraint failed: commandId/,
'commandId must be a UUID');
assert.end();
});
t.test('Cannot insert event from wrong entity', assert => {
assert.throws(
() => stmt.run([tableTennisEntity, thingKey, thingCreatedEvent, data, thingEventId1, commandId1]),
/FOREIGN KEY constraint failed/,
'cannot insert event in wrong entity');
assert.end();
});
t.test('insert events for an entity', assert => {
assert.doesNotThrow(() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, commandId1]));
assert.doesNotThrow(() => stmt.run([thingEntity, thingKey, thingDeletedEvent, data, thingEventId2, commandId2, thingEventId1]));
assert.doesNotThrow(() => stmt.run([tableTennisEntity, homeTableKey, pingEvent, data, pingEventHomeId, uuid.v4()]));
assert.doesNotThrow(() => stmt.run([tableTennisEntity, workTableKey, pingEvent, data, pingEventWorkId, uuid.v4()]));
assert.end();
});
t.test('previousId rules', assert => {
assert.throws(
() => stmt.run([tableTennisEntity, homeTableKey, pingEvent, data, pingEventHomeId, uuid.v4()]),
/previousId can only be null for first entity event/,
'cannot insert multiple null previousId for an entity');
assert.throws(
() => stmt.run([tableTennisEntity, workTableKey, pongEvent, data, uuid.v4(), uuid.v4(), pingEventHomeId]),
/previousId must be in same entity/,
'previousId must be in same entity');
assert.end();
});
t.test('Cannot insert duplicates', assert => {
assert.throws(
() => stmt.run([thingEntity, thingKey, thingCreatedEvent, data, thingEventId2, commandId2, thingEventId1]),
/UNIQUE constraint failed/,
'cannot insert complete duplicate event');
assert.throws(
() => stmt.run([tableTennisEntity, homeTableKey, pongEvent, data, pingEventHomeId, uuid.v4(), pingEventHomeId]),
/UNIQUE constraint failed: events\.eventId/,
'cannot insert different event for same id');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingDeletedEvent, data, uuid.v4(), commandId1, thingEventId2]),
/UNIQUE constraint failed: events\.commandId/,
'cannot insert different event for same command');
assert.throws(
() => stmt.run([thingEntity, thingKey, thingDeletedEvent, data, uuid.v4(), uuid.v4(), thingEventId1]),
/UNIQUE constraint failed: events\.previousId/,
'cannot insert different event for same previous');
assert.end();
});
});
setup.test('cannot delete or update', t => {
t.test('cannot delete or update entity_events', assert => {
assert.throws(
() => db.exec(`DELETE FROM entity_events WHERE entity = '${tableTennisEntity}'`),
/Cannot delete entity_events/,
'cannot delete entity_events'
);
assert.throws(
() => db.exec(`UPDATE entity_events SET entity = 'fail' WHERE entity = '${tableTennisEntity}'`),
/Cannot update entity_events/,
'cannot update entity_events'
);
assert.end();
});
t.test('cannot delete or update events', assert => {
assert.throws(
() => db.exec(`DELETE FROM events WHERE entity = '${thingEntity}'`),
/Cannot delete events/,
'cannot delete events'
);
assert.throws(
() => db.exec(`UPDATE events SET entityKey = 'fail' WHERE entity = '${thingEntity}'`),
/Cannot update events/,
'cannot update events'
);
assert.end();
});
});
test.onFinish(() => shutdownDb(db));
});
| {
"repo_name": "mattbishop/sql-event-store",
"stars": "49",
"repo_language": "JavaScript",
"file_name": "README.md",
"mime_type": "text/plain"
} |
-- PostgreSQL event store
DROP TABLE IF EXISTS events;
DROP TABLE IF EXISTS entity_events;
CREATE TABLE entity_events
(
entity TEXT NOT NULL,
event TEXT NOT NULL,
PRIMARY KEY (entity, event)
);
CREATE OR REPLACE RULE ignore_dup_entity_events AS ON INSERT TO entity_events
WHERE EXISTS(SELECT 1
FROM entity_events
WHERE (entity, event) = (NEW.entity, NEW.event))
DO INSTEAD NOTHING;
-- immutable entity_events
CREATE OR REPLACE RULE ignore_delete_entity_events AS ON DELETE TO entity_events
DO INSTEAD NOTHING;
CREATE OR REPLACE RULE ignore_update_entity_events AS ON UPDATE TO entity_events
DO INSTEAD NOTHING;
CREATE TABLE events
(
entity TEXT NOT NULL,
entitykey TEXT NOT NULL,
event TEXT NOT NULL,
data JSONB NOT NULL,
eventid UUID NOT NULL UNIQUE,
commandid UUID NOT NULL UNIQUE,
-- previous event uuid; null for first event; null does not trigger UNIQUE constraint
previousid UUID UNIQUE,
timestamp TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- ordering sequence
sequence BIGSERIAL PRIMARY KEY, -- sequence for all events in all entities
FOREIGN KEY (entity, event) REFERENCES entity_events (entity, event)
);
CREATE INDEX entity_index ON events (entitykey, entity);
-- immutable events
CREATE OR REPLACE RULE ignore_delete_events AS ON DELETE TO events
DO INSTEAD NOTHING;
CREATE OR REPLACE RULE ignore_update_events AS ON UPDATE TO events
DO INSTEAD NOTHING;
-- Can only use null previousId for first event in an entity
CREATE OR REPLACE FUNCTION check_first_event_for_entity() RETURNS trigger AS
$$
BEGIN
IF (NEW.previousid IS NULL
AND EXISTS (SELECT 1
FROM events
WHERE NEW.entitykey = entitykey
AND NEW.entity = entity))
THEN
RAISE EXCEPTION 'previousid can only be null for first entity event';
END IF;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS first_event_for_entity ON events;
CREATE TRIGGER first_event_for_entity
BEFORE INSERT
ON events
FOR EACH ROW
EXECUTE PROCEDURE check_first_event_for_entity();
-- previousId must be in the same entity as the event
CREATE OR REPLACE FUNCTION check_previousid_in_same_entity() RETURNS trigger AS
$$
BEGIN
IF (NEW.previousid IS NOT NULL
AND NOT EXISTS (SELECT 1
FROM events
WHERE NEW.previousid = eventid
AND NEW.entitykey = entitykey
AND NEW.entity = entity))
THEN
RAISE EXCEPTION 'previousid must be in the same entity';
END IF;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS previousid_in_same_entity ON events;
CREATE TRIGGER previousid_in_same_entity
BEFORE INSERT
ON events
FOR EACH ROW
EXECUTE FUNCTION check_previousid_in_same_entity();
| {
"repo_name": "mattbishop/sql-event-store",
"stars": "49",
"repo_language": "JavaScript",
"file_name": "README.md",
"mime_type": "text/plain"
} |
/*
This test suite exercises the database schema with incorrect data, duplicate data and other likely real-world problems.
*/
const tape = require('tape')
const _test = require('tape-promise').default;
const test = _test(tape)
const fs = require('fs');
const pg = require('pg');
const uuid = require('uuid');
const thingEntity = 'thing';
const thingCreatedEvent = 'thing-created';
const thingDeletedEvent = 'thing-deleted';
const tableTennisEntity = 'table-tennis';
const pingEvent = 'ball-pinged';
const pongEvent = 'ball-ponged';
async function initDb() {
const db = new pg.Client()
db.connect()
await loadDdl(db);
return db;
}
async function loadDdl(db) {
const createScript = fs.readFileSync('./postgres-event-store.ddl', 'utf8');
return db.query(createScript);
}
async function shutdownDb(db) {
await db.end();
}
// use t.plan() for async testing too.
test('setup', async setup => {
const db = await initDb();
setup.test('running setup on existing db succeeds', async t => {
await loadDdl(db);
t.pass(true);
t.end();
});
setup.test('insert entity_events', t => {
const stmt = 'INSERT INTO entity_events (entity, event) VALUES ($1, $2)';
t.test('cannot insert null fields', async assert => {
await assert.rejects(
() => db.query(stmt, [null, thingCreatedEvent]),
/error: null value in column "entity" of relation "entity_events" violates not-null constraint/,
'cannot insert null entity');
await assert.rejects(
() => db.query(stmt, [thingEntity, null]),
/error: null value in column "event" of relation "entity_events" violates not-null constraint/,
'cannot insert null event');
assert.end();
});
t.test('insert entity_events', async assert => {
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingCreatedEvent]));
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingDeletedEvent]));
await assert.doesNotReject(() => db.query(stmt, [tableTennisEntity, pingEvent]));
await assert.doesNotReject(() => db.query(stmt, [tableTennisEntity, pongEvent]));
assert.end();
});
t.test('insert duplicate entity events does not throw an Error', async assert => {
assert.plan(4);
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingCreatedEvent]));
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingCreatedEvent]));
const result = await db.query(`SELECT COUNT(*) FROM entity_events WHERE entity = '${thingEntity}' AND event = '${thingCreatedEvent}'`);
assert.equal(result.rows[0].count, '1');
assert.pass('no entity event duplicates');
assert.end();
});
});
setup.test('insert events', t => {
const stmt = 'INSERT INTO events (entity, entityKey, event, data, eventId, commandId, previousId) VALUES ($1, $2, $3, $4, $5, $6, $7)';
const thingKey = '1';
const homeTableKey = 'home';
const workTableKey = 'work';
const commandId1 = uuid.v4();
const commandId2 = uuid.v4();
const thingEventId1 = uuid.v4();
const thingEventId2 = uuid.v4();
const pingEventHomeId = uuid.v4();
const pingEventWorkId = uuid.v4();
const data = {};
t.test('cannot insert empty columns', async assert => {
await assert.rejects(
() => db.query(stmt, [null, thingKey, thingCreatedEvent, data, thingEventId1, commandId1, null]),
/error: null value in column "entity" of relation "events" violates not-null constraint/,
'cannot insert null entity');
await assert.rejects(
() => db.query(stmt, [thingEntity, null, thingCreatedEvent, data, thingEventId1, commandId1, null]),
/error: null value in column "entitykey" of relation "events" violates not-null constraint/,
'cannot insert null entity key');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, null, data, thingEventId1, commandId1, null]),
/error: null value in column "event" of relation "events" violates not-null constraint/,
'cannot insert null event');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, null, thingEventId1, commandId1, null]),
/error: null value in column "data" of relation "events" violates not-null constraint/,
'cannot insert null event data');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, null, commandId1, null]),
/error: null value in column "eventid" of relation "events" violates not-null constraint/,
'cannot insert null event id');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, null, null]),
/error: null value in column "commandid" of relation "events" violates not-null constraint/,
'cannot insert null command');
assert.end();
});
t.test('UUIDs format for IDs', async assert => {
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, 'not-a-uuid', commandId1, null]),
/error: invalid input syntax for type uuid: "not-a-uuid"/,
'eventId must be a UUID');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, 'not-a-uuid', null]),
/error: invalid input syntax for type uuid: "not-a-uuid"/,
'commandId must be a UUID');
assert.end();
});
t.test('Cannot insert event from wrong entity', async assert => {
await assert.rejects(
() => db.query(stmt, [tableTennisEntity, thingKey, thingCreatedEvent, data, thingEventId1, commandId1, null]),
/error: insert or update on table "events" violates foreign key constraint "events_entity_event_fkey"/,
'cannot insert event in wrong entity');
assert.end();
});
t.test('insert events for an entity', async assert => {
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, thingEventId1, commandId1, null]));
await assert.doesNotReject(() => db.query(stmt, [thingEntity, thingKey, thingDeletedEvent, data, thingEventId2, commandId2, thingEventId1]));
await assert.doesNotReject(() => db.query(stmt, [tableTennisEntity, homeTableKey, pingEvent, data, pingEventHomeId, uuid.v4(), null]));
await assert.doesNotReject(() => db.query(stmt, [tableTennisEntity, workTableKey, pingEvent, data, pingEventWorkId, uuid.v4(), null]));
assert.end();
});
t.test('previousId rules', async assert => {
await assert.rejects(
() => db.query(stmt, [tableTennisEntity, homeTableKey, pingEvent, data, pingEventHomeId, uuid.v4(), null]),
/error: previousid can only be null for first entity event/,
'cannot insert multiple null previousid for an entity');
await assert.rejects(
() => db.query(stmt, [tableTennisEntity, workTableKey, pongEvent, data, uuid.v4(), uuid.v4(), pingEventHomeId]),
/error: previousid must be in the same entity/,
'previousid must be in same entity');
assert.end();
});
t.test('Cannot insert duplicates', async assert => {
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingCreatedEvent, data, thingEventId2, commandId2, thingEventId1]),
/error: duplicate key value violates unique constraint "events_eventid_key"/,
'cannot insert complete duplicate event');
await assert.rejects(
() => db.query(stmt, [tableTennisEntity, homeTableKey, pongEvent, data, pingEventHomeId, uuid.v4(), pingEventHomeId]),
/error: duplicate key value violates unique constraint "events_eventid_key"/,
'cannot insert different event for same id');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingDeletedEvent, data, uuid.v4(), commandId1, thingEventId2]),
/error: duplicate key value violates unique constraint "events_commandid_key"/,
'cannot insert different event for same command');
await assert.rejects(
() => db.query(stmt, [thingEntity, thingKey, thingDeletedEvent, data, uuid.v4(), uuid.v4(), thingEventId1]),
/error: duplicate key value violates unique constraint "events_previousid_key"/,
'cannot insert different event for same previous');
assert.end();
});
});
setup.test('cannot delete or update', t => {
t.test('cannot delete or update entity_events', async assert => {
await assert.doesNotReject(
async () => await db.query('DELETE FROM entity_events WHERE entity = $1', [tableTennisEntity]),
'ignores delete entity_events');
const deleteResult = await db.query('SELECT COUNT(*) FROM entity_events WHERE entity = $1', [tableTennisEntity])
assert.equal(deleteResult.rows[0].count, '2')
await assert.doesNotReject(
() => db.query('UPDATE entity_events SET event = $1 WHERE entity = $2', ['fail', tableTennisEntity]),
'ignores update entity_events');
const updateResult = await db.query('SELECT event FROM entity_events WHERE entity = $1', [tableTennisEntity])
assert.equal(updateResult.rows.length, 2)
assert.ok(updateResult.rows.some(r => r.event === pingEvent))
assert.ok(updateResult.rows.some(r => r.event === pongEvent))
assert.end();
});
t.test('cannot delete or update events', async assert => {
await assert.doesNotReject(
() => db.query(`DELETE FROM events WHERE entity = '${thingEntity}'`),
/Cannot delete events/,
'cannot delete events'
);
await assert.doesNotReject(
() => db.query(`UPDATE events SET entityKey = 'fail' WHERE entity = '${thingEntity}'`),
/Cannot update events/,
'cannot update events'
);
assert.end();
});
});
test.onFinish(async () => await shutdownDb(db));
});
| {
"repo_name": "mattbishop/sql-event-store",
"stars": "49",
"repo_language": "JavaScript",
"file_name": "README.md",
"mime_type": "text/plain"
} |
# SQL Event Store
Demonstration of a SQL event store with deduplication and guaranteed event ordering. The database rules are intended to prevent incorrect information from entering into an event stream. You are assumed to have familiarity with [event sourcing](https://martinfowler.com/eaaDev/EventSourcing.html).
This project uses a node test suite and SQLite to ensure the DDL complies with the design requirements. This SQLite event store can be used in highly-constrained environments that require an embedded event store, like a mobile device or an IoT system.
This event store can also be ported to most SQL RDBMS and accessed from any number of writers, including high-load serverless functions, without a coordinating “single writer” process. The project includes a Postgres version of the DDL.
# Postgres Event Store
The [Postgres version](./postgres-event-store.ddl) of SQL event store has the same behavior as the SQLite version. It was built and tested on Postgres 13 but can be used in other versions.
The postgres version can be tested with the [test-postgres.js]() script. Run this file instead of `test-sqlite.js`. It will connect to the postgres server defined in the environment variables, according to [node-postgres](https://node-postgres.com/features/connecting).
### Running
One must have Node and NPM installed (Node 16 is what I used) and then:
```bash
> npm install
```
Once it has finished installing the dependencies, run the [tests](test-sqlite.js) with:
```bash
> node test-sqlite.js
```
The test uses [sql.js](https://github.com/kripken/sql.js), the pure Javascript port of SQLite for reliable compilation and test execution. The test will dump the test database to `test-event-store.sqlite` for your examination.
### Conceptual Model
An Event is an unalterable statement of fact that has occurred in the past. It has a name, like `food-eaten`, and it is scoped to an [Entity](https://en.wikiquote.org/wiki/Entity), or an identifiable existence in the world. Entities are individually identified by business-relevant keys that uniquely identify one entity from another.
In this event store, an event cannot exist without an entity to apply it to. Events can create new entities, and in that first event, the entity key is presented as the identifying key for newly-created entity.
Events follow other events in a sequence. In this event store, each event has a reference to the previous event, much like a backward-linked list. This expression of previous event ID enables SQL Event Store to guarantee that events are written sequentially, without losing any concurrent appends of other events in for the same entity.
Appends to other entities do not affect each other, so many events can be appended to many events concurrently without suffering serialization penalties that “single writer” systems can cause.
### Design
- **Append-Only** Once events are created, they cannot be deleted, updated or otherwise modified. This includes entity event definitions.
- **Insertion-Ordered** Events must be consistently replayable in the order they were inserted.
- **Event race conditions are Impossible** The event store prevents a client from writing an event to an entity if another event has been inserted after the client has replayed an event stream.
- **Entity and Event Validation** Event and Entity names cannot be misspelled or misapplied. A client cannot insert an event from the wrong entity. Event and entity names must be defined before use.
### SQL Table Structure
This event store consists of two tables [as described in the DDL](./sqlite-event-store.ddl). The first, `entity_events`, contains the event definitions for an entity type. It must be populated before events can be appended to the main table called `events`.
#### `entity_events` Table
| Column | Notes |
|----------|-----------------------|
| `entity` | The entity name. |
| `event` | An entity event name. |
The `entity_events` table controls the entity and event names that can be used in the `events` table itself through the use of composite foreign keys.
#### `events` Table
| Column | Notes |
|--------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `entity` | The entity name. Part of a composite foreign key to `entity_events`. |
| `entityKey` | The business identifier for the entity. |
| `event` | The event name. Part of a composite foreign key to `entity_events`. |
| `data` | The event data. Cannot be `null` but can be an empty string. |
| `eventId` | The event ID. This value is used by the next event as it's `previousId` value to guard against a Lost Event problem. |
| `commandId` | The command ID causing this event. Database rules ensure a Command ID can only be used once. |
| `previousId` | The event ID of the immediately-previous event for this entity. If this is the first event for an entity, then omit or send `NULL`. |
| `ts` | The timestamp of the event insertion. **AUTOPOPULATES—DO NOT INSERT.** |
| `sequence` | Auto-incrementing sequence number. Used to sort the events for replaying in the insertion order. **AUTOPOPULATES—DO NOT INSERT.** |
The `events` table is designed to allow multiple concurrent, uncoordinated writers to safely create events. It expects the client to know the difference between an entity's first event and subsequent events.
Multiple constraints are applied to this table to ensure bad events do not make their way into the system. This includes duplicated events and commands, incorrect naming and ensured sequential events.
### Client Use Cases
Event store clients can use basic SQL statements to add and replay events. These use cases start with the first—[Insert Entity Event Definitions](#insert-entity-event-definitions)—to set up the database for individual event instances. Thereafter, clients follow the typical event sourcing pattern:
1. Receive a command
2. [Replay events](#replay-events) to compute current state
3. Validate entity state for command
4. [Append](#append-events) a new event
#### Insert Entity Event Definitions
The `entity_events` table is a definition table that contains all the available events for a given entity type. A system will need to populate this table with the entity events expected before attempting to append events.
```sql
INSERT INTO entity_events (entity,
event)
VALUES (?, ?);
```
Use this statement for every event in an entity and for every entity type in the system.
#### Replay Events
Clients must always fetch, or replay, the events for an entity before inserting a new event. Replaying events assures the client that the state of the entity is known so that business rules can be applied for the command before an event is appended. For instance, if a command creates a new entity, the replay step will ensure no events have been appended to the entity's key.
```sql
SELECT event,
data,
eventId
FROM events
WHERE entityKey = ?
AND entity = ?
ORDER BY sequence;
```
If a command produces a subsequent event for an existing entity, the `eventId` of the last event must be used as the `previousId` of the next event.
#### Append Events
Two types of events can be appended into the event log. The first event for an entity and subsequent events. The distinction is important for the database rules to control for incorrect events, like incorrect entity key or invalid previous event id.
##### First Event for an Entity
In this case, the `previousId` does not exist, so it is omitted from the insert statement.
```sql
INSERT INTO events(entity,
entityKey,
event,
data,
eventId,
commandId)
VALUES (?, ?, ?, ?, ?, ?);
```
##### Subsequent Events
The `previousId` is the `eventId` of the last event recorded for the entity.
```sql
INSERT INTO events(entity,
entityKey,
event,
data,
eventId,
commandId,
previousId)
VALUES (?, ?, ?, ?, ?, ?, ?);
```
| {
"repo_name": "mattbishop/sql-event-store",
"stars": "49",
"repo_language": "JavaScript",
"file_name": "README.md",
"mime_type": "text/plain"
} |
# check-node-version
{"gitdown": "badge", "name": "npm-version"}
{"gitdown": "badge", "name": "appveyor"}
{"gitdown": "badge", "name": "travis"}
Check installed versions of `node`, `npm`, `npx`, `yarn`, and `pnpm`.
{"gitdown": "contents"}
## Install
[npm: *check-node-version*](https://www.npmjs.com/package/check-node-version)
```bash
npm install check-node-version
```
## Command Line Usage
```
{"gitdown": "include", "file": "./usage.txt"}
```
### Examples
#### Check for node 6, failing
Check for node 6, but have 8.2.1 installed.
```bash
$ check-node-version --node 6
node: 8.2.1
Error: Wanted node version 6 (>=6.0.0 <7.0.0)
To install node, run `nvm install 6` or see https://nodejs.org/
$ echo $?
1
```
#### Check for node 6, passing
If all versions match, there is no output:
```bash
$ check-node-version --node 6
$ echo $?
0
```
#### Check for multiple versions simultaneously
You can check versions of any combinations of `node`, `npm`, `npx`, `yarn`, and `pnpm`
at one time.
```bash
$ check-node-version --node 4 --npm 2.14 --npx 6 --yarn 0.17.1 --pnpm 6.20.1
```
#### Check for volta pinned versions
You can check versions pinned by [Volta](https://volta.sh/):
```bash
$ check-node-version --volta
```
#### Print installed versions
Use the `--print` option to print currently installed versions.
If given a tool to check, only that will be printed.
Otherwise, all known tools will be printed.
Notes a missing tool.
```bash
$ check-node-version --print --node 11.12
node: 11.12.0
$ echo $?
0
```
```powershell
$ check-node-version --print
yarn: not found
node: 11.12.0
npm: 6.9.0
npx: 10.2.0
$ $LASTEXITCODE
0
```
> **NOTE:**
> Both preceding examples show that this works equally cross-platform,
> the first one being a *nix shell, the second one running on Windows.
> **NOTE:**
> As per [Issue 36](https://github.com/parshap/check-node-version/issues/36),
> non-semver-compliant versions (looking at yarn here) will be handled similarly to missing tools,
> just with a different error message.
>
> At the time of writing, we think that
> 1. all tools should always use semver
> 2. exceptions are bound too be very rare
> 3. preventing a crash is sufficient
>
> Consequently, we do not intend to support non-compliant versions to any further extent.
#### Use with a `.nvmrc` file
```bash
$ check-node-version --node $(cat .nvmrc) --npm 2.14
```
#### Use with `npm test`
```json
{
"name": "my-package",
"devDependencies": {
"check-node-version": "^1.0.0"
},
"scripts": {
"test": "check-node-version --node '>= 4.2.3' && node my-tests.js"
}
}
```
## API Usage
This module can also be used programmatically.
Pass it an object with the required versions of `node`, `npm`, `npx`, `yarn` and/or `pnpm` followed by a results handler.
```javascript
const check = require("check-node-version");
check(
{ node: ">= 18.3", },
(error, result) => {
if (error) {
console.error(error);
return;
}
if (result.isSatisfied) {
console.log("All is well.");
return;
}
console.error("Some package version(s) failed!");
for (const packageName of Object.keys(result.versions)) {
if (!result.versions[packageName].isSatisfied) {
console.error(`Missing ${packageName}.`);
}
}
}
);
```
See `index.d.ts` for the full input and output type definitions.
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
## Releases
### 4.0.3
* Fix crash due to non-semver valid version strings
### 4.0.2
* Make notfound-catch locale-independent on Windows
### 4.0.1
* Fix CLI by restoring shebang to new bin file
### 4.0.0
* **Breaking:** Drop support for node versions before 8.3.0
* **Breaking:** Remove `options.getVersion` option from api (no
cli change)
* Improve test suite
* Make CLI treat versions arguments as strings
* Fix message for missing binary of Windows
* Check global versions only
* Make instructions valid for version ranges
* Only suggest using nvm if nvm is installed
### 3.3.0
* Add NPX support
### 3.2.0
* Add `index.ts` TypeScript typings file
### 3.1.1
* Fix bug with npm warnings causing errors.
### 3.1.0
* Add colors to terminal output.
### 3.0.0
This release changes the default output behavior to only print
*unsatisfied* versions. If all checked versions pass, there is no
output. A `--print` option has been added to get the old behavior of
always printing versions.
* **Breaking**: Remove `--quiet` option, add `--print` option.
* **Breaking**: Move versions under versions key in result object.
* Fix bug when version command outputs more than one line.
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
SYNOPSIS
check-node-version [OPTIONS]
DESCRIPTION
check-node-version will check if the current node, npm, npx, yarn and pnpm
versions match the given semver version ranges.
If the given version is not satisfied, information about
installing the needed version is printed and the program exits
with an error code.
OPTIONS
--node VERSION
Check that the current node version matches the given semver
version range.
--npm VERSION
Check that the current npm version matches the given semver
version range.
--npx VERSION
Check that the current npx version matches the given semver
version range.
--yarn VERSION
Check that the current yarn version matches the given semver
version range.
--pnpm VERSION
Check that the current pnpm version matches the given semver
version range.
--package
Use the "engines" key in the current package.json for the
semver version ranges.
--volta
Use the versions pinned by Volta in the package.json
-p, --print
Print installed versions.
-h, --help
Print this message.
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
environment:
matrix:
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "11"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- npm test
build: off
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
"use strict";
const { exec } = require("child_process");
const path = require("path");
const filterObject = require("object-filter");
const mapValues = require("map-values");
const parallel = require("run-parallel");
const semver = require("semver");
const tools = require("./tools");
const runningOnWindows = (process.platform === "win32");
const originalPath = process.env.PATH;
const pathSeparator = runningOnWindows ? ";" : ":";
const localBinPath = path.resolve("node_modules/.bin")
// ignore locally installed packages
const globalPath = originalPath
.split(pathSeparator)
.filter(p => path.resolve(p)!==localBinPath)
.join(pathSeparator)
;
module.exports = function check(wanted, callback) {
// Normalize arguments
if (typeof wanted === "function") {
callback = wanted;
wanted = null;
}
const options = { callback };
options.wanted = normalizeWanted(wanted);
options.commands = mapValues(
(
Object.keys(options.wanted).length
? filterObject(tools, (_, key) => options.wanted[key])
: tools
),
({ getVersion }) => ( runVersionCommand.bind(null, getVersion) )
);
if (runningOnWindows) {
runForWindows(options);
} else {
run(options);
}
}
function runForWindows(options) {
// See and understand https://github.com/parshap/check-node-version/issues/35
// before trying to optimize this function
//
// `chcp` is used instead of `where` on account of its more extensive availablity
// chcp: MS-DOS 6.22+, Windows 95+; where: Windows 7+
//
// Plus, in order to be absolutely certain, the error message of `where` would still need evaluation.
exec("chcp", (error, stdout) => {
const finalCallback = options.callback;
if (error) {
finalCallback(chcpError(error, 1));
return;
}
const codepage = stdout.match(/\d+/)[0];
if (codepage === "65001" || codepage === "437") {
// need not switch codepage
return run(options);
}
// reset codepage before exiting
options.callback = (...args) => exec(`chcp ${codepage}`, (error) => {
if (error) {
finalCallback(chcpError(error, 3));
return;
}
finalCallback(...args);
});
// switch to Unicode
exec("chcp 65001", (error) => {
if (error) {
finalCallback(chcpError(error, 2));
return;
}
run(options);
});
function chcpError(error, step) {
switch (step) {
case 1:
error.message = `[CHCP] error while getting current codepage:\n${error.message}`;
break;
case 2:
error.message = `[CHCP] error while switching to Unicode codepage:\n${error.message}`;
break;
case 3:
error.message = `
[CHCP] error while resetting current codepage:
${error.message}
Please note that your terminal is now using the Unicode codepage.
Therefore, codepage-dependent actions may work in an unusual manner.
You can run \`chcp ${codepage}\` yourself in order to reset your codepage,
or just close this terminal and work in another.
`.trim().replace(/^ +/gm,'') // strip indentation
break;
// no default
}
return error
}
});
}
function run({ commands, callback, wanted }) {
parallel(commands, (err, versionsResult) => {
if (err) {
callback(err);
return;
}
const versions = mapValues(versionsResult, ({ version, notfound, invalid }, name) => {
const programInfo = {
isSatisfied: true,
};
if (version) {
programInfo.version = semver(version);
}
if (invalid) {
programInfo.invalid = invalid;
}
if (notfound) {
programInfo.notfound = notfound;
}
if (wanted[name]) {
programInfo.wanted = new semver.Range(wanted[name]);
programInfo.isSatisfied = Boolean(
programInfo.version
&&
semver.satisfies(programInfo.version, programInfo.wanted)
);
}
return programInfo;
});
callback(null, {
versions: versions,
isSatisfied: Object.keys(wanted).every(name => versions[name].isSatisfied),
});
});
};
// Return object containing only keys that a program exists for and
// something valid was given.
function normalizeWanted(wanted) {
if (!wanted) {
return {};
}
// Validate keys
wanted = filterObject(wanted, Boolean);
// Normalize to strings
wanted = mapValues(wanted, String);
// Filter existing programs
wanted = filterObject(wanted, (_, key) => tools[key]);
return wanted;
}
function runVersionCommand(command, callback) {
process.env.PATH = globalPath;
exec(command, (execError, stdout, stderr) => {
const commandDescription = JSON.stringify(command);
if (!execError) {
const version = stdout.trim();
if (semver.valid(version)) {
return callback(null, {
version,
});
} else {
return callback(null, {
invalid: true,
})
}
}
if (toolNotFound(execError)) {
return callback(null, {
notfound: true,
});
}
// something went very wrong during execution
let errorMessage = `Command failed: ${commandDescription}`
if (stderr) {
errorMessage += `\n\nstderr:\n${stderr.toString().trim()}\n`;
}
errorMessage += `\n\noriginal error message:\n${execError.message}\n`;
return callback(new Error(errorMessage));
});
process.env.PATH = originalPath;
}
function toolNotFound(execError) {
if (runningOnWindows) {
return execError.message.includes("is not recognized");
}
return execError.code === 127;
}
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
#!/usr/bin/env node
require("./gatekeeper");
require("./cli");
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
const { execSync } = require("child_process");
module.exports = {
node: {
getVersion: "node --version",
getInstallInstructions(v) {
if (hasNvm()) {
return `To install node, run \`nvm install ${v}\``;
}
return `To install node, see https://nodejs.org/download/release/v${v}/`;
}
},
npm: {
getVersion: "npm --version",
getInstallInstructions(v) {
return `To install npm, run \`npm install -g npm@${v}\``;
}
},
npx: {
getVersion: "npx --version",
getInstallInstructions(v) {
return `To install npx, run \`npm install -g npx@${v}\``;
}
},
yarn: {
getVersion: "yarn --version",
getInstallInstructions(v) {
return `To install yarn, see https://github.com/yarnpkg/yarn/releases/tag/v${v}`;
}
},
pnpm: {
getVersion: "pnpm --version",
getInstallInstructions(v) {
return `To install pnpm, run \`npm install -g pnpm@${v}\``;
}
},
};
function hasNvm() {
try {
// check for existance of nvm
execSync(
'nvm',
{ stdio:[] } // don't care about output
);
} catch (e) {
// no nvm,
return false;
}
return true;
}
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
var semver = require('semver');
var current = process.version;
var supported = require('./package.json').engines.node;
if (!semver.satisfies(current, supported)) {
console.error(
'\n' +
'You are using node version ' + semver.valid(current) + '.\n\n' +
'check-node-version supports node verion ' + semver.valid(semver.minVersion(supported)) + ' and newer.\n\n' +
'Please do one of the following:\n' +
' 1. update your version of node\n' +
' 2. downgrade to version 3.3.0 of check-node-version\n\n' +
'We are sorry for the inconvenience.' +
'\n'
);
process.exit(1);
}
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
"use strict";
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
const minimist = require("minimist");
const semver = require('semver');
const check = require(".");
const tools = require("./tools");
const argv = minimist(process.argv.slice(2), {
alias: {
"print": "p",
"help": "h",
},
boolean: [
"print",
"help",
"volta",
"package",
],
string: [
"node",
"npm",
"npx",
"yarn",
"pnpm",
],
unknown: function (arg) {
console.error(`Unknown option: ${arg}`);
process.exit(1);
}
});
if (argv.help) {
const usage = fs.readFileSync(path.join(__dirname, "usage.txt"), {
encoding: "utf8",
});
process.stdout.write(usage);
process.exit(0);
}
let options;
if (argv.package) {
options = optionsFromPackage();
} else if (argv.volta) {
options = optionsFromVolta();
} else {
options = optionsFromCommandLine();
}
check(options, (err, result) => {
if (err) {
throw err;
}
printVersions(result, argv.print);
process.exit(result.isSatisfied ? 0 : 1);
});
//
function optionsFromCommandLine() {
return Object.keys(tools).reduce((memo, name) => ({
...memo,
[name]: argv[name],
}), {});
}
function optionsFromPackage() {
let packageJson;
try {
packageJson = require(path.join(process.cwd(), 'package.json'));
} catch (e) {
console.log('Error: When running with --package, a package.json file is expected in the current working directory');
console.log('Current working directory is: ' + process.cwd());
process.exit(1);
}
if (!packageJson.engines) {
console.log('Error: When running with --package, your package.json is expected to contain the "engines" key');
console.log('See https://docs.npmjs.com/files/package.json#engines for the supported syntax');
process.exit(1);
}
return Object.keys(tools).reduce((memo, name) => ({
...memo,
[name]: packageJson.engines[name],
}), {});
}
function optionsFromVolta() {
let packageJson;
try {
packageJson = require(path.join(process.cwd(), 'package.json'));
} catch (e) {
console.log('Error: When running with --volta, a package.json file is expected in the current working directory');
console.log('Current working directory is: ' + process.cwd());
process.exit(1);
}
if (!packageJson.volta) {
console.log('Error: When running with --volta, your package.json is expected to contain the "volta" key');
console.log('See https://docs.volta.sh/guide/understanding#pinning-node-engines');
process.exit(1);
}
console.log(packageJson.volta);
return Object.keys(tools).reduce((memo, name) => ({
...memo,
[name]: packageJson.volta[name],
}), {});
}
//
function printVersions(result, print) {
Object.keys(result.versions).forEach(name => {
const info = result.versions[name];
const isSatisfied = info.isSatisfied;
// print installed version
if (print || !isSatisfied) {
printInstalledVersion(name, info);
}
if (isSatisfied) return;
// report any non-compliant versions
const { raw, range } = info.wanted;
console.error(chalk.red(`Wanted ${name} version ` + chalk.bold(`${raw} (${range})`)));
console.log(chalk.yellow.bold(
tools[name]
.getInstallInstructions(
semver.minVersion(info.wanted)
)
));
});
}
function printInstalledVersion(name, { version, isSatisfied, invalid, notfound }) {
let versionNote = "";
if (version) {
versionNote = name + ": " + chalk.bold(version);
}
if (invalid) {
versionNote = name + ": " + chalk.bold("given version not semver-compliant");
}
if (notfound) {
versionNote = name + ": not found";
}
if (isSatisfied) {
if (version) console.log(versionNote);
else console.log(chalk.gray(versionNote));
} else {
console.log(chalk.red(versionNote));
}
}
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
/**
* Which versions of which packages are required.
*/
interface WantedVersions {
/**
* Required version of Node.js.
*/
node?: string;
/**
* Required version of npm.
*/
npm?: string;
/**
* Required version of yarn.
*/
yarn?: string;
/**
* Required version of pnpm.
*/
pnpm?: string;
}
type OnGetVersion = (error: Error | null, info: VersionInfo) => void;
/**
* Gets the version of a package.
*
* @param packageName Name of the package.
* @param onComplete Handler for the package name.
*/
type GetVersion = (packageName: string, onComplete: OnGetVersion) => void;
/**
* Requested version range of a package.
*/
interface Wanted {
/**
* Resolved semver equivalent of the raw version.
*/
range: string;
/**
* Raw semver requirement for the version.
*/
raw: string;
}
/**
* Positive result of checking a program version.
*/
interface SatisfiedVersionInfo {
/**
* Whether the version was known to satisfy its requirements (true).
*/
isSatisfied: true;
/**
* Retrieved version.
*/
version: string;
/**
* Requested version range of the package, if any.
*/
wanted?: Wanted;
}
/**
* Negative result of checking a program version.
*/
interface UnsatisfiedVersionInfo {
/**
* Whether the version was known to satisfy its requirements (false).
*/
isSatisfied: false;
/**
* Whether the program version was unable to be found.
*/
notfound?: boolean;
/**
* Whether the program version string is non-compliant with semver.
*/
invalid?: boolean;
/**
* Retrieved version, if available.
*/
version?: string;
/**
* Requested version range of the package, if any.
*/
wanted?: Wanted;
}
/**
* Result of checking a program version.
*/
type VersionInfo = SatisfiedVersionInfo | UnsatisfiedVersionInfo;
/**
* Versions for each package, keyed by package name.
*/
interface VersionInfos {
[i: string]: VersionInfo;
}
/**
* Results from checking versions.
*/
interface Results {
/**
* Versions for each package, keyed by package name.
*/
versions: VersionInfos;
/**
* Whether all versions were satisfied.
*/
isSatisfied: boolean;
}
/**
* Handles results from checking versions.
*
* @param error Error from version checking, if any.
* @param results Results from checking versions.
*/
type OnComplete = (error: Error | null, results: Results) => void;
/**
* Checks package versions.
*
* @param [wanted] Which versions of programs are required.
* @param onComplete Handles results from checking versions.
*/
declare function check(onComplete: OnComplete): void;
declare function check(wanted: WantedVersions, onComplete: OnComplete): void;
export = check;
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
<a name="check-node-version"></a>
# check-node-version
[](https://www.npmjs.org/package/check-node-version)
[](https://ci.appveyor.com/project/parshap/check-node-version/branch/master)
[](https://travis-ci.org/parshap/check-node-version)
Check installed versions of `node`, `npm`, `npx`, `yarn`, and `pnpm`.
* [check-node-version](#check-node-version)
* [Install](#check-node-version-install)
* [Command Line Usage](#check-node-version-command-line-usage)
* [Examples](#check-node-version-command-line-usage-examples)
* [API Usage](#check-node-version-api-usage)
<a name="check-node-version-install"></a>
## Install
[npm: *check-node-version*](https://www.npmjs.com/package/check-node-version)
```bash
npm install check-node-version
```
<a name="check-node-version-command-line-usage"></a>
## Command Line Usage
```
SYNOPSIS
check-node-version [OPTIONS]
DESCRIPTION
check-node-version will check if the current node, npm, npx, yarn and pnpm
versions match the given semver version ranges.
If the given version is not satisfied, information about
installing the needed version is printed and the program exits
with an error code.
OPTIONS
--node VERSION
Check that the current node version matches the given semver
version range.
--npm VERSION
Check that the current npm version matches the given semver
version range.
--npx VERSION
Check that the current npx version matches the given semver
version range.
--yarn VERSION
Check that the current yarn version matches the given semver
version range.
--pnpm VERSION
Check that the current pnpm version matches the given semver
version range.
--package
Use the "engines" key in the current package.json for the
semver version ranges.
--volta
Use the versions pinned by Volta in the package.json
-p, --print
Print installed versions.
-h, --help
Print this message.
```
<a name="check-node-version-command-line-usage-examples"></a>
### Examples
<a name="check-node-version-command-line-usage-examples-check-for-node-6-failing"></a>
#### Check for node 6, failing
Check for node 6, but have 8.2.1 installed.
```bash
$ check-node-version --node 6
node: 8.2.1
Error: Wanted node version 6 (>=6.0.0 <7.0.0)
To install node, run `nvm install 6` or see https://nodejs.org/
$ echo $?
1
```
<a name="check-node-version-command-line-usage-examples-check-for-node-6-passing"></a>
#### Check for node 6, passing
If all versions match, there is no output:
```bash
$ check-node-version --node 6
$ echo $?
0
```
<a name="check-node-version-command-line-usage-examples-check-for-multiple-versions-simultaneously"></a>
#### Check for multiple versions simultaneously
You can check versions of any combinations of `node`, `npm`, `npx`, `yarn`, and `pnpm`
at one time.
```bash
$ check-node-version --node 4 --npm 2.14 --npx 6 --yarn 0.17.1 --pnpm 6.20.1
```
<a name="check-node-version-command-line-usage-examples-check-for-volta-pinned-versions"></a>
#### Check for volta pinned versions
You can check versions pinned by [Volta](https://volta.sh/):
```bash
$ check-node-version --volta
```
<a name="check-node-version-command-line-usage-examples-print-installed-versions"></a>
#### Print installed versions
Use the `--print` option to print currently installed versions.
If given a tool to check, only that will be printed.
Otherwise, all known tools will be printed.
Notes a missing tool.
```bash
$ check-node-version --print --node 11.12
node: 11.12.0
$ echo $?
0
```
```powershell
$ check-node-version --print
yarn: not found
node: 11.12.0
npm: 6.9.0
npx: 10.2.0
$ $LASTEXITCODE
0
```
> **NOTE:**
> Both preceding examples show that this works equally cross-platform,
> the first one being a *nix shell, the second one running on Windows.
> **NOTE:**
> As per [Issue 36](https://github.com/parshap/check-node-version/issues/36),
> non-semver-compliant versions (looking at yarn here) will be handled similarly to missing tools,
> just with a different error message.
>
> At the time of writing, we think that
> 1. all tools should always use semver
> 2. exceptions are bound too be very rare
> 3. preventing a crash is sufficient
>
> Consequently, we do not intend to support non-compliant versions to any further extent.
<a name="check-node-version-command-line-usage-examples-use-with-a-nvmrc-file"></a>
#### Use with a <code>.nvmrc</code> file
```bash
$ check-node-version --node $(cat .nvmrc) --npm 2.14
```
<a name="check-node-version-command-line-usage-examples-use-with-npm-test"></a>
#### Use with <code>npm test</code>
```json
{
"name": "my-package",
"devDependencies": {
"check-node-version": "^1.0.0"
},
"scripts": {
"test": "check-node-version --node '>= 4.2.3' && node my-tests.js"
}
}
```
<a name="check-node-version-api-usage"></a>
## API Usage
This module can also be used programmatically.
Pass it an object with the required versions of `node`, `npm`, `npx`, `yarn` and/or `pnpm` followed by a results handler.
```javascript
const check = require("check-node-version");
check(
{ node: ">= 18.3", },
(error, result) => {
if (error) {
console.error(error);
return;
}
if (result.isSatisfied) {
console.log("All is well.");
return;
}
console.error("Some package version(s) failed!");
for (const packageName of Object.keys(result.versions)) {
if (!result.versions[packageName].isSatisfied) {
console.error(`Missing ${packageName}.`);
}
}
}
);
```
See `index.d.ts` for the full input and output type definitions.
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
const {
nodeCurrent, nodeLTS, nodeOld,
npmCurrent, npmLTS, npmLatest, npmOld,
npxCurrent, npxLTS, npxLatest, npxOld,
yarnCurrent, yarnInvalid,
pnpmCurrent,
} = require("./_versions");
exports.current = {
node: nodeCurrent,
npm: npmCurrent,
npx: npxCurrent,
};
exports.latest = {
node: nodeCurrent,
npm: npmLatest,
npx: npxLatest,
};
exports.lts = {
node: nodeLTS,
npm: npmLTS,
npx: npxLTS,
};
exports.old = {
node: nodeOld,
npm: npmOld,
npx: npxOld,
};
exports.npx = {
...exports.old,
npx: npmLatest,
};
exports.yarn = {
...exports.current,
yarn: yarnCurrent,
};
exports.pnpm = {
...exports.current,
pnpm: pnpmCurrent,
};
exports.invalid = {
...exports.current,
yarn: yarnInvalid,
};
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
module.exports = {
nodeCurrent: "11.12.0",
nodeLTS: "10.15.3",
nodeOld: "8.3.0",
npmLatest: "6.9.0",
npmCurrent: "6.7.0",
npmLTS: "6.4.1",
npmOld: "5.3.0",
npxLatest: "10.2.0",
npxCurrent: "6.7.0",
npxLTS: "6.4.1",
npxOld: "9.2.0", // crazy, I know ¯\_(ツ)_/¯
yarnCurrent: "1.15.2",
yarnInvalid: "0.32+git",
pnpmCurrent: "6.20.1",
};
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
"use strict";
const test = require("ava").cb;
const check = require("..");
const {
nodeCurrent, nodeLTS, nodeOld,
npmCurrent, npmLTS, npmLatest, npmOld,
npxCurrent, npxLTS, npxLatest, npxOld,
yarnCurrent, yarnInvalid,
pnpmCurrent,
} = require("./_versions");
const {
current, latest, lts,
old, npx, yarn, pnpm, invalid,
} = require("./_setups");
const {
crossTest,
after,
from,
} = require("./_helpers");
test("global versions only", t => {
// check for locally installed npm
check({ npm: "3.10.10" }, (error, result) => {
t.falsy(error);
t.false(result.isSatisfied);
t.truthy(result.versions.npm);
t.end();
});
});
{
const successSteps = [current];
const failureSteps = [old];
Object.entries(yarn).forEach(([k,v]) => {
successSteps.push({[k]:v});
failureSteps.push({[k]:after(v)});
});
crossTest("check exactly requested tools", yarn, successSteps, (t, err, result, {wanted}) => {
t.falsy(err);
t.true(result.isSatisfied);
t.is(
Object.keys(wanted).toString(),
Object.keys(result.versions).toString(),
);
t.true(Object.values(result.versions)[0].isSatisfied);
});
crossTest("check exactly requested tools, failure", yarn, failureSteps, (t, err, result, {wanted}) => {
t.falsy(err);
t.false(result.isSatisfied);
t.is(
Object.keys(wanted).toString(),
Object.keys(result.versions).toString(),
);
t.false(Object.values(result.versions)[0].isSatisfied);
});
}
crossTest("check all tools if none is requested", [current, latest, lts, old, npx, yarn, pnpm], {}, (t, err, result) => {
t.falsy(err);
t.truthy(result.versions.node);
t.truthy(result.versions.npm);
t.truthy(result.versions.npx);
t.truthy(result.versions.yarn);
t.truthy(result.versions.pnpm);
t.true(result.isSatisfied);
});
crossTest("positive node result", current, [
{ node: nodeCurrent },
{ node: from(nodeCurrent) },
{ node: after(nodeLTS) },
{ node: from(nodeLTS) },
{ node: after(nodeOld) },
{ node: from(nodeOld) },
], (t, err, result) => {
t.falsy(err);
t.true(result.isSatisfied);
t.true(result.versions.node.isSatisfied);
t.truthy(result.versions.node);
t.truthy(result.versions.node.version);
t.is(result.versions.node.version.raw, nodeCurrent);
});
crossTest("negative node result", old, [
{ node: after(nodeCurrent) },
{ node: from(nodeCurrent) },
{ node: nodeCurrent },
{ node: after(nodeLTS) },
{ node: from(nodeLTS) },
{ node: nodeLTS },
{ node: after(nodeOld) },
], (t, err, result) => {
t.falsy(err);
t.false(result.versions.node.isSatisfied);
t.false(result.isSatisfied);
t.truthy(result.versions.node);
t.is(result.versions.node.version.raw, nodeOld);
});
crossTest("tool not installed", current, { yarn: yarnCurrent, pnpm: pnpmCurrent }, (t, err, result) => {
t.falsy(err);
t.false(result.isSatisfied);
t.false(result.versions.yarn.isSatisfied);
t.false(result.versions.pnpm.isSatisfied);
t.true(result.versions.yarn.notfound);
t.true(result.versions.pnpm.notfound);
t.is(result.versions.yarn.version, undefined);
t.is(result.versions.yarn.wanted.range, yarnCurrent);
t.is(result.versions.pnpm.version, undefined);
t.is(result.versions.pnpm.wanted.range, pnpmCurrent);
});
crossTest("non-semver version string, required", invalid, { yarn: yarnCurrent }, (t, err, result) => {
t.falsy(err);
t.false(result.isSatisfied);
t.false(result.versions.yarn.isSatisfied);
t.true(result.versions.yarn.invalid);
t.is(result.versions.yarn.version, undefined);
});
crossTest("non-semver version string, not required", invalid, {}, (t, err, result) => {
t.falsy(err);
t.true(result.isSatisfied);
t.true(result.versions.yarn.isSatisfied);
t.true(result.versions.yarn.invalid);
t.is(result.versions.yarn.version, undefined);
});
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
const { exec } = require("child_process");
const { unlink } = require("fs");
const test = require("ava").cb;
const nodeVersion = `node: ${process.version.replace('v', '')}`;
test("run with node", t => {
exec("node ./bin.js --print", (error, stdout) => {
t.falsy(error);
t.truthy(stdout);
t.true(stdout.includes(nodeVersion));
t.end();
});
});
test("run with npx", t => {
exec("npx ./bin.js --print", (error, stdout) => {
t.falsy(error);
t.truthy(stdout);
t.true(stdout.includes(nodeVersion));
t.end();
});
});
test("run npm package", t => {
exec("npm pack", (error, stdout) => {
t.falsy(error);
const packageFile = stdout.trim();
exec(`npx ./${packageFile} --print`, (error, stdout) => {
unlink(packageFile, ()=>{});
t.falsy(error);
t.truthy(stdout);
t.true(stdout.includes(nodeVersion));
t.end();
});
});
});
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
const test = require("ava").cb;
const chalk = require("chalk");
const proxyquire = require("proxyquire");
const realPlatform = process.platform;
const NIX = "linux";
const WIN = "win32";
//
module.exports = {
crossTest,
after,
from,
}
//
function after(version) {
return `>${version}`
}
function from(version) {
return `>=${version}`
}
//
/**
* @callback AssertionsCallback
*
* @param {Object} t - https://github.com/avajs/ava/blob/master/docs/02-execution-context.md
* @param {?Error} error - any error that occurs during version query other than the tool not being installed
* @param {Results} result - data on the wanted and installed versions
*/
/**
* Runs tests across environments, version setups, and version requirements.
*
* @param {string} label - basic test label
* @param {Object|Object[]} versions - the available versions
* @param {Object|Object[]} wanted - the wanted versions
* @param {AssertionsCallback} assertions - the callback containing the assertions
*/
function crossTest(label, installed, wanted, assertions) {
if (Array.isArray(installed)) {
installed.forEach((setup, i) => {
crossTest(label + chalk.green(` inst${i}`), setup, wanted, assertions);
})
return;
}
if (Array.isArray(wanted)) {
wanted.forEach((setup, i) => {
crossTest(label + chalk.yellow(` want${i}`), installed, setup, assertions);
})
return;
}
const callback = (t, err, result) => {
assertions(t, err, result, {installed, wanted});
t.end();
}
test((label + chalk.blue(" *nix")), t => {
mockCheck(NIX, installed)(wanted, callback.bind(null, t));
});
test((label + chalk.blue(" Win")), t => {
mockCheck(WIN, installed)(wanted, callback.bind(null, t));
});
}
const chcpRegex = /^chcp\b/;
function mockCheck(platform, versions) {
Object.defineProperty(process, "platform", { value: platform })
try {
return proxyquire("..", {
"child_process": {
exec(command, callback) {
if (chcpRegex.test(command)) {
callback(null, "Active code page: 65001", "");
return;
}
const tool = command.split("--version")[0].trim();
const version = versions[tool];
let stderr = "";
let execError = null;
if (!version) {
stderr = notFoundMessage(platform, tool);
execError = new NotFoundError(platform, tool);
}
callback(execError, version || "", stderr);
}
},
})
} finally {
Object.defineProperty(process, "platform", { value: realPlatform })
}
}
function NotFoundError(platform, tool) {
switch (platform) {
case NIX: return new NotFoundErrorNix(tool);
case WIN: return new NotFoundErrorWin(tool);
}
}
function notFoundMessage(platform, tool) {
switch (platform) {
case NIX: return tool + ": not found";
case WIN: return tool + ` : The term '${tool}' is not recognized`;
}
}
function NotFoundErrorNix(tool) {
const error = new Error(notFoundMessage(NIX, tool));
error.code = 127;
return error;
}
function NotFoundErrorWin(tool) {
const error = new Error(notFoundMessage(WIN, tool));
error.code = 1;
return error;
}
| {
"repo_name": "parshap/check-node-version",
"stars": "74",
"repo_language": "JavaScript",
"file_name": "_helpers.js",
"mime_type": "text/plain"
} |
## 酒店管理系统
> 项目具体说明:【Wiki】 JavaWeb 作业,即简单的酒店管理系统。
### 基础环境:
- Tomcat9
- Java 1.8+
- Mysql/Mariadb
### 描述:
很简陋的小项目,真的很简陋,毕竟是 17 年学生时代所写。
关于部署:Tomcat 务必为 9.X,JDK 可 12;数据库文件位于 `~/src/sql/` 中,初始登录用户密码为:`root`/`toor`;Tomcat 应用上下文为 `/hb`;项目依赖:`lib` 目录。
### 截图:



<p align='end'>2022.3.23 补充 ੧ᐛ੭ </p> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/webapp/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/src/webapp" relative="/" />
</webroots>
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
<root url="file://$MODULE_DIR$/lib" />
<root url="file://$MODULE_DIR$/src" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/lib" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="Java EE 6-Java EE 6" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="Tomcat 10.0.18" level="application_server_libraries" />
<orderEntry type="library" exported="" name="lib" level="project" />
</component>
<component name="sonarModuleSettings">
<option name="localAnalysisScripName" value="<PROJECT>" />
<option name="serverName" value="<PROJECT>" />
</component>
</module> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
## 酒店管理系统
> 受限于当时的知识储备,所采用的技术都非常的原始,完成度也不是很好,基本就是单纯对表的增删改查。一个成熟的项目不仅仅只是对表的增删改,最重要的是业务上的处理,报表数据的分析等等。当初在学校做这个项目时就陷入了一个怪圈,着重于技术的新颖,框架的特殊等等,背道而驰(也被老师说过很多次)。本质上没必要整那么多花里胡哨的,注重业务上的完成度就很以及很好了,技术上的选择最多是锦上添花。最后,当初真应该使用一个成熟的前端框架来写,Vue 或者 Angular 什么的都行,组件什么的比自己造容易太多了。。。
>
> <p align='end'>———— inkss</p>
### 一、概述
酒店管理系统,类 Maven 项目结构。项目配置项为:
* 服务器:apache-tomcat-9.0.0.M26
* 数据库:Mysql
* 编辑器:IntelliJ IDEA
### 二、介绍
项目具体说明:[【Wiki】](https://github.com/inkss/hotelbook-JavaWeb/wiki) JavaWeb 作业,即简单的酒店管理系统。
后端 Java 部分采用 MVC 形式,前端网页主要借鉴 [layui](http://www.layui.com) 与 [win10-ui](http://win10ui.yuri2.cn) 。
目前完成:登录,楼层,房间类型,预订单,日志的增删改查。网页前端功能反倒是全部划分完成。
整体写的七七八八,用了不少第三方的 jar 包,虽然采用了类似Maven的结构,但是本身只是普通的 JavaWeb 项目。
数据库脚本位于`~/src/sql`目录中,导入 mysql 后,用 IDEA 打开重新配置一下 JDK 与 Tomcat 不出意外是可以直接使用的。
附1:Tomcat 的 Deployment 中 Application context值为 /hb
附2:数据库默认登录账号 root toor
重要:本项目最初是在 Ubuntu 上写的,中间才迁移到 Windows 上,所以数据库上踩了一个坑,Windows 对大小写不敏感,也就是 **Windows 不区分大小写**,数据库建表时表名称含有大写值,对应的就是 DAO 层操控数据库时表名也全是大写,但是在 Windows 下导出的表结构中表名**全是小写**,这里务必注意务必注意务必注意。从某种意义上来说这是数据库设计上遗留的问题。
### 三、补充
如果自我评价这个项目,那就是在需求分析阶段就很失败,表现到具体设计上就是功能上想当然(简直白瞎了学那么久软件工程);而在代码上使用的主要插件 Win10-UI 虽然在界面上很新颖很有特色,但是事实上很不成熟,而且特别依赖这些框架,不好评价 layui 和 bootstrap 谁好谁强,因为都不太会使用,到现在都觉得写前端好可怕加头大。后端上算是应用到 MVC 思想,稍微去做分层(虽然当时只知道应该这样去做而不知为什么)。
项目没有用 Maven 管理,也没有使用 SpringMVC,不过在小学期时因为赖直接在这个基础上进行改造,倒是改成了 SpringMVC + MyBatis (当然需求没动,所以除了后端上的变通其他的改变不是很大,依旧烂)。
相关的链接在这里:https://github.com/inkss/Java-Project/tree/master/hb
<p align='end'>2018.8.20 补充 ੧ᐛ੭ </p>
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
# layui 使用笔记
> 记录本项目中对layui的使用细节,毕竟官网文档辣么长
## 1.模块名称:table
### 1.1 方法级渲染表格
<html>
<body>
<table id="demo"></table>
<script>
...
//初始化表格
var tableIns = table.render({ //tableIns:table.render()方法的实例
elem: '#demo' //指定原始表格元素选择器
, id: 'tableID' //表格容器索引
, height: 315 //容器高度
, cols: [{
//field字段名、title标题名、width列宽、sort排序、fixed固定列、toolbar绑定工具条
}] //设置表头
, page: true //是否开启分页
, where: {
make: 0 //接口的其它自定义参数
}
, done: function(res, curr, count){ //回调
console.log(res.msg); //得到状态信息
console.log(curr); //得到当前页码
console.log(count); //得到数据总量
}
});
//表格重载 方法一
tableIns.reload({
where: {
//其它自定义参数
}
});
//表格重载 方法二
table.reload('tableID', {
where: {
//其它自定义参数
}
});
...
</script>
</body>
</html>
### 1.2 表格接口
private String code; //数据状态字段
private String msg; //状态字段名
private String count; //数据总数
private List data; //数据
## 2.模块名称:util
### 2.1 固定块:回到顶端
util.fixbar({
showHeight: 2,
click: function(type) {
console.log(type);
}
});
## 3.模块名称:layer
## 4.模块名称:form
* js设置radio
$("input[name='addBed'][value='Y']").prop("checked", true); //把 是 给主动选上
form.render('radio'); //重新渲染
* js设置下拉
$("#orderState").val(obj.orderState); //<--需要处理
form.render("select"); //重新渲染select | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet Icon" type=" image/x-icon" href="img/windows.ico">
<link rel="stylesheet" type="text/css" href="css/login/register-login.css">
<script src="./js/global.js"></script>
</head>
<body>
<div id="box"></div>
<!--主栏-->
<div class="cent-box">
<!--标题-->
<div class="cent-box-header">
<h1 class="main-title">HotelBook</h1>
<h2 class="sub-title">酒店管理系统</h2>
</div>
<div class="cont-main clearfix">
<!--登录区域开始-->
<div class="login form">
<!--文本输入框-->
<div class="group">
<!--用户名输入框-->
<div class="group-ipt loginName">
<input type="text" name="loginName" id="loginName" class="ipt" placeholder="输入您的用户名" required>
</div>
<!--密码输入框-->
<div class="group-ipt loginPwd">
<input type="password" name="loginPwd" id="loginPwd" class="ipt" placeholder="输入您的登录密码" required>
</div>
</div>
<!--登录按钮-->
<div class="button" id="btnLogin">
<button type="submit" class="login-btn register-btn button" id="embed-submit">登录</button>
</div>
</div>
<!--登录区域结束-->
<!--尾注-->
<div class="remember clearfix">
<label class="remember-me">
<a href="#">获取帮助</a>
</label>
<label class="forgot-password">
<a href="#">忘记密码?</a>
</label>
</div>
</div>
</div>
<!--脚注-->
<div class="footer">
<p>© 2017
<a href="#">HotelBook System</a>
</p>
</div>
<script type="text/javascript" src="./js/login/particles.js"></script>
<script type="text/javascript" src="./js/login/background.js"></script>
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript" src="./js/layui/layui.js"></script>
<script type="text/javascript" src="./js/Cookie.js"></script>
//引入win10的api
<script type="text/javascript" src="MAIN/js/win10.child.js"></script>
<script>
//模块化调用layui
layui.use(['layer'], function() {
var layer = layui.layer;
$(document).ready(function() {
//alert("网页加载完毕");
//按钮点击事件
$('#btnLogin').click(function() {
//alert("按钮被点击");
loginName = $('#loginName').val();
var loginPwd = $('#loginPwd').val();
var params = "loginName=" + loginName + "&loginPwd=" + loginPwd;
if(loginName === "")
layer.tips("请输入用户名", "#loginName"); //layer.tips(“string","#吸附容器")
else if(loginPwd === "")
layer.tips("请输入密码", "#loginPwd");
else {
//发出ajax请求,调用后端功能
$.post(baseUrl + '/QueryLoginNameServlet', params, function(data) {
if(data === '-1')
layer.msg("用户名不存在", {
anim: 6
});
else if(data === '0')
layer.msg("密码不正确", {
anim: 6
});
else {
layer.msg('登录成功', {
icon: 16,
shade: 0.01
});
//根据写入的session值得到结果
$.post(baseUrl + '/QueryLoginInfoServlet', function(loginInfo) {
//数据返回样例
<%--{"loginId":1,"loginName":"root","loginPwd":"toor","loginNickName":"管理员","loginAdmin":0}--%>
//取值方法
var obj = JSON.parse(loginInfo);
//alert(obj.loginName);
//alert(obj.loginPwd);
//alert(obj.loginNickName);
//alert(obj.loginAdmin);
//设置cookie
setCookie("loginName", loginName);
setCookie("loginNickName", obj.loginNickName);
setCookie("loginAdmin", obj.loginAdmin);
});
setTimeout(function() {
location.href = 'MAIN/main.html';
}, 1000); //等待一段时间后跳入
}
});
}
}); //button
}); //jquery
}); //layui
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h2>啊啊啊啊啊啊啊啊啊</h2>
</body>
</html>
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<!-- saved from url=(0043)http://hi.baidu.com/com/error/?from=oldblog -->
<HTML>
<HEAD>
<TITLE>nav</TITLE>
<link rel="stylesheet Icon" type=" image/x-icon" href="img/windows.ico">
<!--STATUS OK-->
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<style>
.mod-page-body {
height: auto;
_height: 100%;
min-height: 100%;
zoom: 1;
}
.mod-page-body .mod-page-main .x-page-container {
padding: 0;
margin: 0;
zoom: 1
}
.mod-page-body {
color: #454545;
zoom: 1
}
.mod-page-body .mod-page-main {
padding-top: 50px
}
.mod-page-body .mod-page-main {
padding-bottom: 85px
}
.wordwrap {
word-break: break-all;
word-wrap: break-word
}
pre.wordwrap {
white-space: pre-wrap
}
.clearfix:after {
content: '\20';
display: block;
height: 0;
clear: both
}
.clearfix {
zoom: 1
}
.grid-98 {
overflow: hidden;
margin: 0 auto;
padding: 0
}
.grid-98 {
width: 980px
}
.mod-footer {
padding: 30px 0 15px 0;
width: 100%;
height: 40px;
position: relative;
margin-top: -85px;
clear: both;
zoom: 1
}
.mod-footer .hidden-box {
line-height: 0;
height: 0;
overflow: hidden
}
.mod-footer .footer-box {
text-align: center;
font-family: Arial, simsun;
font-size: 12px
}
.mod-footer .footer-box .copy-box {
color: #959595;
line-height: 12px;
height: 12px;
overflow: hidden
}
.mod-footer .footer-box .inner-box {
margin-bottom: 10px;
line-height: 14px;
height: 14px;
overflow: hidden;
color: #3FA7CB
}
.mod-footer .hidden-box {
line-height: 0;
height: 0;
overflow: hidden
}
.mod-page-body
</style>
<STYLE type=text/css>
.mod-notfound {
BORDER-RIGHT: #444444 1px solid;
BORDER-TOP: #444444 1px solid;
MARGIN-TOP: 10px;
BACKGROUND: #F0F0F0;
BORDER-LEFT: #444444 1px solid;
BORDER-BOTTOM: #444444 1px solid;
HEIGHT: 380px;
TEXT-ALIGN: center;
border-radius: 10px
}
</STYLE>
</HEAD>
<META content="MSHTML 6.00.6000.17117" name=GENERATOR>
</HEAD>
<BODY bgcolor="#f0f0f0">
<SECTION class=mod-page-body>
<DIV class="mod-page-main wordwrap clearfix">
<DIV class=x-page-container>
<DIV class="mod-notfound grid-98">
<IMG class=img-notfound height=300 src="./img/nav.jpg" width=786>
<P style="FONT-SIZE: 18px; LINE-HEIGHT: 50px">推開窗 回到夢裡的故鄉</P>
</DIV>
</DIV>
</DIV>
</SECTION>
<FOOTER class="mod-footer mod-cs-footer">
<DIV class="clearfix hidden-box"></DIV>
<DIV class=footer-box>
<DIV class=copy-box>©2017 酒店管理系统</DIV>
</DIV>
</FOOTER>
</BODY>
</HTML> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>注册账户</title>
<link rel="stylesheet" href="./js/layui/css/layui.css" media="all">
<script src="./js/layui/layui.js"></script>
<script src="./js/jquery.js"></script>
<script src="./js/global.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
<legend>注册用户</legend>
</fieldset>
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">账户名</label>
<div class="layui-input-inline">
<input type="text" name="loginName" lay-verify="required|inputName" autocomplete="off"
placeholder="您登录所需的账户" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="password" name="loginPwd" id="pwd1" lay-verify="required|inputPwd" autocomplete="off"
placeholder="您登录所需的密码" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">确认密码</label>
<div class="layui-input-inline">
<input type="password" id="pwd2" lay-verify="required|inputPwd" autocomplete="off"
placeholder="重复你所输入的密码" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">昵称</label>
<div class="layui-input-inline">
<input type="text" name="loginNickName" lay-verify="required|inputName" autocomplete="off"
placeholder="您的个性昵称" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="insertRome">注册</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script>
layui.use(['form', 'layedit', 'laydate'], function () {
var form = layui.form,
layer = layui.layer;
//自定义验证规则
form.verify({
inputName: function (value) {
if (value.length < 4) {
return '账户至少4个字符';
}
if (value.length > 10) {
return '账户至多10个字符'
}
},
inputPwd: function (value) {
if (value.length < 4) {
return '密码至少4个字符';
}
if (value.length > 18) {
return '密码至多18个字符'
}
}
});
//监听提交
form.on('submit(insertRome)', function (data) {
var pwd1 = $("#pwd1").val();
var pwd2 = $("#pwd2").val();
if (pwd1 != pwd2) {
layer.msg("二次密码验证不一致");
} else {
$.post(baseUrl + '/InsertLoginServlet', JSON.stringify(data.field), function (code) {
if (code === 1) {
layer.alert('注册成功!', {
title: '成功',
icon: 6,
anim: 5
});
} else {
layer.alert('注册失败!', {
title: '异常',
icon: 5,
anim: 6
});
}
});
}
return false;
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<!-- saved from url=(0043)http://hi.baidu.com/com/error/?from=oldblog -->
<HTML>
<HEAD>
<TITLE>404错误页面</TITLE>
<!--STATUS OK-->
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet Icon" type=" image/x-icon" href="img/windows.ico">
<style>
.mod-page-body {
height: auto;
_height: 100%;
min-height: 100%;
zoom: 1
}
.mod-page-body .mod-page-main .x-page-container {
padding: 0;
margin: 0;
zoom: 1
}
.mod-page-body {
color: #454545;
zoom: 1
}
.mod-page-body .mod-page-main {
padding-top: 50px
}
.mod-page-body .mod-page-main {
padding-bottom: 85px
}
.wordwrap {
word-break: break-all;
word-wrap: break-word
}
pre.wordwrap {
white-space: pre-wrap
}
.clearfix:after {
content: '\20';
display: block;
height: 0;
clear: both
}
.clearfix {
zoom: 1
}
.grid-98 {
overflow: hidden;
margin: 0 auto;
padding: 0
}
.grid-98 {
width: 980px
}
.mod-footer {
padding: 30px 0 15px 0;
width: 100%;
height: 40px;
position: relative;
margin-top: -85px;
clear: both;
zoom: 1
}
.mod-footer .hidden-box {
line-height: 0;
height: 0;
overflow: hidden
}
.mod-footer .footer-box {
text-align: center;
font-family: Arial, simsun;
font-size: 12px
}
.mod-footer .footer-box .copy-box {
color: #959595;
line-height: 12px;
height: 12px;
overflow: hidden
}
.mod-footer .footer-box .inner-box {
margin-bottom: 10px;
line-height: 14px;
height: 14px;
overflow: hidden;
color: #3FA7CB
}
.mod-footer .hidden-box {
line-height: 0;
height: 0;
overflow: hidden
}
</style>
<STYLE type=text/css>
.mod-notfound {
BORDER-RIGHT: #e1e1e1 1px solid;
BORDER-TOP: #e1e1e1 1px solid;
MARGIN-TOP: 10px;
BACKGROUND: #fff;
BORDER-LEFT: #e1e1e1 1px solid;
BORDER-BOTTOM: #e1e1e1 1px solid;
HEIGHT: 425px;
TEXT-ALIGN: center;
border-radius: 10px
}
</STYLE>
</HEAD>
<META content="MSHTML 6.00.6000.17117" name=GENERATOR>
</HEAD>
<BODY>
<SECTION class=mod-page-body>
<DIV class="mod-page-main wordwrap clearfix">
<DIV class=x-page-container>
<DIV class="mod-notfound grid-98">
<IMG class=img-notfound height=320 src="data:image/gif;base64,R0lGODlhCAJAAcQAALOzs+Xl5czMzPn5+Z+fn9nZ2b+/v+zs7KysrPLy8sbGxtLS0qamprm5ud/f376+vvv7+8LCwvf39/Pz887Ozt7e3u/v7+fn59bW1srKyuLi4uvr69vb25mZmf///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUE1NEMxRjA3M0NBMTFFMTlBMTlGRTgxRTY1QTk0MDIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUE1NEMxRjE3M0NBMTFFMTlBMTlGRTgxRTY1QTk0MDIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QTU0QzFFRTczQ0ExMUUxOUExOUZFODFFNjVBOTQwMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QTU0QzFFRjczQ0ExMUUxOUExOUZFODFFNjVBOTQwMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAAAAAAALAAAAAAIAkABAAX/oCeOZGmeaKqubOu+cCzPdG3feK7vfO//wKBwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum8/otHrNbrvf8Lh8Tq/b7/i8fs/v+/+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wADChxIsKDBgwgTKlzIsKHDhxAjSpxIKoAAAAw6aOzAoEEBiiBjFGhAQCMBAAoE/whQgEAjgwAhY6JIoKBkhwYLDpxIAEDjR5lAExjQiKDAABZDO+gEClKoxgYwX7QEUGhAAAcqs2otECAB008DBGg04DVGAI1R+wRYYKDnSQBa4yrA2AFlgbJfLTnICCCtjJ4G9ljsadcviwEOWHZAIABv3kcDGnQg8LPGgsl3Bow8mTNHAgEZiz525KCkgqM3DmhcKscBSQMOgDhwKwD1aEORORq2oTE2HJoEGvgeEsDtgtuFApi2naOkgDcBGjBYwLxIgZIv3yQIwJ07a+QoxBIYvqPnczYFAAAgnyR3h9NpEvfcSJ+Agd3IB/RE4Lh8h/M7LdCAegQKcNcVASDQV/8U1y32XRgjbcQASiphpZhGADw4mnLvBWHeTklxpB59HCmgIRMHqIdfEwe0NF4YBxhQEgIKOFAdCZ+VRBl44lX2Q0sAjtAgbCasRRJRPioxgAEMsCeFfj55UUBL0/WngntJApUbAyfyoFGQHgxFwIokpEcUmUJcV5sWSWVZRQEZQUVDUmhK1OJiN/qAFgliIZAnCqV9iQRPAFh5RVJgTgFnB2TdsN9XHAZGxFlKjeDAZF2mACWjRpR23BdtVlFcXYbKkMBqQBWg0adEXNrBCAmU5KQLSUkaxJIIZJpFqFEMoIBuPAzFKki/7mhEnyP01EANA7TUwaw6JIBAA39y4aL/rkYEkBF8PIiVKCQjqadAqZOIiW0PgIlwKQHktnDqZNXaoNy3XzTLUbxE/JqdD7/S28hQDChwpJuRLIlpEiX9lJG/L4jVwbA6qEowGAeURNUS0t6EWgEGqNTuCxnVmYhYCxRgoAIZfbyIvX4moVoHXqlKAL4tDOBSDwIQcK6UqyrB4Xn6rQjtCmcRUMmEv26UM8Mrt9RyEpcxIMLCOiS1M606s2E1EjIPl2EKX8cAZCMCerCeCDarCgCUxV0sCcs0/9ihzHHPNJyrENcg49X1hnZEsaw5YOsJCzBtQtR1/wFArg+j3YGqCpjdwQAEGH4I3COE5QDfNbwbW0uDyzCA/9SOc4rD3tD1TATA3wmAZgCRvxBrByILouBZaU2YUUaTPQ0J5plztwAAE+cQtQcvq7wCkVPXhcNlxZ9RrPI2DPX0Zx64bi+XJUQHQ0uxL+JsfSKI1VYDban3ttPxspV4DFT/igAOiSWLmQ2q5s0G5aYDYb1tJfPAAgq3EbeJwGQvkN/7+iC4ugCJVdZLyVQkwT4WBCB0EdOIV0qivxjoZwRJs4FqMOgGVdEOCOJhjus80CzJYKgEcmrBujjnh7U8DAFjYs4F1eMRSfzPBQbywbY84KoFooB02dMIswjAACNuoQBZ4ssPZPagFWaPd/8hQYpcULHHOYJSJLKcI364s/9m4QxeYbpJDT6ywrWVT4k06AkNu9As9lCqdjBQTdZKMMARtMWKIkhR3OwVPhNoZi4AaIAAhmaH6NCOUQFw4iHE4xWeuKABc0zBy3yTkeipgCorVEBUHEYDb8GhWQ8iDA9m56OyNMs2sznQWtbUAskYkAQG24hNJtMoPixONR2cBBVFYABdHaAsAgimB0siqeTVAJQwsSIpZaAaJL7hAE0kwR11YC8wuTF7hfSARbSXQDydIFAMEABrNDMfbq0hAOdqACYrlYltimB+KLAXp1RSPkaugGUjQNYzw6QTUYpAfjPoiT/RMJsSZISEMxjKskrATxGcDX+TMZTMgrmAGUn/8grXUUBKFkrNTNKhi5WBXQousxGsnAcrNACe5MSIgsjh85uqFInz6KCAYZmQeipQVTZL0CxPumCGJ1AVf1bQRd+dAZOWMoBRaeUSk55ybCOwSAoc5hPhiMCSomsJtUiAqhvEDp+SC+dhQlaHZjnGOTeYXZd8dcsZdHFWl3JqClyF1qeaYEokZapL0CgIZZUArEmlT6xsU1cWZCx069pBAibqAUHBQCyNZQNN1EVZD+jLUVkUAv/cFKuZvSApyvxCYyNDLQMIrDOyY6kHWjJVnprToeQa3no4llWIapKDJvhVZ28QQBbu6QX8C2wPrhKXzQFBAZJa0Fd7Y5md3gqr/yboCR7RpqOPTiGzRNwX7ABAnX+6cLD0/IPMDOWAvubTdwVIbQlKY6wStES+LzgAaij1PqEOangkCrBHvHuCsxWHBKCjQWmBSoMEJ1atLHAYfrcAXg9IK0hTYpjDmESUCc/hrilIT7X0851CIa8FwzxBWc9ozRZQzTrzodEC4PnVABTgQoxi8AoSkE0Ti+AyRkto44QwlMyOzrTughVR0FBhFhogdAtAwIp6ErlfQXgP3VxBe2lZprFmNXLxjfDBTlA0IEjGt2TWYKtCswCVAUcj7qRBAXTCT96WTrmWWswQ+vQnU7rLmi7UsRWQOAC2KNIxTz4sXE5gy0KXCM12sP+lC0bSgJQIwLWGeeUrlzfmE4hluDvoJAyKPASe1GW7aHMY92rQogGMbmq2cTBy2RqE9eaTAEhuAfMESF0zQDVoKUh0CYStRR1h8VV+ADKBcfm1XHF6jyj4kA/exWDg1pqJeC7BnbxYA34q4CPfHsHxLtu/H7yMTJBzgasPQNl30RQLfbzx8jB4aROkiD7F9MMmd1Ac/RLv2dg6bg+UCgNXCfq0jFo2r2ggtQsij7Iv4xvl2HUrax8RZpMOjDUtdgZp3TN6xPYjRO9U2zcQcgeuHUCKsAVkbL3Mfx1CuHuDxe0cJCXbJLiPB0g3VA9YnAX9EoJYVXCWJn/VK1TRuUX/rVsGqIbJAPESzbA7KJaSu0GBkkUbvlKsgsvMXAeygsEQfzAUqyMlo3LWCT7DLQLJgHomhCX7vVRQ9hbwE5QQ1PMZHK6ueI3uQag8hKusagNX1W4okKaBHmHgObmbvQVOc5QI+M7rFgc7tFNc8QlsNjm7f2RZWn0jss/g4xZgszotwg1clYBSF2TEwzD4VeLLpJFlH67cq/w5NUeAREqpzGa57sHsmKaqt1sQQNPcu/FRkJ7gwr4Okvk6EfgnRs6jWirPir3eeVCxnvtA2Tkofa9V4Ge5GV0yz1cX8uHI5BjWEmKjs70aBq8kWVuQ/ausPQwMi64TCuH1ORBE94R5/7eGcT8wPf+kZjIggEkUZGgQK/JkKAPgGG5FUY9ncqaxBNZDbtJHXGoEA6u3A2pDBP6FAypFTB8YYrjHb6qjApdieTOAWWugEgniJGGTVbfkcYEAMPIHA+D3Amf2Az1RcpyHcysgakRQEte3eW4jgypAaz0wOkx3ebMHdFNoBqOTAJFRSDFyAmw3Akv1B5RihDdAKTQEgFGofy9gTzrAX0UgezmARK5CdBzxXGjHAhlBhiWQU2mQHhdDbIu0ed7XR38wQe2he4chcCKYgi5AKT1AakVQTeFXFo54eenXApSCX+9ie9J2Bhm2JD8hbN/0V1y4fHbAUgcHWlWoTWrIA/+SYXXJB3YEOAQlkYp8EhXWV4C2+IRXyHzbdwMvVgbpURnxR0yRc4MWRgKlN1t+wD9XJgR8toB1mIadx4Hcp4hD8Io4gEAigI1C8os74DBXMxTPGAPjJwbDeDjhs1sTNVk+Qnk75wfF0oONqHkIZ4o0kFfSaHQ+2IpEUH41EHqV5X8mgH7TFoJ4mH048C6ExwRh8W8oIGVowwA0oSC9pIx4wY+/YVlHwD+XOFuzaHNDpn0aSVUOWASXUpIu0Im4pIA0F3wqQG05UIlfQBPuhwIJYin4SHkq2QYAowRuVwPnKItzxIfh14tBUHT99y0Et1xRMmnT+DzgqAUxkm+6xir/0gU2ZdGTa/AyF7hGcRcDznSNJ/kCRokDJYGPejJ6OsCSIyAZ5RhHU6kCwqUDdckFrtEYMJCFgdSBB3RWvhSVRjA7ejiHPXAZq6iMSEkDHGkE+HeU36KEqdE93vhJISmX76Ykw2MUMzA8fuRPUjNZe/AuXymXcbkCTsgDPXGJkrYDjVkEj4kDbilO91MD9aOYPVmZM6CbUCAUSvdMn7JFdAlFH3kGP4kEiGMDQdgD9ghEi7mblykEsQlaifJpjuIYbGh6/tg52xkFrjEunkGRFtUu7NYAu0gG71KcMzA7S2hf0RmQtRkDqZkDr0kE02kDs7maYmkbJ2g/PVmC9COY/1DwkJy5A1GmcvL2hFyZBvOIBFSGA7xZSoxIbguaAvU5BPf5TCHZnFpWFJrhZdNFkC5wlzhgnVFwQb/ZAyShXzBIAjWiB86InGG5ni6pAwbZmRk6A8FYBJzXf0lCk3uJFTrhF5C4f+8ZA7PZHiOhlyi0OJ/HGgdgGLeJBz/VkWFXhjlKAyVhUkAqm8/pA0rpJSLKaxWKYJlzpTAQoSA4poNiAD10K4pkYZSRoARFVH4JB4ZoBEFZol9KTfEplhw6J33KAynJnGNKjgrWGAbAKgCaX91Jo9WYBCMBnkLQImlRMQ2AVo11p25AmkewLrZHojpwGWqpAgLHHTYgW0cgFv8QlgAHx3n9QVsBCUiSk36NilEtGgSfAZFDMDyo1xKosYxt15BhUCxWqpBempksoI01gIYsRHjndgQ3SgKXsaBdOpDEqmQGqH2JSZcrGASCY5VDEBn00izO9oUewEbtWQYPJa0TagNIuAO1iJ8xpwM7OgRQGFCL+Rl58oLalqUxQKpCpp4INpK3MjzlFYkSmQLA4QA8ZimRk0x3sG9FUDQ9qKZmMZcUGjy7iFA8Op3ziUtb6mlTeBacCgPMao5sOgO5mJRPtq5yJqzMVznQNazipKxlIB5GIIWleVgAGwNBV3j4F0kihLE5MIImELL6mlmIyieD+gI1Wo9sKbRTywP/S3qeHuRaeaQgAvOmAkkHQ1cESisvPyt26aVggSqX3SqoTHlR2iaZJyCrTouzOKmxK1CtOiBQqyQwPbuevBp7L5JVdCsGnNe37hK1HlimOyGgDGewBwKfK9sDIztq72mPSSqha+sBkjG4e/itAYk+2SoD/RaQAYMaMFUHBlcEl9tt75qqnhsDElUmBLsf9GgC/kqt8kUu16pdOzCta6qHJdCCNsBOXJYEAgCiMQUabAS8YPBZkzKjOLC5PNASzHtA+CecncNMRFavtGmwAXuFLQGz2RW5KvAythetNvAZb7oE5LoDYTEgWOsF6UIEq6uhnEtUZZuIyJo9BOsqmVsz/zX6MjU3AlG6rBt6tsBIvingsduYvydQleKLAykSwYAgvEBgsT4At0fbujSwnFY7Fj8QsmCUY6l2hykwuWRVtbyhwBd3ms6Zq0RTafFbeDIbCe9CwSxQv0LJwijrvRhVlhnkIDzAP4ahNjlDFPPhw/8KxAM5vTz8r0/cAmeJiXBRuzMAXVasB24oBFt8jduKll98A0UIKwO0bNj0JbOkEumjHh1TIV1Bflc4hCx0YwCwqGoKhybgwDkcxX70pzYAPqbSK+SlCUC2Oq9Ltiqcj4x7A3s6ebZoFZcGALsUYJRMItNCTtx1qBqLuA61vyOgxytgZXupvTpwoVxgqZswtv+SO8AGCsoLzL05kLqdIyDHNiEdM2M0xrDMZQDjsxjqhHhZZSZ69ckKLIkqlsiKDMN/ZbQuMJRdMBszLAhFCgQ3HMJ2KwN5KERHqkkoU0DfhsPiJCAkshRJk07Vcq8lIMrHvMq15TeuycdScGlZ7AcPysWurGtP61iPegMpJDugQRS0+gOuYRPEsx3n0qAoMK/r3C2dFlRPWcrw/ATt6wk6bIKc7KWKS3snKzoIybBJUSVIoBnOwgBGNTsQhbQLrZqTUSf8k9F5HNFNwBPViwgVjaWerAPYdQNNS2aFox7HthiJtEhW0s+akhQ36TPzgYy+qDHjSyb3fCXOkqK4dC3/hgrOxKHUnFDTwwvCa3m/vLe/iIFjlUzJAbNOHU2tFhPNZcg7htMgBCBK+/Wc+8zPNsEAHeMA3JEYNmG4wXvTViBioqDV9IrA9OnXoqOAEeISHZPLJrAdbNHLJP1GFEdUkhG4VOAwYejRe710aJKvQ5zYZB267unCThByoCDYkOt9EszMRJNRNfEUjxukMuISRhEnhyVW8XIAJrPGBNLbWYHLOHzG0MawTHQUYQo2MC26JvPbom0Cx3kFRVUKwEyCJmHVXWwD4oEktrcoN2FCl0rK5zTbJ5ESwN0dWTEgSewSdew6ggYl9RVt/he+K4Daz/zQVNAiza0IquwDgXJq/7H81DCEIVYtbkg8d1JIQmGRlm1mVzZ2vOkNFzaCcIadrjuFmFb4v1rgFvlNPzUMCno7fUfMSzOWRybj0/mMmlnpA12Ea/s0l9dROWqNPIkxPgiw4GfHxAMYG6VFM/tdBvZSOfMsAwIS5IdwreO6GfXBxnJBIL1MHwSLBC/DOyYzhbkBdeMqODbhoXSYyKcSZJJBUkaOBu5hHwMeUaTNCQyJIiUuyWP9FnBhINxB5ChEFJPRmoHEAJbdKeJ9kZSZyHgrsABM2GrgSIo90x4kdaqQMKfAP5laQEJCAJndHgvAO1be5+HxH92XOM5qchzDO/ax4SiA363gwZtgFfiRFP/8s1OqUulOsCiVY+kkqxic8ysu7QUJIM6LYegpMLqtMG6a0CAb4XQ/ticySDKXPSOsEeZcZXVFhAcJTipAANiuEHGbkBSLozRxfUKY9St8vUrz8SlhbkJnTgKISAcZM9xVg+GdMHaaUNkTOB8EQB2pKx5jQuJHwFKBEeYshbPOmwcGg+7DixOzIBaWp+swmoHhRSKS4jC1o9scttGaRLSmZzGGWQJCxdraWuZfQCW2px8GjwmNl3O+4WpENO5+oLNCgt60JDGaghVs3hGwpZwmVmhcUS0rHpurHiaRLQPT7OwIL0KrRgt2ri6SYmeDzAjVTNwQdgCK0RGY7ANcNRn/EI56uzRsh+wCIa8HspyPo0gL2blzwRoVcxHjb7DpJoAAqr0o5EX2EX+8WEResHQzfhTvdjl3ezC/MzAScm4JZ1lRPLYU3lMVC2BQkjMxVadFD8X2jAfaSkdJRMMWeH8YP58HkRVR6l4KlOIjfIk8+3IIGVMX/JMpJWEbSgXqzMLd5gmSM4cYvFwXIsXBe+XMdoCm6ra+uuDu2oRWPBFnhRAoaWmqo6dUe5+PGRHvLwMgjoQTrIHnRgQ4ezAU76Yf3T4KJs1HgzMlfE4IFGuhlbLjXAT56f0Wd53fGyYmyCPJTKqvdOsWw18FPa5tQd8LLMUepn0AH88GOizHckw0/zICAoRRBIN3ekGwKADRdYixBKh947nzIrDSNUy3AYEgzCFRgx7imHxCo9Ip9RToAKYBQKLq/YLD4jEZ1+gQujZBsOx+w5ECLPQnOHQY0MEZ4KAmOLTAxMyUhOERdiwgFXQojC3FHMRVwrFY0UUVNFl6foKGKvE4eTgg1Iiqrs5lPTkGHSZJMoqtNDDANIgtEAok5aqJSRKkrh4/9bo+CRggP0NH2xy8LKMkABiUSnM/DSwUnChDXVknzf2+DRiDXWnmODqX8cGkd3t2Jdh7GDxCGUC6J3DgG0cd5N0I0ECBMIIDex30MGfXk3JSfqBy+MMfkh4NyczBQslhpC4MKP8hSEekw8gcAwCEIylzphSDCG8cMNBgQUua0Aw2W0TunTcAMBgoILENmdEOMXFcuekmQK4OApb6zBEgQYBfARCcUNNqlp+sZs96sInVwwEBH9GGmvPCyFBzFRX0UIQAgAIayHQB6/B2XkgCV+HmALDV1dMUaAazPYl4MkmDnSh3G3C0JxKLXw6saOaCEAIFDta6gcHORq99lRL0Q8MQswcFnFHsIHDbChfavrsZLPY7mlHXnYlGciCgaYw7nnKR+EgNrCjYpBdAnjzgRxt4l4eDR0atXnh8sk4UlzInYKUAeI+ajsP8oJDpqON8y5sn6W6zOQkodo5U5REIyktHrVb/oBcJLDAfRR68kGAOcwwYRwIFnIGGAX+UMYcMMBCgQD/dPcPgfFgAIICKKgSgnIop4qeiACQEsBtXyjVAQGn9nWBAhQoCGUdIWGQXZELvoUHaSBhN0Y9xngzggAFzbThGIgckoMALVg20ggEnKqKIXWMYFKaZMOwlgANFesBHY0bCCccBzBkgoZFdMYcAT2lVhUUukkWRQB7RCJILAQ0UcB8SLzBgwgCxkUgQaCyy2BZyZHBHqaYqePHSm3GC6oYDfSKQaJCBIJnHCG+1BYCrCyjaYwccSnOAAlUhyuYNTdnzFRo8kjRRHD18KsacwIaaLBgOOFiArmbd0icDqz5H/4CkAuSVErInDPnUo2jEeg86cGjG0hsHILCtsutWoU+fqpKAFmhs6IeFac+OMShJDGZ46J5InLGlW2G9UKxM6b3hABoJAxAuuw9Pwe+WhDDA14yc1hoaAPX6UIC6cJxhMDmbkqyCwzYIoh9f8YYFQ1sTEwLAx90g7AZ3bhTQMMQ7v4Yjx2G6mqKKNFTqBaULqNiAq2ZW3FdXl67ijm1cdaXil67+fKbWTLuqwMV7KDcaiADkwl7VLMNVcxm51DJGMzzDbaAKSC/n6rtb4513Hl1f/NYZT66ygyIVA9CAjAJoerIHVIfGBtkU72TnNaHhou9wao8hqGBkABS35xmrUP/A4YcrXbiKuQh9sQr4nhBhZuNEE4DoYiNgOI04HCDIXElIoMADClCwQAUVWGABSXa80YsewyD6ufNoYf4ZDAYWcPUIWkENzTqiwaz1dzhAsMHwC1Dg+wPnR0ABBsRPwM1YbpzB3hdLiPy8/QIZRWsYsFcygAAETAtJ33PMmAYyqapdzBEFfIIELKCBClAgA+c7XwaEZwEJHON9ZCiX5KCAjZndL4THMEoHpfA3S6CLSygIACls4JnJvBB3W5HCBMTHggmmrwIbwOAnekEdMjjCWmA4AKBEaMSB5KKEUXCdhQqGuxc8iICYoRAO/DcxBtQvBw7EgATRZ0EIxMEd8Iv/yBe2oLgjotESMDjjNKZXiR60DSeqWWH2sjIuG0giRRnCAhs9sEXzPSADGLgAD60EA9YhoVwgPAEn+pjGR5bBjbwAwhcscAEIRsB4a6gjP8goRcrc8QSS8FaGBviF8EEQhwvQQPvCMEcyWY4K1XMkJGvpyg6QwShxTMIENMDFCQJPA0N4AbA0J4QYwiWUteGIDQwSxTL0cgER8CIrvRA9L5xhl1HwkS27+ZcfgqFc2ZGABqRJQQxowAJgzEEvnpmDHnAImWgJpTHhAYMshqGXGDBfBFbZyjpwMlBrrMIMvGlQVQQUCo5Y3g0goIEuZoB4U4BnFO4oz7OEUlhI+AFd/0AhgQuY8wH9rCYSFNYBR1JxCp46KEtBkdAnxO8GEsDA+ShwgXVGbGFR8MxFzYK8ExBrFrkAnCWiOc3fDbKQKHBiGF6Ar5for6VSfcNLE+kyFMxUpBxQKhUU5s4c4MEVPQ0DhqrhCV2K8pCviOUxekkBYAoTBf1YoEKriq5FTjWvT6iqPX+ogWlWAKdfUOZecfnJMhSAUX3pQluiOgYSZkKIT3iBY5FhAQ5QYANt7IASq5hEKdxVr6Itg6u84DGgCsUDHAjkP8Pw0yi4cawExcJqQlJZMEBWIgl1kjgYoE1pGIWucvDkE5hFy9GO1ihhuEJHG+iG/E0BTTHgaxL68f+jMzA0l5zlFjOToEBxPGYgmvttEvDQ0VeYErnqbdLmvnCGHz02tR40k3B3WkcxPne7HjjhUH7Yg3Q4gLyrgEhnF0fZKCwAvutd8DlmFTED/CIRiJRp8MygQigoTxLUndCFcaBB7abimjiQpCPAkojjjqEfBMBnCuWHBG4yOMZaIO5kQ0xjL1jgARTwcHcD44zY1BcKH1aCXPCKhKYQoEEOhq1hF+fGz3YjNgbIzgJe4GKwCljGWrYBuKSQgC4oLA1jqMADKoAD/j2BKyfIUJDTDMWRRElL9IHD3ZYMBUl6wI0iRobggEC00E0JDbfdMqGrwF8vvyDLUiCzNhNhTRj/tPkJc2LabOJACBaSB7bW0LNTBpIf78Gq0KIWg0l51JVw5LEMGwhkDpg6hapEGgoHoNuaPkGINgV1KA/SjBBzS5B1iA5x5xk1sb/AhKX0RZQ9OK8YJHA+ruo20u7YsEAu3aZn9aJtCnMGr4vt7TuhaRuuIIaRcyBBMw+BbVMILrXvQQgF46AHLYFsa75tb9pAAIJcNQgDJJTYPJQbBRAQngcuIFJojyeL30JFu73rhAHgswqK+NgLr7ALIjCbQOnT5L31mtUHYECwjNwSTLbiHlyhOMcBeWsGwNoDmHAmSlMyzGFxRqIqwQEGKt6WJIwhOhMgQDdGgsAFgMfxjh/U/wJvjUBgkwCb7mmowFGAwPnACIFpLkDkjHzX43RhqpqLSmh1qsQaA5ZlSVw5LMkqOgWOjnRIFv13F6ACaMBRI0uc+wQTkGAG3H4NF6kIbXSM9UDc+L88fF0JBcgFvJXFdr+//X759l3bZ2LwCLQSAqt9AORnTPh74Hdxco6B4b50lEHv7PGRD6EEKjBNDEDbIQsQqWZPIIHYU0G2M7lCdq3guKDFxyERV8VfK796z2U1Als9CwRoGsi5l0H3MpE+JPMdAdgff2fJbzpiLICBzE6l4dKgfi01/wAOaD37Rtp++h9GfoK8v5YSkGZc1b9+mipAA+2HWPwF0v9aWkAGKP9A59mfb2SVAkCf/fxfNyxgLf3VAuBeASIG+4lQA46f+FUfTaGbBFIGBRqRBcYOBgKgABIgB5KE9THd/jkPCP6ECNrSA6qgCd7DX4FcBCqgCyLDkMnY/EVAAsogQWwA5dng/YReMt2Ylm1A+gzhD6rCBLBcCVYgns1ThxXawEVA/THhMzSfSPmgG9weqBThFBIVEqZPDGZhHNAg91XB/OVAA3FRawVJGGIUFY6aFdbeGYJCAOrYEiLB1fkg+XBABcAhuDWZEY4hof1VyOGhJZifAtxhGGAABsSNHJoFYXnb3inAIC6iGCTh+ZkhEmwA9EHQJErhHB6i8ziUJsLBamH/4SaCgQSwnCpOwSh6gAbsGNxoDijRoQgR3QIIUgVcQPHIIhgkYda5Ihj81RWWAS3SItyUYiXuIhpBQPEUDx+uoQAO4zFS2B66QQXUAsHFzTNmBW9l32p1oTbmQDK24hhkgDA5GxxWAAewizj6xJ7d2wVcHzoiASxy4xskIRh9Hw5MAPA8Ypy40QBMGHFE4xTAIgU4ZPAMTzplo4LM1DnmkwJkwCdmYSeu4xhMQARo1gQ8gCY6FAdIYqjE1inij35FwUdC4QRYEgT5TgVJFJxwQA/GAQRQAObpowdsYQaQJBQiwUfOHQQowAaGo2F1hUwIngf4GhRAwESCjwWkko5p/4A1EoRzIQEXaaQXYABOauNAemIOQIAgfUHRFWUFPU9KQg9LqsJlzaRF0sQGdKQfRQBWnuUD1OUPagDtJQEGKBoOzB9Q+mQGZORaKqVK3sNTCiZeTsEE3KQyDscCnCQoJGFlZuHABVIEciUVTF5clSUFdCVKGpbosIVZMKbAcQAEfoL1ZUAh6SQHpFNMUoBjroJNocAlecJHKiIT7h3IPUEFKEBX4iP66Z0CYKbzGN4ffB5TuCUKOGFBegIs8iQKFM9sSqU04KYHOJttPqZhjqa9JSFYIgE+Zid3Yt8J/JVcJiW31EBzjtBzesBAnmcZ7FN4PoQ8+lHawUFZHiYHkv9ZJjIQeXoBLBKmCLmRArzn4tTjcxplfZ7l0RnlXmaFBgSESOJnFfgnhIqaZoomFFQYGLgeUoaQnnVBFsCnkAQICjAmBVCoG7joDdgibTibJiGgKDRfdR5fWQInFOAjfloA8HjnuugZejhlg7JDkKpCJt2A0vlGQHqAcK7CV3KojH2kXl4EiUaB0g3gE3AAexKpYbkCivoElJ0ABuhnHl7ZBtwiZjibZvnhlOpox40nmELnA3Qll9ppwT3AnoKKG/XaadLEK50ABWhpTjoiDnBAmmaFRQonGLlehn4BlSLd5WXnjErBBUSQn54APg5peRQpWqgVClAAo1bCwGnp1RX/khMK5TNsgKmigFp6gKyqAqXam8EJ6BRoKlQKJwa0aomKqUyE2g1IoYVKKhRIQAZYpKHKqAIAT5tmhQTg5Eceqid85adOFU39J0M+gHT6JEi147F6Tqg6hAMYDrEWYmEmpxvY4iAO3LpCZ5VCw6oZz6px6glsgLx2JrFpK34a3CoVzyVF0FXmFbmaRSmGJrYKnKZaZJC+6GSYJ5/ea1/e6w1EkLgaVL+GATlh1vCo02gdpEMkwHbkwDM6lMJuQCR6q9LVJpDcZPskoXFKQRJWrMCBZ6Fp7DF8bC3Ro/ucwpX1rA00XyEVHQdsgDpNowMtqtFqHWQKkryeBaXO370S/yUYlCW8rlfOHgPn2VLQHoNtnICUtMmIpWsSYKrAOdDweCzkfRQXLcBNhYqtesFAeqdRYu1oaW0VVKsUcC3Pli1wGUNvkK2uKgBWNpA3VhBJrQs+/uoNxGM+MV2Mrda2VoFIkmWuJkHfQpIkVU2tPcMBKIrX8k7xiM/wfJ9Drs8FVS7GOgQ+PqxgQuvcEuhoGRzlVkEk5gDuQoH+dS0ujUqYYBGKWdrf6qraHq3qjgELsC5BDGTLUoETjoHBQa0RXV7dVoDtngCTItc9oYFbrIOcrVg7sMjwSt0qqGF5WOH5JkFZemsVRKxo5dicUkHvqC8KPMB6EYLQ4dHh9ZsUQP/cHoFIYEbXc04A7k0vdC4vSaRsEhQd09lg0b1uFOzrVF1p43rB3rYUIfSHFdFWeU2JnsBZSGjDFFQPqdQCoXrA90GeN5YB1R3wTDDrE4DU7xiq2sZj+SzfG0RQXhlln56hznlQbPiWMEBcDxjAbhBRDKBGlgCQgqrA4aXLqNpl+l3dCytpkHBAdsakDe8QI5qlVEkQrJqgFHuDAFRFxfQAoqAGMVRWAMxVgtADYGBV+y6AGDNQDjRjoVUtS9FU7MpgIgxfWBSNSgnxny2AEQNLLkRKEnBAy92uIzuuH29Zjlnw8+BqAo9aSAhw9AHwfhQJPfBnDkDoBBhjY7bU2Xr/wV8p7MN8pPxm4b+NsCqsw+pEwRKE7yK+KSRi7xHxaM1mXwoVkaQUQcAh3aNa7RdDEk1tsgnGRiCLAgulF6F9JBRM8xNc7cbOrhGt2nD2pAdARCgjgwIJL0vlWBRk8w18ZATjwKq9cJxIq+b2pOAs8jP8QONpGRtCAWC2ZOSCAQdw8xG9FQa7YhIjQEK6QT8sc8eJ5BIOpC8XakKzS19CcjcrwbIR8/zkGhOqjyhIqzqvyzu3swQ28zGgi/5mYY6FdBKwcwjNnh1TtDdnWihMx0V/G9yKQiNjMnhsc05LICyPMzzoyE+/tA1kgEs/TA+371CfwHhEMxDNmVJXwkcm/zW7kJkkQ3VF/0ol9AM4X7UY/BVPd+A0pXQWfsstz0PIdPUnhCjc0NTdpjV3LeQ1fHLQod5bN5tkat/B2fUrvEAso0Cr0Jdz/DUDmPRex0ESrjJtaKBhS1oLpUXWAE0NQLNQMzYKkM/OxC9YbyIxcILe6AUfVbYnXJ1Hl8dih/YsdLJnA/Fpe4KnsouzRYBma+NGqHZMs7YlOCS7ROdt11VtOzNvryFIAvf9jEfeFPZwo2FsI/fzJABkb8Zyf0JRQ7fzxLGZNPV0jwElY/fn0Pa7UfZ2n0Ajg7fnlMkRjncL4/V5Q0zCqXdrK3d7wzdyIXN807dUoXR943dLQWl+83m3LeVyfwP4I0lpgBO4EY12gSP4/Xx1gjM4dwt0g0M4nPxohFM4uxxlhWN4qEx4hnN4kFx4h4M4gWx4iJP4b+RfiaN4iqv4irN4i7v4i8N4jMv4jNN4jdv4jeN4juv4jvN4j/v4jwN5kAv5kBN5kRv5kSN5kit5LYUAADs=" width=520>
<P style="FONT-SIZE: 24px; LINE-HEIGHT: 70px">啊~哦~ 您要查看的页面不存在或已删除!</P>
</DIV>
</DIV>
</DIV>
</SECTION>
<FOOTER class="mod-footer mod-cs-footer">
<DIV class="clearfix hidden-box"></DIV>
<DIV class=footer-box>
<DIV class=copy-box>©2017 酒店管理系统</DIV>
</DIV>
</FOOTER>
</BODY>
</HTML> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="./js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="./MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="./js/layui/layui.js"></script>
<script src="./js/jquery.js"></script>
<script src="./js/global.js"></script>
<script src="./js/Cookie.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<button class="layui-btn layui-btn-primary fa fa-pencil-square-o " id="insertButton"> 新增</button>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-primary fa fa-cloud-download" id="toXlsButton"> 导出</button>
</div>
<div class="layui-inline">
<button type="button" class="layui-btn layui-btn-primary fa fa-cloud-upload" id="upload"> 导入</button>
</div>
</div>
</legend>
</fieldset>
<table id="tableID"></table>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-xs" lay-event="edit">改密</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['util', 'layer', 'table','upload'], function () {
$(document).ready(function () {
var table = layui.table,
layer = layui.layer,
upload = layui.upload,
util = layui.util;
upload.render({ //允许上传的文件后缀
elem: '#upload'
,url: baseUrl + '/UploadFileServlet'
,accept: 'file' //普通文件
,exts: 'xlsx' //只允许上传excel文件
,before: function(){
layer.msg('文件上传中');
}
,success: function(res){
alert(res.msg);
}
});
var countNum;
var tableIns = table.render({
elem: '#tableID',
id: 'tableID',
url: baseUrl + '/LoginTableServlet',
cols: [
[{
field: 'loginId',
title: '用户ID',
width: 100,
sort: true,
fixed: true
}, {
field: 'loginName',
title: '用户登录名'
}, {
field: 'loginNickName',
title: '用户昵称'
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 150
}]
],
page: true,
where: {
make: 0
},
done: function (res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function (obj) {
var data = obj.data,
layEvent = obj.event;
var loginId = data.loginId;
var loginName = data.loginName;
var loginNameNow = getCookie("loginName");
if (layEvent === 'del') {
if (loginName != loginNameNow) {
layer.confirm('您确定要删除该条数据吗?', {
offset: '180px',
btn: ['是滴', '手滑']
}, function () {
table.reload('tableID', {
where: {
make: 4,
loginId: loginId
}
});
layer.msg('删除结果如下', {
offset: '250px',
icon: 1
});
}, function () {
layer.msg('删除操作已取消', {
offset: '250px'
});
});
} else {
layer.msg('当前登陆账号禁止删除', {
offset: '250px'
});
}
} else if (layEvent === 'edit') {
layer.prompt({
title: '请输入旧密码',
formType: 1,
offset: '220px',
maxlength: 18
}, function (value, index) {
var params = "loginName=" + loginName + "&loginPwd=" + value;
$.post(baseUrl + '/QueryLoginNameServlet', params, function updateCheck(data) {
layer.close(index);
if (data === "0") {
layer.alert('密码不正确!', {
title: '警告',
icon: 2,
anim: 6,
offset: '220px'
});
} else {
layer.prompt({
title: '请输入新密码',
formType: 1,
offset: '220px',
maxlength: 18
}, function (value1, index1) {
var pwd1 = value1;
layer.prompt({
title: '请再次输入新密码',
formType: 1,
offset: '220px',
maxlength: 18
}, function (value2, index2) {
var pwd2 = value2;
if (pwd2 != pwd1) {
layer.close(index2);
layer.alert('两次输入的值不一致!', {
title: '警告',
icon: 2,
anim: 6,
offset: '220px'
});
} else {
layer.close(index1);
layer.close(index2);
params = "loginName=" + loginName + "&loginPwd=" + value2;
$.post(baseUrl + '/UpdatePwdServlet', params, function updateCheck(data) {
if (data === '1') {
layer.alert('修改成功!', {
title: '成功',
icon: 6,
anim: 1,
offset: '220px'
});
} else {
layer.alert('修改失败!', {
title: '失败',
icon: 2,
anim: 6,
offset: '220px'
});
}
});
}
});
});
}
});
});
}
});
//新增
$('#insertButton').click(function () {
layer.open({
title: "新增",
btn: ['关闭'],
yes: function (index) {
tableIns.reload({
where: {
make: 0
}
});
layer.close(index); //关闭弹窗
},
type: 2,
area: ['450px', '500px'],
fixed: false,
maxmin: true,
content: '/hb/insertLogin.jsp',
cancel: function () {
tableIns.reload({
where: {
make: 0
}
});
}
});
});
//导出
$('#toXlsButton').click(function () {
location.href = baseUrl + '/LoginExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//回到顶端
util.fixbar({
showHeight: 2,
click: function (type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>酒店管理系统</title>
<link rel="stylesheet Icon" type=" image/x-icon" href="img/windows.ico">
</head>
<body>
<jsp:forward page="login.jsp"></jsp:forward>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
* {
padding: 0;
margin: 0;
list-style: none;
text-decoration: none;
}
html,
body {
height: 100%;
width: 100%;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
color: #555;
font-size: 15px;
line-height: 1.7;
}
input:focus {
outline: none;
}
canvas {
display: block;
vertical-align: bottom;
}
#box {
width: 100%;
height: 100%;
background-size: cover;
background: #F7FAFC no-repeat 50% 50%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
}
.cent-box {
width: 300px;
height: 440px;
vertical-align: middle;
white-space: normal;
position: absolute;
z-index: 2;
left: 50%;
top: 50%;
margin: -220px auto 0 -150px;
}
.register-box {
height: 490px;
margin-top: -270px;
}
.cent-box-header {
text-align: center;
}
.hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.cent-box-header .main-title {
width: 160px;
height: 74px;
margin: 0 auto;
background-size: contain;
}
.cent-box-header .sub-title {
margin-bottom: 20px;
font-weight: 400;
font-size: 18px;
line-height: 1;
}
.clearfix:before {
content: '';
display: table;
}
.index-tab {
text-align: center;
font-size: 18px;
margin-bottom: 10px;
}
.index-tab .index-slide-nav {
display: inline-block;
position: relative;
}
.index-tab .index-slide-nav a {
float: left;
width: 4em;
line-height: 35px;
opacity: 0.7;
-webkit-transition: opacity .15s, color .15s;
transition: opacity .15s, color .15s;
color: #555;
}
.index-tab .index-slide-nav a:hover {
color: #0f88eb;
opacity: 1;
}
.index-tab .index-slide-nav a.active {
opacity: 1;
color: #0f88eb;
}
.slide-bar {
position: absolute;
left: 0;
bottom: 0;
margin: 0 .8em;
width: 2.4em;
height: 2px;
background: #0f88eb;
}
.slide-bar1 {
left: 4em;
}
.form {
float: none;
margin: auto;
text-align: left;
width: 300px;
}
.form .group {
padding: 1px 0;
border: 1px solid #d5d5d5;
border-radius: 3px;
}
.form .group .group-ipt {
position: relative;
margin: 0;
overflow: hidden;
}
.form .group .group-ipt input {
padding: 1em .8em;
width: 100%;
box-sizing: border-box;
border: 0;
border-radius: 0;
box-shadow: none;
background: rgba(255, 255, 255, 0.5);
font-family: 'Microsoft Yahei', serif;
color: #666;
position: relative;
}
.verify {
margin-top: 5px;
}
.show {
height: 39px;
margin: 0 auto;
text-align: center;
padding-top: 5px;
}
#password,
#loginPwd,
#verify,
#user,
#password1 {
border-top: 1px solid #e8e8e8;
}
.imgcode {
width: 95px;
position: absolute;
right: 0;
top: 2px;
cursor: pointer;
height: 40px;
}
.button {
margin-top: 18px;
}
.button {
width: 100%;
background: #0f88eb;
box-shadow: none;
border: 0;
border-radius: 3px;
line-height: 41px;
color: #fff;
display: block;
font-size: 15px;
cursor: pointer;
font-family: 'Microsoft Yahei';
}
.button:hover {
background: #80c3f7;
}
.remember {
margin-top: 10px;
line-height: 30px;
}
.remember label {
display: block;
}
.remember-me {
font-size: 14px;
float: left;
position: relative;
cursor: pointer;
}
.icon {
width: 11px;
height: 11px;
display: block;
border: 1px solid #ccc;
float: left;
margin-top: 8px;
margin-right: 5px;
cursor: pointer;
}
.zt {
width: 9px;
height: 9px;
background: #0f88eb;
margin: 1px;
display: block;
}
.forgot-password {
float: right;
font-size: 14px;
}
.forgot-password a {
color: #555;
}
.forgot-password a:hover {
text-decoration: underline;
}
.footer {
position: fixed;
width: 100%;
height: 40px;
bottom: 0;
left: 0;
text-align: center;
color: #999;
z-index: 2;
padding-bottom: 10px;
font-size: 13px;
}
.footer a {
color: #666;
text-decoration: underline;
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>酒店管理系统</title>
<link rel='Shortcut Icon' type='image/x-icon' href='../img/windows.ico'>
<script type="text/javascript" src="./js/jquery-2.2.4.min.js"></script>
<link href="css/animate.css" rel="stylesheet">
<script type="text/javascript" src="./component/layer-v3.0.3/layer/layer.js"></script>
<link rel="stylesheet" href="component/font-awesome-4.7.0/css/font-awesome.min.css">
<link href="css/default.css" rel="stylesheet">
<script type="text/javascript" src="./js/win10.js"></script>
<script type="text/javascript" src="../js/Cookie.js"></script>
<style>
* {
font-family: "Microsoft YaHei", 微软雅黑, "MicrosoftJhengHei", 华文细黑, STHeiti, MingLiu
}
.layui-layer-title {
border-bottom: 1px solid #2b2b33;
}
/*去除窗体标题栏与主栏的差异,默认的属性是#eee*/
.win10-block-content-text {
line-height: 44px;
text-align: center;
font-size: 16px;
}
/*磁贴自定义样式*/
</style>
<script>
if(window.top == window.self) {
//alert('页面不是在框架中打开的');
} else {
//alert('页面是在框架中打开的');
//所以最简单的方法就是判断主页面是否在框架里,如果在就直接刷新父类界面
parent.location.reload();
}
//从cookie读取登录用户
var loginName = getCookie("loginName");
var isLogin = getCookie("isLogin");
var loginNickName = getCookie("loginNickName");
var loginAdmin = getCookie("loginAdmin");
if(isLogin == null)
setCookie("isLogin", "0"); //表示第一次登录
Win10.onReady(function() {
//设置壁纸
Win10.setBgUrl({
main: './img/wallpapers/miaowu.jpg',
mobile: './img/wallpapers/mobile.jpg',
});
//Animated动画 地址:https://daneden.github.io/animate.css
Win10.setAnimated([
'animated flip',
'animated bounceIn',
], 0.01);
//发送一条消息
setTimeout(function() {
isLogin = getCookie("isLogin");
loginAdmin = getCookie("loginAdmin");
if(isLogin == 0) {
Win10.newMsg('欢迎登录',
'欢迎用户"' + loginNickName + '"的登录。');
setCookie("isLogin", "1")
} else {
Win10.newMsg('欢迎回来',
'你好' + loginNickName + ',欢迎回来。');
}
}, 2500);
});
</script>
</head>
<body>
<div id="win10">
<!--桌面图标-->
<div class="desktop">
<div id="win10-shortcuts" class="shortcuts-hidden">
<div class="shortcut win10-open-window" data-area-offset="max" data-url="../webpage/orderInfo/order.jsp">
<img class="icon" src="img/icon/1YuDing.png" />
<div class="title">客房预定</div>
</div>
<div class="shortcut win10-open-window" data-url="../webpage/auth/auth.jsp">
<img class="icon" src="img/icon/2RuZhu.png" />
<div class="title">客房入住</div>
</div>
<div class="shortcut win10-open-window" data-url="../webpage/auth/auth.jsp">
<img class="icon" src="img/icon/3FangTai.png" />
<div class="title">房态管理</div>
</div>
<div class="shortcut win10-open-window" data-url="../webpage/searchTable/searchMain.jsp">
<img class="icon" src="img/icon/4ShuJu.png" />
<div class="title">数据查询</div>
</div>
<div class="shortcut win10-open-window" data-url="../webpage/billinfo/billInfoMain.jsp">
<img class="icon" src="img/icon/5ZhangDan.png" />
<div class="title">账单管理</div>
</div>
<div class="shortcut win10-open-window" data-url="../webpage/SystemSetting/SystemMain.jsp">
<img class="icon" src="img/icon/6XiTong.png" />
<div class="title">系统设定</div>
</div>
<div class="shortcut win10-open-window" data-url="../loginTable.jsp">
<img class="icon" src="img/icon/7YuanGong.png" />
<div class="title">员工管理</div>
</div>
<div class="shortcut" onclick="Win10.exit()">
<img class="icon" src="img/icon/8AnQuan.png" />
<div class="title">安全退出</div>
</div>
<div class="shortcut" onclick="window.open('https://github.com/inkss/hotelbook-JavaWeb')">
<img class="icon" src="img/icon/9XiangMu.png" />
<div class="title">项目地址</div>
</div>
<div class="shortcut win10-open-window" data-url="./plugins/theme_switcher/theme_switcher.html">
<img class="icon" src="img/icon/11pic.png" />
<div class="title">更换壁纸</div>
</div>
<div class="shortcut win10-open-window" data-url="https://www.baidu.com">
<img class="icon" src="img/icon/10Liulan.png" />
<div class="title">浏览器</div>
</div>
</div>
<div id="win10-desktop-scene"></div>
</div>
<!--磁贴菜单-->
<div id="win10-menu" class="hidden">
<div class="list win10-menu-hidden animated animated-slideOutLeft">
<div class="item" onclick="Win10.exit()">
<i class="black icon fa fa-power-off fa-fw"></i>
<span class="title">关闭</span>
</div>
</div>
<div class="blocks">
<div class="menu_group">
<div class="title">Welcome</div>
<div class="block" loc="1,1" size="6,4">
<div class="content">
<div style="font-size:100px;line-height: 132px;margin: 0 auto ;display: block" class="fa fa-fw fa-windows win10-block-content-text"></div>
<div class="win10-block-content-text" style="font-size: 22px">欢迎使用 酒店管理系统</div>
</div>
</div>
</div>
</div>
<div id="win10-menu-switcher"></div>
</div>
<!--通知中心-->
<div id="win10_command_center" class="hidden_right">
<div class="title">
<h4 style="float: left">消息中心 </h4>
<span id="win10_btn_command_center_clean_all">全部清除</span>
</div>
<div class="msgs"></div>
</div>
<!--状态栏-->
<div id="win10_task_bar">
<div id="win10_btn_group_left" class="btn_group">
<div id="win10_btn_win" class="btn">
<span class="fa fa-windows"></span>
</div>
<div class="btn" id="win10-btn-browser">
<span class="fa fa-internet-explorer"></span>
</div>
</div>
<div id="win10_btn_group_middle" class="btn_group"></div>
<div id="win10_btn_group_right" class="btn_group">
<div class="btn" id="win10_btn_time"></div>
<div class="btn" id="win10_btn_command">
<span id="win10-msg-nof" class="fa fa-comment-o"></span>
</div>
<div class="btn" id="win10_btn_show_desktop"></div>
</div>
</div>
</div>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
html {
height: 100%;
}
body {
padding: 0;
margin: 0;
height: 100%;
overflow: hidden;
}
#win10 *{
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
#win10-login{
background: black no-repeat fixed;
width: 100%;
height: 100%;
background-size: 100% 100%;
position: fixed;
z-index: -1;
top:0;
left:0;
}
#win10 {
width: 100%;
height: 100%;
background: black no-repeat fixed;
background-size: 100% 100%;
position: relative;
/*padding-top: 20px;*/
}
#win10 *{
scrollbar-arrow-color: #5e6a5c;); /*图6,三角箭头的颜色*/
scrollbar-face-color: #5e6a5c; /*图5,立体滚动条的颜色*/
scrollbar-3dlight-color: #5e6a5c; /*图1,立体滚动条亮边的颜色*/
scrollbar-highlight-color: #5e6a5c; /*图2,滚动条空白部分的颜色*/
scrollbar-shadow-color: #5e6a5c; /*图3,立体滚动条阴影的颜色*/
scrollbar-darkshadow-color: #5e6a5c; /*图4,立体滚动条强阴影的颜色*/
scrollbar-track-color: rgba(74, 84, 78, 0.41); /*图7,立体滚动条背景颜色*/
scrollbar-base-color:#5e6a5c; /*滚动条的基本颜色*/
}
#win10 hr { height:0px; border-top:1px solid #999; border-right:0px; border-bottom:0px; border-left:0px; }
#win10 .desktop {
width: 100%;
height: 100%;
}
#win10_task_bar {
width: 100%;
position: fixed;
bottom: 0;
height: 40px;
background-color: rgba(19, 23, 28, 0.9);
z-index: 19930813;
}
#win10 .btn_group {
height: 100%;
}
#win10 .btn_group .btn {
float: left;
color: white;
text-align: center;
line-height: 40px;
height: 100%;
text-overflow:ellipsis;
overflow: hidden;
transition: background-color 0.3s;
}
#win10 .btn_group .btn:hover {
background-color: rgba(106, 105, 100, 0.71);
cursor: pointer;
}
#win10_btn_group_left{
float: left;
overflow: auto;
max-width:200px;
}
#win10_btn_group_middle{
float: left;
width:calc(100% - 240px);
overflow: auto;
}
#win10_btn_group_middle .btn_close{
position: absolute;
right: 0;
width: 20px;
text-align: center;
color: transparent;
}
#win10_btn_group_middle .btn:hover .btn_close{
color: rgba(131, 168, 157, 0.71);
}
#win10_btn_group_middle .btn:hover .btn_close:hover{
color: white;
}
#win10_btn_group_middle .btn_title{
float: left;
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
text-align: left;
white-space: nowrap;
}
#win10_btn_group_middle::-webkit-scrollbar {
width: 2px;
}
#win10_btn_group_middle::-webkit-scrollbar-track {
background-color: #808080;
}
#win10_btn_group_middle::-webkit-scrollbar-thumb {
background-color: rgba(30, 39, 34, 0.41);
}
#win10_btn_group_right{
float: right;
max-width:200px;
overflow: auto;
}
#win10_btn_group_left .btn {
height: 100%;
width: 48px;
overflow: hidden;
font-size: 20px;
}
#win10_btn_group_right .btn {
height: 100%;
min-width: 4px;
padding: 0 10px;
font-size: 12px ;
}
#win10_btn_show_desktop {
border-left: grey 1px solid;
width: 4px;
margin-left: 3px;
padding: 0 !important
}
#win10_btn_time {
font-size: 12px;
line-height: 20px !important
}
#win10-menu {
position: fixed;
bottom: 41px;
background-color: rgba(19,23,28,0.81);
height: 60%;
width: 75%;
max-width: 880px;
overflow: auto;
padding-left:10px;
z-index: 1000;
overflow-y: hidden;
transition: bottom 0.5s ;
}
#win10-menu.hidden {
bottom:-70%;
}
#win10-menu .blocks::-webkit-scrollbar,.list::-webkit-scrollbar,#win10_command_center::-webkit-scrollbar {
width: 8px;
height: 8px;
}
#win10-menu .blocks::-webkit-scrollbar-track,.list::-webkit-scrollbar-track,#win10_command_center::-webkit-scrollbar-track {
background-color: rgba(74, 84, 78, 0.41);
}
#win10-menu .blocks::-webkit-scrollbar-thumb,.list::-webkit-scrollbar-thumb,#win10_command_center::-webkit-scrollbar-thumb {
background-color: #6a6a6a;
}
#win10-menu .blocks::-webkit-scrollbar-button ,.list::-webkit-scrollbar-button ,#win10_command_center::-webkit-scrollbar-button {
/*background-color: #6a6a6a;*/
}
#win10-menu .list,.blocks{
float: left;
width: 180px;
height:100%;
overflow: auto;
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
}
#win10-menu .list{
width:240px;
padding:0 10px;
padding-top: 5px;
font-size: 12px;
height: 100%;
}
#win10-menu .list .item.has-sub-down::after{
font: normal normal normal 14px/1 FontAwesome;
content:"\f107";
line-height: inherit;
float: right;
}
#win10-menu .list .item.has-sub-up::after{
font: normal normal normal 14px/1 FontAwesome;
content:"\f106";
line-height: inherit;
float: right;
}
#win10-menu .list .item,.sub-item{
color:white;
margin: 1px 0;
line-height: 40px;
padding: 0 10px;
text-overflow: ellipsis;
overflow: hidden;
transition: background-color 0.3s;
position: relative;
width: calc(100% - 20px);
}
#win10-menu .list .item>.icon,#win10-menu .list .sub-item>.icon,.sub-item>.icon{
line-height: 36px;
font-size: 22px;
float: left;
margin-right: 0.5em;
width: 36px;
position: relative;
top:2px;
background-color: grey;
}
#win10-menu .list .sub-item{
padding-left:30px;
width: calc(100% - 40px);
}
#win10-menu .list .item:hover,.sub-item:hover{
background-color: rgba(72,72,72,0.58);
cursor: pointer;
}
#win10-menu .blocks{
max-width: 650px;
width:calc(100% - 260px);
}
#win10-menu-switcher{
position: absolute;
height: 100%;
border-left: 1px solid grey;
top: 0;
right: 0;
display: none;
width: 30px;
cursor: pointer;
}
#win10-menu-switcher:active{
background-color: rgba(92, 109, 92, 0.81);
}
#win10-menu .menu_group {
float: left;
width: 300px;
color: white;
position: relative;
overflow: hidden;
margin-bottom: 20px;
}
#win10-menu .menu_group .title {
padding: 5px;
padding-top: 12px;
font-size: 13px;
}
#win10-menu .menu_group:hover .title::after{
font: normal normal normal 14px/1 FontAwesome;
content:"\f0c9";
line-height: inherit;
float: right;
margin-right: 17px;
color: grey;
}
#win10-menu .menu_group .block {
padding: 0;
background-color: transparent;
float: left;
box-sizing: border-box;
border: 2px solid transparent;
overflow: hidden;
position: absolute;
top: 40px;
left: 0;
cursor: default;
font-size: 16px;
}
#win10-menu .menu_group .block .content {
background-color: rgba(0, 196, 255, 0.55);
width: calc(100% + 4px);
height: calc(100% + 4px);
position: absolute;
left: -2px;top: -2px;
overflow: hidden;
transition: left 0.5s;
}
#win10-menu .menu_group .block:hover .content.cover{
left: calc(-100% - 4px);
}
#win10-menu .menu_group .block .content.detail{
left: calc(100% + 4px);
}
#win10-menu .menu_group .block:hover .content.detail{
left: -2px;
}
#win10-menu .menu_group .block:hover {
border: 2px solid white;
}
#win10 #win10-shortcuts {
height: calc(100% - 40px);
position: absolute;
left: 0;top: 0;
z-index: 100;
}
#win10 #win10-shortcuts.shortcuts-hidden .shortcut{display: none}
#win10 #win10-shortcuts .shortcut {
width: 80px;
overflow: hidden;
cursor: pointer;
padding: 0;
position: absolute;
transition: all 0.5s;
}
#win10 #win10-shortcuts .shortcut:hover {
background-color: rgba(255, 255, 255, 0.11);
}
#win10 #win10-shortcuts .shortcut>.icon {
width: 50px;
height: 50px;
overflow: hidden;
margin: 0 auto;
color: white;
box-sizing: border-box;
margin-bottom: 5px;
margin-top: 5px;
text-align: center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
display: block;
font-size: 37px;
line-height: 50px;
}
#win10-shortcuts .shortcut .title {
color: white;
font-size: 12px;
text-align: center;
line-height: 18px;
margin-bottom: 5px;
}
#win10_command_center {
position: fixed;
right: 0;
bottom: 41px;
width: 350px;
background-color: rgba(19,23,28,0.81);
height: calc(100% - 42px);
transition: all 0.5s;
overflow-x: hidden;
overflow-y: auto;
color: white;
box-sizing: border-box;
z-index: 1000;
}
#win10_command_center.hidden_right {
right: -350px;
}
#win10_command_center > .title{
position: absolute;
top: 0;
left: 0;
width: 100%;
padding-left: 10px;
transition: background-color 0.5s;
}
#win10_command_center > .title:hover{
background-color: rgba(255, 255, 255, 0.19);
}
#win10_btn_group_right #win10_btn_command{
font-size: 20px;
}
#win10_btn_command .msgNof{
position: fixed;
right: 0;
bottom: 20px;
border: 1px solid red;
background-color: red;
color: white;
border-radius: 3px;
}
#win10_btn_command_center_clean_all{
color: grey;
text-align: right;
font-size:12px;
float: right;
margin-top:40px;
margin-right:24px;
transition: color 0.5s;
}
#win10_btn_command_center_clean_all:hover{
cursor: pointer;
color:white;
}
#win10_command_center .msgs{
position: absolute;
top:60px;
left: 0;
width: 100%;
overflow: hidden;
/*padding: 10px;*/
}
#win10_command_center .btn_close_msg{
line-height: inherit;
transition: color 0.5s ;
}
#win10_command_center .msgs .msg{
width: calc(100% - 20px);
min-height: 40px;
padding:10px;
margin-top: 4px;
transition: background-color 0.5s;
position: relative;
}
#win10_command_center .msgs .msg.animated{
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
}
#win10_command_center .msgs .msg:hover{
cursor: default;
background-color: rgba(255, 255, 255, 0.19);
}
#win10_command_center .msgs .msg:hover .title{
color: white;
}
#win10_command_center .msgs .msg:hover>.btn_close_msg{
color: grey;
}
#win10_command_center .msgs .msg:hover>.content{
color: white;
}
#win10_command_center .msgs .msg>.title{
color: #c7c7c7;
font-size: 14px;
line-height: 28px;
}
#win10_command_center .msgs .msg>.btn_close_msg{
cursor: pointer;
color: transparent;
padding: 3px;
position: absolute;
top: 11px;
right: 11px;
}
#win10_command_center .msgs .msg>.btn_close_msg:hover{
color: white;
}
#win10_command_center .msgs .msg>.content{
font-size: 12px;
color: #9b9b9b;
padding-bottom: 5px;
}
#win10_btn_group_middle .btn{
float: left;
box-sizing: border-box;
height: inherit;
max-width: 140px;
border-bottom:4px solid #707070;
line-height: 40px;
color: white;
text-align: center;
font-size: 12px;
word-break: keep-all;
padding: 0 10px;
margin-right: 1px;
position: relative;
}
#win10_btn_group_middle .btn.active{
background-color: #3B3D3F;
}
#win10_btn_group_middle .btn:hover{
cursor: pointer;
}
.win10-open-iframe{
background-color: transparent;
border: 1px solid #323232;
}
.win10-open-iframe .layui-layer-content{
background-color: white;
max-height: calc(100% - 42px);
}
.win10-open-iframe .layui-layer-title{
box-sizing: border-box;
background-color: rgba(49, 49, 50, 0.94);
padding-right: 160px;
color: white;
}
.win10-open-iframe.hide{
display: none;
}
.win10-btn_refresh{
float: right;
}
#win10 .img-loader{
display: none;
}
.win10-btn-refresh>span,.win10-btn-change-url>span{
font-size: 16px !important;
color: rgb(255, 255, 255);
}
.win10-open-iframe .layui-layer-min cite{display: none;}
.win10-open-iframe .layui-layer-max:hover{background-image:none}
.win10-open-iframe .layui-layer-max,.layui-layer-maxmin{background:none}
.win10-open-iframe .layui-layer-setwin a.layui-layer-close1:hover{
background:red;
color: #fff ;
opacity: 1;
}
.win10-open-iframe .layui-layer-min::before{
content:"\f2d1";
color: white;
font: normal normal normal 14px/1 FontAwesome;
}
.win10-open-iframe .layui-layer-max::before{
content:"\f2d0";
color: white;
font: normal normal normal 14px/1 FontAwesome;
}
.win10-open-iframe .layui-layer-maxmin.layui-layer-max::before{
content:"\f2d2";
color: white;
font: normal normal normal 14px/1 FontAwesome;
}
.win10-open-iframe .layui-layer-close::before{
content:"\f2d3";
color: #fff;
font: normal normal normal 14px/1 FontAwesome;
}
.win10-open-iframe .layui-layer-min,.layui-layer-close,.layui-layer-max{
text-decoration: none;
}
.win10-layer-open-browser textarea{
margin: 20px;
outline: none;
resize: none;
}
/*右键菜单*/
#win10 .win10-context-menu { left: 0;top: 0;position: fixed; width: 150px; height: auto; background-color: rgb(255, 255, 255); border: #CCC 1px solid; display: block; border-radius: 5px; z-index: 99999999; }
#win10 .win10-context-menu ul { margin: 0px; padding: 0px; }
#win10 .win10-context-menu ul li {transition: background-color 0.5s;cursor: default;padding: 0px 1em; list-style: none; line-height: 30px; height: 30px; margin: 3px 0; font-size: 13px; }
#win10 .win10-context-menu ul li:hover { background-color: #DDD; }
#win10 .win10-context-menu ul li a {text-decoration: none; display: block; height: 100%; color: #333; outline: none; }
#win10 .win10-context-menu ul hr { margin: 0; height: 0px; border: 0px; border-bottom: rgb(233,233,233) 1px solid;border-top: none }
/*块级按钮*/
.win10-open-iframe .layui-layer-ico{background-image:none;}
.win10-open-iframe .layui-layer-setwin {
position: absolute;
right: 0px;
top: 0px;
font-size: 0;
line-height: 40px;
height: 40px;
}
.win10-open-iframe .layui-layer-setwin a {
position: relative;
width: 30px;
height: 40px;
font-size: 13px;
text-align: center;
overflow: hidden;
}
.win10-open-iframe .layui-layer-setwin a:hover {
background: #5d5d5d;
}
.win10-open-iframe .layui-layer-title .icon ,#win10_btn_group_middle .btn_title .icon{
font-size: 15px;
padding: 1px;
width: 20px;
height: 20px;
line-height: 20px;
display: inline-block;
border-radius: 3px;
text-align: center;
margin-right: 0.5em;
}
.win10-open-iframe .layui-layer-title img.icon,#win10_btn_group_middle .btn_title img.icon{
width: 20px;
position: relative;
top:5px ;
margin-right: 0.5em;
}
#win10-menu>.list>.sub-item img.icon,#win10-menu>.list>.item img.icon{
width: 36px;
height:36px;
position: relative;
top:2px ;
margin-right: 0.5em;
}
/*桌面舞台样式*/
#win10-desktop-scene{
width: 100%;
height: calc(100% - 40px);
position: absolute;
left: 0;
top: 0;
z-index: 0;
background-color: transparent;
}
/*各种颜色 具体效果见 https://www.kancloud.cn/qq85569256/xzui/350010*/
.win10-open-iframe .black-green, #win10 .black-green{background:#009688!important;}
.win10-open-iframe .green,#win10 .green{background:#5FB878!important;}
.win10-open-iframe .black,#win10 .black{background:#393D49!important;}
.win10-open-iframe .blue,#win10 .blue{background:#1E9FFF!important;}
.win10-open-iframe .orange,#win10 .orange{background:#F7B824!important;}
.win10-open-iframe .red,#win10 .red{background:#FF5722!important;}
.win10-open-iframe .dark,#win10 .dark{background:#2F4056!important;}
.win10-open-iframe .purple,#win10 .purple{background:#b074e6!important;}
@media screen and (max-width:768px){
#win10-menu{
width:calc(100% - 10px);
height: calc(100% - 42px);
}
#win10-menu.hidden{
bottom: -100% ;
}
#win10_command_center{
width: 100%;
}
#win10_command_center.hidden_right {
right: -100%;
}
.layui-layer-setwin .layui-layer-max{
display: none;
}
#win10_btn_group_left .btn {
height: 100%;
width: 40px;
overflow: hidden;
font-size: 16px;
}
#win10_btn_group_right .btn {
height: 100%;
min-width: 4px;
padding: 0 10px;
font-size: 16px!important;
}
#win10_btn_show_desktop {
border-left: grey 1px solid;
width: 30px;
margin-left: 3px;
padding: 0 !important
}
#win10_btn_group_left{
max-width:100px;
}
#win10_btn_group_middle{
width:calc(100% - 160px);
}
#win10_btn_group_middle .btn{
padding: 0 3px;
}
#win10_btn_group_right{
max-width:150px;
}
#win10-menu .list{
padding-left: 2px;
position: absolute;
width: calc(100% - 31px);
left: 0;
top: 0;
}
#win10-menu .blocks{
overflow-x: hidden;
position: absolute;
width:calc(100% - 31px);
left: 0;
top: 0;
}
#win10-menu .menu_group {
width: 90%;
float: none;
margin: 0 auto;
clear: both;
}
#win10_btn_time{display: none}
#win10-menu-switcher{
display: block;
}
#win10-menu>.win10-menu-hidden{
display: none;
}
#win10_btn_group_middle .btn_close{
display: none;
}
.win10-open-iframe .layui-layer-setwin a {
width: 32px;
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
@charset "UTF-8";
/*!
* animate.css -http://daneden.me/animate
* Version - 3.5.1
* Licensed under the MIT license - http://opensource.org/licenses/MIT
*
* Copyright (c) 2016 Daniel Eden
*/
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
.animated.flipOutX,
.animated.flipOutY,
.animated.bounceIn,
.animated.bounceOut {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
@-webkit-keyframes bounce {
from, 20%, 53%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
40%, 43% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
-webkit-transform: translate3d(0, -30px, 0);
transform: translate3d(0, -30px, 0);
}
70% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
-webkit-transform: translate3d(0, -15px, 0);
transform: translate3d(0, -15px, 0);
}
90% {
-webkit-transform: translate3d(0,-4px,0);
transform: translate3d(0,-4px,0);
}
}
@keyframes bounce {
from, 20%, 53%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
40%, 43% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
-webkit-transform: translate3d(0, -30px, 0);
transform: translate3d(0, -30px, 0);
}
70% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
-webkit-transform: translate3d(0, -15px, 0);
transform: translate3d(0, -15px, 0);
}
90% {
-webkit-transform: translate3d(0,-4px,0);
transform: translate3d(0,-4px,0);
}
}
.bounce {
-webkit-animation-name: bounce;
animation-name: bounce;
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
}
@-webkit-keyframes flash {
from, 50%, to {
opacity: 1;
}
25%, 75% {
opacity: 0;
}
}
@keyframes flash {
from, 50%, to {
opacity: 1;
}
25%, 75% {
opacity: 0;
}
}
.flash {
-webkit-animation-name: flash;
animation-name: flash;
}
/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
@-webkit-keyframes pulse {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes pulse {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.pulse {
-webkit-animation-name: pulse;
animation-name: pulse;
}
@-webkit-keyframes rubberBand {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
30% {
-webkit-transform: scale3d(1.25, 0.75, 1);
transform: scale3d(1.25, 0.75, 1);
}
40% {
-webkit-transform: scale3d(0.75, 1.25, 1);
transform: scale3d(0.75, 1.25, 1);
}
50% {
-webkit-transform: scale3d(1.15, 0.85, 1);
transform: scale3d(1.15, 0.85, 1);
}
65% {
-webkit-transform: scale3d(.95, 1.05, 1);
transform: scale3d(.95, 1.05, 1);
}
75% {
-webkit-transform: scale3d(1.05, .95, 1);
transform: scale3d(1.05, .95, 1);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes rubberBand {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
30% {
-webkit-transform: scale3d(1.25, 0.75, 1);
transform: scale3d(1.25, 0.75, 1);
}
40% {
-webkit-transform: scale3d(0.75, 1.25, 1);
transform: scale3d(0.75, 1.25, 1);
}
50% {
-webkit-transform: scale3d(1.15, 0.85, 1);
transform: scale3d(1.15, 0.85, 1);
}
65% {
-webkit-transform: scale3d(.95, 1.05, 1);
transform: scale3d(.95, 1.05, 1);
}
75% {
-webkit-transform: scale3d(1.05, .95, 1);
transform: scale3d(1.05, .95, 1);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.rubberBand {
-webkit-animation-name: rubberBand;
animation-name: rubberBand;
}
@-webkit-keyframes shake {
from, to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%, 40%, 60%, 80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
@keyframes shake {
from, to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%, 40%, 60%, 80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
.shake {
-webkit-animation-name: shake;
animation-name: shake;
}
@-webkit-keyframes headShake {
0% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
6.5% {
-webkit-transform: translateX(-6px) rotateY(-9deg);
transform: translateX(-6px) rotateY(-9deg);
}
18.5% {
-webkit-transform: translateX(5px) rotateY(7deg);
transform: translateX(5px) rotateY(7deg);
}
31.5% {
-webkit-transform: translateX(-3px) rotateY(-5deg);
transform: translateX(-3px) rotateY(-5deg);
}
43.5% {
-webkit-transform: translateX(2px) rotateY(3deg);
transform: translateX(2px) rotateY(3deg);
}
50% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
}
@keyframes headShake {
0% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
6.5% {
-webkit-transform: translateX(-6px) rotateY(-9deg);
transform: translateX(-6px) rotateY(-9deg);
}
18.5% {
-webkit-transform: translateX(5px) rotateY(7deg);
transform: translateX(5px) rotateY(7deg);
}
31.5% {
-webkit-transform: translateX(-3px) rotateY(-5deg);
transform: translateX(-3px) rotateY(-5deg);
}
43.5% {
-webkit-transform: translateX(2px) rotateY(3deg);
transform: translateX(2px) rotateY(3deg);
}
50% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
}
.headShake {
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-name: headShake;
animation-name: headShake;
}
@-webkit-keyframes swing {
20% {
-webkit-transform: rotate3d(0, 0, 1, 15deg);
transform: rotate3d(0, 0, 1, 15deg);
}
40% {
-webkit-transform: rotate3d(0, 0, 1, -10deg);
transform: rotate3d(0, 0, 1, -10deg);
}
60% {
-webkit-transform: rotate3d(0, 0, 1, 5deg);
transform: rotate3d(0, 0, 1, 5deg);
}
80% {
-webkit-transform: rotate3d(0, 0, 1, -5deg);
transform: rotate3d(0, 0, 1, -5deg);
}
to {
-webkit-transform: rotate3d(0, 0, 1, 0deg);
transform: rotate3d(0, 0, 1, 0deg);
}
}
@keyframes swing {
20% {
-webkit-transform: rotate3d(0, 0, 1, 15deg);
transform: rotate3d(0, 0, 1, 15deg);
}
40% {
-webkit-transform: rotate3d(0, 0, 1, -10deg);
transform: rotate3d(0, 0, 1, -10deg);
}
60% {
-webkit-transform: rotate3d(0, 0, 1, 5deg);
transform: rotate3d(0, 0, 1, 5deg);
}
80% {
-webkit-transform: rotate3d(0, 0, 1, -5deg);
transform: rotate3d(0, 0, 1, -5deg);
}
to {
-webkit-transform: rotate3d(0, 0, 1, 0deg);
transform: rotate3d(0, 0, 1, 0deg);
}
}
.swing {
-webkit-transform-origin: top center;
transform-origin: top center;
-webkit-animation-name: swing;
animation-name: swing;
}
@-webkit-keyframes tada {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
10%, 20% {
-webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
}
30%, 50%, 70%, 90% {
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
40%, 60%, 80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes tada {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
10%, 20% {
-webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
}
30%, 50%, 70%, 90% {
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
40%, 60%, 80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.tada {
-webkit-animation-name: tada;
animation-name: tada;
}
/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
@-webkit-keyframes wobble {
from {
-webkit-transform: none;
transform: none;
}
15% {
-webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
}
30% {
-webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
}
45% {
-webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
}
60% {
-webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
}
75% {
-webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
}
to {
-webkit-transform: none;
transform: none;
}
}
@keyframes wobble {
from {
-webkit-transform: none;
transform: none;
}
15% {
-webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
}
30% {
-webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
}
45% {
-webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
}
60% {
-webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
}
75% {
-webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
}
to {
-webkit-transform: none;
transform: none;
}
}
.wobble {
-webkit-animation-name: wobble;
animation-name: wobble;
}
@-webkit-keyframes jello {
from, 11.1%, to {
-webkit-transform: none;
transform: none;
}
22.2% {
-webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
transform: skewX(-12.5deg) skewY(-12.5deg);
}
33.3% {
-webkit-transform: skewX(6.25deg) skewY(6.25deg);
transform: skewX(6.25deg) skewY(6.25deg);
}
44.4% {
-webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
transform: skewX(-3.125deg) skewY(-3.125deg);
}
55.5% {
-webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
transform: skewX(1.5625deg) skewY(1.5625deg);
}
66.6% {
-webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);
transform: skewX(-0.78125deg) skewY(-0.78125deg);
}
77.7% {
-webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
transform: skewX(0.390625deg) skewY(0.390625deg);
}
88.8% {
-webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
}
}
@keyframes jello {
from, 11.1%, to {
-webkit-transform: none;
transform: none;
}
22.2% {
-webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
transform: skewX(-12.5deg) skewY(-12.5deg);
}
33.3% {
-webkit-transform: skewX(6.25deg) skewY(6.25deg);
transform: skewX(6.25deg) skewY(6.25deg);
}
44.4% {
-webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
transform: skewX(-3.125deg) skewY(-3.125deg);
}
55.5% {
-webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
transform: skewX(1.5625deg) skewY(1.5625deg);
}
66.6% {
-webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);
transform: skewX(-0.78125deg) skewY(-0.78125deg);
}
77.7% {
-webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
transform: skewX(0.390625deg) skewY(0.390625deg);
}
88.8% {
-webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
}
}
.jello {
-webkit-animation-name: jello;
animation-name: jello;
-webkit-transform-origin: center;
transform-origin: center;
}
@-webkit-keyframes bounceIn {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes bounceIn {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.bounceIn {
-webkit-animation-name: bounceIn;
animation-name: bounceIn;
}
@-webkit-keyframes bounceInDown {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: translate3d(0, -3000px, 0);
transform: translate3d(0, -3000px, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, 25px, 0);
transform: translate3d(0, 25px, 0);
}
75% {
-webkit-transform: translate3d(0, -10px, 0);
transform: translate3d(0, -10px, 0);
}
90% {
-webkit-transform: translate3d(0, 5px, 0);
transform: translate3d(0, 5px, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
@keyframes bounceInDown {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: translate3d(0, -3000px, 0);
transform: translate3d(0, -3000px, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, 25px, 0);
transform: translate3d(0, 25px, 0);
}
75% {
-webkit-transform: translate3d(0, -10px, 0);
transform: translate3d(0, -10px, 0);
}
90% {
-webkit-transform: translate3d(0, 5px, 0);
transform: translate3d(0, 5px, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
.bounceInDown {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
}
@-webkit-keyframes bounceInLeft {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: translate3d(-3000px, 0, 0);
transform: translate3d(-3000px, 0, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(25px, 0, 0);
transform: translate3d(25px, 0, 0);
}
75% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
90% {
-webkit-transform: translate3d(5px, 0, 0);
transform: translate3d(5px, 0, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
@keyframes bounceInLeft {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: translate3d(-3000px, 0, 0);
transform: translate3d(-3000px, 0, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(25px, 0, 0);
transform: translate3d(25px, 0, 0);
}
75% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
90% {
-webkit-transform: translate3d(5px, 0, 0);
transform: translate3d(5px, 0, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
.bounceInLeft {
-webkit-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
@-webkit-keyframes bounceInRight {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
from {
opacity: 0;
-webkit-transform: translate3d(3000px, 0, 0);
transform: translate3d(3000px, 0, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(-25px, 0, 0);
transform: translate3d(-25px, 0, 0);
}
75% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
90% {
-webkit-transform: translate3d(-5px, 0, 0);
transform: translate3d(-5px, 0, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
@keyframes bounceInRight {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
from {
opacity: 0;
-webkit-transform: translate3d(3000px, 0, 0);
transform: translate3d(3000px, 0, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(-25px, 0, 0);
transform: translate3d(-25px, 0, 0);
}
75% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
90% {
-webkit-transform: translate3d(-5px, 0, 0);
transform: translate3d(-5px, 0, 0);
}
to {
-webkit-transform: none;
transform: none;
}
}
.bounceInRight {
-webkit-animation-name: bounceInRight;
animation-name: bounceInRight;
}
@-webkit-keyframes bounceInUp {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
from {
opacity: 0;
-webkit-transform: translate3d(0, 3000px, 0);
transform: translate3d(0, 3000px, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
75% {
-webkit-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0);
}
90% {
-webkit-transform: translate3d(0, -5px, 0);
transform: translate3d(0, -5px, 0);
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes bounceInUp {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
from {
opacity: 0;
-webkit-transform: translate3d(0, 3000px, 0);
transform: translate3d(0, 3000px, 0);
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
75% {
-webkit-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0);
}
90% {
-webkit-transform: translate3d(0, -5px, 0);
transform: translate3d(0, -5px, 0);
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.bounceInUp {
-webkit-animation-name: bounceInUp;
animation-name: bounceInUp;
}
@-webkit-keyframes bounceOut {
20% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
50%, 55% {
opacity: 1;
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
}
@keyframes bounceOut {
20% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
50%, 55% {
opacity: 1;
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
}
.bounceOut {
-webkit-animation-name: bounceOut;
animation-name: bounceOut;
}
@-webkit-keyframes bounceOutDown {
20% {
-webkit-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0);
}
40%, 45% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
}
@keyframes bounceOutDown {
20% {
-webkit-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0);
}
40%, 45% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
}
.bounceOutDown {
-webkit-animation-name: bounceOutDown;
animation-name: bounceOutDown;
}
@-webkit-keyframes bounceOutLeft {
20% {
opacity: 1;
-webkit-transform: translate3d(20px, 0, 0);
transform: translate3d(20px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
}
@keyframes bounceOutLeft {
20% {
opacity: 1;
-webkit-transform: translate3d(20px, 0, 0);
transform: translate3d(20px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
}
.bounceOutLeft {
-webkit-animation-name: bounceOutLeft;
animation-name: bounceOutLeft;
}
@-webkit-keyframes bounceOutRight {
20% {
opacity: 1;
-webkit-transform: translate3d(-20px, 0, 0);
transform: translate3d(-20px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
}
@keyframes bounceOutRight {
20% {
opacity: 1;
-webkit-transform: translate3d(-20px, 0, 0);
transform: translate3d(-20px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
}
.bounceOutRight {
-webkit-animation-name: bounceOutRight;
animation-name: bounceOutRight;
}
@-webkit-keyframes bounceOutUp {
20% {
-webkit-transform: translate3d(0, -10px, 0);
transform: translate3d(0, -10px, 0);
}
40%, 45% {
opacity: 1;
-webkit-transform: translate3d(0, 20px, 0);
transform: translate3d(0, 20px, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
}
@keyframes bounceOutUp {
20% {
-webkit-transform: translate3d(0, -10px, 0);
transform: translate3d(0, -10px, 0);
}
40%, 45% {
opacity: 1;
-webkit-transform: translate3d(0, 20px, 0);
transform: translate3d(0, 20px, 0);
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
}
.bounceOutUp {
-webkit-animation-name: bounceOutUp;
animation-name: bounceOutUp;
}
@-webkit-keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fadeIn {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
@-webkit-keyframes fadeInDown {
from {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInDown {
from {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInDown {
-webkit-animation-name: fadeInDown;
animation-name: fadeInDown;
}
@-webkit-keyframes fadeInDownBig {
from {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInDownBig {
from {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInDownBig {
-webkit-animation-name: fadeInDownBig;
animation-name: fadeInDownBig;
}
@-webkit-keyframes fadeInLeft {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInLeft {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInLeft {
-webkit-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
@-webkit-keyframes fadeInLeftBig {
from {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInLeftBig {
from {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInLeftBig {
-webkit-animation-name: fadeInLeftBig;
animation-name: fadeInLeftBig;
}
@-webkit-keyframes fadeInRight {
from {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInRight {
from {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInRight {
-webkit-animation-name: fadeInRight;
animation-name: fadeInRight;
}
@-webkit-keyframes fadeInRightBig {
from {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInRightBig {
from {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInRightBig {
-webkit-animation-name: fadeInRightBig;
animation-name: fadeInRightBig;
}
@-webkit-keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
@-webkit-keyframes fadeInUpBig {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInUpBig {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInUpBig {
-webkit-animation-name: fadeInUpBig;
animation-name: fadeInUpBig;
}
@-webkit-keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.fadeOut {
-webkit-animation-name: fadeOut;
animation-name: fadeOut;
}
@-webkit-keyframes fadeOutDown {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
@keyframes fadeOutDown {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
.fadeOutDown {
-webkit-animation-name: fadeOutDown;
animation-name: fadeOutDown;
}
@-webkit-keyframes fadeOutDownBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
}
@keyframes fadeOutDownBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, 2000px, 0);
transform: translate3d(0, 2000px, 0);
}
}
.fadeOutDownBig {
-webkit-animation-name: fadeOutDownBig;
animation-name: fadeOutDownBig;
}
@-webkit-keyframes fadeOutLeft {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
@keyframes fadeOutLeft {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
.fadeOutLeft {
-webkit-animation-name: fadeOutLeft;
animation-name: fadeOutLeft;
}
@-webkit-keyframes fadeOutLeftBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
}
@keyframes fadeOutLeftBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(-2000px, 0, 0);
transform: translate3d(-2000px, 0, 0);
}
}
.fadeOutLeftBig {
-webkit-animation-name: fadeOutLeftBig;
animation-name: fadeOutLeftBig;
}
@-webkit-keyframes fadeOutRight {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
}
@keyframes fadeOutRight {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
}
.fadeOutRight {
-webkit-animation-name: fadeOutRight;
animation-name: fadeOutRight;
}
@-webkit-keyframes fadeOutRightBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
}
@keyframes fadeOutRightBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(2000px, 0, 0);
transform: translate3d(2000px, 0, 0);
}
}
.fadeOutRightBig {
-webkit-animation-name: fadeOutRightBig;
animation-name: fadeOutRightBig;
}
@-webkit-keyframes fadeOutUp {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
@keyframes fadeOutUp {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
.fadeOutUp {
-webkit-animation-name: fadeOutUp;
animation-name: fadeOutUp;
}
@-webkit-keyframes fadeOutUpBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
}
@keyframes fadeOutUpBig {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(0, -2000px, 0);
transform: translate3d(0, -2000px, 0);
}
}
.fadeOutUpBig {
-webkit-animation-name: fadeOutUpBig;
animation-name: fadeOutUpBig;
}
@-webkit-keyframes flip {
from {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
40% {
-webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
50% {
-webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
80% {
-webkit-transform: perspective(400px) scale3d(.95, .95, .95);
transform: perspective(400px) scale3d(.95, .95, .95);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
}
@keyframes flip {
from {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
40% {
-webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
50% {
-webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
80% {
-webkit-transform: perspective(400px) scale3d(.95, .95, .95);
transform: perspective(400px) scale3d(.95, .95, .95);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
}
.animated.flip {
-webkit-backface-visibility: visible;
backface-visibility: visible;
-webkit-animation-name: flip;
animation-name: flip;
}
@-webkit-keyframes flipInX {
from {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
}
@keyframes flipInX {
from {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
}
.flipInX {
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
-webkit-animation-name: flipInX;
animation-name: flipInX;
}
@-webkit-keyframes flipInY {
from {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
}
@keyframes flipInY {
from {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
}
to {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
}
.flipInY {
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
-webkit-animation-name: flipInY;
animation-name: flipInY;
}
@-webkit-keyframes flipOutX {
from {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
opacity: 1;
}
to {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
opacity: 0;
}
}
@keyframes flipOutX {
from {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
opacity: 1;
}
to {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
opacity: 0;
}
}
.flipOutX {
-webkit-animation-name: flipOutX;
animation-name: flipOutX;
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
}
@-webkit-keyframes flipOutY {
from {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);
transform: perspective(400px) rotate3d(0, 1, 0, -15deg);
opacity: 1;
}
to {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
opacity: 0;
}
}
@keyframes flipOutY {
from {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);
transform: perspective(400px) rotate3d(0, 1, 0, -15deg);
opacity: 1;
}
to {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
opacity: 0;
}
}
.flipOutY {
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
-webkit-animation-name: flipOutY;
animation-name: flipOutY;
}
@-webkit-keyframes lightSpeedIn {
from {
-webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);
transform: translate3d(100%, 0, 0) skewX(-30deg);
opacity: 0;
}
60% {
-webkit-transform: skewX(20deg);
transform: skewX(20deg);
opacity: 1;
}
80% {
-webkit-transform: skewX(-5deg);
transform: skewX(-5deg);
opacity: 1;
}
to {
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes lightSpeedIn {
from {
-webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);
transform: translate3d(100%, 0, 0) skewX(-30deg);
opacity: 0;
}
60% {
-webkit-transform: skewX(20deg);
transform: skewX(20deg);
opacity: 1;
}
80% {
-webkit-transform: skewX(-5deg);
transform: skewX(-5deg);
opacity: 1;
}
to {
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.lightSpeedIn {
-webkit-animation-name: lightSpeedIn;
animation-name: lightSpeedIn;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
@-webkit-keyframes lightSpeedOut {
from {
opacity: 1;
}
to {
-webkit-transform: translate3d(100%, 0, 0) skewX(30deg);
transform: translate3d(100%, 0, 0) skewX(30deg);
opacity: 0;
}
}
@keyframes lightSpeedOut {
from {
opacity: 1;
}
to {
-webkit-transform: translate3d(100%, 0, 0) skewX(30deg);
transform: translate3d(100%, 0, 0) skewX(30deg);
opacity: 0;
}
}
.lightSpeedOut {
-webkit-animation-name: lightSpeedOut;
animation-name: lightSpeedOut;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
@-webkit-keyframes rotateIn {
from {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: rotate3d(0, 0, 1, -200deg);
transform: rotate3d(0, 0, 1, -200deg);
opacity: 0;
}
to {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes rotateIn {
from {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: rotate3d(0, 0, 1, -200deg);
transform: rotate3d(0, 0, 1, -200deg);
opacity: 0;
}
to {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.rotateIn {
-webkit-animation-name: rotateIn;
animation-name: rotateIn;
}
@-webkit-keyframes rotateInDownLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes rotateInDownLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.rotateInDownLeft {
-webkit-animation-name: rotateInDownLeft;
animation-name: rotateInDownLeft;
}
@-webkit-keyframes rotateInDownRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes rotateInDownRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.rotateInDownRight {
-webkit-animation-name: rotateInDownRight;
animation-name: rotateInDownRight;
}
@-webkit-keyframes rotateInUpLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes rotateInUpLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.rotateInUpLeft {
-webkit-animation-name: rotateInUpLeft;
animation-name: rotateInUpLeft;
}
@-webkit-keyframes rotateInUpRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, -90deg);
transform: rotate3d(0, 0, 1, -90deg);
opacity: 0;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
@keyframes rotateInUpRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, -90deg);
transform: rotate3d(0, 0, 1, -90deg);
opacity: 0;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: none;
transform: none;
opacity: 1;
}
}
.rotateInUpRight {
-webkit-animation-name: rotateInUpRight;
animation-name: rotateInUpRight;
}
@-webkit-keyframes rotateOut {
from {
-webkit-transform-origin: center;
transform-origin: center;
opacity: 1;
}
to {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: rotate3d(0, 0, 1, 200deg);
transform: rotate3d(0, 0, 1, 200deg);
opacity: 0;
}
}
@keyframes rotateOut {
from {
-webkit-transform-origin: center;
transform-origin: center;
opacity: 1;
}
to {
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transform: rotate3d(0, 0, 1, 200deg);
transform: rotate3d(0, 0, 1, 200deg);
opacity: 0;
}
}
.rotateOut {
-webkit-animation-name: rotateOut;
animation-name: rotateOut;
}
@-webkit-keyframes rotateOutDownLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
opacity: 1;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
}
@keyframes rotateOutDownLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
opacity: 1;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
opacity: 0;
}
}
.rotateOutDownLeft {
-webkit-animation-name: rotateOutDownLeft;
animation-name: rotateOutDownLeft;
}
@-webkit-keyframes rotateOutDownRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
opacity: 1;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
}
@keyframes rotateOutDownRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
opacity: 1;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
}
.rotateOutDownRight {
-webkit-animation-name: rotateOutDownRight;
animation-name: rotateOutDownRight;
}
@-webkit-keyframes rotateOutUpLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
opacity: 1;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
}
@keyframes rotateOutUpLeft {
from {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
opacity: 1;
}
to {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
opacity: 0;
}
}
.rotateOutUpLeft {
-webkit-animation-name: rotateOutUpLeft;
animation-name: rotateOutUpLeft;
}
@-webkit-keyframes rotateOutUpRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
opacity: 1;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, 90deg);
transform: rotate3d(0, 0, 1, 90deg);
opacity: 0;
}
}
@keyframes rotateOutUpRight {
from {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
opacity: 1;
}
to {
-webkit-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate3d(0, 0, 1, 90deg);
transform: rotate3d(0, 0, 1, 90deg);
opacity: 0;
}
}
.rotateOutUpRight {
-webkit-animation-name: rotateOutUpRight;
animation-name: rotateOutUpRight;
}
@-webkit-keyframes hinge {
0% {
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
20%, 60% {
-webkit-transform: rotate3d(0, 0, 1, 80deg);
transform: rotate3d(0, 0, 1, 80deg);
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
40%, 80% {
-webkit-transform: rotate3d(0, 0, 1, 60deg);
transform: rotate3d(0, 0, 1, 60deg);
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
opacity: 1;
}
to {
-webkit-transform: translate3d(0, 700px, 0);
transform: translate3d(0, 700px, 0);
opacity: 0;
}
}
@keyframes hinge {
0% {
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
20%, 60% {
-webkit-transform: rotate3d(0, 0, 1, 80deg);
transform: rotate3d(0, 0, 1, 80deg);
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
40%, 80% {
-webkit-transform: rotate3d(0, 0, 1, 60deg);
transform: rotate3d(0, 0, 1, 60deg);
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
opacity: 1;
}
to {
-webkit-transform: translate3d(0, 700px, 0);
transform: translate3d(0, 700px, 0);
opacity: 0;
}
}
.hinge {
-webkit-animation-name: hinge;
animation-name: hinge;
}
/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
@-webkit-keyframes rollIn {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes rollIn {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.rollIn {
-webkit-animation-name: rollIn;
animation-name: rollIn;
}
/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
@-webkit-keyframes rollOut {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);
transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);
}
}
@keyframes rollOut {
from {
opacity: 1;
}
to {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);
transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);
}
}
.rollOut {
-webkit-animation-name: rollOut;
animation-name: rollOut;
}
@-webkit-keyframes zoomIn {
from {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
@keyframes zoomIn {
from {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
.zoomIn {
-webkit-animation-name: zoomIn;
animation-name: zoomIn;
}
@-webkit-keyframes zoomInDown {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomInDown {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomInDown {
-webkit-animation-name: zoomInDown;
animation-name: zoomInDown;
}
@-webkit-keyframes zoomInLeft {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0);
transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomInLeft {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0);
transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomInLeft {
-webkit-animation-name: zoomInLeft;
animation-name: zoomInLeft;
}
@-webkit-keyframes zoomInRight {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0);
transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomInRight {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0);
transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomInRight {
-webkit-animation-name: zoomInRight;
animation-name: zoomInRight;
}
@-webkit-keyframes zoomInUp {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomInUp {
from {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
60% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomInUp {
-webkit-animation-name: zoomInUp;
animation-name: zoomInUp;
}
@-webkit-keyframes zoomOut {
from {
opacity: 1;
}
50% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
to {
opacity: 0;
}
}
@keyframes zoomOut {
from {
opacity: 1;
}
50% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
to {
opacity: 0;
}
}
.zoomOut {
-webkit-animation-name: zoomOut;
animation-name: zoomOut;
}
@-webkit-keyframes zoomOutDown {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
to {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0);
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomOutDown {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
to {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0);
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomOutDown {
-webkit-animation-name: zoomOutDown;
animation-name: zoomOutDown;
}
@-webkit-keyframes zoomOutLeft {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: scale(.1) translate3d(-2000px, 0, 0);
transform: scale(.1) translate3d(-2000px, 0, 0);
-webkit-transform-origin: left center;
transform-origin: left center;
}
}
@keyframes zoomOutLeft {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: scale(.1) translate3d(-2000px, 0, 0);
transform: scale(.1) translate3d(-2000px, 0, 0);
-webkit-transform-origin: left center;
transform-origin: left center;
}
}
.zoomOutLeft {
-webkit-animation-name: zoomOutLeft;
animation-name: zoomOutLeft;
}
@-webkit-keyframes zoomOutRight {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: scale(.1) translate3d(2000px, 0, 0);
transform: scale(.1) translate3d(2000px, 0, 0);
-webkit-transform-origin: right center;
transform-origin: right center;
}
}
@keyframes zoomOutRight {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0);
transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0);
}
to {
opacity: 0;
-webkit-transform: scale(.1) translate3d(2000px, 0, 0);
transform: scale(.1) translate3d(2000px, 0, 0);
-webkit-transform-origin: right center;
transform-origin: right center;
}
}
.zoomOutRight {
-webkit-animation-name: zoomOutRight;
animation-name: zoomOutRight;
}
@-webkit-keyframes zoomOutUp {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
to {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0);
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
@keyframes zoomOutUp {
40% {
opacity: 1;
-webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0);
-webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
to {
opacity: 0;
-webkit-transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0);
transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0);
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
}
.zoomOutUp {
-webkit-animation-name: zoomOutUp;
animation-name: zoomOutUp;
}
@-webkit-keyframes slideInDown {
from {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInDown {
from {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.slideInDown {
-webkit-animation-name: slideInDown;
animation-name: slideInDown;
}
@-webkit-keyframes slideInLeft {
from {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInLeft {
from {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.slideInLeft {
-webkit-animation-name: slideInLeft;
animation-name: slideInLeft;
}
@-webkit-keyframes slideInRight {
from {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInRight {
from {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.slideInRight {
-webkit-animation-name: slideInRight;
animation-name: slideInRight;
}
@-webkit-keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.slideInUp {
-webkit-animation-name: slideInUp;
animation-name: slideInUp;
}
@-webkit-keyframes slideOutDown {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
@keyframes slideOutDown {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
.slideOutDown {
-webkit-animation-name: slideOutDown;
animation-name: slideOutDown;
}
@-webkit-keyframes slideOutLeft {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
@keyframes slideOutLeft {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
.slideOutLeft {
-webkit-animation-name: slideOutLeft;
animation-name: slideOutLeft;
}
@-webkit-keyframes slideOutRight {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
}
@keyframes slideOutRight {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
}
.slideOutRight {
-webkit-animation-name: slideOutRight;
animation-name: slideOutRight;
}
@-webkit-keyframes slideOutUp {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
@keyframes slideOutUp {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
.slideOutUp {
-webkit-animation-name: slideOutUp;
animation-name: slideOutUp;
}
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>主题切换</title>
<link href="theme_switcher.css" rel="stylesheet">
<script type="text/javascript" src="../../js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="../../js/win10.child.js"></script>
<script type="text/javascript" src="./theme_switcher.js"></script>
</head>
<body>
<!--主题设置-->
<div id="theme_body">
<div id="theme_area" class="theme_area">
<!--主题图片-->
<!--<div id="btn-upload" class="theme_upload">-->
<!--<div class="theme_icon" style="background-image: url(./bg/uploadbg.png);background-size:100% 100%;">-->
<!--<form action="#" method="post" enctype="multipart/form-data">-->
<!--<input style="opacity: 0;display: block;width:100%;height:100px;" type="file">-->
<!--<input type="submit" class="theme_text" value="自定义上传">-->
<!--</form>-->
<!--</div>-->
<!--</div>-->
</div>
<div class="h10"></div>
</div>
<div class="clear"></div>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/*themesetting*/
#theme_body {
}
.theme_area {
z-index: 999;
padding: 10px 0 0 10px;
}
.theme_area a {
color: #333;
text-decoration: none;
}
div.wallpaper_settingButton, a.theme_setting, div.theme_upload {
display: inline;
float: left;
margin: 5px 8px 5px 8px;
width: 180px;
height: 140px;
cursor: pointer;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px
}
a.theme_setting {
background: #cbe7fc;
transition: all 0.5s;
}
a.theme_setting:hover {
background: #75c1f9
}
div.themeSetting_hover {
background: #75c1f9
}
div.theme_select, a.theme_select {
background: #75c1f9
}
.theme_icon {
margin: 5px auto;
padding-top: 3px;
width: 140px;
height: 100px;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
text-align: center;
}
.theme_icon img{
width: 140px;
height: 100px;
}
.theme_text {
margin: 5px 0 0 0;
text-align: center;
font-size: 12px;
text-decoration: none;
}
.theme_text a {
text-decoration: none;
}
.theme_text a:link {
text-decoration: none;
}
div.theme_upload {
background: #e9e9e9;
transition: all 0.5s;
}
div.theme_upload:hover{
background: #75c1f9
}
.clear {
clear: both;
}
.h10 {
clear: both;
height: 10px;
}
/*end*/ | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
$(function () {
//此处预定义了背景数据,其实可以用ajax获取
var themes = [
{
"pic": "./plugins/theme_switcher/bg/bg1.jpg",
"thumb": "./bg/bg1_small.jpg",
"title": "win10"
},
{
"pic": "./plugins/theme_switcher/bg/bg2.jpg",
"thumb": "./bg/bg2_small.jpg",
"title": "梦幻光影"
},
{
"pic": "./plugins/theme_switcher/bg/bg3.jpg",
"thumb": "./bg/bg3_small.jpg",
"title": "扬帆起航"
},
{
"pic": "./plugins/theme_switcher/bg/bg4.jpg",
"thumb": "./bg/bg4_small.jpg",
"title": "乡土气息"
},
{
"pic": "./plugins/theme_switcher/bg/bg5.jpg",
"thumb": "./bg/bg5_small.jpg",
"title": "绿色清新"
},
{
"pic": "./plugins/theme_switcher/bg/bg6.jpg",
"thumb": "./bg/bg6_small.jpg",
"title": "Win8"
},
{
"pic": "./plugins/theme_switcher/bg/bg7.jpg",
"thumb": "./bg/bg7_small.jpg",
"title": "蓝色海岸"
},
{
"pic": "./plugins/theme_switcher/bg/bg8.jpg",
"thumb": "./bg/bg8_small.jpg",
"title": "冰天雪地"
},
{
"pic": "./plugins/theme_switcher/bg/bg9.jpg",
"thumb": "./bg/bg9_small.jpg",
"title": "繁花满树"
},
{
"pic": "./plugins/theme_switcher/bg/bg10.jpg",
"thumb": "./bg/bg10_small.jpg",
"title": "精灵小鸟"
},
{
"pic": "./plugins/theme_switcher/bg/bg11.jpg",
"thumb": "./bg/bg11_small.jpg",
"title": "炫酷跑车"
},
{
"pic": "./plugins/theme_switcher/bg/bg12.jpg",
"thumb": "./bg/bg12_small.jpg",
"title": "中国风"
},
{
"pic": "./plugins/theme_switcher/bg/bg13.jpg",
"thumb": "./bg/bg13_small.jpg",
"title": "Winxp"
},
{
"pic": "./plugins/theme_switcher/bg/bg14.jpg",
"thumb": "./bg/bg14_small.jpg",
"title": "淡雅唯美"
},
{
"pic": "./plugins/theme_switcher/bg/bg15.jpg",
"thumb": "./bg/bg15_small.jpg",
"title": "Win7"
},
];
var theme_area=$("#theme_area");
theme_area.on('click','.theme_setting',function () {
var pic=$(this).data('pic');
Win10_parent.setBgUrl({main:pic});
//此处你也许想用ajax把修改信息保存到服务器。。。
});
themes.forEach(function (t) {
var theme=$("<a href=\"javascript:;\" data-pic=\""+t.pic+"\" class=\"theme_setting \">\n" +
" <div class=\"theme_icon\"><img src=\""+t.thumb+"\"></div>\n" +
" <div class=\"theme_text\">"+t.title+"</div>\n" +
" </a>");
theme_area.append(theme)
});
});
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/**
* 背景图片切换
* 创意:宝通
* 润色:Yuri2
* */
使用说明,将theme_switcher.html 作为子页
比如放在桌面图标或者开始菜单中
桌面图标的例子:
<div class="shortcut win10-open-window" data-url="./plugins/theme_switcher/theme_switcher.html">
<i class="icon fa fa-fw fa-picture-o blue" ></i>
<div class="title">切换壁纸</div>
</div>
目录结构
win10-ui
-plugins
-theme_switcher
-css,js,html.....
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/**
* Created by Yuri2 on 2017/7/10.
*/
window.Win10 = {
_version: 'v1.1.2.3',
_debug: true,
_bgs: {
main: '',
mobile: '',
},
_countTask: 0,
_newMsgCount: 0,
_animated_classes: [],
_animated_liveness: 0,
_switchMenuTooHurry: false,
_lang: 'unknown',
_iframeOnClick: {
resolution: 200,
iframes: [],
interval: null,
Iframe: function() {
this.element = arguments[0];
this.cb = arguments[1];
this.hasTracked = false;
},
track: function(element, cb) {
this.iframes.push(new this.Iframe(element, cb));
if(!this.interval) {
var _this = this;
this.interval = setInterval(function() {
_this.checkClick();
}, this.resolution);
}
},
checkClick: function() {
if(document.activeElement) {
var activeElement = document.activeElement;
for(var i in this.iframes) {
var eid = undefined;
if((eid = this.iframes[i].element.id) && !document.getElementById(eid)) {
delete this.iframes[i];
continue;
}
if(activeElement === this.iframes[i].element) { // user is in this Iframe
if(this.iframes[i].hasTracked === false) {
this.iframes[i].cb.apply(window, []);
this.iframes[i].hasTracked = true;
}
} else {
this.iframes[i].hasTracked = false;
}
}
}
}
},
_iframe_click_lock_children: {},
_renderBar: function() {
//调整任务栏项目的宽度
if(this._countTask <= 0) {
return;
} //防止除以0
var btns = $("#win10_btn_group_middle>.btn");
btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )'))
},
_handleReady: [],
_hideShortcut: function() {
var that = $("#win10 #win10-shortcuts .shortcut");
that.removeClass('animated flipInX');
that.addClass('animated flipOutX');
},
_showShortcut: function() {
var that = $("#win10 #win10-shortcuts .shortcut");
that.removeClass('animated flipOutX');
that.addClass('animated flipInX');
},
_checkBgUrls: function() {
var loaders = $('#win10>.img-loader');
var flag = false;
if(Win10.isSmallScreen()) {
if(Win10._bgs.mobile) {
loaders.each(function() {
var loader = $(this);
if(loader.attr('src') === Win10._bgs.mobile && loader.hasClass('loaded')) {
Win10._setBackgroundImg(Win10._bgs.mobile);
flag = true;
}
});
if(!flag) {
//没找到加载完毕的图片
var img = $('<img class="img-loader" src="' + Win10._bgs.mobile + '" />');
$('#win10').append(img);
Win10._onImgComplete(img[0], function() {
img.addClass('loaded');
Win10._setBackgroundImg(Win10._bgs.mobile);
})
}
}
} else {
if(Win10._bgs.main) {
loaders.each(function() {
var loader = $(this);
if(loader.attr('src') === Win10._bgs.main && loader.hasClass('loaded')) {
Win10._setBackgroundImg(Win10._bgs.main);
flag = true;
}
});
if(!flag) {
//没找到加载完毕的图片
var img = $('<img class="img-loader" src="' + Win10._bgs.main + '" />');
$('#win10').append(img);
Win10._onImgComplete(img[0], function() {
img.addClass('loaded');
Win10._setBackgroundImg(Win10._bgs.main);
})
}
}
}
},
_startAnimate: function() {
setInterval(function() {
var classes_lenth = Win10._animated_classes.length;
var animated_liveness = Win10._animated_liveness;
if(animated_liveness === 0 || classes_lenth === 0 || !$("#win10-menu").hasClass('opened')) {
return;
}
$('#win10-menu>.blocks>.menu_group>.block').each(function() {
if(!$(this).hasClass('onAnimate') && Math.random() <= animated_liveness) {
var that = $(this);
var class_animate = Win10._animated_classes[Math.floor((Math.random() * classes_lenth))];
that.addClass('onAnimate');
setTimeout(function() {
that.addClass(class_animate);
setTimeout(function() {
that.removeClass('onAnimate');
that.removeClass(class_animate);
}, 3000);
}, Math.random() * 2 * 1000)
}
})
}, 1000);
},
_onImgComplete: function(img, callback) {
if(!img) {
return;
}
var timer = setInterval(function() {
if(img.complete) {
callback(img);
clearInterval(timer);
}
}, 50)
},
_setBackgroundImg: function(img) {
$('#win10').css('background-image', 'url(' + img + ')')
},
_settop: function(layero) {
if(!isNaN(layero)) {
layero = this.getLayeroByIndex(layero);
}
//置顶窗口
var max_zindex = 0;
$(".win10-open-iframe").each(function() {
z = parseInt($(this).css('z-index'));
$(this).css('z-index', z - 1);
if(z > max_zindex) {
max_zindex = z;
}
});
layero.css('z-index', max_zindex + 1);
},
_checkTop: function() {
var max_index = 0,
max_z = 0,
btn = null;
$("#win10_btn_group_middle .btn.show").each(function() {
var index = $(this).attr('index');
var layero = Win10.getLayeroByIndex(index);
var z = layero.css('z-index');
if(z > max_z) {
max_index = index;
max_z = z;
btn = $(this);
}
});
this._settop(max_index);
$("#win10_btn_group_middle .btn").removeClass('active');
if(btn) {
btn.addClass('active');
}
},
_renderContextMenu: function(x, y, menu, trigger) {
this._removeContextMenu();
if(menu === true) {
return;
}
var dom = $("<div class='win10-context-menu'><ul></ul></div>");
$('#win10').append(dom);
var ul = dom.find('ul');
for(var i = 0; i < menu.length; i++) {
var item = menu[i];
if(item === '|') {
ul.append($('<hr/>'));
continue;
}
if(typeof(item) === 'string') {
ul.append($('<li>' + item + '</li>'));
continue;
}
if(typeof(item) === 'object') {
var sub = $('<li>' + item[0] + '</li>');
ul.append(sub);
sub.click(trigger, item[1]);
}
}
//修正坐标
if(x + 150 > document.body.clientWidth) {
x -= 150
}
if(y + dom.height() > document.body.clientHeight) {
y -= dom.height()
}
dom.css({
top: y,
left: x,
});
},
_removeContextMenu: function() {
$('.win10-context-menu').remove();
},
_closeWin: function(index) {
$("#win10_" + index).remove();
layer.close(index);
Win10._checkTop();
Win10._countTask--; //回退countTask数
Win10._renderBar();
},
_fixWindowsHeightAndWidth: function() {
//此处代码修正全屏切换引起的子窗体尺寸超出屏幕
var opens = $('.win10-open-iframe');
var clientHeight = document.body.clientHeight;
opens.each(function() {
var layero_opened = $(this);
var height = layero_opened.css('height');
height = parseInt(height.replace('px', ''));
if(height + 40 >= clientHeight) {
layero_opened.css('height', clientHeight - 40);
layero_opened.find('.layui-layer-content').css('height', clientHeight - 83);
layero_opened.find('.layui-layer-content iframe').css('height', clientHeight - 83);
}
})
},
/**
* 原 win10_bind_open_windows 子窗口事件自动绑定插件
* @author:vG
* @修订:Yuri2
* @version:2.0.1
* 说明: 所有#win10下的元素加入类win10-open-window即可自动绑定openUrl函数,无须用onclick手动绑定
*/
_bind_open_windows: function() {
// 注册事件委派 打开url窗口
$('#win10').on('click', '.win10-open-window', function() {
//>> 获取当前点击的对象
$this = $(this);
//>> 判断url地址是否为空 如果为空 不予处理
if($this.data('url') !== "") {
//>> 获取弹窗标题
var title = $this.data('title') || '',
areaAndOffset;
//>> 判断是否有标题图片
var bg = $this.data('icon-bg') ? $this.data('icon-bg') : '';
if($this.data('icon-image')) {
//>> 加入到标题中
title = '<img class="icon ' + bg + '" src="' + $this.data('icon-image') + '"/>' + title;
}
if($this.data('icon-font')) {
//>> 加入到标题中
title = '<i class="fa fa-fw fa-' + $this.data('icon-font') + ' icon ' + bg + '"></i>' + title;
}
if(!title && $this.children('.icon').length === 1 && $this.children('.title').length === 1) {
title = $this.children('.icon').prop("outerHTML") + $this.children('.title').html();
}
//>> 判断是否需要 设置 区域宽度高度
if($this.data('area-offset')) {
areaAndOffset = $this.data('area-offset');
//>> 判断是否有分隔符
if(areaAndOffset.indexOf(',') !== -1) {
areaAndOffset = eval(areaAndOffset);
}
}
//>> 调用win10打开url方法
Win10.openUrl($this.data('url'), title, areaAndOffset);
}
})
},
_init: function() {
//获取语言
this._lang = (navigator.language || navigator.browserLanguage).toLowerCase();
$("#win10_btn_win").click(function() {
Win10.commandCenterClose();
Win10.menuToggle();
});
$("#win10_btn_command").click(function() {
Win10.menuClose();
Win10.commandCenterToggle();
});
$("#win10 .desktop").click(function() {
Win10.menuClose();
Win10.commandCenterClose();
});
$('#win10').on('click', ".msg .btn_close_msg", function() {
var msg = $(this).parent();
$(msg).addClass('animated slideOutRight');
setTimeout(function() {
msg.remove()
}, 500)
});
$('#win10_btn_command_center_clean_all').click(function() {
var msgs = $('#win10_command_center .msg');
msgs.addClass('animated slideOutRight');
setTimeout(function() {
msgs.remove()
}, 1500);
setTimeout(function() {
Win10.commandCenterClose();
}, 1000);
});
$("#win10_btn_show_desktop").click(function() {
$("#win10 .desktop").click();
Win10.hideWins();
});
$("#win10-menu-switcher").click(function() {
if(Win10._switchMenuTooHurry) {
return;
}
Win10._switchMenuTooHurry = true;
var class_name = 'win10-menu-hidden';
var list = $("#win10-menu>.list");
var blocks = $("#win10-menu>.blocks");
var toggleSlide = function(obj) {
if(obj.hasClass(class_name)) {
obj.addClass('animated slideInLeft');
obj.removeClass('animated slideOutLeft');
obj.removeClass(class_name);
} else {
setTimeout(function() {
obj.addClass(class_name);
}, 450);
obj.addClass('animated slideOutLeft');
obj.removeClass('animated slideInLeft');
}
};
toggleSlide(list);
toggleSlide(blocks);
setTimeout(function() {
Win10._switchMenuTooHurry = false;
}, 520)
});
$("#win10_btn_group_middle").click(function() {
$("#win10 .desktop").click();
});
$(document).on('click', '.win10-btn-refresh', function() {
var index = $(this).attr('index');
var iframe = Win10.getLayeroByIndex(index).find('iframe');
iframe.attr('src', iframe.attr('src'));
});
$(document).on('click', '.win10-btn-change-url', function() {
var index = $(this).attr('index');
var iframe = Win10.getLayeroByIndex(index).find('iframe');
layer.prompt({
title: Win10.lang('编辑网址', 'Edit URL'),
formType: 2,
skin: 'win10-layer-open-browser',
value: iframe.attr('src'),
area: ['500px', '200px'],
zIndex: 99999999999
}, function(value, i) {
layer.close(i);
layer.msg(Win10.lang('请稍候...', 'Hold on please...'), {
time: 1500
}, function() {
iframe.attr('src', value);
});
});
});
$(document).on('mousedown', '.win10-open-iframe', function() {
var layero = $(this);
Win10._settop(layero);
Win10._checkTop();
});
$('#win10_btn_group_middle').on('click', '.btn_close', function() {
var index = $(this).parent().attr('index');
Win10._closeWin(index);
});
$('#win10-menu .list').on('click', '.item', function() {
var e = $(this);
if(e.hasClass('has-sub-down')) {
$('#win10-menu .list .item.has-sub-up').toggleClass('has-sub-down').toggleClass('has-sub-up');
$("#win10-menu .list .sub-item").slideUp();
}
e.toggleClass('has-sub-down').toggleClass('has-sub-up');
while(e.next().hasClass('sub-item')) {
e.next().slideToggle();
e = e.next();
}
});
$("#win10-btn-browser").click(function() {
// var area = ['100%', (document.body.clientHeight - 40) + 'px'];
// var offset = ['0', '0'];
layer.prompt({
title: Win10.lang('访问网址', 'Visit URL'),
formType: 2,
value: '',
skin: 'win10-layer-open-browser',
area: ['300px', '150px'],
zIndex: 99999999999
}, function(value, i) {
layer.close(i);
layer.msg(Win10.lang('请稍候...', 'Hold on please...'), {
time: 1500
}, function() {
Win10.openUrl(value, value);
});
});
});
setInterval(function() {
var myDate = new Date();
var year = myDate.getFullYear();
var month = myDate.getMonth() + 1;
var date = myDate.getDate();
var hours = myDate.getHours();
var mins = myDate.getMinutes();
if(mins < 10) {
mins = '0' + mins
}
$("#win10_btn_time").html(hours + ':' + mins + '<br/>' + year + '/' + month + '/' + date);
}, 1000);
Win10.buildList(); //预处理左侧菜单
Win10._startAnimate(); //动画处理
Win10.renderShortcuts(); //渲染图标
$("#win10-shortcuts").removeClass('shortcuts-hidden'); //显示图标
Win10._showShortcut(); //显示图标
Win10.renderMenuBlocks(); //渲染磁贴
//窗口改大小,重新渲染
$(window).resize(function() {
Win10.renderShortcuts();
Win10._checkBgUrls();
Win10._fixWindowsHeightAndWidth();
});
//细节
$(document).on('focus', ".win10-layer-open-browser textarea", function() {
$(this).attr('spellcheck', 'false');
});
$(document).on('keyup', ".win10-layer-open-browser textarea", function(e) {
if(e.keyCode === 13) {
$(this).parent().parent().find('.layui-layer-btn0').click();
}
});
//点击清空右键菜单
$(document).click(function() {
Win10._removeContextMenu();
});
//禁用右键的右键
$(document).on('contextmenu', '.win10-context-menu', function(e) {
e.preventDefault();
e.stopPropagation();
});
//设置默认右键菜单
Win10.setContextMenu('#win10', true);
Win10.setContextMenu('#win10>.desktop', [
['<i class="fa fa-fw fa-refresh"></i> ' + Win10.lang('刷新'), function() {
location.reload()
}],
'|', ['<i class="fa fa-fw fa-window-maximize"></i> ' + Win10.lang('进入全屏', 'Enable Full Screen'), function() {
Win10.enableFullScreen()
}],
['<i class="fa fa-fw fa-window-restore"></i> ' + Win10.lang('退出全屏', 'Disable Full Screen'), function() {
Win10.disableFullScreen()
}],
'|', ['<i class="fa fa-fw fa-info-circle"></i> ' + Win10.lang('关于', 'About Us'), function() {
Win10.aboutUs()
}],
]);
Win10.setContextMenu('#win10_btn_group_middle', [
['<i class="fa fa-fw fa-window-maximize"></i> ' + Win10.lang('全部显示', 'Show All Windows'), function() {
Win10.showWins()
}],
['<i class="fa fa-fw fa-window-minimize"></i> ' + Win10.lang('全部隐藏', 'Hide All Windows'), function() {
Win10.hideWins()
}],
['<i class="fa fa-fw fa-window-close"></i> ' + Win10.lang('全部关闭', 'Close All Windows'), function() {
Win10.closeAll()
}],
]);
//处理消息图标闪烁
setInterval(function() {
var btn = $("#win10-msg-nof.on-new-msg");
if(btn.length > 0) {
btn.toggleClass('fa-commenting-o');
}
}, 600);
//绑定快捷键
$("body").keyup(function(e) {
if(e.ctrlKey) {
switch(e.keyCode) {
case 37: //left
$("#win10_btn_win").click();
break;
case 38: //up
Win10.showWins();
break;
case 39: //right
$("#win10_btn_command").click();
break;
case 40: //down
Win10.hideWins();
break;
}
}
});
/**
* WIN10-UI v1.1.2.2 桌面舞台支持补丁
* WIN10-UI v1.1.2.2之后的版本不需要此补丁
* @usage 直接引用即可(需要jquery)
* @author Yuri2
*/
if($("#win10-desktop-scene").length < 1) {
$("#win10-shortcuts").css({
position: 'absolute',
left: 0,
top: 0,
'z-index': 100,
});
$("#win10 .desktop").append("<div id='win10-desktop-scene' style='width: 100%;height: calc(100% - 40px);position: absolute;left: 0;top: 0; z-index: 0;background-color: transparent;'></div>")
}
//属性绑定
Win10._bind_open_windows();
},
setBgUrl: function(bgs) {
this._bgs = bgs;
this._checkBgUrls();
},
menuClose: function() {
$("#win10-menu").removeClass('opened');
$("#win10-menu").addClass('hidden');
this._showShortcut();
$(".win10-open-iframe").removeClass('hide');
},
menuOpen: function() {
$("#win10-menu").addClass('opened');
$("#win10-menu").removeClass('hidden');
this._hideShortcut();
$(".win10-open-iframe").addClass('hide');
},
menuToggle: function() {
if(!$("#win10-menu").hasClass('opened')) {
this.menuOpen();
} else {
this.menuClose();
}
},
commandCenterClose: function() {
$("#win10_command_center").addClass('hidden_right');
this._showShortcut();
$(".win10-open-iframe").removeClass('hide');
},
commandCenterOpen: function() {
$("#win10_command_center").removeClass('hidden_right');
this._hideShortcut();
$(".win10-open-iframe").addClass('hide');
$("#win10-msg-nof").removeClass('on-new-msg fa-commenting-o');
},
renderShortcuts: function() {
var h = parseInt($("#win10 #win10-shortcuts")[0].offsetHeight / 100);
var x = 0,
y = 0;
$("#win10 #win10-shortcuts .shortcut").each(function() {
$(this).css({
left: x * 82 + 10,
top: y * 100 + 10,
});
y++;
if(y >= h) {
y = 0;
x++;
}
});
},
renderMenuBlocks: function() {
var cell_width = 44;
var groups = $("#win10-menu .menu_group");
groups.each(function() {
var group = $(this);
var blocks = group.children('.block');
var max_height = 0;
blocks.each(function() {
var that = $(this);
var loc = that.attr('loc').split(',');
var size = that.attr('size').split(',');
var top = (loc[1] - 1) * cell_width + 40;
var height = size[1] * cell_width;
var full_height = top + height;
if(full_height > max_height) {
max_height = full_height
}
that.css({
top: top,
left: (loc[0] - 1) * cell_width,
width: size[0] * cell_width,
height: height,
})
});
group.css('height', max_height);
});
},
commandCenterToggle: function() {
if($("#win10_command_center").hasClass('hidden_right')) {
this.commandCenterOpen();
} else {
this.commandCenterClose();
}
},
newMsg: function(title, content, handle_click) {
var e = $('<div class="msg">' +
'<div class="title">' + title + '</div>' +
'<div class="content">' + content + '</div>' +
'<span class="btn_close_msg fa fa-close"></span>' +
'</div>');
$("#win10_command_center .msgs").prepend(e);
e.find('.content:first,.title:first').click(function() {
if(handle_click) {
handle_click(e);
}
});
layer.tips(Win10.lang('新消息:', 'New message:') + title, '#win10_btn_command', {
tips: [1, '#3c6a4a'],
time: 3000
});
if($("#win10_command_center").hasClass('hidden_right')) {
$("#win10-msg-nof").addClass('on-new-msg');
}
},
getLayeroByIndex: function(index) {
return $('#' + 'layui-layer' + index)
},
isSmallScreen: function(size) {
if(!size) {
size = 768
}
var width = document.body.clientWidth;
return width < size;
},
enableFullScreen: function() {
var docElm = document.documentElement;
//W3C
if(docElm.requestFullscreen) {
docElm.requestFullscreen();
}
//FireFox
else if(docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
//Chrome等
else if(docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
//IE11
else if(docElm.msRequestFullscreen) {
document.body.msRequestFullscreen();
}
},
disableFullScreen: function() {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if(document.msExitFullscreen) {
document.msExitFullscreen();
}
},
buildList: function() {
$("#win10-menu .list .sub-item").slideUp();
$("#win10-menu .list .item").each(function() {
if($(this).next().hasClass('sub-item')) {
$(this).addClass('has-sub-down');
$(this).removeClass('has-sub-up');
}
})
},
openUrl: function(url, title, areaAndOffset) {
if(this._countTask > 12) {
c;
return false;
} else {
this._countTask++;
}
if(!url) {
url = '404'
}
url = url.replace(/(^\s*)|(\s*$)/g, "");
var preg = /^(https?:\/\/|\.\.?\/|\/\/?)/;
if(!preg.test(url)) {
url = 'http://' + url;
}
//layer.msg(url);
//if (!url) {
// url = '//yuri2.cn';
//}
if(!title) {
title = url;
}
var area, offset;
if(this.isSmallScreen() || areaAndOffset === 'max') {
area = ['100%', (document.body.clientHeight - 40) + 'px'];
offset = ['0', '0'];
} else if(typeof areaAndOffset === 'object') {
area = areaAndOffset[0];
offset = areaAndOffset[1];
} else {
area = ['80%', '80%'];
var topset, leftset;
topset = parseInt($(window).height());
topset = (topset - (topset * 0.8)) / 2 - 41;
leftset = parseInt($(window).width());
leftset = (leftset - (leftset * 0.8)) / 2 - 120;
offset = [Math.round((this._countTask % 10 * 20) + topset) + 'px', Math.round((this._countTask % 10 * 20 + 100) + leftset) + 'px'];
}
var index = layer.open({
type: 2,
shadeClose: true,
shade: false,
maxmin: true, //开启最大化最小化按钮
title: title,
content: url,
area: area,
offset: offset,
isOutAnim: false,
skin: 'win10-open-iframe',
cancel: function(index, layero) {
$("#win10_" + index).remove();
Win10._checkTop();
Win10._countTask--; //回退countTask数
Win10._renderBar();
},
min: function(layero) {
layero.hide();
$("#win10_" + index).removeClass('show');
Win10._checkTop();
return false;
},
full: function(layero) {
layero.find('.layui-layer-min').css('display', 'inline-block');
},
});
$('#win10_btn_group_middle .btn.active').removeClass('active');
var btn = $('<div id="win10_' + index + '" index="' + index + '" class="btn show active"><div class="btn_title">' + title + '</div><div class="btn_close fa fa-close"></div></div>');
var layero_opened = Win10.getLayeroByIndex(index);
layero_opened.css('z-index', Win10._countTask + 813);
Win10._settop(layero_opened);
layero_opened.find('.layui-layer-setwin').prepend('<a class="win10-btn-change-url" index="' + index + '" title="' + Win10.lang('修改地址', 'Change URL') + '" href="javascript:void(0)"><span class="fa fa-chain"></span></a><a class="win10-btn-refresh" index="' + index + '" title="' + Win10.lang('刷新', 'Refresh') + '" href="javascript:void(0)"><span class="fa fa-refresh"></span></a>');
layero_opened.find('.layui-layer-setwin .layui-layer-max').click(function() {
setTimeout(function() {
var height = layero_opened.css('height');
height = parseInt(height.replace('px', ''));
if(height >= document.body.clientHeight) {
layero_opened.css('height', height - 40);
layero_opened.find('.layui-layer-content').css('height', height - 83);
layero_opened.find('.layui-layer-content iframe').css('height', height - 83);
}
}, 300);
});
$("#win10_btn_group_middle").append(btn);
Win10._renderBar();
btn.click(function() {
var index = $(this).attr('index');
var layero = Win10.getLayeroByIndex(index);
var settop = function() {
//置顶窗口
var max_zindex = 0;
$(".win10-open-iframe").each(function() {
z = parseInt($(this).css('z-index'));
$(this).css('z-index', z - 1);
if(z > max_zindex) {
max_zindex = z;
}
});
layero.css('z-index', max_zindex + 1);
};
if($(this).hasClass('show')) {
if($(this).hasClass('active')) {
$(this).removeClass('active');
$(this).removeClass('show');
Win10._checkTop();
layero.hide();
} else {
$('#win10_btn_group_middle .btn.active').removeClass('active');
$(this).addClass('active');
Win10._settop(layero);
}
} else {
$(this).addClass('show');
$('#win10_btn_group_middle .btn.active').removeClass('active');
$(this).addClass('active');
Win10._settop(layero);
layero.show();
}
});
Win10._iframeOnClick.track(layero_opened.find('iframe:first')[0], function() {
if(Object.getOwnPropertyNames(Win10._iframe_click_lock_children).length === 0) {
Win10._settop(layero_opened);
Win10._checkTop();
} else {
console.log('click locked');
}
});
this.menuClose();
this.commandCenterClose();
return index;
},
closeAll: function() {
$(".win10-open-iframe").remove();
$("#win10_btn_group_middle").html("");
Win10._countTask = 0;
Win10._renderBar();
},
setAnimated: function(animated_classes, animated_liveness) {
this._animated_classes = animated_classes;
this._animated_liveness = animated_liveness;
},
exit: function() {
layer.confirm(Win10.lang('请确认退出系统', 'Are you sure you want to close this page?'), {
icon: 3,
title: Win10.lang('提示', 'Prompt')
}, function(index) {
$.post('http://localhost:8080/hb/ExitSystemServlet');
document.body.onbeforeunload = function() {};
deleteCookie("loginName");
deleteCookie("loginNickName");
deleteCookie("loginAdmin");
deleteCookie("isLogin");
window.location.href = "/hb";
window.close();
layer.close(index);
/*
layer.alert(Win10.lang('哎呀,好像失败了呢。', 'Ops...There seems to be a little problem.'), {
skin: 'layui-layer-lan'
, closeBtn: 0
});
*/
});
},
lang: function(cn, en) {
return this._lang === 'zh-cn' || this._lang === 'zh-tw' ? cn : en;
},
aboutUs: function() {
//关于我们
layer.open({
type: 1,
closeBtn: 1, //不显示关闭按钮
anim: 2,
skin: 'layui-layer-molv',
title: 'Hotelbook 关于系统',
shadeClose: true, //开启遮罩关闭
area: ['300px', '180px'], //宽高
content: '<div style="padding: 10px;font-size: 12px">' +
'<h2>酒店管理系统</h2>' +
'<p>inks©版权所有</p>' +
'<a>© 2017 HotelBook System</a>' +
'</div>'
});
},
setContextMenu: function(jq_dom, menu) {
if(typeof(jq_dom) === 'string') {
jq_dom = $(jq_dom);
}
jq_dom.unbind('contextmenu');
jq_dom.on('contextmenu', function(e) {
if(menu) {
Win10._renderContextMenu(e.clientX, e.clientY, menu, this);
if(e.cancelable) {
// 判断默认行为是否已经被禁用
if(!e.defaultPrevented) {
e.preventDefault();
}
}
e.stopPropagation();
}
});
},
hideWins: function() {
$('#win10_btn_group_middle>.btn.show').each(function() {
var index = $(this).attr('index');
var layero = Win10.getLayeroByIndex(index);
$(this).removeClass('show');
$(this).removeClass('active');
layero.hide();
})
},
showWins: function() {
$('#win10_btn_group_middle>.btn').each(function() {
var index = $(this).attr('index');
var layero = Win10.getLayeroByIndex(index);
$(this).addClass('show');
layero.show();
});
Win10._checkTop();
},
getDesktopScene: function() {
return $("#win10-desktop-scene");
},
onReady: function(handle) {
Win10._handleReady.push(handle);
}
};
$(function() {
Win10._init();
for(var i in Win10._handleReady) {
var handle = Win10._handleReady[i];
handle();
}
}); | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/**
* Created by Yuri2 on 2017/7/31.
*/
//此处代码适合在子页面使用
window.Win10_parent=parent.Win10; //获取父级Win10对象的句柄
window.Win10_child={
close:function () {
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
Win10_parent._closeWin(index);
},
newMsg: function (title, content,handle_click){
Win10_parent.newMsg(title, content,handle_click)
},
openUrl: function (url, title,max){
var click_lock_name=Math.random();
Win10_parent._iframe_click_lock_children[click_lock_name]=true;
var index=Win10_parent.openUrl(url, title,max);
setTimeout(function () {
delete Win10_parent._iframe_click_lock_children[click_lock_name];
},1000);
return index;
}
};
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/*!
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* makes the font 33% larger relative to the icon container */
.fa-lg {
font-size: 1.33333333em;
line-height: 0.75em;
vertical-align: -15%;
}
.fa-2x {
font-size: 2em;
}
.fa-3x {
font-size: 3em;
}
.fa-4x {
font-size: 4em;
}
.fa-5x {
font-size: 5em;
}
.fa-fw {
width: 1.28571429em;
text-align: center;
}
.fa-ul {
padding-left: 0;
margin-left: 2.14285714em;
list-style-type: none;
}
.fa-ul > li {
position: relative;
}
.fa-li {
position: absolute;
left: -2.14285714em;
width: 2.14285714em;
top: 0.14285714em;
text-align: center;
}
.fa-li.fa-lg {
left: -1.85714286em;
}
.fa-border {
padding: .2em .25em .15em;
border: solid 0.08em #eeeeee;
border-radius: .1em;
}
.fa-pull-left {
float: left;
}
.fa-pull-right {
float: right;
}
.fa.fa-pull-left {
margin-right: .3em;
}
.fa.fa-pull-right {
margin-left: .3em;
}
/* Deprecated as of 4.4.0 */
.pull-right {
float: right;
}
.pull-left {
float: left;
}
.fa.pull-left {
margin-right: .3em;
}
.fa.pull-right {
margin-left: .3em;
}
.fa-spin {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}
.fa-pulse {
-webkit-animation: fa-spin 1s infinite steps(8);
animation: fa-spin 1s infinite steps(8);
}
@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.fa-rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.fa-rotate-180 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.fa-rotate-270 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.fa-flip-horizontal {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
.fa-flip-vertical {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
-webkit-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
}
:root .fa-rotate-90,
:root .fa-rotate-180,
:root .fa-rotate-270,
:root .fa-flip-horizontal,
:root .fa-flip-vertical {
filter: none;
}
.fa-stack {
position: relative;
display: inline-block;
width: 2em;
height: 2em;
line-height: 2em;
vertical-align: middle;
}
.fa-stack-1x,
.fa-stack-2x {
position: absolute;
left: 0;
width: 100%;
text-align: center;
}
.fa-stack-1x {
line-height: inherit;
}
.fa-stack-2x {
font-size: 2em;
}
.fa-inverse {
color: #ffffff;
}
/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
readers do not read off random characters that represent icons */
.fa-glass:before {
content: "\f000";
}
.fa-music:before {
content: "\f001";
}
.fa-search:before {
content: "\f002";
}
.fa-envelope-o:before {
content: "\f003";
}
.fa-heart:before {
content: "\f004";
}
.fa-star:before {
content: "\f005";
}
.fa-star-o:before {
content: "\f006";
}
.fa-user:before {
content: "\f007";
}
.fa-film:before {
content: "\f008";
}
.fa-th-large:before {
content: "\f009";
}
.fa-th:before {
content: "\f00a";
}
.fa-th-list:before {
content: "\f00b";
}
.fa-check:before {
content: "\f00c";
}
.fa-remove:before,
.fa-close:before,
.fa-times:before {
content: "\f00d";
}
.fa-search-plus:before {
content: "\f00e";
}
.fa-search-minus:before {
content: "\f010";
}
.fa-power-off:before {
content: "\f011";
}
.fa-signal:before {
content: "\f012";
}
.fa-gear:before,
.fa-cog:before {
content: "\f013";
}
.fa-trash-o:before {
content: "\f014";
}
.fa-home:before {
content: "\f015";
}
.fa-file-o:before {
content: "\f016";
}
.fa-clock-o:before {
content: "\f017";
}
.fa-road:before {
content: "\f018";
}
.fa-download:before {
content: "\f019";
}
.fa-arrow-circle-o-down:before {
content: "\f01a";
}
.fa-arrow-circle-o-up:before {
content: "\f01b";
}
.fa-inbox:before {
content: "\f01c";
}
.fa-play-circle-o:before {
content: "\f01d";
}
.fa-rotate-right:before,
.fa-repeat:before {
content: "\f01e";
}
.fa-refresh:before {
content: "\f021";
}
.fa-list-alt:before {
content: "\f022";
}
.fa-lock:before {
content: "\f023";
}
.fa-flag:before {
content: "\f024";
}
.fa-headphones:before {
content: "\f025";
}
.fa-volume-off:before {
content: "\f026";
}
.fa-volume-down:before {
content: "\f027";
}
.fa-volume-up:before {
content: "\f028";
}
.fa-qrcode:before {
content: "\f029";
}
.fa-barcode:before {
content: "\f02a";
}
.fa-tag:before {
content: "\f02b";
}
.fa-tags:before {
content: "\f02c";
}
.fa-book:before {
content: "\f02d";
}
.fa-bookmark:before {
content: "\f02e";
}
.fa-print:before {
content: "\f02f";
}
.fa-camera:before {
content: "\f030";
}
.fa-font:before {
content: "\f031";
}
.fa-bold:before {
content: "\f032";
}
.fa-italic:before {
content: "\f033";
}
.fa-text-height:before {
content: "\f034";
}
.fa-text-width:before {
content: "\f035";
}
.fa-align-left:before {
content: "\f036";
}
.fa-align-center:before {
content: "\f037";
}
.fa-align-right:before {
content: "\f038";
}
.fa-align-justify:before {
content: "\f039";
}
.fa-list:before {
content: "\f03a";
}
.fa-dedent:before,
.fa-outdent:before {
content: "\f03b";
}
.fa-indent:before {
content: "\f03c";
}
.fa-video-camera:before {
content: "\f03d";
}
.fa-photo:before,
.fa-image:before,
.fa-picture-o:before {
content: "\f03e";
}
.fa-pencil:before {
content: "\f040";
}
.fa-map-marker:before {
content: "\f041";
}
.fa-adjust:before {
content: "\f042";
}
.fa-tint:before {
content: "\f043";
}
.fa-edit:before,
.fa-pencil-square-o:before {
content: "\f044";
}
.fa-share-square-o:before {
content: "\f045";
}
.fa-check-square-o:before {
content: "\f046";
}
.fa-arrows:before {
content: "\f047";
}
.fa-step-backward:before {
content: "\f048";
}
.fa-fast-backward:before {
content: "\f049";
}
.fa-backward:before {
content: "\f04a";
}
.fa-play:before {
content: "\f04b";
}
.fa-pause:before {
content: "\f04c";
}
.fa-stop:before {
content: "\f04d";
}
.fa-forward:before {
content: "\f04e";
}
.fa-fast-forward:before {
content: "\f050";
}
.fa-step-forward:before {
content: "\f051";
}
.fa-eject:before {
content: "\f052";
}
.fa-chevron-left:before {
content: "\f053";
}
.fa-chevron-right:before {
content: "\f054";
}
.fa-plus-circle:before {
content: "\f055";
}
.fa-minus-circle:before {
content: "\f056";
}
.fa-times-circle:before {
content: "\f057";
}
.fa-check-circle:before {
content: "\f058";
}
.fa-question-circle:before {
content: "\f059";
}
.fa-info-circle:before {
content: "\f05a";
}
.fa-crosshairs:before {
content: "\f05b";
}
.fa-times-circle-o:before {
content: "\f05c";
}
.fa-check-circle-o:before {
content: "\f05d";
}
.fa-ban:before {
content: "\f05e";
}
.fa-arrow-left:before {
content: "\f060";
}
.fa-arrow-right:before {
content: "\f061";
}
.fa-arrow-up:before {
content: "\f062";
}
.fa-arrow-down:before {
content: "\f063";
}
.fa-mail-forward:before,
.fa-share:before {
content: "\f064";
}
.fa-expand:before {
content: "\f065";
}
.fa-compress:before {
content: "\f066";
}
.fa-plus:before {
content: "\f067";
}
.fa-minus:before {
content: "\f068";
}
.fa-asterisk:before {
content: "\f069";
}
.fa-exclamation-circle:before {
content: "\f06a";
}
.fa-gift:before {
content: "\f06b";
}
.fa-leaf:before {
content: "\f06c";
}
.fa-fire:before {
content: "\f06d";
}
.fa-eye:before {
content: "\f06e";
}
.fa-eye-slash:before {
content: "\f070";
}
.fa-warning:before,
.fa-exclamation-triangle:before {
content: "\f071";
}
.fa-plane:before {
content: "\f072";
}
.fa-calendar:before {
content: "\f073";
}
.fa-random:before {
content: "\f074";
}
.fa-comment:before {
content: "\f075";
}
.fa-magnet:before {
content: "\f076";
}
.fa-chevron-up:before {
content: "\f077";
}
.fa-chevron-down:before {
content: "\f078";
}
.fa-retweet:before {
content: "\f079";
}
.fa-shopping-cart:before {
content: "\f07a";
}
.fa-folder:before {
content: "\f07b";
}
.fa-folder-open:before {
content: "\f07c";
}
.fa-arrows-v:before {
content: "\f07d";
}
.fa-arrows-h:before {
content: "\f07e";
}
.fa-bar-chart-o:before,
.fa-bar-chart:before {
content: "\f080";
}
.fa-twitter-square:before {
content: "\f081";
}
.fa-facebook-square:before {
content: "\f082";
}
.fa-camera-retro:before {
content: "\f083";
}
.fa-key:before {
content: "\f084";
}
.fa-gears:before,
.fa-cogs:before {
content: "\f085";
}
.fa-comments:before {
content: "\f086";
}
.fa-thumbs-o-up:before {
content: "\f087";
}
.fa-thumbs-o-down:before {
content: "\f088";
}
.fa-star-half:before {
content: "\f089";
}
.fa-heart-o:before {
content: "\f08a";
}
.fa-sign-out:before {
content: "\f08b";
}
.fa-linkedin-square:before {
content: "\f08c";
}
.fa-thumb-tack:before {
content: "\f08d";
}
.fa-external-link:before {
content: "\f08e";
}
.fa-sign-in:before {
content: "\f090";
}
.fa-trophy:before {
content: "\f091";
}
.fa-github-square:before {
content: "\f092";
}
.fa-upload:before {
content: "\f093";
}
.fa-lemon-o:before {
content: "\f094";
}
.fa-phone:before {
content: "\f095";
}
.fa-square-o:before {
content: "\f096";
}
.fa-bookmark-o:before {
content: "\f097";
}
.fa-phone-square:before {
content: "\f098";
}
.fa-twitter:before {
content: "\f099";
}
.fa-facebook-f:before,
.fa-facebook:before {
content: "\f09a";
}
.fa-github:before {
content: "\f09b";
}
.fa-unlock:before {
content: "\f09c";
}
.fa-credit-card:before {
content: "\f09d";
}
.fa-feed:before,
.fa-rss:before {
content: "\f09e";
}
.fa-hdd-o:before {
content: "\f0a0";
}
.fa-bullhorn:before {
content: "\f0a1";
}
.fa-bell:before {
content: "\f0f3";
}
.fa-certificate:before {
content: "\f0a3";
}
.fa-hand-o-right:before {
content: "\f0a4";
}
.fa-hand-o-left:before {
content: "\f0a5";
}
.fa-hand-o-up:before {
content: "\f0a6";
}
.fa-hand-o-down:before {
content: "\f0a7";
}
.fa-arrow-circle-left:before {
content: "\f0a8";
}
.fa-arrow-circle-right:before {
content: "\f0a9";
}
.fa-arrow-circle-up:before {
content: "\f0aa";
}
.fa-arrow-circle-down:before {
content: "\f0ab";
}
.fa-globe:before {
content: "\f0ac";
}
.fa-wrench:before {
content: "\f0ad";
}
.fa-tasks:before {
content: "\f0ae";
}
.fa-filter:before {
content: "\f0b0";
}
.fa-briefcase:before {
content: "\f0b1";
}
.fa-arrows-alt:before {
content: "\f0b2";
}
.fa-group:before,
.fa-users:before {
content: "\f0c0";
}
.fa-chain:before,
.fa-link:before {
content: "\f0c1";
}
.fa-cloud:before {
content: "\f0c2";
}
.fa-flask:before {
content: "\f0c3";
}
.fa-cut:before,
.fa-scissors:before {
content: "\f0c4";
}
.fa-copy:before,
.fa-files-o:before {
content: "\f0c5";
}
.fa-paperclip:before {
content: "\f0c6";
}
.fa-save:before,
.fa-floppy-o:before {
content: "\f0c7";
}
.fa-square:before {
content: "\f0c8";
}
.fa-navicon:before,
.fa-reorder:before,
.fa-bars:before {
content: "\f0c9";
}
.fa-list-ul:before {
content: "\f0ca";
}
.fa-list-ol:before {
content: "\f0cb";
}
.fa-strikethrough:before {
content: "\f0cc";
}
.fa-underline:before {
content: "\f0cd";
}
.fa-table:before {
content: "\f0ce";
}
.fa-magic:before {
content: "\f0d0";
}
.fa-truck:before {
content: "\f0d1";
}
.fa-pinterest:before {
content: "\f0d2";
}
.fa-pinterest-square:before {
content: "\f0d3";
}
.fa-google-plus-square:before {
content: "\f0d4";
}
.fa-google-plus:before {
content: "\f0d5";
}
.fa-money:before {
content: "\f0d6";
}
.fa-caret-down:before {
content: "\f0d7";
}
.fa-caret-up:before {
content: "\f0d8";
}
.fa-caret-left:before {
content: "\f0d9";
}
.fa-caret-right:before {
content: "\f0da";
}
.fa-columns:before {
content: "\f0db";
}
.fa-unsorted:before,
.fa-sort:before {
content: "\f0dc";
}
.fa-sort-down:before,
.fa-sort-desc:before {
content: "\f0dd";
}
.fa-sort-up:before,
.fa-sort-asc:before {
content: "\f0de";
}
.fa-envelope:before {
content: "\f0e0";
}
.fa-linkedin:before {
content: "\f0e1";
}
.fa-rotate-left:before,
.fa-undo:before {
content: "\f0e2";
}
.fa-legal:before,
.fa-gavel:before {
content: "\f0e3";
}
.fa-dashboard:before,
.fa-tachometer:before {
content: "\f0e4";
}
.fa-comment-o:before {
content: "\f0e5";
}
.fa-comments-o:before {
content: "\f0e6";
}
.fa-flash:before,
.fa-bolt:before {
content: "\f0e7";
}
.fa-sitemap:before {
content: "\f0e8";
}
.fa-umbrella:before {
content: "\f0e9";
}
.fa-paste:before,
.fa-clipboard:before {
content: "\f0ea";
}
.fa-lightbulb-o:before {
content: "\f0eb";
}
.fa-exchange:before {
content: "\f0ec";
}
.fa-cloud-download:before {
content: "\f0ed";
}
.fa-cloud-upload:before {
content: "\f0ee";
}
.fa-user-md:before {
content: "\f0f0";
}
.fa-stethoscope:before {
content: "\f0f1";
}
.fa-suitcase:before {
content: "\f0f2";
}
.fa-bell-o:before {
content: "\f0a2";
}
.fa-coffee:before {
content: "\f0f4";
}
.fa-cutlery:before {
content: "\f0f5";
}
.fa-file-text-o:before {
content: "\f0f6";
}
.fa-building-o:before {
content: "\f0f7";
}
.fa-hospital-o:before {
content: "\f0f8";
}
.fa-ambulance:before {
content: "\f0f9";
}
.fa-medkit:before {
content: "\f0fa";
}
.fa-fighter-jet:before {
content: "\f0fb";
}
.fa-beer:before {
content: "\f0fc";
}
.fa-h-square:before {
content: "\f0fd";
}
.fa-plus-square:before {
content: "\f0fe";
}
.fa-angle-double-left:before {
content: "\f100";
}
.fa-angle-double-right:before {
content: "\f101";
}
.fa-angle-double-up:before {
content: "\f102";
}
.fa-angle-double-down:before {
content: "\f103";
}
.fa-angle-left:before {
content: "\f104";
}
.fa-angle-right:before {
content: "\f105";
}
.fa-angle-up:before {
content: "\f106";
}
.fa-angle-down:before {
content: "\f107";
}
.fa-desktop:before {
content: "\f108";
}
.fa-laptop:before {
content: "\f109";
}
.fa-tablet:before {
content: "\f10a";
}
.fa-mobile-phone:before,
.fa-mobile:before {
content: "\f10b";
}
.fa-circle-o:before {
content: "\f10c";
}
.fa-quote-left:before {
content: "\f10d";
}
.fa-quote-right:before {
content: "\f10e";
}
.fa-spinner:before {
content: "\f110";
}
.fa-circle:before {
content: "\f111";
}
.fa-mail-reply:before,
.fa-reply:before {
content: "\f112";
}
.fa-github-alt:before {
content: "\f113";
}
.fa-folder-o:before {
content: "\f114";
}
.fa-folder-open-o:before {
content: "\f115";
}
.fa-smile-o:before {
content: "\f118";
}
.fa-frown-o:before {
content: "\f119";
}
.fa-meh-o:before {
content: "\f11a";
}
.fa-gamepad:before {
content: "\f11b";
}
.fa-keyboard-o:before {
content: "\f11c";
}
.fa-flag-o:before {
content: "\f11d";
}
.fa-flag-checkered:before {
content: "\f11e";
}
.fa-terminal:before {
content: "\f120";
}
.fa-code:before {
content: "\f121";
}
.fa-mail-reply-all:before,
.fa-reply-all:before {
content: "\f122";
}
.fa-star-half-empty:before,
.fa-star-half-full:before,
.fa-star-half-o:before {
content: "\f123";
}
.fa-location-arrow:before {
content: "\f124";
}
.fa-crop:before {
content: "\f125";
}
.fa-code-fork:before {
content: "\f126";
}
.fa-unlink:before,
.fa-chain-broken:before {
content: "\f127";
}
.fa-question:before {
content: "\f128";
}
.fa-info:before {
content: "\f129";
}
.fa-exclamation:before {
content: "\f12a";
}
.fa-superscript:before {
content: "\f12b";
}
.fa-subscript:before {
content: "\f12c";
}
.fa-eraser:before {
content: "\f12d";
}
.fa-puzzle-piece:before {
content: "\f12e";
}
.fa-microphone:before {
content: "\f130";
}
.fa-microphone-slash:before {
content: "\f131";
}
.fa-shield:before {
content: "\f132";
}
.fa-calendar-o:before {
content: "\f133";
}
.fa-fire-extinguisher:before {
content: "\f134";
}
.fa-rocket:before {
content: "\f135";
}
.fa-maxcdn:before {
content: "\f136";
}
.fa-chevron-circle-left:before {
content: "\f137";
}
.fa-chevron-circle-right:before {
content: "\f138";
}
.fa-chevron-circle-up:before {
content: "\f139";
}
.fa-chevron-circle-down:before {
content: "\f13a";
}
.fa-html5:before {
content: "\f13b";
}
.fa-css3:before {
content: "\f13c";
}
.fa-anchor:before {
content: "\f13d";
}
.fa-unlock-alt:before {
content: "\f13e";
}
.fa-bullseye:before {
content: "\f140";
}
.fa-ellipsis-h:before {
content: "\f141";
}
.fa-ellipsis-v:before {
content: "\f142";
}
.fa-rss-square:before {
content: "\f143";
}
.fa-play-circle:before {
content: "\f144";
}
.fa-ticket:before {
content: "\f145";
}
.fa-minus-square:before {
content: "\f146";
}
.fa-minus-square-o:before {
content: "\f147";
}
.fa-level-up:before {
content: "\f148";
}
.fa-level-down:before {
content: "\f149";
}
.fa-check-square:before {
content: "\f14a";
}
.fa-pencil-square:before {
content: "\f14b";
}
.fa-external-link-square:before {
content: "\f14c";
}
.fa-share-square:before {
content: "\f14d";
}
.fa-compass:before {
content: "\f14e";
}
.fa-toggle-down:before,
.fa-caret-square-o-down:before {
content: "\f150";
}
.fa-toggle-up:before,
.fa-caret-square-o-up:before {
content: "\f151";
}
.fa-toggle-right:before,
.fa-caret-square-o-right:before {
content: "\f152";
}
.fa-euro:before,
.fa-eur:before {
content: "\f153";
}
.fa-gbp:before {
content: "\f154";
}
.fa-dollar:before,
.fa-usd:before {
content: "\f155";
}
.fa-rupee:before,
.fa-inr:before {
content: "\f156";
}
.fa-cny:before,
.fa-rmb:before,
.fa-yen:before,
.fa-jpy:before {
content: "\f157";
}
.fa-ruble:before,
.fa-rouble:before,
.fa-rub:before {
content: "\f158";
}
.fa-won:before,
.fa-krw:before {
content: "\f159";
}
.fa-bitcoin:before,
.fa-btc:before {
content: "\f15a";
}
.fa-file:before {
content: "\f15b";
}
.fa-file-text:before {
content: "\f15c";
}
.fa-sort-alpha-asc:before {
content: "\f15d";
}
.fa-sort-alpha-desc:before {
content: "\f15e";
}
.fa-sort-amount-asc:before {
content: "\f160";
}
.fa-sort-amount-desc:before {
content: "\f161";
}
.fa-sort-numeric-asc:before {
content: "\f162";
}
.fa-sort-numeric-desc:before {
content: "\f163";
}
.fa-thumbs-up:before {
content: "\f164";
}
.fa-thumbs-down:before {
content: "\f165";
}
.fa-youtube-square:before {
content: "\f166";
}
.fa-youtube:before {
content: "\f167";
}
.fa-xing:before {
content: "\f168";
}
.fa-xing-square:before {
content: "\f169";
}
.fa-youtube-play:before {
content: "\f16a";
}
.fa-dropbox:before {
content: "\f16b";
}
.fa-stack-overflow:before {
content: "\f16c";
}
.fa-instagram:before {
content: "\f16d";
}
.fa-flickr:before {
content: "\f16e";
}
.fa-adn:before {
content: "\f170";
}
.fa-bitbucket:before {
content: "\f171";
}
.fa-bitbucket-square:before {
content: "\f172";
}
.fa-tumblr:before {
content: "\f173";
}
.fa-tumblr-square:before {
content: "\f174";
}
.fa-long-arrow-down:before {
content: "\f175";
}
.fa-long-arrow-up:before {
content: "\f176";
}
.fa-long-arrow-left:before {
content: "\f177";
}
.fa-long-arrow-right:before {
content: "\f178";
}
.fa-apple:before {
content: "\f179";
}
.fa-windows:before {
content: "\f17a";
}
.fa-android:before {
content: "\f17b";
}
.fa-linux:before {
content: "\f17c";
}
.fa-dribbble:before {
content: "\f17d";
}
.fa-skype:before {
content: "\f17e";
}
.fa-foursquare:before {
content: "\f180";
}
.fa-trello:before {
content: "\f181";
}
.fa-female:before {
content: "\f182";
}
.fa-male:before {
content: "\f183";
}
.fa-gittip:before,
.fa-gratipay:before {
content: "\f184";
}
.fa-sun-o:before {
content: "\f185";
}
.fa-moon-o:before {
content: "\f186";
}
.fa-archive:before {
content: "\f187";
}
.fa-bug:before {
content: "\f188";
}
.fa-vk:before {
content: "\f189";
}
.fa-weibo:before {
content: "\f18a";
}
.fa-renren:before {
content: "\f18b";
}
.fa-pagelines:before {
content: "\f18c";
}
.fa-stack-exchange:before {
content: "\f18d";
}
.fa-arrow-circle-o-right:before {
content: "\f18e";
}
.fa-arrow-circle-o-left:before {
content: "\f190";
}
.fa-toggle-left:before,
.fa-caret-square-o-left:before {
content: "\f191";
}
.fa-dot-circle-o:before {
content: "\f192";
}
.fa-wheelchair:before {
content: "\f193";
}
.fa-vimeo-square:before {
content: "\f194";
}
.fa-turkish-lira:before,
.fa-try:before {
content: "\f195";
}
.fa-plus-square-o:before {
content: "\f196";
}
.fa-space-shuttle:before {
content: "\f197";
}
.fa-slack:before {
content: "\f198";
}
.fa-envelope-square:before {
content: "\f199";
}
.fa-wordpress:before {
content: "\f19a";
}
.fa-openid:before {
content: "\f19b";
}
.fa-institution:before,
.fa-bank:before,
.fa-university:before {
content: "\f19c";
}
.fa-mortar-board:before,
.fa-graduation-cap:before {
content: "\f19d";
}
.fa-yahoo:before {
content: "\f19e";
}
.fa-google:before {
content: "\f1a0";
}
.fa-reddit:before {
content: "\f1a1";
}
.fa-reddit-square:before {
content: "\f1a2";
}
.fa-stumbleupon-circle:before {
content: "\f1a3";
}
.fa-stumbleupon:before {
content: "\f1a4";
}
.fa-delicious:before {
content: "\f1a5";
}
.fa-digg:before {
content: "\f1a6";
}
.fa-pied-piper-pp:before {
content: "\f1a7";
}
.fa-pied-piper-alt:before {
content: "\f1a8";
}
.fa-drupal:before {
content: "\f1a9";
}
.fa-joomla:before {
content: "\f1aa";
}
.fa-language:before {
content: "\f1ab";
}
.fa-fax:before {
content: "\f1ac";
}
.fa-building:before {
content: "\f1ad";
}
.fa-child:before {
content: "\f1ae";
}
.fa-paw:before {
content: "\f1b0";
}
.fa-spoon:before {
content: "\f1b1";
}
.fa-cube:before {
content: "\f1b2";
}
.fa-cubes:before {
content: "\f1b3";
}
.fa-behance:before {
content: "\f1b4";
}
.fa-behance-square:before {
content: "\f1b5";
}
.fa-steam:before {
content: "\f1b6";
}
.fa-steam-square:before {
content: "\f1b7";
}
.fa-recycle:before {
content: "\f1b8";
}
.fa-automobile:before,
.fa-car:before {
content: "\f1b9";
}
.fa-cab:before,
.fa-taxi:before {
content: "\f1ba";
}
.fa-tree:before {
content: "\f1bb";
}
.fa-spotify:before {
content: "\f1bc";
}
.fa-deviantart:before {
content: "\f1bd";
}
.fa-soundcloud:before {
content: "\f1be";
}
.fa-database:before {
content: "\f1c0";
}
.fa-file-pdf-o:before {
content: "\f1c1";
}
.fa-file-word-o:before {
content: "\f1c2";
}
.fa-file-excel-o:before {
content: "\f1c3";
}
.fa-file-powerpoint-o:before {
content: "\f1c4";
}
.fa-file-photo-o:before,
.fa-file-picture-o:before,
.fa-file-image-o:before {
content: "\f1c5";
}
.fa-file-zip-o:before,
.fa-file-archive-o:before {
content: "\f1c6";
}
.fa-file-sound-o:before,
.fa-file-audio-o:before {
content: "\f1c7";
}
.fa-file-movie-o:before,
.fa-file-video-o:before {
content: "\f1c8";
}
.fa-file-code-o:before {
content: "\f1c9";
}
.fa-vine:before {
content: "\f1ca";
}
.fa-codepen:before {
content: "\f1cb";
}
.fa-jsfiddle:before {
content: "\f1cc";
}
.fa-life-bouy:before,
.fa-life-buoy:before,
.fa-life-saver:before,
.fa-support:before,
.fa-life-ring:before {
content: "\f1cd";
}
.fa-circle-o-notch:before {
content: "\f1ce";
}
.fa-ra:before,
.fa-resistance:before,
.fa-rebel:before {
content: "\f1d0";
}
.fa-ge:before,
.fa-empire:before {
content: "\f1d1";
}
.fa-git-square:before {
content: "\f1d2";
}
.fa-git:before {
content: "\f1d3";
}
.fa-y-combinator-square:before,
.fa-yc-square:before,
.fa-hacker-news:before {
content: "\f1d4";
}
.fa-tencent-weibo:before {
content: "\f1d5";
}
.fa-qq:before {
content: "\f1d6";
}
.fa-wechat:before,
.fa-weixin:before {
content: "\f1d7";
}
.fa-send:before,
.fa-paper-plane:before {
content: "\f1d8";
}
.fa-send-o:before,
.fa-paper-plane-o:before {
content: "\f1d9";
}
.fa-history:before {
content: "\f1da";
}
.fa-circle-thin:before {
content: "\f1db";
}
.fa-header:before {
content: "\f1dc";
}
.fa-paragraph:before {
content: "\f1dd";
}
.fa-sliders:before {
content: "\f1de";
}
.fa-share-alt:before {
content: "\f1e0";
}
.fa-share-alt-square:before {
content: "\f1e1";
}
.fa-bomb:before {
content: "\f1e2";
}
.fa-soccer-ball-o:before,
.fa-futbol-o:before {
content: "\f1e3";
}
.fa-tty:before {
content: "\f1e4";
}
.fa-binoculars:before {
content: "\f1e5";
}
.fa-plug:before {
content: "\f1e6";
}
.fa-slideshare:before {
content: "\f1e7";
}
.fa-twitch:before {
content: "\f1e8";
}
.fa-yelp:before {
content: "\f1e9";
}
.fa-newspaper-o:before {
content: "\f1ea";
}
.fa-wifi:before {
content: "\f1eb";
}
.fa-calculator:before {
content: "\f1ec";
}
.fa-paypal:before {
content: "\f1ed";
}
.fa-google-wallet:before {
content: "\f1ee";
}
.fa-cc-visa:before {
content: "\f1f0";
}
.fa-cc-mastercard:before {
content: "\f1f1";
}
.fa-cc-discover:before {
content: "\f1f2";
}
.fa-cc-amex:before {
content: "\f1f3";
}
.fa-cc-paypal:before {
content: "\f1f4";
}
.fa-cc-stripe:before {
content: "\f1f5";
}
.fa-bell-slash:before {
content: "\f1f6";
}
.fa-bell-slash-o:before {
content: "\f1f7";
}
.fa-trash:before {
content: "\f1f8";
}
.fa-copyright:before {
content: "\f1f9";
}
.fa-at:before {
content: "\f1fa";
}
.fa-eyedropper:before {
content: "\f1fb";
}
.fa-paint-brush:before {
content: "\f1fc";
}
.fa-birthday-cake:before {
content: "\f1fd";
}
.fa-area-chart:before {
content: "\f1fe";
}
.fa-pie-chart:before {
content: "\f200";
}
.fa-line-chart:before {
content: "\f201";
}
.fa-lastfm:before {
content: "\f202";
}
.fa-lastfm-square:before {
content: "\f203";
}
.fa-toggle-off:before {
content: "\f204";
}
.fa-toggle-on:before {
content: "\f205";
}
.fa-bicycle:before {
content: "\f206";
}
.fa-bus:before {
content: "\f207";
}
.fa-ioxhost:before {
content: "\f208";
}
.fa-angellist:before {
content: "\f209";
}
.fa-cc:before {
content: "\f20a";
}
.fa-shekel:before,
.fa-sheqel:before,
.fa-ils:before {
content: "\f20b";
}
.fa-meanpath:before {
content: "\f20c";
}
.fa-buysellads:before {
content: "\f20d";
}
.fa-connectdevelop:before {
content: "\f20e";
}
.fa-dashcube:before {
content: "\f210";
}
.fa-forumbee:before {
content: "\f211";
}
.fa-leanpub:before {
content: "\f212";
}
.fa-sellsy:before {
content: "\f213";
}
.fa-shirtsinbulk:before {
content: "\f214";
}
.fa-simplybuilt:before {
content: "\f215";
}
.fa-skyatlas:before {
content: "\f216";
}
.fa-cart-plus:before {
content: "\f217";
}
.fa-cart-arrow-down:before {
content: "\f218";
}
.fa-diamond:before {
content: "\f219";
}
.fa-ship:before {
content: "\f21a";
}
.fa-user-secret:before {
content: "\f21b";
}
.fa-motorcycle:before {
content: "\f21c";
}
.fa-street-view:before {
content: "\f21d";
}
.fa-heartbeat:before {
content: "\f21e";
}
.fa-venus:before {
content: "\f221";
}
.fa-mars:before {
content: "\f222";
}
.fa-mercury:before {
content: "\f223";
}
.fa-intersex:before,
.fa-transgender:before {
content: "\f224";
}
.fa-transgender-alt:before {
content: "\f225";
}
.fa-venus-double:before {
content: "\f226";
}
.fa-mars-double:before {
content: "\f227";
}
.fa-venus-mars:before {
content: "\f228";
}
.fa-mars-stroke:before {
content: "\f229";
}
.fa-mars-stroke-v:before {
content: "\f22a";
}
.fa-mars-stroke-h:before {
content: "\f22b";
}
.fa-neuter:before {
content: "\f22c";
}
.fa-genderless:before {
content: "\f22d";
}
.fa-facebook-official:before {
content: "\f230";
}
.fa-pinterest-p:before {
content: "\f231";
}
.fa-whatsapp:before {
content: "\f232";
}
.fa-server:before {
content: "\f233";
}
.fa-user-plus:before {
content: "\f234";
}
.fa-user-times:before {
content: "\f235";
}
.fa-hotel:before,
.fa-bed:before {
content: "\f236";
}
.fa-viacoin:before {
content: "\f237";
}
.fa-train:before {
content: "\f238";
}
.fa-subway:before {
content: "\f239";
}
.fa-medium:before {
content: "\f23a";
}
.fa-yc:before,
.fa-y-combinator:before {
content: "\f23b";
}
.fa-optin-monster:before {
content: "\f23c";
}
.fa-opencart:before {
content: "\f23d";
}
.fa-expeditedssl:before {
content: "\f23e";
}
.fa-battery-4:before,
.fa-battery:before,
.fa-battery-full:before {
content: "\f240";
}
.fa-battery-3:before,
.fa-battery-three-quarters:before {
content: "\f241";
}
.fa-battery-2:before,
.fa-battery-half:before {
content: "\f242";
}
.fa-battery-1:before,
.fa-battery-quarter:before {
content: "\f243";
}
.fa-battery-0:before,
.fa-battery-empty:before {
content: "\f244";
}
.fa-mouse-pointer:before {
content: "\f245";
}
.fa-i-cursor:before {
content: "\f246";
}
.fa-object-group:before {
content: "\f247";
}
.fa-object-ungroup:before {
content: "\f248";
}
.fa-sticky-note:before {
content: "\f249";
}
.fa-sticky-note-o:before {
content: "\f24a";
}
.fa-cc-jcb:before {
content: "\f24b";
}
.fa-cc-diners-club:before {
content: "\f24c";
}
.fa-clone:before {
content: "\f24d";
}
.fa-balance-scale:before {
content: "\f24e";
}
.fa-hourglass-o:before {
content: "\f250";
}
.fa-hourglass-1:before,
.fa-hourglass-start:before {
content: "\f251";
}
.fa-hourglass-2:before,
.fa-hourglass-half:before {
content: "\f252";
}
.fa-hourglass-3:before,
.fa-hourglass-end:before {
content: "\f253";
}
.fa-hourglass:before {
content: "\f254";
}
.fa-hand-grab-o:before,
.fa-hand-rock-o:before {
content: "\f255";
}
.fa-hand-stop-o:before,
.fa-hand-paper-o:before {
content: "\f256";
}
.fa-hand-scissors-o:before {
content: "\f257";
}
.fa-hand-lizard-o:before {
content: "\f258";
}
.fa-hand-spock-o:before {
content: "\f259";
}
.fa-hand-pointer-o:before {
content: "\f25a";
}
.fa-hand-peace-o:before {
content: "\f25b";
}
.fa-trademark:before {
content: "\f25c";
}
.fa-registered:before {
content: "\f25d";
}
.fa-creative-commons:before {
content: "\f25e";
}
.fa-gg:before {
content: "\f260";
}
.fa-gg-circle:before {
content: "\f261";
}
.fa-tripadvisor:before {
content: "\f262";
}
.fa-odnoklassniki:before {
content: "\f263";
}
.fa-odnoklassniki-square:before {
content: "\f264";
}
.fa-get-pocket:before {
content: "\f265";
}
.fa-wikipedia-w:before {
content: "\f266";
}
.fa-safari:before {
content: "\f267";
}
.fa-chrome:before {
content: "\f268";
}
.fa-firefox:before {
content: "\f269";
}
.fa-opera:before {
content: "\f26a";
}
.fa-internet-explorer:before {
content: "\f26b";
}
.fa-tv:before,
.fa-television:before {
content: "\f26c";
}
.fa-contao:before {
content: "\f26d";
}
.fa-500px:before {
content: "\f26e";
}
.fa-amazon:before {
content: "\f270";
}
.fa-calendar-plus-o:before {
content: "\f271";
}
.fa-calendar-minus-o:before {
content: "\f272";
}
.fa-calendar-times-o:before {
content: "\f273";
}
.fa-calendar-check-o:before {
content: "\f274";
}
.fa-industry:before {
content: "\f275";
}
.fa-map-pin:before {
content: "\f276";
}
.fa-map-signs:before {
content: "\f277";
}
.fa-map-o:before {
content: "\f278";
}
.fa-map:before {
content: "\f279";
}
.fa-commenting:before {
content: "\f27a";
}
.fa-commenting-o:before {
content: "\f27b";
}
.fa-houzz:before {
content: "\f27c";
}
.fa-vimeo:before {
content: "\f27d";
}
.fa-black-tie:before {
content: "\f27e";
}
.fa-fonticons:before {
content: "\f280";
}
.fa-reddit-alien:before {
content: "\f281";
}
.fa-edge:before {
content: "\f282";
}
.fa-credit-card-alt:before {
content: "\f283";
}
.fa-codiepie:before {
content: "\f284";
}
.fa-modx:before {
content: "\f285";
}
.fa-fort-awesome:before {
content: "\f286";
}
.fa-usb:before {
content: "\f287";
}
.fa-product-hunt:before {
content: "\f288";
}
.fa-mixcloud:before {
content: "\f289";
}
.fa-scribd:before {
content: "\f28a";
}
.fa-pause-circle:before {
content: "\f28b";
}
.fa-pause-circle-o:before {
content: "\f28c";
}
.fa-stop-circle:before {
content: "\f28d";
}
.fa-stop-circle-o:before {
content: "\f28e";
}
.fa-shopping-bag:before {
content: "\f290";
}
.fa-shopping-basket:before {
content: "\f291";
}
.fa-hashtag:before {
content: "\f292";
}
.fa-bluetooth:before {
content: "\f293";
}
.fa-bluetooth-b:before {
content: "\f294";
}
.fa-percent:before {
content: "\f295";
}
.fa-gitlab:before {
content: "\f296";
}
.fa-wpbeginner:before {
content: "\f297";
}
.fa-wpforms:before {
content: "\f298";
}
.fa-envira:before {
content: "\f299";
}
.fa-universal-access:before {
content: "\f29a";
}
.fa-wheelchair-alt:before {
content: "\f29b";
}
.fa-question-circle-o:before {
content: "\f29c";
}
.fa-blind:before {
content: "\f29d";
}
.fa-audio-description:before {
content: "\f29e";
}
.fa-volume-control-phone:before {
content: "\f2a0";
}
.fa-braille:before {
content: "\f2a1";
}
.fa-assistive-listening-systems:before {
content: "\f2a2";
}
.fa-asl-interpreting:before,
.fa-american-sign-language-interpreting:before {
content: "\f2a3";
}
.fa-deafness:before,
.fa-hard-of-hearing:before,
.fa-deaf:before {
content: "\f2a4";
}
.fa-glide:before {
content: "\f2a5";
}
.fa-glide-g:before {
content: "\f2a6";
}
.fa-signing:before,
.fa-sign-language:before {
content: "\f2a7";
}
.fa-low-vision:before {
content: "\f2a8";
}
.fa-viadeo:before {
content: "\f2a9";
}
.fa-viadeo-square:before {
content: "\f2aa";
}
.fa-snapchat:before {
content: "\f2ab";
}
.fa-snapchat-ghost:before {
content: "\f2ac";
}
.fa-snapchat-square:before {
content: "\f2ad";
}
.fa-pied-piper:before {
content: "\f2ae";
}
.fa-first-order:before {
content: "\f2b0";
}
.fa-yoast:before {
content: "\f2b1";
}
.fa-themeisle:before {
content: "\f2b2";
}
.fa-google-plus-circle:before,
.fa-google-plus-official:before {
content: "\f2b3";
}
.fa-fa:before,
.fa-font-awesome:before {
content: "\f2b4";
}
.fa-handshake-o:before {
content: "\f2b5";
}
.fa-envelope-open:before {
content: "\f2b6";
}
.fa-envelope-open-o:before {
content: "\f2b7";
}
.fa-linode:before {
content: "\f2b8";
}
.fa-address-book:before {
content: "\f2b9";
}
.fa-address-book-o:before {
content: "\f2ba";
}
.fa-vcard:before,
.fa-address-card:before {
content: "\f2bb";
}
.fa-vcard-o:before,
.fa-address-card-o:before {
content: "\f2bc";
}
.fa-user-circle:before {
content: "\f2bd";
}
.fa-user-circle-o:before {
content: "\f2be";
}
.fa-user-o:before {
content: "\f2c0";
}
.fa-id-badge:before {
content: "\f2c1";
}
.fa-drivers-license:before,
.fa-id-card:before {
content: "\f2c2";
}
.fa-drivers-license-o:before,
.fa-id-card-o:before {
content: "\f2c3";
}
.fa-quora:before {
content: "\f2c4";
}
.fa-free-code-camp:before {
content: "\f2c5";
}
.fa-telegram:before {
content: "\f2c6";
}
.fa-thermometer-4:before,
.fa-thermometer:before,
.fa-thermometer-full:before {
content: "\f2c7";
}
.fa-thermometer-3:before,
.fa-thermometer-three-quarters:before {
content: "\f2c8";
}
.fa-thermometer-2:before,
.fa-thermometer-half:before {
content: "\f2c9";
}
.fa-thermometer-1:before,
.fa-thermometer-quarter:before {
content: "\f2ca";
}
.fa-thermometer-0:before,
.fa-thermometer-empty:before {
content: "\f2cb";
}
.fa-shower:before {
content: "\f2cc";
}
.fa-bathtub:before,
.fa-s15:before,
.fa-bath:before {
content: "\f2cd";
}
.fa-podcast:before {
content: "\f2ce";
}
.fa-window-maximize:before {
content: "\f2d0";
}
.fa-window-minimize:before {
content: "\f2d1";
}
.fa-window-restore:before {
content: "\f2d2";
}
.fa-times-rectangle:before,
.fa-window-close:before {
content: "\f2d3";
}
.fa-times-rectangle-o:before,
.fa-window-close-o:before {
content: "\f2d4";
}
.fa-bandcamp:before {
content: "\f2d5";
}
.fa-grav:before {
content: "\f2d6";
}
.fa-etsy:before {
content: "\f2d7";
}
.fa-imdb:before {
content: "\f2d8";
}
.fa-ravelry:before {
content: "\f2d9";
}
.fa-eercast:before {
content: "\f2da";
}
.fa-microchip:before {
content: "\f2db";
}
.fa-snowflake-o:before {
content: "\f2dc";
}
.fa-superpowers:before {
content: "\f2dd";
}
.fa-wpexplorer:before {
content: "\f2de";
}
.fa-meetup:before {
content: "\f2e0";
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/**
@Name:layer v3.0.3 Web弹层组件
@Author:贤心
@Site:http://layer.layui.com
@License:MIT
*/
;!function(window, undefined){
"use strict";
var isLayui = window.layui && layui.define, $, win, ready = {
getPath: function(){
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
if(script.getAttribute('merge')) return;
return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
}(),
config: {}, end: {}, minIndex: 0, minLeft: [],
btn: ['确定', '取消'],
//五种原始层模式
type: ['dialog', 'page', 'iframe', 'loading', 'tips']
};
//默认内置方法。
var layer = {
v: '3.0.3',
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
) : false;
}(),
index: (window.layer && window.layer.v) ? 100000 : 0,
path: ready.getPath,
config: function(options, fn){
options = options || {};
layer.cache = ready.config = $.extend({}, ready.config, options);
layer.path = ready.config.path || layer.path;
typeof options.extend === 'string' && (options.extend = [options.extend]);
if(ready.config.path) layer.ready();
if(!options.extend) return this;
isLayui
? layui.addcss('modules/layer/' + options.extend)
: layer.link('skin/' + options.extend);
return this;
},
//载入CSS配件
link: function(href, fn, cssname){
//未设置路径,则不主动加载css
if(!layer.path) return;
var head = $('head')[0], link = document.createElement('link');
if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, '');
var id = 'layuicss-'+app, timeout = 0;
link.rel = 'stylesheet';
link.href = layer.path + href;
link.id = id;
if(!$('#'+ id)[0]){
head.appendChild(link);
}
if(typeof fn !== 'function') return;
//轮询css是否加载完毕
(function poll() {
if(++timeout > 8 * 1000 / 100){
return window.console && console.error('layer.css: Invalid');
}
parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
}());
},
ready: function(callback){
var cssname = 'skinlayercss', ver = '303';
isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
: layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
return this;
},
//各种快捷引用
alert: function(content, options, yes){
var type = typeof options === 'function';
if(type) yes = options;
return layer.open($.extend({
content: content,
yes: yes
}, type ? {} : options));
},
confirm: function(content, options, yes, cancel){
var type = typeof options === 'function';
if(type){
cancel = yes;
yes = options;
}
return layer.open($.extend({
content: content,
btn: ready.btn,
yes: yes,
btn2: cancel
}, type ? {} : options));
},
msg: function(content, options, end){ //最常用提示层
var type = typeof options === 'function', rskin = ready.config.skin;
var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
var anim = doms.anim.length - 1;
if(type) end = options;
return layer.open($.extend({
content: content,
time: 3000,
shade: false,
skin: skin,
title: false,
closeBtn: false,
btn: false,
resize: false,
end: end
}, (type && !ready.config.skin) ? {
skin: skin + ' layui-layer-hui',
anim: anim
} : function(){
options = options || {};
if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
}
return options;
}()));
},
load: function(icon, options){
return layer.open($.extend({
type: 3,
icon: icon || 0,
resize: false,
shade: 0.01
}, options));
},
tips: function(content, follow, options){
return layer.open($.extend({
type: 4,
content: [content, follow],
closeBtn: false,
time: 3000,
shade: false,
resize: false,
fixed: false,
maxWidth: 210
}, options));
}
};
var Class = function(setings){
var that = this;
that.index = ++layer.index;
that.config = $.extend({}, that.config, ready.config, setings);
document.body ? that.creat() : setTimeout(function(){
that.creat();
}, 30);
};
Class.pt = Class.prototype;
//缓存常用字符
var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
//默认配置
Class.pt.config = {
type: 0,
shade: 0.3,
fixed: true,
move: doms[1],
title: '信息',
offset: 'auto',
area: 'auto',
closeBtn: 1,
time: 0, //0表示不自动关闭
zIndex: 19891014,
maxWidth: 360,
anim: 0,
isOutAnim: true,
icon: -1,
moveType: 1,
resize: true,
scrollbar: true, //是否允许浏览器滚动条
tips: 2
};
//容器
Class.pt.vessel = function(conType, callback){
var that = this, times = that.index, config = that.config;
var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
var ismax = config.maxmin && (config.type === 1 || config.type === 2);
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
+ (titype ? config.title[0] : config.title)
+ '</div>' : '');
config.zIndex = zIndex;
callback([
//遮罩
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
//主体
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
+ (conType && config.type != 2 ? '' : titleHTML)
+ '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
+ (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
+ (config.type == 1 && conType ? '' : (config.content||''))
+ '</div>'
+ '<span class="layui-layer-setwin">'+ function(){
var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
return closebtn;
}() + '</span>'
+ (config.btn ? function(){
var button = '';
typeof config.btn === 'string' && (config.btn = [config.btn]);
for(var i = 0, len = config.btn.length; i < len; i++){
button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
}
return '<div class="'+ doms[6] + (config.btnAlign ? (' layui-layer-btn-' + config.btnAlign) : '') +'">'+ button +'</div>'
}() : '')
+ (config.resize ? '<span class="layui-layer-resize"></span>' : '')
+ '</div>'
], titleHTML, $('<div class="layui-layer-move"></div>'));
return that;
};
//创建骨架
Class.pt.creat = function(){
var that = this
,config = that.config
,times = that.index, nodeIndex
,content = config.content
,conType = typeof content === 'object'
,body = $('body');
if(config.id && $('#'+config.id)[0]) return;
if(typeof config.area === 'string'){
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
}
//anim兼容旧版shift
if(config.shift){
config.anim = config.shift;
}
if(layer.ie == 6){
config.fixed = false;
}
switch(config.type){
case 0:
config.btn = ('btn' in config) ? config.btn : ready.btn[0];
layer.closeAll('dialog');
break;
case 2:
var content = config.content = conType ? config.content : [config.content, 'auto'];
config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
break;
case 3:
delete config.title;
delete config.closeBtn;
config.icon === -1 && (config.icon === 0);
layer.closeAll('loading');
break;
case 4:
conType || (config.content = [config.content, 'body']);
config.follow = config.content[1];
config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
delete config.title;
config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
config.tipsMore || layer.closeAll('tips');
break;
}
//建立容器
that.vessel(conType, function(html, titleHTML, moveElem){
body.append(html[0]);
conType ? function(){
(config.type == 2 || config.type == 4) ? function(){
$('body').append(html[1]);
}() : function(){
if(!content.parents('.'+doms[0])[0]){
content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
$('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
}
}();
}() : body.append(html[1]);
$('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
that.layero = $('#'+ doms[0] + times);
config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
}).auto(times);
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
//坐标自适应浏览器窗口尺寸
config.type == 4 ? that.tips() : that.offset();
if(config.fixed){
win.on('resize', function(){
that.offset();
(/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
config.type == 4 && that.tips();
});
}
config.time <= 0 || setTimeout(function(){
layer.close(that.index)
}, config.time);
that.move().callback();
//为兼容jQuery3.0的css动画影响元素尺寸计算
if(doms.anim[config.anim]){
that.layero.addClass(doms.anim[config.anim]);
}
//记录关闭动画
if(config.isOutAnim){
that.layero.data('isOutAnim', true);
}
};
//自适应
Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);
if(config.area[0] === '' && config.maxWidth > 0){
//为了修复IE7下一个让人难以理解的bug
if(layer.ie && layer.ie < 8 && config.btn){
layero.width(layero.innerWidth());
}
layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
}
var area = [layero.innerWidth(), layero.innerHeight()];
var titHeight = layero.find(doms[1]).outerHeight() || 0;
var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
function setHeight(elem){
elem = layero.find(elem);
elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
}
switch(config.type){
case 2:
setHeight('iframe');
break;
default:
if(config.area[1] === ''){
if(config.fixed && area[1] >= win.height()){
area[1] = win.height();
setHeight('.'+doms[5]);
}
} else {
setHeight('.'+doms[5]);
}
break;
}
return that;
};
//计算坐标
Class.pt.offset = function(){
var that = this, config = that.config, layero = that.layero;
var area = [layero.outerWidth(), layero.outerHeight()];
var type = typeof config.offset === 'object';
that.offsetTop = (win.height() - area[1])/2;
that.offsetLeft = (win.width() - area[0])/2;
if(type){
that.offsetTop = config.offset[0];
that.offsetLeft = config.offset[1]||that.offsetLeft;
} else if(config.offset !== 'auto'){
if(config.offset === 't'){ //上
that.offsetTop = 0;
} else if(config.offset === 'r'){ //右
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'b'){ //下
that.offsetTop = win.height() - area[1];
} else if(config.offset === 'l'){ //左
that.offsetLeft = 0;
} else if(config.offset === 'lt'){ //左上角
that.offsetTop = 0;
that.offsetLeft = 0;
} else if(config.offset === 'lb'){ //左下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = 0;
} else if(config.offset === 'rt'){ //右上角
that.offsetTop = 0;
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'rb'){ //右下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = win.width() - area[0];
} else {
that.offsetTop = config.offset;
}
}
if(!config.fixed){
that.offsetTop = /%$/.test(that.offsetTop) ?
win.height()*parseFloat(that.offsetTop)/100
: parseFloat(that.offsetTop);
that.offsetLeft = /%$/.test(that.offsetLeft) ?
win.width()*parseFloat(that.offsetLeft)/100
: parseFloat(that.offsetLeft);
that.offsetTop += win.scrollTop();
that.offsetLeft += win.scrollLeft();
}
if(layero.attr('minLeft')){
that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
that.offsetLeft = layero.css('left');
}
layero.css({top: that.offsetTop, left: that.offsetLeft});
};
//Tips
Class.pt.tips = function(){
var that = this, config = that.config, layero = that.layero;
var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
if(!follow[0]) follow = $('body');
var goal = {
width: follow.outerWidth(),
height: follow.outerHeight(),
top: follow.offset().top,
left: follow.offset().left
}, tipsG = layero.find('.layui-layer-TipsG');
var guide = config.tips[0];
config.tips[1] || tipsG.remove();
goal.autoLeft = function(){
if(goal.left + layArea[0] - win.width() > 0){
goal.tipLeft = goal.left + goal.width - layArea[0];
tipsG.css({right: 12, left: 'auto'});
} else {
goal.tipLeft = goal.left;
}
};
//辨别tips的方位
goal.where = [function(){ //上
goal.autoLeft();
goal.tipTop = goal.top - layArea[1] - 10;
tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
}, function(){ //右
goal.tipLeft = goal.left + goal.width + 10;
goal.tipTop = goal.top;
tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
}, function(){ //下
goal.autoLeft();
goal.tipTop = goal.top + goal.height + 10;
tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
}, function(){ //左
goal.tipLeft = goal.left - layArea[0] - 10;
goal.tipTop = goal.top;
tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
}];
goal.where[guide-1]();
/* 8*2为小三角形占据的空间 */
if(guide === 1){
goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
} else if(guide === 2){
win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
} else if(guide === 3){
(goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
} else if(guide === 4){
layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
}
layero.find('.'+doms[5]).css({
'background-color': config.tips[1],
'padding-right': (config.closeBtn ? '30px' : '')
});
layero.css({
left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
});
};
//拖拽层
Class.pt.move = function(){
var that = this
,config = that.config
,_DOC = $(document)
,layero = that.layero
,moveElem = layero.find(config.move)
,resizeElem = layero.find('.layui-layer-resize')
,dict = {};
if(config.move){
moveElem.css('cursor', 'move');
}
moveElem.on('mousedown', function(e){
e.preventDefault();
if(config.move){
dict.moveStart = true;
dict.offset = [
e.clientX - parseFloat(layero.css('left'))
,e.clientY - parseFloat(layero.css('top'))
];
ready.moveElem.css('cursor', 'move').show();
}
});
resizeElem.on('mousedown', function(e){
e.preventDefault();
dict.resizeStart = true;
dict.offset = [e.clientX, e.clientY];
dict.area = [
layero.outerWidth()
,layero.outerHeight()
];
ready.moveElem.css('cursor', 'se-resize').show();
});
_DOC.on('mousemove', function(e){
//拖拽移动
if(dict.moveStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,fixed = layero.css('position') === 'fixed';
e.preventDefault();
dict.stX = fixed ? 0 : win.scrollLeft();
dict.stY = fixed ? 0 : win.scrollTop();
//控制元素不被拖出窗口外
if(!config.moveOut){
var setRig = win.width() - layero.outerWidth() + dict.stX
,setBot = win.height() - layero.outerHeight() + dict.stY;
X < dict.stX && (X = dict.stX);
X > setRig && (X = setRig);
Y < dict.stY && (Y = dict.stY);
Y > setBot && (Y = setBot);
}
layero.css({
left: X
,top: Y
});
}
//Resize
if(config.resize && dict.resizeStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1];
e.preventDefault();
layer.style(that.index, {
width: dict.area[0] + X
,height: dict.area[1] + Y
});
dict.isResize = true;
config.resizing && config.resizing(layero);
}
}).on('mouseup', function(e){
if(dict.moveStart){
delete dict.moveStart;
ready.moveElem.hide();
config.moveEnd && config.moveEnd(layero);
}
if(dict.resizeStart){
delete dict.resizeStart;
ready.moveElem.hide();
}
});
return that;
};
Class.pt.callback = function(){
var that = this, layero = that.layero, config = that.config;
that.openLayer();
if(config.success){
if(config.type == 2){
layero.find('iframe').on('load', function(){
config.success(layero, that.index);
});
} else {
config.success(layero, that.index);
}
}
layer.ie == 6 && that.IE6(layero);
//按钮
layero.find('.'+ doms[6]).children('a').on('click', function(){
var index = $(this).index();
if(index === 0){
if(config.yes){
config.yes(that.index, layero)
} else if(config['btn1']){
config['btn1'](that.index, layero)
} else {
layer.close(that.index);
}
} else {
var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
close === false || layer.close(that.index);
}
});
//取消
function cancel(){
var close = config.cancel && config.cancel(that.index, layero);
close === false || layer.close(that.index);
}
//右上角关闭回调
layero.find('.'+ doms[7]).on('click', cancel);
//点遮罩关闭
if(config.shadeClose){
$('#layui-layer-shade'+ that.index).on('click', function(){
layer.close(that.index);
});
}
//最小化
layero.find('.layui-layer-min').on('click', function(){
var min = config.min && config.min(layero);
min === false || layer.min(that.index, config);
});
//全屏/还原
layero.find('.layui-layer-max').on('click', function(){
if($(this).hasClass('layui-layer-maxmin')){
layer.restore(that.index);
config.restore && config.restore(layero);
} else {
layer.full(that.index, config);
setTimeout(function(){
config.full && config.full(layero);
}, 100);
}
});
config.end && (ready.end[that.index] = config.end);
};
//for ie6 恢复select
ready.reselect = function(){
$.each($('select'), function(index , value){
var sthis = $(this);
if(!sthis.parents('.'+doms[0])[0]){
(sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
}
sthis = null;
});
};
Class.pt.IE6 = function(layero){
//隐藏select
$('select').each(function(index , value){
var sthis = $(this);
if(!sthis.parents('.'+doms[0])[0]){
sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
}
sthis = null;
});
};
//需依赖原型的对外方法
Class.pt.openLayer = function(){
var that = this;
//置顶当前窗口
layer.zIndex = that.config.zIndex;
layer.setTop = function(layero){
var setZindex = function(){
layer.zIndex++;
layero.css('z-index', layer.zIndex + 1);
};
layer.zIndex = parseInt(layero[0].style.zIndex);
layero.on('mousedown', setZindex);
return layer.zIndex;
};
};
ready.record = function(layero){
var area = [
layero.width(),
layero.height(),
layero.position().top,
layero.position().left + parseFloat(layero.css('margin-left'))
];
layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
layero.attr({area: area});
};
ready.rescollbar = function(index){
if(doms.html.attr('layer-full') == index){
if(doms.html[0].style.removeProperty){
doms.html[0].style.removeProperty('overflow');
} else {
doms.html[0].style.removeAttribute('overflow');
}
doms.html.removeAttr('layer-full');
}
};
/** 内置成员 */
window.layer = layer;
//获取子iframe的DOM
layer.getChildFrame = function(selector, index){
index = index || $('.'+doms[4]).attr('times');
return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
};
//得到当前iframe层的索引,子iframe时使用
layer.getFrameIndex = function(name){
return $('#'+ name).parents('.'+doms[4]).attr('times');
};
//iframe层自适应宽高
layer.iframeAuto = function(index){
if(!index) return;
var heg = layer.getChildFrame('html', index).outerHeight();
var layero = $('#'+ doms[0] + index);
var titHeight = layero.find(doms[1]).outerHeight() || 0;
var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
layero.css({height: heg + titHeight + btnHeight});
layero.find('iframe').css({height: heg});
};
//重置iframe url
layer.iframeSrc = function(index, url){
$('#'+ doms[0] + index).find('iframe').attr('src', url);
};
//设定层的样式
layer.style = function(index, options, limit){
var layero = $('#'+ doms[0] + index)
,contElem = layero.find('.layui-layer-content')
,type = layero.attr('type')
,titHeight = layero.find(doms[1]).outerHeight() || 0
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
,minLeft = layero.attr('minLeft');
if(type === ready.type[3] || type === ready.type[4]){
return;
}
if(!limit){
if(parseFloat(options.width) <= 260){
options.width = 260;
}
if(parseFloat(options.height) - titHeight - btnHeight <= 64){
options.height = 64 + titHeight + btnHeight;
}
}
layero.css(options);
btnHeight = layero.find('.'+doms[6]).outerHeight()||0; //确保btnHeight有值
if(type === ready.type[2]){
layero.find('iframe').css({
height: parseFloat(options.height) - titHeight - btnHeight
});
// layero.find('iframe').height(parseFloat(options.height) - titHeight);
} else {
contElem.css({
height: parseFloat(options.height) - titHeight - btnHeight
- parseFloat(contElem.css('padding-top'))
- parseFloat(contElem.css('padding-bottom'))
})
}
};
//最小化
layer.min = function(index, options){
var layero = $('#'+ doms[0] + index)
,titHeight = layero.find(doms[1]).outerHeight() || 0
,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
,position = layero.css('position');
ready.record(layero);
if(ready.minLeft[0]){
left = ready.minLeft[0];
ready.minLeft.shift();
}
layero.attr('position', position);
layer.style(index, {
width: 180
,height: titHeight
,left: left
,top: win.height() - titHeight
,position: 'fixed'
,overflow: 'hidden'
}, true);
layero.find('.layui-layer-min').hide();
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
ready.rescollbar(index);
if(!layero.attr('minLeft')){
ready.minIndex++;
}
layero.attr('minLeft', left);
};
//还原
layer.restore = function(index){
var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
var type = layero.attr('type');
layer.style(index, {
width: parseFloat(area[0]),
height: parseFloat(area[1]),
top: parseFloat(area[2]),
left: parseFloat(area[3]),
position: layero.attr('position'),
overflow: 'visible'
}, true);
layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
layero.find('.layui-layer-min').show();
layero.attr('type') === 'page' && layero.find(doms[4]).show();
ready.rescollbar(index);
};
//全屏
layer.full = function(index){
var layero = $('#'+ doms[0] + index), timer;
ready.record(layero);
if(!doms.html.attr('layer-full')){
doms.html.css('overflow','hidden').attr('layer-full', index);
}
clearTimeout(timer);
timer = setTimeout(function(){
var isfix = layero.css('position') === 'fixed';
layer.style(index, {
top: isfix ? 0 : win.scrollTop(),
left: isfix ? 0 : win.scrollLeft(),
width: win.width(),
height: win.height()
}, true);
layero.find('.layui-layer-min').hide();
}, 100);
};
//改变title
layer.title = function(name, index){
var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
title.html(name);
};
//关闭layer总方法
layer.close = function(index){
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
if(!layero[0]) return;
var WRAP = 'layui-layer-wrap', remove = function(){
if(type === ready.type[1] && layero.attr('conType') === 'object'){
layero.children(':not(.'+ doms[5] +')').remove();
var wrap = layero.find('.'+WRAP);
for(var i = 0; i < 2; i++){
wrap.unwrap();
}
wrap.css('display', wrap.data('display')).removeClass(WRAP);
} else {
//低版本IE 回收 iframe
if(type === ready.type[2]){
try {
var iframe = $('#'+doms[4]+index)[0];
iframe.contentWindow.document.write('');
iframe.contentWindow.close();
layero.find('.'+doms[5])[0].removeChild(iframe);
} catch(e){}
}
layero[0].innerHTML = '';
layero.remove();
}
typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index];
};
if(layero.data('isOutAnim')){
layero.addClass(closeAnim);
}
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
layer.ie == 6 && ready.reselect();
ready.rescollbar(index);
if(layero.attr('minLeft')){
ready.minIndex--;
ready.minLeft.push(layero.attr('minLeft'));
}
if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
remove()
} else {
setTimeout(function(){
remove();
}, 200);
}
};
//关闭所有层
layer.closeAll = function(type){
$.each($('.'+doms[0]), function(){
var othis = $(this);
var is = type ? (othis.attr('type') === type) : 1;
is && layer.close(othis.attr('times'));
is = null;
});
};
/**
拓展模块,layui开始合并在一起
*/
var cache = layer.cache||{}, skin = function(type){
return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
};
//仿系统prompt
layer.prompt = function(options, yes){
var style = '';
options = options || {};
if(typeof options === 'function') yes = options;
if(options.area){
var area = options.area;
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
delete options.area;
}
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
}();
var success = options.success;
delete options.success;
return layer.open($.extend({
type: 1
,btn: ['确定','取消']
,content: content
,skin: 'layui-layer-prompt' + skin('prompt')
,maxWidth: win.width()
,success: function(layero){
prompt = layero.find('.layui-layer-input');
prompt.focus();
typeof success === 'function' && success(layero);
}
,resize: false
,yes: function(index){
var value = prompt.val();
if(value === ''){
prompt.focus();
} else if(value.length > (options.maxlength||500)) {
layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1});
} else {
yes && yes(value, index, prompt);
}
}
}, options));
};
//tab层
layer.tab = function(options){
options = options || {};
var tab = options.tab || {}
,success = options.success;
delete options.success;
return layer.open($.extend({
type: 1,
skin: 'layui-layer-tab' + skin('tab'),
resize: false,
title: function(){
var len = tab.length, ii = 1, str = '';
if(len > 0){
str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
for(; ii < len; ii++){
str += '<span>'+ tab[ii].title +'</span>';
}
}
return str;
}(),
content: '<ul class="layui-layer-tabmain">'+ function(){
var len = tab.length, ii = 1, str = '';
if(len > 0){
str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
for(; ii < len; ii++){
str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
}
}
return str;
}() +'</ul>',
success: function(layero){
var btn = layero.find('.layui-layer-title').children();
var main = layero.find('.layui-layer-tabmain').children();
btn.on('mousedown', function(e){
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
var othis = $(this), index = othis.index();
othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
main.eq(index).show().siblings().hide();
typeof options.change === 'function' && options.change(index);
});
typeof success === 'function' && success(layero);
}
}, options));
};
//相册层
layer.photos = function(options, loop, key){
var dict = {};
options = options || {};
if(!options.photos) return;
var type = options.photos.constructor === Object;
var photos = type ? options.photos : {}, data = photos.data || [];
var start = photos.start || 0;
dict.imgIndex = (start|0) + 1;
options.img = options.img || 'img';
var success = options.success;
delete options.success;
if(!type){ //页面直接获取
var parent = $(options.photos), pushData = function(){
data = [];
parent.find(options.img).each(function(index){
var othis = $(this);
othis.attr('layer-index', index);
data.push({
alt: othis.attr('alt'),
pid: othis.attr('layer-pid'),
src: othis.attr('layer-src') || othis.attr('src'),
thumb: othis.attr('src')
});
})
};
pushData();
if (data.length === 0) return;
loop || parent.on('click', options.img, function(){
var othis = $(this), index = othis.attr('layer-index');
layer.photos($.extend(options, {
photos: {
start: index,
data: data,
tab: options.tab
},
full: options.full
}), true);
pushData();
});
//不直接弹出
if(!loop) return;
} else if (data.length === 0){
return layer.msg('没有图片');
}
//上一张
dict.imgprev = function(key){
dict.imgIndex--;
if(dict.imgIndex < 1){
dict.imgIndex = data.length;
}
dict.tabimg(key);
};
//下一张
dict.imgnext = function(key,errorMsg){
dict.imgIndex++;
if(dict.imgIndex > data.length){
dict.imgIndex = 1;
if (errorMsg) {
return
}
}
dict.tabimg(key)
};
//方向键
dict.keyup = function(event){
if(!dict.end){
var code = event.keyCode;
event.preventDefault();
if(code === 37){
dict.imgprev(true);
} else if(code === 39) {
dict.imgnext(true);
} else if(code === 27) {
layer.close(dict.index);
}
}
};
//切换
dict.tabimg = function(key){
if(data.length <= 1) return;
photos.start = dict.imgIndex - 1;
layer.close(dict.index);
return layer.photos(options, true, key);
setTimeout(function(){
layer.photos(options, true, key);
}, 200);
};
//一些动作
dict.event = function(){
dict.bigimg.hover(function(){
dict.imgsee.show();
}, function(){
dict.imgsee.hide();
});
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
event.preventDefault();
dict.imgprev();
});
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
event.preventDefault();
dict.imgnext();
});
$(document).on('keyup', dict.keyup);
};
//图片预加载
function loadImage(url, callback, error) {
var img = new Image();
img.src = url;
if(img.complete){
return callback(img);
}
img.onload = function(){
img.onload = null;
callback(img);
};
img.onerror = function(e){
img.onerror = null;
error(e);
};
}
dict.loadi = layer.load(1, {
shade: 'shade' in options ? false : 0.9,
scrollbar: false
});
loadImage(data[start].src, function(img){
layer.close(dict.loadi);
dict.index = layer.open($.extend({
type: 1,
id: 'layui-layer-photos',
area: function(){
var imgarea = [img.width, img.height];
var winarea = [$(window).width() - 100, $(window).height() - 100];
//如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
imgarea[0] = imgarea[0]/wh[0];
imgarea[1] = imgarea[1]/wh[0];
} else if(wh[0] < wh[1]){
imgarea[0] = imgarea[0]/wh[1];
imgarea[1] = imgarea[1]/wh[1];
}
}
return [imgarea[0]+'px', imgarea[1]+'px'];
}(),
title: false,
shade: 0.9,
shadeClose: true,
closeBtn: false,
move: '.layui-layer-phimg img',
moveType: 1,
scrollbar: false,
moveOut: true,
//anim: Math.random()*5|0,
isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'),
content: '<div class="layui-layer-phimg">'
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
+'<div class="layui-layer-imgsee">'
+(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
+'</div>'
+'</div>',
success: function(layero, index){
dict.bigimg = layero.find('.layui-layer-phimg');
dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
dict.event(layero);
options.tab && options.tab(data[start], layero);
typeof success === 'function' && success(layero);
}, end: function(){
dict.end = true;
$(document).off('keyup', dict.keyup);
}
}, options));
}, function(){
layer.close(dict.loadi);
layer.msg('当前图片地址异常<br>是否继续查看下一张?', {
time: 30000,
btn: ['下一张', '不看了'],
yes: function(){
data.length > 1 && dict.imgnext(true,true);
}
});
});
};
//主入口
ready.run = function(_$){
$ = _$;
win = $(window);
doms.html = $('html');
layer.open = function(deliver){
var o = new Class(deliver);
return o.index;
};
};
//加载方式
window.layui && layui.define ? (
layer.ready()
,layui.define('jquery', function(exports){ //layui加载
layer.path = layui.cache.dir;
ready.run(layui.jquery);
//暴露模块
window.layer = layer;
exports('layer', layer);
})
) : (
(typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载
ready.run(window.jQuery);
return layer;
}) : function(){ //普通script标签加载
ready.run(window.jQuery);
layer.ready();
}()
);
}(window); | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<error-page>
<error-code>404</error-code>
<location>/404.htm</location>
</error-page>
</web-app>
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-2-4
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<9
// For `typeof node.method` instead of `node.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.9.1",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event pojo is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support, all, a,
input, select, fragment,
opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
checkOn: !!input.value,
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",
// Will be defined later
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in orderinfo to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var i, l, thisCache,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
// Try to fetch any internally stored data first
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
this.each(function() {
jQuery.data( this, key, value );
});
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
hooks.cur = fn;
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, notxml, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
// In IE9+, Flash objects don't have .getAttribute (#12945)
// Support: IE9+
if ( typeof elem.getAttribute !== core_strundefined ) {
ret = elem.getAttribute( name );
}
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( rboolean.test( name ) ) {
// Set corresponding property to false for boolean attributes
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
if ( !getSetAttribute && ruseDefault.test( name ) ) {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
} else {
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
var
// Use .prop to determine if this attribute is understood as boolean
prop = jQuery.prop( elem, name ),
// Fetch it accordingly
attr = typeof prop === "boolean" && elem.getAttribute( name ),
detail = typeof prop === "boolean" ?
getSetInput && getSetAttribute ?
attr != null :
// oldIE fabricates an empty string for missing boolean attributes
// and conflates checked/selected into attroperties
ruseDefault.test( name ) ?
elem[ jQuery.camelCase( "default-" + name ) ] :
!!attr :
// fetch an attribute node for properties not recognized as boolean
elem.getAttributeNode( name );
return detail && detail.value !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
// fix oldIE value attroperty
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return jQuery.nodeName( elem, "input" ) ?
// Ignore the value *property* by using defaultValue
elem.defaultValue :
ret && ret.specified ? ret.value : undefined;
},
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret == null ? undefined : ret;
}
});
});
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
event.isTrigger = true;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
}
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== document.activeElement && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === document.activeElement && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var i,
cachedruns,
Expr,
getText,
isXML,
compile,
hasDuplicate,
outermostContext,
// Local document vars
setDocument,
document,
docElem,
documentIsXML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
sortOrder,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
support = {},
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Array methods
arr = [],
pop = arr.pop,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rsibling = /[\x20\t\r\n\f]*[+~]/,
rnative = /^[^{]+\{\s*\[native code/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
funescape = function( _, escaped ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
return high !== high ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Use a stripped-down slice if we can't use a native one
try {
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
while ( (elem = this[i++]) ) {
results.push( elem );
}
return results;
};
}
/**
* For feature detection
* @param {Function} fn The function to test for native support
*/
function isNative( fn ) {
return rnative.test( fn + "" );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var cache,
keys = [];
return (cache = function( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
});
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( !documentIsXML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
// QSA path
if ( support.qsa && !rbuggyQSA.test(selector) ) {
old = true;
nid = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsXML = isXML( doc );
// Check if getElementsByTagName("*") returns only elements
support.tagNameNoComments = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if attributes should be retrieved by attribute nodes
support.attributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
});
// Check if getElementsByClassName can be trusted
support.getByClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
});
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
support.getByName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = doc.getElementsByName &&
// buggy browsers will return fewer than the correct 2
doc.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
doc.getElementsByName( expando + 0 ).length;
support.getIdNotName = !doc.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// IE6/7 return modified attributes
Expr.attrHandle = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}) ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
};
// ID find and filter
if ( support.getIdNotName ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.tagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Name
Expr.find["NAME"] = support.getByName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
};
// Class
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
return context.getElementsByClassName( className );
}
};
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21),
// no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ];
if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
if ( div.querySelectorAll("[i^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
// Document orderinfo sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
var compare;
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
if ( a === doc || contains( preferredDoc, a ) ) {
return -1;
}
if ( b === doc || contains( preferredDoc, b ) ) {
return 1;
}
return 0;
}
return compare & 4 ? -1 : 1;
}
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
hasDuplicate = false;
[0, 0].sort( sortOrder );
support.detectDuplicates = hasDuplicate;
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyQSA always contains :focus, so no need for an existence check
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
var val;
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
if ( !documentIsXML ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( documentIsXML || support.attributes ) {
return elem.getAttribute( name );
}
return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
name :
val && val.specified ? val.value : null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[4] ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifider
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsXML ?
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
elem.lang) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push( {
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
} );
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push( {
value: matched,
type: type,
matches: match
} );
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !documentIsXML &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
documentIsXML,
results,
rsibling.test( selector )
);
return results;
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Easy API for creating new setFilters
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Initialize with the default document
setDocument();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, ret, self,
len = this.length;
if ( typeof selector !== "string" ) {
self = this;
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
ret = [];
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, this[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true) );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
var isFunc = jQuery.isFunction( value );
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( !isFunc && typeof value !== "string" ) {
value = jQuery( value ).not( this ).detach();
}
return this.domManip( [ value ], true, function( elem ) {
var next = this.nextSibling,
parent = this.parentNode;
if ( parent ) {
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
});
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, table ? self.html() : undefined );
}
self.domManip( args, table, callback );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
node,
i
);
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery.ajax({
url: node.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
var attr = elem.getAttributeNode("type");
elem.type = ( attr && attr.specified ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
var bool = typeof state === "boolean";
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing pojo to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( (match = rheaders.exec( responseHeadersString )) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in orderinfo when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 ) {
isSuccess = true;
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
isSuccess = true;
statusText = "notmodified";
// If we have data, let's convert it
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv2, current, conv, tmp,
converters = {},
i = 0,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ];
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split(" ");
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.splice( i--, 0, current );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s["throws"] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
// Update prev for next iteration
prev = current;
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( err ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
createTweens( animation, props );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var value, name, index, easing, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/*jshint validthis:true */
var prop, index, length,
value, dataShow, toggle,
tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
doAnimation.finish = function() {
anim.stop( true );
};
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.cur && hooks.cur.finish ) {
hooks.cur.finish.call( this );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.documentElement;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.documentElement;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// })();
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window ); | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
function getTime() {
var date = new Date();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if(month >= 1 && month <= 9) {
month = "0" + month;
}
if(strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
return date.getFullYear() + month + strDate + date.getHours() + date.getMinutes() + date.getSeconds();
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
//服务器端url
var baseUrl = "http://localhost:8080/hb";
//不受这个影响的地址有:
//1. win10.js 854行 857行
//2. romeTypeTable.js 88行
//3. CommonFilter.java 54行 | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
//设置cookie 销毁时间:会话结束
function setCookie(name, value) {
document.cookie = name + '=' + value + "; path=/";
}
//读取cookie
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); //正则匹配
if(arr = document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
}
}
//删除一个cookie
//思路就是将cookie的时间设置成从前,这样浏览器就直接删除了
//上面用到的设置cookie没有指定销毁时间,是在浏览器关闭时自动删除
//也就是不设置时间的cookie不会存储到硬盘,也就是保存到内存中,随浏览器生存
function deleteCookie(name) {
var date = new Date();
//将date设置为过去的时间
date.setTime(date.getTime() - 10000);
//将userId这个cookie删除
document.cookie = name + "=删除; path=/; expires=" + date.toGMTString();
}
//为了方便 cookies的域都在"/" | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/*! FileSaver.js
* A saveAs() FileSaver implementation.
* 2014-01-24
*
* By Eli Grey, http://eligrey.com
* License: X11/MIT
* See LICENSE.md
*/
/*global self */
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs = saveAs
// IE 10+ (native saveAs)
|| (typeof navigator !== "undefined" &&
navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
// Everyone else
|| (function(view) {
"use strict";
// IE <10 is explicitly unsupported
if (typeof navigator !== "undefined" &&
/MSIE [1-9]\./.test(navigator.userAgent)) {
return;
}
var
doc = view.document
// only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
, get_URL = function() {
return view.URL || view.webkitURL || view;
}
, URL = view.URL || view.webkitURL || view
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
, can_use_save_link = !view.externalHost && "download" in save_link
, click = function(node) {
var event = doc.createEvent("MouseEvents");
event.initMouseEvent(
"click", true, false, view, 0, 0, 0, 0, 0
, false, false, false, false, 0, null
);
node.dispatchEvent(event);
}
, webkit_req_fs = view.webkitRequestFileSystem
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
, throw_outside = function(ex) {
(view.setImmediate || view.setTimeout)(function() {
throw ex;
}, 0);
}
, force_saveable_type = "application/octet-stream"
, fs_min_size = 0
, deletion_queue = []
, process_deletion_queue = function() {
var i = deletion_queue.length;
while (i--) {
var file = deletion_queue[i];
if (typeof file === "string") { // file is an object URL
URL.revokeObjectURL(file);
} else { // file is a File
file.remove();
}
}
deletion_queue.length = 0; // clear queue
}
, dispatch = function(filesaver, event_types, event) {
event_types = [].concat(event_types);
var i = event_types.length;
while (i--) {
var listener = filesaver["on" + event_types[i]];
if (typeof listener === "function") {
try {
listener.call(filesaver, event || filesaver);
} catch (ex) {
throw_outside(ex);
}
}
}
}
, FileSaver = function(blob, name) {
// First try a.download, then web filesystem, then object URLs
var
filesaver = this
, type = blob.type
, blob_changed = false
, object_url
, target_view
, get_object_url = function() {
var object_url = get_URL().createObjectURL(blob);
deletion_queue.push(object_url);
return object_url;
}
, dispatch_all = function() {
dispatch(filesaver, "writestart progress write writeend".split(" "));
}
// on any filesys errors revert to saving with object URLs
, fs_error = function() {
// don't create more object URLs than needed
if (blob_changed || !object_url) {
object_url = get_object_url(blob);
}
if (target_view) {
target_view.location.href = object_url;
} else {
if(navigator.userAgent.match(/7\.[\d\s\.]+Safari/) // is Safari 7.x
&& typeof window.FileReader !== "undefined" // can convert to base64
&& blob.size <= 1024*1024*150 // file size max 150MB
) {
var reader = new window.FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() {
var frame = doc.createElement("iframe");
frame.src = reader.result;
frame.style.display = "none";
doc.body.appendChild(frame);
dispatch_all();
return;
}
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.SAVEDASUNKNOWN;
return;
}
else {
window.open(object_url, "_blank");
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.SAVEDASBLOB;
dispatch_all();
return;
}
}
}
, abortable = function(func) {
return function() {
if (filesaver.readyState !== filesaver.DONE) {
return func.apply(this, arguments);
}
};
}
, create_if_not_found = {create: true, exclusive: false}
, slice
;
filesaver.readyState = filesaver.INIT;
if (!name) {
name = "download";
}
if (can_use_save_link) {
object_url = get_object_url(blob);
// FF for Android has a nasty garbage collection mechanism
// that turns all objects that are not pure javascript into 'deadObject'
// this means `doc` and `save_link` are unusable and need to be recreated
// `view` is usable though:
doc = view.document;
save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
save_link.href = object_url;
save_link.download = name;
var event = doc.createEvent("MouseEvents");
event.initMouseEvent(
"click", true, false, view, 0, 0, 0, 0, 0
, false, false, false, false, 0, null
);
save_link.dispatchEvent(event);
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.SAVEDASBLOB;
dispatch_all();
return;
}
// Object and web filesystem URLs have a problem saving in Google Chrome when
// viewed in a tab, so I force save with application/octet-stream
// http://code.google.com/p/chromium/issues/detail?id=91158
if (view.chrome && type && type !== force_saveable_type) {
slice = blob.slice || blob.webkitSlice;
blob = slice.call(blob, 0, blob.size, force_saveable_type);
blob_changed = true;
}
// Since I can't be sure that the guessed media type will trigger a download
// in WebKit, I append .download to the filename.
// https://bugs.webkit.org/show_bug.cgi?id=65440
if (webkit_req_fs && name !== "download") {
name += ".download";
}
if (type === force_saveable_type || webkit_req_fs) {
target_view = view;
}
if (!req_fs) {
fs_error();
return;
}
fs_min_size += blob.size;
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
var save = function() {
dir.getFile(name, create_if_not_found, abortable(function(file) {
file.createWriter(abortable(function(writer) {
writer.onwriteend = function(event) {
target_view.location.href = file.toURL();
deletion_queue.push(file);
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.SAVEDASBLOB;
dispatch(filesaver, "writeend", event);
};
writer.onerror = function() {
var error = writer.error;
if (error.code !== error.ABORT_ERR) {
fs_error();
}
};
"writestart progress write abort".split(" ").forEach(function(event) {
writer["on" + event] = filesaver["on" + event];
});
writer.write(blob);
filesaver.abort = function() {
writer.abort();
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.FAILED;
};
filesaver.readyState = filesaver.WRITING;
}), fs_error);
}), fs_error);
};
dir.getFile(name, {create: false}, abortable(function(file) {
// delete file if it already exists
file.remove();
save();
}), abortable(function(ex) {
if (ex.code === ex.NOT_FOUND_ERR) {
save();
} else {
fs_error();
}
}));
}), fs_error);
}), fs_error);
}
, FS_proto = FileSaver.prototype
, saveAs = function(blob, name) {
return new FileSaver(blob, name);
}
;
FS_proto.abort = function() {
var filesaver = this;
filesaver.readyState = filesaver.DONE;
filesaver.savedAs = filesaver.FAILED;
dispatch(filesaver, "abort");
};
FS_proto.readyState = FS_proto.INIT = 0;
FS_proto.WRITING = 1;
FS_proto.DONE = 2;
FS_proto.FAILED = -1;
FS_proto.SAVEDASBLOB = 1;
FS_proto.SAVEDASURI = 2;
FS_proto.SAVEDASUNKNOWN = 3;
FS_proto.error =
FS_proto.onwritestart =
FS_proto.onprogress =
FS_proto.onwrite =
FS_proto.onabort =
FS_proto.onerror =
FS_proto.onwriteend =
null;
view.addEventListener("unload", process_deletion_queue, false);
saveAs.unload = function() {
process_deletion_queue();
view.removeEventListener("unload", process_deletion_queue, false);
};
return saveAs;
}(
typeof self !== "undefined" && self
|| typeof window !== "undefined" && window
|| this.content
));
// `self` is undefined in Firefox for Android content script context
// while `this` is nsIContentFrameMessageManager
// with an attribute `content` that corresponds to the window
if (typeof module !== "undefined" && module !== null) {
module.exports = saveAs;
} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
define([], function() {
return saveAs;
});
} else if(typeof Meteor !== 'undefined') { // make it available for Meteor
Meteor.saveAs = saveAs;
}
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if(cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function(range) {
if(R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for(var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({s:{r:R, c:outRow.length},e:{r:R+rowspan-1, c:outRow.length+colspan-1}});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if(date1904) v+=1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {s: {c:10000000, r:10000000}, e: {c:0, r:0 }};
for(var R = 0; R != data.length; ++R) {
for(var C = 0; C != data[R].length; ++C) {
if(range.s.r > R) range.s.r = R;
if(range.s.c > C) range.s.c = C;
if(range.e.r < R) range.e.r = R;
if(range.e.c < C) range.e.c = C;
var cell = {v: data[R][C] };
if(cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
if(typeof cell.v === 'number') cell.t = 'n';
else if(typeof cell.v === 'boolean') cell.t = 'b';
else if(cell.v instanceof Date) {
cell.t = 'n'; cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
}
else cell.t = 's';
ws[cell_ref] = cell;
}
}
if(range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if(!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
function export_table_to_excel(id,fileName) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
console.log(data);
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType:'xlsx', bookSST:false, type: 'binary'});
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), fileName+".xlsx")
}
| {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
/* -----------------------------------------------
/* How to use? : Check the GitHub README
/* ----------------------------------------------- */
/* To load a config file (particles.json) you need to host this demo (MAMP/WAMP/local)... */
/*
particlesJS.load('particles-js', 'particles.json', function() {
console.log('particles.js loaded - callback');
});
*/
/* Otherwise just put the config content (json): */
particlesJS('box',
{
"particles": {
"number": {
"value": 20,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#e5e5e5"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000"
},
"polygon": {
"nb_sides": 5
},
"image": {
"src": "img/github.svg",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 15,
"random": true,
"anim": {
"enable": false,
"speed": 5,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#ddd",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 2,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": false,
"mode": "repulse"
},
"onclick": {
"enable": true,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
"distance": 400,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true,
"config_demo": {
"hide_card": false,
"background_color": "#b61924",
"background_image": "",
"background_position": "50% 50%",
"background_repeat": "no-repeat",
"background_size": "cover"
}
}
); | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
var pJS = function(tag_id, params){
var canvas_el = document.querySelector('#'+tag_id+' > .particles-js-canvas-el');
/* particles.js variables with default values */
this.pJS = {
canvas: {
el: canvas_el,
w: canvas_el.offsetWidth,
h: canvas_el.offsetHeight
},
particles: {
number: {
value: 400,
density: {
enable: true,
value_area: 800
}
},
color: {
value: '#000'
},
shape: {
type: 'circle',
stroke: {
width: 0,
color: '#ff0000'
},
polygon: {
nb_sides: 5
},
image: {
src: '',
width: 100,
height: 100
}
},
opacity: {
value: 1,
random: false,
anim: {
enable: false,
speed: 2,
opacity_min: 0,
sync: false
}
},
size: {
value: 20,
random: false,
anim: {
enable: false,
speed: 20,
size_min: 0,
sync: false
}
},
line_linked: {
enable: true,
distance: 100,
color: '#fff',
opacity: 1,
width: 1
},
move: {
enable: true,
speed: 2,
direction: 'none',
random: false,
straight: false,
out_mode: 'out',
bounce: false,
attract: {
enable: false,
rotateX: 3000,
rotateY: 3000
}
},
array: []
},
interactivity: {
detect_on: 'canvas',
events: {
onhover: {
enable: true,
mode: 'grab'
},
onclick: {
enable: true,
mode: 'push'
},
resize: true
},
modes: {
grab:{
distance: 100,
line_linked:{
opacity: 1
}
},
bubble:{
distance: 200,
size: 80,
duration: 0.4
},
repulse:{
distance: 200,
duration: 0.4
},
push:{
particles_nb: 4
},
remove:{
particles_nb: 2
}
},
mouse:{}
},
retina_detect: false,
fn: {
interact: {},
modes: {},
vendors:{}
},
tmp: {}
};
var pJS = this.pJS;
/* params settings */
if(params){
Object.deepExtend(pJS, params);
}
pJS.tmp.obj = {
size_value: pJS.particles.size.value,
size_anim_speed: pJS.particles.size.anim.speed,
move_speed: pJS.particles.move.speed,
line_linked_distance: pJS.particles.line_linked.distance,
line_linked_width: pJS.particles.line_linked.width,
mode_grab_distance: pJS.interactivity.modes.grab.distance,
mode_bubble_distance: pJS.interactivity.modes.bubble.distance,
mode_bubble_size: pJS.interactivity.modes.bubble.size,
mode_repulse_distance: pJS.interactivity.modes.repulse.distance
};
pJS.fn.retinaInit = function(){
if(pJS.retina_detect && window.devicePixelRatio > 1){
pJS.canvas.pxratio = window.devicePixelRatio;
pJS.tmp.retina = true;
}
else{
pJS.canvas.pxratio = 1;
pJS.tmp.retina = false;
}
pJS.canvas.w = pJS.canvas.el.offsetWidth * pJS.canvas.pxratio;
pJS.canvas.h = pJS.canvas.el.offsetHeight * pJS.canvas.pxratio;
pJS.particles.size.value = pJS.tmp.obj.size_value * pJS.canvas.pxratio;
pJS.particles.size.anim.speed = pJS.tmp.obj.size_anim_speed * pJS.canvas.pxratio;
pJS.particles.move.speed = pJS.tmp.obj.move_speed * pJS.canvas.pxratio;
pJS.particles.line_linked.distance = pJS.tmp.obj.line_linked_distance * pJS.canvas.pxratio;
pJS.interactivity.modes.grab.distance = pJS.tmp.obj.mode_grab_distance * pJS.canvas.pxratio;
pJS.interactivity.modes.bubble.distance = pJS.tmp.obj.mode_bubble_distance * pJS.canvas.pxratio;
pJS.particles.line_linked.width = pJS.tmp.obj.line_linked_width * pJS.canvas.pxratio;
pJS.interactivity.modes.bubble.size = pJS.tmp.obj.mode_bubble_size * pJS.canvas.pxratio;
pJS.interactivity.modes.repulse.distance = pJS.tmp.obj.mode_repulse_distance * pJS.canvas.pxratio;
};
/* ---------- pJS functions - canvas ------------ */
pJS.fn.canvasInit = function(){
pJS.canvas.ctx = pJS.canvas.el.getContext('2d');
};
pJS.fn.canvasSize = function(){
pJS.canvas.el.width = pJS.canvas.w;
pJS.canvas.el.height = pJS.canvas.h;
if(pJS && pJS.interactivity.events.resize){
window.addEventListener('resize', function(){
pJS.canvas.w = pJS.canvas.el.offsetWidth;
pJS.canvas.h = pJS.canvas.el.offsetHeight;
/* resize canvas */
if(pJS.tmp.retina){
pJS.canvas.w *= pJS.canvas.pxratio;
pJS.canvas.h *= pJS.canvas.pxratio;
}
pJS.canvas.el.width = pJS.canvas.w;
pJS.canvas.el.height = pJS.canvas.h;
/* repaint canvas on anim disabled */
if(!pJS.particles.move.enable){
pJS.fn.particlesEmpty();
pJS.fn.particlesCreate();
pJS.fn.particlesDraw();
pJS.fn.vendors.densityAutoParticles();
}
/* density particles enabled */
pJS.fn.vendors.densityAutoParticles();
});
}
};
pJS.fn.canvasPaint = function(){
pJS.canvas.ctx.fillRect(0, 0, pJS.canvas.w, pJS.canvas.h);
};
pJS.fn.canvasClear = function(){
pJS.canvas.ctx.clearRect(0, 0, pJS.canvas.w, pJS.canvas.h);
};
/* --------- pJS functions - particles ----------- */
pJS.fn.particle = function(color, opacity, position){
/* size */
this.radius = (pJS.particles.size.random ? Math.random() : 1) * pJS.particles.size.value;
if(pJS.particles.size.anim.enable){
this.size_status = false;
this.vs = pJS.particles.size.anim.speed / 100;
if(!pJS.particles.size.anim.sync){
this.vs = this.vs * Math.random();
}
}
/* position */
this.x = position ? position.x : Math.random() * pJS.canvas.w;
this.y = position ? position.y : Math.random() * pJS.canvas.h;
/* check position - into the canvas */
if(this.x > pJS.canvas.w - this.radius*2) this.x = this.x - this.radius;
else if(this.x < this.radius*2) this.x = this.x + this.radius;
if(this.y > pJS.canvas.h - this.radius*2) this.y = this.y - this.radius;
else if(this.y < this.radius*2) this.y = this.y + this.radius;
/* check position - avoid overlap */
if(pJS.particles.move.bounce){
pJS.fn.vendors.checkOverlap(this, position);
}
/* color */
this.color = {};
if(typeof(color.value) == 'object'){
if(color.value instanceof Array){
var color_selected = color.value[Math.floor(Math.random() * pJS.particles.color.value.length)];
this.color.rgb = hexToRgb(color_selected);
}else{
if(color.value.r != undefined && color.value.g != undefined && color.value.b != undefined){
this.color.rgb = {
r: color.value.r,
g: color.value.g,
b: color.value.b
}
}
if(color.value.h != undefined && color.value.s != undefined && color.value.l != undefined){
this.color.hsl = {
h: color.value.h,
s: color.value.s,
l: color.value.l
}
}
}
}
else if(color.value == 'random'){
this.color.rgb = {
r: (Math.floor(Math.random() * (255 - 0 + 1)) + 0),
g: (Math.floor(Math.random() * (255 - 0 + 1)) + 0),
b: (Math.floor(Math.random() * (255 - 0 + 1)) + 0)
}
}
else if(typeof(color.value) == 'string'){
this.color = color;
this.color.rgb = hexToRgb(this.color.value);
}
/* opacity */
this.opacity = (pJS.particles.opacity.random ? Math.random() : 1) * pJS.particles.opacity.value;
if(pJS.particles.opacity.anim.enable){
this.opacity_status = false;
this.vo = pJS.particles.opacity.anim.speed / 100;
if(!pJS.particles.opacity.anim.sync){
this.vo = this.vo * Math.random();
}
}
/* animation - velocity for speed */
var velbase = {};
switch(pJS.particles.move.direction){
case 'top':
velbase = { x:0, y:-1 };
break;
case 'top-right':
velbase = { x:0.5, y:-0.5 };
break;
case 'right':
velbase = { x:1, y:-0 };
break;
case 'bottom-right':
velbase = { x:0.5, y:0.5 };
break;
case 'bottom':
velbase = { x:0, y:1 };
break;
case 'bottom-left':
velbase = { x:-0.5, y:1 };
break;
case 'left':
velbase = { x:-1, y:0 };
break;
case 'top-left':
velbase = { x:-0.5, y:-0.5 };
break;
default:
velbase = { x:0, y:0 };
break;
}
if(pJS.particles.move.straight){
this.vx = velbase.x;
this.vy = velbase.y;
if(pJS.particles.move.random){
this.vx = this.vx * (Math.random());
this.vy = this.vy * (Math.random());
}
}else{
this.vx = velbase.x + Math.random()-0.5;
this.vy = velbase.y + Math.random()-0.5;
}
// var theta = 2.0 * Math.PI * Math.random();
// this.vx = Math.cos(theta);
// this.vy = Math.sin(theta);
this.vx_i = this.vx;
this.vy_i = this.vy;
/* if shape is image */
var shape_type = pJS.particles.shape.type;
if(typeof(shape_type) == 'object'){
if(shape_type instanceof Array){
var shape_selected = shape_type[Math.floor(Math.random() * shape_type.length)];
this.shape = shape_selected;
}
}else{
this.shape = shape_type;
}
if(this.shape == 'image'){
var sh = pJS.particles.shape;
this.img = {
src: sh.image.src,
ratio: sh.image.width / sh.image.height
};
if(!this.img.ratio) this.img.ratio = 1;
if(pJS.tmp.img_type == 'svg' && pJS.tmp.source_svg != undefined){
pJS.fn.vendors.createSvgImg(this);
if(pJS.tmp.pushing){
this.img.loaded = false;
}
}
}
};
pJS.fn.particle.prototype.draw = function() {
var p = this;
if(p.radius_bubble != undefined){
var radius = p.radius_bubble;
}else{
var radius = p.radius;
}
if(p.opacity_bubble != undefined){
var opacity = p.opacity_bubble;
}else{
var opacity = p.opacity;
}
if(p.color.rgb){
var color_value = 'rgba('+p.color.rgb.r+','+p.color.rgb.g+','+p.color.rgb.b+','+opacity+')';
}else{
var color_value = 'hsla('+p.color.hsl.h+','+p.color.hsl.s+'%,'+p.color.hsl.l+'%,'+opacity+')';
}
pJS.canvas.ctx.fillStyle = color_value;
pJS.canvas.ctx.beginPath();
switch(p.shape){
case 'circle':
pJS.canvas.ctx.arc(p.x, p.y, radius, 0, Math.PI * 2, false);
break;
case 'edge':
pJS.canvas.ctx.rect(p.x-radius, p.y-radius, radius*2, radius*2);
break;
case 'triangle':
pJS.fn.vendors.drawShape(pJS.canvas.ctx, p.x-radius, p.y+radius / 1.66, radius*2, 3, 2);
break;
case 'polygon':
pJS.fn.vendors.drawShape(
pJS.canvas.ctx,
p.x - radius / (pJS.particles.shape.polygon.nb_sides/3.5), // startX
p.y - radius / (2.66/3.5), // startY
radius*2.66 / (pJS.particles.shape.polygon.nb_sides/3), // sideLength
pJS.particles.shape.polygon.nb_sides, // sideCountNumerator
1 // sideCountDenominator
);
break;
case 'star':
pJS.fn.vendors.drawShape(
pJS.canvas.ctx,
p.x - radius*2 / (pJS.particles.shape.polygon.nb_sides/4), // startX
p.y - radius / (2*2.66/3.5), // startY
radius*2*2.66 / (pJS.particles.shape.polygon.nb_sides/3), // sideLength
pJS.particles.shape.polygon.nb_sides, // sideCountNumerator
2 // sideCountDenominator
);
break;
case 'image':
function draw(){
pJS.canvas.ctx.drawImage(
img_obj,
p.x-radius,
p.y-radius,
radius*2,
radius*2 / p.img.ratio
);
}
if(pJS.tmp.img_type == 'svg'){
var img_obj = p.img.obj;
}else{
var img_obj = pJS.tmp.img_obj;
}
if(img_obj){
draw();
}
break;
}
pJS.canvas.ctx.closePath();
if(pJS.particles.shape.stroke.width > 0){
pJS.canvas.ctx.strokeStyle = pJS.particles.shape.stroke.color;
pJS.canvas.ctx.lineWidth = pJS.particles.shape.stroke.width;
pJS.canvas.ctx.stroke();
}
pJS.canvas.ctx.fill();
};
pJS.fn.particlesCreate = function(){
for(var i = 0; i < pJS.particles.number.value; i++) {
pJS.particles.array.push(new pJS.fn.particle(pJS.particles.color, pJS.particles.opacity.value));
}
};
pJS.fn.particlesUpdate = function(){
for(var i = 0; i < pJS.particles.array.length; i++){
/* the particle */
var p = pJS.particles.array[i];
// var d = ( dx = pJS.interactivity.mouse.click_pos_x - p.x ) * dx + ( dy = pJS.interactivity.mouse.click_pos_y - p.y ) * dy;
// var f = -BANG_SIZE / d;
// if ( d < BANG_SIZE ) {
// var t = Math.atan2( dy, dx );
// p.vx = f * Math.cos(t);
// p.vy = f * Math.sin(t);
// }
/* move the particle */
if(pJS.particles.move.enable){
var ms = pJS.particles.move.speed/2;
p.x += p.vx * ms;
p.y += p.vy * ms;
}
/* change opacity status */
if(pJS.particles.opacity.anim.enable) {
if(p.opacity_status == true) {
if(p.opacity >= pJS.particles.opacity.value) p.opacity_status = false;
p.opacity += p.vo;
}else {
if(p.opacity <= pJS.particles.opacity.anim.opacity_min) p.opacity_status = true;
p.opacity -= p.vo;
}
if(p.opacity < 0) p.opacity = 0;
}
/* change size */
if(pJS.particles.size.anim.enable){
if(p.size_status == true){
if(p.radius >= pJS.particles.size.value) p.size_status = false;
p.radius += p.vs;
}else{
if(p.radius <= pJS.particles.size.anim.size_min) p.size_status = true;
p.radius -= p.vs;
}
if(p.radius < 0) p.radius = 0;
}
/* change particle position if it is out of canvas */
if(pJS.particles.move.out_mode == 'bounce'){
var new_pos = {
x_left: p.radius,
x_right: pJS.canvas.w,
y_top: p.radius,
y_bottom: pJS.canvas.h
}
}else{
var new_pos = {
x_left: -p.radius,
x_right: pJS.canvas.w + p.radius,
y_top: -p.radius,
y_bottom: pJS.canvas.h + p.radius
}
}
if(p.x - p.radius > pJS.canvas.w){
p.x = new_pos.x_left;
p.y = Math.random() * pJS.canvas.h;
}
else if(p.x + p.radius < 0){
p.x = new_pos.x_right;
p.y = Math.random() * pJS.canvas.h;
}
if(p.y - p.radius > pJS.canvas.h){
p.y = new_pos.y_top;
p.x = Math.random() * pJS.canvas.w;
}
else if(p.y + p.radius < 0){
p.y = new_pos.y_bottom;
p.x = Math.random() * pJS.canvas.w;
}
/* out of canvas modes */
switch(pJS.particles.move.out_mode){
case 'bounce':
if (p.x + p.radius > pJS.canvas.w) p.vx = -p.vx;
else if (p.x - p.radius < 0) p.vx = -p.vx;
if (p.y + p.radius > pJS.canvas.h) p.vy = -p.vy;
else if (p.y - p.radius < 0) p.vy = -p.vy;
break;
}
/* events */
if(isInArray('grab', pJS.interactivity.events.onhover.mode)){
pJS.fn.modes.grabParticle(p);
}
if(isInArray('bubble', pJS.interactivity.events.onhover.mode) || isInArray('bubble', pJS.interactivity.events.onclick.mode)){
pJS.fn.modes.bubbleParticle(p);
}
if(isInArray('repulse', pJS.interactivity.events.onhover.mode) || isInArray('repulse', pJS.interactivity.events.onclick.mode)){
pJS.fn.modes.repulseParticle(p);
}
/* interaction auto between particles */
if(pJS.particles.line_linked.enable || pJS.particles.move.attract.enable){
for(var j = i + 1; j < pJS.particles.array.length; j++){
var p2 = pJS.particles.array[j];
/* link particles */
if(pJS.particles.line_linked.enable){
pJS.fn.interact.linkParticles(p,p2);
}
/* attract particles */
if(pJS.particles.move.attract.enable){
pJS.fn.interact.attractParticles(p,p2);
}
/* bounce particles */
if(pJS.particles.move.bounce){
pJS.fn.interact.bounceParticles(p,p2);
}
}
}
}
};
pJS.fn.particlesDraw = function(){
/* clear canvas */
pJS.canvas.ctx.clearRect(0, 0, pJS.canvas.w, pJS.canvas.h);
/* update each particles param */
pJS.fn.particlesUpdate();
/* draw each particle */
for(var i = 0; i < pJS.particles.array.length; i++){
var p = pJS.particles.array[i];
p.draw();
}
};
pJS.fn.particlesEmpty = function(){
pJS.particles.array = [];
};
pJS.fn.particlesRefresh = function(){
/* init all */
cancelRequestAnimFrame(pJS.fn.checkAnimFrame);
cancelRequestAnimFrame(pJS.fn.drawAnimFrame);
pJS.tmp.source_svg = undefined;
pJS.tmp.img_obj = undefined;
pJS.tmp.count_svg = 0;
pJS.fn.particlesEmpty();
pJS.fn.canvasClear();
/* restart */
pJS.fn.vendors.start();
};
/* ---------- pJS functions - particles interaction ------------ */
pJS.fn.interact.linkParticles = function(p1, p2){
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dist = Math.sqrt(dx*dx + dy*dy);
/* draw a line between p1 and p2 if the distance between them is under the config distance */
if(dist <= pJS.particles.line_linked.distance){
var opacity_line = pJS.particles.line_linked.opacity - (dist / (1/pJS.particles.line_linked.opacity)) / pJS.particles.line_linked.distance;
if(opacity_line > 0){
/* style */
var color_line = pJS.particles.line_linked.color_rgb_line;
pJS.canvas.ctx.strokeStyle = 'rgba('+color_line.r+','+color_line.g+','+color_line.b+','+opacity_line+')';
pJS.canvas.ctx.lineWidth = pJS.particles.line_linked.width;
//pJS.canvas.ctx.lineCap = 'round'; /* performance issue */
/* path */
pJS.canvas.ctx.beginPath();
pJS.canvas.ctx.moveTo(p1.x, p1.y);
pJS.canvas.ctx.lineTo(p2.x, p2.y);
pJS.canvas.ctx.stroke();
pJS.canvas.ctx.closePath();
}
}
};
pJS.fn.interact.attractParticles = function(p1, p2){
/* condensed particles */
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dist = Math.sqrt(dx*dx + dy*dy);
if(dist <= pJS.particles.line_linked.distance){
var ax = dx/(pJS.particles.move.attract.rotateX*1000),
ay = dy/(pJS.particles.move.attract.rotateY*1000);
p1.vx -= ax;
p1.vy -= ay;
p2.vx += ax;
p2.vy += ay;
}
};
pJS.fn.interact.bounceParticles = function(p1, p2){
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dist = Math.sqrt(dx*dx + dy*dy),
dist_p = p1.radius+p2.radius;
if(dist <= dist_p){
p1.vx = -p1.vx;
p1.vy = -p1.vy;
p2.vx = -p2.vx;
p2.vy = -p2.vy;
}
};
/* ---------- pJS functions - modes events ------------ */
pJS.fn.modes.pushParticles = function(nb, pos){
pJS.tmp.pushing = true;
for(var i = 0; i < nb; i++){
pJS.particles.array.push(
new pJS.fn.particle(
pJS.particles.color,
pJS.particles.opacity.value,
{
'x': pos ? pos.pos_x : Math.random() * pJS.canvas.w,
'y': pos ? pos.pos_y : Math.random() * pJS.canvas.h
}
)
);
if(i == nb-1){
if(!pJS.particles.move.enable){
pJS.fn.particlesDraw();
}
pJS.tmp.pushing = false;
}
}
};
pJS.fn.modes.removeParticles = function(nb){
pJS.particles.array.splice(0, nb);
if(!pJS.particles.move.enable){
pJS.fn.particlesDraw();
}
};
pJS.fn.modes.bubbleParticle = function(p){
/* on hover event */
if(pJS.interactivity.events.onhover.enable && isInArray('bubble', pJS.interactivity.events.onhover.mode)){
var dx_mouse = p.x - pJS.interactivity.mouse.pos_x,
dy_mouse = p.y - pJS.interactivity.mouse.pos_y,
dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse),
ratio = 1 - dist_mouse / pJS.interactivity.modes.bubble.distance;
function init(){
p.opacity_bubble = p.opacity;
p.radius_bubble = p.radius;
}
/* mousemove - check ratio */
if(dist_mouse <= pJS.interactivity.modes.bubble.distance){
if(ratio >= 0 && pJS.interactivity.status == 'mousemove'){
/* size */
if(pJS.interactivity.modes.bubble.size != pJS.particles.size.value){
if(pJS.interactivity.modes.bubble.size > pJS.particles.size.value){
var size = p.radius + (pJS.interactivity.modes.bubble.size*ratio);
if(size >= 0){
p.radius_bubble = size;
}
}else{
var dif = p.radius - pJS.interactivity.modes.bubble.size,
size = p.radius - (dif*ratio);
if(size > 0){
p.radius_bubble = size;
}else{
p.radius_bubble = 0;
}
}
}
/* opacity */
if(pJS.interactivity.modes.bubble.opacity != pJS.particles.opacity.value){
if(pJS.interactivity.modes.bubble.opacity > pJS.particles.opacity.value){
var opacity = pJS.interactivity.modes.bubble.opacity*ratio;
if(opacity > p.opacity && opacity <= pJS.interactivity.modes.bubble.opacity){
p.opacity_bubble = opacity;
}
}else{
var opacity = p.opacity - (pJS.particles.opacity.value-pJS.interactivity.modes.bubble.opacity)*ratio;
if(opacity < p.opacity && opacity >= pJS.interactivity.modes.bubble.opacity){
p.opacity_bubble = opacity;
}
}
}
}
}else{
init();
}
/* mouseleave */
if(pJS.interactivity.status == 'mouseleave'){
init();
}
}
/* on click event */
else if(pJS.interactivity.events.onclick.enable && isInArray('bubble', pJS.interactivity.events.onclick.mode)){
if(pJS.tmp.bubble_clicking){
var dx_mouse = p.x - pJS.interactivity.mouse.click_pos_x,
dy_mouse = p.y - pJS.interactivity.mouse.click_pos_y,
dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse),
time_spent = (new Date().getTime() - pJS.interactivity.mouse.click_time)/1000;
if(time_spent > pJS.interactivity.modes.bubble.duration){
pJS.tmp.bubble_duration_end = true;
}
if(time_spent > pJS.interactivity.modes.bubble.duration*2){
pJS.tmp.bubble_clicking = false;
pJS.tmp.bubble_duration_end = false;
}
}
function process(bubble_param, particles_param, p_obj_bubble, p_obj, id){
if(bubble_param != particles_param){
if(!pJS.tmp.bubble_duration_end){
if(dist_mouse <= pJS.interactivity.modes.bubble.distance){
if(p_obj_bubble != undefined) var obj = p_obj_bubble;
else var obj = p_obj;
if(obj != bubble_param){
var value = p_obj - (time_spent * (p_obj - bubble_param) / pJS.interactivity.modes.bubble.duration);
if(id == 'size') p.radius_bubble = value;
if(id == 'opacity') p.opacity_bubble = value;
}
}else{
if(id == 'size') p.radius_bubble = undefined;
if(id == 'opacity') p.opacity_bubble = undefined;
}
}else{
if(p_obj_bubble != undefined){
var value_tmp = p_obj - (time_spent * (p_obj - bubble_param) / pJS.interactivity.modes.bubble.duration),
dif = bubble_param - value_tmp;
value = bubble_param + dif;
if(id == 'size') p.radius_bubble = value;
if(id == 'opacity') p.opacity_bubble = value;
}
}
}
}
if(pJS.tmp.bubble_clicking){
/* size */
process(pJS.interactivity.modes.bubble.size, pJS.particles.size.value, p.radius_bubble, p.radius, 'size');
/* opacity */
process(pJS.interactivity.modes.bubble.opacity, pJS.particles.opacity.value, p.opacity_bubble, p.opacity, 'opacity');
}
}
};
pJS.fn.modes.repulseParticle = function(p){
if(pJS.interactivity.events.onhover.enable && isInArray('repulse', pJS.interactivity.events.onhover.mode) && pJS.interactivity.status == 'mousemove') {
var dx_mouse = p.x - pJS.interactivity.mouse.pos_x,
dy_mouse = p.y - pJS.interactivity.mouse.pos_y,
dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse);
var normVec = {x: dx_mouse/dist_mouse, y: dy_mouse/dist_mouse},
repulseRadius = pJS.interactivity.modes.repulse.distance,
velocity = 100,
repulseFactor = clamp((1/repulseRadius)*(-1*Math.pow(dist_mouse/repulseRadius,2)+1)*repulseRadius*velocity, 0, 50);
var pos = {
x: p.x + normVec.x * repulseFactor,
y: p.y + normVec.y * repulseFactor
};
if(pJS.particles.move.out_mode == 'bounce'){
if(pos.x - p.radius > 0 && pos.x + p.radius < pJS.canvas.w) p.x = pos.x;
if(pos.y - p.radius > 0 && pos.y + p.radius < pJS.canvas.h) p.y = pos.y;
}else{
p.x = pos.x;
p.y = pos.y;
}
}
else if(pJS.interactivity.events.onclick.enable && isInArray('repulse', pJS.interactivity.events.onclick.mode)) {
if(!pJS.tmp.repulse_finish){
pJS.tmp.repulse_count++;
if(pJS.tmp.repulse_count == pJS.particles.array.length){
pJS.tmp.repulse_finish = true;
}
}
if(pJS.tmp.repulse_clicking){
var repulseRadius = Math.pow(pJS.interactivity.modes.repulse.distance/6, 3);
var dx = pJS.interactivity.mouse.click_pos_x - p.x,
dy = pJS.interactivity.mouse.click_pos_y - p.y,
d = dx*dx + dy*dy;
var force = -repulseRadius / d * 1;
function process(){
var f = Math.atan2(dy,dx);
p.vx = force * Math.cos(f);
p.vy = force * Math.sin(f);
if(pJS.particles.move.out_mode == 'bounce'){
var pos = {
x: p.x + p.vx,
y: p.y + p.vy
};
if (pos.x + p.radius > pJS.canvas.w) p.vx = -p.vx;
else if (pos.x - p.radius < 0) p.vx = -p.vx;
if (pos.y + p.radius > pJS.canvas.h) p.vy = -p.vy;
else if (pos.y - p.radius < 0) p.vy = -p.vy;
}
}
// default
if(d <= repulseRadius){
process();
}
// bang - slow motion mode
// if(!pJS.tmp.repulse_finish){
// if(d <= repulseRadius){
// process();
// }
// }else{
// process();
// }
}else{
if(pJS.tmp.repulse_clicking == false){
p.vx = p.vx_i;
p.vy = p.vy_i;
}
}
}
};
pJS.fn.modes.grabParticle = function(p){
if(pJS.interactivity.events.onhover.enable && pJS.interactivity.status == 'mousemove'){
var dx_mouse = p.x - pJS.interactivity.mouse.pos_x,
dy_mouse = p.y - pJS.interactivity.mouse.pos_y,
dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse);
/* draw a line between the cursor and the particle if the distance between them is under the config distance */
if(dist_mouse <= pJS.interactivity.modes.grab.distance){
var opacity_line = pJS.interactivity.modes.grab.line_linked.opacity - (dist_mouse / (1/pJS.interactivity.modes.grab.line_linked.opacity)) / pJS.interactivity.modes.grab.distance;
if(opacity_line > 0){
/* style */
var color_line = pJS.particles.line_linked.color_rgb_line;
pJS.canvas.ctx.strokeStyle = 'rgba('+color_line.r+','+color_line.g+','+color_line.b+','+opacity_line+')';
pJS.canvas.ctx.lineWidth = pJS.particles.line_linked.width;
//pJS.canvas.ctx.lineCap = 'round'; /* performance issue */
/* path */
pJS.canvas.ctx.beginPath();
pJS.canvas.ctx.moveTo(p.x, p.y);
pJS.canvas.ctx.lineTo(pJS.interactivity.mouse.pos_x, pJS.interactivity.mouse.pos_y);
pJS.canvas.ctx.stroke();
pJS.canvas.ctx.closePath();
}
}
}
};
/* ---------- pJS functions - vendors ------------ */
pJS.fn.vendors.eventsListeners = function(){
/* events target element */
if(pJS.interactivity.detect_on == 'window'){
pJS.interactivity.el = window;
}else{
pJS.interactivity.el = pJS.canvas.el;
}
/* detect mouse pos - on hover / click event */
if(pJS.interactivity.events.onhover.enable || pJS.interactivity.events.onclick.enable){
/* el on mousemove */
pJS.interactivity.el.addEventListener('mousemove', function(e){
if(pJS.interactivity.el == window){
var pos_x = e.clientX,
pos_y = e.clientY;
}
else{
var pos_x = e.offsetX || e.clientX,
pos_y = e.offsetY || e.clientY;
}
pJS.interactivity.mouse.pos_x = pos_x;
pJS.interactivity.mouse.pos_y = pos_y;
if(pJS.tmp.retina){
pJS.interactivity.mouse.pos_x *= pJS.canvas.pxratio;
pJS.interactivity.mouse.pos_y *= pJS.canvas.pxratio;
}
pJS.interactivity.status = 'mousemove';
});
/* el on onmouseleave */
pJS.interactivity.el.addEventListener('mouseleave', function(e){
pJS.interactivity.mouse.pos_x = null;
pJS.interactivity.mouse.pos_y = null;
pJS.interactivity.status = 'mouseleave';
});
}
/* on click event */
if(pJS.interactivity.events.onclick.enable){
pJS.interactivity.el.addEventListener('click', function(){
pJS.interactivity.mouse.click_pos_x = pJS.interactivity.mouse.pos_x;
pJS.interactivity.mouse.click_pos_y = pJS.interactivity.mouse.pos_y;
pJS.interactivity.mouse.click_time = new Date().getTime();
if(pJS.interactivity.events.onclick.enable){
switch(pJS.interactivity.events.onclick.mode){
case 'push':
if(pJS.particles.move.enable){
pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb, pJS.interactivity.mouse);
}else{
if(pJS.interactivity.modes.push.particles_nb == 1){
pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb, pJS.interactivity.mouse);
}
else if(pJS.interactivity.modes.push.particles_nb > 1){
pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb);
}
}
break;
case 'remove':
pJS.fn.modes.removeParticles(pJS.interactivity.modes.remove.particles_nb);
break;
case 'bubble':
pJS.tmp.bubble_clicking = true;
break;
case 'repulse':
pJS.tmp.repulse_clicking = true;
pJS.tmp.repulse_count = 0;
pJS.tmp.repulse_finish = false;
setTimeout(function(){
pJS.tmp.repulse_clicking = false;
}, pJS.interactivity.modes.repulse.duration*1000);
break;
}
}
});
}
};
pJS.fn.vendors.densityAutoParticles = function(){
if(pJS.particles.number.density.enable){
/* calc area */
var area = pJS.canvas.el.width * pJS.canvas.el.height / 1000;
if(pJS.tmp.retina){
area = area/(pJS.canvas.pxratio*2);
}
/* calc number of particles based on density area */
var nb_particles = area * pJS.particles.number.value / pJS.particles.number.density.value_area;
/* add or remove X particles */
var missing_particles = pJS.particles.array.length - nb_particles;
if(missing_particles < 0) pJS.fn.modes.pushParticles(Math.abs(missing_particles));
else pJS.fn.modes.removeParticles(missing_particles);
}
};
pJS.fn.vendors.checkOverlap = function(p1, position){
for(var i = 0; i < pJS.particles.array.length; i++){
var p2 = pJS.particles.array[i];
var dx = p1.x - p2.x,
dy = p1.y - p2.y,
dist = Math.sqrt(dx*dx + dy*dy);
if(dist <= p1.radius + p2.radius){
p1.x = position ? position.x : Math.random() * pJS.canvas.w;
p1.y = position ? position.y : Math.random() * pJS.canvas.h;
pJS.fn.vendors.checkOverlap(p1);
}
}
};
pJS.fn.vendors.createSvgImg = function(p){
/* set color to svg element */
var svgXml = pJS.tmp.source_svg,
rgbHex = /#([0-9A-F]{3,6})/gi,
coloredSvgXml = svgXml.replace(rgbHex, function (m, r, g, b) {
if(p.color.rgb){
var color_value = 'rgba('+p.color.rgb.r+','+p.color.rgb.g+','+p.color.rgb.b+','+p.opacity+')';
}else{
var color_value = 'hsla('+p.color.hsl.h+','+p.color.hsl.s+'%,'+p.color.hsl.l+'%,'+p.opacity+')';
}
return color_value;
});
/* prepare to create img with colored svg */
var svg = new Blob([coloredSvgXml], {type: 'image/svg+xml;charset=utf-8'}),
DOMURL = window.URL || window.webkitURL || window,
url = DOMURL.createObjectURL(svg);
/* create particle img obj */
var img = new Image();
img.addEventListener('load', function(){
p.img.obj = img;
p.img.loaded = true;
DOMURL.revokeObjectURL(url);
pJS.tmp.count_svg++;
});
img.src = url;
};
pJS.fn.vendors.destroypJS = function(){
cancelAnimationFrame(pJS.fn.drawAnimFrame);
canvas_el.remove();
pJSDom = null;
};
pJS.fn.vendors.drawShape = function(c, startX, startY, sideLength, sideCountNumerator, sideCountDenominator){
// By Programming Thomas - https://programmingthomas.wordpress.com/2013/04/03/n-sided-shapes/
var sideCount = sideCountNumerator * sideCountDenominator;
var decimalSides = sideCountNumerator / sideCountDenominator;
var interiorAngleDegrees = (180 * (decimalSides - 2)) / decimalSides;
var interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180; // convert to radians
c.save();
c.beginPath();
c.translate(startX, startY);
c.moveTo(0,0);
for (var i = 0; i < sideCount; i++) {
c.lineTo(sideLength,0);
c.translate(sideLength,0);
c.rotate(interiorAngle);
}
//c.stroke();
c.fill();
c.restore();
};
pJS.fn.vendors.exportImg = function(){
window.open(pJS.canvas.el.toDataURL('image/png'), '_blank');
};
pJS.fn.vendors.loadImg = function(type){
pJS.tmp.img_error = undefined;
if(pJS.particles.shape.image.src != ''){
if(type == 'svg'){
var xhr = new XMLHttpRequest();
xhr.open('GET', pJS.particles.shape.image.src);
xhr.onreadystatechange = function (data) {
if(xhr.readyState == 4){
if(xhr.status == 200){
pJS.tmp.source_svg = data.currentTarget.response;
pJS.fn.vendors.checkBeforeDraw();
}else{
console.log('Error pJS - Image not found');
pJS.tmp.img_error = true;
}
}
};
xhr.send();
}else{
var img = new Image();
img.addEventListener('load', function(){
pJS.tmp.img_obj = img;
pJS.fn.vendors.checkBeforeDraw();
});
img.src = pJS.particles.shape.image.src;
}
}else{
console.log('Error pJS - No image.src');
pJS.tmp.img_error = true;
}
};
pJS.fn.vendors.draw = function(){
if(pJS.particles.shape.type == 'image'){
if(pJS.tmp.img_type == 'svg'){
if(pJS.tmp.count_svg >= pJS.particles.number.value){
pJS.fn.particlesDraw();
if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame);
else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
}else{
//console.log('still loading...');
if(!pJS.tmp.img_error) pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
}
}else{
if(pJS.tmp.img_obj != undefined){
pJS.fn.particlesDraw();
if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame);
else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
}else{
if(!pJS.tmp.img_error) pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
}
}
}else{
pJS.fn.particlesDraw();
if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame);
else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
}
};
pJS.fn.vendors.checkBeforeDraw = function(){
// if shape is image
if(pJS.particles.shape.type == 'image'){
if(pJS.tmp.img_type == 'svg' && pJS.tmp.source_svg == undefined){
pJS.tmp.checkAnimFrame = requestAnimFrame(check);
}else{
//console.log('images loaded! cancel check');
cancelRequestAnimFrame(pJS.tmp.checkAnimFrame);
if(!pJS.tmp.img_error){
pJS.fn.vendors.init();
pJS.fn.vendors.draw();
}
}
}else{
pJS.fn.vendors.init();
pJS.fn.vendors.draw();
}
};
pJS.fn.vendors.init = function(){
/* init canvas + particles */
pJS.fn.retinaInit();
pJS.fn.canvasInit();
pJS.fn.canvasSize();
pJS.fn.canvasPaint();
pJS.fn.particlesCreate();
pJS.fn.vendors.densityAutoParticles();
/* particles.line_linked - convert hex colors to rgb */
pJS.particles.line_linked.color_rgb_line = hexToRgb(pJS.particles.line_linked.color);
};
pJS.fn.vendors.start = function(){
if(isInArray('image', pJS.particles.shape.type)){
pJS.tmp.img_type = pJS.particles.shape.image.src.substr(pJS.particles.shape.image.src.length - 3);
pJS.fn.vendors.loadImg(pJS.tmp.img_type);
}else{
pJS.fn.vendors.checkBeforeDraw();
}
};
/* ---------- pJS - start ------------ */
pJS.fn.vendors.eventsListeners();
pJS.fn.vendors.start();
};
/* ---------- global functions - vendors ------------ */
Object.deepExtend = function(destination, source) {
for (var property in source) {
if (source[property] && source[property].constructor &&
source[property].constructor === Object) {
destination[property] = destination[property] || {};
arguments.callee(destination[property], source[property]);
} else {
destination[property] = source[property];
}
}
return destination;
};
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000 / 60);
};
})();
window.cancelRequestAnimFrame = ( function() {
return window.cancelAnimationFrame ||
window.webkitCancelRequestAnimationFrame ||
window.mozCancelRequestAnimationFrame ||
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame ||
clearTimeout
} )();
function hexToRgb(hex){
// By Tim Down - http://stackoverflow.com/a/5624139/3493650
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function(m, r, g, b) {
return r + r + g + g + b + b;
});
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
function clamp(number, min, max) {
return Math.min(Math.max(number, min), max);
}
function isInArray(value, array) {
return array.indexOf(value) > -1;
}
/* ---------- particles.js functions - start ------------ */
window.pJSDom = [];
window.particlesJS = function(tag_id, params){
//console.log(params);
/* no string id? so it's object params, and set the id with default id */
if(typeof(tag_id) != 'string'){
params = tag_id;
tag_id = 'particles-js';
}
/* no id? set the id to default id */
if(!tag_id){
tag_id = 'particles-js';
}
/* pJS elements */
var pJS_tag = document.getElementById(tag_id),
pJS_canvas_class = 'particles-js-canvas-el',
exist_canvas = pJS_tag.getElementsByClassName(pJS_canvas_class);
/* remove canvas if exists into the pJS target tag */
if(exist_canvas.length){
while(exist_canvas.length > 0){
pJS_tag.removeChild(exist_canvas[0]);
}
}
/* create canvas element */
var canvas_el = document.createElement('canvas');
canvas_el.className = pJS_canvas_class;
/* set size canvas */
canvas_el.style.width = "100%";
canvas_el.style.height = "100%";
/* append canvas */
var canvas = document.getElementById(tag_id).appendChild(canvas_el);
/* launch particle.js */
if(canvas != null){
pJSDom.push(new pJS(tag_id, params));
}
};
window.particlesJS.load = function(tag_id, path_config_json, callback){
/* load json config */
var xhr = new XMLHttpRequest();
xhr.open('GET', path_config_json);
xhr.onreadystatechange = function (data) {
if(xhr.readyState == 4){
if(xhr.status == 200){
var params = JSON.parse(data.currentTarget.response);
window.particlesJS(tag_id, params);
if(callback) callback();
}else{
console.log('Error pJS - XMLHttpRequest status: '+xhr.status);
console.log('Error pJS - File config not found');
}
}
};
xhr.send();
}; | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
</head>
<frameset rows="60,*" frameborder="0">
<frame name="Header" src="billInfoHeader.jsp" />
<frame name="billInfo" src="../../nav.html" />
</frameset>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/toExcel/xlsx.full.min.js"></script>
<script type="text/javascript" src="../../js/toExcel/FileSaver.js"></script>
<script type="text/javascript" src="../../js/toExcel/Export2Excel.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo">酒店管理系统</div>
<!-- 头部区域(可配合layui已有的水平导航) -->
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item">
<a href="此处填充地址" target="billInfo">账单结算</a>
</li>
<li class="layui-nav-item">
<a href="此处填充地址" target="billInfo">账单管理</a>
</li>
</div>
</div>
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script>
//JavaScript代码区域
layui.use('element', function() {});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>预定单</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/getTime.js"></script>
<script src="../../js/Cookie.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px;">
<legend>酒店管理 - 预订单</legend>
</fieldset>
<form class="layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">预定单号</label>
<div class="layui-input-block">
<input type="text" id="orderId" class="layui-input" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">预定人</label>
<div class="layui-input-inline">
<input type="text" id="orderName" lay-verify="required" autocomplete="off" placeholder="预定人姓名" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">预定电话</label>
<div class="layui-input-inline">
<input type="tel" id="orderPhone" lay-verify="phone" autocomplete="off" placeholder="预定人电话" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">身份证</label>
<div class="layui-input-block">
<input type="text" id="orderIDcard" lay-verify="required|identity" placeholder="公民身份证号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">入住时长</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" lay-verify="required" id="orderAllTime" placeholder="抵店时间 - 离店时间" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">入住人数</label>
<div class="layui-input-inline">
<input type="text" id="checkNum" lay-verify="number" autocomplete="off" placeholder="实际入住人数" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">房间类型</label>
<div class="layui-input-inline">
<input type="text" id="typeId" lay-verify="required" autocomplete="off" placeholder="房间类型" class="layui-input" readonly>
</div>
<button type="button" class="layui-btn layui-btn-primary" id="buttonTypeId"><i class="layui-icon"></i> 选择</button>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">客房价格</label>
<div class="layui-input-inline">
<input type="text" id="price" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">入住价格</label>
<div class="layui-input-inline">
<input type="text" id="checkPrice" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">折扣</label>
<div class="layui-input-inline">
<input type="text" id="discount" lay-verify="number" autocomplete="off" placeholder="折扣请输入,无折扣置空" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">折扣原因</label>
<div class="layui-input-inline">
<input type="text" id="discountReason" autocomplete="off" placeholder="请输入折扣原因" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">是否加床</label>
<div class="layui-input-inline">
<input type="radio" name="addBed" value="Y" title="是" lay-filter="addBedYes">
<input type="radio" name="addBed" value="N" title="否" lay-filter="addBedNo" checked>
</div>
</div>
<div class="layui-inline">
<div id="addBed" class="layui-inline layui-hide">
<label class="layui-form-label">加床价格</label>
<div class="layui-input-inline">
<input type="text" id="addBedPrice" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">预收款</label>
<div class="layui-input-inline">
<input type="text" id="orderMoney" lay-verify="required|number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">单据状态</label>
<div class="layui-input-inline">
<select name="orderState" class="layui-input-inline" id="orderState">
<option value="预定">预定</option>
<option value="入住">入住</option>
<option value="结算">结算</option>
<option value="延期">延期</option>
</select>
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea id="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="insertRome">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script>
layui.use(['form', 'layedit', 'laydate'], function() {
var form = layui.form,
layer = layui.layer,
layedit = layui.layedit,
laydate = layui.laydate;
var isAddBed = false;
var orderId = getCookie("orderId");
deleteCookie("orderId"); //取到值就麻溜的删
var queryId = "orderId=" + orderId;
// 开始赋值
$.post(baseUrl + '/QueryOrderInfoServlet', queryId, function(orderInfo) {
var obj = JSON.parse(orderInfo);
$("#orderId").val(orderId);
$("#orderName").val(obj.orderName);
$("#orderPhone").val(obj.orderPhone);
$("#orderIDcard").val(obj.orderIDcard);
$("#typeId").val(obj.typeId);
$("#orderAllTime").val(obj.arrireDate + " | " + obj.leaveDate);
$("#orderState").val(obj.orderState); //<--需要处理
form.render("select"); //重新渲染select
$("#checkNum").val(obj.checkNum);
$("#price").val(obj.price);
$("#orderName").val(obj.orderName);
$("#checkPrice").val(obj.checkPrice);
$("#discount").val(obj.discount);
$("#discountReason").val(obj.discountReason);
isAddBed = obj.addBed; //<--需要处理,默认选中的是否
if(isAddBed === "false") {
$('#addBed').removeClass("layui-show");
$('#addBed').addClass("layui-hide");
} else {
$('#addBed').removeClass("layui-hide");
$('#addBed').addClass("layui-show");
$("input[name='addBed'][value='Y']").prop("checked", true); //把 是 给主动选上
form.render('radio'); //重新渲染
}
$("#addBedPrice").val(obj.addBedPrice);
$("#orderMoney").val(obj.orderMoney);
$("#operatorId").val(obj.operatorId);
$("#remark").val(obj.remark);
});
//日期
laydate.render({
elem: '#arrireDate'
});
laydate.render({
elem: '#leaveDate'
});
laydate.render({
elem: '#orderAllTime',
type: 'datetime',
min: -30,
range: '|',
format: 'yyyy-MM-dd',
calendar: true
});
//一个属性的显隐,直接通过修改class实现,使用了layui的class属性
form.on('radio(addBedYes)', function() {
$('#addBed').removeClass("layui-hide");
$('#addBed').addClass("layui-show");
isAddBed = true;
});
form.on('radio(addBedNo)', function() {
$('#addBed').removeClass("layui-show");
$('#addBed').addClass("layui-hide");
isAddBed = false;
});
//房间类型的选择
$('#buttonTypeId').on('click', function() {
layer.open({
type: 2,
title: '请选择房间类型',
btn: ['确定', '取消'],
area: ['750', '360px'],
fixed: form,
content: './selectRoomType.jsp',
yes: function(index, layero) {
typeId.value = $(layero).find('iframe')[0].contentWindow.tId.value; //将子窗口中的 tId 抓过来
price.value = $(layero).find('iframe')[0].contentWindow.tPrice.value;
layer.close(index); //关闭弹窗
},
btn2: function(index) {
layer.close(index);
},
success: function(layero, index) {
var obj = $(layero).find('iframe')[0].contentWindow;
},
offset: '0px'
});
});
//监听提交
form.on('submit(insertRome)', function(data) {
//先获取值
var orderId = $('#orderId').val();
var orderName = $('#orderName').val();
var orderPhone = $('#orderPhone').val();
var orderIDcard = $('#orderIDcard').val();
var typeId = $('#typeId').val();
//返回数据类型: yyyy-mm-dd hh:mm:ss
var orderAllTime = ($('#orderAllTime').val()).split(" | ");
var arrireDate = orderAllTime[0];
var leaveDate = orderAllTime[1];
var orderState = $('#orderState').val();
var checkNum = $('#checkNum').val();
var price = $('#price').val();
var checkPrice = $('#checkPrice').val();
var discount = $('#discount').val();
var discountReason = $('#discountReason').val();
//加床:true 不加:false
var addBed = isAddBed;
var addBedPrice = $('#addBedPrice').val();
var orderMoney = $('#orderMoney').val();
var operatorId = getCookie("loginName");
var remark = $('#remark').val();
var params = "orderId=" + orderId + "&orderName=" + orderName + "&orderPhone=" + orderPhone +
"&orderIDcard=" + orderIDcard + "&typeId=" + typeId + "&arrireDate=" + arrireDate +
"&leaveDate=" + leaveDate + "&orderState=" + orderState + "&checkNum=" + checkNum +
"&price=" + price + "&checkPrice=" + checkPrice + "&discount=" + discount +
"&discountReason=" + discountReason + "&addBed=" + addBed + "&addBedPrice=" + addBedPrice +
"&orderMoney=" + orderMoney + "&operatorId=" + operatorId + "&remark=" + remark + "&make=2";
$.post(baseUrl + '/InsertAndUpdateServlet', params, function(data) {
if(data === '1') {
layer.alert('修改登记单成功!', {
title: '修改成功',
icon: 6,
shade: 0.6,
anim: 3,
offset: '0px'
});
} else {
layer.alert('修改登记单失败!', {
title: '修改失败',
icon: 2,
shade: 0.6,
anim: 6,
offset: '0px'
});
}
});
return false;
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>预定单</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/getTime.js"></script>
<script src="../../js/Cookie.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px;">
<legend>酒店管理 - 预订单</legend>
</fieldset>
<form class="layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">预定单号</label>
<div class="layui-input-block">
<input type="text" id="orderId" class="layui-input" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">预定人</label>
<div class="layui-input-inline">
<input type="text" id="orderName" lay-verify="required" autocomplete="off" placeholder="预定人姓名" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">预定电话</label>
<div class="layui-input-inline">
<input type="tel" id="orderPhone" lay-verify="phone" autocomplete="off" placeholder="预定人电话" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">身份证</label>
<div class="layui-input-block">
<input type="text" id="orderIDcard" lay-verify="required|identity" placeholder="公民身份证号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">入住时长</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" lay-verify="required" id="orderAllTime" placeholder="抵店时间 - 离店时间" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">入住人数</label>
<div class="layui-input-inline">
<input type="text" id="checkNum" lay-verify="number" autocomplete="off" placeholder="实际入住人数" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">房间类型</label>
<div class="layui-input-inline">
<input type="text" id="typeId" lay-verify="required" autocomplete="off" placeholder="房间类型" class="layui-input" readonly>
</div>
<button type="button" class="layui-btn layui-btn-primary" id="buttonTypeId"><i class="layui-icon"></i> 选择</button>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">客房价格</label>
<div class="layui-input-inline">
<input type="text" id="price" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">入住价格</label>
<div class="layui-input-inline">
<input type="text" id="checkPrice" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">折扣</label>
<div class="layui-input-inline">
<input type="text" id="discount" lay-verify="number" autocomplete="off" placeholder="折扣请输入,无折扣置空" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">折扣原因</label>
<div class="layui-input-inline">
<input type="text" id="discountReason" autocomplete="off" placeholder="请输入折扣原因" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">是否加床</label>
<div class="layui-input-inline">
<input type="radio" name="addBed" value="Y" title="是" lay-filter="addBedYes">
<input type="radio" name="addBed" value="N" title="否" lay-filter="addBedNo" checked="">
</div>
</div>
<div class="layui-inline">
<div id="addBed" class="layui-inline layui-hide">
<label class="layui-form-label">加床价格</label>
<div class="layui-input-inline">
<input type="text" id="addBedPrice" lay-verify="number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">预收款</label>
<div class="layui-input-inline">
<input type="text" id="orderMoney" lay-verify="required|number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">单据状态</label>
<div class="layui-input-inline">
<select name="city" class="layui-input-inline" id="orderState">
<option value="预定">预定</option>
<option value="入住">入住</option>
<option value="结算">结算</option>
<option value="延期">延期</option>
</select>
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea id="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="insertRome">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script>
//layui的form表单默认的submit提交是真的不会用。
//以JSON对象传递给后台的话,在传递前无法对数据二次修改。
//所以就变成了整体传递过去,后端再解析JSON,但是解析时字段为空就又出错。
//具体起来就是类似房间类型-新增房间那部分,全部字段强制要求全给,后端又set个别字段。
//所以本文的提交就默认老老实实用ajax提交出去,不采用JSON对象了。
layui.use(['form', 'layedit', 'laydate'], function() {
var form = layui.form,
layer = layui.layer,
layedit = layui.layedit,
laydate = layui.laydate;
var isAddBed = false;
//日期
laydate.render({
elem: '#arrireDate'
});
laydate.render({
elem: '#leaveDate'
});
laydate.render({
elem: '#orderAllTime',
type: 'datetime',
min: 0,
range: '|',
format: 'yyyy-MM-dd',
calendar: true
});
//设置ID(读取的时间)
var time = new Date().getTime();
$(document).ready(function() {
$("#orderId").val("OD" + time);
});
//一个属性的显隐,直接通过修改class实现,使用了layui的class属性
form.on('radio(addBedYes)', function() {
$('#addBed').removeClass("layui-hide");
$('#addBed').addClass("layui-show");
isAddBed = true;
});
form.on('radio(addBedNo)', function() {
$('#addBed').removeClass("layui-show");
$('#addBed').addClass("layui-hide");
isAddBed = false;
});
//房间类型的选择
$('#buttonTypeId').on('click', function() {
layer.open({
type: 2,
title: '请选择房间类型',
btn: ['确定', '取消'],
area: ['880px', '440px'],
fixed: form,
content: './selectRoomType.jsp',
yes: function(index, layero) {
typeId.value = $(layero).find('iframe')[0].contentWindow.tId.value; //将子窗口中的 tId 抓过来
price.value = $(layero).find('iframe')[0].contentWindow.tPrice.value;
layer.close(index); //关闭弹窗
},
btn2: function(index) {
layer.close(index);
},
success: function(layero, index) {
var obj = $(layero).find('iframe')[0].contentWindow;
}
});
});
//监听提交
form.on('submit(insertRome)', function(data) {
//先获取值
var orderId = $('#orderId').val();
var orderName = $('#orderName').val();
var orderPhone = $('#orderPhone').val();
var orderIDcard = $('#orderIDcard').val();
var typeId = $('#typeId').val();
//返回数据类型: yyyy-mm-dd hh:mm:ss
var orderAllTime = ($('#orderAllTime').val()).split(" | ");
var arrireDate = orderAllTime[0];
var leaveDate = orderAllTime[1];
var orderState = $('#orderState').val();
var checkNum = $('#checkNum').val();
// var roomId = $('#roomId').val(); 后台处理 -->直接放一个空类就行了
var price = $('#price').val();
var checkPrice = $('#checkPrice').val();
var discount = $('#discount').val();
var discountReason = $('#discountReason').val();
//加床:true 不加:false
var addBed = isAddBed;
var addBedPrice = $('#addBedPrice').val();
var orderMoney = $('#orderMoney').val();
var operatorId = getCookie("loginName");
var remark = $('#remark').val();
var params = "orderId=" + orderId + "&orderName=" + orderName + "&orderPhone=" + orderPhone +
"&orderIDcard=" + orderIDcard + "&typeId=" + typeId + "&arrireDate=" + arrireDate +
"&leaveDate=" + leaveDate + "&orderState=" + orderState + "&checkNum=" + checkNum +
"&price=" + price + "&checkPrice=" + checkPrice + "&discount=" + discount +
"&discountReason=" + discountReason + "&addBed=" + addBed + "&addBedPrice=" + addBedPrice +
"&orderMoney=" + orderMoney + "&operatorId=" + operatorId + "&remark=" + remark + "&make=1";
$.post(baseUrl + '/InsertAndUpdateServlet', params, function(data) {
if(data === '1') {
layer.alert('预订单登记成功!', {
title: '新增成功',
icon: 6,
shade: 0.6,
anim: 3,
offset: '220px'
});
} else if(data === '0') {
layer.alert('存在相同字段!', {
title: '新增失败',
icon: 5,
shade: 0.6,
anim: 6,
offset: '220px'
});
} else {
layer.alert('预订单登记失败!', {
title: '新增失败',
icon: 2,
shade: 0.6,
anim: 6,
offset: '220px'
});
}
});
return false;
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<style>
.fixDiv {
position: sticky;
bottom: 0;
background-color: white;
BORDER-BOTTOM: #e1e1e1 1px solid;
BORDER-TOP: #e1e1e1 1px solid;
BORDER-RIGHT: #e1e1e1 1px solid;
BORDER-LEFT: #e1e1e1 1px solid;
border-radius: 10px
}
</style>
</head>
<body>
<table id="dataTable" class='layui-table'>
<tr>
<th>ID</th>
<th>类型名称</th>
<th>价格</th>
<th>拼房价格</th>
<th>可超预定数</th>
<th>是否可拼房</th>
</tr>
</table>
<div class="fixDiv">
<label class="layui-form-label">当前选中:</label>
<div class="layui-input-inline">
<input type="text" id="tId" class="layui-input" placeholder="ID" readonly>
</div>
<div class="layui-input-inline">
<input type="text" id="tPrice" class="layui-input" placeholder="价格" readonly>
</div>
</div>
<script>
//网页加载完毕
$(document).ready(function() {
//发出ajax请求,调用后端数据
$.getJSON(baseUrl + '/selectRomeTypeIdServlet', function(data) {
//遍历响应的json数组
$.each(data, function(index, el) {
var tId = el.typeId;
var tPrice = el.price;
var html = '';
html += '<tr onclick="tId.value=\'' + tId + '\',tPrice.value=\'' + tPrice + '\'" >';
html += ' <td>' + el.typeId + '</td>';
html += ' <td>' + el.typeName + '</td>';
html += ' <td>' + el.price + '</td>';
html += ' <td>' + el.splicPrice + '</td>';
html += ' <td>' + el.exceedance + '</td>';
html += ' <td>' + el.isSplice + '</td>';
html += '</tr>';
//追加到表格中
$('#dataTable').append(html);
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/Cookie.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<div class="layui-input-inline">
<input class="layui-input" id="inputSearch1" placeholder="预定人">
</div>
<button class="layui-btn fa fa-search layui-btn-normal" id="searchButton1"> 搜索</button>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input class="layui-input" id="inputSearch2" placeholder="房间类型">
</div>
<button class="layui-btn fa fa-search layui-btn-normal" id="searchButton2"> 搜索</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-refresh layui-btn-normal" id="refreshButton"> 刷新</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-save layui-btn-normal" id="toXlsButton"> 导出</button>
</div>
</div>
</legend>
</fieldset>
<div id="toxlsTable">
<table id="tableID"></table>
</div>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['util', 'layer', 'table'], function() {
$(document).ready(function() {
var table = layui.table,
layer = layui.layer,
util = layui.util;
var countNum;
var tableIns = table.render({
elem: '#tableID',
id: 'tableID',
url: baseUrl + '/OrderInfoServlet',
cols: [
[{
field: 'orderId',
title: '预定单号',
width: 180,
sort: true,
fixed: true
}, {
field: 'orderName',
title: '预定人',
sort: true,
width: 180
}, {
field: 'orderPhone',
title: '预定电话',
width: 180
}, {
field: 'orderIDcard',
title: '身份证',
width: 200
}, {
field: 'arrireDate',
title: '抵店时间',
width: 180
}, {
field: 'leaveDate',
title: '离店时间',
width: 180
}, {
field: 'typeId',
title: '房间类型',
sort: true,
width: 180
}, {
field: 'checkNum',
title: '入住人数',
width: 100
}, {
field: 'price',
title: '客房价格',
width: 100
}, {
field: 'checkPrice',
title: '入住价格',
width: 100
}, {
field: 'discount',
title: '折扣',
width: 100
}, {
field: 'discountReason',
title: '折扣原因',
width: 180
}, {
field: 'addBed',
title: '是否加床',
sort: true,
width: 100
}, {
field: 'addBedPrice',
title: '加床价格',
width: 100
}, {
field: 'orderMoney',
title: '预收款',
width: 100
}, {
field: 'orderState',
title: '单据状态',
sort: true,
width: 100
}, {
field: 'remark',
title: '备注',
width: 400
}, {
field: 'operatorId',
title: '操作员',
sort: true,
width: 100
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 150,
fixed: 'right'
}]
],
page: true,
where: {
make: 0
},
done: function(res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function(obj) {
var data = obj.data,
layEvent = obj.event;
var orderId = data.orderId;
if(layEvent === 'del') {
layer.confirm('您确定要删除该条数据吗?', {
offset: '180px',
btn: ['是滴', '手滑']
}, function() {
table.reload('tableID', {
where: {
make: 4,
orderId: orderId
}
});
layer.msg('删除结果如下', {
offset: '250px',
icon: 1
});
tableIns.reload({
where: {
make: 0,
page: 1
}
});
}, function() {
layer.msg('删除操作已取消', {
offset: '250px'
});
});
} else if(layEvent === 'edit') {
// emmm 父子传参只会写儿子传递给父亲的
// 其实 用jsp那套session啥的传参或许更好
setCookie("orderId", orderId);
//编辑
layer.open({
title: "提交",
btn: ['关闭'],
yes: function(index) {
tableIns.reload({
where: {
make: 0
}
});
layer.close(index); //关闭弹窗
},
type: 2,
area: ['1080px', '520px'],
fixed: false,
maxmin: true,
content: '/hb/webpage/orderInfo/updateOrder.jsp',
cancel: function() {
tableIns.reload({
where: {
make: 0
}
});
}
});
}
});
//搜索
$('#searchButton1').click(function() {
var select = $('#inputSearch1').val();
tableIns.reload({
where: {
make: 1,
page: 1,
select: select
}
});
});
$('#searchButton2').click(function() {
var select = $('#inputSearch2').val();
tableIns.reload({
where: {
make: 2,
page: 1,
select: select
}
});
});
//刷新
$('#refreshButton').click(function() {
tableIns.reload({
where: {
make: 0,
page: 1
}
});
});
//导出
$('#toXlsButton').click(function() {
location.href = baseUrl + '/OrderInfoExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//回到顶端
util.fixbar({
showHeight: 2,
click: function(type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<div class="layui-input-inline">
<input class="layui-input" id="AuthITEM" placeholder="权限名称">
</div>
<button class="layui-btn fa fa-search" id="searchAuthITEM"> 搜索</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-refresh" id="refresh"> 刷新</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-pencil-square-o " id="insertAuth"> 新增</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-save" id="toXls"> 导出</button>
</div>
</div>
</legend>
</fieldset>
<div id="toxlsTable">
<%--方法级渲染表格--%>
<table id="tableAuth"></table>
</div>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
/**
* 权限表 全部完成
* 2017.11.15 1:33
*/
layui.use(['util', 'layer', 'table'], function() {
$(document).ready(function() {
var table = layui.table,
layer = layui.layer,
util = layui.util;
var countNum;
//方法级渲染
var tableIns = table.render({
elem: '#tableAuth' //绑定元素-->对应页面table的ID
,
id: 'tableAuth' //表格容器索引
,
url: baseUrl + '/AuthInfoServlet' //数据接口
,
limit: 30,
cols: [
[ //表头
//field字段名、title标题名、width列宽、sort排序、fixed固定列、toolbar绑定工具条
{
field: 'authId',
title: 'ID',
width: 100,
sort: true,
fixed: true
}, {
field: 'authItem',
title: '权限名称'
}, {
field: 'isRead',
title: '可读'
}, {
field: 'isWrite',
title: '可写'
}, {
field: 'isChange',
title: '可改'
}, {
field: 'isDelete',
title: '可删'
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 200
}
]
],
page: true //是否开启分页
,
where: {
make: 0
} //接口的其它参数
,
done: function(res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function(obj) { //tool是工具条事件名
var data = obj.data,
layEvent = obj.event; //获得 lay-event 对应的值
//从前当前行获取列数据
var authId = data.authId;
var authItem = data.authItem;
var isRead = data.isRead;
var isWrite = data.isWrite;
var isChange = data.isChange;
var isDelete = data.isDelete;
if(layEvent === 'detail') { //查看功能
layer.alert('权限项:' + data.authItem + '<br>最低可读权限等级:' + data.isRead + '<br>最低可写权限等级:' +
data.isWrite + '<br>最低可改权限等级:' + data.isChange + '<br>最低可删权限等级:' + data.isDelete, {
skin: 'layui-layer-lan',
closeBtn: 0,
title: '您当前选择的权限值信息',
anim: 4,
offset: '180px'
});
} else if(layEvent === 'del') { //删除功能
layer.alert('本条目禁止删除!', {
title: '警告',
icon: 4,
anim: 6,
offset: '250px'
});
} else if(layEvent === 'edit') { //编辑功能
//layer.prompt(options, yes) - 输入层
//formType:输入框类型,支持0(文本)默认1(密码)2(多行文本) maxlength: 140, //可输入文本的最大长度,默认500
layer.prompt({
title: '请输入最低可读权限等级',
formType: 0,
value: isRead,
offset: '220px',
maxlength: 1
}, function(IsRead, index) {
layer.close(index);
layer.prompt({
title: '请输入最低可写权限等级',
formType: 0,
value: isWrite,
offset: '220px',
maxlength: 1
}, function(IsWrite, index) {
layer.close(index);
layer.prompt({
title: '请输入最低可改权限等级',
formType: 0,
value: isChange,
offset: '220px',
maxlength: 1
}, function(IsChange, index) {
layer.close(index);
layer.prompt({
title: '请输入最低可改权限等级',
formType: 0,
value: isDelete,
offset: '220px',
maxlength: 1
}, function(IsDelete, index) {
layer.close(index);
//isNaN() 函数用于检查其参数是否是非数字值,如果是数字返回true
if(isNaN(IsRead) || isNaN(IsWrite) || isNaN(IsChange) || isNaN(IsDelete)) {
layer.msg('您所输入的值类型不合法', {
offset: '250px'
});
} else { //传数据
table.reload('tableAuth', {
where: {
make: 2,
authId: authId,
authItem: authItem,
isRead: IsRead,
isWrite: IsWrite,
isChange: IsChange,
isDelete: IsDelete
}
});
layer.msg('修改成功', {
offset: '250px'
});
}
});
});
});
});
}
});
//刷新
$('#refresh').click(function() {
tableIns.reload({
where: {
make: 0,
page: 1
}
});
});
//新增
$('#insertAuth').click(function() {
layer.alert('本条目禁止新增!', {
title: '警告',
icon: 4,
anim: 6,
offset: '250px'
});
});
//搜索权限项目
$('#searchAuthITEM').click(function() {
var authItem = $('#AuthITEM').val();
if(authItem === "")
layer.msg('您必须输入值', {
offset: '250px'
});
else if(authItem.length > 10)
layer.msg('您所输入的值长度不合法', {
offset: '250px'
});
else {
layer.msg('搜索结果', {
offset: '250px'
});
//与tableIns.reload方法类似,这种方法是取表格容器索引值
table.reload('tableAuth', {
where: {
make: 3,
authItem: authItem
}
});
}
});
//导出
$('#toXls').click(function() {
location.href = baseUrl + '/AuthInfoExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//固定块 -- 就是那个回到顶部
util.fixbar({
showHeight: 2,
click: function(type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>新增房间类型</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
<legend>新增房间类型</legend>
</fieldset>
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">类型名称</label>
<div class="layui-input-block">
<input type="text" name="typeName" lay-verify="required|typeName" autocomplete="off" placeholder="请输入类型名称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">价格</label>
<div class="layui-input-inline">
<input type="text" name="price" lay-verify="required|number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">拼房价格</label>
<div class="layui-input-inline">
<input type="text" name="splicPrice" lay-verify="required|number" autocomplete="off" placeholder="¥" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">可超预定数</label>
<div class="layui-input-inline">
<input type="text" name="exceedance" lay-verify="required|number" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否可拼房</label>
<div class="layui-input-block">
<input type="radio" name="isSplice" value="Y" title="是" checked="">
<input type="radio" name="isSplice" value="N" title="否">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="insertRome">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script>
layui.use(['form', 'layedit', 'laydate'], function() {
var form = layui.form,
layer = layui.layer;
//自定义验证规则
form.verify({
typeName: function(value) {
if(value.length < 3) {
return '房间类型至少3个字符';
}
if(value.length > 10) {
return '房间类型至多10个字符'
}
}
});
//监听提交
form.on('submit(insertRome)', function(data) {
$.post(baseUrl + '/InsertRoomTypeServlet', JSON.stringify(data.field), function(code) {
if(code === 1) {
layer.alert('插入成功!', {
title: '成功',
icon: 6,
anim: 5
});
} else if(code === 0) {
layer.alert('已存在同名项!', {
title: '重复',
icon: 4,
anim: 6
});
} else {
layer.alert('插入失败!', {
title: '异常',
icon: 6,
anim: 6
});
}
});
return false;
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<button class="layui-btn fa fa-save" id="toXls"> 导出当前数据</button>
</div>
</div>
</legend>
</fieldset>
<%--方法级渲染表格--%>
<table id="tableLogInfo"></table>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['util', 'layer', 'table'], function () {
$(document).ready(function () {
var table = layui.table,
layer = layui.layer,
util = layui.util;
var countNum;
//方法级渲染
var tableIns = table.render({
elem: '#tableLogInfo' //绑定元素-->对应页面table的ID
,
id: 'tableLogInfo' //表格容器索引
,
url: baseUrl + '/LogInfoServlet' //数据接口
,
limit: 30,
cols: [
[ //表头
//field字段名、title标题名、width列宽、sort排序、fixed固定列、toolbar绑定工具条
{
field: 'logId',
title: '日志编号',
width: 100,
sort: true,
fixed: true
}, {
field: 'logName',
title: '内容',
sort: true
}, {
field: 'loginId',
title: '用户ID',
sort: true
}, {
field: 'loginName',
title: '用户登录名',
sort: true
}, {
field: 'logDate',
title: '日期',
sort: true
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 100
}
]
],
page: true //是否开启分页
,
where: {
make: 0
} //接口的其它参数
,
done: function (res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function (obj) { //tool是工具条事件名
var data = obj.data,
layEvent = obj.event; //获得 lay-event 对应的值
//从前当前行获取列数据
var logId = data.logId;
if (layEvent === 'del') { //删除功能
layer.confirm('您确定要删除该条数据吗?', {
offset: '180px',
btn: ['是滴', '手滑']
}, function () {
tableIns.reload({
where: {
make: 1,
logId: logId
}
});
layer.msg('删除结果如下', {
offset: '250px',
icon: 1
});
// tableIns.reload({
// where: {
// make: 0,
// page: 1
// }
// });
}, function () {
layer.msg('删除操作已取消', {
offset: '250px'
});
});
}
});
//刷新
$('#refresh').click(function () {
tableIns.reload({
where: {
make: 0,
page: 1
}
});
});
//导出
$('#toXls').click(function () {
location.href = baseUrl + '/LogInfoExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//固定块 -- 就是那个回到顶部
util.fixbar({
showHeight: 2,
click: function (type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
</head>
<frameset cols="200,*" frameborder="0">
<frame name="nav" src="SystemNav.jsp" />
<frame name="system" src="../../nav.html" />
</frameset>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/toExcel/xlsx.full.min.js"></script>
<script type="text/javascript" src="../../js/toExcel/FileSaver.js"></script>
<script type="text/javascript" src="../../js/toExcel/Export2Excel.js"></script>
</head>
<body>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<ul class="layui-nav layui-nav-tree">
<li class="layui-nav-item layui-nav-itemed">
<a>基础功能设置</a>
<dl class="layui-nav-child">
<dd>
<a href="RoomTypeTable.jsp" target="system">房间类型</a>
</dd>
<dd>
<a href="FloorTable.jsp" target="system">楼层信息</a>
</dd>
</dl>
</li>
<li class="layui-nav-item">
<a>附属功能设置</a>
<dl class="layui-nav-child">
<dd>
<a href="LogTable.jsp" target="system">日志管理</a>
</dd>
<dd>
<a href="AuthTable.jsp" target="system">权限管理</a>
</dd>
</dl>
</li>
</ul>
</div>
</div>
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script>
layui.use('element', function() {});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/toExcel/xlsx.full.min.js"></script>
<script type="text/javascript" src="../../js/toExcel/FileSaver.js"></script>
<script type="text/javascript" src="../../js/toExcel/Export2Excel.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<div class="layui-input-inline">
<input class="layui-input" id="inputSearch" placeholder="楼层名称">
</div>
<button class="layui-btn fa fa-search" id="searchButton"> 搜索</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-refresh" id="refreshButton"> 刷新</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-pencil-square-o " id="insertButton"> 新增</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-save" id="toXlsButton"> 导出</button>
</div>
</div>
</legend>
</fieldset>
<div id="toxlsTable">
<table id="tableID"></table>
</div>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
/**
* 公共模板部分,自制模板修改
* 规定:make 0重载 1新增 2修改 3搜索 4删除
*
* 这个模板来自权限表的jsp与js,因为大体类似,前端可以参照同一结构
* 一些变量名换成了与具体项无关的名称,需要修改的部分通过注释注明
* 原注释可以参考最初的版本 : AuthTable.jsp
*/
layui.use(['util', 'layer', 'table'], function() {
$(document).ready(function() {
var table = layui.table,
layer = layui.layer,
util = layui.util;
var countNum;
var tableIns = table.render({
elem: '#tableID',
id: 'tableID',
url: baseUrl + '/FloorInfoServlet',
cols: [
[{
field: 'floorId',
title: 'ID',
width: 100,
sort: true,
fixed: true
}, {
field: 'floorName',
title: '楼层名称'
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 200
}]
],
page: true,
where: {
make: 0
},
done: function(res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function(obj) {
var data = obj.data,
layEvent = obj.event;
var floorId = data.floorId;
var floorName = data.floorName;
if(layEvent === 'detail') { //查看功能
layer.alert('ID:' + floorId + '<br>楼层名称:' + floorName, {
skin: 'layui-layer-lan',
closeBtn: 0,
title: '您当前选择的楼层值信息',
anim: 4,
offset: '180px'
});
} else if(layEvent === 'del') {
layer.confirm('您确定要删除该条数据吗?', {
offset: '180px',
btn: ['是滴', '手滑']
}, function() {
table.reload('tableID', {
where: {
make: 4,
floorId: floorId
}
});
layer.msg('删除结果如下', {
offset: '250px',
icon: 1
});
}, function() {
layer.msg('删除操作已取消', {
offset: '250px'
});
});
} else if(layEvent === 'edit') {
layer.prompt({
title: '请输入楼层名称',
formType: 0,
value: floorName,
offset: '220px',
maxlength: 10
}, function(value, index) {
var params = "new=" + value + "&old=" + floorName;
$.post(baseUrl + '/QueryFloorNameServlet', params, function updateCheck(data) {
if(data === "1" || data === "2") {
layer.close(index);
table.reload('tableID', {
where: {
make: 2,
floorId: floorId,
floorName: value
}
});
layer.msg('修改结果如下', {
offset: '250px'
});
} else {
layer.alert('该楼层名称已经存在!', {
title: '警告',
icon: 4,
anim: 6,
offset: '220px'
});
}
});
});
}
});
//搜索
$('#searchButton').click(function() {
var inputTxt = $('#inputSearch').val();
if(inputTxt === "")
layer.msg('您必须输入值', {
offset: '250px'
});
else if(inputTxt.length > 10)
layer.msg('您所输入的值长度不合法', {
offset: '250px'
});
else {
tableIns.reload({
where: {
make: 3,
floorName: inputTxt
}
});
layer.msg('搜索结果', {
offset: '250px'
});
}
});
//刷新
$('#refreshButton').click(function() {
tableIns.reload({
where: {
make: 0,
page: 1
}
});
});
//新增
$('#insertButton').click(function() {
layer.prompt({
title: '请输入楼层名称',
formType: 0,
offset: '220px',
maxlength: 10
}, function(inputValue, index) {
var params = "new=" + inputValue + "&old=" + inputValue;
$.post(baseUrl + '/QueryFloorNameServlet', params, function(data) {
if(data === "1") {
layer.close(index);
table.reload('tableID', {
where: {
make: 1,
floorName: inputValue
}
});
layer.msg('新增楼层成功', {
offset: '250px'
});
tableIns.reload({
where: {
make: 0
}
});
} else {
layer.alert('该楼层名称已经存在!', {
title: '警告',
icon: 4,
anim: 6,
offset: '220px'
});
}
});
});
});
//导出
$('#toXlsButton').click(function() {
location.href = baseUrl + '/FloorInfoExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//回到顶端
util.fixbar({
showHeight: 2,
click: function(type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script src="../../js/global.js"></script>
<script src="../../js/toExcel/xlsx.full.min.js"></script>
<script type="text/javascript" src="../../js/toExcel/FileSaver.js"></script>
<script type="text/javascript" src="../../js/toExcel/Export2Excel.js"></script>
<style>
body {
margin: 10px;
}
.layui-elem-field legend {
font-size: 14px;
}
.layui-field-title {
margin: 25px 0 15px;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>
<div>
<div class="layui-inline">
<div class="layui-input-inline">
<input class="layui-input" id="inputSearch" placeholder="房间类型">
</div>
<button class="layui-btn fa fa-search" id="searchButton"> 搜索</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-refresh" id="refreshButton"> 刷新</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-pencil-square-o " id="insertButton"> 新增</button>
</div>
<div class="layui-inline">
<button class="layui-btn fa fa-save" id="toXlsButton"> 导出</button>
</div>
</div>
</legend>
</fieldset>
<div id="toxlsTable">
<table id="tableID"></table>
</div>
<script type="text/html" id="barAuth">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['util', 'layer', 'table'], function() {
$(document).ready(function() {
var table = layui.table,
layer = layui.layer,
util = layui.util;
var countNum;
var tableIns = table.render({
elem: '#tableID',
id: 'tableID',
url: baseUrl + '/RoomTypeServlet',
cols: [
[{
field: 'typeId',
title: 'ID',
sort: true,
fixed: true,
width: 150
}, {
field: 'typeName',
title: '类型名称'
}, {
field: 'price',
title: '价格'
}, {
field: 'splicPrice',
title: '拼房价格'
}, {
field: 'exceedance',
title: '可超预定数'
}, {
field: 'isSplice',
title: '是否可拼房'
}, {
field: 'right',
title: '管理',
align: 'center',
toolbar: '#barAuth',
width: 200
}]
],
page: true,
where: {
make: 0
},
done: function(res, curr, count) {
countNum = count;
}
});
//监听工具条
table.on('tool', function(obj) {
var data = obj.data,
layEvent = obj.event;
var typeId = data.typeId;
var typeName = data.typeName;
var price = data.price;
var splicPrice = data.splicPrice;
var exceedance = data.exceedance;
var isSplice = data.isSplice;
if(layEvent === 'detail') {
layer.alert(
'ID:' + typeId + '<br>类型名称:' + typeName + '<br>价格:' + price +
'<br>拼房价格:' + splicPrice + '<br>可超预定数:' + exceedance + '<br>是否可拼房:' + isSplice, {
skin: 'layui-layer-lan',
closeBtn: 0,
title: '您当前选择的房间类型信息',
anim: 4,
offset: '180px'
});
} else if(layEvent === 'del') {
layer.confirm('您确定要删除该条数据吗?', {
offset: '180px',
btn: ['是滴', '手滑']
}, function() {
table.reload('tableID', {
where: {
make: 4,
typeId: typeId
}
});
layer.msg('删除结果如下', {
offset: '250px',
icon: 1
});
}, function() {
layer.msg('删除操作已取消', {
offset: '250px'
});
});
} else if(layEvent === 'edit') {
//编辑
layer.prompt({
title: '请输入类型名称',
formType: 0,
value: typeName,
offset: '220px',
maxlength: 10
}, function(NewTypeName, index) {
var params = "new=" + NewTypeName + "&old=" + typeName;
$.post(baseUrl + '/QueryRoomTypeNameServlet', params, function(data) {
if(data === "1" || data === "2") {
if(NewTypeName.length < 3)
layer.alert('长度不符合!', {
title: '警告',
icon: 4,
anim: 6,
offset: '220px'
});
else {
layer.close(index);
layer.prompt({
title: '请输入价格',
formType: 0,
value: price,
offset: '220px',
maxlength: 10
}, function(NewPrice, index) {
if(isNaN(NewPrice)) {
layer.msg('您所输入的值类型不合法', {
offset: '250px'
});
} else {
layer.close(index);
layer.prompt({
title: '请输入拼房价格',
formType: 0,
value: splicPrice,
offset: '220px',
maxlength: 10
}, function(NewSplicPrice, index) {
if(isNaN(NewSplicPrice)) {
layer.msg('您所输入的值类型不合法', {
offset: '250px'
});
} else {
layer.close(index);
layer.prompt({
title: '请输入可超预定数',
formType: 0,
value: exceedance,
offset: '220px',
maxlength: 10
}, function(NewExceedance, index) {
if(isNaN(NewExceedance)) {
layer.msg('您所输入的值类型不合法', {
offset: '250px'
});
} else {
layer.close(index);
layer.prompt({
title: '是否可拼房(Y/N)',
formType: 0,
value: isSplice,
offset: '220px',
maxlength: 10
}, function(NewIsSplice, index) {
if(NewIsSplice.valueOf() === "Y" || NewIsSplice.valueOf() === "N") {
tableIns.reload({
where: {
make: 2,
typeId: typeId,
typeName: NewTypeName,
price: NewPrice,
splicPrice: NewSplicPrice,
exceedance: NewExceedance,
isSplice: NewIsSplice
}
});
layer.close(index);
} else {
layer.msg('您所输入的值类型不合法', {
offset: '260px'
});
}
});
}
});
}
});
}
});
}
} else {
layer.alert('已存在同名项!', {
title: '警告',
icon: 4,
anim: 6,
offset: '220px'
});
}
});
});
}
});
//搜索
$('#searchButton').click(function() {
var inputTxt = $('#inputSearch').val();
if(inputTxt === "")
layer.msg('您必须输入值', {
offset: '250px'
});
else if(inputTxt.length > 10)
layer.msg('您所输入的值长度不合法', {
offset: '250px'
});
else {
layer.msg('搜索结果', {
offset: '250px'
});
table.reload('tableID', {
where: {
make: 3,
typeName: inputTxt
}
})
}
});
//刷新
$('#refreshButton').click(function() {
// 简述此处存在的BUG 删除操作触发外键依赖后,出500异常
// 通过msg回传参数,尔后执行刷新操作时,框架本身死掉
// 即往后端传入的分页参数固定为1,表格的重载刷新失效
// 暂时只发现删除引起的异常,先通过强制刷新解决此处异常
// tableIns.reload({
// where: {
// make: 0,
// page: 1
// }
// });
location.reload();
});
//新增
$('#insertButton').click(function() {
layer.open({
title: "新增",
btn: ['关闭'],
yes: function(index) {
tableIns.reload({
where: {
make: 0
}
});
layer.close(index); //关闭弹窗
},
type: 2,
area: ['780px', '450px'],
fixed: false,
maxmin: true,
content: '/hb/webpage/SystemSetting/insertRomeType.jsp',
cancel: function() {
tableIns.reload({
where: {
make: 0
}
});
}
});
});
//导出
$('#toXlsButton').click(function() {
location.href = baseUrl + '/RoomInfoExcelServlet';
layer.alert('Excel文件生成完成!', {
title: '成功',
icon: 6,
anim: 1,
offset: '250px'
});
});
//回到顶端
util.fixbar({
showHeight: 2,
click: function(type) {
console.log(type);
}
});
});
});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>酒店管理系统</title>
</head>
<frameset rows="60,*" frameborder="0">
<frame name="Header" src="searchHeader.jsp" />
<frame name="search" src="../../nav.html" />
</frameset>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>酒店管理系统</title>
<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../MAIN/component/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="../../js/toExcel/xlsx.full.min.js"></script>
<script type="text/javascript" src="../../js/toExcel/FileSaver.js"></script>
<script type="text/javascript" src="../../js/toExcel/Export2Excel.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo">酒店管理系统</div>
<!-- 头部区域(可配合layui已有的水平导航) -->
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item" lay-unselect>
<a href="../orderInfo/orderTable.jsp" target="search">预订单</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="此处填充地址" target="search">入住单</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="此处填充地址" target="search">账单明细</a>
</li>
</ul>
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item" lay-unselect>
<a href="此处填充地址" target="search">预订单历史</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="此处填充地址" target="search">入住单历史</a>
</li>
</ul>
</div>
</div>
<script src="../../js/layui/layui.js"></script>
<script src="../../js/jquery.js"></script>
<script>
//JavaScript代码区域
layui.use('element', function() {});
</script>
</body>
</html> | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.authinfo.dao;
import com.inks.hb.authinfo.pojo.AuthInfo;
import org.junit.Test;
import java.sql.SQLException;
import static org.junit.Assert.*;
public class AuthInfoDaoTest {
private AuthInfoDao dao = new AuthInfoDao();
@Test
public void insertData() {
AuthInfo authInfo;
for (int i = 0;i < 100; i++) {
authInfo = new AuthInfo(i,"测试" + i, "1","1",""+i,"0");
try {
dao.insertData(authInfo);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.orderinfo.dao;
import com.inks.hb.login.dao.LoginDao;
import com.inks.hb.login.pojo.Login;
import com.inks.hb.orderinfo.pojo.OrderInfo;
import com.inks.hb.roomtype.dao.RoomTypeDao;
import com.inks.hb.roomtype.pojo.RoomType;
import org.junit.Test;
import java.sql.SQLException;
import java.util.ArrayList;
import static org.junit.Assert.*;
public class OrderInfoDaoTest {
OrderInfoDao dao = new OrderInfoDao();
RoomTypeDao roomTypeDao = new RoomTypeDao();
LoginDao loginDao = new LoginDao();
@Test
public void insertData() throws Exception {
OrderInfo orderInfo = new OrderInfo();
RoomType roomType = roomTypeDao.queryName("123");
Login login = (Login) loginDao.query(new Login("root",""));
System.out.println(login);
orderInfo.setTypeId(roomType);
orderInfo.setOperatorId(login);
orderInfo.setOrderId("预定第3单");
dao.insertData(orderInfo);
}
@Test
public void queryOrder(){
ArrayList<OrderInfo> list = null;
try {
list = dao.queryOrder(1,"测试");
for (OrderInfo info : list)
System.out.println(info);
} catch (SQLException e) {
e.printStackTrace();
}
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.orderinfo.service;
import com.inks.hb.orderinfo.pojo.OrderInfo;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.*;
public class OrderInfoServiceImplTest {
private OrderInfoService service = new OrderInfoServiceImpl();
@Test
public void insertOrderInfo() {
}
@Test
public void deleteOrderInfo() {
}
@Test
public void updateOrderInfo() {
}
@Test
public void query() {
ArrayList<OrderInfo> list = service.query(1,50);
for (OrderInfo info : list) {
System.out.println(info);
}
}
@Test
public void query1() {
System.out.println(service.query("OD151254780333"));
}
@Test
public void queryOrderInfoNum() {
}
@Test
public void queryRepeat() {
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.floorinfo.dao;
import com.inks.hb.floorinfo.pojo.FloorInfo;
import org.junit.Test;
import static org.junit.Assert.*;
public class FloorInfoDaoTest {
@Test
public void insertData() throws Exception {
FloorInfoDao dao = new FloorInfoDao();
FloorInfo floorInfo;
for (int i = 0; i < 100; i++) {
floorInfo = new FloorInfo(i, "123546");
dao.insertData(floorInfo);
}
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.login.service;
import com.inks.hb.login.pojo.Login;
import org.junit.Test;
import static org.junit.Assert.*;
public class LoginServiceImplTest {
@Test
public void queryByName() {
}
@Test
public void queryLogin() {
}
@Test
public void insertLogin() {
Login login = new Login("admin","123456","测试账户");
int code = new LoginServiceImpl().insertLogin(login);
System.out.println("code: " + code);
}
@Test
public void deleteLogin() {
}
@Test
public void updateLogin() {
}
@Test
public void query() {
}
@Test
public void queryLoginNum() {
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
package com.inks.hb.common;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
public class ExportExcelTest {
@Test
public void readXlsx() {
try {
ArrayList list = ExportExcel.readXlsx("D:\\用户信息.xlsx");
for (Object i : list)
System.out.println(i.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
} | {
"repo_name": "inkss/hotelbook-JavaWeb",
"stars": "161",
"repo_language": "Java",
"file_name": "MD5.java",
"mime_type": "text/x-java"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.