text
stringlengths 3
1.05M
|
---|
import { StyleSheet } from 'react-native';
export const colors = {
theme: '#3a2850',
homeCard: '#ff2d34'
};
export const general = StyleSheet.create({
theme: {
backgroundColor: colors.theme
},
safeArea: {
flex: 1,
justifyContent: 'flex-start'
}
});
|
import logging
from datetime import date, datetime
from drf_yasg.utils import swagger_serializer_method
from rest_framework import serializers
from .models import Amount, UnitConversionPayload, Dimension, CustomUnit
from geocurrency.core.serializers import UserSerializer
class UnitAmountSerializer(serializers.Serializer):
system = serializers.CharField()
unit = serializers.CharField()
value = serializers.FloatField()
date_obj = serializers.DateField()
@staticmethod
def validate_system(system):
from .models import UnitSystem
if not UnitSystem.is_valid(system):
raise serializers.ValidationError('Invalid system')
return system
@staticmethod
def validate_unit(unit):
# Validating unit requires knowledge of the system
# Let‘s say it is valid for now
return unit
@staticmethod
def validate_date_obj(value):
if isinstance(value, date):
return value
try:
datetime.strptime(value, 'YYYY-MM-DD')
except ValueError:
raise serializers.ValidationError('Invalid date format, use YYYY-MM-DD')
return value
def create(self, validated_data):
return Amount(**validated_data)
def update(self, instance, validated_data):
instance.system = validated_data.get('system', instance.system)
instance.unit = validated_data.get('unit', instance.unit)
instance.value = validated_data.get('value', instance.value)
instance.date_obj = validated_data.get('date_obj', instance.date_obj)
return instance
class UnitSerializer(serializers.Serializer):
code = serializers.CharField()
name = serializers.CharField()
dimensions = serializers.SerializerMethodField()
@swagger_serializer_method(serializer_or_field=serializers.ListField)
def get_dimensions(self, obj):
return str(obj.dimensions)
class DimensionSerializer(serializers.Serializer):
code = serializers.CharField()
name = serializers.CharField()
dimension = serializers.CharField()
base_unit = serializers.SerializerMethodField()
def create(self, validated_data):
return Dimension(**validated_data)
def update(self, instance, validated_data):
instance.unit_system = validated_data.get('system', instance.unit_system)
instance.code = validated_data.get('code', instance.code)
instance.value = validated_data.get('name', instance.name)
instance.dimension = validated_data.get('date_obj', instance.dimension)
return instance
@swagger_serializer_method(serializer_or_field=serializers.CharField)
def get_base_unit(self, obj):
return obj.base_unit
class DimensionWithUnitsSerializer(DimensionSerializer):
units = UnitSerializer(many=True)
@swagger_serializer_method(serializer_or_field=UnitSerializer)
def get_units(self, obj: Dimension):
try:
return obj.units
except KeyError as e:
logging.error(str(e))
return None
class UnitSystemSerializer(serializers.Serializer):
system_name = serializers.CharField()
class UnitConversionPayloadSerializer(serializers.Serializer):
data = UnitAmountSerializer(many=True, required=False)
base_system = serializers.CharField(required=True)
base_unit = serializers.CharField(required=True)
batch_id = serializers.CharField(required=False)
key = serializers.CharField(required=False)
eob = serializers.BooleanField(default=False)
def is_valid(self, raise_exception=False) -> bool:
if not self.initial_data.get('data') and (not self.initial_data.get('batch_id')
or (self.initial_data.get('batch_id')
and not self.initial_data.get('eob'))):
raise serializers.ValidationError(
'data has to be provided if batch_id is not provided or batch_id is provided and eob is False'
)
return super(UnitConversionPayloadSerializer, self).is_valid()
@staticmethod
def validate_base_system(value: str):
from geocurrency.units.models import UnitSystem
if not UnitSystem.is_valid(value):
raise serializers.ValidationError('Invalid unit system')
return value
@staticmethod
def validate_base_unit(value: str) -> str:
from geocurrency.units.models import Unit
if not Unit.is_valid(value):
raise serializers.ValidationError('Invalid unit')
return value
def create(self, validated_data: {}):
return UnitConversionPayload(**validated_data)
def update(self, instance, validated_data: {}):
self.data = validated_data.get('data', instance.data)
self.base_system = validated_data.get('base_system', instance.base_system)
self.base_unit = validated_data.get('base_system', instance.base_unit)
self.batch_id = validated_data.get('batch_id', instance.batch_id)
self.key = validated_data.get('key', instance.key)
self.eob = validated_data.get('eob', instance.eob)
return instance
class CustomUnitSerializer(serializers.ModelSerializer):
user = UserSerializer(read_only=True)
unit_system = serializers.CharField(read_only=True)
class Meta:
model = CustomUnit
fields = ['user', 'key', 'unit_system', 'code', 'name', 'relation', 'symbol', 'alias'] |
/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.listReusableBlocks=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="SdGz")}({GRId:function(e,t){e.exports=window.wp.element},K9lf:function(e,t){e.exports=window.wp.compose},SdGz:function(e,t,n){"use strict";n.r(t);var o=n("GRId"),i=n("l3Sj"),r=n("YLtl"),s=n("ywyh"),l=n.n(s);var a=async function(e){const t=await l()({path:"/wp/v2/types/wp_block"}),n=await l()({path:`/wp/v2/${t.rest_base}/${e}?context=edit`}),o=n.title.raw,i=n.content.raw,s=JSON.stringify({__file:"wp_block",title:o,content:i},null,2);!function(e,t,n){const o=new window.Blob([t],{type:n});if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(o,e);else{const t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=e,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}}(Object(r.kebabCase)(o)+".json",s,"application/json")},c=n("tI+e"),u=n("K9lf");var d=async function(e){const t=await function(e){const t=new window.FileReader;return new Promise(n=>{t.onload=()=>{n(t.result)},t.readAsText(e)})}(e);let n;try{n=JSON.parse(t)}catch(e){throw new Error("Invalid JSON file")}if(!("wp_block"===n.__file&&n.title&&n.content&&Object(r.isString)(n.title)&&Object(r.isString)(n.content)))throw new Error("Invalid Reusable block JSON file");const o=await l()({path:"/wp/v2/types/wp_block"});return await l()({path:"/wp/v2/"+o.rest_base,data:{title:n.title,content:n.content,status:"publish"},method:"POST"})};class p extends o.Component{constructor(){super(...arguments),this.state={isLoading:!1,error:null,file:null},this.isStillMounted=!0,this.onChangeFile=this.onChangeFile.bind(this),this.onSubmit=this.onSubmit.bind(this)}componentWillUnmount(){this.isStillMounted=!1}onChangeFile(e){this.setState({file:e.target.files[0],error:null})}onSubmit(e){e.preventDefault();const{file:t}=this.state,{onUpload:n}=this.props;t&&(this.setState({isLoading:!0}),d(t).then(e=>{this.isStillMounted&&(this.setState({isLoading:!1}),n(e))}).catch(e=>{if(!this.isStillMounted)return;let t;switch(e.message){case"Invalid JSON file":t=Object(i.__)("Invalid JSON file");break;case"Invalid Reusable block JSON file":t=Object(i.__)("Invalid Reusable block JSON file");break;default:t=Object(i.__)("Unknown error")}this.setState({isLoading:!1,error:t})}))}onDismissError(){this.setState({error:null})}render(){const{instanceId:e}=this.props,{file:t,isLoading:n,error:r}=this.state,s="list-reusable-blocks-import-form-"+e;return Object(o.createElement)("form",{className:"list-reusable-blocks-import-form",onSubmit:this.onSubmit},r&&Object(o.createElement)(c.Notice,{status:"error",onRemove:()=>this.onDismissError()},r),Object(o.createElement)("label",{htmlFor:s,className:"list-reusable-blocks-import-form__label"},Object(i.__)("File")),Object(o.createElement)("input",{id:s,type:"file",onChange:this.onChangeFile}),Object(o.createElement)(c.Button,{type:"submit",isBusy:n,disabled:!t||n,variant:"secondary",className:"list-reusable-blocks-import-form__button"},Object(i._x)("Import","button label")))}}var b=Object(u.withInstanceId)(p);var f=function(e){let{onUpload:t}=e;return Object(o.createElement)(c.Dropdown,{position:"bottom right",contentClassName:"list-reusable-blocks-import-dropdown__content",renderToggle:e=>{let{isOpen:t,onToggle:n}=e;return Object(o.createElement)(c.Button,{"aria-expanded":t,onClick:n,variant:"primary"},Object(i.__)("Import from JSON"))},renderContent:e=>{let{onClose:n}=e;return Object(o.createElement)(b,{onUpload:Object(r.flow)(n,t)})}})};document.body.addEventListener("click",e=>{e.target.classList.contains("wp-list-reusable-blocks__export")&&(e.preventDefault(),a(e.target.dataset.id))}),document.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector(".page-title-action");if(!e)return;const t=document.createElement("div");t.className="list-reusable-blocks__container",e.parentNode.insertBefore(t,e),Object(o.render)(Object(o.createElement)(f,{onUpload:()=>{const e=document.createElement("div");e.className="notice notice-success is-dismissible",e.innerHTML=`<p>${Object(i.__)("Reusable block imported successfully!")}</p>`;const t=document.querySelector(".wp-header-end");t&&t.parentNode.insertBefore(e,t)}}),t)})},YLtl:function(e,t){e.exports=window.lodash},l3Sj:function(e,t){e.exports=window.wp.i18n},"tI+e":function(e,t){e.exports=window.wp.components},ywyh:function(e,t){e.exports=window.wp.apiFetch}}); |
if (1) function a(){} else function b(){} |
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
import ListEditing from '../src/listediting';
import ListCommand from '../src/listcommand';
import IndentCommand from '../src/indentcommand';
import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
import BoldEditing from '@ckeditor/ckeditor5-basic-styles/src/bold/boldediting';
import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
import BlockQuoteEditing from '@ckeditor/ckeditor5-block-quote/src/blockquoteediting';
import HeadingEditing from '@ckeditor/ckeditor5-heading/src/headingediting';
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
import { getData as getModelData, parse as parseModel, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { getData as getViewData, parse as parseView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import IndentEditing from '@ckeditor/ckeditor5-indent/src/indentediting';
import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
import TableEditing from '@ckeditor/ckeditor5-table/src/tableediting';
describe( 'ListEditing', () => {
let editor, model, modelDoc, modelRoot, view, viewDoc, viewRoot;
beforeEach( () => {
return VirtualTestEditor
.create( {
plugins: [ Clipboard, BoldEditing, ListEditing, UndoEditing, BlockQuoteEditing, TableEditing ]
} )
.then( newEditor => {
editor = newEditor;
model = editor.model;
modelDoc = model.document;
modelRoot = modelDoc.getRoot();
view = editor.editing.view;
viewDoc = view.document;
viewRoot = viewDoc.getRoot();
model.schema.register( 'foo', {
allowWhere: '$block',
allowAttributes: [ 'listIndent', 'listType' ],
isBlock: true,
isObject: true
} );
} );
} );
afterEach( () => {
return editor.destroy();
} );
it( 'should have pluginName', () => {
expect( ListEditing.pluginName ).to.equal( 'ListEditing' );
} );
it( 'should be loaded', () => {
expect( editor.plugins.get( ListEditing ) ).to.be.instanceOf( ListEditing );
} );
it( 'should set proper schema rules', () => {
expect( model.schema.isRegistered( 'listItem' ) );
expect( model.schema.isBlock( 'listItem' ) );
expect( model.schema.checkChild( [ '$root' ], 'listItem' ) ).to.be.true;
expect( model.schema.checkChild( [ '$root', 'listItem' ], '$text' ) ).to.be.true;
expect( model.schema.checkChild( [ '$root', 'listItem' ], 'listItem' ) ).to.be.false;
expect( model.schema.checkChild( [ '$root', 'listItem' ], '$block' ) ).to.be.false;
expect( model.schema.checkAttribute( [ '$root', 'listItem' ], 'listIndent' ) ).to.be.true;
expect( model.schema.checkAttribute( [ '$root', 'listItem' ], 'listType' ) ).to.be.true;
} );
describe( 'commands', () => {
it( 'should register bulleted list command', () => {
const command = editor.commands.get( 'bulletedList' );
expect( command ).to.be.instanceOf( ListCommand );
expect( command ).to.have.property( 'type', 'bulleted' );
} );
it( 'should register numbered list command', () => {
const command = editor.commands.get( 'numberedList' );
expect( command ).to.be.instanceOf( ListCommand );
expect( command ).to.have.property( 'type', 'numbered' );
} );
it( 'should register indent list command', () => {
const command = editor.commands.get( 'indentList' );
expect( command ).to.be.instanceOf( IndentCommand );
} );
it( 'should register outdent list command', () => {
const command = editor.commands.get( 'outdentList' );
expect( command ).to.be.instanceOf( IndentCommand );
} );
it( 'should add indent list command to indent command', () => {
return VirtualTestEditor
.create( {
plugins: [ ListEditing, IndentEditing ]
} )
.then( newEditor => {
editor = newEditor;
} )
.then( () => {
const indentListCommand = editor.commands.get( 'indentList' );
const indentCommand = editor.commands.get( 'indent' );
const spy = sinon.spy( indentListCommand, 'execute' );
indentListCommand.isEnabled = true;
indentCommand.execute();
sinon.assert.calledOnce( spy );
} );
} );
it( 'should add outdent list command to outdent command', () => {
return VirtualTestEditor
.create( {
plugins: [ ListEditing, IndentEditing ]
} )
.then( newEditor => {
editor = newEditor;
} )
.then( () => {
const outdentListCommand = editor.commands.get( 'outdentList' );
const outdentCommand = editor.commands.get( 'outdent' );
const spy = sinon.spy( outdentListCommand, 'execute' );
outdentListCommand.isEnabled = true;
outdentCommand.execute();
sinon.assert.calledOnce( spy );
} );
} );
} );
describe( 'enter key handling callback', () => {
it( 'should execute outdentList command on enter key in empty list', () => {
const domEvtDataStub = { preventDefault() {} };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">[]</listItem>' );
editor.editing.view.document.fire( 'enter', domEvtDataStub );
sinon.assert.calledOnce( editor.execute );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
it( 'should not execute outdentList command on enter key in non-empty list', () => {
const domEvtDataStub = { preventDefault() {} };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">foo[]</listItem>' );
editor.editing.view.document.fire( 'enter', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
} );
describe( 'delete key handling callback', () => {
it( 'should execute outdentList command on backspace key in first item of list (first node in root)', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">[]foo</listItem>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
it( 'should execute outdentList command on backspace key in first item of list (after a paragraph)', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<paragraph>foo</paragraph><listItem listType="bulleted" listIndent="0">[]foo</listItem>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
it( 'should not execute outdentList command on delete key in first item of list', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'forward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">[]foo</listItem>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
it( 'should not execute outdentList command when selection is not collapsed', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">[fo]o</listItem>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
it( 'should not execute outdentList command if not in list item', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<paragraph>[]foo</paragraph>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
it( 'should not execute outdentList command if not in first list item', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData(
model,
'<listItem listType="bulleted" listIndent="0">foo</listItem><listItem listType="bulleted" listIndent="0">[]foo</listItem>'
);
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
it( 'should not execute outdentList command when selection is not on first position', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData( model, '<listItem listType="bulleted" listIndent="0">fo[]o</listItem>' );
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.notCalled( editor.execute );
} );
it( 'should outdent list when previous element is nested in block quote', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData(
model,
'<blockQuote><paragraph>x</paragraph></blockQuote><listItem listType="bulleted" listIndent="0">[]foo</listItem>'
);
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
it( 'should outdent list when list is nested in block quote', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData(
model,
'<paragraph>x</paragraph><blockQuote><listItem listType="bulleted" listIndent="0">[]foo</listItem></blockQuote>'
);
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
it( 'should outdent empty list when list is nested in block quote', () => {
const domEvtDataStub = { preventDefault() {}, direction: 'backward' };
sinon.spy( editor, 'execute' );
setModelData(
model,
'<paragraph>x</paragraph><blockQuote><listItem listType="bulleted" listIndent="0">[]</listItem></blockQuote>'
);
editor.editing.view.document.fire( 'delete', domEvtDataStub );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
} );
} );
describe( 'tab key handling callback', () => {
let domEvtDataStub;
beforeEach( () => {
domEvtDataStub = {
keyCode: getCode( 'Tab' ),
preventDefault: sinon.spy(),
stopPropagation: sinon.spy()
};
sinon.spy( editor, 'execute' );
} );
afterEach( () => {
editor.execute.restore();
} );
it( 'should execute indentList command on tab key', () => {
setModelData(
model,
'<listItem listType="bulleted" listIndent="0">foo</listItem>' +
'<listItem listType="bulleted" listIndent="0">[]bar</listItem>'
);
editor.editing.view.document.fire( 'keydown', domEvtDataStub );
sinon.assert.calledOnce( editor.execute );
sinon.assert.calledWithExactly( editor.execute, 'indentList' );
sinon.assert.calledOnce( domEvtDataStub.preventDefault );
sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
} );
it( 'should execute outdentList command on Shift+Tab keystroke', () => {
domEvtDataStub.keyCode += getCode( 'Shift' );
setModelData(
model,
'<listItem listType="bulleted" listIndent="0">foo</listItem>' +
'<listItem listType="bulleted" listIndent="1">[]bar</listItem>'
);
editor.editing.view.document.fire( 'keydown', domEvtDataStub );
sinon.assert.calledOnce( editor.execute );
sinon.assert.calledWithExactly( editor.execute, 'outdentList' );
sinon.assert.calledOnce( domEvtDataStub.preventDefault );
sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
} );
it( 'should not indent if command is disabled', () => {
setModelData( model, '<listItem listType="bulleted" listIndent="0">[]foo</listItem>' );
editor.editing.view.document.fire( 'keydown', domEvtDataStub );
expect( editor.execute.called ).to.be.false;
sinon.assert.notCalled( domEvtDataStub.preventDefault );
sinon.assert.notCalled( domEvtDataStub.stopPropagation );
} );
it( 'should not indent or outdent if alt+tab is pressed', () => {
domEvtDataStub.keyCode += getCode( 'alt' );
setModelData(
model,
'<listItem listType="bulleted" listIndent="0">foo</listItem>' +
'<listItem listType="bulleted" listIndent="0">[]bar</listItem>'
);
editor.editing.view.document.fire( 'keydown', domEvtDataStub );
expect( editor.execute.called ).to.be.false;
sinon.assert.notCalled( domEvtDataStub.preventDefault );
sinon.assert.notCalled( domEvtDataStub.stopPropagation );
} );
} );
describe( 'flat lists', () => {
describe( 'setting data', () => {
function testList( testName, string, expectedString = null ) {
it( testName, () => {
editor.setData( string );
expect( editor.getData() ).to.equal( expectedString || string );
} );
}
testList( 'single item', '<ul><li>x</li></ul>' );
testList( 'multiple items', '<ul><li>a</li><li>b</li><li>c</li></ul>' );
testList( 'items and text', '<p>xxx</p><ul><li>a</li><li>b</li></ul><p>yyy</p><ul><li>c</li><li>d</li></ul>' );
testList( 'numbered list', '<ol><li>a</li><li>b</li></ol>' );
testList( 'mixed list and content #1', '<p>xxx</p><ul><li>a</li><li>b</li></ul><ol><li>c</li><li>d</li></ol><p>yyy</p>' );
testList( 'mixed list and content #2',
'<ol><li>a</li></ol><p>xxx</p><ul><li>b</li><li>c</li></ul><p>yyy</p><ul><li>d</li></ul>' );
testList(
'clears incorrect elements',
'<ul>x<li>a</li><li>b</li><p>xxx</p>x</ul><p>c</p>', '<ul><li>a</li><li>b</li></ul><p>c</p>'
);
testList(
'clears whitespaces',
'<p>foo</p>' +
'<ul>' +
' <li>xxx</li>' +
' <li>yyy</li>' +
'</ul>',
'<p>foo</p><ul><li>xxx</li><li>yyy</li></ul>'
);
// #ckeditor5/1399
testList( 'single item with `font-weight` style',
'<ol><li style="font-weight: bold">foo</li></ol>', '<ol><li><strong>foo</strong></li></ol>' );
it( 'model test for mixed content', () => {
editor.setData( '<ol><li>a</li></ol><p>xxx</p><ul><li>b</li><li>c</li></ul><p>yyy</p><ul><li>d</li></ul>' );
const expectedModelData =
'<listItem listIndent="0" listType="numbered">a</listItem>' +
'<paragraph>xxx</paragraph>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>' +
'<paragraph>yyy</paragraph>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>';
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( expectedModelData );
} );
describe( 'block elements inside list items', () => {
describe( 'single block', () => {
testList(
'single item',
'<ul><li><p>Foo</p></li></ul>',
'<p>Foo</p>'
);
testList(
'multiple items',
'<ul><li><p>Foo</p></li><li><p>Bar</p></li></ul>',
'<p>Foo</p><p>Bar</p>'
);
testList(
'nested items',
'<ul><li><p>Foo</p><ol><li><p>Bar</p></li></ol></li></ul>',
'<p>Foo</p><p>Bar</p>'
);
} );
describe( 'multiple blocks', () => {
testList(
'single item',
'<ul><li><h2>Foo</h2><p>Bar</p></li></ul>',
'<p>Foo</p><p>Bar</p>'
);
testList(
'multiple items',
'<ol><li><p>123</p></li></ol><ul><li><h2>Foo</h2><p>Bar</p></li></ul>',
'<p>123</p><p>Foo</p><p>Bar</p>'
);
testList(
'nested items #2',
'<ol><li><p>123</p><p>456</p><ul><li><h2>Foo</h2><p>Bar</p></li></ul></li></ol>',
'<p>123</p><p>456</p><p>Foo</p><p>Bar</p>'
);
} );
describe.skip( 'multiple blocks', () => { // Skip due to #112 issue.
testList(
'nested items #1',
'<ol><li><p>123</p><ul><li><h2>Foo</h2><p>Bar</p></li></ul><p>456</p></li></ol>',
'<p>123</p><p>Foo</p><p>Bar</p><p>456</p>'
);
} );
describe( 'inline + block', () => {
testList(
'single item',
'<ul><li>Foo<p>Bar</p></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p>'
);
testList(
'multiple items',
'<ul><li>Foo<p>Bar</p></li><li>Foz<p>Baz</p></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p><ul><li>Foz</li></ul><p>Baz</p>'
);
testList(
'split by list items',
'<ul><li>Foo</li><li><p>Bar</p></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p>'
);
testList(
'nested split by list items',
'<ul><li>Foo<ol><li><p>Bar</p></li></ol></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p>'
);
testList(
'nested items #1',
'<ol><li>Foo<p>Bar</p><ul><li>123<h2>456</h2></li></ul></li></ol>',
'<ol><li>Foo</li></ol><p>Bar</p><ul><li>123</li></ul><p>456</p>'
);
testList(
'nested items #2',
'<ol><li>Foo<p>Bar</p><ul><li>123<h2>456</h2></li></ul></li><li>abc<h2>def</h2></li></ol>',
'<ol><li>Foo</li></ol><p>Bar</p><ul><li>123</li></ul><p>456</p><ol><li>abc</li></ol><p>def</p>'
);
} );
describe( 'block + inline', () => {
testList(
'single item',
'<ul><li><p>Foo</p>Bar</li></ul>',
'<p>Foo</p><ul><li>Bar</li></ul>'
);
testList(
'multiple items',
'<ul><li><p>Foo</p>Bar</li><li><p>Foz</p>Baz</li></ul>',
'<p>Foo</p><ul><li>Bar</li></ul><p>Foz</p><ul><li>Baz</li></ul>'
);
testList(
'split by list items',
'<ul><li><p>Bar</p><li>Foo</li></li></ul>',
'<p>Bar</p><ul><li>Foo</li></ul>'
);
testList(
'nested split by list items',
'<ul><li><p>Bar</p><ol><li>Foo</li></ol></li></ul>',
'<p>Bar</p><ol><li>Foo</li></ol>'
);
testList(
'nested items #1',
'<ol><li><p>Foo</p>Bar<ul><li><h2>123</h2>456</li></ul></li></ol>',
'<p>Foo</p><ol><li>Bar</li></ol><p>123</p><ul><li>456</li></ul>'
);
testList(
'nested items #2',
'<ol><li><p>Foo</p>Bar<ul><li><h2>123</h2>456</li></ul></li><li><h2>abc</h2>def</li></ol>',
'<p>Foo</p><ol><li>Bar</li></ol><p>123</p><ul><li>456</li></ul><p>abc</p><ol><li>def</li></ol>'
);
} );
describe( 'complex', () => {
testList(
'single item with inline block inline',
'<ul><li>Foo<p>Bar</p>Baz</li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p><ul><li>Baz</li></ul>'
);
testList(
'single item with inline block block',
'<ul><li>Text<p>Foo</p><p>Bar</p></li></ul>',
'<ul><li>Text</li></ul><p>Foo</p><p>Bar</p>'
);
testList(
'single item with block block inline',
'<ul><li><p>Foo</p><p>Bar</p>Text</li></ul>',
'<p>Foo</p><p>Bar</p><ul><li>Text</li></ul>'
);
testList(
'single item with block block block',
'<ul><li><p>Foo</p><p>Bar</p><p>Baz</p></li></ul>',
'<p>Foo</p><p>Bar</p><p>Baz</p>'
);
testList(
'item inline + item block and inline',
'<ul><li>Foo</li><li><p>Bar</p>Baz</li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p><ul><li>Baz</li></ul>'
);
testList(
'item inline and block + item inline',
'<ul><li>Foo<p>Bar</p></li><li>Baz</li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p><ul><li>Baz</li></ul>'
);
testList(
'multiple items inline/block mix',
'<ul><li>Text<p>Foo</p></li><li>Bar<p>Baz</p>123</li></ul>',
'<ul><li>Text</li></ul><p>Foo</p><ul><li>Bar</li></ul><p>Baz</p><ul><li>123</li></ul>'
);
testList(
'nested items',
'<ul><li>Foo<p>Bar</p></li><li>Baz<p>123</p>456<ol><li>ABC<p>DEF</p></li><li>GHI</li></ol></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p><ul><li>Baz</li></ul><p>123</p><ul><li>456<ol><li>ABC</li></ol></li></ul>' +
'<p>DEF</p><ol><li>GHI</li></ol>'
);
testList(
'list with empty inline element',
'<ul><li><span></span>Foo<p>Bar</p></li></ul>',
'<ul><li>Foo</li></ul><p>Bar</p>'
);
} );
} );
} );
describe( 'position mapping', () => {
let mapper;
beforeEach( () => {
mapper = editor.editing.mapper;
editor.setData(
'<p>a</p>' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'<p>e</p>' +
'<ol>' +
'<li>f</li>' +
'</ol>' +
'<p>g</p>'
);
} );
/*
<paragraph>a</paragraph>
<listItem listIndent=0 listType="bulleted">b</listItem>
<listItem listIndent=0 listType="bulleted">c</listItem>
<listItem listIndent=0 listType="bulleted">d</listItem>
<paragraph>e</paragraph>
<listItem listIndent=0 listType="numbered">f</listItem>
<paragraph>g</paragraph>
*/
describe( 'view to model', () => {
function testList( testName, viewPath, modelPath ) {
it( testName, () => {
const viewPos = getViewPosition( viewRoot, viewPath, view );
const modelPos = mapper.toModelPosition( viewPos );
expect( modelPos.root ).to.equal( modelRoot );
expect( modelPos.path ).to.deep.equal( modelPath );
} );
}
testList( 'before ul', [ 1 ], [ 1 ] ); // --> before first `listItem`
testList( 'before first li', [ 1, 0 ], [ 1 ] ); // --> before first `listItem`
testList( 'beginning of li', [ 1, 0, 0 ], [ 1, 0 ] ); // --> beginning of first `listItem`
testList( 'end of li', [ 1, 0, 1 ], [ 1, 1 ] ); // --> end of first `listItem`
testList( 'before middle li', [ 1, 1 ], [ 2 ] ); // --> before middle `listItem`
testList( 'before last li', [ 1, 2 ], [ 3 ] ); // --> before last `listItem`
testList( 'after last li', [ 1, 3 ], [ 4 ] ); // --> after last `listItem` / before `paragraph`
testList( 'after ul', [ 2 ], [ 4 ] ); // --> after last `listItem` / before `paragraph`
testList( 'before ol', [ 3 ], [ 5 ] ); // --> before numbered `listItem`
testList( 'before only li', [ 3, 0 ], [ 5 ] ); // --> before numbered `listItem`
testList( 'after only li', [ 3, 1 ], [ 6 ] ); // --> after numbered `listItem`
testList( 'after ol', [ 4 ], [ 6 ] ); // --> after numbered `listItem`
} );
describe( 'model to view', () => {
function testList( testName, modelPath, viewPath ) {
it( testName, () => {
const modelPos = model.createPositionFromPath( modelRoot, modelPath );
const viewPos = mapper.toViewPosition( modelPos );
expect( viewPos.root ).to.equal( viewRoot );
expect( getViewPath( viewPos ) ).to.deep.equal( viewPath );
} );
}
testList( 'before first listItem', [ 1 ], [ 1 ] ); // --> before ul
testList( 'beginning of first listItem', [ 1, 0 ], [ 1, 0, 0, 0 ] ); // --> beginning of `b` text node
testList( 'end of first listItem', [ 1, 1 ], [ 1, 0, 0, 1 ] ); // --> end of `b` text node
testList( 'before middle listItem', [ 2 ], [ 1, 1 ] ); // --> before middle li
testList( 'before last listItem', [ 3 ], [ 1, 2 ] ); // --> before last li
testList( 'after last listItem', [ 4 ], [ 2 ] ); // --> after ul
testList( 'before numbered listItem', [ 5 ], [ 3 ] ); // --> before ol
testList( 'after numbered listItem', [ 6 ], [ 4 ] ); // --> after ol
} );
} );
describe( 'convert changes', () => {
describe( 'insert', () => {
testInsert(
'list item at the beginning of same list type',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<listItem listIndent="0" listType="bulleted">a</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>x</li>' +
'<li>a</li>' +
'</ul>'
);
testInsert(
'list item in the middle of same list type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>x</li>' +
'<li>b</li>' +
'</ul>'
);
testInsert(
'list item at the end of same list type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>x</li>' +
'</ul>'
);
testInsert(
'list item at the beginning of different list type',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="numbered">x</listItem>]' +
'<listItem listIndent="0" listType="bulleted">a</listItem>',
'<p>p</p>' +
'<ol>' +
'<li>x</li>' +
'</ol>' +
'<ul>' +
'<li>a</li>' +
'</ul>'
);
testInsert(
'list item in the middle of different list type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="numbered">x</listItem>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<ol>' +
'<li>x</li>' +
'</ol>' +
'<ul>' +
'<li>b</li>' +
'</ul>'
);
testInsert(
'list item at the end of different list type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="numbered">x</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<ol>' +
'<li>x</li>' +
'</ol>'
);
testInsert(
'element between list items',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="bulleted">a</listItem>',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>x</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>'
);
} );
describe( 'remove', () => {
testRemove(
'remove the first list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'</ul>'
);
testRemove(
'remove list item from the middle',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>c</li>' +
'</ul>'
);
testRemove(
'remove the last list item',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>b</li>' +
'</ul>'
);
testRemove(
'remove the only list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<paragraph>p</paragraph>',
'<p>p</p>' +
'<p>p</p>'
);
testRemove(
'remove element from between lists of same type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<paragraph>p</paragraph>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>b</li>' +
'</ul>' +
'<p>p</p>'
);
testRemove(
'remove element from between lists of different type',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="numbered">b</listItem>' +
'<paragraph>p</paragraph>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<ol>' +
'<li>b</li>' +
'</ol>' +
'<p>p</p>'
);
} );
describe( 'change type', () => {
testChangeType(
'change first list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<p>p</p>' +
'<ol>' +
'<li>a</li>' +
'</ol>' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'</ul>'
);
testChangeType(
'change middle list item',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<ol>' +
'<li>b</li>' +
'</ol>' +
'<ul>' +
'<li>c</li>' +
'</ul>'
);
testChangeType(
'change last list item',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>b</li>' +
'</ul>' +
'<ol>' +
'<li>c</li>' +
'</ol>'
);
testChangeType(
'change only list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<paragraph>p</paragraph>',
'<p>p</p>' +
'<ol>' +
'<li>a</li>' +
'</ol>' +
'<p>p</p>'
);
testChangeType(
'change element at the edge of two different lists #1',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="0" listType="numbered">d</listItem>',
'<ul>' +
'<li>a</li>' +
'<li>b</li>' +
'</ul>' +
'<ol>' +
'<li>c</li>' +
'<li>d</li>' +
'</ol>'
);
testChangeType(
'change element at the edge of two different lists #1',
'<listItem listIndent="0" listType="numbered">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
'<ol>' +
'<li>a</li>' +
'<li>b</li>' +
'</ol>' +
'<ul>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>'
);
testChangeType(
'change multiple elements #1',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<ol>' +
'<li>b</li>' +
'<li>c</li>' +
'</ol>' +
'<ul>' +
'<li>d</li>' +
'</ul>'
);
testChangeType(
'change multiple elements #2',
'<listItem listIndent="0" listType="numbered">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="0" listType="numbered">d</listItem>',
'<ol>' +
'<li>a</li>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ol>'
);
} );
describe( 'rename from list item', () => {
testRenameFromListItem(
'rename first list item',
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>',
'<p>a</p>' +
'<ul>' +
'<li>b</li>' +
'</ul>'
);
testRenameFromListItem(
'rename middle list item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>b</p>' +
'<ul>' +
'<li>c</li>' +
'</ul>'
);
testRenameFromListItem(
'rename last list item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>b</p>'
);
testRenameFromListItem(
'rename only list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<paragraph>p</paragraph>',
'<p>p</p>' +
'<p>x</p>' +
'<p>p</p>'
);
} );
describe( 'rename to list item (with attribute change)', () => {
testRenameToListItem(
'only paragraph', 0,
'[<paragraph>a</paragraph>]',
'<ul>' +
'<li>a</li>' +
'</ul>'
);
testRenameToListItem(
'paragraph between paragraphs', 0,
'<paragraph>x</paragraph>' +
'[<paragraph>a</paragraph>]' +
'<paragraph>x</paragraph>',
'<p>x</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>x</p>'
);
testRenameToListItem(
'element before list of same type', 0,
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="bulleted">a</listItem>',
'<ul>' +
'<li>x</li>' +
'<li>a</li>' +
'</ul>'
);
testRenameToListItem(
'element after list of same type', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>x</paragraph>]',
'<ul>' +
'<li>a</li>' +
'<li>x</li>' +
'</ul>'
);
testRenameToListItem(
'element before list of different type', 0,
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="numbered">a</listItem>',
'<ul>' +
'<li>x</li>' +
'</ul>' +
'<ol>' +
'<li>a</li>' +
'</ol>'
);
testRenameToListItem(
'element after list of different type', 0,
'<listItem listIndent="0" listType="numbered">a</listItem>' +
'[<paragraph>x</paragraph>]',
'<ol>' +
'<li>a</li>' +
'</ol>' +
'<ul>' +
'<li>x</li>' +
'</ul>'
);
testRenameToListItem(
'element between lists of same type', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="0" listType="bulleted">b</listItem>',
'<ul>' +
'<li>a</li>' +
'<li>x</li>' +
'<li>b</li>' +
'</ul>'
);
} );
describe( 'move', () => {
testMove(
'list item inside same list',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
4, // Move after last item.
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'<li>c</li>' +
'<li>b</li>' +
'</ul>'
);
testMove(
'out list item from list',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<paragraph>p</paragraph>',
4, // Move after second paragraph.
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>p</p>' +
'<ul>' +
'<li>b</li>' +
'</ul>'
);
testMove(
'the only list item',
'<paragraph>p</paragraph>' +
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<paragraph>p</paragraph>',
3, // Move after second paragraph.
'<p>p</p>' +
'<p>p</p>' +
'<ul>' +
'<li>a</li>' +
'</ul>'
);
testMove(
'list item between two lists of same type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
4, // Move between list item "c" and list item "d'.
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>p</p>' +
'<ul>' +
'<li>c</li>' +
'<li>b</li>' +
'<li>d</li>' +
'</ul>'
);
testMove(
'list item between two lists of different type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="numbered">c</listItem>' +
'<listItem listIndent="0" listType="numbered">d</listItem>',
4, // Move between list item "c" and list item "d'.
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>p</p>' +
'<ol>' +
'<li>c</li>' +
'</ol>' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'<ol>' +
'<li>d</li>' +
'</ol>'
);
testMove(
'element between list items',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'[<paragraph>p</paragraph>]',
1, // Move between list item "a" and list item "b'.
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>p</p>' +
'<ul>' +
'<li>b</li>' +
'</ul>'
);
} );
} );
} );
describe( 'nested lists', () => {
describe( 'setting data', () => {
function testList( string, expectedString = null ) {
return () => {
editor.setData( string );
assertEqualMarkup( editor.getData(), expectedString || string );
};
}
describe( 'non HTML compliant list fixing', () => {
it( 'ul in ul', testList(
'<ul>' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</ul>',
'<ul>' +
'<li>1.1</li>' +
'</ul>'
) );
it( 'ul in ol', testList(
'<ol>' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</ol>',
'<ul>' +
'<li>1.1</li>' +
'</ul>'
) );
it( 'ul in ul (previous sibling is li)', testList(
'<ul>' +
'<li>1</li>' +
'<ul>' +
'<li>2.1</li>' +
'</ul>' +
'</ul>',
'<ul>' +
'<li>1' +
'<ul>' +
'<li>2.1</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'ul in deeply nested ul - base index > 0 #1', testList(
'<ul>' +
'<li>1.1</li>' +
'<li>1.2' +
'<ul>' +
'<ul>' +
'<ul>' +
'<ul>' +
'<li>2.1</li>' +
'</ul>' +
'</ul>' +
'</ul>' +
'</ul>' +
'</li>' +
'</ul>',
'<ul>' +
'<li>1.1</li>' +
'<li>1.2' +
'<ul>' +
'<li>2.1</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'ul in deeply nested ul - base index > 0 #2', testList(
'<ul>' +
'<li>1.1</li>' +
'<li>1.2' +
'<ul>' +
'<li>2.1</li>' +
'<ul>' +
'<ul>' +
'<ul>' +
'<li>3.1</li>' +
'</ul>' +
'</ul>' +
'</ul>' +
'<li>2.2</li>' +
'</ul>' +
'</li>' +
'</ul>',
'<ul>' +
'<li>1.1</li>' +
'<li>1.2' +
'<ul>' +
'<li>2.1' +
'<ul>' +
'<li>3.1</li>' +
'</ul>' +
'</li>' +
'<li>2.2</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'ul in deeply nested ul inside li', testList(
'<ul>' +
'<li>A' +
'<ul>' +
'<ul>' +
'<ul>' +
'<ul>' +
'<li>B</li>' +
'</ul>' +
'</ul>' +
'</ul>' +
'<li>C</li>' +
'</ul>' +
'</li>' +
'</ul>',
'<ul>' +
'<li>A' +
'<ul>' +
'<li>B</li>' +
'<li>C</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'ul in deeply nested ul/ol', testList(
'<ul>' +
'<li>A' +
'<ol>' +
'<ul>' +
'<ol>' +
'<ul>' +
'<li>B</li>' +
'</ul>' +
'</ol>' +
'</ul>' +
'<li>C</li>' +
'</ol>' +
'</li>' +
'</ul>',
'<ul>' +
'<li>A' +
'<ul>' +
'<li>B</li>' +
'<li>C</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'ul in ul (complex case)', testList(
'<ol>' +
'<li>1</li>' +
'<ul>' +
'<li>A</li>' +
'<ol>' +
'<li>1</li>' +
'</ol>' +
'</ul>' +
'<li>2</li>' +
'<li>3</li>' +
'<ul>' +
'<li>A</li>' +
'<li>B</li>' +
'</ul>' +
'</ol>' +
'<ul>' +
'<li>A</li>' +
'<ol>' +
'<li>1</li>' +
'<li>2</li>' +
'</ol>' +
'</ul>',
'<ol>' +
'<li>1' +
'<ul>' +
'<li>A' +
'<ol>' +
'<li>1</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'<li>3' +
'<ul>' +
'<li>A</li>' +
'<li>B</li>' +
'</ul>' +
'</li>' +
'</ol>' +
'<ul>' +
'<li>A' +
'<ol>' +
'<li>1</li>' +
'<li>2</li>' +
'</ol>' +
'</li>' +
'</ul>'
) );
it( 'ol in ol (deep structure)', testList(
'<ol>' +
'<li>A1</li>' +
'<ol>' +
'<ol>' +
'<ol>' +
'<ol>' +
'<ol>' +
'<ol>' +
'<ol>' +
'<li>B8</li>' +
'</ol>' +
'</ol>' +
'</ol>' +
'</ol>' +
'</ol>' +
'<li>C3</li>' +
'<ol>' +
'<li>D4</li>' +
'</ol>' +
'</ol>' +
'<li>E2</li>' +
'</ol>' +
'</ol>',
'<ol>' +
'<li>A1' +
'<ol>' +
'<li>B8</li>' +
'<li>C3' +
'<ol>' +
'<li>D4</li>' +
'</ol>' +
'</li>' +
'<li>E2</li>' +
'</ol>' +
'</li>' +
'</ol>'
) );
it( 'block elements wrapping nested ul', testList(
'text before' +
'<ul>' +
'<li>' +
'text' +
'<div>' +
'<ul>' +
'<li>inner text</li>' +
'</ul>' +
'</div>' +
'</li>' +
'</ul>',
'<p>text before</p>' +
'<ul>' +
'<li>' +
'text' +
'<ul>' +
'<li>inner text</li>' +
'</ul>' +
'</li>' +
'</ul>'
) );
it( 'block elements wrapping nested ul - invalid blocks', testList(
'<ul>' +
'<li>' +
'a' +
'<table>' +
'<tr>' +
'<td>' +
'<div>' +
'<ul>' +
'<li>b</li>' +
'<li>c' +
'<ul>' +
'<li>' +
'd' +
'<table>' +
'<tr>' +
'<td>' +
'e' +
'</td>' +
'</tr>' +
'</table>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</div>' +
'</td>' +
'</tr>' +
'</table>' +
'f' +
'</li>' +
'<li>g</li>' +
'</ul>',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<figure class="table">' +
'<table>' +
'<tbody>' +
'<tr>' +
'<td>' +
'<ul>' +
'<li>b</li>' +
'<li>c<ul>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>e</p>' +
'</td>' +
'</tr>' +
'</tbody>' +
'</table>' +
'</figure>' +
'<ul>' +
'<li>f</li>' +
'<li>g</li>' +
'</ul>'
) );
it( 'deeply nested block elements wrapping nested ul', testList(
'<ul>' +
'<li>' +
'a' +
'<div>' +
'<div>' +
'<ul>' +
'<li>b</li>' +
'<li>c' +
'<ul>' +
'<li>d' +
'<div>' +
'<ul>' +
'<li>e</li>' +
'</ul>' +
'</div>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</div>' +
'</div>' +
'f' +
'</li>' +
'<li>g</li>' +
'</ul>' +
'</ul>',
'<ul>' +
'<li>a' +
'<ul>' +
'<li>b</li>' +
'<li>c' +
'<ul>' +
'<li>d' +
'<ul>' +
'<li>e</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>f</li>' +
'<li>g</li>' +
'</ul>'
) );
} );
it( 'bullet list simple structure', testList(
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>bar</p>'
) );
it( 'bullet list deep structure', testList(
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>' +
'1.1' +
'<ul><li>1.1.1</li><li>1.1.2</li><li>1.1.3</li><li>1.1.4</li></ul>' +
'</li>' +
'<li>' +
'1.2' +
'<ul><li>1.2.1</li></ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'<li>' +
'3' +
'<ul>' +
'<li>' +
'3.1' +
'<ul>' +
'<li>' +
'3.1.1' +
'<ul><li>3.1.1.1</li></ul>' +
'</li>' +
'<li>3.1.2</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>bar</p>'
) );
it( 'mixed lists deep structure', testList(
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>' +
'1.1' +
'<ul><li>1.1.1</li><li>1.1.2</li></ul>' +
'<ol><li>1.1.3</li><li>1.1.4</li></ol>' +
'</li>' +
'<li>' +
'1.2' +
'<ul><li>1.2.1</li></ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'<li>' +
'3' +
'<ol>' +
'<li>' +
'3.1' +
'<ul>' +
'<li>' +
'3.1.1' +
'<ol><li>3.1.1.1</li></ol>' +
'<ul><li>3.1.1.2</li></ul>' +
'</li>' +
'<li>3.1.2</li>' +
'</ul>' +
'</li>' +
'</ol>' +
'<ul>' +
'<li>3.2</li>' +
'<li>3.3</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>bar</p>',
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>' +
'1.1' +
'<ul><li>1.1.1</li><li>1.1.2</li><li>1.1.3</li><li>1.1.4</li></ul>' +
'</li>' +
'<li>' +
'1.2' +
'<ul><li>1.2.1</li></ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'<li>' +
'3' +
'<ol>' +
'<li>' +
'3.1' +
'<ul>' +
'<li>' +
'3.1.1' +
'<ol><li>3.1.1.1</li><li>3.1.1.2</li></ol>' +
'</li>' +
'<li>3.1.2</li>' +
'</ul>' +
'</li>' +
'<li>3.2</li>' +
'<li>3.3</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'<p>bar</p>'
) );
it( 'mixed lists deep structure, white spaces, incorrect content, empty items', testList(
'<p>foo</p>' +
'<ul>' +
' xxx' +
' <li>' +
' 1' +
' <ul>' +
' xxx' +
' <li>' +
' <ul><li></li><li>1.1.2</li></ul>' +
' <ol><li>1.1.3</li><li>1.1.4</li></ol>' + // Will be changed to <ul>.
' </li>' +
' <li>' +
' <ul><li>1.2.1</li></ul>' +
' </li>' +
' xxx' +
' </ul>' +
' </li>' +
' <li>2</li>' +
' <li>' +
' <ol>' +
' <p>xxx</p>' +
' <li>' +
' 3<strong>.</strong>1' + // Test multiple text nodes in <li>.
' <ul>' +
' <li>' +
' 3.1.1' +
' <ol><li>3.1.1.1</li></ol>' +
' <ul><li>3.1.1.2</li></ul>' + // Will be changed to <ol>.
' </li>' +
' <li>3.1.2</li>' +
' </ul>' +
' </li>' +
' </ol>' +
' <p>xxx</p>' +
' <ul>' + // Since <p> gets removed, this will become <ol>.
' <li>3.2</li>' +
' <li>3.3</li>' +
' </ul>' +
' </li>' +
' <p>xxx</p>' +
'</ul>' +
'<p>bar</p>',
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>' +
' ' +
'<ul>' +
'<li> </li>' +
'<li>1.1.2</li>' +
'<li>1.1.3</li>' +
'<li>1.1.4</li>' +
'</ul>' +
'</li>' +
'<li>' +
' ' +
'<ul><li>1.2.1</li></ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'<li>' +
' ' +
'<ol>' +
'<li>' +
'3<strong>.</strong>1' +
'<ul>' +
'<li>' +
'3.1.1' +
'<ol>' +
'<li>3.1.1.1</li>' +
'<li>3.1.1.2</li>' +
'</ol>' +
'</li>' +
'<li>3.1.2</li>' +
'</ul>' +
'</li>' +
'<li>3.2</li>' +
'<li>3.3</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'<p>bar</p>'
) );
describe( 'model tests for nested lists', () => {
it( 'should properly set listIndent and listType', () => {
// <ol> in the middle will be fixed by postfixer to bulleted list.
editor.setData(
'<p>foo</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'<ol>' +
'<li>' +
'1.2' +
'<ol>' +
'<li>1.2.1</li>' +
'</ol>' +
'</li>' +
'<li>1.3</li>' +
'</ol>' +
'</li>' +
'<li>2</li>' +
'</ul>' +
'<p>bar</p>'
);
const expectedModelData =
'<paragraph>foo</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.2</listItem>' +
'<listItem listIndent="2" listType="numbered">1.2.1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.3</listItem>' +
'<listItem listIndent="0" listType="bulleted">2</listItem>' +
'<paragraph>bar</paragraph>';
assertEqualMarkup( getModelData( model, { withoutSelection: true } ), expectedModelData );
} );
it( 'should properly listIndent when list nested in other block', () => {
editor.setData(
'<ul>' +
'<li>' +
'a' +
'<table>' +
'<tr>' +
'<td>' +
'<div>' +
'<ul>' +
'<li>b</li>' +
'<li>c' +
'<ul>' +
'<li>' +
'd' +
'<table>' +
'<tr>' +
'<td>e</td>' +
'</tr>' +
'</table>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</div>' +
'</td>' +
'</tr>' +
'</table>' +
'f' +
'</li>' +
'<li>g</li>' +
'</ul>'
);
const expectedModelData =
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<table>' +
'<tableRow>' +
'<tableCell>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'<paragraph>e</paragraph>' +
'</tableCell>' +
'</tableRow>' +
'</table>' +
'<listItem listIndent="0" listType="bulleted">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>';
assertEqualMarkup( getModelData( model, { withoutSelection: true } ), expectedModelData );
} );
} );
} );
describe( 'position mapping', () => {
let mapper;
beforeEach( () => {
mapper = editor.editing.mapper;
editor.setData(
'<ul>' +
'<li>a</li>' +
'<li>' +
'bbb' +
'<ol>' +
'<li>c</li>' +
'<li>d</li>' +
'<li>e</li>' +
'<li>' +
'<ul>' +
'<li>g</li>' +
'<li>h</li>' +
'<li>i</li>' +
'</ul>' +
'</li>' +
'<li>j</li>' +
'</ol>' +
'</li>' +
'<li>k</li>' +
'</ul>'
);
} );
/*
<listItem listIndent=0 listType="bulleted">a</listItem>
<listItem listIndent=0 listType="bulleted">bbb</listItem>
<listItem listIndent=1 listType="numbered">c</listItem>
<listItem listIndent=1 listType="numbered">d</listItem>
<listItem listIndent=1 listType="numbered">e</listItem>
<listItem listIndent=1 listType="numbered"></listItem>
<listItem listIndent=2 listType="bulleted">g</listItem>
<listItem listIndent=2 listType="bulleted">h</listItem>
<listItem listIndent=2 listType="bullered">i</listItem>
<listItem listIndent=1 listType="numbered">j</listItem>
<listItem listIndent=0 listType="bulleted">k</listItem>
*/
describe( 'view to model', () => {
function testList( testName, viewPath, modelPath ) {
it( testName, () => {
const viewPos = getViewPosition( viewRoot, viewPath, view );
const modelPos = mapper.toModelPosition( viewPos );
expect( modelPos.root ).to.equal( modelRoot );
expect( modelPos.path ).to.deep.equal( modelPath );
} );
}
testList( 'before ul#1', [ 0 ], [ 0 ] ); // --> before listItem "a"
testList( 'before li "a"', [ 0, 0 ], [ 0 ] ); // --> before listItem "a"
testList( 'before "a"', [ 0, 0, 0 ], [ 0, 0 ] ); // --> beginning of listItem "a"
testList( 'after "a"', [ 0, 0, 1 ], [ 0, 1 ] ); // --> end of listItem "a"
testList( 'before li "bbb"', [ 0, 1 ], [ 1 ] ); // --> before listItem "bbb"
testList( 'before "bbb"', [ 0, 1, 0 ], [ 1, 0 ] ); // --> beginning of listItem "bbb"
testList( 'after "bbb"', [ 0, 1, 1 ], [ 1, 3 ] ); // --> end of listItem "bbb"
testList( 'before li "c"', [ 0, 1, 1, 0 ], [ 2 ] ); // --> before listItem "c"
testList( 'before "c"', [ 0, 1, 1, 0, 0 ], [ 2, 0 ] ); // --> beginning of listItem "c"
testList( 'after "c"', [ 0, 1, 1, 0, 1 ], [ 2, 1 ] ); // --> end of listItem "c"
testList( 'before li "d"', [ 0, 1, 1, 1 ], [ 3 ] ); // --> before listItem "d"
testList( 'before li "e"', [ 0, 1, 1, 2 ], [ 4 ] ); // --> before listItem "e"
testList( 'before "empty" li', [ 0, 1, 1, 3 ], [ 5 ] ); // --> before "empty" listItem
testList( 'before ul#2', [ 0, 1, 1, 3, 0 ], [ 5, 0 ] ); // --> inside "empty" listItem
testList( 'before li "g"', [ 0, 1, 1, 3, 0, 0 ], [ 6 ] ); // --> before listItem "g"
testList( 'before li "h"', [ 0, 1, 1, 3, 0, 1 ], [ 7 ] ); // --> before listItem "h"
testList( 'before li "i"', [ 0, 1, 1, 3, 0, 2 ], [ 8 ] ); // --> before listItem "i"
testList( 'after li "i"', [ 0, 1, 1, 3, 0, 3 ], [ 9 ] ); // --> before listItem "j"
testList( 'after ul#2', [ 0, 1, 1, 3, 1 ], [ 9 ] ); // --> before listItem "j"
testList( 'before li "j"', [ 0, 1, 1, 4 ], [ 9 ] ); // --> before listItem "j"
testList( 'after li "j"', [ 0, 1, 1, 5 ], [ 10 ] ); // --> before listItem "k"
testList( 'end of li "bbb"', [ 0, 1, 2 ], [ 10 ] ); // --> before listItem "k"
testList( 'before li "k"', [ 0, 2 ], [ 10 ] ); // --> before listItem "k"
testList( 'after li "k"', [ 0, 3 ], [ 11 ] ); // --> after listItem "k"
testList( 'after ul', [ 1 ], [ 11 ] ); // --> after listItem "k"
} );
describe( 'model to view', () => {
function testList( testName, modelPath, viewPath ) {
it( testName, () => {
const modelPos = model.createPositionFromPath( modelRoot, modelPath );
const viewPos = mapper.toViewPosition( modelPos );
expect( viewPos.root ).to.equal( viewRoot );
expect( getViewPath( viewPos ) ).to.deep.equal( viewPath );
} );
}
testList( 'before listItem "a"', [ 0 ], [ 0 ] ); // --> before ul
testList( 'beginning of listItem "a"', [ 0, 0 ], [ 0, 0, 0, 0 ] ); // --> beginning of "a" text node
testList( 'end of listItem "a"', [ 0, 1 ], [ 0, 0, 0, 1 ] ); // --> end of "a" text node
testList( 'before listItem "bbb"', [ 1 ], [ 0, 1 ] ); // --> before li "bbb"
testList( 'beginning of listItem "bbb"', [ 1, 0 ], [ 0, 1, 0, 0 ] ); // --> beginning of "bbb" text node
testList( 'end of listItem "bbb"', [ 1, 3 ], [ 0, 1, 0, 3 ] ); // --> end of "bbb" text node
testList( 'before listItem "c"', [ 2 ], [ 0, 1, 1, 0 ] ); // --> before li "c"
testList( 'beginning of listItem "c"', [ 2, 0 ], [ 0, 1, 1, 0, 0, 0 ] ); // --> beginning of "c" text node
testList( 'end of listItem "c"', [ 2, 1 ], [ 0, 1, 1, 0, 0, 1 ] ); // --> end of "c" text node
testList( 'before listItem "d"', [ 3 ], [ 0, 1, 1, 1 ] ); // --> before li "d"
testList( 'before listItem "e"', [ 4 ], [ 0, 1, 1, 2 ] ); // --> before li "e"
testList( 'before "empty" listItem', [ 5 ], [ 0, 1, 1, 3 ] ); // --> before "empty" li
testList( 'inside "empty" listItem', [ 5, 0 ], [ 0, 1, 1, 3, 0 ] ); // --> before ul
testList( 'before listItem "g"', [ 6 ], [ 0, 1, 1, 3, 0, 0 ] ); // --> before li "g"
testList( 'before listItem "h"', [ 7 ], [ 0, 1, 1, 3, 0, 1 ] ); // --> before li "h"
testList( 'before listItem "i"', [ 8 ], [ 0, 1, 1, 3, 0, 2 ] ); // --> before li "i"
testList( 'before listItem "j"', [ 9 ], [ 0, 1, 1, 4 ] ); // --> before li "j"
testList( 'before listItem "k"', [ 10 ], [ 0, 2 ] ); // --> before li "k"
testList( 'after listItem "k"', [ 11 ], [ 1 ] ); // --> after ul
} );
} );
describe( 'convert changes', () => {
describe( 'insert', () => {
describe( 'same list type', () => {
testInsert(
'after smaller indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="1" listType="bulleted">x</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'after smaller indent, before same indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="1" listType="bulleted">x</listItem>]' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>x</li>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'after smaller indent, before smaller indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="1" listType="bulleted">x</listItem>]' +
'<listItem listIndent="0" listType="bulleted">2</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'<li>2</li>' +
'</ul>'
);
testInsert(
'after same indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'[<listItem listIndent="1" listType="bulleted">x</listItem>]',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'after same indent, before bigger indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>1</li>' +
'<li>' +
'x' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'after bigger indent, before bigger indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'[<listItem listIndent="0" listType="bulleted">x</listItem>]' +
'<listItem listIndent="1" listType="bulleted">1.2</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'<li>' +
'x' +
'<ul>' +
'<li>1.2</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'list items with too big indent',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="4" listType="bulleted">x</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="5" listType="bulleted">x</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="4" listType="bulleted">x</listItem>]' + // This indent should be fixed by post fixer.
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>' +
'x' +
'<ul>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
} );
describe( 'different list type', () => {
testInsert(
'after smaller indent, before same indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="1" listType="numbered">x</listItem>]' + // This type should be fixed by post fixer.
'<listItem listIndent="1" listType="bulleted">1.1</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ol>' +
'<li>x</li>' +
'<li>1.1</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
testInsert(
'after same indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'[<listItem listIndent="1" listType="numbered">x</listItem>]', // This type should be fixed by post fixer.
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testInsert(
'after same indent, before bigger indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'[<listItem listIndent="0" listType="numbered">x</listItem>]' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>1</li>' +
'</ul>' +
'<ol>' +
'<li>' +
'x' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ol>'
);
testInsert(
'after bigger indent, before bigger indent',
'<paragraph>p</paragraph>' +
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'[<listItem listIndent="0" listType="numbered">x</listItem>]' +
'<listItem listIndent="1" listType="bulleted">1.2</listItem>',
'<p>p</p>' +
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<ol>' +
'<li>' +
'x' +
'<ul>' +
'<li>1.2</li>' +
'</ul>' +
'</li>' +
'</ol>'
);
testInsert(
'after bigger indent, in nested list, different type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'[<listItem listIndent="1" listType="numbered">x</listItem>]', // This type should be fixed by post fixer.
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'<li>x</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
} );
// This case is pretty complex but it tests various edge cases concerning splitting lists.
testInsert(
'element between nested list items - complex',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="numbered">d</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="3" listType="numbered">e</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="2" listType="bulleted">f</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="3" listType="bulleted">g</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="1" listType="bulleted">h</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="2" listType="numbered">i</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="0" listType="numbered">j</listItem>' + // This indent should be fixed by post fixer.
'<paragraph>p</paragraph>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>' +
'c' +
'<ol>' +
'<li>d</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ol>' +
'<li>e</li>' +
'</ol>' +
'<ul>' +
'<li>' +
'f' +
'<ul>' +
'<li>g</li>' +
'</ul>' +
'</li>' +
'<li>' +
'h' +
'<ol>' +
'<li>i</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'<ol>' +
'<li>j</li>' +
'</ol>' +
'<p>p</p>',
false
);
testInsert(
'element before indent "hole"',
'<listItem listIndent="0" listType="bulleted">1</listItem>' +
'<listItem listIndent="1" listType="bulleted">1.1</listItem>' +
'[<paragraph>x</paragraph>]' +
'<listItem listIndent="2" listType="bulleted">1.1.1</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="0" listType="bulleted">2</listItem>',
'<ul>' +
'<li>' +
'1' +
'<ul>' +
'<li>1.1</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ul>' +
'<li>1.1.1</li>' +
'<li>2</li>' +
'</ul>',
false
);
_test(
'two list items with mismatched types inserted in one batch',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>[]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>',
() => {
const item1 = '<listItem listIndent="1" listType="numbered">c</listItem>';
const item2 = '<listItem listIndent="1" listType="bulleted">d</listItem>';
model.change( writer => {
writer.append( parseModel( item1, model.schema ), modelRoot );
writer.append( parseModel( item2, model.schema ), modelRoot );
} );
}
);
} );
describe( 'remove', () => {
testRemove(
'the first nested item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'nested item from the middle',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'the last nested item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'the only nested item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]',
'<ul>' +
'<li>a</li>' +
'</ul>'
);
testRemove(
'list item that separates two nested lists of same type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="numbered">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="numbered">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ol>' +
'<li>b</li>' +
'<li>d</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
testRemove(
'list item that separates two nested lists of different type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="numbered">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>', // This type should be fixed by post fixer.
'<ul>' +
'<li>' +
'a' +
'<ol>' +
'<li>b</li>' +
'<li>d</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
testRemove(
'item that has nested lists, previous item has same indent',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'item that has nested lists, previous item has smaller indent',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="2" listType="bulleted">d</listItem>', // This indent should be fixed by post fixer.
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'item that has nested lists, previous item has bigger indent by 1',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'<listItem listIndent="2" listType="numbered">e</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>' +
'd' +
'<ol>' +
'<li>e</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'item that has nested lists, previous item has bigger indent by 2',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'[<listItem listIndent="0" listType="bulleted">d</listItem>]' +
'<listItem listIndent="1" listType="bulleted">e</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'<li>e</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRemove(
'first list item that has nested list',
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="2" listType="bulleted">c</listItem>', // This indent should be fixed by post fixer.
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
} );
describe( 'change type', () => {
testChangeType(
'list item that has nested items',
'[<listItem listIndent="0" listType="numbered">a</listItem>]' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
// The change will be "prevented" by post fixer.
testChangeType(
'list item that is a nested item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="numbered">b</listItem>' +
'[<listItem listIndent="1" listType="numbered">c</listItem>]' +
'<listItem listIndent="1" listType="numbered">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ol>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
} );
describe( 'change indent', () => {
describe( 'same list type', () => {
testChangeIndent(
'indent last item of flat list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'indent middle item of flat list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'<li>c</li>' +
'</ul>'
);
testChangeIndent(
'indent last item in nested list', 2,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'indent middle item in nested list', 2,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
// Keep in mind that this test is different than "executing command on item that has nested list".
// A command is automatically indenting nested items so the hierarchy is preserved.
// Here we test conversion and the change is simple changing indent of one item.
// This may be true also for other tests in this suite, keep this in mind.
testChangeIndent(
'indent item that has nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="bulleted">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'indent item that in view is a next sibling of item that has nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent the first item of nested list', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>a</li>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent item from the middle of nested list', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'<li>' +
'c' +
'<ul>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent the last item of nested list', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'<li>c</li>' +
'</ul>'
);
testChangeIndent(
'outdent the only item of nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent item by two', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>'
);
} );
describe( 'different list type', () => {
testChangeIndent(
'indent middle item of flat list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="numbered">b</listItem>]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ol>' +
'<li>b</li>' +
'</ol>' +
'</li>' +
'<li>c</li>' +
'</ul>'
);
testChangeIndent(
'indent item that has nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="0" listType="numbered">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ol>' +
'<li>b</li>' +
'<li>c</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'indent item that in view is a next sibling of item that has nested list #1', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="0" listType="numbered">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent the first item of nested list', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>a</li>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent the only item of nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testChangeIndent(
'outdent item by two', 0,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="numbered">c</listItem>]' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<ol>' +
'<li>c</li>' +
'</ol>' +
'<ul>' +
'<li>d</li>' +
'</ul>'
);
} );
} );
describe( 'rename from list item', () => {
testRenameFromListItem(
'rename nested item from the middle #1',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>', // This indent should be fixed by post fixer.
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>c</p>' +
'<ul>' +
'<li>d</li>' +
'</ul>',
false
);
testRenameFromListItem(
'rename nested item from the middle #2 - nightmare example',
// Indents in this example should be fixed by post fixer.
// This nightmare example checks if structure of the list is kept as intact as possible.
'<listItem listIndent="0" listType="bulleted">a</listItem>' + // a -------- --> a --------
'<listItem listIndent="1" listType="bulleted">b</listItem>' + // b -------- --> b --------
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' + // c -------- --> --------
'<listItem listIndent="3" listType="bulleted">d</listItem>' + // d -------- --> d --------
'<listItem listIndent="3" listType="bulleted">e</listItem>' + // e -------- --> e --------
'<listItem listIndent="4" listType="bulleted">f</listItem>' + // f -------- --> f --------
'<listItem listIndent="2" listType="bulleted">g</listItem>' + // g -------- --> g --------
'<listItem listIndent="3" listType="bulleted">h</listItem>' + // h -------- --> h --------
'<listItem listIndent="4" listType="bulleted">i</listItem>' + // i -------- --> i --------
'<listItem listIndent="1" listType="bulleted">j</listItem>' + // j -------- --> j --------
'<listItem listIndent="2" listType="bulleted">k</listItem>' + // k -------- --> k --------
'<listItem listIndent="0" listType="bulleted">l</listItem>' + // l -------- --> l --------
'<listItem listIndent="1" listType="bulleted">m</listItem>', // m -------- --> m --------
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>c</p>' +
'<ul>' +
'<li>d</li>' +
'<li>' +
'e' +
'<ul>' +
'<li>f</li>' +
'</ul>' +
'</li>' +
'<li>' +
'g' +
'<ul>' +
'<li>' +
'h' +
'<ul>' +
'<li>i</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>' +
'j' +
'<ul>' +
'<li>k</li>' +
'</ul>' +
'</li>' +
'<li>' +
'l' +
'<ul>' +
'<li>m</li>' +
'</ul>' +
'</li>' +
'</ul>',
false
);
testRenameFromListItem(
'rename nested item from the middle #3 - manual test example',
// Indents in this example should be fixed by post fixer.
// This example checks a bug found by testing manual test.
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'<listItem listIndent="2" listType="bulleted">e</listItem>' +
'<listItem listIndent="2" listType="bulleted">f</listItem>' +
'<listItem listIndent="2" listType="bulleted">g</listItem>' +
'<listItem listIndent="2" listType="bulleted">h</listItem>' +
'<listItem listIndent="0" listType="bulleted"></listItem>' +
'<listItem listIndent="1" listType="bulleted"></listItem>' +
'<listItem listIndent="2" listType="numbered">k</listItem>' +
'<listItem listIndent="2" listType="numbered">l</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>c</p>' +
'<ul>' +
'<li>' +
'd' +
'<ul>' +
'<li>e</li>' +
'<li>f</li>' +
'<li>g</li>' +
'<li>h</li>' +
'</ul>' +
'</li>' +
'<li>' +
'<ul>' +
'<li>' +
'<ol>' +
'<li>k</li>' +
'<li>l</li>' +
'</ol>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>',
false
);
testRenameFromListItem(
'rename the only nested item',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]',
'<ul>' +
'<li>a</li>' +
'</ul>' +
'<p>b</p>'
);
} );
describe( 'rename to list item (with attribute change)', () => {
testRenameToListItem(
'element into first item in nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<paragraph>b</paragraph>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRenameToListItem(
'element into last item in nested list', 1,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<paragraph>c</paragraph>]',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testRenameToListItem(
'element into a first item in deeply nested list', 2,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<paragraph>c</paragraph>]' +
'<listItem listIndent="0" listType="bulleted">d</listItem>',
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>d</li>' +
'</ul>'
);
} );
describe( 'move', () => {
// Since move is in fact remove + insert and does not event have its own converter, only a few cases will be tested here.
testMove(
'out nested list items',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="3" listType="bulleted">d</listItem>' + // This indent should be fixed by post fixer.
'<listItem listIndent="4" listType="bulleted">e</listItem>' + // This indent should be fixed by post fixer.
'<paragraph>x</paragraph>',
6,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'd' +
'<ul>' +
'<li>e</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
testMove(
'nested list items between lists of same type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>]' +
'<listItem listIndent="4" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>',
7,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>e</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ul>' +
'<li>' +
'f' +
'<ul>' +
'<li>' +
'c' +
'<ul>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'<li>g</li>' +
'</ul>'
);
testMove(
'nested list items between lists of different type',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>]' +
'<listItem listIndent="4" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="numbered">f</listItem>' +
'<listItem listIndent="1" listType="numbered">g</listItem>',
7,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>' +
'b' +
'<ul>' +
'<li>e</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ol>' +
'<li>' +
'f' +
'<ul>' +
'<li>' +
'c' +
'<ul>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'<li>g</li>' +
'</ul>' +
'</li>' +
'</ol>',
false
);
testMove(
'element between nested list',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>' +
'[<paragraph>x</paragraph>]',
2,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'<p>x</p>' +
'<ul>' +
'<li>' +
'c' +
'<ul>' +
'<li>d</li>' +
'</ul>' +
'</li>' +
'</ul>',
false
);
testMove(
'multiple nested list items of different types #1 - fix at start',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>]' +
'<listItem listIndent="1" listType="numbered">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="numbered">h</listItem>' +
'<listItem listIndent="1" listType="numbered">i</listItem>',
8,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>f</li>' +
'</ul>' +
'</li>' +
'<li>' +
'g' +
'<ol>' +
'<li>h</li>' +
'<li>c</li>' +
'</ol>' +
'</li>' +
'<li>' +
'd' +
'<ol>' +
'<li>e</li>' +
'<li>i</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
testMove(
'multiple nested list items of different types #2 - fix at end',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>]' +
'<listItem listIndent="1" listType="numbered">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="bulleted">h</listItem>' +
'<listItem listIndent="1" listType="bulleted">i</listItem>',
8,
'<ul>' +
'<li>' +
'a' +
'<ul>' +
'<li>b</li>' +
'<li>f</li>' +
'</ul>' +
'</li>' +
'<li>' +
'g' +
'<ul>' +
'<li>h</li>' +
'<li>c</li>' +
'</ul>' +
'</li>' +
'<li>' +
'd' +
'<ol>' +
'<li>e</li>' +
'<li>i</li>' +
'</ol>' +
'</li>' +
'</ul>'
);
} );
} );
} );
describe( 'post fixer', () => {
describe( 'insert', () => {
function testList( input, inserted, output ) {
return () => {
// Wrap all changes in one block to avoid post-fixing the selection
// (which may be incorret) in the meantime.
model.change( () => {
setModelData( model, input );
model.change( writer => {
writer.insert( parseModel( inserted, model.schema ), modelDoc.selection.getFirstPosition() );
} );
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( output );
};
}
it( 'element before nested list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[]' +
'<listItem listIndent="2" listType="bulleted">d</listItem>' +
'<listItem listIndent="2" listType="bulleted">e</listItem>' +
'<listItem listIndent="3" listType="bulleted">f</listItem>',
'<paragraph>x</paragraph>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="0" listType="bulleted">e</listItem>' +
'<listItem listIndent="1" listType="bulleted">f</listItem>'
) );
it( 'list item before nested list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[]' +
'<listItem listIndent="2" listType="bulleted">d</listItem>' +
'<listItem listIndent="2" listType="bulleted">e</listItem>' +
'<listItem listIndent="3" listType="bulleted">f</listItem>',
'<listItem listIndent="0" listType="bulleted">x</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="bulleted">x</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="bulleted">e</listItem>' +
'<listItem listIndent="2" listType="bulleted">f</listItem>'
) );
it( 'multiple list items with too big indent', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[]' +
'<listItem listIndent="1" listType="bulleted">c</listItem>',
'<listItem listIndent="4" listType="bulleted">x</listItem>' +
'<listItem listIndent="5" listType="bulleted">x</listItem>' +
'<listItem listIndent="4" listType="bulleted">x</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">x</listItem>' +
'<listItem listIndent="3" listType="bulleted">x</listItem>' +
'<listItem listIndent="2" listType="bulleted">x</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>'
) );
it( 'item with different type - top level list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'[]' +
'<listItem listIndent="0" listType="bulleted">c</listItem>',
'<listItem listIndent="0" listType="numbered">x</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="0" listType="numbered">x</listItem>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>'
) );
it( 'multiple items with different type - nested list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[]' +
'<listItem listIndent="2" listType="bulleted">c</listItem>',
'<listItem listIndent="1" listType="numbered">x</listItem>' +
'<listItem listIndent="2" listType="numbered">x</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">x</listItem>' +
'<listItem listIndent="2" listType="numbered">x</listItem>' +
'<listItem listIndent="2" listType="numbered">c</listItem>'
) );
it( 'item with different type, in nested list, after nested list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'[]',
'<listItem listIndent="1" listType="numbered">x</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">x</listItem>'
) );
it( 'two list items with mismatched types inserted in one batch', () => {
const input =
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>';
const output =
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>';
setModelData( model, input );
const item1 = '<listItem listIndent="1" listType="numbered">c</listItem>';
const item2 = '<listItem listIndent="1" listType="bulleted">d</listItem>';
model.change( writer => {
writer.append( parseModel( item1, model.schema ), modelRoot );
writer.append( parseModel( item2, model.schema ), modelRoot );
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( output );
} );
} );
describe( 'remove', () => {
function testList( input, output ) {
return () => {
model.change( writer => {
setModelData( model, input );
writer.remove( modelDoc.selection.getFirstRange() );
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( output );
};
}
it( 'first list item', testList(
'[<listItem listIndent="0" listType="bulleted">a</listItem>]' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>',
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>'
) );
it( 'first list item of nested list', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>]' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="bulleted">e</listItem>' +
'<listItem listIndent="2" listType="bulleted">f</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="2" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="bulleted">e</listItem>' +
'<listItem listIndent="2" listType="bulleted">f</listItem>'
) );
it( 'selection over two different nested lists of same indent', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>]' +
'<listItem listIndent="1" listType="numbered">f</listItem>',
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">f</listItem>'
) );
} );
describe( 'move', () => {
function testList( input, offset, output ) {
return () => {
model.change( writer => {
setModelData( model, input );
const targetPosition = writer.createPositionAt( modelRoot, offset );
writer.move( modelDoc.selection.getFirstRange(), targetPosition );
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( output );
};
}
it( 'nested list item out of list structure', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'[<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="3" listType="bulleted">d</listItem>' +
'<listItem listIndent="4" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>',
6,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'<listItem listIndent="2" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>'
) );
it( 'list items between lists', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>]' +
'<listItem listIndent="4" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>',
7,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">e</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">f</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="2" listType="bulleted">d</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>'
) );
it( 'element in between nested list items', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="2" listType="bulleted">c</listItem>' +
'<listItem listIndent="3" listType="bulleted">d</listItem>' +
'[<paragraph>x</paragraph>]',
2,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<paragraph>x</paragraph>' +
'<listItem listIndent="0" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>'
) );
it( 'multiple nested list items of different types #1 - fix at start', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>]' +
'<listItem listIndent="1" listType="numbered">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="numbered">h</listItem>' +
'<listItem listIndent="1" listType="numbered">i</listItem>',
8,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="numbered">h</listItem>' +
'<listItem listIndent="1" listType="numbered">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>' +
'<listItem listIndent="1" listType="numbered">i</listItem>'
) );
it( 'multiple nested list items of different types #2 - fix at end', testList(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>]' +
'<listItem listIndent="1" listType="numbered">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="bulleted">h</listItem>' +
'<listItem listIndent="1" listType="bulleted">i</listItem>',
8,
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">f</listItem>' +
'<listItem listIndent="0" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="bulleted">h</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="numbered">e</listItem>' +
'<listItem listIndent="1" listType="numbered">i</listItem>'
) );
// #78.
it( 'move out of container', testList(
'<blockQuote>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'[<listItem listIndent="2" listType="bulleted">e</listItem>]' +
'</blockQuote>',
0,
'<listItem listIndent="0" listType="bulleted">e</listItem>' +
'<blockQuote>' +
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">c</listItem>' +
'<listItem listIndent="1" listType="bulleted">d</listItem>' +
'</blockQuote>'
) );
} );
describe( 'rename', () => {
it( 'rename nested item', () => {
const modelBefore =
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'[<listItem listIndent="2" listType="bulleted">c</listItem>]' +
'<listItem listIndent="2" listType="bulleted">d</listItem>' +
'<listItem listIndent="3" listType="bulleted">e</listItem>' +
'<listItem listIndent="1" listType="bulleted">f</listItem>' +
'<listItem listIndent="2" listType="bulleted">g</listItem>' +
'<listItem listIndent="1" listType="bulleted">h</listItem>' +
'<listItem listIndent="2" listType="bulleted">i</listItem>';
const expectedModel =
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="1" listType="bulleted">b</listItem>' +
'<paragraph>c</paragraph>' +
'<listItem listIndent="0" listType="bulleted">d</listItem>' +
'<listItem listIndent="1" listType="bulleted">e</listItem>' +
'<listItem listIndent="0" listType="bulleted">f</listItem>' +
'<listItem listIndent="1" listType="bulleted">g</listItem>' +
'<listItem listIndent="0" listType="bulleted">h</listItem>' +
'<listItem listIndent="1" listType="bulleted">i</listItem>';
model.change( writer => {
setModelData( model, modelBefore );
const element = modelDoc.selection.getFirstPosition().nodeAfter;
writer.rename( element, 'paragraph' );
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( expectedModel );
} );
} );
} );
describe( 'paste and insertContent integration', () => {
it( 'should be triggered on DataController#insertContent()', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
editor.model.insertContent(
parseModel(
'<listItem listType="bulleted" listIndent="0">X</listItem>' +
'<listItem listType="bulleted" listIndent="1">Y</listItem>',
model.schema
)
);
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BX</listItem>' +
'<listItem listIndent="2" listType="bulleted">Y[]</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
it( 'should be triggered when selectable is passed', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
model.insertContent(
parseModel(
'<listItem listType="bulleted" listIndent="0">X</listItem>' +
'<listItem listType="bulleted" listIndent="1">Y</listItem>',
model.schema
),
model.createRange(
model.createPositionFromPath( modelRoot, [ 1, 1 ] ),
model.createPositionFromPath( modelRoot, [ 1, 1 ] )
)
);
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">B[]X</listItem>' +
'<listItem listIndent="2" listType="bulleted">Y</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
// Just checking that it doesn't crash. #69
it( 'should work if an element is passed to DataController#insertContent()', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
model.change( writer => {
const listItem = writer.createElement( 'listItem', { listType: 'bulleted', listIndent: '0' } );
writer.insertText( 'X', listItem );
model.insertContent( listItem );
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BX[]</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
// Just checking that it doesn't crash. #69
it( 'should work if an element is passed to DataController#insertContent() - case #69', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
model.change( writer => {
model.insertContent( writer.createText( 'X' ) );
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BX[]</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
it( 'should fix indents of pasted list items', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BX</listItem>' +
'<listItem listIndent="2" listType="bulleted">Y[]</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
it( 'should not fix indents of list items that are separated by non-list element', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>W<ul><li>X</li></ul></li></ul><p>Y</p><ul><li>Z</li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BW</listItem>' +
'<listItem listIndent="2" listType="bulleted">X</listItem>' +
'<paragraph>Y</paragraph>' +
'<listItem listIndent="0" listType="bulleted">Z[]</listItem>' +
'<listItem listIndent="1" listType="bulleted">C</listItem>'
);
} );
it( 'should co-work correctly with post fixer', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<p>X</p><ul><li>Y</li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BX</listItem>' +
'<listItem listIndent="0" listType="bulleted">Y[]</listItem>' +
'<listItem listIndent="1" listType="bulleted">C</listItem>'
);
} );
it( 'should work if items are pasted between listItem elements', () => {
// Wrap all changes in one block to avoid post-fixing the selection
// (which may be incorret) in the meantime.
model.change( () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B</listItem>[]' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
} );
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">B</listItem>' +
'<listItem listIndent="1" listType="bulleted">X</listItem>' +
'<listItem listIndent="2" listType="bulleted">Y[]</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
it( 'should create correct model when list items are pasted in top-level list', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A[]</listItem>' +
'<listItem listType="bulleted" listIndent="1">B</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">AX</listItem>' +
'<listItem listIndent="1" listType="bulleted">Y[]</listItem>' +
'<listItem listIndent="1" listType="bulleted">B</listItem>'
);
} );
it( 'should create correct model when list items are pasted in non-list context', () => {
setModelData( model,
'<paragraph>A[]</paragraph>' +
'<paragraph>B</paragraph>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<paragraph>AX</paragraph>' +
'<listItem listIndent="0" listType="bulleted">Y[]</listItem>' +
'<paragraph>B</paragraph>'
);
} );
it( 'should not crash when "empty content" is inserted', () => {
setModelData( model, '<paragraph>[]</paragraph>' );
expect( () => {
model.change( writer => {
editor.model.insertContent( writer.createDocumentFragment() );
} );
} ).not.to.throw();
} );
it( 'should correctly handle item that is pasted without its parent', () => {
// Wrap all changes in one block to avoid post-fixing the selection
// (which may be incorret) in the meantime.
model.change( () => {
setModelData( model,
'<paragraph>Foo</paragraph>' +
'<listItem listType="numbered" listIndent="0">A</listItem>' +
'<listItem listType="numbered" listIndent="1">B</listItem>' +
'[]' +
'<paragraph>Bar</paragraph>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<li>X</li>' )
} );
} );
expect( getModelData( model ) ).to.equal(
'<paragraph>Foo</paragraph>' +
'<listItem listIndent="0" listType="numbered">A</listItem>' +
'<listItem listIndent="1" listType="numbered">B</listItem>' +
'<listItem listIndent="1" listType="numbered">X[]</listItem>' +
'<paragraph>Bar</paragraph>'
);
} );
it( 'should correctly handle item that is pasted without its parent #2', () => {
// Wrap all changes in one block to avoid post-fixing the selection
// (which may be incorret) in the meantime.
model.change( () => {
setModelData( model,
'<paragraph>Foo</paragraph>' +
'<listItem listType="numbered" listIndent="0">A</listItem>' +
'<listItem listType="numbered" listIndent="1">B</listItem>' +
'[]' +
'<paragraph>Bar</paragraph>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<li>X<ul><li>Y</li></ul></li>' )
} );
} );
expect( getModelData( model ) ).to.equal(
'<paragraph>Foo</paragraph>' +
'<listItem listIndent="0" listType="numbered">A</listItem>' +
'<listItem listIndent="1" listType="numbered">B</listItem>' +
'<listItem listIndent="1" listType="numbered">X</listItem>' +
'<listItem listIndent="2" listType="bulleted">Y[]</listItem>' +
'<paragraph>Bar</paragraph>'
);
} );
it( 'should handle block elements inside pasted list #1', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A</listItem>' +
'<listItem listType="bulleted" listIndent="1">B[]</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>W<ul><li>X<p>Y</p>Z</li></ul></li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">A</listItem>' +
'<listItem listIndent="1" listType="bulleted">BW</listItem>' +
'<listItem listIndent="2" listType="bulleted">X</listItem>' +
'<paragraph>Y</paragraph>' +
'<listItem listIndent="0" listType="bulleted">Z[]</listItem>' +
'<listItem listIndent="1" listType="bulleted">C</listItem>'
);
} );
it( 'should handle block elements inside pasted list #2', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A[]</listItem>' +
'<listItem listType="bulleted" listIndent="1">B</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>W<ul><li>X<p>Y</p>Z</li></ul></li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">AW</listItem>' +
'<listItem listIndent="1" listType="bulleted">X</listItem>' +
'<paragraph>Y</paragraph>' +
'<listItem listIndent="0" listType="bulleted">Z[]</listItem>' +
'<listItem listIndent="0" listType="bulleted">B</listItem>' +
'<listItem listIndent="1" listType="bulleted">C</listItem>'
);
} );
it( 'should handle block elements inside pasted list #3', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A[]</listItem>' +
'<listItem listType="bulleted" listIndent="1">B</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li><p>W</p><p>X</p><p>Y</p></li><li>Z</li></ul>' )
} );
expect( getModelData( model ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">AW</listItem>' +
'<paragraph>X</paragraph>' +
'<paragraph>Y</paragraph>' +
'<listItem listIndent="0" listType="bulleted">Z[]</listItem>' +
'<listItem listIndent="1" listType="bulleted">B</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
// https://github.com/ckeditor/ckeditor5-list/issues/126#issuecomment-518206743
it( 'should properly handle split of list items with non-standard converters', () => {
setModelData( model,
'<listItem listType="bulleted" listIndent="0">A[]</listItem>' +
'<listItem listType="bulleted" listIndent="1">B</listItem>' +
'<listItem listType="bulleted" listIndent="2">C</listItem>'
);
editor.model.schema.register( 'splitBlock', { inheritAllFrom: '$block' } );
editor.conversion.for( 'downcast' ).elementToElement( { model: 'splitBlock', view: 'splitBlock' } );
editor.conversion.for( 'upcast' ).add( dispatcher => dispatcher.on( 'element:splitBlock', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.viewItem, { name: true } );
// Use split to allowed parent logic to simulate a non-standard use of `modelCursor` after split.
const splitBlock = conversionApi.writer.createElement( 'splitBlock' );
conversionApi.safeInsert( splitBlock, data.modelCursor );
data.modelRange = conversionApi.writer.createRangeOn( splitBlock );
data.modelCursor = conversionApi.writer.createPositionAfter( splitBlock );
} ) );
const clipboard = editor.plugins.get( 'Clipboard' );
clipboard.fire( 'inputTransformation', {
content: parseView( '<ul><li>a<splitBlock></splitBlock>b</li></ul>' )
} );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">Aa</listItem>' +
'<splitBlock></splitBlock>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<listItem listIndent="1" listType="bulleted">B</listItem>' +
'<listItem listIndent="2" listType="bulleted">C</listItem>'
);
} );
} );
describe( 'other', () => {
it( 'model insert converter should not fire if change was already consumed', () => {
editor.editing.downcastDispatcher.on( 'insert:listItem', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.item, 'attribute:listType' );
conversionApi.consumable.consume( data.item, 'attribute:listIndent' );
}, { priority: 'highest' } );
editor.conversion.for( 'downcast' )
.elementToElement( { model: 'listItem', view: 'p', converterPriority: 'highest' } );
// Paragraph is needed, otherwise selection throws.
setModelData( model, '<paragraph>x</paragraph><listItem listIndent="0" listType="bulleted">y</listItem>' );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) ).to.equal( '<p>x</p><p>y</p>' );
} );
it( 'model remove converter should be possible to overwrite', () => {
editor.editing.downcastDispatcher.on( 'remove:listItem', evt => {
evt.stop();
}, { priority: 'highest' } );
// Paragraph is needed to prevent autoparagraphing of empty editor.
setModelData( model, '<paragraph>x</paragraph><listItem listIndent="0" listType="bulleted"></listItem>' );
model.change( writer => {
writer.remove( modelRoot.getChild( 1 ) );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) ).to.equal( '<p>x</p><ul><li></li></ul>' );
} );
it( 'model change type converter should not fire if change was already consumed', () => {
editor.editing.downcastDispatcher.on( 'attribute:listType', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.item, 'attribute:listType' );
}, { priority: 'highest' } );
setModelData( model, '<listItem listIndent="0" listType="bulleted"></listItem>' );
model.change( writer => {
writer.setAttribute( 'listType', 'numbered', modelRoot.getChild( 0 ) );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) ).to.equal( '<ul><li></li></ul>' );
} );
it( 'model change indent converter should not fire if change was already consumed', () => {
editor.editing.downcastDispatcher.on( 'attribute:listIndent', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.item, 'attribute:listIndent' );
}, { priority: 'highest' } );
setModelData(
model,
'<listItem listIndent="0" listType="bulleted">a</listItem><listItem listIndent="0" listType="bulleted">b</listItem>'
);
model.change( writer => {
writer.setAttribute( 'listIndent', 1, modelRoot.getChild( 1 ) );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) ).to.equal( '<ul><li>a</li><li>b</li></ul>' );
} );
it( 'view li converter should not fire if change was already consumed', () => {
editor.data.upcastDispatcher.on( 'element:li', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.viewItem, { name: true } );
}, { priority: 'highest' } );
editor.setData( '<p></p><ul><li></li></ul>' );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<paragraph></paragraph>' );
} );
it( 'view ul converter should not fire if change was already consumed', () => {
editor.data.upcastDispatcher.on( 'element:ul', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.viewItem, { name: true } );
}, { priority: 'highest' } );
editor.setData( '<p></p><ul><li></li></ul>' );
expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<paragraph></paragraph>' );
} );
it( 'view converter should pass model range in data.modelRange', () => {
editor.data.upcastDispatcher.on( 'element:ul', ( evt, data ) => {
expect( data.modelRange ).to.be.instanceof( ModelRange );
}, { priority: 'lowest' } );
editor.setData( '<ul><li>Foo</li><li>Bar</li></ul>' );
} );
// This test tests the fix in `injectViewList` helper.
it( 'ul and ol should not be inserted before ui element - injectViewList()', () => {
editor.setData( '<ul><li>Foo</li><li>Bar</li></ul>' );
// Append ui element at the end of first <li>.
view.change( writer => {
const firstChild = viewDoc.getRoot().getChild( 0 ).getChild( 0 );
const uiElement = writer.createUIElement( 'span' );
writer.insert( writer.createPositionAt( firstChild, 'end' ), uiElement );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span></li><li>Bar</li></ul>' );
model.change( writer => {
// Change indent of the second list item.
writer.setAttribute( 'listIndent', 1, modelRoot.getChild( 1 ) );
} );
// Check if the new <ul> was added at correct position.
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span><ul><li>Bar</li></ul></li></ul>' );
} );
// This test tests the fix in `hoistNestedLists` helper.
it( 'ul and ol should not be inserted before ui element - hoistNestedLists()', () => {
editor.setData( '<ul><li>Foo</li><li>Bar<ul><li>Xxx</li><li>Yyy</li></ul></li></ul>' );
// Append ui element at the end of first <li>.
view.change( writer => {
const firstChild = viewDoc.getRoot().getChild( 0 ).getChild( 0 );
const uiElement = writer.createUIElement( 'span' );
writer.insert( writer.createPositionAt( firstChild, 'end' ), uiElement );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span></li><li>Bar<ul><li>Xxx</li><li>Yyy</li></ul></li></ul>' );
model.change( writer => {
// Remove second list item. Expect that its sub-list will be moved to first list item.
writer.remove( modelRoot.getChild( 1 ) );
} );
// Check if the <ul> was added at correct position.
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span><ul><li>Xxx</li><li>Yyy</li></ul></li></ul>' );
} );
describe( 'remove converter should properly handle ui elements', () => {
let liFoo, liBar;
beforeEach( () => {
editor.setData( '<ul><li>Foo</li><li>Bar</li></ul>' );
liFoo = modelRoot.getChild( 0 );
liBar = modelRoot.getChild( 1 );
} );
it( 'ui element before <ul>', () => {
view.change( writer => {
// Append ui element before <ul>.
writer.insert( writer.createPositionAt( viewRoot, 0 ), writer.createUIElement( 'span' ) );
} );
model.change( writer => {
writer.remove( liFoo );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<span></span><ul><li>Bar</li></ul>' );
} );
it( 'ui element before first <li>', () => {
view.change( writer => {
// Append ui element before <ul>.
writer.insert( writer.createPositionAt( viewRoot.getChild( 0 ), 0 ), writer.createUIElement( 'span' ) );
} );
model.change( writer => {
writer.remove( liFoo );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><span></span><li>Bar</li></ul>' );
} );
it( 'ui element in the middle of list', () => {
view.change( writer => {
// Append ui element before <ul>.
writer.insert( writer.createPositionAt( viewRoot.getChild( 0 ), 'end' ), writer.createUIElement( 'span' ) );
} );
model.change( writer => {
writer.remove( liBar );
} );
expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo</li><span></span></ul>' );
} );
} );
} );
describe( 'schema checking and parent splitting', () => {
beforeEach( () => {
// Since this part of test tests only view->model conversion editing pipeline is not necessary.
editor.editing.destroy();
} );
it( 'list should be not converted when modelCursor and its ancestors disallow to insert list', () => {
model.document.createRoot( '$title', 'title' );
model.schema.register( '$title', {
disallow: '$block',
allow: 'inline'
} );
editor.data.set( { title: '<ul><li>foo</li></ul>' } );
expect( getModelData( model, { rootName: 'title', withoutSelection: true } ) ).to.equal( '' );
} );
it( 'should split parent element when one of modelCursor ancestors allows to insert list - in the middle', () => {
editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
model.schema.register( 'div', { inheritAllFrom: '$block' } );
editor.setData(
'<div>' +
'abc' +
'<ul>' +
'<li>foo</li>' +
'</ul>' +
'def' +
'</div>'
);
expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
'<div>abc</div>' +
'<listItem listIndent="0" listType="bulleted">foo</listItem>' +
'<div>def</div>'
);
} );
it( 'should split parent element when one of modelCursor ancestors allows to insert list - at the end', () => {
editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
model.schema.register( 'div', { inheritAllFrom: '$block' } );
editor.setData(
'<div>' +
'abc' +
'<ul>' +
'<li>foo</li>' +
'</ul>' +
'</div>'
);
expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
'<div>abc</div>' +
'<listItem listIndent="0" listType="bulleted">foo</listItem>'
);
} );
it( 'should split parent element when one of modelCursor ancestors allows to insert list - at the beginning', () => {
editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
model.schema.register( 'div', { inheritAllFrom: '$block' } );
editor.setData(
'<div>' +
'<ul>' +
'<li>foo</li>' +
'</ul>' +
'def' +
'</div>'
);
expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">foo</listItem>' +
'<div>def</div>'
);
} );
// https://github.com/ckeditor/ckeditor5-list/issues/121
it( 'should correctly set data.modelCursor', () => {
editor.setData(
'<ul>' +
'<li>a</li>' +
'<li>b</li>' +
'</ul>' +
'c'
);
expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
'<listItem listIndent="0" listType="bulleted">a</listItem>' +
'<listItem listIndent="0" listType="bulleted">b</listItem>' +
'<paragraph>c</paragraph>'
);
} );
// https://github.com/ckeditor/ckeditor5/issues/1572
it( 'should not crash if list item contains autoparagraphed block that will be split', () => {
// Creating a new editor as we need HeadingEditing. Cannot add HeadingEditing to the `describe` at the beginning of the
// test file because other tests assume that headings are not available.
return VirtualTestEditor
.create( {
plugins: [ ListEditing, HeadingEditing ]
} )
.then( editor => {
editor.setData( '<ul><li><div><h2>Foo</h2></div></li></ul>' );
expect( getModelData( editor.model, { withoutSelection: true } ) ).to.equal( '<heading1>Foo</heading1>' );
} );
} );
} );
function getViewPosition( root, path, view ) {
let parent = root;
while ( path.length > 1 ) {
parent = parent.getChild( path.shift() );
}
return view.createPositionAt( parent, path[ 0 ] );
}
function getViewPath( position ) {
const path = [ position.offset ];
let parent = position.parent;
while ( parent.parent ) {
path.unshift( parent.index );
parent = parent.parent;
}
return path;
}
function testInsert( testName, input, output, testUndo = true ) {
// Cut out inserted element that is between '[' and ']' characters.
const selStart = input.indexOf( '[' ) + 1;
const selEnd = input.indexOf( ']' );
const item = input.substring( selStart, selEnd );
const modelInput = input.substring( 0, selStart ) + input.substring( selEnd );
const actionCallback = selection => {
model.change( writer => {
writer.insert( parseModel( item, model.schema ), selection.getFirstPosition() );
} );
};
_test( testName, modelInput, output, actionCallback, testUndo );
}
function testRemove( testName, input, output ) {
const actionCallback = selection => {
model.change( writer => {
writer.remove( selection.getFirstRange() );
} );
};
_test( testName, input, output, actionCallback );
}
function testChangeType( testName, input, output ) {
const actionCallback = selection => {
const element = selection.getFirstPosition().nodeAfter;
const newType = element.getAttribute( 'listType' ) == 'numbered' ? 'bulleted' : 'numbered';
model.change( writer => {
const itemsToChange = Array.from( selection.getSelectedBlocks() );
for ( const item of itemsToChange ) {
writer.setAttribute( 'listType', newType, item );
}
} );
};
_test( testName, input, output, actionCallback );
}
function testRenameFromListItem( testName, input, output, testUndo = true ) {
const actionCallback = selection => {
const element = selection.getFirstPosition().nodeAfter;
model.change( writer => {
writer.rename( element, 'paragraph' );
writer.removeAttribute( 'listType', element );
writer.removeAttribute( 'listIndent', element );
} );
};
_test( testName, input, output, actionCallback, testUndo );
}
function testRenameToListItem( testName, newIndent, input, output ) {
const actionCallback = selection => {
const element = selection.getFirstPosition().nodeAfter;
model.change( writer => {
writer.setAttributes( { listType: 'bulleted', listIndent: newIndent }, element );
writer.rename( element, 'listItem' );
} );
};
_test( testName, input, output, actionCallback );
}
function testChangeIndent( testName, newIndent, input, output ) {
const actionCallback = selection => {
model.change( writer => {
writer.setAttribute( 'listIndent', newIndent, selection.getFirstRange() );
} );
};
_test( testName, input, output, actionCallback );
}
function testMove( testName, input, rootOffset, output, testUndo = true ) {
const actionCallback = selection => {
model.change( writer => {
const targetPosition = writer.createPositionAt( modelRoot, rootOffset );
writer.move( selection.getFirstRange(), targetPosition );
} );
};
_test( testName, input, output, actionCallback, testUndo );
}
function _test( testName, input, output, actionCallback, testUndo ) {
it( testName, () => {
const callbackSelection = prepareTest( model, input );
actionCallback( callbackSelection );
expect( getViewData( view, { withoutSelection: true } ) ).to.equal( output );
} );
if ( testUndo ) {
it( testName + ' (undo integration)', () => {
const callbackSelection = prepareTest( model, input );
const modelBefore = getModelData( model );
const viewBefore = getViewData( view, { withoutSelection: true } );
actionCallback( callbackSelection );
const modelAfter = getModelData( model );
const viewAfter = getViewData( view, { withoutSelection: true } );
editor.execute( 'undo' );
expect( getModelData( model ) ).to.equal( modelBefore );
expect( getViewData( view, { withoutSelection: true } ) ).to.equal( viewBefore );
editor.execute( 'redo' );
expect( getModelData( model ) ).to.equal( modelAfter );
expect( getViewData( view, { withoutSelection: true } ) ).to.equal( viewAfter );
} );
}
function prepareTest( model, input ) {
const modelRoot = model.document.getRoot( 'main' );
// Parse data string to model.
const parsedResult = parseModel( input, model.schema, { context: [ modelRoot.name ] } );
// Retrieve DocumentFragment and Selection from parsed model.
const modelDocumentFragment = parsedResult.model;
const selection = parsedResult.selection;
// Ensure no undo step is generated.
model.enqueueChange( 'transparent', writer => {
// Replace existing model in document by new one.
writer.remove( writer.createRangeIn( modelRoot ) );
writer.insert( modelDocumentFragment, modelRoot );
// Clean up previous document selection.
writer.setSelection( null );
writer.removeSelectionAttribute( model.document.selection.getAttributeKeys() );
} );
const ranges = [];
for ( const range of selection.getRanges() ) {
const start = model.createPositionFromPath( modelRoot, range.start.path );
const end = model.createPositionFromPath( modelRoot, range.end.path );
ranges.push( model.createRange( start, end ) );
}
return model.createSelection( ranges );
}
}
} );
|
# check library version numbers
# scipy
import scipy
print('scipy: %s' % scipy.__version__)
# numpy
import numpy
print('numpy: %s' % numpy.__version__)
# matplotlib
import matplotlib
print('matplotlib: %s' % matplotlib.__version__)
# pandas
import pandas
print('pandas: %s' % pandas.__version__)
# statsmodels
import statsmodels
print('statsmodels: %s' % statsmodels.__version__)
# scikit-learn
import sklearn
print('sklearn: %s' % sklearn.__version__) |
from tkinter import *
from tkinter.ttk import *
class DomainTree(Treeview):
def __init__(self, master = None):
super().__init__()
def populateTree():
pass
class DomainApp(Frame):
def __init__(self, master=None):
super().__init__()
self.pack()
self.tree = DomainTree(master = self)
self.tree['columns'] = ('count')
self.tree.pack(fill = 'both', expand = True)
if __name__ == '__main__':
root = Tk()
app = DomainApp(master = root)
root.mainloop()
root.destroy()
|
import React from 'react';
import styles from './Header.css'
const OrderAddressHeader = ({ history }) =>
(<div className={styles.header} onClick={() => history.goBack()}>
返回订单
</div>)
export default OrderAddressHeader |
"""A friendly Python SFTP interface."""
from __future__ import print_function
import os
from contextlib import contextmanager
import posixpath
import socket
from stat import S_IMODE, S_ISDIR, S_ISREG
import tempfile
import warnings
import paramiko
from paramiko import SSHException, AuthenticationException # make available
from paramiko import AgentKey, RSAKey, DSSKey
from pysftp.exceptions import (CredentialException, ConnectionException,
HostKeysException)
from pysftp.helpers import (st_mode_to_int, WTCallbacks, path_advance,
path_retreat, reparent, walktree, cd, known_hosts)
__version__ = "0.2.9"
# pylint: disable = R0913,C0302
class CnOpts(object): # pylint:disable=r0903
'''additional connection options beyond authentication
:ivar bool|str log: initial value: False -
log connection/handshake details? If set to True,
pysftp creates a temporary file and logs to that. If set to a valid
path and filename, pysftp logs to that. The name of the logfile can
be found at ``.logfile``
:ivar bool compression: initial value: False - Enables compression on the
transport, if set to True.
:ivar list|None ciphers: initial value: None -
List of ciphers to use in order.
:ivar paramiko.hostkeys.HostKeys|None hostkeys: HostKeys object to use for
host key checking.
:param filepath|None knownhosts: initial value: None - file to load
hostkeys. If not specified, uses ~/.ssh/known_hosts
:returns: (obj) CnOpts - A connection options object, used for passing
extended options to the Connection
:raises HostKeysException:
'''
def __init__(self, knownhosts=None):
self.log = False
self.compression = False
self.ciphers = None
if knownhosts is None:
knownhosts = known_hosts()
self.hostkeys = paramiko.hostkeys.HostKeys()
try:
self.hostkeys.load(knownhosts)
except IOError:
# can't find known_hosts in the standard place
wmsg = "Failed to load HostKeys from %s. " % knownhosts
wmsg += "You will need to explicitly load HostKeys "
wmsg += "(cnopts.hostkeys.load(filename)) or disable"
wmsg += "HostKey checking (cnopts.hostkeys = None)."
warnings.warn(wmsg, UserWarning)
else:
if len(self.hostkeys.items()) == 0:
raise HostKeysException('No Host Keys Found')
def get_hostkey(self, host):
'''return the matching hostkey to use for verification for the host
indicated or raise an SSHException'''
kval = self.hostkeys.lookup(host) # None|{keytype: PKey}
if kval is None:
raise SSHException("No hostkey for host %s found." % host)
# return the pkey from the dict
return list(kval.values())[0]
class Connection(object): # pylint:disable=r0902,r0904
"""Connects and logs into the specified hostname.
Arguments that are not given are guessed from the environment.
:param str host:
The Hostname or IP of the remote machine.
:param str|None username: *Default: None* -
Your username at the remote machine.
:param str|obj|None private_key: *Default: None* -
path to private key file(str) or paramiko.AgentKey
:param str|None password: *Default: None* -
Your password at the remote machine.
:param int port: *Default: 22* -
The SSH port of the remote machine.
:param str|None private_key_pass: *Default: None* -
password to use, if private_key is encrypted.
:param list|None ciphers: *Deprecated* -
see ``pysftp.CnOpts`` and ``cnopts`` parameter
:param bool|str log: *Deprecated* -
see ``pysftp.CnOpts`` and ``cnopts`` parameter
:param None|CnOpts cnopts: *Default: None* - extra connection options
set in a CnOpts object.
:param str|None default_path: *Default: None* -
set a default path upon connection.
:returns: (obj) connection to the requested host
:raises ConnectionException:
:raises CredentialException:
:raises SSHException:
:raises AuthenticationException:
:raises PasswordRequiredException:
:raises HostKeysException:
"""
def __init__(self, host, username=None, private_key=None, password=None,
port=22, private_key_pass=None, ciphers=None, log=False,
cnopts=None, default_path=None):
# starting point for transport.connect options
self._tconnect = {'username': username, 'password': password,
'hostkey': None, 'pkey': None}
self._cnopts = cnopts or CnOpts()
self._default_path = default_path
# TODO: remove this if block and log param above in v0.3.0
if log:
wmsg = "log parameter is deprecated and will be remove in 0.3.0. "\
"Use cnopts param."
warnings.warn(wmsg, DeprecationWarning)
self._cnopts.log = log
# TODO: remove this if block and log param above in v0.3.0
if ciphers is not None:
wmsg = "ciphers parameter is deprecated and will be remove in "\
"0.3.0. Use cnopts param."
warnings.warn(wmsg, DeprecationWarning)
self._cnopts.ciphers = ciphers
# check that we have a hostkey to verify
if self._cnopts.hostkeys is not None:
self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
self._sftp_live = False
self._sftp = None
self._set_username()
self._set_logging()
# Begin the SSH transport.
self._transport = None
self._start_transport(host, port)
self._transport.use_compression(self._cnopts.compression)
self._set_authentication(password, private_key, private_key_pass)
self._transport.connect(**self._tconnect)
def _set_authentication(self, password, private_key, private_key_pass):
'''Authenticate the transport. prefer password if given'''
if password is None:
# Use Private Key.
if not private_key:
# Try to use default key.
if os.path.exists(os.path.expanduser('~/.ssh/id_rsa')):
private_key = '~/.ssh/id_rsa'
elif os.path.exists(os.path.expanduser('~/.ssh/id_dsa')):
private_key = '~/.ssh/id_dsa'
else:
raise CredentialException("No password or key specified.")
if isinstance(private_key, (AgentKey, RSAKey)):
# use the paramiko agent or rsa key
self._tconnect['pkey'] = private_key
else:
# isn't a paramiko AgentKey or RSAKey, try to build a
# key from what we assume is a path to a key
private_key_file = os.path.expanduser(private_key)
try: # try rsa
self._tconnect['pkey'] = RSAKey.from_private_key_file(
private_key_file, private_key_pass)
except paramiko.SSHException: # if it fails, try dss
# pylint:disable=r0204
self._tconnect['pkey'] = DSSKey.from_private_key_file(
private_key_file, private_key_pass)
def _start_transport(self, host, port):
'''start the transport and set the ciphers if specified.'''
try:
self._transport = paramiko.Transport((host, port))
# Set security ciphers if set
if self._cnopts.ciphers is not None:
ciphers = self._cnopts.ciphers
self._transport.get_security_options().ciphers = ciphers
except (AttributeError, socket.gaierror):
# couldn't connect
raise ConnectionException(host, port)
def _set_username(self):
'''set the username for the connection. If not passed, then look to the
environment. Still nothing? Throw exception.'''
if self._tconnect['username'] is None:
self._tconnect['username'] = os.environ.get('LOGNAME', None)
if self._tconnect['username'] is None:
raise CredentialException('No username specified.')
def _set_logging(self):
'''set logging for connection'''
if self._cnopts.log:
if isinstance(self._cnopts.log, bool):
# Log to a temporary file.
fhnd, self._cnopts.log = tempfile.mkstemp('.txt', 'ssh-')
os.close(fhnd) # don't want os file descriptors open
paramiko.util.log_to_file(self._cnopts.log)
def _sftp_connect(self):
"""Establish the SFTP connection."""
if not self._sftp_live:
self._sftp = paramiko.SFTPClient.from_transport(self._transport)
if self._default_path is not None:
# print("_default_path: [%s]" % self._default_path)
self._sftp.chdir(self._default_path)
self._sftp_live = True
@property
def pwd(self):
'''return the current working directory
:returns: (str) current working directory
'''
self._sftp_connect()
return self._sftp.normalize('.')
def get(self, remotepath, localpath=None, callback=None,
preserve_mtime=False):
"""Copies a file between the remote host and the local host.
:param str remotepath: the remote path and filename, source
:param str localpath:
the local path and filename to copy, destination. If not specified,
file is copied to local current working directory
:param callable callback:
optional callback function (form: ``func(int, int)``) that accepts
the bytes transferred so far and the total bytes to be transferred.
:param bool preserve_mtime:
*Default: False* - make the modification time(st_mtime) on the
local file match the time on the remote. (st_atime can differ
because stat'ing the localfile can/does update it's st_atime)
:returns: None
:raises: IOError
"""
if not localpath:
localpath = os.path.split(remotepath)[1]
self._sftp_connect()
if preserve_mtime:
sftpattrs = self._sftp.stat(remotepath)
self._sftp.get(remotepath, localpath, callback=callback)
if preserve_mtime:
os.utime(localpath, (sftpattrs.st_atime, sftpattrs.st_mtime))
def get_d(self, remotedir, localdir, preserve_mtime=False):
"""get the contents of remotedir and write to locadir. (non-recursive)
:param str remotedir: the remote directory to copy from (source)
:param str localdir: the local directory to copy to (target)
:param bool preserve_mtime: *Default: False* -
preserve modification time on files
:returns: None
:raises:
"""
self._sftp_connect()
with self.cd(remotedir):
for sattr in self._sftp.listdir_attr('.'):
if S_ISREG(sattr.st_mode):
rname = sattr.filename
self.get(rname, reparent(localdir, rname),
preserve_mtime=preserve_mtime)
def get_r(self, remotedir, localdir, preserve_mtime=False):
"""recursively copy remotedir structure to localdir
:param str remotedir: the remote directory to copy from
:param str localdir: the local directory to copy to
:param bool preserve_mtime: *Default: False* -
preserve modification time on files
:returns: None
:raises:
"""
self._sftp_connect()
wtcb = WTCallbacks()
self.walktree(remotedir, wtcb.file_cb, wtcb.dir_cb, wtcb.unk_cb)
# handle directories we recursed through
for dname in wtcb.dlist:
for subdir in path_advance(dname):
try:
os.mkdir(reparent(localdir, subdir))
# force result to a list for setter,
wtcb.dlist = wtcb.dlist + [subdir, ]
except OSError: # dir exists
pass
for fname in wtcb.flist:
# they may have told us to start down farther, so we may not have
# recursed through some, ensure local dir structure matches
head, _ = os.path.split(fname)
if head not in wtcb.dlist:
for subdir in path_advance(head):
if subdir not in wtcb.dlist and subdir != '.':
os.mkdir(reparent(localdir, subdir))
wtcb.dlist = wtcb.dlist + [subdir, ]
self.get(fname,
reparent(localdir, fname),
preserve_mtime=preserve_mtime)
def getfo(self, remotepath, flo, callback=None):
"""Copy a remote file (remotepath) to a file-like object, flo.
:param str remotepath: the remote path and filename, source
:param flo: open file like object to write, destination.
:param callable callback:
optional callback function (form: ``func(int, int``)) that accepts
the bytes transferred so far and the total bytes to be transferred.
:returns: (int) the number of bytes written to the opened file object
:raises: Any exception raised by operations will be passed through.
"""
self._sftp_connect()
return self._sftp.getfo(remotepath, flo, callback=callback)
def put(self, localpath, remotepath=None, callback=None, confirm=True,
preserve_mtime=False):
"""Copies a file between the local host and the remote host.
:param str localpath: the local path and filename
:param str remotepath:
the remote path, else the remote :attr:`.pwd` and filename is used.
:param callable callback:
optional callback function (form: ``func(int, int``)) that accepts
the bytes transferred so far and the total bytes to be transferred.
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size
:param bool preserve_mtime:
*Default: False* - make the modification time(st_mtime) on the
remote file match the time on the local. (st_atime can differ
because stat'ing the localfile can/does update it's st_atime)
:returns:
(obj) SFTPAttributes containing attributes about the given file
:raises IOError: if remotepath doesn't exist
:raises OSError: if localpath doesn't exist
"""
if not remotepath:
remotepath = os.path.split(localpath)[1]
self._sftp_connect()
if preserve_mtime:
local_stat = os.stat(localpath)
times = (local_stat.st_atime, local_stat.st_mtime)
sftpattrs = self._sftp.put(localpath, remotepath, callback=callback,
confirm=confirm)
if preserve_mtime:
self._sftp.utime(remotepath, times)
sftpattrs = self._sftp.stat(remotepath)
return sftpattrs
def put_d(self, localpath, remotepath, confirm=True, preserve_mtime=False):
"""Copies a local directory's contents to a remotepath
:param str localpath: the local path to copy (source)
:param str remotepath:
the remote path to copy to (target)
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size
:param bool preserve_mtime:
*Default: False* - make the modification time(st_mtime) on the
remote file match the time on the local. (st_atime can differ
because stat'ing the localfile can/does update it's st_atime)
:returns: None
:raises IOError: if remotepath doesn't exist
:raises OSError: if localpath doesn't exist
"""
self._sftp_connect()
wtcb = WTCallbacks()
cur_local_dir = os.getcwd()
os.chdir(localpath)
walktree('.', wtcb.file_cb, wtcb.dir_cb, wtcb.unk_cb,
recurse=False)
for fname in wtcb.flist:
fname = os.path.normpath(fname)
src = os.path.join(localpath, fname)
dest = reparent(remotepath, fname)
# print('put', src, dest)
self.put(src, dest, confirm=confirm, preserve_mtime=preserve_mtime)
# restore local directory
os.chdir(cur_local_dir)
def put_r(self, localpath, remotepath, confirm=True, preserve_mtime=False):
"""Recursively copies a local directory's contents to a remotepath
:param str localpath: the local path to copy (source)
:param str remotepath:
the remote path to copy to (target)
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size
:param bool preserve_mtime:
*Default: False* - make the modification time(st_mtime) on the
remote file match the time on the local. (st_atime can differ
because stat'ing the localfile can/does update it's st_atime)
:returns: None
:raises IOError: if remotepath doesn't exist
:raises OSError: if localpath doesn't exist
"""
self._sftp_connect()
wtcb = WTCallbacks()
cur_local_dir = os.getcwd()
os.chdir(localpath)
walktree('.', wtcb.file_cb, wtcb.dir_cb, wtcb.unk_cb)
# restore local directory
os.chdir(cur_local_dir)
for dname in wtcb.dlist:
if dname != '.':
pth = reparent(remotepath, dname)
if not self.isdir(pth):
self.mkdir(pth)
for fname in wtcb.flist:
head, _ = os.path.split(fname)
if head not in wtcb.dlist:
for subdir in path_advance(head):
if subdir not in wtcb.dlist and subdir != '.':
self.mkdir(reparent(remotepath, subdir))
wtcb.dlist = wtcb.dlist + [subdir, ]
src = os.path.join(localpath, fname)
dest = reparent(remotepath, fname)
# print('put', src, dest)
self.put(src, dest, confirm=confirm, preserve_mtime=preserve_mtime)
def putfo(self, flo, remotepath=None, file_size=0, callback=None,
confirm=True):
"""Copies the contents of a file like object to remotepath.
:param flo: a file-like object that supports .read()
:param str remotepath: the remote path.
:param int file_size:
the size of flo, if not given the second param passed to the
callback function will always be 0.
:param callable callback:
optional callback function (form: ``func(int, int``)) that accepts
the bytes transferred so far and the total bytes to be transferred.
:param bool confirm:
whether to do a stat() on the file afterwards to confirm the file
size
:returns:
(obj) SFTPAttributes containing attributes about the given file
:raises: TypeError, if remotepath not specified, any underlying error
"""
self._sftp_connect()
return self._sftp.putfo(flo, remotepath, file_size=file_size,
callback=callback, confirm=confirm)
def execute(self, command):
"""Execute the given commands on a remote machine. The command is
executed without regard to the remote :attr:`.pwd`.
:param str command: the command to execute.
:returns: (list of str) representing the results of the command
:raises: Any exception raised by command will be passed through.
"""
channel = self._transport.open_session()
channel.exec_command(command)
output = channel.makefile('rb', -1).readlines()
if output:
return output
else:
return channel.makefile_stderr('rb', -1).readlines()
@contextmanager
def cd(self, remotepath=None): # pylint:disable=c0103
"""context manager that can change to a optionally specified remote
directory and restores the old pwd on exit.
:param str|None remotepath: *Default: None* -
remotepath to temporarily make the current directory
:returns: None
:raises: IOError, if remote path doesn't exist
"""
original_path = self.pwd
try:
if remotepath is not None:
self.cwd(remotepath)
yield
finally:
self.cwd(original_path)
def chdir(self, remotepath):
"""change the current working directory on the remote
:param str remotepath: the remote path to change to
:returns: None
:raises: IOError, if path does not exist
"""
self._sftp_connect()
self._sftp.chdir(remotepath)
cwd = chdir # synonym for chdir
def chmod(self, remotepath, mode=777):
"""set the mode of a remotepath to mode, where mode is an integer
representation of the octal mode to use.
:param str remotepath: the remote path/file to modify
:param int mode: *Default: 777* -
int representation of octal mode for directory
:returns: None
:raises: IOError, if the file doesn't exist
"""
self._sftp_connect()
self._sftp.chmod(remotepath, mode=int(str(mode), 8))
def chown(self, remotepath, uid=None, gid=None):
""" set uid and/or gid on a remotepath, you may specify either or both.
Unless you have **permission** to do this on the remote server, you
will raise an IOError: 13 - permission denied
:param str remotepath: the remote path/file to modify
:param int uid: the user id to set on the remotepath
:param int gid: the group id to set on the remotepath
:returns: None
:raises:
IOError, if you don't have permission or the file doesn't exist
"""
self._sftp_connect()
if uid is None or gid is None:
if uid is None and gid is None: # short circuit if no change
return
rstat = self._sftp.stat(remotepath)
if uid is None:
uid = rstat.st_uid
if gid is None:
gid = rstat.st_gid
self._sftp.chown(remotepath, uid=uid, gid=gid)
def getcwd(self):
"""return the current working directory on the remote. This is a wrapper
for paramiko's method and not to be confused with the SFTP command,
cwd.
:returns: (str) the current remote path. None, if not set.
"""
self._sftp_connect()
return self._sftp.getcwd()
def listdir(self, remotepath='.'):
"""return a list of files/directories for the given remote path.
Unlike, paramiko, the directory listing is sorted.
:param str remotepath: path to list on the server
:returns: (list of str) directory entries, sorted
"""
self._sftp_connect()
return sorted(self._sftp.listdir(remotepath))
def listdir_attr(self, remotepath='.'):
"""return a list of SFTPAttribute objects of the files/directories for
the given remote path. The list is in arbitrary order. It does not
include the special entries '.' and '..'.
The returned SFTPAttributes objects will each have an additional field:
longname, which may contain a formatted string of the file's
attributes, in unix format. The content of this string will depend on
the SFTP server.
:param str remotepath: path to list on the server
:returns: (list of SFTPAttributes), sorted
"""
self._sftp_connect()
return sorted(self._sftp.listdir_attr(remotepath),
key=lambda attr: attr.filename)
def mkdir(self, remotepath, mode=777):
"""Create a directory named remotepath with mode. On some systems,
mode is ignored. Where it is used, the current umask value is first
masked out.
:param str remotepath: directory to create`
:param int mode: *Default: 777* -
int representation of octal mode for directory
:returns: None
"""
self._sftp_connect()
self._sftp.mkdir(remotepath, mode=int(str(mode), 8))
def normalize(self, remotepath):
"""Return the expanded path, w.r.t the server, of a given path. This
can be used to resolve symlinks or determine what the server believes
to be the :attr:`.pwd`, by passing '.' as remotepath.
:param str remotepath: path to be normalized
:return: (str) normalized form of the given path
:raises: IOError, if remotepath can't be resolved
"""
self._sftp_connect()
return self._sftp.normalize(remotepath)
def isdir(self, remotepath):
"""return true, if remotepath is a directory
:param str remotepath: the path to test
:returns: (bool)
"""
self._sftp_connect()
try:
result = S_ISDIR(self._sftp.stat(remotepath).st_mode)
except IOError: # no such file
result = False
return result
def isfile(self, remotepath):
"""return true if remotepath is a file
:param str remotepath: the path to test
:returns: (bool)
"""
self._sftp_connect()
try:
result = S_ISREG(self._sftp.stat(remotepath).st_mode)
except IOError: # no such file
result = False
return result
def makedirs(self, remotedir, mode=777):
"""create all directories in remotedir as needed, setting their mode
to mode, if created.
If remotedir already exists, silently complete. If a regular file is
in the way, raise an exception.
:param str remotedir: the directory structure to create
:param int mode: *Default: 777* -
int representation of octal mode for directory
:returns: None
:raises: OSError
"""
self._sftp_connect()
if self.isdir(remotedir):
pass
elif self.isfile(remotedir):
raise OSError("a file with the same name as the remotedir, "
"'%s', already exists." % remotedir)
else:
head, tail = os.path.split(remotedir)
if head and not self.isdir(head):
self.makedirs(head, mode)
if tail:
self.mkdir(remotedir, mode=mode)
def readlink(self, remotelink):
"""Return the target of a symlink (shortcut). The result will be
an absolute pathname.
:param str remotelink: remote path of the symlink
:return: (str) absolute path to target
"""
self._sftp_connect()
return self._sftp.normalize(self._sftp.readlink(remotelink))
def remove(self, remotefile):
"""remove the file @ remotefile, remotefile may include a path, if no
path, then :attr:`.pwd` is used. This method only works on files
:param str remotefile: the remote file to delete
:returns: None
:raises: IOError
"""
self._sftp_connect()
self._sftp.remove(remotefile)
unlink = remove # synonym for remove
def rmdir(self, remotepath):
"""remove remote directory
:param str remotepath: the remote directory to remove
:returns: None
"""
self._sftp_connect()
self._sftp.rmdir(remotepath)
def rename(self, remote_src, remote_dest):
"""rename a file or directory on the remote host.
:param str remote_src: the remote file/directory to rename
:param str remote_dest: the remote file/directory to put it
:returns: None
:raises: IOError
"""
self._sftp_connect()
self._sftp.rename(remote_src, remote_dest)
def stat(self, remotepath):
"""return information about file/directory for the given remote path
:param str remotepath: path to stat
:returns: (obj) SFTPAttributes
"""
self._sftp_connect()
return self._sftp.stat(remotepath)
def lstat(self, remotepath):
"""return information about file/directory for the given remote path,
without following symbolic links. Otherwise, the same as .stat()
:param str remotepath: path to stat
:returns: (obj) SFTPAttributes object
"""
self._sftp_connect()
return self._sftp.lstat(remotepath)
def close(self):
"""Closes the connection and cleans up."""
# Close SFTP Connection.
if self._sftp_live:
self._sftp.close()
self._sftp_live = False
# Close the SSH Transport.
if self._transport:
self._transport.close()
self._transport = None
# clean up any loggers
if self._cnopts.log:
# if handlers are active they hang around until the app exits
# this closes and removes the handlers if in use at close
import logging
lgr = logging.getLogger("paramiko")
if lgr:
lgr.handlers = []
def open(self, remote_file, mode='r', bufsize=-1):
"""Open a file on the remote server.
See http://paramiko-docs.readthedocs.org/en/latest/api/sftp.html for
details.
:param str remote_file: name of the file to open.
:param str mode:
mode (Python-style) to open file (always assumed binary)
:param int bufsize: *Default: -1* - desired buffering
:returns: (obj) SFTPFile, a handle the remote open file
:raises: IOError, if the file could not be opened.
"""
self._sftp_connect()
return self._sftp.open(remote_file, mode=mode, bufsize=bufsize)
def exists(self, remotepath):
"""Test whether a remotepath exists.
:param str remotepath: the remote path to verify
:returns: (bool) True, if remotepath exists, else False
"""
self._sftp_connect()
try:
self._sftp.stat(remotepath)
except IOError:
return False
return True
def lexists(self, remotepath):
"""Test whether a remotepath exists. Returns True for broken symbolic
links
:param str remotepath: the remote path to verify
:returns: (bool), True, if lexists, else False
"""
self._sftp_connect()
try:
self._sftp.lstat(remotepath)
except IOError:
return False
return True
def symlink(self, remote_src, remote_dest):
'''create a symlink for a remote file on the server
:param str remote_src: path of original file
:param str remote_dest: path of the created symlink
:returns: None
:raises:
any underlying error, IOError if something already exists at
remote_dest
'''
self._sftp_connect()
self._sftp.symlink(remote_src, remote_dest)
def truncate(self, remotepath, size):
"""Change the size of the file specified by path. Used to modify the
size of the file, just like the truncate method on Python file objects.
The new file size is confirmed and returned.
:param str remotepath: remote file path to modify
:param int|long size: the new file size
:returns: (int) new size of file
:raises: IOError, if file does not exist
"""
self._sftp_connect()
self._sftp.truncate(remotepath, size)
return self._sftp.stat(remotepath).st_size
def walktree(self, remotepath, fcallback, dcallback, ucallback,
recurse=True):
'''recursively descend, depth first, the directory tree rooted at
remotepath, calling discreet callback functions for each regular file,
directory and unknown file type.
:param str remotepath:
root of remote directory to descend, use '.' to start at
:attr:`.pwd`
:param callable fcallback:
callback function to invoke for a regular file.
(form: ``func(str)``)
:param callable dcallback:
callback function to invoke for a directory. (form: ``func(str)``)
:param callable ucallback:
callback function to invoke for an unknown file type.
(form: ``func(str)``)
:param bool recurse: *Default: True* - should it recurse
:returns: None
:raises:
'''
self._sftp_connect()
for entry in self.listdir(remotepath):
pathname = posixpath.join(remotepath, entry)
mode = self._sftp.stat(pathname).st_mode
if S_ISDIR(mode):
# It's a directory, call the dcallback function
dcallback(pathname)
if recurse:
# now, recurse into it
self.walktree(pathname, fcallback, dcallback, ucallback)
elif S_ISREG(mode):
# It's a file, call the fcallback function
fcallback(pathname)
else:
# Unknown file type
ucallback(pathname)
@property
def sftp_client(self):
"""give access to the underlying, connected paramiko SFTPClient object
see http://paramiko-docs.readthedocs.org/en/latest/api/sftp.html
:params: None
:returns: (obj) the active SFTPClient object
"""
self._sftp_connect()
return self._sftp
@property
def active_ciphers(self):
"""Get tuple of currently used local and remote ciphers.
:returns:
(tuple of str) currently used ciphers (local_cipher,
remote_cipher)
"""
return self._transport.local_cipher, self._transport.remote_cipher
@property
def active_compression(self):
"""Get tuple of currently used local and remote compression.
:returns:
(tuple of str) currently used compression (local_compression,
remote_compression)
"""
localc = self._transport.local_compression
remotec = self._transport.remote_compression
return localc, remotec
@property
def security_options(self):
"""return the available security options recognized by paramiko.
:returns:
(obj) security preferences of the ssh transport. These are tuples
of acceptable `.ciphers`, `.digests`, `.key_types`, and key
exchange algorithms `.kex`, listed in order of preference.
"""
return self._transport.get_security_options()
@property
def logfile(self):
'''return the name of the file used for logging or False it not logging
:returns: (str)logfile or (bool) False
'''
return self._cnopts.log
@property
def timeout(self):
''' (float|None) *Default: None* -
get or set the underlying socket timeout for pending read/write
ops.
:returns:
(float|None) seconds to wait for a pending read/write operation
before raising socket.timeout, or None for no timeout
'''
self._sftp_connect()
channel = self._sftp.get_channel()
return channel.gettimeout()
@timeout.setter
def timeout(self, val):
'''setter for timeout'''
self._sftp_connect()
channel = self._sftp.get_channel()
channel.settimeout(val)
@property
def remote_server_key(self):
'''return the remote server's key'''
return self._transport.get_remote_server_key()
def __del__(self):
"""Attempt to clean up if not explicitly closed."""
self.close()
def __enter__(self):
return self
def __exit__(self, etype, value, traceback):
self.close()
|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1DeleteOptions(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'api_version': 'str',
'grace_period_seconds': 'int',
'kind': 'str',
'orphan_dependents': 'bool',
'preconditions': 'V1Preconditions',
'propagation_policy': 'str'
}
attribute_map = {
'api_version': 'apiVersion',
'grace_period_seconds': 'gracePeriodSeconds',
'kind': 'kind',
'orphan_dependents': 'orphanDependents',
'preconditions': 'preconditions',
'propagation_policy': 'propagationPolicy'
}
def __init__(self, api_version=None, grace_period_seconds=None, kind=None, orphan_dependents=None, preconditions=None, propagation_policy=None):
"""
V1DeleteOptions - a model defined in Swagger
"""
self._api_version = None
self._grace_period_seconds = None
self._kind = None
self._orphan_dependents = None
self._preconditions = None
self._propagation_policy = None
self.discriminator = None
if api_version is not None:
self.api_version = api_version
if grace_period_seconds is not None:
self.grace_period_seconds = grace_period_seconds
if kind is not None:
self.kind = kind
if orphan_dependents is not None:
self.orphan_dependents = orphan_dependents
if preconditions is not None:
self.preconditions = preconditions
if propagation_policy is not None:
self.propagation_policy = propagation_policy
@property
def api_version(self):
"""
Gets the api_version of this V1DeleteOptions.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
:return: The api_version of this V1DeleteOptions.
:rtype: str
"""
return self._api_version
@api_version.setter
def api_version(self, api_version):
"""
Sets the api_version of this V1DeleteOptions.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
:param api_version: The api_version of this V1DeleteOptions.
:type: str
"""
self._api_version = api_version
@property
def grace_period_seconds(self):
"""
Gets the grace_period_seconds of this V1DeleteOptions.
The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
:return: The grace_period_seconds of this V1DeleteOptions.
:rtype: int
"""
return self._grace_period_seconds
@grace_period_seconds.setter
def grace_period_seconds(self, grace_period_seconds):
"""
Sets the grace_period_seconds of this V1DeleteOptions.
The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
:param grace_period_seconds: The grace_period_seconds of this V1DeleteOptions.
:type: int
"""
self._grace_period_seconds = grace_period_seconds
@property
def kind(self):
"""
Gets the kind of this V1DeleteOptions.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
:return: The kind of this V1DeleteOptions.
:rtype: str
"""
return self._kind
@kind.setter
def kind(self, kind):
"""
Sets the kind of this V1DeleteOptions.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
:param kind: The kind of this V1DeleteOptions.
:type: str
"""
self._kind = kind
@property
def orphan_dependents(self):
"""
Gets the orphan_dependents of this V1DeleteOptions.
Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
:return: The orphan_dependents of this V1DeleteOptions.
:rtype: bool
"""
return self._orphan_dependents
@orphan_dependents.setter
def orphan_dependents(self, orphan_dependents):
"""
Sets the orphan_dependents of this V1DeleteOptions.
Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
:param orphan_dependents: The orphan_dependents of this V1DeleteOptions.
:type: bool
"""
self._orphan_dependents = orphan_dependents
@property
def preconditions(self):
"""
Gets the preconditions of this V1DeleteOptions.
Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.
:return: The preconditions of this V1DeleteOptions.
:rtype: V1Preconditions
"""
return self._preconditions
@preconditions.setter
def preconditions(self, preconditions):
"""
Sets the preconditions of this V1DeleteOptions.
Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.
:param preconditions: The preconditions of this V1DeleteOptions.
:type: V1Preconditions
"""
self._preconditions = preconditions
@property
def propagation_policy(self):
"""
Gets the propagation_policy of this V1DeleteOptions.
Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
:return: The propagation_policy of this V1DeleteOptions.
:rtype: str
"""
return self._propagation_policy
@propagation_policy.setter
def propagation_policy(self, propagation_policy):
"""
Sets the propagation_policy of this V1DeleteOptions.
Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
:param propagation_policy: The propagation_policy of this V1DeleteOptions.
:type: str
"""
self._propagation_policy = propagation_policy
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, V1DeleteOptions):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
|
"""Manage creation of schema."""
from __future__ import annotations
import sys
import logging
import operator
from pathlib import Path
from typing import Union, List, Dict, Any
from ruamel.yaml import YAML # type: ignore[import]
from ruamel.yaml.comments import CommentedMap, CommentedSeq # type: ignore[import]
from schema import Schema, SchemaError, Or, Optional # type: ignore[import]
from .tools import MAX_DATE_STR
from .schema_tags import Tags, OutputTags, BuildTags, LangTags
log = logging.getLogger("GHC")
SCHEMA_FILE = Path(__file__).parent.parent / "schema" / "schema.yml"
class SchemaManager:
"""Manage schema creation."""
GenericListType = List[Union[Any, Dict[str, Any], List[Any]]]
GenericDictType = Dict[str, Union[Any, Dict[str, Any], List[Any]]]
def __init__(self: SchemaManager, file_name: Path):
"""Create a schema for my tests."""
injection_schema = {
Tags.INJECT_SOURCE_TAG: str,
Tags.INJECT_DESTINATION_TAG: str,
}
test_schema = {
Tags.NAME_TAG: str,
Optional(Tags.INPUT_TAG): str,
Optional(Tags.INJECT_FOLDER_TAG): [injection_schema],
Optional(Tags.RUN_GTESTS_TAG, default=False): bool,
Optional(Tags.EXPECTED_OUTPUT_TAG): Or(str, float, int),
Optional(Tags.TIMEOUT_TAG, default=60): float,
}
task_schema = {
Tags.NAME_TAG: str,
Tags.LANGUAGE_TAG: Or(LangTags.CPP, LangTags.BASH),
Tags.FOLDER_TAG: str,
Optional(Tags.OUTPUT_TYPE_TAG, default=OutputTags.STRING): Or(
OutputTags.STRING, OutputTags.NUMBER
),
Optional(Tags.COMPILER_FLAGS_TAG, default="-Wall"): str,
Optional(Tags.BINARY_NAME_TAG, default="main"): str,
Optional(Tags.PIPE_TAG, default=""): str,
Optional(Tags.BUILD_TYPE_TAG, default=BuildTags.CMAKE): Or(
BuildTags.CMAKE, BuildTags.SIMPLE
),
Optional(Tags.BUILD_TIMEOUT_TAG, default=60): float,
Optional(Tags.TESTS_TAG): [test_schema],
}
homework_schema = {
Tags.NAME_TAG: str,
Tags.FOLDER_TAG: str,
Optional(Tags.DEADLINE_TAG, default=MAX_DATE_STR): str,
Tags.TASKS_TAG: [task_schema],
}
self.__schema = Schema(
{
Tags.FOLDER_TAG: str,
Tags.HOMEWORKS_TAG: [homework_schema],
}
)
yaml = YAML()
# big enough value to prevent wrapping
yaml.width = 4096 # type: ignore[assignment]
yaml.explicit_start = True # type: ignore[assignment]
yaml.indent(mapping=2, sequence=4, offset=2)
with open(file_name, "r") as stream:
contents = SchemaManager.__to_simple_dict(yaml.load(stream))
try:
self.__validated_yaml = self.__schema.validate(contents)
except SchemaError as exc:
sys.exit(exc.code)
# Write the schema every time we run this code while developing. We
# don't want to run this when the package is installed as this we won't
# have the permission. This is intended to keep the schema file up to
# date when we add new stuff to it.
try:
with open(SCHEMA_FILE, "w") as outfile:
str_dict = SchemaManager.__sanitize_value(self.__schema._schema)
yaml.dump(str_dict, outfile)
except OSError:
log.debug("Cannot write schema file. We only use this while developing.")
@staticmethod
def __to_simple_list(
commented_seq: List[Union[Any, CommentedSeq, CommentedMap]]
) -> SchemaManager.GenericListType:
simple_list: SchemaManager.GenericListType = []
for value in commented_seq:
if isinstance(value, CommentedSeq):
simple_list.append(SchemaManager.__to_simple_list(value))
elif isinstance(value, CommentedMap):
simple_list.append(SchemaManager.__to_simple_dict(value))
else:
simple_list.append(value)
return simple_list
@staticmethod
def __to_simple_dict(
commented_map: Dict[str, Union[Any, CommentedSeq, CommentedMap]],
) -> SchemaManager.GenericDictType:
simple_dict: SchemaManager.GenericDictType = {}
for key, value in commented_map.items():
if isinstance(value, CommentedMap):
simple_dict[key] = SchemaManager.__to_simple_dict(value)
elif isinstance(value, CommentedSeq):
simple_dict[key] = SchemaManager.__to_simple_list(value)
else:
simple_dict[key] = value
return simple_dict
@property
def validated_yaml(self) -> dict:
"""Return validated yaml."""
return self.__validated_yaml
@property
def schema(self):
"""Return schema."""
return self.__schema
# pylint: disable=R0911
# This method needs this many returns.
@staticmethod
def __sanitize_value(input_var: Union[dict, Optional, Or, Any]):
"""Use the schema and create an example file from it."""
# pylint: disable=W0212
# This seems to be the only way to get to schema value.
if isinstance(input_var, dict):
new_dict = {}
for key, val in input_var.items():
new_dict[
SchemaManager.__sanitize_value(key)
] = SchemaManager.__sanitize_value(val)
return CommentedMap(sorted(new_dict.items(), key=operator.itemgetter(0)))
if isinstance(input_var, list):
new_list = []
for val in input_var:
new_list.append(SchemaManager.__sanitize_value(val))
return new_list
if isinstance(input_var, Optional):
if input_var._schema == Tags.DEADLINE_TAG:
return SchemaManager.__sanitize_value(input_var._schema)
return "~[optional]~ " + SchemaManager.__sanitize_value(input_var._schema)
if isinstance(input_var, Or):
return "Any of " + str(
[SchemaManager.__sanitize_value(s) for s in input_var._args]
)
if input_var is str:
return "String value"
if input_var is float:
return "Float value"
if input_var is int:
return "Int value"
if input_var is bool:
return "Boolean value"
return str(input_var)
|
#Import Libraries
from sklearn.preprocessing import MaxAbsScaler
#----------------------------------------------------
#MaxAbsScaler Data
scaler = MaxAbsScaler(copy=True)
X = scaler.fit_transform(X)
#showing data
print('X \n' , X[:10])
print('y \n' , y[:10]) |
import Framebuffer from './framebuffer';
import Texture from './texture';
import Sampler from './sampler';
import { formatValue, log } from '../utils';
import assert from '../utils/assert'; // Local constants, will be "collapsed" during minification
// WebGL1
const GL_FLOAT = 0x1406;
const GL_FLOAT_VEC2 = 0x8B50;
const GL_FLOAT_VEC3 = 0x8B51;
const GL_FLOAT_VEC4 = 0x8B52;
const GL_INT = 0x1404;
const GL_INT_VEC2 = 0x8B53;
const GL_INT_VEC3 = 0x8B54;
const GL_INT_VEC4 = 0x8B55;
const GL_BOOL = 0x8B56;
const GL_BOOL_VEC2 = 0x8B57;
const GL_BOOL_VEC3 = 0x8B58;
const GL_BOOL_VEC4 = 0x8B59;
const GL_FLOAT_MAT2 = 0x8B5A;
const GL_FLOAT_MAT3 = 0x8B5B;
const GL_FLOAT_MAT4 = 0x8B5C;
const GL_SAMPLER_2D = 0x8B5E;
const GL_SAMPLER_CUBE = 0x8B60; // WebGL2
const GL_UNSIGNED_INT = 0x1405;
const GL_UNSIGNED_INT_VEC2 = 0x8DC6;
const GL_UNSIGNED_INT_VEC3 = 0x8DC7;
const GL_UNSIGNED_INT_VEC4 = 0x8DC8;
/* eslint-disable camelcase */
const GL_FLOAT_MAT2x3 = 0x8B65;
const GL_FLOAT_MAT2x4 = 0x8B66;
const GL_FLOAT_MAT3x2 = 0x8B67;
const GL_FLOAT_MAT3x4 = 0x8B68;
const GL_FLOAT_MAT4x2 = 0x8B69;
const GL_FLOAT_MAT4x3 = 0x8B6A;
const GL_SAMPLER_3D = 0x8B5F;
const GL_SAMPLER_2D_SHADOW = 0x8B62;
const GL_SAMPLER_2D_ARRAY = 0x8DC1;
const GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
const GL_SAMPLER_CUBE_SHADOW = 0x8DC5;
const GL_INT_SAMPLER_2D = 0x8DCA;
const GL_INT_SAMPLER_3D = 0x8DCB;
const GL_INT_SAMPLER_CUBE = 0x8DCC;
const GL_INT_SAMPLER_2D_ARRAY = 0x8DCF;
const GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2;
const GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3;
const GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
const GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
const UNIFORM_SETTERS = {
// WEBGL1
/* eslint-disable max-len */
[GL_FLOAT]: (gl, location, value) => gl.uniform1f(location, value),
[GL_FLOAT_VEC2]: (gl, location, value) => gl.uniform2fv(location, toFloatArray(value, 2)),
[GL_FLOAT_VEC3]: (gl, location, value) => gl.uniform3fv(location, toFloatArray(value, 3)),
[GL_FLOAT_VEC4]: (gl, location, value) => gl.uniform4fv(location, toFloatArray(value, 4)),
[GL_INT]: (gl, location, value) => gl.uniform1i(location, value),
[GL_INT_VEC2]: (gl, location, value) => gl.uniform2iv(location, toIntArray(value, 2)),
[GL_INT_VEC3]: (gl, location, value) => gl.uniform3iv(location, toIntArray(value, 3)),
[GL_INT_VEC4]: (gl, location, value) => gl.uniform4iv(location, toIntArray(value, 4)),
[GL_BOOL]: (gl, location, value) => gl.uniform1i(location, value),
[GL_BOOL_VEC2]: (gl, location, value) => gl.uniform2iv(location, toIntArray(value, 2)),
[GL_BOOL_VEC3]: (gl, location, value) => gl.uniform3iv(location, toIntArray(value, 3)),
[GL_BOOL_VEC4]: (gl, location, value) => gl.uniform4iv(location, toIntArray(value, 4)),
// uniformMatrix(false): don't transpose the matrix
[GL_FLOAT_MAT2]: (gl, location, value) => gl.uniformMatrix2fv(location, false, toFloatArray(value, 4)),
[GL_FLOAT_MAT3]: (gl, location, value) => gl.uniformMatrix3fv(location, false, toFloatArray(value, 9)),
[GL_FLOAT_MAT4]: (gl, location, value) => gl.uniformMatrix4fv(location, false, toFloatArray(value, 16)),
[GL_SAMPLER_2D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_SAMPLER_CUBE]: (gl, location, value) => gl.uniform1i(location, value),
// WEBGL2 - unsigned integers, irregular matrices, additional texture samplers
[GL_UNSIGNED_INT]: (gl, location, value) => gl.uniform1ui(location, value),
[GL_UNSIGNED_INT_VEC2]: (gl, location, value) => gl.uniform2uiv(location, toUIntArray(value, 2)),
[GL_UNSIGNED_INT_VEC3]: (gl, location, value) => gl.uniform3uiv(location, toUIntArray(value, 3)),
[GL_UNSIGNED_INT_VEC4]: (gl, location, value) => gl.uniform4uiv(location, toUIntArray(value, 4)),
// uniformMatrix(false): don't transpose the matrix
[GL_FLOAT_MAT2x3]: (gl, location, value) => gl.uniformMatrix2x3fv(location, false, toFloatArray(value, 6)),
[GL_FLOAT_MAT2x4]: (gl, location, value) => gl.uniformMatrix2x4fv(location, false, toFloatArray(value, 8)),
[GL_FLOAT_MAT3x2]: (gl, location, value) => gl.uniformMatrix3x2fv(location, false, toFloatArray(value, 6)),
[GL_FLOAT_MAT3x4]: (gl, location, value) => gl.uniformMatrix3x4fv(location, false, toFloatArray(value, 12)),
[GL_FLOAT_MAT4x2]: (gl, location, value) => gl.uniformMatrix4x2fv(location, false, toFloatArray(value, 8)),
[GL_FLOAT_MAT4x3]: (gl, location, value) => gl.uniformMatrix4x3fv(location, false, toFloatArray(value, 12)),
[GL_SAMPLER_3D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_SAMPLER_2D_SHADOW]: (gl, location, value) => gl.uniform1i(location, value),
[GL_SAMPLER_2D_ARRAY]: (gl, location, value) => gl.uniform1i(location, value),
[GL_SAMPLER_2D_ARRAY_SHADOW]: (gl, location, value) => gl.uniform1i(location, value),
[GL_SAMPLER_CUBE_SHADOW]: (gl, location, value) => gl.uniform1i(location, value),
[GL_INT_SAMPLER_2D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_INT_SAMPLER_3D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_INT_SAMPLER_CUBE]: (gl, location, value) => gl.uniform1i(location, value),
[GL_INT_SAMPLER_2D_ARRAY]: (gl, location, value) => gl.uniform1i(location, value),
[GL_UNSIGNED_INT_SAMPLER_2D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_UNSIGNED_INT_SAMPLER_3D]: (gl, location, value) => gl.uniform1i(location, value),
[GL_UNSIGNED_INT_SAMPLER_CUBE]: (gl, location, value) => gl.uniform1i(location, value),
[GL_UNSIGNED_INT_SAMPLER_2D_ARRAY]: (gl, location, value) => gl.uniform1i(location, value)
/* eslint-enable max-len */
}; // Pre-allocated typed arrays for temporary conversion
const FLOAT_ARRAY = {};
const INT_ARRAY = {};
const UINT_ARRAY = {};
/* Functions to ensure the type of uniform values */
function toTypedArray(value, uniformLength, Type, cache) {
const length = value.length;
if (length % uniformLength) {
log.warn(`Uniform size should be multiples of ${uniformLength}`, value)();
}
if (value instanceof Type) {
return value;
}
let result = cache[length];
if (!result) {
result = new Type(length);
cache[length] = result;
}
for (let i = 0; i < length; i++) {
result[i] = value[i];
}
return result;
}
function toFloatArray(value, uniformLength) {
return toTypedArray(value, uniformLength, Float32Array, FLOAT_ARRAY);
}
function toIntArray(value, uniformLength) {
return toTypedArray(value, uniformLength, Int32Array, INT_ARRAY);
}
function toUIntArray(value, uniformLength) {
return toTypedArray(value, uniformLength, Uint32Array, UINT_ARRAY);
}
export function parseUniformName(name) {
// name = name[name.length - 1] === ']' ?
// name.substr(0, name.length - 3) : name;
// if array name then clean the array brackets
const UNIFORM_NAME_REGEXP = /([^\[]*)(\[[0-9]+\])?/;
const matches = name.match(UNIFORM_NAME_REGEXP);
if (!matches || matches.length < 2) {
throw new Error(`Failed to parse GLSL uniform name ${name}`);
}
return {
name: matches[1],
length: matches[2] || 1,
isArray: Boolean(matches[2])
};
} // Returns a Magic Uniform Setter
/* eslint-disable complexity */
export function getUniformSetter(gl, location, info) {
const setter = UNIFORM_SETTERS[info.type];
if (!setter) {
throw new Error(`Unknown GLSL uniform type ${info.type}`);
}
return setter.bind(null, gl, location);
} // Basic checks of uniform values without knowledge of program
// To facilitate early detection of e.g. undefined values in JavaScript
export function checkUniformValues(uniforms, source) {
for (const uniformName in uniforms) {
const value = uniforms[uniformName];
if (!checkUniformValue(value)) {
// Add space to source
source = source ? `${source} ` : ''; // Value could be unprintable so write the object on console
console.error(`${source} Bad uniform ${uniformName}`, value); // eslint-disable-line
/* eslint-enable no-console */
throw new Error(`${source} Bad uniform ${uniformName}`);
}
}
return true;
} // TODO use type information during validation
function checkUniformValue(value) {
if (Array.isArray(value) || ArrayBuffer.isView(value)) {
return checkUniformArray(value);
} // Check if single value is a number
if (isFinite(value)) {
return true;
} else if (value === true || value === false) {
return true;
} else if (value instanceof Texture || value instanceof Sampler) {
return true;
} else if (value instanceof Framebuffer) {
return Boolean(value.texture);
}
return false;
}
function checkUniformArray(value) {
// Check that every element in array is a number, and at least 1 element
if (value.length === 0) {
return false;
}
const checkLength = Math.min(value.length, 16);
for (let i = 0; i < checkLength; ++i) {
if (!Number.isFinite(value[i])) {
return false;
}
}
return true;
}
/**
* Given two values of a uniform, returns `true` if they are equal
*/
export function areUniformsEqual(uniform1, uniform2) {
if (Array.isArray(uniform1) || ArrayBuffer.isView(uniform1)) {
if (!uniform2) {
return false;
}
const len = uniform1.length;
if (uniform2.length !== len) {
return false;
}
for (let i = 0; i < len; i++) {
if (uniform1[i] !== uniform2[i]) {
return false;
}
}
return true;
}
return uniform1 === uniform2;
} // Prepares a table suitable for console.table
/* eslint-disable max-statements */
export function getUniformsTable({
header = 'Uniforms',
program,
uniforms,
undefinedOnly = false
} = {}) {
assert(program);
const SHADER_MODULE_UNIFORM_REGEXP = '.*_.*';
const PROJECT_MODULE_UNIFORM_REGEXP = '.*Matrix'; // TODO - Use explicit list
const uniformLocations = program._uniformSetters;
const table = {}; // {[header]: {}};
// Add program's provided uniforms (in alphabetical order)
const uniformNames = Object.keys(uniformLocations).sort();
let count = 0; // First add non-underscored uniforms (assumed not coming from shader modules)
for (const uniformName of uniformNames) {
if (!uniformName.match(SHADER_MODULE_UNIFORM_REGEXP) && !uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
if (addUniformToTable({
table,
header,
uniforms,
uniformName,
undefinedOnly
})) {
count++;
}
}
} // add underscored uniforms (assumed from shader modules)
for (const uniformName of uniformNames) {
if (uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
if (addUniformToTable({
table,
header,
uniforms,
uniformName,
undefinedOnly
})) {
count++;
}
}
}
for (const uniformName of uniformNames) {
if (!table[uniformName]) {
if (addUniformToTable({
table,
header,
uniforms,
uniformName,
undefinedOnly
})) {
count++;
}
}
} // Create a table of unused uniforms
let unusedCount = 0;
const unusedTable = {};
if (!undefinedOnly) {
for (const uniformName in uniforms) {
const uniform = uniforms[uniformName];
if (!table[uniformName]) {
unusedCount++;
unusedTable[uniformName] = {
Type: `NOT USED: ${uniform}`,
[header]: formatValue(uniform)
};
}
}
}
return {
table,
count,
unusedTable,
unusedCount
};
} // Helper
function addUniformToTable({
table,
header,
uniforms,
uniformName,
undefinedOnly
}) {
const value = uniforms[uniformName];
const isDefined = isUniformDefined(value);
if (!undefinedOnly || !isDefined) {
table[uniformName] = {
// Add program's unprovided uniforms
[header]: isDefined ? formatValue(value) : 'N/A',
'Uniform Type': isDefined ? value : 'NOT PROVIDED'
};
return true;
}
return false;
}
function isUniformDefined(value) {
return value !== undefined && value !== null;
}
//# sourceMappingURL=uniforms.js.map |
##############################################################################
#
# Copyright (c) 2002-2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import re
from cgi import FieldStorage, escape
from ZPublisher.Converters import get_converter
from ZPublisher.HTTPRequest import *
from z3c.soap.interfaces import ISOAPRequest
from ZPublisher.TaintedString import TaintedString
from zope.interface import directlyProvides
xmlrpc=None # Placeholder for module that we'll import if we have to.
soap=None
def processInputs(
self,
# "static" variables that we want to be local for speed
SEQUENCE=1,
DEFAULT=2,
RECORD=4,
RECORDS=8,
REC=12, # RECORD | RECORDS
EMPTY=16,
CONVERTED=32,
hasattr=hasattr,
getattr=getattr,
setattr=setattr,
search_type=re.compile('(:[a-zA-Z][-a-zA-Z0-9_]+|\\.[xy])$').search,
):
"""Process request inputs
We need to delay input parsing so that it is done under
publisher control for error handling purposes.
"""
response = self.response
environ = self.environ
method = environ.get('REQUEST_METHOD','GET')
if method != 'GET':
fp = self.stdin
else:
fp = None
form = self.form
other = self.other
taintedform = self.taintedform
# If 'QUERY_STRING' is not present in environ
# FieldStorage will try to get it from sys.argv[1]
# which is not what we need.
if 'QUERY_STRING' not in environ:
environ['QUERY_STRING'] = ''
meth = None
fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1)
if not hasattr(fs,'list') or fs.list is None:
# XXX begin monkeypatch
contentType = None
if fs.headers.has_key('content-type'):
contentType = fs.headers['content-type']
# cut off a possible charset definition
if contentType.find(';') >= 0:
contentType = contentType[0:contentType.find(';')]
# Hm, maybe it's an SOAP
# SOAP 1.1 has HTTP SOAPAction Field
# SOAP 1.2 has Content-Type application/soap+xml
#
# found a Content-Type of text/xml-SOAP on a Microsoft page
# this page points 3 HTTP-Fields for SOAP Requests:
# MethodName, InterfaceName (opt) and MessageCall
#
if (environ.has_key('HTTP_SOAPACTION') or
(contentType in ['application/soap+xml',
'text/xml',
'text/xml-SOAP']) and fs.value.find('SOAP-ENV:Body') > 0):
global soap
if soap is None:
import soap
fp.seek(0)
directlyProvides(self, ISOAPRequest)
sparser = soap.SOAPParser(fp.read())
meth = sparser.method
self.args = sparser.parse()
response = soap.SOAPResponse(response)
response._soap11 = environ.has_key('HTTP_SOAPACTION')
response._soap12 = (contentType == 'application/soap+xml')
response._contentType = contentType
response._method = meth
response._error_format = 'text/xml'
other['RESPONSE'] = self.response = response
other['REQUEST_METHOD'] = method
self.maybe_webdav_client = 0
# XXX end monkeypatch
# Stash XML request for interpretation by a SOAP-aware view
other['SOAPXML'] = fs.value
# Hm, maybe it's an XML-RPC
elif ('content-type' in fs.headers and
'text/xml' in fs.headers['content-type'] and
method == 'POST'):
# Ye haaa, XML-RPC!
global xmlrpc
if xmlrpc is None:
from ZPublisher import xmlrpc
meth, self.args = xmlrpc.parse_input(fs.value)
response = xmlrpc.response(response)
other['RESPONSE'] = self.response = response
self.maybe_webdav_client = 0
else:
self._file = fs.file
else:
fslist = fs.list
tuple_items = {}
lt = type([])
CGI_name = isCGI_NAMEs
defaults = {}
tainteddefaults = {}
converter = None
for item in fslist:
isFileUpload = 0
key = item.name
if (hasattr(item,'file') and hasattr(item,'filename')
and hasattr(item,'headers')):
if (item.file and
(item.filename is not None
# RFC 1867 says that all fields get a content-type.
# or 'content-type' in map(lower, item.headers.keys())
)):
item = FileUpload(item)
isFileUpload = 1
else:
item = item.value
flags = 0
character_encoding = ''
# Variables for potentially unsafe values.
tainted = None
converter_type = None
# Loop through the different types and set
# the appropriate flags
# We'll search from the back to the front.
# We'll do the search in two steps. First, we'll
# do a string search, and then we'll check it with
# a re search.
l = key.rfind(':')
if l >= 0:
mo = search_type(key,l)
if mo:
l = mo.start(0)
else:
l = -1
while l >= 0:
type_name = key[l+1:]
key = key[:l]
c = get_converter(type_name, None)
if c is not None:
converter = c
converter_type = type_name
flags = flags | CONVERTED
elif type_name == 'list':
flags = flags | SEQUENCE
elif type_name == 'tuple':
tuple_items[key] = 1
flags = flags | SEQUENCE
elif (type_name == 'method' or type_name == 'action'):
if l:
meth = key
else:
meth = item
elif (type_name == 'default_method' or type_name == \
'default_action'):
if not meth:
if l:
meth = key
else:
meth = item
elif type_name == 'default':
flags = flags | DEFAULT
elif type_name == 'record':
flags = flags | RECORD
elif type_name == 'records':
flags = flags | RECORDS
elif type_name == 'ignore_empty':
if not item:
flags = flags | EMPTY
elif has_codec(type_name):
character_encoding = type_name
l = key.rfind(':')
if l < 0:
break
mo = search_type(key,l)
if mo:
l = mo.start(0)
else:
l = -1
# Filter out special names from form:
if key in CGI_name or key[:5] == 'HTTP_':
continue
# If the key is tainted, mark it so as well.
tainted_key = key
if '<' in key:
tainted_key = TaintedString(key)
if flags:
# skip over empty fields
if flags & EMPTY:
continue
#Split the key and its attribute
if flags & REC:
key = key.split(".")
key, attr = ".".join(key[:-1]), key[-1]
# Update the tainted_key if necessary
tainted_key = key
if '<' in key:
tainted_key = TaintedString(key)
# Attributes cannot hold a <.
if '<' in attr:
raise ValueError(
"%s is not a valid record attribute name" %
escape(attr))
# defer conversion
if flags & CONVERTED:
try:
if character_encoding:
# We have a string with a specified character
# encoding. This gets passed to the converter
# either as unicode, if it can handle it, or
# crunched back down to latin-1 if it can not.
item = unicode(item,character_encoding)
if hasattr(converter,'convert_unicode'):
item = converter.convert_unicode(item)
else:
item = converter(
item.encode(default_encoding))
else:
item = converter(item)
# Flag potentially unsafe values
if converter_type in ('string', 'required', 'text',
'ustring', 'utext'):
if not isFileUpload and '<' in item:
tainted = TaintedString(item)
elif converter_type in ('tokens', 'lines',
'utokens', 'ulines'):
is_tainted = 0
tainted = item[:]
for i in range(len(tainted)):
if '<' in tainted[i]:
is_tainted = 1
tainted[i] = TaintedString(tainted[i])
if not is_tainted:
tainted = None
except:
if (not item and not (flags & DEFAULT) and
key in defaults):
item = defaults[key]
if flags & RECORD:
item = getattr(item,attr)
if flags & RECORDS:
item = getattr(item[-1], attr)
if tainted_key in tainteddefaults:
tainted = tainteddefaults[tainted_key]
if flags & RECORD:
tainted = getattr(tainted, attr)
if flags & RECORDS:
tainted = getattr(tainted[-1], attr)
else:
raise
elif not isFileUpload and '<' in item:
# Flag potentially unsafe values
tainted = TaintedString(item)
# If the key is tainted, we need to store stuff in the
# tainted dict as well, even if the value is safe.
if '<' in tainted_key and tainted is None:
tainted = item
#Determine which dictionary to use
if flags & DEFAULT:
mapping_object = defaults
tainted_mapping = tainteddefaults
else:
mapping_object = form
tainted_mapping = taintedform
#Insert in dictionary
if key in mapping_object:
if flags & RECORDS:
#Get the list and the last record
#in the list. reclist is mutable.
reclist = mapping_object[key]
x = reclist[-1]
if tainted:
# Store a tainted copy as well
if tainted_key not in tainted_mapping:
tainted_mapping[tainted_key] = deepcopy(
reclist)
treclist = tainted_mapping[tainted_key]
lastrecord = treclist[-1]
if not hasattr(lastrecord, attr):
if flags & SEQUENCE:
tainted = [tainted]
setattr(lastrecord, attr, tainted)
else:
if flags & SEQUENCE:
getattr(lastrecord,
attr).append(tainted)
else:
newrec = record()
setattr(newrec, attr, tainted)
treclist.append(newrec)
elif tainted_key in tainted_mapping:
# If we already put a tainted value into this
# recordset, we need to make sure the whole
# recordset is built.
treclist = tainted_mapping[tainted_key]
lastrecord = treclist[-1]
copyitem = item
if not hasattr(lastrecord, attr):
if flags & SEQUENCE:
copyitem = [copyitem]
setattr(lastrecord, attr, copyitem)
else:
if flags & SEQUENCE:
getattr(lastrecord,
attr).append(copyitem)
else:
newrec = record()
setattr(newrec, attr, copyitem)
treclist.append(newrec)
if not hasattr(x,attr):
#If the attribute does not
#exist, setit
if flags & SEQUENCE:
item = [item]
setattr(x,attr,item)
else:
if flags & SEQUENCE:
# If the attribute is a
# sequence, append the item
# to the existing attribute
y = getattr(x, attr)
y.append(item)
setattr(x, attr, y)
else:
# Create a new record and add
# it to the list
n = record()
setattr(n,attr,item)
mapping_object[key].append(n)
elif flags & RECORD:
b = mapping_object[key]
if flags & SEQUENCE:
item = [item]
if not hasattr(b, attr):
# if it does not have the
# attribute, set it
setattr(b, attr, item)
else:
# it has the attribute so
# append the item to it
setattr(b, attr, getattr(b, attr) + item)
else:
# it is not a sequence so
# set the attribute
setattr(b, attr, item)
# Store a tainted copy as well if necessary
if tainted:
if tainted_key not in tainted_mapping:
tainted_mapping[tainted_key] = deepcopy(
mapping_object[key])
b = tainted_mapping[tainted_key]
if flags & SEQUENCE:
seq = getattr(b, attr, [])
seq.append(tainted)
setattr(b, attr, seq)
else:
setattr(b, attr, tainted)
elif tainted_key in tainted_mapping:
# If we already put a tainted value into this
# record, we need to make sure the whole record
# is built.
b = tainted_mapping[tainted_key]
if flags & SEQUENCE:
seq = getattr(b, attr, [])
seq.append(item)
setattr(b, attr, seq)
else:
setattr(b, attr, item)
else:
# it is not a record or list of records
found = mapping_object[key]
if tainted:
# Store a tainted version if necessary
if tainted_key not in tainted_mapping:
copied = deepcopy(found)
if isinstance(copied, lt):
tainted_mapping[tainted_key] = copied
else:
tainted_mapping[tainted_key] = [copied]
tainted_mapping[tainted_key].append(tainted)
elif tainted_key in tainted_mapping:
# We may already have encountered a tainted
# value for this key, and the tainted_mapping
# needs to hold all the values.
tfound = tainted_mapping[tainted_key]
if isinstance(tfound, lt):
tainted_mapping[tainted_key].append(item)
else:
tainted_mapping[tainted_key] = [tfound,
item]
if type(found) is lt:
found.append(item)
else:
found = [found,item]
mapping_object[key] = found
else:
# The dictionary does not have the key
if flags & RECORDS:
# Create a new record, set its attribute
# and put it in the dictionary as a list
a = record()
if flags & SEQUENCE:
item = [item]
setattr(a,attr,item)
mapping_object[key] = [a]
if tainted:
# Store a tainted copy if necessary
a = record()
if flags & SEQUENCE:
tainted = [tainted]
setattr(a, attr, tainted)
tainted_mapping[tainted_key] = [a]
elif flags & RECORD:
# Create a new record, set its attribute
# and put it in the dictionary
if flags & SEQUENCE:
item = [item]
r = mapping_object[key] = record()
setattr(r,attr,item)
if tainted:
# Store a tainted copy if necessary
if flags & SEQUENCE:
tainted = [tainted]
r = tainted_mapping[tainted_key] = record()
setattr(r, attr, tainted)
else:
# it is not a record or list of records
if flags & SEQUENCE:
item = [item]
mapping_object[key] = item
if tainted:
# Store a tainted copy if necessary
if flags & SEQUENCE:
tainted = [tainted]
tainted_mapping[tainted_key] = tainted
else:
# This branch is for case when no type was specified.
mapping_object = form
if not isFileUpload and '<' in item:
tainted = TaintedString(item)
elif '<' in key:
tainted = item
#Insert in dictionary
if key in mapping_object:
# it is not a record or list of records
found = mapping_object[key]
if tainted:
# Store a tainted version if necessary
if tainted_key not in taintedform:
copied = deepcopy(found)
if isinstance(copied, lt):
taintedform[tainted_key] = copied
else:
taintedform[tainted_key] = [copied]
elif not isinstance(taintedform[tainted_key], lt):
taintedform[tainted_key] = [
taintedform[tainted_key]]
taintedform[tainted_key].append(tainted)
elif tainted_key in taintedform:
# We may already have encountered a tainted value
# for this key, and the taintedform needs to hold
# all the values.
tfound = taintedform[tainted_key]
if isinstance(tfound, lt):
taintedform[tainted_key].append(item)
else:
taintedform[tainted_key] = [tfound, item]
if type(found) is lt:
found.append(item)
else:
found = [found,item]
mapping_object[key] = found
else:
mapping_object[key] = item
if tainted:
taintedform[tainted_key] = tainted
#insert defaults into form dictionary
if defaults:
for key, value in defaults.items():
tainted_key = key
if '<' in key:
tainted_key = TaintedString(key)
if key not in form:
# if the form does not have the key,
# set the default
form[key] = value
if tainted_key in tainteddefaults:
taintedform[tainted_key] = \
tainteddefaults[tainted_key]
else:
#The form has the key
tdefault = tainteddefaults.get(tainted_key, value)
if isinstance(value, record):
# if the key is mapped to a record, get the
# record
r = form[key]
# First deal with tainted defaults.
if tainted_key in taintedform:
tainted = taintedform[tainted_key]
for k, v in tdefault.__dict__.items():
if not hasattr(tainted, k):
setattr(tainted, k, v)
elif tainted_key in tainteddefaults:
# Find out if any of the tainted default
# attributes needs to be copied over.
missesdefault = 0
for k, v in tdefault.__dict__.items():
if not hasattr(r, k):
missesdefault = 1
break
if missesdefault:
tainted = deepcopy(r)
for k, v in tdefault.__dict__.items():
if not hasattr(tainted, k):
setattr(tainted, k, v)
taintedform[tainted_key] = tainted
for k, v in value.__dict__.items():
# loop through the attributes and value
# in the default dictionary
if not hasattr(r, k):
# if the form dictionary doesn't have
# the attribute, set it to the default
setattr(r,k,v)
form[key] = r
elif isinstance(value, lt):
# the default value is a list
l = form[key]
if not isinstance(l, lt):
l = [l]
# First deal with tainted copies
if tainted_key in taintedform:
tainted = taintedform[tainted_key]
if not isinstance(tainted, lt):
tainted = [tainted]
for defitem in tdefault:
if isinstance(defitem, record):
for k, v in defitem.__dict__.items():
for origitem in tainted:
if not hasattr(origitem, k):
setattr(origitem, k, v)
else:
if not defitem in tainted:
tainted.append(defitem)
taintedform[tainted_key] = tainted
elif tainted_key in tainteddefaults:
missesdefault = 0
for defitem in tdefault:
if isinstance(defitem, record):
try:
for k, v in \
defitem.__dict__.items():
for origitem in l:
if not hasattr(
origitem, k):
missesdefault = 1
raise NestedLoopExit
except NestedLoopExit:
break
else:
if not defitem in l:
missesdefault = 1
break
if missesdefault:
tainted = deepcopy(l)
for defitem in tdefault:
if isinstance(defitem, record):
for k, v in (
defitem.__dict__.items()):
for origitem in tainted:
if not hasattr(
origitem, k):
setattr(origitem, k, v)
else:
if not defitem in tainted:
tainted.append(defitem)
taintedform[tainted_key] = tainted
for x in value:
# for each x in the list
if isinstance(x, record):
# if the x is a record
for k, v in x.__dict__.items():
# loop through each
# attribute and value in
# the record
for y in l:
# loop through each
# record in the form
# list if it doesn't
# have the attributes
# in the default
# dictionary, set them
if not hasattr(y, k):
setattr(y, k, v)
else:
# x is not a record
if not x in l:
l.append(x)
form[key] = l
else:
# The form has the key, the key is not mapped
# to a record or sequence so do nothing
pass
# Convert to tuples
if tuple_items:
for key in tuple_items.keys():
# Split the key and get the attr
k = key.split( ".")
k,attr = '.'.join(k[:-1]), k[-1]
a = attr
new = ''
# remove any type_names in the attr
while not a =='':
a = a.split( ":")
a,new = ':'.join(a[:-1]), a[-1]
attr = new
if k in form:
# If the form has the split key get its value
tainted_split_key = k
if '<' in k:
tainted_split_key = TaintedString(k)
item =form[k]
if isinstance(item, record):
# if the value is mapped to a record, check if it
# has the attribute, if it has it, convert it to
# a tuple and set it
if hasattr(item,attr):
value = tuple(getattr(item,attr))
setattr(item,attr,value)
else:
# It is mapped to a list of records
for x in item:
# loop through the records
if hasattr(x, attr):
# If the record has the attribute
# convert it to a tuple and set it
value = tuple(getattr(x,attr))
setattr(x,attr,value)
# Do the same for the tainted counterpart
if tainted_split_key in taintedform:
tainted = taintedform[tainted_split_key]
if isinstance(item, record):
seq = tuple(getattr(tainted, attr))
setattr(tainted, attr, seq)
else:
for trec in tainted:
if hasattr(trec, attr):
seq = getattr(trec, attr)
seq = tuple(seq)
setattr(trec, attr, seq)
else:
# the form does not have the split key
tainted_key = key
if '<' in key:
tainted_key = TaintedString(key)
if key in form:
# if it has the original key, get the item
# convert it to a tuple
item = form[key]
item = tuple(form[key])
form[key] = item
if tainted_key in taintedform:
tainted = tuple(taintedform[tainted_key])
taintedform[tainted_key] = tainted
if meth:
if 'PATH_INFO' in environ:
path = environ['PATH_INFO']
while path[-1:] == '/':
path = path[:-1]
else:
path = ''
other['PATH_INFO'] = path = "%s/%s" % (path,meth)
self._hacked_path = 1
#XXX this monkey patch does not seems useful anymore???
HTTPRequest.processInputs = processInputs
import logging
logger = logging.getLogger('Zope')
logger.info("z3c.soap: monkeypatched ZPublisher.HTTPRequest.processInputs")
# vi:ts=4
|
/* @flow */
import type { Auth } from './apiTypes';
import messagesFlags from './messages/messagesFlags';
let unsentMessageIds = [];
let lastSentTime = 0;
export default (auth: Auth, messageIds: number[]): any => {
unsentMessageIds.push(...messageIds);
if (Date.now() - lastSentTime > 2000) {
messagesFlags(auth, unsentMessageIds, 'add', 'read');
unsentMessageIds = [];
lastSentTime = Date.now();
}
};
|
import {SWITZERLAND_RECTANGLE} from './constants.js';
import UrlTemplateImageryProvider from 'cesium/Source/Scene/UrlTemplateImageryProvider';
import ImageryLayer from 'cesium/Source/Scene/ImageryLayer';
import Credit from 'cesium/Source/Core/Credit';
import i18next from 'i18next';
import WebMapServiceImageryProvider from 'cesium/Source/Scene/WebMapServiceImageryProvider';
const wmtsLayerUrlTemplate = 'https://wmts.geo.admin.ch/1.0.0/{layer}/default/{timestamp}/3857/{z}/{x}/{y}.{format}';
/**
* @param {string} layer Layer identifier
* @param {number} [maximumLevel]
* @param {import('cesium/Source/Core/Rectangle').default} [rectangle]
* @return {Promise<ImageryLayer>}
*/
export function getSwisstopoImagery(layer, maximumLevel = 16, rectangle = SWITZERLAND_RECTANGLE) {
return new Promise((resolve, reject) => {
getLayersConfig().then(layersConfig => {
const config = layersConfig[layer];
if (config) {
let imageryProvider;
switch (config.type) {
case 'wmts': {
const url = wmtsLayerUrlTemplate
.replace('{layer}', config.serverLayerName)
.replace('{timestamp}', config.timestamps[0])
.replace('{format}', config.format);
imageryProvider = new UrlTemplateImageryProvider({
url: url,
maximumLevel: maximumLevel,
rectangle: rectangle,
credit: new Credit(config.attribution)
});
break;
}
case 'wms': {
const url = 'https://wms{s}.geo.admin.ch?version=1.3.0';
imageryProvider = new WebMapServiceImageryProvider({
url: url,
parameters: {
FORMAT: config.format,
TRANSPARENT: true,
LANG: i18next.language,
},
subdomains: '0123',
layers: config.serverLayerName,
maximumLevel: maximumLevel,
rectangle: rectangle,
credit: new Credit(config.attribution)
});
break;
}
default:
reject(`unsupported layer type: ${config.type}`);
}
const imageryLayer = new ImageryLayer(imageryProvider, {
alpha: config.opacity
});
resolve(imageryLayer);
} else {
reject(`layer not found: ${layer}`);
}
});
});
}
/**
* @param {import('cesium/Source/Scene/ImageryLayerCollection').default} collection
* @param {import('cesium/Source/Scene/ImageryLayer').default} imageryLayer
* @return {boolean}
*/
export function containsSwisstopoImagery(collection, imageryLayer) {
const url = imageryLayer.imageryProvider.url;
for (let i = 0, ii = collection.length; i < ii; i++) {
const layer = collection.get(i);
if (layer.imageryProvider.url === url) {
return true;
}
}
return false;
}
let layersConfigPromise;
/**
* @return {Promise<Object>}
*/
export function getLayersConfig() {
if (!layersConfigPromise) {
layersConfigPromise = fetch('https://map.geo.admin.ch/configs/en/layersConfig.json')
.then(response => response.json());
}
return layersConfigPromise;
}
/**
* @param {import('cesium/Source/Widgets/Viewer/Viewer').default} viewer
* @param {string} layer
* @param {'png' | 'jpeg'} format
* @param {number} maximumLevel
* @param {string} timestamp
* @return {ImageryLayer}
*/
export function addSwisstopoLayer(viewer, layer, format, maximumLevel, timestamp = 'current') {
const url = wmtsLayerUrlTemplate
.replace('{layer}', layer)
.replace('{timestamp}', timestamp)
.replace('{format}', format);
const imageryLayer = new ImageryLayer(
new UrlTemplateImageryProvider({
rectangle: SWITZERLAND_RECTANGLE,
maximumLevel: maximumLevel,
credit: new Credit('swisstopo'),
url: url
}), {
show: false
});
viewer.scene.imageryLayers.add(imageryLayer);
return imageryLayer;
}
|
import React, { Component } from 'react'
import PropTypes from "prop-types"
const btnStyle = {
background: "yellow",
color: "gray",
border: "none",
padding: "5px 15px",
borderRadius: "50%",
float: "right",
}
const btnStyleHover = {
...btnStyle, background: "red"
}
export class TodoListItem extends Component {
state = {
hover: false
}
getStyle = () =>{
//using ternary operator
return{
background: "blue",
padding: "10px",
borderBottom: "1px #ccc dotted",
textDecoration: this.props.todo.completed ?
"line-through" : "none"
}
}
//if not using arrow function will need to bind this to event
render() {
const { id, title } = this.props.todo
return (
<div style={this.getStyle()}>
<p>
<input type="checkbox" onChange={this.props.markComplete.bind(this, id)}/> {" "}
{ title }
<button onMouseEnter={()=> this.setState({hover: true})} onMouseLeave={()=> this.setState({hover: false})} onClick={this.props.delTodo.bind(this, id)} style={this.state.hover? btnStyleHover : btnStyle}>X</button>
</p>
</div>
)
}
}
TodoListItem.propTypes = {
todo: PropTypes.object.isRequired
}
export default TodoListItem
|
const nMultiPageMenu = document.querySelector('#multi-page-menu');
const nLogArea = nMultiPageMenu.querySelector('#logArea');
const nGithubIssueLink = nMultiPageMenu.querySelector('#githubIssueLink');
nMultiPageMenu.addEventListener('pageChange', (e) => {
switch (e.detail.pageId) {
case 'debug':
initDebugLog();
break;
}
});
// Select all log text when click
nLogArea.addEventListener('click', () => {
nLogArea.focus();
nLogArea.select();
});
nGithubIssueLink.addEventListener('click', () => {
// Add the last 30 log lines to the issue body
const template = '# Description\n[Please explain the problem/bug/behavior]\n\n# Log\n```\n' + nLogArea.value.split('\n').slice(-30).join('\n') + '\n```';
const issueUrl = 'https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass/issues/new?body=' + encodeURIComponent(template);
open(issueUrl, '_blank');
});
initSettings();
initErrorCount();
function initSettings() {
const nSettings = document.querySelector('[data-id="settings"]');
const nReset = nSettings.querySelector('#reset');
const defaultOptions = {
unlockNotification: true,
unlockConfirmation: true,
};
const options = { ...defaultOptions };
nSettings.addEventListener('change', ({ target }) => {
options[target.name] = target.checked;
chrome.storage.sync.set({ options });
});
nReset.addEventListener('click', () => {
Object.assign(options, defaultOptions);
chrome.storage.sync.set({ options });
resetSettings();
});
chrome.storage.sync.get('options', (data) => {
Object.assign(options, data.options);
resetSettings();
});
function resetSettings() {
for (const option in options) {
const nSetting = nSettings.querySelector(`[name=${option}]`);
if (nSetting) {
nSetting.checked = options[option];
}
}
}
}
function getLogEntries() {
return new Promise((resolve) => chrome.runtime.sendMessage({ event: 'GET_LOG_ENTRIES' }, resolve));
}
async function initDebugLog() {
const logEntries = await getLogEntries();
let logText = '';
logEntries.forEach((entry) => {
logText += `${new Date(entry.ts).toTimeString().split(' ')[0]} [${entry.isError ? 'ERROR' : 'INFO'}] ${entry.message}`;
logText += entry.isError && entry.stack ? '\n' + entry.stack.split('\n').slice(1, 2).join('\n') + '\n' : '';
logText += '\n';
});
// Set Text and scroll to bottom
nLogArea.value = logText;
nLogArea.scrollTop = nLogArea.scrollHeight;
}
async function initErrorCount() {
const errorCount = (await getLogEntries()).filter((x) => x.isError).length;
if (errorCount > 0) {
const nLabel = nMultiPageMenu.querySelector('#debugErrorWarning');
nLabel.innerText = `${errorCount} Issues`;
}
}
|
import {AmpLayout} from '#builtins/amp-layout/amp-layout';
import {buildDom} from '#builtins/amp-layout/build-dom';
import {createElementWithAttributes} from '#core/dom';
import {Layout_Enum} from '#core/dom/layout';
describes.realWin('amp-layout', {amp: true}, (env) => {
async function getAmpLayout(attrs, innerHTML) {
const {win} = env;
const ampLayout = createElementWithAttributes(
win.document,
'amp-layout',
attrs
);
ampLayout.innerHTML = innerHTML;
win.document.body.appendChild(ampLayout);
await ampLayout.buildInternal();
await ampLayout.layoutCallback();
return ampLayout;
}
it('should reparent all children under a container for when layout!=container', async () => {
const children = '<span>hello</span><span>world</span>';
const ampLayout = await getAmpLayout(
{layout: Layout_Enum.FIXED, height: 100, width: 100},
children
);
expect(ampLayout.childNodes).have.length(1);
expect(ampLayout.childNodes[0].getAttribute('class')).includes(
'i-amphtml-fill-content'
);
expect(ampLayout.childNodes[0].innerHTML).equal(children);
});
it('should noop when layout=container', async () => {
const children = '<span>hello</span><span>world</span>';
const ampLayout = await getAmpLayout({}, children);
expect(ampLayout.childNodes).have.length(2);
expect(ampLayout.innerHTML).equal(children);
});
it('buildDom and buildCallback should result in the same outerHTML', () => {
const layout1 = createElementWithAttributes(
env.win.document,
'amp-layout',
{
width: 100,
height: 100,
}
);
const layout2 = layout1.cloneNode(/* deep */ true);
new AmpLayout(layout1).buildCallback();
buildDom(layout2);
expect(layout1.outerHTML).to.equal(layout2.outerHTML);
});
it('buildDom does not modify server rendered elements', () => {
const layout = createElementWithAttributes(env.win.document, 'amp-layout');
buildDom(layout);
layout.setAttribute('i-amphtml-ssr', '');
const before = layout.outerHTML;
buildDom(layout);
const after = layout.outerHTML;
expect(before).to.equal(after);
});
});
|
module.exports = {
docs: [
{
type : 'category',
label : 'The Shared Backpack',
items : [
'About'
]
},
{
type: 'category',
label : 'Shared Backpack user app',
items :[
'Shared Backpack user app/Getting Started',
'Shared Backpack user app/Connecting People',
'Shared Backpack user app/Cheap Travel',
'Shared Backpack user app/Local References',
]
},
{
type: 'category',
label : 'Shared Backpack API',
items :[
'Shared Backpack API/Match Making',
'Shared Backpack API/Admin',
'Shared Backpack API/Mini Admin',
'Shared Backpack API/User',
]
},
{
type: 'category',
label: 'Admin Panel',
items: [
'Shared Backpack Admin Panel/User-Management',
'Shared Backpack Admin Panel/Mini-Admin-Management',
]
},
{
type: 'category',
label: 'Shared Backpack mini admin panel',
items: [
'Shared Backpack mini admin panel/mini admin panel',
]
},
],
};
|
import User from 'models/User';
import { DataTypes, QueryTypes } from 'sequelize';
import sequelize from 'utils/sequelize';
const Post = sequelize.define('Post', {
user_id: DataTypes.BIGINT,
described: DataTypes.STRING,
created: DataTypes.DATE,
modified: DataTypes.DATE,
status: DataTypes.STRING,
banned: DataTypes.STRING,
can_comment: DataTypes.BOOLEAN,
category_id: DataTypes.INTEGER,
}, {
tableName: 'posts',
timestamps: false,
});
Post.belongsTo(User, { foreignKey: 'user_id' });
Post.fuzzySearch = ({ keyword, index, count }) => sequelize.query(
`SELECT posts.id, described, posts.user_id, videos.url as video_url, videos.thumb as video_thumb
FROM posts
LEFT JOIN videos
ON posts.id = videos.post_id
WHERE :keyword % ANY(STRING_TO_ARRAY(posts.described, ' '))
LIMIT :count
OFFSET :index`,
{
type: QueryTypes.SELECT,
replacements: { keyword, index: index > 0 ? index : 0, count: count > 0 ? count : 0 },
},
);
export default Post;
|
'use strict';
const request = require('request');
const jsonPath = require('JSONPath');
const select = require('xpath.js');
const Dom = require('xmldom').DOMParser;
const fs = require('fs');
const path = require('path');
const jsonSchemaValidator = require('is-my-json-valid');
const spec = require('swagger-tools').specs.v2;
let accessToken;
const globalVariables = {};
const _xmlAttributeNodeType = 2;
const base64Encode = function(str) {
return new Buffer(str).toString('base64');
};
const getContentType = function(content) {
try {
JSON.parse(content);
return 'json';
} catch (e) {
try {
new Dom().parseFromString(content);
return 'xml';
} catch (e) {
return null;
}
}
};
const evaluateJsonPath = function(path, content) {
const contentJson = JSON.parse(content);
const evalResult = jsonPath({resultType: 'all'}, path, contentJson);
return (evalResult.length > 0) ? evalResult[0].value : null;
};
const evaluateXPath = function(path, content) {
const xmlDocument = new Dom().parseFromString(content);
const node = select(xmlDocument, path)[0];
if (node.nodeType === _xmlAttributeNodeType) {
return node.value;
}
return node.firstChild.data; // element or comment
};
const evaluatePath = function(path, content) {
const contentType = getContentType(content);
switch (contentType) {
case 'json':
return evaluateJsonPath(path, content);
case 'xml':
return evaluateXPath(path, content);
default:
return null;
}
};
const getAssertionResult = function(success, expected, actual, apickliInstance) {
return {
success,
expected,
actual,
response: {
statusCode: apickliInstance.getResponseObject().statusCode,
headers: apickliInstance.getResponseObject().headers,
body: apickliInstance.getResponseObject().body,
},
};
};
function Apickli(scheme, domain, fixturesDirectory, variableChar) {
this.domain = scheme + '://' + domain;
this.headers = {};
this.cookies = [];
this.httpResponse = {};
this.requestBody = '';
this.scenarioVariables = {};
this.fixturesDirectory = (fixturesDirectory ? fixturesDirectory : '');
this.queryParameters = {};
this.formParameters = {};
this.variableChar = (variableChar ? variableChar : '`');
}
Apickli.prototype.addRequestHeader = function(name, value) {
name = this.replaceVariables(name);
value = this.replaceVariables(value);
let valuesArray = [];
if (this.headers[name]) {
valuesArray = this.headers[name].split(',');
}
valuesArray.push(value);
this.headers[name] = valuesArray.join(',');
};
Apickli.prototype.removeRequestHeader = function(name) {
name = this.replaceVariables(name);
delete this.headers[name];
};
Apickli.prototype.setRequestHeader = function(name, value) {
this.removeRequestHeader(name);
name = this.replaceVariables(name);
value = this.replaceVariables(value);
this.addRequestHeader(name, value);
};
Apickli.prototype.getResponseObject = function() {
return this.httpResponse;
};
Apickli.prototype.addCookie = function(cookie) {
cookie = this.replaceVariables(cookie);
this.cookies.push(cookie);
};
Apickli.prototype.setRequestBody = function(body) {
body = this.replaceVariables(body);
this.requestBody = body;
};
Apickli.prototype.setQueryParameters = function(queryParameters) {
const self = this;
const paramsObject = {};
queryParameters.forEach(function(q) {
const queryParameterName = self.replaceVariables(q.parameter);
const queryParameterValue = self.replaceVariables(q.value);
paramsObject[queryParameterName] = queryParameterValue;
});
this.queryParameters = paramsObject;
};
Apickli.prototype.setFormParameters = function(formParameters) {
const self = this;
const paramsObject = {};
formParameters.forEach(function(f) {
const formParameterName = self.replaceVariables(f.parameter);
const formParameterValue = self.replaceVariables(f.value);
paramsObject[formParameterName] = formParameterValue;
});
this.formParameters = paramsObject;
};
Apickli.prototype.setHeaders = function(headersTable) {
const self = this;
headersTable.forEach(function(h) {
const headerName = self.replaceVariables(h.name);
const headerValue = self.replaceVariables(h.value);
self.addRequestHeader(headerName, headerValue);
});
};
Apickli.prototype.pipeFileContentsToRequestBody = function(file, callback) {
const self = this;
file = this.replaceVariables(file);
fs.readFile(path.join(this.fixturesDirectory, file), 'utf8', function(err, data) {
if (err) {
callback(err);
}
self.setRequestBody(data);
callback();
});
};
Apickli.prototype.get = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('GET', resource, callback);
};
Apickli.prototype.post = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('POST', resource, callback);
};
Apickli.prototype.put = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('PUT', resource, callback);
};
Apickli.prototype.delete = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('DELETE', resource, callback);
};
Apickli.prototype.patch = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('PATCH', resource, callback);
};
Apickli.prototype.options = function(resource, callback) { // callback(error, response)
resource = this.replaceVariables(resource);
this.sendRequest('OPTIONS', resource, callback);
};
Apickli.prototype.addHttpBasicAuthorizationHeader = function(username, password) {
username = this.replaceVariables(username);
password = this.replaceVariables(password);
const b64EncodedValue = base64Encode(username + ':' + password);
this.addRequestHeader('Authorization', 'Basic ' + b64EncodedValue);
};
Apickli.prototype.assertResponseCode = function(responseCode) {
responseCode = this.replaceVariables(responseCode);
const realResponseCode = this.getResponseObject().statusCode.toString();
const success = (realResponseCode === responseCode);
return getAssertionResult(success, responseCode, realResponseCode, this);
};
Apickli.prototype.assertResponseDoesNotContainHeader = function(header, callback) {
header = this.replaceVariables(header);
const success = typeof this.getResponseObject().headers[header.toLowerCase()] == 'undefined';
return getAssertionResult(success, true, false, this);
};
Apickli.prototype.assertResponseContainsHeader = function(header, callback) {
header = this.replaceVariables(header);
const success = typeof this.getResponseObject().headers[header.toLowerCase()] != 'undefined';
return getAssertionResult(success, true, false, this);
};
Apickli.prototype.assertHeaderValue = function(header, expression) {
header = this.replaceVariables(header);
expression = this.replaceVariables(expression);
const realHeaderValue = this.getResponseObject().headers[header.toLowerCase()];
const regex = new RegExp(expression);
const success = (regex.test(realHeaderValue));
return getAssertionResult(success, expression, realHeaderValue, this);
};
Apickli.prototype.assertPathInResponseBodyMatchesExpression = function(path, regexp) {
path = this.replaceVariables(path);
regexp = this.replaceVariables(regexp);
const regExpObject = new RegExp(regexp);
const evalValue = evaluatePath(path, this.getResponseObject().body);
const success = regExpObject.test(evalValue);
return getAssertionResult(success, regexp, evalValue, this);
};
Apickli.prototype.assertResponseBodyContainsExpression = function(expression) {
expression = this.replaceVariables(expression);
const regex = new RegExp(expression);
const success = regex.test(this.getResponseObject().body);
return getAssertionResult(success, expression, null, this);
};
Apickli.prototype.assertResponseBodyContentType = function(contentType) {
contentType = this.replaceVariables(contentType);
const realContentType = getContentType(this.getResponseObject().body);
const success = (realContentType === contentType);
return getAssertionResult(success, contentType, realContentType, this);
};
Apickli.prototype.assertPathIsArray = function(path) {
path = this.replaceVariables(path);
const value = evaluatePath(path, this.getResponseObject().body);
const success = Array.isArray(value);
return getAssertionResult(success, 'array', typeof value, this);
};
Apickli.prototype.assertPathIsArrayWithLength = function(path, length) {
path = this.replaceVariables(path);
length = this.replaceVariables(length);
let success = false;
let actual = '?';
const value = evaluatePath(path, this.getResponseObject().body);
if (Array.isArray(value)) {
success = value.length.toString() === length;
actual = value.length;
}
return getAssertionResult(success, length, actual, this);
};
Apickli.prototype.evaluatePathInResponseBody = function(path) {
path = this.replaceVariables(path);
return evaluatePath(path, this.getResponseObject().body);
};
Apickli.prototype.setAccessToken = function(token) {
accessToken = token;
};
Apickli.prototype.unsetAccessToken = function() {
accessToken = undefined;
};
Apickli.prototype.getAccessTokenFromResponseBodyPath = function(path) {
path = this.replaceVariables(path);
return evaluatePath(path, this.getResponseObject().body);
};
Apickli.prototype.setAccessTokenFromResponseBodyPath = function(path) {
this.setAccessToken(this.getAccessTokenFromResponseBodyPath(path));
};
Apickli.prototype.setBearerToken = function() {
if (accessToken) {
return this.addRequestHeader('Authorization', 'Bearer ' + accessToken);
} else {
return false;
}
};
Apickli.prototype.storeValueInScenarioScope = function(variableName, value) {
this.scenarioVariables[variableName] = value;
};
Apickli.prototype.storeValueOfHeaderInScenarioScope = function(header, variableName) {
header = this.replaceVariables(header); // only replace header. replacing variable name wouldn't make sense
const value = this.getResponseObject().headers[header.toLowerCase()];
this.scenarioVariables[variableName] = value;
};
Apickli.prototype.storeValueOfResponseBodyPathInScenarioScope = function(path, variableName) {
path = this.replaceVariables(path); // only replace path. replacing variable name wouldn't make sense
const value = evaluatePath(path, this.getResponseObject().body);
this.scenarioVariables[variableName] = value;
};
Apickli.prototype.assertScenarioVariableValue = function(variable, value) {
value = this.replaceVariables(value); // only replace value. replacing variable name wouldn't make sense
return (String(this.scenarioVariables[variable]) === value);
};
Apickli.prototype.storeValueOfHeaderInGlobalScope = function(headerName, variableName) {
headerName = this.replaceVariables(headerName); // only replace headerName. replacing variable name wouldn't make sense
const value = this.getResponseObject().headers[headerName.toLowerCase()];
this.setGlobalVariable(variableName, value);
};
Apickli.prototype.storeValueOfResponseBodyPathInGlobalScope = function(path, variableName) {
path = this.replaceVariables(path); // only replace path. replacing variable name wouldn't make sense
const value = evaluatePath(path, this.getResponseObject().body);
this.setGlobalVariable(variableName, value);
};
Apickli.prototype.setGlobalVariable = function(name, value) {
globalVariables[name] = value;
};
Apickli.prototype.getGlobalVariable = function(name) {
return globalVariables[name];
};
Apickli.prototype.validateResponseWithSchema = function(schemaFile, callback) {
const self = this;
schemaFile = this.replaceVariables(schemaFile, self.scenarioVariables, self.variableChar);
fs.readFile(path.join(this.fixturesDirectory, schemaFile), 'utf8', function(err, jsonSchemaString) {
if (err) {
callback(err);
}
const jsonSchema = JSON.parse(jsonSchemaString);
const responseBody = JSON.parse(self.getResponseObject().body);
const validate = jsonSchemaValidator(jsonSchema, {verbose: true});
const success = validate(responseBody);
callback(getAssertionResult(success, validate.errors, null, self));
});
};
Apickli.prototype.validateResponseWithSwaggerSpecDefinition = function(definitionName, swaggerSpecFile, callback) {
const self = this;
swaggerSpecFile = this.replaceVariables(swaggerSpecFile, self.scenarioVariables, self.variableChar);
fs.readFile(path.join(this.fixturesDirectory, swaggerSpecFile), 'utf8', function(err, swaggerSpecString) {
if (err) {
callback(err);
}
const swaggerObject = JSON.parse(swaggerSpecString);
const responseBody = JSON.parse(self.getResponseObject().body);
spec.validateModel(swaggerObject, '#/definitions/' + definitionName, responseBody, function(err, result) {
if (err) {
callback(getAssertionResult(false, null, err, self));
} else if (result && result.errors) {
callback(getAssertionResult(false, null, result.errors, self));
} else {
callback(getAssertionResult(true, null, null, self));
}
});
});
};
exports.Apickli = Apickli;
/**
* Replaces variable identifiers in the resource string
* with their value in scope if it exists
* Returns the modified string
* The variable identifiers must be delimited with backticks or variableChar character
* offset defines the index of the char from which the varaibles are to be searched
* It's optional.
*
* Credits: Based on contribution by PascalLeMerrer
*/
Apickli.prototype.replaceVariables = function(resource, scope, variableChar, offset) {
scope = scope || this.scenarioVariables;
variableChar = variableChar || this.variableChar;
offset = offset || 0;
const startIndex = resource.indexOf(variableChar, offset);
if (startIndex >= 0) {
const endIndex = resource.indexOf(variableChar, startIndex + 1);
if (endIndex > startIndex) {
const variableName = resource.substr(startIndex + 1, endIndex - startIndex - 1);
const variableValue = scope && scope.hasOwnProperty(variableName) ? scope[variableName] : globalVariables[variableName];
resource = resource.substr(0, startIndex) + variableValue + resource.substr(endIndex + 1);
resource = this.replaceVariables(resource, scope, variableChar, endIndex + 1);
}
}
return resource;
};
Apickli.prototype.sendRequest = function(method, resource, callback) {
const self = this;
const options = {};
options.url = this.domain + resource;
options.method = method;
options.headers = this.headers;
options.qs = this.queryParameters;
if (this.requestBody.length > 0) {
options.body = this.requestBody;
} else if (Object.keys(this.formParameters).length > 0) {
options.form = this.formParameters;
}
const cookieJar = request.jar();
this.cookies.forEach(function(cookie) {
cookieJar.setCookie(request.cookie(cookie), self.domain);
});
options.jar = cookieJar;
if (method !== 'OPTIONS') {
options.followRedirect = false;
}
resource = this.replaceVariables(resource);
request(options, function(error, response) {
if (error) {
return callback(error);
}
self.httpResponse = response;
callback(null, response);
});
};
|
/**
* A Text Field Trigger that contains a {@link Ext.Component Component} or {@link
* Ext.Widget Widget}.
* @private
*/
Ext.define('Ext.form.trigger.Component', {
extend: 'Ext.form.trigger.Trigger',
alias: 'trigger.component',
cls: Ext.baseCSSPrefix + 'form-trigger-cmp',
/**
* @cfg {Object/Ext.Component/Ext.Widget} component A config object for a Component or Widget,
* or an already instantiated Component or Widget.
*/
/**
* @property {Ext.Component/Ext.Widget} component The component or widget
* @readonly
*/
onFieldRender: function () {
var me = this,
component = me.component;
me.callParent();
if (!component.isComponent && !component.isWidget) {
component = Ext.widget(component);
}
me.component = component;
component.render(me.el);
},
destroy: function () {
var component = this.component;
if (component.isComponent || component.isWidget) {
component.destroy();
}
this.component = null;
this.callParent();
}
});
|
# Generated by Django 2.2.6 on 2019-11-21 18:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0025_auto_20191112_1805'),
]
operations = [
migrations.AlterField(
model_name='siteagency',
name='from_date',
field=models.DateTimeField(verbose_name='agency from date'),
),
migrations.AlterField(
model_name='siteagency',
name='to_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='agency to date'),
),
]
|
/**
* @license
* =========================================================
* bootstrap-datetimepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
*
* Contributions:
* - Andrew Rowls
* - Thiago de Arruda
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =========================================================
*/
(function($) {
// Picker object
var smartPhone = (window.orientation != undefined);
var DateTimePicker = function(element, options) {
this.id = dpgId++;
this.init(element, options);
};
DateTimePicker.prototype = {
constructor: DateTimePicker,
init: function(element, options) {
var icon;
if (!(options.pickTime || options.pickDate))
throw new Error('Must choose at least one picker');
this.options = options;
this.$element = $(element);
this.format = options.format || this.$element.data('date-format') || 'MM/dd/yyyy';
this._compileFormat();
this.language = options.language in dates ? options.language : 'en'
this.pickDate = options.pickDate;
this.pickTime = options.pickTime;
this.isInput = this.$element.is('input');
this.component = this.$element.is('.date') ? this.$element.find('.add-on') : false;
if (this.component) {
icon = this.component.find('i');
}
if (this.pickTime) {
this.timeIcon = icon.data('time-icon') || 'icon-time';
icon.addClass(this.timeIcon);
}
if (this.pickDate) {
this.dateIcon = icon.data('date-icon') || 'icon-calendar';
icon.removeClass(this.timeIcon);
icon.addClass(this.dateIcon);
}
this.picker = $(getTemplate(this.timeIcon, options.pickDate, options.pickTime)).appendTo('body');
this.minViewMode = options.minViewMode||this.$element.data('date-minviewmode')||0;
if (typeof this.minViewMode === 'string') {
switch (this.minViewMode) {
case 'months':
this.minViewMode = 1;
break;
case 'years':
this.minViewMode = 2;
break;
default:
this.minViewMode = 0;
break;
}
}
this.viewMode = options.viewMode||this.$element.data('date-viewmode')||0;
if (typeof this.viewMode === 'string') {
switch (this.viewMode) {
case 'months':
this.viewMode = 1;
break;
case 'years':
this.viewMode = 2;
break;
default:
this.viewMode = 0;
break;
}
}
this.startViewMode = this.viewMode;
this.weekStart = options.weekStart||this.$element.data('date-weekstart')||0;
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
this.fillDow();
this.fillMonths();
this.update();
this.showMode();
this._attachDatePickerEvents();
},
show: function(e) {
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.$element.outerHeight();
this.place();
this.$element.trigger({
type: 'show',
date: this.date
});
this._attachDatePickerGlobalEvents();
if (e) {
e.stopPropagation();
e.preventDefault();
}
},
hide: function() {
// Ignore event if in the middle of a picker transition
var collapse = this.picker.find('.collapse')
for (var i = 0; i < collapse.length; i++) {
var collapseData = collapse.eq(i).data('collapse');
if (collapseData && collapseData.transitioning)
return;
}
this.picker.hide();
this.viewMode = this.startViewMode;
this.showMode();
this.set();
this.$element.trigger({
type: 'hide',
date: this.date
});
this._detachDatePickerGlobalEvents();
},
set: function() {
var formated = this.formatDate(this.date);
if (!this.isInput) {
if (this.component){
var input = this.$element.find('input');
input.val(formated);
this._resetMaskPos(input);
}
this.$element.data('date', formated);
} else {
this.$element.val(formated);
this._resetMaskPos(this.$element);
}
},
setValue: function(newDate) {
if (typeof newDate === 'string') {
this.date = this.parseDate(newDate);
} else {
this.date = new Date(newDate);
}
this.set();
this.viewDate = UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), 1, 0, 0, 0, 0);
this.fillDate();
this.fillTime();
},
getDate: function() {
return new Date(this.date.valueOf());
},
setDate: function(date) {
this.setValue(date.valueOf());
},
getLocalDate: function() {
var d = this.date;
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(),
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
},
setLocalDate: function(localDate) {
this.setValue(Date.UTC(localDate.getFullYear(), localDate.getMonth(), localDate.getDate(),
localDate.getHours(), localDate.getMinutes(), localDate.getSeconds(), localDate.getMilliseconds()));
},
place: function(){
var offset = this.component ? this.component.offset() : this.$element.offset();
this.picker.css({
top: offset.top + this.height,
left: offset.left
});
},
update: function(newDate){
var dateStr = newDate;
if (!dateStr) {
if (this.isInput) {
dateStr = this.$element.val();
} else {
dateStr = this.$element.find('input').val();
}
if (!dateStr) {
var tmp = new Date()
this.date = UTCDate(tmp.getFullYear(), tmp.getMonth(), tmp.getDate(),
tmp.getHours(), tmp.getMinutes(), tmp.getSeconds(), tmp.getMilliseconds())
} else {
this.date = this.parseDate(dateStr);
}
}
this.viewDate = UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), 1, 0, 0, 0, 0);
this.fillDate();
this.fillTime();
},
fillDow: function() {
var dowCnt = this.weekStart;
var html = '<tr>';
while (dowCnt < this.weekStart + 7) {
html += '<th class="dow">' + dates[this.language].daysMin[(dowCnt++) % 7] + '</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function() {
var html = '';
var i = 0
while (i < 12) {
html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>';
}
this.picker.find('.datepicker-months td').append(html);
},
fillDate: function() {
var year = this.viewDate.getUTCFullYear();
var month = this.viewDate.getUTCMonth();
var currentDate = UTCDate(
this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate(),
0, 0, 0, 0
);
this.picker.find('.datepicker-days th:eq(1)')
.text(dates[this.language].months[month] + ' ' + year);
var prevMonth = UTCDate(year, month-1, 28, 0, 0, 0, 0);
var day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
prevMonth.setUTCDate(day);
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);
var nextMonth = new Date(prevMonth.valueOf());
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
nextMonth = nextMonth.valueOf();
html = [];
var clsName;
while (prevMonth.valueOf() < nextMonth) {
if (prevMonth.getUTCDay() === this.weekStart) {
html.push('<tr>');
}
clsName = '';
if (prevMonth.getUTCMonth() < month) {
clsName += ' old';
} else if (prevMonth.getUTCMonth() > month) {
clsName += ' new';
}
if (prevMonth.valueOf() === currentDate.valueOf()) {
clsName += ' active';
}
html.push('<td class="day' + clsName + '">' + prevMonth.getUTCDate() + '</td>');
if (prevMonth.getUTCDay() === this.weekEnd) {
html.push('</tr>');
}
prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date.getUTCFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear === year) {
months.eq(this.date.getUTCMonth()).addClass('active');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year' + (i === -1 || i === 10 ? ' old' : '') + (currentYear === year ? ' active' : '') + '">' + year + '</span>';
year += 1;
}
yearCont.html(html);
},
fillTime: function() {
if (!this.date)
return;
var timeComponents = this.picker.find('.timepicker span[data-time-component]');
timeComponents.filter('[data-time-component=hours]').text(padLeft(this.date.getUTCHours().toString(), 2, '0'));
timeComponents.filter('[data-time-component=minutes]').text(padLeft(this.date.getUTCMinutes().toString(), 2, '0'));
timeComponents.filter('[data-time-component=seconds]').text(padLeft(this.date.getUTCSeconds().toString(), 2, '0'));
},
click: function(e) {
e.stopPropagation();
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length === 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'switch':
this.showMode(1);
break;
case 'prev':
case 'next':
this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
this.viewDate,
this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
);
this.fillDate();
this.set();
break;
}
break;
case 'span':
if (target.is('.month')) {
var month = target.parent().find('span').index(target);
this.viewDate.setUTCMonth(month);
} else {
var year = parseInt(target.text(), 10)||0;
this.viewDate.setUTCFullYear(year);
}
if (this.viewMode !== 0) {
this.date = UTCDate(
this.viewDate.getUTCFullYear(), this.viewDate.getUTCMonth(), this.viewDate.getUTCDate(),
this.date.getUTCHours(), this.date.getUTCMinutes(), this.date.getUTCSeconds(),
this.date.getUTCMilliseconds()
);
this.$element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
this.showMode(-1);
this.fillDate();
this.set();
break;
case 'td':
if (target.is('.day')){
var day = parseInt(target.text(), 10)||1;
var month = this.viewDate.getUTCMonth();
if (target.is('.old')) {
month -= 1;
} else if (target.is('.new')) {
month += 1;
}
var year = this.viewDate.getUTCFullYear();
this.date = UTCDate(
year, month, day,
this.date.getUTCHours(), this.date.getUTCMinutes(), this.date.getUTCSeconds(),
this.date.getUTCMilliseconds()
);
this.viewDate = UTCDate(year, month, Math.min(28, day),0,0,0,0);
this.fillDate();
this.set();
this.$element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
break;
}
}
},
actions: {
incrementHours: function(e) {
this.date.setUTCHours(this.date.getUTCHours() + this.options.hourStep);
},
incrementMinutes: function(e) {
this.date.setUTCMinutes(this.date.getUTCMinutes() + this.options.minuteStep);
},
incrementSeconds: function(e) {
this.date.setUTCSeconds(this.date.getUTCSeconds() + this.options.secondStep);
},
decrementHours: function(e) {
this.date.setUTCHours(this.date.getUTCHours() - this.options.hourStep);
},
decrementMinutes: function(e) {
this.date.setUTCMinutes(this.date.getUTCMinutes() - this.options.minuteStep);
},
decrementSeconds: function(e) {
this.date.setUTCSeconds(this.date.getUTCSeconds() - this.options.secondStep);
}
},
doAction: function(e) {
if (!this.date) this.date = UTCDate(1970, 0, 0, 0, 0, 0, 0);
var action = $(e.currentTarget).data('action');
var rv = this.actions[action].apply(this, arguments);
this.set();
this.fillTime();
this.$element.trigger({
type: 'changeDate',
date: this.date,
});
return rv;
},
// part of the following code was taken from
// http://cloud.github.com/downloads/digitalBush/jquery.maskedinput/jquery.maskedinput-1.3.js
keydown: function(e) {
var self = this, k = e.which, input = $(e.target);
if (k == 8 || k == 46) {
// backspace and delete cause the maskPosition
// to be recalculated
setTimeout(function() {
self._resetMaskPos(input);
});
}
},
keypress: function(e) {
var k = e.which;
if (k == 8 || k == 46) {
// For those browsers which will trigger
// keypress on backspace/delete
return;
}
var input = $(e.target);
var c = String.fromCharCode(k);
var val = input.val() || '';
val += c;
var mask = this._mask[this._maskPos];
if (!mask) {
return false;
}
if (mask.end != val.length) {
return;
}
if (!mask.pattern.test(val.slice(mask.start))) {
val = val.slice(0, val.length - 1);
while ((mask = this._mask[this._maskPos]) && mask.character) {
val += mask.character;
// advance mask position past static
// part
this._maskPos++;
}
val += c;
if (mask.end != val.length) {
input.val(val);
return false;
} else {
if (!mask.pattern.test(val.slice(mask.start))) {
input.val(val.slice(0, mask.start));
return false;
} else {
input.val(val);
this._maskPos++;
return false;
}
}
} else {
this._maskPos++;
}
},
change: function(e) {
var input = $(e.target);
var val = input.val();
if (this._formatPattern.test(val)) {
this.update();
this.$element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
this.set();
} else if (val && val.trim()) {
if (this.date) this.set();
else input.val('');
} else {
if (this.date) {
// unset the date when the input is
// erased
this.$element.trigger({
type: 'changeDate',
date: null,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
}
this._resetMaskPos(input);
},
mousedown: function(e) {
e.stopPropagation();
e.preventDefault();
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
}
this.picker.find('.datepicker > div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
},
destroy: function() {
this._detachDatePickerEvents();
this._detachDatePickerGlobalEvents();
this.picker.remove();
this.$element.removeData('datetimepicker');
this.component.removeData('datetimepicker');
},
formatDate: function(d) {
return this.format.replace(formatReplacer, function(match) {
var methodName, property, rv;
property = dateFormatComponents[match].property
methodName = 'get' + property;
rv = d[methodName]();
if (methodName === 'getUTCMonth') rv = rv + 1;
if (methodName === 'getUTCYear') rv = rv + 1900 - 2000;
return padLeft(rv.toString(), match.length, '0');
});
},
parseDate: function(str) {
var match, i, property, methodName, value, parsed = {};
if (!(match = this._formatPattern.exec(str)))
return null;
for (i = 1; i < match.length; i++) {
property = this._propertiesByIndex[i];
if (!property)
continue;
value = match[i];
if (/^\d+$/.test(value))
value = parseInt(value, 10);
parsed[property] = value;
}
return this._finishParsingDate(parsed);
},
_resetMaskPos: function(input) {
var val = input.val();
for (var i = 0; i < this._mask.length; i++) {
if (this._mask[i].end > val.length) {
// If the mask has ended then jump to
// the next
this._maskPos = i;
break;
} else if (this._mask[i].end === val.length) {
this._maskPos = i + 1;
break;
}
}
},
_finishParsingDate: function(parsed) {
var year, month, date, hours, minutes, seconds;
year = parsed.UTCFullYear;
if (parsed.UTCYear) year = 2000 + parsed.UTCYear;
if (!year) year = 1970;
if (parsed.UTCMonth) month = parsed.UTCMonth - 1;
else month = 0;
date = parsed.UTCDate || 1;
hours = parsed.UTCHours || 0;
minutes = parsed.UTCMinutes || 0;
seconds = parsed.UTCSeconds || 0;
return UTCDate(year, month, date, hours, minutes, seconds, 0);
},
_compileFormat: function () {
var match, component, components = [], mask = [], str = this.format, propertiesByIndex = {}, i = pos = 0;
while (match = formatComponent.exec(str)) {
component = match[0];
if (component in dateFormatComponents) {
i++;
propertiesByIndex[i] = dateFormatComponents[component].property;
components.push('\\s*' + dateFormatComponents[component].getPattern(this) + '\\s*');
mask.push({
pattern: new RegExp(dateFormatComponents[component].getPattern(this)),
property: dateFormatComponents[component].property,
start: pos,
end: pos += component.length
});
}
else {
components.push(escapeRegExp(component));
mask.push({
pattern: new RegExp(escapeRegExp(component)),
character: component,
start: pos,
end: ++pos
});
}
str = str.slice(component.length);
}
this._mask = mask;
this._maskPos = 0;
this._formatPattern = new RegExp('^\\s*' + components.join('') + '\\s*$');
this._propertiesByIndex = propertiesByIndex;
},
_attachDatePickerEvents: function() {
var self = this;
this.picker.on({
click: $.proxy(this.click, this),
mousedown: $.proxy(this.mousedown, this),
});
this.picker.on('click', '[data-action]', $.proxy(this.doAction, this));
if (this.pickDate && this.pickTime) {
this.picker.on('click.togglePicker', '.accordion-toggle', function(e) {
e.stopPropagation();
var $this = $(this);
var $parent = $this.closest('ul');
var expanded = $parent.find('.collapse.in');
var closed = $parent.find('.collapse:not(.in)');
if (expanded && expanded.length) {
var collapseData = expanded.data('collapse');
if (collapseData && collapseData.transitioning) return;
expanded.collapse('hide');
closed.collapse('show')
$this.find('i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
self.$element.find('.add-on i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
}
});
}
if (this.isInput) {
this.$element.on({
'focus': $.proxy(this.show, this),
'change': $.proxy(this.change, this),
});
if (this.options.maskInput) {
this.$element.on({
'keydown': $.proxy(this.keydown, this),
'keypress': $.proxy(this.keypress, this)
});
}
} else {
this.$element.on({
'change': $.proxy(this.change, this),
}, 'input');
if (this.options.maskInput) {
this.$element.on({
'keydown': $.proxy(this.keydown, this),
'keypress': $.proxy(this.keypress, this)
}, 'input');
}
if (this.component){
this.component.on('click', $.proxy(this.show, this));
} else {
this.$element.on('click', $.proxy(this.show, this));
}
}
},
_attachDatePickerGlobalEvents: function() {
$(window).on('resize.datetimepicker' + this.id, $.proxy(this.place, this));
if (!this.isInput) {
$(document).on('mousedown.datetimepicker' + this.id, $.proxy(this.hide, this));
}
},
_detachDatePickerEvents: function() {
this.picker.off({
click: this.click,
mousedown: this.mousedown
});
this.picker.off('click', '[data-action]');
if (this.pickDate && this.pickTime) {
this.picker.off('click.togglePicker');
}
if (this.isInput) {
this.$element.off({
'focus': this.show,
'change': this.change,
});
if (this.options.maskInput) {
this.$element.off({
'keydown': this.keydown,
'keypress': this.keypress
});
}
} else {
this.$element.off({
'change': this.change,
}, 'input');
if (this.options.maskInput) {
this.$element.off({
'keydown': this.keydown,
'keypress': this.keypress
}, 'input');
}
if (this.component){
this.component.off('click', this.show);
} else {
this.$element.off('click', this.show);
}
}
},
_detachDatePickerGlobalEvents: function () {
$(window).off('resize.datetimepicker' + this.id);
if (!this.isInput) {
$(document).off('mousedown.datetimepicker' + this.id);
}
}
};
$.fn.datetimepicker = function ( option, val ) {
return this.each(function () {
var $this = $(this),
data = $this.data('datetimepicker'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('datetimepicker', (data = new DateTimePicker(this, $.extend({}, $.fn.datetimepicker.defaults,options))));
}
if (typeof option === 'string') data[option](val);
});
};
$.fn.datetimepicker.defaults = {
maskInput: true,
pickDate: true,
pickTime: true,
hourStep: 1,
minuteStep: 15,
secondStep: 30
};
$.fn.datetimepicker.Constructor = DateTimePicker;
var dpgId = 0;
var dates = $.fn.datetimepicker.dates = {
en: {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
}
};
var dateFormatComponents = {
dd: {property: 'UTCDate', getPattern: function() { return '(0?[1-9]|[1-2][0-9]|3[0-1])\\b';}},
MM: {property: 'UTCMonth', getPattern: function() {return '(0?[1-9]|1[0-2])\\b';}},
yy: {property: 'UTCYear', getPattern: function() {return '(\\d{2})\\b'}},
yyyy: {property: 'UTCFullYear', getPattern: function() {return '(\\d{4})\\b';}},
hh: {property: 'UTCHours', getPattern: function() {return '(0?[0-9]|1[0-9]|2[0-3])\\b';}},
mm: {property: 'UTCMinutes', getPattern: function() {return '(0?[0-9]|[1-5][0-9])\\b';}},
ss: {property: 'UTCSeconds', getPattern: function() {return '(0?[0-9]|[1-5][0-9])\\b';}},
ms: {property: 'UTCMilliseconds', getPattern: function() {return '([0-9]{1,3})\\b';}},
};
var keys = [];
for (var k in dateFormatComponents) keys.push(k);
keys[keys.length - 1] += '\\b';
keys.push('.');
var formatComponent = new RegExp(keys.join('\\b|'));
keys.pop();
var formatReplacer = new RegExp(keys.join('\\b|'), 'g');
function escapeRegExp(str) {
// http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
function padLeft(s, l, c) {
return Array(l - s.length + 1).join(c || ' ') + s;
}
function getTemplate(timeIcon, pickDate, pickTime) {
if (pickDate && pickTime) {
return (
'<div class="datetimepicker dropdown-menu">' +
'<ul>' +
'<li class="collapse in">' +
'<div class="datepicker">' +
DPGlobal.template +
'</div>' +
'</li>' +
'<li class="picker-switch"><a class="accordion-toggle"><i class="' + timeIcon + '"></i></a></li>' +
'<li class="collapse">' +
'<div class="timepicker">' +
TPGlobal.template +
'</div>' +
'</li>' +
'</ul>' +
'</div>'
);
} else if (pickTime) {
return (
'<div class="datetimepicker dropdown-menu">' +
'<div class="timepicker">' +
TPGlobal.template +
'</div>' +
'</div>'
);
} else {
return (
'<div class="datetimepicker dropdown-menu">' +
'<div class="datepicker">' +
DPGlobal.template +
'</div>' +
'</div>'
);
}
}
function UTCDate() {
return new Date(Date.UTC.apply(Date, arguments));
}
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
},
headTemplate:
'<thead>' +
'<tr>' +
'<th class="prev">‹</th>' +
'<th colspan="5" class="switch"></th>' +
'<th class="next">›</th>' +
'</tr>' +
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
};
DPGlobal.template =
'<div class="datepicker-days">' +
'<table class="table-condensed">' +
DPGlobal.headTemplate +
'<tbody></tbody>' +
'</table>' +
'</div>' +
'<div class="datepicker-months">' +
'<table class="table-condensed">' +
DPGlobal.headTemplate +
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>';
var TPGlobal = {
hourTemplate: '<span data-time-component="hours" class="timepicker-hour"></span>',
minuteTemplate: '<span data-time-component="minutes" class="timepicker-minute"></span>',
secondTemplate: '<span data-time-component="seconds" class="timepicker-second"></span>',
};
TPGlobal.template =
'<table class="table-condensed">' +
'<tr>' +
'<td><a href="#" class="btn" data-action="incrementHours"><i class="icon-chevron-up"></i></a></td>' +
'<td class="separator"> </td>' +
'<td><a href="#" class="btn" data-action="incrementMinutes"><i class="icon-chevron-up"></i></a></td>' +
'<td class="separator"> </td>' +
'<td><a href="#" class="btn" data-action="incrementSeconds"><i class="icon-chevron-up"></i></a></td>' +
'</tr>' +
'<tr>' +
'<td>' + TPGlobal.hourTemplate + '</td> ' +
'<td class="separator">:</td>' +
'<td>' + TPGlobal.minuteTemplate + '</td> ' +
'<td class="separator">:</td>' +
'<td>' + TPGlobal.secondTemplate + '</td>' +
'</tr>' +
'<tr>' +
'<td><a href="#" class="btn" data-action="decrementHours"><i class="icon-chevron-down"></i></a></td>' +
'<td class="separator"></td>' +
'<td><a href="#" class="btn" data-action="decrementMinutes"><i class="icon-chevron-down"></i></a></td>' +
'<td class="separator"> </td>' +
'<td><a href="#" class="btn" data-action="decrementSeconds"><i class="icon-chevron-down"></i></a></td>' +
'</tr>' +
'</table>'
})(window.jQuery)
|
import axios from 'axios';
const STUDENT_API_BASE_URL = "http://127.0.0.1:8082/api/v1/students/";
class StudentService {
getStudents(){
return axios.get(STUDENT_API_BASE_URL);
}
createStudent(student){
return axios.post(STUDENT_API_BASE_URL, student);
}
getStudentById(studentId){
return axios.get(STUDENT_API_BASE_URL + studentId);
}
updateStudent(student, studentId){
return axios.put(STUDENT_API_BASE_URL + studentId, student);
}
deleteStudent(studentId){
return axios.delete(STUDENT_API_BASE_URL+ studentId);
}
}
export default new StudentService()
|
import test from 'ava';
import delay from 'delay';
import inRange from 'in-range';
import timeSpan from 'time-span';
import randomInt from 'random-int';
import PQueue from '.';
const fixture = Symbol('fixture');
test('.add()', async t => {
const queue = new PQueue();
const p = queue.add(async () => fixture);
t.is(queue.size, 0);
t.is(queue.pending, 1);
t.is(await p, fixture);
});
test('.add() - limited concurrency', async t => {
const queue = new PQueue({concurrency: 2});
const p = queue.add(async () => fixture);
const p2 = queue.add(async () => delay(100).then(() => fixture));
const p3 = queue.add(async () => fixture);
t.is(queue.size, 1);
t.is(queue.pending, 2);
t.is(await p, fixture);
t.is(await p2, fixture);
t.is(await p3, fixture);
});
test('.add() - concurrency: 1', async t => {
const input = [
[10, 300],
[20, 200],
[30, 100]
];
const end = timeSpan();
const queue = new PQueue({concurrency: 1});
const mapper = ([val, ms]) => queue.add(() => delay(ms).then(() => val));
t.deepEqual(await Promise.all(input.map(mapper)), [10, 20, 30]);
t.true(inRange(end(), 590, 650));
});
test('.add() - concurrency: 5', async t => {
const concurrency = 5;
const queue = new PQueue({concurrency});
let running = 0;
const input = Array(100).fill(0).map(() => queue.add(async () => {
running++;
t.true(running <= concurrency);
t.true(queue.pending <= concurrency);
await delay(randomInt(30, 200));
running--;
}));
await Promise.all(input);
});
test('.add() - priority', async t => {
const result = [];
const queue = new PQueue({concurrency: 1});
queue.add(async () => result.push(0), {priority: 0});
queue.add(async () => result.push(1), {priority: 1});
queue.add(async () => result.push(2), {priority: 1});
queue.add(async () => result.push(3), {priority: 2});
await queue.onEmpty();
t.deepEqual(result, [0, 3, 1, 2]);
});
test('.onEmpty()', async t => {
const queue = new PQueue({concurrency: 1});
queue.add(async () => 0);
queue.add(async () => 0);
t.is(queue.size, 1);
t.is(queue.pending, 1);
await queue.onEmpty();
t.is(queue.size, 0);
queue.add(async () => 0);
queue.add(async () => 0);
t.is(queue.size, 1);
t.is(queue.pending, 1);
await queue.onEmpty();
t.is(queue.size, 0);
// Test an empty queue
await queue.onEmpty();
t.is(queue.size, 0);
});
test('.onIdle()', async t => {
const queue = new PQueue({concurrency: 2});
queue.add(async () => delay(100));
queue.add(async () => delay(100));
queue.add(async () => delay(100));
t.is(queue.size, 1);
t.is(queue.pending, 2);
await queue.onIdle();
t.is(queue.size, 0);
t.is(queue.pending, 0);
queue.add(async () => delay(100));
queue.add(async () => delay(100));
queue.add(async () => delay(100));
t.is(queue.size, 1);
t.is(queue.pending, 2);
await queue.onIdle();
t.is(queue.size, 0);
t.is(queue.pending, 0);
});
test('.clear()', t => {
const queue = new PQueue({concurrency: 2});
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
t.is(queue.size, 4);
t.is(queue.pending, 2);
queue.clear();
t.is(queue.size, 0);
});
test('.addAll()', async t => {
const queue = new PQueue();
const fn = async () => fixture;
const fns = [fn, fn];
const p = queue.addAll(fns);
t.is(queue.size, 0);
t.is(queue.pending, 2);
t.deepEqual(await p, [fixture, fixture]);
});
test('enforce number in options.concurrency', t => {
/* eslint-disable no-new */
t.throws(() => {
new PQueue({concurrency: 0});
}, TypeError);
t.throws(() => {
new PQueue({concurrency: undefined});
}, TypeError);
t.notThrows(() => {
new PQueue({concurrency: 1});
});
t.notThrows(() => {
new PQueue({concurrency: 10});
});
t.notThrows(() => {
new PQueue({concurrency: Infinity});
});
/* eslint-enable no-new */
});
test('autoStart: false', t => {
const queue = new PQueue({concurrency: 2, autoStart: false});
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
t.is(queue.size, 4);
t.is(queue.pending, 0);
t.is(queue.isPaused, true);
queue.start();
t.is(queue.size, 2);
t.is(queue.pending, 2);
t.is(queue.isPaused, false);
queue.clear();
t.is(queue.size, 0);
});
test('.pause()', t => {
const queue = new PQueue({concurrency: 2});
queue.pause();
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
queue.add(() => delay(20000));
t.is(queue.size, 5);
t.is(queue.pending, 0);
t.is(queue.isPaused, true);
queue.start();
t.is(queue.size, 3);
t.is(queue.pending, 2);
t.is(queue.isPaused, false);
queue.add(() => delay(20000));
queue.pause();
t.is(queue.size, 4);
t.is(queue.pending, 2);
t.is(queue.isPaused, true);
queue.start();
t.is(queue.size, 4);
t.is(queue.pending, 2);
t.is(queue.isPaused, false);
queue.clear();
t.is(queue.size, 0);
});
|
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Flight, { Rect } from 'react-flight/dom'
class App extends Component {
render() {
return (
<Flight interactive ref={flight => (this.flight = flight)}>
<Flight.Frame duration={3000} source interactive>
<div className="keyframe">
<Rect
name="head-1"
radius={5}
style={{
right: -60,
top: 20,
width: 50,
height: 10,
}}
>
<ion-icon name="ios-airplane"
style={{
display: 'inline-block',
transform: 'rotate(180deg)'
}}
></ion-icon>
</Rect>
<div
id="brace-1"
className="brace-1"
style={{
color: '#95A2AA',
top: 30,
left: -50,
fontSize: 30,
}}
>
<i class="fa fa-fighter-jet" aria-hidden="true"></i>
</div>
<div
id="brace-2"
className="brace-2"
style={{
color: '#95A2AA',
top: 180,
left: -50,
fontSize: 30,
}}
>
{'}'}
</div>
</div>
</Flight.Frame>
<Flight.Frame duration={3000}>
<div className="keyframe">
<Rect
name="head-1"
radius={5}
style={{
left: -60,
top: 20,
width: 50,
height: 10,
}}
>
<ion-icon name="ios-airplane"
style={{
display: 'inline-block',
transform: 'rotate(90deg)'
}}
></ion-icon>
</Rect>>
<div
id="brace-1"
className="brace-1"
style={{
color: '#95A2AA',
top: 30,
left: 1000,
fontSize: 30,
}}
>
<i class="fa fa-fighter-jet" aria-hidden="true"></i>
</div>
<div
id="brace-2"
className="brace-2"
style={{
color: '#95A2AA',
top: 190,
left: 20,
fontSize: 30,
}}
>
{'}'}
</div>
</div>
</Flight.Frame>
</Flight>
);
}
}
export default App;
|
# Relevant javadocs
# LayoutPolicy, VersionPolicy
# http://search.maven.org/remotecontent?filepath=org/sonatype/nexus/plugins/nexus-repository-maven/3.12.1-01/nexus-repository-maven-3.12.1-01-javadoc.jar
# WritePolicy
# http://search.maven.org/remotecontent?filepath=org/sonatype/nexus/nexus-repository/3.0.2-02/nexus-repository-3.0.2-02-javadoc.jar
# github.com/cloudogu/nexus-claim/blob/develop/scripts/create-Repository.groovy
# TODO: package and read from external .groovy file
def script_create_repo():
script = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.blobstore.api.BlobStoreManager
import org.sonatype.nexus.repository.config.Configuration
import org.sonatype.nexus.repository.storage.WritePolicy
class Repository {
Map<String,Map<String,Object>> properties = new HashMap<String, Object>()
}
if (args != "") {
log.info("Creating repository with args [${args}]")
def rep = convertJsonFileToRepo(args)
def output = createRepository(rep)
return output
}
def createRepository(Repository repo) {
def conf = createConfiguration(repo)
try {
repository.createRepository(conf)
}
catch (Exception e){
return e
}
return null
}
def convertJsonFileToRepo(String jsonData) {
def inputJson = new JsonSlurper().parseText(jsonData)
Repository repo = new Repository()
inputJson.each {
repo.properties.put(it.key, it.value)
}
return repo
}
def createConfiguration(Repository repo){
def name = getName(repo)
def recipeName = getRecipeName(repo)
def online = getOnline(repo)
def attributes = repo.properties.get("attributes")
Configuration conf = new Configuration(
repositoryName: name,
recipeName: recipeName,
online: online,
attributes: attributes
)
return conf
}
def getName(Repository repo){
String name = repo.getProperties().get("name")
return name
}
def getRecipeName(Repository repo){
String recipeName = repo.getProperties().get("recipeName")
return recipeName
}
def getOnline(Repository repo){
String online = repo.getProperties().get("online")
return online
}
"""
return script
|
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
import chalk from 'chalk';
import app from './app';
var PORT = process.env.PORT || 5000;
app.listen(PORT, function () { return console.log(chalk.bold.yellowBright(templateObject_1 || (templateObject_1 = __makeTemplateObject(["Server is running on http://localhost:", ""], ["Server is running on http://localhost:", ""])), PORT)); });
var templateObject_1;
//# sourceMappingURL=server.js.map |
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class GetFromHttpTest(base_test.WebDriverBaseTest):
def testGetUrlWithNoRedirectionOverHttp(self):
page = self.webserver.where_is('navigation/res/empty.html')
self.driver.get(page)
url = self.driver.current_url
self.assertEquals(page, url)
def testGetWillFollowTheLocationHeader(self):
page = self.webserver.where_is('navigation/redirect')
self.driver.get(page)
expected = self.webserver.where_is('navigation/res/empty.html')
url = self.driver.current_url
self.assertEquals(expected, url)
def testGetWillFollowMetaRefreshThatRefreshesInstantly(self):
page = self.webserver.where_is('navigation/res/instant-meta-redirect.html')
self.driver.get(page)
expected = self.webserver.where_is('navigation/res/empty.html')
url = self.driver.current_url
self.assertEquals(expected, url)
def testGetWillFollowMetaRefreshThatRefreshesAfterOneSecond(self):
page = self.webserver.where_is('navigation/res/1s-meta-redirect.html')
self.driver.get(page)
expected = self.webserver.where_is('navigation/res/empty.html')
url = self.driver.current_url
self.assertEquals(expected, url)
def testGetWillNotFollowMetaRefreshThatRefreshesAfterMoreThanOneSecond(self):
page = self.webserver.where_is('navigation/res/60s-meta-redirect.html')
self.driver.get(page)
url = self.driver.current_url
self.assertEquals(page, url)
def testGetFragmentInCurrentDocumentDoesNotReloadPage(self):
page = self.webserver.where_is("navigation/res/fragment.html")
fragment_page = "%s#%s" % (page, "fragment")
self.driver.get(page)
self.driver.execute_script("state = true")
self.driver.get(fragment_page)
self.assertEquals(True, self.driver.execute_script("return state"))
if __name__ == '__main__':
unittest.main()
|
import {
collection,
addDoc,
Timestamp,
writeBatch,
getDocs,
query,
where,
documentId,
} from "firebase/firestore/lite";
import React, { useContext, useState } from "react";
import { Link } from "react-router-dom/cjs/react-router-dom.min";
import { CartContext } from "../../Context/CartContext";
import { dataBase } from "../../firebase/config";
import Loader from "../Loader/Loader";
import { Formik } from "formik";
import * as Yup from "yup";
import { UserContext } from "../../Context/UserContext";
const phoneRegExp =
/^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
const initialValues = {
nombre: "",
email: "",
tel: "",
};
const endPurchaseSchema = Yup.object().shape({
nombre: Yup.string()
.required("Este campo es obligatorio")
.min(4, "El nombre es muy corto")
.max(30, "El nombre supera el límite de caracteres"),
email: Yup.string()
.required("El mail es obligatorio, nos comunicamos por este medio!")
.email("Email inválido"),
tel: Yup.string()
.matches(phoneRegExp, "Número de teléfono sólo pueden ser números")
.required("Este campo es obligatorio")
.min(8, "El teléfono no es válido")
.max(12, "El teléfono tiene demasiados dígitos"),
});
function Checkout() {
const { cart, totalPurchase, clearCart } = useContext(CartContext);
const [orderId, setOrderId] = useState(null);
const [loading, setLoading] = useState(false);
const {logged} = useContext(UserContext);
const handleSubmit = (values) => {
const order = {
buyer: values,
items: cart,
total: totalPurchase(),
date: Timestamp.fromDate(new Date()),
};
console.log(order);
const batch = writeBatch(dataBase);
const ordersRef = collection(dataBase, "orders");
//actualizar documento en base de datos
const productsRef = collection(dataBase, "products");
const q = query(
productsRef,
where(
documentId(),
"in",
cart.map((el) => el.id)
)
);
//Esto es una serie de cambios en conjunto en vez de a uno.
const oufOfStock = [];
getDocs(q).then((resp) => {
resp.docs.forEach((doc) => {
const item = cart.find((prod) => prod.id === doc.id);
if (doc.data().stock >= item.quantity) {
batch.update(doc.ref, {
stock: doc.data().stock - item.quantity,
});
} else {
oufOfStock.push(item);
}
});
if (oufOfStock.length === 0) {
setLoading(true);
addDoc(ordersRef, order)
.then((resp) => {
console.log(resp.id);
batch.commit();
setOrderId(resp.id);
clearCart();
})
.finally(() => {
setLoading(false);
});
} else {
alert("Productos sin stock en el carrito!!");
}
});
};
if (loading) {
return <Loader></Loader>;
}
if (orderId) {
return (
<>
<h2>Compra registrada con éxito !</h2>
<hr></hr>
<p>Tu número de orden es: {orderId} </p>
<Link to="/" className="btn btn-warning">
{" "}
Ir al inicio
</Link>
</>
);
}
if (!orderId && logged && cart.length > 0 ) {
return (
<div className="container w-50">
<h2>Checkout</h2>
<hr />
<Formik
initialValues={initialValues}
validationSchema={endPurchaseSchema}
onSubmit={handleSubmit}
>
{(formik) => (
<form onSubmit={formik.handleSubmit}>
<input
name="nombre"
onChange={formik.handleChange}
value={formik.values.nombre}
className="form-control my-2"
type="text"
placeholder="Nombre"
/>
{formik.errors.nombre && (
<p className="alert alert-danger">{formik.errors.nombre}</p>
)}
<input
name="email"
onChange={formik.handleChange}
value={formik.values.email}
className="form-control my-2"
type="email"
placeholder="Email"
/>
{formik.errors.email && (
<p className="alert alert-danger">{formik.errors.email}</p>
)}
<input
name="tel"
onChange={formik.handleChange}
value={formik.values.tel}
className="form-control my-2"
type="text"
placeholder="Teléfono"
/>
{formik.errors.tel && (
<p className="alert alert-danger">{formik.errors.tel}</p>
)}
<button type="submit" className="btn btn-success">
Enviar
</button>
</form>
)}
</Formik>
</div>
);
}
if(!logged){
return(
<h2>Debes estar logueado</h2>
)
}
if(logged && cart.length === 0){
return(
<h2>Debes agregar productos al carrito para ver el checkout</h2>
)
}
}
export default Checkout;
|
//IE dont have console
if (typeof window.console == 'undefined')
console = {
log: function() {
},
info: function() {
},
warn: function() {
}
};
$(document).ready(function() {
/*
* fff
* */
NOC.init()
// automake numbers of rack
$(window).mouseup(function(e) {
SEARCH.docmouseup(e)
if (CAGE.drag) {
CAGE.stopDrag()
}
if (RACK.pdumove)
RACK.pdustopDrag()
if (CAGE.screw) {
$(CAGE.screw).show()
}
});
});
var HEADER = {
init: function() {
//add room menu
$('#headmenu_room').html(
'<a class="menu_a" id="room_action" href="#">' +
'<div class="icon_menu"><div class="icons head_action"></div> </div>' +
'</a>' +
'<ul style="display: none;" class="sub_menu">' +
'<li class="sub_menu_div"><a class="rack_click" href="#"><div>Add new Rack</div></a></li>' +
'</ul>'
)
$('a.rack_click').click(function() {
RACK.new_r()
});
this.first = false;
this.getdata()
},
currentRoom: function() {
this.makeNavData(RACK.header[0], RACK.header[1], RACK.header[2])
this.bid = RACK.header[0];
this.fid = RACK.header[1];
this.rid = RACK.header[2];
$('#room_reload').hide()
},
navclick: function(d) {
u = undefined;
t = $(d).attr('t')
i = $(d).attr('i')
switch (t) {
case 'a':
if (i == 'new') {
RACK.new_r()
}
if (i == 'back') {
HEADER.currentRoom()
}
break;
case 'b':
if (i != this.bid) {
this.bid = i
this.fid = u
this.rid = u
this.makeNavData(i, u, u, true)
}
break;
case 'f':
if (i != this.fid) {
this.fid = i
this.rid = u
this.makeNavData(this.bid, i, u, true)
}
break;
case 'r':
if (i != this.rid) {
this.rid = i
this.makeNavData(this.bid, this.fid, i, true)
}
break;
}
},
updateRoom: function(rid) {
WIN.close('#win_device')
if (typeof CABLE != 'undefined') {
if (CABLE.mode) {
if (rid != undefined) {
CABLE.plot()
}
}
else {
if (rid != undefined) {
RACK.init();
if (!this.first) {
CAGE.init();
this.first = true;
}
}
}
}
else {
if (rid != undefined) {
RACK.init();
if (!this.first) {
CAGE.init();
this.first = true;
}
}
}
},
makeNavData: function(key, f_key, r_key, uprom) {
if (uprom == undefined) {
uprom = true
}
div = $('#building_nav')
div.html('')
//building
$('<li></li>').addClass('menu_div menu_ico menu_building').css('margin-left', '10px').appendTo(div)
b = $('<li></li>').addClass('menu_div').appendTo(div)
b_a = $('<a/>').addClass('menu_a').attr('href', '#').appendTo(b)
$('<div/>').addClass('menu_name').appendTo(b_a)
b_ul = $('<ul/>').addClass('sub_menu').appendTo(b)
//arrow
//$('<li></li>').addClass('menu_div menu_arrow').appendTo(div)
//$('<li></li>').addClass('menu_div').html('<a href="#"><div class="menu_name">>></div></a>').appendTo(div)
//floor
$('<li></li>').addClass('menu_div menu_ico menu_floor').appendTo(div)
f = $('<li></li>').addClass('menu_div').appendTo(div)
f_a = $('<a/>').addClass('menu_a').attr('href', '#').appendTo(f)
$('<div/>').addClass('menu_name').appendTo(f_a)
f_ul = $('<ul/>').addClass('sub_menu').appendTo(f)
//arrow
$('<li></li>').addClass('menu_div menu_ico menu_room').appendTo(div)
//$('<li></li>').addClass('menu_div').html('<a href="#"><div class="menu_name">>></div></a>').appendTo(div)
//room
r = $('<li></li>').addClass('menu_div').appendTo(div)
r_a = $('<a/>').addClass('menu_a').attr('href', '#').appendTo(r)
$('<div/>').addClass('menu_name').appendTo(r_a)
r_ul = $('<ul/>').addClass('sub_menu').appendTo(r)
//arrow
//$('<li></li>').addClass('menu_div menu_arrow').appendTo(div)
//$('<li></li>').addClass('menu_div').html('<a href="#"><div class="menu_name" style="width:10px;"> </div></a>').appendTo(div)
/*
a=$('<li></li>').addClass('menu_div').appendTo(div)
a_a=$('<a/>').attr('id','room_action').addClass('menu_a').attr('href','#').appendTo(a)
$('<div/>').addClass('icon_menu').html('<div class="icons head_action"></div>').appendTo(a_a)
a_ul=$('<ul/>').addClass('sub_menu').appendTo(a)
li=$('<li></li>').addClass('sub_menu_div').appendTo(a_ul)
li_a=$('<a/>').attr({'href':'#','t':'a','i':'new'}).appendTo(li)
d=$('<div/>').appendTo(li_a)
$(d).html('add new rack')
*/
/*
a=$('<li></li>').attr('id','room_reload').css('display','none').addClass('menu_div').appendTo(div)
a_a=$('<a/>').addClass('menu_a').attr('href','#').appendTo(a)
$('<div/>').addClass('icon_menu').html('<div class="icons head_reload"></div>').appendTo(a_a)
a_ul=$('<ul/>').addClass('sub_menu').appendTo(a)
li=$('<li></li>').addClass('sub_menu_div').appendTo(a_ul)
li_a=$('<a/>').attr({'href':'#','t':'a','i':'back'}).appendTo(li)
d=$('<div/>').appendTo(li_a)
$(d).html('current room')
*/
$.each(this.navdata, function(i, item) { //buildings
if (key == undefined) {
key = item.id
HEADER.bid = key
}
if (key == item.id) {
$(b_a).find('div').html(item.name)
if (item.floors.length == 0) {
$(f_a).find('div').html('<span class="notset">not set</span>')
$(r_a).find('div').html('<span class="notset">not set</span>')
$('#room_action').hide()
}
//get floors
$.each(item.floors, function(ii, floor) { //floors
if (f_key == undefined) {
f_key = floor.id;
HEADER.fid = f_key
}
if (f_key == floor.id) {
$(f_a).find('div').html(floor.name)
if (floor.rooms.length == 0) {
$('#room_action').hide()
$(r_a).find('div').html('<span class="notset">not set</span>')
}
//get rooms
$.each(floor.rooms, function(ii, room) { //floors
if (r_key == undefined) {
r_key = room.id;
HEADER.rid = r_key
}
if (r_key == room.id) {
$('#room_action').show()
$(r_a).find('div').html(room.name)
}
li = $('<li></li>').addClass('sub_menu_div').appendTo(r_ul)
li_a = $('<a/>').attr({'href': '#', 't': 'r', 'i': room.id}).appendTo(li)
d = $('<div/>').appendTo(li_a)
$(d).html(room.name)
});
}
li = $('<li></li>').addClass('sub_menu_div').appendTo(f_ul)
li_a = $('<a/>').attr({'href': '#', 't': 'f', 'i': floor.id}).appendTo(li)
d = $('<div/>').appendTo(li_a)
$(d).html(floor.name)
});
}
li = $('<li></li>').addClass('sub_menu_div').appendTo(b_ul)
li_a = $('<a/>').attr({'href': '#', 't': 'b', 'i': item.id}).appendTo(li)
d = $('<div/>').appendTo(li_a)
$(d).html(item.name)
});
this.setNavAction()
if (uprom)
this.updateRoom(r_key)
},
setLogoAction: function() {
$("ul.menu_noc li").mouseover(function() {
$(this).parent().find("ul.sub_menu").show()
$(this).parent().hover(function() {
}, function() {
$(this).parent().find("ul.sub_menu").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
});
});
},
setNavAction: function() {
NOC.setNavAction();
$("#building_nav li.sub_menu_div a").click(function() {
HEADER.navclick(this);
});
NOC.tooltipset()
},
getdata: function() {
$.postJSON('basic/ajax/headnav', function(data) {
if (data.license) {
WIN.show('#win_license')
HEADER.setLogoAction();
} else {
HEADER.navdata = data
HEADER.makeNavData();
}
});
}
}
var ELEMENT = {
_checkbox: function(d) {
atr = Number($(d).attr('act'))
m = $(d).find('div.icons')[0]
if (atr == 0) {
$(d).attr('act', 1)
$(m).addClass('active')
a = 1;
} else {
$(d).attr('act', 0)
$(m).removeClass('active')
a = 0;
}
return a;
}
}
var RAID = {
init: function(d) {
this.set = true
this.inp = $('#win_raid select.raid_size')
for (i = 0; i <= 64; i++) {
$('<option/>').val(i).html(i).appendTo(this.inp)
}
this.row = 0
this.add = 0
this.data = false
this.select = false
this.sel = $('#win_raid select.raid_type')
this.tot = $('#win_raid input.raid_total')
this.tab = $('#win_raid div.disc_table')
this.tot.numeric();
this.tot.addClass('disabled');
this.ctot = 0;
this.sel.change(function() {
v = $(this).val()
$.postJSON('basic/device/raid/type', {'eid': eid, 'type': v, 'tmp': RAID.tmp}, function(json) {
});
RAID.updateValue()
});
this.inp.change(function(e) {
//$('<div></div>').addClass('disk_id').html('<div class="wnums">'+c+'.</div>').appendTo(div)
//$('<div></div>').addClass('hdd_detail').appendTo(div)
v = $(this).val()
if (v.length < 0) {
$(this).val(RAID.size)
} else {
RAID.setsize(v)
}
});
$('#win_raid_layer1 div.edit_action li').click(function(){
switch(Number($(this).attr('m'))){
case 1:
RAID.win_new_hdd()
break;
}
});
},
updateValue: function() {
winp = $(this.div).parent().find('input')
if (this.sel.val() > 1) {
r = this.sel.find('option:selected').text() + ', discs:' + this.inp.val() + ', cap:' + RAID.ctot + ' GB'
} else {
r = 'Raid:none, discs:' + this.inp.val() + ', cap:' + RAID.ctot + ' GB'
}
winp.val(r)
},
setsize: function(s) {
if (s != this.size) {
WIN.show('#win_raid')
$('#win_raid div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
if (s > 50)
s = 50;
$.postJSON('basic/device/raid/size', {'eid': eid, 'size': s, 'tmp': RAID.tmp}, function(json) {
RAID.make(json)
});
this.updateValue()
RAID.last = 0
}
},
remove: function(obj) {
$.postJSON('basic/device/raid/delete', {'eid': 80, 'rid': obj.attr('row'), 'type': 2, 'val': 50, 'tmp': false}, function(json) {
obj.remove();
RAID.size--;
RAID.settotal();
$.postJSON('basic/device/raid/get', {'eid': eid, 'tmp': RAID.tmp}, function(json) {
RAID.make(json)
});
});
},
settotal: function() {
RAID.ctot = 0;
$.each($(RAID.tab).find('.dsize'), function() {
if ($(this).val() != '') {
RAID.ctot += Number($(this).val());
}
});
if (RAID.ctot != this.total) {
$('#win_raid div.win_mask').show()
$('#win_raid div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
console.log("total " + RAID.ctot)
$.postJSON('basic/device/raid/total', {'eid': eid, 'total': RAID.ctot, 'tmp': RAID.tmp}, function(json) {
RAID.make(json)
});
this.updateValue()
}
},
open: function(d, tmp, data) {
this.div = d
this.tmp = tmp
RAID.data = true;
if (typeof data !== 'undefined') {
eid = data.id
RAID.data = data
}
else {
RAID.data = false;
eid = $(d).parent().parent().attr('eid')
}
WIN.show('#win_raid')
$('#win_raid div.win_mask').show()
//$('#win_raid div.win_layer').removeClass('win_visible');
$('#win_raid div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
$.postJSON('basic/device/raid/get', {'eid': eid, 'tmp': tmp}, function(json) {
RAID.make(json)
});
},
addRow: function(d, div, c) {
RAID.row = d.id;
div = $(div).addClass('row').attr('row', d.id)
$('<div></div>').addClass('disk_id').html('<div class="wnums">' + c + '.</div>').appendTo(div)
$('<div></div>').addClass('hdd_detail').appendTo(div)
$('<div></div>').addClass('cell').html(
'<fieldset><legend>VPort:</legend><input class="vport" placeholder="none" n="1" value="' + d.port + '">' +
'</fieldset><fieldset><legend>Size:</legend><input class="dsize" placeholder="-" n="2" value="' + d.size + '">' +
'</fieldset>').appendTo(div);
$('<div></div>').addClass('cell').html('<fieldset><legend>Model / Type:</legend>' +
'<input class="dmodel" placeholder="model/type" n="3" value="' + d.model + '"></fieldset>' +
'<fieldset><legend>Serial Number:</legend><input class="dsn" placeholder="S/N" n="4" value="' + d.sn + '">' +
'</fieldset>').appendTo(div);
$('<div class="remove icons"></div><div class="clear:both"></div>').appendTo(div)
$(div).appendTo(this.tab);
},
make: function(json) {
if (!this.set)
this.init()
this.id = json.eid;
$('#win_raid div.dataLoad').remove()
//$('#win_raid_layer1').addClass('win_visible');
//$('#win_raid div.win_menu li').removeClass('aktive')
//$('#win_raid div.win_menu li:first').addClass('aktive')
this.type = json.type
this.size = json.size
this.total = json.total
this.sel.val(json.type)
this.inp.val(json.size)
this.tab.html('')
$.each(json.items, function(i, e) {
div = $('<div></div>')
RAID.addRow(e, div, i + 1)
div.appendTo(RAID.win)
});
RAID.ctot = 0;
$.each($(this.tab).find('.dsize'), function() {
if ($(this).val() != '') {
RAID.ctot += Number($(this).val());
}
});
this.tot.val(RAID.ctot)
this.updateValue()
addhdd = $('<div></div>').html(
'<fieldset class="newdiscadd" tab="2">' +
'<legend class="fieldmenu"><span class="anew">Add new disc</span></legend>' +
'<div class="add_element"><div class="icons"></div></div></fieldset>').appendTo(this.tab)
$('.newdiscadd').bind('click', function() {
RAID.setsize(RAID.size + 1)
});
$('.row .remove').click(function() {
RAID.remove($(this).parent());
});
if (RAID.data) {
rid = this.data.rid
wid = $('#win_raid div.disc_table').closest('.win_layer').attr('id')
wid = wid.substring(wid.length - 1, wid.length)
$('#win_raid div.win_menu').find('li[layout="' + wid + '"]').click()
row = $('#win_raid').find('div[row="' + rid + '"]')
pos=0
$.each(json.items,function(k,v) {
if(v.id == row.attr('row'))
pos=k;
});
$('#win_raid .win_data').scrollTop(pos*100)
row.addClass('active');
}
$('#win_raid div.win_mask').hide()
$(this.tab).find('input').bind('blur focus keydown', function(e) {
//enter pressed
if (e.type == 'keydown') {
if (e.keyCode == 13) {
$(this).blur()
}
}
if (e.type == 'focus')
$(this).addClass('focused')
if (e.type == 'blur') {
$(this).removeClass('focused')
v = $(this).val()
//id of data
rid = $(this).parents('.row').attr('row')
type = $(this).attr('n')
$.postJSON('basic/device/raid/set', {'eid': RAID.id, 'rid': rid, 'type': type, 'val': v, 'tmp': RAID.tmp}, function(json) {
});
RAID.settotal();
}
});
//m='<tr><td><input class="size_small" value="p"></td><td><input class="size_small2" value="279.39 GB"></td><td><input class="size_large" value="SEAGATE ST3300657SS"></td></tr>'
},
setsize2: function(data, pop) {
RAID.ctot = RAID.size + data.val
$.postJSON('basic/device/raid/new', {
'eid': data.eid,
'val': RAID.ctot,
'vport': data.vport,
'dsize': data.dsize,
'dmodel': data.dmodel,
'dsn': data.dsn,
'tmp': RAID.tmp
}, function(json) {
RAID.make(json)
RAID.settotal()
pop.win.remove()
});
},
getWinField: function(win, type) {
var fields={}
$.each($(win).find(type),function(i,e) {
fields[$(e).attr('class')]=$(e).val()
})
return fields
},
win_new_hdd: function() {
var pop = new POPUP.init(
'Add HDD/RAID', //popup title
'win_add_hdd', //popup name
'win_raid', //parent window
{
w: 350, //width
h: 330, //height
wdclass: 'orange2'
})
var args = {
save: false, //save button
rem: false, //remove button
cancel: true, //cancel
add: true, //add
}
pop.data(
args,
'<div class="win_data" style="height:400px;">'
+ '<div class="win_layer win_visible">'
+ '<div class="datadiv" style="width:260px;">'
+ '<fieldset class="dta"><legend>Discs to add:</legend><select class="discs_to_add"></select></fieldset>'
+ '<fieldset><legend>VPort:</legend><input class="vport" placeholder="none" n="1" value="">'
+ '</fieldset><fieldset><legend>Size:</legend><input class="dsize" placeholder="-" n="2" value="">'
+ '</fieldset><fieldset><legend>Model / Type:</legend><input class="dmodel" placeholder="model/type" n="3" value="">'
+ '</fieldset><fieldset><legend>Serial Number:</legend><input class="dsn" placeholder="S/N" n="4" value="">'
+ '<fieldset style="position:absolute;bottom:10px;right:10px;"><legend></legend>'
+ '</div>'
+ '</div>'
);
for (i = 0; i <= 32; i++)
$('<option/>').val(i).html(i).appendTo($('#pop_win_add_hdd .discs_to_add'))
$('#pop_win_add_hdd .dsize').numeric();
pop.actionSet('win_rack', ['close', 'cancel'], function() {
pop.win.remove()
});
pop.actionSet('windows', ['add'], function() {
var fields = RAID.getWinField('#pop_win_add_hdd', 'input')
var val = Number($('#pop_win_add_hdd .discs_to_add').val())
RAID.setsize2({
'eid': RAID.id,
'val': val,
'vport': fields['vport'],
'dsize': fields['dsize'],
'dmodel': fields['dmodel'],
'dsn': fields['dsn'],
'tmp': RAID.tmp
},pop)
});
}
}
var RAM = {
init: function(d) {
this.set = true
this.tot = $('#win_ram input.ram_total')
this.tot.addClass('disabled');
this.tot.numeric();
this.ctot = 0;
this.row = 0
this.add = 0
this.data = false
this.select = false
this.sel = $('#win_ram select.ram_type')
this.tab = $('#win_ram div.ram_table')
this.inp = $('#win_ram select.ram_size')
this.mta = $('#win_ram select.modules_to_add')
for (i = 0; i <= 32; i++)
$('<option/>').val(i).html(i).appendTo(this.inp)
$('<option>').val('0').html('Choose...').appendTo(this.mta)
for (i = 0; i <= 32; i++)
$('<option/>').val(i).html(i).appendTo(this.mta)
this.sel.change(function() {
v = $(this).val()
$.postJSON('basic/device/ram/type', {'eid': eid, 'type': v, 'tmp': RAM.tmp}, function(json) {
});
RAM.updateValue()
});
this.inp.change(function(e) {
v = $(this).val()
if (v.length < 0) {
$(this).val(RAM.size)
} else {
RAM.setsize(v)
}
});
$('#win_ram_layer1 div.edit_action li').click(function() {
switch (Number($(this).attr('m'))) {
case 1:
RAM.win_new_ram(this);
break;
}
});
},
updateValue: function() {
winp = $(this.div).parent().find('input')
if (this.sel.val() > 1) {
r = this.sel.find('option:selected').text() + ', modules:' + this.inp.val() + ', cap:' + this.tot.val() + ' MB'
} else {
r = 'Ram: none, modules:' + this.inp.val() + ', cap:' + this.tot.val() + ' MB'
}
winp.val(r)
},
setsize: function(s) {
if (s != this.size) {
$('#win_ram div.win_mask').show()
$('#win_ram div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
//if(s>50) s=50;
$.postJSON('basic/device/ram/size', {'eid': eid, 'size': s, 'tmp': RAM.tmp}, function(json) {
RAM.make(json)
});
this.updateValue()
}
},
remove: function(obj) {
$.postJSON('basic/device/ram/delete', {'eid': 9, 'rid': obj.attr('row'), 'type': 2, 'val': 50, 'tmp': false}, function(json) {
obj.remove();
RAM.size--;
RAM.settotal();
$.postJSON('basic/device/ram/get', {'eid': eid, 'tmp': RAM.tmp}, function(json) {
RAM.make(json)
});
});
},
settotal: function() {
RAM.ctot = 0;
$.each($(RAM.tab).find('.dsize'), function() {
if ($(this).val() != '') {
RAM.ctot += Number($(this).val());
}
});
if (RAM.ctot != this.total) {
$('#win_ram div.win_mask').show()
$('#win_ram div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
//if(s>100) s=100;
$.postJSON('basic/device/ram/total', {'eid': eid, 'total': RAM.ctot, 'tmp': RAM.tmp}, function(json) {
RAM.make(json)
});
this.updateValue()
}
},
open: function(d, tmp, data) {
this.div = d
this.tmp = tmp
eid = $(d).parent().parent().attr('eid')
RAM.data = true;
if (typeof data !== 'undefined') {
eid = data.id
RAM.data = data
}
else {
RAM.data = false;
eid = $(d).parent().parent().attr('eid')
}
WIN.show('#win_ram')
$('#win_ram div.win_mask').show()
$('#win_ram div.win_data').append($('<div/>').addClass('dataLoad').html('loading data..'))
$.postJSON('basic/device/ram/get', {'eid': eid, 'tmp': RAM.tmp}, function(json) {
RAM.make(json)
});
},
addRow: function(d, tr, c) {
RAM.row = d.id;
div = $(div).addClass('row').attr('row', d.id)
$('<div></div>').addClass('disk_id').html('<div class="wnums">' + c + '.</div>').appendTo(div)
$('<div></div>').addClass('mem_detail').appendTo(div)
$('<div></div>').addClass('cell').html(
'<fieldset><legend>VPort:</legend><input class="vport" placeholder="none" n="1" value="' + d.port + '">' +
'</fieldset><fieldset><legend>Size:</legend><input class="dsize" placeholder="-" n="2" value="' + d.size + '">' +
'</fieldset>').appendTo(div);
$('<div></div>').addClass('cell').html('<fieldset><legend>Model / Type:</legend>' +
'<input class="dmodel" placeholder="model/type" n="3" value="' + d.model + '"></fieldset>' +
'<fieldset><legend>Serial Number:</legend><input class="dsn" placeholder="S/N" n="4" value="' + d.sn + '">' +
'</fieldset>').appendTo(div);
$('<div class="remove icons"></div><div class="clear:both"></div>').appendTo(div)
$(div).appendTo(this.tab);
},
make: function(json) {
if (!this.set)
this.init()
this.id = json.eid;
$('#win_ram div.dataLoad').remove()
this.type = json.type
this.size = json.size
this.total = json.total
this.sel.val(json.type)
this.inp.val(json.size)
this.tab.html('')
$.each(json.items, function(i, e) {
div = $('<div></div>')
RAM.addRow(e, div, i + 1)
div.appendTo(RAM.win)
});
RAM.ctot = 0;
$.each($(this.tab).find('.dsize'), function() {
if ($(this).val() != '') {
RAM.ctot += Number($(this).val());
}
});
this.tot.val(RAM.ctot)
this.updateValue()
$('<div></div>').html(
'<fieldset class="newmoduleadd" tab="2">' +
'<legend class="fieldmenu"><span class="anew">Add new module</span></legend>' +
'<div class="add_element"><div class="icons"></div></div></fieldset>').appendTo(this.tab)
$('.newmoduleadd').bind('click', function() {
RAM.setsize(RAM.size + 1)
});
$('.row .remove').click(function() {
RAM.remove($(this).parent());
});
if (RAM.data) {
rid=this.data.rid
wid=this.tab.closest('.win_layer').attr('id')
wid=wid.substring(wid.length - 1, wid.length)
$('#win_ram div.win_menu').find('li[layout="' + wid + '"]').click()
row=$('#win_ram').find('div[row="' + rid + '"]')
pos=0
$.each(json.items,function(k,v) {
if(v.id == row.attr('row'))
pos=k;
});
$('#win_ram .win_data').scrollTop(pos*100)
row.addClass('active');
}
$('#win_ram div.win_mask').hide()
$(this.tab).find('input').bind('blur focus keydown', function(e) {
//enter pressed
if (e.type == 'keydown') {
if (e.keyCode == 13) {
$(this).blur()
}
}
if (e.type == 'focus')
$(this).addClass('focused')
if (e.type == 'blur') {
$(this).removeClass('focused')
v = $(this).val()
//id of data
rid = $(this).parents('.row').attr('row')
type = $(this).attr('n')
$.postJSON('basic/device/ram/set', {'eid': RAM.id, 'rid': rid, 'type': type, 'val': v, 'tmp': RAM.tmp}, function(json) {
});
RAM.settotal();
}
});
},
setsize2: function(data, pop) {
RAM.ctot = RAM.size + data.val
$.postJSON('basic/device/ram/new', {
'eid': data.eid,
'val': RAM.ctot,
'vport': data.vport,
'dsize': data.dsize,
'dmodel': data.dmodel,
'dsn': data.dsn,
'tmp': RAM.tmp
}, function(json) {
RAM.make(json)
RAM.settotal()
pop.win.remove()
});
},
getWinField: function(win, type) {
var fields={}
$.each($(win).find(type),function(i,e) {
fields[$(e).attr('class')]=$(e).val()
})
return fields
},
win_new_ram: function(div) {
var pop = new POPUP.init(
'Add RAM', //popup title
'win_add_ram', //popup name
'win_ram', //parent window
{
w: 350, //width
h: 330, //height
wdclass: 'orange2'
})
var args = {
save: false, //save button
rem: false, //remove button
cancel: true, //cancel
add: true, //add
}
pop.data(
args,
'<div class="win_data" style="height:400px;">'
+ '<div class="win_layer win_visible">'
+ '<div class="datadiv" style="width:260px;">'
+ '<fieldset class="dta"><legend>Modules to add:</legend><select class="discs_to_add"></select></fieldset>'
+ '<fieldset><legend>VPort:</legend><input class="vport" placeholder="none" n="1" value="">'
+ '</fieldset><fieldset><legend>Size:</legend><input class="dsize" placeholder="-" n="2" value="">'
+ '</fieldset><fieldset><legend>Model / Type:</legend><input class="dmodel" placeholder="model/type" n="3" value="">'
+ '</fieldset><fieldset><legend>Serial Number:</legend><input class="dsn" placeholder="S/N" n="4" value="">'
+ '<fieldset style="position:absolute;bottom:10px;right:10px;"><legend></legend>'
+ '</div>'
+ '</div>'
);
for (i = 0; i <= 32; i++)
$('<option/>').val(i).html(i).appendTo($('#pop_win_add_ram .discs_to_add'))
$('#pop_win_add_ram .dsize').numeric();
pop.actionSet('win_ram', ['close', 'cancel'], function() {
pop.win.remove()
});
pop.actionSet('windows', ['add'], function() {
var fields = RAM.getWinField('#pop_win_add_ram', 'input')
var val = Number($('#pop_win_add_ram .discs_to_add').val())
RAM.setsize2({
'eid': RAM.id,
'val': val,
'vport': fields['vport'],
'dsize': fields['dsize'],
'dmodel': fields['dmodel'],
'dsn': fields['dsn'],
'tmp': RAM.tmp
},pop)
});
}
}
var BUILDING = {
init: function() {
if (!this.loaded) {
this.loaded = true;
this.settree();
}
},
getObject: function(id, rel) {
sameid = getObjects(HEADER.navdata, "id", id)
m = getObjects(sameid, "rel", rel)
return m[0]
},
getNavOb: function(obj) {
rel = $(obj).attr('rel')
id = $(obj).attr('id').replace(rel + '_', '')
return this.getObject(id, rel);
},
getNavParentOb: function(obj) {
rel = $(obj).parent().parent().attr('rel')
id = $(obj).parent().parent().attr('id').replace(rel + '_', '')
return this.getObject(id, rel);
},
createData: function(val) {
//attributes
rel = $(val).attr('rel')
id = $(val).attr('id').replace(rel + '_', '')
n = $(val).find('a:first').text()
//new object data
data = new Object();
data.name = n.substring(1, n.length)
data.id = id
data.rel = rel
return data
},
removeByValue: function(arr, val) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) {
arr.splice(i, 1);
break;
}
}
},
updateHeadNav: function(c, val) {
upset = false
rel = $(val).attr('rel')
//switch action
switch (c) {
case 'create':
data = this.createData(val)
switch (rel) {
//switch action rel
case 'building':
data.floors = Array();
HEADER.navdata.push(data)
break;
case 'floor':
data.rooms = Array();
p = this.getNavParentOb(val)
p.floors.push(data)
break;
case 'room':
p = this.getNavParentOb(val)
p.rooms.push(data)
break;
}
break;
case 'rename':
data = this.createData(val)
p = this.getNavOb(val)
p.name = data.name
break;
case 'remove':
rel = val.rslt.obj.attr('rel')
switch (rel) {
case 'building':
bid = val.rslt.obj.attr('id').replace('building_', '')
if (HEADER.bid == bid) {
HEADER.bid = undefined;
HEADER.fid = undefined;
HEADER.rid = undefined;
upset = true
}
p = HEADER.navdata
break;
case 'floor':
fid = val.rslt.obj.attr('id').replace('floor_', '')
if (HEADER.fid == fid) {
HEADER.fid = undefined;
HEADER.rid = undefined;
upset = true
}
pt = this.getNavOb(val.rslt.parent)
p = pt.floors
break;
case 'room':
rid = val.rslt.obj.attr('id').replace('room_', '')
if (HEADER.rid == rid) {
HEADER.rid = undefined;
upset = true
}
pt = this.getNavOb(val.rslt.parent)
p = pt.rooms
break;
}
o = this.getNavOb(val.rslt.obj)
this.removeByValue(p, o)
break;
}
HEADER.makeNavData(HEADER.bid, HEADER.fid, HEADER.rid, upset)
},
settree: function() {
$("#building_tree")
.bind("before.jstree", function(e, data) {
$("#alog").append(data.func + "<br />");
})
.jstree({
// List of active plugins
"plugins": [
"themes", "json_data", "ui", "crrm", "dnd", "types"
],
// I usually configure the plugin that handles the data first
// This example uses JSON as it is most common
"json_data": {
// This tree is ajax enabled - as this is most common, and maybe a bit more complex
// All the options are almost the same as jQuery's AJAX (read the docs)
"ajax": {
// the URL to fetch the data
"url": "./basic/building",
//type
"type": 'POST',
// the `data` function is executed in the instance's scope
// the parameter is the node being loaded
// (may be -1, 0, or undefined when loading the root nodes)
"data": function(n) {
// the result is fed to the AJAX request `data` option
return {
"rel": n.attr ? n.attr("rel") : 'root',
"id": n.attr ? n.attr("id").replace(n.attr("rel") + '_', '') : '0'
};
}
}
},
// Using types - most of the time this is an overkill
// read the docs carefully to decide whether you need types
"types": {
// I set both options to -2, as I do not need depth and children count checking
// Those two checks may slow jstree a lot, so use only when needed
"max_depth": -2,
"max_children": -2,
// I want only `drive` nodes to be root nodes
// This will prevent moving or creating any other type as a root node
"valid_children": ["building"],
"types": {
// The default type
"room": {
// I want this type to have no children (so only leaf nodes)
// In my case - those are files
"valid_children": "none",
// If we specify an icon for the default type it WILL OVERRIDE the theme icons
"icon": {
"image": "assets/img/icons.png",
"position": "-125px -75px"
}
},
// The `floor` type
"floor": {
// can have files and other folders inside of it, but NOT `drive` nodes
"valid_children": ["room"],
"icon": {
"image": "assets/img/icons.png",
"position": "-100px -75px"
}
},
// The `building` nodes
"building": {
// can have files and folders inside, but NOT other `drive` nodes
"valid_children": ["floor"],
"icon": {
"image": "assets/img/icons.png",
"position": "-75px -75px"
},
// those prevent the functions with the same name to be used on `drive` nodes
// internally the `before` event is used
"start_drag": false,
"move_node": false,
"remove": false
}
}
},
"core": {
// just open those two nodes up
// as this is an AJAX enabled tree, both will be downloaded from the server
"initially_open": ["building_1", "floor_1"]
}
})
.bind("create.jstree", function(e, data) {
$.postJSON(
"/basic/building/create",
{
"id": data.rslt.parent != -1 ? data.rslt.parent.attr("id").replace(data.rslt.parent.attr("rel") + "_", "") : 0,
"position": data.rslt.position,
"title": data.rslt.name,
"type": data.rslt.obj.attr("rel")
},
function(m) {
if (m.status) {
$(data.rslt.obj).attr("id", '' + m.id);
BUILDING.updateHeadNav('create', data.rslt.obj)
$.postJSON('basic/ajax/headnav', function(data) {
HEADER.navdata = data
});
}
else {
$.jstree.rollback(data.rlbk);
}
}
);
})
.bind("remove.jstree", function(e, data) {
BUILDING.updateHeadNav('remove', data)
$.postJSON(
"/basic/building/remove",
{
"id": data.rslt.obj.attr("id").replace(data.rslt.obj.attr("rel") +"_", ""),
"type": data.rslt.obj.attr("rel")
},
function(r) {
if (!r.status) {
data.inst.refresh();// $.jstree.rollback(data.rlbk);
} else {
}
}
);
//
})
.bind("rename.jstree", function(e, data) {
if (data.rslt.new_name != data.rslt.old_name) {
$.postJSON(
"/basic/building/rename",
{
"id": data.rslt.obj.attr("id").replace(data.rslt.obj.attr("rel") + "_", ""),
"title": data.rslt.new_name,
"type": data.rslt.obj.attr("rel")
},
function(r) {
if (!r.status) {
$.jstree.rollback(data.rlbk);
} else {
BUILDING.updateHeadNav('rename', data.rslt.obj)
}
}
);
}
})
.bind("select_node.jstree", function(e, data) {
BUILDING.selected = data.rslt.obj
rel = data.rslt.obj.attr('rel')
switch (rel) {
default:
//root
set = Array(true, false, false, false, false, false, false, false, false)
break;
case 'building':
//building
set = Array(true, true, true, true, false, false, false, false, false)
break;
case 'floor':
//floor
set = Array(true, false, false, false, true, true, true, false, false)
break;
case 'room':
//room
set = Array(true, false, false, false, false, false, false, true, true)
break;
}
butt = $('#win_building div.win_button')
$.each(butt, function(i, e) {
if (set[i]) {
$(this).removeClass('disabled')
} else {
$(this).addClass('disabled')
}
});
})
;
$('#win_building div.win_button').click(function() {
dis = $(this).hasClass('disabled')
if (!dis) {
BUILDING.action(this);
}
});
},
action: function(d) {
t = $(d).parent().attr('id')
m = $(d).attr('m')
switch (t) {
case 'bul_act':
break;
case 'fl_act':
break;
case 'rm_act':
break;
}
switch (m) {
case '1':
if (t == 'bul_act') {
w = -1;
} else {
w = null;
}
$("#building_tree").jstree("create", w, "last", "enter name");
break;
case '2':
$("#building_tree").jstree("rename");
break;
case '3':
switch (t) {
case 'bul_act':
tx = 'building'
break;
case 'fl_act':
tx = 'room'
break;
case 'rm_act':
tx = 'floor'
break;
}
WIN.prompt('Warning', 'Huh, are you sure want to delete ' + tx + '? all data will be erased !', 0);
break;
}
},
remove: function() {
$("#building_tree").jstree("remove");
}
}
function grayscale(src) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var imgObj = new Image();
imgObj.src = src;
canvas.width = imgObj.width;
canvas.height = imgObj.height;
ctx.drawImage(imgObj, 0, 0);
var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
for (var y = 0; y < imgPixels.height; y++) {
for (var x = 0; x < imgPixels.width; x++) {
var i = (y * 4) * imgPixels.width + x * 4;
var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
imgPixels.data[i] = avg;
imgPixels.data[i + 1] = avg;
imgPixels.data[i + 2] = avg;
}
}
ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
return canvas.toDataURL();
}
function zipupload(e) {
//var elid=$(e).parent().parent().parent().attr('eid')
//var cont=$(e).parent().parent().find('div.img_container')
var div = $(e).parent().parent().parent()
var count = 0;
var butt = $(e).parent()
this.upload = new AjaxUpload($(e), {
action: './basic/templates/upload',
name: 'image',
data: {
},
autoSubmit: true,
responseType: 'json',
onChange: function(file, ext) {
},
onSubmit: function(file, ext) {
WIN.interval = setInterval(function() {
count += 4;
if (count > 60)
count = 0;
$(div).css({'background-position': count + 'px 10px'});
}, 50)
$(div).addClass('upload_track')
$(butt).hide()
// Allow only images.
if (ext && /^(zip)$/i.test(ext)) {
this.setData({
});
} else {
$(div).removeClass('upload_track')
if (WIN.interval)
clearInterval(WIN.interval)
$(butt).show()
alert('That is not ZIP archive !');
return false;
}
},
onError: function(file, r) {
console.log(file, r)
},
onComplete: function(file, r) {
$(butt).show()
$(div).removeClass('upload_track')
if (WIN.interval)
clearInterval(WIN.interval)
if (r.err == 'NO') {
TEMPLATE.cat.val(r.category)
m = new Object();
m.data = r.templates
m.nid = r.device
TEMPLATE.loadSel(m)
} else {
alert(r.err)
}
/*
if(r.status=='ok'){
r.tmpl=tmp
WIN.addImageField(cont[0],r)
}
*/
}
});
}
function imageupload(e, t) {
var elid = $(e).parent().parent().parent().parent().parent().attr('eid')
var cont = $(e).parent().parent().parent().parent().find('div.img_container')
var div = $(e).parent().parent().parent()
var count = 0;
var tmp = t;
var butt = $(e).parent()
this.upload = new AjaxUpload($(e), {
action: './basic/image/upload',
name: 'image',
data: {
},
autoSubmit: true,
responseType: 'json',
onChange: function(file, ext) {
},
onSubmit: function(file, ext) {
WIN.interval = setInterval(function() {
count += 4;
if (count > 60)
count = 0;
$(div).css({'background-position': count + 'px 0px'});
}, 50)
$(div).addClass('upload_track')
$(butt).hide()
// Allow only images.
if (ext && /^(jpg|png|jpeg|gif)$/i.test(ext)) {
this.setData({
'key1': DEVICE.id,
'key2': elid,
'key3': tmp
});
} else {
$(div).removeClass('upload_track')
if (WIN.interval)
clearInterval(WIN.interval)
$(butt).show()
alert('not image');
return false;
}
},
onError: function(file, r) {
console.log(file, r)
},
onComplete: function(file, r) {
$(butt).show()
$(div).removeClass('upload_track')
if (WIN.interval)
clearInterval(WIN.interval)
if (r.status == 'ok') {
r.tmpl = tmp
WIN.addImageField(cont[0], r)
}
}
});
}
var DOMAINS = {
init: function() {
this.table = $('#domaintable')
$.postJSON('/basic/domain/ip', '', function(json) {
DOMAINS.make(json)
});
},
make: function(json) {
this.table.html('')
tr = $('<tr/>').addClass('head')
$('<td/>').text('IP address').attr({'valign': 'top'}).appendTo(tr)
$('<td/>').text('Hostname/Domain').attr({'valign': 'top'}).appendTo(tr)
tr.appendTo(this.table)
$.each(json.data, function(i, e) {
tr = $('<tr/>')
td1 = $('<td/>').text(e.ip).attr({'valign': 'top'}).appendTo(tr)
td2 = $('<td/>').text(e.host).attr({'valign': 'top'}).appendTo(tr)
tr.appendTo(DOMAINS.table)
$.each(e.vps, function(ii, vps) {
tr = $('<tr/>')
td1 = $('<td/>').css('padding-left', '10px').text('-').attr({'valign': 'top'}).appendTo(tr)
td2 = $('<td/>').text(vps.host).attr({'valign': 'top'}).appendTo(tr)
tr.appendTo(DOMAINS.table)
$.each(vps.ips, function(iii, ip) {
tr = $('<tr/>')
td1 = $('<td/>').css('padding-left', '20px').text(ip.data).attr({'valign': 'top'}).appendTo(tr)
td2 = $('<td/>').text('...').attr({'valign': 'top'}).appendTo(tr)
tr.appendTo(DOMAINS.table)
});
});
});
}
}
var SEARCH = {
docmouseup: function(a) {
$('#searchdata').hide()
},
tabs: function(data) {
num = 0;
$.each(data, function(a, item) {
set = false
if (item.items.length > 0) {
$.each(item.items, function(i, d) {
t = ''
if (!set) {
t = item.type
set = true
}
newTR = $('<tr id="s_tab' + num + '" ind="' + num + '" class="card" style="overflow:hidden;"></tr>')
td = $('<td/>').addClass('title').attr('t', item.tn).html(t).appendTo(newTR)
td2 = $('<td/>').html('<div itd="' + d.id + '" tab="' + d.tab + '" dev="' + d.dev + '" rack="' + d.rack + '" f="' + d.floor + '" b="' + d.building + '" room="' + d.room + '" rid="' + d.rid + '" class="data">'+d.name+'</div>').appendTo(newTR)
num++;
//td2=$('<td/>').attr(data.id).html(data.name).appendTo(newTR)
$(SEARCH.table).append(newTR)
});
}
});
if (num > 0)
$('#searchdata').show()
$(SEARCH.table).find('tr.card').hover(function(e) {
$(SEARCH.table).find('tr.card').removeClass('over');
$(this).addClass('over')
SEARCH.index = Number($(this).attr('ind'))
}, function(e) {
}).click(function() {
SEARCH.seek($(this).attr('ind'))
});
},
gethandler: function(id) {
p = new Object();
p.m = $('#rack_unit' + id).find('div.handler')
p.dev = $('#rack_unit' + id)
if (p.m.length > 0)
return p
this.rackRemoveCover(id)
p.m = $('#vertPDU' + id).find('div.p_handler')
p.dev = $('#vertPDU' + id)
return p
},
rackRemoveCover: function(d) {
mm = $('#vertPDU' + d)
rack = $(mm).parent().parent().parent()
li = $(rack).find('div.rack_edit li')[1]
RACK.rid = rack.attr('id')
if ($(li).find('a.nop').attr('active') != 'ok')
RACK.cover($(li).find('a.nop')[0])
},
seekstat: function() {
//room set
//console.log(HEADER.rid)
if (HEADER.rid != Number(this.data.room) && Number(this.data.room) > 0) {
//console.log('romset')
HEADER.bid = Number(this.data.building)
HEADER.rid = Number(this.data.room)
HEADER.fid = Number(this.data.floor)
HEADER.makeNavData(HEADER.bid, HEADER.fid, HEADER.rid, true)
} else {
//rack find
//console.info(this.data.t)
switch (Number(this.data.t)) {
//DEVICE
case 1:
if (Number(this.data.room) > 0) {
r = $('#rack' + this.data.rack)
if ($(r).offset().left > winw) {
CAGE.next();
} else {
this.stopSeek()
WIN.show('#win_device')
handler = SEARCH.gethandler(this.data.id)
DEVICE.window(handler.m)
DEVICE.forceMenu(0)
t = $(handler.dev).position().top + $('#rack' + this.data.rack).offset().top + 35 - winh
$('#content').scrollTop(t);
}
}
break;
//buildings
case 2:
HEADER.bid = Number(this.data.id)
HEADER.makeNavData(HEADER.bid, undefined, undefined, true)
this.stopSeek()
$('#content').scrollTop(0);
break;
//floors
case 3:
HEADER.fid = Number(this.data.id)
HEADER.bid = Number(this.data.building)
HEADER.makeNavData(HEADER.bid, HEADER.fid, undefined, true)
this.stopSeek()
$('#content').scrollTop(0);
break;
//rooms
case 4:
HEADER.bid = Number(this.data.building)
HEADER.rid = Number(this.data.id)
HEADER.fid = Number(this.data.floor)
HEADER.makeNavData(HEADER.bid, HEADER.fid, HEADER.rid, true)
this.stopSeek()
$('#content').scrollTop(0);
break;
//RACK
case 5:
if (Number(this.data.room) > 0) {
r = $('#rack' + this.data.id)
if ($(r).offset().left > winw) {
CAGE.next();
} else {
this.stopSeek()
RACK.rid = 'rack' + this.data.id
RACK.window()
$('#content').scrollTop(0);
}
}
break;
//storage
case 6:
if (Number(this.data.room) > 0) {
r = $('#rack' + this.data.rack)
if ($(r).offset().left > winw) {
CAGE.next();
} else {
this.stopSeek()
WIN.show('#win_device')
handler = this.gethandler(this.data.dev)
DEVICE.window(handler.m)
t = $(handler.dev).position().top + $('#rack' + this.data.rack).offset().top + 35 - winh
$('#content').scrollTop(t);
if(!DEVICE.editmode)
DEVICE.editModeSet();
DEVICE.forceMenu(Number(this.data.tab))
RAID.init();
RAID.open($('<div></div>'), false, this.data);
}
}
break;
case 7:
if (Number(this.data.room) > 0) {
r = $('#rack' + this.data.rack)
if ($(r).offset().left > winw) {
CAGE.next();
} else {
this.stopSeek()
WIN.show('#win_device')
handler = this.gethandler(this.data.dev)
DEVICE.window(handler.m)
t = $(handler.dev).position().top + $('#rack' + this.data.rack).offset().top + 35 - winh
$('#content').scrollTop(t);
DEVICE.forceMenu(Number(this.data.tab))
}
}
break;
case 8:
if (Number(this.data.room) > 0) {
r = $('#rack' + this.data.rack)
if ($(r).offset().left > winw) {
CAGE.next();
} else {
this.stopSeek()
WIN.show('#win_device')
handler = this.gethandler(this.data.dev)
DEVICE.window(handler.m)
t = $(handler.dev).position().top + $('#rack' + this.data.rack).offset().top + 35 - winh
$('#content').scrollTop(t);
if(!DEVICE.editmode)
DEVICE.editModeSet();
DEVICE.forceMenu(Number(this.data.tab))
RAM.init();
RAM.open($('<div></div>'), false, this.data);
}
}
break;
}
}
},
stopSeek: function() {
$('#icon_search').hide()
$('#win_mask2').hide()
$('#win_mask3').hide()
$('#searchdata').hide()
this.seeking = false;
//remove mask..
},
seek: function(e) {
$('#icon_search').show()
$('#win_mask2').show()
$('#win_mask3').show()
m = $('#s_tab' + e)
t = Number(m.find('td.title').attr('t'))
id = m.find('div.data').attr('itd')
room = m.find('div.data').attr('room')
tab = m.find('div.data').attr('tab')
rack = m.find('div.data').attr('rack')
dev = Number(m.find('div.data').attr('dev'))
b = m.find('div.data').attr('b')
f = m.find('div.data').attr('f')
rid = m.find('div.data').attr('rid')
this.data = {'t': t, 'id': id, 'room': room, 'rack': rack, 'building': b, 'floor': f, 'tab': tab, 'dev': dev, 'rid': rid}
this.seeking = true;
this.seekstat();
/*
$.getJSON('search/details',{'type':t,'tid':id}, function(json) {
console.log(json)
});
*/
},
select: function(key) {
n = $('#searchtable tr.card').length - 1
$('#searchtable tr.card').removeClass('over')
if (key == 'down') {
SEARCH.index++;
} else {
SEARCH.index--;
}
if (SEARCH.index > n)
SEARCH.index = 0
if (SEARCH.index < 0)
SEARCH.index = n
//console.log(SEARCH.index,n)
$('#searchtable tr:eq(' + SEARCH.index + ')').addClass('over')
},
headmenu: function() {
$('#headmenu_search').html(
'<div act="0" class="menu_search hint" hint="Click to activate search panel!"></div>' +
'<ul class="sub_menu_null search_drop">' +
'<li class="sub_menu_div"><div style="padding:0;"><div id="icon_search"></div><div class="info"><span>Search</span></div>' +
'<input class="inputsearch" style="position:absolute;width:350px;margin-left:175px;height:25px;top:0px;margin-top:4px;" autocomplete="off">' +
'<div id="searchdata" style="margin-left: -1px; padding-top: 0px; display: none;"><div class="back"></div><table id="searchtable"></table></div></div></li>' +
'</ul>')
},
init: function() {
this.index = -1;
$('#searchdata').hide()
this.table = ('#searchtable')
NOC.hintset(null)
this.headmenu()
$('#header input.inputsearch').bind('keydown keyup focus', function(e) {
next = true;
if (e.keyCode == 13) {
next = false;
if (SEARCH.index >= 0) {
if (e.type == 'keydown') {
SEARCH.seek(SEARCH.index)
}
}
}
if (e.keyCode >= 37 && e.keyCode <= 40) {
next = false;
if (e.type == 'keydown') {
if (e.keyCode == 38)
SEARCH.select('up')
if (e.keyCode == 40)
SEARCH.select('down')
}
}
//escape
if (e.keyCode == 27) {
next = false;
if (e.type == 'keydown') {
$('#searchdata').hide()
$(SEARCH.table).html('')
ms = $('#header div.menu_search')
$(ms).parent().find('ul.search_drop').slideUp('fast');
$(ms).attr('act', 0)
$(ms).removeClass('active_button')
}
//console.log(e.keyCode,$(this).val())
}
if (next && e.type == 'keyup') {
$.getJSON('basic/search', {'key': $(this).val()}, function(json) {
$('#searchdata').hide()
$(SEARCH.table).html('')
SEARCH.tabs(json)
SEARCH.index = -1;
});
}
});
$('#header div.menu_search').bind('click mouseover mouseout', function(e) {
act = Number($(this).attr('act'))
if (act == 0) {
$(this).removeClass('active_button')
if (e.type == 'mouseover') {
$(this).addClass('active_button')
}
if (e.type == 'mouseout') {
$(this).removeClass('active_button')
}
}
if (e.type == 'click') {
if (act == 0) {
$(this).attr('act', 1)
$(this).parent().find('ul.search_drop').show()
$(this).addClass('active_button')
$('input.inputsearch').focus()
} else {
$(this).parent().find('ul.search_drop').slideUp('fast');
$(this).attr('act', 0)
}
}
});
}
}
var HARDWARE = {
init: function() {
//console.log('hardware init...')
}
}
var PRINT = {
_checkbox: function(d) {
val = ELEMENT._checkbox(d)
},
set: function() {
}
}
|
/*
* #%L
* GraphWalker Dashboard
* %%
* Copyright (C) 2005 - 2014 GraphWalker
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* #L%
*/
/*! jQuery UI - v1.10.4 - 2014-02-16
* http://jqueryui.com
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
jQuery(function(t){t.datepicker.regional.id={closeText:"Tutup",prevText:"<mundur",nextText:"maju>",currentText:"hari ini",monthNames:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember"],monthNamesShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agus","Sep","Okt","Nop","Des"],dayNames:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],dayNamesShort:["Min","Sen","Sel","Rab","kam","Jum","Sab"],dayNamesMin:["Mg","Sn","Sl","Rb","Km","jm","Sb"],weekHeader:"Mg",dateFormat:"dd/mm/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},t.datepicker.setDefaults(t.datepicker.regional.id)}); |
/**
* Project: [treela-web]
* Created on: '8/28/2017'
* License: 'MIT'
* Author: Akshay Kr Singh <[email protected]>
*/
export const MENU_TYPE_SHOP = 'app/components/AppHeader/MENU_TYPE_SHOP';
export const MENU_TYPE_ADMIN = 'app/components/AppHeader/MENU_TYPE_ADMIN';
|
Template.listCustomers.onCreated(function() {
var template = this;
template.autorun(function() {
var skipCount = (currentPage() - 1) * Meteor.settings.public.recordsPerPage;
template.subscribe(
'customers',
skipCount,
Router.current().params.sortField,
Router.current().params.sortDirection
);
});
});
Template.listCustomers.helpers({
// hasNewCustomerTemplate: function() {
// return Template["newestCustomer"];
// },
customers: function() {
return Customers.findFromPublication('customers', {}, {
sort: CustomerSortSettings.getSortParams(
CustomerSortSettings.sortField(),
CustomerSortSettings.sortDirection())
});
},
prevPage: function() {
var previousPage = currentPage() === 1 ? 1 : currentPage() - 1;
return Router.routes.customerIndex.path({
page: previousPage,
sortField: Router.current().params.sortField,
sortDirection: Router.current().params.sortDirection
});
},
nextPage: function() {
var nextPage = hasMorePages() ? currentPage() + 1 : currentPage();
return Router.routes.customerIndex.path({
page: nextPage,
sortField: Router.current().params.sortField,
sortDirection:Router.current().params.sortDirection
});
},
prevPageClass: function() {
return currentPage() <= 1 ? "disabled" : "";
},
nextPageClass: function() {
return hasMorePages() ? "" : "disabled";
},
firstNameIconClass: function() {
return CustomerSortSettings.getSortIconClass("firstname");
},
lastNameIconClass: function() {
return CustomerSortSettings.getSortIconClass("lastname");
},
emailIconClass: function() {
return CustomerSortSettings.getSortIconClass("email");
}
});
Template.listCustomers.events({
// 'click #btnAddCustomer': function(e) {
// e.preventDefault();
// Router.go('addCustomer', {page: Router.current().params.page});
// },
'click #firstName,#lastName,#email': function(e) {
e.preventDefault();
if (e.target.id === 'firstName') {
navigateToCustomersRoute('firstname');
} else if (e.target.id === 'lastName') {
navigateToCustomersRoute('lastname');
} else if (e.target.id === 'email') {
navigateToCustomersRoute('email');
}
}
});
var navigateToCustomersRoute = function(sortField) {
Router.go('customerIndex', {
page: Router.current().params.page || 1,
sortField: sortField,
sortDirection: CustomerSortSettings.toggleSortDirection(sortField)
});
}
var hasMorePages = function() {
var totalCustomers = Counts.get('customerCount');
return currentPage() * parseInt(Meteor.settings.public.recordsPerPage) < totalCustomers;
}
var currentPage = function() {
return parseInt(Router.current().params.page) || 1;
} |
// Obj 2 atomicGL exporter
// author: Remi COZOT - IRISA/University of Rennes 1
mur2toit=function(){
this.vertices =[
12.9261,6.5495,-2.2999, // vertice0
13.0788,6.49,-2.2955, // vertice1
12.9263,6.49,-2.2922, // vertice2
14.7348,6.49,-2.3307, // vertice3
14.7347,6.5495,-2.3384, // vertice4
12.9409,6.6395,-1.6059, // vertice5
14.7347,6.5495,-2.3384, // vertice6
12.9261,6.5495,-2.2999, // vertice7
14.5794,6.6395,-1.6407, // vertice8
12.9409,6.9795,1.0175, // vertice9
12.9409,7.0103,1.2555, // vertice10
12.7655,6.639,-1.6058, // vertice11
12.7655,7.0099,1.2555, // vertice12
12.7657,6.5795,-1.5981, // vertice13
12.7655,7.0099,1.2555, // vertice14
12.7655,6.639,-1.6058, // vertice15
12.7657,6.9504,1.2632, // vertice16
12.9411,6.58,-1.5982, // vertice17
12.7657,6.9504,1.2632, // vertice18
12.7657,6.5795,-1.5981, // vertice19
12.9411,6.9508,1.2631, // vertice20
12.9411,6.9375,1.16, // vertice21
12.9411,6.92,1.0252, // vertice22
13.0788,6.49,-2.2955, // vertice23
12.9263,6.49,-2.2922, // vertice24
12.9409,6.6395,-1.6059, // vertice25
12.9263,6.49,-2.2922, // vertice26
12.9411,6.58,-1.5982, // vertice27
12.9261,6.5495,-2.2999, // vertice28
12.9409,6.6395,-1.6059, // vertice29
12.9261,6.5495,-2.2999, // vertice30
12.7649,6.5495,-2.3027, // vertice31
12.9261,6.5495,-2.2999, // vertice32
12.9263,6.49,-2.2922, // vertice33
12.7649,6.5495,-2.3027, // vertice34
12.7649,6.5495,-2.3027, // vertice35
12.9263,6.49,-2.2922, // vertice36
12.7649,6.49,-2.2955, // vertice37
12.9263,6.49,-2.2922, // vertice38
12.7657,6.5795,-1.5981, // vertice39
12.7649,6.5495,-2.3027, // vertice40
12.7655,6.639,-1.6058, // vertice41
12.9411,6.58,-1.5982, // vertice42
12.7657,6.5795,-1.5981, // vertice43
12.9409,6.6395,-1.6059, // vertice44
12.9409,6.6395,-1.6059, // vertice45
12.7649,6.5495,-2.3027, // vertice46
12.7655,6.639,-1.6058, // vertice47
12.7649,6.5495,-2.3027, // vertice48
12.7657,6.5795,-1.5981, // vertice49
12.7655,6.639,-1.6058, // vertice50
12.7649,6.5495,-2.3027, // vertice51
12.7649,6.49,-2.2955, // vertice52
12.7657,6.5795,-1.5981, // vertice53
12.9263,6.49,-2.2922, // vertice54
12.7657,6.5795,-1.5981, // vertice55
12.7649,6.49,-2.2955, // vertice56
13.0662,6.49,-2.2955, // vertice57
12.9263,6.49,-2.2922, // vertice58
12.7649,6.49,-2.2955, // vertice59
13.0788,6.49,-2.2955, // vertice60
14.5796,6.58,-1.633, // vertice61
14.7348,6.49,-2.3307, // vertice62
14.6796,6.58,-1.6352, // vertice63
14.7496,6.58,-1.6366, // vertice64
14.7348,6.49,-2.3307, // vertice65
14.7494,6.6395,-1.6444, // vertice66
14.7496,6.58,-1.6366, // vertice67
14.7347,6.5495,-2.3384, // vertice68
14.7494,6.6395,-1.6444, // vertice69
14.5794,6.6395,-1.6407, // vertice70
14.7496,6.58,-1.6366, // vertice71
14.7494,6.6395,-1.6444, // vertice72
14.6796,6.58,-1.6352, // vertice73
14.5796,6.58,-1.633, // vertice74
14.5794,6.6395,-1.6407, // vertice75
14.7473,6.5794,-1.6376, // vertice76
14.5796,6.58,-1.633, // vertice77
14.5794,6.6395,-1.6407, // vertice78
14.7473,6.6376,-1.6449, // vertice79
14.7473,6.5794,-1.6376, // vertice80
14.5794,6.6395,-1.6407, // vertice81
14.7142,6.9604,0.87836, // vertice82
14.7473,6.6376,-1.6449, // vertice83
14.7123,6.9785,1.0199, // vertice84
14.5794,6.6395,-1.6407, // vertice85
14.5448,6.9782,1.0177, // vertice86
14.7123,6.9785,1.0199, // vertice87
12.9411,6.9782,1.0177, // vertice88
14.5794,6.6395,-1.6407, // vertice89
12.9411,6.92,1.0252, // vertice90
12.9411,6.9782,1.0177, // vertice91
14.5794,6.6395,-1.6407, // vertice92
12.9411,6.92,1.0252, // vertice93
14.5796,6.58,-1.633, // vertice94
12.9409,6.9795,1.0175, // vertice95
12.9409,6.9795,1.0175, // vertice96
12.9411,6.9375,1.16, // vertice97
12.9411,6.92,1.0252, // vertice98
12.9409,7.0103,1.2555, // vertice99
12.9411,6.9508,1.2631, // vertice100
12.9411,6.9509,1.2632, // vertice101
12.7655,7.0099,1.2555, // vertice102
12.9411,6.9509,1.2632, // vertice103
12.9409,7.0103,1.2555, // vertice104
12.7657,6.9504,1.2632, // vertice105
12.9411,6.9509,1.2632, // vertice106
12.9411,7.0086,1.2557, // vertice107
12.9411,6.9375,1.16, // vertice108
12.9411,6.9508,1.2631, // vertice109
12.9411,6.96,1.16, // vertice110
12.9411,6.9782,1.0177, // vertice111
12.9411,6.96,1.0252, // vertice112
12.9411,6.92,1.0252, // vertice113
12.9411,6.96,1.16, // vertice114
12.9411,6.92,1.0252, // vertice115
12.9411,6.96,1.0252, // vertice116
12.9411,6.9375,1.16, // vertice117
12.9411,6.92,1.0252, // vertice118
12.9411,6.9372,1.16, // vertice119
12.9411,6.9375,1.16, // vertice120
14.5448,6.9504,1.2631, // vertice121
12.9411,6.9372,1.16, // vertice122
12.9411,6.92,1.0252, // vertice123
12.9411,6.9504,1.2631, // vertice124
14.5448,7.0086,1.2557, // vertice125
12.9411,6.9504,1.2631, // vertice126
14.5448,6.9504,1.2631, // vertice127
12.9411,6.9508,1.2631, // vertice128
12.9411,7.0086,1.2557, // vertice129
14.5448,7.0086,1.2557, // vertice130
12.9411,6.9782,1.0177, // vertice131
12.9411,7.0086,1.2557, // vertice132
14.5448,6.9782,1.0177, // vertice133
14.5448,7.0086,1.2557, // vertice134
14.7123,6.9785,1.0199, // vertice135
14.5448,6.9782,1.0177, // vertice136
14.7092,7.0086,1.2557, // vertice137
14.5448,7.0086,1.2557, // vertice138
14.5448,6.9504,1.2631, // vertice139
14.7092,7.0086,1.2557, // vertice140
14.5448,6.9372,1.16, // vertice141
14.5448,7.0086,1.2557, // vertice142
14.5448,6.9504,1.2631, // vertice143
14.5448,6.95,1.16, // vertice144
14.5448,6.9372,1.16, // vertice145
14.5448,6.95,1.0252, // vertice146
14.5448,6.95,1.16, // vertice147
14.5448,6.92,1.0252, // vertice148
14.7123,6.9203,1.0273, // vertice149
14.5448,6.9372,1.16, // vertice150
14.5448,6.92,1.0252, // vertice151
14.5448,6.9504,1.2631, // vertice152
14.7141,6.9524,1.2631, // vertice153
14.5448,6.9504,1.2631, // vertice154
14.7123,6.9203,1.0273, // vertice155
14.7092,7.0086,1.2557, // vertice156
14.5448,6.9504,1.2631, // vertice157
14.7141,6.9524,1.2631, // vertice158
14.7123,6.9785,1.0199, // vertice159
14.7092,7.0086,1.2557, // vertice160
14.7141,6.9524,1.2631, // vertice161
14.7123,6.9785,1.0199, // vertice162
14.7141,6.9524,1.2631, // vertice163
14.7123,6.9203,1.0273, // vertice164
14.7141,6.9524,1.2631, // vertice165
14.7123,6.9203,1.0273, // vertice166
14.7136,6.9077,0.92864, // vertice167
14.7136,6.9077,0.92864, // vertice168
14.7123,6.9785,1.0199, // vertice169
14.7123,6.9203,1.0273, // vertice170
14.7142,6.9604,0.87836, // vertice171
14.7473,6.5794,-1.6376, // vertice172
14.7136,6.9077,0.92864, // vertice173
14.5796,6.58,-1.633, // vertice174
14.7473,6.5794,-1.6376, // vertice175
14.7123,6.9203,1.0273, // vertice176
14.5448,6.92,1.0252, // vertice177
14.5448,6.9372,1.16, // vertice178
14.7123,6.9203,1.0273, // vertice179
14.5448,6.9782,1.0177, // vertice180
14.5448,6.92,1.0252, // vertice181
14.7123,6.9785,1.0199, // vertice182
14.5448,6.9782,1.0177, // vertice183
14.5448,6.95,1.0252, // vertice184
14.5448,6.92,1.0252, // vertice185
14.7473,6.6376,-1.6449, // vertice186
12.9411,6.9508,1.2631, // vertice187
12.9411,6.9372,1.16, // vertice188
12.9411,6.9504,1.2631, // vertice189
12.9411,6.9375,1.16 // vertice190
]
this.normals = [
-0.021079,-0.12856,-0.99148, // normal0
-0.021079,-0.12856,-0.99148, // normal1
-0.021079,-0.12856,-0.99148, // normal2
-0.021079,-0.12856,-0.99148, // normal3
-0.021079,-0.12856,-0.99148, // normal4
-0.0027325,0.9917,-0.12853, // normal5
-0.0027325,0.9917,-0.12853, // normal6
-0.0027325,0.9917,-0.12853, // normal7
-0.0027325,0.9917,-0.12853, // normal8
-0.0027325,0.9917,-0.12853, // normal9
-0.0027325,0.9917,-0.12853, // normal10
-0.0027325,0.9917,-0.12853, // normal11
-0.0027325,0.9917,-0.12853, // normal12
-1,-0.0027098,0.00035121, // normal13
-1,-0.0027098,0.00035121, // normal14
-1,-0.0027098,0.00035121, // normal15
-1,-0.0027098,0.00035121, // normal16
0.0027325,-0.9917,0.12853, // normal17
0.0027325,-0.9917,0.12853, // normal18
0.0027325,-0.9917,0.12853, // normal19
0.0027325,-0.9917,0.12853, // normal20
0.0027325,-0.9917,0.12853, // normal21
0.0027325,-0.9917,0.12853, // normal22
0.0027325,-0.9917,0.12853, // normal23
0.0027325,-0.9917,0.12853, // normal24
-0.99977,-4.776e-15,0.021255, // normal25
-0.99977,-4.776e-15,0.021255, // normal26
-0.99977,-4.776e-15,0.021255, // normal27
-0.99977,-4.776e-15,0.021255, // normal28
0.0022106,0.99169,-0.12863, // normal29
0.0022106,0.99169,-0.12863, // normal30
0.0022106,0.99169,-0.12863, // normal31
0.01704,-0.12847,-0.99157, // normal32
0.01704,-0.12847,-0.99157, // normal33
0.01704,-0.12847,-0.99157, // normal34
0.019929,-0.12079,-0.99248, // normal35
0.019929,-0.12079,-0.99248, // normal36
0.019929,-0.12079,-0.99248, // normal37
-0.34786,-0.93668,0.040311, // normal38
-0.34786,-0.93668,0.040311, // normal39
-0.34786,-0.93668,0.040311, // normal40
-4.2505e-15,-0.12853,-0.99171, // normal41
-4.2505e-15,-0.12853,-0.99171, // normal42
-4.2505e-15,-0.12853,-0.99171, // normal43
-4.2505e-15,-0.12853,-0.99171, // normal44
-0.0027325,0.99185,-0.1274, // normal45
-0.0027325,0.99185,-0.1274, // normal46
-0.0027325,0.99185,-0.1274, // normal47
-1,-0.0025883,0.0012891, // normal48
-1,-0.0025883,0.0012891, // normal49
-1,-0.0025883,0.0012891, // normal50
-1,0.00014273,0.0011727, // normal51
-1,0.00014273,0.0011727, // normal52
-1,0.00014273,0.0011727, // normal53
-0.0025568,-0.99186,0.12733, // normal54
-0.0025568,-0.99186,0.12733, // normal55
-0.0025568,-0.99186,0.12733, // normal56
8.2443e-32,-1,-2.227e-13, // normal57
8.2443e-32,-1,-2.227e-13, // normal58
8.2443e-32,-1,-2.227e-13, // normal59
8.2443e-32,-1,-2.227e-13, // normal60
0.0027325,-0.9917,0.12853, // normal61
0.0027325,-0.9917,0.12853, // normal62
0.0027325,-0.9917,0.12853, // normal63
0.0027325,-0.9917,0.12853, // normal64
0.99977,3.6579e-14,-0.021255, // normal65
0.99977,3.6579e-14,-0.021255, // normal66
0.99977,3.6579e-14,-0.021255, // normal67
0.99977,3.6579e-14,-0.021255, // normal68
-0.0027325,0.9917,-0.12853, // normal69
0.021079,0.12856,0.99148, // normal70
0.021079,0.12856,0.99148, // normal71
0.021079,0.12856,0.99148, // normal72
0.021079,0.12856,0.99148, // normal73
0.021079,0.12856,0.99148, // normal74
-0.027391,-0.12856,-0.99132, // normal75
-0.027391,-0.12856,-0.99132, // normal76
-0.027391,-0.12856,-0.99132, // normal77
-0.026334,-0.12562,-0.99173, // normal78
-0.026334,-0.12562,-0.99173, // normal79
-0.026334,-0.12562,-0.99173, // normal80
0.0079927,0.9919,-0.12677, // normal81
0.0079927,0.9919,-0.12677, // normal82
0.0079927,0.9919,-0.12677, // normal83
0.0079927,0.9919,-0.12677, // normal84
-3.6818e-07,0.99198,-0.12638, // normal85
-3.6818e-07,0.99198,-0.12638, // normal86
-3.6818e-07,0.99198,-0.12638, // normal87
-3.6818e-07,0.99198,-0.12638, // normal88
-0.85319,-0.066177,-0.51738, // normal89
-0.85319,-0.066177,-0.51738, // normal90
-0.85319,-0.066177,-0.51738, // normal91
0.85316,0.06936,0.51703, // normal92
0.85316,0.06936,0.51703, // normal93
0.85316,0.06936,0.51703, // normal94
0.85316,0.06936,0.51703, // normal95
1,0.0027098,-0.00035121, // normal96
1,0.0027098,-0.00035121, // normal97
1,0.0027098,-0.00035121, // normal98
1,0.0027098,-0.00035121, // normal99
1,0.0027098,-0.00035121, // normal100
1,0.0027098,-0.00035121, // normal101
-1.1842e-17,0.12853,0.99171, // normal102
-1.1842e-17,0.12853,0.99171, // normal103
-1.1842e-17,0.12853,0.99171, // normal104
-1.1842e-17,0.12853,0.99171, // normal105
0.0027325,-0.9917,0.12853, // normal106
-1,-4.7144e-14,-2.0246e-14, // normal107
-1,-4.7144e-14,-2.0246e-14, // normal108
-1,-4.7144e-14,-2.0246e-14, // normal109
-1,-4.7144e-14,-2.0246e-14, // normal110
-1,-4.7144e-14,-2.0246e-14, // normal111
-1,-4.7144e-14,-2.0246e-14, // normal112
-1,-4.7144e-14,-2.0246e-14, // normal113
1,-1.5432e-14,6.3541e-15, // normal114
1,-1.5432e-14,6.3541e-15, // normal115
1,-1.5432e-14,6.3541e-15, // normal116
1,-1.5432e-14,6.3541e-15, // normal117
-1,0,-1.0708e-14, // normal118
-1,0,-1.0708e-14, // normal119
-1,0,-1.0708e-14, // normal120
-9.2568e-15,-0.99192,0.12687, // normal121
-9.2568e-15,-0.99192,0.12687, // normal122
-9.2568e-15,-0.99192,0.12687, // normal123
-9.2568e-15,-0.99192,0.12687, // normal124
-3.8276e-14,0.12687,0.99192, // normal125
-3.8276e-14,0.12687,0.99192, // normal126
-3.8276e-14,0.12687,0.99192, // normal127
-3.8276e-14,0.12687,0.99192, // normal128
-3.8276e-14,0.12687,0.99192, // normal129
7.6201e-15,0.99192,-0.12687, // normal130
7.6201e-15,0.99192,-0.12687, // normal131
7.6201e-15,0.99192,-0.12687, // normal132
7.6201e-15,0.99192,-0.12687, // normal133
2.8445e-14,0.99192,-0.12687, // normal134
2.8445e-14,0.99192,-0.12687, // normal135
2.8445e-14,0.99192,-0.12687, // normal136
2.8445e-14,0.99192,-0.12687, // normal137
1.2615e-16,0.12687,0.99192, // normal138
1.2615e-16,0.12687,0.99192, // normal139
1.2615e-16,0.12687,0.99192, // normal140
1,-2.5751e-14,-3.0847e-14, // normal141
1,-2.5751e-14,-3.0847e-14, // normal142
1,-2.5751e-14,-3.0847e-14, // normal143
1,-2.5751e-14,-3.0847e-14, // normal144
1,3.4657e-14,-1.2924e-14, // normal145
1,3.4657e-14,-1.2924e-14, // normal146
1,3.4657e-14,-1.2924e-14, // normal147
1,3.4657e-14,-1.2924e-14, // normal148
-1.3189e-14,-0.99192,0.12687, // normal149
-1.3189e-14,-0.99192,0.12687, // normal150
-1.3189e-14,-0.99192,0.12687, // normal151
-1.3189e-14,-0.99192,0.12687, // normal152
0.011729,-0.99077,0.13506, // normal153
0.011729,-0.99077,0.13506, // normal154
0.011729,-0.99077,0.13506, // normal155
-0.0015531,0.13119,0.99136, // normal156
-0.0015531,0.13119,0.99136, // normal157
-0.0015531,0.13119,0.99136, // normal158
0.99625,0.086455,0.0019975, // normal159
0.99625,0.086455,0.0019975, // normal160
0.99625,0.086455,0.0019975, // normal161
0.99997,-0.00094377,-0.0073786, // normal162
0.99997,-0.00094377,-0.0073786, // normal163
0.99997,-0.00094377,-0.0073786, // normal164
0.3784,-0.91752,0.12232, // normal165
0.3784,-0.91752,0.12232, // normal166
0.3784,-0.91752,0.12232, // normal167
0.99992,0.0016491,0.012893, // normal168
0.99992,0.0016491,0.012893, // normal169
0.99992,0.0016491,0.012893, // normal170
0.99992,0.0016491,0.012893, // normal171
0.99992,0.0016491,0.012893, // normal172
-9.2568e-15,-0.99192,0.12687, // normal173
-9.2568e-15,-0.99192,0.12687, // normal174
-9.2568e-15,-0.99192,0.12687, // normal175
-9.2568e-15,-0.99192,0.12687, // normal176
-9.2568e-15,-0.99192,0.12687, // normal177
-9.2568e-15,-0.99192,0.12687, // normal178
-0.012998,0.12686,0.99184, // normal179
-0.012998,0.12686,0.99184, // normal180
-0.012998,0.12686,0.99184, // normal181
-0.012998,0.12686,0.99184, // normal182
1,-2.5751e-14,-3.0847e-14, // normal183
1,-2.5751e-14,-3.0847e-14, // normal184
1,-2.5751e-14,-3.0847e-14, // normal185
0.99992,0.0016491,0.012893, // normal186
-1,8.1082e-12,-1.093e-12, // normal187
-1,8.1082e-12,-1.093e-12, // normal188
-1,8.1082e-12,-1.093e-12, // normal189
-1,8.1082e-12,-1.093e-12 // normal190
]
this.uv = [
-21.2797,11.0818, // uv0
-21.5299,10.9834, // uv1
-21.2797,10.9834, // uv2
-24.2471,10.9834, // uv3
-24.2471,11.0818, // uv4
-21.2797,-0.76422, // uv5
-24.2471,-1.9125, // uv6
-21.2797,-1.9125, // uv7
-23.9682,-0.76422, // uv8
-21.1882,3.5742, // uv9
-21.1799,3.9678, // uv10
-20.9921,-0.77029, // uv11
-20.8923,3.9617, // uv12
-2.6142,10.7364, // uv13
2.0669,11.4424, // uv14
-2.6269,10.834, // uv15
2.0796,11.3447, // uv16
21.2797,-0.76422, // uv17
20.8923,3.9617, // uv18
20.9921,-0.77029, // uv19
21.1799,3.9676, // uv20
21.1835,3.7972, // uv21
21.1882,3.5742, // uv22
21.5299,-1.9125, // uv23
21.2797,-1.9125, // uv24
-52.381,261.398, // uv25
-79.4077,255.512, // uv26
-52.0773,259.055, // uv27
-79.7114,257.855, // uv28
-21.1801,-1.5726, // uv29
-21.1364,-2.72, // uv30
-20.8718,-2.72, // uv31
-21.1364,11.1863, // uv32
-21.1368,11.0879, // uv33
-20.8718,11.1863, // uv34
-20.8597,11.1722, // uv35
-21.1248,11.0739, // uv36
-20.8599,11.0739, // uv37
-31.0637,-393.768, // uv38
-4.6466,-383.705, // uv39
-32.2053,-387.079, // uv40
-502.58,267.337, // uv41
-509.491,264.994, // uv42
-502.587,264.975, // uv43
-509.484,267.356, // uv44
-21.2801,-0.77283, // uv45
-21.0159,-1.9313, // uv46
-20.9925,-0.77895, // uv47
-3.7504,10.6897, // uv48
-2.5946,10.7389, // uv49
-2.6073,10.8365, // uv50
-3.7528,10.7469, // uv51
-3.741,10.6493, // uv52
-2.597,10.7962, // uv53
21.1248,-2.7952, // uv54
20.8843,-1.6422, // uv55
20.8599,-2.7952, // uv56
-514.418,90.3725, // uv57
-508.91,90.2449, // uv58
-502.554,90.3725, // uv59
-514.913,90.3725, // uv60
23.9682,-0.76422, // uv61
24.2471,-1.9125, // uv62
24.1323,-0.76422, // uv63
24.2471,-0.76422, // uv64
3.3087,10.6463, // uv65
2.1825,10.8916, // uv66
2.1699,10.794, // uv67
3.3213,10.7439, // uv68
-24.2471,-0.76422, // uv69
23.9682,11.0818, // uv70
24.2471,10.9834, // uv71
24.2471,11.0818, // uv72
24.1323,10.9834, // uv73
23.9682,10.9834, // uv74
-575.559,265.492, // uv75
-582.16,263.106, // uv76
-575.557,263.129, // uv77
-575.506,265.525, // uv78
-582.115,265.45, // uv79
-582.107,263.14, // uv80
-23.6997,-2.7738, // uv81
-24.1803,1.3701, // uv82
-23.9739,-2.7982, // uv83
-24.1918,1.6039, // uv84
-23.9164,-1.2934, // uv85
-23.8595,3.1028, // uv86
-24.1344,3.1064, // uv87
-21.2288,3.1028, // uv88
-352.861,230.561, // uv89
-229.67,241.629, // uv90
-229.921,243.925, // uv91
352.73,229.042, // uv92
229.539,240.112, // uv93
352.473,226.694, // uv94
229.795,242.46, // uv95
-40.2361,273.402, // uv96
-45.8482,271.747, // uv97
-40.5398,271.059, // uv98
-49.6066,274.616, // uv99
-49.9063,272.273, // uv100
-49.9102,272.274, // uv101
20.9409,11.139, // uv102
21.2288,11.0414, // uv103
21.2285,11.1398, // uv104
20.9411,11.0406, // uv105
21.1799,3.9678, // uv106
49.4364,275.93, // uv107
45.6693,273.129, // uv108
49.7274,273.655, // uv109
45.6693,274.016, // uv110
40.0678,274.732, // uv111
40.3608,274.016, // uv112
40.3608,272.441, // uv113
-45.6693,274.016, // uv114
-40.3608,272.441, // uv115
-40.3608,274.016, // uv116
-45.6693,273.129, // uv117
40.3608,272.441, // uv118
45.6693,273.12, // uv119
45.6693,273.129, // uv120
23.8595,3.5019, // uv121
21.2288,3.3313, // uv122
21.2288,3.1083, // uv123
21.2288,3.5019, // uv124
23.8595,11.1428, // uv125
21.2288,11.0466, // uv126
23.8595,11.0466, // uv127
21.2288,11.0473, // uv128
21.2288,11.1428, // uv129
-23.8595,3.5019, // uv130
-21.2288,3.1083, // uv131
-21.2288,3.5019, // uv132
-23.8595,3.1083, // uv133
-23.8595,3.5019, // uv134
-24.1344,3.1119, // uv135
-23.8595,3.1083, // uv136
-24.1293,3.5019, // uv137
23.8595,11.1428, // uv138
23.8595,11.0466, // uv139
24.1293,11.1428, // uv140
-45.6693,273.12, // uv141
-49.4364,275.93, // uv142
-49.7294,273.639, // uv143
-45.6693,273.622, // uv144
-45.6693,273.12, // uv145
-40.3608,273.622, // uv146
-45.6693,273.622, // uv147
-40.3608,272.441, // uv148
24.1344,3.1119, // uv149
23.8595,3.3313, // uv150
23.8595,3.1083, // uv151
23.8595,3.5019, // uv152
23.8675,5.6604, // uv153
23.5908,5.6362, // uv154
23.8981,5.2712, // uv155
24.1325,11.1324, // uv156
23.8628,11.0362, // uv157
24.1405,11.0395, // uv158
-1.6246,9.3179, // uv159
-2.0115,9.3676, // uv160
-2.0237,9.2751, // uv161
-1.8511,11.4704, // uv162
-2.2501,11.4277, // uv163
-1.8633,11.3749, // uv164
130.858,628.638, // uv165
139.67,625.453, // uv166
143.383,624.204, // uv167
-1.2121,11.2916, // uv168
-1.3617,11.4078, // uv169
-1.374,11.3123, // uv170
-1.1296,11.3781, // uv171
2.998,10.7532, // uv172
24.1365,2.9487, // uv173
23.9167,-1.2877, // uv174
24.1917,-1.2953, // uv175
24.1344,3.1119, // uv176
23.8595,3.1083, // uv177
23.8595,3.3313, // uv178
579.706,266.083, // uv179
573.105,268.381, // uv180
573.109,266.072, // uv181
579.702,268.392, // uv182
-40.0678,274.732, // uv183
-40.3608,273.622, // uv184
-40.3608,272.441, // uv185
3.0101,10.8486, // uv186
49.7274,273.655, // uv187
45.6693,273.12, // uv188
49.7294,273.639, // uv189
45.6693,273.129 // uv190
]
this.index=[
0,
1,
2,
1,
0,
3,
3,
0,
4,
5,
6,
7,
6,
5,
8,
5,
9,
8,
5,
10,
9,
11,
10,
5,
10,
11,
12,
13,
14,
15,
14,
13,
16,
17,
18,
19,
18,
17,
20,
20,
17,
21,
21,
17,
22,
17,
23,
22,
23,
17,
24,
25,
26,
27,
26,
25,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
17,
19,
24,
41,
42,
43,
42,
41,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
58,
57,
60,
22,
23,
61,
61,
23,
62,
61,
62,
63,
63,
62,
64,
65,
66,
67,
66,
65,
68,
6,
8,
69,
70,
71,
72,
70,
73,
71,
73,
70,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
82,
81,
84,
85,
86,
87,
86,
85,
88,
89,
90,
91,
92,
93,
94,
92,
95,
93,
96,
97,
98,
99,
97,
96,
99,
100,
97,
100,
99,
101,
102,
103,
104,
103,
102,
105,
106,
18,
20,
107,
108,
109,
108,
107,
110,
111,
110,
107,
110,
111,
112,
112,
111,
113,
114,
115,
116,
115,
114,
117,
118,
119,
120,
121,
122,
123,
122,
121,
124,
125,
126,
127,
126,
125,
128,
128,
125,
129,
130,
131,
132,
131,
130,
133,
134,
135,
136,
135,
134,
137,
138,
139,
140,
141,
142,
143,
142,
141,
144,
145,
146,
147,
146,
145,
148,
149,
150,
151,
150,
149,
152,
153,
154,
155,
156,
157,
158,
159,
160,
161,
162,
163,
164,
165,
166,
167,
168,
169,
170,
169,
168,
171,
171,
168,
172,
173,
174,
175,
176,
174,
173,
177,
174,
176,
174,
177,
123,
178,
123,
177,
121,
123,
178,
179,
180,
181,
180,
179,
182,
183,
184,
185,
183,
144,
184,
144,
183,
142,
171,
172,
186,
187,
188,
189,
188,
187,
190
]
}
|
const express = require("express");
const database = require("./database");
const utils = require("../utils");
const router = express.Router();
router.post("/register", (request, response) => {
if (
!request.body ||
!request.body.username ||
!request.body.password ||
!request.body.name
) {
response.json({
status: "failed",
message: "Request missing username, password or name"
});
return;
}
const { username, password, name } = request.body;
if (database[username]) {
response.json({
status: "failed",
message: `Username ${username} already exists`
});
return;
}
database[username] = {
password: password,
name: name,
id: utils.randomBase64URLBuffer()
};
request.session.loggedIn = true;
request.session.username = username;
response.json({
status: "ok"
});
});
router.post("/login", (request, response) => {
if (!request.body || !request.body.username || !request.body.password) {
response.json({
status: "failed",
message: "Request missing username or password"
});
return;
}
const { username, password } = request.body;
if (!database[username] || database[username].password !== password) {
response.json({
status: "failed",
message: "Wrong username or password"
});
return;
}
request.session.loggedIn = true;
request.session.username = username;
response.json({
status: "ok"
});
});
module.exports = router;
|
'''
Provider for duck dataset from xingyu liu
'''
import os
import os.path
import json
import numpy as np
import sys
import pickle
import glob
class SceneflowDataset():
def __init__(self, root='../semantic_seg/processed_data', npoints=2048, train=True):
self.npoints = npoints
self.train = train
self.root = root
self.datapath = glob.glob(os.path.join(self.root, '*.npz'))
self.datapath.sort()
self.filelist = []
for d in self.datapath:
base = os.path.join(os.path.dirname(d), '-'.join(os.path.basename(d).split('.npz')[0].split('-')[:-1]))
idx = int(os.path.basename(d).split('.npz')[0].split('-')[-1])
next_d = base + '-' + str(int(idx) + 1).zfill(6) + '.npz'
prev_d = base + '-' + str(int(idx) - 1).zfill(6) + '.npz'
if next_d in self.datapath:
self.filelist.append([d, next_d])
if prev_d in self.datapath:
self.filelist.append([d, prev_d])
def __getitem__(self, index):
fn1, fn2 = self.filelist[index]
with open(fn1, 'rb') as fp:
data = np.load(fp)
center1 = data['center']
rgb1 = data['rgb']
semantic1 = data['semantic']
pc1 = data['pc']
with open(fn2, 'rb') as fp:
data = np.load(fp)
center2 = data['center']
rgb2 = data['rgb']
semantic2 = data['semantic']
pc2 = data['pc']
return pc1, rgb1, fn1, pc2, rgb2, fn2
def __len__(self):
return len(self.filelist)
if __name__ == '__main__':
import mayavi.mlab as mlab
d = SceneflowDataset(root='../semantic_seg/processed_data', npoints=2048)
print(len(d))
import time
tic = time.time()
point_size = 0.2
for i in range(200, 500):
pc1, rgb1, pc2, rgb2 = d[i]
print(pc1.shape, rgb1.shape, pc2.shape, rgb2.shape)
print(rgb1.max())
print(rgb1.min())
exit()
mlab.figure(bgcolor=(1,1,1))
mlab.points3d(pc1[:,0], pc1[:,1], pc1[:,2], scale_factor=point_size, color=(1,0,0))
mlab.points3d(pc2[:,0], pc2[:,1], pc2[:,2], scale_factor=point_size, color=(0,1,0))
input()
exit()
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './Card.css';
import HelperImage from '../../shared/media/images/icons/help.svg';
import Popover from '../Popover/Popover';
import PopoverBody from '../Popover/PopoverBody';
class Card extends Component {
// eslint-disable-line react/prefer-stateless-function
constructor(props) {
super(props);
this.state = {
helperstate: false,
formattedDate: '-',
};
this._handlePopover = this._handlePopover.bind(this);
}
componentWillReceiveProps(nextProps) {
const { date } = nextProps;
const formattedDate = new Date(date).toLocaleTimeString('en-US');
this.setState({ formattedDate });
}
_handlePopover() {
this.setState({
helperstate: !this.state.helperstate,
});
}
render() {
const { children, title, helpText, id } = this.props;
const { formattedDate } = this.state;
return (
<div className={styles.cardouter}>
<div>
<h3 className={styles.cardtitle}>
{title}
{' '}
-
{' '}
<strong className={styles.updated}>
Last Updated: {formattedDate}
</strong>
</h3>
</div>
<div className={styles.helperImage}>
<HelperImage
height="24"
width="24"
alt="Help me"
onClick={this._handlePopover}
id={'HelpText' + id}
/>
</div>
<div>
{children}
</div>
<Popover
placement="left"
isOpen={this.state.helperstate}
target={'HelpText' + id}
toggle={this._handlePopover}
>
<PopoverBody>
<p>
{helpText}
</p>
</PopoverBody>
</Popover>
</div>
);
}
}
Card.defaultProps = {
helpImage: true,
helpText: 'This is the default explanation about this card.',
title: 'This is the default title',
};
Card.propTypes = {
children: PropTypes.node,
title: PropTypes.string.isRequired,
helpText: PropTypes.string,
id: PropTypes.string.isRequired,
date: PropTypes.number,
};
export default Card;
|
export const MainNav = [
/*{
icon: 'pe-7s-config',
label: 'Documentation',
to: '#/documentation/main',
},*/
{
icon: 'pe-7s-rocket',
label: 'Dashboards',
content: [
{
label: 'Analytics',
to: '#/dashboards/analytics',
},
{
label: 'Commerce',
to: '#/dashboards/commerce',
},
{
label: 'Sales',
to: '#/dashboards/sales',
},
{
label: 'Minimal',
content: [
{
label: 'Variation 1',
to: '#/dashboards/minimal-dashboard-1',
},
{
label: 'Variation 2',
to: '#/dashboards/minimal-dashboard-2',
},
],
},
{
label: 'CRM',
to: '#/dashboards/crm',
}
],
},
{
icon: 'pe-7s-browser',
label: 'Pages',
content: [
{
label: 'Login',
to: '#/pages/login',
},
{
label: 'Login Boxed',
to: '#/pages/login-boxed',
},
{
label: 'Register',
to: '#/pages/register',
},
{
label: 'Register Boxed',
to: '#/pages/register-boxed',
},
{
label: 'Forgot Password',
to: '#/pages/forgot-password',
},
{
label: 'Forgot Password Boxed',
to: '#/pages/forgot-password-boxed',
},
],
},
{
icon: 'pe-7s-plugin',
label: 'Applications',
content: [
{
label: 'Mailbox',
to: '#/apps/mailbox',
},
{
label: 'Chat',
to: '#/apps/chat',
},
{
label: 'Split Layout',
to: '#/apps/split-layout',
},
{
label: 'FAQ Section',
to: '#/apps/faq-section',
},
],
},
];
export const ComponentsNav = [
{
icon: 'pe-7s-diamond',
label: 'Elements',
content: [
{
label: 'Buttons',
content: [
{
label: 'Standard',
to: '#/elements/buttons-standard',
},
{
label: 'Pills',
to: '#/elements/buttons-pills',
},
{
label: 'Square',
to: '#/elements/buttons-square',
},
{
label: 'Shadow',
to: '#/elements/buttons-shadow',
},
{
label: 'With Icons',
to: '#/elements/buttons-icons',
},
]
},
{
label: 'Dropdowns',
to: '#/elements/dropdowns',
},
{
label: 'Icons',
to: '#/elements/icons',
},
{
label: 'Badges',
to: '#/elements/badges-labels',
},
{
label: 'Cards',
to: '#/elements/cards',
},
{
label: 'Loading Indicators',
to: '#/elements/loaders',
},
{
label: 'List Groups',
to: '#/elements/list-group',
},
{
label: 'Navigation Menus',
to: '#/elements/navigation',
},
{
label: 'Timeline',
to: '#/elements/timelines',
},
{
label: 'Utilities',
to: '#/elements/utilities',
},
{
label: 'Visibility Sensor',
to: '#/elements/visibility-sensor',
},
],
},
{
icon: 'pe-7s-car',
label: 'Components',
content: [
{
label: 'Tabs',
to: '#/components/tabs',
},
{
label: 'Accordions',
to: '#/components/accordions',
},
{
label: 'Notifications',
to: '#/components/notifications',
},
{
label: 'Modals',
to: '#/components/modals',
},
{
label: 'Loading Blockers',
to: '#/components/loading-blocks',
},
{
label: 'Progress Bar',
to: '#/components/progress-bar',
},
{
label: 'Tooltips & Popovers',
to: '#/components/tooltips-popovers',
},
{
label: 'Carousel',
to: '#/components/carousel',
},
{
label: 'Calendar',
to: '#/components/calendar',
},
{
label: 'Pagination',
to: '#/components/pagination',
},
{
label: 'Count Up',
to: '#/components/count-up',
},
{
label: 'Sticky Elements',
to: '#/components/sticky-elements',
},
{
label: 'Scrollable',
to: '#/components/scrollable-elements',
},
{
label: 'Tree View',
to: '#/components/tree-view',
},
{
label: 'Maps',
to: '#/components/maps',
},
{
label: 'Ratings',
to: '#/components/ratings',
},
{
label: 'Image Crop',
to: '#/components/image-crop',
},
{
label: 'Guided Tours',
to: '#/components/guided-tours',
},
],
},
{
icon: 'pe-7s-display2',
label: 'Tables',
content: [
{
label: 'Data Tables',
content: [
{
label: 'Basic',
to: '#/tables/data-tables',
},
{
label: 'Custom Components',
to: '#/tables/datatables-custom-components',
},
{
label: 'Fixed Header',
to: '#/tables/datatables-fixed-header',
},
{
label: 'Aggregation',
to: '#/tables/datatables-aggregation',
},
{
label: 'Editable Tables',
to: '#/tables/datatables-editable',
},
]
},
{
label: 'Regular Tables',
to: '#/tables/regular-tables',
},
{
label: 'Grid Tables',
to: '#/tables/grid-tables',
},
]
},
];
export const FormsNav = [
{
icon: 'pe-7s-light',
label: 'Elements',
content: [
{
label: 'Controls',
to: '#/forms/controls',
},
{
label: 'Layouts',
to: '#/forms/layouts',
},
{
label: 'Validation',
to: '#/forms/validation',
},
{
label: 'Wizards',
content: [
{
label: 'Variation 1',
to: '#/forms/wizard-1',
},
{
label: 'Variation 2',
to: '#/forms/wizard-2',
},
{
label: 'Variation 3',
to: '#/forms/wizard-3',
},
]
},
{
label: 'Sticky Form Headers',
to: '#/forms/sticky-headers',
},
],
},
{
icon: 'pe-7s-joy',
label: 'Widgets',
content: [
{
label: 'Datepicker',
to: '#/forms/datepicker',
},
{
label: 'Range Slider',
to: '#/forms/range-slider',
},
{
label: 'Input Selects',
to: '#/forms/input-selects',
},
{
label: 'Toggle Switch',
to: '#/forms/toggle-switch',
},
{
label: 'Dropdowns',
to: '#/forms/dropdown',
},
{
label: 'WYSIWYG Editor',
to: '#/forms/wysiwyg-editor',
},
{
label: 'Input Mask',
to: '#/forms/input-mask',
},
{
label: 'Typeahead',
to: '#/forms/typeahead',
},
{
label: 'Clipboard',
to: '#/forms/clipboard',
},
{
label: 'Textarea Autosize',
to: '#/forms/textarea-autosize',
},
{
label: 'Number Spinners',
to: '#/forms/numberspinners',
},
{
label: 'Color Picker',
to: '#/forms/color-picker',
},
{
label: 'Dropzone',
to: '#/forms/dropzone',
},
],
},
];
export const WidgetsNav = [
{
icon: 'pe-7s-graph2',
label: 'Chart Boxes',
content: [
{
label: 'Variation 1',
to: '#/widgets/chart-boxes',
},
{
label: 'Variation 2',
to: '#/widgets/chart-boxes-2',
},
{
label: 'Variation 3',
to: '#/widgets/chart-boxes-3',
},
]
},
{
icon: 'pe-7s-id',
label: 'Profile Boxes',
to: '#/widgets/profile-boxes',
},
{
icon: 'pe-7s-display1',
label: 'Content Boxes',
to: '#/widgets/content-boxes',
},
];
export const ChartsNav = [
{
icon: 'pe-7s-graph2',
label: 'ChartJS',
to: '#/charts/chartjs',
},
{
icon: 'pe-7s-graph',
label: 'Apex Charts',
to: '#/charts/apexcharts',
},
{
icon: 'pe-7s-gleam',
label: 'Gauges',
to: '#/charts/gauges',
},
{
icon: 'pe-7s-graph1',
label: 'Chart Sparklines 1',
to: '#/charts/sparklines-1',
},
{
icon: 'pe-7s-edit',
label: 'Chart Sparklines 2',
to: '#/charts/sparklines-2',
},
]; |
#! /usr/bin/env python
"""
Routines to analysis execution time of virtual screening
These routines were developed by:
Rodrigo Antonio Faccioli - [email protected] / [email protected]
Leandro Oliveira Bortot - [email protected] / [email protected]
"""
import os
import operator
""" This function obtains all log_docking files
in mypath
"""
def get_files_log_docking(mypath):
only_log_file = []
for root, dirs, files in os.walk(mypath):
for file in files:
if file.endswith(".log_docking"):
f_path = os.path.join(root,file)
only_log_file.append(f_path)
return only_log_file
def vs_time_docking(path_log_docking, path_analysis):
d_docking_time = {}
str_sep = "__-__"
file_all_docking_time = "all_docking_time.txt"
#Obatain all log_docking files
all_log_files = get_files_log_docking(path_log_docking)
#Assign all lines into d_docking_time
for log in all_log_files:
f_file = open(log,"r")
for line in f_file:
line_s = str(line).split("\t")
receptor = str(line_s[0])
compound = str(line_s[1])
dock_time = float(line_s[2])
torsion_angle = int(line_s[3])
num_atom = int(line_s[4])
key = receptor+str_sep+compound+str_sep+str(torsion_angle)+str_sep+str(num_atom)
d_docking_time[key] = dock_time
f_file.close()
#Sorting dictionary by dock_time
sorted_log_dict = sorted(d_docking_time.items(), key=operator.itemgetter(1), reverse=True)
#Creating file
f_path = os.path.join(path_analysis,file_all_docking_time)
f_file = open(f_path,"w")
f_file.write(";receptor compound torsion_angle atom\n")
for l_item in sorted_log_dict:
key_s = str(l_item[0]).split(str_sep)
receptor = str(key_s[0])
compound = str(key_s[1])
torsion_angle = int(key_s[2])
num_atom = int(key_s[3])
dock_time = float(l_item[1])
line = str(receptor)+"\t"+str(compound)+"\t"+str(dock_time)+"\t"+str(torsion_angle)+"\t"+str(num_atom)+"\n"
f_file.write(line)
f_file.close()
|
import request from '@/utils/request'
// 查询调度日志列表
export function listJobLog(query) {
return request({
url: '/monitor/jobLog/list',
method: 'get',
params: query
})
}
// 删除调度日志
export function delJobLog(jobLogId) {
return request({
url: '/monitor/jobLog/' + jobLogId,
method: 'delete'
})
}
// 清空调度日志
export function cleanJobLog() {
return request({
url: '/monitor/jobLog/clean',
method: 'delete'
})
}
// 导出调度日志
export function exportJobLog(query) {
return request({
url: '/monitor/jobLog/export',
method: 'get',
params: query
})
} |
// config-overrides.js
const {
addWebpackAlias,
babelInclude,
fixBabelImports,
override,
} = require('customize-cra');
const path = require('path');
module.exports = override(
fixBabelImports('module-resolver', {
alias: {
'^react-native$': 'react-native-web',
},
}),
addWebpackAlias({
'react-native': 'react-native-web',
// here you can add extra packages
}),
babelInclude([
path.resolve('src'),
path.resolve('app.json'),
// any react-native modules you need babel to compile
])
);
|
/* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*/
/**
Filename: RegExp_multiline.js
Description: 'Tests RegExps multiline property'
Author: Nick Lerissa
Date: March 12, 1998
*/
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
var VERSION = 'no version';
startTest();
var TITLE = 'RegExp: multiline';
writeHeaderToLog('Executing script: RegExp_multiline.js');
writeHeaderToLog( SECTION + " "+ TITLE);
var count = 0;
var testcases = new Array();
// First we do a series of tests with RegExp.multiline set to false (default value)
// Following this we do the same tests with RegExp.multiline set true(**).
// RegExp.multiline
testcases[count++] = new TestCase ( SECTION, "RegExp.multiline",
false, RegExp.multiline);
// (multiline == false) '123\n456'.match(/^4../)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)",
null, '123\n456'.match(/^4../));
// (multiline == false) 'a11\na22\na23\na24'.match(/^a../g)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
// (multiline == false) 'a11\na22'.match(/^.+^./)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)",
null, 'a11\na22'.match(/^.+^./));
// (multiline == false) '123\n456'.match(/.3$/)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)",
null, '123\n456'.match(/.3$/));
// (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
// (multiline == false) 'abc\ndef'.match(/c$...$/)
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)",
null, 'abc\ndef'.match(/c$...$/));
// (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
// (multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))
testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))",
null, 'abc\ndef'.match(new RegExp('c$...$')));
// **Now we do the tests with RegExp.multiline set to true
// RegExp.multiline = true; RegExp.multiline
RegExp.multiline = true;
testcases[count++] = new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline",
true, RegExp.multiline);
// (multiline == true) '123\n456'.match(/^4../)
testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)",
String(['456']), String('123\n456'.match(/^4../)));
// (multiline == true) 'a11\na22\na23\na24'.match(/^a../g)
testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
// (multiline == true) 'a11\na22'.match(/^.+^./)
//testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)",
// String(['a11\na']), String('a11\na22'.match(/^.+^./)));
// (multiline == true) '123\n456'.match(/.3$/)
testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)",
String(['23']), String('123\n456'.match(/.3$/)));
// (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g)
testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
// (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
// (multiline == true) 'abc\ndef'.match(/c$....$/)
//testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)",
// 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
RegExp.multiline = false;
function test()
{
for ( tc=0; tc < testcases.length; tc++ ) {
testcases[tc].passed = writeTestCaseResult(
testcases[tc].expect,
testcases[tc].actual,
testcases[tc].description +" = "+
testcases[tc].actual );
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
stopTest();
return ( testcases );
}
test();
|
import os
import logging
import nose
import angr
l = logging.getLogger("angr_tests")
this_file = str(os.path.dirname(os.path.realpath(__file__)))
test_location = os.path.join(this_file, '../../binaries/tests')
data_location = os.path.join(this_file, "../../binaries/tests_data/test_gdb_plugin")
def test_gdb():
p = angr.Project(os.path.join(test_location, "x86_64/test_gdb_plugin"))
st = p.factory.blank_state()
st.gdb.set_stack(os.path.join(data_location, "stack"), stack_top=0x7ffffffff000)
st.gdb.set_heap(os.path.join(data_location, "heap"), heap_base = 0x601000)
st.gdb.set_regs(os.path.join(data_location, "regs"))
nose.tools.assert_equal(st.solver.eval(st.regs.rip), 0x4005b4)
# Read the byte in memory at $sp + 8
loc = st.solver.eval(st.regs.rsp) + 8
val = st.memory.load(loc, 8, endness=st.arch.memory_endness)
nose.tools.assert_equal(st.solver.eval(val), 0x00601010)
if __name__ == "__main__":
test_gdb()
|
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&#]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function getBaseURL() {
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
console.log('getBaseURL - getUrl:' + getUrl);
console.log('getBaseURL - baseUrl:' + baseUrl);
return baseUrl;
}
|
/**
* @file global api
* @author mars
*/
// import Mars, {directives} from '${apiLibrary}'
/**
* 判断变量是否为对象
*
* @param {Object} target 判断目标
* @return {Object} object 变量是否为对象
*/
function shouleBeObject(target) {
return target && typeof target === 'object'
? {
res: true
}
: {
res: false
};
}
/**
* 格式化返回错误信息
*
* @param {string} name 说明
* @param {string} para 错误类型字段名
* @param {string} correct 正确类型
* @param {string} wrong 错误类型字段内容
* @return {string} string 错误信息
*/
function getParameterError({name = '', para, correct, wrong}) {
const parameter = para ? `parameter.${para}` : 'parameter';
const errorType = upperCaseFirstLetter(wrong === null ? 'Null' : wrong);
return `${name}:fail parameter error: ${parameter} should be ${correct} instead of ${errorType}`;
}
/**
* 转化大写
*
* @param {string} string 转换字符串
* @return {string} string 转换字符串
*/
function upperCaseFirstLetter(string) {
if (typeof string !== 'string') {
return string;
}
string = string.replace(/^./, match => match.toUpperCase());
return string;
}
function sendTypeErrorMsg(res, apiName, paramName, paramType, rightType, fail, complete) {
res.errMsg = getParameterError({
name: apiName,
para: paramName,
correct: rightType,
wrong: paramType
});
console.error(res.errMsg);
typeof fail === 'function' && fail(res);
typeof complete === 'function' && complete(res);
}
/**
* 判断是否是object,并发送信息
*
* @param {Object} opt 判断对象
* @param {string} apiName 方法参数名
*/
function judgeOptionType(opt, apiName) {
const res = shouleBeObject(opt);
if (!res.res) {
console.error(getParameterError({
name: apiName,
para: null,
correct: 'Object',
wrong: typeof opt
}));
}
}
/**
* 平滑滚动
*
* @param {node} el 需要滚动的容器dom
* @param {number} top 滚动的scrollTop值
* @param {number} duration 滚动时长
* @param {Function} success 成功回调
* @param {Function} complete 完成回调
*/
function animateScroll(el, top, duration, success, complete) {
let requestId = null;
let currentTop = el.pageYOffset;
if (currentTop === top) {
return;
}
const stepCount = duration / 16;
const Type = currentTop > top ? 'UP' : 'DOWN';
const stepDistance = Type === 'UP'
? (currentTop - top) / stepCount
: (top - currentTop) / stepCount;
// 采用requestAnimationFrame,平滑动画
function step() {
if (Type === 'UP') {
currentTop -= stepDistance;
window.scrollTo(0, currentTop);
if (currentTop > top) {
el.scrollTop = currentTop;
requestId = window.requestAnimationFrame(step);
}
else {
// el.scrollTop = top;
window.scrollTo(0, top);
window.cancelAnimationFrame(requestId);
typeof success === 'function' && success();
typeof complete === 'function' && complete();
}
}
else if (Type === 'DOWN') {
currentTop += stepDistance;
if (currentTop < top) {
window.scrollTo(0, currentTop);
requestId = window.requestAnimationFrame(step);
}
else {
// el.scrollTop = top;
window.scrollTo(0, top);
window.cancelAnimationFrame(requestId);
typeof success === 'function' && success();
typeof complete === 'function' && complete();
}
}
}
window.requestAnimationFrame(step);
}
function initDirectives(Vue, directives = {}) {
Object.keys(directives).forEach(key => {
Vue.directive(key, directives[key]);
});
}
function initGlobalApi(Vue, vm) {
/* globals directives */
initDirectives(Vue, directives);
const marsAppInstance = vm.$root.$children[0];
/* globals Mars */
Vue.prototype.$api = Object.assign(Mars, {
'$router': vm.$router,
stopPullDownRefresh: marsAppInstance.$refs.refresherHandler.stopPullDownRefresh,
setNavigationBarTitle: opt => {
judgeOptionType(opt, 'setNavigationBarTitle');
const {title, success, fail, complete} = opt;
let resInfo = {errMsg: 'setNavigationBarTitle:ok'};
if (title && typeof title !== 'string' || title === undefined) {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarTitle', 'title',
typeof title, 'string', fail, complete);
}
marsAppInstance.currentTitle = opt.title;
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
setNavigationBarColor: opt => {
judgeOptionType(opt, 'setNavigationBarColor');
const {frontColor, backgroundColor, animation, success, fail, complete} = opt;
let resInfo = {errMsg: 'setNavigationBarColor:ok'};
if (frontColor !== '#ffffff' && frontColor !== '#000000') {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarColor', 'frontColor',
frontColor, '#000000|#ffffff', fail, complete);
}
if (backgroundColor && typeof backgroundColor !== 'string' || backgroundColor === undefined) {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarColor', 'backgroundColor',
typeof backgroundColor, 'string', fail, complete);
}
let transitionDuration = 0;
let transitionTimingFunc = 'linear';
if (animation) {
const animationRes = shouleBeObject(animation);
if (!animationRes.res) {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarColor', 'animation',
typeof animation, 'object', fail, complete);
}
const {
duration,
timingFunc
} = animation;
if (duration && typeof duration !== 'number') {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarColor', 'animation.duration',
typeof duration, 'number', fail, complete);
}
transitionDuration = duration;
if (['linear', 'easeIn', 'easeOut', 'easeInOut'].indexOf(timingFunc) === -1) {
return sendTypeErrorMsg(
resInfo, 'setNavigationBarColor', 'animation.timingFunc', timingFunc,
'linear|easeIn|easeOut|easeInOut', fail, complete);
}
transitionTimingFunc = timingFunc;
}
marsAppInstance.currentNavigationBarTextStyle = frontColor;
marsAppInstance.currentNavigationBarBackgroundColor = backgroundColor;
marsAppInstance.transitionDuration = transitionDuration
&& (transitionDuration / 1000 + 's')
|| 0;
marsAppInstance.transitionTimingFunc = transitionTimingFunc;
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
setTabBarBadge: opt => {
judgeOptionType(opt, 'setTabBarBadge');
let {index, text, success, fail, complete} = opt;
let resInfo = {errMsg: 'setTabBarBadge:ok'};
if (index && typeof index !== 'number') {
return sendTypeErrorMsg(
resInfo, 'setTabBarBadge', 'index',
typeof index, 'number', fail, complete);
}
if (text && typeof text !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarBadge', 'text',
typeof text, 'string', fail, complete);
}
text.length > 4 && (text = text.substring(0, 4) + '...');
marsAppInstance.tabList[index] && (marsAppInstance.tabList[index].badge = text);
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
removeTabBarBadge: opt => {
judgeOptionType(opt, 'removeTabBarBadge');
let {index, success, fail, complete} = opt;
let resInfo = {errMsg: 'removeTabBarBadge:ok'};
if (index && typeof index !== 'number') {
return sendTypeErrorMsg(
resInfo, 'removeTabBarBadge', 'index',
typeof index, 'number', fail, complete);
}
marsAppInstance.tabList[index] && (marsAppInstance.tabList[index].badge = '');
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
showTabBarRedDot: opt => {
judgeOptionType(opt, 'showTabBarRedDot');
let {index, success, fail, complete} = opt;
let resInfo = {errMsg: 'showTabBarRedDot:ok'};
if (index && typeof index !== 'number') {
return sendTypeErrorMsg(
resInfo, 'showTabBarRedDot', 'index',
typeof index, 'number', fail, complete);
}
marsAppInstance.tabList[index] && (marsAppInstance.tabList[index].showRedDot = true);
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
hideTabBarRedDot: opt => {
judgeOptionType(opt, 'hideTabBarRedDot');
let {index, success, fail, complete} = opt;
let resInfo = {errMsg: 'hideTabBarRedDot:ok'};
if (index && typeof index !== 'number') {
return sendTypeErrorMsg(
resInfo, 'hideTabBarRedDot', 'index',
typeof index, 'number', fail, complete);
}
marsAppInstance.tabList[index] && (marsAppInstance.tabList[index].showRedDot = false);
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
setTabBarStyle: opt => {
judgeOptionType(opt, 'setTabBarStyle');
const {color, selectedColor, backgroundColor, borderStyle, success, fail, complete} = opt;
let resInfo = {errMsg: 'setTabBarStyle:ok'};
if (color && typeof color !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarStyle', 'color',
typeof color, 'string', fail, complete);
}
if (selectedColor && typeof selectedColor !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarStyle', 'selectedColor',
typeof selectedColor, 'string', fail, complete);
}
if (backgroundColor && typeof backgroundColor !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarStyle', 'backgroundColor',
typeof backgroundColor, 'string', fail, complete);
}
if (borderStyle && (borderStyle !== 'white' && borderStyle !== 'black')) {
return sendTypeErrorMsg(
resInfo, 'setTabBarStyle', 'borderStyle',
borderStyle, 'black|white', fail, complete);
}
marsAppInstance.tabBarSelectedColor = selectedColor;
marsAppInstance.tabBarColor = color;
marsAppInstance.tabBarBackgroundColor = backgroundColor;
marsAppInstance.tabBarBorderStyle = borderStyle;
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
setTabBarItem: opt => {
judgeOptionType(opt, 'setTabBarItem');
const {index, text, iconPath, selectedIconPath, success, fail, complete} = opt;
let resInfo = {errMsg: 'setTabBarItem:ok'};
if (index && typeof index !== 'number') {
return sendTypeErrorMsg(
resInfo, 'setTabBarItem', 'index',
typeof index, 'number', fail, complete);
}
if (text && typeof text !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarItem', 'text',
typeof text, 'string', fail, complete);
}
if (iconPath && typeof iconPath !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarItem', 'iconPath',
typeof iconPath, 'string', fail, complete);
}
if (selectedIconPath && typeof selectedIconPath !== 'string') {
return sendTypeErrorMsg(
resInfo, 'setTabBarItem', 'selectedIconPath',
typeof selectedIconPath, 'string', fail, complete);
}
marsAppInstance.tabList[index] && (marsAppInstance.tabList[index].text = text);
marsAppInstance.tabList[index]
&& iconPath
&& (marsAppInstance.tabList[index].iconPath = iconPath);
marsAppInstance.tabList[index]
&& selectedIconPath
&& (marsAppInstance.tabList[index].selectedIconPath = selectedIconPath);
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
showTabBar: opt => {
judgeOptionType(opt, 'showTabBar');
const {animation, success, fail, complete} = opt;
let resInfo = {errMsg: 'showTabBar:ok'};
if (animation && typeof animation !== 'boolean') {
return sendTypeErrorMsg(
resInfo, 'showTabBar', 'animation',
typeof animation, 'boolean', fail, complete);
}
marsAppInstance.customShowTabBar = true;
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
hideTabBar: opt => {
judgeOptionType(opt, 'hideTabBar');
const {animation, success, fail, complete} = opt;
let resInfo = {errMsg: 'hideTabBa:ok'};
if (animation && typeof animation !== 'boolean') {
return sendTypeErrorMsg(
resInfo, 'hideTabBar', 'animation',
typeof animation, 'boolean', fail, complete);
}
marsAppInstance.customShowTabBar = false;
typeof success === 'function' && success(resInfo);
typeof complete === 'function' && complete(resInfo);
},
pageScrollTo: opt => {
judgeOptionType(opt, 'pageScrollTo');
const {scrollTop, duration, success, fail, complete} = opt;
let resInfo = {errMsg: 'pageScrollTo:ok'};
if (scrollTop && typeof scrollTop !== 'number') {
return sendTypeErrorMsg(
resInfo, 'pageScrollTo', 'scrollTop',
typeof scrollTop, 'number', fail, complete);
}
if (duration && typeof duration !== 'number') {
return sendTypeErrorMsg(
resInfo, 'pageScrollTo', 'duration',
typeof duration, 'number', fail, complete);
}
const scrollContainer = window;
animateScroll(scrollContainer, scrollTop, duration, success, complete);
}
});
}
/* eslint-disable fecs-export-on-declare */
export default initGlobalApi; |
//Como o valor retornado deste módulo é um função factory será atribuido um objeto independente para cada const/var que acessar este módulo.
module.exports = ()=>{
return{
valor: 1,
inc(){
this.valor++;
}
};
}; |
const { parentPort } = require('worker_threads');
function random(min, max) {
return Math.random() * (max - min) + min
}
const sorter = require("./test2-worker");
const start = Date.now()
let bigList = Array(1000000).fill().map((_) => random(1, 10000))
/**
//you can receive messages from the main thread this way:
parentPort.on('message', (msg) => {
console.log("Main thread finished on: ", (msg.timeDiff / 1000), " seconds...");
})
*/
sorter.sort(bigList);
parentPort.postMessage({ val: sorter.firstValue, timeDiff: Date.now() - start });
|
import React from 'react'
import './CTable.css'
import PropTypes from 'prop-types';
import CTableHeader from './CTableHeader';
import CTableRow from './CTableRow';
export default function CTable(props) {
return (
<table className="cTable">
<caption>{props.caption}</caption>
<CTableHeader {...props} />
<tbody>
<CTableRow {...props} />
</tbody>
</table>
)
}
CTable.propTypes = {
caption: PropTypes.string,
data: PropTypes.arrayOf(PropTypes.object).isRequired,
headerColor: PropTypes.string,
headerTextColor: PropTypes.string,
primaryColor: PropTypes.string,
secondaryColor: PropTypes.string,
cellTextColor: PropTypes.string,
conditionalCellStyle: PropTypes.arrayOf(PropTypes.exact({
columns: PropTypes.arrayOf(PropTypes.string).isRequired,
styleTrue: PropTypes.object.isRequired,
styleFalse: PropTypes.object.isRequired,
validation: PropTypes.func.isRequired,
defaultStyle: PropTypes.object.isRequired,
}))
} |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 23 12:11:15 2020
Modified from the cornstover biorefinery constructed in Cortes-Peña et al., 2020,
with modification of fermentation system for 2,3-Butanediol instead of the original ethanol
[1] Cortes-Peña et al., BioSTEAM: A Fast and Flexible Platform for the Design,
Simulation, and Techno-Economic Analysis of Biorefineries under Uncertainty.
ACS Sustainable Chem. Eng. 2020, 8 (8), 3302–3310.
https://doi.org/10.1021/acssuschemeng.9b07040.
All units are explicitly defined here for transparency and easy reference
@author: sarangbhagwat
"""
import biosteam as bst
import thermosteam as tmo
from biorefineries.BDO.chemicals_data import chems
tmo.settings.set_thermo(chems)
bst.CE = 541.7 # year 2016
_kg_per_ton = 907.18474
_lb_per_kg = 2.20462
_liter_per_gallon = 3.78541
_ft3_per_m3 = 35.3147
_chemical_2011to2016 = 102.5 / 91.7
_chemical_2020to2016 = 102.5 / 113.8 # average of Jan and Feb
# From USD/dry-ton to USD/kg in 2016$, 20% moisture content
# changed from Humbird et al., 2011 to Davis et al., 2018
feedstock_price = 71.26 / _kg_per_ton * 0.8
# 2.18 is the average whole-sale ethanol price between 2010-2019 in 2016 $/gal
# based on Annual Energy Outlook (AEO) from Energy Information Adiministration (EIA)
# (https://www.eia.gov/outlooks/aeo/), which is $0.732/gal and similar to the
# 2.18/(2988/1e3) = $0.730/gal based on a density of 2988 g/gal from H2 Tools
# Lower and upper bounds are $1.37/gal and $2.79/gal, or $0.460/kg and $0.978/kg
ethanol_V = chems.Ethanol.V('l', 298.15, 101325) # molar volume in m3/mol
ethanol_MW = chems.Ethanol.MW
ethanol_price = 2.18 / (_liter_per_gallon/chems.Ethanol.V('l', 298.15, 101325)*ethanol_MW/1e6)
# Dipotassium hydrogen phosphate (DPHP)
# https://www.alibaba.com/product-detail/Food-Grade-Dipotassium-Dydrogen-Phosphate-Trihydrate_60842047866.html?spm=a2700.7724857.normalList.2.4ef2457e3gPbfv&s=p
# DISREGARD: https://www.sigmaaldrich.com/catalog/product/mm/105104?lang=en®ion=US
DPHP_price = 1.15
# 2.86 is the average motor gasoline price between 2010-2019 in 2016 $/gal
# based on AEO from EIA, density of gasoline is 2.819 kg/gal
# based on Lower and Higher Heating Values of Hydrogen and Other Fuels
# from H2 Tools maintained by Pacific Northwest National Laboratory
# (https://h2tools.org/hyarc/calculator-tools/lower-and-higher-heating-values-fuels)
denaturant_price = 2.86 / 2.819
# 1.41e6 is $/yr and 4279 in kg/hr from Table 33 of Davis et al., 2018 (BDO scenario)
# 7880 is operating hours/yr on Page 10 of Davis et al., 2018,
# cost is negative because it's a product stream
ash_disposal_price = -1.41e6 / (4279*7880)
# Assums no cost/credit for baseline, the same as ash disposal for the lower bound,
# for the upper bound (i.e., positive selling price indicating profit), use
# USGS 2015-2019 average free on bard price in $/metric ton for crude gypsum.
# National Minerals Information Center. Mineral Commodity Summaries 2020;
# U.S. Geological Survey, 2020.
# Assuming all prices were in their nominal year (e.g., 2015 price in 2015$)
# and adjusted to 2016$
# 2015: 7.80 * 1.114 / 1.100 = 7.90
# 2016: 8.00
# 2017: 7.50 * 1.114 / 1.134 = 7.37
# 2018: 8.30 * 1.114 / 1.157 = 7.99
# 2019: 8.00 * 1.114 / 1.185 = 7.52
# (7.90+8.00+7.37+7.99+7.52) / 5 = 7.76 (in metric tonne)
# For the lower bound (i.e., negative selling price indicating cost), use price from
# Aden et al., 2002: $0.0094/lb in 2000$ = 0.0094*1.114/0.802*2.20462 = $0.0288/kg
# in 2016$
gypsum_price = 0
# Baseline from Davis et al., 2018, lower bound is 2015-2019 average of
# hydrate lime in $/ton at plant from Mineral Commodity Summaries 2020.
# 2015: 146.40 * (1.114/1.100) / 907.18474 = 0.163
# 2016: 145.50 / 907.18474 = 0.160
# 2017: 147.10 * (1.114/1.134) / 907.18474 = 0.159
# 2018: 151.50 * (1.114/1.157) / 907.18474 = 0.161
# 2019: 151.00 * (1.114/1.185) / 907.18474 = 0.156
# (0.163+0.160+0.159+0.161+0.156) / 5 = 0.160
# Upper bound is +10% from baseline = 0.1189 * _lb_per_kg * 1.1 = 0.288
lime_price = 0.1189 * _lb_per_kg
# Mentioned in P53 of Humbird et al., not into any units, but a cashflow
# The original cost is $466,183 every 5 years, converted to per hour assuming 96% uptime
baghouse_bag_price = 466833 / 5 / (24*365*0.96)
# 4.70 is the average natural gas price in 2016$/Mcf based on AEO from EIA,
# which is $0.231/kg at 273.15 K or $0.253/kg at 298.15 K using BioSTEAM,
# similar to the 4.7/1000/22*1000 = $0.214/kg at 273.15 K using 22 g/ft3 from H2 Tools
# Using the same conversion, lower and upper bounds should be
# $3.68/Mcf and $5.65/Mcf, or $0.198/kg and $0.304/kg
CH4_V = chems.CH4.V(298.15, 101325) # molar volume in m3/mol
CH4_MW = chems.CH4.MW
natural_gas_price = 4.70/1e3*_ft3_per_m3*CH4_V * (1e3/CH4_MW)
# https://www.rightpricechemicals.com/buy-amberlyst-15-ion-exchange-resin.html
# USD 383.13 for 2.5kg (largest available size order), accessed 06/11/2020
amberlyst_15_price = 153.252 * _chemical_2020to2016
# https://www.alibaba.com/product-detail/Tricalcium-Phosphate-Tricalcium-Phosphate-TCP-Tricalcium_60744013678.html?spm=a2700.galleryofferlist.0.0.42f16684C9iJhz&s=p
TCP_price = 850 / _kg_per_ton # tricalcium (di)phosphate
# BDO_price = 1.88 # initial value
MEK_price = 1.88 # initial value
# Currently not in use
# Methanol price from Goellner et al., production from natural gas (Case 3),
# average of two load structures in 2011$,
# crude methanol with ~1% CO2 and 1% H2O
methanol_price = (311.17+345.39)/2/_kg_per_ton * _chemical_2011to2016
# Acetoin product selling price
# https://www.alibaba.com/product-detail/Acetoin-CAS-NO-513-86-0_60673118759.html?spm=a2700.galleryofferlist.0.0.4d906f82dIhSkn
# acetoin_price = 5.925
acetoin_price = 0. # assumed
# Isobutyraldehyde product selling price
# https://www.alibaba.com/product-detail/China-manufacture-Isobutyraldehyde-price_60837108075.html?spm=a2700.galleryofferlist.0.0.753369fcbZcNhe
# IBA_price = 1.2
IBA_price = 0. # assumed
# https://www.alibaba.com/product-detail/High-purity-99-Isobutanol-Iso-butanol_62334586181.html?spm=a2700.galleryofferlist.normal_offer.d_title.6a377f34hUhyuR
isobutanol_price = 1.3
# https://www.alibaba.com/product-detail/Carboxy-Methyl-Cellulose-CAS-9000-11_62593143048.html?spm=a2700.galleryofferlist.normal_offer.d_title.714574f8fNXgfq&s=p
# https://www.alibaba.com/product-detail/hydrogenation-catalyst-HT-40-nickel-catalyst_507577301.html?spm=a2700.galleryofferlist.normal_offer.d_title.61e474d0VtlyjV&s=p
KieCNi_price = 1.3 + 0.18*20
# https://www.alibaba.com/product-detail/Gas-Hydrogen-45kg-Lpg-Gas-Cylinder_62018626105.html?spm=a2700.galleryofferlist.topad_creative.d_title.4a5c7ce2MUN3cm
h2_price = 1.03
# market for fatty alcohol, GLO, ecoinvent 3.7.1; show that 10% - 1000% of this assumed value has negligible effect on MPSP
oleyl_alcohol_price = 2.97 # 2.1 euro per kg in 2005; adjusted for inflation and conversion to USD
# All in 2016$/kg
price = {'MEK': MEK_price,
'TCP': TCP_price,
'Kie-CMC-Ni':KieCNi_price,
'IBA': IBA_price,
'Acetoin': acetoin_price,
'Feedstock': feedstock_price,
'H2': h2_price,
'OleylAlcohol': oleyl_alcohol_price,
'Isobutanol': isobutanol_price,
'Sulfuric acid': 0.0430 * _lb_per_kg,
# 0.1900 is for NH3
'AmmoniumHydroxide': 0.1900 * _lb_per_kg * 17.031/35.046,
'CSL': 0.0339 * _lb_per_kg,
'Caustics': 0.2384 * _lb_per_kg * 0.5, # 50 wt% NaOH/water mixture
'Boiler chems': 2.9772 * _lb_per_kg,
'Lime': lime_price,
'Cooling tower chems': 1.7842 * _lb_per_kg,
'Makeup water': 0.0002 * _lb_per_kg,
# Cost of ash is negative because it's a product stream
'Ash disposal': ash_disposal_price,
'Electricity': 0.070, # AEO from EIA, 2010-2019 average (0.067-0.074 range)
# $6.16/kg protein in 2016$, P25 of Davis et al., 2018
'Enzyme': 6.16,
'DPHP': DPHP_price,
'Baghouse bag': baghouse_bag_price,
'Natural gas': natural_gas_price,
'Methanol': methanol_price,
'Ethanol': ethanol_price,
# Below currently not in use
'Gypsum': gypsum_price,
'Denaturant': denaturant_price,
'Amberlyst15': amberlyst_15_price,
'DAP': 0.1645 * _lb_per_kg,}
bst.PowerUtility.price = price['Electricity']
_ha = bst.HeatUtility.get_heating_agent('low_pressure_steam')
_ha.heat_transfer_efficiency = 0.90
_ha.T = 529.2
_ha.P = 44e5
_ha.regeneration_price = 0.30626
_CW = bst.HeatUtility.get_cooling_agent('cooling_water')
_CW.T = 28 + 273.15
_CW.T_limit = _CW.T + 9
_CW.regeneration_price = 0
bst.HeatUtility.get_cooling_agent('chilled_water').heat_transfer_price = 0
# Side steam in CHP not a heat utility, thus will cause problem in TEA utility
# cost calculation if price not set to 0 here, costs for regeneration of heating
# and cooling utilities will be considered as CAPEX and OPEX of CHP and CT, respectively
# for i in (_lps, _mps, _hps, _cooling, _chilled):
# i.heat_transfer_price = i.regeneration_price = 0
# # if i == _cooling: continue
# # i.heat_transfer_efficiency = 0.85
# %%
# =============================================================================
# Characterization factors (CFs) for life cycle analysis (LCA), all from ref [5]
# if not noted, note that it is unclear if in-plant receiving and preprocessing
# (~50% of the total impact per ref [6]) of feedstock is included in ref [5]
# =============================================================================
CFs = {}
# =============================================================================
# 100-year global warming potential (GWP) in kg CO2-eq/kg
# =============================================================================
GWP_CFs = {
'NH4OH': 2.64 * chems.NH3.MW/chems.NH4OH.MW,
'CSL': 1.55,
'CH4': 0.40, # NA NG from shale and conventional recovery
'Enzyme': 2.24,
'Lime': 1.29,
'NaOH': 2.11,
'H2SO4': 44.47/1e3,
'Ethanol': 1.44,
'Isobutanol': 3.7703,
'H2' : 1.5907,
'OleylAlcohol': 3.022 # market for fatty alcohol, GLO, ecoinvent 3.7.1
}
H3PO4_GWP_CF = 2.5426
KOH_GWP_CF = 2.299
GWP_CFs['DPHP'] = 174.2*(H3PO4_GWP_CF/97.944 + 2*KOH_GWP_CF/56.106)
GWP_CF_array = chems.kwarray(GWP_CFs)
# In kg CO2-eq/kg of material
GWP_CF_stream = tmo.Stream('GWP_CF_stream', GWP_CF_array, units='kg/hr')
GWP_CFs['FGHTP Corn stover'] = 44.70/1e3 * 0.8
GWP_CFs['Switchgrass'] = 87.81/1e3 * 0.8
GWP_CFs['Miscanthus'] = 78.28/1e3 * 0.8
GWP_CFs['CaCO3'] = 10.30/1e3
GWP_CFs['Gypsum'] = -4.20/1e3
# In kg CO2-eq/kWh
GWP_CFs['Electricity'] = 0.48
# From corn stover
GWP_CFs['LacticAcid_GREET'] = 1.80
# From ref [7], lactic acid production, RoW, TRACI global warming
GWP_CFs['LacticAcid_fossil'] = 4.1787
CFs['GWP_CFs'] = GWP_CFs
CFs['GWP_CF_stream'] = GWP_CF_stream
# =============================================================================
# Fossil energy consumption (FEC), in MJ/kg of material
# =============================================================================
FEC_CFs = {
'NH4OH': 42 * chems.NH3.MW/chems.NH4OH.MW,
'CSL': 12,
'CH4': 50, # NA NG from shale and conventional recovery
'Enzyme': 26,
'Lime': 4.896,
'NaOH': 29,
'H2SO4': 568.98/1e3,
'Ethanol': 16,
'Isobutanol': 85.597,
'H2' : 148.23,
'OleylAlcohol': 49.29 # market for fatty alcohol, GLO, ecoinvent 3.7.1
}
H3PO4_FEC_CF = 39.542
KOH_FEC_CF = 30.421
FEC_CFs['DPHP'] = 174.2*(H3PO4_FEC_CF/97.944 + 2*KOH_FEC_CF/56.106)
FEC_CF_array = chems.kwarray(FEC_CFs)
# In MJ/kg of material
FEC_CF_stream = tmo.Stream('FEC_CF_stream', FEC_CF_array, units='kg/hr')
FEC_CFs['FGHTP Corn stover'] = 688.60/1e3 * 0.8
FEC_CFs['Switchgrass'] = 892.41/1e3 * 0.8
FEC_CFs['Miscanthus'] = 569.05/1e3 * 0.8
FEC_CFs['CaCO3'] = 133.19/1e3
FEC_CFs['Gypsum'] = -44.19/1e3
# In MJ/kWh
FEC_CFs['Electricity'] = 5.926
# From corn stover
FEC_CFs['LacticAcid'] = 29
# From ref [7], lactic acid production, RoW, cumulative energy demand, fossil
FEC_CFs['LacticAcid_fossil'] = 79.524
CFs['FEC_CFs'] = FEC_CFs
CFs['FEC_CF_stream'] = FEC_CF_stream
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
# # BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# # Copyright (C) 2020, Yoel Cortes-Pena <[email protected]>
# # Bioindustrial-Park: BioSTEAM's Premier Biorefinery Models and Results
# # Copyright (C) 2020, Yalin Li <[email protected]>,
# # Sarang Bhagwat <[email protected]>, and Yoel Cortes-Pena (this biorefinery)
# #
# # This module is under the UIUC open-source license. See
# # github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# # for license details.
# """
# Created on Mon Dec 30 09:30:10 2019
# Modified from the biorefineries constructed in [1] and [2] for the production of
# lactic acid from lignocellulosic feedstocks
# [1] Cortes-Peña et al., BioSTEAM: A Fast and Flexible Platform for the Design,
# Simulation, and Techno-Economic Analysis of Biorefineries under Uncertainty.
# ACS Sustainable Chem. Eng. 2020, 8 (8), 3302–3310.
# https://doi.org/10.1021/acssuschemeng.9b07040
# [2] Li et al., Tailored Pretreatment Processes for the Sustainable Design of
# Lignocellulosic Biorefineries across the Feedstock Landscape. Submitted.
# July, 2020.
# [3] Davis et al., Process Design and Economics for the Conversion of Lignocellulosic
# Biomass to Hydrocarbon Fuels and Coproducts: 2018 Biochemical Design Case Update;
# NREL/TP-5100-71949; National Renewable Energy Lab (NREL), 2018.
# https://doi.org/10.2172/1483234
# [4] Aden et al., Process Design Report for Stover Feedstock: Lignocellulosic
# Biomass to Ethanol Process Design and Economics Utilizing Co-Current Dilute
# Acid Prehydrolysis and Enzymatic Hydrolysis for Corn Stover; NREL/TP-510-32438;
# National Renewable Energy Lab (NREL), 2002.
# https://doi.org/10.2172/1218326.
# @author: yalinli_cabbi
# """
# # %%
# import biosteam as bst
# from lactic.chemicals import chems
# bst.CE = 541.7 # year 2016
# _kg_per_ton = 907.18474
# _lb_per_kg = 2.20462
# _liter_per_gallon = 3.78541
# _ft3_per_m3 = 35.3147
# _chemical_2020to2016 = 102.5 / 113.8 # average of Jan and Feb
# # From USD/dry-ton to USD/kg in 2016$, 20% moisture content,
# # baseline and lower bound (60) from ref [3], upper bound (146.4) from
# # Hartley et al., ACS Sustainable Chem. Eng. 2020, 8 (19), 7267–7277.
# # https://doi.org/10.1021/acssuschemeng.9b06551.
# _feedstock_factor = _kg_per_ton / 0.8
# feedstock_price = 71.3 / _feedstock_factor
#
# # Baseline from ref [3], lower and upper bounds (96% and 110% of baseline)
# # calculated using the index of sulfuric acid from U.S. Bureau of Labor Statistics
# # (Producer Price Index by Commodity for Chemicals and Allied Products)
# # https://fred.stlouisfed.org/series/WPU0613020T1 (accessed Jul 31, 2020).
# sulfuric_acid_price = 0.0430 * _lb_per_kg
# # 2.2 is the average whole-sale ethanol price between 2010-2019 in 2016 $/gal
# # based on Annual Energy Outlook (AEO) from Energy Information Adiministration (EIA)
# # (https://www.eia.gov/outlooks/aeo/), which is $0.732/gal and similar to the
# # 2.2/(2988/1e3) = $0.736/gal based on a density of 2988 g/gal from H2 Tools
# # Lower and upper bounds are $1.37/gal and $2.79/gal, or $0.460/kg and $0.978/kg
# _ethanol_V = chems.Ethanol.V('l', 298.15, 101325) # molar volume in m3/mol
# _ethanol_MW = chems.Ethanol.MW
# _ethanol_kg_2_gal = _liter_per_gallon/_ethanol_V*_ethanol_MW/1e6
# ethanol_price = 2.2 / _ethanol_kg_2_gal
# # Cost is negative because it's a product stream
# ash_disposal_price = -1.41e6 / (4279*7880)
# # Assums no cost/credit for baseline, the same as ash disposal for the lower bound,
# # for the upper bound (i.e., positive selling price indicating profit), use
# # USGS 2015-2019 average free on bard price in $/metric ton for crude gypsum.
# # National Minerals Information Center. Mineral Commodity Summaries 2020;
# # U.S. Geological Survey, 2020.
# # Assuming all prices were in their nominal year (e.g., 2015 price in 2015$)
# # and adjusted to 2016$
# # 2015: 7.80 * 1.114 / 1.100 = 7.90
# # 2016: 8.00
# # 2017: 7.50 * 1.114 / 1.134 = 7.37
# # 2018: 8.30 * 1.114 / 1.157 = 7.99
# # 2019: 8.00 * 1.114 / 1.185 = 7.52
# # (7.90+8.00+7.37+7.99+7.52) / 5 = 7.76 (in metric tonne)
# # For the lower bound (i.e., negative selling price indicating cost), use price from
# # ref [4]: $0.0094/lb in 2000$ = 0.0094*1.114/0.802*2.20462 = $0.0288/kg in 2016$
# gypsum_price = 0
# # Baseline from ref [3], lower bound is 2015-2019 average of
# # hydrate lime in $/ton at plant from Mineral Commodity Summaries 2020.
# # 2015: 146.40 * (1.114/1.100) / 907.18474 = 0.163
# # 2016: 145.50 / 907.18474 = 0.160
# # 2017: 147.10 * (1.114/1.134) / 907.18474 = 0.159
# # 2018: 151.50 * (1.114/1.157) / 907.18474 = 0.161
# # 2019: 151.00 * (1.114/1.185) / 907.18474 = 0.156
# # (0.163+0.160+0.159+0.161+0.156) / 5 = 0.160
# # Upper bound is +10% from baseline = 0.1189 * _lb_per_kg * 1.1 = 0.288
# lime_price = 0.1189 * _lb_per_kg
# baghouse_bag_price = 466833 / 5 / (24*365*0.96)
# # 4.70 is the average natural gas price in 2016$/Mcf based on AEO from EIA,
# # which is $0.231/kg at 273.15 K or $0.253/kg at 298.15 K using BioSTEAM,
# # similar to the 4.7/1000/22*1000 = $0.214/kg at 273.15 K using 22 g/ft3 from H2 Tools
# # Using the same conversion, lower and upper bounds (min/max of 2010-2019) should be
# # $3.68/Mcf and $5.65/Mcf, or $0.198/kg and $0.304/kg
# _CH4_V = chems.CH4.V(298.15, 101325) # molar volume in m3/mol
# _CH4_MW = chems.CH4.MW
# natural_gas_price = 4.70/1e3*_ft3_per_m3*_CH4_V * (1e3/_CH4_MW)
# # https://www.rightpricechemicals.com/buy-amberlyst-15-ion-exchange-resin.html
# # USD 383.13 for 2.5kg (largest available size order), accessed 06/11/2020
# amberlyst_15_price = 153.252 * _chemical_2020to2016
# # All in 2016$/kg
# price = {'Feedstock': feedstock_price,
# 'Sulfuric acid': 0.0430 * _lb_per_kg,
# # 0.1900 is for NH3
# 'NH4OH': 0.1900 * _lb_per_kg * 17.031/35.046,
# 'CSL': 0.0339 * _lb_per_kg,
# 'Enzyme': 6.16,
# 'Lime': lime_price,
# 'Amberlyst15': amberlyst_15_price,
# 'NaOH': 0.2384 * _lb_per_kg,
# 'WWT polymer': 2.6282 * _lb_per_kg,
# 'Boiler chems': 2.9772 * _lb_per_kg,
# 'Cooling tower chems': 1.7842 * _lb_per_kg,
# 'Makeup water': 0.0002 * _lb_per_kg,
# # Cost of ash is negative because it's a product stream
# 'Ash disposal': ash_disposal_price,
# 'Gypsum': gypsum_price,
# 'Electricity': 0.070, # AEO from EIA, 2010-2019 average (0.067-0.074 range)
# 'Ethanol': ethanol_price,
# 'Baghouse bag': baghouse_bag_price,
# 'Natural gas': natural_gas_price}
# bst.PowerUtility.price = price['Electricity']
# _lps = bst.HeatUtility.get_heating_agent('low_pressure_steam')
# _mps = bst.HeatUtility.get_heating_agent('medium_pressure_steam')
# _hps = bst.HeatUtility.get_heating_agent('high_pressure_steam')
# _mps.T = 233 + 273.15
# _hps.T = 266 + 273.15
# _cooling = bst.HeatUtility.get_cooling_agent('cooling_water')
# _cooling.regeneration_price = 0
# _cooling.T = 28 + 273.15
# _cooling.T_limit = _cooling.T + 9
# # Side steam in CHP not a heat utility, thus will cause problem in TEA utility
# # cost calculation if price not set to 0 here, costs for regeneration of heating
# # and cooling utilities will be considered as CAPEX and OPEX of CHP and CT, respectively
# for i in (_lps, _mps, _hps, _cooling):
# i.heat_transfer_price = i.regeneration_price = 0
# # if i == _cooling: continue
# # i.heat_transfer_efficiency = 0.85
|
var WidgetWrapper = require('./widget');
var TextBMFontWrapper = cc.Class({
name: 'cc.TextBMFontWrapper',
extends: WidgetWrapper,
properties: {
text: {
get: function () {
return this.targetN.string;
},
set: function (value) {
if (typeof value === 'string') {
this.targetN.string = value;
}
else {
cc.error('The new text must be String');
}
}
},
bitmapFont_: {
get: function () {
return this.targetN._file || '';
},
set: function (value) {
cc.loader.load(value, function () {
this.targetN.setFntFile(value);
}.bind(this) );
},
url: cc.BitmapFont
},
_text: {
default: 'TextBMFont'
},
bitmapFont: {
default: '',
url: cc.BitmapFont,
visible: false
}
},
onBeforeSerialize: function () {
WidgetWrapper.prototype.onBeforeSerialize.call(this);
this._text = this.text;
this.bitmapFont = this.bitmapFont_;
},
createNode: function (node) {
node = node || new ccui.TextBMFont();
node.string = this._text;
node.setFntFile(this.bitmapFont);
WidgetWrapper.prototype.createNode.call(this, node);
return node;
}
});
var originSetFntFile = ccui.TextBMFont.prototype.setFntFile;
ccui.TextBMFont.prototype.setFntFile = function (value) {
this._file = value;
originSetFntFile.call(this, value);
};
cc.TextBMFontWrapper = module.exports = TextBMFontWrapper;
|
from celery import shared_task
from django.conf import settings
from rgd.tasks import helpers
@shared_task(time_limit=settings.CELERY_TASK_TIME_LIMIT)
def task_load_image(file_pk):
from rgd_imagery.models import Image
from rgd_imagery.tasks.etl import load_image
image_file = Image.objects.get(pk=file_pk)
helpers._run_with_failure_reason(image_file, load_image, file_pk)
@shared_task(time_limit=settings.CELERY_TASK_TIME_LIMIT)
def task_populate_raster(raster_pk):
from rgd_imagery.models import Raster
from rgd_imagery.tasks.etl import populate_raster
raster = Raster.objects.get(pk=raster_pk)
helpers._run_with_failure_reason(raster, populate_raster, raster_pk)
@shared_task(time_limit=settings.CELERY_TASK_TIME_LIMIT)
def task_populate_raster_footprint(raster_pk):
from rgd_imagery.models import Raster
from rgd_imagery.tasks.etl import populate_raster_footprint
raster = Raster.objects.get(pk=raster_pk)
helpers._run_with_failure_reason(raster, populate_raster_footprint, raster_pk)
@shared_task(time_limit=settings.CELERY_TASK_TIME_LIMIT)
def task_populate_raster_outline(raster_pk):
from rgd_imagery.models import Raster
from rgd_imagery.tasks.etl import populate_raster_outline
raster = Raster.objects.get(pk=raster_pk)
helpers._run_with_failure_reason(raster, populate_raster_outline, raster_pk)
@shared_task(time_limit=settings.CELERY_TASK_TIME_LIMIT)
def task_run_processed_image(processed_pk):
from rgd_imagery.models import ProcessedImage
from rgd_imagery.tasks.subsample import run_processed_image
obj = ProcessedImage.objects.get(pk=processed_pk)
helpers._run_with_failure_reason(obj, run_processed_image, processed_pk)
|
import os
import cv2
import numpy as np
#use um vídeo que mostre somente a pessoa que você deseja extrair o rosto
#amostras de diferentes vídeos podem ser salvas na mesma pasta
#o nome das novas amostras seguem a ordem crescente das amostras já salvas
if __name__ == "__main__":
video = "andy.mp4"
diretorio = "./Andy"
frontal_face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
cap = cv2.VideoCapture(video)
cont_frames = 0
total_amostras = 50
try:
os.mkdir(diretorio)
except OSError:
local = os.listdir(diretorio)
local_arquivos = []
for arq in local:
if arq[-3::] == "png":
local_arquivos.append(arq)
total_amostras += len(local_arquivos)
cont_frames += len(local_arquivos)
while cont_frames < total_amostras:
ret, img = cap.read()
if ret == False:
cap.release()
else:
img_cinza = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = frontal_face_cascade.detectMultiScale(img_cinza, 1.3, 5)
if len(faces) == 0:
continue
for (x, y, w, h) in faces:
coord_face = img_cinza[y:y+h, x:x+w] #ou coord_face = img[y:y+h, x:x+w]
larg, alt = coord_face.shape
if(larg * alt <= 20 * 20): #imagens muito pequenas são desconsideradas
continue
recortar_face = cv2.resize(coord_face, (255, 255))
cv2.imwrite(diretorio + "\\" + str(cont_frames)+ ".png", coord_face)
cont_frames += 1
cap.release()
print(" [*] Concluído!")
|
import { OPEN_HAMBURGER_MENU, OPEN_SEARCHBAR } from "./actions";
function hamburgerMenuReducer(state = false, action) {
switch (action.type) {
case OPEN_HAMBURGER_MENU:
return action.isHamburgerMenuOpen;
default:
return state;
}
}
function searchBarReducer(state = false, action) {
switch (action.type) {
case OPEN_SEARCHBAR:
return action.isSearchBarOpen;
default:
return state;
}
}
export const REDUCERS = {
isHamburgerMenuOpen: hamburgerMenuReducer,
isSearchBarOpen: searchBarReducer
};
|
module.exports = 'deeper' |
from string import ascii_letters, digits
import RandomUsers as ru
username = ru.Username()
password = ru.Password(allow=ascii_letters + digits)
user_model = ru.BasicModel(username=username, password=password)
users = user_model.ordered_generate(ordered_fields={"username": "num_"}, csv_file="test.csv")
|
'use strict';
angular.module('myApp.jokes', [])
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('jokes', {
url: '/jokes',
data: {
permissions: {
except: ['anonymous'],
redirectTo: 'auth'
}
},
views: {
'jokesContent': {
templateUrl: "view_jokes/jokes.html",
controller: 'JokesCtrl as jokes'
}
}
})
}])
.controller('JokesCtrl', ['$http', '$auth', '$rootScope','$state', '$q' , function($http, $auth, $rootScope, $state, $q) {
var vm = this;
vm.jokes = [];
vm.error;
vm.joke;
$http.get('http://localhost:8000/api/v1/jokes').success(function(jokes){
console.log(jokes);
vm.jokes = jokes.data;
}).error(function(error){
vm.error = error;
})
vm.lastpage=1;
vm.init = function() {
vm.lastpage=1;
$http({
url: 'http://localhost:8000/api/v1/jokes',
method: "GET",
params: {page: vm.lastpage}
}).success(function(jokes, status, headers, config) {
vm.jokes = jokes.data;
vm.currentpage = jokes.current_page;
});
};
vm.init();
vm.loadMore = function() {
vm.lastpage +=1;
$http({
url: 'http://localhost:8000/api/v1/jokes',
method: "GET",
params: {page: vm.lastpage}
}).success(function (jokes, status, headers, config) {
vm.jokes = vm.jokes.concat(jokes.data);
});
};
vm.addJoke = function() {
$http.post('http://localhost:8000/api/v1/jokes', {
body: vm.joke,
user_id: $rootScope.currentUser.id
}).success(function(response) {
// console.log(vm.jokes);
// vm.jokes.push(response.data);
vm.jokes.unshift(response.data);
console.log(vm.jokes);
vm.joke = '';
// alert(data.message);
// alert("Joke Created Successfully");
}).error(function(){
console.log("error");
});
};
vm.updateJoke = function(joke){
console.log(joke);
$http.put('http://localhost:8000/api/v1/jokes/' + joke.joke_id, {
body: joke.joke,
user_id: $rootScope.currentUser.id
}).success(function(response) {
// alert("Joke Updated Successfully");
}).error(function(){
console.log("error");
});
}
vm.deleteJoke = function(index, jokeId){
console.log(index, jokeId);
$http.delete('http://localhost:8000/api/v1/jokes/' + jokeId)
.success(function() {
vm.jokes.splice(index, 1);
});;
}
}]); |
/*!
* DevExtreme (dx.messages.es.js)
* Version: 20.1.6
* Build date: Fri Jul 17 2020
*
* Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict";
! function(root, factory) {
if ("function" === typeof define && define.amd) {
define(function(require) {
factory(require("devextreme/localization"))
})
} else {
if ("object" === typeof module && module.exports) {
factory(require("devextreme/localization"))
} else {
factory(DevExpress.localization)
}
}
}(this, function(localization) {
localization.loadMessages({
es: {
Yes: "S\xed",
No: "No",
Cancel: "Cancelar",
Clear: "Limpiar",
Done: "Hecho",
Loading: "Cargando...",
Select: "Seleccionar...",
Search: "Buscar",
Back: "Volver",
OK: "Aceptar",
"dxCollectionWidget-noDataText": "Sin datos para mostrar",
"dxDropDownEditor-selectLabel": "Seleccionar",
"validation-required": "Obligatorio",
"validation-required-formatted": "{0} es obligatorio",
"validation-numeric": "Valor debe ser un n\xfamero",
"validation-numeric-formatted": "{0} debe ser un n\xfamero",
"validation-range": "Valor fuera de rango",
"validation-range-formatted": "{0} fuera de rango",
"validation-stringLength": "El tama\xf1o del valor es incorrecto",
"validation-stringLength-formatted": "El tama\xf1o de {0} es incorrecto",
"validation-custom": "Valor inv\xe1lido",
"validation-custom-formatted": "{0} inv\xe1lido",
"validation-async": "Valor inv\xe1lido",
"validation-async-formatted": "{0} inv\xe1lido",
"validation-compare": "Valores no coinciden",
"validation-compare-formatted": "{0} no coinciden",
"validation-pattern": "Valor no coincide con el patr\xf3n",
"validation-pattern-formatted": "{0} no coincide con el patr\xf3n",
"validation-email": "Email inv\xe1lido",
"validation-email-formatted": "{0} inv\xe1lido",
"validation-mask": "Valor inv\xe1lido",
"dxLookup-searchPlaceholder": "Cantidad m\xednima de caracteres: {0}",
"dxList-pullingDownText": "Desliza hacia abajo para actualizar...",
"dxList-pulledDownText": "Suelta para actualizar...",
"dxList-refreshingText": "Actualizando...",
"dxList-pageLoadingText": "Cargando...",
"dxList-nextButtonText": "M\xe1s",
"dxList-selectAll": "Seleccionar Todo",
"dxListEditDecorator-delete": "Eliminar",
"dxListEditDecorator-more": "M\xe1s",
"dxScrollView-pullingDownText": "Desliza hacia abajo para actualizar...",
"dxScrollView-pulledDownText": "Suelta para actualizar...",
"dxScrollView-refreshingText": "Actualizando...",
"dxScrollView-reachBottomText": "Cargando...",
"dxDateBox-simulatedDataPickerTitleTime": "Seleccione hora",
"dxDateBox-simulatedDataPickerTitleDate": "Seleccione fecha",
"dxDateBox-simulatedDataPickerTitleDateTime": "Seleccione fecha y hora",
"dxDateBox-validation-datetime": "Valor debe ser una fecha u hora",
"dxFileUploader-selectFile": "Seleccionar archivo",
"dxFileUploader-dropFile": "o arrastre un archivo aqu\xed",
"dxFileUploader-bytes": "bytes",
"dxFileUploader-kb": "kb",
"dxFileUploader-Mb": "Mb",
"dxFileUploader-Gb": "Gb",
"dxFileUploader-upload": "Subir",
"dxFileUploader-uploaded": "Subido",
"dxFileUploader-readyToUpload": "Listo para subir",
"dxFileUploader-uploadFailedMessage": "Falla ao subir",
"dxFileUploader-invalidFileExtension": "Tipo de archivo no est\xe1 permitido",
"dxFileUploader-invalidMaxFileSize": "Archivo es muy grande",
"dxFileUploader-invalidMinFileSize": "Archivo es muy peque\xf1o",
"dxRangeSlider-ariaFrom": "Desde",
"dxRangeSlider-ariaTill": "Hasta",
"dxSwitch-switchedOnText": "ENCENDIDO",
"dxSwitch-switchedOffText": "APAGADO",
"dxForm-optionalMark": "opcional",
"dxForm-requiredMessage": "{0} es obligatorio",
"dxNumberBox-invalidValueMessage": "Valor debe ser un n\xfamero",
"dxNumberBox-noDataText": "Sin datos",
"dxDataGrid-columnChooserTitle": "Selector de Columnas",
"dxDataGrid-columnChooserEmptyText": "Arrastra una columna aqu\xed para ocultarla",
"dxDataGrid-groupContinuesMessage": "Contin\xfaa en la p\xe1gina siguiente",
"dxDataGrid-groupContinuedMessage": "Continuaci\xf3n de la p\xe1gina anterior",
"dxDataGrid-groupHeaderText": "Agrupar por esta columna",
"dxDataGrid-ungroupHeaderText": "Desagrupar",
"dxDataGrid-ungroupAllText": "Desagrupar Todo",
"dxDataGrid-editingEditRow": "Modificar",
"dxDataGrid-editingSaveRowChanges": "Guardar",
"dxDataGrid-editingCancelRowChanges": "Cancelar",
"dxDataGrid-editingDeleteRow": "Eliminar",
"dxDataGrid-editingUndeleteRow": "Recuperar",
"dxDataGrid-editingConfirmDeleteMessage": "\xbfEst\xe1 seguro que desea eliminar este registro?",
"dxDataGrid-validationCancelChanges": "Cancelar cambios",
"dxDataGrid-groupPanelEmptyText": "Arrastra una columna aqu\xed para agrupar por ella",
"dxDataGrid-noDataText": "Sin datos",
"dxDataGrid-searchPanelPlaceholder": "Buscar...",
"dxDataGrid-filterRowShowAllText": "(Todos)",
"dxDataGrid-filterRowResetOperationText": "Reestablecer",
"dxDataGrid-filterRowOperationEquals": "Igual",
"dxDataGrid-filterRowOperationNotEquals": "No es igual",
"dxDataGrid-filterRowOperationLess": "Menor que",
"dxDataGrid-filterRowOperationLessOrEquals": "Menor o igual a",
"dxDataGrid-filterRowOperationGreater": "Mayor que",
"dxDataGrid-filterRowOperationGreaterOrEquals": "Mayor o igual a",
"dxDataGrid-filterRowOperationStartsWith": "Empieza con",
"dxDataGrid-filterRowOperationContains": "Contiene",
"dxDataGrid-filterRowOperationNotContains": "No contiene",
"dxDataGrid-filterRowOperationEndsWith": "Termina con",
"dxDataGrid-filterRowOperationBetween": "Entre",
"dxDataGrid-filterRowOperationBetweenStartText": "Inicio",
"dxDataGrid-filterRowOperationBetweenEndText": "Fin",
"dxDataGrid-applyFilterText": "Filtrar",
"dxDataGrid-trueText": "verdadero",
"dxDataGrid-falseText": "falso",
"dxDataGrid-sortingAscendingText": "Orden Ascendente",
"dxDataGrid-sortingDescendingText": "Orden Descendente",
"dxDataGrid-sortingClearText": "Limpiar Ordenamiento",
"dxDataGrid-editingSaveAllChanges": "Guardar cambios",
"dxDataGrid-editingCancelAllChanges": "Descartar cambios",
"dxDataGrid-editingAddRow": "Agregar una fila",
"dxDataGrid-summaryMin": "M\xedn: {0}",
"dxDataGrid-summaryMinOtherColumn": "M\xedn de {1} es {0}",
"dxDataGrid-summaryMax": "M\xe1x: {0}",
"dxDataGrid-summaryMaxOtherColumn": "M\xe1x de {1} es {0}",
"dxDataGrid-summaryAvg": "Prom: {0}",
"dxDataGrid-summaryAvgOtherColumn": "Prom de {1} es {0}",
"dxDataGrid-summarySum": "Suma: {0}",
"dxDataGrid-summarySumOtherColumn": "Suma de {1} es {0}",
"dxDataGrid-summaryCount": "Cantidad: {0}",
"dxDataGrid-columnFixingFix": "Anclar",
"dxDataGrid-columnFixingUnfix": "Desanclar",
"dxDataGrid-columnFixingLeftPosition": "A la izquierda",
"dxDataGrid-columnFixingRightPosition": "A la derecha",
"dxDataGrid-exportTo": "Exportar",
"dxDataGrid-exportToExcel": "Exportar a archivo Excel",
"dxDataGrid-exporting": "Exportar...",
"dxDataGrid-excelFormat": "Archivo Excel",
"dxDataGrid-selectedRows": "Filas seleccionadas",
"dxDataGrid-exportSelectedRows": "Exportar filas seleccionadas",
"dxDataGrid-exportAll": "Exportar todo",
"dxDataGrid-headerFilterEmptyValue": "(Vacio)",
"dxDataGrid-headerFilterOK": "Aceptar",
"dxDataGrid-headerFilterCancel": "Cancelar",
"dxDataGrid-ariaColumn": "Columna",
"dxDataGrid-ariaValue": "Valor",
"dxDataGrid-ariaFilterCell": "Celda de filtro",
"dxDataGrid-ariaCollapse": "Colapsar",
"dxDataGrid-ariaExpand": "Expandir",
"dxDataGrid-ariaDataGrid": "Tabla de datos",
"dxDataGrid-ariaSearchInGrid": "Buscar en la tabla de datos",
"dxDataGrid-ariaSelectAll": "Seleccionar todo",
"dxDataGrid-ariaSelectRow": "Seleccionar fila",
"dxDataGrid-filterBuilderPopupTitle": "Constructor de filtro",
"dxDataGrid-filterPanelCreateFilter": "Crear filtro",
"dxDataGrid-filterPanelClearFilter": "Limpiar filtro",
"dxDataGrid-filterPanelFilterEnabledHint": "Habilitar filtro",
"dxTreeList-ariaTreeList": "Lista de \xe1rbol",
"dxTreeList-editingAddRowToNode": "A\xf1adir",
"dxPager-infoText": "P\xe1gina {0} de {1} ({2} \xedtems)",
"dxPager-pagesCountText": "de",
"dxPivotGrid-grandTotal": "Gran Total",
"dxPivotGrid-total": "{0} Total",
"dxPivotGrid-fieldChooserTitle": "Selector de Campos",
"dxPivotGrid-showFieldChooser": "Mostrar Selector de Campos",
"dxPivotGrid-expandAll": "Expandir Todo",
"dxPivotGrid-collapseAll": "Colapsar Todo",
"dxPivotGrid-sortColumnBySummary": 'Ordenar "{0}" por esta columna',
"dxPivotGrid-sortRowBySummary": 'Ordenar "{0}" por esta fila',
"dxPivotGrid-removeAllSorting": "Remover ordenamiento",
"dxPivotGrid-dataNotAvailable": "N/A",
"dxPivotGrid-rowFields": "Campos de fila",
"dxPivotGrid-columnFields": "Campos de columna",
"dxPivotGrid-dataFields": "Campos de dato",
"dxPivotGrid-filterFields": "Campos de filtro",
"dxPivotGrid-allFields": "Todos los campos",
"dxPivotGrid-columnFieldArea": "Arrastra campos de columna aqu\xed",
"dxPivotGrid-dataFieldArea": "Arrastra campos de dato aqu\xed",
"dxPivotGrid-rowFieldArea": "Arrastra campos de fila aqu\xed",
"dxPivotGrid-filterFieldArea": "Arrastra campos de filtro aqu\xed",
"dxScheduler-editorLabelTitle": "Asunto",
"dxScheduler-editorLabelStartDate": "Fecha inicial",
"dxScheduler-editorLabelEndDate": "Fecha final",
"dxScheduler-editorLabelDescription": "Descripci\xf3n",
"dxScheduler-editorLabelRecurrence": "Repetir",
"dxScheduler-openAppointment": "Abrir cita",
"dxScheduler-recurrenceNever": "Nunca",
"dxScheduler-recurrenceMinutely": "Minutely",
"dxScheduler-recurrenceHourly": "Hourly",
"dxScheduler-recurrenceDaily": "Diario",
"dxScheduler-recurrenceWeekly": "Semanal",
"dxScheduler-recurrenceMonthly": "Mensual",
"dxScheduler-recurrenceYearly": "Anual",
"dxScheduler-recurrenceRepeatEvery": "Cada",
"dxScheduler-recurrenceRepeatOn": "Repeat On",
"dxScheduler-recurrenceEnd": "Terminar repetici\xf3n",
"dxScheduler-recurrenceAfter": "Despu\xe9s",
"dxScheduler-recurrenceOn": "En",
"dxScheduler-recurrenceRepeatMinutely": "minute(s)",
"dxScheduler-recurrenceRepeatHourly": "hour(s)",
"dxScheduler-recurrenceRepeatDaily": "d\xeda(s)",
"dxScheduler-recurrenceRepeatWeekly": "semana(s)",
"dxScheduler-recurrenceRepeatMonthly": "mes(es)",
"dxScheduler-recurrenceRepeatYearly": "a\xf1o(s)",
"dxScheduler-switcherDay": "D\xeda",
"dxScheduler-switcherWeek": "Semana",
"dxScheduler-switcherWorkWeek": "Semana Laboral",
"dxScheduler-switcherMonth": "Mes",
"dxScheduler-switcherAgenda": "Agenda",
"dxScheduler-switcherTimelineDay": "L\xednea de tiempo D\xeda",
"dxScheduler-switcherTimelineWeek": "L\xednea de tiempo Semana",
"dxScheduler-switcherTimelineWorkWeek": "L\xednea de tiempo Semana Laboral",
"dxScheduler-switcherTimelineMonth": "L\xednea de tiempo Mes",
"dxScheduler-recurrenceRepeatOnDate": "en la fecha",
"dxScheduler-recurrenceRepeatCount": "ocurrencia(s)",
"dxScheduler-allDay": "Todo el d\xeda",
"dxScheduler-confirmRecurrenceEditMessage": "\xbfQuiere modificar solo esta cita o toda la serie?",
"dxScheduler-confirmRecurrenceDeleteMessage": "\xbfQuiere eliminar solo esta cita o toda la serie?",
"dxScheduler-confirmRecurrenceEditSeries": "Modificar serie",
"dxScheduler-confirmRecurrenceDeleteSeries": "Eliminar serie",
"dxScheduler-confirmRecurrenceEditOccurrence": "Modificar cita",
"dxScheduler-confirmRecurrenceDeleteOccurrence": "Eliminar cita",
"dxScheduler-noTimezoneTitle": "Sin zona horaria",
"dxScheduler-moreAppointments": "{0} m\xe1s",
"dxCalendar-todayButtonText": "Hoy",
"dxCalendar-ariaWidgetName": "Calendario",
"dxColorView-ariaRed": "Rojo",
"dxColorView-ariaGreen": "Verde",
"dxColorView-ariaBlue": "Azul",
"dxColorView-ariaAlpha": "Transparencia",
"dxColorView-ariaHex": "C\xf3digo del color",
"dxTagBox-selected": "{0} seleccionado",
"dxTagBox-allSelected": "Todos seleccionados ({0})",
"dxTagBox-moreSelected": "{0} m\xe1s",
"vizExport-printingButtonText": "Imprimir",
"vizExport-titleMenuText": "Exportar/Imprimir",
"vizExport-exportButtonText": "Archivo {0}",
"dxFilterBuilder-and": "Y",
"dxFilterBuilder-or": "O",
"dxFilterBuilder-notAnd": "NO Y",
"dxFilterBuilder-notOr": "NO O",
"dxFilterBuilder-addCondition": "A\xf1adir condici\xf3n",
"dxFilterBuilder-addGroup": "A\xf1adir Grupo",
"dxFilterBuilder-enterValueText": "<rellene con un valor>",
"dxFilterBuilder-filterOperationEquals": "Igual",
"dxFilterBuilder-filterOperationNotEquals": "Diferente",
"dxFilterBuilder-filterOperationLess": "Menos que",
"dxFilterBuilder-filterOperationLessOrEquals": "Menor o igual que",
"dxFilterBuilder-filterOperationGreater": "M\xe1s grande que",
"dxFilterBuilder-filterOperationGreaterOrEquals": "Mayor o igual que",
"dxFilterBuilder-filterOperationStartsWith": "Comienza con",
"dxFilterBuilder-filterOperationContains": "Contiene",
"dxFilterBuilder-filterOperationNotContains": "No contiene",
"dxFilterBuilder-filterOperationEndsWith": "Termina con",
"dxFilterBuilder-filterOperationIsBlank": "Vac\xedo",
"dxFilterBuilder-filterOperationIsNotBlank": "No vac\xedo",
"dxFilterBuilder-filterOperationBetween": "Entre",
"dxFilterBuilder-filterOperationAnyOf": "Alguno de",
"dxFilterBuilder-filterOperationNoneOf": "Ning\xfan de",
"dxHtmlEditor-dialogColorCaption": "Cambiar el color de la fuente",
"dxHtmlEditor-dialogBackgroundCaption": "Cambiar el color de fondo",
"dxHtmlEditor-dialogLinkCaption": "A\xf1adir enlace",
"dxHtmlEditor-dialogLinkUrlField": "URL",
"dxHtmlEditor-dialogLinkTextField": "Texto",
"dxHtmlEditor-dialogLinkTargetField": "Abrir enlace en nueva ventana",
"dxHtmlEditor-dialogImageCaption": "A\xf1adir imagen",
"dxHtmlEditor-dialogImageUrlField": "URL",
"dxHtmlEditor-dialogImageAltField": "Texto alternativo",
"dxHtmlEditor-dialogImageWidthField": "Anchura (px)",
"dxHtmlEditor-dialogImageHeightField": "Altura (px)",
"dxHtmlEditor-heading": "Encabezamiento",
"dxHtmlEditor-normalText": "Texto normal",
"dxFileManager-newDirectoryName": "Sin t\xedtulo",
"dxFileManager-rootDirectoryName": "Archivos",
"dxFileManager-errorNoAccess": "Acceso denegado. La operaci\xf3n no se puede completar.",
"dxFileManager-errorDirectoryExistsFormat": "Carpeta {0} ya existe.",
"dxFileManager-errorFileExistsFormat": "Archivo {0} ya existe.",
"dxFileManager-errorFileNotFoundFormat": "Archivo {0} no encontrado.",
"dxFileManager-errorDirectoryNotFoundFormat": "TODO",
"dxFileManager-errorWrongFileExtension": "TODO",
"dxFileManager-errorMaxFileSizeExceeded": "TODO",
"dxFileManager-errorInvalidSymbols": "TODO",
"dxFileManager-errorDefault": "Error no especificado",
"dxFileManager-errorDirectoryOpenFailed": "TODO",
"dxFileManager-commandCreate": "TODO",
"dxFileManager-commandRename": "TODO",
"dxFileManager-commandMove": "TODO",
"dxFileManager-commandCopy": "TODO",
"dxFileManager-commandDelete": "TODO",
"dxFileManager-commandDownload": "TODO",
"dxFileManager-commandUpload": "TODO",
"dxFileManager-commandRefresh": "TODO",
"dxFileManager-commandThumbnails": "TODO",
"dxFileManager-commandDetails": "TODO",
"dxFileManager-commandClearSelection": "TODO",
"dxFileManager-commandShowNavPane": "TODO",
"dxFileManager-dialogDirectoryChooserTitle": "TODO",
"dxFileManager-dialogDirectoryChooserButtonText": "TODO",
"dxFileManager-dialogRenameItemTitle": "TODO",
"dxFileManager-dialogRenameItemButtonText": "TODO",
"dxFileManager-dialogCreateDirectoryTitle": "TODO",
"dxFileManager-dialogCreateDirectoryButtonText": "TODO",
"dxFileManager-dialogDeleteItemTitle": "TODO",
"dxFileManager-dialogDeleteItemButtonText": "TODO",
"dxFileManager-dialogDeleteItemSingleItemConfirmation": "TODO",
"dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "TODO",
"dxFileManager-editingCreateSingleItemProcessingMessage": "TODO",
"dxFileManager-editingCreateSingleItemSuccessMessage": "TODO",
"dxFileManager-editingCreateSingleItemErrorMessage": "TODO",
"dxFileManager-editingCreateCommonErrorMessage": "TODO",
"dxFileManager-editingRenameSingleItemProcessingMessage": "TODO",
"dxFileManager-editingRenameSingleItemSuccessMessage": "TODO",
"dxFileManager-editingRenameSingleItemErrorMessage": "TODO",
"dxFileManager-editingRenameCommonErrorMessage": "TODO",
"dxFileManager-editingDeleteSingleItemProcessingMessage": "TODO",
"dxFileManager-editingDeleteMultipleItemsProcessingMessage": "TODO",
"dxFileManager-editingDeleteSingleItemSuccessMessage": "TODO",
"dxFileManager-editingDeleteMultipleItemsSuccessMessage": "TODO",
"dxFileManager-editingDeleteSingleItemErrorMessage": "TODO",
"dxFileManager-editingDeleteMultipleItemsErrorMessage": "TODO",
"dxFileManager-editingDeleteCommonErrorMessage": "TODO",
"dxFileManager-editingMoveSingleItemProcessingMessage": "TODO",
"dxFileManager-editingMoveMultipleItemsProcessingMessage": "TODO",
"dxFileManager-editingMoveSingleItemSuccessMessage": "TODO",
"dxFileManager-editingMoveMultipleItemsSuccessMessage": "TODO",
"dxFileManager-editingMoveSingleItemErrorMessage": "TODO",
"dxFileManager-editingMoveMultipleItemsErrorMessage": "TODO",
"dxFileManager-editingMoveCommonErrorMessage": "TODO",
"dxFileManager-editingCopySingleItemProcessingMessage": "TODO",
"dxFileManager-editingCopyMultipleItemsProcessingMessage": "TODO",
"dxFileManager-editingCopySingleItemSuccessMessage": "TODO",
"dxFileManager-editingCopyMultipleItemsSuccessMessage": "TODO",
"dxFileManager-editingCopySingleItemErrorMessage": "TODO",
"dxFileManager-editingCopyMultipleItemsErrorMessage": "TODO",
"dxFileManager-editingCopyCommonErrorMessage": "TODO",
"dxFileManager-editingUploadSingleItemProcessingMessage": "TODO",
"dxFileManager-editingUploadMultipleItemsProcessingMessage": "TODO",
"dxFileManager-editingUploadSingleItemSuccessMessage": "TODO",
"dxFileManager-editingUploadMultipleItemsSuccessMessage": "TODO",
"dxFileManager-editingUploadSingleItemErrorMessage": "TODO",
"dxFileManager-editingUploadMultipleItemsErrorMessage": "TODO",
"dxFileManager-editingUploadCanceledMessage": "TODO",
"dxFileManager-listDetailsColumnCaptionName": "TODO",
"dxFileManager-listDetailsColumnCaptionDateModified": "TODO",
"dxFileManager-listDetailsColumnCaptionFileSize": "TODO",
"dxFileManager-listThumbnailsTooltipTextSize": "TODO",
"dxFileManager-listThumbnailsTooltipTextDateModified": "TODO",
"dxFileManager-notificationProgressPanelTitle": "TODO",
"dxFileManager-notificationProgressPanelEmptyListText": "TODO",
"dxFileManager-notificationProgressPanelOperationCanceled": "TODO",
"dxDiagram-categoryGeneral": "General",
"dxDiagram-categoryFlowchart": "Diagrama de flujo",
"dxDiagram-categoryOrgChart": "Organigrama",
"dxDiagram-categoryContainers": "Contenedores",
"dxDiagram-categoryCustom": "Personalizado",
"dxDiagram-commandExportToSvg": "Exportar a SVG",
"dxDiagram-commandExportToPng": "Exportar a PNG",
"dxDiagram-commandExportToJpg": "Exportar a JPG",
"dxDiagram-commandUndo": "Deshacer",
"dxDiagram-commandRedo": "Rehacer",
"dxDiagram-commandFontName": "Nombre de fuente",
"dxDiagram-commandFontSize": "Tama\xf1o de fuente",
"dxDiagram-commandBold": "Negrita",
"dxDiagram-commandItalic": "Cursiva",
"dxDiagram-commandUnderline": "Subrayado",
"dxDiagram-commandTextColor": "Color de fuente",
"dxDiagram-commandLineColor": "Color de l\xednea",
"dxDiagram-commandLineWidth": "Ancho de l\xednea",
"dxDiagram-commandLineStyle": "Estilo de l\xednea",
"dxDiagram-commandLineStyleSolid": "S\xf3lido",
"dxDiagram-commandLineStyleDotted": "De puntos",
"dxDiagram-commandLineStyleDashed": "De guiones",
"dxDiagram-commandFillColor": "Color de relleno",
"dxDiagram-commandAlignLeft": "Alinear a la izquierda",
"dxDiagram-commandAlignCenter": "Alinear al centro",
"dxDiagram-commandAlignRight": "Alinear a la derecha",
"dxDiagram-commandConnectorLineType": "Tipo de l\xednea de conector",
"dxDiagram-commandConnectorLineStraight": "Recto",
"dxDiagram-commandConnectorLineOrthogonal": "Ortogonal",
"dxDiagram-commandConnectorLineStart": "Conector de inicio de l\xednea",
"dxDiagram-commandConnectorLineEnd": "Conector de final de l\xednea",
"dxDiagram-commandConnectorLineNone": "Ninguno",
"dxDiagram-commandConnectorLineArrow": "Flecha",
"dxDiagram-commandFullscreen": "Pantalla completa",
"dxDiagram-commandUnits": "Unidades",
"dxDiagram-commandPageSize": "Tama\xf1o de p\xe1gina",
"dxDiagram-commandPageOrientation": "Orientaci\xf3n de p\xe1gina",
"dxDiagram-commandPageOrientationLandscape": "Horizontal",
"dxDiagram-commandPageOrientationPortrait": "Vertical",
"dxDiagram-commandPageColor": "Color de p\xe1gina",
"dxDiagram-commandShowGrid": "Mostrar cuadr\xedcula",
"dxDiagram-commandSnapToGrid": "Ajustar a la cuadr\xedcula",
"dxDiagram-commandGridSize": "Tama\xf1o de cuadr\xedcula",
"dxDiagram-commandZoomLevel": "Nivel de zoom",
"dxDiagram-commandAutoZoom": "Zoom autom\xe1tico",
"dxDiagram-commandFitToContent": "Ajustar al contenido",
"dxDiagram-commandFitToWidth": "Ajustar al ancho",
"dxDiagram-commandAutoZoomByContent": "Zoom autom\xe1tico por contenido",
"dxDiagram-commandAutoZoomByWidth": "Zoom autom\xe1tico por ancho",
"dxDiagram-commandSimpleView": "Vista Simple",
"dxDiagram-commandCut": "Cortar",
"dxDiagram-commandCopy": "Copiar",
"dxDiagram-commandPaste": "Pegar",
"dxDiagram-commandSelectAll": "Seleccionar todo",
"dxDiagram-commandDelete": "Eliminar",
"dxDiagram-commandBringToFront": "Traer al frente",
"dxDiagram-commandSendToBack": "Enviar al fondo",
"dxDiagram-commandLock": "Bloquear",
"dxDiagram-commandUnlock": "Desbloquear",
"dxDiagram-commandInsertShapeImage": "Insertar imagen...",
"dxDiagram-commandEditShapeImage": "Cambiar imagen...",
"dxDiagram-commandDeleteShapeImage": "Eliminar imagen",
"dxDiagram-commandLayoutLeftToRight": "De izquierda a derecha",
"dxDiagram-commandLayoutRightToLeft": "De derecha a izquierda",
"dxDiagram-commandLayoutTopToBottom": "De arriba a abajo",
"dxDiagram-commandLayoutBottomToTop": "De abajo a arriba",
"dxDiagram-unitIn": "pulg.",
"dxDiagram-unitCm": "cm",
"dxDiagram-unitPx": "px",
"dxDiagram-dialogButtonOK": "Aceptar",
"dxDiagram-dialogButtonCancel": "Cancelar",
"dxDiagram-dialogInsertShapeImageTitle": "Insertar Imagen",
"dxDiagram-dialogEditShapeImageTitle": "Cambiar Imagen",
"dxDiagram-dialogEditShapeImageSelectButton": "Seleccionar imagen",
"dxDiagram-dialogEditShapeImageLabelText": "o colocar el archivo aqu\xed",
"dxDiagram-uiExport": "Exportar",
"dxDiagram-uiProperties": "Propiedades",
"dxDiagram-uiSettings": "Configuraci\xf3n",
"dxDiagram-uiShowToolbox": "Cuadro de herramientas",
"dxDiagram-uiSearch": "Buscar",
"dxDiagram-uiStyle": "Estilo",
"dxDiagram-uiLayout": "Dise\xf1o",
"dxDiagram-uiLayoutTree": "\xc1rbol",
"dxDiagram-uiLayoutLayered": "Capas",
"dxDiagram-uiDiagram": "Diagrama",
"dxDiagram-uiText": "Texto",
"dxDiagram-uiObject": "Objeto",
"dxDiagram-uiConnector": "Conector",
"dxDiagram-uiPage": "P\xe1gina",
"dxDiagram-shapeText": "Texto",
"dxDiagram-shapeRectangle": "Rect\xe1ngulo",
"dxDiagram-shapeEllipse": "Elipse",
"dxDiagram-shapeCross": "Cruz",
"dxDiagram-shapeTriangle": "Tri\xe1ngulo",
"dxDiagram-shapeDiamond": "Rombo",
"dxDiagram-shapeHeart": "Coraz\xf3n",
"dxDiagram-shapePentagon": "Pent\xe1gono",
"dxDiagram-shapeHexagon": "Hex\xe1gono",
"dxDiagram-shapeOctagon": "Oct\xe1gono",
"dxDiagram-shapeStar": "Estrella",
"dxDiagram-shapeArrowLeft": "Flecha izquierda",
"dxDiagram-shapeArrowUp": "Flecha arriba",
"dxDiagram-shapeArrowRight": "Flecha derecha",
"dxDiagram-shapeArrowDown": "Flecha abajo",
"dxDiagram-shapeArrowUpDown": "Flecha arriba/abajo",
"dxDiagram-shapeArrowLeftRight": "Flecha izquierda/derecha",
"dxDiagram-shapeProcess": "Proceso",
"dxDiagram-shapeDecision": "Decisi\xf3n",
"dxDiagram-shapeTerminator": "Terminador",
"dxDiagram-shapePredefinedProcess": "Proceso predefinido",
"dxDiagram-shapeDocument": "Documento",
"dxDiagram-shapeMultipleDocuments": "Varios documentos",
"dxDiagram-shapeManualInput": "Entrada manual",
"dxDiagram-shapePreparation": "Preparaci\xf3n",
"dxDiagram-shapeData": "Datos",
"dxDiagram-shapeDatabase": "Base de datos",
"dxDiagram-shapeHardDisk": "Disco duro",
"dxDiagram-shapeInternalStorage": "Almacenamiento interno",
"dxDiagram-shapePaperTape": "Cinta de papel",
"dxDiagram-shapeManualOperation": "Operaci\xf3n manual",
"dxDiagram-shapeDelay": "Retraso",
"dxDiagram-shapeStoredData": "Datos almacenados",
"dxDiagram-shapeDisplay": "Pantalla",
"dxDiagram-shapeMerge": "Combinar",
"dxDiagram-shapeConnector": "Conector",
"dxDiagram-shapeOr": "O",
"dxDiagram-shapeSummingJunction": "Uni\xf3n en Y",
"dxDiagram-shapeContainerDefaultText": "Contenedor",
"dxDiagram-shapeVerticalContainer": "Contenedor vertical",
"dxDiagram-shapeHorizontalContainer": "Contenedor horizontal",
"dxDiagram-shapeCardDefaultText": "Nombre de persona",
"dxDiagram-shapeCardWithImageOnLeft": "Tarjeta con imagen a la izquierda",
"dxDiagram-shapeCardWithImageOnTop": "Tarjeta con imagen en la parte superior",
"dxDiagram-shapeCardWithImageOnRight": "Tarjeta con imagen a la derecha",
"dxGantt-dialogTitle": "TODO",
"dxGantt-dialogStartTitle": "TODO",
"dxGantt-dialogEndTitle": "TODO",
"dxGantt-dialogProgressTitle": "TODO",
"dxGantt-dialogResourcesTitle": "TODO",
"dxGantt-dialogResourceManagerTitle": "TODO",
"dxGantt-dialogTaskDetailsTitle": "TODO",
"dxGantt-dialogEditResourceListHint": "TODO",
"dxGantt-dialogEditNoResources": "TODO",
"dxGantt-dialogButtonAdd": "TODO",
"dxGantt-contextMenuNewTask": "TODO",
"dxGantt-contextMenuNewSubtask": "TODO",
"dxGantt-contextMenuDeleteTask": "TODO",
"dxGantt-contextMenuDeleteDependency": "TODO",
"dxGantt-dialogTaskDeleteConfirmation": "TODO",
"dxGantt-dialogDependencyDeleteConfirmation": "TODO",
"dxGantt-dialogResourcesDeleteConfirmation": "TODO",
"dxGantt-dialogConstraintCriticalViolationMessage": "TODO",
"dxGantt-dialogConstraintViolationMessage": "TODO",
"dxGantt-dialogCancelOperationMessage": "TODO",
"dxGantt-dialogDeleteDependencyMessage": "TODO",
"dxGantt-dialogMoveTaskAndKeepDependencyMessage": "TODO",
"dxGantt-undo": "TODO",
"dxGantt-redo": "TODO",
"dxGantt-expandAll": "TODO",
"dxGantt-collapseAll": "TODO",
"dxGantt-addNewTask": "TODO",
"dxGantt-deleteSelectedTask": "TODO",
"dxGantt-zoomIn": "TODO",
"dxGantt-zoomOut": "TODO",
"dxGantt-fullScreen": "TODO"
}
})
});
|
def test_sigfig__3sigfigs_of_pi_314():
pass
|
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { StaticSymbol } from '../aot/static_symbol';
import { tokenReference } from '../compile_metadata';
import { Identifiers } from '../identifiers';
import * as o from '../output/output_ast';
import { Identifiers as R3 } from '../render3/r3_identifiers';
import { typeWithParameters } from './util';
import { unsupported } from './view/util';
export var R3FactoryDelegateType;
(function (R3FactoryDelegateType) {
R3FactoryDelegateType[R3FactoryDelegateType["Class"] = 0] = "Class";
R3FactoryDelegateType[R3FactoryDelegateType["Function"] = 1] = "Function";
R3FactoryDelegateType[R3FactoryDelegateType["Factory"] = 2] = "Factory";
})(R3FactoryDelegateType || (R3FactoryDelegateType = {}));
export var R3FactoryTarget;
(function (R3FactoryTarget) {
R3FactoryTarget[R3FactoryTarget["Directive"] = 0] = "Directive";
R3FactoryTarget[R3FactoryTarget["Component"] = 1] = "Component";
R3FactoryTarget[R3FactoryTarget["Injectable"] = 2] = "Injectable";
R3FactoryTarget[R3FactoryTarget["Pipe"] = 3] = "Pipe";
R3FactoryTarget[R3FactoryTarget["NgModule"] = 4] = "NgModule";
})(R3FactoryTarget || (R3FactoryTarget = {}));
/**
* Resolved type of a dependency.
*
* Occasionally, dependencies will have special significance which is known statically. In that
* case the `R3ResolvedDependencyType` informs the factory generator that a particular dependency
* should be generated specially (usually by calling a special injection function instead of the
* standard one).
*/
export var R3ResolvedDependencyType;
(function (R3ResolvedDependencyType) {
/**
* A normal token dependency.
*/
R3ResolvedDependencyType[R3ResolvedDependencyType["Token"] = 0] = "Token";
/**
* The dependency is for an attribute.
*
* The token expression is a string representing the attribute name.
*/
R3ResolvedDependencyType[R3ResolvedDependencyType["Attribute"] = 1] = "Attribute";
/**
* Injecting the `ChangeDetectorRef` token. Needs special handling when injected into a pipe.
*/
R3ResolvedDependencyType[R3ResolvedDependencyType["ChangeDetectorRef"] = 2] = "ChangeDetectorRef";
/**
* An invalid dependency (no token could be determined). An error should be thrown at runtime.
*/
R3ResolvedDependencyType[R3ResolvedDependencyType["Invalid"] = 3] = "Invalid";
})(R3ResolvedDependencyType || (R3ResolvedDependencyType = {}));
/**
* Construct a factory function expression for the given `R3FactoryMetadata`.
*/
export function compileFactoryFunction(meta) {
const t = o.variable('t');
const statements = [];
let ctorDepsType = o.NONE_TYPE;
// The type to instantiate via constructor invocation. If there is no delegated factory, meaning
// this type is always created by constructor invocation, then this is the type-to-create
// parameter provided by the user (t) if specified, or the current type if not. If there is a
// delegated factory (which is used to create the current type) then this is only the type-to-
// create parameter (t).
const typeForCtor = !isDelegatedMetadata(meta) ?
new o.BinaryOperatorExpr(o.BinaryOperator.Or, t, meta.internalType) :
t;
let ctorExpr = null;
if (meta.deps !== null) {
// There is a constructor (either explicitly or implicitly defined).
if (meta.deps !== 'invalid') {
ctorExpr = new o.InstantiateExpr(typeForCtor, injectDependencies(meta.deps, meta.injectFn, meta.target === R3FactoryTarget.Pipe));
ctorDepsType = createCtorDepsType(meta.deps);
}
}
else {
const baseFactory = o.variable(`ɵ${meta.name}_BaseFactory`);
const getInheritedFactory = o.importExpr(R3.getInheritedFactory);
const baseFactoryStmt = baseFactory.set(getInheritedFactory.callFn([meta.internalType]))
.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Exported, o.StmtModifier.Final]);
statements.push(baseFactoryStmt);
// There is no constructor, use the base class' factory to construct typeForCtor.
ctorExpr = baseFactory.callFn([typeForCtor]);
}
const ctorExprFinal = ctorExpr;
const body = [];
let retExpr = null;
function makeConditionalFactory(nonCtorExpr) {
const r = o.variable('r');
body.push(r.set(o.NULL_EXPR).toDeclStmt());
let ctorStmt = null;
if (ctorExprFinal !== null) {
ctorStmt = r.set(ctorExprFinal).toStmt();
}
else {
ctorStmt = o.importExpr(R3.invalidFactory).callFn([]).toStmt();
}
body.push(o.ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt()]));
return r;
}
if (isDelegatedMetadata(meta) && meta.delegateType === R3FactoryDelegateType.Factory) {
const delegateFactory = o.variable(`ɵ${meta.name}_BaseFactory`);
const getFactoryOf = o.importExpr(R3.getFactoryOf);
if (meta.delegate.isEquivalent(meta.internalType)) {
throw new Error(`Illegal state: compiling factory that delegates to itself`);
}
const delegateFactoryStmt = delegateFactory.set(getFactoryOf.callFn([meta.delegate])).toDeclStmt(o.INFERRED_TYPE, [
o.StmtModifier.Exported, o.StmtModifier.Final
]);
statements.push(delegateFactoryStmt);
retExpr = makeConditionalFactory(delegateFactory.callFn([]));
}
else if (isDelegatedMetadata(meta)) {
// This type is created with a delegated factory. If a type parameter is not specified, call
// the factory instead.
const delegateArgs = injectDependencies(meta.delegateDeps, meta.injectFn, meta.target === R3FactoryTarget.Pipe);
// Either call `new delegate(...)` or `delegate(...)` depending on meta.delegateType.
const factoryExpr = new (meta.delegateType === R3FactoryDelegateType.Class ?
o.InstantiateExpr :
o.InvokeFunctionExpr)(meta.delegate, delegateArgs);
retExpr = makeConditionalFactory(factoryExpr);
}
else if (isExpressionFactoryMetadata(meta)) {
// TODO(alxhub): decide whether to lower the value here or in the caller
retExpr = makeConditionalFactory(meta.expression);
}
else {
retExpr = ctorExpr;
}
if (retExpr !== null) {
body.push(new o.ReturnStatement(retExpr));
}
else {
body.push(o.importExpr(R3.invalidFactory).callFn([]).toStmt());
}
return {
factory: o.fn([new o.FnParam('t', o.DYNAMIC_TYPE)], body, o.INFERRED_TYPE, undefined, `${meta.name}_Factory`),
statements,
type: o.expressionType(o.importExpr(R3.FactoryDef, [typeWithParameters(meta.type.type, meta.typeArgumentCount), ctorDepsType]))
};
}
function injectDependencies(deps, injectFn, isPipe) {
return deps.map((dep, index) => compileInjectDependency(dep, injectFn, isPipe, index));
}
function compileInjectDependency(dep, injectFn, isPipe, index) {
// Interpret the dependency according to its resolved type.
switch (dep.resolved) {
case R3ResolvedDependencyType.Token:
case R3ResolvedDependencyType.ChangeDetectorRef:
// Build up the injection flags according to the metadata.
const flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) |
(dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) |
(dep.optional ? 8 /* Optional */ : 0);
// If this dependency is optional or otherwise has non-default flags, then additional
// parameters describing how to inject the dependency must be passed to the inject function
// that's being used.
let flagsParam = (flags !== 0 /* Default */ || dep.optional) ? o.literal(flags) : null;
// We have a separate instruction for injecting ChangeDetectorRef into a pipe.
if (isPipe && dep.resolved === R3ResolvedDependencyType.ChangeDetectorRef) {
return o.importExpr(R3.injectPipeChangeDetectorRef).callFn(flagsParam ? [flagsParam] : []);
}
// Build up the arguments to the injectFn call.
const injectArgs = [dep.token];
if (flagsParam) {
injectArgs.push(flagsParam);
}
return o.importExpr(injectFn).callFn(injectArgs);
case R3ResolvedDependencyType.Attribute:
// In the case of attributes, the attribute name in question is given as the token.
return o.importExpr(R3.injectAttribute).callFn([dep.token]);
case R3ResolvedDependencyType.Invalid:
return o.importExpr(R3.invalidFactoryDep).callFn([o.literal(index)]);
default:
return unsupported(`Unknown R3ResolvedDependencyType: ${R3ResolvedDependencyType[dep.resolved]}`);
}
}
function createCtorDepsType(deps) {
let hasTypes = false;
const attributeTypes = deps.map(dep => {
const type = createCtorDepType(dep);
if (type !== null) {
hasTypes = true;
return type;
}
else {
return o.literal(null);
}
});
if (hasTypes) {
return o.expressionType(o.literalArr(attributeTypes));
}
else {
return o.NONE_TYPE;
}
}
function createCtorDepType(dep) {
const entries = [];
if (dep.resolved === R3ResolvedDependencyType.Attribute) {
if (dep.attribute !== null) {
entries.push({ key: 'attribute', value: dep.attribute, quoted: false });
}
}
if (dep.optional) {
entries.push({ key: 'optional', value: o.literal(true), quoted: false });
}
if (dep.host) {
entries.push({ key: 'host', value: o.literal(true), quoted: false });
}
if (dep.self) {
entries.push({ key: 'self', value: o.literal(true), quoted: false });
}
if (dep.skipSelf) {
entries.push({ key: 'skipSelf', value: o.literal(true), quoted: false });
}
return entries.length > 0 ? o.literalMap(entries) : null;
}
/**
* A helper function useful for extracting `R3DependencyMetadata` from a Render2
* `CompileTypeMetadata` instance.
*/
export function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {
// Use the `CompileReflector` to look up references to some well-known Angular types. These will
// be compared with the token to statically determine whether the token has significance to
// Angular, and set the correct `R3ResolvedDependencyType` as a result.
const injectorRef = reflector.resolveExternalReference(Identifiers.Injector);
// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.
const deps = [];
for (let dependency of type.diDeps) {
if (dependency.token) {
const tokenRef = tokenReference(dependency.token);
let resolved = dependency.isAttribute ?
R3ResolvedDependencyType.Attribute :
R3ResolvedDependencyType.Token;
// In the case of most dependencies, the token will be a reference to a type. Sometimes,
// however, it can be a string, in the case of older Angular code or @Attribute injection.
const token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : o.literal(tokenRef);
// Construct the dependency.
deps.push({
token,
attribute: null,
resolved,
host: !!dependency.isHost,
optional: !!dependency.isOptional,
self: !!dependency.isSelf,
skipSelf: !!dependency.isSkipSelf,
});
}
else {
unsupported('dependency without a token');
}
}
return deps;
}
function isDelegatedMetadata(meta) {
return meta.delegateType !== undefined;
}
function isExpressionFactoryMetadata(meta) {
return meta.expression !== undefined;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicjNfZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9yZW5kZXIzL3IzX2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQ2xELE9BQU8sRUFBc0IsY0FBYyxFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFHeEUsT0FBTyxFQUFDLFdBQVcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBQzNDLE9BQU8sS0FBSyxDQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFDMUMsT0FBTyxFQUFDLFdBQVcsSUFBSSxFQUFFLEVBQUMsTUFBTSwyQkFBMkIsQ0FBQztBQUc1RCxPQUFPLEVBQWMsa0JBQWtCLEVBQUMsTUFBTSxRQUFRLENBQUM7QUFDdkQsT0FBTyxFQUFDLFdBQVcsRUFBQyxNQUFNLGFBQWEsQ0FBQztBQW9EeEMsTUFBTSxDQUFOLElBQVkscUJBSVg7QUFKRCxXQUFZLHFCQUFxQjtJQUMvQixtRUFBSyxDQUFBO0lBQ0wseUVBQVEsQ0FBQTtJQUNSLHVFQUFPLENBQUE7QUFDVCxDQUFDLEVBSlcscUJBQXFCLEtBQXJCLHFCQUFxQixRQUloQztBQW9CRCxNQUFNLENBQU4sSUFBWSxlQU1YO0FBTkQsV0FBWSxlQUFlO0lBQ3pCLCtEQUFhLENBQUE7SUFDYiwrREFBYSxDQUFBO0lBQ2IsaUVBQWMsQ0FBQTtJQUNkLHFEQUFRLENBQUE7SUFDUiw2REFBWSxDQUFBO0FBQ2QsQ0FBQyxFQU5XLGVBQWUsS0FBZixlQUFlLFFBTTFCO0FBRUQ7Ozs7Ozs7R0FPRztBQUNILE1BQU0sQ0FBTixJQUFZLHdCQXNCWDtBQXRCRCxXQUFZLHdCQUF3QjtJQUNsQzs7T0FFRztJQUNILHlFQUFTLENBQUE7SUFFVDs7OztPQUlHO0lBQ0gsaUZBQWEsQ0FBQTtJQUViOztPQUVHO0lBQ0gsaUdBQXFCLENBQUE7SUFFckI7O09BRUc7SUFDSCw2RUFBVyxDQUFBO0FBQ2IsQ0FBQyxFQXRCVyx3QkFBd0IsS0FBeEIsd0JBQXdCLFFBc0JuQztBQW1ERDs7R0FFRztBQUNILE1BQU0sVUFBVSxzQkFBc0IsQ0FBQyxJQUF1QjtJQUM1RCxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQzFCLE1BQU0sVUFBVSxHQUFrQixFQUFFLENBQUM7SUFDckMsSUFBSSxZQUFZLEdBQVcsQ0FBQyxDQUFDLFNBQVMsQ0FBQztJQUV2QyxnR0FBZ0c7SUFDaEcseUZBQXlGO0lBQ3pGLDZGQUE2RjtJQUM3Riw4RkFBOEY7SUFDOUYsd0JBQXdCO0lBQ3hCLE1BQU0sV0FBVyxHQUFHLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUM1QyxJQUFJLENBQUMsQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDLENBQUMsY0FBYyxDQUFDLEVBQUUsRUFBRSxDQUFDLEVBQUUsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7UUFDckUsQ0FBQyxDQUFDO0lBRU4sSUFBSSxRQUFRLEdBQXNCLElBQUksQ0FBQztJQUN2QyxJQUFJLElBQUksQ0FBQyxJQUFJLEtBQUssSUFBSSxFQUFFO1FBQ3RCLG9FQUFvRTtRQUNwRSxJQUFJLElBQUksQ0FBQyxJQUFJLEtBQUssU0FBUyxFQUFFO1lBQzNCLFFBQVEsR0FBRyxJQUFJLENBQUMsQ0FBQyxlQUFlLENBQzVCLFdBQVcsRUFDWCxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLE1BQU0sS0FBSyxlQUFlLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztZQUV4RixZQUFZLEdBQUcsa0JBQWtCLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1NBQzlDO0tBQ0Y7U0FBTTtRQUNMLE1BQU0sV0FBVyxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsSUFBSSxJQUFJLENBQUMsSUFBSSxjQUFjLENBQUMsQ0FBQztRQUM1RCxNQUFNLG1CQUFtQixHQUFHLENBQUMsQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLG1CQUFtQixDQUFDLENBQUM7UUFDakUsTUFBTSxlQUFlLEdBQ2pCLFdBQVcsQ0FBQyxHQUFHLENBQUMsbUJBQW1CLENBQUMsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7YUFDM0QsVUFBVSxDQUFDLENBQUMsQ0FBQyxhQUFhLEVBQUUsQ0FBQyxDQUFDLENBQUMsWUFBWSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7UUFDdEYsVUFBVSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQztRQUVqQyxpRkFBaUY7UUFDakYsUUFBUSxHQUFHLFdBQVcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDO0tBQzlDO0lBQ0QsTUFBTSxhQUFhLEdBQUcsUUFBUSxDQUFDO0lBRS9CLE1BQU0sSUFBSSxHQUFrQixFQUFFLENBQUM7SUFDL0IsSUFBSSxPQUFPLEdBQXNCLElBQUksQ0FBQztJQUV0QyxTQUFTLHNCQUFzQixDQUFDLFdBQXlCO1FBQ3ZELE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDMUIsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQzNDLElBQUksUUFBUSxHQUFxQixJQUFJLENBQUM7UUFDdEMsSUFBSSxhQUFhLEtBQUssSUFBSSxFQUFFO1lBQzFCLFFBQVEsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxDQUFDLE1BQU0sRUFBRSxDQUFDO1NBQzFDO2FBQU07WUFDTCxRQUFRLEdBQUcsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsY0FBYyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxDQUFDLE1BQU0sRUFBRSxDQUFDO1NBQ2hFO1FBQ0QsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNsRSxPQUFPLENBQUMsQ0FBQztJQUNYLENBQUM7SUFFRCxJQUFJLG1CQUFtQixDQUFDLElBQUksQ0FBQyxJQUFJLElBQUksQ0FBQyxZQUFZLEtBQUsscUJBQXFCLENBQUMsT0FBTyxFQUFFO1FBQ3BGLE1BQU0sZUFBZSxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsSUFBSSxJQUFJLENBQUMsSUFBSSxjQUFjLENBQUMsQ0FBQztRQUNoRSxNQUFNLFlBQVksR0FBRyxDQUFDLENBQUMsVUFBVSxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUNuRCxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsRUFBRTtZQUNqRCxNQUFNLElBQUksS0FBSyxDQUFDLDJEQUEyRCxDQUFDLENBQUM7U0FDOUU7UUFDRCxNQUFNLG1CQUFtQixHQUNyQixlQUFlLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsYUFBYSxFQUFFO1lBQ3BGLENBQUMsQ0FBQyxZQUFZLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQyxZQUFZLENBQUMsS0FBSztTQUM5QyxDQUFDLENBQUM7UUFFUCxVQUFVLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLENBQUM7UUFDckMsT0FBTyxHQUFHLHNCQUFzQixDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQztLQUM5RDtTQUFNLElBQUksbUJBQW1CLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDcEMsNEZBQTRGO1FBQzVGLHVCQUF1QjtRQUN2QixNQUFNLFlBQVksR0FDZCxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsWUFBWSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLE1BQU0sS0FBSyxlQUFlLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDL0YscUZBQXFGO1FBQ3JGLE1BQU0sV0FBVyxHQUFHLElBQUksQ0FDcEIsSUFBSSxDQUFDLFlBQVksS0FBSyxxQkFBcUIsQ0FBQyxLQUFLLENBQUMsQ0FBQztZQUMvQyxDQUFDLENBQUMsZUFBZSxDQUFDLENBQUM7WUFDbkIsQ0FBQyxDQUFDLGtCQUFrQixDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxZQUFZLENBQUMsQ0FBQztRQUMzRCxPQUFPLEdBQUcsc0JBQXNCLENBQUMsV0FBVyxDQUFDLENBQUM7S0FDL0M7U0FBTSxJQUFJLDJCQUEyQixDQUFDLElBQUksQ0FBQyxFQUFFO1FBQzVDLHdFQUF3RTtRQUN4RSxPQUFPLEdBQUcsc0JBQXNCLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0tBQ25EO1NBQU07UUFDTCxPQUFPLEdBQUcsUUFBUSxDQUFDO0tBQ3BCO0lBRUQsSUFBSSxPQUFPLEtBQUssSUFBSSxFQUFFO1FBQ3BCLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsZUFBZSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7S0FDM0M7U0FBTTtRQUNMLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsY0FBYyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7S0FDaEU7SUFFRCxPQUFPO1FBQ0wsT0FBTyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQ1QsQ0FBQyxJQUFJLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUMsQ0FBQyxZQUFZLENBQUMsQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLENBQUMsYUFBYSxFQUFFLFNBQVMsRUFDdEUsR0FBRyxJQUFJLENBQUMsSUFBSSxVQUFVLENBQUM7UUFDM0IsVUFBVTtRQUNWLElBQUksRUFBRSxDQUFDLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQy9CLEVBQUUsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsaUJBQWlCLENBQUMsRUFBRSxZQUFZLENBQUMsQ0FBQyxDQUFDO0tBQ2hHLENBQUM7QUFDSixDQUFDO0FBRUQsU0FBUyxrQkFBa0IsQ0FDdkIsSUFBNEIsRUFBRSxRQUE2QixFQUFFLE1BQWU7SUFDOUUsT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxFQUFFLEtBQUssRUFBRSxFQUFFLENBQUMsdUJBQXVCLENBQUMsR0FBRyxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsS0FBSyxDQUFDLENBQUMsQ0FBQztBQUN6RixDQUFDO0FBRUQsU0FBUyx1QkFBdUIsQ0FDNUIsR0FBeUIsRUFBRSxRQUE2QixFQUFFLE1BQWUsRUFDekUsS0FBYTtJQUNmLDJEQUEyRDtJQUMzRCxRQUFRLEdBQUcsQ0FBQyxRQUFRLEVBQUU7UUFDcEIsS0FBSyx3QkFBd0IsQ0FBQyxLQUFLLENBQUM7UUFDcEMsS0FBSyx3QkFBd0IsQ0FBQyxpQkFBaUI7WUFDN0MsMERBQTBEO1lBQzFELE1BQU0sS0FBSyxHQUFHLGtCQUFzQixDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxjQUFrQixDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUNqRSxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxrQkFBc0IsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDLGNBQWtCLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQzdFLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxDQUFDLGtCQUFzQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFFOUMscUZBQXFGO1lBQ3JGLDJGQUEyRjtZQUMzRixxQkFBcUI7WUFDckIsSUFBSSxVQUFVLEdBQ1YsQ0FBQyxLQUFLLG9CQUF3QixJQUFJLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDO1lBRTlFLDhFQUE4RTtZQUM5RSxJQUFJLE1BQU0sSUFBSSxHQUFHLENBQUMsUUFBUSxLQUFLLHdCQUF3QixDQUFDLGlCQUFpQixFQUFFO2dCQUN6RSxPQUFPLENBQUMsQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLDJCQUEyQixDQUFDLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUM7YUFDNUY7WUFFRCwrQ0FBK0M7WUFDL0MsTUFBTSxVQUFVLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDL0IsSUFBSSxVQUFVLEVBQUU7Z0JBQ2QsVUFBVSxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQzthQUM3QjtZQUNELE9BQU8sQ0FBQyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLENBQUM7UUFDbkQsS0FBSyx3QkFBd0IsQ0FBQyxTQUFTO1lBQ3JDLG1GQUFtRjtZQUNuRixPQUFPLENBQUMsQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLGVBQWUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO1FBQzlELEtBQUssd0JBQXdCLENBQUMsT0FBTztZQUNuQyxPQUFPLENBQUMsQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLGlCQUFpQixDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDdkU7WUFDRSxPQUFPLFdBQVcsQ0FDZCxxQ0FBcUMsd0JBQXdCLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQztLQUN0RjtBQUNILENBQUM7QUFFRCxTQUFTLGtCQUFrQixDQUFDLElBQTRCO0lBQ3RELElBQUksUUFBUSxHQUFHLEtBQUssQ0FBQztJQUNyQixNQUFNLGNBQWMsR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1FBQ3BDLE1BQU0sSUFBSSxHQUFHLGlCQUFpQixDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQ3BDLElBQUksSUFBSSxLQUFLLElBQUksRUFBRTtZQUNqQixRQUFRLEdBQUcsSUFBSSxDQUFDO1lBQ2hCLE9BQU8sSUFBSSxDQUFDO1NBQ2I7YUFBTTtZQUNMLE9BQU8sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztTQUN4QjtJQUNILENBQUMsQ0FBQyxDQUFDO0lBRUgsSUFBSSxRQUFRLEVBQUU7UUFDWixPQUFPLENBQUMsQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO0tBQ3ZEO1NBQU07UUFDTCxPQUFPLENBQUMsQ0FBQyxTQUFTLENBQUM7S0FDcEI7QUFDSCxDQUFDO0FBRUQsU0FBUyxpQkFBaUIsQ0FBQyxHQUF5QjtJQUNsRCxNQUFNLE9BQU8sR0FBMEQsRUFBRSxDQUFDO0lBRTFFLElBQUksR0FBRyxDQUFDLFFBQVEsS0FBSyx3QkFBd0IsQ0FBQyxTQUFTLEVBQUU7UUFDdkQsSUFBSSxHQUFHLENBQUMsU0FBUyxLQUFLLElBQUksRUFBRTtZQUMxQixPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUMsR0FBRyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsR0FBRyxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFDLENBQUMsQ0FBQztTQUN2RTtLQUNGO0lBQ0QsSUFBSSxHQUFHLENBQUMsUUFBUSxFQUFFO1FBQ2hCLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBQyxHQUFHLEVBQUUsVUFBVSxFQUFFLEtBQUssRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUMsQ0FBQyxDQUFDO0tBQ3hFO0lBQ0QsSUFBSSxHQUFHLENBQUMsSUFBSSxFQUFFO1FBQ1osT0FBTyxDQUFDLElBQUksQ0FBQyxFQUFDLEdBQUcsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUUsTUFBTSxFQUFFLEtBQUssRUFBQyxDQUFDLENBQUM7S0FDcEU7SUFDRCxJQUFJLEdBQUcsQ0FBQyxJQUFJLEVBQUU7UUFDWixPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUMsR0FBRyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFDLENBQUMsQ0FBQztLQUNwRTtJQUNELElBQUksR0FBRyxDQUFDLFFBQVEsRUFBRTtRQUNoQixPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUMsR0FBRyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFDLENBQUMsQ0FBQztLQUN4RTtJQUVELE9BQU8sT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQztBQUMzRCxDQUFDO0FBRUQ7OztHQUdHO0FBQ0gsTUFBTSxVQUFVLDhCQUE4QixDQUMxQyxJQUF5QixFQUFFLFNBQXdCLEVBQ25ELFNBQTJCO0lBQzdCLGdHQUFnRztJQUNoRywyRkFBMkY7SUFDM0YsdUVBQXVFO0lBQ3ZFLE1BQU0sV0FBVyxHQUFHLFNBQVMsQ0FBQyx3QkFBd0IsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQUM7SUFFN0Usa0dBQWtHO0lBQ2xHLE1BQU0sSUFBSSxHQUEyQixFQUFFLENBQUM7SUFDeEMsS0FBSyxJQUFJLFVBQVUsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFO1FBQ2xDLElBQUksVUFBVSxDQUFDLEtBQUssRUFBRTtZQUNwQixNQUFNLFFBQVEsR0FBRyxjQUFjLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ2xELElBQUksUUFBUSxHQUE2QixVQUFVLENBQUMsV0FBVyxDQUFDLENBQUM7Z0JBQzdELHdCQUF3QixDQUFDLFNBQVMsQ0FBQyxDQUFDO2dCQUNwQyx3QkFBd0IsQ0FBQyxLQUFLLENBQUM7WUFFbkMsd0ZBQXdGO1lBQ3hGLDBGQUEwRjtZQUMxRixNQUFNLEtBQUssR0FDUCxRQUFRLFlBQVksWUFBWSxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO1lBRTVGLDRCQUE0QjtZQUM1QixJQUFJLENBQUMsSUFBSSxDQUFDO2dCQUNSLEtBQUs7Z0JBQ0wsU0FBUyxFQUFFLElBQUk7Z0JBQ2YsUUFBUTtnQkFDUixJQUFJLEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxNQUFNO2dCQUN6QixRQUFRLEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxVQUFVO2dCQUNqQyxJQUFJLEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxNQUFNO2dCQUN6QixRQUFRLEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxVQUFVO2FBQ2xDLENBQUMsQ0FBQztTQUNKO2FBQU07WUFDTCxXQUFXLENBQUMsNEJBQTRCLENBQUMsQ0FBQztTQUMzQztLQUNGO0lBRUQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQsU0FBUyxtQkFBbUIsQ0FBQyxJQUF1QjtJQUVsRCxPQUFRLElBQVksQ0FBQyxZQUFZLEtBQUssU0FBUyxDQUFDO0FBQ2xELENBQUM7QUFFRCxTQUFTLDJCQUEyQixDQUFDLElBQXVCO0lBQzFELE9BQVEsSUFBWSxDQUFDLFVBQVUsS0FBSyxTQUFTLENBQUM7QUFDaEQsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuaW1wb3J0IHtTdGF0aWNTeW1ib2x9IGZyb20gJy4uL2FvdC9zdGF0aWNfc3ltYm9sJztcbmltcG9ydCB7Q29tcGlsZVR5cGVNZXRhZGF0YSwgdG9rZW5SZWZlcmVuY2V9IGZyb20gJy4uL2NvbXBpbGVfbWV0YWRhdGEnO1xuaW1wb3J0IHtDb21waWxlUmVmbGVjdG9yfSBmcm9tICcuLi9jb21waWxlX3JlZmxlY3Rvcic7XG5pbXBvcnQge0luamVjdEZsYWdzfSBmcm9tICcuLi9jb3JlJztcbmltcG9ydCB7SWRlbnRpZmllcnN9IGZyb20gJy4uL2lkZW50aWZpZXJzJztcbmltcG9ydCAqIGFzIG8gZnJvbSAnLi4vb3V0cHV0L291dHB1dF9hc3QnO1xuaW1wb3J0IHtJZGVudGlmaWVycyBhcyBSM30gZnJvbSAnLi4vcmVuZGVyMy9yM19pZGVudGlmaWVycyc7XG5pbXBvcnQge091dHB1dENvbnRleHR9IGZyb20gJy4uL3V0aWwnO1xuXG5pbXBvcnQge1IzUmVmZXJlbmNlLCB0eXBlV2l0aFBhcmFtZXRlcnN9IGZyb20gJy4vdXRpbCc7XG5pbXBvcnQge3Vuc3VwcG9ydGVkfSBmcm9tICcuL3ZpZXcvdXRpbCc7XG5cblxuXG4vKipcbiAqIE1ldGFkYXRhIHJlcXVpcmVkIGJ5IHRoZSBmYWN0b3J5IGdlbmVyYXRvciB0byBnZW5lcmF0ZSBhIGBmYWN0b3J5YCBmdW5jdGlvbiBmb3IgYSB0eXBlLlxuICovXG5leHBvcnQgaW50ZXJmYWNlIFIzQ29uc3RydWN0b3JGYWN0b3J5TWV0YWRhdGEge1xuICAvKipcbiAgICogU3RyaW5nIG5hbWUgb2YgdGhlIHR5cGUgYmVpbmcgZ2VuZXJhdGVkICh1c2VkIHRvIG5hbWUgdGhlIGZhY3RvcnkgZnVuY3Rpb24pLlxuICAgKi9cbiAgbmFtZTogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBBbiBleHByZXNzaW9uIHJlcHJlc2VudGluZyB0aGUgaW50ZXJmYWNlIHR5cGUgYmVpbmcgY29uc3RydWN0ZWQuXG4gICAqL1xuICB0eXBlOiBSM1JlZmVyZW5jZTtcblxuICAvKipcbiAgICogQW4gZXhwcmVzc2lvbiByZXByZXNlbnRpbmcgdGhlIGNvbnN0cnVjdG9yIHR5cGUsIGludGVuZGVkIGZvciB1c2Ugd2l0aGluIGEgY2xhc3MgZGVmaW5pdGlvblxuICAgKiBpdHNlbGYuXG4gICAqXG4gICAqIFRoaXMgY2FuIGRpZmZlciBmcm9tIHRoZSBvdXRlciBgdHlwZWAgaWYgdGhlIGNsYXNzIGlzIGJlaW5nIGNvbXBpbGVkIGJ5IG5nY2MgYW5kIGlzIGluc2lkZVxuICAgKiBhbiBJSUZFIHN0cnVjdHVyZSB0aGF0IHVzZXMgYSBkaWZmZXJlbnQgbmFtZSBpbnRlcm5hbGx5LlxuICAgKi9cbiAgaW50ZXJuYWxUeXBlOiBvLkV4cHJlc3Npb247XG5cbiAgLyoqIE51bWJlciBvZiBhcmd1bWVudHMgZm9yIHRoZSBgdHlwZWAuICovXG4gIHR5cGVBcmd1bWVudENvdW50OiBudW1iZXI7XG5cbiAgLyoqXG4gICAqIFJlZ2FyZGxlc3Mgb2Ygd2hldGhlciBgZm5PckNsYXNzYCBpcyBhIGNvbnN0cnVjdG9yIGZ1bmN0aW9uIG9yIGEgdXNlci1kZWZpbmVkIGZhY3RvcnksIGl0XG4gICAqIG1heSBoYXZlIDAgb3IgbW9yZSBwYXJhbWV0ZXJzLCB3aGljaCB3aWxsIGJlIGluamVjdGVkIGFjY29yZGluZyB0byB0aGUgYFIzRGVwZW5kZW5jeU1ldGFkYXRhYFxuICAgKiBmb3IgdGhvc2UgcGFyYW1ldGVycy4gSWYgdGhpcyBpcyBgbnVsbGAsIHRoZW4gdGhlIHR5cGUncyBjb25zdHJ1Y3RvciBpcyBub25leGlzdGVudCBhbmQgd2lsbFxuICAgKiBiZSBpbmhlcml0ZWQgZnJvbSBgZm5PckNsYXNzYCB3aGljaCBpcyBpbnRlcnByZXRlZCBhcyB0aGUgY3VycmVudCB0eXBlLiBJZiB0aGlzIGlzIGAnaW52YWxpZCdgLFxuICAgKiB0aGVuIG9uZSBvciBtb3JlIG9mIHRoZSBwYXJhbWV0ZXJzIHdhc24ndCByZXNvbHZhYmxlIGFuZCBhbnkgYXR0ZW1wdCB0byB1c2UgdGhlc2UgZGVwcyB3aWxsXG4gICAqIHJlc3VsdCBpbiBhIHJ1bnRpbWUgZXJyb3IuXG4gICAqL1xuICBkZXBzOiBSM0RlcGVuZGVuY3lNZXRhZGF0YVtdfCdpbnZhbGlkJ3xudWxsO1xuXG4gIC8qKlxuICAgKiBBbiBleHByZXNzaW9uIGZvciB0aGUgZnVuY3Rpb24gd2hpY2ggd2lsbCBiZSB1c2VkIHRvIGluamVjdCBkZXBlbmRlbmNpZXMuIFRoZSBBUEkgb2YgdGhpc1xuICAgKiBmdW5jdGlvbiBjb3VsZCBiZSBkaWZmZXJlbnQsIGFuZCBvdGhlciBvcHRpb25zIGNvbnRyb2wgaG93IGl0IHdpbGwgYmUgaW52b2tlZC5cbiAgICovXG4gIGluamVjdEZuOiBvLkV4dGVybmFsUmVmZXJlbmNlO1xuXG4gIC8qKlxuICAgKiBUeXBlIG9mIHRoZSB0YXJnZXQgYmVpbmcgY3JlYXRlZCBieSB0aGUgZmFjdG9yeS5cbiAgICovXG4gIHRhcmdldDogUjNGYWN0b3J5VGFyZ2V0O1xufVxuXG5leHBvcnQgZW51bSBSM0ZhY3RvcnlEZWxlZ2F0ZVR5cGUge1xuICBDbGFzcyxcbiAgRnVuY3Rpb24sXG4gIEZhY3RvcnksXG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgUjNEZWxlZ2F0ZWRGYWN0b3J5TWV0YWRhdGEgZXh0ZW5kcyBSM0NvbnN0cnVjdG9yRmFjdG9yeU1ldGFkYXRhIHtcbiAgZGVsZWdhdGU6IG8uRXhwcmVzc2lvbjtcbiAgZGVsZWdhdGVUeXBlOiBSM0ZhY3RvcnlEZWxlZ2F0ZVR5cGUuRmFjdG9yeTtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBSM0RlbGVnYXRlZEZuT3JDbGFzc01ldGFkYXRhIGV4dGVuZHMgUjNDb25zdHJ1Y3RvckZhY3RvcnlNZXRhZGF0YSB7XG4gIGRlbGVnYXRlOiBvLkV4cHJlc3Npb247XG4gIGRlbGVnYXRlVHlwZTogUjNGYWN0b3J5RGVsZWdhdGVUeXBlLkNsYXNzfFIzRmFjdG9yeURlbGVnYXRlVHlwZS5GdW5jdGlvbjtcbiAgZGVsZWdhdGVEZXBzOiBSM0RlcGVuZGVuY3lNZXRhZGF0YVtdO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIFIzRXhwcmVzc2lvbkZhY3RvcnlNZXRhZGF0YSBleHRlbmRzIFIzQ29uc3RydWN0b3JGYWN0b3J5TWV0YWRhdGEge1xuICBleHByZXNzaW9uOiBvLkV4cHJlc3Npb247XG59XG5cbmV4cG9ydCB0eXBlIFIzRmFjdG9yeU1ldGFkYXRhID0gUjNDb25zdHJ1Y3RvckZhY3RvcnlNZXRhZGF0YXxSM0RlbGVnYXRlZEZhY3RvcnlNZXRhZGF0YXxcbiAgICBSM0RlbGVnYXRlZEZuT3JDbGFzc01ldGFkYXRhfFIzRXhwcmVzc2lvbkZhY3RvcnlNZXRhZGF0YTtcblxuZXhwb3J0IGVudW0gUjNGYWN0b3J5VGFyZ2V0IHtcbiAgRGlyZWN0aXZlID0gMCxcbiAgQ29tcG9uZW50ID0gMSxcbiAgSW5qZWN0YWJsZSA9IDIsXG4gIFBpcGUgPSAzLFxuICBOZ01vZHVsZSA9IDQsXG59XG5cbi8qKlxuICogUmVzb2x2ZWQgdHlwZSBvZiBhIGRlcGVuZGVuY3kuXG4gKlxuICogT2NjYXNpb25hbGx5LCBkZXBlbmRlbmNpZXMgd2lsbCBoYXZlIHNwZWNpYWwgc2lnbmlmaWNhbmNlIHdoaWNoIGlzIGtub3duIHN0YXRpY2FsbHkuIEluIHRoYXRcbiAqIGNhc2UgdGhlIGBSM1Jlc29sdmVkRGVwZW5kZW5jeVR5cGVgIGluZm9ybXMgdGhlIGZhY3RvcnkgZ2VuZXJhdG9yIHRoYXQgYSBwYXJ0aWN1bGFyIGRlcGVuZGVuY3lcbiAqIHNob3VsZCBiZSBnZW5lcmF0ZWQgc3BlY2lhbGx5ICh1c3VhbGx5IGJ5IGNhbGxpbmcgYSBzcGVjaWFsIGluamVjdGlvbiBmdW5jdGlvbiBpbnN0ZWFkIG9mIHRoZVxuICogc3RhbmRhcmQgb25lKS5cbiAqL1xuZXhwb3J0IGVudW0gUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlIHtcbiAgLyoqXG4gICAqIEEgbm9ybWFsIHRva2VuIGRlcGVuZGVuY3kuXG4gICAqL1xuICBUb2tlbiA9IDAsXG5cbiAgLyoqXG4gICAqIFRoZSBkZXBlbmRlbmN5IGlzIGZvciBhbiBhdHRyaWJ1dGUuXG4gICAqXG4gICAqIFRoZSB0b2tlbiBleHByZXNzaW9uIGlzIGEgc3RyaW5nIHJlcHJlc2VudGluZyB0aGUgYXR0cmlidXRlIG5hbWUuXG4gICAqL1xuICBBdHRyaWJ1dGUgPSAxLFxuXG4gIC8qKlxuICAgKiBJbmplY3RpbmcgdGhlIGBDaGFuZ2VEZXRlY3RvclJlZmAgdG9rZW4uIE5lZWRzIHNwZWNpYWwgaGFuZGxpbmcgd2hlbiBpbmplY3RlZCBpbnRvIGEgcGlwZS5cbiAgICovXG4gIENoYW5nZURldGVjdG9yUmVmID0gMixcblxuICAvKipcbiAgICogQW4gaW52YWxpZCBkZXBlbmRlbmN5IChubyB0b2tlbiBjb3VsZCBiZSBkZXRlcm1pbmVkKS4gQW4gZXJyb3Igc2hvdWxkIGJlIHRocm93biBhdCBydW50aW1lLlxuICAgKi9cbiAgSW52YWxpZCA9IDMsXG59XG5cbi8qKlxuICogTWV0YWRhdGEgcmVwcmVzZW50aW5nIGEgc2luZ2xlIGRlcGVuZGVuY3kgdG8gYmUgaW5qZWN0ZWQgaW50byBhIGNvbnN0cnVjdG9yIG9yIGZ1bmN0aW9uIGNhbGwuXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgUjNEZXBlbmRlbmN5TWV0YWRhdGEge1xuICAvKipcbiAgICogQW4gZXhwcmVzc2lvbiByZXByZXNlbnRpbmcgdGhlIHRva2VuIG9yIHZhbHVlIHRvIGJlIGluamVjdGVkLlxuICAgKi9cbiAgdG9rZW46IG8uRXhwcmVzc2lvbjtcblxuICAvKipcbiAgICogSWYgYW4gQEF0dHJpYnV0ZSBkZWNvcmF0b3IgaXMgcHJlc2VudCwgdGhpcyBpcyB0aGUgbGl0ZXJhbCB0eXBlIG9mIHRoZSBhdHRyaWJ1dGUgbmFtZSwgb3JcbiAgICogdGhlIHVua25vd24gdHlwZSBpZiBubyBsaXRlcmFsIHR5cGUgaXMgYXZhaWxhYmxlIChlLmcuIHRoZSBhdHRyaWJ1dGUgbmFtZSBpcyBhbiBleHByZXNzaW9uKS5cbiAgICogV2lsbCBiZSBudWxsIG90aGVyd2lzZS5cbiAgICovXG4gIGF0dHJpYnV0ZTogby5FeHByZXNzaW9ufG51bGw7XG5cbiAgLyoqXG4gICAqIEFuIGVudW0gaW5kaWNhdGluZyB3aGV0aGVyIHRoaXMgZGVwZW5kZW5jeSBoYXMgc3BlY2lhbCBtZWFuaW5nIHRvIEFuZ3VsYXIgYW5kIG5lZWRzIHRvIGJlXG4gICAqIGluamVjdGVkIHNwZWNpYWxseS5cbiAgICovXG4gIHJlc29sdmVkOiBSM1Jlc29sdmVkRGVwZW5kZW5jeVR5cGU7XG5cbiAgLyoqXG4gICAqIFdoZXRoZXIgdGhlIGRlcGVuZGVuY3kgaGFzIGFuIEBIb3N0IHF1YWxpZmllci5cbiAgICovXG4gIGhvc3Q6IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIFdoZXRoZXIgdGhlIGRlcGVuZGVuY3kgaGFzIGFuIEBPcHRpb25hbCBxdWFsaWZpZXIuXG4gICAqL1xuICBvcHRpb25hbDogYm9vbGVhbjtcblxuICAvKipcbiAgICogV2hldGhlciB0aGUgZGVwZW5kZW5jeSBoYXMgYW4gQFNlbGYgcXVhbGlmaWVyLlxuICAgKi9cbiAgc2VsZjogYm9vbGVhbjtcblxuICAvKipcbiAgICogV2hldGhlciB0aGUgZGVwZW5kZW5jeSBoYXMgYW4gQFNraXBTZWxmIHF1YWxpZmllci5cbiAgICovXG4gIHNraXBTZWxmOiBib29sZWFuO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIFIzRmFjdG9yeUZuIHtcbiAgZmFjdG9yeTogby5FeHByZXNzaW9uO1xuICBzdGF0ZW1lbnRzOiBvLlN0YXRlbWVudFtdO1xuICB0eXBlOiBvLkV4cHJlc3Npb25UeXBlO1xufVxuXG4vKipcbiAqIENvbnN0cnVjdCBhIGZhY3RvcnkgZnVuY3Rpb24gZXhwcmVzc2lvbiBmb3IgdGhlIGdpdmVuIGBSM0ZhY3RvcnlNZXRhZGF0YWAuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBjb21waWxlRmFjdG9yeUZ1bmN0aW9uKG1ldGE6IFIzRmFjdG9yeU1ldGFkYXRhKTogUjNGYWN0b3J5Rm4ge1xuICBjb25zdCB0ID0gby52YXJpYWJsZSgndCcpO1xuICBjb25zdCBzdGF0ZW1lbnRzOiBvLlN0YXRlbWVudFtdID0gW107XG4gIGxldCBjdG9yRGVwc1R5cGU6IG8uVHlwZSA9IG8uTk9ORV9UWVBFO1xuXG4gIC8vIFRoZSB0eXBlIHRvIGluc3RhbnRpYXRlIHZpYSBjb25zdHJ1Y3RvciBpbnZvY2F0aW9uLiBJZiB0aGVyZSBpcyBubyBkZWxlZ2F0ZWQgZmFjdG9yeSwgbWVhbmluZ1xuICAvLyB0aGlzIHR5cGUgaXMgYWx3YXlzIGNyZWF0ZWQgYnkgY29uc3RydWN0b3IgaW52b2NhdGlvbiwgdGhlbiB0aGlzIGlzIHRoZSB0eXBlLXRvLWNyZWF0ZVxuICAvLyBwYXJhbWV0ZXIgcHJvdmlkZWQgYnkgdGhlIHVzZXIgKHQpIGlmIHNwZWNpZmllZCwgb3IgdGhlIGN1cnJlbnQgdHlwZSBpZiBub3QuIElmIHRoZXJlIGlzIGFcbiAgLy8gZGVsZWdhdGVkIGZhY3RvcnkgKHdoaWNoIGlzIHVzZWQgdG8gY3JlYXRlIHRoZSBjdXJyZW50IHR5cGUpIHRoZW4gdGhpcyBpcyBvbmx5IHRoZSB0eXBlLXRvLVxuICAvLyBjcmVhdGUgcGFyYW1ldGVyICh0KS5cbiAgY29uc3QgdHlwZUZvckN0b3IgPSAhaXNEZWxlZ2F0ZWRNZXRhZGF0YShtZXRhKSA/XG4gICAgICBuZXcgby5CaW5hcnlPcGVyYXRvckV4cHIoby5CaW5hcnlPcGVyYXRvci5PciwgdCwgbWV0YS5pbnRlcm5hbFR5cGUpIDpcbiAgICAgIHQ7XG5cbiAgbGV0IGN0b3JFeHByOiBvLkV4cHJlc3Npb258bnVsbCA9IG51bGw7XG4gIGlmIChtZXRhLmRlcHMgIT09IG51bGwpIHtcbiAgICAvLyBUaGVyZSBpcyBhIGNvbnN0cnVjdG9yIChlaXRoZXIgZXhwbGljaXRseSBvciBpbXBsaWNpdGx5IGRlZmluZWQpLlxuICAgIGlmIChtZXRhLmRlcHMgIT09ICdpbnZhbGlkJykge1xuICAgICAgY3RvckV4cHIgPSBuZXcgby5JbnN0YW50aWF0ZUV4cHIoXG4gICAgICAgICAgdHlwZUZvckN0b3IsXG4gICAgICAgICAgaW5qZWN0RGVwZW5kZW5jaWVzKG1ldGEuZGVwcywgbWV0YS5pbmplY3RGbiwgbWV0YS50YXJnZXQgPT09IFIzRmFjdG9yeVRhcmdldC5QaXBlKSk7XG5cbiAgICAgIGN0b3JEZXBzVHlwZSA9IGNyZWF0ZUN0b3JEZXBzVHlwZShtZXRhLmRlcHMpO1xuICAgIH1cbiAgfSBlbHNlIHtcbiAgICBjb25zdCBiYXNlRmFjdG9yeSA9IG8udmFyaWFibGUoYMm1JHttZXRhLm5hbWV9X0Jhc2VGYWN0b3J5YCk7XG4gICAgY29uc3QgZ2V0SW5oZXJpdGVkRmFjdG9yeSA9IG8uaW1wb3J0RXhwcihSMy5nZXRJbmhlcml0ZWRGYWN0b3J5KTtcbiAgICBjb25zdCBiYXNlRmFjdG9yeVN0bXQgPVxuICAgICAgICBiYXNlRmFjdG9yeS5zZXQoZ2V0SW5oZXJpdGVkRmFjdG9yeS5jYWxsRm4oW21ldGEuaW50ZXJuYWxUeXBlXSkpXG4gICAgICAgICAgICAudG9EZWNsU3RtdChvLklORkVSUkVEX1RZUEUsIFtvLlN0bXRNb2RpZmllci5FeHBvcnRlZCwgby5TdG10TW9kaWZpZXIuRmluYWxdKTtcbiAgICBzdGF0ZW1lbnRzLnB1c2goYmFzZUZhY3RvcnlTdG10KTtcblxuICAgIC8vIFRoZXJlIGlzIG5vIGNvbnN0cnVjdG9yLCB1c2UgdGhlIGJhc2UgY2xhc3MnIGZhY3RvcnkgdG8gY29uc3RydWN0IHR5cGVGb3JDdG9yLlxuICAgIGN0b3JFeHByID0gYmFzZUZhY3RvcnkuY2FsbEZuKFt0eXBlRm9yQ3Rvcl0pO1xuICB9XG4gIGNvbnN0IGN0b3JFeHByRmluYWwgPSBjdG9yRXhwcjtcblxuICBjb25zdCBib2R5OiBvLlN0YXRlbWVudFtdID0gW107XG4gIGxldCByZXRFeHByOiBvLkV4cHJlc3Npb258bnVsbCA9IG51bGw7XG5cbiAgZnVuY3Rpb24gbWFrZUNvbmRpdGlvbmFsRmFjdG9yeShub25DdG9yRXhwcjogby5FeHByZXNzaW9uKTogby5SZWFkVmFyRXhwciB7XG4gICAgY29uc3QgciA9IG8udmFyaWFibGUoJ3InKTtcbiAgICBib2R5LnB1c2goci5zZXQoby5OVUxMX0VYUFIpLnRvRGVjbFN0bXQoKSk7XG4gICAgbGV0IGN0b3JTdG10OiBvLlN0YXRlbWVudHxudWxsID0gbnVsbDtcbiAgICBpZiAoY3RvckV4cHJGaW5hbCAhPT0gbnVsbCkge1xuICAgICAgY3RvclN0bXQgPSByLnNldChjdG9yRXhwckZpbmFsKS50b1N0bXQoKTtcbiAgICB9IGVsc2Uge1xuICAgICAgY3RvclN0bXQgPSBvLmltcG9ydEV4cHIoUjMuaW52YWxpZEZhY3RvcnkpLmNhbGxGbihbXSkudG9TdG10KCk7XG4gICAgfVxuICAgIGJvZHkucHVzaChvLmlmU3RtdCh0LCBbY3RvclN0bXRdLCBbci5zZXQobm9uQ3RvckV4cHIpLnRvU3RtdCgpXSkpO1xuICAgIHJldHVybiByO1xuICB9XG5cbiAgaWYgKGlzRGVsZWdhdGVkTWV0YWRhdGEobWV0YSkgJiYgbWV0YS5kZWxlZ2F0ZVR5cGUgPT09IFIzRmFjdG9yeURlbGVnYXRlVHlwZS5GYWN0b3J5KSB7XG4gICAgY29uc3QgZGVsZWdhdGVGYWN0b3J5ID0gby52YXJpYWJsZShgybUke21ldGEubmFtZX1fQmFzZUZhY3RvcnlgKTtcbiAgICBjb25zdCBnZXRGYWN0b3J5T2YgPSBvLmltcG9ydEV4cHIoUjMuZ2V0RmFjdG9yeU9mKTtcbiAgICBpZiAobWV0YS5kZWxlZ2F0ZS5pc0VxdWl2YWxlbnQobWV0YS5pbnRlcm5hbFR5cGUpKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYElsbGVnYWwgc3RhdGU6IGNvbXBpbGluZyBmYWN0b3J5IHRoYXQgZGVsZWdhdGVzIHRvIGl0c2VsZmApO1xuICAgIH1cbiAgICBjb25zdCBkZWxlZ2F0ZUZhY3RvcnlTdG10ID1cbiAgICAgICAgZGVsZWdhdGVGYWN0b3J5LnNldChnZXRGYWN0b3J5T2YuY2FsbEZuKFttZXRhLmRlbGVnYXRlXSkpLnRvRGVjbFN0bXQoby5JTkZFUlJFRF9UWVBFLCBbXG4gICAgICAgICAgby5TdG10TW9kaWZpZXIuRXhwb3J0ZWQsIG8uU3RtdE1vZGlmaWVyLkZpbmFsXG4gICAgICAgIF0pO1xuXG4gICAgc3RhdGVtZW50cy5wdXNoKGRlbGVnYXRlRmFjdG9yeVN0bXQpO1xuICAgIHJldEV4cHIgPSBtYWtlQ29uZGl0aW9uYWxGYWN0b3J5KGRlbGVnYXRlRmFjdG9yeS5jYWxsRm4oW10pKTtcbiAgfSBlbHNlIGlmIChpc0RlbGVnYXRlZE1ldGFkYXRhKG1ldGEpKSB7XG4gICAgLy8gVGhpcyB0eXBlIGlzIGNyZWF0ZWQgd2l0aCBhIGRlbGVnYXRlZCBmYWN0b3J5LiBJZiBhIHR5cGUgcGFyYW1ldGVyIGlzIG5vdCBzcGVjaWZpZWQsIGNhbGxcbiAgICAvLyB0aGUgZmFjdG9yeSBpbnN0ZWFkLlxuICAgIGNvbnN0IGRlbGVnYXRlQXJncyA9XG4gICAgICAgIGluamVjdERlcGVuZGVuY2llcyhtZXRhLmRlbGVnYXRlRGVwcywgbWV0YS5pbmplY3RGbiwgbWV0YS50YXJnZXQgPT09IFIzRmFjdG9yeVRhcmdldC5QaXBlKTtcbiAgICAvLyBFaXRoZXIgY2FsbCBgbmV3IGRlbGVnYXRlKC4uLilgIG9yIGBkZWxlZ2F0ZSguLi4pYCBkZXBlbmRpbmcgb24gbWV0YS5kZWxlZ2F0ZVR5cGUuXG4gICAgY29uc3QgZmFjdG9yeUV4cHIgPSBuZXcgKFxuICAgICAgICBtZXRhLmRlbGVnYXRlVHlwZSA9PT0gUjNGYWN0b3J5RGVsZWdhdGVUeXBlLkNsYXNzID9cbiAgICAgICAgICAgIG8uSW5zdGFudGlhdGVFeHByIDpcbiAgICAgICAgICAgIG8uSW52b2tlRnVuY3Rpb25FeHByKShtZXRhLmRlbGVnYXRlLCBkZWxlZ2F0ZUFyZ3MpO1xuICAgIHJldEV4cHIgPSBtYWtlQ29uZGl0aW9uYWxGYWN0b3J5KGZhY3RvcnlFeHByKTtcbiAgfSBlbHNlIGlmIChpc0V4cHJlc3Npb25GYWN0b3J5TWV0YWRhdGEobWV0YSkpIHtcbiAgICAvLyBUT0RPKGFseGh1Yik6IGRlY2lkZSB3aGV0aGVyIHRvIGxvd2VyIHRoZSB2YWx1ZSBoZXJlIG9yIGluIHRoZSBjYWxsZXJcbiAgICByZXRFeHByID0gbWFrZUNvbmRpdGlvbmFsRmFjdG9yeShtZXRhLmV4cHJlc3Npb24pO1xuICB9IGVsc2Uge1xuICAgIHJldEV4cHIgPSBjdG9yRXhwcjtcbiAgfVxuXG4gIGlmIChyZXRFeHByICE9PSBudWxsKSB7XG4gICAgYm9keS5wdXNoKG5ldyBvLlJldHVyblN0YXRlbWVudChyZXRFeHByKSk7XG4gIH0gZWxzZSB7XG4gICAgYm9keS5wdXNoKG8uaW1wb3J0RXhwcihSMy5pbnZhbGlkRmFjdG9yeSkuY2FsbEZuKFtdKS50b1N0bXQoKSk7XG4gIH1cblxuICByZXR1cm4ge1xuICAgIGZhY3Rvcnk6IG8uZm4oXG4gICAgICAgIFtuZXcgby5GblBhcmFtKCd0Jywgby5EWU5BTUlDX1RZUEUpXSwgYm9keSwgby5JTkZFUlJFRF9UWVBFLCB1bmRlZmluZWQsXG4gICAgICAgIGAke21ldGEubmFtZX1fRmFjdG9yeWApLFxuICAgIHN0YXRlbWVudHMsXG4gICAgdHlwZTogby5leHByZXNzaW9uVHlwZShvLmltcG9ydEV4cHIoXG4gICAgICAgIFIzLkZhY3RvcnlEZWYsIFt0eXBlV2l0aFBhcmFtZXRlcnMobWV0YS50eXBlLnR5cGUsIG1ldGEudHlwZUFyZ3VtZW50Q291bnQpLCBjdG9yRGVwc1R5cGVdKSlcbiAgfTtcbn1cblxuZnVuY3Rpb24gaW5qZWN0RGVwZW5kZW5jaWVzKFxuICAgIGRlcHM6IFIzRGVwZW5kZW5jeU1ldGFkYXRhW10sIGluamVjdEZuOiBvLkV4dGVybmFsUmVmZXJlbmNlLCBpc1BpcGU6IGJvb2xlYW4pOiBvLkV4cHJlc3Npb25bXSB7XG4gIHJldHVybiBkZXBzLm1hcCgoZGVwLCBpbmRleCkgPT4gY29tcGlsZUluamVjdERlcGVuZGVuY3koZGVwLCBpbmplY3RGbiwgaXNQaXBlLCBpbmRleCkpO1xufVxuXG5mdW5jdGlvbiBjb21waWxlSW5qZWN0RGVwZW5kZW5jeShcbiAgICBkZXA6IFIzRGVwZW5kZW5jeU1ldGFkYXRhLCBpbmplY3RGbjogby5FeHRlcm5hbFJlZmVyZW5jZSwgaXNQaXBlOiBib29sZWFuLFxuICAgIGluZGV4OiBudW1iZXIpOiBvLkV4cHJlc3Npb24ge1xuICAvLyBJbnRlcnByZXQgdGhlIGRlcGVuZGVuY3kgYWNjb3JkaW5nIHRvIGl0cyByZXNvbHZlZCB0eXBlLlxuICBzd2l0Y2ggKGRlcC5yZXNvbHZlZCkge1xuICAgIGNhc2UgUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLlRva2VuOlxuICAgIGNhc2UgUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLkNoYW5nZURldGVjdG9yUmVmOlxuICAgICAgLy8gQnVpbGQgdXAgdGhlIGluamVjdGlvbiBmbGFncyBhY2NvcmRpbmcgdG8gdGhlIG1ldGFkYXRhLlxuICAgICAgY29uc3QgZmxhZ3MgPSBJbmplY3RGbGFncy5EZWZhdWx0IHwgKGRlcC5zZWxmID8gSW5qZWN0RmxhZ3MuU2VsZiA6IDApIHxcbiAgICAgICAgICAoZGVwLnNraXBTZWxmID8gSW5qZWN0RmxhZ3MuU2tpcFNlbGYgOiAwKSB8IChkZXAuaG9zdCA/IEluamVjdEZsYWdzLkhvc3QgOiAwKSB8XG4gICAgICAgICAgKGRlcC5vcHRpb25hbCA/IEluamVjdEZsYWdzLk9wdGlvbmFsIDogMCk7XG5cbiAgICAgIC8vIElmIHRoaXMgZGVwZW5kZW5jeSBpcyBvcHRpb25hbCBvciBvdGhlcndpc2UgaGFzIG5vbi1kZWZhdWx0IGZsYWdzLCB0aGVuIGFkZGl0aW9uYWxcbiAgICAgIC8vIHBhcmFtZXRlcnMgZGVzY3JpYmluZyBob3cgdG8gaW5qZWN0IHRoZSBkZXBlbmRlbmN5IG11c3QgYmUgcGFzc2VkIHRvIHRoZSBpbmplY3QgZnVuY3Rpb25cbiAgICAgIC8vIHRoYXQncyBiZWluZyB1c2VkLlxuICAgICAgbGV0IGZsYWdzUGFyYW06IG8uTGl0ZXJhbEV4cHJ8bnVsbCA9XG4gICAgICAgICAgKGZsYWdzICE9PSBJbmplY3RGbGFncy5EZWZhdWx0IHx8IGRlcC5vcHRpb25hbCkgPyBvLmxpdGVyYWwoZmxhZ3MpIDogbnVsbDtcblxuICAgICAgLy8gV2UgaGF2ZSBhIHNlcGFyYXRlIGluc3RydWN0aW9uIGZvciBpbmplY3RpbmcgQ2hhbmdlRGV0ZWN0b3JSZWYgaW50byBhIHBpcGUuXG4gICAgICBpZiAoaXNQaXBlICYmIGRlcC5yZXNvbHZlZCA9PT0gUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLkNoYW5nZURldGVjdG9yUmVmKSB7XG4gICAgICAgIHJldHVybiBvLmltcG9ydEV4cHIoUjMuaW5qZWN0UGlwZUNoYW5nZURldGVjdG9yUmVmKS5jYWxsRm4oZmxhZ3NQYXJhbSA/IFtmbGFnc1BhcmFtXSA6IFtdKTtcbiAgICAgIH1cblxuICAgICAgLy8gQnVpbGQgdXAgdGhlIGFyZ3VtZW50cyB0byB0aGUgaW5qZWN0Rm4gY2FsbC5cbiAgICAgIGNvbnN0IGluamVjdEFyZ3MgPSBbZGVwLnRva2VuXTtcbiAgICAgIGlmIChmbGFnc1BhcmFtKSB7XG4gICAgICAgIGluamVjdEFyZ3MucHVzaChmbGFnc1BhcmFtKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBvLmltcG9ydEV4cHIoaW5qZWN0Rm4pLmNhbGxGbihpbmplY3RBcmdzKTtcbiAgICBjYXNlIFIzUmVzb2x2ZWREZXBlbmRlbmN5VHlwZS5BdHRyaWJ1dGU6XG4gICAgICAvLyBJbiB0aGUgY2FzZSBvZiBhdHRyaWJ1dGVzLCB0aGUgYXR0cmlidXRlIG5hbWUgaW4gcXVlc3Rpb24gaXMgZ2l2ZW4gYXMgdGhlIHRva2VuLlxuICAgICAgcmV0dXJuIG8uaW1wb3J0RXhwcihSMy5pbmplY3RBdHRyaWJ1dGUpLmNhbGxGbihbZGVwLnRva2VuXSk7XG4gICAgY2FzZSBSM1Jlc29sdmVkRGVwZW5kZW5jeVR5cGUuSW52YWxpZDpcbiAgICAgIHJldHVybiBvLmltcG9ydEV4cHIoUjMuaW52YWxpZEZhY3RvcnlEZXApLmNhbGxGbihbby5saXRlcmFsKGluZGV4KV0pO1xuICAgIGRlZmF1bHQ6XG4gICAgICByZXR1cm4gdW5zdXBwb3J0ZWQoXG4gICAgICAgICAgYFVua25vd24gUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlOiAke1IzUmVzb2x2ZWREZXBlbmRlbmN5VHlwZVtkZXAucmVzb2x2ZWRdfWApO1xuICB9XG59XG5cbmZ1bmN0aW9uIGNyZWF0ZUN0b3JEZXBzVHlwZShkZXBzOiBSM0RlcGVuZGVuY3lNZXRhZGF0YVtdKTogby5UeXBlIHtcbiAgbGV0IGhhc1R5cGVzID0gZmFsc2U7XG4gIGNvbnN0IGF0dHJpYnV0ZVR5cGVzID0gZGVwcy5tYXAoZGVwID0+IHtcbiAgICBjb25zdCB0eXBlID0gY3JlYXRlQ3RvckRlcFR5cGUoZGVwKTtcbiAgICBpZiAodHlwZSAhPT0gbnVsbCkge1xuICAgICAgaGFzVHlwZXMgPSB0cnVlO1xuICAgICAgcmV0dXJuIHR5cGU7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBvLmxpdGVyYWwobnVsbCk7XG4gICAgfVxuICB9KTtcblxuICBpZiAoaGFzVHlwZXMpIHtcbiAgICByZXR1cm4gby5leHByZXNzaW9uVHlwZShvLmxpdGVyYWxBcnIoYXR0cmlidXRlVHlwZXMpKTtcbiAgfSBlbHNlIHtcbiAgICByZXR1cm4gby5OT05FX1RZUEU7XG4gIH1cbn1cblxuZnVuY3Rpb24gY3JlYXRlQ3RvckRlcFR5cGUoZGVwOiBSM0RlcGVuZGVuY3lNZXRhZGF0YSk6IG8uTGl0ZXJhbE1hcEV4cHJ8bnVsbCB7XG4gIGNvbnN0IGVudHJpZXM6IHtrZXk6IHN0cmluZywgcXVvdGVkOiBib29sZWFuLCB2YWx1ZTogby5FeHByZXNzaW9ufVtdID0gW107XG5cbiAgaWYgKGRlcC5yZXNvbHZlZCA9PT0gUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLkF0dHJpYnV0ZSkge1xuICAgIGlmIChkZXAuYXR0cmlidXRlICE9PSBudWxsKSB7XG4gICAgICBlbnRyaWVzLnB1c2goe2tleTogJ2F0dHJpYnV0ZScsIHZhbHVlOiBkZXAuYXR0cmlidXRlLCBxdW90ZWQ6IGZhbHNlfSk7XG4gICAgfVxuICB9XG4gIGlmIChkZXAub3B0aW9uYWwpIHtcbiAgICBlbnRyaWVzLnB1c2goe2tleTogJ29wdGlvbmFsJywgdmFsdWU6IG8ubGl0ZXJhbCh0cnVlKSwgcXVvdGVkOiBmYWxzZX0pO1xuICB9XG4gIGlmIChkZXAuaG9zdCkge1xuICAgIGVudHJpZXMucHVzaCh7a2V5OiAnaG9zdCcsIHZhbHVlOiBvLmxpdGVyYWwodHJ1ZSksIHF1b3RlZDogZmFsc2V9KTtcbiAgfVxuICBpZiAoZGVwLnNlbGYpIHtcbiAgICBlbnRyaWVzLnB1c2goe2tleTogJ3NlbGYnLCB2YWx1ZTogby5saXRlcmFsKHRydWUpLCBxdW90ZWQ6IGZhbHNlfSk7XG4gIH1cbiAgaWYgKGRlcC5za2lwU2VsZikge1xuICAgIGVudHJpZXMucHVzaCh7a2V5OiAnc2tpcFNlbGYnLCB2YWx1ZTogby5saXRlcmFsKHRydWUpLCBxdW90ZWQ6IGZhbHNlfSk7XG4gIH1cblxuICByZXR1cm4gZW50cmllcy5sZW5ndGggPiAwID8gby5saXRlcmFsTWFwKGVudHJpZXMpIDogbnVsbDtcbn1cblxuLyoqXG4gKiBBIGhlbHBlciBmdW5jdGlvbiB1c2VmdWwgZm9yIGV4dHJhY3RpbmcgYFIzRGVwZW5kZW5jeU1ldGFkYXRhYCBmcm9tIGEgUmVuZGVyMlxuICogYENvbXBpbGVUeXBlTWV0YWRhdGFgIGluc3RhbmNlLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZGVwZW5kZW5jaWVzRnJvbUdsb2JhbE1ldGFkYXRhKFxuICAgIHR5cGU6IENvbXBpbGVUeXBlTWV0YWRhdGEsIG91dHB1dEN0eDogT3V0cHV0Q29udGV4dCxcbiAgICByZWZsZWN0b3I6IENvbXBpbGVSZWZsZWN0b3IpOiBSM0RlcGVuZGVuY3lNZXRhZGF0YVtdIHtcbiAgLy8gVXNlIHRoZSBgQ29tcGlsZVJlZmxlY3RvcmAgdG8gbG9vayB1cCByZWZlcmVuY2VzIHRvIHNvbWUgd2VsbC1rbm93biBBbmd1bGFyIHR5cGVzLiBUaGVzZSB3aWxsXG4gIC8vIGJlIGNvbXBhcmVkIHdpdGggdGhlIHRva2VuIHRvIHN0YXRpY2FsbHkgZGV0ZXJtaW5lIHdoZXRoZXIgdGhlIHRva2VuIGhhcyBzaWduaWZpY2FuY2UgdG9cbiAgLy8gQW5ndWxhciwgYW5kIHNldCB0aGUgY29ycmVjdCBgUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlYCBhcyBhIHJlc3VsdC5cbiAgY29uc3QgaW5qZWN0b3JSZWYgPSByZWZsZWN0b3IucmVzb2x2ZUV4dGVybmFsUmVmZXJlbmNlKElkZW50aWZpZXJzLkluamVjdG9yKTtcblxuICAvLyBJdGVyYXRlIHRocm91Z2ggdGhlIHR5cGUncyBESSBkZXBlbmRlbmNpZXMgYW5kIHByb2R1Y2UgYFIzRGVwZW5kZW5jeU1ldGFkYXRhYCBmb3IgZWFjaCBvZiB0aGVtLlxuICBjb25zdCBkZXBzOiBSM0RlcGVuZGVuY3lNZXRhZGF0YVtdID0gW107XG4gIGZvciAobGV0IGRlcGVuZGVuY3kgb2YgdHlwZS5kaURlcHMpIHtcbiAgICBpZiAoZGVwZW5kZW5jeS50b2tlbikge1xuICAgICAgY29uc3QgdG9rZW5SZWYgPSB0b2tlblJlZmVyZW5jZShkZXBlbmRlbmN5LnRva2VuKTtcbiAgICAgIGxldCByZXNvbHZlZDogUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlID0gZGVwZW5kZW5jeS5pc0F0dHJpYnV0ZSA/XG4gICAgICAgICAgUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLkF0dHJpYnV0ZSA6XG4gICAgICAgICAgUjNSZXNvbHZlZERlcGVuZGVuY3lUeXBlLlRva2VuO1xuXG4gICAgICAvLyBJbiB0aGUgY2FzZSBvZiBtb3N0IGRlcGVuZGVuY2llcywgdGhlIHRva2VuIHdpbGwgYmUgYSByZWZlcmVuY2UgdG8gYSB0eXBlLiBTb21ldGltZXMsXG4gICAgICAvLyBob3dldmVyLCBpdCBjYW4gYmUgYSBzdHJpbmcsIGluIHRoZSBjYXNlIG9mIG9sZGVyIEFuZ3VsYXIgY29kZSBvciBAQXR0cmlidXRlIGluamVjdGlvbi5cbiAgICAgIGNvbnN0IHRva2VuID1cbiAgICAgICAgICB0b2tlblJlZiBpbnN0YW5jZW9mIFN0YXRpY1N5bWJvbCA/IG91dHB1dEN0eC5pbXBvcnRFeHByKHRva2VuUmVmKSA6IG8ubGl0ZXJhbCh0b2tlblJlZik7XG5cbiAgICAgIC8vIENvbnN0cnVjdCB0aGUgZGVwZW5kZW5jeS5cbiAgICAgIGRlcHMucHVzaCh7XG4gICAgICAgIHRva2VuLFxuICAgICAgICBhdHRyaWJ1dGU6IG51bGwsXG4gICAgICAgIHJlc29sdmVkLFxuICAgICAgICBob3N0OiAhIWRlcGVuZGVuY3kuaXNIb3N0LFxuICAgICAgICBvcHRpb25hbDogISFkZXBlbmRlbmN5LmlzT3B0aW9uYWwsXG4gICAgICAgIHNlbGY6ICEhZGVwZW5kZW5jeS5pc1NlbGYsXG4gICAgICAgIHNraXBTZWxmOiAhIWRlcGVuZGVuY3kuaXNTa2lwU2VsZixcbiAgICAgIH0pO1xuICAgIH0gZWxzZSB7XG4gICAgICB1bnN1cHBvcnRlZCgnZGVwZW5kZW5jeSB3aXRob3V0IGEgdG9rZW4nKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gZGVwcztcbn1cblxuZnVuY3Rpb24gaXNEZWxlZ2F0ZWRNZXRhZGF0YShtZXRhOiBSM0ZhY3RvcnlNZXRhZGF0YSk6IG1ldGEgaXMgUjNEZWxlZ2F0ZWRGYWN0b3J5TWV0YWRhdGF8XG4gICAgUjNEZWxlZ2F0ZWRGbk9yQ2xhc3NNZXRhZGF0YSB7XG4gIHJldHVybiAobWV0YSBhcyBhbnkpLmRlbGVnYXRlVHlwZSAhPT0gdW5kZWZpbmVkO1xufVxuXG5mdW5jdGlvbiBpc0V4cHJlc3Npb25GYWN0b3J5TWV0YWRhdGEobWV0YTogUjNGYWN0b3J5TWV0YWRhdGEpOiBtZXRhIGlzIFIzRXhwcmVzc2lvbkZhY3RvcnlNZXRhZGF0YSB7XG4gIHJldHVybiAobWV0YSBhcyBhbnkpLmV4cHJlc3Npb24gIT09IHVuZGVmaW5lZDtcbn1cbiJdfQ== |
import unittest
from conans.test.utils.tools import TestClient, TestServer
from collections import OrderedDict
from conans.util.files import load
class RemoteTest(unittest.TestCase):
def setUp(self):
self.servers = OrderedDict()
self.users = {}
for i in range(3):
test_server = TestServer()
self.servers["remote%d" % i] = test_server
self.users["remote%d" % i] = [("lasote", "mypass")]
self.client = TestClient(servers=self.servers, users=self.users)
def basic_test(self):
self.client.run("remote list")
self.assertIn("remote0: http://", self.client.user_io.out)
self.assertIn("remote1: http://", self.client.user_io.out)
self.assertIn("remote2: http://", self.client.user_io.out)
self.client.run("remote add origin https://myurl")
self.client.run("remote list")
lines = str(self.client.user_io.out).splitlines()
self.assertIn("origin: https://myurl", lines[3])
self.client.run("remote update origin https://2myurl")
self.client.run("remote list")
self.assertIn("origin: https://2myurl", self.client.user_io.out)
self.client.run("remote update remote0 https://remote0url")
self.client.run("remote list")
output = str(self.client.user_io.out)
self.assertIn("remote0: https://remote0url", output.splitlines()[0])
self.client.run("remote remove remote0")
self.client.run("remote list")
output = str(self.client.user_io.out)
self.assertIn("remote1: http://", output.splitlines()[0])
def add_force_test(self):
client = TestClient()
client.run("remote add r1 https://r1")
client.run("remote add r2 https://r2")
client.run("remote add r3 https://r3")
client.run("remote add_ref Hello/0.1@user/testing r2")
client.run("remote add_ref Hello2/0.1@user/testing r1")
client.run("remote add r4 https://r4 -f")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r1: https://r1", lines[0])
self.assertIn("r2: https://r2", lines[1])
self.assertIn("r3: https://r3", lines[2])
self.assertIn("r4: https://r4", lines[3])
client.run("remote add r2 https://newr2 -f")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r1: https://r1", lines[0])
self.assertIn("r3: https://r3", lines[1])
self.assertIn("r4: https://r4", lines[2])
self.assertIn("r2: https://newr2", lines[3])
client.run("remote add newr1 https://r1 -f")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r3: https://r3", lines[0])
self.assertIn("r4: https://r4", lines[1])
self.assertIn("r2: https://newr2", lines[2])
self.assertIn("newr1: https://r1", lines[3])
client.run("remote list_ref")
self.assertIn("Hello2/0.1@user/testing: newr1", client.out)
self.assertIn("Hello/0.1@user/testing: r2", client.out)
client.run("remote add newr1 https://newr1 -f -i")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("newr1: https://newr1", lines[0])
self.assertIn("r3: https://r3", lines[1])
self.assertIn("r4: https://r4", lines[2])
self.assertIn("r2: https://newr2", lines[3])
def rename_test(self):
client = TestClient()
client.run("remote add r1 https://r1")
client.run("remote add r2 https://r2")
client.run("remote add r3 https://r3")
client.run("remote add_ref Hello/0.1@user/testing r2")
client.run("remote rename r2 mynewr2")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r1: https://r1", lines[0])
self.assertIn("mynewr2: https://r2", lines[1])
self.assertIn("r3: https://r3", lines[2])
client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: mynewr2", client.out)
def insert_test(self):
self.client.run("remote add origin https://myurl --insert")
self.client.run("remote list")
first_line = str(self.client.user_io.out).splitlines()[0]
self.assertIn("origin: https://myurl", first_line)
self.client.run("remote add origin2 https://myurl2 --insert=0")
self.client.run("remote list")
lines = str(self.client.user_io.out).splitlines()
self.assertIn("origin2: https://myurl2", lines[0])
self.assertIn("origin: https://myurl", lines[1])
self.client.run("remote add origin3 https://myurl3 --insert=1")
self.client.run("remote list")
lines = str(self.client.user_io.out).splitlines()
self.assertIn("origin2: https://myurl2", lines[0])
self.assertIn("origin3: https://myurl3", lines[1])
self.assertIn("origin: https://myurl", lines[2])
def update_test_insert(self):
client = TestClient()
client.run("remote add r1 https://r1")
client.run("remote add r2 https://r2")
client.run("remote add r3 https://r3")
client.run("remote update r2 https://r2new --insert")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r2: https://r2new", lines[0])
self.assertIn("r1: https://r1", lines[1])
self.assertIn("r3: https://r3", lines[2])
client.run("remote update r2 https://r2new2 --insert 2")
client.run("remote list")
lines = str(client.user_io.out).splitlines()
self.assertIn("r1: https://r1", lines[0])
self.assertIn("r3: https://r3", lines[1])
self.assertIn("r2: https://r2new2", lines[2])
def verify_ssl_test(self):
client = TestClient()
client.run("remote add my-remote http://someurl TRUE")
client.run("remote add my-remote2 http://someurl2 yes")
client.run("remote add my-remote3 http://someurl3 FALse")
client.run("remote add my-remote4 http://someurl4 No")
registry = load(client.client_cache.registry)
self.assertIn("my-remote http://someurl True", registry)
self.assertIn("my-remote2 http://someurl2 True", registry)
self.assertIn("my-remote3 http://someurl3 False", registry)
self.assertIn("my-remote4 http://someurl4 False", registry)
def verify_ssl_error_test(self):
client = TestClient()
error = client.run("remote add my-remote http://someurl some_invalid_option=foo",
ignore_error=True)
self.assertTrue(error)
self.assertIn("ERROR: Unrecognized boolean value 'some_invalid_option=foo'",
client.user_io.out)
self.assertEqual("", load(client.client_cache.registry))
def errors_test(self):
self.client.run("remote update origin url", ignore_error=True)
self.assertIn("ERROR: Remote 'origin' not found in remotes", self.client.user_io.out)
self.client.run("remote remove origin", ignore_error=True)
self.assertIn("ERROR: Remote 'origin' not found in remotes", self.client.user_io.out)
def duplicated_error_tests(self):
""" check remote name and URL are not duplicated
"""
error = self.client.run("remote add remote1 http://otherurl", ignore_error=True)
self.assertTrue(error)
self.assertIn("ERROR: Remote 'remote1' already exists in remotes (use update to modify)",
self.client.user_io.out)
self.client.run("remote list")
url = str(self.client.user_io.out).split()[1]
error = self.client.run("remote add newname %s" % url, ignore_error=True)
self.assertTrue(error)
self.assertIn("Remote 'remote0' already exists with same URL",
self.client.user_io.out)
error = self.client.run("remote update remote1 %s" % url, ignore_error=True)
self.assertTrue(error)
self.assertIn("Remote 'remote0' already exists with same URL",
self.client.user_io.out)
def basic_refs_test(self):
self.client.run("remote add_ref Hello/0.1@user/testing remote0")
self.client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: remote0", self.client.user_io.out)
self.client.run("remote add_ref Hello1/0.1@user/testing remote1")
self.client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: remote0", self.client.user_io.out)
self.assertIn("Hello1/0.1@user/testing: remote1", self.client.user_io.out)
self.client.run("remote remove_ref Hello1/0.1@user/testing")
self.client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: remote0", self.client.user_io.out)
self.assertNotIn("Hello1/0.1@user/testing", self.client.user_io.out)
self.client.run("remote add_ref Hello1/0.1@user/testing remote1")
self.client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: remote0", self.client.user_io.out)
self.assertIn("Hello1/0.1@user/testing: remote1", self.client.user_io.out)
self.client.run("remote update_ref Hello1/0.1@user/testing remote2")
self.client.run("remote list_ref")
self.assertIn("Hello/0.1@user/testing: remote0", self.client.user_io.out)
self.assertIn("Hello1/0.1@user/testing: remote2", self.client.user_io.out)
|
[{"Owner":"Dad72","Date":"2016-12-02T00:53:39Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI am looking to create a ramp system. But I do not succeed in making it. Is what anybody has of idea of how?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tAt the moment_co_ I raise summits which form a mountain and I wish that by choosing vertexes from top of the mountain_co_ then the vertexes of the bottom of the mountain_co_ this will create a ramp.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI found a sample video that looks like what I would like to do_dd_\n_lt_/p_gt_\n\n_lt_div class_eq__qt_ipsEmbeddedVideo_qt__gt_\n\t_lt_div_gt_\n\t\t_lt_iframe allowfullscreen_eq__qt_true_qt_ frameborder_eq__qt_0_qt_ height_eq__qt_270_qt_ src_eq__qt_https_dd_//www.youtube.com/embed/k46nP_u092E?feature_eq_oembed_qt_ width_eq__qt_480_qt__gt__lt_/iframe_gt_\n\t_lt_/div_gt_\n_lt_/div_gt_\n\n_lt_p_gt_\n\tHow can this be done?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThank you for your help\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"V!nc3r","Date":"2016-12-02T08:30:27Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tWhy not just model ramps in 3d modeler ?\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T11:42:23Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tIt is for a terrain editor that I do. So I need to have this tool for my editor. But I do not know yet how.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T13:47:36Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tI start a PG of what I have until the. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tThere are two modes. One for the vertex elevation and another for the ramps. It changes to line_dd_ 43 and 44 (To be changed manually) By default elevation mode is actived\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThe function to make the ramp is line 171\n_lt_/p_gt_\n\n_lt_p_gt_\n\tCurrently I select the vertex on functions_dd_ line 129 and 150 and I save them in an array. This corresponds to the beginning of the ramp towards the end. But I_t_m not sure if what I have started is correct. _lt_img alt_eq__qt__dd_wacko_dd__qt_ data-emoticon_eq__qt__qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_wacko.png_qt_ title_eq__qt__dd_wacko_dd__qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tI wanted to take inspiration from the function_dd_ line 279 coming from worldmonger on the site of Babylon _lt_img alt_eq__qt__dd_P_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_tongue.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_P_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//www.babylonjs-playground.com/#RKPBE%2313_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//www.babylonjs-playground.com/#RKPBE#13_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI hope there is some expert on terrain sculpture that will help me. This is the last thing of complicate with my editor.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThank you for you help\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"getzel","Date":"2016-12-02T14:19:52Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tWaho the terrain editor looks promising.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T14:26:50Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tYes_co_ There are other tools with_dd_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_img class_eq__qt_ipsImage ipsImage_thumbnailed_qt_ data-fileid_eq__qt_10496_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/monthly_2016_12/editground.jpg.227551f3b3d0eb3c67ce615aa0e8ada7.jpg_qt_ alt_eq__qt_editground.jpg_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tI also intend to add different brushes too. But I still have the problem of ramps with which I really struggle. The other tools work.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Gugis","Date":"2016-12-02T15:38:45Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tYou have 2 variables - topPoint (at the top of the mountain) and bottomPoint (at the bottom of the mountain). Now you have to caculate distance and height difference between these two points_dd_\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_var totalDistance _eq_ Math.sqrt((topPoint.x-bottomPoint.x) * (topPoint.x-bottomPoint.x) + (topPoint.z - bottomPoint.z) * (topPoint.z - bottomPoint.z))_sm_\nvar heightDifference _eq_ topPoint.z - bottomPoint.z_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tNext you have to select which vertices you need to update_co_ for that use _lt_a href_eq__qt_https_dd_//en.wikipedia.org/wiki/Bresenham_t_s_line_algorithm_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//en.wikipedia.org/wiki/Bresenham_t_s_line_algorithm_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tLoop through all vertices and calculate how far from bottom point current vertex is (use first method)_dd_\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_var currentVertexDistance _eq_ Math.sqrt((bottomPoint.x-currentVertex.x) * (bottomPoint.x-currentVertex.x) + (bottomPoint.z - currentVertex.z) * (bottomPoint.z - currentVertex.z))_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tFor getting proper height of current vertex you have to calculate distance ratio between current vertex and bottom point_dd_\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_var heightRatio _eq_ currentVertexDistance/totalDistance_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tFinally height of current vertex_dd_\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_currentVertex.z _eq_ endPoint.z + heightRatio * heightDifference_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tI am not sure that i wrote everything 100% correctly_co_ but it should be something like that.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T15:55:18Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tWoaw_co_ I do not understand for the use of Bresenham_t_s_line_algorithm. In any case_co_ thank you for this theoris and sample code.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Gugis","Date":"2016-12-02T16:08:24Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_153302_qt_ data-ipsquote-contentid_eq__qt_26758_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1480694118_qt_ data-ipsquote-userid_eq__qt_5292_qt_ data-ipsquote-username_eq__qt_Dad72_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t9 minutes ago_co_ Dad72 said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tWoaw_co_ I do not understand for the use of Bresenham_t_s_line_algorithm. In any case_co_ thank you for this theoris and sample code.\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\tHere_t_s javascript function of this algorithm_dd_ _lt_a href_eq__qt_http_dd_//stackoverflow.com/questions/4672279/bresenham-algorithm-in-javascript/4672319#4672319_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//stackoverflow.com/questions/4672279/bresenham-algorithm-in-javascript/4672319#4672319_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T16:14:47Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tThank you. It_t_s complicated_co_ I have a headache.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tWould you have time to help me reproduce this on this playground?\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//www.babylonjs-playground.com/#RKPBE%2313_qt_ rel_eq__qt_external nofollow_qt_ style_eq__qt_color_dd_rgb(60_co_105_co_148)_sm_text-decoration_dd_underline_sm_background-color_dd_rgb(255_co_255_co_255)_sm_font-family_dd__t_Helvetica Neue_t__co_ Helvetica_co_ Arial_co_ sans-serif_sm_font-size_dd_14px_sm_font-style_dd_normal_sm_font-weight_dd_normal_sm_letter-spacing_dd_normal_sm_text-indent_dd_0px_sm_text-transform_dd_none_sm_white-space_dd_normal_sm_word-spacing_dd_0px_sm__qt__gt_http_dd_//www.babylonjs-playground.com/#RKPBE#13_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThanking you in advance\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Gugis","Date":"2016-12-02T17:40:34Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tThere_t_s a lot of work to do. The most I can do is to guide you.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"V!nc3r","Date":"2016-12-02T17:53:35Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tAnd why not paint on a heightmap and update the terrain on live rather than directly _qt_paint_qt_ mesh data ? Would it not be easier ?\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"adam","Date":"2016-12-02T18:08:36Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tIt would look cool. I don_t_t think it would be easier_co_ though.\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T19:53:26Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tI try but I can not and I think I did absolutely anything. _lt_img alt_eq__qt__dd_wacko_dd__qt_ data-emoticon_eq__qt__qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_wacko.png_qt_ title_eq__qt__dd_wacko_dd__qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tI modify the PG in ways to create a small mountain and automatically switch to ramp creation mode (when you can create more mountain)\n_lt_/p_gt_\n\n_lt_p_gt_\n\tBut what I did does not work for Ramp mode. I do not even understand what I do. _lt_img alt_eq__qt__dd_blink_dd__qt_ data-emoticon_eq__qt__qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_blink.png_qt_ title_eq__qt__dd_blink_dd__qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//www.babylonjs-playground.com/#RKPBE%2316_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//www.babylonjs-playground.com/#RKPBE#16_lt_/a_gt_\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-02T21:37:49Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tI try another approach that is also a total failure. _lt_img alt_eq__qt__dd_(_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_sad.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_(_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tI drop this feature that takes me too much head and I will finish no longer have hair on my head. I can not do it and I do not think I can do it tomorrow either.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tYou can always create ramps manually by gradually elevating the tops at the moment. So I_t_ll settle for that. I do not have the level for that kind of _qt_chemistry mathematics_qt_.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"gryff","Date":"2016-12-02T22:14:46Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_153360_qt_ data-ipsquote-contentid_eq__qt_26758_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1480714669_qt_ data-ipsquote-userid_eq__qt_5292_qt_ data-ipsquote-username_eq__qt_Dad72_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t34 minutes ago_co_ Dad72 said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tI drop this feature\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\t_lt_a contenteditable_eq__qt_false_qt_ data-ipshover_eq__qt__qt_ data-ipshover-target_eq__qt_http_dd_//www.html5gamedevs.com/profile/5292-dad72/?do_eq_hovercard_qt_ data-mentionid_eq__qt_5292_qt_ href_eq__qt_http_dd_//www.html5gamedevs.com/profile/5292-dad72/_qt_ rel_eq__qt__qt__gt_@Dad72_lt_/a_gt_ I have known you on this forum for almost 3 years - not known you to give up easily.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tC_t_est mauvais _lt_img alt_eq__qt__dd_(_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_sad.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_(_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tcheers_co_ gryff _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"adam","Date":"2016-12-02T22:25:39Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tI_t_ll give it an attempt over the weekend.\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Wingnut","Date":"2016-12-02T22:48:44Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tSO_co_ now... hehe... gray scale image... used as a heightMap or displaceMap... that has a _qt_quantized_qt_ number of available steps_co_ yes?\n_lt_/p_gt_\n\n_lt_p_gt_\n\t256 colors of gray? So_co_ ramps made from gray-scale... that use our displaceMap system... will get a _qt_steppy_qt_ ramp... yes?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tBut a modeled ramp... or a math-derived map... would give a much smoother ramp_co_ yes?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tOk_co_ just checking. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tThe granularity (subdivs) of the ground... will need consideration... (duh wingy). hmm.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tCan a ramp get wider or narrower... as it ascends/descends? (Wingy digs in his bag for some aspirin).\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-03T00:40:02Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tThank you Gryff_co_ Adam and Wingnut for your support. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tYes_co_ Gryff I_t_m not the type to give up generally easily_co_ but I feel like I run into a big wall. I do not know at all how to do and rather than do anything/to make bullshit_co_ down I prefer to stop. My ideas exceed my skills sometimes. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tBut thanks. If you get there_co_ Adam_co_ I would try to understand what you did for learn. Thank you for giving a try to this headache and do not you care if you do not succeed.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Gijs","Date":"2016-12-03T15:29:40Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi_co_ it_t_s a fun challenge! I tried my best to make something like in the video_co_ and here are the results_dd_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThis is the standalone version. You can adjust the brush size.\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//www.babylonjs-playground.com/#RKPBE%2317_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//www.babylonjs-playground.com/#RKPBE#17_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tTip_dd_ enable wireframe mode on the material to see the geometry better.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThis is your #13 mixed with my #17_dd_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//www.babylonjs-playground.com/#RKPBE%2318_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//www.babylonjs-playground.com/#RKPBE#18_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI saw buttons in your demo very briefly_co_ but for some reason they usually don_t_t show. I made the middle mouse button for _t_ramp_t_ instead_co_ left is to make mountains.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tHopefully it is of some use to you. Good luck with your project!\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-03T16:27:32Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tWoaw_co_ it_t_s really cool. Thank you so much Gijs. _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_br /_gt_\n\tI will study what you have done to learn.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThanks again. \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-03T16:56:16Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tI studied the code you did. I_t_m impressed_co_ I would never have done that. You made a quality system. This is really perfect.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tGreat thank you for helping me with this.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Gijs","Date":"2016-12-03T17:27:07Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_153455_qt_ data-ipsquote-contentid_eq__qt_26758_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1480784176_qt_ data-ipsquote-userid_eq__qt_5292_qt_ data-ipsquote-username_eq__qt_Dad72_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t30 minutes ago_co_ Dad72 said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tI studied the code you did. I_t_m impressed_co_ I would never have done that. You made a quality system. This is really perfect.\n\t\t_lt_/p_gt_\n\n\t\t_lt_p_gt_\n\t\t\tGreat thank you for helping me with this.\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\tYou_t_re welcome_co_ but I just thought of a more general method of doing such things_co_ so if that works out_co_ the ramp code may soon be obsolete\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"getzel","Date":"2016-12-03T18:11:22Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tThere are some coding heros on this forum !\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Dad72","Date":"2016-12-03T21:31:52Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_153456_qt_ data-ipsquote-contentid_eq__qt_26758_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1480786027_qt_ data-ipsquote-userid_eq__qt_22401_qt_ data-ipsquote-username_eq__qt_Gijs_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t4 hours ago_co_ Gijs said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tbut I just thought of a more general method of doing such things_co_ so if that works out_co_ the ramp code may soon be obsolete\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\tIf there is one manners more general_co_ I definitely want to see it. _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/[email protected] 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}] |
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.smoothScroll = factory(root);
}
})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {
'use strict';
//
// Variables
//
var smoothScroll = {}; // Object for public APIs
var supports = 'querySelector' in document && 'addEventListener' in root; // Feature test
var settings, anchor, toggle, fixedHeader, headerHeight, eventTimeout, animationInterval;
// Default settings
var defaults = {
selector: '[data-scroll]',
selectorHeader: null,
speed: 500,
easing: 'easeInOutCubic',
offset: 0,
callback: function () {}
};
//
// Methods
//
/**
* Merge two or more objects. Returns a new object.
* @private
* @param {Boolean} deep If true, do a deep (or recursive) merge [optional]
* @param {Object} objects The objects to merge together
* @returns {Object} Merged values of defaults and options
*/
var extend = function () {
// Variables
var extended = {};
var deep = false;
var i = 0;
var length = arguments.length;
// Check if a deep merge
if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
deep = arguments[0];
i++;
}
// Merge the object into the extended object
var merge = function (obj) {
for ( var prop in obj ) {
if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
// If deep merge and property is an object, merge properties
if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
extended[prop] = extend( true, extended[prop], obj[prop] );
} else {
extended[prop] = obj[prop];
}
}
}
};
// Loop through each object and conduct a merge
for ( ; i < length; i++ ) {
var obj = arguments[i];
merge(obj);
}
return extended;
};
/**
* Get the height of an element.
* @private
* @param {Node} elem The element to get the height of
* @return {Number} The element's height in pixels
*/
var getHeight = function ( elem ) {
return Math.max( elem.scrollHeight, elem.offsetHeight, elem.clientHeight );
};
/**
* Get the closest matching element up the DOM tree.
* @private
* @param {Element} elem Starting element
* @param {String} selector Selector to match against
* @return {Boolean|Element} Returns null if not match found
*/
var getClosest = function ( elem, selector ) {
// Element.matches() polyfill
if (!Element.prototype.matches) {
Element.prototype.matches =
Element.prototype.matchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector ||
Element.prototype.oMatchesSelector ||
Element.prototype.webkitMatchesSelector ||
function(s) {
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
i = matches.length;
while (--i >= 0 && matches.item(i) !== this) {}
return i > -1;
};
}
// Get closest match
for ( ; elem && elem !== document; elem = elem.parentNode ) {
if ( elem.matches( selector ) ) return elem;
}
return null;
};
/**
* Escape special characters for use with querySelector
* @private
* @param {String} id The anchor ID to escape
* @author Mathias Bynens
* @link https://github.com/mathiasbynens/CSS.escape
*/
var escapeCharacters = function ( id ) {
// Remove leading hash
if ( id.charAt(0) === '#' ) {
id = id.substr(1);
}
var string = String(id);
var length = string.length;
var index = -1;
var codeUnit;
var result = '';
var firstCodeUnit = string.charCodeAt(0);
while (++index < length) {
codeUnit = string.charCodeAt(index);
// Note: there’s no need to special-case astral symbols, surrogate
// pairs, or lone surrogates.
// If the character is NULL (U+0000), then throw an
// `InvalidCharacterError` exception and terminate these steps.
if (codeUnit === 0x0000) {
throw new InvalidCharacterError(
'Invalid character: the input contains U+0000.'
);
}
if (
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
// U+007F, […]
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
// If the character is the first character and is in the range [0-9]
// (U+0030 to U+0039), […]
(index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
// If the character is the second character and is in the range [0-9]
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
(
index === 1 &&
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
firstCodeUnit === 0x002D
)
) {
// http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point
result += '\\' + codeUnit.toString(16) + ' ';
continue;
}
// If the character is not handled by one of the above rules and is
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
// U+005A), or [a-z] (U+0061 to U+007A), […]
if (
codeUnit >= 0x0080 ||
codeUnit === 0x002D ||
codeUnit === 0x005F ||
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
codeUnit >= 0x0061 && codeUnit <= 0x007A
) {
// the character itself
result += string.charAt(index);
continue;
}
// Otherwise, the escaped character.
// http://dev.w3.org/csswg/cssom/#escape-a-character
result += '\\' + string.charAt(index);
}
return '#' + result;
};
/**
* Calculate the easing pattern
* @private
* @link https://gist.github.com/gre/1650294
* @param {String} type Easing pattern
* @param {Number} time Time animation should take to complete
* @returns {Number}
*/
var easingPattern = function ( type, time ) {
var pattern;
if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity
if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity
if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration
if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity
if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity
if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration
if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity
if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity
if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration
if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity
if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity
if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration
return pattern || time; // no easing, no acceleration
};
/**
* Calculate how far to scroll
* @private
* @param {Element} anchor The anchor element to scroll to
* @param {Number} headerHeight Height of a fixed header, if any
* @param {Number} offset Number of pixels by which to offset scroll
* @returns {Number}
*/
var getEndLocation = function ( anchor, headerHeight, offset ) {
var location = 0;
if (anchor.offsetParent) {
do {
location += anchor.offsetTop;
anchor = anchor.offsetParent;
} while (anchor);
}
location = Math.max(location - headerHeight - offset, 0);
return Math.min(location, getDocumentHeight() - getViewportHeight());
};
/**
* Determine the viewport's height
* @private
* @returns {Number}
*/
var getViewportHeight = function() {
return Math.max( document.documentElement.clientHeight, root.innerHeight || 0 );
};
/**
* Determine the document's height
* @private
* @returns {Number}
*/
var getDocumentHeight = function () {
return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
);
};
/**
* Convert data-options attribute into an object of key/value pairs
* @private
* @param {String} options Link-specific options as a data attribute string
* @returns {Object}
*/
var getDataOptions = function ( options ) {
return !options || !(typeof JSON === 'object' && typeof JSON.parse === 'function') ? {} : JSON.parse( options );
};
/**
* Get the height of the fixed header
* @private
* @param {Node} header The header
* @return {Number} The height of the header
*/
var getHeaderHeight = function ( header ) {
return !header ? 0 : ( getHeight( header ) + header.offsetTop );
};
/**
* Bring the anchored element into focus
* @private
*/
var adjustFocus = function ( anchor, endLocation, isNum ) {
// Don't run if scrolling to a number on the page
if ( isNum ) return;
// Otherwise, bring anchor element into focus
anchor.focus();
if ( document.activeElement.id !== anchor.id ) {
anchor.setAttribute( 'tabindex', '-1' );
anchor.focus();
anchor.style.outline = 'none';
}
root.scrollTo( 0 , endLocation );
};
/**
* Start/stop the scrolling animation
* @public
* @param {Node|Number} anchor The element or position to scroll to
* @param {Element} toggle The element that toggled the scroll event
* @param {Object} options
*/
smoothScroll.animateScroll = function ( anchor, toggle, options ) {
// Options and overrides
var overrides = getDataOptions( toggle ? toggle.getAttribute('data-options') : null );
var animateSettings = extend( settings || defaults, options || {}, overrides ); // Merge user options with defaults
// Selectors and variables
var isNum = Object.prototype.toString.call( anchor ) === '[object Number]' ? true : false;
var anchorElem = isNum || !anchor.tagName ? null : anchor;
if ( !isNum && !anchorElem ) return;
var startLocation = root.pageYOffset; // Current location on the page
if ( animateSettings.selectorHeader && !fixedHeader ) {
// Get the fixed header if not already set
fixedHeader = document.querySelector( animateSettings.selectorHeader );
}
if ( !headerHeight ) {
// Get the height of a fixed header if one exists and not already set
headerHeight = getHeaderHeight( fixedHeader );
}
var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt(animateSettings.offset, 10) ); // Location to scroll to
var distance = endLocation - startLocation; // distance to travel
var documentHeight = getDocumentHeight();
var timeLapsed = 0;
var percentage, position;
/**
* Stop the scroll animation when it reaches its target (or the bottom/top of page)
* @private
* @param {Number} position Current position on the page
* @param {Number} endLocation Scroll to location
* @param {Number} animationInterval How much to scroll on this loop
*/
var stopAnimateScroll = function ( position, endLocation, animationInterval ) {
var currentLocation = root.pageYOffset;
if ( position == endLocation || currentLocation == endLocation || ( (root.innerHeight + currentLocation) >= documentHeight ) ) {
// Clear the animation timer
clearInterval(animationInterval);
// Bring the anchored element into focus
adjustFocus( anchor, endLocation, isNum );
// Run callback after animation complete
animateSettings.callback( anchor, toggle );
}
};
/**
* Loop scrolling animation
* @private
*/
var loopAnimateScroll = function () {
timeLapsed += 16;
percentage = ( timeLapsed / parseInt(animateSettings.speed, 10) );
percentage = ( percentage > 1 ) ? 1 : percentage;
position = startLocation + ( distance * easingPattern(animateSettings.easing, percentage) );
root.scrollTo( 0, Math.floor(position) );
stopAnimateScroll(position, endLocation, animationInterval);
};
/**
* Set interval timer
* @private
*/
var startAnimateScroll = function () {
clearInterval(animationInterval);
animationInterval = setInterval(loopAnimateScroll, 16);
};
/**
* Reset position to fix weird iOS bug
* @link https://github.com/cferdinandi/smooth-scroll/issues/45
*/
if ( root.pageYOffset === 0 ) {
root.scrollTo( 0, 0 );
}
// Start scrolling animation
startAnimateScroll();
};
/**
* Handle has change event
* @private
*/
var hashChangeHandler = function (event) {
// Get hash from URL
// var hash = decodeURIComponent( escapeCharacters( root.location.hash ) );
var hash;
try {
hash = escapeCharacters( decodeURIComponent( root.location.hash ) );
} catch(e) {
hash = escapeCharacters( root.location.hash );
}
// Only run if there's an anchor element to scroll to
if ( !anchor ) return;
// Reset the anchor element's ID
anchor.id = anchor.getAttribute( 'data-scroll-id' );
// Scroll to the anchored content
smoothScroll.animateScroll( anchor, toggle );
// Reset anchor and toggle
anchor = null;
toggle = null;
};
/**
* If smooth scroll element clicked, animate scroll
* @private
*/
var clickHandler = function (event) {
// Don't run if right-click or command/control + click
if ( event.button !== 0 || event.metaKey || event.ctrlKey ) return;
// Check if a smooth scroll link was clicked
toggle = getClosest( event.target, settings.selector );
if ( !toggle || toggle.tagName.toLowerCase() !== 'a' ) return;
// Only run if link is an anchor and points to the current page
if ( toggle.hostname !== root.location.hostname || toggle.pathname !== root.location.pathname || !/#/.test(toggle.href) ) return;
// Get the sanitized hash
// var hash = decodeURIComponent( escapeCharacters( toggle.hash ) );
// console.log(hash);
var hash;
try {
hash = escapeCharacters( decodeURIComponent( toggle.hash ) );
} catch(e) {
hash = escapeCharacters( toggle.hash );
}
// If the hash is empty, scroll to the top of the page
if ( hash === '#' ) {
// Prevent default link behavior
event.preventDefault();
// Set the anchored element
anchor = document.body;
// Save or create the ID as a data attribute and remove it (prevents scroll jump)
var id = anchor.id ? anchor.id : 'smooth-scroll-top';
anchor.setAttribute( 'data-scroll-id', id );
anchor.id = '';
// If no hash change event will happen, fire manually
// Otherwise, update the hash
if ( root.location.hash.substring(1) === id ) {
hashChangeHandler();
} else {
root.location.hash = id;
}
return;
}
// Get the anchored element
anchor = document.querySelector( hash );
// If anchored element exists, save the ID as a data attribute and remove it (prevents scroll jump)
if ( !anchor ) return;
anchor.setAttribute( 'data-scroll-id', anchor.id );
anchor.id = '';
// If no hash change event will happen, fire manually
if ( toggle.hash === root.location.hash ) {
event.preventDefault();
hashChangeHandler();
}
};
/**
* On window scroll and resize, only run events at a rate of 15fps for better performance
* @private
* @param {Function} eventTimeout Timeout function
* @param {Object} settings
*/
var resizeThrottler = function (event) {
if ( !eventTimeout ) {
eventTimeout = setTimeout(function() {
eventTimeout = null; // Reset timeout
headerHeight = getHeaderHeight( fixedHeader ); // Get the height of a fixed header if one exists
}, 66);
}
};
/**
* Destroy the current initialization.
* @public
*/
smoothScroll.destroy = function () {
// If plugin isn't already initialized, stop
if ( !settings ) return;
// Remove event listeners
document.removeEventListener( 'click', clickHandler, false );
root.removeEventListener( 'resize', resizeThrottler, false );
// Reset varaibles
settings = null;
anchor = null;
toggle = null;
fixedHeader = null;
headerHeight = null;
eventTimeout = null;
animationInterval = null;
};
/**
* Initialize Smooth Scroll
* @public
* @param {Object} options User settings
*/
smoothScroll.init = function ( options ) {
// feature test
if ( !supports ) return;
// Destroy any existing initializations
smoothScroll.destroy();
// Selectors and variables
settings = extend( defaults, options || {} ); // Merge user options with defaults
fixedHeader = settings.selectorHeader ? document.querySelector( settings.selectorHeader ) : null; // Get the fixed header
headerHeight = getHeaderHeight( fixedHeader );
// When a toggle is clicked, run the click handler
document.addEventListener( 'click', clickHandler, false );
// Listen for hash changes
root.addEventListener('hashchange', hashChangeHandler, false);
// If window is resized and there's a fixed header, recalculate its size
if ( fixedHeader ) {
root.addEventListener( 'resize', resizeThrottler, false );
}
};
//
// Public APIs
//
return smoothScroll;
}); |
import json
import pytest
from dvc.cli import parse_args
from dvc.command.status import CmdDataStatus
def test_cloud_status(tmp_dir, dvc, mocker):
cli_args = parse_args(
[
"status",
"--cloud",
"target1",
"target2",
"--jobs",
"2",
"--remote",
"remote",
"--all-branches",
"--all-tags",
"--all-commits",
"--with-deps",
"--recursive",
]
)
assert cli_args.func == CmdDataStatus
cmd = cli_args.func(cli_args)
m = mocker.patch.object(cmd.repo, "status", autospec=True, return_value={})
assert cmd.run() == 0
m.assert_called_once_with(
cloud=True,
targets=["target1", "target2"],
jobs=2,
remote="remote",
all_branches=True,
all_tags=True,
all_commits=True,
with_deps=True,
recursive=True,
)
@pytest.mark.parametrize("status", [{}, {"a": "b", "c": [1, 2, 3]}, [1, 2, 3]])
def test_status_show_json(mocker, caplog, status):
cli_args = parse_args(["status", "--show-json"])
assert cli_args.func == CmdDataStatus
cmd = cli_args.func(cli_args)
mocker.patch.object(cmd.repo, "status", autospec=True, return_value=status)
caplog.clear()
assert cmd.run() == 0
assert caplog.messages == [json.dumps(status)]
@pytest.mark.parametrize(
"status, ret", [({}, 0), ({"a": "b", "c": [1, 2, 3]}, 1), ([1, 2, 3], 1)]
)
def test_status_quiet(mocker, caplog, capsys, status, ret):
cli_args = parse_args(["status", "-q"])
assert cli_args.func == CmdDataStatus
cmd = cli_args.func(cli_args)
mocker.patch.object(cmd.repo, "status", autospec=True, return_value=status)
caplog.clear()
assert cmd.run() == ret
assert not caplog.messages
captured = capsys.readouterr()
assert not captured.err
assert not captured.out
|
zipdata({"7370912":[34,"呉市","焼山本庄"],"7372392":[34,"江田島市","能美町中町","4859番地9"],"7370065":[34,"呉市","望地町"],"7370812":[34,"呉市","西三津田町"],"7370145":[34,"呉市","仁方西神町"],"7372393":[34,"江田島市","沖美町畑","358番地"],"7372506":[34,"呉市","安浦町原畑"],"7370193":[34,"呉市","広多賀谷","1丁目5-1"],"7370046":[34,"呉市","中通"],"7370042":[34,"呉市","和庄本町"],"7370192":[34,"呉市","広名田","1丁目3-1"],"7370044":[34,"呉市","八幡町"],"7370827":[34,"呉市","西愛宕町"],"7371215":[34,"呉市","音戸町早瀬"],"7370162":[34,"呉市","郷原学びの丘"],"7370864":[34,"呉市","吉浦西城町"],"7370846":[34,"呉市","吉浦町"],"7370005":[34,"呉市","阿賀町"],"7370031":[34,"呉市","上長迫町"],"7370182":[34,"呉市","郷原学びの丘","1丁目1の1"],"7372301":[34,"江田島市","能美町中町"],"7370935":[34,"呉市","焼山中央"],"7370103":[34,"呉市","広塩焼"],"7370015":[34,"呉市","船見町"],"7370138":[34,"呉市","広黄幡町"],"7370841":[34,"呉市","吉浦神賀町"],"7371206":[34,"呉市","音戸町高須"],"7378512":[34,"呉市","若葉町","5-1"],"7370163":[34,"呉市","郷原野路の里"],"7370874":[34,"呉市","天応南町"],"7370843":[34,"呉市","吉浦潭鼓町"],"7370931":[34,"呉市","焼山三ツ石町"],"7370853":[34,"呉市","吉浦中町"],"7372609":[34,"呉市","川尻町野呂山"],"7370063":[34,"呉市","東惣付町"],"7370155":[34,"呉市","仁方錦町"],"7370876":[34,"呉市","天応宮町"],"7370033":[34,"呉市","寺本町"],"7378554":[34,"呉市","幸町","7-1"],"7378518":[34,"呉市","吉浦新町","2丁目3番20号"],"7370198":[34,"呉市","広文化町","1-23"],"7378508":[34,"呉市","宝町","6-9"],"7370077":[34,"呉市","伏原"],"7378686":[34,"呉市","本通","2丁目2-15"],"7370885":[34,"呉市","天応福浦町"],"7372313":[34,"江田島市","沖美町是長"],"7370906":[34,"呉市","焼山町"],"7370004":[34,"呉市","阿賀南"],"7372607":[34,"呉市","川尻町東"],"7371205":[34,"呉市","音戸町南隠渡"],"7370837":[34,"呉市","東塩屋町"],"7370076":[34,"呉市","吾妻"],"7372302":[34,"江田島市","能美町鹿川"],"7372111":[34,"江田島市","江田島町切串"],"7370934":[34,"呉市","焼山政畝"],"7371212":[34,"呉市","音戸町有清"],"7370828":[34,"呉市","東愛宕町"],"7370104":[34,"呉市","広町田"],"7372632":[34,"呉市","川尻町上畑"],"7372122":[34,"江田島市","江田島町中央"],"7372516":[34,"呉市","安浦町中央"],"7378611":[34,"呉市","本通","2丁目3-7"],"7370107":[34,"呉市","広弁天橋町"],"7370854":[34,"呉市","吉浦町"],"7370142":[34,"呉市","広駅前"],"7372633":[34,"呉市","川尻町沖田"],"7372101":[34,"江田島市","大柿町飛渡瀬"],"7370071":[34,"呉市","上畑町"],"7370806":[34,"呉市","西片山町"],"7370936":[34,"呉市","焼山東"],"7372193":[34,"江田島市","江田島町中央","1丁目1-1"],"7372608":[34,"呉市","川尻町小用"],"7371213":[34,"呉市","音戸町先奥"],"7370834":[34,"呉市","瀬戸見町"],"7370029":[34,"呉市","宝町"],"7370113":[34,"呉市","広横路"],"7372212":[34,"江田島市","大柿町大君"],"7371207":[34,"呉市","音戸町波多見"],"7370043":[34,"呉市","和庄登町"],"7370135":[34,"呉市","広津久茂町"],"7370803":[34,"呉市","郷町"],"7372131":[34,"江田島市","江田島町秋月"],"7372511":[34,"呉市","安浦町赤向坂"],"7370832":[34,"呉市","若葉町"],"7370921":[34,"呉市","苗代町"],"7370816":[34,"呉市","二河峡町"],"7370052":[34,"呉市","東中央"],"7370815":[34,"呉市","荘山田村"],"7378651":[34,"呉市","中央","1丁目6-28"],"7370804":[34,"呉市","内神町"],"7370883":[34,"呉市","天応西条"],"7378503":[34,"呉市","中央","3丁目8-21"],"7372519":[34,"呉市","安浦町内海南"],"7370115":[34,"呉市","広町"],"7370851":[34,"呉市","吉浦新出町"],"7370844":[34,"呉市","吉浦池ノ浦町"],"7370842":[34,"呉市","吉浦東町"],"7370137":[34,"呉市","広小坪"],"7378509":[34,"呉市","中央","6丁目2番9号呉市つばき会館"],"7370862":[34,"呉市","狩留賀町"],"7372100":[34,"江田島市",""],"7370013":[34,"呉市","的場"],"7372635":[34,"呉市","川尻町柳迫"],"7378516":[34,"呉市","三条","2丁目4-10"],"7370131":[34,"呉市","広中町"],"7370026":[34,"呉市","神原町"],"7370112":[34,"呉市","広古新開"],"7370884":[34,"呉市","天応伝十原町"],"7370143":[34,"呉市","広白石"],"7372507":[34,"呉市","安浦町内海"],"7372501":[34,"呉市","安浦町女子畑"],"7370106":[34,"呉市","広三芦"],"7370807":[34,"呉市","江原町"],"7378501":[34,"呉市","中央","4丁目1-6"],"7370805":[34,"呉市","東片山町"],"7372292":[34,"江田島市","大柿町大原","535番地1"],"7370153":[34,"呉市","仁方大歳町"],"7370831":[34,"呉市","光町"],"7372517":[34,"呉市","安浦町水尻"],"7372311":[34,"江田島市","沖美町岡大王"],"7370073":[34,"呉市","東鹿田町"],"7370012":[34,"呉市","警固屋"],"7370852":[34,"呉市","吉浦東本町"],"7372509":[34,"呉市","安浦町下垣内"],"7370124":[34,"呉市","広中新開"],"7372121":[34,"江田島市","江田島町小用"],"7371216":[34,"呉市","音戸町田原"],"7370134":[34,"呉市","広多賀谷"],"7378513":[34,"呉市","築地町","1番24号"],"7370865":[34,"呉市","吉浦岩神町"],"7370873":[34,"呉市","汐見町"],"7372636":[34,"呉市","川尻町才野谷"],"7372616":[34,"呉市","川尻町水落"],"7370045":[34,"呉市","本通"],"7372631":[34,"呉市","川尻町板休"],"7370303":[34,"呉市","下蒲刈町下島"],"7370022":[34,"呉市","清水"],"7370035":[34,"呉市","長迫町"],"7372513":[34,"呉市","安浦町安登東"],"7370911":[34,"呉市","焼山北"],"7370114":[34,"呉市","広文化町"],"7370822":[34,"呉市","築地町"],"7370809":[34,"呉市","西辰川"],"7372617":[34,"呉市","川尻町小畑"],"7370902":[34,"呉市","焼山此原町"],"7372314":[34,"江田島市","沖美町美能"],"7370913":[34,"呉市","焼山泉ケ丘"],"7372211":[34,"江田島市","大柿町柿浦"],"7378506":[34,"呉市","阿賀南","2丁目2-11"],"7370914":[34,"呉市","押込西平町"],"7370032":[34,"呉市","本町"],"7372123":[34,"江田島市","江田島町国有無番地"],"7370908":[34,"呉市","焼山宮ケ迫"],"7378653":[34,"呉市","西中央","1丁目2-25"],"7370075":[34,"呉市","西畑町"],"7370125":[34,"呉市","広本町"],"7370863":[34,"呉市","吉浦宮花町"],"7371204":[34,"呉市","音戸町北隠渡"],"7370836":[34,"呉市","北塩屋町"],"7370011":[34,"呉市","見晴"],"7372504":[34,"呉市","安浦町中切"],"7372604":[34,"呉市","川尻町小仁方"],"7372502":[34,"呉市","安浦町三津口"],"7370025":[34,"呉市","室瀬町"],"7372637":[34,"呉市","川尻町後懸"],"7371211":[34,"呉市","音戸町畑"],"7370054":[34,"呉市","上山田町"],"7370881":[34,"呉市","天応塩谷町"],"7370002":[34,"呉市","広町"],"7370111":[34,"呉市","広大広"],"7372514":[34,"呉市","安浦町中央ハイツ"],"7372112":[34,"江田島市","江田島町幸之浦"],"7370122":[34,"呉市","広杭本町"],"7372603":[34,"呉市","川尻町西"],"7372518":[34,"呉市","安浦町内海北"],"7370823":[34,"呉市","海岸"],"7370311":[34,"呉市","蒲刈町向"],"7372602":[34,"呉市","川尻町森"],"7370101":[34,"呉市","広石内"],"7372515":[34,"呉市","安浦町中央北"],"7372503":[34,"呉市","安浦町安登"],"7370904":[34,"呉市","焼山"],"7370123":[34,"呉市","広両谷"],"7370838":[34,"呉市","西塩屋町"],"7372132":[34,"江田島市","江田島町江南"],"7370062":[34,"呉市","西惣付町"],"7370141":[34,"呉市","広大新開"],"7372195":[34,"江田島市","",""],"7370845":[34,"呉市","吉浦新町"],"7370907":[34,"呉市","焼山町"],"7370833":[34,"呉市","晴海町"],"7370872":[34,"呉市","梅木町"],"7370905":[34,"呉市","焼山町"],"7370053":[34,"呉市","長ノ木町"],"7370814":[34,"呉市","山手"],"7370034":[34,"呉市","溝路町"],"7370151":[34,"呉市","仁方中筋町"],"7370132":[34,"呉市","広名田"],"7370817":[34,"呉市","上二河町"],"7378507":[34,"呉市","天応塩谷町","1-6"],"7370866":[34,"呉市","吉浦松葉町"],"7372512":[34,"呉市","安浦町安登西"],"7370105":[34,"呉市","広中迫町"],"7372601":[34,"呉市","川尻町原山"],"7370878":[34,"呉市","大山町"],"7370811":[34,"呉市","西中央"],"7370922":[34,"呉市","栃原町"],"7370825":[34,"呉市","西川原石町"],"7372303":[34,"江田島市","能美町高田"],"7371377":[34,"呉市","倉橋町"],"7378652":[34,"呉市","中央","3丁目9番15号"],"7370403":[34,"呉市","蒲刈町田戸"],"7378504":[34,"呉市","西中央","1丁目3-25"],"7370079":[34,"呉市","上平原町"],"7370024":[34,"呉市","宮原"],"7378541":[34,"呉市","天応大浜","4丁目1-1"],"7370021":[34,"呉市","三和町"],"7370867":[34,"呉市","吉浦上城町"],"7370802":[34,"呉市","南辰川町"],"7370003":[34,"呉市","阿賀中央"],"7378502":[34,"呉市","中央","3丁目12-4"],"7371201":[34,"呉市","音戸町坪井"],"7370835":[34,"呉市","新宮町"],"7372316":[34,"江田島市","沖美町三吉"],"7372126":[34,"江田島市","江田島町津久茂"],"7370861":[34,"呉市","吉浦本町"],"7370301":[34,"呉市","下蒲刈町三之瀬"],"7370056":[34,"呉市","朝日町"],"7370074":[34,"呉市","西鹿田"],"7370000":[34,"呉市",""],"7370932":[34,"呉市","焼山松ケ丘"],"7372614":[34,"呉市","川尻町大原"],"7370136":[34,"呉市","広長浜"],"7370813":[34,"呉市","東三津田町"],"7370901":[34,"呉市","焼山ひばりケ丘町"],"7370401":[34,"呉市","蒲刈町宮盛"],"7372213":[34,"江田島市","大柿町大原"],"7370824":[34,"呉市","東川原石町"],"7372133":[34,"江田島市","江田島町鷲部"],"7370072":[34,"呉市","東畑"],"7370821":[34,"呉市","三条"],"7370924":[34,"呉市","焼山南"],"7370023":[34,"呉市","青山町"],"7370154":[34,"呉市","仁方桟橋通"],"7370028":[34,"呉市","幸町"],"7370882":[34,"呉市","天応東久保"],"7372214":[34,"江田島市","大柿町深江"],"7370915":[34,"呉市","押込"],"7371202":[34,"呉市","音戸町引地"],"7370933":[34,"呉市","焼山桜ケ丘"],"7371217":[34,"呉市","音戸町渡子"],"7370146":[34,"呉市","仁方宮上町"],"7370064":[34,"呉市","西谷町"],"7370014":[34,"呉市","坪ノ内町"],"7370826":[34,"呉市","両城"],"7378650":[34,"呉市","中通","2丁目5-8"],"7372634":[34,"呉市","川尻町岩戸"],"7370402":[34,"呉市","蒲刈町大浦"],"7372312":[34,"江田島市","沖美町畑"],"7372124":[34,"江田島市","江田島町宮ノ原"],"7370818":[34,"呉市","二河町"],"7370001":[34,"呉市","阿賀北"],"7378505":[34,"呉市","西中央","2丁目3-28"],"7370055":[34,"呉市","下山田町"],"7378609":[34,"呉市","西中央","1丁目5-2"],"7371203":[34,"呉市","音戸町鰯浜"],"7372508":[34,"呉市","安浦町中畑"],"7370808":[34,"呉市","上内神町"],"7378520":[34,"呉市","昭和町","11-1"],"7370152":[34,"呉市","仁方本町"],"7372606":[34,"呉市","川尻町久筋"],"7370027":[34,"呉市","昭和町"],"7370195":[34,"呉市","広多賀谷","3丁目1-1"],"7370157":[34,"呉市","仁方町"],"7370156":[34,"呉市","仁方皆実町"],"7370061":[34,"呉市","畝原町"],"7370923":[34,"呉市","神山"],"7370871":[34,"呉市","長谷町"],"7371214":[34,"呉市","音戸町藤脇"],"7370161":[34,"呉市","郷原町"],"7370302":[34,"呉市","下蒲刈町大地蔵"],"7372215":[34,"江田島市","大柿町小古江"],"7372293":[34,"江田島市","大柿町小古江","1982-2"],"7372113":[34,"江田島市","江田島町大須"],"7370801":[34,"呉市","東辰川町"],"7370041":[34,"呉市","和庄"],"7372505":[34,"呉市","安浦町内平"],"7370078":[34,"呉市","平原町"],"7378517":[34,"呉市","本町","9番21号すこやかセンターくれ別館"],"7372295":[34,"江田島市","大柿町大原","505番地"],"7370875":[34,"呉市","天応大浜"],"7372615":[34,"呉市","川尻町真光地"],"7372605":[34,"呉市","川尻町久俊"],"7370051":[34,"呉市","中央"],"7370102":[34,"呉市","広徳丸町"],"7370877":[34,"呉市","弥生町"],"7370121":[34,"呉市","広吉松"],"7370144":[34,"呉市","広白岳"],"7372315":[34,"江田島市","沖美町高祖"],"7372125":[34,"江田島市","江田島町大原特借宿舎"],"7370903":[34,"呉市","焼山西"],"7370133":[34,"呉市","広末広"]}
);
|
import { wallet } from "wallet-preload-shim";
import {
DEX_LOGOUT_ATTEMPT,
DEX_LOGOUT_SUCCESS,
DEX_LOGOUT_FAILED,
logoutDex,
stopDex
} from "./DexActions";
import {
rescanCancel,
ticketBuyerCancel,
showCantCloseModal,
stopMonitorLockableAccounts
} from "./ControlActions";
import {
getWalletServiceAttempt,
startWalletServices,
getBestBlockHeightAttempt
} from "./ClientActions";
import { WALLETREMOVED_FAILED } from "./DaemonActions";
import { isTestNet, trezorDevice } from "selectors";
import { walletrpc as api } from "middleware/walletrpc/api_pb";
import { push as pushHistory } from "connected-react-router";
import { stopNotifcations } from "./NotificationActions";
import { stopDcrlnd } from "./LNActions";
import { TESTNET } from "constants";
import * as cfgConstants from "constants/config";
import { RESCAN_PROGRESS } from "./ControlActions";
import { stopAccountMixer } from "./AccountMixerActions";
import { TRZ_WALLET_CLOSED } from "actions/TrezorActions";
const { SyncNotificationType } = api;
const MAX_RPC_RETRIES = 5;
const RPC_RETRY_DELAY = 5000;
export const LOADER_ATTEMPT = "LOADER_ATTEMPT";
export const LOADER_FAILED = "LOADER_FAILED";
export const LOADER_SUCCESS = "LOADER_SUCCESS";
export const loaderRequest = () => (dispatch, getState) =>
new Promise((resolve, reject) => {
const getLoaderAsync = async () => {
const {
grpc: { address, port }
} = getState();
const {
daemon: { walletName }
} = getState();
const grpcCertAndKey = wallet.getDcrwalletGrpcKeyCert();
const request = {
isTestNet: isTestNet(getState()),
walletName,
address,
port,
cert: grpcCertAndKey,
key: grpcCertAndKey
};
dispatch({ request, type: LOADER_ATTEMPT });
try {
const loader = await wallet.getLoader(request);
dispatch({ loader, type: LOADER_SUCCESS });
return loader;
} catch (error) {
dispatch({ error, type: LOADER_FAILED });
reject(error);
}
};
getLoaderAsync()
.then((loader) => resolve(loader))
.catch((error) => console.log(error));
});
export const GETWALLETSEEDSVC_ATTEMPT = "GETWALLETSEEDSVC_ATTEMPT";
export const GETWALLETSEEDSVC_FAILED = "GETWALLETSEEDSVC_FAILED";
export const GETWALLETSEEDSVC_SUCCESS = "GETWALLETSEEDSVC_SUCCESS";
export const getWalletSeedService = () => (dispatch, getState) => {
const {
grpc: { address, port }
} = getState();
const {
daemon: { walletName }
} = getState();
dispatch({ type: GETWALLETSEEDSVC_ATTEMPT });
const grpcCertAndKey = wallet.getDcrwalletGrpcKeyCert();
return wallet
.getSeedService(
isTestNet(getState()),
walletName,
address,
port,
grpcCertAndKey,
grpcCertAndKey
)
.then((seedService) => {
dispatch({ seedService, type: GETWALLETSEEDSVC_SUCCESS });
})
.catch((error) => dispatch({ error, type: GETWALLETSEEDSVC_FAILED }));
};
export const CREATEWALLET_GOBACK = "CREATEWALLET_GOBACK";
// cancelCreateWallet stops and remove the wallet being created
// removing its directories. It is used when a wallet starts being created
// but the user has given up.
export const cancelCreateWallet = () => async (dispatch, getState) => {
const {
daemon: { walletName }
} = getState();
const { currentSettings } = getState().settings;
const network = currentSettings.network;
try {
await wallet.stopWallet();
await wallet.removeWallet(walletName, network == TESTNET);
dispatch(setSelectedWallet(null));
dispatch({ type: CREATEWALLET_GOBACK });
} catch (err) {
dispatch({ error: err, type: WALLETREMOVED_FAILED });
}
};
export const CREATEWALLET_ATTEMPT = "CREATEWALLET_ATTEMPT";
export const CREATEWALLET_FAILED = "CREATEWALLET_FAILED";
export const CREATEWALLET_SUCCESS = "CREATEWALLET_SUCCESS";
export const createWalletRequest = (pubPass, privPass, seed, isNew) => (
dispatch,
getState
) =>
new Promise((resolve, reject) => {
dispatch({ existing: !isNew, type: CREATEWALLET_ATTEMPT });
return wallet
.createWallet(getState().walletLoader.loader, pubPass, privPass, seed)
.then(() => {
const {
daemon: { walletName }
} = getState();
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
config.delete(cfgConstants.DISCOVER_ACCOUNTS);
config.delete(cfgConstants.WALLET_CREATED_AS_NEW);
config.set(cfgConstants.DISCOVER_ACCOUNTS, isNew);
dispatch({ complete: isNew, type: UPDATEDISCOVERACCOUNTS });
dispatch({ type: CREATEWALLET_SUCCESS });
dispatch(clearStakePoolConfigNewWallet());
dispatch(getWalletServiceAttempt());
resolve(true);
})
.catch((error) => {
dispatch({ error, type: CREATEWALLET_FAILED });
reject(error);
});
});
export const CREATEWATCHONLYWALLET_ATTEMPT = "CREATEWATCHONLYWALLET_ATTEMPT";
export const CREATEWATCHONLYWALLET_FAILED = "CREATEWATCHONLYWALLET_FAILED";
export const CREATEWATCHONLYWALLET_SUCCESS = "CREATEWATCHONLYWALLET_SUCCESS";
export const createWatchOnlyWalletRequest = (extendedPubKey, pubPass = "") => (
dispatch,
getState
) =>
new Promise((resolve, reject) => {
dispatch({ type: CREATEWATCHONLYWALLET_ATTEMPT });
return wallet
.createWatchingOnlyWallet(
getState().walletLoader.loader,
extendedPubKey,
pubPass
)
.then(() => {
const {
daemon: { walletName }
} = getState();
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
config.set(cfgConstants.IS_WATCH_ONLY, true);
config.delete(cfgConstants.DISCOVER_ACCOUNTS);
wallet.setIsWatchingOnly(true);
dispatch({ response: {}, type: CREATEWATCHONLYWALLET_SUCCESS });
dispatch(getWalletServiceAttempt());
resolve(true);
})
.catch((error) => {
dispatch({ error, type: CREATEWATCHONLYWALLET_FAILED });
reject(error);
});
});
export const OPENWALLET_INPUT = "OPENWALLET_INPUT";
export const OPENWALLET_INPUTPRIVPASS = "OPENWALLET_INPUTPRIVPASS";
export const OPENWALLET_FAILED_INPUT = "OPENWALLET_FAILED_INPUT";
export const OPENWALLET_ATTEMPT = "OPENWALLET_ATTEMPT";
export const OPENWALLET_FAILED = "OPENWALLET_FAILED";
export const OPENWALLET_SUCCESS = "OPENWALLET_SUCCESS";
export const openWalletAttempt = (pubPass, retryAttempt, selectedWallet) => (
dispatch,
getState
) =>
new Promise((resolve, reject) => {
dispatch({ type: OPENWALLET_ATTEMPT });
return wallet
.openWallet(getState().walletLoader.loader, pubPass)
.then(async (response) => {
await dispatch(getWalletServiceAttempt());
wallet.setIsWatchingOnly(response.watchingOnly);
// needsPassPhrase is reset by OPENWALLET_SUCCESS, so store it here if
// we need to ask for the passphrase before starting the sync process.
const needsPassPhrase = getState().walletLoader.needsPassPhrase;
dispatch({
isWatchingOnly: response.watchingOnly,
type: OPENWALLET_SUCCESS
});
if (needsPassPhrase) {
reject(OPENWALLET_INPUTPRIVPASS);
return;
}
resolve(true);
})
.catch(async (error) => {
// This error message happens after creating a new wallet as we already
// started it on creation. So we just ignore it.
if (error.message.includes("wallet already")) {
dispatch(getWalletServiceAttempt());
const isWatchingOnly = await wallet.getIsWatchingOnly();
dispatch({ isWatchingOnly, type: OPENWALLET_SUCCESS });
return resolve(true);
}
// Wallet with pub pass
if (error.message.includes("invalid passphrase:: wallet.Open")) {
if (retryAttempt) {
dispatch({ error, type: OPENWALLET_FAILED_INPUT });
return reject(OPENWALLET_FAILED_INPUT);
}
return reject(OPENWALLET_INPUT);
}
if (!selectedWallet.finished) {
const walletCfg = wallet.getWalletCfg(
isTestNet(getState()),
selectedWallet.value.wallet
);
error.walletCreatedAsNew = !!walletCfg.get(
cfgConstants.WALLET_CREATED_AS_NEW
);
}
dispatch({ error, type: OPENWALLET_FAILED });
reject(error);
});
});
export const CLOSEWALLET_ATTEMPT = "CLOSEWALLET_ATTEMPT";
export const CLOSEWALLET_FAILED = "CLOSEWALLET_FAILED";
export const CLOSEWALLET_SUCCESS = "CLOSEWALLET_SUCCESS";
const finalCloseWallet = () => async (dispatch, getState) => {
const { walletReady } = getState().daemon;
dispatch({ type: CLOSEWALLET_ATTEMPT });
try {
await dispatch(stopNotifcations());
await dispatch(syncCancel());
await dispatch(rescanCancel());
await dispatch(stopDcrlnd());
await dispatch(stopMonitorLockableAccounts());
await dispatch(ticketBuyerCancel());
await dispatch(stopAccountMixer(true));
await dispatch(setSelectedWallet(null));
await dispatch(stopDex());
if (walletReady) {
await wallet.closeWallet(getState().walletLoader.loader);
}
await wallet.stopWallet();
dispatch({ type: CLOSEWALLET_SUCCESS });
if (trezorDevice(getState())) dispatch({ type: TRZ_WALLET_CLOSED });
dispatch(pushHistory("/getstarted/initial"));
} catch (error) {
dispatch({ error, type: CLOSEWALLET_FAILED });
dispatch(pushHistory("/error"));
}
};
export const closeWalletRequest = () => async (dispatch, getState) => {
const { loggedIn } = getState().dex;
try {
if (loggedIn) {
dispatch({ type: DEX_LOGOUT_ATTEMPT });
await logoutDex();
dispatch({ type: DEX_LOGOUT_SUCCESS });
}
return dispatch(finalCloseWallet());
} catch (error) {
const openOrder =
error.indexOf("cannot log out with active orders", 0) > -1;
dispatch({ type: DEX_LOGOUT_FAILED, error, openOrder });
dispatch(showCantCloseModal());
}
};
export const STARTRPC_ATTEMPT = "STARTRPC_ATTEMPT";
export const STARTRPC_FAILED = "STARTRPC_FAILED";
export const STARTRPC_SUCCESS = "STARTRPC_SUCCESS";
export const STARTRPC_RETRY = "STARTRPC_RETRY";
export const startRpcRequestFunc = (privPass, isRetry) => (
dispatch,
getState
) => {
const { syncAttemptRequest } = getState().walletLoader;
if (syncAttemptRequest) {
return;
}
const {
daemon: { walletName },
walletLoader: { discoverAccountsComplete }
} = getState();
const credentials = wallet.getDcrdRpcCredentials();
const discoverAccts = !discoverAccountsComplete && privPass;
const setPrivPass = discoverAccts
? new Uint8Array(Buffer.from(privPass))
: null;
return new Promise((resolve, reject) => {
if (!isRetry) dispatch({ type: SYNC_ATTEMPT });
const { loader } = getState().walletLoader;
setTimeout(async () => {
const rpcSyncCall = await wallet.rpcSync(
loader,
credentials,
discoverAccts,
setPrivPass
);
dispatch({ syncCall: rpcSyncCall, type: SYNC_UPDATE });
rpcSyncCall.on("data", async (response) => {
const synced = await dispatch(syncConsumer(response));
if (synced) {
return resolve();
}
});
rpcSyncCall.on("end", function () {
// Connection closed.
});
rpcSyncCall.on("error", function (status) {
status = status + "";
if (status.indexOf("Cancelled") < 0) {
if (isRetry) {
const { rpcRetryAttempts } = getState().walletLoader;
if (rpcRetryAttempts < MAX_RPC_RETRIES) {
dispatch({
rpcRetryAttempts: rpcRetryAttempts + 1,
type: STARTRPC_RETRY
});
setTimeout(
() => dispatch(startRpcRequestFunc(privPass, isRetry)),
RPC_RETRY_DELAY
);
} else {
dispatch({
error: `${status}. You may need to edit ${wallet.getWalletPath(
isTestNet(getState()),
walletName
)} and try again`,
type: STARTRPC_FAILED
});
}
} else if (status.includes("wallet.Unlock: invalid passphrase")) {
// Wallet needs unlocking to discover accounts and passphrase
// is wrong.
dispatch({ error: status, type: SYNC_FAILED });
return reject(OPENWALLET_INPUTPRIVPASS);
} else if (
status.indexOf("invalid passphrase") > 0 ||
status.indexOf("Stream removed")
) {
dispatch({ error: status, type: SYNC_FAILED });
reject(status);
} else {
dispatch(startRpcRequestFunc(privPass, true));
}
}
});
}, 500);
});
};
export const WALLET_SELECTED = "WALLET_SELECTED";
// setSelectedWallet sets a selected wallet which the user opened at the reducer and
// at node memory with ipcRender. This way we can still know the wallet opened by the
// user after a refresh (common when in dev).
export const setSelectedWallet = (selectedWallet) => (dispatch) => {
dispatch({ type: WALLET_SELECTED, selectedWallet });
wallet.setSelectedWallet(selectedWallet);
};
// getSelectedWallet gets a wallet from the node memory. If it does exit, it is
// dispatched and added to the reducer.
export const getSelectedWallet = () => (dispatch) => {
const selectedWallet = wallet.getSelectedWallet();
if (!selectedWallet) {
return null;
}
dispatch({ type: WALLET_SELECTED, selectedWallet });
return selectedWallet;
};
export const UPDATEDISCOVERACCOUNTS = "UPDATEDISCOVERACCOUNTS";
export const CLEARSTAKEPOOLCONFIG = "CLEARSTAKEPOOLCONFIG";
export function clearStakePoolConfigNewWallet() {
return (dispatch, getState) => {
const {
daemon: { walletName }
} = getState();
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
config.delete(cfgConstants.STAKEPOOLS);
wallet.getStakePoolInfo().then((foundStakePoolConfigs) => {
if (foundStakePoolConfigs) {
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
config.set(cfgConstants.STAKEPOOLS, foundStakePoolConfigs);
dispatch({
currentStakePoolConfig: foundStakePoolConfigs,
type: CLEARSTAKEPOOLCONFIG
});
}
});
};
}
export const GENERATESEED_ATTEMPT = "GENERATESEED_ATTEMPT";
export const GENERATESEED_FAILED = "GENERATESEED_FAILED";
export const GENERATESEED_SUCCESS = "GENERATESEED_SUCCESS";
// generateSeed generates a new seed for a new wallet. Please note that the seed
// is *not* replicated into the global redux state, to prevent being extracted
// or logged.
// This is an async function, so it returns a promise that resolves once the
// seed is obtained.
export const generateSeed = () => (dispatch, getState) => {
const seedService = getState().walletLoader.seedService;
dispatch({ type: GENERATESEED_ATTEMPT });
try {
const response = wallet.generateSeed(seedService);
dispatch({ type: GENERATESEED_SUCCESS }); // please note: don't copy the seed here.
return response;
} catch (error) {
dispatch({ error, type: GENERATESEED_FAILED });
throw error;
}
};
export const DECODESEED_ATTEMPT = "DECODESEED_ATTEMPT";
export const DECODESEED_FAILED = "DECODESEED_FAILED";
export const DECODESEED_SUCCESS = "DECODESEED_SUCCESS";
// decodeSeed tries to decode the given mnemonic as a seed. Please note that
// this mnenomic is *not* replicated into the global redux state, to prevent
// being extracted or logged.
export const decodeSeed = (mnemonic) => async (dispatch, getState) => {
const seedService = getState().walletLoader.seedService;
dispatch({ type: DECODESEED_ATTEMPT }); // please note: don't copy the seed here.
try {
const response = await wallet.decodeSeed(seedService, mnemonic);
dispatch({ type: DECODESEED_SUCCESS });
return response;
} catch (error) {
dispatch({ error, type: DECODESEED_FAILED });
throw error;
}
};
export const SYNC_ATTEMPT = "SYNC_ATTEMPT";
export const SYNC_FAILED = "SYNC_FAILED";
export const SYNC_UPDATE = "SYNC_UPDATE";
export const SYNC_INPUT = "SYNC_INPUT";
export const SYNC_CANCEL = "SYNC_CANCEL";
export const SYNC_SYNCED = "SYNC_SYNCED";
export const SYNC_UNSYNCED = "SYNC_UNSYNCED";
export const SYNC_PEER_CONNECTED = "SYNC_PEER_CONNECTED";
export const SYNC_PEER_DISCONNECTED = "SYNC_PEER_DISCONNECTED";
export const SYNC_FETCHED_MISSING_CFILTERS_STARTED =
"SYNC_FETCHED_MISSING_CFILTERS_STARTED";
export const SYNC_FETCHED_MISSING_CFILTERS_PROGRESS =
"SYNC_FETCHED_MISSING_CFILTERS_PROGRESS";
export const SYNC_FETCHED_MISSING_CFILTERS_FINISHED =
"SYNC_FETCHED_MISSING_CFILTERS_FINISHED";
export const SYNC_FETCHED_HEADERS_STARTED = "SYNC_FETCHED_HEADERS_STARTED";
export const SYNC_FETCHED_HEADERS_PROGRESS = "SYNC_FETCHED_HEADERS_PROGRESS";
export const SYNC_FETCHED_HEADERS_FINISHED = "SYNC_FETCHED_HEADERS_FINISHED";
export const SYNC_DISCOVER_ADDRESSES_FINISHED =
"SYNC_DISCOVER_ADDRESSES_FINISHED";
export const SYNC_DISCOVER_ADDRESSES_STARTED =
"SYNC_DISCOVER_ADDRESSES_STARTED";
export const SYNC_RESCAN_STARTED = "SYNC_RESCAN_STARTED";
export const SYNC_RESCAN_FINISHED = "SYNC_RESCAN_FINISHED";
export const spvSyncAttempt = (privPass) => (dispatch, getState) => {
const { syncAttemptRequest } = getState().walletLoader;
if (syncAttemptRequest) {
return;
}
dispatch({ type: SYNC_ATTEMPT });
const { discoverAccountsComplete } = getState().walletLoader;
const { currentSettings } = getState().settings;
const spvConnect = currentSettings.spvConnect;
const discoverAccts = !discoverAccountsComplete && privPass;
const setPrivPass = discoverAccts
? new Uint8Array(Buffer.from(privPass))
: null;
// Disable use of async executor here because wallet.spvSync call needs to be
// async, but we only resolve the promise once the "synced" event is received
// on the data stream, so we need the "bare" promise.
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
const { loader } = getState().walletLoader;
const spvSyncCall = await wallet.spvSync(
loader,
spvConnect,
discoverAccts,
setPrivPass
);
dispatch({ syncCall: spvSyncCall, type: SYNC_UPDATE });
spvSyncCall.on("data", async function (response) {
const synced = await dispatch(syncConsumer(response));
if (synced) {
return resolve();
}
});
spvSyncCall.on("end", function (data) {
// It never gets here but log if it does.
console.log("sync end", data);
});
spvSyncCall.on("error", function (status) {
status = status + "";
// Wallet needs unlocking to discover accounts and passphrase is wrong.
if (status.includes("wallet.Unlock: invalid passphrase")) {
dispatch({ error: status, type: SYNC_FAILED });
return reject(OPENWALLET_INPUTPRIVPASS);
}
if (status.indexOf("Cancelled") < 0) {
console.error(status);
dispatch({ error: status, type: SYNC_FAILED });
reject(status);
}
});
});
};
export function syncCancel() {
return (dispatch, getState) => {
const { syncCall } = getState().walletLoader;
if (syncCall) {
syncCall.cancel();
dispatch({ type: SYNC_CANCEL });
}
};
}
const syncConsumer = (response) => async (dispatch, getState) => {
const { discoverAccountsComplete } = getState().walletLoader;
switch (response.notificationType) {
case SyncNotificationType.SYNCED: {
await dispatch(getBestBlockHeightAttempt(startWalletServices));
dispatch({ type: SYNC_SYNCED });
return true;
}
case SyncNotificationType.UNSYNCED: {
dispatch({ type: SYNC_UNSYNCED });
break;
}
case SyncNotificationType.PEER_CONNECTED: {
dispatch({
peerCount: response.peerInformation.peerCount,
type: SYNC_PEER_CONNECTED
});
break;
}
case SyncNotificationType.PEER_DISCONNECTED: {
dispatch({
peerCount: response.peerInformation.peerCount,
type: SYNC_PEER_DISCONNECTED
});
break;
}
case SyncNotificationType.FETCHED_MISSING_CFILTERS_STARTED: {
dispatch({ type: SYNC_FETCHED_MISSING_CFILTERS_STARTED });
break;
}
case SyncNotificationType.FETCHED_MISSING_CFILTERS_PROGRESS: {
const cFiltersStart =
response.fetchMissingCfilters.fetchedCfiltersStartHeight;
const cFiltersEnd =
response.fetchMissingCfilters.fetchedCfiltersEndHeight;
dispatch({
cFiltersStart,
cFiltersEnd,
type: SYNC_FETCHED_MISSING_CFILTERS_PROGRESS
});
break;
}
case SyncNotificationType.FETCHED_MISSING_CFILTERS_FINISHED: {
dispatch({ type: SYNC_FETCHED_MISSING_CFILTERS_FINISHED });
break;
}
case SyncNotificationType.FETCHED_HEADERS_STARTED: {
const fetchTimeStart = new Date();
dispatch({ fetchTimeStart, type: SYNC_FETCHED_HEADERS_STARTED });
break;
}
case SyncNotificationType.FETCHED_HEADERS_PROGRESS: {
const lastFetchedHeaderTime = new Date(
response.fetchHeaders.lastHeaderTime * 1000
);
const fetchHeadersCount = response.fetchHeaders.fetchedHeadersCount;
dispatch({
fetchHeadersCount,
lastFetchedHeaderTime,
type: SYNC_FETCHED_HEADERS_PROGRESS
});
break;
}
case SyncNotificationType.FETCHED_HEADERS_FINISHED: {
dispatch({ type: SYNC_FETCHED_HEADERS_FINISHED });
break;
}
case SyncNotificationType.DISCOVER_ADDRESSES_STARTED: {
dispatch({ type: SYNC_DISCOVER_ADDRESSES_STARTED });
break;
}
case SyncNotificationType.DISCOVER_ADDRESSES_FINISHED: {
dispatch({ type: SYNC_DISCOVER_ADDRESSES_FINISHED });
if (!discoverAccountsComplete) {
const {
daemon: { walletName }
} = getState();
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
config.delete(cfgConstants.DISCOVER_ACCOUNTS);
config.set(cfgConstants.DISCOVER_ACCOUNTS, true);
dispatch({ complete: true, type: UPDATEDISCOVERACCOUNTS });
}
break;
}
case SyncNotificationType.RESCAN_STARTED: {
dispatch({ type: SYNC_RESCAN_STARTED });
dispatch(getBestBlockHeightAttempt());
break;
}
case SyncNotificationType.RESCAN_PROGRESS: {
dispatch({
type: RESCAN_PROGRESS,
rescanResponse: response.rescanProgress
});
break;
}
case SyncNotificationType.RESCAN_FINISHED: {
dispatch({ type: SYNC_RESCAN_FINISHED });
break;
}
}
};
export const RESCANPOINT_ATTEMPT = "RESCANPOINT_ATTEMPT";
export const RESCANPOINT_FAILED = "RESCANPOINT_FAILED";
export const RESCANPOINT_SUCCESS = "RESCANPOINT_SUCCESS";
export const rescanPointAttempt = () => (dispatch, getState) => {
dispatch({ type: RESCANPOINT_ATTEMPT });
return wallet
.rescanPoint(getState().walletLoader.loader)
.then((response) => {
dispatch({ response, type: RESCANPOINT_SUCCESS });
})
.catch((error) => {
dispatch({ error, type: RESCANPOINT_FAILED });
});
};
export const SET_POLITEIA_LAST_ACCESS_SUCCESS =
"SET_POLITEIA_LAST_ACCESS_SUCCESS";
export const setLastPoliteiaAccessTime = () => (dispatch, getState) => {
const {
daemon: { walletName }
} = getState();
const {
grpc: { currentBlockHeight }
} = getState();
const config = wallet.getWalletCfg(isTestNet(getState()), walletName);
// time in seconds as politeia uses its proposal time in seconds
const timestamp = new Date().getTime() / 1000;
config.set(cfgConstants.POLITEIA_LAST_ACCESS_TIME, timestamp);
config.set(cfgConstants.POLITEIA_LAST_ACCESS_BLOCK, currentBlockHeight);
dispatch({
type: SET_POLITEIA_LAST_ACCESS_SUCCESS,
currentBlockHeight,
timestamp
});
};
|
$(function(){
$('.wysiwyg').wysihtml5();
$('#form-news').validate();
$('#delPrjBtn').click(function(){
$('#form-del-project').submit();
});
$('#delNewsBtn').click(function(){
$('#form-del-news').submit();
});
$('#btnSubmitNews').click(function(){
$('#form-news').submit();
});
$('#show-modal-news').click(function(){
$('#form_type').html('สร้าง');
$('#form_btn_type').html('สร้าง');
$('#news_id').val('');
$('#news_name').val('');
$('#news_type').val('');
$('#news_url').val('');
$('#news_detail').data("wysihtml5").editor.setValue('');
});
});
function delProject(pid){
var project_name = $('#project_name_'+pid).html();
$('#prj_name_del').html(' "'+project_name+'" ');
$('#del_prj_id').val(pid);
$('#modal-delproject').modal('show');
}
function delNews(nid){
var news_name = $('#news_name_'+nid).html();
$('#news_name_del').html(' "'+news_name+'" ');
$('#del_news_id').val(nid);
$('#modal-delnews').modal('show');
}
function editNews(nid){
$('#form_type').html('แก้ไข');
$('#form_btn_type').html('แก้ไข');
$('#news_id').val(nid);
$('#news_name').val($('#news_name_'+nid).html());
$('#news_type').val($('#news_type_'+nid).html());
// $('#news_detail').val($('#news_detail_'+nid).val());
$('#news_url').val($('#news_url_'+nid).val());
// var wysihtml5Editor = $('#news_detail').wysihtml5().data("wysihtml5").editor;
// wysihtml5Editor.setValue($('#news_detail_'+nid).val(), true);
$('#news_detail').data("wysihtml5").editor.setValue($('#news_detail_'+nid).val());
} |
var searchData=
[
['revbitmatrix_5758',['RevBitMatrix',['../classoperations__research_1_1_rev_bit_set.html#ac9da3e5301f8c4c0ed8a261d0a0b2cbd',1,'operations_research::RevBitSet']]],
['revimmutablemultimap_5759',['RevImmutableMultiMap',['../classoperations__research_1_1_solver.html#a523b4c1786dd34b9d1fa2579b91b4c0d',1,'operations_research::Solver']]],
['routingdimension_5760',['RoutingDimension',['../classoperations__research_1_1_routing_model.html#a50ba9dd11704e0be7edaa9e9f24142ff',1,'operations_research::RoutingModel']]],
['routingmodel_5761',['RoutingModel',['../classoperations__research_1_1_solver.html#ab7aef297f0c654af26dc7108c9ee6c69',1,'operations_research::Solver::RoutingModel()'],['../classoperations__research_1_1_routing_dimension.html#ab7aef297f0c654af26dc7108c9ee6c69',1,'operations_research::RoutingDimension::RoutingModel()']]],
['routingmodelinspector_5762',['RoutingModelInspector',['../classoperations__research_1_1_routing_model.html#a00141bd90e555aea59a9e98cfbcda6eb',1,'operations_research::RoutingModel::RoutingModelInspector()'],['../classoperations__research_1_1_routing_dimension.html#a00141bd90e555aea59a9e98cfbcda6eb',1,'operations_research::RoutingDimension::RoutingModelInspector()']]]
];
|
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: {
"js/app.js": /^(web\/static\/js)|(node_modules)/,
"js/ex_admin_common.js": ["web/static/vendor/ex_admin_common.js"],
"js/admin_lte2.js": ["web/static/vendor/admin_lte2.js"],
"js/jquery.min.js": ["web/static/vendor/jquery.min.js"],
}
},
stylesheets: {
joinTo: {
"css/app.css": /^(web\/static\/css)/,
"css/admin_lte2.css": ["web/static/vendor/admin_lte2.css"],
"css/active_admin.css": ["web/static/vendor/active_admin.css.css"],
},
order: {
after: ["web/static/css/app.css"] // concat app.css last
}
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to "/web/static/assets". Files in this directory
// will be copied to `paths.public`, which is "priv/static" by default.
assets: /^(web\/static\/assets)/
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"web/static",
"test/static"
],
// Where to compile files to
public: "priv/static"
},
// Configure your plugins
plugins: {
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/web\/static\/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},
npm: {
enabled: true
}
};
// To add the ExAdmin generated assets to your brunch build, do the following:
//
// Replace
//
// javascripts: {
// joinTo: "js/app.js"
// }
//
// With
//
// javascripts: {
// joinTo: {
// "js/app.js": /^(web\/static\/js)|(node_modules)/,
// "js/ex_admin_common.js": ["web/static/vendor/ex_admin_common.js"],
// "js/admin_lte2.js": ["web/static/vendor/admin_lte2.js"],
// "js/jquery.min.js": ["web/static/vendor/jquery.min.js"],
// }
// },
//
// Replace
//
// stylesheets: {
// joinTo: "css/app.css",
// order: {
// after: ["web/static/css/app.css"] // concat app.css last
// }
// },
//
// With
//
// stylesheets: {
// joinTo: {
// "css/app.css": /^(web\/static\/css)/,
// "css/admin_lte2.css": ["web/static/vendor/admin_lte2.css"],
// "css/active_admin.css": ["web/static/vendor/active_admin.css.css"],
// },
// order: {
// after: ["web/static/css/app.css"] // concat app.css last
// }
// },
//
|
import { combineEpics } from 'redux-observable';
import { GET_USERS } from '../../store/actionTypes';
import { getUsersSuccess } from './ListAction';
export const getUsersEpic = (action$, store, { getUsersService }) => action$.ofType(GET_USERS).switchMap(() => getUsersService()
.map(res => getUsersSuccess(res))
.catch(err => console.log('>>>>>>>>> err', err)));
export default combineEpics(getUsersEpic);
|
// exports only the environment-specific config.
module.exports = require('./env/'+process.env.NODE_ENV+'.env.config.js');
|
#!/usr/bin/env python2
import os, sys
PATH = os.path.dirname(os.path.realpath(sys.argv[0])) + "/"
configurations = dict(
transdec = dict(bg_picture=PATH+"Transdec.jpg",extent=(-5,130.8,0,74.6)),
teagle = dict(bg_picture=PATH+"teagle.jpg", extent=(0,27.7,0,16.66)),
automatic = None # Indicates to use filenames
)
import argparse
parser = argparse.ArgumentParser(description="""Layout Editor - Graphical display of DVL locations""")
parser.add_argument('filename', type=str, help="file containing output from marker to be viewed")
parser.add_argument('configuration', type=str, default="automatic", help="which background configuration to use.", nargs='?', choices=configurations.keys())
parser.add_argument('--save', type=str, default="", help="file name to save to", nargs='?')
args = parser.parse_args()
# Interpret no specified configuration by looking at the filename
if args.configuration == "automatic":
args.configuration = "teagle" if "teagle" in args.filename else "transdec"
import pickle
marks = pickle.load(file(args.filename, "r"))
configuration = configurations[ args.configuration ]
save_file_name = args.save
import pylab
fig = pylab.gcf()
#Handle User Input
current_selection = None
def on_pick_event(event):
global current_selection
#Take selection
if event.mouseevent.button == 1:
ind = event.ind[-1]
X,Y = xs[ind], ys[ind]
current_selection = ind
fig.canvas.mpl_connect('pick_event', on_pick_event)
grab_point = None
def on_click(event):
global grab_point
if event.button == 3:
if event.xdata is not None and event.ydata is not None:
grab_point = event.xdata, event.ydata
fig.canvas.mpl_connect('button_press_event', on_click)
def on_move(event):
#Drag selection
global current_selection, point_plot, label_texts
x,y = event.xdata, event.ydata
if current_selection is not None:
xs[current_selection] = x
ys[current_selection] = y
point_plot.set_data(xs,ys)
label_texts[current_selection].set_position( (x,y) )
pylab.draw()
if grab_point is not None:
x,y = event.xdata, event.ydata
if x is not None and y is not None:
x1,x2 = ax.get_xlim()
y1,y2 = ax.get_ylim()
ax.set_xlim( x1 - (x-grab_point[0]), x2 - (x-grab_point[0]))
ax.set_ylim( y1 - (y-grab_point[1]), y2 - (y - grab_point[1]))
pylab.draw()
fig.canvas.mpl_connect('motion_notify_event', on_move)
def on_release(event):
global current_selection, grab_point
if event.button == 1:
#clear selection
current_selection = None
elif event.button == 3:
grab_point = None
fig.canvas.mpl_connect('button_release_event', on_release)
def on_scroll(event):
#Scrolling up/down for zooming
x,y = event.xdata, event.ydata
x1,x2 = ax.get_xlim()
y1,y2 = ax.get_ylim()
xp,yp = (x-x1)/(x2-x1), (y-y1)/(y2-y1)
SCALE = 1.5
if event.button == "up":
width = (x2-x1)/SCALE
height = (y2-y1)/SCALE
elif event.button == "down":
width = (x2-x1)*SCALE
height = (y2-y1)*SCALE
ax.set_xlim( x - width*xp, x + width*(1-xp) )
ax.set_ylim( y - height*yp, y + height*(1-yp) )
pylab.draw()
fig.canvas.mpl_connect('scroll_event', on_scroll)
#Show background image
bg = pylab.imread(configuration["bg_picture"])
pylab.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05)
ax = pylab.subplot(111)
pylab.imshow(bg, extent=configuration["extent"], origin='lower')
'''
#Make the plots
labels = marks.keys()
import mission.layout.layout as layout
desired_labels = set(layout.places)
removed_labels = set(labels).difference(desired_labels)
if removed_labels:
print "The following labels no longer appear in layout.places"
print ", ".join(x for x in removed_labels)
resp = raw_input("Would you like to remove them from the layout? y/N")
if "y" in resp or "Y" in resp:
labels = desired_labels.intersection(labels)
new_labels = desired_labels.difference(labels)
if new_labels:
print "Adding the following points:", ", ".join(x for x in new_labels)
avg_x = sum(marks[l][1] for l in labels)/len(labels)
avg_y = sum(marks[l][0] for l in labels)/len(labels)
for label in new_labels:
marks[label] = (avg_x, avg_y)
labels = desired_labels
xs = [marks[l][1] for l in labels]
ys = [marks[l][0] for l in labels]
point_plot = pylab.plot(xs, ys, "ro", picker=True, pickradius=8, markersize=8)[0]
label_texts = []
for x,y,label in zip(xs,ys,labels):
label_texts.append( pylab.text(x,y, " " + label, color='r') )
'''
pylab.grid(b=True, which='major', color='b', linestyle='-')
pylab.show()
if save_file_name == "":
yn = raw_input("Save changes to %s? (y/N)" % args.filename)
if "y" in yn or "Y" in yn:
print "Saving to %s" % args.filename
save_file_name = args.filename
else:
print "Exiting without saving changes"
#Output to save file
if save_file_name != "":
save_file = file(save_file_name, "w")
pickle.dump( dict( zip( labels, zip(ys,xs ))) , save_file )
save_file.close()
|
mycallback( {"CONTRIBUTOR OCCUPATION": "Designer", "CONTRIBUTION AMOUNT (F3L Bundled)": "35.00", "ELECTION CODE": "G2010", "MEMO CODE": "", "CONTRIBUTOR EMPLOYER": "Sew What", "DONOR CANDIDATE STATE": "", "CONTRIBUTOR STREET 1": "1524 McAllister Street", "CONTRIBUTOR MIDDLE NAME": "", "DONOR CANDIDATE FEC ID": "", "DONOR CANDIDATE MIDDLE NAME": "", "CONTRIBUTOR STATE": "CA", "DONOR CANDIDATE FIRST NAME": "", "CONTRIBUTOR FIRST NAME": "Susan", "BACK REFERENCE SCHED NAME": "", "DONOR CANDIDATE DISTRICT": "", "CONTRIBUTION DATE": "20101021", "DONOR COMMITTEE NAME": "", "MEMO TEXT/DESCRIPTION": "", "Reference to SI or SL system code that identifies the Account": "", "FILER COMMITTEE ID NUMBER": "C00461061", "DONOR CANDIDATE LAST NAME": "", "CONTRIBUTOR LAST NAME": "VanKuiken", "_record_type": "fec.version.v7_0.SA", "CONDUIT STREET2": "", "CONDUIT STREET1": "", "DONOR COMMITTEE FEC ID": "", "CONTRIBUTION PURPOSE DESCRIP": "", "CONTRIBUTOR ZIP": "94115", "CONTRIBUTOR STREET 2": "", "CONDUIT CITY": "", "ENTITY TYPE": "IND", "CONTRIBUTOR CITY": "San Francisco", "CONTRIBUTOR SUFFIX": "", "TRANSACTION ID": "INCA7293", "DONOR CANDIDATE SUFFIX": "", "DONOR CANDIDATE OFFICE": "", "CONTRIBUTION PURPOSE CODE": "15", "ELECTION OTHER DESCRIPTION": "", "_src_file": "2011/20110504/727407.fec_3.yml", "CONDUIT STATE": "", "CONTRIBUTOR ORGANIZATION NAME": "", "BACK REFERENCE TRAN ID NUMBER": "", "DONOR CANDIDATE PREFIX": "", "CONTRIBUTOR PREFIX": "", "CONDUIT ZIP": "", "CONDUIT NAME": "", "CONTRIBUTION AGGREGATE F3L Semi-annual Bundled": "60.00", "FORM TYPE": "SA11AI"});
|
'use strict';
const assert = require('assert');
const { isScalar } = require('../req');
describe('isScalar', function() {
it('should accept scalar values', function() {
assert.strictEqual(isScalar(0), true);
assert.strictEqual(isScalar(42), true, 'Answer to the Ultimate Question of Life, the Universe, and Everything');
assert.strictEqual(isScalar(Math.PI), true);
assert.strictEqual(isScalar(Infinity), true);
assert.strictEqual(isScalar(NaN), true);
assert.strictEqual(isScalar(''), true);
assert.strictEqual(isScalar('a'), true);
assert.strictEqual(isScalar('0123'), true);
assert.strictEqual(isScalar(42), true, 'Answer to the Ultimate Question of Life, the Universe, and Everything');
assert.strictEqual(isScalar('{ "json": true }'), true);
assert.strictEqual(isScalar(null), true);
assert.strictEqual(isScalar(false), true);
assert.strictEqual(isScalar(true), true);
});
it('should reject undefined values and not defined params', function() {
assert.strictEqual(isScalar(undefined), false);
assert.strictEqual(isScalar(), false);
});
it('should reject complex values', function() {
assert.strictEqual(isScalar({}), false);
assert.strictEqual(isScalar([]), false);
assert.strictEqual(isScalar(Symbol()), false);
assert.strictEqual(isScalar(Date), false);
assert.strictEqual(isScalar(()=> 42), false);
});
});
|
import React, { Component } from 'react'
import LandingPage from './LandingPage'
import {
HashRouter,
Route
} from "react-router-dom";
// import LoadPage from './LoadPage';
import ReadPage from './ReadPage';
class App extends Component {
render() {
return (
<HashRouter>
<div>
<Route path="/" exact component={ LandingPage } />
<Route path="/ReadPage" component={ ReadPage } />
</div>
</HashRouter>
)
}
}
export default App
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// MODULES //
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var ldexp = require( './../lib' );
// MAIN //
bench( pkg, function benchmark( b ) {
var x;
var y;
var z;
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*20.0 ) - 10.0;
y = round( randu()*2040.0 ) - 1020.0;
z = ldexp( x, y );
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
|
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.3.4
*
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* @see http://php.net/manual/en/function.date.php
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/var DateFormatter;!function(){"use strict";var t,e,r,n,a,u,i;u=864e5,i=3600,t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,r,n){var a=n||"0",u=t.toString();return u.length<r?e(a+u,r):u},r=function(t){var e,n;for(t=t||{},e=1;e<arguments.length;e++)if(n=arguments[e])for(var a in n)n.hasOwnProperty(a)&&("object"==typeof n[a]?r(t[a],n[a]):t[a]=n[a]);return t},n=function(t,e){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()===t.toLowerCase())return r;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,r={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&r[e]?r[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},DateFormatter=function(t){var e=this,n=r(a,t);e.dateSettings=n.dateSettings,e.separators=n.separators,e.validParts=n.validParts,e.intParts=n.intParts,e.tzParts=n.tzParts,e.tzClip=n.tzClip},DateFormatter.prototype={constructor:DateFormatter,getMonth:function(t){var e,r=this;return e=n(t,r.dateSettings.monthsShort)+1,0===e&&(e=n(t,r.dateSettings.months)+1),e},parseDate:function(e,r){var n,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===r)return u=parseInt(e),u?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}if(n=r.match(d.validParts),!n||0===n.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),n[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(o=d.getMonth(i),!(o>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(c=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1,h=a[c],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(g===!0&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var r,n,a,u,i,s,o=this,c=t.replace(o.separators,"\x00").split("\x00"),f=/^[djmn]/g,l=e.match(o.validParts),h=new Date,d=0;if(!f.test(l[0]))return t;for(a=0;a<c.length;a++){if(d=2,i=c[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===l[0]||"n"===l[0]?h.setMonth(s-1):h.setDate(s);break;case 1:"m"===l[0]||"n"===l[0]?h.setDate(s):h.setMonth(s-1);break;case 2:if(n=h.getFullYear(),r=i.length,d=4>r?r:4,n=parseInt(4>r?n.toString().substr(0,4-r)+i:i.substr(0,4)),!n)return null;h.setFullYear(n);break;case 3:h.setHours(s);break;case 4:h.setMinutes(s);break;case 5:h.setSeconds(s)}u=i.substr(d),u.length>0&&c.splice(a+1,0,u)}return h},parseFormat:function(t,r){var n,a=this,s=a.dateSettings,o=/\\?(.?)/gi,c=function(t,e){return n[t]?n[t]():e};return n={d:function(){return e(n.j(),2)},D:function(){return s.daysShort[n.w()]},j:function(){return r.getDate()},l:function(){return s.days[n.w()]},N:function(){return n.w()||7},w:function(){return r.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/u)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),r=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-r)/u/7),2)},F:function(){return s.months[r.getMonth()]},m:function(){return e(n.n(),2)},M:function(){return s.monthsShort[r.getMonth()]},n:function(){return r.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=n.n(),e=n.W(),r=n.Y();return r+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return r.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return n.A().toLowerCase()},A:function(){var t=n.G()<12?0:1;return s.meridiem[t]},B:function(){var t=r.getUTCHours()*i,n=60*r.getUTCMinutes(),a=r.getUTCSeconds();return e(Math.floor((t+n+a+i)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return r.getHours()},h:function(){return e(n.g(),2)},H:function(){return e(n.G(),2)},i:function(){return e(r.getMinutes(),2)},s:function(){return e(r.getSeconds(),2)},u:function(){return e(1e3*r.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(r))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(n.Y(),0),e=Date.UTC(n.Y(),0),r=new Date(n.Y(),6),a=Date.UTC(n.Y(),6);return t-e!==r-a?1:0},O:function(){var t=r.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(n/60)+n%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(r).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-r.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(o,c)},r:function(){return"D, d M Y H:i:s O".replace(o,c)},U:function(){return r.getTime()/1e3||0}},c(t,t)},formatDate:function(t,e){var r,n,a,u,i,s=this,o="",c="\\";if("string"==typeof t&&(t=s.parseDate(t,e),!t))return null;if(t instanceof Date){for(a=e.length,r=0;a>r;r++)i=e.charAt(r),"S"!==i&&i!==c&&(r>0&&e.charAt(r-1)===c?o+=i:(u=s.parseFormat(i,t),r!==a-1&&s.intParts.test(i)&&"S"===e.charAt(r+1)&&(n=parseInt(u)||0,u+=s.dateSettings.ordinal(n)),o+=u));return o}return""}}}();/**
* @preserve jQuery DateTimePicker
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<[email protected]>)
*/
/**
* @param {jQuery} $
*/
var datetimepickerFactory = function ($) {
'use strict';
var default_options = {
i18n: {
ar: { // Arabic
months: [
"كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
],
dayOfWeekShort: [
"ن", "ث", "ع", "خ", "ج", "س", "ح"
],
dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
},
ro: { // Romanian
months: [
"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
],
dayOfWeekShort: [
"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
],
dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
},
id: { // Indonesian
months: [
"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
],
dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
},
is: { // Icelandic
months: [
"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
],
dayOfWeekShort: [
"Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
],
dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
},
bg: { // Bulgarian
months: [
"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
],
dayOfWeekShort: [
"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
},
fa: { // Persian/Farsi
months: [
'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
],
dayOfWeekShort: [
'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
],
dayOfWeek: ["یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه", "یکشنبه"]
},
ru: { // Russian
months: [
'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
],
dayOfWeekShort: [
"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
},
uk: { // Ukrainian
months: [
'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
],
dayOfWeekShort: [
"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
],
dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
},
en: { // English
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
el: { // Ελληνικά
months: [
"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
],
dayOfWeekShort: [
"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
],
dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
},
de: { // German
months: [
'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
],
dayOfWeekShort: [
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
],
dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
},
nl: { // Dutch
months: [
"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
],
dayOfWeekShort: [
"zo", "ma", "di", "wo", "do", "vr", "za"
],
dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
},
tr: { // Turkish
months: [
"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
],
dayOfWeekShort: [
"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
],
dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
},
fr: { //French
months: [
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
],
dayOfWeekShort: [
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
],
dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
},
es: { // Spanish
months: [
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
],
dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
},
th: { // Thai
months: [
'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
],
dayOfWeekShort: [
'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
],
dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
},
pl: { // Polish
months: [
"styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
],
dayOfWeekShort: [
"nd", "pn", "wt", "śr", "cz", "pt", "sb"
],
dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
},
pt: { // Portuguese
months: [
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
],
dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
},
ch: { // Simplified Chinese
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
]
},
se: { // Swedish
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
]
},
km: { // Khmer (ភាសាខ្មែរ)
months: [
"មករា", "កុម្ភៈ", "មិនា", "មេសា", "ឧសភា", "មិថុនា", "កក្កដា", "សីហា", "កញ្ញា", "តុលា", "វិច្ឆិកា", "ធ្នូ"
],
dayOfWeekShort: ["អាទិ", "ច័ន្ទ", "អង្គារ", "ពុធ", "ព្រហ", "សុក្រ", "សៅរ៍"],
dayOfWeek: ["អាទិត្យ", "ច័ន្ទ", "អង្គារ", "ពុធ", "ព្រហស្បតិ៍", "សុក្រ", "សៅរ៍"]
},
kr: { // Korean
months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
],
dayOfWeekShort: [
"일", "월", "화", "수", "목", "금", "토"
],
dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
},
it: { // Italian
months: [
"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
],
dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
},
da: { // Dansk
months: [
"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
],
dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
},
no: { // Norwegian
months: [
"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
],
dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
},
ja: { // Japanese
months: [
"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
],
dayOfWeekShort: [
"日", "月", "火", "水", "木", "金", "土"
],
dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
},
vi: { // Vietnamese
months: [
"Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
],
dayOfWeekShort: [
"CN", "T2", "T3", "T4", "T5", "T6", "T7"
],
dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
},
sl: { // Slovenščina
months: [
"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
],
dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
},
cs: { // Čeština
months: [
"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
],
dayOfWeekShort: [
"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
]
},
hu: { // Hungarian
months: [
"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
],
dayOfWeekShort: [
"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
],
dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
},
az: { //Azerbaijanian (Azeri)
months: [
"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
],
dayOfWeekShort: [
"B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
],
dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
},
bs: { //Bosanski
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
},
ca: { //Català
months: [
"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
],
dayOfWeekShort: [
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
],
dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
},
'en-GB': { //English (British)
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
et: { //"Eesti"
months: [
"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
],
dayOfWeekShort: [
"P", "E", "T", "K", "N", "R", "L"
],
dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
},
eu: { //Euskara
months: [
"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
],
dayOfWeekShort: [
"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
],
dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
},
fi: { //Finnish (Suomi)
months: [
"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
],
dayOfWeekShort: [
"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
],
dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
},
gl: { //Galego
months: [
"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
],
dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
},
hr: { //Hrvatski
months: [
"Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
},
ko: { //Korean (한국어)
months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
],
dayOfWeekShort: [
"일", "월", "화", "수", "목", "금", "토"
],
dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
},
lt: { //Lithuanian (lietuvių)
months: [
"Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
],
dayOfWeekShort: [
"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
],
dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
},
lv: { //Latvian (Latviešu)
months: [
"Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
],
dayOfWeekShort: [
"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
],
dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
},
mk: { //Macedonian (Македонски)
months: [
"јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
],
dayOfWeekShort: [
"нед", "пон", "вто", "сре", "чет", "пет", "саб"
],
dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
},
mn: { //Mongolian (Монгол)
months: [
"1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
],
dayOfWeekShort: [
"Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
],
dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
},
'pt-BR': { //Português(Brasil)
months: [
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
],
dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
},
sk: { //Slovenčina
months: [
"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
],
dayOfWeekShort: [
"Ne", "Po", "Ut", "St", "Št", "Pi", "So"
],
dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
},
sq: { //Albanian (Shqip)
months: [
"Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
],
dayOfWeekShort: [
"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
],
dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
},
'sr-YU': { //Serbian (Srpski)
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
],
dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
},
sr: { //Serbian Cyrillic (Српски)
months: [
"јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
],
dayOfWeekShort: [
"нед", "пон", "уто", "сре", "чет", "пет", "суб"
],
dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
},
sv: { //Svenska
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
],
dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
},
'zh-TW': { //Traditional Chinese (繁體中文)
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
],
dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
},
zh: { //Simplified Chinese (简体中文)
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
],
dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
},
ug:{ // Uyghur(ئۇيغۇرچە)
months: [
"1-ئاي","2-ئاي","3-ئاي","4-ئاي","5-ئاي","6-ئاي","7-ئاي","8-ئاي","9-ئاي","10-ئاي","11-ئاي","12-ئاي"
],
dayOfWeek: [
"يەكشەنبە", "دۈشەنبە","سەيشەنبە","چارشەنبە","پەيشەنبە","جۈمە","شەنبە"
]
},
he: { //Hebrew (עברית)
months: [
'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
],
dayOfWeekShort: [
'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
],
dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
},
hy: { // Armenian
months: [
"Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
],
dayOfWeekShort: [
"Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
],
dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
},
kg: { // Kyrgyz
months: [
'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
],
dayOfWeekShort: [
"Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
],
dayOfWeek: [
"Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
]
},
rm: { // Romansh
months: [
"Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
],
dayOfWeekShort: [
"Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
],
dayOfWeek: [
"Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
]
},
ka: { // Georgian
months: [
'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'
],
dayOfWeekShort: [
"კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
],
dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
}
},
ownerDocument: document,
contentWindow: window,
value: '',
rtl: false,
format: 'Y/m/d H:i',
formatTime: 'H:i',
formatDate: 'Y/m/d',
startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
step: 60,
monthChangeSpinner: true,
closeOnDateSelect: false,
closeOnTimeSelect: true,
closeOnWithoutClick: true,
closeOnInputClick: true,
openOnFocus: true,
timepicker: true,
datepicker: true,
weeks: false,
defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
minDate: false,
maxDate: false,
minTime: false,
maxTime: false,
minDateTime: false,
maxDateTime: false,
allowTimes: [],
opened: false,
initTime: true,
inline: false,
theme: '',
touchMovedThreshold: 5,
onSelectDate: function () {},
onSelectTime: function () {},
onChangeMonth: function () {},
onGetWeekOfYear: function () {},
onChangeYear: function () {},
onChangeDateTime: function () {},
onShow: function () {},
onClose: function () {},
onGenerate: function () {},
withoutCopyright: true,
inverseButton: false,
hours12: false,
next: 'xdsoft_next',
prev : 'xdsoft_prev',
dayOfWeekStart: 0,
parentID: 'body',
timeHeightInTimePicker: 25,
timepickerScrollbar: true,
todayButton: true,
prevButton: true,
nextButton: true,
defaultSelect: true,
scrollMonth: true,
scrollTime: true,
scrollInput: true,
lazyInit: false,
mask: false,
validateOnBlur: true,
allowBlank: true,
yearStart: 1950,
yearEnd: 2050,
monthStart: 0,
monthEnd: 11,
style: '',
id: '',
fixed: false,
roundTime: 'round', // ceil, floor
className: '',
weekends: [],
highlightedDates: [],
highlightedPeriods: [],
allowDates : [],
allowDateRe : null,
disabledDates : [],
disabledWeekDays: [],
yearOffset: 0,
beforeShowDay: null,
enterLikeTab: true,
showApplyButton: false
};
var dateHelper = null,
defaultDateHelper = null,
globalLocaleDefault = 'en',
globalLocale = 'en';
var dateFormatterOptionsDefault = {
meridiem: ['AM', 'PM']
};
var initDateFormatter = function(){
var locale = default_options.i18n[globalLocale],
opts = {
days: locale.dayOfWeek,
daysShort: locale.dayOfWeekShort,
months: locale.months,
monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
};
if (typeof DateFormatter === 'function') {
dateHelper = defaultDateHelper = new DateFormatter({
dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
});
}
};
var dateFormatters = {
moment: {
default_options:{
format: 'YYYY/MM/DD HH:mm',
formatDate: 'YYYY/MM/DD',
formatTime: 'HH:mm',
},
formatter: {
parseDate: function (date, format) {
if(isFormatStandard(format)){
return defaultDateHelper.parseDate(date, format);
}
var d = moment(date, format);
return d.isValid() ? d.toDate() : false;
},
formatDate: function (date, format) {
if(isFormatStandard(format)){
return defaultDateHelper.formatDate(date, format);
}
return moment(date).format(format);
},
formatMask: function(format){
return format
.replace(/Y{4}/g, '9999')
.replace(/Y{2}/g, '99')
.replace(/M{2}/g, '19')
.replace(/D{2}/g, '39')
.replace(/H{2}/g, '29')
.replace(/m{2}/g, '59')
.replace(/s{2}/g, '59');
},
}
}
}
// for locale settings
$.datetimepicker = {
setLocale: function(locale){
var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
if (globalLocale !== newLocale) {
globalLocale = newLocale;
// reinit date formatter
initDateFormatter();
}
},
setDateFormatter: function(dateFormatter) {
if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){
var df = dateFormatters[dateFormatter];
$.extend(default_options, df.default_options);
dateHelper = df.formatter;
}
else {
dateHelper = dateFormatter;
}
},
};
var standardFormats = {
RFC_2822: 'D, d M Y H:i:s O',
ATOM: 'Y-m-d\TH:i:sP',
ISO_8601: 'Y-m-d\TH:i:sO',
RFC_822: 'D, d M y H:i:s O',
RFC_850: 'l, d-M-y H:i:s T',
RFC_1036: 'D, d M y H:i:s O',
RFC_1123: 'D, d M Y H:i:s O',
RSS: 'D, d M Y H:i:s O',
W3C: 'Y-m-d\TH:i:sP'
}
var isFormatStandard = function(format){
return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
}
$.extend($.datetimepicker, standardFormats);
// first init date formatter
initDateFormatter();
// fix for ie8
if (!window.getComputedStyle) {
window.getComputedStyle = function (el) {
this.el = el;
this.getPropertyValue = function (prop) {
var re = /(-([a-z]))/g;
if (prop === 'float') {
prop = 'styleFloat';
}
if (re.test(prop)) {
prop = prop.replace(re, function (a, b, c) {
return c.toUpperCase();
});
}
return el.currentStyle[prop] || null;
};
return this;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj, start) {
var i, j;
for (i = (start || 0), j = this.length; i < j; i += 1) {
if (this[i] === obj) { return i; }
}
return -1;
};
}
Date.prototype.countDaysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
};
$.fn.xdsoftScroller = function (options, percent) {
return this.each(function () {
var timeboxparent = $(this),
pointerEventToXY = function (e) {
var out = {x: 0, y: 0},
touch;
if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
out.x = touch.clientX;
out.y = touch.clientY;
} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
out.x = e.clientX;
out.y = e.clientY;
}
return out;
},
timebox,
parentHeight,
height,
scrollbar,
scroller,
maximumOffset = 100,
start = false,
startY = 0,
startTop = 0,
h1 = 0,
touchStart = false,
startTopScroll = 0,
calcOffset = function () {};
if (percent === 'hide') {
timeboxparent.find('.xdsoft_scrollbar').hide();
return;
}
if (!$(this).hasClass('xdsoft_scroller_box')) {
timebox = timeboxparent.children().eq(0);
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
scrollbar = $('<div class="xdsoft_scrollbar"></div>');
scroller = $('<div class="xdsoft_scroller"></div>');
scrollbar.append(scroller);
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
calcOffset = function calcOffset(event) {
var offset = pointerEventToXY(event).y - startY + startTopScroll;
if (offset < 0) {
offset = 0;
}
if (offset + scroller[0].offsetHeight > h1) {
offset = h1 - scroller[0].offsetHeight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
};
scroller
.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
}
startY = pointerEventToXY(event).y;
startTopScroll = parseInt(scroller.css('margin-top'), 10);
h1 = scrollbar[0].offsetHeight;
if (event.type === 'mousedown' || event.type === 'touchstart') {
if (options.ownerDocument) {
$(options.ownerDocument.body).addClass('xdsoft_noselect');
}
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
.off('mousemove.xdsoft_scroller', calcOffset)
.removeClass('xdsoft_noselect');
});
$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
} else {
touchStart = true;
event.stopPropagation();
event.preventDefault();
}
})
.on('touchmove', function (event) {
if (touchStart) {
event.preventDefault();
calcOffset(event);
}
})
.on('touchend touchcancel', function () {
touchStart = false;
startTopScroll = 0;
});
timeboxparent
.on('scroll_element.xdsoft_scroller', function (event, percentage) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
}
percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
scroller.css('margin-top', maximumOffset * percentage);
setTimeout(function () {
timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
}, 10);
})
.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
var percent, sh;
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
percent = parentHeight / height;
sh = percent * scrollbar[0].offsetHeight;
if (percent > 1) {
scroller.hide();
} else {
scroller.show();
scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
if (noTriggerScroll !== true) {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
}
}
});
timeboxparent.on('mousewheel', function (event) {
var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
top = top - (event.deltaY * 20);
if (top < 0) {
top = 0;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
event.stopPropagation();
return false;
});
timeboxparent.on('touchstart', function (event) {
start = pointerEventToXY(event);
startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
});
timeboxparent.on('touchmove', function (event) {
if (start) {
event.preventDefault();
var coord = pointerEventToXY(event);
timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
}
});
timeboxparent.on('touchend touchcancel', function () {
start = false;
startTop = 0;
});
}
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
});
};
$.fn.datetimepicker = function (opt, opt2) {
var result = this,
KEY0 = 48,
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
CTRLKEY = 17,
DEL = 46,
ENTER = 13,
ESC = 27,
BACKSPACE = 8,
ARROWLEFT = 37,
ARROWUP = 38,
ARROWRIGHT = 39,
ARROWDOWN = 40,
TAB = 9,
F5 = 116,
AKEY = 65,
CKEY = 67,
VKEY = 86,
ZKEY = 90,
YKEY = 89,
ctrlDown = false,
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
lazyInitTimer = 0,
createDateTimePicker,
destroyDateTimePicker,
lazyInit = function (input) {
input
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
return;
}
clearTimeout(lazyInitTimer);
lazyInitTimer = setTimeout(function () {
if (!input.data('xdsoft_datetimepicker')) {
createDateTimePicker(input);
}
input
.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
.trigger('open.xdsoft');
}, 100);
});
};
createDateTimePicker = function (input) {
var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
datepicker = $('<div class="xdsoft_datepicker active"></div>'),
month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
'<button type="button" class="xdsoft_next"></button></div>'),
calendar = $('<div class="xdsoft_calendar"></div>'),
timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
timebox = $('<div class="xdsoft_time_variant"></div>'),
applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
triggerAfterOpen = false,
XDSoft_datetime,
xchangeTimer,
timerclick,
current_time_index,
setPos,
timer = 0,
_xdsoft_datetime,
forEachAncestorOf;
if (options.id) {
datetimepicker.attr('id', options.id);
}
if (options.style) {
datetimepicker.attr('style', options.style);
}
if (options.weeks) {
datetimepicker.addClass('xdsoft_showweeks');
}
if (options.rtl) {
datetimepicker.addClass('xdsoft_rtl');
}
datetimepicker.addClass('xdsoft_' + options.theme);
datetimepicker.addClass(options.className);
month_picker
.find('.xdsoft_month span')
.after(monthselect);
month_picker
.find('.xdsoft_year span')
.after(yearselect);
month_picker
.find('.xdsoft_month,.xdsoft_year')
.on('touchstart mousedown.xdsoft', function (event) {
var select = $(this).find('.xdsoft_select').eq(0),
val = 0,
top = 0,
visible = select.is(':visible'),
items,
i;
month_picker
.find('.xdsoft_select')
.hide();
if (_xdsoft_datetime.currentTime) {
val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
}
select[visible ? 'hide' : 'show']();
for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
if (items.eq(i).data('value') === val) {
break;
} else {
top += items[0].offsetHeight;
}
}
select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
event.stopPropagation();
return false;
});
var handleTouchMoved = function (event) {
var evt = event.originalEvent;
var touchPosition = evt.touches ? evt.touches[0] : evt;
this.touchStartPosition = this.touchStartPosition || touchPosition;
var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX);
var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY);
var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement);
if(distance > options.touchMovedThreshold) {
this.touchMoved = true;
}
}
month_picker
.find('.xdsoft_select')
.xdsoftScroller(options)
.on('touchstart mousedown.xdsoft', function (event) {
var evt = event.originalEvent;
this.touchMoved = false;
this.touchStartPosition = evt.touches ? evt.touches[0] : evt;
event.stopPropagation();
event.preventDefault();
})
.on('touchmove', '.xdsoft_option', handleTouchMoved)
.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
if (!this.touchMoved) {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var year = _xdsoft_datetime.currentTime.getFullYear();
if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
}
$(this).parent().parent().hide();
datetimepicker.trigger('xchange.xdsoft');
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
}
});
datetimepicker.getValue = function () {
return _xdsoft_datetime.getCurrentTime();
};
datetimepicker.setOptions = function (_options) {
var highlightedDates = {};
options = $.extend(true, {}, options, _options);
if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
options.allowTimes = $.extend(true, [], _options.allowTimes);
}
if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
options.weekends = $.extend(true, [], _options.weekends);
}
if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
options.allowDates = $.extend(true, [], _options.allowDates);
}
if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
options.allowDateRe = new RegExp(_options.allowDateRe);
}
if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
$.each(_options.highlightedDates, function (index, value) {
var splitData = $.map(value.split(','), $.trim),
exDesc,
hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
highlightedDates = $.extend(true, [], options.highlightedDates);
$.each(_options.highlightedPeriods, function (index, value) {
var dateTest, // start date
dateEnd,
desc,
hDate,
keyDate,
exDesc,
style;
if ($.isArray(value)) {
dateTest = value[0];
dateEnd = value[1];
desc = value[2];
style = value[3];
}
else {
var splitData = $.map(value.split(','), $.trim);
dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
desc = splitData[2];
style = splitData[3];
}
while (dateTest <= dateEnd) {
hDate = new HighlightedDate(dateTest, desc, style);
keyDate = dateHelper.formatDate(dateTest, options.formatDate);
dateTest.setDate(dateTest.getDate() + 1);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
options.disabledDates = $.extend(true, [], _options.disabledDates);
}
if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
}
if ((options.open || options.opened) && (!options.inline)) {
input.trigger('open.xdsoft');
}
if (options.inline) {
triggerAfterOpen = true;
datetimepicker.addClass('xdsoft_inline');
input.after(datetimepicker).hide();
}
if (options.inverseButton) {
options.next = 'xdsoft_prev';
options.prev = 'xdsoft_next';
}
if (options.datepicker) {
datepicker.addClass('active');
} else {
datepicker.removeClass('active');
}
if (options.timepicker) {
timepicker.addClass('active');
} else {
timepicker.removeClass('active');
}
if (options.value) {
_xdsoft_datetime.setCurrentTime(options.value);
if (input && input.val) {
input.val(_xdsoft_datetime.str);
}
}
if (isNaN(options.dayOfWeekStart)) {
options.dayOfWeekStart = 0;
} else {
options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
}
if (!options.timepickerScrollbar) {
timeboxparent.xdsoftScroller(options, 'hide');
}
if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
}
if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
}
if (options.minDateTime && /^\+(.*)$/.test(options.minDateTime)) {
options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate);
}
if (options.maxDateTime && /^\+(.*)$/.test(options.maxDateTime)) {
options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate);
}
applyButton.toggle(options.showApplyButton);
month_picker
.find('.xdsoft_today_button')
.css('visibility', !options.todayButton ? 'hidden' : 'visible');
month_picker
.find('.' + options.prev)
.css('visibility', !options.prevButton ? 'hidden' : 'visible');
month_picker
.find('.' + options.next)
.css('visibility', !options.nextButton ? 'hidden' : 'visible');
setMask(options);
if (options.validateOnBlur) {
input
.off('blur.xdsoft')
.on('blur.xdsoft', function () {
if (options.allowBlank && (!$.trim($(this).val()).length ||
(typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
$(this).val(null);
datetimepicker.data('xdsoft_datetime').empty();
} else {
var d = dateHelper.parseDate($(this).val(), options.format);
if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
$(this).val(dateHelper.formatDate(d, options.format));
} else {
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
// parse the numbers as 0312 => 03:12
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
$(this).val([splittedHours, splittedMinutes].map(function (item) {
return item > 9 ? item : '0' + item;
}).join(':'));
} else {
$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
}
}
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
}
datetimepicker.trigger('changedatetime.xdsoft');
datetimepicker.trigger('close.xdsoft');
});
}
options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
datetimepicker
.trigger('xchange.xdsoft')
.trigger('afterOpen.xdsoft');
};
datetimepicker
.data('options', options)
.on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation();
event.preventDefault();
yearselect.hide();
monthselect.hide();
return false;
});
//scroll_element = timepicker.find('.xdsoft_time_box');
timeboxparent.append(timebox);
timeboxparent.xdsoftScroller(options);
datetimepicker.on('afterOpen.xdsoft', function () {
timeboxparent.xdsoftScroller(options);
});
datetimepicker
.append(datepicker)
.append(timepicker);
if (options.withoutCopyright !== true) {
datetimepicker
.append(xdsoft_copyright);
}
datepicker
.append(month_picker)
.append(calendar)
.append(applyButton);
$(options.parentID)
.append(datetimepicker);
XDSoft_datetime = function () {
var _this = this;
_this.now = function (norecursion) {
var d = new Date(),
date,
time;
if (!norecursion && options.defaultDate) {
date = _this.strToDateTime(options.defaultDate);
d.setFullYear(date.getFullYear());
d.setMonth(date.getMonth());
d.setDate(date.getDate());
}
d.setFullYear(d.getFullYear());
if (!norecursion && options.defaultTime) {
time = _this.strtotime(options.defaultTime);
d.setHours(time.getHours());
d.setMinutes(time.getMinutes());
d.setSeconds(time.getSeconds());
d.setMilliseconds(time.getMilliseconds());
}
return d;
};
_this.isValidDate = function (d) {
if (Object.prototype.toString.call(d) !== "[object Date]") {
return false;
}
return !isNaN(d.getTime());
};
_this.setCurrentTime = function (dTime, requireValidDate) {
if (typeof dTime === 'string') {
_this.currentTime = _this.strToDateTime(dTime);
}
else if (_this.isValidDate(dTime)) {
_this.currentTime = dTime;
}
else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) {
_this.currentTime = null;
}
else {
_this.currentTime = _this.now();
}
datetimepicker.trigger('xchange.xdsoft');
};
_this.empty = function () {
_this.currentTime = null;
};
_this.getCurrentTime = function () {
return _this.currentTime;
};
_this.nextMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() + 1,
year;
if (month === 12) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
month = 0;
}
year = _this.currentTime.getFullYear();
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.prevMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() - 1;
if (month === -1) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
month = 11;
}
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.getWeekOfYear = function (datetime) {
if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
if (typeof week !== 'undefined') {
return week;
}
}
var onejan = new Date(datetime.getFullYear(), 0, 1);
//First week of the year is th one with the first Thursday according to ISO8601
if (onejan.getDay() !== 4) {
onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
}
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
_this.strToDateTime = function (sDateTime) {
var tmpDate = [], timeOffset, currentTime;
if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
return sDateTime;
}
tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
if (tmpDate) {
tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
}
if (tmpDate && tmpDate[2]) {
timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
} else {
currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
}
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now();
}
return currentTime;
};
_this.strToDate = function (sDate) {
if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
return sDate;
}
var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.strtotime = function (sTime) {
if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
return sTime;
}
var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.str = function () {
var format = options.format;
if (options.yearOffset) {
format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset);
format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4));
}
return dateHelper.formatDate(_this.currentTime, format);
};
_this.currentTime = this.now();
};
_xdsoft_datetime = new XDSoft_datetime();
applyButton.on('touchend click', function (e) {//pathbrite
e.preventDefault();
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input.val(_xdsoft_datetime.str());
datetimepicker.trigger('close.xdsoft');
});
month_picker
.find('.xdsoft_today_button')
.on('touchend mousedown.xdsoft', function () {
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(0, true);
datetimepicker.trigger('afterOpen.xdsoft');
}).on('dblclick.xdsoft', function () {
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
if (currentDate < minDate) {
return;
}
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
if (currentDate > maxDate) {
return;
}
input.val(_xdsoft_datetime.str());
input.trigger('change');
datetimepicker.trigger('close.xdsoft');
});
month_picker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false;
(function arguments_callee1(v) {
if ($this.hasClass(options.next)) {
_xdsoft_datetime.nextMonth();
} else if ($this.hasClass(options.prev)) {
_xdsoft_datetime.prevMonth();
}
if (options.monthChangeSpinner) {
if (!stop) {
timer = setTimeout(arguments_callee1, v || 100);
}
}
}(500));
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
clearTimeout(timer);
stop = true;
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
});
});
timepicker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false,
period = 110;
(function arguments_callee4(v) {
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop'), 10));
if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
}
/**
* Fixed bug:
* When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
* The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
* would cause a bug when you use jquery.css method.
* Let's say: * { transition: all .5s ease; }
* jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
* meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
* next/prev button.
*
* What we should do:
* Replace timebox.css('marginTop') with timebox[0].style.marginTop.
*/
timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
period = (period > 10) ? 10 : period - 10;
if (!stop) {
timer = setTimeout(arguments_callee4, v || period);
}
}(500));
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
clearTimeout(timer);
stop = true;
$([options.ownerDocument.body, options.contentWindow])
.off('touchend mouseup.xdsoft', arguments_callee5);
});
});
xchangeTimer = 0;
// base handler - generating a calendar and timepicker
datetimepicker
.on('xchange.xdsoft', function (event) {
clearTimeout(xchangeTimer);
xchangeTimer = setTimeout(function () {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var table = '',
start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
i = 0,
j,
today = _xdsoft_datetime.now(),
maxDate = false,
minDate = false,
minDateTime = false,
maxDateTime = false,
hDate,
day,
d,
y,
m,
w,
classes = [],
customDateSettings,
newRow = true,
time = '',
h,
line_time,
description;
while (start.getDay() !== options.dayOfWeekStart) {
start.setDate(start.getDate() - 1);
}
table += '<table><thead><tr>';
if (options.weeks) {
table += '<th></th>';
}
for (j = 0; j < 7; j += 1) {
table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
}
table += '</tr></thead>';
table += '<tbody>';
if (options.maxDate !== false) {
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
}
if (options.minDate !== false) {
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
}
if (options.minDateTime !== false) {
minDateTime = _xdsoft_datetime.strToDate(options.minDateTime);
minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds());
}
if (options.maxDateTime !== false) {
maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime);
maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds());
}
var maxDateTimeDay;
if (maxDateTime !== false) {
maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate();
}
while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
classes = [];
i += 1;
day = start.getDay();
d = start.getDate();
y = start.getFullYear();
m = start.getMonth();
w = _xdsoft_datetime.getWeekOfYear(start);
description = '';
classes.push('xdsoft_date');
if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
} else {
customDateSettings = null;
}
if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
classes.push('xdsoft_disabled');
}
}
if(options.allowDates && options.allowDates.length>0){
if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
classes.push('xdsoft_disabled');
}
}
var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate();
if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) {
classes.push('xdsoft_disabled');
}
if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_disabled');
}
if (options.disabledWeekDays.indexOf(day) !== -1) {
classes.push('xdsoft_disabled');
}
if (input.is('[disabled]')) {
classes.push('xdsoft_disabled');
}
if (customDateSettings && customDateSettings[1] !== "") {
classes.push(customDateSettings[1]);
}
if (_xdsoft_datetime.currentTime.getMonth() !== m) {
classes.push('xdsoft_other_month');
}
if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_current');
}
if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_today');
}
if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_weekend');
}
if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
description = hDate.desc === undefined ? '' : hDate.desc;
}
if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
classes.push(options.beforeShowDay(start));
}
if (newRow) {
table += '<tr>';
newRow = false;
if (options.weeks) {
table += '<th>' + w + '</th>';
}
}
table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
'<div>' + d + '</div>' +
'</td>';
if (start.getDay() === options.dayOfWeekStartPrev) {
table += '</tr>';
newRow = true;
}
start.setDate(d + 1);
}
table += '</tbody></table>';
calendar.html(table);
month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset);
// generate timebox
time = '';
h = '';
m = '';
var minTimeMinutesOfDay = 0;
if (options.minTime !== false) {
var t = _xdsoft_datetime.strtotime(options.minTime);
minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
}
var maxTimeMinutesOfDay = 24 * 60;
if (options.maxTime !== false) {
var t = _xdsoft_datetime.strtotime(options.maxTime);
maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
}
if (options.minDateTime !== false) {
var t = _xdsoft_datetime.strToDateTime(options.minDateTime);
var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
if (currentDayIsMinDateTimeDay) {
var m = 60 * t.getHours() + t.getMinutes();
if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m;
}
}
if (options.maxDateTime !== false) {
var t = _xdsoft_datetime.strToDateTime(options.maxDateTime);
var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
if (currentDayIsMaxDateTimeDay) {
var m = 60 * t.getHours() + t.getMinutes();
if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m;
}
}
line_time = function line_time(h, m) {
var now = _xdsoft_datetime.now(), current_time,
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
now.setHours(h);
h = parseInt(now.getHours(), 10);
now.setMinutes(m);
m = parseInt(now.getMinutes(), 10);
classes = [];
var currentMinutesOfDay = 60 * h + m;
if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) {
classes.push('xdsoft_disabled');
}
current_time = new Date(_xdsoft_datetime.currentTime);
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
if (!isALlowTimesInit) {
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
}
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
if (options.defaultSelect || datetimepicker.data('changed')) {
classes.push('xdsoft_current');
} else if (options.initTime) {
classes.push('xdsoft_init_time');
}
}
if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
classes.push('xdsoft_today');
}
time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
};
if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
for (j = 0; j < 60; j += options.step) {
var currentMinutesOfDay = i * 60 + j;
if (currentMinutesOfDay < minTimeMinutesOfDay) continue;
if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue;
h = (i < 10 ? '0' : '') + i;
m = (j < 10 ? '0' : '') + j;
line_time(h, m);
}
}
} else {
for (i = 0; i < options.allowTimes.length; i += 1) {
h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
line_time(h, m);
}
}
timebox.html(time);
opt = '';
for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>';
}
yearselect.children().eq(0)
.html(opt);
for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
}
monthselect.children().eq(0).html(opt);
$(datetimepicker)
.trigger('generate.xdsoft');
}, 10);
event.stopPropagation();
})
.on('afterOpen.xdsoft', function () {
if (options.timepicker) {
var classType, pheight, height, top;
if (timebox.find('.xdsoft_current').length) {
classType = '.xdsoft_current';
} else if (timebox.find('.xdsoft_init_time').length) {
classType = '.xdsoft_init_time';
}
if (classType) {
pheight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
if ((height - pheight) < top) {
top = height - pheight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
} else {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
}
}
});
timerclick = 0;
calendar
.on('touchend click.xdsoft', 'td', function (xdevent) {
xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
timerclick += 1;
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setDate(1);
currentTime.setFullYear($this.data('year'));
currentTime.setMonth($this.data('month'));
currentTime.setDate($this.data('date'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
input.val(_xdsoft_datetime.str());
if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
datetimepicker.trigger('close.xdsoft');
}
setTimeout(function () {
timerclick = 0;
}, 200);
});
timebox
.on('touchstart', 'div', function (xdevent) {
this.touchMoved = false;
})
.on('touchmove', 'div', handleTouchMoved)
.on('touchend click.xdsoft', 'div', function (xdevent) {
if (!this.touchMoved) {
xdevent.stopPropagation();
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setHours($this.data('hour'));
currentTime.setMinutes($this.data('minute'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
datetimepicker.data('input').val(_xdsoft_datetime.str());
if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if (options.inline !== true && options.closeOnTimeSelect === true) {
datetimepicker.trigger('close.xdsoft');
}
}
});
datepicker
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollMonth) {
return true;
}
if (event.deltaY < 0) {
_xdsoft_datetime.nextMonth();
} else {
_xdsoft_datetime.prevMonth();
}
return false;
});
input
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollInput) {
return true;
}
if (!options.datepicker && options.timepicker) {
current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
current_time_index += event.deltaY;
}
if (timebox.children().eq(current_time_index).length) {
timebox.children().eq(current_time_index).trigger('mousedown');
}
return false;
}
if (options.datepicker && !options.timepicker) {
datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
if (input.val) {
input.val(_xdsoft_datetime.str());
}
datetimepicker.trigger('changedatetime.xdsoft');
return false;
}
});
datetimepicker
.on('changedatetime.xdsoft', function (event) {
if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
var $input = datetimepicker.data('input');
options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
delete options.value;
$input.trigger('change');
}
})
.on('generate.xdsoft', function () {
if (options.onGenerate && $.isFunction(options.onGenerate)) {
options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (triggerAfterOpen) {
datetimepicker.trigger('afterOpen.xdsoft');
triggerAfterOpen = false;
}
})
.on('click.xdsoft', function (xdevent) {
xdevent.stopPropagation();
});
current_time_index = 0;
/**
* Runs the callback for each of the specified node's ancestors.
*
* Return FALSE from the callback to stop ascending.
*
* @param {DOMNode} node
* @param {Function} callback
* @returns {undefined}
*/
forEachAncestorOf = function (node, callback) {
do {
node = node.parentNode;
if (!node || callback(node) === false) {
break;
}
} while (node.nodeName !== 'HTML');
};
/**
* Sets the position of the picker.
*
* @returns {undefined}
*/
setPos = function () {
var dateInputOffset,
dateInputElem,
verticalPosition,
left,
position,
datetimepickerElem,
dateInputHasFixedAncestor,
$dateInput,
windowWidth,
verticalAnchorEdge,
datetimepickerCss,
windowHeight,
windowScrollTop;
$dateInput = datetimepicker.data('input');
dateInputOffset = $dateInput.offset();
dateInputElem = $dateInput[0];
verticalAnchorEdge = 'top';
verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
left = dateInputOffset.left;
position = "absolute";
windowWidth = $(options.contentWindow).width();
windowHeight = $(options.contentWindow).height();
windowScrollTop = $(options.contentWindow).scrollTop();
if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
left = left - diff;
}
if ($dateInput.parent().css('direction') === 'rtl') {
left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
}
if (options.fixed) {
verticalPosition -= windowScrollTop;
left -= $(options.contentWindow).scrollLeft();
position = "fixed";
} else {
dateInputHasFixedAncestor = false;
forEachAncestorOf(dateInputElem, function (ancestorNode) {
if (ancestorNode === null) {
return false;
}
if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
dateInputHasFixedAncestor = true;
return false;
}
});
if (dateInputHasFixedAncestor) {
position = 'fixed';
//If the picker won't fit entirely within the viewport then display it above the date input.
if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
verticalAnchorEdge = 'bottom';
verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
} else {
verticalPosition -= windowScrollTop;
}
} else {
if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) {
verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1;
}
}
if (verticalPosition < 0) {
verticalPosition = 0;
}
if (left + dateInputElem.offsetWidth > windowWidth) {
left = windowWidth - dateInputElem.offsetWidth;
}
}
datetimepickerElem = datetimepicker[0];
forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
var ancestorNodePosition;
ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
return false;
}
});
datetimepickerCss = {
position: position,
left: left,
top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones.
};
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
datetimepicker.css(datetimepickerCss);
};
datetimepicker
.on('open.xdsoft', function (event) {
var onShow = true;
if (options.onShow && $.isFunction(options.onShow)) {
onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onShow !== false) {
datetimepicker.show();
setPos();
$(options.contentWindow)
.off('resize.xdsoft', setPos)
.on('resize.xdsoft', setPos);
if (options.closeOnWithoutClick) {
$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
datetimepicker.trigger('close.xdsoft');
$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
});
}
}
})
.on('close.xdsoft', function (event) {
var onClose = true;
month_picker
.find('.xdsoft_month,.xdsoft_year')
.find('.xdsoft_select')
.hide();
if (options.onClose && $.isFunction(options.onClose)) {
onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onClose !== false && !options.opened && !options.inline) {
datetimepicker.hide();
}
event.stopPropagation();
})
.on('toggle.xdsoft', function () {
if (datetimepicker.is(':visible')) {
datetimepicker.trigger('close.xdsoft');
} else {
datetimepicker.trigger('open.xdsoft');
}
})
.data('input', input);
timer = 0;
datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
datetimepicker.setOptions(options);
function getCurrentValue() {
var ct = false, time;
if (options.startDate) {
ct = _xdsoft_datetime.strToDate(options.startDate);
} else {
ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
if (ct) {
ct = _xdsoft_datetime.strToDateTime(ct);
if (options.yearOffset) {
ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds());
}
} else if (options.defaultDate) {
ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
if (options.defaultTime) {
time = _xdsoft_datetime.strtotime(options.defaultTime);
ct.setHours(time.getHours());
ct.setMinutes(time.getMinutes());
}
}
}
if (ct && _xdsoft_datetime.isValidDate(ct)) {
datetimepicker.data('changed', true);
} else {
ct = '';
}
return ct || 0;
}
function setMask(options) {
var isValidValue = function (mask, value) {
var reg = mask
.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
.replace(/_/g, '{digit+}')
.replace(/([0-9]{1})/g, '{digit$1}')
.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
return (new RegExp(reg)).test(value);
},
getCaretPos = function (input) {
try {
if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
var range = options.ownerDocument.selection.createRange();
return range.getBookmark().charCodeAt(2) - 2;
}
if (input.setSelectionRange) {
return input.selectionStart;
}
} catch (e) {
return 0;
}
},
setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
if (!node) {
return false;
}
if (node.createTextRange) {
var textRange = node.createTextRange();
textRange.collapse(true);
textRange.moveEnd('character', pos);
textRange.moveStart('character', pos);
textRange.select();
return true;
}
if (node.setSelectionRange) {
node.setSelectionRange(pos, pos);
return true;
}
return false;
};
if(options.mask) {
input.off('keydown.xdsoft');
}
if (options.mask === true) {
if (dateHelper.formatMask) {
options.mask = dateHelper.formatMask(options.format)
} else {
options.mask = options.format
.replace(/Y/g, '9999')
.replace(/F/g, '9999')
.replace(/m/g, '19')
.replace(/d/g, '39')
.replace(/H/g, '29')
.replace(/i/g, '59')
.replace(/s/g, '59');
}
}
if ($.type(options.mask) === 'string') {
if (!isValidValue(options.mask, input.val())) {
input.val(options.mask.replace(/[0-9]/g, '_'));
setCaretPos(input[0], 0);
}
input.on('paste.xdsoft', function (event) {
// couple options here
// 1. return false - tell them they can't paste
// 2. insert over current characters - minimal validation
// 3. full fledged parsing and validation
// let's go option 2 for now
// fires multiple times for some reason
// https://stackoverflow.com/a/30496488/1366033
var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
pastedData = clipboardData.getData('text'),
val = this.value,
pos = this.selectionStart
var valueBeforeCursor = val.substr(0, pos);
var valueAfterPaste = val.substr(pos + pastedData.length);
val = valueBeforeCursor + pastedData + valueAfterPaste;
pos += pastedData.length;
if (isValidValue(options.mask, val)) {
this.value = val;
setCaretPos(this, pos);
} else if ($.trim(val) === '') {
this.value = options.mask.replace(/[0-9]/g, '_');
} else {
input.trigger('error_input.xdsoft');
}
event.preventDefault();
return false;
});
input.on('keydown.xdsoft', function (event) {
var val = this.value,
key = event.which,
pos = this.selectionStart,
selEnd = this.selectionEnd,
hasSel = pos !== selEnd,
digit;
// only alow these characters
if (((key >= KEY0 && key <= KEY9) ||
(key >= _KEY0 && key <= _KEY9)) ||
(key === BACKSPACE || key === DEL)) {
// get char to insert which is new character or placeholder ('_')
digit = (key === BACKSPACE || key === DEL) ? '_' :
String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key);
// we're deleting something, we're not at the start, and have normal cursor, move back one
// if we have a selection length, cursor actually sits behind deletable char, not in front
if (key === BACKSPACE && pos && !hasSel) {
pos -= 1;
}
// don't stop on a separator, continue whatever direction you were going
// value char - keep incrementing position while on separator char and we still have room
// del char - keep decrementing position while on separator char and we still have room
while (true) {
var maskValueAtCurPos = options.mask.substr(pos, 1);
var posShorterThanMaskLength = pos < options.mask.length;
var posGreaterThanZero = pos > 0;
var notNumberOrPlaceholder = /[^0-9_]/;
var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos);
var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero
// if we hit a real char, stay where we are
if (!continueMovingPosition) break;
// hitting backspace in a selection, you can possibly go back any further - go forward
pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
}
if (hasSel) {
// pos might have moved so re-calc length
var selLength = selEnd - pos
// if we have a selection length we will wipe out entire selection and replace with default template for that range
var defaultBlank = options.mask.replace(/[0-9]/g, '_');
var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength);
var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
var valueBeforeSel = val.substr(0, pos);
var insertChars = digit + selReplacementRemainder;
var charsAfterSelection = val.substr(pos + selLength);
val = valueBeforeSel + insertChars + charsAfterSelection
} else {
var valueBeforeCursor = val.substr(0, pos);
var insertChar = digit;
var valueAfterNextChar = val.substr(pos + 1);
val = valueBeforeCursor + insertChar + valueAfterNextChar
}
if ($.trim(val) === '') {
// if empty, set to default
val = defaultBlank
} else {
// if at the last character don't need to do anything
if (pos === options.mask.length) {
event.preventDefault();
return false;
}
}
// resume cursor location
pos += (key === BACKSPACE) ? 0 : 1;
// don't stop on a separator, continue whatever direction you were going
while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
pos += (key === BACKSPACE) ? 0 : 1;
}
if (isValidValue(options.mask, val)) {
this.value = val;
setCaretPos(this, pos);
} else if ($.trim(val) === '') {
this.value = options.mask.replace(/[0-9]/g, '_');
} else {
input.trigger('error_input.xdsoft');
}
} else {
if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
return true;
}
}
event.preventDefault();
return false;
});
}
}
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input
.data('xdsoft_datetimepicker', datetimepicker)
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
return;
}
if (!options.openOnFocus) {
return;
}
clearTimeout(timer);
timer = setTimeout(function () {
if (input.is(':disabled')) {
return;
}
triggerAfterOpen = true;
_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
if(options.mask) {
setMask(options);
}
datetimepicker.trigger('open.xdsoft');
}, 100);
})
.on('keydown.xdsoft', function (event) {
var elementSelector,
key = event.which;
if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
datetimepicker.trigger('close.xdsoft');
elementSelector.eq(elementSelector.index(this) + 1).focus();
return false;
}
if ([TAB].indexOf(key) !== -1) {
datetimepicker.trigger('close.xdsoft');
return true;
}
})
.on('blur.xdsoft', function () {
datetimepicker.trigger('close.xdsoft');
});
};
destroyDateTimePicker = function (input) {
var datetimepicker = input.data('xdsoft_datetimepicker');
if (datetimepicker) {
datetimepicker.data('xdsoft_datetime', null);
datetimepicker.remove();
input
.data('xdsoft_datetimepicker', null)
.off('.xdsoft');
$(options.contentWindow).off('resize.xdsoft');
$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
if (input.unmousewheel) {
input.unmousewheel();
}
}
};
$(options.ownerDocument)
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
.on('keydown.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = true;
}
})
.on('keyup.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = false;
}
});
this.each(function () {
var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
if (datetimepicker) {
if ($.type(opt) === 'string') {
switch (opt) {
case 'show':
$(this).select().focus();
datetimepicker.trigger('open.xdsoft');
break;
case 'hide':
datetimepicker.trigger('close.xdsoft');
break;
case 'toggle':
datetimepicker.trigger('toggle.xdsoft');
break;
case 'destroy':
destroyDateTimePicker($(this));
break;
case 'reset':
this.value = this.defaultValue;
if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
datetimepicker.data('changed', false);
}
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
break;
case 'validate':
$input = datetimepicker.data('input');
$input.trigger('blur.xdsoft');
break;
default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2);
}
}
} else {
datetimepicker
.setOptions(opt);
}
return 0;
}
if ($.type(opt) !== 'string') {
if (!options.lazyInit || options.open || options.inline) {
createDateTimePicker($(this));
} else {
lazyInit($(this));
}
}
});
return result;
};
$.fn.datetimepicker.defaults = default_options;
function HighlightedDate(date, desc, style) {
"use strict";
this.date = date;
this.desc = desc;
this.style = style;
}
};
;(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery', 'jquery-mousewheel'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory(require('jquery'));;
} else {
// Browser globals
factory(jQuery);
}
}(datetimepickerFactory));
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
slice = Array.prototype.slice,
nullLowestDeltaTimeout, lowestDelta;
if ( $.event.fixHooks ) {
for ( var i = toFix.length; i; ) {
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
}
}
var special = $.event.special.mousewheel = {
version: '3.1.12',
setup: function() {
if ( this.addEventListener ) {
for ( var i = toBind.length; i; ) {
this.addEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i = toBind.length; i; ) {
this.removeEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
}
});
function handler(event) {
var orgEvent = event || window.event,
args = slice.call(arguments, 1),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
offsetX = 0,
offsetY = 0;
event = $.event.fix(orgEvent);
event.type = 'mousewheel';
// Old school scrollwheel delta
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaX = deltaY * -1;
deltaY = 0;
}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta = deltaY === 0 ? deltaX : deltaY;
// New school wheel delta (wheel event)
if ( 'deltaY' in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( 'deltaX' in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
}
// No change actually happened, no reason to go any further
if ( deltaY === 0 && deltaX === 0 ) { return; }
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
// * deltaMode 0 is by pixels, nothing to do
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
}
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
if ( !lowestDelta || absDelta < lowestDelta ) {
lowestDelta = absDelta;
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
lowestDelta /= 40;
}
}
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
// Divide all the things by 40!
delta /= 40;
deltaX /= 40;
deltaY /= 40;
}
// Get a whole, normalized value for the deltas
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
// Normalise offsetX and offsetY properties
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
var boundingRect = this.getBoundingClientRect();
offsetX = event.clientX - boundingRect.left;
offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;
event.deltaY = deltaY;
event.deltaFactor = lowestDelta;
event.offsetX = offsetX;
event.offsetY = offsetY;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode = 0;
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
function nullLowestDelta() {
lowestDelta = null;
}
function shouldAdjustOldDeltas(orgEvent, absDelta) {
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
}
}));
|
import React, { Component } from 'react'
import { Link } from 'gatsby'
import { Row, Col } from 'antd'
const FooterListItem = props => (
<div className="footer-li">
{props.to ? (
<Row>
<Link to={props.to}>{props.children}</Link>
</Row>
) : (
props.children
)}
</div>
)
class Footer extends Component {
render() {
return (
<div className="footer-universal">
<Row gutter={[24, 8]} justify="space-around" style={{margin: 0}}>
<Col xs={0} sm={0} md={0} lg={6} xl={6} className="gutter-row">
</Col>
<Col xs={24} sm={24} md={24} lg={16} xl={16} className="gutter-row">
<Col xs={24} sm={24} md={4} lg={4} xl={4} className="gutter-row">
<span className="footer-links-header" justify="space-around">Why PostHog</span>
<FooterListItem to="/product-features">Features</FooterListItem>
<FooterListItem to="/pricing">Pricing</FooterListItem>
<FooterListItem to="/faq">FAQ</FooterListItem>
<FooterListItem to="/startups">PostHog for Startups</FooterListItem>
</Col>
<Col xs={24} sm={24} md={4} lg={4} xl={4} className="gutter-row">
<span className="footer-links-header">Resources</span>
<FooterListItem to="/docs/deployment">Quick Start</FooterListItem>
<FooterListItem to="/docs">Docs</FooterListItem>
<FooterListItem to="/blog">Blog</FooterListItem>
<FooterListItem to="/newsletter">Newsletter</FooterListItem>
</Col>
<Col xs={24} sm={24} md={4} lg={4} xl={4} className="gutter-row">
<span className="footer-links-header">Community</span>
<FooterListItem>
<a href="https://github.com/PostHog/posthog/graphs/contributors">
Contributors
</a>
</FooterListItem>
<FooterListItem>
<a href="https://github.com/posthog/posthog">Source code</a>
</FooterListItem>
<FooterListItem>
<a href="https://github.com/posthog">Explore repositories</a>
</FooterListItem>
<FooterListItem to="/handbook/roadmap">Roadmap</FooterListItem>
<FooterListItem>
<a href="https://github.com/PostHog/posthog/blob/master/CONTRIBUTING.md">
Contribute
</a>
</FooterListItem>
<FooterListItem>
<a href="https://github.com/PostHog/posthog/issues">Issues</a>
</FooterListItem>
</Col>
<Col xs={24} sm={24} md={4} lg={4} xl={4} className="gutter-row">
<span className="footer-links-header">Support</span>
<FooterListItem to="/support">Support</FooterListItem>
<FooterListItem><a href="mailto:[email protected]">Contact sales</a></FooterListItem>
<FooterListItem to="/status">Status</FooterListItem>
</Col>
<Col xs={24} sm={24} md={4} lg={4} xl={4} className="gutter-row">
<span className="footer-links-header">Company</span>
<FooterListItem to="/handbook/story">About</FooterListItem>
<FooterListItem to="/handbook">Handbook</FooterListItem>
<FooterListItem to="/careers">Careers</FooterListItem>
<FooterListItem to="/handbook/investors">Investors</FooterListItem>
<FooterListItem to="/media">Media</FooterListItem>
<FooterListItem to="/terms">Terms</FooterListItem>
</Col>
</Col>
<Col xs={0} sm={0} md={0} lg={4} xl={4} className="gutter-row">
</Col>
</Row>
</div>
)
}
}
export default Footer
|
var searchData=
[
['sl_20interface_20porting_20guide',['SL Interface Porting Guide',['../porting_guide.html',1,'SlNetSock_overview']]],
['s_5faddr',['s_addr',['../structSlNetSock__InAddr__t.html#a7dec588a9be0d55cced4a8e1737a3bba',1,'SlNetSock_InAddr_t']]],
['sa_5fdata',['sa_data',['../structSlNetSock__Addr__t.html#aed2c32bbc74c64c5b2ac6ce46cab3b26',1,'SlNetSock_Addr_t']]],
['sa_5ffamily',['sa_family',['../structSlNetSock__Addr__t.html#ac4302e69ee1039f1412ff7d13b0d5b04',1,'SlNetSock_Addr_t']]],
['sackpermittedenabled',['sackPermittedEnabled',['../structSlNetSock__SackPermitted__t.html#a62c4023542ff1031b7d086d5352a6331',1,'SlNetSock_SackPermitted_t']]],
['scanfield',['scanField',['../structURLHandler__Setup.html#ade844531d4104e19d511c6c6601247ec',1,'URLHandler_Setup']]],
['sdsetbitmap',['sdSetBitmap',['../structSlNetSock__SdSet__t.html#a032f6151419a2aa71eb0d2ab32f51177',1,'SlNetSock_SdSet_t']]],
['securealpn',['secureALPN',['../structSlNetSock__SecureALPN__t.html#aa247b25d5cceb70f3849a320004e736b',1,'SlNetSock_SecureALPN_t']]],
['securefiles',['secureFiles',['../structMQTTClient__ConnParams.html#a768b59dcf06a72687ed2d4ae68b17b95',1,'MQTTClient_ConnParams::secureFiles()'],['../struct__MQTTServer__ConnParams__.html#a102d9a559c67f5bb358f1eb832f7c0a0',1,'_MQTTServer_ConnParams_::secureFiles()']]],
['securemask',['secureMask',['../structSlNetSock__SecureMask__t.html#ae2930574c064e02d5c1fec73f22f84d6',1,'SlNetSock_SecureMask_t']]],
['securemethod',['secureMethod',['../structSlNetSock__SecureMethod__t.html#a1e739077a189dd9fa7e2c06359702062',1,'SlNetSock_SecureMethod_t']]],
['serveraddr',['serverAddr',['../structMQTTClient__ConnParams.html#a7252e8fada348a26ef1a2a23a323ad42',1,'MQTTClient_ConnParams']]],
['sin6_5faddr',['sin6_addr',['../structSlNetSock__AddrIn6__t.html#a661e81c49b8709fd30a22e210f5fa7af',1,'SlNetSock_AddrIn6_t']]],
['sin6_5ffamily',['sin6_family',['../structSlNetSock__AddrIn6__t.html#a4cbe74f712aeeb4c97f106259698dc37',1,'SlNetSock_AddrIn6_t']]],
['sin6_5fflowinfo',['sin6_flowinfo',['../structSlNetSock__AddrIn6__t.html#ae4ed19039481c3e3de3a0a869e93d287',1,'SlNetSock_AddrIn6_t']]],
['sin6_5fport',['sin6_port',['../structSlNetSock__AddrIn6__t.html#a61abf2ed104c1f41531abec279962cf8',1,'SlNetSock_AddrIn6_t']]],
['sin6_5fscope_5fid',['sin6_scope_id',['../structSlNetSock__AddrIn6__t.html#a8c4ce7648ac082c2bb0ebbe1bb5d57d1',1,'SlNetSock_AddrIn6_t']]],
['sin_5faddr',['sin_addr',['../structSlNetSock__AddrIn__t.html#a521c184cd338025af99803d1ea11f982',1,'SlNetSock_AddrIn_t']]],
['sin_5ffamily',['sin_family',['../structSlNetSock__AddrIn__t.html#a9513f9fa22bb590c39b24bfbd9903e19',1,'SlNetSock_AddrIn_t']]],
['sin_5fport',['sin_port',['../structSlNetSock__AddrIn__t.html#a0cb27a717e5f4fbfe6a2935987532cd8',1,'SlNetSock_AddrIn_t']]],
['sin_5fzero',['sin_zero',['../structSlNetSock__AddrIn__t.html#abf505c793b8a4e9ebb900fcd16792551',1,'SlNetSock_AddrIn_t']]],
['slnet_20group',['SlNet group',['../group__SlNet.html',1,'']]],
['slnet_2eh',['slnet.h',['../slnet_8h.html',1,'']]],
['slneterr_20group',['SlNetErr group',['../group__SlNetErr.html',1,'']]],
['slneterr_2eh',['slneterr.h',['../slneterr_8h.html',1,'']]],
['slneterr_5fapi_5faborted',['SLNETERR_API_ABORTED',['../group__SlNetErr.html#gabc3e6b69741bc71ddd84e379d22986ce',1,'slneterr.h']]],
['slneterr_5fbad_5finterface',['SLNETERR_BAD_INTERFACE',['../group__SlNetErr.html#gaa875cc1bfb9b713be8f9bd9a090fbfb5',1,'slneterr.h']]],
['slneterr_5fbsd_5fconnection_5fpending',['SLNETERR_BSD_CONNECTION_PENDING',['../group__SlNetErr.html#ga63013a9ee669313ec852187671f2042e',1,'slneterr.h']]],
['slneterr_5fbsd_5feacces',['SLNETERR_BSD_EACCES',['../group__SlNetErr.html#ga69acc2e6b9b87554276693185d092ab3',1,'slneterr.h']]],
['slneterr_5fbsd_5feaddrinuse',['SLNETERR_BSD_EADDRINUSE',['../group__SlNetErr.html#gac336b4d4ef87426cc2459e9f5d115fed',1,'slneterr.h']]],
['slneterr_5fbsd_5feaddrnotavail',['SLNETERR_BSD_EADDRNOTAVAIL',['../group__SlNetErr.html#ga1de3b517d0a5a52ee6e8a3ff5f16a4dc',1,'slneterr.h']]],
['slneterr_5fbsd_5feafnosupport',['SLNETERR_BSD_EAFNOSUPPORT',['../group__SlNetErr.html#gaa9242365708c1d22e97d1b1f3f100442',1,'slneterr.h']]],
['slneterr_5fbsd_5feagain',['SLNETERR_BSD_EAGAIN',['../group__SlNetErr.html#ga1e6a07cd5f63fcd0ec48ce463fc94e42',1,'slneterr.h']]],
['slneterr_5fbsd_5fealready',['SLNETERR_BSD_EALREADY',['../group__SlNetErr.html#ga220feb72ea8c3b044104bd16407b6873',1,'slneterr.h']]],
['slneterr_5fbsd_5fealready_5fenabled',['SLNETERR_BSD_EALREADY_ENABLED',['../group__SlNetErr.html#ga4d63e951753639ebc0508aaa32d0463b',1,'slneterr.h']]],
['slneterr_5fbsd_5feauto_5fconnect_5for_5fconnecting',['SLNETERR_BSD_EAUTO_CONNECT_OR_CONNECTING',['../group__SlNetErr.html#gab0aa8fae2cd3995e4c56e1dc875deb25',1,'slneterr.h']]],
['slneterr_5fbsd_5febadf',['SLNETERR_BSD_EBADF',['../group__SlNetErr.html#ga4b326c3c6ba30f04ebe999bb4a659cbf',1,'slneterr.h']]],
['slneterr_5fbsd_5feclose',['SLNETERR_BSD_ECLOSE',['../group__SlNetErr.html#gaaa3cb82204cf3d959c3917d6489c80ce',1,'slneterr.h']]],
['slneterr_5fbsd_5feconnaborted',['SLNETERR_BSD_ECONNABORTED',['../group__SlNetErr.html#gad18d77e1ea2a2b9c251ee590f5e88f7c',1,'slneterr.h']]],
['slneterr_5fbsd_5feconnrefused',['SLNETERR_BSD_ECONNREFUSED',['../group__SlNetErr.html#gaa762f9f6671c03c9c3d5443583e5b805',1,'slneterr.h']]],
['slneterr_5fbsd_5feconnreset',['SLNETERR_BSD_ECONNRESET',['../group__SlNetErr.html#ga7d36f1426a30243cacca221a637e99db',1,'slneterr.h']]],
['slneterr_5fbsd_5fedestaddrreq',['SLNETERR_BSD_EDESTADDRREQ',['../group__SlNetErr.html#ga30e49b6cb74958a51223b8a7425c2957',1,'slneterr.h']]],
['slneterr_5fbsd_5fedom',['SLNETERR_BSD_EDOM',['../group__SlNetErr.html#gaae89626b05b8fc53f4781e1ba0427f63',1,'slneterr.h']]],
['slneterr_5fbsd_5fefault',['SLNETERR_BSD_EFAULT',['../group__SlNetErr.html#ga11324ec74d9af0f4e07eb20ec48ce881',1,'slneterr.h']]],
['slneterr_5fbsd_5fehostdown',['SLNETERR_BSD_EHOSTDOWN',['../group__SlNetErr.html#ga19ff116477372fb3c1389c27c5f9176c',1,'slneterr.h']]],
['slneterr_5fbsd_5fehostunreach',['SLNETERR_BSD_EHOSTUNREACH',['../group__SlNetErr.html#gaf0b1e2c7fafcdb0e3e98d7b0d4b9fe56',1,'slneterr.h']]],
['slneterr_5fbsd_5feinval',['SLNETERR_BSD_EINVAL',['../group__SlNetErr.html#gab32afb693511e3ae75432feb54e1018a',1,'slneterr.h']]],
['slneterr_5fbsd_5feisconn',['SLNETERR_BSD_EISCONN',['../group__SlNetErr.html#ga03b5b07a1136da9ea1709b123d176989',1,'slneterr.h']]],
['slneterr_5fbsd_5femsgsize',['SLNETERR_BSD_EMSGSIZE',['../group__SlNetErr.html#ga5667d7f6d14972ab9cd6d5dd8d5ac064',1,'slneterr.h']]],
['slneterr_5fbsd_5fenetdown',['SLNETERR_BSD_ENETDOWN',['../group__SlNetErr.html#ga02540ae0771fb79b1bb48913109777d9',1,'slneterr.h']]],
['slneterr_5fbsd_5fenetunreach',['SLNETERR_BSD_ENETUNREACH',['../group__SlNetErr.html#ga550004a8ce01990fa5ef5583dfe9aab9',1,'slneterr.h']]],
['slneterr_5fbsd_5fenobufs',['SLNETERR_BSD_ENOBUFS',['../group__SlNetErr.html#ga571b02e0abb1d25599047a0d5b23cdeb',1,'slneterr.h']]],
['slneterr_5fbsd_5fenomem',['SLNETERR_BSD_ENOMEM',['../group__SlNetErr.html#ga4cdefc3f246a154a16581a7389fcfcec',1,'slneterr.h']]],
['slneterr_5fbsd_5fenoprotoopt',['SLNETERR_BSD_ENOPROTOOPT',['../group__SlNetErr.html#gabeb8f9a1f8fdc0a3aaaabd46da0da169',1,'slneterr.h']]],
['slneterr_5fbsd_5fenospc',['SLNETERR_BSD_ENOSPC',['../group__SlNetErr.html#ga68f7e34cc2d7fa56a215bed68c1a2c51',1,'slneterr.h']]],
['slneterr_5fbsd_5fenotconn',['SLNETERR_BSD_ENOTCONN',['../group__SlNetErr.html#gac423cda075596f8f11308b3969fb6f80',1,'slneterr.h']]],
['slneterr_5fbsd_5fenotsock',['SLNETERR_BSD_ENOTSOCK',['../group__SlNetErr.html#ga402f647ce7d4dde9e83bb2e621492b34',1,'slneterr.h']]],
['slneterr_5fbsd_5fensock',['SLNETERR_BSD_ENSOCK',['../group__SlNetErr.html#gab6f2f866f4c42ef3b7d8c9bd297ba245',1,'slneterr.h']]],
['slneterr_5fbsd_5fenxio',['SLNETERR_BSD_ENXIO',['../group__SlNetErr.html#gaa9aae19543bcd9c524bf44f4c637e142',1,'slneterr.h']]],
['slneterr_5fbsd_5feobuff',['SLNETERR_BSD_EOBUFF',['../group__SlNetErr.html#ga06e81863fa5702e16d25cf8667bd57e2',1,'slneterr.h']]],
['slneterr_5fbsd_5feopnotsupp',['SLNETERR_BSD_EOPNOTSUPP',['../group__SlNetErr.html#ga5729904fda75f5c734d78e2cef8698ab',1,'slneterr.h']]],
['slneterr_5fbsd_5feprotonosupport',['SLNETERR_BSD_EPROTONOSUPPORT',['../group__SlNetErr.html#gadda08790c3ce4a8ad0043f92e8770c69',1,'slneterr.h']]],
['slneterr_5fbsd_5feprototype',['SLNETERR_BSD_EPROTOTYPE',['../group__SlNetErr.html#ga269d4e45666626ab6e7316163c4944ec',1,'slneterr.h']]],
['slneterr_5fbsd_5feshutdown',['SLNETERR_BSD_ESHUTDOWN',['../group__SlNetErr.html#ga901411fae8a8c94e65c8a317f6dbd07f',1,'slneterr.h']]],
['slneterr_5fbsd_5fesocktnosupport',['SLNETERR_BSD_ESOCKTNOSUPPORT',['../group__SlNetErr.html#ga954a609805e6cc12567ba9af9b37a15f',1,'slneterr.h']]],
['slneterr_5fbsd_5fetimedout',['SLNETERR_BSD_ETIMEDOUT',['../group__SlNetErr.html#ga12ac5ee0e02072441fda41d23cee4fd9',1,'slneterr.h']]],
['slneterr_5fbsd_5feunsupported_5frole',['SLNETERR_BSD_EUNSUPPORTED_ROLE',['../group__SlNetErr.html#ga2eac0f15ac368ded867faba9b64bdf11',1,'slneterr.h']]],
['slneterr_5fbsd_5fewouldblock',['SLNETERR_BSD_EWOULDBLOCK',['../group__SlNetErr.html#ga00c309ceb6135ade45609d6f076841ec',1,'slneterr.h']]],
['slneterr_5fbsd_5finexe',['SLNETERR_BSD_INEXE',['../group__SlNetErr.html#ga50e880e2b3dc29b85fa9d20b1ab5f93f',1,'slneterr.h']]],
['slneterr_5fbsd_5fsoc_5ferror',['SLNETERR_BSD_SOC_ERROR',['../group__SlNetErr.html#gabf84713a30c885a5b279c966208218ee',1,'slneterr.h']]],
['slneterr_5fcalib_5ffail',['SLNETERR_CALIB_FAIL',['../group__SlNetErr.html#gad67ab3786378750667245d35560bff2c',1,'slneterr.h']]],
['slneterr_5fdevice_5flocked_5fsecurity_5falert',['SLNETERR_DEVICE_LOCKED_SECURITY_ALERT',['../group__SlNetErr.html#ga8002cc3bdeb9ffef2cff5c8126b7ee74',1,'slneterr.h']]],
['slneterr_5fdevice_5fname_5finvalid',['SLNETERR_DEVICE_NAME_INVALID',['../group__SlNetErr.html#ga483cb142c534ea52fb60e2aacccb703b',1,'slneterr.h']]],
['slneterr_5fdevice_5fname_5flen_5ferr',['SLNETERR_DEVICE_NAME_LEN_ERR',['../group__SlNetErr.html#ga15664a209dce31098f5547319a02355c',1,'slneterr.h']]],
['slneterr_5fdomain_5fname_5finvalid',['SLNETERR_DOMAIN_NAME_INVALID',['../group__SlNetErr.html#gab86f4217075f0c543565ad4e29c6ccf7',1,'slneterr.h']]],
['slneterr_5fdomain_5fname_5flen_5ferr',['SLNETERR_DOMAIN_NAME_LEN_ERR',['../group__SlNetErr.html#ga2f7d9fc563663854f07b34cd766dbe39',1,'slneterr.h']]],
['slneterr_5fesec_5faccess_5fdenied',['SLNETERR_ESEC_ACCESS_DENIED',['../group__SlNetErr.html#ga3304f49a7e8edc17bd7e089c5227e876',1,'slneterr.h']]],
['slneterr_5fesec_5falgo_5fid_5fe',['SLNETERR_ESEC_ALGO_ID_E',['../group__SlNetErr.html#gaec3e4e8c3ce83a0e56038f17853ed40a',1,'slneterr.h']]],
['slneterr_5fesec_5falt_5fname_5fe',['SLNETERR_ESEC_ALT_NAME_E',['../group__SlNetErr.html#gacfcb52922c77bfa0c8c2091d9e803f66',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fafter_5fdate_5fe',['SLNETERR_ESEC_ASN_AFTER_DATE_E',['../group__SlNetErr.html#ga3bcad4a8a30b8eafe633d387f3c97827',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fbefore_5fdate_5fe',['SLNETERR_ESEC_ASN_BEFORE_DATE_E',['../group__SlNetErr.html#ga49f4c7633697f832676f24305deda666',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fbitstr_5fe',['SLNETERR_ESEC_ASN_BITSTR_E',['../group__SlNetErr.html#gaf6b25f3edec7e49832a9ba8c06442b9a',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fcrit_5fext_5fe',['SLNETERR_ESEC_ASN_CRIT_EXT_E',['../group__SlNetErr.html#gac480d17ddb0b6b0d11585043929e57e2',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fcrl_5fconfirm_5fe',['SLNETERR_ESEC_ASN_CRL_CONFIRM_E',['../group__SlNetErr.html#ga5b92f2c61c11d614441c2c302936be70',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fcrl_5fno_5fsigner_5fe',['SLNETERR_ESEC_ASN_CRL_NO_SIGNER_E',['../group__SlNetErr.html#ga1e9ba40f2821e68eb13269774cf74053',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fdate_5fsz_5fe',['SLNETERR_ESEC_ASN_DATE_SZ_E',['../group__SlNetErr.html#gaed93aebd8a4fb50fab5f43f74c5556c4',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fdh_5fkey_5fe',['SLNETERR_ESEC_ASN_DH_KEY_E',['../group__SlNetErr.html#ga746da0beae2d729d42213ae1f75284a4',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fecc_5fkey_5fe',['SLNETERR_ESEC_ASN_ECC_KEY_E',['../group__SlNetErr.html#ga7b6ab3c2ed476e5ac417d3e0348c7836',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fexpect_5f0_5fe',['SLNETERR_ESEC_ASN_EXPECT_0_E',['../group__SlNetErr.html#ga89b4d5eb084f23ed9b28aa93d51263e7',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fgetint_5fe',['SLNETERR_ESEC_ASN_GETINT_E',['../group__SlNetErr.html#gacd737e173da1642409ce2e3dc4351b86',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5finput_5fe',['SLNETERR_ESEC_ASN_INPUT_E',['../group__SlNetErr.html#gae61bbe2c0ed496b080e101633c35facf',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fno_5fsigner_5fe',['SLNETERR_ESEC_ASN_NO_SIGNER_E',['../group__SlNetErr.html#ga50c97276d1ca57c3482fc3de76049263',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fntru_5fkey_5fe',['SLNETERR_ESEC_ASN_NTRU_KEY_E',['../group__SlNetErr.html#gac0ebc8be4c7e2a5a4cb27f44a3aa25d2',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fobject_5fid_5fe',['SLNETERR_ESEC_ASN_OBJECT_ID_E',['../group__SlNetErr.html#ga2e30ea76a06ee12250c890f56f0db08f',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5focsp_5fconfirm_5fe',['SLNETERR_ESEC_ASN_OCSP_CONFIRM_E',['../group__SlNetErr.html#ga49a7ffa1e94a8936b476cacfda46c0c8',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fparse_5fe',['SLNETERR_ESEC_ASN_PARSE_E',['../group__SlNetErr.html#ga7aff3c1dc6c1d9246f540062c8f3eaaa',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5frsa_5fkey_5fe',['SLNETERR_ESEC_ASN_RSA_KEY_E',['../group__SlNetErr.html#ga7d081b081e8ed026b4d4dbc37db252b9',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fsig_5fconfirm_5fe',['SLNETERR_ESEC_ASN_SIG_CONFIRM_E',['../group__SlNetErr.html#ga7c8f6fc5dee9bf95b671e283857e47d6',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fsig_5fhash_5fe',['SLNETERR_ESEC_ASN_SIG_HASH_E',['../group__SlNetErr.html#gab1baa44adaaeb299bbb22b0b6a08fb27',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fsig_5fkey_5fe',['SLNETERR_ESEC_ASN_SIG_KEY_E',['../group__SlNetErr.html#ga0c52126718578f05f23c262918065fc2',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fsig_5foid_5fe',['SLNETERR_ESEC_ASN_SIG_OID_E',['../group__SlNetErr.html#ga59e7b056309efeee22de16b383ceb7bc',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5ftag_5fnull_5fe',['SLNETERR_ESEC_ASN_TAG_NULL_E',['../group__SlNetErr.html#ga748b829455e4b11190bb3fbf24d7f50a',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5ftime_5fe',['SLNETERR_ESEC_ASN_TIME_E',['../group__SlNetErr.html#ga88ef4a1af37375bb66ae157822888c82',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5funknown_5foid_5fe',['SLNETERR_ESEC_ASN_UNKNOWN_OID_E',['../group__SlNetErr.html#ga8d16177855070e54a8ae51f9b4229c48',1,'slneterr.h']]],
['slneterr_5fesec_5fasn_5fversion_5fe',['SLNETERR_ESEC_ASN_VERSION_E',['../group__SlNetErr.html#ga7d9650c263713c346ce6e9dc88ca4a67',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fca_5ffile',['SLNETERR_ESEC_BAD_CA_FILE',['../group__SlNetErr.html#ga708f15a255fd51fb4a7c95d4033f9e78',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fcert_5ffile',['SLNETERR_ESEC_BAD_CERT_FILE',['../group__SlNetErr.html#ga114bd1ec8e2e12dd4989afc794e7ad7f',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fcert_5fmanager_5ferror',['SLNETERR_ESEC_BAD_CERT_MANAGER_ERROR',['../group__SlNetErr.html#ga85c4adf860c6e0121c0ff7937c4d21cc',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fcertificate',['SLNETERR_ESEC_BAD_CERTIFICATE',['../group__SlNetErr.html#gaec2c867c48aff9c6dc43459243cd7d5c',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fcertificate_5fhash_5fvalue',['SLNETERR_ESEC_BAD_CERTIFICATE_HASH_VALUE',['../group__SlNetErr.html#gaca42cd1c3394769a534f57768e88ac2b',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fcertificate_5fstatus_5fresponse',['SLNETERR_ESEC_BAD_CERTIFICATE_STATUS_RESPONSE',['../group__SlNetErr.html#ga732c98db51aa1e28fc1a0ecbf79e7d45',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fdh_5ffile',['SLNETERR_ESEC_BAD_DH_FILE',['../group__SlNetErr.html#ga4dfef55f0982eb8a544265336bb3d73d',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5ffunc_5farg',['SLNETERR_ESEC_BAD_FUNC_ARG',['../group__SlNetErr.html#gaa5fc1c00aa9beea0aa075baf9166bab0',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fhello',['SLNETERR_ESEC_BAD_HELLO',['../group__SlNetErr.html#ga58a69ab990b033511be7802fc7b0ea9a',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fpath_5ferror',['SLNETERR_ESEC_BAD_PATH_ERROR',['../group__SlNetErr.html#ga71c38dde384e60970cecd31c93491157',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5fprivate_5ffile',['SLNETERR_ESEC_BAD_PRIVATE_FILE',['../group__SlNetErr.html#ga2557a62bd50f4bbec5473738e32d17ee',1,'slneterr.h']]],
['slneterr_5fesec_5fbad_5frecord_5fmac',['SLNETERR_ESEC_BAD_RECORD_MAC',['../group__SlNetErr.html#gaa6c72b20c32ae205075ca1857e7f8899',1,'slneterr.h']]],
['slneterr_5fesec_5fbuffer_5fe',['SLNETERR_ESEC_BUFFER_E',['../group__SlNetErr.html#ga4094a4a200ddf845d35f7b61c18be4ee',1,'slneterr.h']]],
['slneterr_5fesec_5fbuffer_5ferror',['SLNETERR_ESEC_BUFFER_ERROR',['../group__SlNetErr.html#ga9426cd51494c6b823663ce86e2470d4a',1,'slneterr.h']]],
['slneterr_5fesec_5fbuild_5fmsg_5ferror',['SLNETERR_ESEC_BUILD_MSG_ERROR',['../group__SlNetErr.html#ga610cc12f71e2dcd9e2bfb86540a58f1d',1,'slneterr.h']]],
['slneterr_5fesec_5fca_5ftrue_5fe',['SLNETERR_ESEC_CA_TRUE_E',['../group__SlNetErr.html#gabcaf72c87f18a9faba7f6b9c0a98deff',1,'slneterr.h']]],
['slneterr_5fesec_5fcertificate_5frevoked',['SLNETERR_ESEC_CERTIFICATE_REVOKED',['../group__SlNetErr.html#ga90569b1f079c263c619d155ad28b29f9',1,'slneterr.h']]],
['slneterr_5fesec_5fcertificate_5funobtainable',['SLNETERR_ESEC_CERTIFICATE_UNOBTAINABLE',['../group__SlNetErr.html#ga0ccfd79a5996d78554137d5770ae17f7',1,'slneterr.h']]],
['slneterr_5fesec_5fclose_5fnotify',['SLNETERR_ESEC_CLOSE_NOTIFY',['../group__SlNetErr.html#ga96ee632550f3020bc7e49bc34b23233d',1,'slneterr.h']]],
['slneterr_5fesec_5fclosed',['SLNETERR_ESEC_CLOSED',['../group__SlNetErr.html#gafda0de04df449572341a22e1c6f63398',1,'slneterr.h']]],
['slneterr_5fesec_5fcrl_5fcert_5frevoked',['SLNETERR_ESEC_CRL_CERT_REVOKED',['../group__SlNetErr.html#ga41a03822046a5bdcad8fe291e5ff504c',1,'slneterr.h']]],
['slneterr_5fesec_5fcrl_5fmissing',['SLNETERR_ESEC_CRL_MISSING',['../group__SlNetErr.html#gaf17afc22a8a0c14c4191482aacc3ed90',1,'slneterr.h']]],
['slneterr_5fesec_5fdate_5fe',['SLNETERR_ESEC_DATE_E',['../group__SlNetErr.html#gaa1546fa992ce858bbbf884eff4df5aed',1,'slneterr.h']]],
['slneterr_5fesec_5fdate_5ferror',['SLNETERR_ESEC_DATE_ERROR',['../group__SlNetErr.html#ga91a03d0b22dddabfab888ca1a55d5420',1,'slneterr.h']]],
['slneterr_5fesec_5fdecode_5ferror',['SLNETERR_ESEC_DECODE_ERROR',['../group__SlNetErr.html#ga71f506b7a7c8e1b0aea9005f62df9a28',1,'slneterr.h']]],
['slneterr_5fesec_5fdecompression_5ffailure',['SLNETERR_ESEC_DECOMPRESSION_FAILURE',['../group__SlNetErr.html#gad2e02eb930c9714144ab327c1f851a91',1,'slneterr.h']]],
['slneterr_5fesec_5fdecrypt',['SLNETERR_ESEC_DECRYPT',['../group__SlNetErr.html#ga252de582ade44152f05d44a9628ebeee',1,'slneterr.h']]],
['slneterr_5fesec_5fdecrypt_5ferror1',['SLNETERR_ESEC_DECRYPT_ERROR1',['../group__SlNetErr.html#ga4e5d7989d33c12b0cc039709220c72e9',1,'slneterr.h']]],
['slneterr_5fesec_5fdecryption_5ffailed',['SLNETERR_ESEC_DECRYPTION_FAILED',['../group__SlNetErr.html#gac544eb1ea934a9c036972e242f449a5c',1,'slneterr.h']]],
['slneterr_5fesec_5fdomain_5fname_5fmismatch',['SLNETERR_ESEC_DOMAIN_NAME_MISMATCH',['../group__SlNetErr.html#ga7c23cf4183198a229383e3f883c157a4',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fbad_5farg_5fe',['SLNETERR_ESEC_ECC_BAD_ARG_E',['../group__SlNetErr.html#ga32db1eed72af452f876ec732309a45ef',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fcurve_5ferror',['SLNETERR_ESEC_ECC_CURVE_ERROR',['../group__SlNetErr.html#ga3a778d912d84e640ede262c3cd014697',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fcurve_5foid_5fe',['SLNETERR_ESEC_ECC_CURVE_OID_E',['../group__SlNetErr.html#ga1b0ed4cf0c4ba2e4badc8c36cf7fd70e',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fcurvetype_5ferror',['SLNETERR_ESEC_ECC_CURVETYPE_ERROR',['../group__SlNetErr.html#ga6095fc9571dc0a912a4ceeeb39c8c257',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fexport_5ferror',['SLNETERR_ESEC_ECC_EXPORT_ERROR',['../group__SlNetErr.html#gac2acf35845a512790bea1c7343187988',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fmakekey_5ferror',['SLNETERR_ESEC_ECC_MAKEKEY_ERROR',['../group__SlNetErr.html#ga5453c6e0a5f6406d96b0fc457a297482',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fpeerkey_5ferror',['SLNETERR_ESEC_ECC_PEERKEY_ERROR',['../group__SlNetErr.html#ga9c9c2dbf06731984ef28296bfe87184f',1,'slneterr.h']]],
['slneterr_5fesec_5fecc_5fshared_5ferror',['SLNETERR_ESEC_ECC_SHARED_ERROR',['../group__SlNetErr.html#ga3f8d115e562b79a5ce10efea0d31dec8',1,'slneterr.h']]],
['slneterr_5fesec_5fencrypt_5ferror',['SLNETERR_ESEC_ENCRYPT_ERROR',['../group__SlNetErr.html#gaf79a7baf6312bb2d343102278851ecf6',1,'slneterr.h']]],
['slneterr_5fesec_5fexport_5frestriction',['SLNETERR_ESEC_EXPORT_RESTRICTION',['../group__SlNetErr.html#gac3e1165c761a4006589c4d74fa43b1e6',1,'slneterr.h']]],
['slneterr_5fesec_5fextensions_5fe',['SLNETERR_ESEC_EXTENSIONS_E',['../group__SlNetErr.html#ga0006af97a74fa360efc478cae30b8f68',1,'slneterr.h']]],
['slneterr_5fesec_5ffatal_5ferror',['SLNETERR_ESEC_FATAL_ERROR',['../group__SlNetErr.html#ga135e22799d8412a5bda85fefd78948c3',1,'slneterr.h']]],
['slneterr_5fesec_5ffread_5ferror',['SLNETERR_ESEC_FREAD_ERROR',['../group__SlNetErr.html#ga3f0368435a42c36ea6d3b97affab34ba',1,'slneterr.h']]],
['slneterr_5fesec_5fgeneral',['SLNETERR_ESEC_GENERAL',['../group__SlNetErr.html#ga0ed33fd50d08dff99aedcd0b34e728e8',1,'slneterr.h']]],
['slneterr_5fesec_5fhand_5fshake_5ftimed_5fout',['SLNETERR_ESEC_HAND_SHAKE_TIMED_OUT',['../group__SlNetErr.html#gaf6bde2a30c73b7555820b74e8ef6c5b1',1,'slneterr.h']]],
['slneterr_5fesec_5fhandshake_5ffailure',['SLNETERR_ESEC_HANDSHAKE_FAILURE',['../group__SlNetErr.html#ga242914300c05dc34a0a771a9acfa8a0d',1,'slneterr.h']]],
['slneterr_5fesec_5fhello_5fverify_5ferror',['SLNETERR_ESEC_HELLO_VERIFY_ERROR',['../group__SlNetErr.html#ga0f3f189cc909957e83a55211bec82fa8',1,'slneterr.h']]],
['slneterr_5fesec_5fillegal_5fparameter',['SLNETERR_ESEC_ILLEGAL_PARAMETER',['../group__SlNetErr.html#ga198db3f5ef003451598f4e5920e1aeb5',1,'slneterr.h']]],
['slneterr_5fesec_5fincomplete_5fdata',['SLNETERR_ESEC_INCOMPLETE_DATA',['../group__SlNetErr.html#ga143057772edf81c69c5b81eafabf5cfb',1,'slneterr.h']]],
['slneterr_5fesec_5finner_5fdecrypt_5ferror',['SLNETERR_ESEC_INNER_DECRYPT_ERROR',['../group__SlNetErr.html#ga90c4360305a1df42b0019549efdb51b0',1,'slneterr.h']]],
['slneterr_5fesec_5finsufficient_5fsecurity',['SLNETERR_ESEC_INSUFFICIENT_SECURITY',['../group__SlNetErr.html#gae7054dde0254aa2a32bfc4307a8c8e0d',1,'slneterr.h']]],
['slneterr_5fesec_5finternal_5ferror',['SLNETERR_ESEC_INTERNAL_ERROR',['../group__SlNetErr.html#ga96501fb527fb6d07ffdf11188e8aff9e',1,'slneterr.h']]],
['slneterr_5fesec_5fissuer_5fe',['SLNETERR_ESEC_ISSUER_E',['../group__SlNetErr.html#ga2eff40ffe62ae6ef60fbc3ab20d646e4',1,'slneterr.h']]],
['slneterr_5fesec_5flength_5ferror',['SLNETERR_ESEC_LENGTH_ERROR',['../group__SlNetErr.html#ga42abf63441668eaffcfea8309d36f609',1,'slneterr.h']]],
['slneterr_5fesec_5fmatch_5fsuite_5ferror',['SLNETERR_ESEC_MATCH_SUITE_ERROR',['../group__SlNetErr.html#ga848035d20bb26a0a90c788704dfde915',1,'slneterr.h']]],
['slneterr_5fesec_5fmax_5fchain_5ferror',['SLNETERR_ESEC_MAX_CHAIN_ERROR',['../group__SlNetErr.html#gad1cdd0659ee1d22960baba8b24f681aa',1,'slneterr.h']]],
['slneterr_5fesec_5fmemory',['SLNETERR_ESEC_MEMORY',['../group__SlNetErr.html#gaaa2fb2809955c8266cb16a05ece34461',1,'slneterr.h']]],
['slneterr_5fesec_5fmonitor_5frunning_5fe',['SLNETERR_ESEC_MONITOR_RUNNING_E',['../group__SlNetErr.html#ga7b3cb7da0d17e46455f5f654966a76d0',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fca_5ffile',['SLNETERR_ESEC_NO_CA_FILE',['../group__SlNetErr.html#ga6607170eafb811fbc41f6a646f9fa0b8',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fcertificate',['SLNETERR_ESEC_NO_CERTIFICATE',['../group__SlNetErr.html#ga882eb28abd08de86b242e26d82aaf160',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fdh_5fparams',['SLNETERR_ESEC_NO_DH_PARAMS',['../group__SlNetErr.html#gabc3fbb18023256b91a5943b143236f0c',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fpassword',['SLNETERR_ESEC_NO_PASSWORD',['../group__SlNetErr.html#ga7a23af45361fd5fef503b9a90f0f0f50',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fpeer_5fcert',['SLNETERR_ESEC_NO_PEER_CERT',['../group__SlNetErr.html#ga9a88fd890f080a4bc24746bc785cbaa6',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fpeer_5fkey',['SLNETERR_ESEC_NO_PEER_KEY',['../group__SlNetErr.html#ga9a5c893f2858cd34af201fa53ac2a056',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fpeer_5fverify',['SLNETERR_ESEC_NO_PEER_VERIFY',['../group__SlNetErr.html#ga1083601ec88a4663dbeb4ef94a615697',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5fprivate_5fkey',['SLNETERR_ESEC_NO_PRIVATE_KEY',['../group__SlNetErr.html#ga76f1925d2217a620657d7476dc0873de',1,'slneterr.h']]],
['slneterr_5fesec_5fno_5frenegotiation',['SLNETERR_ESEC_NO_RENEGOTIATION',['../group__SlNetErr.html#ga2694857d1763945a02c372701a727c5d',1,'slneterr.h']]],
['slneterr_5fesec_5fnot_5fallowed_5fwhen_5flistening',['SLNETERR_ESEC_NOT_ALLOWED_WHEN_LISTENING',['../group__SlNetErr.html#ga5c3dd8349c42500c7e433eddb9208ff1',1,'slneterr.h']]],
['slneterr_5fesec_5fnot_5fca_5ferror',['SLNETERR_ESEC_NOT_CA_ERROR',['../group__SlNetErr.html#ga77c1af4dd6a0aa3668407ebbe3e69790',1,'slneterr.h']]],
['slneterr_5fesec_5fnot_5fcompiled_5fin',['SLNETERR_ESEC_NOT_COMPILED_IN',['../group__SlNetErr.html#gae710b801154b284b622859e09de882b2',1,'slneterr.h']]],
['slneterr_5fesec_5fnot_5fready_5ferror',['SLNETERR_ESEC_NOT_READY_ERROR',['../group__SlNetErr.html#ga50ff194e5f21c85b0e228d1c71923d4a',1,'slneterr.h']]],
['slneterr_5fesec_5focsp_5fcert_5frevoked',['SLNETERR_ESEC_OCSP_CERT_REVOKED',['../group__SlNetErr.html#gaf90a6632d286927f4bc0ba250bb60691',1,'slneterr.h']]],
['slneterr_5fesec_5focsp_5fcert_5funknown',['SLNETERR_ESEC_OCSP_CERT_UNKNOWN',['../group__SlNetErr.html#ga216c58cc6387148aec8466d7acc495a3',1,'slneterr.h']]],
['slneterr_5fesec_5focsp_5flookup_5ffail',['SLNETERR_ESEC_OCSP_LOOKUP_FAIL',['../group__SlNetErr.html#ga793b1108a8aff0878dc24a7f839617e1',1,'slneterr.h']]],
['slneterr_5fesec_5focsp_5fneed_5furl',['SLNETERR_ESEC_OCSP_NEED_URL',['../group__SlNetErr.html#ga2bfd1961cef22480378128972f251909',1,'slneterr.h']]],
['slneterr_5fesec_5fparse_5ferror',['SLNETERR_ESEC_PARSE_ERROR',['../group__SlNetErr.html#ga3d93c038b70ef428f17fdfa25c0c5cfa',1,'slneterr.h']]],
['slneterr_5fesec_5fpeer_5fkey_5ferror',['SLNETERR_ESEC_PEER_KEY_ERROR',['../group__SlNetErr.html#ga175ccdc9d2e8d14d54ea11f53b876a57',1,'slneterr.h']]],
['slneterr_5fesec_5fpms_5fversion_5ferror',['SLNETERR_ESEC_PMS_VERSION_ERROR',['../group__SlNetErr.html#ga340c32e4fce3766a7614b8315f493af4',1,'slneterr.h']]],
['slneterr_5fesec_5fprotocol_5fversion',['SLNETERR_ESEC_PROTOCOL_VERSION',['../group__SlNetErr.html#gac9b274ef0c97866a8b2acc1dca7b9bb6',1,'slneterr.h']]],
['slneterr_5fesec_5fpublic_5fkey_5fe',['SLNETERR_ESEC_PUBLIC_KEY_E',['../group__SlNetErr.html#ga63a811ed51d64bb173613b64267d9c77',1,'slneterr.h']]],
['slneterr_5fesec_5frecord_5foverflow',['SLNETERR_ESEC_RECORD_OVERFLOW',['../group__SlNetErr.html#ga23eace71fbfd351c34ddafedc238bf1b',1,'slneterr.h']]],
['slneterr_5fesec_5frsa_5fprivate_5ferror',['SLNETERR_ESEC_RSA_PRIVATE_ERROR',['../group__SlNetErr.html#ga4ec349c43ab873119a3a3fb242eff6ee',1,'slneterr.h']]],
['slneterr_5fesec_5frx_5fbuffer_5fnot_5fempty',['SLNETERR_ESEC_RX_BUFFER_NOT_EMPTY',['../group__SlNetErr.html#gab5ed59cf436a8ca2aaa2b1848c57ae5b',1,'slneterr.h']]],
['slneterr_5fesec_5fside_5ferror',['SLNETERR_ESEC_SIDE_ERROR',['../group__SlNetErr.html#ga0337f07f08d6aa090e475709e7506d3b',1,'slneterr.h']]],
['slneterr_5fesec_5fsno_5fverify',['SLNETERR_ESEC_SNO_VERIFY',['../group__SlNetErr.html#ga809cb2b97524319696b53f961af5233f',1,'slneterr.h']]],
['slneterr_5fesec_5fsocket_5ferror_5fe',['SLNETERR_ESEC_SOCKET_ERROR_E',['../group__SlNetErr.html#gacee1fb06249f1823faf0ed44a9e7ff6d',1,'slneterr.h']]],
['slneterr_5fesec_5fsocket_5fnodata',['SLNETERR_ESEC_SOCKET_NODATA',['../group__SlNetErr.html#gae0f1ec7eff160258a6300be13008b4aa',1,'slneterr.h']]],
['slneterr_5fesec_5fssl_5fduring_5fhand_5fshake',['SLNETERR_ESEC_SSL_DURING_HAND_SHAKE',['../group__SlNetErr.html#ga80c1bbf927a4271df92d2b0dda3a715f',1,'slneterr.h']]],
['slneterr_5fesec_5fsubject_5fe',['SLNETERR_ESEC_SUBJECT_E',['../group__SlNetErr.html#gafa30f5165c8c67c30db8b0ceaf0d366b',1,'slneterr.h']]],
['slneterr_5fesec_5ft00_5fmany_5fssl_5fopened',['SLNETERR_ESEC_T00_MANY_SSL_OPENED',['../group__SlNetErr.html#ga6ed8186aaea7b478f7f5b51b00d29ee9',1,'slneterr.h']]],
['slneterr_5fesec_5ftcp_5fdisconnected_5funcomplete_5frecord',['SLNETERR_ESEC_TCP_DISCONNECTED_UNCOMPLETE_RECORD',['../group__SlNetErr.html#ga946a00d1df1f78332b7fe46711e1514f',1,'slneterr.h']]],
['slneterr_5fesec_5fthread_5fcreate_5fe',['SLNETERR_ESEC_THREAD_CREATE_E',['../group__SlNetErr.html#ga69c9a2a54fe709e8b646cea9da3840ed',1,'slneterr.h']]],
['slneterr_5fesec_5ftx_5fbuffer_5fnot_5fempty',['SLNETERR_ESEC_TX_BUFFER_NOT_EMPTY',['../group__SlNetErr.html#ga799ca8fd109a65ba5504e1b0a858ce72',1,'slneterr.h']]],
['slneterr_5fesec_5funexpected_5fmessage',['SLNETERR_ESEC_UNEXPECTED_MESSAGE',['../group__SlNetErr.html#ga9c1d422b8b51ef56077b7b82b44b4c96',1,'slneterr.h']]],
['slneterr_5fesec_5funicode_5fsize_5fe',['SLNETERR_ESEC_UNICODE_SIZE_E',['../group__SlNetErr.html#gac1030e6e15048aa6456a44d7d580674b',1,'slneterr.h']]],
['slneterr_5fesec_5funknown_5fhandshake_5ftype',['SLNETERR_ESEC_UNKNOWN_HANDSHAKE_TYPE',['../group__SlNetErr.html#gac41fdacaa156e2e8ff5cd07cdde82377',1,'slneterr.h']]],
['slneterr_5fesec_5funknown_5frecord_5ftype',['SLNETERR_ESEC_UNKNOWN_RECORD_TYPE',['../group__SlNetErr.html#ga56a2bf24af4130846108ab6f2d870c3b',1,'slneterr.h']]],
['slneterr_5fesec_5funknown_5froot_5fca',['SLNETERR_ESEC_UNKNOWN_ROOT_CA',['../group__SlNetErr.html#ga4ad52bf03c92d0532db9501fc9aef3d1',1,'slneterr.h']]],
['slneterr_5fesec_5funrecognized_5fname',['SLNETERR_ESEC_UNRECOGNIZED_NAME',['../group__SlNetErr.html#ga1292c7f10bbfd45b987ec3b55b6fd7a5',1,'slneterr.h']]],
['slneterr_5fesec_5funsupported_5fcertificate',['SLNETERR_ESEC_UNSUPPORTED_CERTIFICATE',['../group__SlNetErr.html#ga4a2df7b815ff4b2d72be9c4f6fd81c28',1,'slneterr.h']]],
['slneterr_5fesec_5funsupported_5fextension',['SLNETERR_ESEC_UNSUPPORTED_EXTENSION',['../group__SlNetErr.html#ga1139f1ef536746faf6e5c2adc849ea9e',1,'slneterr.h']]],
['slneterr_5fesec_5funsupported_5fsuite',['SLNETERR_ESEC_UNSUPPORTED_SUITE',['../group__SlNetErr.html#gabc0615c46e77173212e51e5e92581fe8',1,'slneterr.h']]],
['slneterr_5fesec_5fuser_5fcancelled',['SLNETERR_ESEC_USER_CANCELLED',['../group__SlNetErr.html#gafe83c886eccb10b41cf24228923baa36',1,'slneterr.h']]],
['slneterr_5fesec_5fverify_5fcert_5ferror',['SLNETERR_ESEC_VERIFY_CERT_ERROR',['../group__SlNetErr.html#ga94a445770535ce35670585ecc360a7ae',1,'slneterr.h']]],
['slneterr_5fesec_5fverify_5ffinished_5ferror',['SLNETERR_ESEC_VERIFY_FINISHED_ERROR',['../group__SlNetErr.html#ga4385504f600e7f3a409f1c22e7f5a791',1,'slneterr.h']]],
['slneterr_5fesec_5fverify_5fmac_5ferror',['SLNETERR_ESEC_VERIFY_MAC_ERROR',['../group__SlNetErr.html#ga16e34614c175b0ca6ee15f75ebba0e02',1,'slneterr.h']]],
['slneterr_5fesec_5fverify_5fsign_5ferror',['SLNETERR_ESEC_VERIFY_SIGN_ERROR',['../group__SlNetErr.html#ga49b0e2afd0e574d8a1d418d9e11086e2',1,'slneterr.h']]],
['slneterr_5fesec_5fwant_5fread',['SLNETERR_ESEC_WANT_READ',['../group__SlNetErr.html#gabc507e5610152f788ea74dfc35112bab',1,'slneterr.h']]],
['slneterr_5fesec_5fwant_5fwrite',['SLNETERR_ESEC_WANT_WRITE',['../group__SlNetErr.html#gaef3b124700ada8a1accddc9ea8cff5ab',1,'slneterr.h']]],
['slneterr_5fesec_5fwrong_5fpeer_5fcert',['SLNETERR_ESEC_WRONG_PEER_CERT',['../group__SlNetErr.html#gac78fdf7852d66b4cb5d27b7dafe380bc',1,'slneterr.h']]],
['slneterr_5fesec_5fzero_5freturn',['SLNETERR_ESEC_ZERO_RETURN',['../group__SlNetErr.html#ga9adf2156e1a8e41cb65bcaa26a55dce0',1,'slneterr.h']]],
['slneterr_5fesmallbuf',['SLNETERR_ESMALLBUF',['../group__SlNetErr.html#gaf1a7ce838d4be1f9ca0f5ef38d371143',1,'slneterr.h']]],
['slneterr_5fezerolen',['SLNETERR_EZEROLEN',['../group__SlNetErr.html#ga0471f26ff37a8fb72bdc5ea01a086e60',1,'slneterr.h']]],
['slneterr_5fgeneral_5fdevice',['SLNETERR_GENERAL_DEVICE',['../group__SlNetErr.html#gadde830bd8c9e3c4d74e312a1eadc8961',1,'slneterr.h']]],
['slneterr_5fgeneral_5ferr',['SLNETERR_GENERAL_ERR',['../group__SlNetErr.html#ga7fa17209fc9aa253536cd53425ada62e',1,'slneterr.h']]],
['slneterr_5fhostapd_5finit_5ffail',['SLNETERR_HOSTAPD_INIT_FAIL',['../group__SlNetErr.html#ga238aa91bce03caf0db9b8b1689032dca',1,'slneterr.h']]],
['slneterr_5fhostapd_5finit_5fif_5ffail',['SLNETERR_HOSTAPD_INIT_IF_FAIL',['../group__SlNetErr.html#ga7c2932b3ef735eb8681c36ed6e3453ac',1,'slneterr.h']]],
['slneterr_5fincomplete_5fprogramming',['SLNETERR_INCOMPLETE_PROGRAMMING',['../group__SlNetErr.html#gaad6fcdffb6bd0c8d414ba9cf06f7baa0',1,'slneterr.h']]],
['slneterr_5fincorrect_5fipv6_5fstatic_5fglobal_5faddr',['SLNETERR_INCORRECT_IPV6_STATIC_GLOBAL_ADDR',['../group__SlNetErr.html#gaf3491711f14711f71de88c936ad6cdb5',1,'slneterr.h']]],
['slneterr_5fincorrect_5fipv6_5fstatic_5flocal_5faddr',['SLNETERR_INCORRECT_IPV6_STATIC_LOCAL_ADDR',['../group__SlNetErr.html#ga7ed8e14a8af0d0375dee66c219a7f220',1,'slneterr.h']]],
['slneterr_5finvalid_5fopcode',['SLNETERR_INVALID_OPCODE',['../group__SlNetErr.html#gade529231ae0b5e8ffb22c1383772ee45',1,'slneterr.h']]],
['slneterr_5finvalid_5fparam',['SLNETERR_INVALID_PARAM',['../group__SlNetErr.html#gaf0df499d82302d07c1bacc826ed27c9b',1,'slneterr.h']]],
['slneterr_5finvalid_5fpersistent_5fconfiguration',['SLNETERR_INVALID_PERSISTENT_CONFIGURATION',['../group__SlNetErr.html#gadb5b05bedd77dddb6ba9c68c8ac3e15f',1,'slneterr.h']]],
['slneterr_5finvalparam',['SLNETERR_INVALPARAM',['../group__SlNetErr.html#ga7d5e9fbf72e061692f8003298f188e67',1,'slneterr.h']]],
['slneterr_5fipv6_5flocal_5faddr_5fshould_5fbe_5fset_5ffirst',['SLNETERR_IPV6_LOCAL_ADDR_SHOULD_BE_SET_FIRST',['../group__SlNetErr.html#gae841ac5acc54a7d57c5f2fce1c869cc3',1,'slneterr.h']]],
['slneterr_5floading_5fcertificate_5fstore',['SLNETERR_LOADING_CERTIFICATE_STORE',['../group__SlNetErr.html#ga8742d0ece6b691db37865c2a872b4998',1,'slneterr.h']]],
['slneterr_5fmdns_5fcreate_5ffail',['SLNETERR_MDNS_CREATE_FAIL',['../group__SlNetErr.html#ga9ef31be91ac3d9501e7d59ede22f0d0f',1,'slneterr.h']]],
['slneterr_5fmdns_5fenable_5ffail',['SLNETERR_MDNS_ENABLE_FAIL',['../group__SlNetErr.html#ga2abc7a676fab731fd433550be1de7f1e',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5falloc_5ferror',['SLNETERR_NET_APP_DNS_ALLOC_ERROR',['../group__SlNetErr.html#ga585587158439d09ff53d9e2236b76eb1',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fbad_5faddress_5ferror',['SLNETERR_NET_APP_DNS_BAD_ADDRESS_ERROR',['../group__SlNetErr.html#ga75d659884b8c0cc84821915307815602',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fbad_5fid_5ferror',['SLNETERR_NET_APP_DNS_BAD_ID_ERROR',['../group__SlNetErr.html#gaea17ae453c906a2925dce9db68248712',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fduplicate_5fentry',['SLNETERR_NET_APP_DNS_DUPLICATE_ENTRY',['../group__SlNetErr.html#gafe718b5a7a9ffe8fba917143b7adc095',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fempty_5fdns_5fserver_5flist',['SLNETERR_NET_APP_DNS_EMPTY_DNS_SERVER_LIST',['../group__SlNetErr.html#ga236a74afbfcd97573f97841a464a0716',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5ferror',['SLNETERR_NET_APP_DNS_ERROR',['../group__SlNetErr.html#gacd9e8a094f4e097ef667ae6b84d0a2a7',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fexecution_5ferror',['SLNETERR_NET_APP_DNS_EXECUTION_ERROR',['../group__SlNetErr.html#ga0bfb83e5c454f0ad46d63df96d313ec3',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5finvalid_5faddress_5ftype',['SLNETERR_NET_APP_DNS_INVALID_ADDRESS_TYPE',['../group__SlNetErr.html#ga8b5430ce45fa90b14cad4c31248b68e8',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5finvalid_5ffamily_5ftype',['SLNETERR_NET_APP_DNS_INVALID_FAMILY_TYPE',['../group__SlNetErr.html#gaa6e5c04cea24cf6b70706c7a83724be7',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fipv6_5fnot_5fsupported',['SLNETERR_NET_APP_DNS_IPV6_NOT_SUPPORTED',['../group__SlNetErr.html#ga5c1668a26131457b81c2437922bf1994',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fipv6_5freq_5fbut_5fipv6_5fdisabled',['SLNETERR_NET_APP_DNS_IPV6_REQ_BUT_IPV6_DISABLED',['../group__SlNetErr.html#gad625f8ddc7277ab7fe0e0b2ed0f325f4',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fmalformed_5fpacket',['SLNETERR_NET_APP_DNS_MALFORMED_PACKET',['../group__SlNetErr.html#gaa9afca6ecdcbf5da77276fc23ee02ea5',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fmismatched_5fresponse',['SLNETERR_NET_APP_DNS_MISMATCHED_RESPONSE',['../group__SlNetErr.html#ga7d36757bcf0f73da384d925392aafc33',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fneed_5fmore_5frecord_5fbuffer',['SLNETERR_NET_APP_DNS_NEED_MORE_RECORD_BUFFER',['../group__SlNetErr.html#ga204511742e74f3c1036e62bf24107b39',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fno_5fserver',['SLNETERR_NET_APP_DNS_NO_SERVER',['../group__SlNetErr.html#ga5c1f64aa06d7e726fd945903159b6280',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fpacket_5fcreate_5ferror',['SLNETERR_NET_APP_DNS_PACKET_CREATE_ERROR',['../group__SlNetErr.html#ga7655cffcc07b5d2cd16d88d87be87cdd',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fparam_5ferror',['SLNETERR_NET_APP_DNS_PARAM_ERROR',['../group__SlNetErr.html#gae787c9ebe8b5c7f62a0678f3e9b5b4f1',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fquery_5ffailed',['SLNETERR_NET_APP_DNS_QUERY_FAILED',['../group__SlNetErr.html#ga5f5d3b5441ea20a59fe9376bd6e94c92',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fquery_5fno_5fresponse',['SLNETERR_NET_APP_DNS_QUERY_NO_RESPONSE',['../group__SlNetErr.html#ga06aeccf43a38b4d25811991ced7236a9',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5freq_5ftoo_5fbig',['SLNETERR_NET_APP_DNS_REQ_TOO_BIG',['../group__SlNetErr.html#ga7d012af8549d2cc8b111d1c2064749b1',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fretry_5fa_5fquery',['SLNETERR_NET_APP_DNS_RETRY_A_QUERY',['../group__SlNetErr.html#gae83e5132a45942a2ea7418a5ad1ca344',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fserver_5fauth_5ferror',['SLNETERR_NET_APP_DNS_SERVER_AUTH_ERROR',['../group__SlNetErr.html#gab7a1411cba11351cf12f219ebbe390bb',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fserver_5fnot_5ffound',['SLNETERR_NET_APP_DNS_SERVER_NOT_FOUND',['../group__SlNetErr.html#gad40d08b31eb31c8d6c92dc6f13d0c931',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fsize_5ferror',['SLNETERR_NET_APP_DNS_SIZE_ERROR',['../group__SlNetErr.html#gab7a6fab11945438476dd6e9571e40e70',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5ftimeoutr',['SLNETERR_NET_APP_DNS_TIMEOUTR',['../group__SlNetErr.html#ga2e639f5888102ee395b33aa2bdf52b2b',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fdns_5fzero_5fgateway_5fip_5faddress',['SLNETERR_NET_APP_DNS_ZERO_GATEWAY_IP_ADDRESS',['../group__SlNetErr.html#ga8c77ca5281bb1f2b0dc3d0a47a0d6980',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fenobufs',['SLNETERR_NET_APP_ENOBUFS',['../group__SlNetErr.html#gab9c4b6b5b03a66bf9324b9ddec05d452',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fhttp_5fgeneral_5ferror',['SLNETERR_NET_APP_HTTP_GENERAL_ERROR',['../group__SlNetErr.html#ga33acd45eb41ee18c596b119517d0e80d',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fhttp_5finvalid_5ftimeout',['SLNETERR_NET_APP_HTTP_INVALID_TIMEOUT',['../group__SlNetErr.html#ga00770c3a89bf69904edbb6ddf56b706c',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fhttp_5fserver_5falready_5fstarted',['SLNETERR_NET_APP_HTTP_SERVER_ALREADY_STARTED',['../group__SlNetErr.html#ga066e8295c725df81827a79ca16efa8b4',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fincorect_5fapp_5fmask',['SLNETERR_NET_APP_INCORECT_APP_MASK',['../group__SlNetErr.html#gad26fbfd2e026530b2f0c2cf41c151826',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fincorect_5frole_5ffor_5fapp',['SLNETERR_NET_APP_INCORECT_ROLE_FOR_APP',['../group__SlNetErr.html#ga0e2fe3c6226f2afcf4a726c1dc5b6820',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5finvalid_5furn_5flength',['SLNETERR_NET_APP_INVALID_URN_LENGTH',['../group__SlNetErr.html#ga760bd67601aafbaedb88bf4d85417b61',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5falready_5fstarted',['SLNETERR_NET_APP_MDNS_ALREADY_STARTED',['../group__SlNetErr.html#ga9169a2f5bef5fbfec4cd6d67b1fe84a7',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fauth_5ferror',['SLNETERR_NET_APP_MDNS_AUTH_ERROR',['../group__SlNetErr.html#ga362f20726e3f95f4e40a5d12e4a52f24',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fbuffer_5fsize_5ferror',['SLNETERR_NET_APP_MDNS_BUFFER_SIZE_ERROR',['../group__SlNetErr.html#ga16bef92179dcdf49c895ab63c839f357',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fcache_5ferror',['SLNETERR_NET_APP_MDNS_CACHE_ERROR',['../group__SlNetErr.html#ga31d27b96274d54debdb64e6d91c22095',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fdata_5fsize_5ferror',['SLNETERR_NET_APP_MDNS_DATA_SIZE_ERROR',['../group__SlNetErr.html#gaef9b9edffae77b0747121597b1baa6b9',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fdest_5faddress_5ferror',['SLNETERR_NET_APP_MDNS_DEST_ADDRESS_ERROR',['../group__SlNetErr.html#ga2c3eecd91cf066e0962cfdcb1fed2d21',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fduplicate_5fservice',['SLNETERR_NET_APP_MDNS_DUPLICATE_SERVICE',['../group__SlNetErr.html#ga69d03a78559a517cc00c60b973608cc6',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5ferror',['SLNETERR_NET_APP_MDNS_ERROR',['../group__SlNetErr.html#gaaf9a2c21fb1277231be03850f011d824',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5ferror_5fservice_5fname_5ferror',['SLNETERR_NET_APP_MDNS_ERROR_SERVICE_NAME_ERROR',['../group__SlNetErr.html#gacf95223acccc6062eea08fb08fc57581',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fexceed_5fmax_5flabel',['SLNETERR_NET_APP_MDNS_EXCEED_MAX_LABEL',['../group__SlNetErr.html#ga00b9a09390d33a3e74a981842ea20b7d',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fexist_5fanswer',['SLNETERR_NET_APP_MDNS_EXIST_ANSWER',['../group__SlNetErr.html#gab34e78b9b96aed0f36ff14623a78d63d',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fexist_5fsame_5fquery',['SLNETERR_NET_APP_MDNS_EXIST_SAME_QUERY',['../group__SlNetErr.html#ga06805a3ae25adbde650ddc0c625ca3f9',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fexist_5funique_5frr',['SLNETERR_NET_APP_MDNS_EXIST_UNIQUE_RR',['../group__SlNetErr.html#gae11f08ee7d55f9ef7167361e61db72f4',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fexisted_5fservice_5ferror',['SLNETERR_NET_APP_MDNS_EXISTED_SERVICE_ERROR',['../group__SlNetErr.html#ga3671b88cf7c288a35a42bbec4a895433',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fget_5fservice_5flist_5fflag_5ferror',['SLNETERR_NET_APP_MDNS_GET_SERVICE_LIST_FLAG_ERROR',['../group__SlNetErr.html#ga702d119424878118292fbbbd32f7b065',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fhost_5fname_5ferror',['SLNETERR_NET_APP_MDNS_HOST_NAME_ERROR',['../group__SlNetErr.html#ga663b8506ce79ef6a457625e29cfa31fc',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fidentical_5fservices_5ferror',['SLNETERR_NET_APP_MDNS_IDENTICAL_SERVICES_ERROR',['../group__SlNetErr.html#ga300312ccbf21f9a92f149157e53c537a',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5flookup_5findex_5ferror',['SLNETERR_NET_APP_MDNS_LOOKUP_INDEX_ERROR',['../group__SlNetErr.html#ga6d59515313a311381fac80d14ef76ac6',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fmax_5fservices_5ferror',['SLNETERR_NET_APP_MDNS_MAX_SERVICES_ERROR',['../group__SlNetErr.html#ga23d6470f38a6ea73ad44b9498e0b125f',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fmdns_5fno_5fconfiguration_5ferror',['SLNETERR_NET_APP_MDNS_MDNS_NO_CONFIGURATION_ERROR',['../group__SlNetErr.html#gae042c75fe4a1f4b1e2800cc11e4818a8',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fname_5fmismatch',['SLNETERR_NET_APP_MDNS_NAME_MISMATCH',['../group__SlNetErr.html#ga87bc30440650e9a5e1d96611b443081b',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fnet_5fapp_5fset_5ferror',['SLNETERR_NET_APP_MDNS_NET_APP_SET_ERROR',['../group__SlNetErr.html#ga3d6d66cfca339c285024b74ac57004d8',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fno_5fanswer',['SLNETERR_NET_APP_MDNS_NO_ANSWER',['../group__SlNetErr.html#ga3c55ed9091af4b50f344bb73a9ec66bd',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fno_5fknown_5fanswer',['SLNETERR_NET_APP_MDNS_NO_KNOWN_ANSWER',['../group__SlNetErr.html#ga26ff50d62bac8f1c531fd72245649f87',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fno_5fmore_5fentries',['SLNETERR_NET_APP_MDNS_NO_MORE_ENTRIES',['../group__SlNetErr.html#gafbec8e7a51f4f80de7edb3bf62768be3',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fnot_5flocal_5flink',['SLNETERR_NET_APP_MDNS_NOT_LOCAL_LINK',['../group__SlNetErr.html#gad3dbd82ef47aa48cff611c2c1bd5a356',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fnot_5fstarted',['SLNETERR_NET_APP_MDNS_NOT_STARTED',['../group__SlNetErr.html#ga98433dc0217e4b1298f20f6561e34e4c',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fpacket_5ferror',['SLNETERR_NET_APP_MDNS_PACKET_ERROR',['../group__SlNetErr.html#ga7093616e2ebf645cd93a68cfa02d94ad',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fparam_5ferror',['SLNETERR_NET_APP_MDNS_PARAM_ERROR',['../group__SlNetErr.html#ga597e0927ba463b5b248f775b9c864b2d',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5frx_5fpacket_5fallocation_5ferror',['SLNETERR_NET_APP_MDNS_RX_PACKET_ALLOCATION_ERROR',['../group__SlNetErr.html#gab2508e3e96753bd94902721cfe5a4a75',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fservice_5ftype_5fmismatch',['SLNETERR_NET_APP_MDNS_SERVICE_TYPE_MISMATCH',['../group__SlNetErr.html#gad61f8c401f8521db70ab2aefb0b076e3',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fstatus_5ferror',['SLNETERR_NET_APP_MDNS_STATUS_ERROR',['../group__SlNetErr.html#ga3d96c8344c28b8b174b9e0a59b049b8e',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5fudp_5fport_5ferror',['SLNETERR_NET_APP_MDNS_UDP_PORT_ERROR',['../group__SlNetErr.html#ga1f3597b956b6f29cef006b0b549a89e8',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fmdns_5funsupported_5ftype',['SLNETERR_NET_APP_MDNS_UNSUPPORTED_TYPE',['../group__SlNetErr.html#gabd7c0d65de6d3cca9db56f80552aa660',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5fp2p_5frole_5fis_5fnot_5fconfigured',['SLNETERR_NET_APP_P2P_ROLE_IS_NOT_CONFIGURED',['../group__SlNetErr.html#gaaffb184833e41cba3f4f6f6d1ef5708a',1,'slneterr.h']]],
['slneterr_5fnet_5fapp_5frx_5fbuffer_5flength',['SLNETERR_NET_APP_RX_BUFFER_LENGTH',['../group__SlNetErr.html#ga07bb76dbdb546e7a4d072d5c6798486a',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fbuffer_5ftoo_5fsmall',['SLNETERR_NETUTIL_CRYPTO_BUFFER_TOO_SMALL',['../group__SlNetErr.html#ga3fb19376777276f037de7d1e3861513d',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fcorrupted_5fdb_5ffile',['SLNETERR_NETUTIL_CRYPTO_CORRUPTED_DB_FILE',['../group__SlNetErr.html#ga3d68475316fb058108529146f2f6d2d4',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fdb_5fentry_5fnot_5ffree',['SLNETERR_NETUTIL_CRYPTO_DB_ENTRY_NOT_FREE',['../group__SlNetErr.html#ga4363a92ffcec3eaae5bee51fe1944a9a',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fempty_5fdb_5fentry',['SLNETERR_NETUTIL_CRYPTO_EMPTY_DB_ENTRY',['../group__SlNetErr.html#ga41da86d1e40e80305c4dc0474fe7e00b',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fgeneral',['SLNETERR_NETUTIL_CRYPTO_GENERAL',['../group__SlNetErr.html#gad2fbb938d4d353103bd8145a54a68046',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5finvalid_5fdb_5fver',['SLNETERR_NETUTIL_CRYPTO_INVALID_DB_VER',['../group__SlNetErr.html#ga34b79cbae083f786c3f5205dd245c95d',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5finvalid_5findex',['SLNETERR_NETUTIL_CRYPTO_INVALID_INDEX',['../group__SlNetErr.html#gaf507d2fe7e611bc456bce743a495161d',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5finvalid_5fparam',['SLNETERR_NETUTIL_CRYPTO_INVALID_PARAM',['../group__SlNetErr.html#ga5cf8fddae9524f72a535bbed1e200d9e',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fmem_5falloc',['SLNETERR_NETUTIL_CRYPTO_MEM_ALLOC',['../group__SlNetErr.html#ga6ef860c89af6eb7eff8edef08d6c531e',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5fnon_5ftemporary_5fkey',['SLNETERR_NETUTIL_CRYPTO_NON_TEMPORARY_KEY',['../group__SlNetErr.html#gacd0fdf5836e07fc6c1fdfa385d1a991c',1,'slneterr.h']]],
['slneterr_5fnetutil_5fcrypto_5funsupported_5foption',['SLNETERR_NETUTIL_CRYPTO_UNSUPPORTED_OPTION',['../group__SlNetErr.html#ga4eed525e5de35017c7af3d8c67ae2313',1,'slneterr.h']]],
['slneterr_5fnot_5fallowed_5fnwp_5flocked',['SLNETERR_NOT_ALLOWED_NWP_LOCKED',['../group__SlNetErr.html#ga8cc843f0ea8ce52109a224af0c535459',1,'slneterr.h']]],
['slneterr_5fnvmem_5faccess_5ffailed',['SLNETERR_NVMEM_ACCESS_FAILED',['../group__SlNetErr.html#ga0e2e855dc9e2b2adf67479e757b90d56',1,'slneterr.h']]],
['slneterr_5fpending_5ftxrx_5fno_5ftimeout',['SLNETERR_PENDING_TXRX_NO_TIMEOUT',['../group__SlNetErr.html#ga2169ef8a483d49de44e47265497cdad0',1,'slneterr.h']]],
['slneterr_5fpending_5ftxrx_5fstop_5ftimeout_5fexp',['SLNETERR_PENDING_TXRX_STOP_TIMEOUT_EXP',['../group__SlNetErr.html#ga05e9761ba6197a6597f26410f01ceeb5',1,'slneterr.h']]],
['slneterr_5fpool_5fis_5fempty',['SLNETERR_POOL_IS_EMPTY',['../group__SlNetErr.html#gadf96c6a59fb0fa1c9d3528692c6f1e0d',1,'slneterr.h']]],
['slneterr_5frestore_5fimage_5fcomplete',['SLNETERR_RESTORE_IMAGE_COMPLETE',['../group__SlNetErr.html#ga4436bf2961f179afa770377b92798f37',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fapi_5fcommand_5fin_5fprogress',['SLNETERR_RET_CODE_API_COMMAND_IN_PROGRESS',['../group__SlNetErr.html#gaf61b074354e0da63df27f7492780972c',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fcouldnt_5ffind_5fresource',['SLNETERR_RET_CODE_COULDNT_FIND_RESOURCE',['../group__SlNetErr.html#ga4fb4def7ddd968b42c8e0ac4b416b564',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fdev_5falready_5fstarted',['SLNETERR_RET_CODE_DEV_ALREADY_STARTED',['../group__SlNetErr.html#ga1fed11104ca5a2f31ef36d0be74113ae',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fdev_5flocked',['SLNETERR_RET_CODE_DEV_LOCKED',['../group__SlNetErr.html#ga78fe13fd6c62057665efff8da8ee2e06',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fdev_5fnot_5fstarted',['SLNETERR_RET_CODE_DEV_NOT_STARTED',['../group__SlNetErr.html#gad2f40cd3b39869fa7823370358c22d7d',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fdoesnt_5fsupport_5fnon_5fmandatory_5ffxn',['SLNETERR_RET_CODE_DOESNT_SUPPORT_NON_MANDATORY_FXN',['../group__SlNetErr.html#ga567ecaa3c46ec50a2687749aa925d96d',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fevent_5flink_5fnot_5ffound',['SLNETERR_RET_CODE_EVENT_LINK_NOT_FOUND',['../group__SlNetErr.html#ga8124d909898c3c8e66b82df76f3312c5',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5ffunction_5ffailed',['SLNETERR_RET_CODE_FUNCTION_FAILED',['../group__SlNetErr.html#ga6185c54ca8575ee286d937e3b20adb3e',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5finvalid_5finput',['SLNETERR_RET_CODE_INVALID_INPUT',['../group__SlNetErr.html#gac250e931121d3f5e4564458af7adfb7b',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fmalloc_5ferror',['SLNETERR_RET_CODE_MALLOC_ERROR',['../group__SlNetErr.html#gad8cc40c21fa3873eae5ae4c6e3f22655',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fmutex_5fcreation_5ffailed',['SLNETERR_RET_CODE_MUTEX_CREATION_FAILED',['../group__SlNetErr.html#gacfe39438561069257a15cc25db5ecb6e',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fnet_5fapp_5fping_5finvalid_5fparams',['SLNETERR_RET_CODE_NET_APP_PING_INVALID_PARAMS',['../group__SlNetErr.html#gaa870c073603c545688e41393fb141dcb',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fno_5ffree_5fspace',['SLNETERR_RET_CODE_NO_FREE_SPACE',['../group__SlNetErr.html#ga2205f69aeb6a7f77b94b3d1623818ce4',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fnwp_5fif_5ferror',['SLNETERR_RET_CODE_NWP_IF_ERROR',['../group__SlNetErr.html#gaa7e72b88308bad3d63956a81631d9c6f',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fok',['SLNETERR_RET_CODE_OK',['../group__SlNetErr.html#ga6b9c5be497d0c2b69bac9f177f70927e',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fprotocol_5ferror',['SLNETERR_RET_CODE_PROTOCOL_ERROR',['../group__SlNetErr.html#gada176fd3eb21c8d236a660da04a438b2',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fprovisioning_5fin_5fprogress',['SLNETERR_RET_CODE_PROVISIONING_IN_PROGRESS',['../group__SlNetErr.html#ga2dcc6885fb0146697d0010e0d8df8f43',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fself_5ferror',['SLNETERR_RET_CODE_SELF_ERROR',['../group__SlNetErr.html#gaa97403ad5073bcbbc511fe8fbd32a47b',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fsocket_5fcreation_5fin_5fprogress',['SLNETERR_RET_CODE_SOCKET_CREATION_IN_PROGRESS',['../group__SlNetErr.html#gad74df75a1a04d210a97969ae44f24c84',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fsocket_5fselect_5fin_5fprogress_5ferror',['SLNETERR_RET_CODE_SOCKET_SELECT_IN_PROGRESS_ERROR',['../group__SlNetErr.html#ga18daee225efeea083669d5b2a5b015fe',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5fstop_5fin_5fprogress',['SLNETERR_RET_CODE_STOP_IN_PROGRESS',['../group__SlNetErr.html#gafdd38380019194241966ac3a2d119ea3',1,'slneterr.h']]],
['slneterr_5fret_5fcode_5funsupported',['SLNETERR_RET_CODE_UNSUPPORTED',['../group__SlNetErr.html#gad9408cadb0eed89ddffc051e7b4f0b87',1,'slneterr.h']]],
['slneterr_5frole_5fap_5ferr',['SLNETERR_ROLE_AP_ERR',['../group__SlNetErr.html#ga047d73f98e8a685a6c97ce280306acc6',1,'slneterr.h']]],
['slneterr_5frole_5fp2p_5ferr',['SLNETERR_ROLE_P2P_ERR',['../group__SlNetErr.html#ga6f19234fa3187f7f676f889049ee7d68',1,'slneterr.h']]],
['slneterr_5frole_5fsta_5ferr',['SLNETERR_ROLE_STA_ERR',['../group__SlNetErr.html#gaad5fceb67bff0ce8247bec9e5095cf24',1,'slneterr.h']]],
['slneterr_5frxfl_5faction_5fno_5freg_5fnumber',['SLNETERR_RXFL_ACTION_NO_REG_NUMBER',['../group__SlNetErr.html#gae9e1abcd792b42ab9791aea0e995af55',1,'slneterr.h']]],
['slneterr_5frxfl_5faction_5fuse_5freg1_5fto_5freg4',['SLNETERR_RXFL_ACTION_USE_REG1_TO_REG4',['../group__SlNetErr.html#ga2e46ee22ad9451c02e04fc183a90ac88',1,'slneterr.h']]],
['slneterr_5frxfl_5faction_5fuse_5freg5_5fto_5freg8',['SLNETERR_RXFL_ACTION_USE_REG5_TO_REG8',['../group__SlNetErr.html#ga282ecd51e694ff0bb1e93f6f7cc901da',1,'slneterr.h']]],
['slneterr_5frxfl_5faction_5fuser_5fevent_5fid_5ftoo_5fbig',['SLNETERR_RXFL_ACTION_USER_EVENT_ID_TOO_BIG',['../group__SlNetErr.html#gabf88e1ba2cfcddc10e8bc84516d9da7f',1,'slneterr.h']]],
['slneterr_5frxfl_5falloc',['SLNETERR_RXFL_ALLOC',['../group__SlNetErr.html#ga860e29c392bb1a60367fe05041e86f2a',1,'slneterr.h']]],
['slneterr_5frxfl_5fallocation_5ffor_5fdb_5fnode_5ffailed',['SLNETERR_RXFL_ALLOCATION_FOR_DB_NODE_FAILED',['../group__SlNetErr.html#ga9f67d1de23b8fbc98ce962db2e3bbdd3',1,'slneterr.h']]],
['slneterr_5frxfl_5fallocation_5ffor_5fglobals_5fstructure_5ffailed',['SLNETERR_RXFL_ALLOCATION_FOR_GLOBALS_STRUCTURE_FAILED',['../group__SlNetErr.html#gae761aa90452f466c98a69796babf9a78',1,'slneterr.h']]],
['slneterr_5frxfl_5fbad_5ffile_5fmode',['SLNETERR_RXFL_BAD_FILE_MODE',['../group__SlNetErr.html#ga99f3c1b638040bc101b5049c07dc9e5c',1,'slneterr.h']]],
['slneterr_5frxfl_5fchild_5fis_5fenabled',['SLNETERR_RXFL_CHILD_IS_ENABLED',['../group__SlNetErr.html#gaf99083501bd442cedd0d85bda78e5a92',1,'slneterr.h']]],
['slneterr_5frxfl_5fcontinue_5fwrite_5fmust_5fbe_5fmod_5f4',['SLNETERR_RXFL_CONTINUE_WRITE_MUST_BE_MOD_4',['../group__SlNetErr.html#ga628a364cd9fc1d982ea057392eef2529',1,'slneterr.h']]],
['slneterr_5frxfl_5fdepedency_5fnot_5fon_5fthe_5fsame_5flayer',['SLNETERR_RXFL_DEPEDENCY_NOT_ON_THE_SAME_LAYER',['../group__SlNetErr.html#gaaa0d9ba6534c8acd376c3010c2f8ce5c',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependency_5fis_5fdisabled',['SLNETERR_RXFL_DEPENDENCY_IS_DISABLED',['../group__SlNetErr.html#gafc01fa292f5f2e675385ba63573a1652',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependency_5fis_5fnot_5fpersistent',['SLNETERR_RXFL_DEPENDENCY_IS_NOT_PERSISTENT',['../group__SlNetErr.html#gadb4ec99e12b9c4444c09899b15c3b9b6',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fdependency_5faction_5fis_5fdrop',['SLNETERR_RXFL_DEPENDENT_FILTER_DEPENDENCY_ACTION_IS_DROP',['../group__SlNetErr.html#ga91ad893b86f60b03ec533a505b4ac585',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fdo_5fnot_5fexist_5f1',['SLNETERR_RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_1',['../group__SlNetErr.html#gada600cced10e3646c9d91bc50d3b47f2',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fdo_5fnot_5fexist_5f2',['SLNETERR_RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_2',['../group__SlNetErr.html#gaf22066127964879f902eb0e1d4bfeb88',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fdo_5fnot_5fexist_5f3',['SLNETERR_RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_3',['../group__SlNetErr.html#ga29b5072245d3438e8a11767d9777ae2e',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fis_5fnot_5fenabled',['SLNETERR_RXFL_DEPENDENT_FILTER_IS_NOT_ENABLED',['../group__SlNetErr.html#ga9e6b47b259c3a8d2822358645fd54f0e',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fis_5fnot_5fpersistent',['SLNETERR_RXFL_DEPENDENT_FILTER_IS_NOT_PERSISTENT',['../group__SlNetErr.html#gacb5fcc3e4ea309569d1c7b0262660cee',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5flayer_5fdo_5fnot_5ffit',['SLNETERR_RXFL_DEPENDENT_FILTER_LAYER_DO_NOT_FIT',['../group__SlNetErr.html#ga535eac9854f396ca7b50f70ad025619c',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fsoftware_5ffilter_5fnot_5ffit',['SLNETERR_RXFL_DEPENDENT_FILTER_SOFTWARE_FILTER_NOT_FIT',['../group__SlNetErr.html#ga1680e99eabb0896496d5feadba0eadd5',1,'slneterr.h']]],
['slneterr_5frxfl_5fdependent_5ffilter_5fsystem_5fstate_5fdo_5fnot_5ffit',['SLNETERR_RXFL_DEPENDENT_FILTER_SYSTEM_STATE_DO_NOT_FIT',['../group__SlNetErr.html#gab3154e2ce1ec873792708acc149ce339',1,'slneterr.h']]],
['slneterr_5frxfl_5fdevice_5fnot_5floaded',['SLNETERR_RXFL_DEVICE_NOT_LOADED',['../group__SlNetErr.html#ga8e6c713292fbd62e451ff7ca225af7ac',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5finit_5fstorage',['SLNETERR_RXFL_FAILED_INIT_STORAGE',['../group__SlNetErr.html#ga49572cfc91317bfdb7ed0333b40c43ae',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fload_5ffile',['SLNETERR_RXFL_FAILED_LOAD_FILE',['../group__SlNetErr.html#ga81da8c2f0c31b1cc8eec2d723c3d1e23',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fread_5fnvfile',['SLNETERR_RXFL_FAILED_READ_NVFILE',['../group__SlNetErr.html#gaa5684afb7b16627eafd4d1553426f68f',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fto_5fcreate_5ffile',['SLNETERR_RXFL_FAILED_TO_CREATE_FILE',['../group__SlNetErr.html#ga45f15ece77b5b0c437f7728d24b420f8',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fto_5fcreate_5flock_5fobj',['SLNETERR_RXFL_FAILED_TO_CREATE_LOCK_OBJ',['../group__SlNetErr.html#gaf30a53cd7c804a141f89dac7d5e0e0b9',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fto_5fread',['SLNETERR_RXFL_FAILED_TO_READ',['../group__SlNetErr.html#ga4b8196a357029fee100ef1093aa6e25d',1,'slneterr.h']]],
['slneterr_5frxfl_5ffailed_5fto_5fwrite',['SLNETERR_RXFL_FAILED_TO_WRITE',['../group__SlNetErr.html#ga819d61369d83744b461a5921dd1b9b24',1,'slneterr.h']]],
['slneterr_5frxfl_5ffield_5fsupport_5fonly_5fequal_5fand_5fnotequal',['SLNETERR_RXFL_FIELD_SUPPORT_ONLY_EQUAL_AND_NOTEQUAL',['../group__SlNetErr.html#ga70d396c0ca74500a46357680468596ff',1,'slneterr.h']]],
['slneterr_5frxfl_5ffile_5falready_5fin_5fuse',['SLNETERR_RXFL_FILE_ALREADY_IN_USE',['../group__SlNetErr.html#gafa407141f770deebdadbf6ac175d5280',1,'slneterr.h']]],
['slneterr_5frxfl_5ffile_5ffilters_5fnot_5fexists',['SLNETERR_RXFL_FILE_FILTERS_NOT_EXISTS',['../group__SlNetErr.html#ga08e446f8ff5a3670d635ffe2e160682d',1,'slneterr.h']]],
['slneterr_5frxfl_5ffilter_5fdo_5fnot_5fexists',['SLNETERR_RXFL_FILTER_DO_NOT_EXISTS',['../group__SlNetErr.html#ga04cd7743a50b41ab7123353df6ed5121',1,'slneterr.h']]],
['slneterr_5frxfl_5ffilter_5fhas_5fchilds',['SLNETERR_RXFL_FILTER_HAS_CHILDS',['../group__SlNetErr.html#gae73669b8c2d7b1f02ca5fdd5c5d0f5c2',1,'slneterr.h']]],
['slneterr_5frxfl_5fframe_5ftype_5fnot_5fsupported',['SLNETERR_RXFL_FRAME_TYPE_NOT_SUPPORTED',['../group__SlNetErr.html#ga5e8fd3e79c13fe23cc8b289cf9267fca',1,'slneterr.h']]],
['slneterr_5frxfl_5ffs_5falready_5floaded',['SLNETERR_RXFL_FS_ALREADY_LOADED',['../group__SlNetErr.html#gaad5505b0c5949f7dd1d19295f8055c37',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5fargs',['SLNETERR_RXFL_INVALID_ARGS',['../group__SlNetErr.html#ga13f1b1b5082cd8f4c2461c83165a5efe',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5ffile_5fid',['SLNETERR_RXFL_INVALID_FILE_ID',['../group__SlNetErr.html#ga59f809fab889b7330a6789d8852ad76b',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5ffilter_5farg_5fupdate',['SLNETERR_RXFL_INVALID_FILTER_ARG_UPDATE',['../group__SlNetErr.html#gaa6b10eff3bddd985f5113e65d62a46f1',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5ffunc_5fid_5ffor_5ffilter_5ftype',['SLNETERR_RXFL_INVALID_FUNC_ID_FOR_FILTER_TYPE',['../group__SlNetErr.html#gac00d8b8ddca042fea04ad5e59cf832af',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5fhandle',['SLNETERR_RXFL_INVALID_HANDLE',['../group__SlNetErr.html#gac95bba260e051a1cc48262698afb261f',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5fmagic_5fnum',['SLNETERR_RXFL_INVALID_MAGIC_NUM',['../group__SlNetErr.html#ga64433b4f0f9ad16b7f784c0e93f4262f',1,'slneterr.h']]],
['slneterr_5frxfl_5finvalid_5fsystem_5fstate_5ftrigger_5ffor_5ffilter_5ftype',['SLNETERR_RXFL_INVALID_SYSTEM_STATE_TRIGGER_FOR_FILTER_TYPE',['../group__SlNetErr.html#ga877cc58926ef46be4cda586634541dfa',1,'slneterr.h']]],
['slneterr_5frxfl_5fmac_5fopertation_5fhalt_5ffailed',['SLNETERR_RXFL_MAC_OPERTATION_HALT_FAILED',['../group__SlNetErr.html#gaf2bdc8d677232250e295d63c9e734031',1,'slneterr.h']]],
['slneterr_5frxfl_5fmac_5fopertation_5fresume_5ffailed',['SLNETERR_RXFL_MAC_OPERTATION_RESUME_FAILED',['../group__SlNetErr.html#ga3cc0e9c487d183cca91781a5a9faa967',1,'slneterr.h']]],
['slneterr_5frxfl_5fmac_5fsend_5farg_5fdb_5ffailed',['SLNETERR_RXFL_MAC_SEND_ARG_DB_FAILED',['../group__SlNetErr.html#gaab3a770f1eab27e47a409112246b64be',1,'slneterr.h']]],
['slneterr_5frxfl_5fmac_5fsend_5fmatchdb_5ffailed',['SLNETERR_RXFL_MAC_SEND_MATCHDB_FAILED',['../group__SlNetErr.html#ga2772b89b897c5fbc541315ca131cb100',1,'slneterr.h']]],
['slneterr_5frxfl_5fmac_5fsend_5fnodedb_5ffailed',['SLNETERR_RXFL_MAC_SEND_NODEDB_FAILED',['../group__SlNetErr.html#ga02a3ee402705ea6fc6be61a59e346b3c',1,'slneterr.h']]],
['slneterr_5frxfl_5fno_5ffilter_5fdatabase_5fallocate',['SLNETERR_RXFL_NO_FILTER_DATABASE_ALLOCATE',['../group__SlNetErr.html#ga15f001f7600baf9802d5780f28da7eda',1,'slneterr.h']]],
['slneterr_5frxfl_5fno_5ffilters_5fare_5fdefined',['SLNETERR_RXFL_NO_FILTERS_ARE_DEFINED',['../group__SlNetErr.html#gaa83b62db6af7175ff2e7e6a0e213d480',1,'slneterr.h']]],
['slneterr_5frxfl_5fnot_5fsupported',['SLNETERR_RXFL_NOT_SUPPORTED',['../group__SlNetErr.html#ga084c83ea80cb6760a2c4d8ec551fafe4',1,'slneterr.h']]],
['slneterr_5frxfl_5fnumber_5fof_5fargs_5fexceeded',['SLNETERR_RXFL_NUMBER_OF_ARGS_EXCEEDED',['../group__SlNetErr.html#ga9fd586fc34f1906a6f48673c2a160404',1,'slneterr.h']]],
['slneterr_5frxfl_5fnumber_5fof_5fconnection_5fpoints_5fexceeded',['SLNETERR_RXFL_NUMBER_OF_CONNECTION_POINTS_EXCEEDED',['../group__SlNetErr.html#gaa62c9019941c6f91db7fac5de5fca416',1,'slneterr.h']]],
['slneterr_5frxfl_5fnumber_5fof_5ffilter_5fexceeded',['SLNETERR_RXFL_NUMBER_OF_FILTER_EXCEEDED',['../group__SlNetErr.html#ga49938e76a355b328107efc18e6a03397',1,'slneterr.h']]],
['slneterr_5frxfl_5foffset_5fout_5fof_5frange',['SLNETERR_RXFL_OFFSET_OUT_OF_RANGE',['../group__SlNetErr.html#ga1c0fa69aefe5b41b74f0744d486772ab',1,'slneterr.h']]],
['slneterr_5frxfl_5foffset_5ftoo_5fbig',['SLNETERR_RXFL_OFFSET_TOO_BIG',['../group__SlNetErr.html#gaaaee693298817be65c02e81f92b32516',1,'slneterr.h']]],
['slneterr_5frxfl_5fok',['SLNETERR_RXFL_OK',['../group__SlNetErr.html#gac66734b3d16a0e68d28780155a0d6aee',1,'slneterr.h']]],
['slneterr_5frxfl_5foutput_5for_5finput_5fbuffer_5flength_5ftoo_5fsmall',['SLNETERR_RXFL_OUTPUT_OR_INPUT_BUFFER_LENGTH_TOO_SMALL',['../group__SlNetErr.html#ga840363f38bb7236c81ebe0a304e474a8',1,'slneterr.h']]],
['slneterr_5frxfl_5frange_5fcompare_5fparams_5fare_5finvalid',['SLNETERR_RXFL_RANGE_COMPARE_PARAMS_ARE_INVALID',['../group__SlNetErr.html#ga65ba1a1f8ae5718dca0cce069d44b58b',1,'slneterr.h']]],
['slneterr_5frxfl_5fread_5fdata_5flength',['SLNETERR_RXFL_READ_DATA_LENGTH',['../group__SlNetErr.html#gad50c4823c6c6d7d802af888f0a586b76',1,'slneterr.h']]],
['slneterr_5frxfl_5fread_5ffile_5ffailed',['SLNETERR_RXFL_READ_FILE_FAILED',['../group__SlNetErr.html#ga6f16cdaf7c76ddbe7ddc6052c0cbdf0e',1,'slneterr.h']]],
['slneterr_5frxfl_5fread_5ffile_5ffilter_5fid_5fillegal',['SLNETERR_RXFL_READ_FILE_FILTER_ID_ILLEGAL',['../group__SlNetErr.html#ga7c77fb126a4dfc960196926d93d8e541',1,'slneterr.h']]],
['slneterr_5frxfl_5fread_5ffile_5fnumber_5fof_5ffilter_5ffailed',['SLNETERR_RXFL_READ_FILE_NUMBER_OF_FILTER_FAILED',['../group__SlNetErr.html#gaf8c071b3b3f424c276bd19a6e77a0a77',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5ffield_5fid_5fnot_5fsupported',['SLNETERR_RXFL_RULE_FIELD_ID_NOT_SUPPORTED',['../group__SlNetErr.html#ga77406860bb2ceb07ef8e98d926e634e2',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5faction_5ftype_5fnot_5fsupported',['SLNETERR_RXFL_RULE_HEADER_ACTION_TYPE_NOT_SUPPORTED',['../group__SlNetErr.html#ga72314ad77e28d54dd4743ee9c562ffda',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5fcombination_5foperator_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_COMBINATION_OPERATOR_OUT_OF_RANGE',['../group__SlNetErr.html#ga0cf7294a2fc4a0e5523cd12459c35a05',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5fcompare_5ffunc_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_COMPARE_FUNC_OUT_OF_RANGE',['../group__SlNetErr.html#ga54c74f941fe4d8bc6f51f948fe0c1883',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5ffield_5fid_5fascii_5fnot_5fsupported',['SLNETERR_RXFL_RULE_HEADER_FIELD_ID_ASCII_NOT_SUPPORTED',['../group__SlNetErr.html#gaf00ace0d697ed594c4cff451975e7ba7',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5ffield_5fid_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_FIELD_ID_OUT_OF_RANGE',['../group__SlNetErr.html#ga77b4437bce19e6387a81cb2431dcf9bb',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5fnot_5fsupported',['SLNETERR_RXFL_RULE_HEADER_NOT_SUPPORTED',['../group__SlNetErr.html#gae600783b23f5bc023145f746e310f894',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_OUT_OF_RANGE',['../group__SlNetErr.html#ga89d1ebf472629756167aaf55d813819d',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5ftrigger_5fcompare_5ffunc_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_TRIGGER_COMPARE_FUNC_OUT_OF_RANGE',['../group__SlNetErr.html#gaebe10f509dae6fa19faf957a45494b40',1,'slneterr.h']]],
['slneterr_5frxfl_5frule_5fheader_5ftrigger_5fout_5fof_5frange',['SLNETERR_RXFL_RULE_HEADER_TRIGGER_OUT_OF_RANGE',['../group__SlNetErr.html#ga5a84c9d61183c3a4788665a9444c9fae',1,'slneterr.h']]],
['slneterr_5frxfl_5frxfl_5fallocation_5fproblem',['SLNETERR_RXFL_RXFL_ALLOCATION_PROBLEM',['../group__SlNetErr.html#ga871637294c5d9fd69c74f44082656522',1,'slneterr.h']]],
['slneterr_5frxfl_5frxfl_5finvalid_5fpattern_5flength',['SLNETERR_RXFL_RXFL_INVALID_PATTERN_LENGTH',['../group__SlNetErr.html#ga642b4802e624952396d9c402cfbee3f6',1,'slneterr.h']]],
['slneterr_5frxfl_5fstat_5funsupported',['SLNETERR_RXFL_STAT_UNSUPPORTED',['../group__SlNetErr.html#ga5c325d4a4a7c96c6e44d7f75db368dd6',1,'slneterr.h']]],
['slneterr_5frxfl_5fsystem_5fstate_5fnot_5fsupported_5ffor_5fthis_5ffilter',['SLNETERR_RXFL_SYSTEM_STATE_NOT_SUPPORTED_FOR_THIS_FILTER',['../group__SlNetErr.html#ga2285982db103ac14da51c9c8ab4c3667',1,'slneterr.h']]],
['slneterr_5frxfl_5fthe_5ffilter_5fis_5fnot_5fof_5fheader_5ftype',['SLNETERR_RXFL_THE_FILTER_IS_NOT_OF_HEADER_TYPE',['../group__SlNetErr.html#ga81119af7a168db782b6b4aab060bc3c8',1,'slneterr.h']]],
['slneterr_5frxfl_5ftrigger_5fuse_5freg1_5fto_5freg4',['SLNETERR_RXFL_TRIGGER_USE_REG1_TO_REG4',['../group__SlNetErr.html#gaa0301b7889669c8f7c6431ed14add92b',1,'slneterr.h']]],
['slneterr_5frxfl_5ftrigger_5fuse_5freg5_5fto_5freg8',['SLNETERR_RXFL_TRIGGER_USE_REG5_TO_REG8',['../group__SlNetErr.html#gab5caa2bb512432fc7f026fd914cd0f6b',1,'slneterr.h']]],
['slneterr_5frxfl_5funknown',['SLNETERR_RXFL_UNKNOWN',['../group__SlNetErr.html#ga98acb77b82d029a25a6643c8d881b315',1,'slneterr.h']]],
['slneterr_5frxfl_5fupdate_5fnot_5fsupported',['SLNETERR_RXFL_UPDATE_NOT_SUPPORTED',['../group__SlNetErr.html#ga3702df093f52acdc57b1403d8479d312',1,'slneterr.h']]],
['slneterr_5frxfl_5fwrong_5fcompare_5ffunc_5ffor_5fbroadcast_5faddress',['SLNETERR_RXFL_WRONG_COMPARE_FUNC_FOR_BROADCAST_ADDRESS',['../group__SlNetErr.html#gacb32c1c5713e23ec330a1b43f284c2cd',1,'slneterr.h']]],
['slneterr_5frxfl_5fwrong_5fmulticast_5faddress',['SLNETERR_RXFL_WRONG_MULTICAST_ADDRESS',['../group__SlNetErr.html#ga455000d5ac16e10f9b3ea713bd814194',1,'slneterr.h']]],
['slneterr_5frxfl_5fwrong_5fmulticast_5fbroadcast_5faddress',['SLNETERR_RXFL_WRONG_MULTICAST_BROADCAST_ADDRESS',['../group__SlNetErr.html#ga8ca25dff880b47992f363216e1d4db99',1,'slneterr.h']]],
['slneterr_5fstatic_5faddr_5fsubnet_5ferror',['SLNETERR_STATIC_ADDR_SUBNET_ERROR',['../group__SlNetErr.html#ga3c7a6a518f780bf4f314e54ee5440798',1,'slneterr.h']]],
['slneterr_5fstatus_5ferror',['SLNETERR_STATUS_ERROR',['../group__SlNetErr.html#gafc2a008fdd1ee3abf10a670af344d3ca',1,'slneterr.h']]],
['slneterr_5fsupplicant_5ferror',['SLNETERR_SUPPLICANT_ERROR',['../group__SlNetErr.html#ga0509f6ea7d8c3b675b6817a3df38ac77',1,'slneterr.h']]],
['slneterr_5funknown_5ferr',['SLNETERR_UNKNOWN_ERR',['../group__SlNetErr.html#gaf01805cf6b50a18ae0384d697fed07f1',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5faccess_5flist_5fdisabled',['SLNETERR_WLAN_AP_ACCESS_LIST_DISABLED',['../group__SlNetErr.html#gad59499ddf4687a5be6e52bed431a7c63',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5faccess_5flist_5ffull',['SLNETERR_WLAN_AP_ACCESS_LIST_FULL',['../group__SlNetErr.html#gaae499216f934f508554019a1949b3edd',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5faccess_5flist_5fmode_5fnot_5fsupported',['SLNETERR_WLAN_AP_ACCESS_LIST_MODE_NOT_SUPPORTED',['../group__SlNetErr.html#ga2e6f16a454fec74fbb93b858188f6f9a',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5faccess_5flist_5fno_5faddress_5fto_5fdelete',['SLNETERR_WLAN_AP_ACCESS_LIST_NO_ADDRESS_TO_DELETE',['../group__SlNetErr.html#gae27a5ef647acc59bee4a88d0575d9a00',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5fscan_5finterval_5ftoo_5flow',['SLNETERR_WLAN_AP_SCAN_INTERVAL_TOO_LOW',['../group__SlNetErr.html#ga6f7ed5a3ad4f342d38da3cece03199d3',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5fscan_5finterval_5ftoo_5fshort',['SLNETERR_WLAN_AP_SCAN_INTERVAL_TOO_SHORT',['../group__SlNetErr.html#ga666d22eae300ef894c819d3777ddcf42',1,'slneterr.h']]],
['slneterr_5fwlan_5fap_5fsta_5fnot_5ffound',['SLNETERR_WLAN_AP_STA_NOT_FOUND',['../group__SlNetErr.html#ga3b4b706cfcd21415d976ce34c14b6913',1,'slneterr.h']]],
['slneterr_5fwlan_5fcannot_5fconfig_5fscan_5fduring_5fprovisioning',['SLNETERR_WLAN_CANNOT_CONFIG_SCAN_DURING_PROVISIONING',['../group__SlNetErr.html#gaa49ed82016a2e68defbf3bd40153d572',1,'slneterr.h']]],
['slneterr_5fwlan_5fdrv_5finit_5ffail',['SLNETERR_WLAN_DRV_INIT_FAIL',['../group__SlNetErr.html#gaca2febbc17cdb0fcbf06a19b7db15bca',1,'slneterr.h']]],
['slneterr_5fwlan_5feap_5fanonymous_5flen_5ferror',['SLNETERR_WLAN_EAP_ANONYMOUS_LEN_ERROR',['../group__SlNetErr.html#ga16a7d3200f17acf63b2c76c61c98728d',1,'slneterr.h']]],
['slneterr_5fwlan_5feap_5fwrong_5fmethod',['SLNETERR_WLAN_EAP_WRONG_METHOD',['../group__SlNetErr.html#gaaf7c725ff1d731ccd30467304e7cb20d',1,'slneterr.h']]],
['slneterr_5fwlan_5ffast_5fconn_5fdata_5finvalid',['SLNETERR_WLAN_FAST_CONN_DATA_INVALID',['../group__SlNetErr.html#ga2092b9c1d16f34a21c8fe1d28399be6e',1,'slneterr.h']]],
['slneterr_5fwlan_5fget_5fnetwork_5flist_5feagain',['SLNETERR_WLAN_GET_NETWORK_LIST_EAGAIN',['../group__SlNetErr.html#gacbfcfc208326515b1d71c11021005fd2',1,'slneterr.h']]],
['slneterr_5fwlan_5fget_5fprofile_5finvalid_5findex',['SLNETERR_WLAN_GET_PROFILE_INVALID_INDEX',['../group__SlNetErr.html#ga513c4da73a9ac2fe3752ae855fab1db5',1,'slneterr.h']]],
['slneterr_5fwlan_5fillegal_5fchannel',['SLNETERR_WLAN_ILLEGAL_CHANNEL',['../group__SlNetErr.html#ga7857bfdc25bc91c9d15a0166ac1c0aa2',1,'slneterr.h']]],
['slneterr_5fwlan_5fillegal_5fwep_5fkey_5findex',['SLNETERR_WLAN_ILLEGAL_WEP_KEY_INDEX',['../group__SlNetErr.html#ga055fd97056e3c2119a7b9d51162bfa2f',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5fap_5fpassword_5flength',['SLNETERR_WLAN_INVALID_AP_PASSWORD_LENGTH',['../group__SlNetErr.html#gaa483e7461bf271e9519cb2ec5f1e1ec0',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5fcountry_5fcode',['SLNETERR_WLAN_INVALID_COUNTRY_CODE',['../group__SlNetErr.html#ga1b39f94076a29cca6a0edd5678e5d1a8',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5fdwell_5ftime_5fvalues',['SLNETERR_WLAN_INVALID_DWELL_TIME_VALUES',['../group__SlNetErr.html#ga066ee457f23a284c25b3c0b0f0b3a5fb',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5fpolicy_5ftype',['SLNETERR_WLAN_INVALID_POLICY_TYPE',['../group__SlNetErr.html#gaa2b8d983894d53d01a7e9b5ac946ddae',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5frole',['SLNETERR_WLAN_INVALID_ROLE',['../group__SlNetErr.html#ga11f0f3754413ffe7fcb533670e0c4d32',1,'slneterr.h']]],
['slneterr_5fwlan_5finvalid_5fsecurity_5ftype',['SLNETERR_WLAN_INVALID_SECURITY_TYPE',['../group__SlNetErr.html#gab4ba3740a9f84a37fc94104370586323',1,'slneterr.h']]],
['slneterr_5fwlan_5fkey_5ferror',['SLNETERR_WLAN_KEY_ERROR',['../group__SlNetErr.html#ga6fd116c3e8131b4f214d6e2fc6ad06f7',1,'slneterr.h']]],
['slneterr_5fwlan_5fmulticast_5fexceed_5fmax_5faddr',['SLNETERR_WLAN_MULTICAST_EXCEED_MAX_ADDR',['../group__SlNetErr.html#ga927c467ae907fc30c284468234367e65',1,'slneterr.h']]],
['slneterr_5fwlan_5fmulticast_5finval_5faddr',['SLNETERR_WLAN_MULTICAST_INVAL_ADDR',['../group__SlNetErr.html#ga1722f27de018623060fa21edb3c6e760',1,'slneterr.h']]],
['slneterr_5fwlan_5fno_5ffree_5fprofile',['SLNETERR_WLAN_NO_FREE_PROFILE',['../group__SlNetErr.html#ga652a42cfe2ea959ee02146faea3b0d47',1,'slneterr.h']]],
['slneterr_5fwlan_5fnvmem_5faccess_5ffailed',['SLNETERR_WLAN_NVMEM_ACCESS_FAILED',['../group__SlNetErr.html#gaa3936f71f31463350496ba87b5eb02a7',1,'slneterr.h']]],
['slneterr_5fwlan_5fold_5ffile_5fversion',['SLNETERR_WLAN_OLD_FILE_VERSION',['../group__SlNetErr.html#ga8053852101bc4d698d9c7262a45bd449',1,'slneterr.h']]],
['slneterr_5fwlan_5fpassphrase_5ftoo_5flong',['SLNETERR_WLAN_PASSPHRASE_TOO_LONG',['../group__SlNetErr.html#ga2604455fca86cac4ff8b53572195ac0b',1,'slneterr.h']]],
['slneterr_5fwlan_5fpassword_5ferror',['SLNETERR_WLAN_PASSWORD_ERROR',['../group__SlNetErr.html#ga280b0f422b9cc5ac217ba1260d1dad39',1,'slneterr.h']]],
['slneterr_5fwlan_5fpm_5fpolicy_5finvalid_5foption',['SLNETERR_WLAN_PM_POLICY_INVALID_OPTION',['../group__SlNetErr.html#gab32d4dc9bca269edeea551b05e0962e4',1,'slneterr.h']]],
['slneterr_5fwlan_5fpm_5fpolicy_5finvalid_5fparams',['SLNETERR_WLAN_PM_POLICY_INVALID_PARAMS',['../group__SlNetErr.html#ga89ae8669a8008aff0ed1c4c7e89c82a3',1,'slneterr.h']]],
['slneterr_5fwlan_5fpreferred_5fnetwork_5flist_5ffull',['SLNETERR_WLAN_PREFERRED_NETWORK_LIST_FULL',['../group__SlNetErr.html#ga22349cb2f2b51c32b791c6c99b0ce9c3',1,'slneterr.h']]],
['slneterr_5fwlan_5fpreferred_5fnetworks_5ffile_5fload_5ffailed',['SLNETERR_WLAN_PREFERRED_NETWORKS_FILE_LOAD_FAILED',['../group__SlNetErr.html#ga4960aff4f9d27c8b800c2831070db663',1,'slneterr.h']]],
['slneterr_5fwlan_5fpreferred_5fnetworks_5ffile_5fwrite_5ffailed',['SLNETERR_WLAN_PREFERRED_NETWORKS_FILE_WRITE_FAILED',['../group__SlNetErr.html#ga363d8fb832472e148749e798b3baa11f',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fabort_5fgeneral_5ferror',['SLNETERR_WLAN_PROVISIONING_ABORT_GENERAL_ERROR',['../group__SlNetErr.html#gac40fce30fac9bc73dc6cced22f41425c',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fabort_5fhttp_5fserver_5fdisabled',['SLNETERR_WLAN_PROVISIONING_ABORT_HTTP_SERVER_DISABLED',['../group__SlNetErr.html#ga0470f111e210d023c5401f5d0ae349a3',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fabort_5finvalid_5fparam',['SLNETERR_WLAN_PROVISIONING_ABORT_INVALID_PARAM',['../group__SlNetErr.html#ga0a40a6d4344c389d03996e6dabb588a1',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fabort_5fprofile_5flist_5ffull',['SLNETERR_WLAN_PROVISIONING_ABORT_PROFILE_LIST_FULL',['../group__SlNetErr.html#gae0a6b56fd9e7292ec51746c37d384249',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fabort_5fprovisioning_5falready_5fstarted',['SLNETERR_WLAN_PROVISIONING_ABORT_PROVISIONING_ALREADY_STARTED',['../group__SlNetErr.html#ga737f58ea95f7a8d9d8952806e5a85f33',1,'slneterr.h']]],
['slneterr_5fwlan_5fprovisioning_5fcmd_5fnot_5fexpected',['SLNETERR_WLAN_PROVISIONING_CMD_NOT_EXPECTED',['../group__SlNetErr.html#gab9ab85b06f5c0f89c95d46b0ad45d9de',1,'slneterr.h']]],
['slneterr_5fwlan_5fscan_5fpolicy_5finvalid_5fparams',['SLNETERR_WLAN_SCAN_POLICY_INVALID_PARAMS',['../group__SlNetErr.html#gae211999f921a5bafd1b06516bf24f275',1,'slneterr.h']]],
['slneterr_5fwlan_5fssid_5flen_5ferror',['SLNETERR_WLAN_SSID_LEN_ERROR',['../group__SlNetErr.html#gafda901ca01fc4bf1e464f65f60a949f5',1,'slneterr.h']]],
['slneterr_5fwlan_5ftransceiver_5fenabled',['SLNETERR_WLAN_TRANSCEIVER_ENABLED',['../group__SlNetErr.html#gaaf3f9c2c69a037e153f51f17e3b3a405',1,'slneterr.h']]],
['slneterr_5fwlan_5ftx_5fpower_5fout_5fof_5frange',['SLNETERR_WLAN_TX_POWER_OUT_OF_RANGE',['../group__SlNetErr.html#ga684a99e409cd054b36743d791f5a2ea4',1,'slneterr.h']]],
['slneterr_5fwlan_5fuser_5fid_5flen_5ferror',['SLNETERR_WLAN_USER_ID_LEN_ERROR',['../group__SlNetErr.html#gab333d899f65669fe68b91622ae7d2ad3',1,'slneterr.h']]],
['slneterr_5fwlan_5fwifi_5falready_5fdisconnected',['SLNETERR_WLAN_WIFI_ALREADY_DISCONNECTED',['../group__SlNetErr.html#gada17383459ec34cc56fdff112167923d',1,'slneterr.h']]],
['slneterr_5fwlan_5fwifi_5fnot_5fconnected',['SLNETERR_WLAN_WIFI_NOT_CONNECTED',['../group__SlNetErr.html#ga8bab717e8b8b5d41933b84f3db693d4c',1,'slneterr.h']]],
['slneterr_5fwrong_5frole',['SLNETERR_WRONG_ROLE',['../group__SlNetErr.html#gadd9e2a5cf9f6144e2580b6ada292a568',1,'slneterr.h']]],
['slnetif_20group',['SlNetIf group',['../group__SlNetIf.html',1,'']]],
['slnetif_2eh',['slnetif.h',['../slnetif_8h.html',1,'']]],
['slnetif_5fadd',['SlNetIf_add',['../group__SlNetIf.html#gae09651b941726526788a932498d2d250',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5fdhcp',['SLNETIF_ADDR_CFG_DHCP',['../group__SlNetIf.html#gae32690c44cf94a636a70fd5f71ad5eff',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5fdhcp_5flla',['SLNETIF_ADDR_CFG_DHCP_LLA',['../group__SlNetIf.html#ga2cf4e2fbc91c1bb10d69d9cef2bfe012',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5fstateful',['SLNETIF_ADDR_CFG_STATEFUL',['../group__SlNetIf.html#ga67b7dea083608aa5546a42716b098f29',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5fstateless',['SLNETIF_ADDR_CFG_STATELESS',['../group__SlNetIf.html#ga634267a367ce68a937fad6ebbe7505d2',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5fstatic',['SLNETIF_ADDR_CFG_STATIC',['../group__SlNetIf.html#ga85be04b659b55a977ee6f31ad355cbd6',1,'slnetif.h']]],
['slnetif_5faddr_5fcfg_5funknown',['SLNETIF_ADDR_CFG_UNKNOWN',['../group__SlNetIf.html#gae877bee21b65f26f02808729297503be',1,'slnetif.h']]],
['slnetif_5fconfig_5ft',['SlNetIf_Config_t',['../structSlNetIf__Config__t.html',1,'SlNetIf_Config_t'],['../group__SlNetIf.html#ga61bf8cd4f09c42f10f5f47e9681a83cb',1,'SlNetIf_Config_t(): slnetif.h']]],
['slnetif_5ferr_5fifcreatecontext_5ffailed',['SLNETIF_ERR_IFCREATECONTEXT_FAILED',['../group__SlNetErr.html#ga7e0d1c94ed1de32309497124347ddaa2',1,'slneterr.h']]],
['slnetif_5ferr_5fifgetconnectionstatus_5ffailed',['SLNETIF_ERR_IFGETCONNECTIONSTATUS_FAILED',['../group__SlNetErr.html#gad9e5865e7f304f5214abbf22d4d9cbf7',1,'slneterr.h']]],
['slnetif_5ferr_5fifgetipaddr_5ffailed',['SLNETIF_ERR_IFGETIPADDR_FAILED',['../group__SlNetErr.html#gab5afa168a54cef19cfb1f7dc6d3aeba7',1,'slneterr.h']]],
['slnetif_5ferr_5fifloadsecobj_5ffailed',['SLNETIF_ERR_IFLOADSECOBJ_FAILED',['../group__SlNetErr.html#ga8f50c4b430c0296a5b091637518ca505',1,'slneterr.h']]],
['slnetif_5fgetconnectionstatus',['SlNetIf_getConnectionStatus',['../group__SlNetIf.html#gac47597b573607194c63d42a82d5953db',1,'slnetif.h']]],
['slnetif_5fgetidbyname',['SlNetIf_getIDByName',['../group__SlNetIf.html#gaeeae547b8a09e85d158664baea09481a',1,'slnetif.h']]],
['slnetif_5fgetifbyid',['SlNetIf_getIfByID',['../group__SlNetIf.html#ga0d75e614174a9e0255649171aee5acc1',1,'slnetif.h']]],
['slnetif_5fgetipaddr',['SlNetIf_getIPAddr',['../group__SlNetIf.html#gac2fbe1c788dfcabb94e465448e2632a2',1,'slnetif.h']]],
['slnetif_5fgetnamebyid',['SlNetIf_getNameByID',['../group__SlNetIf.html#ga56629f3720863eb2ad4012e0cb80e836',1,'slnetif.h']]],
['slnetif_5fgetpriority',['SlNetIf_getPriority',['../group__SlNetIf.html#gaa183085c427847c2693ba67ca32b9e2b',1,'slnetif.h']]],
['slnetif_5fgetstate',['SlNetIf_getState',['../group__SlNetIf.html#ga19d3d422deca70b2082264cba84f4466',1,'slnetif.h']]],
['slnetif_5fid_5f1',['SLNETIF_ID_1',['../group__SlNetIf.html#gaae4163ece492875e6efbc95d27c66b26',1,'slnetif.h']]],
['slnetif_5fid_5f10',['SLNETIF_ID_10',['../group__SlNetIf.html#ga5a15c75cb9fb98fa3fac9cf46eb6af77',1,'slnetif.h']]],
['slnetif_5fid_5f11',['SLNETIF_ID_11',['../group__SlNetIf.html#ga073e3f3987223d2bc69c9c2e4aba219d',1,'slnetif.h']]],
['slnetif_5fid_5f12',['SLNETIF_ID_12',['../group__SlNetIf.html#ga2df830639ecd615795f2e5b3100e3bec',1,'slnetif.h']]],
['slnetif_5fid_5f13',['SLNETIF_ID_13',['../group__SlNetIf.html#ga1959fd6e0597f9821bc5209d5265c678',1,'slnetif.h']]],
['slnetif_5fid_5f14',['SLNETIF_ID_14',['../group__SlNetIf.html#ga0e1e203e8856dd321267cae2e7277453',1,'slnetif.h']]],
['slnetif_5fid_5f15',['SLNETIF_ID_15',['../group__SlNetIf.html#ga6615a091deb90d6b8ed136891fef5930',1,'slnetif.h']]],
['slnetif_5fid_5f16',['SLNETIF_ID_16',['../group__SlNetIf.html#ga174b2ca0c4e0cd130329c68b89b23c3d',1,'slnetif.h']]],
['slnetif_5fid_5f2',['SLNETIF_ID_2',['../group__SlNetIf.html#ga880e6ae0b17f13aa2e56bc0b3f7d9784',1,'slnetif.h']]],
['slnetif_5fid_5f3',['SLNETIF_ID_3',['../group__SlNetIf.html#ga1a535b85dc293e63abdb4cb494848b65',1,'slnetif.h']]],
['slnetif_5fid_5f4',['SLNETIF_ID_4',['../group__SlNetIf.html#ga98e1397c01b67cfb2338bf813fc8b93a',1,'slnetif.h']]],
['slnetif_5fid_5f5',['SLNETIF_ID_5',['../group__SlNetIf.html#ga62b1a2e777c4603bef63c6f039bd15d9',1,'slnetif.h']]],
['slnetif_5fid_5f6',['SLNETIF_ID_6',['../group__SlNetIf.html#ga2b50b85c7f51dacdfa6045353db6c5fe',1,'slnetif.h']]],
['slnetif_5fid_5f7',['SLNETIF_ID_7',['../group__SlNetIf.html#gacb65aee75b15aa7c05ecfedde9852f35',1,'slnetif.h']]],
['slnetif_5fid_5f8',['SLNETIF_ID_8',['../group__SlNetIf.html#ga48274ce36fe00022f3ec84965213fc5b',1,'slnetif.h']]],
['slnetif_5fid_5f9',['SLNETIF_ID_9',['../group__SlNetIf.html#gaff221501ab002492eeba67c26a7423c4',1,'slnetif.h']]],
['slnetif_5finit',['SlNetIf_init',['../group__SlNetIf.html#gaed6d8e498c616bc48232f9718b14dcc8',1,'slnetif.h']]],
['slnetif_5fipv4_5faddr',['SLNETIF_IPV4_ADDR',['../group__SlNetIf.html#gga5b4ae97f88b0f06e47174562a25b35ffa69b20def7a20d5dcd675eebabfcd19f7',1,'slnetif.h']]],
['slnetif_5fipv6_5faddr_5fglobal',['SLNETIF_IPV6_ADDR_GLOBAL',['../group__SlNetIf.html#gga5b4ae97f88b0f06e47174562a25b35ffa069d2f0202d1c2253ab7aa36dd0f1a88',1,'slnetif.h']]],
['slnetif_5fipv6_5faddr_5flocal',['SLNETIF_IPV6_ADDR_LOCAL',['../group__SlNetIf.html#gga5b4ae97f88b0f06e47174562a25b35ffa873e3684397a1c1922f80a35cc550a2b',1,'slnetif.h']]],
['slnetif_5floadsecobj',['SlNetIf_loadSecObj',['../group__SlNetIf.html#ga72f32689df9255833f05af282ae3639b',1,'slnetif.h']]],
['slnetif_5fmax_5fif',['SLNETIF_MAX_IF',['../group__SlNetIf.html#gab90a01f93220dec498118a5aec566c8f',1,'slnetif.h']]],
['slnetif_5fquery_5fif_5fallow_5fpartial_5fmatch_5fbit',['SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT',['../group__SlNetIf.html#ga10a0a72096e2c62efb03e7ca4eec8b8c',1,'slnetif.h']]],
['slnetif_5fquery_5fif_5fconnection_5fstatus_5fbit',['SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT',['../group__SlNetIf.html#gada1e4fe46542135f1bc4dfff6657aa79',1,'slnetif.h']]],
['slnetif_5fquery_5fif_5fstate_5fbit',['SLNETIF_QUERY_IF_STATE_BIT',['../group__SlNetIf.html#ga601b979748297c75db52ca8972e5dce3',1,'slnetif.h']]],
['slnetif_5fqueryif',['SlNetIf_queryIf',['../group__SlNetIf.html#ga2c6139ad09a3da7bac9ed7c7cef72caa',1,'slnetif.h']]],
['slnetif_5fsec_5fobj_5ftype_5fcertificate',['SLNETIF_SEC_OBJ_TYPE_CERTIFICATE',['../group__SlNetIf.html#ga26a9179b2112e4a436090afe00e58cb7',1,'slnetif.h']]],
['slnetif_5fsec_5fobj_5ftype_5fdh_5fkey',['SLNETIF_SEC_OBJ_TYPE_DH_KEY',['../group__SlNetIf.html#gad2285553ebd5175623a0a430cc9bbaf8',1,'slnetif.h']]],
['slnetif_5fsec_5fobj_5ftype_5frsa_5fprivate_5fkey',['SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY',['../group__SlNetIf.html#ga6ffa46fae363550a1c90b11734ea24ec',1,'slnetif.h']]],
['slnetif_5fsetpriority',['SlNetIf_setPriority',['../group__SlNetIf.html#gaa7db498d54a14d7fcead79431a9cac02',1,'slnetif.h']]],
['slnetif_5fsetstate',['SlNetIf_setState',['../group__SlNetIf.html#gae11207d3284a9c84a7bc42d8ae2f20ff',1,'slnetif.h']]],
['slnetif_5fstate_5fdisable',['SLNETIF_STATE_DISABLE',['../group__SlNetIf.html#gga32d763d79092fa7f4a81064961dcc568ac3567b866974fff0710df28bb1115443',1,'slnetif.h']]],
['slnetif_5fstate_5fenable',['SLNETIF_STATE_ENABLE',['../group__SlNetIf.html#gga32d763d79092fa7f4a81064961dcc568a2fd12cc357f9c09dd39f61ec4bccfce0',1,'slnetif.h']]],
['slnetif_5fstatus_5fconnected',['SLNETIF_STATUS_CONNECTED',['../group__SlNetIf.html#gaf0b8d901e3e0490641e7100ee75ad63d',1,'slnetif.h']]],
['slnetif_5fstatus_5fdisconnected',['SLNETIF_STATUS_DISCONNECTED',['../group__SlNetIf.html#gaaafe0f63f29523f2de32a3aa6c336159',1,'slnetif.h']]],
['slnetif_5ft',['SlNetIf_t',['../structSlNetIf__t.html',1,'SlNetIf_t'],['../group__SlNetIf.html#ga00766f0c02893e7e7e15d7748007eaba',1,'SlNetIf_t(): slnetif.h']]],
['slnetifaddresstype_5fe',['SlNetIfAddressType_e',['../group__SlNetIf.html#ga5b4ae97f88b0f06e47174562a25b35ff',1,'slnetif.h']]],
['slnetifstate_5fe',['SlNetIfState_e',['../group__SlNetIf.html#ga32d763d79092fa7f4a81064961dcc568',1,'slnetif.h']]],
['slnetsock_20group',['SlNetSock group',['../group__SlNetSock.html',1,'']]],
['slnetsock_2eh',['slnetsock.h',['../slnetsock_8h.html',1,'']]],
['slnetsock_5faccept',['SlNetSock_accept',['../group__SlNetSock.html#ga45fd9b22c489184590f54120f13dbcd6',1,'slnetsock.h']]],
['slnetsock_5faddr_5ft',['SlNetSock_Addr_t',['../structSlNetSock__Addr__t.html',1,'SlNetSock_Addr_t'],['../group__SlNetSock.html#ga602566ae86c181687b621641c65d97f7',1,'SlNetSock_Addr_t(): slnetsock.h']]],
['slnetsock_5faddrin6_5ft',['SlNetSock_AddrIn6_t',['../structSlNetSock__AddrIn6__t.html',1,'SlNetSock_AddrIn6_t'],['../group__SlNetSock.html#gace2541e83c6c09ef5ab4ce0e522c6724',1,'SlNetSock_AddrIn6_t(): slnetsock.h']]],
['slnetsock_5faddrin_5ft',['SlNetSock_AddrIn_t',['../structSlNetSock__AddrIn__t.html',1,'SlNetSock_AddrIn_t'],['../group__SlNetSock.html#gaccdb0bf5d2826b71fc2c8bcea407aa16',1,'SlNetSock_AddrIn_t(): slnetsock.h']]],
['slnetsock_5faf_5finet',['SLNETSOCK_AF_INET',['../group__SlNetSock.html#ga0518da6a55b73912d74671b77d010565',1,'slnetsock.h']]],
['slnetsock_5faf_5finet6',['SLNETSOCK_AF_INET6',['../group__SlNetSock.html#ga67534288288a9753e612b6b7c3c00719',1,'slnetsock.h']]],
['slnetsock_5faf_5fpacket',['SLNETSOCK_AF_PACKET',['../group__SlNetSock.html#ga751f9e220820778baa55e966bbb3832d',1,'slnetsock.h']]],
['slnetsock_5faf_5frf',['SLNETSOCK_AF_RF',['../group__SlNetSock.html#ga8a8bc47cf2f9e8d324de24cec2dbbd1e',1,'slnetsock.h']]],
['slnetsock_5faf_5funspec',['SLNETSOCK_AF_UNSPEC',['../group__SlNetSock.html#gab36b24a78520aa7d01b31c48139f9cd2',1,'slnetsock.h']]],
['slnetsock_5fbind',['SlNetSock_bind',['../group__SlNetSock.html#ga8c6a39689f45df13e97afcea7c21adbb',1,'slnetsock.h']]],
['slnetsock_5fbroadcast_5ft',['SlNetSock_Broadcast_t',['../structSlNetSock__Broadcast__t.html',1,'SlNetSock_Broadcast_t'],['../group__SlNetSock.html#gaa91e904e2b181c3f092cbb80d4477d0b',1,'SlNetSock_Broadcast_t(): slnetsock.h']]],
['slnetsock_5fclose',['SlNetSock_close',['../group__SlNetSock.html#gac10928928d0984392fa31f6ef8c5fad8',1,'slnetsock.h']]],
['slnetsock_5fconnect',['SlNetSock_connect',['../group__SlNetSock.html#gaea4662ca93793562d216cb307977d3b5',1,'slnetsock.h']]],
['slnetsock_5fcreate',['SlNetSock_create',['../group__SlNetSock.html#ga9ea71381f0f81003ca777c06d0bfdf0f',1,'slnetsock.h']]],
['slnetsock_5fcreate_5fallow_5fpartial_5fmatch',['SLNETSOCK_CREATE_ALLOW_PARTIAL_MATCH',['../group__SlNetSock.html#gad24bf9b6a02595a3f02c853ee33969fd',1,'slnetsock.h']]],
['slnetsock_5fcreate_5fif_5fstate_5fenable',['SLNETSOCK_CREATE_IF_STATE_ENABLE',['../group__SlNetSock.html#gab92201fa0e706f5487de0302b7d0d4c9',1,'slnetsock.h']]],
['slnetsock_5fcreate_5fif_5fstatus_5fconnected',['SLNETSOCK_CREATE_IF_STATUS_CONNECTED',['../group__SlNetSock.html#ga088fb3d2f84b99bfdbf9dcd88bb3462a',1,'slnetsock.h']]],
['slnetsock_5ferr_5fsockaccept_5ffailed',['SLNETSOCK_ERR_SOCKACCEPT_FAILED',['../group__SlNetErr.html#ga512a01cc91090a82a3d4cdc0356394bc',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockbind_5ffailed',['SLNETSOCK_ERR_SOCKBIND_FAILED',['../group__SlNetErr.html#ga97fce2338d452cf590ce3963cedbaf5e',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockclose_5ffailed',['SLNETSOCK_ERR_SOCKCLOSE_FAILED',['../group__SlNetErr.html#gae78bd1ef02cc7854b7dc30dcb660893c',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockconnect_5ffailed',['SLNETSOCK_ERR_SOCKCONNECT_FAILED',['../group__SlNetErr.html#ga591b6347632157227fb44bc7a0820c7d',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockcreate_5ffailed',['SLNETSOCK_ERR_SOCKCREATE_FAILED',['../group__SlNetErr.html#ga81fcae1816a4f398d09d2a4ad97ed44d',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockgetlocalname_5ffailed',['SLNETSOCK_ERR_SOCKGETLOCALNAME_FAILED',['../group__SlNetErr.html#gab20cb6d765f4ee5560e2594929e97986',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockgetopt_5ffailed',['SLNETSOCK_ERR_SOCKGETOPT_FAILED',['../group__SlNetErr.html#gad3e476cf685cb10e95a71ed2789378c4',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockgetpeername_5ffailed',['SLNETSOCK_ERR_SOCKGETPEERNAME_FAILED',['../group__SlNetErr.html#gabe2a98dbd15039fec1a2c6db4fcb439b',1,'slneterr.h']]],
['slnetsock_5ferr_5fsocklisten_5ffailed',['SLNETSOCK_ERR_SOCKLISTEN_FAILED',['../group__SlNetErr.html#ga9fa113487f7dc8383ecba4d72f1c4454',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockrecv_5ffailed',['SLNETSOCK_ERR_SOCKRECV_FAILED',['../group__SlNetErr.html#gafd1f3edb0b7019307ae95f96b88db0d7',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockrecvfrom_5ffailed',['SLNETSOCK_ERR_SOCKRECVFROM_FAILED',['../group__SlNetErr.html#ga8e0d03fda6ff4210803f2c0f1130c415',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockselect_5ffailed',['SLNETSOCK_ERR_SOCKSELECT_FAILED',['../group__SlNetErr.html#ga4f6398a36f676c8f81e05b019452310e',1,'slneterr.h']]],
['slnetsock_5ferr_5fsocksend_5ffailed',['SLNETSOCK_ERR_SOCKSEND_FAILED',['../group__SlNetErr.html#ga6e6a9b37a4705d807235b2379738aa97',1,'slneterr.h']]],
['slnetsock_5ferr_5fsocksendto_5ffailed',['SLNETSOCK_ERR_SOCKSENDTO_FAILED',['../group__SlNetErr.html#ga5b364b82b003d7401b5f8fbd00753227',1,'slneterr.h']]],
['slnetsock_5ferr_5fsocksetopt_5ffailed',['SLNETSOCK_ERR_SOCKSETOPT_FAILED',['../group__SlNetErr.html#gae90adb96bce150f1692df67b21378ad8',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockshutdown_5ffailed',['SLNETSOCK_ERR_SOCKSHUTDOWN_FAILED',['../group__SlNetErr.html#ga9c10391fbc4ec61730567744a642f0a2',1,'slneterr.h']]],
['slnetsock_5ferr_5fsockstartsec_5ffailed',['SLNETSOCK_ERR_SOCKSTARTSEC_FAILED',['../group__SlNetErr.html#ga8155d0cff9cebb07803ea95552e5f377',1,'slneterr.h']]],
['slnetsock_5fgetifid',['SlNetSock_getIfID',['../group__SlNetSock.html#gab42e56068b8b35d87e8ecdc1a3d67f62',1,'slnetsock.h']]],
['slnetsock_5fgetopt',['SlNetSock_getOpt',['../group__SlNetSock.html#ga4e94ea51cc019d104ca181cba2d6bf50',1,'slnetsock.h']]],
['slnetsock_5fgetpeername',['SlNetSock_getPeerName',['../group__SlNetSock.html#ga3eac25e5c6ec5865c89e07b0dce09000',1,'slnetsock.h']]],
['slnetsock_5fgetsockname',['SlNetSock_getSockName',['../group__SlNetSock.html#gab4101ff3e249219f95ef7134b1ce8199',1,'slnetsock.h']]],
['slnetsock_5fin6addr_5fany',['SLNETSOCK_IN6ADDR_ANY',['../group__SlNetSock.html#gaa8001a367623ec15c1bca8a6e08c5bc9',1,'slnetsock.h']]],
['slnetsock_5fin6addr_5ft',['SlNetSock_In6Addr_t',['../structSlNetSock__In6Addr__t.html',1,'SlNetSock_In6Addr_t'],['../group__SlNetSock.html#ga415ebfac2c78a81d56045b71b8aa8f68',1,'SlNetSock_In6Addr_t(): slnetsock.h']]],
['slnetsock_5finaddr_5fany',['SLNETSOCK_INADDR_ANY',['../group__SlNetSock.html#gadaaea8a6b5e159b3b747034686db6242',1,'slnetsock.h']]],
['slnetsock_5finaddr_5ft',['SlNetSock_InAddr_t',['../structSlNetSock__InAddr__t.html',1,'SlNetSock_InAddr_t'],['../group__SlNetSock.html#ga84ce92df3a5e3698e8e4d3993a7d4462',1,'SlNetSock_InAddr_t(): slnetsock.h']]],
['slnetsock_5finet6_5faddrstrlen',['SLNETSOCK_INET6_ADDRSTRLEN',['../group__SlNetSock.html#ga5e8695416672c4e1e0f73f3216a50466',1,'slnetsock.h']]],
['slnetsock_5finet_5faddrstrlen',['SLNETSOCK_INET_ADDRSTRLEN',['../group__SlNetSock.html#ga101277c1c2017c596f76d8dcd64476c3',1,'slnetsock.h']]],
['slnetsock_5finit',['SlNetSock_init',['../group__SlNetSock.html#ga5593c6be4cc33d90383dcbd4e6d1b377',1,'slnetsock.h']]],
['slnetsock_5fipmreq_5ft',['SlNetSock_IpMreq_t',['../structSlNetSock__IpMreq__t.html',1,'SlNetSock_IpMreq_t'],['../group__SlNetSock.html#ga6f0279477d2a41a5a21acbb0c0c81b89',1,'SlNetSock_IpMreq_t(): slnetsock.h']]],
['slnetsock_5fipv6mreq_5ft',['SlNetSock_IpV6Mreq_t',['../structSlNetSock__IpV6Mreq__t.html',1,'SlNetSock_IpV6Mreq_t'],['../group__SlNetSock.html#ga8f24034648dd46f6dc657b2dbc382e5a',1,'SlNetSock_IpV6Mreq_t(): slnetsock.h']]],
['slnetsock_5fkeepalive_5ft',['SlNetSock_Keepalive_t',['../structSlNetSock__Keepalive__t.html',1,'SlNetSock_Keepalive_t'],['../group__SlNetSock.html#gae86c88e9b228f6ff9e2d7c0410108f4f',1,'SlNetSock_Keepalive_t(): slnetsock.h']]],
['slnetsock_5flinger_5ft',['SlNetSock_linger_t',['../structSlNetSock__linger__t.html',1,'SlNetSock_linger_t'],['../group__SlNetSock.html#ga7991b3450d535d4c011ffa0f341dd7bf',1,'SlNetSock_linger_t(): slnetsock.h']]],
['slnetsock_5flisten',['SlNetSock_listen',['../group__SlNetSock.html#gafa59ce16fc62997cf08ae88cdd358fd0',1,'slnetsock.h']]],
['slnetsock_5flvl_5fip',['SLNETSOCK_LVL_IP',['../group__SlNetSock.html#gaee7b0aedfc5661b8dcdc506a5a30bf85',1,'slnetsock.h']]],
['slnetsock_5flvl_5fphy',['SLNETSOCK_LVL_PHY',['../group__SlNetSock.html#gab802e49c8d304d4afadd6df98b419ce9',1,'slnetsock.h']]],
['slnetsock_5flvl_5fsocket',['SLNETSOCK_LVL_SOCKET',['../group__SlNetSock.html#gad03341a3a66102bce02fcf3bdb7f387f',1,'slnetsock.h']]],
['slnetsock_5fmax_5fconcurrent_5fsockets',['SLNETSOCK_MAX_CONCURRENT_SOCKETS',['../group__SlNetSock.html#ga44c8ba606cb6706b0da4cde533c605f6',1,'slnetsock.h']]],
['slnetsock_5fmaxrtt_5ft',['SlNetSock_MaxRtt_t',['../structSlNetSock__MaxRtt__t.html',1,'SlNetSock_MaxRtt_t'],['../group__SlNetSock.html#ga1d8dc328180537e8da64c74fc65a335b',1,'SlNetSock_MaxRtt_t(): slnetsock.h']]],
['slnetsock_5fmaxseg_5ft',['SlNetSock_MaxSeg_t',['../structSlNetSock__MaxSeg__t.html',1,'SlNetSock_MaxSeg_t'],['../group__SlNetSock.html#ga9bd140582d0929db01d594a1329f2c1d',1,'SlNetSock_MaxSeg_t(): slnetsock.h']]],
['slnetsock_5fmsg_5fdontroute',['SLNETSOCK_MSG_DONTROUTE',['../group__SlNetSock.html#ga783a904109146927aca61763cd008a4a',1,'slnetsock.h']]],
['slnetsock_5fmsg_5fdontwait',['SLNETSOCK_MSG_DONTWAIT',['../group__SlNetSock.html#ga1faef31e047f3cde8782a7feb7a35183',1,'slnetsock.h']]],
['slnetsock_5fmsg_5fnosignal',['SLNETSOCK_MSG_NOSIGNAL',['../group__SlNetSock.html#ga518162085b23b3f588af6913a4b0e899',1,'slnetsock.h']]],
['slnetsock_5fmsg_5foob',['SLNETSOCK_MSG_OOB',['../group__SlNetSock.html#ga98b6e53c925ca0bab46f66afb14c3313',1,'slnetsock.h']]],
['slnetsock_5fmsg_5fpeek',['SLNETSOCK_MSG_PEEK',['../group__SlNetSock.html#ga17c06b18f4013fd5298f25d371f2875a',1,'slnetsock.h']]],
['slnetsock_5fmsg_5fwaitall',['SLNETSOCK_MSG_WAITALL',['../group__SlNetSock.html#ga809ddeaf0a4402da6d694c58c7ee3beb',1,'slnetsock.h']]],
['slnetsock_5fnodelay_5ft',['SlNetSock_NoDelay_t',['../structSlNetSock__NoDelay__t.html',1,'SlNetSock_NoDelay_t'],['../group__SlNetSock.html#ga8f9780ff167fedcd163b0089f5770035',1,'SlNetSock_NoDelay_t(): slnetsock.h']]],
['slnetsock_5fnonblocking_5ft',['SlNetSock_Nonblocking_t',['../structSlNetSock__Nonblocking__t.html',1,'SlNetSock_Nonblocking_t'],['../group__SlNetSock.html#gac03c5e165159c83cf59e614bc22df7be',1,'SlNetSock_Nonblocking_t(): slnetsock.h']]],
['slnetsock_5fnonipboundary_5ft',['SlNetSock_NonIpBoundary_t',['../structSlNetSock__NonIpBoundary__t.html',1,'SlNetSock_NonIpBoundary_t'],['../group__SlNetSock.html#ga3d69db17a56600db7db4566ff1731578',1,'SlNetSock_NonIpBoundary_t(): slnetsock.h']]],
['slnetsock_5fnoopt_5ft',['SlNetSock_NoOpt_t',['../structSlNetSock__NoOpt__t.html',1,'SlNetSock_NoOpt_t'],['../group__SlNetSock.html#ga3f31025ebcb742f2cf64fb7a8c57f340',1,'SlNetSock_NoOpt_t(): slnetsock.h']]],
['slnetsock_5fnopush_5ft',['SlNetSock_NoPush_t',['../structSlNetSock__NoPush__t.html',1,'SlNetSock_NoPush_t'],['../group__SlNetSock.html#ga70573a3b0ab1e530f8e247b108f39989',1,'SlNetSock_NoPush_t(): slnetsock.h']]],
['slnetsock_5fopip_5fadd_5fmembership',['SLNETSOCK_OPIP_ADD_MEMBERSHIP',['../group__SlNetSock.html#ga5eb5ca2f7b6d4b5c305badfa59049cda',1,'slnetsock.h']]],
['slnetsock_5fopip_5fdrop_5fmembership',['SLNETSOCK_OPIP_DROP_MEMBERSHIP',['../group__SlNetSock.html#ga5a59baf626d84f887984cb12e32776e1',1,'slnetsock.h']]],
['slnetsock_5fopip_5fhdrincl',['SLNETSOCK_OPIP_HDRINCL',['../group__SlNetSock.html#gab78371b5ed2f0fe4b8a02b042d379ca2',1,'slnetsock.h']]],
['slnetsock_5fopip_5fmulticast_5fttl',['SLNETSOCK_OPIP_MULTICAST_TTL',['../group__SlNetSock.html#ga03833a49cfc2409706568563878a4978',1,'slnetsock.h']]],
['slnetsock_5fopip_5fraw_5fipv6_5fhdrincl',['SLNETSOCK_OPIP_RAW_IPV6_HDRINCL',['../group__SlNetSock.html#ga77b9ffbc13b9f2e56ff47ad9e40a5f9f',1,'slnetsock.h']]],
['slnetsock_5fopip_5fraw_5frx_5fno_5fheader',['SLNETSOCK_OPIP_RAW_RX_NO_HEADER',['../group__SlNetSock.html#ga48dac0da98622d57ed8e84b5df9d745d',1,'slnetsock.h']]],
['slnetsock_5fopipv6_5fadd_5fmembership',['SLNETSOCK_OPIPV6_ADD_MEMBERSHIP',['../group__SlNetSock.html#ga4e9f6316c706309a57fda6decda351b1',1,'slnetsock.h']]],
['slnetsock_5fopipv6_5fdrop_5fmembership',['SLNETSOCK_OPIPV6_DROP_MEMBERSHIP',['../group__SlNetSock.html#gae7d3a2ec62b6a23ae965d13a5354a079',1,'slnetsock.h']]],
['slnetsock_5fopipv6_5fmulticast_5fhops',['SLNETSOCK_OPIPV6_MULTICAST_HOPS',['../group__SlNetSock.html#gac3bbce972abfe090f4d2398be00e2a14',1,'slnetsock.h']]],
['slnetsock_5fopphy_5fallow_5facks',['SLNETSOCK_OPPHY_ALLOW_ACKS',['../group__SlNetSock.html#gadaae917fcc39d8fba861e04d8e465b31',1,'slnetsock.h']]],
['slnetsock_5fopphy_5fchannel',['SLNETSOCK_OPPHY_CHANNEL',['../group__SlNetSock.html#gac3ac2aa4b9ef928e5fed2dcdf0c3e8c2',1,'slnetsock.h']]],
['slnetsock_5fopphy_5fnum_5fframes_5fto_5ftx',['SLNETSOCK_OPPHY_NUM_FRAMES_TO_TX',['../group__SlNetSock.html#gaf0709aaeff739089e37b080d67f09e77',1,'slnetsock.h']]],
['slnetsock_5fopphy_5fpreamble',['SLNETSOCK_OPPHY_PREAMBLE',['../group__SlNetSock.html#ga3d46a692a3ce4691fc526fec2e28871d',1,'slnetsock.h']]],
['slnetsock_5fopphy_5frate',['SLNETSOCK_OPPHY_RATE',['../group__SlNetSock.html#ga157517d966b1af27eeb02251c0c49442',1,'slnetsock.h']]],
['slnetsock_5fopphy_5ftx_5finhibit_5fthreshold',['SLNETSOCK_OPPHY_TX_INHIBIT_THRESHOLD',['../group__SlNetSock.html#gaf720373256294fb4ab22db18d717216e',1,'slnetsock.h']]],
['slnetsock_5fopphy_5ftx_5fpower',['SLNETSOCK_OPPHY_TX_POWER',['../group__SlNetSock.html#ga2cdd28cb2f63232f5e780516c05520fa',1,'slnetsock.h']]],
['slnetsock_5fopphy_5ftx_5ftimeout',['SLNETSOCK_OPPHY_TX_TIMEOUT',['../group__SlNetSock.html#ga23882b1f93cbb0e1badada98f871e3e5',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fbroadcast',['SLNETSOCK_OPSOCK_BROADCAST',['../group__SlNetSock.html#gafe4d5b357f7b515e8c6e5b0f9b8339ff',1,'slnetsock.h']]],
['slnetsock_5fopsock_5ferror',['SLNETSOCK_OPSOCK_ERROR',['../group__SlNetSock.html#ga758e7930aa8109d6d78ff864cdc4df7b',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fkeepalive',['SLNETSOCK_OPSOCK_KEEPALIVE',['../group__SlNetSock.html#gab2d8e1387ed3aaef3cb8f937de284492',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fkeepalive_5ftime',['SLNETSOCK_OPSOCK_KEEPALIVE_TIME',['../group__SlNetSock.html#ga027cc08f0c8ed179b3676020f0fdd71f',1,'slnetsock.h']]],
['slnetsock_5fopsock_5flinger',['SLNETSOCK_OPSOCK_LINGER',['../group__SlNetSock.html#ga09b61d602a689e9813d7413e165365e8',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fnon_5fblocking',['SLNETSOCK_OPSOCK_NON_BLOCKING',['../group__SlNetSock.html#ga0dd6ae6582a5f28e523db617b756625f',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fnon_5fip_5fboundary',['SLNETSOCK_OPSOCK_NON_IP_BOUNDARY',['../group__SlNetSock.html#gad571fd11e62a34601f71761e10abc2cf',1,'slnetsock.h']]],
['slnetsock_5fopsock_5frcv_5fbuf',['SLNETSOCK_OPSOCK_RCV_BUF',['../group__SlNetSock.html#gaaa1ec6f9c40a128025b319463e9a58f6',1,'slnetsock.h']]],
['slnetsock_5fopsock_5frcv_5ftimeo',['SLNETSOCK_OPSOCK_RCV_TIMEO',['../group__SlNetSock.html#gaa28743b27038b8ce900f18216874af9f',1,'slnetsock.h']]],
['slnetsock_5fopsock_5freuseaddr',['SLNETSOCK_OPSOCK_REUSEADDR',['../group__SlNetSock.html#ga8070fa02da039ae00d632cc9e2d25f48',1,'slnetsock.h']]],
['slnetsock_5fopsock_5freuseport',['SLNETSOCK_OPSOCK_REUSEPORT',['../group__SlNetSock.html#gaf986159b504b8b0e68e00781c5bc5928',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fslnetsocksd',['SLNETSOCK_OPSOCK_SLNETSOCKSD',['../group__SlNetSock.html#ga8dc3ffbf5c8985099d999b5dd8753fbf',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fsnd_5fbuf',['SLNETSOCK_OPSOCK_SND_BUF',['../group__SlNetSock.html#gac0610332d5907dc7dbdea5b406ccbe14',1,'slnetsock.h']]],
['slnetsock_5fopsock_5fsnd_5ftimeo',['SLNETSOCK_OPSOCK_SND_TIMEO',['../group__SlNetSock.html#gac269d99fdf5f96a94d70d0de8b1b5ce6',1,'slnetsock.h']]],
['slnetsock',['SlNetSock',['../SlNetSock_overview.html',1,'']]],
['slnetsock_5fpf_5finet',['SLNETSOCK_PF_INET',['../group__SlNetSock.html#ga6aa5150566ec3f525f19a9c006e03d0b',1,'slnetsock.h']]],
['slnetsock_5fpf_5finet6',['SLNETSOCK_PF_INET6',['../group__SlNetSock.html#ga64e671172b2fde47f2b0b01700386dff',1,'slnetsock.h']]],
['slnetsock_5fpf_5funspec',['SLNETSOCK_PF_UNSPEC',['../group__SlNetSock.html#ga3d752decb75fb13491e55d03a72d70d3',1,'slnetsock.h']]],
['slnetsock_5fproto_5fraw',['SLNETSOCK_PROTO_RAW',['../group__SlNetSock.html#ga4e6463128d72c83111d0b0b8d6365977',1,'slnetsock.h']]],
['slnetsock_5fproto_5fsecure',['SLNETSOCK_PROTO_SECURE',['../group__SlNetSock.html#ga78752b5bb7afadb16c2fe8a06848cf95',1,'slnetsock.h']]],
['slnetsock_5fproto_5ftcp',['SLNETSOCK_PROTO_TCP',['../group__SlNetSock.html#ga430387db835f0079db9ff56c8017ebc3',1,'slnetsock.h']]],
['slnetsock_5fproto_5fudp',['SLNETSOCK_PROTO_UDP',['../group__SlNetSock.html#ga2586fd6e3cd11859057854b49feec889',1,'slnetsock.h']]],
['slnetsock_5frecv',['SlNetSock_recv',['../group__SlNetSock.html#ga1349ee33126ca01de47104aa61253908',1,'slnetsock.h']]],
['slnetsock_5frecvfrom',['SlNetSock_recvFrom',['../group__SlNetSock.html#gacb20dca59da74cd843213a8094302257',1,'slnetsock.h']]],
['slnetsock_5fsackpermitted_5ft',['SlNetSock_SackPermitted_t',['../structSlNetSock__SackPermitted__t.html',1,'SlNetSock_SackPermitted_t'],['../group__SlNetSock.html#ga635509343f3feaa62a50672b7946cee9',1,'SlNetSock_SackPermitted_t(): slnetsock.h']]],
['slnetsock_5fsdsclr',['SlNetSock_sdsClr',['../group__SlNetSock.html#ga2dbf64e06858d1941b85b509b16cf3e2',1,'slnetsock.h']]],
['slnetsock_5fsdsclrall',['SlNetSock_sdsClrAll',['../group__SlNetSock.html#ga896fea39cd3146769ce5d28c5bc162f3',1,'slnetsock.h']]],
['slnetsock_5fsdset_5ft',['SlNetSock_SdSet_t',['../structSlNetSock__SdSet__t.html',1,'SlNetSock_SdSet_t'],['../group__SlNetSock.html#ga76397a9c86206f51290a6f6a3618fe30',1,'SlNetSock_SdSet_t(): slnetsock.h']]],
['slnetsock_5fsdsisset',['SlNetSock_sdsIsSet',['../group__SlNetSock.html#gad6a3e15d6efbf721d957b7d9f2344ac1',1,'slnetsock.h']]],
['slnetsock_5fsdsset',['SlNetSock_sdsSet',['../group__SlNetSock.html#gaa0a2e1e8c5da6365bb14a9f01b078062',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5ffull_5flist',['SLNETSOCK_SEC_ALPN_FULL_LIST',['../group__SlNetSock.html#gab674f70d8d727f5251e1b71737ad7b89',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5fh1',['SLNETSOCK_SEC_ALPN_H1',['../group__SlNetSock.html#gaee4a3faaff9d5a150696dd03550c4347',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5fh2',['SLNETSOCK_SEC_ALPN_H2',['../group__SlNetSock.html#ga820390c77197950525ea817e949fe3eb',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5fh2_5f14',['SLNETSOCK_SEC_ALPN_H2_14',['../group__SlNetSock.html#gaca270001466e199b89975a5777a95842',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5fh2_5f16',['SLNETSOCK_SEC_ALPN_H2_16',['../group__SlNetSock.html#ga62bd7a5f3023a465344d02b56fe12a0c',1,'slnetsock.h']]],
['slnetsock_5fsec_5falpn_5fh2c',['SLNETSOCK_SEC_ALPN_H2C',['../group__SlNetSock.html#ga4d8053a189154333ea66aa4849f6812e',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5falpn',['SLNETSOCK_SEC_ATTRIB_ALPN',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa51be3139b09c64e0bd2fc9397a01ea55',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fciphers',['SLNETSOCK_SEC_ATTRIB_CIPHERS',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa257291386c43bf32520280f900ad6933',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fdh_5fkey',['SLNETSOCK_SEC_ATTRIB_DH_KEY',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefad0bb9632496cd348ab74212e0a74e15f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fdisable_5fcert_5fstore',['SLNETSOCK_SEC_ATTRIB_DISABLE_CERT_STORE',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa4a23e9cec7bc6f013a926218b3201cd5',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fdomain_5fname',['SLNETSOCK_SEC_ATTRIB_DOMAIN_NAME',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa83ef412076126d87efa855949bf53a2c',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fext_5fclient_5fchlng_5fresp',['SLNETSOCK_SEC_ATTRIB_EXT_CLIENT_CHLNG_RESP',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa0cec521bbdbb94965ee8ed1b00d345ef',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5flocal_5fcert',['SLNETSOCK_SEC_ATTRIB_LOCAL_CERT',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa9f21c649e6caa89e64331e1a87c7e1c4',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fmethod',['SLNETSOCK_SEC_ATTRIB_METHOD',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefa80aa6f93506287f7aeff51ab252d3470',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fpeer_5froot_5fca',['SLNETSOCK_SEC_ATTRIB_PEER_ROOT_CA',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefae27abcd3f8a2473e64b3c1a81bec2c55',1,'slnetsock.h']]],
['slnetsock_5fsec_5fattrib_5fprivate_5fkey',['SLNETSOCK_SEC_ATTRIB_PRIVATE_KEY',['../group__SlNetSock.html#gga01d744e1c31131db3690b5a917ec8aefaaeceb3b35c02cf20c164049858f749ec',1,'slnetsock.h']]],
['slnetsock_5fsec_5fbind_5fcontext_5fonly',['SLNETSOCK_SEC_BIND_CONTEXT_ONLY',['../group__SlNetSock.html#ga34b20314fe133d83a2bfc1d36b930c63',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ffull_5flist',['SLNETSOCK_SEC_CIPHER_FULL_LIST',['../group__SlNetSock.html#gaef6f21ab18320a36c21c1128a7ea0c3a',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5fssl_5frsa_5fwith_5frc4_5f128_5fmd5',['SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_MD5',['../group__SlNetSock.html#gafecfebb03aa5999938369263e5f8a1b6',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5fssl_5frsa_5fwith_5frc4_5f128_5fsha',['SLNETSOCK_SEC_CIPHER_SSL_RSA_WITH_RC4_128_SHA',['../group__SlNetSock.html#ga09fd5ba56f85f1c8e7dcabfececbf5a8',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fdhe_5frsa_5fwith_5faes_5f128_5fgcm_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256',['../group__SlNetSock.html#ga9b76063ba49af1bc218ae2cecabf6a4b',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fdhe_5frsa_5fwith_5faes_5f256_5fcbc_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_CBC_SHA',['../group__SlNetSock.html#gaaec1c0e0c9f356b756b4328711dad118',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fdhe_5frsa_5fwith_5faes_5f256_5fgcm_5fsha384',['SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384',['../group__SlNetSock.html#ga73a37918ed516794718084b8ed219ebb',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fdhe_5frsa_5fwith_5fchacha20_5fpoly1305_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256',['../group__SlNetSock.html#gaf9209e036db438998412e8cd42eb2257',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5faes_5f128_5fcbc_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',['../group__SlNetSock.html#ga6ed75ed8cb4ab9773b9df9186c552e81',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5faes_5f128_5fcbc_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256',['../group__SlNetSock.html#gae804b98963a266ba4607353b69a3e7c5',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5faes_5f128_5fgcm_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',['../group__SlNetSock.html#ga5da643dfbbd92e1a73ce431b24017f6f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5faes_5f256_5fcbc_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',['../group__SlNetSock.html#ga535bd14ee8b174df5d34c203c2362efe',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5faes_5f256_5fgcm_5fsha384',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',['../group__SlNetSock.html#gaeaf3f9af1e380207ed77de85971b8b85',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5fecdsa_5fwith_5fchacha20_5fpoly1305_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256',['../group__SlNetSock.html#gaa04a2d4af19d08e6f268683435162dfa',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5faes_5f128_5fcbc_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256',['../group__SlNetSock.html#ga98fa530e37fff987126d04687db4cba2',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5faes_5f128_5fgcm_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',['../group__SlNetSock.html#ga488c5bb7dcc01afbb4f04fa370dc78fb',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5faes_5f256_5fcbc_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',['../group__SlNetSock.html#ga604eb43fa80b2c2ec0e49421f3c46b5f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5faes_5f256_5fgcm_5fsha384',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',['../group__SlNetSock.html#gae3d8bd8119745fa75021e410a819caff',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5fchacha20_5fpoly1305_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256',['../group__SlNetSock.html#ga2137f014d0beb0f34c862a05fb82f520',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5fecdhe_5frsa_5fwith_5frc4_5f128_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_ECDHE_RSA_WITH_RC4_128_SHA',['../group__SlNetSock.html#ga92453f7beb97f5b2f89f9a4392896232',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5frsa_5fwith_5faes_5f128_5fcbc_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_CBC_SHA256',['../group__SlNetSock.html#ga1b6d9f9764a3517de5076b3c584cbc47',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5frsa_5fwith_5faes_5f128_5fgcm_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_128_GCM_SHA256',['../group__SlNetSock.html#ga9f84d2bf03ad6fc37a8b1f43844b5f5f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5frsa_5fwith_5faes_5f256_5fcbc_5fsha',['SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA',['../group__SlNetSock.html#ga13b905c6dc3c9c7b389c901128d2864d',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5frsa_5fwith_5faes_5f256_5fcbc_5fsha256',['SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_CBC_SHA256',['../group__SlNetSock.html#gad988a448fc83df3e43d9de7dce5fa66d',1,'slnetsock.h']]],
['slnetsock_5fsec_5fcipher_5ftls_5frsa_5fwith_5faes_5f256_5fgcm_5fsha384',['SLNETSOCK_SEC_CIPHER_TLS_RSA_WITH_AES_256_GCM_SHA384',['../group__SlNetSock.html#ga9add427b33e17bf3ca911be5d32decd9',1,'slnetsock.h']]],
['slnetsock_5fsec_5fis_5fserver',['SLNETSOCK_SEC_IS_SERVER',['../group__SlNetSock.html#ga770bf963acc7e0adb1d37003979b8190',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5fdlsv1',['SLNETSOCK_SEC_METHOD_DLSV1',['../group__SlNetSock.html#gaa787e2bfb7f1e0e58c14569818582b91',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5fsslv3',['SLNETSOCK_SEC_METHOD_SSLV3',['../group__SlNetSock.html#ga558896cae99fb6785a9808c35710f46f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5fsslv3_5ftlsv1_5f2',['SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2',['../group__SlNetSock.html#ga47baa398aad27b550022df20889f6dce',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5ftlsv1',['SLNETSOCK_SEC_METHOD_TLSV1',['../group__SlNetSock.html#ga8ffd7df132ae4a81a8d91effe16f578d',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5ftlsv1_5f1',['SLNETSOCK_SEC_METHOD_TLSV1_1',['../group__SlNetSock.html#ga4c2f9ac88749caf85007d203685b728f',1,'slnetsock.h']]],
['slnetsock_5fsec_5fmethod_5ftlsv1_5f2',['SLNETSOCK_SEC_METHOD_TLSV1_2',['../group__SlNetSock.html#ga0a8e3fb65a20d6091b9b8d06bb5ba2b6',1,'slnetsock.h']]],
['slnetsock_5fsec_5fstart_5fsecurity_5fsession_5fonly',['SLNETSOCK_SEC_START_SECURITY_SESSION_ONLY',['../group__SlNetSock.html#ga0ed0fea2b0240402a054157dbccc1aad',1,'slnetsock.h']]],
['slnetsock_5fsecattribcreate',['SlNetSock_secAttribCreate',['../group__SlNetSock.html#gabd1c8f31a04b4e7e318c85516a1d33c8',1,'slnetsock.h']]],
['slnetsock_5fsecattribdelete',['SlNetSock_secAttribDelete',['../group__SlNetSock.html#ga774a4b41541a4ff58b44acae1e583697',1,'slnetsock.h']]],
['slnetsock_5fsecattribnode_5ft',['SlNetSock_SecAttribNode_t',['../structSlNetSock__SecAttribNode__t.html',1,'SlNetSock_SecAttribNode_t'],['../group__SlNetSock.html#gad7f90d1a1c57755d2840007ea024a9e0',1,'SlNetSock_SecAttribNode_t(): slnetsock.h']]],
['slnetsock_5fsecattribset',['SlNetSock_secAttribSet',['../group__SlNetSock.html#ga23d9ec26e91738ec8a480fe36b0835f8',1,'slnetsock.h']]],
['slnetsock_5fsecurealpn_5ft',['SlNetSock_SecureALPN_t',['../structSlNetSock__SecureALPN__t.html',1,'SlNetSock_SecureALPN_t'],['../group__SlNetSock.html#ga27a054823b5519f04be5c2763c22da93',1,'SlNetSock_SecureALPN_t(): slnetsock.h']]],
['slnetsock_5fsecuremask_5ft',['SlNetSock_SecureMask_t',['../structSlNetSock__SecureMask__t.html',1,'SlNetSock_SecureMask_t'],['../group__SlNetSock.html#gaf326008d0a836463306fbab2b014e716',1,'SlNetSock_SecureMask_t(): slnetsock.h']]],
['slnetsock_5fsecuremethod_5ft',['SlNetSock_SecureMethod_t',['../structSlNetSock__SecureMethod__t.html',1,'SlNetSock_SecureMethod_t'],['../group__SlNetSock.html#ga4a958a903aaad837122b97e11a1fecd3',1,'SlNetSock_SecureMethod_t(): slnetsock.h']]],
['slnetsock_5fselect',['SlNetSock_select',['../group__SlNetSock.html#ga6fb99109fb8ca927a6e0bb663feb40d8',1,'slnetsock.h']]],
['slnetsock_5fsend',['SlNetSock_send',['../group__SlNetSock.html#ga46bc70ae63ecd3fc15bfb2c99dda85db',1,'slnetsock.h']]],
['slnetsock_5fsendto',['SlNetSock_sendTo',['../group__SlNetSock.html#ga785993d541a91b99c5a4e29e7fb9318c',1,'slnetsock.h']]],
['slnetsock_5fsetopt',['SlNetSock_setOpt',['../group__SlNetSock.html#ga39840c28417c98670d82e347e5c1093b',1,'slnetsock.h']]],
['slnetsock_5fshut_5frd',['SLNETSOCK_SHUT_RD',['../group__SlNetSock.html#gabeb4e11eed2d4958e27a9c90c1082b7b',1,'slnetsock.h']]],
['slnetsock_5fshut_5frdwr',['SLNETSOCK_SHUT_RDWR',['../group__SlNetSock.html#ga3c334cce685decca658cedb7514fc599',1,'slnetsock.h']]],
['slnetsock_5fshut_5fwr',['SLNETSOCK_SHUT_WR',['../group__SlNetSock.html#ga20d9a86de3e94347e9f250731ad5f0dc',1,'slnetsock.h']]],
['slnetsock_5fshutdown',['SlNetSock_shutdown',['../group__SlNetSock.html#ga770906a5e5d3ed14184e51f830346b19',1,'slnetsock.h']]],
['slnetsock_5fsock_5fbridge',['SLNETSOCK_SOCK_BRIDGE',['../group__SlNetSock.html#ga39cee27be99a69b053cdbe4af9af6ac5',1,'slnetsock.h']]],
['slnetsock_5fsock_5fdgram',['SLNETSOCK_SOCK_DGRAM',['../group__SlNetSock.html#gacf83988d5e46cd52964f0b9163095bed',1,'slnetsock.h']]],
['slnetsock_5fsock_5fmac_5fwith_5fcca',['SLNETSOCK_SOCK_MAC_WITH_CCA',['../group__SlNetSock.html#ga07de48c9f97e3a9095cb9a5298764602',1,'slnetsock.h']]],
['slnetsock_5fsock_5fmac_5fwith_5fno_5fcca',['SLNETSOCK_SOCK_MAC_WITH_NO_CCA',['../group__SlNetSock.html#ga456cdcdca17dd7331a2e4a5aeaca5928',1,'slnetsock.h']]],
['slnetsock_5fsock_5fraw',['SLNETSOCK_SOCK_RAW',['../group__SlNetSock.html#gab86bdc5d6f9b18fb38b644b67c906e60',1,'slnetsock.h']]],
['slnetsock_5fsock_5frouter',['SLNETSOCK_SOCK_ROUTER',['../group__SlNetSock.html#ga7f484fc41fc614a43d6fca7bb7e64ae6',1,'slnetsock.h']]],
['slnetsock_5fsock_5frx_5fmtr',['SLNETSOCK_SOCK_RX_MTR',['../group__SlNetSock.html#gad636cbcab63925954dcb16d5928b4c96',1,'slnetsock.h']]],
['slnetsock_5fsock_5fstream',['SLNETSOCK_SOCK_STREAM',['../group__SlNetSock.html#ga7fdd452457c1ad69a272206f7a462b87',1,'slnetsock.h']]],
['slnetsock_5fsockaddrstorage_5ft',['SlNetSock_SockAddrStorage_t',['../structSlNetSock__SockAddrStorage__t.html',1,'SlNetSock_SockAddrStorage_t'],['../group__SlNetSock.html#gaa4504b47f51a143a63d6a74a1b5ea58e',1,'SlNetSock_SockAddrStorage_t(): slnetsock.h']]],
['slnetsock_5fstartsec',['SlNetSock_startSec',['../group__SlNetSock.html#gac601a0009777c2dd84b476a7fbd09ed5',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fmaxrtt',['SLNETSOCK_TCP_MAXRTT',['../group__SlNetSock.html#ga1364d2ec5b6148ac631684102e195ded',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fmaxseg',['SLNETSOCK_TCP_MAXSEG',['../group__SlNetSock.html#ga96e68864fa32d64ce0e28cee855a2def',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fnodelay',['SLNETSOCK_TCP_NODELAY',['../group__SlNetSock.html#ga1e2c228fd033c2818e9c009aafeeb6a2',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fnoopt',['SLNETSOCK_TCP_NOOPT',['../group__SlNetSock.html#gaee9470aadaf3f50d5d84fb6835a1446a',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fnopush',['SLNETSOCK_TCP_NOPUSH',['../group__SlNetSock.html#ga78f62a690cd041fe464cbecded8381b9',1,'slnetsock.h']]],
['slnetsock_5ftcp_5fsackpermitted',['SLNETSOCK_TCP_SACKPERMITTED',['../group__SlNetSock.html#ga052ae4cc3ee6cee569c1aeabd6b79e53',1,'slnetsock.h']]],
['slnetsock_5ftimeval_5ft',['SlNetSock_Timeval_t',['../group__SlNetSock.html#gabe4a9f6015bc289d3342f2e3df8ecbe7',1,'slnetsock.h']]],
['slnetsock_5ftransceiverrxoverhead_5ft',['SlNetSock_TransceiverRxOverHead_t',['../structSlNetSock__TransceiverRxOverHead__t.html',1,'SlNetSock_TransceiverRxOverHead_t'],['../group__SlNetSock.html#ga51d004f1386e9abb704d97218981ae74',1,'SlNetSock_TransceiverRxOverHead_t(): slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5fdefault',['SLNETSOCK_TX_INHIBIT_THRESHOLD_DEFAULT',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2a490c61f1b4ddb77e3041e67b2228c150',1,'slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5fhigh',['SLNETSOCK_TX_INHIBIT_THRESHOLD_HIGH',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2a35f2949bc737ee5ab7c901ee529125d1',1,'slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5flow',['SLNETSOCK_TX_INHIBIT_THRESHOLD_LOW',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2a96df1246830b98dbd4399ce410e81217',1,'slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5fmax',['SLNETSOCK_TX_INHIBIT_THRESHOLD_MAX',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2ab06ce2fd7ff437096a6c26092ed6f020',1,'slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5fmed',['SLNETSOCK_TX_INHIBIT_THRESHOLD_MED',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2abbd2691ec42d27391e688acbdbb7c156',1,'slnetsock.h']]],
['slnetsock_5ftx_5finhibit_5fthreshold_5fmin',['SLNETSOCK_TX_INHIBIT_THRESHOLD_MIN',['../group__SlNetSock.html#ggab1fa253aa2056ab544e2cee5ad61fcc2af45a1c5b855fce7a7eb8f60afc7e0f42',1,'slnetsock.h']]],
['slnetsock_5fwinsize_5ft',['SlNetSock_Winsize_t',['../structSlNetSock__Winsize__t.html',1,'SlNetSock_Winsize_t'],['../group__SlNetSock.html#ga870bf55eff6791294b32c696808d13b1',1,'SlNetSock_Winsize_t(): slnetsock.h']]],
['slnetsocklen_5ft',['SlNetSocklen_t',['../group__SlNetSock.html#ga89b698aee92814448d4bd15a2b874fd5',1,'slnetsock.h']]],
['slnetsocksecattrib_5fe',['SlNetSockSecAttrib_e',['../group__SlNetSock.html#ga01d744e1c31131db3690b5a917ec8aef',1,'slnetsock.h']]],
['slnetsocksecattrib_5ft',['SlNetSockSecAttrib_t',['../group__SlNetSock.html#gab0a8884e32b47aca0215b6083dad9489',1,'slnetsock.h']]],
['slnetsocktxinhibitthreshold_5fe',['SlNetSockTxInhibitThreshold_e',['../group__SlNetSock.html#gab1fa253aa2056ab544e2cee5ad61fcc2',1,'slnetsock.h']]],
['slnetutil_5faddrinfo_5ft',['SlNetUtil_addrInfo_t',['../structSlNetUtil__addrInfo__t.html',1,'SlNetUtil_addrInfo_t'],['../group__SlNetUtils.html#ga4a64ea4bcdf34e8d9a9744c556acb838',1,'SlNetUtil_addrInfo_t(): slnetutils.h']]],
['slnetutil_5fai_5fnumerichost',['SLNETUTIL_AI_NUMERICHOST',['../group__SlNetUtils.html#ga77cca0414a4c54b04afaa83c132af4bc',1,'slnetutils.h']]],
['slnetutil_5fai_5fpassive',['SLNETUTIL_AI_PASSIVE',['../group__SlNetUtils.html#gaf59ab2e28a09ea3c0449a0aeea275bd6',1,'slnetutils.h']]],
['slnetutil_5feai_5faddrfamily',['SLNETUTIL_EAI_ADDRFAMILY',['../group__SlNetErr.html#ga9ef268a40c1845a22783a2d94ce08ee6',1,'slneterr.h']]],
['slnetutil_5feai_5fagain',['SLNETUTIL_EAI_AGAIN',['../group__SlNetErr.html#ga42e99e70dcd03d30805d7e69fa4d737b',1,'slneterr.h']]],
['slnetutil_5feai_5fbadflags',['SLNETUTIL_EAI_BADFLAGS',['../group__SlNetErr.html#gaa55dbc962e4e773b374e0415bcb7282f',1,'slneterr.h']]],
['slnetutil_5feai_5fbase',['SLNETUTIL_EAI_BASE',['../group__SlNetErr.html#gaf82407e94c944788f5c4af4489a298da',1,'slneterr.h']]],
['slnetutil_5feai_5ffail',['SLNETUTIL_EAI_FAIL',['../group__SlNetErr.html#gab19007d963f02944bb793799ae162105',1,'slneterr.h']]],
['slnetutil_5feai_5ffamily',['SLNETUTIL_EAI_FAMILY',['../group__SlNetErr.html#gac4df2f16b21577f8b9948b020194d770',1,'slneterr.h']]],
['slnetutil_5feai_5fmemory',['SLNETUTIL_EAI_MEMORY',['../group__SlNetErr.html#ga0b67cfa294f2fab30e642796d5b7cb6e',1,'slneterr.h']]],
['slnetutil_5feai_5fnoname',['SLNETUTIL_EAI_NONAME',['../group__SlNetErr.html#ga9fe7a98c8aad439c86c00a7688cda637',1,'slneterr.h']]],
['slnetutil_5feai_5foverflow',['SLNETUTIL_EAI_OVERFLOW',['../group__SlNetErr.html#ga4a9a5ce83cf75ce6fa283fa9c9fbcfc4',1,'slneterr.h']]],
['slnetutil_5feai_5fservice',['SLNETUTIL_EAI_SERVICE',['../group__SlNetErr.html#ga5777e395b0baff300eecbebff19b934c',1,'slneterr.h']]],
['slnetutil_5feai_5fsocktype',['SLNETUTIL_EAI_SOCKTYPE',['../group__SlNetErr.html#gaef719a015ac852619e8de80477d0205c',1,'slneterr.h']]],
['slnetutil_5feai_5fsystem',['SLNETUTIL_EAI_SYSTEM',['../group__SlNetErr.html#ga01a8ba2ffc7aa109c27dcae2427fd280',1,'slneterr.h']]],
['slnetutil_5ferr_5futilgethostbyname_5ffailed',['SLNETUTIL_ERR_UTILGETHOSTBYNAME_FAILED',['../group__SlNetErr.html#ga2c97bf08e558e99b7d36c217953c9197',1,'slneterr.h']]],
['slnetutil_5ffreeaddrinfo',['SlNetUtil_freeAddrInfo',['../group__SlNetUtils.html#ga3f549d372d7eec8ea400421e9ffa590d',1,'slnetutils.h']]],
['slnetutil_5fgaistrerr',['SlNetUtil_gaiStrErr',['../group__SlNetUtils.html#ga5d53331813dcb52bb1ed036563f7f354',1,'slnetutils.h']]],
['slnetutil_5fgetaddrinfo',['SlNetUtil_getAddrInfo',['../group__SlNetUtils.html#gafeec4b60ed91c5de705085486ba93046',1,'slnetutils.h']]],
['slnetutil_5fgethostbyname',['SlNetUtil_getHostByName',['../group__SlNetUtils.html#gab9f23f3dae293a3867c989a30a0e5e43',1,'slnetutils.h']]],
['slnetutil_5fhtonl',['SlNetUtil_htonl',['../group__SlNetUtils.html#gad8841854e4de9257ec8b564e16ad203a',1,'slnetutils.h']]],
['slnetutil_5fhtons',['SlNetUtil_htons',['../group__SlNetUtils.html#ga625dce8534729932d619072a9412d9ee',1,'slnetutils.h']]],
['slnetutil_5finetaton',['SlNetUtil_inetAton',['../group__SlNetUtils.html#ga283414c56fced5e415159df557ab3a5f',1,'slnetutils.h']]],
['slnetutil_5finetntop',['SlNetUtil_inetNtop',['../group__SlNetUtils.html#gaa5b58e91624abe40c9d1e2215cb1e236',1,'slnetutils.h']]],
['slnetutil_5finetpton',['SlNetUtil_inetPton',['../group__SlNetUtils.html#ga39a64b1d44c226469bd9c9db3366122e',1,'slnetutils.h']]],
['slnetutil_5finit',['SlNetUtil_init',['../group__SlNetUtils.html#ga432d7d9e966f640dc3d08aa00b99a16f',1,'slnetutils.h']]],
['slnetutil_5fipv4_5fval',['SLNETUTIL_IPV4_VAL',['../group__SlNetUtils.html#gac7def045bbd7fbfbd11d2e8ffce385d4',1,'slnetutils.h']]],
['slnetutil_5fntohl',['SlNetUtil_ntohl',['../group__SlNetUtils.html#ga1a366f1e3001a7845354cafe84cff003',1,'slnetutils.h']]],
['slnetutil_5fntohs',['SlNetUtil_ntohs',['../group__SlNetUtils.html#ga017456a86f2209fbd19437667b33af0b',1,'slnetutils.h']]],
['slnetutils_20group',['SlNetUtils group',['../group__SlNetUtils.html',1,'']]],
['slnetutils_2eh',['slnetutils.h',['../slnetutils_8h.html',1,'']]],
['sntp_2eh',['sntp.h',['../sntp_8h.html',1,'']]],
['sntp_5feconnectfail',['SNTP_ECONNECTFAIL',['../group__ti__net__sntp__SNTP.html#gaa2b08acea154cad301a43daf65eec489',1,'sntp.h']]],
['sntp_5fefatalnoretry',['SNTP_EFATALNORETRY',['../group__ti__net__sntp__SNTP.html#ga6e874080da6108182e1aa5047031ef7d',1,'sntp.h']]],
['sntp_5fegethostbynamefail',['SNTP_EGETHOSTBYNAMEFAIL',['../group__ti__net__sntp__SNTP.html#ga56b9d7c1429ae4fa08c2ed3f2e180fa0',1,'sntp.h']]],
['sntp_5feinvalidargs',['SNTP_EINVALIDARGS',['../group__ti__net__sntp__SNTP.html#ga833bfbd9a170df1f81da629e5cd91845',1,'sntp.h']]],
['sntp_5feinvalidfamily',['SNTP_EINVALIDFAMILY',['../group__ti__net__sntp__SNTP.html#ga969984141cc5f01210c7ad1a28caf8de',1,'sntp.h']]],
['sntp_5feinvalidresp',['SNTP_EINVALIDRESP',['../group__ti__net__sntp__SNTP.html#gaaaa17c8096e957cd35279dac7b344fe8',1,'sntp.h']]],
['sntp_5feratebackoff',['SNTP_ERATEBACKOFF',['../group__ti__net__sntp__SNTP.html#gac6ff9ea6bae8596e917cc34725190f67',1,'sntp.h']]],
['sntp_5ferecvfail',['SNTP_ERECVFAIL',['../group__ti__net__sntp__SNTP.html#gac831a16869b7c78c044b8b92b2b85973',1,'sntp.h']]],
['sntp_5fesendfail',['SNTP_ESENDFAIL',['../group__ti__net__sntp__SNTP.html#gaffe13e69ec9483c742560a774243da90',1,'sntp.h']]],
['sntp_5fesockcreatefail',['SNTP_ESOCKCREATEFAIL',['../group__ti__net__sntp__SNTP.html#gaf888256ff0efd96efc6ad6c9a9d59020',1,'sntp.h']]],
['sntp_5fesockoptfail',['SNTP_ESOCKOPTFAIL',['../group__ti__net__sntp__SNTP.html#ga6fe4f80e250d27f47dabb1d42b04b0a2',1,'sntp.h']]],
['sntp_5fgettime',['SNTP_getTime',['../group__ti__net__sntp__SNTP.html#gaf28840559d2f511e3fc376102bbc8837',1,'sntp.h']]],
['sntp_5fgettimebyaddr',['SNTP_getTimeByAddr',['../group__ti__net__sntp__SNTP.html#ga49f27dfff681fb9bdde566c23aa6f6d8',1,'sntp.h']]],
['sockaccept',['sockAccept',['../structSlNetIf__Config__t.html#a76a809b7e3637fd1510e1d9c384c06e8',1,'SlNetIf_Config_t']]],
['sockbind',['sockBind',['../structSlNetIf__Config__t.html#a13290e3f0d2b134c0b9b4c6369a9f409',1,'SlNetIf_Config_t']]],
['sockclose',['sockClose',['../structSlNetIf__Config__t.html#ab4555e74fd1e05a071e8c20b5fe91422',1,'SlNetIf_Config_t']]],
['sockconnect',['sockConnect',['../structSlNetIf__Config__t.html#a3c97fe12153360098b450fcc0ae7e68a',1,'SlNetIf_Config_t']]],
['sockcreate',['sockCreate',['../structSlNetIf__Config__t.html#a083ed3e60745fc6b48617fcdd6e86927',1,'SlNetIf_Config_t']]],
['sockgetlocalname',['sockGetLocalName',['../structSlNetIf__Config__t.html#ad4d2259a0347e21bdb463e6efa5590a8',1,'SlNetIf_Config_t']]],
['sockgetopt',['sockGetOpt',['../structSlNetIf__Config__t.html#a7141241ab611f6a6f7470a0f1a7e15b3',1,'SlNetIf_Config_t']]],
['sockgetpeername',['sockGetPeerName',['../structSlNetIf__Config__t.html#ae99d1b259e79ae43184a82fd0d32157d',1,'SlNetIf_Config_t']]],
['socklisten',['sockListen',['../structSlNetIf__Config__t.html#abd6f5cbdd5834267bbae22b3db53d5b4',1,'SlNetIf_Config_t']]],
['sockrecv',['sockRecv',['../structSlNetIf__Config__t.html#a8e9da688f25e8c4818281861a88b7db7',1,'SlNetIf_Config_t']]],
['sockrecvfrom',['sockRecvFrom',['../structSlNetIf__Config__t.html#a55ecf6ce8dc83603ffedcf6b8d2bf2cc',1,'SlNetIf_Config_t']]],
['sockselect',['sockSelect',['../structSlNetIf__Config__t.html#a12ab85869481ba5e0b55b43fc0b9462a',1,'SlNetIf_Config_t']]],
['socksend',['sockSend',['../structSlNetIf__Config__t.html#afb57d54ee329c5063b3967dd9afd8710',1,'SlNetIf_Config_t']]],
['socksendto',['sockSendTo',['../structSlNetIf__Config__t.html#a2016a512efd66579ab7507b7ba0f6d01',1,'SlNetIf_Config_t']]],
['socksetopt',['sockSetOpt',['../structSlNetIf__Config__t.html#a88f3f207a12c44108892d01bea874c45',1,'SlNetIf_Config_t']]],
['sockshutdown',['sockShutdown',['../structSlNetIf__Config__t.html#a9ba0bc23b129509b36c756cff838e41e',1,'SlNetIf_Config_t']]],
['sockstartsec',['sockstartSec',['../structSlNetIf__Config__t.html#af3287ee2b76f780731123c55d4381eaf',1,'SlNetIf_Config_t']]],
['ss_5ffamily',['ss_family',['../structSlNetSock__SockAddrStorage__t.html#ae68799246aaab92467e8a71d53e59338',1,'SlNetSock_SockAddrStorage_t']]],
['sntp_20client',['SNTP Client',['../group__ti__net__sntp__SNTP.html',1,'']]]
];
|
/* eslint-disable no-undef */
export const loadState = () => {
try {
const serializedState = localStorage.getItem("state")
if (serializedState === null) {
return undefined
}
return JSON.parse(serializedState)
} catch (err) {
return undefined
}
}
export const saveState = state => {
try {
const serializedState = JSON.stringify(state)
localStorage.setItem("state", serializedState)
} catch (err) {
// Ignore write errors.
}
}
|
import * as types from '../actions/actionTypes';
import initialState from './initialState';
export default function CategoryReducer(state = initialState.categories, action) {
switch (action.type) {
case types.CREATE_CATEGORY_SUCCESS:
return [...state,
Object.assign({}, action.category)];
case types.UPDATE_CATEGORY_SUCCESS:
return [...state.filter((category) => category.id != action.category.id),
Object.assign({}, action.category)];
case types.DELETE_CATEGORY_SUCCESS:
return [...state.filter((category) => category.id != action.category.id)];
case types.LOAD_CATEGORIES_SUCCESS:
return action.categories;
default:
return state;
}
} |
var callbackArguments = [];
var argument1 = function callback(){callbackArguments.push(arguments)};
var argument2 = null;
var argument3 = function callback(){callbackArguments.push(arguments)};
var argument4 = true;
var argument5 = r_0;
var argument6 = function callback(){callbackArguments.push(arguments)};
var argument7 = [49,49,82,122,460,49,460];
var argument8 = function callback(){callbackArguments.push(arguments)};
var argument9 = null;
var argument10 = null;
var base_0 = ["[",":olfp","fN","e*1{"]
var r_0= undefined
try {
r_0 = base_0.find(argument1,argument2)
}
catch(e) {
r_0= "Error"
}
var base_1 = ["[",":olfp","fN","e*1{"]
var r_1= undefined
try {
r_1 = base_1.find(argument3,argument4,argument5)
}
catch(e) {
r_1= "Error"
}
var base_2 = ["[",":olfp","fN","e*1{"]
var r_2= undefined
try {
r_2 = base_2.find(argument6,argument7)
}
catch(e) {
r_2= "Error"
}
var base_3 = ["[",":olfp","fN","e*1{"]
var r_3= undefined
try {
r_3 = base_3.find(argument8,argument9,argument10)
}
catch(e) {
r_3= "Error"
}
function serialize(array){
return array.map(function(a){
if (a === null || a == undefined) return a;
var name = a.constructor.name;
if (name==='Object' || name=='Boolean'|| name=='Array'||name=='Number'||name=='String')
return JSON.stringify(a);
return name;
});
}
setTimeout(function(){
require("fs").writeFileSync("./experiments/find/findEmpty/test222.json",JSON.stringify({"baseObjects":serialize([base_0,base_1,base_2,base_3]),"returnObjects":serialize([r_0,r_1,r_2,r_3]),"callbackArgs":callbackArguments}))
},300) |
const path = require('path')
exports.createPages = ({actions, graphql}) => {
const {createPage} = actions
const postTemplate = path.resolve('src/templates/blog-post.js');
return graphql(`{
allMarkdownRemark{
edges{
node{
html
id
frontmatter{
path
title
date
author
}
}
}
}
}
`).then(res => {
if(res.errors){
return Promise.reject(res.errors)
}
res.data.allMarkdownRemark.edges.forEach(({node}) =>
createPage({
path: node.frontmatter.path,
component: postTemplate,
})
)
})
} |
let listaUsario = [];
const numeroDatos = () =>
parseInt(document.getElementById("numeroDatos").value);
const aggInput = () => {
// Eliminar todos los elementos hijos del padre;
var elemento = document.getElementById("aggInputs");
while (elemento.firstChild) {
elemento.removeChild(elemento.firstChild);
};
// Quitar respuesta
const resultado = document.getElementById("resultado");
resultado.innerText = "";
// Colocar los input
let valorNumeroDatos = numeroDatos();
for (let i = 1; i < (valorNumeroDatos + 1); i++ ) {
var direccion = `<label for="${i}">Dato ${i}: </label>
<input id="${i}" type="number"/>`;
let input1 = document.getElementById("aggInputs");
input1.insertAdjacentHTML('beforeend', direccion);
}
let button = document.getElementById("aggInputs");
button.insertAdjacentHTML('beforeend',
'<button type="button" onclick="calcularMediaAritmetica()">Calcular</button>');
}
const calcularMediaAritmetica = () => {
listaUsario = [];
datosUsuario();
const sumaLista = listaUsario.reduce(
(valorAcumulado = 0, nuevoElemento) => valorAcumulado + nuevoElemento);
const promedioLista = sumaLista / listaUsario.length;
const resultado = document.getElementById("resultado");
resultado.innerText = "El promedio es: " + promedioLista;
}
const datosUsuario = () => {
let valorNumeroDatos = numeroDatos();
// Trae los datos a JS y los agrega a la lista
for (let i = 1; i < (valorNumeroDatos + 1); i++){
let id = i;
let dato = document.getElementById(id);
let valueDato = parseInt(dato.value);
listaUsario.push(valueDato);
}
}
|
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
# Licensed under MIT conditions
#
# -----------------------------------------------------------------------------
#
# E16_Dropcap.py
#
# Draw one column that fills the entire usable space of the page,
# add a positioned element, containing a dropcap and fill the rest
# of the column as path, constructed from the position of the
# child elements in the text element.
# The usable area of the page is defined by the remainder of page.padding.
#
# TODO: This example needs to be more generalized, hiding most of the code.
#
from pagebot import getContext
from pagebot.fonttoolbox.objects.font import findFont
from pagebot.document import Document
from pagebot.elements import * # Import all types of page-child elements for convenience
from pagebot.toolbox.color import color
from pagebot.toolbox.units import em
from pagebot.conditions import * # Import all conditions for convenience.
from pagebot.constants import * # Import all constants for convenience
context = getContext()
W = H = 1000 # Document size
PADDING = 100 # Page padding on all sides. Select value and cmd-drag to change interactive.
# Dummy text, used several times to create the length we need for this example
text = """Considering the fact that the application allows individuals to call a phone number and leave a voice mail, which is automatically translated into a tweet with a hashtag from the country of origin. """
font = findFont('Roboto-Regular')
# Create a new document with 1 page. Set overall size and padding.
doc = Document(w=W, h=H, padding=PADDING, context=context)
# Get the default page view of the document and set viewing parameters
view = doc.view
# Show the usable space (=page.padding) of the page, which the same as the box after fitting
view.showPadding = True
view.showOrigin = False
view.showTextOverflowMarker = False
# Get the first (and only automatic created) page of the document
page = doc[1]
# Show the principle of building a dropcap.
# In normal PageBot usage, this is hidden as child elements of Text that define the layout
# of the clipping path. Here is it shown as separate steps.
# Make main text, skipping the first character
style = dict(font=font, fontSize=24, leading=em(1.4))
bs1 = context.newString(text[1:] + text * 10, style=style)
# Make the BabelString of the dropcap, taking the first character of t.
dropCapStyle = dict(font='Georgia-Bold', fontSize=pt(250))
PADDING = pt(12)
# Create a new BezierPath object, that contains a rectangle with the size of the text box.
dropCapPath = PageBotPath(context=context)
dropCapPath.text(text[0], style=dropCapStyle) # Place the initial letter as drop cap. Path size is calculated around the result.
minX, minY, maxX, maxY = dropCapPath.bounds() # Get the bounds of the dropcap pixels
dcw = maxX - minX
dch = maxY - minY
dropCapPathFrame = PageBotPath(context=context)
dropCapPathFrame.rect(0, 0, maxX+PADDING, maxY+PADDING)
dropCapPathFrame.moveBy((0, page.ph - dch - PADDING))
# Create another path with the size and position of the dropcap reserved space.
# Normally this would come from the position of a child element inside the main text.
# Note that the core context.newPath() answers a DrawBot.BezierPath, which is contained
# by a PageBothPath() instance.
textFramePath = PageBotPath(context=context)
textFramePath.rect(0, 0, page.pw, page.ph) # Make a rectangle path with size of text box.
# Make a new path for the available text flow, which is the difference between the paths
textFlowPath = textFramePath.difference(dropCapPathFrame)
newText(bs1, parent=page, yAlign=TOP, showFrame=True, conditions=[Fit()], clipPath=textFlowPath)
newPaths(textFlowPath, parent=page, conditions=(Left2Left(), Top2Top()))
newPaths(dropCapPath, parent=page, mr=PADDING, mb=PADDING, fill=(1, 0, 0), conditions=(Left2Left(), Top2Top()))
# Solve the page/element conditions
doc.solve()
# Export the document to this PDF file.
doc.export('_export/DropcapBasics.pdf')
|
import _ from "lodash";
function ResultGroup(props) {
//props.groupName //props.groupResults //props.onSelected
return (
<section className="search-results-group-container">
<h3>{props.groupName}</h3>
<ul>
{props.groupResults.map((result, index) => {
return (
<li
className={
props.isHighlightName === result.name ? "highlight" : ""
}
key={index}
onClick={() => props.onSelected(result.name)}
>
{result.name}
</li>
);
})}
</ul>
</section>
);
}
export default function SearchResults(props) {
const groupedResults = _.groupBy(props.results, (result) => result.type);
const highlightNameInTopResult =
props.results.length > 0 &&
props.highlightResult?.name === props.results[0].name
? props.results[0].name
: null;
const highlightNameInGroup =
!highlightNameInTopResult && props.highlightResult != null
? props.highlightResult.name
: null;
console.log("123", highlightNameInGroup, props.highlightResult?.name);
return (
<div className={props.className}>
{props.results.length > 0 && (
<ResultGroup
groupName="Top Hit"
groupResults={[props.results[0]]}
onSelected={props.onSelected}
isHighlightName={highlightNameInTopResult}
/>
)}
{Object.keys(groupedResults).map((groupName) => {
return (
<ResultGroup
key={groupName}
groupName={groupName}
groupResults={groupedResults[groupName]}
onSelected={props.onSelected}
isHighlightName={highlightNameInGroup}
/>
);
})}
</div>
);
}
|
import { moduleFor, ApplicationTest } from '../../utils/test-case';
import { strip } from '../../utils/abstract-test-case';
import { compile } from '../../utils/helpers';
import { Controller, RSVP } from 'ember-runtime';
import { Component } from 'ember-glimmer';
import { Engine } from 'ember-application';
import { Route } from 'ember-routing';
import { next } from 'ember-metal';
moduleFor('Application test: engine rendering', class extends ApplicationTest {
get routerOptions() {
return {
location: 'none',
// This creates a handler function similar to what is in use by ember-engines
// internally. Specifically, it returns a promise when transitioning _into_
// the first engine route, but returns the synchronously available handler
// _after_ the engine has been resolved.
_getHandlerFunction() {
let syncHandler = this._super(...arguments);
this._enginePromises = Object.create(null);
this._resolvedEngines = Object.create(null);
return name => {
let engineInfo = this._engineInfoByRoute[name];
if (!engineInfo) { return syncHandler(name); }
let engineName = engineInfo.name;
if (this._resolvedEngines[engineName]) { return syncHandler(name); }
let enginePromise = this._enginePromises[engineName];
if (!enginePromise) {
enginePromise = new RSVP.Promise(resolve => {
setTimeout(() => {
this._resolvedEngines[engineName] = true;
resolve();
}, 1);
});
this._enginePromises[engineName] = enginePromise;
}
return enginePromise.then(() => syncHandler(name));
};
}
};
}
setupAppAndRoutableEngine(hooks = []) {
let self = this;
this.addTemplate('application', 'Application{{outlet}}');
this.router.map(function() {
this.mount('blog');
});
this.add('route-map:blog', function() {
this.route('post', function() {
this.route('comments');
this.route('likes');
});
this.route('category', {path: 'category/:id'});
this.route('author', {path: 'author/:id'});
});
this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
}));
this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('controller:application', Controller.extend({
queryParams: ['lang'],
lang: ''
}));
this.register('controller:category', Controller.extend({
queryParams: ['type'],
}));
this.register('controller:authorKtrl', Controller.extend({
queryParams: ['official'],
}));
this.register('template:application', compile('Engine{{lang}}{{outlet}}'));
this.register('route:application', Route.extend({
model() {
hooks.push('engine - application');
}
}));
this.register('route:author', Route.extend({
controllerName: 'authorKtrl',
}));
if (self._additionalEngineRegistrations) {
self._additionalEngineRegistrations.call(this);
}
}
}));
}
setupAppAndRoutelessEngine(hooks) {
this.setupRoutelessEngine(hooks);
this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile('Engine'));
this.register('controller:application', Controller.extend({
init() {
this._super(...arguments);
hooks.push('engine - application');
}
}));
}
}));
}
setupAppAndRoutableEngineWithPartial(hooks) {
this.addTemplate('application', 'Application{{outlet}}');
this.router.map(function() {
this.mount('blog');
});
this.add('route-map:blog', function() { });
this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
}));
this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:foo', compile('foo partial'));
this.register('template:application', compile('Engine{{outlet}} {{partial "foo"}}'));
this.register('route:application', Route.extend({
model() {
hooks.push('engine - application');
}
}));
}
}));
}
setupRoutelessEngine(hooks) {
this.addTemplate('application', 'Application{{mount "chat-engine"}}');
this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
}));
}
setupAppAndRoutlessEngineWithPartial(hooks) {
this.setupRoutelessEngine(hooks);
this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:foo', compile('foo partial'));
this.register('template:application', compile('Engine {{partial "foo"}}'));
this.register('controller:application', Controller.extend({
init() {
this._super(...arguments);
hooks.push('engine - application');
}
}));
}
}));
}
additionalEngineRegistrations(callback) {
this._additionalEngineRegistrations = callback;
}
setupEngineWithAttrs() {
this.addTemplate('application', 'Application{{mount "chat-engine"}}');
this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:components/foo-bar', compile(`{{partial "troll"}}`));
this.register('template:troll', compile('{{attrs.wat}}'));
this.register('controller:application', Controller.extend({
contextType: 'Engine'
}));
this.register('template:application', compile('Engine {{foo-bar wat=contextType}}'));
}
}));
}
stringsEndWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
['@test attrs in an engine']() {
this.setupEngineWithAttrs([]);
return this.visit('/').then(() => {
this.assertText('ApplicationEngine Engine');
});
}
['@test sharing a template between engine and application has separate refinements']() {
this.assert.expect(1);
let sharedTemplate = compile(strip`
<h1>{{contextType}}</h1>
{{ambiguous-curlies}}
{{outlet}}
`);
this.add('template:application', sharedTemplate);
this.add('controller:application', Controller.extend({
contextType: 'Application',
'ambiguous-curlies': 'Controller Data!'
}));
this.router.map(function() {
this.mount('blog');
});
this.add('route-map:blog', function() { });
this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('controller:application', Controller.extend({
contextType: 'Engine'
}));
this.register('template:application', sharedTemplate);
this.register('template:components/ambiguous-curlies', compile(strip`
<p>Component!</p>
`));
}
}));
return this.visit('/blog').then(() => {
this.assertText('ApplicationController Data!EngineComponent!');
});
}
['@test sharing a layout between engine and application has separate refinements']() {
this.assert.expect(1);
let sharedLayout = compile(strip`
{{ambiguous-curlies}}
`);
let sharedComponent = Component.extend({
layout: sharedLayout
});
this.addTemplate('application', strip`
<h1>Application</h1>
{{my-component ambiguous-curlies="Local Data!"}}
{{outlet}}
`);
this.add('component:my-component', sharedComponent);
this.router.map(function() {
this.mount('blog');
});
this.add('route-map:blog', function() { });
this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile(strip`
<h1>Engine</h1>
{{my-component}}
{{outlet}}
`));
this.register('component:my-component', sharedComponent);
this.register('template:components/ambiguous-curlies', compile(strip`
<p>Component!</p>
`));
}
}));
return this.visit('/blog').then(() => {
this.assertText('ApplicationLocal Data!EngineComponent!');
});
}
['@test visit() with `shouldRender: true` returns a promise that resolves when application and engine templates have rendered'](assert) {
assert.expect(2);
let hooks = [];
this.setupAppAndRoutableEngine(hooks);
return this.visit('/blog', { shouldRender: true }).then(() => {
this.assertText('ApplicationEngine');
this.assert.deepEqual(hooks, [
'application - application',
'engine - application'
], 'the expected model hooks were fired');
});
}
['@test visit() with `shouldRender: false` returns a promise that resolves without rendering'](assert) {
assert.expect(2);
let hooks = [];
this.setupAppAndRoutableEngine(hooks);
return this.visit('/blog', { shouldRender: false }).then(() => {
assert.strictEqual(
document.getElementById('qunit-fixture').children.length, 0,
`there are no elements in the qunit-fixture element`
);
this.assert.deepEqual(hooks, [
'application - application',
'engine - application'
], 'the expected model hooks were fired');
});
}
['@test visit() with `shouldRender: true` returns a promise that resolves when application and routeless engine templates have rendered'](assert) {
assert.expect(2);
let hooks = [];
this.setupAppAndRoutelessEngine(hooks);
return this.visit('/', { shouldRender: true }).then(() => {
this.assertText('ApplicationEngine');
this.assert.deepEqual(hooks, [
'application - application',
'engine - application'
], 'the expected hooks were fired');
});
}
['@test visit() with partials in routable engine'](assert) {
assert.expect(2);
let hooks = [];
this.setupAppAndRoutableEngineWithPartial(hooks);
return this.visit('/blog', { shouldRender: true }).then(() => {
this.assertText('ApplicationEngine foo partial');
this.assert.deepEqual(hooks, [
'application - application',
'engine - application'
], 'the expected hooks were fired');
});
}
['@test visit() with partials in non-routable engine'](assert) {
assert.expect(2);
let hooks = [];
this.setupAppAndRoutlessEngineWithPartial(hooks);
return this.visit('/', { shouldRender: true }).then(() => {
this.assertText('ApplicationEngine foo partial');
this.assert.deepEqual(hooks, [
'application - application',
'engine - application'
], 'the expected hooks were fired');
});
}
['@test deactivate should be called on Engine Routes before destruction'](assert) {
assert.expect(3);
this.setupAppAndRoutableEngine();
this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile('Engine{{outlet}}'));
this.register('route:application', Route.extend({
deactivate() {
assert.notOk(this.isDestroyed, 'Route is not destroyed');
assert.notOk(this.isDestroying, 'Route is not being destroyed');
}
}));
}
}));
return this.visit('/blog').then(() => {
this.assertText('ApplicationEngine');
});
}
['@test engine should lookup and use correct controller']() {
this.setupAppAndRoutableEngine();
return this.visit('/blog?lang=English').then(() => {
this.assertText('ApplicationEngineEnglish');
});
}
['@test error substate route works for the application route of an Engine'](assert) {
assert.expect(2);
let errorEntered = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:application_error', Route.extend({
activate() {
next(errorEntered.resolve);
}
}));
this.register('template:application_error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
model() {
return RSVP.reject(new Error('Oh, noes!'));
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
return this.transitionTo('blog.post');
}).then(() => {
return errorEntered.promise;
}).then(() => {
this.assertText('ApplicationError! Oh, noes!');
});
}
['@test error route works for the application route of an Engine'](assert) {
assert.expect(2);
let errorEntered = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:error', Route.extend({
activate() {
next(errorEntered.resolve);
}
}));
this.register('template:error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
model() {
return RSVP.reject(new Error('Oh, noes!'));
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
return this.transitionTo('blog.post');
}).then(() => {
return errorEntered.promise;
}).then(() => {
this.assertText('ApplicationEngineError! Oh, noes!');
});
}
['@test error substate route works for a child route of an Engine'](assert) {
assert.expect(2);
let errorEntered = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:post_error', Route.extend({
activate() {
next(errorEntered.resolve);
}
}));
this.register('template:post_error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
model() {
return RSVP.reject(new Error('Oh, noes!'));
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
return this.transitionTo('blog.post');
}).then(() => {
return errorEntered.promise;
}).then(() => {
this.assertText('ApplicationEngineError! Oh, noes!');
});
}
['@test error route works for a child route of an Engine'](assert) {
assert.expect(2);
let errorEntered = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:post.error', Route.extend({
activate() {
next(errorEntered.resolve);
}
}));
this.register('template:post.error', compile('Error! {{model.message}}'));
this.register('route:post.comments', Route.extend({
model() {
return RSVP.reject(new Error('Oh, noes!'));
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
return this.transitionTo('blog.post.comments');
}).then(() => {
return errorEntered.promise;
}).then(() => {
this.assertText('ApplicationEngineError! Oh, noes!');
});
}
['@test loading substate route works for the application route of an Engine'](assert) {
assert.expect(3);
let done = assert.async();
let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:application_loading', Route.extend({
activate() {
next(loadingEntered.resolve);
}
}));
this.register('template:application_loading', compile('Loading'));
this.register('template:post', compile('Post'));
this.register('route:post', Route.extend({
model() {
return resolveLoading.promise;
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
let transition = this.transitionTo('blog.post');
loadingEntered.promise.then(() => {
this.assertText('ApplicationLoading');
resolveLoading.resolve();
return this.runTaskNext().then(() => {
this.assertText('ApplicationEnginePost');
done();
});
});
return transition;
});
}
['@test loading route works for the application route of an Engine'](assert) {
assert.expect(3);
let done = assert.async();
let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('route:loading', Route.extend({
activate() {
next(loadingEntered.resolve);
}
}));
this.register('template:loading', compile('Loading'));
this.register('template:post', compile('Post'));
this.register('route:post', Route.extend({
model() {
return resolveLoading.promise;
}
}));
});
return this.visit('/').then(() => {
this.assertText('Application');
let transition = this.transitionTo('blog.post');
loadingEntered.promise.then(() => {
this.assertText('ApplicationEngineLoading');
resolveLoading.resolve();
return this.runTaskNext().then(() => {
this.assertText('ApplicationEnginePost');
done();
});
});
return transition;
});
}
['@test loading substate route works for a child route of an Engine'](assert) {
assert.expect(3);
let resolveLoading;
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('template:post', compile('{{outlet}}'));
this.register('template:post.comments', compile('Comments'));
this.register('template:post.likes_loading', compile('Loading'));
this.register('template:post.likes', compile('Likes'));
this.register('route:post.likes', Route.extend({
model() {
return new RSVP.Promise((resolve) => {
resolveLoading = resolve;
});
}
}));
});
return this.visit('/blog/post/comments').then(() => {
this.assertText('ApplicationEngineComments');
let transition = this.transitionTo('blog.post.likes');
this.runTaskNext().then(() => {
this.assertText('ApplicationEngineLoading');
resolveLoading();
});
return transition
.then(() => this.runTaskNext())
.then(() => this.assertText('ApplicationEngineLikes'));
});
}
['@test loading route works for a child route of an Engine'](assert) {
assert.expect(3);
let done = assert.async();
let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('template:post', compile('{{outlet}}'));
this.register('template:post.comments', compile('Comments'));
this.register('route:post.loading', Route.extend({
activate() {
next(loadingEntered.resolve);
}
}));
this.register('template:post.loading', compile('Loading'));
this.register('template:post.likes', compile('Likes'));
this.register('route:post.likes', Route.extend({
model() {
return resolveLoading.promise;
}
}));
});
return this.visit('/blog/post/comments').then(() => {
this.assertText('ApplicationEngineComments');
let transition = this.transitionTo('blog.post.likes');
loadingEntered.promise.then(() => {
this.assertText('ApplicationEngineLoading');
resolveLoading.resolve();
return this.runTaskNext().then(() => {
this.assertText('ApplicationEngineLikes');
done();
});
});
return transition;
});
}
['@test query params don\'t have stickiness by default between model'](assert) {
assert.expect(1);
let tmpl = '{{#link-to "blog.category" 1337}}Category 1337{{/link-to}}';
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('template:category', compile(tmpl));
});
return this.visit('/blog/category/1?type=news').then(() => {
let suffix = '/blog/category/1337';
let href = this.element.querySelector('a').href;
// check if link ends with the suffix
assert.ok(this.stringsEndWith(href, suffix));
});
}
['@test query params in customized controllerName have stickiness by default between model'](assert) {
assert.expect(2);
let tmpl = '{{#link-to "blog.author" 1337 class="author-1337"}}Author 1337{{/link-to}}{{#link-to "blog.author" 1 class="author-1"}}Author 1{{/link-to}}';
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function() {
this.register('template:author', compile(tmpl));
});
return this.visit('/blog/author/1?official=true').then(() => {
let suffix1 = '/blog/author/1?official=true';
let href1 = this.element.querySelector('.author-1').href;
let suffix1337 = '/blog/author/1337';
let href1337 = this.element.querySelector('.author-1337').href;
// check if link ends with the suffix
assert.ok(this.stringsEndWith(href1, suffix1), `${href1} ends with ${suffix1}`);
assert.ok(this.stringsEndWith(href1337, suffix1337), `${href1337} ends with ${suffix1337}`);
});
}
['@test visit() routable engine which errors on init'](assert) {
assert.expect(1);
let hooks = [];
this.additionalEngineRegistrations(function() {
this.register('route:application', Route.extend({
init() {
throw new Error('Whoops! Something went wrong...');
}
}));
});
this.setupAppAndRoutableEngine(hooks);
return this.visit('/', { shouldRender: true })
.then(() => {
return this.visit('/blog');
})
.catch((error) => {
assert.equal(error.message, 'Whoops! Something went wrong...');
});
}
});
|
def get_name():
return "world"
|
import random
import torch
import numpy as np
import pandas as pd
from multiprocessing import Pool
from collections import UserList, defaultdict
from rdkit import rdBase
from matplotlib import pyplot as plt
from rdkit import Chem
# https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader
def set_torch_seed_to_all_gens(_):
seed = torch.initial_seed() % (2**32 - 1)
random.seed(seed)
np.random.seed(seed)
class SS:
bos = '<bos>'
eos = '<eos>'
pad = '<pad>'
unk = '<unk>'
class CharVocab:
@classmethod
def from_data(cls, data, *args, **kwargs):
chars = set()
for string in data:
chars.update(string)
return cls(chars, *args, **kwargs)
def __init__(self, chars, ss=SS):
if (ss.bos in chars) or (ss.eos in chars) or \
(ss.pad in chars) or (ss.unk in chars):
raise ValueError('SS in chars')
all_syms = sorted(list(chars)) + [ss.bos, ss.eos, ss.pad, ss.unk]
self.ss = ss
self.c2i = {c: i for i, c in enumerate(all_syms)}
self.i2c = {i: c for i, c in enumerate(all_syms)}
def __len__(self):
return len(self.c2i)
@property
def bos(self):
return self.c2i[self.ss.bos]
@property
def eos(self):
return self.c2i[self.ss.eos]
@property
def pad(self):
return self.c2i[self.ss.pad]
@property
def unk(self):
return self.c2i[self.ss.unk]
def char2id(self, char):
if char not in self.c2i:
return self.unk
return self.c2i[char]
def id2char(self, id):
if id not in self.i2c:
return self.ss.unk
return self.i2c[id]
def string2ids(self, string, add_bos=False, add_eos=False):
ids = [self.char2id(c) for c in string]
if add_bos:
ids = [self.bos] + ids
if add_eos:
ids = ids + [self.eos]
return ids
def ids2string(self, ids, rem_bos=True, rem_eos=True):
if len(ids) == 0:
return ''
if rem_bos and ids[0] == self.bos:
ids = ids[1:]
if rem_eos and ids[-1] == self.eos:
ids = ids[:-1]
string = ''.join([self.id2char(id) for id in ids])
return string
class OneHotVocab(CharVocab):
def __init__(self, *args, **kwargs):
super(OneHotVocab, self).__init__(*args, **kwargs)
self.vectors = torch.eye(len(self.c2i))
def mapper(n_jobs):
'''
Returns function for map call.
If n_jobs == 1, will use standard map
If n_jobs > 1, will use multiprocessing pool
If n_jobs is a pool object, will return its map function
'''
if n_jobs == 1:
def _mapper(*args, **kwargs):
return list(map(*args, **kwargs))
return _mapper
elif isinstance(n_jobs, int):
pool = Pool(n_jobs)
def _mapper(*args, **kwargs):
try:
result = pool.map(*args, **kwargs)
finally:
pool.terminate()
return result
return _mapper
else:
return n_jobs.map
class Logger(UserList):
def __init__(self, data=None):
super().__init__()
self.sdata = defaultdict(list)
for step in (data or []):
self.append(step)
def __getitem__(self, key):
if isinstance(key, int):
return self.data[key]
elif isinstance(key, slice):
return Logger(self.data[key])
else:
ldata = self.sdata[key]
if isinstance(ldata[0], dict):
return Logger(ldata)
else:
return ldata
def append(self, step_dict):
super().append(step_dict)
for k, v in step_dict.items():
self.sdata[k].append(v)
def save(self, path):
df = pd.DataFrame(list(self))
df.to_csv(path, index=None)
class LogPlotter:
def __init__(self, log):
self.log = log
def line(self, ax, name):
if isinstance(self.log[0][name], dict):
for k in self.log[0][name]:
ax.plot(self.log[name][k], label=k)
ax.legend()
else:
ax.plot(self.log[name])
ax.set_ylabel('value')
ax.set_xlabel('epoch')
ax.set_title(name)
def grid(self, names, size=7):
_, axs = plt.subplots(nrows=len(names) // 2, ncols=2,
figsize=(size * 2, size * (len(names) // 2)))
for ax, name in zip(axs.flatten(), names):
self.line(ax, name)
class CircularBuffer:
def __init__(self, size):
self.max_size = size
self.data = np.zeros(self.max_size)
self.size = 0
self.pointer = -1
def add(self, element):
self.size = min(self.size + 1, self.max_size)
self.pointer = (self.pointer + 1) % self.max_size
self.data[self.pointer] = element
return element
def last(self):
assert self.pointer != -1, "Can't get an element from an empty buffer!"
return self.data[self.pointer]
def mean(self):
if self.size > 0:
return self.data[:self.size].mean()
else:
return 0.0
def disable_rdkit_log():
rdBase.DisableLog('rdApp.*')
def enable_rdkit_log():
rdBase.EnableLog('rdApp.*')
def get_mol(smiles_or_mol):
'''
Loads SMILES/molecule into RDKit's object
'''
if isinstance(smiles_or_mol, str):
if len(smiles_or_mol) == 0:
return None
mol = Chem.MolFromSmiles(smiles_or_mol)
if mol is None:
return None
try:
Chem.SanitizeMol(mol)
except ValueError:
return None
return mol
else:
return smiles_or_mol
|
/* global $, _ */
define(
[
'edx-ui-toolkit/js/utils/global-loader'
],
function(GlobalLoader) {
'use strict';
describe('GlobalLoader', function() {
beforeEach(function() {
GlobalLoader.defineAs('TestModule', 'js/test-module')(
[],
function() {
return {name: 'TestModule'};
}
);
});
it('installs a module into the edx namespace', function() {
expect(edx.TestModule).toBeDefined();
expect(edx.TestModule.name).toBe('TestModule');
});
it('handles standard libraries', function() {
GlobalLoader.defineAs('TestModule2', 'js/test-module2')(
['jquery', 'underscore'],
function($, _) {
return {name: 'TestModule2', $: $, _: _};
}
);
expect(edx.TestModule2).toBeDefined();
expect(edx.TestModule2.$).toBe($);
expect(edx.TestModule2._).toBe(_);
});
it('loads dependent modules', function() {
GlobalLoader.defineAs('TestModule2', 'js/test-module2')(
['js/test-module'],
function(TestModule) {
return {name: 'TestModule2', dependsOn: TestModule};
}
);
expect(edx.TestModule2).toBeDefined();
expect(edx.TestModule2.name).toBe('TestModule2');
expect(edx.TestModule2.dependsOn).toBe(edx.TestModule);
});
});
}
);
|
import { Meteor } from 'meteor/meteor';
import { settings } from 'meteor/rocketchat:settings';
import s from 'underscore.string';
export const getURL = (path, { cdn = true, full = false } = {}) => {
const cdnPrefix = s.rtrim(s.trim(settings.get('CDN_PREFIX') || ''), '/');
const pathPrefix = s.rtrim(s.trim(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || ''), '/');
let basePath;
const finalPath = s.ltrim(s.trim(path), '/');
if (cdn && cdnPrefix !== '') {
basePath = cdnPrefix + pathPrefix;
} else if (full) {
return Meteor.absoluteUrl(finalPath);
} else {
basePath = pathPrefix;
}
return `${ basePath }/${ finalPath }`;
};
|
/*The MIT License (MIT)
Copyright (c) 2014 Andrew MacKenzie
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
/*global define, brackets, $, Mustache */
define(function (require, exports, module) {
"use strict";
var Dialogs = brackets.getModule("widgets/Dialogs"),
projectDialog = require("text!templates/php-project-dialog.html"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
prefs = PreferencesManager.getExtensionPrefs("php-sig.php-smarthints"),
Strings = require('strings');
require("lib/jquery.add-input-area");
function showProjectDialog(filters) {
filters.sort(function (a, b) {
var nameA = a.filterName.toLowerCase(),
nameB = b.filterName.toLowerCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
});
Dialogs.showModalDialogUsingTemplate(Mustache.render(projectDialog, {
arr: filters,
strings: Strings
}));
function _setIndeterminateState() {
var checked,
indeterminate;
if ($('.php-filter:checked').length === 0) {
checked = false;
indeterminate = false;
} else if ($('.php-filter:not(:checked)').length === 0) {
checked = true;
indeterminate = false;
} else {
checked = false;
indeterminate = true;
}
$('.php-filter-all').prop({
checked: checked,
indeterminate: indeterminate
});
}
$('.php-filter-all').change(function () {
$('.php-filter').prop('checked', $(this).prop('checked'));
});
$('.php-filter').change(_setIndeterminateState);
_setIndeterminateState();
$('#btnApplyProject').on('click', function (event) {
var newFunctionList = [];
$('[id^=php-]').each(function (index) {
if ($(this).is(':checked')) {
newFunctionList.push($(this).attr('id').substr(4));
}
});
prefs.set("filteredFunctionList", newFunctionList, {location: { scope: "project"}});
prefs.save();
});
$('#phplist').addInputArea();
}
exports.showProjectDialog = showProjectDialog;
});
|
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const UserSchema = new Schema({
name: {
type: String,
required: true
},
email: {
type: String,
required: true
},
password: {
type: String,
required: true
},
date: {
type: Date,
default: Date.now
},
money: {
type: Number,
default: 50000
}
});
module.exports = User = mongoose.model('users', UserSchema); |
/*! jQuery UI - v1.11.4 - 2015-10-18
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "jquery" ], factory );
} else {
}
}(function( $ ) {
/*!
* jQuery UI Core 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {};
$.extend( $.ui, {
version: "1.11.4",
keyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
}
});
// plugins
$.fn.extend({
scrollParent: function( includeHidden ) {
var position = this.css( "position" ),
excludeStaticParent = position === "absolute",
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
scrollParent = this.parents().filter( function() {
var parent = $( this );
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
return false;
}
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
}).eq( 0 );
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
},
uniqueId: (function() {
var uuid = 0;
return function() {
return this.each(function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
});
};
})(),
removeUniqueId: function() {
return this.each(function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
});
}
});
// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
return !!img && visible( img );
}
return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) &&
// the element and all of its ancestors must be visible
visible( element );
}
function visible( element ) {
return $.expr.filters.visible( element ) &&
!$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
}
$.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo(function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
}) :
// support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
},
focusable: function( element ) {
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
},
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
isTabIndexNaN = isNaN( tabIndex );
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
}
});
// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};
function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}
$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}
return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};
$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}
return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}
// support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
$.fn.removeData = (function( removeData ) {
return function( key ) {
if ( arguments.length ) {
return removeData.call( this, $.camelCase( key ) );
} else {
return removeData.call( this );
}
};
})( $.fn.removeData );
}
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
$.fn.extend({
focus: (function( orig ) {
return function( delay, fn ) {
return typeof delay === "number" ?
this.each(function() {
var elem = this;
setTimeout(function() {
$( elem ).focus();
if ( fn ) {
fn.call( elem );
}
}, delay );
}) :
orig.apply( this, arguments );
};
})( $.fn.focus ),
disableSelection: (function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.bind( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
});
};
})(),
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
},
zIndex: function( zIndex ) {
if ( zIndex !== undefined ) {
return this.css( "zIndex", zIndex );
}
if ( this.length ) {
var elem = $( this[ 0 ] ), position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
}
return 0;
}
});
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
add: function( module, option, set ) {
var i,
proto = $.ui[ module ].prototype;
for ( i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args, allowDisconnected ) {
var i,
set = instance.plugins[ name ];
if ( !set ) {
return;
}
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
return;
}
for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
}
}
};
/*!
* jQuery UI Widget 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
var widget_uuid = 0,
widget_slice = Array.prototype.slice;
$.cleanData = (function( orig ) {
return function( elems ) {
var events, elem, i;
for ( i = 0; (elem = elems[i]) != null; i++ ) {
try {
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
// http://bugs.jquery.com/ticket/8235
} catch ( e ) {}
}
orig( elems );
};
})( $.cleanData );
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// allow instantiation without "new" keyword
if ( !this._createWidget ) {
return new constructor( options, element );
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
},
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
};
return function() {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
}
$.widget.bridge( name, constructor );
return constructor;
};
$.widget.extend = function( target ) {
var input = widget_slice.call( arguments, 1 ),
inputIndex = 0,
inputLength = input.length,
key,
value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
}
}
}
}
return target;
};
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = widget_slice.call( arguments, 1 ),
returnValue = this;
if ( isMethodCall ) {
this.each(function() {
var methodValue,
instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
});
} else {
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat(args) );
}
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} );
if ( instance._init ) {
instance._init();
}
} else {
$.data( this, fullName, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = widget_uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
});
this.document = $( element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
.removeData( this.widgetFullName )
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
.unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
_destroy: $.noop,
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
}
key = parts.pop();
if ( arguments.length === 1 ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
}
curOption[ key ] = value;
} else {
if ( arguments.length === 1 ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}
options[ key ] = value;
}
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
}
return this;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
.toggleClass( this.widgetFullName + "-disabled", !!value );
// If the widget is becoming disabled, then nothing is interactive
if ( value ) {
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
}
}
return this;
},
enable: function() {
return this._setOptions({ disabled: false });
},
disable: function() {
return this._setOptions({ disabled: true });
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
});
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
this.focusable = $( this.focusable.not( element ).get() );
this.hoverable = $( this.hoverable.not( element ).get() );
},
_delay: function( handler, delay ) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
$( event.currentTarget ).addClass( "ui-state-hover" );
},
mouseleave: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-hover" );
}
});
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
$( event.currentTarget ).addClass( "ui-state-focus" );
},
focusout: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-focus" );
}
});
},
_trigger: function( type, event, data ) {
var prop, orig,
callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
}
}
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions,
effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue(function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
});
}
};
});
var widget = $.widget;
/*!
* jQuery UI Mouse 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/mouse/
*/
var mouseHandled = false;
$( document ).mouseup( function() {
mouseHandled = false;
});
var mouse = $.widget("ui.mouse", {
version: "1.11.4",
options: {
cancel: "input,textarea,button,select,option",
distance: 1,
delay: 0
},
_mouseInit: function() {
var that = this;
this.element
.bind("mousedown." + this.widgetName, function(event) {
return that._mouseDown(event);
})
.bind("click." + this.widgetName, function(event) {
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
$.removeData(event.target, that.widgetName + ".preventClickEvent");
event.stopImmediatePropagation();
return false;
}
});
this.started = false;
},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind("." + this.widgetName);
if ( this._mouseMoveDelegate ) {
this.document
.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
}
},
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
}
this._mouseMoved = false;
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
this._mouseDownEvent = event;
var that = this,
btnIsLeft = (event.which === 1),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
return true;
}
this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
that.mouseDelayMet = true;
}, this.options.delay);
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted = (this._mouseStart(event) !== false);
if (!this._mouseStarted) {
event.preventDefault();
return true;
}
}
// Click event may never have fired (Gecko & Opera)
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
$.removeData(event.target, this.widgetName + ".preventClickEvent");
}
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
return that._mouseMove(event);
};
this._mouseUpDelegate = function(event) {
return that._mouseUp(event);
};
this.document
.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
mouseHandled = true;
return true;
},
_mouseMove: function(event) {
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if ( this._mouseMoved ) {
// IE mouseup check - mouseup happened when mouse was out of window
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event);
// Iframe mouseup check - mouseup occurred in another document
} else if ( !event.which ) {
return this._mouseUp( event );
}
}
if ( event.which || event.button ) {
this._mouseMoved = true;
}
if (this._mouseStarted) {
this._mouseDrag(event);
return event.preventDefault();
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event) !== false);
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
}
return !this._mouseStarted;
},
_mouseUp: function(event) {
this.document
.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
if (this._mouseStarted) {
this._mouseStarted = false;
if (event.target === this._mouseDownEvent.target) {
$.data(event.target, this.widgetName + ".preventClickEvent", true);
}
this._mouseStop(event);
}
mouseHandled = false;
return false;
},
_mouseDistanceMet: function(event) {
return (Math.max(
Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math.abs(this._mouseDownEvent.pageY - event.pageY)
) >= this.options.distance
);
},
_mouseDelayMet: function(/* event */) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart: function(/* event */) {},
_mouseDrag: function(/* event */) {},
_mouseStop: function(/* event */) {},
_mouseCapture: function(/* event */) { return true; }
});
/*!
* jQuery UI Position 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/position/
*/
(function() {
$.ui = $.ui || {};
var cachedScrollbarWidth, supportsOffsetFractions,
max = Math.max,
abs = Math.abs,
round = Math.round,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
function getOffsets( offsets, width, height ) {
return [
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
];
}
function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
function getDimensions( elem ) {
var raw = elem[0];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: 0, left: 0 }
};
}
if ( $.isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
};
}
if ( raw.preventDefault ) {
return {
width: 0,
height: 0,
offset: { top: raw.pageY, left: raw.pageX }
};
}
return {
width: elem.outerWidth(),
height: elem.outerHeight(),
offset: elem.offset()
};
}
$.position = {
scrollbarWidth: function() {
if ( cachedScrollbarWidth !== undefined ) {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0];
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
div.css( "overflow", "scroll" );
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
w2 = div[0].clientWidth;
}
div.remove();
return (cachedScrollbarWidth = w1 - w2);
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-x" ),
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
};
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[0] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
return {
element: withinElement,
isWindow: isWindow,
isDocument: isDocument,
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
// support: jQuery 1.6.x
// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
};
}
};
$.fn.position = function( options ) {
if ( !options || !options.of ) {
return _position.apply( this, arguments );
}
// make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target = $( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
dimensions = getDimensions( target );
if ( target[0].preventDefault ) {
// force left top to allow flipping
options.at = "left top";
}
targetWidth = dimensions.width;
targetHeight = dimensions.height;
targetOffset = dimensions.offset;
// clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
// force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each( [ "my", "at" ], function() {
var pos = ( options[ this ] || "" ).split( " " ),
horizontalOffset,
verticalOffset;
if ( pos.length === 1) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
[ "center" ].concat( pos ) :
[ "center", "center" ];
}
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
// calculate offsets
horizontalOffset = roffset.exec( pos[ 0 ] );
verticalOffset = roffset.exec( pos[ 1 ] );
offsets[ this ] = [
horizontalOffset ? horizontalOffset[ 0 ] : 0,
verticalOffset ? verticalOffset[ 0 ] : 0
];
// reduce to just the positions without the offsets
options[ this ] = [
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
});
// normalize collision option
if ( collision.length === 1 ) {
collision[ 1 ] = collision[ 0 ];
}
if ( options.at[ 0 ] === "right" ) {
basePosition.left += targetWidth;
} else if ( options.at[ 0 ] === "center" ) {
basePosition.left += targetWidth / 2;
}
if ( options.at[ 1 ] === "bottom" ) {
basePosition.top += targetHeight;
} else if ( options.at[ 1 ] === "center" ) {
basePosition.top += targetHeight / 2;
}
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
return this.each(function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseCss( this, "marginLeft" ),
marginTop = parseCss( this, "marginTop" ),
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
position = $.extend( {}, basePosition ),
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
if ( options.my[ 0 ] === "right" ) {
position.left -= elemWidth;
} else if ( options.my[ 0 ] === "center" ) {
position.left -= elemWidth / 2;
}
if ( options.my[ 1 ] === "bottom" ) {
position.top -= elemHeight;
} else if ( options.my[ 1 ] === "center" ) {
position.top -= elemHeight / 2;
}
position.left += myOffset[ 0 ];
position.top += myOffset[ 1 ];
// if the browser doesn't support fractions, then round for consistent results
if ( !supportsOffsetFractions ) {
position.left = round( position.left );
position.top = round( position.top );
}
collisionPosition = {
marginLeft: marginLeft,
marginTop: marginTop
};
$.each( [ "left", "top" ], function( i, dir ) {
if ( $.ui.position[ collision[ i ] ] ) {
$.ui.position[ collision[ i ] ][ dir ]( position, {
targetWidth: targetWidth,
targetHeight: targetHeight,
elemWidth: elemWidth,
elemHeight: elemHeight,
collisionPosition: collisionPosition,
collisionWidth: collisionWidth,
collisionHeight: collisionHeight,
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
within: within,
elem: elem
});
}
});
if ( options.using ) {
// adds feedback as second argument to using callback, if present
using = function( props ) {
var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth,
top = targetOffset.top - position.top,
bottom = top + targetHeight - elemHeight,
feedback = {
target: {
element: target,
left: targetOffset.left,
top: targetOffset.top,
width: targetWidth,
height: targetHeight
},
element: {
element: elem,
left: position.left,
top: position.top,
width: elemWidth,
height: elemHeight
},
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
};
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
feedback.horizontal = "center";
}
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
feedback.vertical = "middle";
}
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
feedback.important = "horizontal";
} else {
feedback.important = "vertical";
}
options.using.call( this, props, feedback );
};
}
elem.offset( $.extend( position, { using: using } ) );
});
};
$.ui.position = {
fit: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
outerWidth = within.width,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = withinOffset - collisionPosLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
// element is wider than within
if ( data.collisionWidth > outerWidth ) {
// element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
position.left += overLeft - newOverRight;
// element is initially over right side of within
} else if ( overRight > 0 && overLeft <= 0 ) {
position.left = withinOffset;
// element is initially over both left and right sides of within
} else {
if ( overLeft > overRight ) {
position.left = withinOffset + outerWidth - data.collisionWidth;
} else {
position.left = withinOffset;
}
}
// too far left -> align with left edge
} else if ( overLeft > 0 ) {
position.left += overLeft;
// too far right -> align with right edge
} else if ( overRight > 0 ) {
position.left -= overRight;
// adjust based on position and margin
} else {
position.left = max( position.left - collisionPosLeft, position.left );
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
outerHeight = data.within.height,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = withinOffset - collisionPosTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
// element is taller than within
if ( data.collisionHeight > outerHeight ) {
// element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
position.top += overTop - newOverBottom;
// element is initially over bottom of within
} else if ( overBottom > 0 && overTop <= 0 ) {
position.top = withinOffset;
// element is initially over both top and bottom of within
} else {
if ( overTop > overBottom ) {
position.top = withinOffset + outerHeight - data.collisionHeight;
} else {
position.top = withinOffset;
}
}
// too far up -> align with top
} else if ( overTop > 0 ) {
position.top += overTop;
// too far down -> align with bottom edge
} else if ( overBottom > 0 ) {
position.top -= overBottom;
// adjust based on position and margin
} else {
position.top = max( position.top - collisionPosTop, position.top );
}
}
},
flip: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = collisionPosLeft - offsetLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
data.my[ 0 ] === "right" ?
data.elemWidth :
0,
atOffset = data.at[ 0 ] === "left" ?
data.targetWidth :
data.at[ 0 ] === "right" ?
-data.targetWidth :
0,
offset = -2 * data.offset[ 0 ],
newOverRight,
newOverLeft;
if ( overLeft < 0 ) {
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset;
}
} else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset;
}
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.offset.top + within.scrollTop,
outerHeight = within.height,
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = collisionPosTop - offsetTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top = data.my[ 1 ] === "top",
myOffset = top ?
-data.elemHeight :
data.my[ 1 ] === "bottom" ?
data.elemHeight :
0,
atOffset = data.at[ 1 ] === "top" ?
data.targetHeight :
data.at[ 1 ] === "bottom" ?
-data.targetHeight :
0,
offset = -2 * data.offset[ 1 ],
newOverTop,
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
position.top += myOffset + atOffset + offset;
}
} else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
position.top += myOffset + atOffset + offset;
}
}
}
},
flipfit: {
left: function() {
$.ui.position.flip.left.apply( this, arguments );
$.ui.position.fit.left.apply( this, arguments );
},
top: function() {
$.ui.position.flip.top.apply( this, arguments );
$.ui.position.fit.top.apply( this, arguments );
}
}
};
// fraction support test
(function() {
var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" );
//Create a "fake body" for testing based on method used in jQuery.support
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
$.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || document.documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
div.style.cssText = "position: absolute; left: 10.7432222px;";
offsetLeft = $( div ).offset().left;
supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
})();
})();
var position = $.ui.position;
/*!
* jQuery UI Draggable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/draggable/
*/
$.widget("ui.draggable", $.ui.mouse, {
version: "1.11.4",
widgetEventPrefix: "drag",
options: {
addClasses: true,
appendTo: "parent",
axis: false,
connectToSortable: false,
containment: false,
cursor: "auto",
cursorAt: false,
grid: false,
handle: false,
helper: "original",
iframeFix: false,
opacity: false,
refreshPositions: false,
revert: false,
revertDuration: 500,
scope: "default",
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
snap: false,
snapMode: "both",
snapTolerance: 20,
stack: false,
zIndex: false,
// callbacks
drag: null,
start: null,
stop: null
},
_create: function() {
if ( this.options.helper === "original" ) {
this._setPositionRelative();
}
if (this.options.addClasses){
this.element.addClass("ui-draggable");
}
if (this.options.disabled){
this.element.addClass("ui-draggable-disabled");
}
this._setHandleClassName();
this._mouseInit();
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "handle" ) {
this._removeHandleClassName();
this._setHandleClassName();
}
},
_destroy: function() {
if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
this.destroyOnClear = true;
return;
}
this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
this._removeHandleClassName();
this._mouseDestroy();
},
_mouseCapture: function(event) {
var o = this.options;
this._blurActiveElement( event );
// among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
return false;
}
//Quit if we're not on a valid handle
this.handle = this._getHandle(event);
if (!this.handle) {
return false;
}
this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
return true;
},
_blockFrames: function( selector ) {
this.iframeBlocks = this.document.find( selector ).map(function() {
var iframe = $( this );
return $( "<div>" )
.css( "position", "absolute" )
.appendTo( iframe.parent() )
.outerWidth( iframe.outerWidth() )
.outerHeight( iframe.outerHeight() )
.offset( iframe.offset() )[ 0 ];
});
},
_unblockFrames: function() {
if ( this.iframeBlocks ) {
this.iframeBlocks.remove();
delete this.iframeBlocks;
}
},
_blurActiveElement: function( event ) {
var document = this.document[ 0 ];
// Only need to blur if the event occurred on the draggable itself, see #10527
if ( !this.handleElement.is( event.target ) ) {
return;
}
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #9520
if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
// Blur any element that currently has focus, see #4261
$( document.activeElement ).blur();
}
} catch ( error ) {}
},
_mouseStart: function(event) {
var o = this.options;
//Create and append the visible helper
this.helper = this._createHelper(event);
this.helper.addClass("ui-draggable-dragging");
//Cache the helper size
this._cacheHelperProportions();
//If ddmanager is used for droppables, set the global draggable
if ($.ui.ddmanager) {
$.ui.ddmanager.current = this;
}
/*
* - Position generation -
* This block generates everything position related - it's the core of draggables.
*/
//Cache the margins of the original element
this._cacheMargins();
//Store the helper's css position
this.cssPosition = this.helper.css( "position" );
this.scrollParent = this.helper.scrollParent( true );
this.offsetParent = this.helper.offsetParent();
this.hasFixedAncestor = this.helper.parents().filter(function() {
return $( this ).css( "position" ) === "fixed";
}).length > 0;
//The element's absolute position on the page minus margins
this.positionAbs = this.element.offset();
this._refreshOffsets( event );
//Generate the original position
this.originalPosition = this.position = this._generatePosition( event, false );
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
//Set a containment if given in the options
this._setContainment();
//Trigger event + callbacks
if (this._trigger("start", event) === false) {
this._clear();
return false;
}
//Recache the helper size
this._cacheHelperProportions();
//Prepare the droppable offsets
if ($.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(this, event);
}
// Reset helper's right/bottom css if they're set and set explicit width/height instead
// as this prevents resizing of elements with right/bottom set (see #7772)
this._normalizeRightBottom();
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStart(this, event);
}
return true;
},
_refreshOffsets: function( event ) {
this.offset = {
top: this.positionAbs.top - this.margins.top,
left: this.positionAbs.left - this.margins.left,
scroll: false,
parent: this._getParentOffset(),
relative: this._getRelativeOffset()
};
this.offset.click = {
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
};
},
_mouseDrag: function(event, noPropagation) {
// reset any necessary cached properties (see #5009)
if ( this.hasFixedAncestor ) {
this.offset.parent = this._getParentOffset();
}
//Compute the helpers position
this.position = this._generatePosition( event, true );
this.positionAbs = this._convertPositionTo("absolute");
//Call plugins and callbacks and use the resulting position if something is returned
if (!noPropagation) {
var ui = this._uiHash();
if (this._trigger("drag", event, ui) === false) {
this._mouseUp({});
return false;
}
this.position = ui.position;
}
this.helper[ 0 ].style.left = this.position.left + "px";
this.helper[ 0 ].style.top = this.position.top + "px";
if ($.ui.ddmanager) {
$.ui.ddmanager.drag(this, event);
}
return false;
},
_mouseStop: function(event) {
//If we are using droppables, inform the manager about the drop
var that = this,
dropped = false;
if ($.ui.ddmanager && !this.options.dropBehaviour) {
dropped = $.ui.ddmanager.drop(this, event);
}
//if a drop comes from outside (a sortable)
if (this.dropped) {
dropped = this.dropped;
this.dropped = false;
}
if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if (that._trigger("stop", event) !== false) {
that._clear();
}
});
} else {
if (this._trigger("stop", event) !== false) {
this._clear();
}
}
return false;
},
_mouseUp: function( event ) {
this._unblockFrames();
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStop(this, event);
}
// Only need to focus if the event occurred on the draggable itself, see #10527
if ( this.handleElement.is( event.target ) ) {
// The interaction is over; whether or not the click resulted in a drag, focus the element
this.element.focus();
}
return $.ui.mouse.prototype._mouseUp.call(this, event);
},
cancel: function() {
if (this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({});
} else {
this._clear();
}
return this;
},
_getHandle: function(event) {
return this.options.handle ?
!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
true;
},
_setHandleClassName: function() {
this.handleElement = this.options.handle ?
this.element.find( this.options.handle ) : this.element;
this.handleElement.addClass( "ui-draggable-handle" );
},
_removeHandleClassName: function() {
this.handleElement.removeClass( "ui-draggable-handle" );
},
_createHelper: function(event) {
var o = this.options,
helperIsFunction = $.isFunction( o.helper ),
helper = helperIsFunction ?
$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
( o.helper === "clone" ?
this.element.clone().removeAttr( "id" ) :
this.element );
if (!helper.parents("body").length) {
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
}
// http://bugs.jqueryui.com/ticket/9446
// a helper function can return the original element
// which wouldn't have been set to relative in _create
if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
this._setPositionRelative();
}
if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
helper.css("position", "absolute");
}
return helper;
},
_setPositionRelative: function() {
if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
this.element[ 0 ].style.position = "relative";
}
},
_adjustOffsetFromHelper: function(obj) {
if (typeof obj === "string") {
obj = obj.split(" ");
}
if ($.isArray(obj)) {
obj = { left: +obj[0], top: +obj[1] || 0 };
}
if ("left" in obj) {
this.offset.click.left = obj.left + this.margins.left;
}
if ("right" in obj) {
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
}
if ("top" in obj) {
this.offset.click.top = obj.top + this.margins.top;
}
if ("bottom" in obj) {
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
}
},
_isRootNode: function( element ) {
return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
},
_getParentOffset: function() {
//Get the offsetParent and cache its position
var po = this.offsetParent.offset(),
document = this.document[ 0 ];
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
po = { top: 0, left: 0 };
}
return {
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
};
},
_getRelativeOffset: function() {
if ( this.cssPosition !== "relative" ) {
return { top: 0, left: 0 };
}
var p = this.element.position(),
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
return {
top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
};
},
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.element.css("marginLeft"), 10) || 0),
top: (parseInt(this.element.css("marginTop"), 10) || 0),
right: (parseInt(this.element.css("marginRight"), 10) || 0),
bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var isUserScrollable, c, ce,
o = this.options,
document = this.document[ 0 ];
this.relativeContainer = null;
if ( !o.containment ) {
this.containment = null;
return;
}
if ( o.containment === "window" ) {
this.containment = [
$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
];
return;
}
if ( o.containment === "document") {
this.containment = [
0,
0,
$( document ).width() - this.helperProportions.width - this.margins.left,
( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
];
return;
}
if ( o.containment.constructor === Array ) {
this.containment = o.containment;
return;
}
if ( o.containment === "parent" ) {
o.containment = this.helper[ 0 ].parentNode;
}
c = $( o.containment );
ce = c[ 0 ];
if ( !ce ) {
return;
}
isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
this.containment = [
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
this.helperProportions.width -
this.margins.left -
this.margins.right,
( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
this.helperProportions.height -
this.margins.top -
this.margins.bottom
];
this.relativeContainer = c;
},
_convertPositionTo: function(d, pos) {
if (!pos) {
pos = this.position;
}
var mod = d === "absolute" ? 1 : -1,
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
return {
top: (
pos.top + // The absolute mouse position
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
),
left: (
pos.left + // The absolute mouse position
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
)
};
},
_generatePosition: function( event, constrainPosition ) {
var containment, co, top, left,
o = this.options,
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
pageX = event.pageX,
pageY = event.pageY;
// Cache the scroll
if ( !scrollIsRootNode || !this.offset.scroll ) {
this.offset.scroll = {
top: this.scrollParent.scrollTop(),
left: this.scrollParent.scrollLeft()
};
}
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
// If we are not dragging yet, we won't check for options
if ( constrainPosition ) {
if ( this.containment ) {
if ( this.relativeContainer ){
co = this.relativeContainer.offset();
containment = [
this.containment[ 0 ] + co.left,
this.containment[ 1 ] + co.top,
this.containment[ 2 ] + co.left,
this.containment[ 3 ] + co.top
];
} else {
containment = this.containment;
}
if (event.pageX - this.offset.click.left < containment[0]) {
pageX = containment[0] + this.offset.click.left;
}
if (event.pageY - this.offset.click.top < containment[1]) {
pageY = containment[1] + this.offset.click.top;
}
if (event.pageX - this.offset.click.left > containment[2]) {
pageX = containment[2] + this.offset.click.left;
}
if (event.pageY - this.offset.click.top > containment[3]) {
pageY = containment[3] + this.offset.click.top;
}
}
if (o.grid) {
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}
if ( o.axis === "y" ) {
pageX = this.originalPageX;
}
if ( o.axis === "x" ) {
pageY = this.originalPageY;
}
}
return {
top: (
pageY - // The absolute mouse position
this.offset.click.top - // Click offset (relative to the element)
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
),
left: (
pageX - // The absolute mouse position
this.offset.click.left - // Click offset (relative to the element)
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
)
};
},
_clear: function() {
this.helper.removeClass("ui-draggable-dragging");
if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
this.helper.remove();
}
this.helper = null;
this.cancelHelperRemoval = false;
if ( this.destroyOnClear ) {
this.destroy();
}
},
_normalizeRightBottom: function() {
if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
this.helper.width( this.helper.width() );
this.helper.css( "right", "auto" );
}
if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
this.helper.height( this.helper.height() );
this.helper.css( "bottom", "auto" );
}
},
// From now on bulk stuff - mainly helpers
_trigger: function( type, event, ui ) {
ui = ui || this._uiHash();
$.ui.plugin.call( this, type, [ event, ui, this ], true );
// Absolute position and offset (see #6884 ) have to be recalculated after plugins
if ( /^(drag|start|stop)/.test( type ) ) {
this.positionAbs = this._convertPositionTo( "absolute" );
ui.offset = this.positionAbs;
}
return $.Widget.prototype._trigger.call( this, type, event, ui );
},
plugins: {},
_uiHash: function() {
return {
helper: this.helper,
position: this.position,
originalPosition: this.originalPosition,
offset: this.positionAbs
};
}
});
$.ui.plugin.add( "draggable", "connectToSortable", {
start: function( event, ui, draggable ) {
var uiSortable = $.extend( {}, ui, {
item: draggable.element
});
draggable.sortables = [];
$( draggable.options.connectToSortable ).each(function() {
var sortable = $( this ).sortable( "instance" );
if ( sortable && !sortable.options.disabled ) {
draggable.sortables.push( sortable );
// refreshPositions is called at drag start to refresh the containerCache
// which is used in drag. This ensures it's initialized and synchronized
// with any changes that might have happened on the page since initialization.
sortable.refreshPositions();
sortable._trigger("activate", event, uiSortable);
}
});
},
stop: function( event, ui, draggable ) {
var uiSortable = $.extend( {}, ui, {
item: draggable.element
});
draggable.cancelHelperRemoval = false;
$.each( draggable.sortables, function() {
var sortable = this;
if ( sortable.isOver ) {
sortable.isOver = 0;
// Allow this sortable to handle removing the helper
draggable.cancelHelperRemoval = true;
sortable.cancelHelperRemoval = false;
// Use _storedCSS To restore properties in the sortable,
// as this also handles revert (#9675) since the draggable
// may have modified them in unexpected ways (#8809)
sortable._storedCSS = {
position: sortable.placeholder.css( "position" ),
top: sortable.placeholder.css( "top" ),
left: sortable.placeholder.css( "left" )
};
sortable._mouseStop(event);
// Once drag has ended, the sortable should return to using
// its original helper, not the shared helper from draggable
sortable.options.helper = sortable.options._helper;
} else {
// Prevent this Sortable from removing the helper.
// However, don't set the draggable to remove the helper
// either as another connected Sortable may yet handle the removal.
sortable.cancelHelperRemoval = true;
sortable._trigger( "deactivate", event, uiSortable );
}
});
},
drag: function( event, ui, draggable ) {
$.each( draggable.sortables, function() {
var innermostIntersecting = false,
sortable = this;
// Copy over variables that sortable's _intersectsWith uses
sortable.positionAbs = draggable.positionAbs;
sortable.helperProportions = draggable.helperProportions;
sortable.offset.click = draggable.offset.click;
if ( sortable._intersectsWith( sortable.containerCache ) ) {
innermostIntersecting = true;
$.each( draggable.sortables, function() {
// Copy over variables that sortable's _intersectsWith uses
this.positionAbs = draggable.positionAbs;
this.helperProportions = draggable.helperProportions;
this.offset.click = draggable.offset.click;
if ( this !== sortable &&
this._intersectsWith( this.containerCache ) &&
$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
innermostIntersecting = false;
}
return innermostIntersecting;
});
}
if ( innermostIntersecting ) {
// If it intersects, we use a little isOver variable and set it once,
// so that the move-in stuff gets fired only once.
if ( !sortable.isOver ) {
sortable.isOver = 1;
// Store draggable's parent in case we need to reappend to it later.
draggable._parent = ui.helper.parent();
sortable.currentItem = ui.helper
.appendTo( sortable.element )
.data( "ui-sortable-item", true );
// Store helper option to later restore it
sortable.options._helper = sortable.options.helper;
sortable.options.helper = function() {
return ui.helper[ 0 ];
};
// Fire the start events of the sortable with our passed browser event,
// and our own helper (so it doesn't create a new one)
event.target = sortable.currentItem[ 0 ];
sortable._mouseCapture( event, true );
sortable._mouseStart( event, true, true );
// Because the browser event is way off the new appended portlet,
// modify necessary variables to reflect the changes
sortable.offset.click.top = draggable.offset.click.top;
sortable.offset.click.left = draggable.offset.click.left;
sortable.offset.parent.left -= draggable.offset.parent.left -
sortable.offset.parent.left;
sortable.offset.parent.top -= draggable.offset.parent.top -
sortable.offset.parent.top;
draggable._trigger( "toSortable", event );
// Inform draggable that the helper is in a valid drop zone,
// used solely in the revert option to handle "valid/invalid".
draggable.dropped = sortable.element;
// Need to refreshPositions of all sortables in the case that
// adding to one sortable changes the location of the other sortables (#9675)
$.each( draggable.sortables, function() {
this.refreshPositions();
});
// hack so receive/update callbacks work (mostly)
draggable.currentItem = draggable.element;
sortable.fromOutside = draggable;
}
if ( sortable.currentItem ) {
sortable._mouseDrag( event );
// Copy the sortable's position because the draggable's can potentially reflect
// a relative position, while sortable is always absolute, which the dragged
// element has now become. (#8809)
ui.position = sortable.position;
}
} else {
// If it doesn't intersect with the sortable, and it intersected before,
// we fake the drag stop of the sortable, but make sure it doesn't remove
// the helper by using cancelHelperRemoval.
if ( sortable.isOver ) {
sortable.isOver = 0;
sortable.cancelHelperRemoval = true;
// Calling sortable's mouseStop would trigger a revert,
// so revert must be temporarily false until after mouseStop is called.
sortable.options._revert = sortable.options.revert;
sortable.options.revert = false;
sortable._trigger( "out", event, sortable._uiHash( sortable ) );
sortable._mouseStop( event, true );
// restore sortable behaviors that were modfied
// when the draggable entered the sortable area (#9481)
sortable.options.revert = sortable.options._revert;
sortable.options.helper = sortable.options._helper;
if ( sortable.placeholder ) {
sortable.placeholder.remove();
}
// Restore and recalculate the draggable's offset considering the sortable
// may have modified them in unexpected ways. (#8809, #10669)
ui.helper.appendTo( draggable._parent );
draggable._refreshOffsets( event );
ui.position = draggable._generatePosition( event, true );
draggable._trigger( "fromSortable", event );
// Inform draggable that the helper is no longer in a valid drop zone
draggable.dropped = false;
// Need to refreshPositions of all sortables just in case removing
// from one sortable changes the location of other sortables (#9675)
$.each( draggable.sortables, function() {
this.refreshPositions();
});
}
}
});
}
});
$.ui.plugin.add("draggable", "cursor", {
start: function( event, ui, instance ) {
var t = $( "body" ),
o = instance.options;
if (t.css("cursor")) {
o._cursor = t.css("cursor");
}
t.css("cursor", o.cursor);
},
stop: function( event, ui, instance ) {
var o = instance.options;
if (o._cursor) {
$("body").css("cursor", o._cursor);
}
}
});
$.ui.plugin.add("draggable", "opacity", {
start: function( event, ui, instance ) {
var t = $( ui.helper ),
o = instance.options;
if (t.css("opacity")) {
o._opacity = t.css("opacity");
}
t.css("opacity", o.opacity);
},
stop: function( event, ui, instance ) {
var o = instance.options;
if (o._opacity) {
$(ui.helper).css("opacity", o._opacity);
}
}
});
$.ui.plugin.add("draggable", "scroll", {
start: function( event, ui, i ) {
if ( !i.scrollParentNotHidden ) {
i.scrollParentNotHidden = i.helper.scrollParent( false );
}
if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
i.overflowOffset = i.scrollParentNotHidden.offset();
}
},
drag: function( event, ui, i ) {
var o = i.options,
scrolled = false,
scrollParent = i.scrollParentNotHidden[ 0 ],
document = i.document[ 0 ];
if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
if ( !o.axis || o.axis !== "x" ) {
if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
}
}
if ( !o.axis || o.axis !== "y" ) {
if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
}
}
} else {
if (!o.axis || o.axis !== "x") {
if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
} else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
}
}
if (!o.axis || o.axis !== "y") {
if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
} else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
}
}
if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(i, event);
}
}
});
$.ui.plugin.add("draggable", "snap", {
start: function( event, ui, i ) {
var o = i.options;
i.snapElements = [];
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
var $t = $(this),
$o = $t.offset();
if (this !== i.element[0]) {
i.snapElements.push({
item: this,
width: $t.outerWidth(), height: $t.outerHeight(),
top: $o.top, left: $o.left
});
}
});
},
drag: function( event, ui, inst ) {
var ts, bs, ls, rs, l, r, t, b, i, first,
o = inst.options,
d = o.snapTolerance,
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
for (i = inst.snapElements.length - 1; i >= 0; i--){
l = inst.snapElements[i].left - inst.margins.left;
r = l + inst.snapElements[i].width;
t = inst.snapElements[i].top - inst.margins.top;
b = t + inst.snapElements[i].height;
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
if (inst.snapElements[i].snapping) {
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = false;
continue;
}
if (o.snapMode !== "inner") {
ts = Math.abs(t - y2) <= d;
bs = Math.abs(b - y1) <= d;
ls = Math.abs(l - x2) <= d;
rs = Math.abs(r - x1) <= d;
if (ts) {
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
}
if (bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
}
if (ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
}
if (rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
}
}
first = (ts || bs || ls || rs);
if (o.snapMode !== "outer") {
ts = Math.abs(t - y1) <= d;
bs = Math.abs(b - y2) <= d;
ls = Math.abs(l - x1) <= d;
rs = Math.abs(r - x2) <= d;
if (ts) {
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
}
if (bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
}
if (ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
}
if (rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
}
}
if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
}
}
});
$.ui.plugin.add("draggable", "stack", {
start: function( event, ui, instance ) {
var min,
o = instance.options,
group = $.makeArray($(o.stack)).sort(function(a, b) {
return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
});
if (!group.length) { return; }
min = parseInt($(group[0]).css("zIndex"), 10) || 0;
$(group).each(function(i) {
$(this).css("zIndex", min + i);
});
this.css("zIndex", (min + group.length));
}
});
$.ui.plugin.add("draggable", "zIndex", {
start: function( event, ui, instance ) {
var t = $( ui.helper ),
o = instance.options;
if (t.css("zIndex")) {
o._zIndex = t.css("zIndex");
}
t.css("zIndex", o.zIndex);
},
stop: function( event, ui, instance ) {
var o = instance.options;
if (o._zIndex) {
$(ui.helper).css("zIndex", o._zIndex);
}
}
});
var draggable = $.ui.draggable;
/*!
* jQuery UI Droppable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/droppable/
*/
$.widget( "ui.droppable", {
version: "1.11.4",
widgetEventPrefix: "drop",
options: {
accept: "*",
activeClass: false,
addClasses: true,
greedy: false,
hoverClass: false,
scope: "default",
tolerance: "intersect",
// callbacks
activate: null,
deactivate: null,
drop: null,
out: null,
over: null
},
_create: function() {
var proportions,
o = this.options,
accept = o.accept;
this.isover = false;
this.isout = true;
this.accept = $.isFunction( accept ) ? accept : function( d ) {
return d.is( accept );
};
this.proportions = function( /* valueToWrite */ ) {
if ( arguments.length ) {
// Store the droppable's proportions
proportions = arguments[ 0 ];
} else {
// Retrieve or derive the droppable's proportions
return proportions ?
proportions :
proportions = {
width: this.element[ 0 ].offsetWidth,
height: this.element[ 0 ].offsetHeight
};
}
};
this._addToManager( o.scope );
o.addClasses && this.element.addClass( "ui-droppable" );
},
_addToManager: function( scope ) {
// Add the reference and positions to the manager
$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
$.ui.ddmanager.droppables[ scope ].push( this );
},
_splice: function( drop ) {
var i = 0;
for ( ; i < drop.length; i++ ) {
if ( drop[ i ] === this ) {
drop.splice( i, 1 );
}
}
},
_destroy: function() {
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
this._splice( drop );
this.element.removeClass( "ui-droppable ui-droppable-disabled" );
},
_setOption: function( key, value ) {
if ( key === "accept" ) {
this.accept = $.isFunction( value ) ? value : function( d ) {
return d.is( value );
};
} else if ( key === "scope" ) {
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
this._splice( drop );
this._addToManager( value );
}
this._super( key, value );
},
_activate: function( event ) {
var draggable = $.ui.ddmanager.current;
if ( this.options.activeClass ) {
this.element.addClass( this.options.activeClass );
}
if ( draggable ){
this._trigger( "activate", event, this.ui( draggable ) );
}
},
_deactivate: function( event ) {
var draggable = $.ui.ddmanager.current;
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
if ( draggable ){
this._trigger( "deactivate", event, this.ui( draggable ) );
}
},
_over: function( event ) {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.hoverClass ) {
this.element.addClass( this.options.hoverClass );
}
this._trigger( "over", event, this.ui( draggable ) );
}
},
_out: function( event ) {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
this._trigger( "out", event, this.ui( draggable ) );
}
},
_drop: function( event, custom ) {
var draggable = custom || $.ui.ddmanager.current,
childrenIntersection = false;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
return false;
}
this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
$.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
) { childrenIntersection = true; return false; }
});
if ( childrenIntersection ) {
return false;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
this._trigger( "drop", event, this.ui( draggable ) );
return this.element;
}
return false;
},
ui: function( c ) {
return {
draggable: ( c.currentItem || c.element ),
helper: c.helper,
position: c.position,
offset: c.positionAbs
};
}
});
$.ui.intersect = (function() {
function isOverAxis( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
}
return function( draggable, droppable, toleranceMode, event ) {
if ( !droppable.offset ) {
return false;
}
var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
x2 = x1 + draggable.helperProportions.width,
y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left,
t = droppable.offset.top,
r = l + droppable.proportions().width,
b = t + droppable.proportions().height;
switch ( toleranceMode ) {
case "fit":
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
case "intersect":
return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
( y2 >= t && y2 <= b ) || // Bottom edge touching
( y1 < t && y2 > b ) // Surrounded vertically
) && (
( x1 >= l && x1 <= r ) || // Left edge touching
( x2 >= l && x2 <= r ) || // Right edge touching
( x1 < l && x2 > r ) // Surrounded horizontally
);
default:
return false;
}
};
})();
/*
This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
current: null,
droppables: { "default": [] },
prepareOffsets: function( t, event ) {
var i, j,
m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
type = event ? event.type : null, // workaround for #2317
list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
droppablesLoop: for ( i = 0; i < m.length; i++ ) {
// No disabled and non-accepted
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
continue;
}
// Filter out elements in the current dragged item
for ( j = 0; j < list.length; j++ ) {
if ( list[ j ] === m[ i ].element[ 0 ] ) {
m[ i ].proportions().height = 0;
continue droppablesLoop;
}
}
m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
if ( !m[ i ].visible ) {
continue;
}
// Activate the droppable if used directly from draggables
if ( type === "mousedown" ) {
m[ i ]._activate.call( m[ i ], event );
}
m[ i ].offset = m[ i ].element.offset();
m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
}
},
drop: function( draggable, event ) {
var dropped = false;
// Create a copy of the droppables in case the list changes during the drop (#9116)
$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
if ( !this.options ) {
return;
}
if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
dropped = this._drop.call( this, event ) || dropped;
}
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
this.isout = true;
this.isover = false;
this._deactivate.call( this, event );
}
});
return dropped;
},
dragStart: function( draggable, event ) {
// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
});
},
drag: function( draggable, event ) {
// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if ( draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
// Run through all droppables and check their positions based on specific tolerance options
$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
if ( this.options.disabled || this.greedyChild || !this.visible ) {
return;
}
var parentInstance, scope, parent,
intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
if ( !c ) {
return;
}
if ( this.options.greedy ) {
// find droppable parents with same scope
scope = this.options.scope;
parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
return $( this ).droppable( "instance" ).options.scope === scope;
});
if ( parent.length ) {
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
parentInstance.greedyChild = ( c === "isover" );
}
}
// we just moved into a greedy child
if ( parentInstance && c === "isover" ) {
parentInstance.isover = false;
parentInstance.isout = true;
parentInstance._out.call( parentInstance, event );
}
this[ c ] = true;
this[c === "isout" ? "isover" : "isout"] = false;
this[c === "isover" ? "_over" : "_out"].call( this, event );
// we just moved out of a greedy child
if ( parentInstance && c === "isout" ) {
parentInstance.isout = false;
parentInstance.isover = true;
parentInstance._over.call( parentInstance, event );
}
});
},
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
}
};
var droppable = $.ui.droppable;
/*!
* jQuery UI Resizable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/resizable/
*/
$.widget("ui.resizable", $.ui.mouse, {
version: "1.11.4",
widgetEventPrefix: "resize",
options: {
alsoResize: false,
animate: false,
animateDuration: "slow",
animateEasing: "swing",
aspectRatio: false,
autoHide: false,
containment: false,
ghost: false,
grid: false,
handles: "e,s,se",
helper: false,
maxHeight: null,
maxWidth: null,
minHeight: 10,
minWidth: 10,
// See #7960
zIndex: 90,
// callbacks
resize: null,
start: null,
stop: null
},
_num: function( value ) {
return parseInt( value, 10 ) || 0;
},
_isNumber: function( value ) {
return !isNaN( parseInt( value, 10 ) );
},
_hasScroll: function( el, a ) {
if ( $( el ).css( "overflow" ) === "hidden") {
return false;
}
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
has = false;
if ( el[ scroll ] > 0 ) {
return true;
}
// TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to
// set the scroll
el[ scroll ] = 1;
has = ( el[ scroll ] > 0 );
el[ scroll ] = 0;
return has;
},
_create: function() {
var n, i, handle, axis, hname,
that = this,
o = this.options;
this.element.addClass("ui-resizable");
$.extend(this, {
_aspectRatio: !!(o.aspectRatio),
aspectRatio: o.aspectRatio,
originalElement: this.element,
_proportionallyResizeElements: [],
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
});
// Wrap the element if it cannot hold child nodes
if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
this.element.wrap(
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
position: this.element.css("position"),
width: this.element.outerWidth(),
height: this.element.outerHeight(),
top: this.element.css("top"),
left: this.element.css("left")
})
);
this.element = this.element.parent().data(
"ui-resizable", this.element.resizable( "instance" )
);
this.elementIsWrapper = true;
this.element.css({
marginLeft: this.originalElement.css("marginLeft"),
marginTop: this.originalElement.css("marginTop"),
marginRight: this.originalElement.css("marginRight"),
marginBottom: this.originalElement.css("marginBottom")
});
this.originalElement.css({
marginLeft: 0,
marginTop: 0,
marginRight: 0,
marginBottom: 0
});
// support: Safari
// Prevent Safari textarea resize
this.originalResizeStyle = this.originalElement.css("resize");
this.originalElement.css("resize", "none");
this._proportionallyResizeElements.push( this.originalElement.css({
position: "static",
zoom: 1,
display: "block"
}) );
// support: IE9
// avoid IE jump (hard set the margin)
this.originalElement.css({ margin: this.originalElement.css("margin") });
this._proportionallyResize();
}
this.handles = o.handles ||
( !$(".ui-resizable-handle", this.element).length ?
"e,s,se" : {
n: ".ui-resizable-n",
e: ".ui-resizable-e",
s: ".ui-resizable-s",
w: ".ui-resizable-w",
se: ".ui-resizable-se",
sw: ".ui-resizable-sw",
ne: ".ui-resizable-ne",
nw: ".ui-resizable-nw"
} );
this._handles = $();
if ( this.handles.constructor === String ) {
if ( this.handles === "all") {
this.handles = "n,e,s,w,se,sw,ne,nw";
}
n = this.handles.split(",");
this.handles = {};
for (i = 0; i < n.length; i++) {
handle = $.trim(n[i]);
hname = "ui-resizable-" + handle;
axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
axis.css({ zIndex: o.zIndex });
// TODO : What's going on here?
if ("se" === handle) {
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
}
this.handles[handle] = ".ui-resizable-" + handle;
this.element.append(axis);
}
}
this._renderAxis = function(target) {
var i, axis, padPos, padWrapper;
target = target || this.element;
for (i in this.handles) {
if (this.handles[i].constructor === String) {
this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
this.handles[ i ] = $( this.handles[ i ] );
this._on( this.handles[ i ], { "mousedown": that._mouseDown });
}
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
axis = $(this.handles[i], this.element);
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
padPos = [ "padding",
/ne|nw|n/.test(i) ? "Top" :
/se|sw|s/.test(i) ? "Bottom" :
/^e$/.test(i) ? "Right" : "Left" ].join("");
target.css(padPos, padWrapper);
this._proportionallyResize();
}
this._handles = this._handles.add( this.handles[ i ] );
}
};
// TODO: make renderAxis a prototype function
this._renderAxis(this.element);
this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
this._handles.disableSelection();
this._handles.mouseover(function() {
if (!that.resizing) {
if (this.className) {
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
}
that.axis = axis && axis[1] ? axis[1] : "se";
}
});
if (o.autoHide) {
this._handles.hide();
$(this.element)
.addClass("ui-resizable-autohide")
.mouseenter(function() {
if (o.disabled) {
return;
}
$(this).removeClass("ui-resizable-autohide");
that._handles.show();
})
.mouseleave(function() {
if (o.disabled) {
return;
}
if (!that.resizing) {
$(this).addClass("ui-resizable-autohide");
that._handles.hide();
}
});
}
this._mouseInit();
},
_destroy: function() {
this._mouseDestroy();
var wrapper,
_destroy = function(exp) {
$(exp)
.removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
.removeData("resizable")
.removeData("ui-resizable")
.unbind(".resizable")
.find(".ui-resizable-handle")
.remove();
};
// TODO: Unwrap at same DOM position
if (this.elementIsWrapper) {
_destroy(this.element);
wrapper = this.element;
this.originalElement.css({
position: wrapper.css("position"),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
top: wrapper.css("top"),
left: wrapper.css("left")
}).insertAfter( wrapper );
wrapper.remove();
}
this.originalElement.css("resize", this.originalResizeStyle);
_destroy(this.originalElement);
return this;
},
_mouseCapture: function(event) {
var i, handle,
capture = false;
for (i in this.handles) {
handle = $(this.handles[i])[0];
if (handle === event.target || $.contains(handle, event.target)) {
capture = true;
}
}
return !this.options.disabled && capture;
},
_mouseStart: function(event) {
var curleft, curtop, cursor,
o = this.options,
el = this.element;
this.resizing = true;
this._renderProxy();
curleft = this._num(this.helper.css("left"));
curtop = this._num(this.helper.css("top"));
if (o.containment) {
curleft += $(o.containment).scrollLeft() || 0;
curtop += $(o.containment).scrollTop() || 0;
}
this.offset = this.helper.offset();
this.position = { left: curleft, top: curtop };
this.size = this._helper ? {
width: this.helper.width(),
height: this.helper.height()
} : {
width: el.width(),
height: el.height()
};
this.originalSize = this._helper ? {
width: el.outerWidth(),
height: el.outerHeight()
} : {
width: el.width(),
height: el.height()
};
this.sizeDiff = {
width: el.outerWidth() - el.width(),
height: el.outerHeight() - el.height()
};
this.originalPosition = { left: curleft, top: curtop };
this.originalMousePosition = { left: event.pageX, top: event.pageY };
this.aspectRatio = (typeof o.aspectRatio === "number") ?
o.aspectRatio :
((this.originalSize.width / this.originalSize.height) || 1);
cursor = $(".ui-resizable-" + this.axis).css("cursor");
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
el.addClass("ui-resizable-resizing");
this._propagate("start", event);
return true;
},
_mouseDrag: function(event) {
var data, props,
smp = this.originalMousePosition,
a = this.axis,
dx = (event.pageX - smp.left) || 0,
dy = (event.pageY - smp.top) || 0,
trigger = this._change[a];
this._updatePrevProperties();
if (!trigger) {
return false;
}
data = trigger.apply(this, [ event, dx, dy ]);
this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey) {
data = this._updateRatio(data, event);
}
data = this._respectSize(data, event);
this._updateCache(data);
this._propagate("resize", event);
props = this._applyChanges();
if ( !this._helper && this._proportionallyResizeElements.length ) {
this._proportionallyResize();
}
if ( !$.isEmptyObject( props ) ) {
this._updatePrevProperties();
this._trigger( "resize", event, this.ui() );
this._applyChanges();
}
return false;
},
_mouseStop: function(event) {
this.resizing = false;
var pr, ista, soffseth, soffsetw, s, left, top,
o = this.options, that = this;
if (this._helper) {
pr = this._proportionallyResizeElements;
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
soffsetw = ista ? 0 : that.sizeDiff.width;
s = {
width: (that.helper.width() - soffsetw),
height: (that.helper.height() - soffseth)
};
left = (parseInt(that.element.css("left"), 10) +
(that.position.left - that.originalPosition.left)) || null;
top = (parseInt(that.element.css("top"), 10) +
(that.position.top - that.originalPosition.top)) || null;
if (!o.animate) {
this.element.css($.extend(s, { top: top, left: left }));
}
that.helper.height(that.size.height);
that.helper.width(that.size.width);
if (this._helper && !o.animate) {
this._proportionallyResize();
}
}
$("body").css("cursor", "auto");
this.element.removeClass("ui-resizable-resizing");
this._propagate("stop", event);
if (this._helper) {
this.helper.remove();
}
return false;
},
_updatePrevProperties: function() {
this.prevPosition = {
top: this.position.top,
left: this.position.left
};
this.prevSize = {
width: this.size.width,
height: this.size.height
};
},
_applyChanges: function() {
var props = {};
if ( this.position.top !== this.prevPosition.top ) {
props.top = this.position.top + "px";
}
if ( this.position.left !== this.prevPosition.left ) {
props.left = this.position.left + "px";
}
if ( this.size.width !== this.prevSize.width ) {
props.width = this.size.width + "px";
}
if ( this.size.height !== this.prevSize.height ) {
props.height = this.size.height + "px";
}
this.helper.css( props );
return props;
},
_updateVirtualBoundaries: function(forceAspectRatio) {
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
o = this.options;
b = {
minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
};
if (this._aspectRatio || forceAspectRatio) {
pMinWidth = b.minHeight * this.aspectRatio;
pMinHeight = b.minWidth / this.aspectRatio;
pMaxWidth = b.maxHeight * this.aspectRatio;
pMaxHeight = b.maxWidth / this.aspectRatio;
if (pMinWidth > b.minWidth) {
b.minWidth = pMinWidth;
}
if (pMinHeight > b.minHeight) {
b.minHeight = pMinHeight;
}
if (pMaxWidth < b.maxWidth) {
b.maxWidth = pMaxWidth;
}
if (pMaxHeight < b.maxHeight) {
b.maxHeight = pMaxHeight;
}
}
this._vBoundaries = b;
},
_updateCache: function(data) {
this.offset = this.helper.offset();
if (this._isNumber(data.left)) {
this.position.left = data.left;
}
if (this._isNumber(data.top)) {
this.position.top = data.top;
}
if (this._isNumber(data.height)) {
this.size.height = data.height;
}
if (this._isNumber(data.width)) {
this.size.width = data.width;
}
},
_updateRatio: function( data ) {
var cpos = this.position,
csize = this.size,
a = this.axis;
if (this._isNumber(data.height)) {
data.width = (data.height * this.aspectRatio);
} else if (this._isNumber(data.width)) {
data.height = (data.width / this.aspectRatio);
}
if (a === "sw") {
data.left = cpos.left + (csize.width - data.width);
data.top = null;
}
if (a === "nw") {
data.top = cpos.top + (csize.height - data.height);
data.left = cpos.left + (csize.width - data.width);
}
return data;
},
_respectSize: function( data ) {
var o = this._vBoundaries,
a = this.axis,
ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
dw = this.originalPosition.left + this.originalSize.width,
dh = this.position.top + this.size.height,
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
if (isminw) {
data.width = o.minWidth;
}
if (isminh) {
data.height = o.minHeight;
}
if (ismaxw) {
data.width = o.maxWidth;
}
if (ismaxh) {
data.height = o.maxHeight;
}
if (isminw && cw) {
data.left = dw - o.minWidth;
}
if (ismaxw && cw) {
data.left = dw - o.maxWidth;
}
if (isminh && ch) {
data.top = dh - o.minHeight;
}
if (ismaxh && ch) {
data.top = dh - o.maxHeight;
}
// Fixing jump error on top/left - bug #2330
if (!data.width && !data.height && !data.left && data.top) {
data.top = null;
} else if (!data.width && !data.height && !data.top && data.left) {
data.left = null;
}
return data;
},
_getPaddingPlusBorderDimensions: function( element ) {
var i = 0,
widths = [],
borders = [
element.css( "borderTopWidth" ),
element.css( "borderRightWidth" ),
element.css( "borderBottomWidth" ),
element.css( "borderLeftWidth" )
],
paddings = [
element.css( "paddingTop" ),
element.css( "paddingRight" ),
element.css( "paddingBottom" ),
element.css( "paddingLeft" )
];
for ( ; i < 4; i++ ) {
widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
}
return {
height: widths[ 0 ] + widths[ 2 ],
width: widths[ 1 ] + widths[ 3 ]
};
},
_proportionallyResize: function() {
if (!this._proportionallyResizeElements.length) {
return;
}
var prel,
i = 0,
element = this.helper || this.element;
for ( ; i < this._proportionallyResizeElements.length; i++) {
prel = this._proportionallyResizeElements[i];
// TODO: Seems like a bug to cache this.outerDimensions
// considering that we are in a loop.
if (!this.outerDimensions) {
this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
}
prel.css({
height: (element.height() - this.outerDimensions.height) || 0,
width: (element.width() - this.outerDimensions.width) || 0
});
}
},
_renderProxy: function() {
var el = this.element, o = this.options;
this.elementOffset = el.offset();
if (this._helper) {
this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
this.helper.addClass(this._helper).css({
width: this.element.outerWidth() - 1,
height: this.element.outerHeight() - 1,
position: "absolute",
left: this.elementOffset.left + "px",
top: this.elementOffset.top + "px",
zIndex: ++o.zIndex //TODO: Don't modify option
});
this.helper
.appendTo("body")
.disableSelection();
} else {
this.helper = this.element;
}
},
_change: {
e: function(event, dx) {
return { width: this.originalSize.width + dx };
},
w: function(event, dx) {
var cs = this.originalSize, sp = this.originalPosition;
return { left: sp.left + dx, width: cs.width - dx };
},
n: function(event, dx, dy) {
var cs = this.originalSize, sp = this.originalPosition;
return { top: sp.top + dy, height: cs.height - dy };
},
s: function(event, dx, dy) {
return { height: this.originalSize.height + dy };
},
se: function(event, dx, dy) {
return $.extend(this._change.s.apply(this, arguments),
this._change.e.apply(this, [ event, dx, dy ]));
},
sw: function(event, dx, dy) {
return $.extend(this._change.s.apply(this, arguments),
this._change.w.apply(this, [ event, dx, dy ]));
},
ne: function(event, dx, dy) {
return $.extend(this._change.n.apply(this, arguments),
this._change.e.apply(this, [ event, dx, dy ]));
},
nw: function(event, dx, dy) {
return $.extend(this._change.n.apply(this, arguments),
this._change.w.apply(this, [ event, dx, dy ]));
}
},
_propagate: function(n, event) {
$.ui.plugin.call(this, n, [ event, this.ui() ]);
(n !== "resize" && this._trigger(n, event, this.ui()));
},
plugins: {},
ui: function() {
return {
originalElement: this.originalElement,
element: this.element,
helper: this.helper,
position: this.position,
size: this.size,
originalSize: this.originalSize,
originalPosition: this.originalPosition
};
}
});
/*
* Resizable Extensions
*/
$.ui.plugin.add("resizable", "animate", {
stop: function( event ) {
var that = $(this).resizable( "instance" ),
o = that.options,
pr = that._proportionallyResizeElements,
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
soffsetw = ista ? 0 : that.sizeDiff.width,
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
left = (parseInt(that.element.css("left"), 10) +
(that.position.left - that.originalPosition.left)) || null,
top = (parseInt(that.element.css("top"), 10) +
(that.position.top - that.originalPosition.top)) || null;
that.element.animate(
$.extend(style, top && left ? { top: top, left: left } : {}), {
duration: o.animateDuration,
easing: o.animateEasing,
step: function() {
var data = {
width: parseInt(that.element.css("width"), 10),
height: parseInt(that.element.css("height"), 10),
top: parseInt(that.element.css("top"), 10),
left: parseInt(that.element.css("left"), 10)
};
if (pr && pr.length) {
$(pr[0]).css({ width: data.width, height: data.height });
}
// propagating resize, and updating values for each animation step
that._updateCache(data);
that._propagate("resize", event);
}
}
);
}
});
$.ui.plugin.add( "resizable", "containment", {
start: function() {
var element, p, co, ch, cw, width, height,
that = $( this ).resizable( "instance" ),
o = that.options,
el = that.element,
oc = o.containment,
ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
if ( !ce ) {
return;
}
that.containerElement = $( ce );
if ( /document/.test( oc ) || oc === document ) {
that.containerOffset = {
left: 0,
top: 0
};
that.containerPosition = {
left: 0,
top: 0
};
that.parentData = {
element: $( document ),
left: 0,
top: 0,
width: $( document ).width(),
height: $( document ).height() || document.body.parentNode.scrollHeight
};
} else {
element = $( ce );
p = [];
$([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
p[ i ] = that._num( element.css( "padding" + name ) );
});
that.containerOffset = element.offset();
that.containerPosition = element.position();
that.containerSize = {
height: ( element.innerHeight() - p[ 3 ] ),
width: ( element.innerWidth() - p[ 1 ] )
};
co = that.containerOffset;
ch = that.containerSize.height;
cw = that.containerSize.width;
width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
that.parentData = {
element: ce,
left: co.left,
top: co.top,
width: width,
height: height
};
}
},
resize: function( event ) {
var woset, hoset, isParent, isOffsetRelative,
that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset,
cp = that.position,
pRatio = that._aspectRatio || event.shiftKey,
cop = {
top: 0,
left: 0
},
ce = that.containerElement,
continueResize = true;
if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
cop = co;
}
if ( cp.left < ( that._helper ? co.left : 0 ) ) {
that.size.width = that.size.width +
( that._helper ?
( that.position.left - co.left ) :
( that.position.left - cop.left ) );
if ( pRatio ) {
that.size.height = that.size.width / that.aspectRatio;
continueResize = false;
}
that.position.left = o.helper ? co.left : 0;
}
if ( cp.top < ( that._helper ? co.top : 0 ) ) {
that.size.height = that.size.height +
( that._helper ?
( that.position.top - co.top ) :
that.position.top );
if ( pRatio ) {
that.size.width = that.size.height * that.aspectRatio;
continueResize = false;
}
that.position.top = that._helper ? co.top : 0;
}
isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
if ( isParent && isOffsetRelative ) {
that.offset.left = that.parentData.left + that.position.left;
that.offset.top = that.parentData.top + that.position.top;
} else {
that.offset.left = that.element.offset().left;
that.offset.top = that.element.offset().top;
}
woset = Math.abs( that.sizeDiff.width +
(that._helper ?
that.offset.left - cop.left :
(that.offset.left - co.left)) );
hoset = Math.abs( that.sizeDiff.height +
(that._helper ?
that.offset.top - cop.top :
(that.offset.top - co.top)) );
if ( woset + that.size.width >= that.parentData.width ) {
that.size.width = that.parentData.width - woset;
if ( pRatio ) {
that.size.height = that.size.width / that.aspectRatio;
continueResize = false;
}
}
if ( hoset + that.size.height >= that.parentData.height ) {
that.size.height = that.parentData.height - hoset;
if ( pRatio ) {
that.size.width = that.size.height * that.aspectRatio;
continueResize = false;
}
}
if ( !continueResize ) {
that.position.left = that.prevPosition.left;
that.position.top = that.prevPosition.top;
that.size.width = that.prevSize.width;
that.size.height = that.prevSize.height;
}
},
stop: function() {
var that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset,
cop = that.containerPosition,
ce = that.containerElement,
helper = $( that.helper ),
ho = helper.offset(),
w = helper.outerWidth() - that.sizeDiff.width,
h = helper.outerHeight() - that.sizeDiff.height;
if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
$( this ).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}
if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
$( this ).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}
}
});
$.ui.plugin.add("resizable", "alsoResize", {
start: function() {
var that = $(this).resizable( "instance" ),
o = that.options;
$(o.alsoResize).each(function() {
var el = $(this);
el.data("ui-resizable-alsoresize", {
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
});
});
},
resize: function(event, ui) {
var that = $(this).resizable( "instance" ),
o = that.options,
os = that.originalSize,
op = that.originalPosition,
delta = {
height: (that.size.height - os.height) || 0,
width: (that.size.width - os.width) || 0,
top: (that.position.top - op.top) || 0,
left: (that.position.left - op.left) || 0
};
$(o.alsoResize).each(function() {
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
css = el.parents(ui.originalElement[0]).length ?
[ "width", "height" ] :
[ "width", "height", "top", "left" ];
$.each(css, function(i, prop) {
var sum = (start[prop] || 0) + (delta[prop] || 0);
if (sum && sum >= 0) {
style[prop] = sum || null;
}
});
el.css(style);
});
},
stop: function() {
$(this).removeData("resizable-alsoresize");
}
});
$.ui.plugin.add("resizable", "ghost", {
start: function() {
var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
that.ghost = that.originalElement.clone();
that.ghost
.css({
opacity: 0.25,
display: "block",
position: "relative",
height: cs.height,
width: cs.width,
margin: 0,
left: 0,
top: 0
})
.addClass("ui-resizable-ghost")
.addClass(typeof o.ghost === "string" ? o.ghost : "");
that.ghost.appendTo(that.helper);
},
resize: function() {
var that = $(this).resizable( "instance" );
if (that.ghost) {
that.ghost.css({
position: "relative",
height: that.size.height,
width: that.size.width
});
}
},
stop: function() {
var that = $(this).resizable( "instance" );
if (that.ghost && that.helper) {
that.helper.get(0).removeChild(that.ghost.get(0));
}
}
});
$.ui.plugin.add("resizable", "grid", {
resize: function() {
var outerDimensions,
that = $(this).resizable( "instance" ),
o = that.options,
cs = that.size,
os = that.originalSize,
op = that.originalPosition,
a = that.axis,
grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
gridX = (grid[0] || 1),
gridY = (grid[1] || 1),
ox = Math.round((cs.width - os.width) / gridX) * gridX,
oy = Math.round((cs.height - os.height) / gridY) * gridY,
newWidth = os.width + ox,
newHeight = os.height + oy,
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
isMinWidth = o.minWidth && (o.minWidth > newWidth),
isMinHeight = o.minHeight && (o.minHeight > newHeight);
o.grid = grid;
if (isMinWidth) {
newWidth += gridX;
}
if (isMinHeight) {
newHeight += gridY;
}
if (isMaxWidth) {
newWidth -= gridX;
}
if (isMaxHeight) {
newHeight -= gridY;
}
if (/^(se|s|e)$/.test(a)) {
that.size.width = newWidth;
that.size.height = newHeight;
} else if (/^(ne)$/.test(a)) {
that.size.width = newWidth;
that.size.height = newHeight;
that.position.top = op.top - oy;
} else if (/^(sw)$/.test(a)) {
that.size.width = newWidth;
that.size.height = newHeight;
that.position.left = op.left - ox;
} else {
if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
outerDimensions = that._getPaddingPlusBorderDimensions( this );
}
if ( newHeight - gridY > 0 ) {
that.size.height = newHeight;
that.position.top = op.top - oy;
} else {
newHeight = gridY - outerDimensions.height;
that.size.height = newHeight;
that.position.top = op.top + os.height - newHeight;
}
if ( newWidth - gridX > 0 ) {
that.size.width = newWidth;
that.position.left = op.left - ox;
} else {
newWidth = gridX - outerDimensions.width;
that.size.width = newWidth;
that.position.left = op.left + os.width - newWidth;
}
}
}
});
var resizable = $.ui.resizable;
/*!
* jQuery UI Selectable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/selectable/
*/
var selectable = $.widget("ui.selectable", $.ui.mouse, {
version: "1.11.4",
options: {
appendTo: "body",
autoRefresh: true,
distance: 0,
filter: "*",
tolerance: "touch",
// callbacks
selected: null,
selecting: null,
start: null,
stop: null,
unselected: null,
unselecting: null
},
_create: function() {
var selectees,
that = this;
this.element.addClass("ui-selectable");
this.dragged = false;
// cache selectee children based on filter
this.refresh = function() {
selectees = $(that.options.filter, that.element[0]);
selectees.addClass("ui-selectee");
selectees.each(function() {
var $this = $(this),
pos = $this.offset();
$.data(this, "selectable-item", {
element: this,
$element: $this,
left: pos.left,
top: pos.top,
right: pos.left + $this.outerWidth(),
bottom: pos.top + $this.outerHeight(),
startselected: false,
selected: $this.hasClass("ui-selected"),
selecting: $this.hasClass("ui-selecting"),
unselecting: $this.hasClass("ui-unselecting")
});
});
};
this.refresh();
this.selectees = selectees.addClass("ui-selectee");
this._mouseInit();
this.helper = $("<div class='ui-selectable-helper'></div>");
},
_destroy: function() {
this.selectees
.removeClass("ui-selectee")
.removeData("selectable-item");
this.element
.removeClass("ui-selectable ui-selectable-disabled");
this._mouseDestroy();
},
_mouseStart: function(event) {
var that = this,
options = this.options;
this.opos = [ event.pageX, event.pageY ];
if (this.options.disabled) {
return;
}
this.selectees = $(options.filter, this.element[0]);
this._trigger("start", event);
$(options.appendTo).append(this.helper);
// position helper (lasso)
this.helper.css({
"left": event.pageX,
"top": event.pageY,
"width": 0,
"height": 0
});
if (options.autoRefresh) {
this.refresh();
}
this.selectees.filter(".ui-selected").each(function() {
var selectee = $.data(this, "selectable-item");
selectee.startselected = true;
if (!event.metaKey && !event.ctrlKey) {
selectee.$element.removeClass("ui-selected");
selectee.selected = false;
selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
});
$(event.target).parents().addBack().each(function() {
var doSelect,
selectee = $.data(this, "selectable-item");
if (selectee) {
doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
selectee.unselecting = !doSelect;
selectee.selecting = doSelect;
selectee.selected = doSelect;
// selectable (UN)SELECTING callback
if (doSelect) {
that._trigger("selecting", event, {
selecting: selectee.element
});
} else {
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
return false;
}
});
},
_mouseDrag: function(event) {
this.dragged = true;
if (this.options.disabled) {
return;
}
var tmp,
that = this,
options = this.options,
x1 = this.opos[0],
y1 = this.opos[1],
x2 = event.pageX,
y2 = event.pageY;
if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
this.selectees.each(function() {
var selectee = $.data(this, "selectable-item"),
hit = false;
//prevent helper from being selected if appendTo: selectable
if (!selectee || selectee.element === that.element[0]) {
return;
}
if (options.tolerance === "touch") {
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
} else if (options.tolerance === "fit") {
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
}
if (hit) {
// SELECT
if (selectee.selected) {
selectee.$element.removeClass("ui-selected");
selectee.selected = false;
}
if (selectee.unselecting) {
selectee.$element.removeClass("ui-unselecting");
selectee.unselecting = false;
}
if (!selectee.selecting) {
selectee.$element.addClass("ui-selecting");
selectee.selecting = true;
// selectable SELECTING callback
that._trigger("selecting", event, {
selecting: selectee.element
});
}
} else {
// UNSELECT
if (selectee.selecting) {
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
selectee.$element.removeClass("ui-selecting");
selectee.selecting = false;
selectee.$element.addClass("ui-selected");
selectee.selected = true;
} else {
selectee.$element.removeClass("ui-selecting");
selectee.selecting = false;
if (selectee.startselected) {
selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
}
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
}
if (selectee.selected) {
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
selectee.$element.removeClass("ui-selected");
selectee.selected = false;
selectee.$element.addClass("ui-unselecting");
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
}
}
});
return false;
},
_mouseStop: function(event) {
var that = this;
this.dragged = false;
$(".ui-unselecting", this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass("ui-unselecting");
selectee.unselecting = false;
selectee.startselected = false;
that._trigger("unselected", event, {
unselected: selectee.element
});
});
$(".ui-selecting", this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
selectee.selecting = false;
selectee.selected = true;
selectee.startselected = true;
that._trigger("selected", event, {
selected: selectee.element
});
});
this._trigger("stop", event);
this.helper.remove();
return false;
}
});
/*!
* jQuery UI Sortable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/sortable/
*/
var sortable = $.widget("ui.sortable", $.ui.mouse, {
version: "1.11.4",
widgetEventPrefix: "sort",
ready: false,
options: {
appendTo: "parent",
axis: false,
connectWith: false,
containment: false,
cursor: "auto",
cursorAt: false,
dropOnEmpty: true,
forcePlaceholderSize: false,
forceHelperSize: false,
grid: false,
handle: false,
helper: "original",
items: "> *",
opacity: false,
placeholder: false,
revert: false,
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
scope: "default",
tolerance: "intersect",
zIndex: 1000,
// callbacks
activate: null,
beforeStop: null,
change: null,
deactivate: null,
out: null,
over: null,
receive: null,
remove: null,
sort: null,
start: null,
stop: null,
update: null
},
_isOverAxis: function( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
},
_isFloating: function( item ) {
return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
},
_create: function() {
this.containerCache = {};
this.element.addClass("ui-sortable");
//Get the items
this.refresh();
//Let's determine the parent's offset
this.offset = this.element.offset();
//Initialize mouse events for interaction
this._mouseInit();
this._setHandleClassName();
//We're ready to go
this.ready = true;
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "handle" ) {
this._setHandleClassName();
}
},
_setHandleClassName: function() {
this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
$.each( this.items, function() {
( this.instance.options.handle ?
this.item.find( this.instance.options.handle ) : this.item )
.addClass( "ui-sortable-handle" );
});
},
_destroy: function() {
this.element
.removeClass( "ui-sortable ui-sortable-disabled" )
.find( ".ui-sortable-handle" )
.removeClass( "ui-sortable-handle" );
this._mouseDestroy();
for ( var i = this.items.length - 1; i >= 0; i-- ) {
this.items[i].item.removeData(this.widgetName + "-item");
}
return this;
},
_mouseCapture: function(event, overrideHandle) {
var currentItem = null,
validHandle = false,
that = this;
if (this.reverting) {
return false;
}
if(this.options.disabled || this.options.type === "static") {
return false;
}
//We have to refresh the items data once first
this._refreshItems(event);
//Find out if the clicked node (or one of its parents) is a actual item in this.items
$(event.target).parents().each(function() {
if($.data(this, that.widgetName + "-item") === that) {
currentItem = $(this);
return false;
}
});
if($.data(event.target, that.widgetName + "-item") === that) {
currentItem = $(event.target);
}
if(!currentItem) {
return false;
}
if(this.options.handle && !overrideHandle) {
$(this.options.handle, currentItem).find("*").addBack().each(function() {
if(this === event.target) {
validHandle = true;
}
});
if(!validHandle) {
return false;
}
}
this.currentItem = currentItem;
this._removeCurrentsFromItems();
return true;
},
_mouseStart: function(event, overrideHandle, noActivation) {
var i, body,
o = this.options;
this.currentContainer = this;
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
this.refreshPositions();
//Create and append the visible helper
this.helper = this._createHelper(event);
//Cache the helper size
this._cacheHelperProportions();
/*
* - Position generation -
* This block generates everything position related - it's the core of draggables.
*/
//Cache the margins of the original element
this._cacheMargins();
//Get the next scrolling parent
this.scrollParent = this.helper.scrollParent();
//The element's absolute position on the page minus margins
this.offset = this.currentItem.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
};
$.extend(this.offset, {
click: { //Where the click happened, relative to the element
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
parent: this._getParentOffset(),
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
});
// Only after we got the offset, we can change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css("position", "absolute");
this.cssPosition = this.helper.css("position");
//Generate the original position
this.originalPosition = this._generatePosition(event);
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
//Cache the former DOM position
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
if(this.helper[0] !== this.currentItem[0]) {
this.currentItem.hide();
}
//Create the placeholder
this._createPlaceholder();
//Set a containment if given in the options
if(o.containment) {
this._setContainment();
}
if( o.cursor && o.cursor !== "auto" ) { // cursor option
body = this.document.find( "body" );
// support: IE
this.storedCursor = body.css( "cursor" );
body.css( "cursor", o.cursor );
this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
}
if(o.opacity) { // opacity option
if (this.helper.css("opacity")) {
this._storedOpacity = this.helper.css("opacity");
}
this.helper.css("opacity", o.opacity);
}
if(o.zIndex) { // zIndex option
if (this.helper.css("zIndex")) {
this._storedZIndex = this.helper.css("zIndex");
}
this.helper.css("zIndex", o.zIndex);
}
//Prepare scrolling
if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
this.overflowOffset = this.scrollParent.offset();
}
//Call callbacks
this._trigger("start", event, this._uiHash());
//Recache the helper size
if(!this._preserveHelperProportions) {
this._cacheHelperProportions();
}
//Post "activate" events to possible containers
if( !noActivation ) {
for ( i = this.containers.length - 1; i >= 0; i-- ) {
this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
}
}
//Prepare possible droppables
if($.ui.ddmanager) {
$.ui.ddmanager.current = this;
}
if ($.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(this, event);
}
this.dragging = true;
this.helper.addClass("ui-sortable-helper");
this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
return true;
},
_mouseDrag: function(event) {
var i, item, itemElement, intersection,
o = this.options,
scrolled = false;
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
if (!this.lastPositionAbs) {
this.lastPositionAbs = this.positionAbs;
}
//Do scrolling
if(this.options.scroll) {
if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
}
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
}
} else {
if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
} else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
}
if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
} else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
}
}
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(this, event);
}
}
//Regenerate the absolute position used for position checks
this.positionAbs = this._convertPositionTo("absolute");
//Set the helper position
if(!this.options.axis || this.options.axis !== "y") {
this.helper[0].style.left = this.position.left+"px";
}
if(!this.options.axis || this.options.axis !== "x") {
this.helper[0].style.top = this.position.top+"px";
}
//Rearrange
for (i = this.items.length - 1; i >= 0; i--) {
//Cache variables and intersection, continue if no intersection
item = this.items[i];
itemElement = item.item[0];
intersection = this._intersectsWithPointer(item);
if (!intersection) {
continue;
}
// Only put the placeholder inside the current Container, skip all
// items from other containers. This works because when moving
// an item from one container to another the
// currentContainer is switched before the placeholder is moved.
//
// Without this, moving items in "sub-sortables" can cause
// the placeholder to jitter between the outer and inner container.
if (item.instance !== this.currentContainer) {
continue;
}
// cannot intersect with itself
// no useless actions that have been done before
// no action if the item moved is the parent of the item checked
if (itemElement !== this.currentItem[0] &&
this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
!$.contains(this.placeholder[0], itemElement) &&
(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
) {
this.direction = intersection === 1 ? "down" : "up";
if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
this._rearrange(event, item);
} else {
break;
}
this._trigger("change", event, this._uiHash());
break;
}
}
//Post events to containers
this._contactContainers(event);
//Interconnect with droppables
if($.ui.ddmanager) {
$.ui.ddmanager.drag(this, event);
}
//Call callbacks
this._trigger("sort", event, this._uiHash());
this.lastPositionAbs = this.positionAbs;
return false;
},
_mouseStop: function(event, noPropagation) {
if(!event) {
return;
}
//If we are using droppables, inform the manager about the drop
if ($.ui.ddmanager && !this.options.dropBehaviour) {
$.ui.ddmanager.drop(this, event);
}
if(this.options.revert) {
var that = this,
cur = this.placeholder.offset(),
axis = this.options.axis,
animation = {};
if ( !axis || axis === "x" ) {
animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
}
if ( !axis || axis === "y" ) {
animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
}
this.reverting = true;
$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
that._clear(event);
});
} else {
this._clear(event, noPropagation);
}
return false;
},
cancel: function() {
if(this.dragging) {
this._mouseUp({ target: null });
if(this.options.helper === "original") {
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
} else {
this.currentItem.show();
}
//Post deactivating events to containers
for (var i = this.containers.length - 1; i >= 0; i--){
this.containers[i]._trigger("deactivate", null, this._uiHash(this));
if(this.containers[i].containerCache.over) {
this.containers[i]._trigger("out", null, this._uiHash(this));
this.containers[i].containerCache.over = 0;
}
}
}
if (this.placeholder) {
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
if(this.placeholder[0].parentNode) {
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
}
if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
this.helper.remove();
}
$.extend(this, {
helper: null,
dragging: false,
reverting: false,
_noFinalSort: null
});
if(this.domPosition.prev) {
$(this.domPosition.prev).after(this.currentItem);
} else {
$(this.domPosition.parent).prepend(this.currentItem);
}
}
return this;
},
serialize: function(o) {
var items = this._getItemsAsjQuery(o && o.connected),
str = [];
o = o || {};
$(items).each(function() {
var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
if (res) {
str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
}
});
if(!str.length && o.key) {
str.push(o.key + "=");
}
return str.join("&");
},
toArray: function(o) {
var items = this._getItemsAsjQuery(o && o.connected),
ret = [];
o = o || {};
items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
return ret;
},
/* Be careful with the following core functions */
_intersectsWith: function(item) {
var x1 = this.positionAbs.left,
x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top,
y2 = y1 + this.helperProportions.height,
l = item.left,
r = l + item.width,
t = item.top,
b = t + item.height,
dyClick = this.offset.click.top,
dxClick = this.offset.click.left,
isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
isOverElement = isOverElementHeight && isOverElementWidth;
if ( this.options.tolerance === "pointer" ||
this.options.forcePointerForContainers ||
(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
) {
return isOverElement;
} else {
return (l < x1 + (this.helperProportions.width / 2) && // Right Half
x2 - (this.helperProportions.width / 2) < r && // Left Half
t < y1 + (this.helperProportions.height / 2) && // Bottom Half
y2 - (this.helperProportions.height / 2) < b ); // Top Half
}
},
_intersectsWithPointer: function(item) {
var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
isOverElement = isOverElementHeight && isOverElementWidth,
verticalDirection = this._getDragVerticalDirection(),
horizontalDirection = this._getDragHorizontalDirection();
if (!isOverElement) {
return false;
}
return this.floating ?
( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
},
_intersectsWithSides: function(item) {
var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
verticalDirection = this._getDragVerticalDirection(),
horizontalDirection = this._getDragHorizontalDirection();
if (this.floating && horizontalDirection) {
return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
} else {
return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
}
},
_getDragVerticalDirection: function() {
var delta = this.positionAbs.top - this.lastPositionAbs.top;
return delta !== 0 && (delta > 0 ? "down" : "up");
},
_getDragHorizontalDirection: function() {
var delta = this.positionAbs.left - this.lastPositionAbs.left;
return delta !== 0 && (delta > 0 ? "right" : "left");
},
refresh: function(event) {
this._refreshItems(event);
this._setHandleClassName();
this.refreshPositions();
return this;
},
_connectWith: function() {
var options = this.options;
return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
},
_getItemsAsjQuery: function(connected) {
var i, j, cur, inst,
items = [],
queries = [],
connectWith = this._connectWith();
if(connectWith && connected) {
for (i = connectWith.length - 1; i >= 0; i--){
cur = $(connectWith[i], this.document[0]);
for ( j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
}
}
}
}
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
function addItems() {
items.push( this );
}
for (i = queries.length - 1; i >= 0; i--){
queries[i][0].each( addItems );
}
return $(items);
},
_removeCurrentsFromItems: function() {
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
this.items = $.grep(this.items, function (item) {
for (var j=0; j < list.length; j++) {
if(list[j] === item.item[0]) {
return false;
}
}
return true;
});
},
_refreshItems: function(event) {
this.items = [];
this.containers = [this];
var i, j, cur, inst, targetData, _queries, item, queriesLength,
items = this.items,
queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
connectWith = this._connectWith();
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
for (i = connectWith.length - 1; i >= 0; i--){
cur = $(connectWith[i], this.document[0]);
for (j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
}
}
}
for (i = queries.length - 1; i >= 0; i--) {
targetData = queries[i][1];
_queries = queries[i][0];
for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
item = $(_queries[j]);
item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
items.push({
item: item,
instance: targetData,
width: 0, height: 0,
left: 0, top: 0
});
}
}
},
refreshPositions: function(fast) {
// Determine whether items are being displayed horizontally
this.floating = this.items.length ?
this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
false;
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
if(this.offsetParent && this.helper) {
this.offset.parent = this._getParentOffset();
}
var i, item, t, p;
for (i = this.items.length - 1; i >= 0; i--){
item = this.items[i];
//We ignore calculating positions of all connected containers when we're not over them
if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
continue;
}
t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
if (!fast) {
item.width = t.outerWidth();
item.height = t.outerHeight();
}
p = t.offset();
item.left = p.left;
item.top = p.top;
}
if(this.options.custom && this.options.custom.refreshContainers) {
this.options.custom.refreshContainers.call(this);
} else {
for (i = this.containers.length - 1; i >= 0; i--){
p = this.containers[i].element.offset();
this.containers[i].containerCache.left = p.left;
this.containers[i].containerCache.top = p.top;
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
}
}
return this;
},
_createPlaceholder: function(that) {
that = that || this;
var className,
o = that.options;
if(!o.placeholder || o.placeholder.constructor === String) {
className = o.placeholder;
o.placeholder = {
element: function() {
var nodeName = that.currentItem[0].nodeName.toLowerCase(),
element = $( "<" + nodeName + ">", that.document[0] )
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper");
if ( nodeName === "tbody" ) {
that._createTrPlaceholder(
that.currentItem.find( "tr" ).eq( 0 ),
$( "<tr>", that.document[ 0 ] ).appendTo( element )
);
} else if ( nodeName === "tr" ) {
that._createTrPlaceholder( that.currentItem, element );
} else if ( nodeName === "img" ) {
element.attr( "src", that.currentItem.attr( "src" ) );
}
if ( !className ) {
element.css( "visibility", "hidden" );
}
return element;
},
update: function(container, p) {
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
if(className && !o.forcePlaceholderSize) {
return;
}
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
}
};
}
//Create the placeholder
that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
//Append it after the actual current item
that.currentItem.after(that.placeholder);
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
o.placeholder.update(that, that.placeholder);
},
_createTrPlaceholder: function( sourceTr, targetTr ) {
var that = this;
sourceTr.children().each(function() {
$( "<td> </td>", that.document[ 0 ] )
.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
.appendTo( targetTr );
});
},
_contactContainers: function(event) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
innermostContainer = null,
innermostIndex = null;
// get innermost container that intersects with item
for (i = this.containers.length - 1; i >= 0; i--) {
// never consider a container that's located within the item itself
if($.contains(this.currentItem[0], this.containers[i].element[0])) {
continue;
}
if(this._intersectsWith(this.containers[i].containerCache)) {
// if we've already found a container and it's more "inner" than this, then continue
if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
continue;
}
innermostContainer = this.containers[i];
innermostIndex = i;
} else {
// container doesn't intersect. trigger "out" event if necessary
if(this.containers[i].containerCache.over) {
this.containers[i]._trigger("out", event, this._uiHash(this));
this.containers[i].containerCache.over = 0;
}
}
}
// if no intersecting containers found, return
if(!innermostContainer) {
return;
}
// move the item into the container if it's not there already
if(this.containers.length === 1) {
if (!this.containers[innermostIndex].containerCache.over) {
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
this.containers[innermostIndex].containerCache.over = 1;
}
} else {
//When entering a new container, we will find the item with the least distance and append our item near it
dist = 10000;
itemWithLeastDistance = null;
floating = innermostContainer.floating || this._isFloating(this.currentItem);
posProperty = floating ? "left" : "top";
sizeProperty = floating ? "width" : "height";
axis = floating ? "clientX" : "clientY";
for (j = this.items.length - 1; j >= 0; j--) {
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
continue;
}
if(this.items[j].item[0] === this.currentItem[0]) {
continue;
}
cur = this.items[j].item.offset()[posProperty];
nearBottom = false;
if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
nearBottom = true;
}
if ( Math.abs( event[ axis ] - cur ) < dist ) {
dist = Math.abs( event[ axis ] - cur );
itemWithLeastDistance = this.items[ j ];
this.direction = nearBottom ? "up": "down";
}
}
//Check if dropOnEmpty is enabled
if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
return;
}
if(this.currentContainer === this.containers[innermostIndex]) {
if ( !this.currentContainer.containerCache.over ) {
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
this.currentContainer.containerCache.over = 1;
}
return;
}
itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
this._trigger("change", event, this._uiHash());
this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
this.currentContainer = this.containers[innermostIndex];
//Update the placeholder
this.options.placeholder.update(this.currentContainer, this.placeholder);
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
this.containers[innermostIndex].containerCache.over = 1;
}
},
_createHelper: function(event) {
var o = this.options,
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
//Add the helper to the DOM if that didn't happen already
if(!helper.parents("body").length) {
$(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
}
if(helper[0] === this.currentItem[0]) {
this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
}
if(!helper[0].style.width || o.forceHelperSize) {
helper.width(this.currentItem.width());
}
if(!helper[0].style.height || o.forceHelperSize) {
helper.height(this.currentItem.height());
}
return helper;
},
_adjustOffsetFromHelper: function(obj) {
if (typeof obj === "string") {
obj = obj.split(" ");
}
if ($.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ("left" in obj) {
this.offset.click.left = obj.left + this.margins.left;
}
if ("right" in obj) {
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
}
if ("top" in obj) {
this.offset.click.top = obj.top + this.margins.top;
}
if ("bottom" in obj) {
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
}
},
_getParentOffset: function() {
//Get the offsetParent and cache its position
this.offsetParent = this.helper.offsetParent();
var po = this.offsetParent.offset();
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
// This needs to be actually done for all browsers, since pageX/pageY includes this information
// with an ugly IE fix
if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
po = { top: 0, left: 0 };
}
return {
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
};
},
_getRelativeOffset: function() {
if(this.cssPosition === "relative") {
var p = this.currentItem.position();
return {
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
};
} else {
return { top: 0, left: 0 };
}
},
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var ce, co, over,
o = this.options;
if(o.containment === "parent") {
o.containment = this.helper[0].parentNode;
}
if(o.containment === "document" || o.containment === "window") {
this.containment = [
0 - this.offset.relative.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top,
o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
(o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
}
if(!(/^(document|window|parent)$/).test(o.containment)) {
ce = $(o.containment)[0];
co = $(o.containment).offset();
over = ($(ce).css("overflow") !== "hidden");
this.containment = [
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
];
}
},
_convertPositionTo: function(d, pos) {
if(!pos) {
pos = this.position;
}
var mod = d === "absolute" ? 1 : -1,
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
top: (
pos.top + // The absolute mouse position
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
),
left: (
pos.left + // The absolute mouse position
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
)
};
},
_generatePosition: function(event) {
var top, left,
o = this.options,
pageX = event.pageX,
pageY = event.pageY,
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
// This is another very weird special case that only happens for relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset parent
// we have to refresh the relative offset during the scroll so there are no jumps
if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
this.offset.relative = this._getRelativeOffset();
}
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
if(this.containment) {
if(event.pageX - this.offset.click.left < this.containment[0]) {
pageX = this.containment[0] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top < this.containment[1]) {
pageY = this.containment[1] + this.offset.click.top;
}
if(event.pageX - this.offset.click.left > this.containment[2]) {
pageX = this.containment[2] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top > this.containment[3]) {
pageY = this.containment[3] + this.offset.click.top;
}
}
if(o.grid) {
top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}
}
return {
top: (
pageY - // The absolute mouse position
this.offset.click.top - // Click offset (relative to the element)
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
),
left: (
pageX - // The absolute mouse position
this.offset.click.left - // Click offset (relative to the element)
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
)
};
},
_rearrange: function(event, i, a, hardRefresh) {
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
//Various things done here to improve the performance:
// 1. we create a setTimeout, that calls refreshPositions
// 2. on the instance, we have a counter variable, that get's higher after every append
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
// 4. this lets only the last addition to the timeout stack through
this.counter = this.counter ? ++this.counter : 1;
var counter = this.counter;
this._delay(function() {
if(counter === this.counter) {
this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
}
});
},
_clear: function(event, noPropagation) {
this.reverting = false;
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
// everything else normalized again
var i,
delayedTriggers = [];
// We first have to update the dom position of the actual currentItem
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
if(!this._noFinalSort && this.currentItem.parent().length) {
this.placeholder.before(this.currentItem);
}
this._noFinalSort = null;
if(this.helper[0] === this.currentItem[0]) {
for(i in this._storedCSS) {
if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
this._storedCSS[i] = "";
}
}
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
} else {
this.currentItem.show();
}
if(this.fromOutside && !noPropagation) {
delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
}
if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
}
// Check if the items Container has Changed and trigger appropriate
// events.
if (this !== this.currentContainer) {
if(!noPropagation) {
delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
}
}
//Post events to containers
function delayEvent( type, instance, container ) {
return function( event ) {
container._trigger( type, event, instance._uiHash( instance ) );
};
}
for (i = this.containers.length - 1; i >= 0; i--){
if (!noPropagation) {
delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
}
if(this.containers[i].containerCache.over) {
delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
this.containers[i].containerCache.over = 0;
}
}
//Do what was originally in plugins
if ( this.storedCursor ) {
this.document.find( "body" ).css( "cursor", this.storedCursor );
this.storedStylesheet.remove();
}
if(this._storedOpacity) {
this.helper.css("opacity", this._storedOpacity);
}
if(this._storedZIndex) {
this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
}
this.dragging = false;
if(!noPropagation) {
this._trigger("beforeStop", event, this._uiHash());
}
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
if ( !this.cancelHelperRemoval ) {
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
this.helper.remove();
}
this.helper = null;
}
if(!noPropagation) {
for (i=0; i < delayedTriggers.length; i++) {
delayedTriggers[i].call(this, event);
} //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
}
this.fromOutside = false;
return !this.cancelHelperRemoval;
},
_trigger: function() {
if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
this.cancel();
}
},
_uiHash: function(_inst) {
var inst = _inst || this;
return {
helper: inst.helper,
placeholder: inst.placeholder || $([]),
position: inst.position,
originalPosition: inst.originalPosition,
offset: inst.positionAbs,
item: inst.currentItem,
sender: _inst ? _inst.element : null
};
}
});
/*!
* jQuery UI Accordion 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/accordion/
*/
var accordion = $.widget( "ui.accordion", {
version: "1.11.4",
options: {
active: 0,
animate: {},
collapsible: false,
event: "click",
header: "> li > :first-child,> :not(li):even",
heightStyle: "auto",
icons: {
activeHeader: "ui-icon-triangle-1-s",
header: "ui-icon-triangle-1-e"
},
// callbacks
activate: null,
beforeActivate: null
},
hideProps: {
borderTopWidth: "hide",
borderBottomWidth: "hide",
paddingTop: "hide",
paddingBottom: "hide",
height: "hide"
},
showProps: {
borderTopWidth: "show",
borderBottomWidth: "show",
paddingTop: "show",
paddingBottom: "show",
height: "show"
},
_create: function() {
var options = this.options;
this.prevShow = this.prevHide = $();
this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
// ARIA
.attr( "role", "tablist" );
// don't allow collapsible: false and active: false / null
if ( !options.collapsible && (options.active === false || options.active == null) ) {
options.active = 0;
}
this._processPanels();
// handle negative values
if ( options.active < 0 ) {
options.active += this.headers.length;
}
this._refresh();
},
_getCreateEventData: function() {
return {
header: this.active,
panel: !this.active.length ? $() : this.active.next()
};
},
_createIcons: function() {
var icons = this.options.icons;
if ( icons ) {
$( "<span>" )
.addClass( "ui-accordion-header-icon ui-icon " + icons.header )
.prependTo( this.headers );
this.active.children( ".ui-accordion-header-icon" )
.removeClass( icons.header )
.addClass( icons.activeHeader );
this.headers.addClass( "ui-accordion-icons" );
}
},
_destroyIcons: function() {
this.headers
.removeClass( "ui-accordion-icons" )
.children( ".ui-accordion-header-icon" )
.remove();
},
_destroy: function() {
var contents;
// clean up main element
this.element
.removeClass( "ui-accordion ui-widget ui-helper-reset" )
.removeAttr( "role" );
// clean up headers
this.headers
.removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-controls" )
.removeAttr( "tabIndex" )
.removeUniqueId();
this._destroyIcons();
// clean up content panels
contents = this.headers.next()
.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
.css( "display", "" )
.removeAttr( "role" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-labelledby" )
.removeUniqueId();
if ( this.options.heightStyle !== "content" ) {
contents.css( "height", "" );
}
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
if ( key === "event" ) {
if ( this.options.event ) {
this._off( this.headers, this.options.event );
}
this._setupEvents( value );
}
this._super( key, value );
// setting collapsible: false while collapsed; open first panel
if ( key === "collapsible" && !value && this.options.active === false ) {
this._activate( 0 );
}
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
this._createIcons();
}
}
// #5332 - opacity doesn't cascade to positioned elements in IE
// so we need to add the disabled class to the headers and panels
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
this.headers.add( this.headers.next() )
.toggleClass( "ui-state-disabled", !!value );
}
},
_keydown: function( event ) {
if ( event.altKey || event.ctrlKey ) {
return;
}
var keyCode = $.ui.keyCode,
length = this.headers.length,
currentIndex = this.headers.index( event.target ),
toFocus = false;
switch ( event.keyCode ) {
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
break;
case keyCode.HOME:
toFocus = this.headers[ 0 ];
break;
case keyCode.END:
toFocus = this.headers[ length - 1 ];
break;
}
if ( toFocus ) {
$( event.target ).attr( "tabIndex", -1 );
$( toFocus ).attr( "tabIndex", 0 );
toFocus.focus();
event.preventDefault();
}
},
_panelKeyDown: function( event ) {
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
$( event.currentTarget ).prev().focus();
}
},
refresh: function() {
var options = this.options;
this._processPanels();
// was collapsed or no panel
if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
options.active = false;
this.active = $();
// active false only when collapsible is true
} else if ( options.active === false ) {
this._activate( 0 );
// was active, but active panel is gone
} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
// all remaining panel are disabled
if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
options.active = false;
this.active = $();
// activate previous panel
} else {
this._activate( Math.max( 0, options.active - 1 ) );
}
// was active, active panel still exists
} else {
// make sure active index is correct
options.active = this.headers.index( this.active );
}
this._destroyIcons();
this._refresh();
},
_processPanels: function() {
var prevHeaders = this.headers,
prevPanels = this.panels;
this.headers = this.element.find( this.options.header )
.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
this.panels = this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.filter( ":not(.ui-accordion-content-active)" )
.hide();
// Avoid memory leaks (#10056)
if ( prevPanels ) {
this._off( prevHeaders.not( this.headers ) );
this._off( prevPanels.not( this.panels ) );
}
},
_refresh: function() {
var maxHeight,
options = this.options,
heightStyle = options.heightStyle,
parent = this.element.parent();
this.active = this._findActive( options.active )
.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
.removeClass( "ui-corner-all" );
this.active.next()
.addClass( "ui-accordion-content-active" )
.show();
this.headers
.attr( "role", "tab" )
.each(function() {
var header = $( this ),
headerId = header.uniqueId().attr( "id" ),
panel = header.next(),
panelId = panel.uniqueId().attr( "id" );
header.attr( "aria-controls", panelId );
panel.attr( "aria-labelledby", headerId );
})
.next()
.attr( "role", "tabpanel" );
this.headers
.not( this.active )
.attr({
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
})
.next()
.attr({
"aria-hidden": "true"
})
.hide();
// make sure at least one header is in the tab order
if ( !this.active.length ) {
this.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
})
.next()
.attr({
"aria-hidden": "false"
});
}
this._createIcons();
this._setupEvents( options.event );
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
return;
}
maxHeight -= elem.outerHeight( true );
});
this.headers.each(function() {
maxHeight -= $( this ).outerHeight( true );
});
this.headers.next()
.each(function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.headers.next()
.each(function() {
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
})
.height( maxHeight );
}
},
_activate: function( index ) {
var active = this._findActive( index )[ 0 ];
// trying to activate the already active panel
if ( active === this.active[ 0 ] ) {
return;
}
// trying to collapse, simulate a click on the currently active header
active = active || this.active[ 0 ];
this._eventHandler({
target: active,
currentTarget: active,
preventDefault: $.noop
});
},
_findActive: function( selector ) {
return typeof selector === "number" ? this.headers.eq( selector ) : $();
},
_setupEvents: function( event ) {
var events = {
keydown: "_keydown"
};
if ( event ) {
$.each( event.split( " " ), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
this._off( this.headers.add( this.headers.next() ) );
this._on( this.headers, events );
this._on( this.headers.next(), { keydown: "_panelKeyDown" });
this._hoverable( this.headers );
this._focusable( this.headers );
},
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
clicked = $( event.currentTarget ),
clickedIsActive = clicked[ 0 ] === active[ 0 ],
collapsing = clickedIsActive && options.collapsible,
toShow = collapsing ? $() : clicked.next(),
toHide = active.next(),
eventData = {
oldHeader: active,
oldPanel: toHide,
newHeader: collapsing ? $() : clicked,
newPanel: toShow
};
event.preventDefault();
if (
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
}
options.active = collapsing ? false : this.headers.index( clicked );
// when the call to ._toggle() comes after the class changes
// it causes a very odd bug in IE 8 (see #6720)
this.active = clickedIsActive ? $() : clicked;
this._toggle( eventData );
// switch classes
// corner classes on the previously active header stay after the animation
active.removeClass( "ui-accordion-header-active ui-state-active" );
if ( options.icons ) {
active.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.activeHeader )
.addClass( options.icons.header );
}
if ( !clickedIsActive ) {
clicked
.removeClass( "ui-corner-all" )
.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
if ( options.icons ) {
clicked.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.header )
.addClass( options.icons.activeHeader );
}
clicked
.next()
.addClass( "ui-accordion-content-active" );
}
},
_toggle: function( data ) {
var toShow = data.newPanel,
toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
// handle activating a panel during the animation for another activation
this.prevShow.add( this.prevHide ).stop( true, true );
this.prevShow = toShow;
this.prevHide = toHide;
if ( this.options.animate ) {
this._animate( toShow, toHide, data );
} else {
toHide.hide();
toShow.show();
this._toggleComplete( data );
}
toHide.attr({
"aria-hidden": "true"
});
toHide.prev().attr({
"aria-selected": "false",
"aria-expanded": "false"
});
// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
if ( toShow.length && toHide.length ) {
toHide.prev().attr({
"tabIndex": -1,
"aria-expanded": "false"
});
} else if ( toShow.length ) {
this.headers.filter(function() {
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
})
.attr( "tabIndex", -1 );
}
toShow
.attr( "aria-hidden", "false" )
.prev()
.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
},
_animate: function( toShow, toHide, data ) {
var total, easing, duration,
that = this,
adjust = 0,
boxSizing = toShow.css( "box-sizing" ),
down = toShow.length &&
( !toHide.length || ( toShow.index() < toHide.index() ) ),
animate = this.options.animate || {},
options = down && animate.down || animate,
complete = function() {
that._toggleComplete( data );
};
if ( typeof options === "number" ) {
duration = options;
}
if ( typeof options === "string" ) {
easing = options;
}
// fall back from options to animation in case of partial down settings
easing = easing || options.easing || animate.easing;
duration = duration || options.duration || animate.duration;
if ( !toHide.length ) {
return toShow.animate( this.showProps, duration, easing, complete );
}
if ( !toShow.length ) {
return toHide.animate( this.hideProps, duration, easing, complete );
}
total = toShow.show().outerHeight();
toHide.animate( this.hideProps, {
duration: duration,
easing: easing,
step: function( now, fx ) {
fx.now = Math.round( now );
}
});
toShow
.hide()
.animate( this.showProps, {
duration: duration,
easing: easing,
complete: complete,
step: function( now, fx ) {
fx.now = Math.round( now );
if ( fx.prop !== "height" ) {
if ( boxSizing === "content-box" ) {
adjust += fx.now;
}
} else if ( that.options.heightStyle !== "content" ) {
fx.now = Math.round( total - toHide.outerHeight() - adjust );
adjust = 0;
}
}
});
},
_toggleComplete: function( data ) {
var toHide = data.oldPanel;
toHide
.removeClass( "ui-accordion-content-active" )
.prev()
.removeClass( "ui-corner-top" )
.addClass( "ui-corner-all" );
// Work around for rendering bug in IE (#5421)
if ( toHide.length ) {
toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
}
this._trigger( "activate", null, data );
}
});
/*!
* jQuery UI Menu 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/menu/
*/
var menu = $.widget( "ui.menu", {
version: "1.11.4",
defaultElement: "<ul>",
delay: 300,
options: {
icons: {
submenu: "ui-icon-carat-1-e"
},
items: "> *",
menus: "ul",
position: {
my: "left-1 top",
at: "right top"
},
role: "menu",
// callbacks
blur: null,
focus: null,
select: null
},
_create: function() {
this.activeMenu = this.element;
// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
this.element
.uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content" )
.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
.attr({
role: this.options.role,
tabIndex: 0
});
if ( this.options.disabled ) {
this.element
.addClass( "ui-state-disabled" )
.attr( "aria-disabled", "true" );
}
this._on({
// Prevent focus from sticking to links inside menu after clicking
// them (focus should always stay on UL during navigation).
"mousedown .ui-menu-item": function( event ) {
event.preventDefault();
},
"click .ui-menu-item": function( event ) {
var target = $( event.target );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
this.select( event );
// Only set the mouseHandled flag if the event will bubble, see #9469.
if ( !event.isPropagationStopped() ) {
this.mouseHandled = true;
}
// Open submenu on click
if ( target.has( ".ui-menu" ).length ) {
this.expand( event );
} else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
// Redirect focus to the menu
this.element.trigger( "focus", [ true ] );
// If the active item is on the top level, let it stay active.
// Otherwise, blur the active item since it is no longer visible.
if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
clearTimeout( this.timer );
}
}
}
},
"mouseenter .ui-menu-item": function( event ) {
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if ( this.previousFilter ) {
return;
}
var target = $( event.currentTarget );
// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
this.focus( event, target );
},
mouseleave: "collapseAll",
"mouseleave .ui-menu": "collapseAll",
focus: function( event, keepActiveItem ) {
// If there's already an active item, keep it active
// If not, activate the first item
var item = this.active || this.element.find( this.options.items ).eq( 0 );
if ( !keepActiveItem ) {
this.focus( event, item );
}
},
blur: function( event ) {
this._delay(function() {
if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
this.collapseAll( event );
}
});
},
keydown: "_keydown"
});
this.refresh();
// Clicks outside of a menu collapse any open menus
this._on( this.document, {
click: function( event ) {
if ( this._closeOnDocumentClick( event ) ) {
this.collapseAll( event );
}
// Reset the mouseHandled flag
this.mouseHandled = false;
}
});
},
_destroy: function() {
// Destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
.find( ".ui-menu" ).addBack()
.removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-disabled" )
.removeUniqueId()
.show();
// Destroy menu items
this.element.find( ".ui-menu-item" )
.removeClass( "ui-menu-item" )
.removeAttr( "role" )
.removeAttr( "aria-disabled" )
.removeUniqueId()
.removeClass( "ui-state-hover" )
.removeAttr( "tabIndex" )
.removeAttr( "role" )
.removeAttr( "aria-haspopup" )
.children().each( function() {
var elem = $( this );
if ( elem.data( "ui-menu-submenu-carat" ) ) {
elem.remove();
}
});
// Destroy menu dividers
this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
},
_keydown: function( event ) {
var match, prev, character, skip,
preventDefault = true;
switch ( event.keyCode ) {
case $.ui.keyCode.PAGE_UP:
this.previousPage( event );
break;
case $.ui.keyCode.PAGE_DOWN:
this.nextPage( event );
break;
case $.ui.keyCode.HOME:
this._move( "first", "first", event );
break;
case $.ui.keyCode.END:
this._move( "last", "last", event );
break;
case $.ui.keyCode.UP:
this.previous( event );
break;
case $.ui.keyCode.DOWN:
this.next( event );
break;
case $.ui.keyCode.LEFT:
this.collapse( event );
break;
case $.ui.keyCode.RIGHT:
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
this.expand( event );
}
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
this._activate( event );
break;
case $.ui.keyCode.ESCAPE:
this.collapse( event );
break;
default:
preventDefault = false;
prev = this.previousFilter || "";
character = String.fromCharCode( event.keyCode );
skip = false;
clearTimeout( this.filterTimer );
if ( character === prev ) {
skip = true;
} else {
character = prev + character;
}
match = this._filterMenuItems( character );
match = skip && match.index( this.active.next() ) !== -1 ?
this.active.nextAll( ".ui-menu-item" ) :
match;
// If no matches on the current filter, reset to the last character pressed
// to move down the menu to the first item that starts with that character
if ( !match.length ) {
character = String.fromCharCode( event.keyCode );
match = this._filterMenuItems( character );
}
if ( match.length ) {
this.focus( event, match );
this.previousFilter = character;
this.filterTimer = this._delay(function() {
delete this.previousFilter;
}, 1000 );
} else {
delete this.previousFilter;
}
}
if ( preventDefault ) {
event.preventDefault();
}
},
_activate: function( event ) {
if ( !this.active.is( ".ui-state-disabled" ) ) {
if ( this.active.is( "[aria-haspopup='true']" ) ) {
this.expand( event );
} else {
this.select( event );
}
}
},
refresh: function() {
var menus, items,
that = this,
icon = this.options.icons.submenu,
submenus = this.element.find( this.options.menus );
this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
// Initialize nested menus
submenus.filter( ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-front" )
.hide()
.attr({
role: this.options.role,
"aria-hidden": "true",
"aria-expanded": "false"
})
.each(function() {
var menu = $( this ),
item = menu.parent(),
submenuCarat = $( "<span>" )
.addClass( "ui-menu-icon ui-icon " + icon )
.data( "ui-menu-submenu-carat", true );
item
.attr( "aria-haspopup", "true" )
.prepend( submenuCarat );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
menus = submenus.add( this.element );
items = menus.find( this.options.items );
// Initialize menu-items containing spaces and/or dashes only as dividers
items.not( ".ui-menu-item" ).each(function() {
var item = $( this );
if ( that._isDivider( item ) ) {
item.addClass( "ui-widget-content ui-menu-divider" );
}
});
// Don't refresh list items that are already adapted
items.not( ".ui-menu-item, .ui-menu-divider" )
.addClass( "ui-menu-item" )
.uniqueId()
.attr({
tabIndex: -1,
role: this._itemRole()
});
// Add aria-disabled attribute to any disabled menu item
items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
// If the active item has been removed, blur the menu
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
this.blur();
}
},
_itemRole: function() {
return {
menu: "menuitem",
listbox: "option"
}[ this.options.role ];
},
_setOption: function( key, value ) {
if ( key === "icons" ) {
this.element.find( ".ui-menu-icon" )
.removeClass( this.options.icons.submenu )
.addClass( value.submenu );
}
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
}
this._super( key, value );
},
focus: function( event, item ) {
var nested, focused;
this.blur( event, event && event.type === "focus" );
this._scrollIntoView( item );
this.active = item.first();
focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
// Only update aria-activedescendant if there's a role
// otherwise we assume focus is managed elsewhere
if ( this.options.role ) {
this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
}
// Highlight active parent menu item, if any
this.active
.parent()
.closest( ".ui-menu-item" )
.addClass( "ui-state-active" );
if ( event && event.type === "keydown" ) {
this._close();
} else {
this.timer = this._delay(function() {
this._close();
}, this.delay );
}
nested = item.children( ".ui-menu" );
if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
this._startOpening(nested);
}
this.activeMenu = item.parent();
this._trigger( "focus", event, { item: item } );
},
_scrollIntoView: function( item ) {
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
if ( this._hasScroll() ) {
borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
scroll = this.activeMenu.scrollTop();
elementHeight = this.activeMenu.height();
itemHeight = item.outerHeight();
if ( offset < 0 ) {
this.activeMenu.scrollTop( scroll + offset );
} else if ( offset + itemHeight > elementHeight ) {
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
}
}
},
blur: function( event, fromFocus ) {
if ( !fromFocus ) {
clearTimeout( this.timer );
}
if ( !this.active ) {
return;
}
this.active.removeClass( "ui-state-focus" );
this.active = null;
this._trigger( "blur", event, { item: this.active } );
},
_startOpening: function( submenu ) {
clearTimeout( this.timer );
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
// shift in the submenu position when mousing over the carat icon
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
return;
}
this.timer = this._delay(function() {
this._close();
this._open( submenu );
}, this.delay );
},
_open: function( submenu ) {
var position = $.extend({
of: this.active
}, this.options.position );
clearTimeout( this.timer );
this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
.hide()
.attr( "aria-hidden", "true" );
submenu
.show()
.removeAttr( "aria-hidden" )
.attr( "aria-expanded", "true" )
.position( position );
},
collapseAll: function( event, all ) {
clearTimeout( this.timer );
this.timer = this._delay(function() {
// If we were passed an event, look for the submenu that contains the event
var currentMenu = all ? this.element :
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
if ( !currentMenu.length ) {
currentMenu = this.element;
}
this._close( currentMenu );
this.blur( event );
this.activeMenu = currentMenu;
}, this.delay );
},
// With no arguments, closes the currently active menu - if nothing is active
// it closes all menus. If passed an argument, it will search for menus BELOW
_close: function( startMenu ) {
if ( !startMenu ) {
startMenu = this.active ? this.active.parent() : this.element;
}
startMenu
.find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" )
.end()
.find( ".ui-state-active" ).not( ".ui-state-focus" )
.removeClass( "ui-state-active" );
},
_closeOnDocumentClick: function( event ) {
return !$( event.target ).closest( ".ui-menu" ).length;
},
_isDivider: function( item ) {
// Match hyphen, em dash, en dash
return !/[^\-\u2014\u2013\s]/.test( item.text() );
},
collapse: function( event ) {
var newItem = this.active &&
this.active.parent().closest( ".ui-menu-item", this.element );
if ( newItem && newItem.length ) {
this._close();
this.focus( event, newItem );
}
},
expand: function( event ) {
var newItem = this.active &&
this.active
.children( ".ui-menu " )
.find( this.options.items )
.first();
if ( newItem && newItem.length ) {
this._open( newItem.parent() );
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
this._delay(function() {
this.focus( event, newItem );
});
}
},
next: function( event ) {
this._move( "next", "first", event );
},
previous: function( event ) {
this._move( "prev", "last", event );
},
isFirstItem: function() {
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
},
isLastItem: function() {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},
_move: function( direction, filter, event ) {
var next;
if ( this.active ) {
if ( direction === "first" || direction === "last" ) {
next = this.active
[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
.eq( -1 );
} else {
next = this.active
[ direction + "All" ]( ".ui-menu-item" )
.eq( 0 );
}
}
if ( !next || !next.length || !this.active ) {
next = this.activeMenu.find( this.options.items )[ filter ]();
}
this.focus( event, next );
},
nextPage: function( event ) {
var item, base, height;
if ( !this.active ) {
this.next( event );
return;
}
if ( this.isLastItem() ) {
return;
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.height();
this.active.nextAll( ".ui-menu-item" ).each(function() {
item = $( this );
return item.offset().top - base - height < 0;
});
this.focus( event, item );
} else {
this.focus( event, this.activeMenu.find( this.options.items )
[ !this.active ? "first" : "last" ]() );
}
},
previousPage: function( event ) {
var item, base, height;
if ( !this.active ) {
this.next( event );
return;
}
if ( this.isFirstItem() ) {
return;
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.height();
this.active.prevAll( ".ui-menu-item" ).each(function() {
item = $( this );
return item.offset().top - base + height > 0;
});
this.focus( event, item );
} else {
this.focus( event, this.activeMenu.find( this.options.items ).first() );
}
},
_hasScroll: function() {
return this.element.outerHeight() < this.element.prop( "scrollHeight" );
},
select: function( event ) {
// TODO: It should never be possible to not have an active item at this
// point, but the tests don't trigger mouseenter before click.
this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
var ui = { item: this.active };
if ( !this.active.has( ".ui-menu" ).length ) {
this.collapseAll( event, true );
}
this._trigger( "select", event, ui );
},
_filterMenuItems: function(character) {
var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
regex = new RegExp( "^" + escapedCharacter, "i" );
return this.activeMenu
.find( this.options.items )
// Only match on items, not dividers or other content (#10571)
.filter( ".ui-menu-item" )
.filter(function() {
return regex.test( $.trim( $( this ).text() ) );
});
}
});
/*!
* jQuery UI Autocomplete 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/autocomplete/
*/
$.widget( "ui.autocomplete", {
version: "1.11.4",
defaultElement: "<input>",
options: {
appendTo: null,
autoFocus: false,
delay: 300,
minLength: 1,
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
source: null,
// callbacks
change: null,
close: null,
focus: null,
open: null,
response: null,
search: null,
select: null
},
requestIndex: 0,
pending: 0,
_create: function() {
// Some browsers only repeat keydown events, not keypress events,
// so we use the suppressKeyPress flag to determine if we've already
// handled the keydown event. #7269
// Unfortunately the code for & in keypress is the same as the up arrow,
// so we use the suppressKeyPressRepeat flag to avoid handling keypress
// events when we know the keydown event was used to modify the
// search term. #7799
var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
nodeName = this.element[ 0 ].nodeName.toLowerCase(),
isTextarea = nodeName === "textarea",
isInput = nodeName === "input";
this.isMultiLine =
// Textareas are always multi-line
isTextarea ? true :
// Inputs are always single-line, even if inside a contentEditable element
// IE also treats inputs as contentEditable
isInput ? false :
// All other element types are determined by whether or not they're contentEditable
this.element.prop( "isContentEditable" );
this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true;
this.element
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" );
this._on( this.element, {
keydown: function( event ) {
if ( this.element.prop( "readOnly" ) ) {
suppressKeyPress = true;
suppressInput = true;
suppressKeyPressRepeat = true;
return;
}
suppressKeyPress = false;
suppressInput = false;
suppressKeyPressRepeat = false;
var keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.PAGE_UP:
suppressKeyPress = true;
this._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
suppressKeyPress = true;
this._move( "nextPage", event );
break;
case keyCode.UP:
suppressKeyPress = true;
this._keyEvent( "previous", event );
break;
case keyCode.DOWN:
suppressKeyPress = true;
this._keyEvent( "next", event );
break;
case keyCode.ENTER:
// when menu is open and has focus
if ( this.menu.active ) {
// #6055 - Opera still allows the keypress to occur
// which causes forms to submit
suppressKeyPress = true;
event.preventDefault();
this.menu.select( event );
}
break;
case keyCode.TAB:
if ( this.menu.active ) {
this.menu.select( event );
}
break;
case keyCode.ESCAPE:
if ( this.menu.element.is( ":visible" ) ) {
if ( !this.isMultiLine ) {
this._value( this.term );
}
this.close( event );
// Different browsers have different default behavior for escape
// Single press can mean undo or clear
// Double press in IE means clear the whole form
event.preventDefault();
}
break;
default:
suppressKeyPressRepeat = true;
// search timeout should be triggered before the input value is changed
this._searchTimeout( event );
break;
}
},
keypress: function( event ) {
if ( suppressKeyPress ) {
suppressKeyPress = false;
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
event.preventDefault();
}
return;
}
if ( suppressKeyPressRepeat ) {
return;
}
// replicate some key handlers to allow them to repeat in Firefox and Opera
var keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.PAGE_UP:
this._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
this._move( "nextPage", event );
break;
case keyCode.UP:
this._keyEvent( "previous", event );
break;
case keyCode.DOWN:
this._keyEvent( "next", event );
break;
}
},
input: function( event ) {
if ( suppressInput ) {
suppressInput = false;
event.preventDefault();
return;
}
this._searchTimeout( event );
},
focus: function() {
this.selectedItem = null;
this.previous = this._value();
},
blur: function( event ) {
if ( this.cancelBlur ) {
delete this.cancelBlur;
return;
}
clearTimeout( this.searching );
this.close( event );
this._change( event );
}
});
this._initSource();
this.menu = $( "<ul>" )
.addClass( "ui-autocomplete ui-front" )
.appendTo( this._appendTo() )
.menu({
// disable ARIA support, the live region takes care of that
role: null
})
.hide()
.menu( "instance" );
this._on( this.menu.element, {
mousedown: function( event ) {
// prevent moving focus out of the text field
event.preventDefault();
// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
this.cancelBlur = true;
this._delay(function() {
delete this.cancelBlur;
});
// clicking on the scrollbar causes focus to shift to the body
// but we can't detect a mouseup or a click immediately afterward
// so we have to track the next mousedown and close the menu if
// the user clicks somewhere outside of the autocomplete
var menuElement = this.menu.element[ 0 ];
if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
this._delay(function() {
var that = this;
this.document.one( "mousedown", function( event ) {
if ( event.target !== that.element[ 0 ] &&
event.target !== menuElement &&
!$.contains( menuElement, event.target ) ) {
that.close();
}
});
});
}
},
menufocus: function( event, ui ) {
var label, item;
// support: Firefox
// Prevent accidental activation of menu items in Firefox (#7024 #9118)
if ( this.isNewMenu ) {
this.isNewMenu = false;
if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
this.menu.blur();
this.document.one( "mousemove", function() {
$( event.target ).trigger( event.originalEvent );
});
return;
}
}
item = ui.item.data( "ui-autocomplete-item" );
if ( false !== this._trigger( "focus", event, { item: item } ) ) {
// use value to match what will end up in the input, if it was a key event
if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
this._value( item.value );
}
}
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && $.trim( label ).length ) {
this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion );
}
},
menuselect: function( event, ui ) {
var item = ui.item.data( "ui-autocomplete-item" ),
previous = this.previous;
// only trigger when focus was lost (click on menu)
if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
this.element.focus();
this.previous = previous;
// #6109 - IE triggers two focus events and the second
// is asynchronous, so we need to reset the previous
// term synchronously and asynchronously :-(
this._delay(function() {
this.previous = previous;
this.selectedItem = item;
});
}
if ( false !== this._trigger( "select", event, { item: item } ) ) {
this._value( item.value );
}
// reset the term after the select event
// this allows custom select handling to work properly
this.term = this._value();
this.close( event );
this.selectedItem = item;
}
});
this.liveRegion = $( "<span>", {
role: "status",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.addClass( "ui-helper-hidden-accessible" )
.appendTo( this.document[ 0 ].body );
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on( this.window, {
beforeunload: function() {
this.element.removeAttr( "autocomplete" );
}
});
},
_destroy: function() {
clearTimeout( this.searching );
this.element
.removeClass( "ui-autocomplete-input" )
.removeAttr( "autocomplete" );
this.menu.element.remove();
this.liveRegion.remove();
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "source" ) {
this._initSource();
}
if ( key === "appendTo" ) {
this.menu.element.appendTo( this._appendTo() );
}
if ( key === "disabled" && value && this.xhr ) {
this.xhr.abort();
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element ) {
element = element.jquery || element.nodeType ?
$( element ) :
this.document.find( element ).eq( 0 );
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front" );
}
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_initSource: function() {
var array, url,
that = this;
if ( $.isArray( this.options.source ) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
};
} else if ( typeof this.options.source === "string" ) {
url = this.options.source;
this.source = function( request, response ) {
if ( that.xhr ) {
that.xhr.abort();
}
that.xhr = $.ajax({
url: url,
data: request,
dataType: "json",
success: function( data ) {
response( data );
},
error: function() {
response([]);
}
});
};
} else {
this.source = this.options.source;
}
},
_searchTimeout: function( event ) {
clearTimeout( this.searching );
this.searching = this._delay(function() {
// Search if the value has changed, or if the user retypes the same value (see #7434)
var equalValues = this.term === this._value(),
menuVisible = this.menu.element.is( ":visible" ),
modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
this.selectedItem = null;
this.search( null, event );
}
}, this.options.delay );
},
search: function( value, event ) {
value = value != null ? value : this._value();
// always save the actual value, not the one passed as an argument
this.term = this._value();
if ( value.length < this.options.minLength ) {
return this.close( event );
}
if ( this._trigger( "search", event ) === false ) {
return;
}
return this._search( value );
},
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;
this.source( { term: value }, this._response() );
},
_response: function() {
var index = ++this.requestIndex;
return $.proxy(function( content ) {
if ( index === this.requestIndex ) {
this.__response( content );
}
this.pending--;
if ( !this.pending ) {
this.element.removeClass( "ui-autocomplete-loading" );
}
}, this );
},
__response: function( content ) {
if ( content ) {
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
this._suggest( content );
this._trigger( "open" );
} else {
// use ._close() instead of .close() so we don't cancel future searches
this._close();
}
},
close: function( event ) {
this.cancelSearch = true;
this._close( event );
},
_close: function( event ) {
if ( this.menu.element.is( ":visible" ) ) {
this.menu.element.hide();
this.menu.blur();
this.isNewMenu = true;
this._trigger( "close", event );
}
},
_change: function( event ) {
if ( this.previous !== this._value() ) {
this._trigger( "change", event, { item: this.selectedItem } );
}
},
_normalize: function( items ) {
// assume all items have the right format when the first item is complete
if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
return items;
}
return $.map( items, function( item ) {
if ( typeof item === "string" ) {
return {
label: item,
value: item
};
}
return $.extend( {}, item, {
label: item.label || item.value,
value: item.value || item.label
});
});
},
_suggest: function( items ) {
var ul = this.menu.element.empty();
this._renderMenu( ul, items );
this.isNewMenu = true;
this.menu.refresh();
// size and position menu
ul.show();
this._resizeMenu();
ul.position( $.extend({
of: this.element
}, this.options.position ) );
if ( this.options.autoFocus ) {
this.menu.next();
}
},
_resizeMenu: function() {
var ul = this.menu.element;
ul.outerWidth( Math.max(
// Firefox wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping (#7513)
ul.width( "" ).outerWidth() + 1,
this.element.outerWidth()
) );
},
_renderMenu: function( ul, items ) {
var that = this;
$.each( items, function( index, item ) {
that._renderItemData( ul, item );
});
},
_renderItemData: function( ul, item ) {
return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
},
_renderItem: function( ul, item ) {
return $( "<li>" ).text( item.label ).appendTo( ul );
},
_move: function( direction, event ) {
if ( !this.menu.element.is( ":visible" ) ) {
this.search( null, event );
return;
}
if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
this.menu.isLastItem() && /^next/.test( direction ) ) {
if ( !this.isMultiLine ) {
this._value( this.term );
}
this.menu.blur();
return;
}
this.menu[ direction ]( event );
},
widget: function() {
return this.menu.element;
},
_value: function() {
return this.valueMethod.apply( this.element, arguments );
},
_keyEvent: function( keyEvent, event ) {
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
this._move( keyEvent, event );
// prevents moving cursor to beginning/end of the text field in some browsers
event.preventDefault();
}
}
});
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
},
filter: function( array, term ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
return $.grep( array, function( value ) {
return matcher.test( value.label || value.value || value );
});
}
});
// live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget( "ui.autocomplete", $.ui.autocomplete, {
options: {
messages: {
noResults: "No search results.",
results: function( amount ) {
return amount + ( amount > 1 ? " results are" : " result is" ) +
" available, use up and down arrow keys to navigate.";
}
}
},
__response: function( content ) {
var message;
this._superApply( arguments );
if ( this.options.disabled || this.cancelSearch ) {
return;
}
if ( content && content.length ) {
message = this.options.messages.results( content.length );
} else {
message = this.options.messages.noResults;
}
this.liveRegion.children().hide();
$( "<div>" ).text( message ).appendTo( this.liveRegion );
}
});
var autocomplete = $.ui.autocomplete;
/*!
* jQuery UI Button 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/button/
*/
var lastActive,
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
formResetHandler = function() {
var form = $( this );
setTimeout(function() {
form.find( ":ui-button" ).button( "refresh" );
}, 1 );
},
radioGroup = function( radio ) {
var name = radio.name,
form = radio.form,
radios = $( [] );
if ( name ) {
name = name.replace( /'/g, "\\'" );
if ( form ) {
radios = $( form ).find( "[name='" + name + "'][type=radio]" );
} else {
radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
.filter(function() {
return !this.form;
});
}
}
return radios;
};
$.widget( "ui.button", {
version: "1.11.4",
defaultElement: "<button>",
options: {
disabled: null,
text: true,
label: null,
icons: {
primary: null,
secondary: null
}
},
_create: function() {
this.element.closest( "form" )
.unbind( "reset" + this.eventNamespace )
.bind( "reset" + this.eventNamespace, formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) {
this.options.disabled = !!this.element.prop( "disabled" );
} else {
this.element.prop( "disabled", this.options.disabled );
}
this._determineButtonType();
this.hasTitle = !!this.buttonElement.attr( "title" );
var that = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
activeClass = !toggleButton ? "ui-state-active" : "";
if ( options.label === null ) {
options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
}
this._hoverable( this.buttonElement );
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
.bind( "mouseenter" + this.eventNamespace, function() {
if ( options.disabled ) {
return;
}
if ( this === lastActive ) {
$( this ).addClass( "ui-state-active" );
}
})
.bind( "mouseleave" + this.eventNamespace, function() {
if ( options.disabled ) {
return;
}
$( this ).removeClass( activeClass );
})
.bind( "click" + this.eventNamespace, function( event ) {
if ( options.disabled ) {
event.preventDefault();
event.stopImmediatePropagation();
}
});
// Can't use _focusable() because the element that receives focus
// and the element that gets the ui-state-focus class are different
this._on({
focus: function() {
this.buttonElement.addClass( "ui-state-focus" );
},
blur: function() {
this.buttonElement.removeClass( "ui-state-focus" );
}
});
if ( toggleButton ) {
this.element.bind( "change" + this.eventNamespace, function() {
that.refresh();
});
}
if ( this.type === "checkbox" ) {
this.buttonElement.bind( "click" + this.eventNamespace, function() {
if ( options.disabled ) {
return false;
}
});
} else if ( this.type === "radio" ) {
this.buttonElement.bind( "click" + this.eventNamespace, function() {
if ( options.disabled ) {
return false;
}
$( this ).addClass( "ui-state-active" );
that.buttonElement.attr( "aria-pressed", "true" );
var radio = that.element[ 0 ];
radioGroup( radio )
.not( radio )
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-state-active" )
.attr( "aria-pressed", "false" );
});
} else {
this.buttonElement
.bind( "mousedown" + this.eventNamespace, function() {
if ( options.disabled ) {
return false;
}
$( this ).addClass( "ui-state-active" );
lastActive = this;
that.document.one( "mouseup", function() {
lastActive = null;
});
})
.bind( "mouseup" + this.eventNamespace, function() {
if ( options.disabled ) {
return false;
}
$( this ).removeClass( "ui-state-active" );
})
.bind( "keydown" + this.eventNamespace, function(event) {
if ( options.disabled ) {
return false;
}
if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
$( this ).addClass( "ui-state-active" );
}
})
// see #8559, we bind to blur here in case the button element loses
// focus between keydown and keyup, it would be left in an "active" state
.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
$( this ).removeClass( "ui-state-active" );
});
if ( this.buttonElement.is("a") ) {
this.buttonElement.keyup(function(event) {
if ( event.keyCode === $.ui.keyCode.SPACE ) {
// TODO pass through original event correctly (just as 2nd argument doesn't work)
$( this ).click();
}
});
}
}
this._setOption( "disabled", options.disabled );
this._resetButton();
},
_determineButtonType: function() {
var ancestor, labelSelector, checked;
if ( this.element.is("[type=checkbox]") ) {
this.type = "checkbox";
} else if ( this.element.is("[type=radio]") ) {
this.type = "radio";
} else if ( this.element.is("input") ) {
this.type = "input";
} else {
this.type = "button";
}
if ( this.type === "checkbox" || this.type === "radio" ) {
// we don't search against the document in case the element
// is disconnected from the DOM
ancestor = this.element.parents().last();
labelSelector = "label[for='" + this.element.attr("id") + "']";
this.buttonElement = ancestor.find( labelSelector );
if ( !this.buttonElement.length ) {
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
this.buttonElement = ancestor.filter( labelSelector );
if ( !this.buttonElement.length ) {
this.buttonElement = ancestor.find( labelSelector );
}
}
this.element.addClass( "ui-helper-hidden-accessible" );
checked = this.element.is( ":checked" );
if ( checked ) {
this.buttonElement.addClass( "ui-state-active" );
}
this.buttonElement.prop( "aria-pressed", checked );
} else {
this.buttonElement = this.element;
}
},
widget: function() {
return this.buttonElement;
},
_destroy: function() {
this.element
.removeClass( "ui-helper-hidden-accessible" );
this.buttonElement
.removeClass( baseClasses + " ui-state-active " + typeClasses )
.removeAttr( "role" )
.removeAttr( "aria-pressed" )
.html( this.buttonElement.find(".ui-button-text").html() );
if ( !this.hasTitle ) {
this.buttonElement.removeAttr( "title" );
}
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "disabled" ) {
this.widget().toggleClass( "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
if ( value ) {
if ( this.type === "checkbox" || this.type === "radio" ) {
this.buttonElement.removeClass( "ui-state-focus" );
} else {
this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
}
}
return;
}
this._resetButton();
},
refresh: function() {
//See #8237 & #8828
var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) {
this._setOption( "disabled", isDisabled );
}
if ( this.type === "radio" ) {
radioGroup( this.element[0] ).each(function() {
if ( $( this ).is( ":checked" ) ) {
$( this ).button( "widget" )
.addClass( "ui-state-active" )
.attr( "aria-pressed", "true" );
} else {
$( this ).button( "widget" )
.removeClass( "ui-state-active" )
.attr( "aria-pressed", "false" );
}
});
} else if ( this.type === "checkbox" ) {
if ( this.element.is( ":checked" ) ) {
this.buttonElement
.addClass( "ui-state-active" )
.attr( "aria-pressed", "true" );
} else {
this.buttonElement
.removeClass( "ui-state-active" )
.attr( "aria-pressed", "false" );
}
}
},
_resetButton: function() {
if ( this.type === "input" ) {
if ( this.options.label ) {
this.element.val( this.options.label );
}
return;
}
var buttonElement = this.buttonElement.removeClass( typeClasses ),
buttonText = $( "<span></span>", this.document[0] )
.addClass( "ui-button-text" )
.html( this.options.label )
.appendTo( buttonElement.empty() )
.text(),
icons = this.options.icons,
multipleIcons = icons.primary && icons.secondary,
buttonClasses = [];
if ( icons.primary || icons.secondary ) {
if ( this.options.text ) {
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
}
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
}
if ( icons.secondary ) {
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
}
if ( !this.options.text ) {
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
if ( !this.hasTitle ) {
buttonElement.attr( "title", $.trim( buttonText ) );
}
}
} else {
buttonClasses.push( "ui-button-text-only" );
}
buttonElement.addClass( buttonClasses.join( " " ) );
}
});
$.widget( "ui.buttonset", {
version: "1.11.4",
options: {
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
},
_create: function() {
this.element.addClass( "ui-buttonset" );
},
_init: function() {
this.refresh();
},
_setOption: function( key, value ) {
if ( key === "disabled" ) {
this.buttons.button( "option", key, value );
}
this._super( key, value );
},
refresh: function() {
var rtl = this.element.css( "direction" ) === "rtl",
allButtons = this.element.find( this.options.items ),
existingButtons = allButtons.filter( ":ui-button" );
// Initialize new buttons
allButtons.not( ":ui-button" ).button();
// Refresh existing buttons
existingButtons.button( "refresh" );
this.buttons = allButtons
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
.filter( ":first" )
.addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
.end()
.filter( ":last" )
.addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
.end()
.end();
},
_destroy: function() {
this.element.removeClass( "ui-buttonset" );
this.buttons
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-corner-left ui-corner-right" )
.end()
.button( "destroy" );
}
});
var button = $.ui.button;
/*!
* jQuery UI Datepicker 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/datepicker/
*/
$.extend($.ui, { datepicker: { version: "1.11.4" } });
var datepicker_instActive;
function datepicker_getZindex( elem ) {
var position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
return 0;
}
/* Date picker manager.
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
Settings for (groups of) date pickers are maintained in an instance object,
allowing multiple different settings on the same page. */
function Datepicker() {
this._curInst = null; // The current instance in use
this._keyEvent = false; // If the last event was a key event
this._disabledInputs = []; // List of date picker inputs that have been disabled
this._datepickerShowing = false; // True if the popup picker is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
this._appendClass = "ui-datepicker-append"; // The name of the append marker class
this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
this.regional = []; // Available regional settings, indexed by language code
this.regional[""] = { // Default regional settings
closeText: "Done", // Display text for close link
prevText: "Prev", // Display text for previous month link
nextText: "Next", // Display text for next month link
currentText: "Today", // Display text for current month link
monthNames: ["January","February","March","April","May","June",
"July","August","September","October","November","December"], // Names of months for drop-down and formatting
monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
weekHeader: "Wk", // Column header for week of the year
dateFormat: "mm/dd/yy", // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false, // True if right-to-left language, false if left-to-right
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
yearSuffix: "" // Additional text to append to the year in the month headers
};
this._defaults = { // Global defaults for all the date picker instances
showOn: "focus", // "focus" for popup on focus,
// "button" for trigger button, or "both" for either
showAnim: "fadeIn", // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText: "", // Display text following the input box, e.g. showing the format
buttonText: "...", // Text for trigger button
buttonImage: "", // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: false, // True if month can be selected directly, false if only prev/next
changeYear: false, // True if year can be selected directly, false if only prev/next
yearRange: "c-10:c+10", // Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to leave blank
selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
showWeek: false, // True to show week of the year, false to not show it
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff: "+10", // Short year values < this are in the current century,
// > this are in the previous century,
// string value starting with "+" for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
duration: "fast", // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow: null, // Function that takes an input field and
// returns a set of custom settings for the date picker
onSelect: null, // Define a callback function when a date is selected
onChangeMonthYear: null, // Define a callback function when the month or year is changed
onClose: null, // Define a callback function when the datepicker is closed
numberOfMonths: 1, // Number of months to show at a time
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big links
altField: "", // Selector for an alternate field to store selected dates into
altFormat: "", // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
showButtonPanel: false, // True to show button panel, false to not show it
autoSize: false, // True to size the input for the date format, false to leave as is
disabled: false // The initial disabled state
};
$.extend(this._defaults, this.regional[""]);
this.regional.en = $.extend( true, {}, this.regional[ "" ]);
this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
}
$.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */
markerClassName: "hasDatepicker",
//Keep track of the maximum number of rows displayed (see #7043)
maxRows: 4,
// TODO rename to "widget" when switching to widget factory
_widgetDatepicker: function() {
return this.dpDiv;
},
/* Override the default settings for all instances of the date picker.
* @param settings object - the new settings to use as defaults (anonymous object)
* @return the manager object
*/
setDefaults: function(settings) {
datepicker_extendRemove(this._defaults, settings || {});
return this;
},
/* Attach the date picker to a jQuery selection.
* @param target element - the target input field or division or span
* @param settings object - the new settings to use for this date picker instance (anonymous)
*/
_attachDatepicker: function(target, settings) {
var nodeName, inline, inst;
nodeName = target.nodeName.toLowerCase();
inline = (nodeName === "div" || nodeName === "span");
if (!target.id) {
this.uuid += 1;
target.id = "dp" + this.uuid;
}
inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {});
if (nodeName === "input") {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
}
},
/* Create a new instance object. */
_newInst: function(target, inline) {
var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
return {id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
inline: inline, // is datepicker inline or not
dpDiv: (!inline ? this.dpDiv : // presentation div
datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
},
/* Attach the date picker to an input field. */
_connectDatepicker: function(target, inst) {
var input = $(target);
inst.append = $([]);
inst.trigger = $([]);
if (input.hasClass(this.markerClassName)) {
return;
}
this._attachments(input, inst);
input.addClass(this.markerClassName).keydown(this._doKeyDown).
keypress(this._doKeyPress).keyup(this._doKeyUp);
this._autoSize(inst);
$.data(target, "datepicker", inst);
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
},
/* Make attachments based on settings. */
_attachments: function(input, inst) {
var showOn, buttonText, buttonImage,
appendText = this._get(inst, "appendText"),
isRTL = this._get(inst, "isRTL");
if (inst.append) {
inst.append.remove();
}
if (appendText) {
inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
input[isRTL ? "before" : "after"](inst.append);
}
input.unbind("focus", this._showDatepicker);
if (inst.trigger) {
inst.trigger.remove();
}
showOn = this._get(inst, "showOn");
if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
input.focus(this._showDatepicker);
}
if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
buttonText = this._get(inst, "buttonText");
buttonImage = this._get(inst, "buttonImage");
inst.trigger = $(this._get(inst, "buttonImageOnly") ?
$("<img/>").addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
$("<button type='button'></button>").addClass(this._triggerClass).
html(!buttonImage ? buttonText : $("<img/>").attr(
{ src:buttonImage, alt:buttonText, title:buttonText })));
input[isRTL ? "before" : "after"](inst.trigger);
inst.trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
$.datepicker._hideDatepicker();
} else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
$.datepicker._hideDatepicker();
$.datepicker._showDatepicker(input[0]);
} else {
$.datepicker._showDatepicker(input[0]);
}
return false;
});
}
},
/* Apply the maximum length for the date format. */
_autoSize: function(inst) {
if (this._get(inst, "autoSize") && !inst.inline) {
var findMax, max, maxI, i,
date = new Date(2009, 12 - 1, 20), // Ensure double digits
dateFormat = this._get(inst, "dateFormat");
if (dateFormat.match(/[DM]/)) {
findMax = function(names) {
max = 0;
maxI = 0;
for (i = 0; i < names.length; i++) {
if (names[i].length > max) {
max = names[i].length;
maxI = i;
}
}
return maxI;
};
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
"monthNames" : "monthNamesShort"))));
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
"dayNames" : "dayNamesShort"))) + 20 - date.getDay());
}
inst.input.attr("size", this._formatDate(inst, date).length);
}
},
/* Attach an inline date picker to a div. */
_inlineDatepicker: function(target, inst) {
var divSpan = $(target);
if (divSpan.hasClass(this.markerClassName)) {
return;
}
divSpan.addClass(this.markerClassName).append(inst.dpDiv);
$.data(target, "datepicker", inst);
this._setDate(inst, this._getDefaultDate(inst), true);
this._updateDatepicker(inst);
this._updateAlternate(inst);
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
inst.dpDiv.css( "display", "block" );
},
/* Pop-up the date picker in a "dialog" box.
* @param input element - ignored
* @param date string or Date - the initial date to display
* @param onSelect function - the function to call when a date is selected
* @param settings object - update the dialog date picker instance's settings (anonymous object)
* @param pos int[2] - coordinates for the dialog's position within the screen or
* event - with x/y coordinates or
* leave empty for default (screen centre)
* @return the manager object
*/
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
var id, browserWidth, browserHeight, scrollX, scrollY,
inst = this._dialogInst; // internal instance
if (!inst) {
this.uuid += 1;
id = "dp" + this.uuid;
this._dialogInput = $("<input type='text' id='" + id +
"' style='position: absolute; top: -100px; width: 0px;'/>");
this._dialogInput.keydown(this._doKeyDown);
$("body").append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
inst.settings = {};
$.data(this._dialogInput[0], "datepicker", inst);
}
datepicker_extendRemove(inst.settings, settings || {});
date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
this._dialogInput.val(date);
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
if (!this._pos) {
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
scrollY = document.documentElement.scrollTop || document.body.scrollTop;
this._pos = // should use actual width/height below
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
}
// move input on screen for focus, but hidden behind dialog
this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[0]);
if ($.blockUI) {
$.blockUI(this.dpDiv);
}
$.data(this._dialogInput[0], "datepicker", inst);
return this;
},
/* Detach a datepicker from its control.
* @param target element - the target input field or division or span
*/
_destroyDatepicker: function(target) {
var nodeName,
$target = $(target),
inst = $.data(target, "datepicker");
if (!$target.hasClass(this.markerClassName)) {
return;
}
nodeName = target.nodeName.toLowerCase();
$.removeData(target, "datepicker");
if (nodeName === "input") {
inst.append.remove();
inst.trigger.remove();
$target.removeClass(this.markerClassName).
unbind("focus", this._showDatepicker).
unbind("keydown", this._doKeyDown).
unbind("keypress", this._doKeyPress).
unbind("keyup", this._doKeyUp);
} else if (nodeName === "div" || nodeName === "span") {
$target.removeClass(this.markerClassName).empty();
}
if ( datepicker_instActive === inst ) {
datepicker_instActive = null;
}
},
/* Enable the date picker to a jQuery selection.
* @param target element - the target input field or division or span
*/
_enableDatepicker: function(target) {
var nodeName, inline,
$target = $(target),
inst = $.data(target, "datepicker");
if (!$target.hasClass(this.markerClassName)) {
return;
}
nodeName = target.nodeName.toLowerCase();
if (nodeName === "input") {
target.disabled = false;
inst.trigger.filter("button").
each(function() { this.disabled = false; }).end().
filter("img").css({opacity: "1.0", cursor: ""});
} else if (nodeName === "div" || nodeName === "span") {
inline = $target.children("." + this._inlineClass);
inline.children().removeClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", false);
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value === target ? null : value); }); // delete entry
},
/* Disable the date picker to a jQuery selection.
* @param target element - the target input field or division or span
*/
_disableDatepicker: function(target) {
var nodeName, inline,
$target = $(target),
inst = $.data(target, "datepicker");
if (!$target.hasClass(this.markerClassName)) {
return;
}
nodeName = target.nodeName.toLowerCase();
if (nodeName === "input") {
target.disabled = true;
inst.trigger.filter("button").
each(function() { this.disabled = true; }).end().
filter("img").css({opacity: "0.5", cursor: "default"});
} else if (nodeName === "div" || nodeName === "span") {
inline = $target.children("." + this._inlineClass);
inline.children().addClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", true);
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value === target ? null : value); }); // delete entry
this._disabledInputs[this._disabledInputs.length] = target;
},
/* Is the first field in a jQuery collection disabled as a datepicker?
* @param target element - the target input field or division or span
* @return boolean - true if disabled, false if enabled
*/
_isDisabledDatepicker: function(target) {
if (!target) {
return false;
}
for (var i = 0; i < this._disabledInputs.length; i++) {
if (this._disabledInputs[i] === target) {
return true;
}
}
return false;
},
/* Retrieve the instance data for the target control.
* @param target element - the target input field or division or span
* @return object - the associated instance data
* @throws error if a jQuery problem getting data
*/
_getInst: function(target) {
try {
return $.data(target, "datepicker");
}
catch (err) {
throw "Missing instance data for this datepicker";
}
},
/* Update or retrieve the settings for a date picker attached to an input field or division.
* @param target element - the target input field or division or span
* @param name object - the new settings to update or
* string - the name of the setting to change or retrieve,
* when retrieving also "all" for all instance settings or
* "defaults" for all global defaults
* @param value any - the new value for the setting
* (omit if above is an object or to retrieve a value)
*/
_optionDatepicker: function(target, name, value) {
var settings, date, minDate, maxDate,
inst = this._getInst(target);
if (arguments.length === 2 && typeof name === "string") {
return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
(inst ? (name === "all" ? $.extend({}, inst.settings) :
this._get(inst, name)) : null));
}
settings = name || {};
if (typeof name === "string") {
settings = {};
settings[name] = value;
}
if (inst) {
if (this._curInst === inst) {
this._hideDatepicker();
}
date = this._getDateDatepicker(target, true);
minDate = this._getMinMaxDate(inst, "min");
maxDate = this._getMinMaxDate(inst, "max");
datepicker_extendRemove(inst.settings, settings);
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
inst.settings.minDate = this._formatDate(inst, minDate);
}
if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
inst.settings.maxDate = this._formatDate(inst, maxDate);
}
if ( "disabled" in settings ) {
if ( settings.disabled ) {
this._disableDatepicker(target);
} else {
this._enableDatepicker(target);
}
}
this._attachments($(target), inst);
this._autoSize(inst);
this._setDate(inst, date);
this._updateAlternate(inst);
this._updateDatepicker(inst);
}
},
// change method deprecated
_changeDatepicker: function(target, name, value) {
this._optionDatepicker(target, name, value);
},
/* Redraw the date picker attached to an input field or division.
* @param target element - the target input field or division or span
*/
_refreshDatepicker: function(target) {
var inst = this._getInst(target);
if (inst) {
this._updateDatepicker(inst);
}
},
/* Set the dates for a jQuery selection.
* @param target element - the target input field or division or span
* @param date Date - the new date
*/
_setDateDatepicker: function(target, date) {
var inst = this._getInst(target);
if (inst) {
this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
},
/* Get the date(s) for the first entry in a jQuery selection.
* @param target element - the target input field or division or span
* @param noDefault boolean - true if no default date is to be used
* @return Date - the current date
*/
_getDateDatepicker: function(target, noDefault) {
var inst = this._getInst(target);
if (inst && !inst.inline) {
this._setDateFromField(inst, noDefault);
}
return (inst ? this._getDate(inst) : null);
},
/* Handle keystrokes. */
_doKeyDown: function(event) {
var onSelect, dateStr, sel,
inst = $.datepicker._getInst(event.target),
handled = true,
isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
inst._keyEvent = true;
if ($.datepicker._datepickerShowing) {
switch (event.keyCode) {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
$.datepicker._currentClass + ")", inst.dpDiv);
if (sel[0]) {
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
}
onSelect = $.datepicker._get(inst, "onSelect");
if (onSelect) {
dateStr = $.datepicker._formatDate(inst);
// trigger custom callback
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
} else {
$.datepicker._hideDatepicker();
}
return false; // don't submit the form
case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, "stepBigMonths") :
-$.datepicker._get(inst, "stepMonths")), "M");
break; // previous month/year on page up/+ ctrl
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, "stepBigMonths") :
+$.datepicker._get(inst, "stepMonths")), "M");
break; // next month/year on page down/+ ctrl
case 35: if (event.ctrlKey || event.metaKey) {
$.datepicker._clearDate(event.target);
}
handled = event.ctrlKey || event.metaKey;
break; // clear on ctrl or command +end
case 36: if (event.ctrlKey || event.metaKey) {
$.datepicker._gotoToday(event.target);
}
handled = event.ctrlKey || event.metaKey;
break; // current on ctrl or command +home
case 37: if (event.ctrlKey || event.metaKey) {
$.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
}
handled = event.ctrlKey || event.metaKey;
// -1 day on ctrl or command +left
if (event.originalEvent.altKey) {
$.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, "stepBigMonths") :
-$.datepicker._get(inst, "stepMonths")), "M");
}
// next month/year on alt +left on Mac
break;
case 38: if (event.ctrlKey || event.metaKey) {
$.datepicker._adjustDate(event.target, -7, "D");
}
handled = event.ctrlKey || event.metaKey;
break; // -1 week on ctrl or command +up
case 39: if (event.ctrlKey || event.metaKey) {
$.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
}
handled = event.ctrlKey || event.metaKey;
// +1 day on ctrl or command +right
if (event.originalEvent.altKey) {
$.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, "stepBigMonths") :
+$.datepicker._get(inst, "stepMonths")), "M");
}
// next month/year on alt +right
break;
case 40: if (event.ctrlKey || event.metaKey) {
$.datepicker._adjustDate(event.target, +7, "D");
}
handled = event.ctrlKey || event.metaKey;
break; // +1 week on ctrl or command +down
default: handled = false;
}
} else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
$.datepicker._showDatepicker(this);
} else {
handled = false;
}
if (handled) {
event.preventDefault();
event.stopPropagation();
}
},
/* Filter entered characters - based on date format. */
_doKeyPress: function(event) {
var chars, chr,
inst = $.datepicker._getInst(event.target);
if ($.datepicker._get(inst, "constrainInput")) {
chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
}
},
/* Synchronise manual entry and field/alternate field. */
_doKeyUp: function(event) {
var date,
inst = $.datepicker._getInst(event.target);
if (inst.input.val() !== inst.lastVal) {
try {
date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}
}
catch (err) {
}
}
return true;
},
/* Pop-up the date picker for a given input field.
* If false returned from beforeShow event handler do not show.
* @param input element - the input field attached to the date picker or
* event - if triggered by focus
*/
_showDatepicker: function(input) {
input = input.target || input;
if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
input = $("input", input.parentNode)[0];
}
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
return;
}
var inst, beforeShow, beforeShowSettings, isFixed,
offset, showAnim, duration;
inst = $.datepicker._getInst(input);
if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
$.datepicker._curInst.dpDiv.stop(true, true);
if ( inst && $.datepicker._datepickerShowing ) {
$.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
}
}
beforeShow = $.datepicker._get(inst, "beforeShow");
beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
if(beforeShowSettings === false){
return;
}
datepicker_extendRemove(inst.settings, beforeShowSettings);
inst.lastVal = null;
$.datepicker._lastInput = input;
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) { // hide cursor
input.value = "";
}
if (!$.datepicker._pos) { // position below input
$.datepicker._pos = $.datepicker._findPos(input);
$.datepicker._pos[1] += input.offsetHeight; // add the height
}
isFixed = false;
$(input).parents().each(function() {
isFixed |= $(this).css("position") === "fixed";
return !isFixed;
});
offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
$.datepicker._pos = null;
//to avoid flashes on Firefox
inst.dpDiv.empty();
// determine sizing offscreen
inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
$.datepicker._updateDatepicker(inst);
// fix width for dynamic number of date pickers
// and adjust position before showing
offset = $.datepicker._checkOffset(inst, offset, isFixed);
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
"static" : (isFixed ? "fixed" : "absolute")), display: "none",
left: offset.left + "px", top: offset.top + "px"});
if (!inst.inline) {
showAnim = $.datepicker._get(inst, "showAnim");
duration = $.datepicker._get(inst, "duration");
inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
$.datepicker._datepickerShowing = true;
if ( $.effects && $.effects.effect[ showAnim ] ) {
inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
} else {
inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
}
if ( $.datepicker._shouldFocusInput( inst ) ) {
inst.input.focus();
}
$.datepicker._curInst = inst;
}
},
/* Generate the date picker content. */
_updateDatepicker: function(inst) {
this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
datepicker_instActive = inst; // for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));
this._attachHandlers(inst);
var origyearshtml,
numMonths = this._getNumberOfMonths(inst),
cols = numMonths[1],
width = 17,
activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
if ( activeCell.length > 0 ) {
datepicker_handleMouseover.apply( activeCell.get( 0 ) );
}
inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
if (cols > 1) {
inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
}
inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
"Class"]("ui-datepicker-multi");
inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
"Class"]("ui-datepicker-rtl");
if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
inst.input.focus();
}
// deffered render of the years select (to avoid flashes on Firefox)
if( inst.yearshtml ){
origyearshtml = inst.yearshtml;
setTimeout(function(){
//assure that inst.yearshtml didn't change.
if( origyearshtml === inst.yearshtml && inst.yearshtml ){
inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
}
origyearshtml = inst.yearshtml = null;
}, 0);
}
},
// #6694 - don't focus the input if it's already focused
// this breaks the change event in IE
// Support: IE and jQuery <1.9
_shouldFocusInput: function( inst ) {
return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
},
/* Check positioning to remain on screen. */
_checkOffset: function(inst, offset, isFixed) {
var dpWidth = inst.dpDiv.outerWidth(),
dpHeight = inst.dpDiv.outerHeight(),
inputWidth = inst.input ? inst.input.outerWidth() : 0,
inputHeight = inst.input ? inst.input.outerHeight() : 0,
viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
// now check if datepicker is showing outside window viewport - move to a better place if so.
offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
Math.abs(offset.left + dpWidth - viewWidth) : 0);
offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
Math.abs(dpHeight + inputHeight) : 0);
return offset;
},
/* Find an object's position on the screen. */
_findPos: function(obj) {
var position,
inst = this._getInst(obj),
isRTL = this._get(inst, "isRTL");
while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
obj = obj[isRTL ? "previousSibling" : "nextSibling"];
}
position = $(obj).offset();
return [position.left, position.top];
},
/* Hide the date picker from view.
* @param input element - the input field attached to the date picker
*/
_hideDatepicker: function(input) {
var showAnim, duration, postProcess, onClose,
inst = this._curInst;
if (!inst || (input && inst !== $.data(input, "datepicker"))) {
return;
}
if (this._datepickerShowing) {
showAnim = this._get(inst, "showAnim");
duration = this._get(inst, "duration");
postProcess = function() {
$.datepicker._tidyDialog(inst);
};
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
} else {
inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
(showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
}
if (!showAnim) {
postProcess();
}
this._datepickerShowing = false;
onClose = this._get(inst, "onClose");
if (onClose) {
onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
}
this._lastInput = null;
if (this._inDialog) {
this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
if ($.blockUI) {
$.unblockUI();
$("body").append(this.dpDiv);
}
}
this._inDialog = false;
}
},
/* Tidy up after a dialog display. */
_tidyDialog: function(inst) {
inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
},
/* Close date picker if clicked elsewhere. */
_checkExternalClick: function(event) {
if (!$.datepicker._curInst) {
return;
}
var $target = $(event.target),
inst = $.datepicker._getInst($target[0]);
if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
$target.parents("#" + $.datepicker._mainDivId).length === 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
$.datepicker._hideDatepicker();
}
},
/* Adjust one of the date sub-fields. */
_adjustDate: function(id, offset, period) {
var target = $(id),
inst = this._getInst(target[0]);
if (this._isDisabledDatepicker(target[0])) {
return;
}
this._adjustInstDate(inst, offset +
(period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
period);
this._updateDatepicker(inst);
},
/* Action for current link. */
_gotoToday: function(id) {
var date,
target = $(id),
inst = this._getInst(target[0]);
if (this._get(inst, "gotoCurrent") && inst.currentDay) {
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
} else {
date = new Date();
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
}
this._notifyChange(inst);
this._adjustDate(target);
},
/* Action for selecting a new month/year. */
_selectMonthYear: function(id, select, period) {
var target = $(id),
inst = this._getInst(target[0]);
inst["selected" + (period === "M" ? "Month" : "Year")] =
inst["draw" + (period === "M" ? "Month" : "Year")] =
parseInt(select.options[select.selectedIndex].value,10);
this._notifyChange(inst);
this._adjustDate(target);
},
/* Action for selecting a day. */
_selectDay: function(id, month, year, td) {
var inst,
target = $(id);
if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
return;
}
inst = this._getInst(target[0]);
inst.selectedDay = inst.currentDay = $("a", td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
},
/* Erase the input field and hide the date picker. */
_clearDate: function(id) {
var target = $(id);
this._selectDate(target, "");
},
/* Update the input field with the selected date. */
_selectDate: function(id, dateStr) {
var onSelect,
target = $(id),
inst = this._getInst(target[0]);
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
if (inst.input) {
inst.input.val(dateStr);
}
this._updateAlternate(inst);
onSelect = this._get(inst, "onSelect");
if (onSelect) {
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
} else if (inst.input) {
inst.input.trigger("change"); // fire the change event
}
if (inst.inline){
this._updateDatepicker(inst);
} else {
this._hideDatepicker();
this._lastInput = inst.input[0];
if (typeof(inst.input[0]) !== "object") {
inst.input.focus(); // restore focus
}
this._lastInput = null;
}
},
/* Update any alternate field to synchronise with the main field. */
_updateAlternate: function(inst) {
var altFormat, date, dateStr,
altField = this._get(inst, "altField");
if (altField) { // update alternate field too
altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
date = this._getDate(inst);
dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
$(altField).each(function() { $(this).val(dateStr); });
}
},
/* Set as beforeShowDay function to prevent selection of weekends.
* @param date Date - the date to customise
* @return [boolean, string] - is this date selectable?, what is its CSS class?
*/
noWeekends: function(date) {
var day = date.getDay();
return [(day > 0 && day < 6), ""];
},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
* @param date Date - the date to get the week for
* @return number - the number of the week within the year that contains this date
*/
iso8601Week: function(date) {
var time,
checkDate = new Date(date.getTime());
// Find Thursday of this week starting on Monday
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
time = checkDate.getTime();
checkDate.setMonth(0); // Compare with Jan 1
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
},
/* Parse a string value into a date object.
* See formatDate below for the possible formats.
*
* @param format string - the expected format of the date
* @param value string - the date in the above format
* @param settings Object - attributes include:
* shortYearCutoff number - the cutoff year for determining the century (optional)
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return Date - the extracted date value or null if value is blank
*/
parseDate: function (format, value, settings) {
if (format == null || value == null) {
throw "Invalid arguments";
}
value = (typeof value === "object" ? value.toString() : value + "");
if (value === "") {
return null;
}
var iFormat, dim, extra,
iValue = 0,
shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
year = -1,
month = -1,
day = -1,
doy = -1,
literal = false,
date,
// Check whether a format character is doubled
lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
if (matches) {
iFormat++;
}
return matches;
},
// Extract a number from the string value
getNumber = function(match) {
var isDoubled = lookAhead(match),
size = (match === "@" ? 14 : (match === "!" ? 20 :
(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
minSize = (match === "y" ? size : 1),
digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
num = value.substring(iValue).match(digits);
if (!num) {
throw "Missing number at position " + iValue;
}
iValue += num[0].length;
return parseInt(num[0], 10);
},
// Extract a name from the string value and convert to an index
getName = function(match, shortNames, longNames) {
var index = -1,
names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
return [ [k, v] ];
}).sort(function (a, b) {
return -(a[1].length - b[1].length);
});
$.each(names, function (i, pair) {
var name = pair[1];
if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
index = pair[0];
iValue += name.length;
return false;
}
});
if (index !== -1) {
return index + 1;
} else {
throw "Unknown name at position " + iValue;
}
},
// Confirm that a literal character matches the string value
checkLiteral = function() {
if (value.charAt(iValue) !== format.charAt(iFormat)) {
throw "Unexpected literal at position " + iValue;
}
iValue++;
};
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
literal = false;
} else {
checkLiteral();
}
} else {
switch (format.charAt(iFormat)) {
case "d":
day = getNumber("d");
break;
case "D":
getName("D", dayNamesShort, dayNames);
break;
case "o":
doy = getNumber("o");
break;
case "m":
month = getNumber("m");
break;
case "M":
month = getName("M", monthNamesShort, monthNames);
break;
case "y":
year = getNumber("y");
break;
case "@":
date = new Date(getNumber("@"));
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "!":
date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "'":
if (lookAhead("'")){
checkLiteral();
} else {
literal = true;
}
break;
default:
checkLiteral();
}
}
}
if (iValue < value.length){
extra = value.substr(iValue);
if (!/^\s+/.test(extra)) {
throw "Extra/unparsed characters found in date: " + extra;
}
}
if (year === -1) {
year = new Date().getFullYear();
} else if (year < 100) {
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <= shortYearCutoff ? 0 : -100);
}
if (doy > -1) {
month = 1;
day = doy;
do {
dim = this._getDaysInMonth(year, month - 1);
if (day <= dim) {
break;
}
month++;
day -= dim;
} while (true);
}
date = this._daylightSavingAdjust(new Date(year, month - 1, day));
if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
throw "Invalid date"; // E.g. 31/02/00
}
return date;
},
/* Standard date formats. */
ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
COOKIE: "D, dd M yy",
ISO_8601: "yy-mm-dd",
RFC_822: "D, d M y",
RFC_850: "DD, dd-M-y",
RFC_1036: "D, d M y",
RFC_1123: "D, d M yy",
RFC_2822: "D, d M yy",
RSS: "D, d M y", // RFC 822
TICKS: "!",
TIMESTAMP: "@",
W3C: "yy-mm-dd", // ISO 8601
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
/* Format a date object into a string value.
* The format can be combinations of the following:
* d - day of month (no leading zero)
* dd - day of month (two digit)
* o - day of year (no leading zeros)
* oo - day of year (three digit)
* D - day name short
* DD - day name long
* m - month of year (no leading zero)
* mm - month of year (two digit)
* M - month name short
* MM - month name long
* y - year (two digit)
* yy - year (four digit)
* @ - Unix timestamp (ms since 01/01/1970)
* ! - Windows ticks (100ns since 01/01/0001)
* "..." - literal text
* '' - single quote
*
* @param format string - the desired format of the date
* @param date Date - the date value to format
* @param settings Object - attributes include:
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return string - the date in the above format
*/
formatDate: function (format, date, settings) {
if (!date) {
return "";
}
var iFormat,
dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
// Check whether a format character is doubled
lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
if (matches) {
iFormat++;
}
return matches;
},
// Format a number, with leading zero if necessary
formatNumber = function(match, value, len) {
var num = "" + value;
if (lookAhead(match)) {
while (num.length < len) {
num = "0" + num;
}
}
return num;
},
// Format a name, short or long as requested
formatName = function(match, value, shortNames, longNames) {
return (lookAhead(match) ? longNames[value] : shortNames[value]);
},
output = "",
literal = false;
if (date) {
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
literal = false;
} else {
output += format.charAt(iFormat);
}
} else {
switch (format.charAt(iFormat)) {
case "d":
output += formatNumber("d", date.getDate(), 2);
break;
case "D":
output += formatName("D", date.getDay(), dayNamesShort, dayNames);
break;
case "o":
output += formatNumber("o",
Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
break;
case "m":
output += formatNumber("m", date.getMonth() + 1, 2);
break;
case "M":
output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
break;
case "y":
output += (lookAhead("y") ? date.getFullYear() :
(date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
break;
case "@":
output += date.getTime();
break;
case "!":
output += date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
if (lookAhead("'")) {
output += "'";
} else {
literal = true;
}
break;
default:
output += format.charAt(iFormat);
}
}
}
}
return output;
},
/* Extract all possible characters from the date format. */
_possibleChars: function (format) {
var iFormat,
chars = "",
literal = false,
// Check whether a format character is doubled
lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
if (matches) {
iFormat++;
}
return matches;
};
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
literal = false;
} else {
chars += format.charAt(iFormat);
}
} else {
switch (format.charAt(iFormat)) {
case "d": case "m": case "y": case "@":
chars += "0123456789";
break;
case "D": case "M":
return null; // Accept anything
case "'":
if (lookAhead("'")) {
chars += "'";
} else {
literal = true;
}
break;
default:
chars += format.charAt(iFormat);
}
}
}
return chars;
},
/* Get a setting value, defaulting if necessary. */
_get: function(inst, name) {
return inst.settings[name] !== undefined ?
inst.settings[name] : this._defaults[name];
},
/* Parse existing date and initialise date picker. */
_setDateFromField: function(inst, noDefault) {
if (inst.input.val() === inst.lastVal) {
return;
}
var dateFormat = this._get(inst, "dateFormat"),
dates = inst.lastVal = inst.input ? inst.input.val() : null,
defaultDate = this._getDefaultDate(inst),
date = defaultDate,
settings = this._getFormatConfig(inst);
try {
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
} catch (event) {
dates = (noDefault ? "" : dates);
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
inst.currentDay = (dates ? date.getDate() : 0);
inst.currentMonth = (dates ? date.getMonth() : 0);
inst.currentYear = (dates ? date.getFullYear() : 0);
this._adjustInstDate(inst);
},
/* Retrieve the default date shown on opening. */
_getDefaultDate: function(inst) {
return this._restrictMinMax(inst,
this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
},
/* A date may be specified as an exact value or a relative one. */
_determineDate: function(inst, date, defaultDate) {
var offsetNumeric = function(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
},
offsetString = function(offset) {
try {
return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
offset, $.datepicker._getFormatConfig(inst));
}
catch (e) {
// Ignore
}
var date = (offset.toLowerCase().match(/^c/) ?
$.datepicker._getDate(inst) : null) || new Date(),
year = date.getFullYear(),
month = date.getMonth(),
day = date.getDate(),
pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || "d") {
case "d" : case "D" :
day += parseInt(matches[1],10); break;
case "w" : case "W" :
day += parseInt(matches[1],10) * 7; break;
case "m" : case "M" :
month += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
case "y": case "Y" :
year += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day);
},
newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
(typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
if (newDate) {
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
newDate.setMilliseconds(0);
}
return this._daylightSavingAdjust(newDate);
},
/* Handle switch to/from daylight saving.
* Hours may be non-zero on daylight saving cut-over:
* > 12 when midnight changeover, but then cannot generate
* midnight datetime, so jump to 1AM, otherwise reset.
* @param date (Date) the date to check
* @return (Date) the corrected date
*/
_daylightSavingAdjust: function(date) {
if (!date) {
return null;
}
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return date;
},
/* Set the date(s) directly. */
_setDate: function(inst, date, noChange) {
var clear = !date,
origMonth = inst.selectedMonth,
origYear = inst.selectedYear,
newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
inst.selectedDay = inst.currentDay = newDate.getDate();
inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
this._notifyChange(inst);
}
this._adjustInstDate(inst);
if (inst.input) {
inst.input.val(clear ? "" : this._formatDate(inst));
}
},
/* Retrieve the date(s) directly. */
_getDate: function(inst) {
var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay)));
return startDate;
},
/* Attach the onxxx handlers. These are declared statically so
* they work with static code transformers like Caja.
*/
_attachHandlers: function(inst) {
var stepMonths = this._get(inst, "stepMonths"),
id = "#" + inst.id.replace( /\\\\/g, "\\" );
inst.dpDiv.find("[data-handler]").map(function () {
var handler = {
prev: function () {
$.datepicker._adjustDate(id, -stepMonths, "M");
},
next: function () {
$.datepicker._adjustDate(id, +stepMonths, "M");
},
hide: function () {
$.datepicker._hideDatepicker();
},
today: function () {
$.datepicker._gotoToday(id);
},
selectDay: function () {
$.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
return false;
},
selectMonth: function () {
$.datepicker._selectMonthYear(id, this, "M");
return false;
},
selectYear: function () {
$.datepicker._selectMonthYear(id, this, "Y");
return false;
}
};
$(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
});
},
/* Generate the HTML for the current state of the date picker. */
_generateHTML: function(inst) {
var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
printDate, dRow, tbody, daySettings, otherMonth, unselectable,
tempDate = new Date(),
today = this._daylightSavingAdjust(
new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
isRTL = this._get(inst, "isRTL"),
showButtonPanel = this._get(inst, "showButtonPanel"),
hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
numMonths = this._getNumberOfMonths(inst),
showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
stepMonths = this._get(inst, "stepMonths"),
isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
minDate = this._getMinMaxDate(inst, "min"),
maxDate = this._getMinMaxDate(inst, "max"),
drawMonth = inst.drawMonth - showCurrentAtPos,
drawYear = inst.drawYear;
if (drawMonth < 0) {
drawMonth += 12;
drawYear--;
}
if (maxDate) {
maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
drawMonth--;
if (drawMonth < 0) {
drawMonth = 11;
drawYear--;
}
}
}
inst.drawMonth = drawMonth;
inst.drawYear = drawYear;
prevText = this._get(inst, "prevText");
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
this._getFormatConfig(inst)));
prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
" title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
nextText = this._get(inst, "nextText");
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
this._getFormatConfig(inst)));
next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
" title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
currentText = this._get(inst, "currentText");
gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
this._get(inst, "closeText") + "</button>" : "");
buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
(this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
firstDay = parseInt(this._get(inst, "firstDay"),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
showWeek = this._get(inst, "showWeek");
dayNames = this._get(inst, "dayNames");
dayNamesMin = this._get(inst, "dayNamesMin");
monthNames = this._get(inst, "monthNames");
monthNamesShort = this._get(inst, "monthNamesShort");
beforeShowDay = this._get(inst, "beforeShowDay");
showOtherMonths = this._get(inst, "showOtherMonths");
selectOtherMonths = this._get(inst, "selectOtherMonths");
defaultDate = this._getDefaultDate(inst);
html = "";
dow;
for (row = 0; row < numMonths[0]; row++) {
group = "";
this.maxRows = 4;
for (col = 0; col < numMonths[1]; col++) {
selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
cornerClass = " ui-corner-all";
calender = "";
if (isMultiMonth) {
calender += "<div class='ui-datepicker-group";
if (numMonths[1] > 1) {
switch (col) {
case 0: calender += " ui-datepicker-group-first";
cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
case numMonths[1]-1: calender += " ui-datepicker-group-last";
cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
}
}
calender += "'>";
}
calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
(/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
(/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
"</div><table class='ui-datepicker-calendar'><thead>" +
"<tr>";
thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
for (dow = 0; dow < 7; dow++) { // days of the week
day = (dow + firstDay) % 7;
thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
"<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
}
calender += thead + "</tr></thead><tbody>";
daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
}
leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
this.maxRows = numRows;
printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += "<tr>";
tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
this._get(inst, "calculateWeek")(printDate) + "</td>");
for (dow = 0; dow < 7; dow++) { // create date picker days
daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
otherMonth = (printDate.getMonth() !== drawMonth);
unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
tbody += "<td class='" +
((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
(otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
(defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
// or defaultDate is current printedDate and defaultDate is selectedDate
" " + this._dayOverClass : "") + // highlight selected day
(unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days
(otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
(printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
(printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title
(unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
(otherMonth && !showOtherMonths ? " " : // display for other months
(unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
(printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
(printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
(otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
"' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
printDate.setDate(printDate.getDate() + 1);
printDate = this._daylightSavingAdjust(printDate);
}
calender += tbody + "</tr>";
}
drawMonth++;
if (drawMonth > 11) {
drawMonth = 0;
drawYear++;
}
calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
group += calender;
}
html += group;
}
html += buttonPanel;
inst._keyEvent = false;
return html;
},
/* Generate the month and year header. */
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth = this._get(inst, "changeMonth"),
changeYear = this._get(inst, "changeYear"),
showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
html = "<div class='ui-datepicker-title'>",
monthHtml = "";
// month selection
if (secondary || !changeMonth) {
monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
} else {
inMinYear = (minDate && minDate.getFullYear() === drawYear);
inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
for ( month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
monthHtml += "<option value='" + month + "'" +
(month === drawMonth ? " selected='selected'" : "") +
">" + monthNamesShort[month] + "</option>";
}
}
monthHtml += "</select>";
}
if (!showMonthAfterYear) {
html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : "");
}
// year selection
if ( !inst.yearshtml ) {
inst.yearshtml = "";
if (secondary || !changeYear) {
html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
} else {
// determine range of years to display
years = this._get(inst, "yearRange").split(":");
thisYear = new Date().getFullYear();
determineYear = function(value) {
var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10)));
return (isNaN(year) ? thisYear : year);
};
year = determineYear(years[0]);
endYear = Math.max(year, determineYear(years[1] || ""));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
for (; year <= endYear; year++) {
inst.yearshtml += "<option value='" + year + "'" +
(year === drawYear ? " selected='selected'" : "") +
">" + year + "</option>";
}
inst.yearshtml += "</select>";
html += inst.yearshtml;
inst.yearshtml = null;
}
}
html += this._get(inst, "yearSuffix");
if (showMonthAfterYear) {
html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml;
}
html += "</div>"; // Close datepicker_header
return html;
},
/* Adjust one of the date sub-fields. */
_adjustInstDate: function(inst, offset, period) {
var year = inst.drawYear + (period === "Y" ? offset : 0),
month = inst.drawMonth + (period === "M" ? offset : 0),
day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
if (period === "M" || period === "Y") {
this._notifyChange(inst);
}
},
/* Ensure a date is within any min/max bounds. */
_restrictMinMax: function(inst, date) {
var minDate = this._getMinMaxDate(inst, "min"),
maxDate = this._getMinMaxDate(inst, "max"),
newDate = (minDate && date < minDate ? minDate : date);
return (maxDate && newDate > maxDate ? maxDate : newDate);
},
/* Notify change of month/year. */
_notifyChange: function(inst) {
var onChange = this._get(inst, "onChangeMonthYear");
if (onChange) {
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
}
},
/* Determine the number of months to show. */
_getNumberOfMonths: function(inst) {
var numMonths = this._get(inst, "numberOfMonths");
return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate: function(inst, minMax) {
return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
},
/* Find the number of days in a given month. */
_getDaysInMonth: function(year, month) {
return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
},
/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth: function(year, month) {
return new Date(year, month, 1).getDay();
},
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
var numMonths = this._getNumberOfMonths(inst),
date = this._daylightSavingAdjust(new Date(curYear,
curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
if (offset < 0) {
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
}
return this._isInRange(inst, date);
},
/* Is the given date in the accepted range? */
_isInRange: function(inst, date) {
var yearSplit, currentYear,
minDate = this._getMinMaxDate(inst, "min"),
maxDate = this._getMinMaxDate(inst, "max"),
minYear = null,
maxYear = null,
years = this._get(inst, "yearRange");
if (years){
yearSplit = years.split(":");
currentYear = new Date().getFullYear();
minYear = parseInt(yearSplit[0], 10);
maxYear = parseInt(yearSplit[1], 10);
if ( yearSplit[0].match(/[+\-].*/) ) {
minYear += currentYear;
}
if ( yearSplit[1].match(/[+\-].*/) ) {
maxYear += currentYear;
}
}
return ((!minDate || date.getTime() >= minDate.getTime()) &&
(!maxDate || date.getTime() <= maxDate.getTime()) &&
(!minYear || date.getFullYear() >= minYear) &&
(!maxYear || date.getFullYear() <= maxYear));
},
/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig: function(inst) {
var shortYearCutoff = this._get(inst, "shortYearCutoff");
shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
return {shortYearCutoff: shortYearCutoff,
dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
},
/* Format the given date for display. */
_formatDate: function(inst, day, month, year) {
if (!day) {
inst.currentDay = inst.selectedDay;
inst.currentMonth = inst.selectedMonth;
inst.currentYear = inst.selectedYear;
}
var date = (day ? (typeof day === "object" ? day :
this._daylightSavingAdjust(new Date(year, month, day))) :
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
}
});
/*
* Bind hover events for datepicker elements.
* Done via delegate so the binding only occurs once in the lifetime of the parent div.
* Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
*/
function datepicker_bindHover(dpDiv) {
var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
return dpDiv.delegate(selector, "mouseout", function() {
$(this).removeClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).removeClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).removeClass("ui-datepicker-next-hover");
}
})
.delegate( selector, "mouseover", datepicker_handleMouseover );
}
function datepicker_handleMouseover() {
if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
$(this).addClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).addClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).addClass("ui-datepicker-next-hover");
}
}
}
/* jQuery extend now ignores nulls! */
function datepicker_extendRemove(target, props) {
$.extend(target, props);
for (var name in props) {
if (props[name] == null) {
target[name] = props[name];
}
}
return target;
}
/* Invoke the datepicker functionality.
@param options string - a command, optionally followed by additional parameters or
Object - settings for attaching new datepicker functionality
@return jQuery object */
$.fn.datepicker = function(options){
/* Verify an empty collection wasn't passed - Fixes #6976 */
if ( !this.length ) {
return this;
}
/* Initialise the date picker. */
if (!$.datepicker.initialized) {
$(document).mousedown($.datepicker._checkExternalClick);
$.datepicker.initialized = true;
}
/* Append datepicker main container to body if not exist. */
if ($("#"+$.datepicker._mainDivId).length === 0) {
$("body").append($.datepicker.dpDiv);
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
return $.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this[0]].concat(otherArgs));
}
if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
return $.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this[0]].concat(otherArgs));
}
return this.each(function() {
typeof options === "string" ?
$.datepicker["_" + options + "Datepicker"].
apply($.datepicker, [this].concat(otherArgs)) :
$.datepicker._attachDatepicker(this, options);
});
};
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.11.4";
var datepicker = $.datepicker;
/*!
* jQuery UI Dialog 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/dialog/
*/
var dialog = $.widget( "ui.dialog", {
version: "1.11.4",
options: {
appendTo: "body",
autoOpen: true,
buttons: [],
closeOnEscape: true,
closeText: "Close",
dialogClass: "",
draggable: true,
hide: null,
height: "auto",
maxHeight: null,
maxWidth: null,
minHeight: 150,
minWidth: 150,
modal: false,
position: {
my: "center",
at: "center",
of: window,
collision: "fit",
// Ensure the titlebar is always visible
using: function( pos ) {
var topOffset = $( this ).css( pos ).offset().top;
if ( topOffset < 0 ) {
$( this ).css( "top", pos.top - topOffset );
}
}
},
resizable: true,
show: null,
title: null,
width: 300,
// callbacks
beforeClose: null,
close: null,
drag: null,
dragStart: null,
dragStop: null,
focus: null,
open: null,
resize: null,
resizeStart: null,
resizeStop: null
},
sizeRelatedOptions: {
buttons: true,
height: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
width: true
},
resizableRelatedOptions: {
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true
},
_create: function() {
this.originalCss = {
display: this.element[ 0 ].style.display,
width: this.element[ 0 ].style.width,
minHeight: this.element[ 0 ].style.minHeight,
maxHeight: this.element[ 0 ].style.maxHeight,
height: this.element[ 0 ].style.height
};
this.originalPosition = {
parent: this.element.parent(),
index: this.element.parent().children().index( this.element )
};
this.originalTitle = this.element.attr( "title" );
this.options.title = this.options.title || this.originalTitle;
this._createWrapper();
this.element
.show()
.removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" )
.appendTo( this.uiDialog );
this._createTitlebar();
this._createButtonPane();
if ( this.options.draggable && $.fn.draggable ) {
this._makeDraggable();
}
if ( this.options.resizable && $.fn.resizable ) {
this._makeResizable();
}
this._isOpen = false;
this._trackFocus();
},
_init: function() {
if ( this.options.autoOpen ) {
this.open();
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element && (element.jquery || element.nodeType) ) {
return $( element );
}
return this.document.find( element || "body" ).eq( 0 );
},
_destroy: function() {
var next,
originalPosition = this.originalPosition;
this._untrackInstance();
this._destroyOverlay();
this.element
.removeUniqueId()
.removeClass( "ui-dialog-content ui-widget-content" )
.css( this.originalCss )
// Without detaching first, the following becomes really slow
.detach();
this.uiDialog.stop( true, true ).remove();
if ( this.originalTitle ) {
this.element.attr( "title", this.originalTitle );
}
next = originalPosition.parent.children().eq( originalPosition.index );
// Don't try to place the dialog next to itself (#8613)
if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
next.before( this.element );
} else {
originalPosition.parent.append( this.element );
}
},
widget: function() {
return this.uiDialog;
},
disable: $.noop,
enable: $.noop,
close: function( event ) {
var activeElement,
that = this;
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
return;
}
this._isOpen = false;
this._focusedElement = null;
this._destroyOverlay();
this._untrackInstance();
if ( !this.opener.filter( ":focusable" ).focus().length ) {
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
activeElement = this.document[ 0 ].activeElement;
// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #4520
if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
// Hiding a focused element doesn't trigger blur in WebKit
// so in case we have nothing to focus on, explicitly blur the active element
// https://bugs.webkit.org/show_bug.cgi?id=47182
$( activeElement ).blur();
}
} catch ( error ) {}
}
this._hide( this.uiDialog, this.options.hide, function() {
that._trigger( "close", event );
});
},
isOpen: function() {
return this._isOpen;
},
moveToTop: function() {
this._moveToTop();
},
_moveToTop: function( event, silent ) {
var moved = false,
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
return +$( this ).css( "z-index" );
}).get(),
zIndexMax = Math.max.apply( null, zIndices );
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
this.uiDialog.css( "z-index", zIndexMax + 1 );
moved = true;
}
if ( moved && !silent ) {
this._trigger( "focus", event );
}
return moved;
},
open: function() {
var that = this;
if ( this._isOpen ) {
if ( this._moveToTop() ) {
this._focusTabbable();
}
return;
}
this._isOpen = true;
this.opener = $( this.document[ 0 ].activeElement );
this._size();
this._position();
this._createOverlay();
this._moveToTop( null, true );
// Ensure the overlay is moved to the top with the dialog, but only when
// opening. The overlay shouldn't move after the dialog is open so that
// modeless dialogs opened after the modal dialog stack properly.
if ( this.overlay ) {
this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
}
this._show( this.uiDialog, this.options.show, function() {
that._focusTabbable();
that._trigger( "focus" );
});
// Track the dialog immediately upon openening in case a focus event
// somehow occurs outside of the dialog before an element inside the
// dialog is focused (#10152)
this._makeFocusTarget();
this._trigger( "open" );
},
_focusTabbable: function() {
// Set focus to the first match:
// 1. An element that was focused previously
// 2. First element inside the dialog matching [autofocus]
// 3. Tabbable element inside the content element
// 4. Tabbable element inside the buttonpane
// 5. The close button
// 6. The dialog itself
var hasFocus = this._focusedElement;
if ( !hasFocus ) {
hasFocus = this.element.find( "[autofocus]" );
}
if ( !hasFocus.length ) {
hasFocus = this.element.find( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialog;
}
hasFocus.eq( 0 ).focus();
},
_keepFocus: function( event ) {
function checkFocus() {
var activeElement = this.document[0].activeElement,
isActive = this.uiDialog[0] === activeElement ||
$.contains( this.uiDialog[0], activeElement );
if ( !isActive ) {
this._focusTabbable();
}
}
event.preventDefault();
checkFocus.call( this );
// support: IE
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
// so we check again later
this._delay( checkFocus );
},
_createWrapper: function() {
this.uiDialog = $("<div>")
.addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
this.options.dialogClass )
.hide()
.attr({
// Setting tabIndex makes the div focusable
tabIndex: -1,
role: "dialog"
})
.appendTo( this._appendTo() );
this._on( this.uiDialog, {
keydown: function( event ) {
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
event.keyCode === $.ui.keyCode.ESCAPE ) {
event.preventDefault();
this.close( event );
return;
}
// prevent tabbing out of dialogs
if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
return;
}
var tabbables = this.uiDialog.find( ":tabbable" ),
first = tabbables.filter( ":first" ),
last = tabbables.filter( ":last" );
if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
this._delay(function() {
first.focus();
});
event.preventDefault();
} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
this._delay(function() {
last.focus();
});
event.preventDefault();
}
},
mousedown: function( event ) {
if ( this._moveToTop( event ) ) {
this._focusTabbable();
}
}
});
// We assume that any existing aria-describedby attribute means
// that the dialog content is marked up properly
// otherwise we brute force the content as the description
if ( !this.element.find( "[aria-describedby]" ).length ) {
this.uiDialog.attr({
"aria-describedby": this.element.uniqueId().attr( "id" )
});
}
},
_createTitlebar: function() {
var uiDialogTitle;
this.uiDialogTitlebar = $( "<div>" )
.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
.prependTo( this.uiDialog );
this._on( this.uiDialogTitlebar, {
mousedown: function( event ) {
// Don't prevent click on close button (#8838)
// Focusing a dialog that is partially scrolled out of view
// causes the browser to scroll it into view, preventing the click event
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
// Dialog isn't getting focus when dragging (#8063)
this.uiDialog.focus();
}
}
});
// support: IE
// Use type="button" to prevent enter keypresses in textboxes from closing the
// dialog in IE (#9312)
this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
.button({
label: this.options.closeText,
icons: {
primary: "ui-icon-closethick"
},
text: false
})
.addClass( "ui-dialog-titlebar-close" )
.appendTo( this.uiDialogTitlebar );
this._on( this.uiDialogTitlebarClose, {
click: function( event ) {
event.preventDefault();
this.close( event );
}
});
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
.prependTo( this.uiDialogTitlebar );
this._title( uiDialogTitle );
this.uiDialog.attr({
"aria-labelledby": uiDialogTitle.attr( "id" )
});
},
_title: function( title ) {
if ( !this.options.title ) {
title.html( " " );
}
title.text( this.options.title );
},
_createButtonPane: function() {
this.uiDialogButtonPane = $( "<div>" )
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
this.uiButtonSet = $( "<div>" )
.addClass( "ui-dialog-buttonset" )
.appendTo( this.uiDialogButtonPane );
this._createButtons();
},
_createButtons: function() {
var that = this,
buttons = this.options.buttons;
// if we already have a button pane, remove it
this.uiDialogButtonPane.remove();
this.uiButtonSet.empty();
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
this.uiDialog.removeClass( "ui-dialog-buttons" );
return;
}
$.each( buttons, function( name, props ) {
var click, buttonOptions;
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
// Change the context for the click callback to be the main element
click = props.click;
props.click = function() {
click.apply( that.element[ 0 ], arguments );
};
buttonOptions = {
icons: props.icons,
text: props.showText
};
delete props.icons;
delete props.showText;
$( "<button></button>", props )
.button( buttonOptions )
.appendTo( that.uiButtonSet );
});
this.uiDialog.addClass( "ui-dialog-buttons" );
this.uiDialogButtonPane.appendTo( this.uiDialog );
},
_makeDraggable: function() {
var that = this,
options = this.options;
function filteredUi( ui ) {
return {
position: ui.position,
offset: ui.offset
};
}
this.uiDialog.draggable({
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
handle: ".ui-dialog-titlebar",
containment: "document",
start: function( event, ui ) {
$( this ).addClass( "ui-dialog-dragging" );
that._blockFrames();
that._trigger( "dragStart", event, filteredUi( ui ) );
},
drag: function( event, ui ) {
that._trigger( "drag", event, filteredUi( ui ) );
},
stop: function( event, ui ) {
var left = ui.offset.left - that.document.scrollLeft(),
top = ui.offset.top - that.document.scrollTop();
options.position = {
my: "left top",
at: "left" + (left >= 0 ? "+" : "") + left + " " +
"top" + (top >= 0 ? "+" : "") + top,
of: that.window
};
$( this ).removeClass( "ui-dialog-dragging" );
that._unblockFrames();
that._trigger( "dragStop", event, filteredUi( ui ) );
}
});
},
_makeResizable: function() {
var that = this,
options = this.options,
handles = options.resizable,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css("position"),
resizeHandles = typeof handles === "string" ?
handles :
"n,e,s,w,se,sw,ne,nw";
function filteredUi( ui ) {
return {
originalPosition: ui.originalPosition,
originalSize: ui.originalSize,
position: ui.position,
size: ui.size
};
}
this.uiDialog.resizable({
cancel: ".ui-dialog-content",
containment: "document",
alsoResize: this.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
minHeight: this._minHeight(),
handles: resizeHandles,
start: function( event, ui ) {
$( this ).addClass( "ui-dialog-resizing" );
that._blockFrames();
that._trigger( "resizeStart", event, filteredUi( ui ) );
},
resize: function( event, ui ) {
that._trigger( "resize", event, filteredUi( ui ) );
},
stop: function( event, ui ) {
var offset = that.uiDialog.offset(),
left = offset.left - that.document.scrollLeft(),
top = offset.top - that.document.scrollTop();
options.height = that.uiDialog.height();
options.width = that.uiDialog.width();
options.position = {
my: "left top",
at: "left" + (left >= 0 ? "+" : "") + left + " " +
"top" + (top >= 0 ? "+" : "") + top,
of: that.window
};
$( this ).removeClass( "ui-dialog-resizing" );
that._unblockFrames();
that._trigger( "resizeStop", event, filteredUi( ui ) );
}
})
.css( "position", position );
},
_trackFocus: function() {
this._on( this.widget(), {
focusin: function( event ) {
this._makeFocusTarget();
this._focusedElement = $( event.target );
}
});
},
_makeFocusTarget: function() {
this._untrackInstance();
this._trackingInstances().unshift( this );
},
_untrackInstance: function() {
var instances = this._trackingInstances(),
exists = $.inArray( this, instances );
if ( exists !== -1 ) {
instances.splice( exists, 1 );
}
},
_trackingInstances: function() {
var instances = this.document.data( "ui-dialog-instances" );
if ( !instances ) {
instances = [];
this.document.data( "ui-dialog-instances", instances );
}
return instances;
},
_minHeight: function() {
var options = this.options;
return options.height === "auto" ?
options.minHeight :
Math.min( options.minHeight, options.height );
},
_position: function() {
// Need to show the dialog to get the actual offset in the position plugin
var isVisible = this.uiDialog.is( ":visible" );
if ( !isVisible ) {
this.uiDialog.show();
}
this.uiDialog.position( this.options.position );
if ( !isVisible ) {
this.uiDialog.hide();
}
},
_setOptions: function( options ) {
var that = this,
resize = false,
resizableOptions = {};
$.each( options, function( key, value ) {
that._setOption( key, value );
if ( key in that.sizeRelatedOptions ) {
resize = true;
}
if ( key in that.resizableRelatedOptions ) {
resizableOptions[ key ] = value;
}
});
if ( resize ) {
this._size();
this._position();
}
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
}
},
_setOption: function( key, value ) {
var isDraggable, isResizable,
uiDialog = this.uiDialog;
if ( key === "dialogClass" ) {
uiDialog
.removeClass( this.options.dialogClass )
.addClass( value );
}
if ( key === "disabled" ) {
return;
}
this._super( key, value );
if ( key === "appendTo" ) {
this.uiDialog.appendTo( this._appendTo() );
}
if ( key === "buttons" ) {
this._createButtons();
}
if ( key === "closeText" ) {
this.uiDialogTitlebarClose.button({
// Ensure that we always pass a string
label: "" + value
});
}
if ( key === "draggable" ) {
isDraggable = uiDialog.is( ":data(ui-draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
if ( !isDraggable && value ) {
this._makeDraggable();
}
}
if ( key === "position" ) {
this._position();
}
if ( key === "resizable" ) {
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
// currently resizable, changing handles
if ( isResizable && typeof value === "string" ) {
uiDialog.resizable( "option", "handles", value );
}
// currently non-resizable, becoming resizable
if ( !isResizable && value !== false ) {
this._makeResizable();
}
}
if ( key === "title" ) {
this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
}
},
_size: function() {
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,
options = this.options;
// Reset content sizing
this.element.show().css({
width: "auto",
minHeight: 0,
maxHeight: "none",
height: 0
});
if ( options.minWidth > options.width ) {
options.width = options.minWidth;
}
// reset wrapper sizing
// determine the height of all the non-content elements
nonContentHeight = this.uiDialog.css({
height: "auto",
width: options.width
})
.outerHeight();
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
maxContentHeight = typeof options.maxHeight === "number" ?
Math.max( 0, options.maxHeight - nonContentHeight ) :
"none";
if ( options.height === "auto" ) {
this.element.css({
minHeight: minContentHeight,
maxHeight: maxContentHeight,
height: "auto"
});
} else {
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
}
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
}
},
_blockFrames: function() {
this.iframeBlocks = this.document.find( "iframe" ).map(function() {
var iframe = $( this );
return $( "<div>" )
.css({
position: "absolute",
width: iframe.outerWidth(),
height: iframe.outerHeight()
})
.appendTo( iframe.parent() )
.offset( iframe.offset() )[0];
});
},
_unblockFrames: function() {
if ( this.iframeBlocks ) {
this.iframeBlocks.remove();
delete this.iframeBlocks;
}
},
_allowInteraction: function( event ) {
if ( $( event.target ).closest( ".ui-dialog" ).length ) {
return true;
}
// TODO: Remove hack when datepicker implements
// the .ui-front logic (#8989)
return !!$( event.target ).closest( ".ui-datepicker" ).length;
},
_createOverlay: function() {
if ( !this.options.modal ) {
return;
}
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling (#2804)
var isOpening = true;
this._delay(function() {
isOpening = false;
});
if ( !this.document.data( "ui-dialog-overlays" ) ) {
// Prevent use of anchors and inputs
// Using _on() for an event handler shared across many instances is
// safe because the dialogs stack and must be closed in reverse order
this._on( this.document, {
focusin: function( event ) {
if ( isOpening ) {
return;
}
if ( !this._allowInteraction( event ) ) {
event.preventDefault();
this._trackingInstances()[ 0 ]._focusTabbable();
}
}
});
}
this.overlay = $( "<div>" )
.addClass( "ui-widget-overlay ui-front" )
.appendTo( this._appendTo() );
this._on( this.overlay, {
mousedown: "_keepFocus"
});
this.document.data( "ui-dialog-overlays",
(this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
},
_destroyOverlay: function() {
if ( !this.options.modal ) {
return;
}
if ( this.overlay ) {
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
if ( !overlays ) {
this.document
.unbind( "focusin" )
.removeData( "ui-dialog-overlays" );
} else {
this.document.data( "ui-dialog-overlays", overlays );
}
this.overlay.remove();
this.overlay = null;
}
}
});
/*!
* jQuery UI Progressbar 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/progressbar/
*/
var progressbar = $.widget( "ui.progressbar", {
version: "1.11.4",
options: {
max: 100,
value: 0,
change: null,
complete: null
},
min: 0,
_create: function() {
// Constrain initial value
this.oldValue = this.options.value = this._constrainedValue();
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
// Only set static values, aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role: "progressbar",
"aria-valuemin": this.min
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
this._refreshValue();
},
_destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.valueDiv.remove();
},
value: function( newValue ) {
if ( newValue === undefined ) {
return this.options.value;
}
this.options.value = this._constrainedValue( newValue );
this._refreshValue();
},
_constrainedValue: function( newValue ) {
if ( newValue === undefined ) {
newValue = this.options.value;
}
this.indeterminate = newValue === false;
// sanitize value
if ( typeof newValue !== "number" ) {
newValue = 0;
}
return this.indeterminate ? false :
Math.min( this.options.max, Math.max( this.min, newValue ) );
},
_setOptions: function( options ) {
// Ensure "value" option is set after other values (like max)
var value = options.value;
delete options.value;
this._super( options );
this.options.value = this._constrainedValue( value );
this._refreshValue();
},
_setOption: function( key, value ) {
if ( key === "max" ) {
// Don't allow a max less than min
value = Math.max( this.min, value );
}
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
}
this._super( key, value );
},
_percentage: function() {
return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
},
_refreshValue: function() {
var value = this.options.value,
percentage = this._percentage();
this.valueDiv
.toggle( this.indeterminate || value > this.min )
.toggleClass( "ui-corner-right", value === this.options.max )
.width( percentage.toFixed(0) + "%" );
this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuenow" );
if ( !this.overlayDiv ) {
this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
}
} else {
this.element.attr({
"aria-valuemax": this.options.max,
"aria-valuenow": value
});
if ( this.overlayDiv ) {
this.overlayDiv.remove();
this.overlayDiv = null;
}
}
if ( this.oldValue !== value ) {
this.oldValue = value;
this._trigger( "change" );
}
if ( value === this.options.max ) {
this._trigger( "complete" );
}
}
});
/*!
* jQuery UI Selectmenu 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/selectmenu
*/
var selectmenu = $.widget( "ui.selectmenu", {
version: "1.11.4",
defaultElement: "<select>",
options: {
appendTo: null,
disabled: null,
icons: {
button: "ui-icon-triangle-1-s"
},
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
width: null,
// callbacks
change: null,
close: null,
focus: null,
open: null,
select: null
},
_create: function() {
var selectmenuId = this.element.uniqueId().attr( "id" );
this.ids = {
element: selectmenuId,
button: selectmenuId + "-button",
menu: selectmenuId + "-menu"
};
this._drawButton();
this._drawMenu();
if ( this.options.disabled ) {
this.disable();
}
},
_drawButton: function() {
var that = this;
// Associate existing label with the new button
this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
this._on( this.label, {
click: function( event ) {
this.button.focus();
event.preventDefault();
}
});
// Hide original select element
this.element.hide();
// Create button
this.button = $( "<span>", {
"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
tabindex: this.options.disabled ? -1 : 0,
id: this.ids.button,
role: "combobox",
"aria-expanded": "false",
"aria-autocomplete": "list",
"aria-owns": this.ids.menu,
"aria-haspopup": "true"
})
.insertAfter( this.element );
$( "<span>", {
"class": "ui-icon " + this.options.icons.button
})
.prependTo( this.button );
this.buttonText = $( "<span>", {
"class": "ui-selectmenu-text"
})
.appendTo( this.button );
this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
this._resizeButton();
this._on( this.button, this._buttonEvents );
this.button.one( "focusin", function() {
// Delay rendering the menu items until the button receives focus.
// The menu may have already been rendered via a programmatic open.
if ( !that.menuItems ) {
that._refreshMenu();
}
});
this._hoverable( this.button );
this._focusable( this.button );
},
_drawMenu: function() {
var that = this;
// Create menu
this.menu = $( "<ul>", {
"aria-hidden": "true",
"aria-labelledby": this.ids.button,
id: this.ids.menu
});
// Wrap menu
this.menuWrap = $( "<div>", {
"class": "ui-selectmenu-menu ui-front"
})
.append( this.menu )
.appendTo( this._appendTo() );
// Initialize menu widget
this.menuInstance = this.menu
.menu({
role: "listbox",
select: function( event, ui ) {
event.preventDefault();
// support: IE8
// If the item was selected via a click, the text selection
// will be destroyed in IE
that._setSelection();
that._select( ui.item.data( "ui-selectmenu-item" ), event );
},
focus: function( event, ui ) {
var item = ui.item.data( "ui-selectmenu-item" );
// Prevent inital focus from firing and check if its a newly focused item
if ( that.focusIndex != null && item.index !== that.focusIndex ) {
that._trigger( "focus", event, { item: item } );
if ( !that.isOpen ) {
that._select( item, event );
}
}
that.focusIndex = item.index;
that.button.attr( "aria-activedescendant",
that.menuItems.eq( item.index ).attr( "id" ) );
}
})
.menu( "instance" );
// Adjust menu styles to dropdown
this.menu
.addClass( "ui-corner-bottom" )
.removeClass( "ui-corner-all" );
// Don't close the menu on mouseleave
this.menuInstance._off( this.menu, "mouseleave" );
// Cancel the menu's collapseAll on document click
this.menuInstance._closeOnDocumentClick = function() {
return false;
};
// Selects often contain empty items, but never contain dividers
this.menuInstance._isDivider = function() {
return false;
};
},
refresh: function() {
this._refreshMenu();
this._setText( this.buttonText, this._getSelectedItem().text() );
if ( !this.options.width ) {
this._resizeButton();
}
},
_refreshMenu: function() {
this.menu.empty();
var item,
options = this.element.find( "option" );
if ( !options.length ) {
return;
}
this._parseOptions( options );
this._renderMenu( this.menu, this.items );
this.menuInstance.refresh();
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
item = this._getSelectedItem();
// Update the menu to have the correct item focused
this.menuInstance.focus( null, item );
this._setAria( item.data( "ui-selectmenu-item" ) );
// Set disabled state
this._setOption( "disabled", this.element.prop( "disabled" ) );
},
open: function( event ) {
if ( this.options.disabled ) {
return;
}
// If this is the first time the menu is being opened, render the items
if ( !this.menuItems ) {
this._refreshMenu();
} else {
// Menu clears focus on close, reset focus to selected item
this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
this.menuInstance.focus( null, this._getSelectedItem() );
}
this.isOpen = true;
this._toggleAttr();
this._resizeMenu();
this._position();
this._on( this.document, this._documentClick );
this._trigger( "open", event );
},
_position: function() {
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
},
close: function( event ) {
if ( !this.isOpen ) {
return;
}
this.isOpen = false;
this._toggleAttr();
this.range = null;
this._off( this.document );
this._trigger( "close", event );
},
widget: function() {
return this.button;
},
menuWidget: function() {
return this.menu;
},
_renderMenu: function( ul, items ) {
var that = this,
currentOptgroup = "";
$.each( items, function( index, item ) {
if ( item.optgroup !== currentOptgroup ) {
$( "<li>", {
"class": "ui-selectmenu-optgroup ui-menu-divider" +
( item.element.parent( "optgroup" ).prop( "disabled" ) ?
" ui-state-disabled" :
"" ),
text: item.optgroup
})
.appendTo( ul );
currentOptgroup = item.optgroup;
}
that._renderItemData( ul, item );
});
},
_renderItemData: function( ul, item ) {
return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
},
_renderItem: function( ul, item ) {
var li = $( "<li>" );
if ( item.disabled ) {
li.addClass( "ui-state-disabled" );
}
this._setText( li, item.label );
return li.appendTo( ul );
},
_setText: function( element, value ) {
if ( value ) {
element.text( value );
} else {
element.html( " " );
}
},
_move: function( direction, event ) {
var item, next,
filter = ".ui-menu-item";
if ( this.isOpen ) {
item = this.menuItems.eq( this.focusIndex );
} else {
item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
filter += ":not(.ui-state-disabled)";
}
if ( direction === "first" || direction === "last" ) {
next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
} else {
next = item[ direction + "All" ]( filter ).eq( 0 );
}
if ( next.length ) {
this.menuInstance.focus( event, next );
}
},
_getSelectedItem: function() {
return this.menuItems.eq( this.element[ 0 ].selectedIndex );
},
_toggle: function( event ) {
this[ this.isOpen ? "close" : "open" ]( event );
},
_setSelection: function() {
var selection;
if ( !this.range ) {
return;
}
if ( window.getSelection ) {
selection = window.getSelection();
selection.removeAllRanges();
selection.addRange( this.range );
// support: IE8
} else {
this.range.select();
}
// support: IE
// Setting the text selection kills the button focus in IE, but
// restoring the focus doesn't kill the selection.
this.button.focus();
},
_documentClick: {
mousedown: function( event ) {
if ( !this.isOpen ) {
return;
}
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
this.close( event );
}
}
},
_buttonEvents: {
// Prevent text selection from being reset when interacting with the selectmenu (#10144)
mousedown: function() {
var selection;
if ( window.getSelection ) {
selection = window.getSelection();
if ( selection.rangeCount ) {
this.range = selection.getRangeAt( 0 );
}
// support: IE8
} else {
this.range = document.selection.createRange();
}
},
click: function( event ) {
this._setSelection();
this._toggle( event );
},
keydown: function( event ) {
var preventDefault = true;
switch ( event.keyCode ) {
case $.ui.keyCode.TAB:
case $.ui.keyCode.ESCAPE:
this.close( event );
preventDefault = false;
break;
case $.ui.keyCode.ENTER:
if ( this.isOpen ) {
this._selectFocusedItem( event );
}
break;
case $.ui.keyCode.UP:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "prev", event );
}
break;
case $.ui.keyCode.DOWN:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "next", event );
}
break;
case $.ui.keyCode.SPACE:
if ( this.isOpen ) {
this._selectFocusedItem( event );
} else {
this._toggle( event );
}
break;
case $.ui.keyCode.LEFT:
this._move( "prev", event );
break;
case $.ui.keyCode.RIGHT:
this._move( "next", event );
break;
case $.ui.keyCode.HOME:
case $.ui.keyCode.PAGE_UP:
this._move( "first", event );
break;
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_DOWN:
this._move( "last", event );
break;
default:
this.menu.trigger( event );
preventDefault = false;
}
if ( preventDefault ) {
event.preventDefault();
}
}
},
_selectFocusedItem: function( event ) {
var item = this.menuItems.eq( this.focusIndex );
if ( !item.hasClass( "ui-state-disabled" ) ) {
this._select( item.data( "ui-selectmenu-item" ), event );
}
},
_select: function( item, event ) {
var oldIndex = this.element[ 0 ].selectedIndex;
// Change native select element
this.element[ 0 ].selectedIndex = item.index;
this._setText( this.buttonText, item.label );
this._setAria( item );
this._trigger( "select", event, { item: item } );
if ( item.index !== oldIndex ) {
this._trigger( "change", event, { item: item } );
}
this.close( event );
},
_setAria: function( item ) {
var id = this.menuItems.eq( item.index ).attr( "id" );
this.button.attr({
"aria-labelledby": id,
"aria-activedescendant": id
});
this.menu.attr( "aria-activedescendant", id );
},
_setOption: function( key, value ) {
if ( key === "icons" ) {
this.button.find( "span.ui-icon" )
.removeClass( this.options.icons.button )
.addClass( value.button );
}
this._super( key, value );
if ( key === "appendTo" ) {
this.menuWrap.appendTo( this._appendTo() );
}
if ( key === "disabled" ) {
this.menuInstance.option( "disabled", value );
this.button
.toggleClass( "ui-state-disabled", value )
.attr( "aria-disabled", value );
this.element.prop( "disabled", value );
if ( value ) {
this.button.attr( "tabindex", -1 );
this.close();
} else {
this.button.attr( "tabindex", 0 );
}
}
if ( key === "width" ) {
this._resizeButton();
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element ) {
element = element.jquery || element.nodeType ?
$( element ) :
this.document.find( element ).eq( 0 );
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front" );
}
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_toggleAttr: function() {
this.button
.toggleClass( "ui-corner-top", this.isOpen )
.toggleClass( "ui-corner-all", !this.isOpen )
.attr( "aria-expanded", this.isOpen );
this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
this.menu.attr( "aria-hidden", !this.isOpen );
},
_resizeButton: function() {
var width = this.options.width;
if ( !width ) {
width = this.element.show().outerWidth();
this.element.hide();
}
this.button.outerWidth( width );
},
_resizeMenu: function() {
this.menu.outerWidth( Math.max(
this.button.outerWidth(),
// support: IE10
// IE10 wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping
this.menu.width( "" ).outerWidth() + 1
) );
},
_getCreateOptions: function() {
return { disabled: this.element.prop( "disabled" ) };
},
_parseOptions: function( options ) {
var data = [];
options.each(function( index, item ) {
var option = $( item ),
optgroup = option.parent( "optgroup" );
data.push({
element: option,
index: index,
value: option.val(),
label: option.text(),
optgroup: optgroup.attr( "label" ) || "",
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
});
});
this.items = data;
},
_destroy: function() {
this.menuWrap.remove();
this.button.remove();
this.element.show();
this.element.removeUniqueId();
this.label.attr( "for", this.ids.element );
}
});
/*!
* jQuery UI Slider 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/slider/
*/
var slider = $.widget( "ui.slider", $.ui.mouse, {
version: "1.11.4",
widgetEventPrefix: "slide",
options: {
animate: false,
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: false,
step: 1,
value: 0,
values: null,
// callbacks
change: null,
slide: null,
start: null,
stop: null
},
// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
numPages: 5,
_create: function() {
this._keySliding = false;
this._mouseSliding = false;
this._animateOff = true;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this._calculateNewMax();
this.element
.addClass( "ui-slider" +
" ui-slider-" + this.orientation +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all");
this._refresh();
this._setOption( "disabled", this.options.disabled );
this._animateOff = false;
},
_refresh: function() {
this._createRange();
this._createHandles();
this._setupEvents();
this._refreshValue();
},
_createHandles: function() {
var i, handleCount,
options = this.options,
existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
handles = [];
handleCount = ( options.values && options.values.length ) || 1;
if ( existingHandles.length > handleCount ) {
existingHandles.slice( handleCount ).remove();
existingHandles = existingHandles.slice( 0, handleCount );
}
for ( i = existingHandles.length; i < handleCount; i++ ) {
handles.push( handle );
}
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
this.handle = this.handles.eq( 0 );
this.handles.each(function( i ) {
$( this ).data( "ui-slider-handle-index", i );
});
},
_createRange: function() {
var options = this.options,
classes = "";
if ( options.range ) {
if ( options.range === true ) {
if ( !options.values ) {
options.values = [ this._valueMin(), this._valueMin() ];
} else if ( options.values.length && options.values.length !== 2 ) {
options.values = [ options.values[0], options.values[0] ];
} else if ( $.isArray( options.values ) ) {
options.values = options.values.slice(0);
}
}
if ( !this.range || !this.range.length ) {
this.range = $( "<div></div>" )
.appendTo( this.element );
classes = "ui-slider-range" +
// note: this isn't the most fittingly semantic framework class for this element,
// but worked best visually with a variety of themes
" ui-widget-header ui-corner-all";
} else {
this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
// Handle range switching from true to min/max
.css({
"left": "",
"bottom": ""
});
}
this.range.addClass( classes +
( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
} else {
if ( this.range ) {
this.range.remove();
}
this.range = null;
}
},
_setupEvents: function() {
this._off( this.handles );
this._on( this.handles, this._handleEvents );
this._hoverable( this.handles );
this._focusable( this.handles );
},
_destroy: function() {
this.handles.remove();
if ( this.range ) {
this.range.remove();
}
this.element
.removeClass( "ui-slider" +
" ui-slider-horizontal" +
" ui-slider-vertical" +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all" );
this._mouseDestroy();
},
_mouseCapture: function( event ) {
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
that = this,
o = this.options;
if ( o.disabled ) {
return false;
}
this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset = this.element.offset();
position = { x: event.pageX, y: event.pageY };
normValue = this._normValueFromMouse( position );
distance = this._valueMax() - this._valueMin() + 1;
this.handles.each(function( i ) {
var thisDistance = Math.abs( normValue - that.values(i) );
if (( distance > thisDistance ) ||
( distance === thisDistance &&
(i === that._lastChangedValue || that.values(i) === o.min ))) {
distance = thisDistance;
closestHandle = $( this );
index = i;
}
});
allowed = this._start( event, index );
if ( allowed === false ) {
return false;
}
this._mouseSliding = true;
this._handleIndex = index;
closestHandle
.addClass( "ui-state-active" )
.focus();
offset = closestHandle.offset();
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
top: event.pageY - offset.top -
( closestHandle.height() / 2 ) -
( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
};
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
this._slide( event, index, normValue );
}
this._animateOff = true;
return true;
},
_mouseStart: function() {
return true;
},
_mouseDrag: function( event ) {
var position = { x: event.pageX, y: event.pageY },
normValue = this._normValueFromMouse( position );
this._slide( event, this._handleIndex, normValue );
return false;
},
_mouseStop: function( event ) {
this.handles.removeClass( "ui-state-active" );
this._mouseSliding = false;
this._stop( event, this._handleIndex );
this._change( event, this._handleIndex );
this._handleIndex = null;
this._clickOffset = null;
this._animateOff = false;
return false;
},
_detectOrientation: function() {
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
},
_normValueFromMouse: function( position ) {
var pixelTotal,
pixelMouse,
percentMouse,
valueTotal,
valueMouse;
if ( this.orientation === "horizontal" ) {
pixelTotal = this.elementSize.width;
pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
} else {
pixelTotal = this.elementSize.height;
pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
}
percentMouse = ( pixelMouse / pixelTotal );
if ( percentMouse > 1 ) {
percentMouse = 1;
}
if ( percentMouse < 0 ) {
percentMouse = 0;
}
if ( this.orientation === "vertical" ) {
percentMouse = 1 - percentMouse;
}
valueTotal = this._valueMax() - this._valueMin();
valueMouse = this._valueMin() + percentMouse * valueTotal;
return this._trimAlignValue( valueMouse );
},
_start: function( event, index ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
}
return this._trigger( "start", event, uiHash );
},
_slide: function( event, index, newVal ) {
var otherVal,
newValues,
allowed;
if ( this.options.values && this.options.values.length ) {
otherVal = this.values( index ? 0 : 1 );
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
) {
newVal = otherVal;
}
if ( newVal !== this.values( index ) ) {
newValues = this.values();
newValues[ index ] = newVal;
// A slide can be canceled by returning false from the slide callback
allowed = this._trigger( "slide", event, {
handle: this.handles[ index ],
value: newVal,
values: newValues
} );
otherVal = this.values( index ? 0 : 1 );
if ( allowed !== false ) {
this.values( index, newVal );
}
}
} else {
if ( newVal !== this.value() ) {
// A slide can be canceled by returning false from the slide callback
allowed = this._trigger( "slide", event, {
handle: this.handles[ index ],
value: newVal
} );
if ( allowed !== false ) {
this.value( newVal );
}
}
}
},
_stop: function( event, index ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
}
this._trigger( "stop", event, uiHash );
},
_change: function( event, index ) {
if ( !this._keySliding && !this._mouseSliding ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
}
//store the last changed value index for reference when handles overlap
this._lastChangedValue = index;
this._trigger( "change", event, uiHash );
}
},
value: function( newValue ) {
if ( arguments.length ) {
this.options.value = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, 0 );
return;
}
return this._value();
},
values: function( index, newValue ) {
var vals,
newValues,
i;
if ( arguments.length > 1 ) {
this.options.values[ index ] = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, index );
return;
}
if ( arguments.length ) {
if ( $.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( newValues[ i ] );
this._change( null, i );
}
this._refreshValue();
} else {
if ( this.options.values && this.options.values.length ) {
return this._values( index );
} else {
return this.value();
}
}
} else {
return this._values();
}
},
_setOption: function( key, value ) {
var i,
valsLength = 0;
if ( key === "range" && this.options.range === true ) {
if ( value === "min" ) {
this.options.value = this._values( 0 );
this.options.values = null;
} else if ( value === "max" ) {
this.options.value = this._values( this.options.values.length - 1 );
this.options.values = null;
}
}
if ( $.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
if ( key === "disabled" ) {
this.element.toggleClass( "ui-state-disabled", !!value );
}
this._super( key, value );
switch ( key ) {
case "orientation":
this._detectOrientation();
this.element
.removeClass( "ui-slider-horizontal ui-slider-vertical" )
.addClass( "ui-slider-" + this.orientation );
this._refreshValue();
// Reset positioning from previous orientation
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
break;
case "value":
this._animateOff = true;
this._refreshValue();
this._change( null, 0 );
this._animateOff = false;
break;
case "values":
this._animateOff = true;
this._refreshValue();
for ( i = 0; i < valsLength; i += 1 ) {
this._change( null, i );
}
this._animateOff = false;
break;
case "step":
case "min":
case "max":
this._animateOff = true;
this._calculateNewMax();
this._refreshValue();
this._animateOff = false;
break;
case "range":
this._animateOff = true;
this._refresh();
this._animateOff = false;
break;
}
},
//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value: function() {
var val = this.options.value;
val = this._trimAlignValue( val );
return val;
},
//internal values getter
// _values() returns array of values trimmed by min and max, aligned by step
// _values( index ) returns single value trimmed by min and max, aligned by step
_values: function( index ) {
var val,
vals,
i;
if ( arguments.length ) {
val = this.options.values[ index ];
val = this._trimAlignValue( val );
return val;
} else if ( this.options.values && this.options.values.length ) {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
for ( i = 0; i < vals.length; i += 1) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
return vals;
} else {
return [];
}
},
// returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue: function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = (val - this._valueMin()) % step,
alignValue = val - valModStep;
if ( Math.abs(valModStep) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed(5) );
},
_calculateNewMax: function() {
var max = this.options.max,
min = this._valueMin(),
step = this.options.step,
aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
max = aboveMin + min;
this.max = parseFloat( max.toFixed( this._precision() ) );
},
_precision: function() {
var precision = this._precisionOf( this.options.step );
if ( this.options.min !== null ) {
precision = Math.max( precision, this._precisionOf( this.options.min ) );
}
return precision;
},
_precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
_valueMin: function() {
return this.options.min;
},
_valueMax: function() {
return this.max;
},
_refreshValue: function() {
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange = this.options.range,
o = this.options,
that = this,
animate = ( !this._animateOff ) ? o.animate : false,
_set = {};
if ( this.options.values && this.options.values.length ) {
this.handles.each(function( i ) {
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( that.options.range === true ) {
if ( that.orientation === "horizontal" ) {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
}
} else {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
}
}
}
lastValPercent = valPercent;
});
} else {
value = this.value();
valueMin = this._valueMin();
valueMax = this._valueMax();
valPercent = ( valueMax !== valueMin ) ?
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
0;
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( oRange === "min" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
}
if ( oRange === "max" && this.orientation === "horizontal" ) {
this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
}
if ( oRange === "min" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
}
if ( oRange === "max" && this.orientation === "vertical" ) {
this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
}
}
},
_handleEvents: {
keydown: function( event ) {
var allowed, curVal, newVal, step,
index = $( event.target ).data( "ui-slider-handle-index" );
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_UP:
case $.ui.keyCode.PAGE_DOWN:
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
event.preventDefault();
if ( !this._keySliding ) {
this._keySliding = true;
$( event.target ).addClass( "ui-state-active" );
allowed = this._start( event, index );
if ( allowed === false ) {
return;
}
}
break;
}
step = this.options.step;
if ( this.options.values && this.options.values.length ) {
curVal = newVal = this.values( index );
} else {
curVal = newVal = this.value();
}
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
newVal = this._valueMin();
break;
case $.ui.keyCode.END:
newVal = this._valueMax();
break;
case $.ui.keyCode.PAGE_UP:
newVal = this._trimAlignValue(
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
);
break;
case $.ui.keyCode.PAGE_DOWN:
newVal = this._trimAlignValue(
curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
if ( curVal === this._valueMax() ) {
return;
}
newVal = this._trimAlignValue( curVal + step );
break;
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
if ( curVal === this._valueMin() ) {
return;
}
newVal = this._trimAlignValue( curVal - step );
break;
}
this._slide( event, index, newVal );
},
keyup: function( event ) {
var index = $( event.target ).data( "ui-slider-handle-index" );
if ( this._keySliding ) {
this._keySliding = false;
this._stop( event, index );
this._change( event, index );
$( event.target ).removeClass( "ui-state-active" );
}
}
}
});
/*!
* jQuery UI Spinner 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/spinner/
*/
function spinner_modifier( fn ) {
return function() {
var previous = this.element.val();
fn.apply( this, arguments );
this._refresh();
if ( previous !== this.element.val() ) {
this._trigger( "change" );
}
};
}
var spinner = $.widget( "ui.spinner", {
version: "1.11.4",
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
culture: null,
icons: {
down: "ui-icon-triangle-1-s",
up: "ui-icon-triangle-1-n"
},
incremental: true,
max: null,
min: null,
numberFormat: null,
page: 10,
step: 1,
change: null,
spin: null,
start: null,
stop: null
},
_create: function() {
// handle string values that need to be parsed
this._setOption( "max", this.options.max );
this._setOption( "min", this.options.min );
this._setOption( "step", this.options.step );
// Only format if there is a value, prevents the field from being marked
// as invalid in Firefox, see #9573.
if ( this.value() !== "" ) {
// Format the value, but don't constrain.
this._value( this.element.val(), true );
}
this._draw();
this._on( this._events );
this._refresh();
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on( this.window, {
beforeunload: function() {
this.element.removeAttr( "autocomplete" );
}
});
},
_getCreateOptions: function() {
var options = {},
element = this.element;
$.each( [ "min", "max", "step" ], function( i, option ) {
var value = element.attr( option );
if ( value !== undefined && value.length ) {
options[ option ] = value;
}
});
return options;
},
_events: {
keydown: function( event ) {
if ( this._start( event ) && this._keydown( event ) ) {
event.preventDefault();
}
},
keyup: "_stop",
focus: function() {
this.previous = this.element.val();
},
blur: function( event ) {
if ( this.cancelBlur ) {
delete this.cancelBlur;
return;
}
this._stop();
this._refresh();
if ( this.previous !== this.element.val() ) {
this._trigger( "change", event );
}
},
mousewheel: function( event, delta ) {
if ( !delta ) {
return;
}
if ( !this.spinning && !this._start( event ) ) {
return false;
}
this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
clearTimeout( this.mousewheelTimer );
this.mousewheelTimer = this._delay(function() {
if ( this.spinning ) {
this._stop( event );
}
}, 100 );
event.preventDefault();
},
"mousedown .ui-spinner-button": function( event ) {
var previous;
// We never want the buttons to have focus; whenever the user is
// interacting with the spinner, the focus should be on the input.
// If the input is focused then this.previous is properly set from
// when the input first received focus. If the input is not focused
// then we need to set this.previous based on the value before spinning.
previous = this.element[0] === this.document[0].activeElement ?
this.previous : this.element.val();
function checkFocus() {
var isActive = this.element[0] === this.document[0].activeElement;
if ( !isActive ) {
this.element.focus();
this.previous = previous;
// support: IE
// IE sets focus asynchronously, so we need to check if focus
// moved off of the input because the user clicked on the button.
this._delay(function() {
this.previous = previous;
});
}
}
// ensure focus is on (or stays on) the text field
event.preventDefault();
checkFocus.call( this );
// support: IE
// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
// and check (again) if focus moved off of the input.
this.cancelBlur = true;
this._delay(function() {
delete this.cancelBlur;
checkFocus.call( this );
});
if ( this._start( event ) === false ) {
return;
}
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
"mouseup .ui-spinner-button": "_stop",
"mouseenter .ui-spinner-button": function( event ) {
// button will add ui-state-active if mouse was down while mouseleave and kept down
if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
return;
}
if ( this._start( event ) === false ) {
return false;
}
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
// TODO: do we really want to consider this a stop?
// shouldn't we just stop the repeater and wait until mouseup before
// we trigger the stop event?
"mouseleave .ui-spinner-button": "_stop"
},
_draw: function() {
var uiSpinner = this.uiSpinner = this.element
.addClass( "ui-spinner-input" )
.attr( "autocomplete", "off" )
.wrap( this._uiSpinnerHtml() )
.parent()
// add buttons
.append( this._buttonHtml() );
this.element.attr( "role", "spinbutton" );
// button bindings
this.buttons = uiSpinner.find( ".ui-spinner-button" )
.attr( "tabIndex", -1 )
.button()
.removeClass( "ui-corner-all" );
// IE 6 doesn't understand height: 50% for the buttons
// unless the wrapper has an explicit height
if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
uiSpinner.height() > 0 ) {
uiSpinner.height( uiSpinner.height() );
}
// disable spinner if element was already disabled
if ( this.options.disabled ) {
this.disable();
}
},
_keydown: function( event ) {
var options = this.options,
keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.UP:
this._repeat( null, 1, event );
return true;
case keyCode.DOWN:
this._repeat( null, -1, event );
return true;
case keyCode.PAGE_UP:
this._repeat( null, options.page, event );
return true;
case keyCode.PAGE_DOWN:
this._repeat( null, -options.page, event );
return true;
}
return false;
},
_uiSpinnerHtml: function() {
return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
},
_buttonHtml: function() {
return "" +
"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
"<span class='ui-icon " + this.options.icons.up + "'>▲</span>" +
"</a>" +
"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
"<span class='ui-icon " + this.options.icons.down + "'>▼</span>" +
"</a>";
},
_start: function( event ) {
if ( !this.spinning && this._trigger( "start", event ) === false ) {
return false;
}
if ( !this.counter ) {
this.counter = 1;
}
this.spinning = true;
return true;
},
_repeat: function( i, steps, event ) {
i = i || 500;
clearTimeout( this.timer );
this.timer = this._delay(function() {
this._repeat( 40, steps, event );
}, i );
this._spin( steps * this.options.step, event );
},
_spin: function( step, event ) {
var value = this.value() || 0;
if ( !this.counter ) {
this.counter = 1;
}
value = this._adjustValue( value + step * this._increment( this.counter ) );
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
this._value( value );
this.counter++;
}
},
_increment: function( i ) {
var incremental = this.options.incremental;
if ( incremental ) {
return $.isFunction( incremental ) ?
incremental( i ) :
Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
}
return 1;
},
_precision: function() {
var precision = this._precisionOf( this.options.step );
if ( this.options.min !== null ) {
precision = Math.max( precision, this._precisionOf( this.options.min ) );
}
return precision;
},
_precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
_adjustValue: function( value ) {
var base, aboveMin,
options = this.options;
// make sure we're at a valid step
// - find out where we are relative to the base (min or 0)
base = options.min !== null ? options.min : 0;
aboveMin = value - base;
// - round to the nearest step
aboveMin = Math.round(aboveMin / options.step) * options.step;
// - rounding is based on 0, so adjust back to our base
value = base + aboveMin;
// fix precision from bad JS floating point math
value = parseFloat( value.toFixed( this._precision() ) );
// clamp the value
if ( options.max !== null && value > options.max) {
return options.max;
}
if ( options.min !== null && value < options.min ) {
return options.min;
}
return value;
},
_stop: function( event ) {
if ( !this.spinning ) {
return;
}
clearTimeout( this.timer );
clearTimeout( this.mousewheelTimer );
this.counter = 0;
this.spinning = false;
this._trigger( "stop", event );
},
_setOption: function( key, value ) {
if ( key === "culture" || key === "numberFormat" ) {
var prevValue = this._parse( this.element.val() );
this.options[ key ] = value;
this.element.val( this._format( prevValue ) );
return;
}
if ( key === "max" || key === "min" || key === "step" ) {
if ( typeof value === "string" ) {
value = this._parse( value );
}
}
if ( key === "icons" ) {
this.buttons.first().find( ".ui-icon" )
.removeClass( this.options.icons.up )
.addClass( value.up );
this.buttons.last().find( ".ui-icon" )
.removeClass( this.options.icons.down )
.addClass( value.down );
}
this._super( key, value );
if ( key === "disabled" ) {
this.widget().toggleClass( "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
this.buttons.button( value ? "disable" : "enable" );
}
},
_setOptions: spinner_modifier(function( options ) {
this._super( options );
}),
_parse: function( val ) {
if ( typeof val === "string" && val !== "" ) {
val = window.Globalize && this.options.numberFormat ?
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
}
return val === "" || isNaN( val ) ? null : val;
},
_format: function( value ) {
if ( value === "" ) {
return "";
}
return window.Globalize && this.options.numberFormat ?
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
value;
},
_refresh: function() {
this.element.attr({
"aria-valuemin": this.options.min,
"aria-valuemax": this.options.max,
// TODO: what should we do with values that can't be parsed?
"aria-valuenow": this._parse( this.element.val() )
});
},
isValid: function() {
var value = this.value();
// null is invalid
if ( value === null ) {
return false;
}
// if value gets adjusted, it's invalid
return value === this._adjustValue( value );
},
// update the value without triggering change
_value: function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
parsed = this._parse( value );
if ( parsed !== null ) {
if ( !allowAny ) {
parsed = this._adjustValue( parsed );
}
value = this._format( parsed );
}
}
this.element.val( value );
this._refresh();
},
_destroy: function() {
this.element
.removeClass( "ui-spinner-input" )
.prop( "disabled", false )
.removeAttr( "autocomplete" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.uiSpinner.replaceWith( this.element );
},
stepUp: spinner_modifier(function( steps ) {
this._stepUp( steps );
}),
_stepUp: function( steps ) {
if ( this._start() ) {
this._spin( (steps || 1) * this.options.step );
this._stop();
}
},
stepDown: spinner_modifier(function( steps ) {
this._stepDown( steps );
}),
_stepDown: function( steps ) {
if ( this._start() ) {
this._spin( (steps || 1) * -this.options.step );
this._stop();
}
},
pageUp: spinner_modifier(function( pages ) {
this._stepUp( (pages || 1) * this.options.page );
}),
pageDown: spinner_modifier(function( pages ) {
this._stepDown( (pages || 1) * this.options.page );
}),
value: function( newVal ) {
if ( !arguments.length ) {
return this._parse( this.element.val() );
}
spinner_modifier( this._value ).call( this, newVal );
},
widget: function() {
return this.uiSpinner;
}
});
/*!
* jQuery UI Tabs 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/tabs/
*/
var tabs = $.widget( "ui.tabs", {
version: "1.11.4",
delay: 300,
options: {
active: null,
collapsible: false,
event: "click",
heightStyle: "content",
hide: null,
show: null,
// callbacks
activate: null,
beforeActivate: null,
beforeLoad: null,
load: null
},
_isLocal: (function() {
var rhash = /#.*$/;
return function( anchor ) {
var anchorUrl, locationUrl;
// support: IE7
// IE7 doesn't normalize the href property when set via script (#9317)
anchor = anchor.cloneNode( false );
anchorUrl = anchor.href.replace( rhash, "" );
locationUrl = location.href.replace( rhash, "" );
// decoding may throw an error if the URL isn't UTF-8 (#9518)
try {
anchorUrl = decodeURIComponent( anchorUrl );
} catch ( error ) {}
try {
locationUrl = decodeURIComponent( locationUrl );
} catch ( error ) {}
return anchor.hash.length > 1 && anchorUrl === locationUrl;
};
})(),
_create: function() {
var that = this,
options = this.options;
this.running = false;
this.element
.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
.toggleClass( "ui-tabs-collapsible", options.collapsible );
this._processTabs();
options.active = this._initialActive();
// Take disabling tabs via class attribute from HTML
// into account and update option properly.
if ( $.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
})
) ).sort();
}
// check for length avoids error when initializing empty list
if ( this.options.active !== false && this.anchors.length ) {
this.active = this._findActive( options.active );
} else {
this.active = $();
}
this._refresh();
if ( this.active.length ) {
this.load( options.active );
}
},
_initialActive: function() {
var active = this.options.active,
collapsible = this.options.collapsible,
locationHash = location.hash.substring( 1 );
if ( active === null ) {
// check the fragment identifier in the URL
if ( locationHash ) {
this.tabs.each(function( i, tab ) {
if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
active = i;
return false;
}
});
}
// check for a tab marked active via a class
if ( active === null ) {
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
}
// no active tab, set to false
if ( active === null || active === -1 ) {
active = this.tabs.length ? 0 : false;
}
}
// handle numbers: negative, out of range
if ( active !== false ) {
active = this.tabs.index( this.tabs.eq( active ) );
if ( active === -1 ) {
active = collapsible ? false : 0;
}
}
// don't allow collapsible: false and active: false
if ( !collapsible && active === false && this.anchors.length ) {
active = 0;
}
return active;
},
_getCreateEventData: function() {
return {
tab: this.active,
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
};
},
_tabKeydown: function( event ) {
var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
selectedIndex = this.tabs.index( focusedTab ),
goingForward = true;
if ( this._handlePageNav( event ) ) {
return;
}
switch ( event.keyCode ) {
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward = false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex = this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex = 0;
break;
case $.ui.keyCode.SPACE:
// Activate only, no collapsing
event.preventDefault();
clearTimeout( this.activating );
this._activate( selectedIndex );
return;
case $.ui.keyCode.ENTER:
// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();
clearTimeout( this.activating );
// Determine if we should collapse or activate
this._activate( selectedIndex === this.options.active ? false : selectedIndex );
return;
default:
return;
}
// Focus the appropriate tab, based on which key was pressed
event.preventDefault();
clearTimeout( this.activating );
selectedIndex = this._focusNextTab( selectedIndex, goingForward );
// Navigating with control/command key will prevent automatic activation
if ( !event.ctrlKey && !event.metaKey ) {
// Update aria-selected immediately so that AT think the tab is already selected.
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
focusedTab.attr( "aria-selected", "false" );
this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
this.activating = this._delay(function() {
this.option( "active", selectedIndex );
}, this.delay );
}
},
_panelKeydown: function( event ) {
if ( this._handlePageNav( event ) ) {
return;
}
// Ctrl+up moves focus to the current tab
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
event.preventDefault();
this.active.focus();
}
},
// Alt+page up/down moves focus to the previous/next tab (and activates)
_handlePageNav: function( event ) {
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
this._activate( this._focusNextTab( this.options.active - 1, false ) );
return true;
}
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
this._activate( this._focusNextTab( this.options.active + 1, true ) );
return true;
}
},
_findNextTab: function( index, goingForward ) {
var lastTabIndex = this.tabs.length - 1;
function constrain() {
if ( index > lastTabIndex ) {
index = 0;
}
if ( index < 0 ) {
index = lastTabIndex;
}
return index;
}
while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
index = goingForward ? index + 1 : index - 1;
}
return index;
},
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).focus();
return index;
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
if ( key === "disabled" ) {
// don't use the widget factory's disabled handling
this._setupDisabled( value );
return;
}
this._super( key, value);
if ( key === "collapsible" ) {
this.element.toggleClass( "ui-tabs-collapsible", value );
// Setting collapsible: false while collapsed; open first panel
if ( !value && this.options.active === false ) {
this._activate( 0 );
}
}
if ( key === "event" ) {
this._setupEvents( value );
}
if ( key === "heightStyle" ) {
this._setupHeightStyle( value );
}
},
_sanitizeSelector: function( hash ) {
return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
},
refresh: function() {
var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
return lis.index( tab );
});
this._processTabs();
// was collapsed or no tabs
if ( options.active === false || !this.anchors.length ) {
options.active = false;
this.active = $();
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
// all remaining tabs are disabled
if ( this.tabs.length === options.disabled.length ) {
options.active = false;
this.active = $();
// activate previous tab
} else {
this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
}
// was active, active tab still exists
} else {
// make sure active index is correct
options.active = this.tabs.index( this.active );
}
this._refresh();
},
_refresh: function() {
this._setupDisabled( this.options.disabled );
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );
this.tabs.not( this.active ).attr({
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
});
this.panels.not( this._getPanelForTab( this.active ) )
.hide()
.attr({
"aria-hidden": "true"
});
// Make sure one tab is in the tab order
if ( !this.active.length ) {
this.tabs.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active
.addClass( "ui-tabs-active ui-state-active" )
.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
this._getPanelForTab( this.active )
.show()
.attr({
"aria-hidden": "false"
});
}
},
_processTabs: function() {
var that = this,
prevTabs = this.tabs,
prevAnchors = this.anchors,
prevPanels = this.panels;
this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.attr( "role", "tablist" )
// Prevent users from focusing disabled tabs via click
.delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
if ( $( this ).is( ".ui-state-disabled" ) ) {
event.preventDefault();
}
})
// support: IE <9
// Preventing the default action in mousedown doesn't prevent IE
// from focusing the element, so if the anchor gets focused, blur.
// We don't have to worry about focusing the previously focused
// element since clicking on a non-focusable element should focus
// the body anyway.
.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
}
});
this.tabs = this.tablist.find( "> li:has(a[href])" )
.addClass( "ui-state-default ui-corner-top" )
.attr({
role: "tab",
tabIndex: -1
});
this.anchors = this.tabs.map(function() {
return $( "a", this )[ 0 ];
})
.addClass( "ui-tabs-anchor" )
.attr({
role: "presentation",
tabIndex: -1
});
this.panels = $();
this.anchors.each(function( i, anchor ) {
var selector, panel, panelId,
anchorId = $( anchor ).uniqueId().attr( "id" ),
tab = $( anchor ).closest( "li" ),
originalAriaControls = tab.attr( "aria-controls" );
// inline tab
if ( that._isLocal( anchor ) ) {
selector = anchor.hash;
panelId = selector.substring( 1 );
panel = that.element.find( that._sanitizeSelector( selector ) );
// remote tab
} else {
// If the tab doesn't already have aria-controls,
// generate an id by using a throw-away element
panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
selector = "#" + panelId;
panel = that.element.find( selector );
if ( !panel.length ) {
panel = that._createPanel( panelId );
panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
}
panel.attr( "aria-live", "polite" );
}
if ( panel.length) {
that.panels = that.panels.add( panel );
}
if ( originalAriaControls ) {
tab.data( "ui-tabs-aria-controls", originalAriaControls );
}
tab.attr({
"aria-controls": panelId,
"aria-labelledby": anchorId
});
panel.attr( "aria-labelledby", anchorId );
});
this.panels
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.attr( "role", "tabpanel" );
// Avoid memory leaks (#10056)
if ( prevTabs ) {
this._off( prevTabs.not( this.tabs ) );
this._off( prevAnchors.not( this.anchors ) );
this._off( prevPanels.not( this.panels ) );
}
},
// allow overriding how to find the list for rare usage scenarios (#7715)
_getList: function() {
return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
},
_createPanel: function( id ) {
return $( "<div>" )
.attr( "id", id )
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.data( "ui-tabs-destroy", true );
},
_setupDisabled: function( disabled ) {
if ( $.isArray( disabled ) ) {
if ( !disabled.length ) {
disabled = false;
} else if ( disabled.length === this.anchors.length ) {
disabled = true;
}
}
// disable tabs
for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
$( li )
.addClass( "ui-state-disabled" )
.attr( "aria-disabled", "true" );
} else {
$( li )
.removeClass( "ui-state-disabled" )
.removeAttr( "aria-disabled" );
}
}
this.options.disabled = disabled;
},
_setupEvents: function( event ) {
var events = {};
if ( event ) {
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
this._off( this.anchors.add( this.tabs ).add( this.panels ) );
// Always prevent the default action, even when disabled
this._on( true, this.anchors, {
click: function( event ) {
event.preventDefault();
}
});
this._on( this.anchors, events );
this._on( this.tabs, { keydown: "_tabKeydown" } );
this._on( this.panels, { keydown: "_panelKeydown" } );
this._focusable( this.tabs );
this._hoverable( this.tabs );
},
_setupHeightStyle: function( heightStyle ) {
var maxHeight,
parent = this.element.parent();
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
maxHeight -= this.element.outerHeight() - this.element.height();
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
return;
}
maxHeight -= elem.outerHeight( true );
});
this.element.children().not( this.panels ).each(function() {
maxHeight -= $( this ).outerHeight( true );
});
this.panels.each(function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.panels.each(function() {
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
}).height( maxHeight );
}
},
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
anchor = $( event.currentTarget ),
tab = anchor.closest( "li" ),
clickedIsActive = tab[ 0 ] === active[ 0 ],
collapsing = clickedIsActive && options.collapsible,
toShow = collapsing ? $() : this._getPanelForTab( tab ),
toHide = !active.length ? $() : this._getPanelForTab( active ),
eventData = {
oldTab: active,
oldPanel: toHide,
newTab: collapsing ? $() : tab,
newPanel: toShow
};
event.preventDefault();
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
}
options.active = collapsing ? false : this.tabs.index( tab );
this.active = clickedIsActive ? $() : tab;
if ( this.xhr ) {
this.xhr.abort();
}
if ( !toHide.length && !toShow.length ) {
$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
}
if ( toShow.length ) {
this.load( this.tabs.index( tab ), event );
}
this._toggle( event, eventData );
},
// handles show/hide for selecting tabs
_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
toHide = eventData.oldPanel;
this.running = true;
function complete() {
that.running = false;
that._trigger( "activate", event, eventData );
}
function show() {
eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
if ( toShow.length && that.options.show ) {
that._show( toShow, that.options.show, complete );
} else {
toShow.show();
complete();
}
}
// start out by hiding, then showing, then completing
if ( toHide.length && this.options.hide ) {
this._hide( toHide, this.options.hide, function() {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
show();
});
} else {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
toHide.hide();
show();
}
toHide.attr( "aria-hidden", "true" );
eventData.oldTab.attr({
"aria-selected": "false",
"aria-expanded": "false"
});
// If we're switching tabs, remove the old tab from the tab order.
// If we're opening from collapsed state, remove the previous tab from the tab order.
// If we're collapsing, then keep the collapsing tab in the tab order.
if ( toShow.length && toHide.length ) {
eventData.oldTab.attr( "tabIndex", -1 );
} else if ( toShow.length ) {
this.tabs.filter(function() {
return $( this ).attr( "tabIndex" ) === 0;
})
.attr( "tabIndex", -1 );
}
toShow.attr( "aria-hidden", "false" );
eventData.newTab.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
},
_activate: function( index ) {
var anchor,
active = this._findActive( index );
// trying to activate the already active panel
if ( active[ 0 ] === this.active[ 0 ] ) {
return;
}
// trying to collapse, simulate a click on the current active header
if ( !active.length ) {
active = this.active;
}
anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
this._eventHandler({
target: anchor,
currentTarget: anchor,
preventDefault: $.noop
});
},
_findActive: function( index ) {
return index === false ? $() : this.tabs.eq( index );
},
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
}
return index;
},
_destroy: function() {
if ( this.xhr ) {
this.xhr.abort();
}
this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
this.tablist
.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.removeAttr( "role" );
this.anchors
.removeClass( "ui-tabs-anchor" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeUniqueId();
this.tablist.unbind( this.eventNamespace );
this.tabs.add( this.panels ).each(function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
$( this )
.removeClass( "ui-state-default ui-state-active ui-state-disabled " +
"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-live" )
.removeAttr( "aria-busy" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-expanded" )
.removeAttr( "role" );
}
});
this.tabs.each(function() {
var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) {
li
.attr( "aria-controls", prev )
.removeData( "ui-tabs-aria-controls" );
} else {
li.removeAttr( "aria-controls" );
}
});
this.panels.show();
if ( this.options.heightStyle !== "content" ) {
this.panels.css( "height", "" );
}
},
enable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === false ) {
return;
}
if ( index === undefined ) {
disabled = false;
} else {
index = this._getIndex( index );
if ( $.isArray( disabled ) ) {
disabled = $.map( disabled, function( num ) {
return num !== index ? num : null;
});
} else {
disabled = $.map( this.tabs, function( li, num ) {
return num !== index ? num : null;
});
}
}
this._setupDisabled( disabled );
},
disable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === true ) {
return;
}
if ( index === undefined ) {
disabled = true;
} else {
index = this._getIndex( index );
if ( $.inArray( index, disabled ) !== -1 ) {
return;
}
if ( $.isArray( disabled ) ) {
disabled = $.merge( [ index ], disabled ).sort();
} else {
disabled = [ index ];
}
}
this._setupDisabled( disabled );
},
load: function( index, event ) {
index = this._getIndex( index );
var that = this,
tab = this.tabs.eq( index ),
anchor = tab.find( ".ui-tabs-anchor" ),
panel = this._getPanelForTab( tab ),
eventData = {
tab: tab,
panel: panel
},
complete = function( jqXHR, status ) {
if ( status === "abort" ) {
that.panels.stop( false, true );
}
tab.removeClass( "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
delete that.xhr;
}
};
// not remote
if ( this._isLocal( anchor[ 0 ] ) ) {
return;
}
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
// support: jQuery <1.8
// jQuery <1.8 returns false if the request is canceled in beforeSend,
// but as of 1.8, $.ajax() always returns a jqXHR object.
if ( this.xhr && this.xhr.statusText !== "canceled" ) {
tab.addClass( "ui-tabs-loading" );
panel.attr( "aria-busy", "true" );
this.xhr
.done(function( response, status, jqXHR ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
panel.html( response );
that._trigger( "load", event, eventData );
complete( jqXHR, status );
}, 1 );
})
.fail(function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
complete( jqXHR, status );
}, 1 );
});
}
},
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
url: anchor.attr( "href" ),
beforeSend: function( jqXHR, settings ) {
return that._trigger( "beforeLoad", event,
$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
}
};
},
_getPanelForTab: function( tab ) {
var id = $( tab ).attr( "aria-controls" );
return this.element.find( this._sanitizeSelector( "#" + id ) );
}
});
/*!
* jQuery UI Tooltip 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/tooltip/
*/
var tooltip = $.widget( "ui.tooltip", {
version: "1.11.4",
options: {
content: function() {
// support: IE<9, Opera in jQuery <1.7
// .text() can't accept undefined, so coerce to a string
var title = $( this ).attr( "title" ) || "";
// Escape title, since we're going from an attribute to raw HTML
return $( "<a>" ).text( title ).html();
},
hide: true,
// Disabled elements have inconsistent behavior across browsers (#8661)
items: "[title]:not([disabled])",
position: {
my: "left top+15",
at: "left bottom",
collision: "flipfit flip"
},
show: true,
tooltipClass: null,
track: false,
// callbacks
close: null,
open: null
},
_addDescribedBy: function( elem, id ) {
var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
describedby.push( id );
elem
.data( "ui-tooltip-id", id )
.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
},
_removeDescribedBy: function( elem ) {
var id = elem.data( "ui-tooltip-id" ),
describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
index = $.inArray( id, describedby );
if ( index !== -1 ) {
describedby.splice( index, 1 );
}
elem.removeData( "ui-tooltip-id" );
describedby = $.trim( describedby.join( " " ) );
if ( describedby ) {
elem.attr( "aria-describedby", describedby );
} else {
elem.removeAttr( "aria-describedby" );
}
},
_create: function() {
this._on({
mouseover: "open",
focusin: "open"
});
// IDs of generated tooltips, needed for destroy
this.tooltips = {};
// IDs of parent tooltips where we removed the title attribute
this.parents = {};
if ( this.options.disabled ) {
this._disable();
}
// Append the aria-live region so tooltips announce correctly
this.liveRegion = $( "<div>" )
.attr({
role: "log",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.addClass( "ui-helper-hidden-accessible" )
.appendTo( this.document[ 0 ].body );
},
_setOption: function( key, value ) {
var that = this;
if ( key === "disabled" ) {
this[ value ? "_disable" : "_enable" ]();
this.options[ key ] = value;
// disable element style changes
return;
}
this._super( key, value );
if ( key === "content" ) {
$.each( this.tooltips, function( id, tooltipData ) {
that._updateContent( tooltipData.element );
});
}
},
_disable: function() {
var that = this;
// close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
var event = $.Event( "blur" );
event.target = event.currentTarget = tooltipData.element[ 0 ];
that.close( event, true );
});
// remove title attributes to prevent native tooltips
this.element.find( this.options.items ).addBack().each(function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
element
.data( "ui-tooltip-title", element.attr( "title" ) )
.removeAttr( "title" );
}
});
},
_enable: function() {
// restore title attributes
this.element.find( this.options.items ).addBack().each(function() {
var element = $( this );
if ( element.data( "ui-tooltip-title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
});
},
open: function( event ) {
var that = this,
target = $( event ? event.target : this.element )
// we need closest here due to mouseover bubbling,
// but always pointing at the same event target
.closest( this.options.items );
// No element to show a tooltip for or the tooltip is already open
if ( !target.length || target.data( "ui-tooltip-id" ) ) {
return;
}
if ( target.attr( "title" ) ) {
target.data( "ui-tooltip-title", target.attr( "title" ) );
}
target.data( "ui-tooltip-open", true );
// kill parent tooltips, custom or native, for hover
if ( event && event.type === "mouseover" ) {
target.parents().each(function() {
var parent = $( this ),
blurEvent;
if ( parent.data( "ui-tooltip-open" ) ) {
blurEvent = $.Event( "blur" );
blurEvent.target = blurEvent.currentTarget = this;
that.close( blurEvent, true );
}
if ( parent.attr( "title" ) ) {
parent.uniqueId();
that.parents[ this.id ] = {
element: this,
title: parent.attr( "title" )
};
parent.attr( "title", "" );
}
});
}
this._registerCloseHandlers( event, target );
this._updateContent( target, event );
},
_updateContent: function( target, event ) {
var content,
contentOption = this.options.content,
that = this,
eventType = event ? event.type : null;
if ( typeof contentOption === "string" ) {
return this._open( event, target, contentOption );
}
content = contentOption.call( target[0], function( response ) {
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay(function() {
// Ignore async response if tooltip was closed already
if ( !target.data( "ui-tooltip-open" ) ) {
return;
}
// jQuery creates a special event for focusin when it doesn't
// exist natively. To improve performance, the native event
// object is reused and the type is changed. Therefore, we can't
// rely on the type being correct after the event finished
// bubbling, so we set it back to the previous value. (#8740)
if ( event ) {
event.type = eventType;
}
this._open( event, target, response );
});
});
if ( content ) {
this._open( event, target, content );
}
},
_open: function( event, target, content ) {
var tooltipData, tooltip, delayedShow, a11yContent,
positionOption = $.extend( {}, this.options.position );
if ( !content ) {
return;
}
// Content can be updated multiple times. If the tooltip already
// exists, then just update the content and bail.
tooltipData = this._find( target );
if ( tooltipData ) {
tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
return;
}
// if we have a title, clear it to prevent the native tooltip
// we have to check first to avoid defining a title if none exists
// (we don't want to cause an element to start matching [title])
//
// We use removeAttr only for key events, to allow IE to export the correct
// accessible attributes. For mouse events, set to empty string to avoid
// native tooltip showing up (happens only when removing inside mouseover).
if ( target.is( "[title]" ) ) {
if ( event && event.type === "mouseover" ) {
target.attr( "title", "" );
} else {
target.removeAttr( "title" );
}
}
tooltipData = this._tooltip( target );
tooltip = tooltipData.tooltip;
this._addDescribedBy( target, tooltip.attr( "id" ) );
tooltip.find( ".ui-tooltip-content" ).html( content );
// Support: Voiceover on OS X, JAWS on IE <= 9
// JAWS announces deletions even when aria-relevant="additions"
// Voiceover will sometimes re-read the entire log region's contents from the beginning
this.liveRegion.children().hide();
if ( content.clone ) {
a11yContent = content.clone();
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
} else {
a11yContent = content;
}
$( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
function position( event ) {
positionOption.of = event;
if ( tooltip.is( ":hidden" ) ) {
return;
}
tooltip.position( positionOption );
}
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
this._on( this.document, {
mousemove: position
});
// trigger once to override element-relative positioning
position( event );
} else {
tooltip.position( $.extend({
of: target
}, this.options.position ) );
}
tooltip.hide();
this._show( tooltip, this.options.show );
// Handle tracking tooltips that are shown with a delay (#8644). As soon
// as the tooltip is visible, position the tooltip using the most recent
// event.
if ( this.options.show && this.options.show.delay ) {
delayedShow = this.delayedShow = setInterval(function() {
if ( tooltip.is( ":visible" ) ) {
position( positionOption.of );
clearInterval( delayedShow );
}
}, $.fx.interval );
}
this._trigger( "open", event, { tooltip: tooltip } );
},
_registerCloseHandlers: function( event, target ) {
var events = {
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
fakeEvent.currentTarget = target[0];
this.close( fakeEvent, true );
}
}
};
// Only bind remove handler for delegated targets. Non-delegated
// tooltips will handle this in destroy.
if ( target[ 0 ] !== this.element[ 0 ] ) {
events.remove = function() {
this._removeTooltip( this._find( target ).tooltip );
};
}
if ( !event || event.type === "mouseover" ) {
events.mouseleave = "close";
}
if ( !event || event.type === "focusin" ) {
events.focusout = "close";
}
this._on( true, target, events );
},
close: function( event ) {
var tooltip,
that = this,
target = $( event ? event.currentTarget : this.element ),
tooltipData = this._find( target );
// The tooltip may already be closed
if ( !tooltipData ) {
// We set ui-tooltip-open immediately upon open (in open()), but only set the
// additional data once there's actually content to show (in _open()). So even if the
// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
// the period between open() and _open().
target.removeData( "ui-tooltip-open" );
return;
}
tooltip = tooltipData.tooltip;
// disabling closes the tooltip, so we need to track when we're closing
// to avoid an infinite loop in case the tooltip becomes disabled on close
if ( tooltipData.closing ) {
return;
}
// Clear the interval for delayed tracking tooltips
clearInterval( this.delayedShow );
// only set title if we had one before (see comment in _open())
// If the title attribute has changed since open(), don't restore
if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
}
this._removeDescribedBy( target );
tooltipData.hiding = true;
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
that._removeTooltip( $( this ) );
});
target.removeData( "ui-tooltip-open" );
this._off( target, "mouseleave focusout keyup" );
// Remove 'remove' binding only on delegated targets
if ( target[ 0 ] !== this.element[ 0 ] ) {
this._off( target, "remove" );
}
this._off( this.document, "mousemove" );
if ( event && event.type === "mouseleave" ) {
$.each( this.parents, function( id, parent ) {
$( parent.element ).attr( "title", parent.title );
delete that.parents[ id ];
});
}
tooltipData.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );
if ( !tooltipData.hiding ) {
tooltipData.closing = false;
}
},
_tooltip: function( element ) {
var tooltip = $( "<div>" )
.attr( "role", "tooltip" )
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
( this.options.tooltipClass || "" ) ),
id = tooltip.uniqueId().attr( "id" );
$( "<div>" )
.addClass( "ui-tooltip-content" )
.appendTo( tooltip );
tooltip.appendTo( this.document[0].body );
return this.tooltips[ id ] = {
element: element,
tooltip: tooltip
};
},
_find: function( target ) {
var id = target.data( "ui-tooltip-id" );
return id ? this.tooltips[ id ] : null;
},
_removeTooltip: function( tooltip ) {
tooltip.remove();
delete this.tooltips[ tooltip.attr( "id" ) ];
},
_destroy: function() {
var that = this;
// close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
// Delegate to close method to handle common cleanup
var event = $.Event( "blur" ),
element = tooltipData.element;
event.target = event.currentTarget = element[ 0 ];
that.close( event, true );
// Remove immediately; destroying an open tooltip doesn't use the
// hide animation
$( "#" + id ).remove();
// Restore the title
if ( element.data( "ui-tooltip-title" ) ) {
// If the title attribute has changed since open(), don't restore
if ( !element.attr( "title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
element.removeData( "ui-tooltip-title" );
}
});
this.liveRegion.remove();
}
});
/*!
* jQuery UI Effects 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/effects-core/
*/
var dataSpace = "ui-effects-",
// Create a local jQuery because jQuery Color relies on it and the
// global may not exist with AMD and a custom build (#10199)
jQuery = $;
$.effects = {
effect: {}
};
/*!
* jQuery Color Animations v2.1.2
* https://github.com/jquery/jquery-color
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* Date: Wed Jan 16 08:47:09 2013 -0600
*/
(function( jQuery, undefined ) {
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
// plusequals test for += 100 -= 100
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
// a set of RE's that can match strings and generate color tuples.
stringParsers = [ {
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ],
execResult[ 3 ],
execResult[ 4 ]
];
}
}, {
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ] * 2.55,
execResult[ 2 ] * 2.55,
execResult[ 3 ] * 2.55,
execResult[ 4 ]
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ], 16 )
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
];
}
}, {
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
space: "hsla",
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ] / 100,
execResult[ 3 ] / 100,
execResult[ 4 ]
];
}
} ],
// jQuery.Color( )
color = jQuery.Color = function( color, green, blue, alpha ) {
return new jQuery.Color.fn.parse( color, green, blue, alpha );
},
spaces = {
rgba: {
props: {
red: {
idx: 0,
type: "byte"
},
green: {
idx: 1,
type: "byte"
},
blue: {
idx: 2,
type: "byte"
}
}
},
hsla: {
props: {
hue: {
idx: 0,
type: "degrees"
},
saturation: {
idx: 1,
type: "percent"
},
lightness: {
idx: 2,
type: "percent"
}
}
}
},
propTypes = {
"byte": {
floor: true,
max: 255
},
"percent": {
max: 1
},
"degrees": {
mod: 360,
floor: true
}
},
support = color.support = {},
// element for support tests
supportElem = jQuery( "<p>" )[ 0 ],
// colors = jQuery.Color.names
colors,
// local aliases of functions called often
each = jQuery.each;
// determine rgba support immediately
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
// define cache name and alpha properties
// for rgba and hsla spaces
each( spaces, function( spaceName, space ) {
space.cache = "_" + spaceName;
space.props.alpha = {
idx: 3,
type: "percent",
def: 1
};
});
function clamp( value, prop, allowEmpty ) {
var type = propTypes[ prop.type ] || {};
if ( value == null ) {
return (allowEmpty || !prop.def) ? null : prop.def;
}
// ~~ is an short way of doing floor for positive numbers
value = type.floor ? ~~value : parseFloat( value );
// IE will pass in empty strings as value for alpha,
// which will hit this case
if ( isNaN( value ) ) {
return prop.def;
}
if ( type.mod ) {
// we add mod before modding to make sure that negatives values
// get converted properly: -10 -> 350
return (value + type.mod) % type.mod;
}
// for now all property types without mod have min and max
return 0 > value ? 0 : type.max < value ? type.max : value;
}
function stringParse( string ) {
var inst = color(),
rgba = inst._rgba = [];
string = string.toLowerCase();
each( stringParsers, function( i, parser ) {
var parsed,
match = parser.re.exec( string ),
values = match && parser.parse( match ),
spaceName = parser.space || "rgba";
if ( values ) {
parsed = inst[ spaceName ]( values );
// if this was an rgba parse the assignment might happen twice
// oh well....
inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
rgba = inst._rgba = parsed._rgba;
// exit each( stringParsers ) here because we matched
return false;
}
});
// Found a stringParser that handled it
if ( rgba.length ) {
// if this came from a parsed string, force "transparent" when alpha is 0
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
if ( rgba.join() === "0,0,0,0" ) {
jQuery.extend( rgba, colors.transparent );
}
return inst;
}
// named colors
return colors[ string ];
}
color.fn = jQuery.extend( color.prototype, {
parse: function( red, green, blue, alpha ) {
if ( red === undefined ) {
this._rgba = [ null, null, null, null ];
return this;
}
if ( red.jquery || red.nodeType ) {
red = jQuery( red ).css( green );
green = undefined;
}
var inst = this,
type = jQuery.type( red ),
rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
red = [ red, green, blue, alpha ];
type = "array";
}
if ( type === "string" ) {
return this.parse( stringParse( red ) || colors._default );
}
if ( type === "array" ) {
each( spaces.rgba.props, function( key, prop ) {
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
});
return this;
}
if ( type === "object" ) {
if ( red instanceof color ) {
each( spaces, function( spaceName, space ) {
if ( red[ space.cache ] ) {
inst[ space.cache ] = red[ space.cache ].slice();
}
});
} else {
each( spaces, function( spaceName, space ) {
var cache = space.cache;
each( space.props, function( key, prop ) {
// if the cache doesn't exist, and we know how to convert
if ( !inst[ cache ] && space.to ) {
// if the value was null, we don't need to copy it
// if the key was alpha, we don't need to copy it either
if ( key === "alpha" || red[ key ] == null ) {
return;
}
inst[ cache ] = space.to( inst._rgba );
}
// this is the only case where we allow nulls for ALL properties.
// call clamp with alwaysAllowEmpty
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
});
// everything defined but alpha?
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
// use the default of 1
inst[ cache ][ 3 ] = 1;
if ( space.from ) {
inst._rgba = space.from( inst[ cache ] );
}
}
});
}
return this;
}
},
is: function( compare ) {
var is = color( compare ),
same = true,
inst = this;
each( spaces, function( _, space ) {
var localCache,
isCache = is[ space.cache ];
if (isCache) {
localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
each( space.props, function( _, prop ) {
if ( isCache[ prop.idx ] != null ) {
same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
return same;
}
});
}
return same;
});
return same;
},
_space: function() {
var used = [],
inst = this;
each( spaces, function( spaceName, space ) {
if ( inst[ space.cache ] ) {
used.push( spaceName );
}
});
return used.pop();
},
transition: function( other, distance ) {
var end = color( other ),
spaceName = end._space(),
space = spaces[ spaceName ],
startColor = this.alpha() === 0 ? color( "transparent" ) : this,
start = startColor[ space.cache ] || space.to( startColor._rgba ),
result = start.slice();
end = end[ space.cache ];
each( space.props, function( key, prop ) {
var index = prop.idx,
startValue = start[ index ],
endValue = end[ index ],
type = propTypes[ prop.type ] || {};
// if null, don't override start value
if ( endValue === null ) {
return;
}
// if null - use end
if ( startValue === null ) {
result[ index ] = endValue;
} else {
if ( type.mod ) {
if ( endValue - startValue > type.mod / 2 ) {
startValue += type.mod;
} else if ( startValue - endValue > type.mod / 2 ) {
startValue -= type.mod;
}
}
result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
}
});
return this[ spaceName ]( result );
},
blend: function( opaque ) {
// if we are already opaque - return ourself
if ( this._rgba[ 3 ] === 1 ) {
return this;
}
var rgb = this._rgba.slice(),
a = rgb.pop(),
blend = color( opaque )._rgba;
return color( jQuery.map( rgb, function( v, i ) {
return ( 1 - a ) * blend[ i ] + a * v;
}));
},
toRgbaString: function() {
var prefix = "rgba(",
rgba = jQuery.map( this._rgba, function( v, i ) {
return v == null ? ( i > 2 ? 1 : 0 ) : v;
});
if ( rgba[ 3 ] === 1 ) {
rgba.pop();
prefix = "rgb(";
}
return prefix + rgba.join() + ")";
},
toHslaString: function() {
var prefix = "hsla(",
hsla = jQuery.map( this.hsla(), function( v, i ) {
if ( v == null ) {
v = i > 2 ? 1 : 0;
}
// catch 1 and 2
if ( i && i < 3 ) {
v = Math.round( v * 100 ) + "%";
}
return v;
});
if ( hsla[ 3 ] === 1 ) {
hsla.pop();
prefix = "hsl(";
}
return prefix + hsla.join() + ")";
},
toHexString: function( includeAlpha ) {
var rgba = this._rgba.slice(),
alpha = rgba.pop();
if ( includeAlpha ) {
rgba.push( ~~( alpha * 255 ) );
}
return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
return v.length === 1 ? "0" + v : v;
}).join("");
},
toString: function() {
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
}
});
color.fn.parse.prototype = color.fn;
// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
function hue2rgb( p, q, h ) {
h = ( h + 1 ) % 1;
if ( h * 6 < 1 ) {
return p + ( q - p ) * h * 6;
}
if ( h * 2 < 1) {
return q;
}
if ( h * 3 < 2 ) {
return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
}
return p;
}
spaces.hsla.to = function( rgba ) {
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
return [ null, null, null, rgba[ 3 ] ];
}
var r = rgba[ 0 ] / 255,
g = rgba[ 1 ] / 255,
b = rgba[ 2 ] / 255,
a = rgba[ 3 ],
max = Math.max( r, g, b ),
min = Math.min( r, g, b ),
diff = max - min,
add = max + min,
l = add * 0.5,
h, s;
if ( min === max ) {
h = 0;
} else if ( r === max ) {
h = ( 60 * ( g - b ) / diff ) + 360;
} else if ( g === max ) {
h = ( 60 * ( b - r ) / diff ) + 120;
} else {
h = ( 60 * ( r - g ) / diff ) + 240;
}
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
if ( diff === 0 ) {
s = 0;
} else if ( l <= 0.5 ) {
s = diff / add;
} else {
s = diff / ( 2 - add );
}
return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
};
spaces.hsla.from = function( hsla ) {
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
return [ null, null, null, hsla[ 3 ] ];
}
var h = hsla[ 0 ] / 360,
s = hsla[ 1 ],
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
Math.round( hue2rgb( p, q, h ) * 255 ),
Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
a
];
};
each( spaces, function( spaceName, space ) {
var props = space.props,
cache = space.cache,
to = space.to,
from = space.from;
// makes rgba() and hsla()
color.fn[ spaceName ] = function( value ) {
// generate a cache for this space if it doesn't exist
if ( to && !this[ cache ] ) {
this[ cache ] = to( this._rgba );
}
if ( value === undefined ) {
return this[ cache ].slice();
}
var ret,
type = jQuery.type( value ),
arr = ( type === "array" || type === "object" ) ? value : arguments,
local = this[ cache ].slice();
each( props, function( key, prop ) {
var val = arr[ type === "object" ? key : prop.idx ];
if ( val == null ) {
val = local[ prop.idx ];
}
local[ prop.idx ] = clamp( val, prop );
});
if ( from ) {
ret = color( from( local ) );
ret[ cache ] = local;
return ret;
} else {
return color( local );
}
};
// makes red() green() blue() alpha() hue() saturation() lightness()
each( props, function( key, prop ) {
// alpha is included in more than one space
if ( color.fn[ key ] ) {
return;
}
color.fn[ key ] = function( value ) {
var vtype = jQuery.type( value ),
fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
local = this[ fn ](),
cur = local[ prop.idx ],
match;
if ( vtype === "undefined" ) {
return cur;
}
if ( vtype === "function" ) {
value = value.call( this, cur );
vtype = jQuery.type( value );
}
if ( value == null && prop.empty ) {
return this;
}
if ( vtype === "string" ) {
match = rplusequals.exec( value );
if ( match ) {
value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
}
}
local[ prop.idx ] = value;
return this[ fn ]( local );
};
});
});
// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
var hooks = hook.split( " " );
each( hooks, function( i, hook ) {
jQuery.cssHooks[ hook ] = {
set: function( elem, value ) {
var parsed, curElem,
backgroundColor = "";
if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
value = color( parsed || value );
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
while (
(backgroundColor === "" || backgroundColor === "transparent") &&
curElem && curElem.style
) {
try {
backgroundColor = jQuery.css( curElem, "backgroundColor" );
curElem = curElem.parentNode;
} catch ( e ) {
}
}
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
backgroundColor :
"_default" );
}
value = value.toRgbaString();
}
try {
elem.style[ hook ] = value;
} catch ( e ) {
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
}
}
};
jQuery.fx.step[ hook ] = function( fx ) {
if ( !fx.colorInit ) {
fx.start = color( fx.elem, hook );
fx.end = color( fx.end );
fx.colorInit = true;
}
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
};
});
};
color.hook( stepHooks );
jQuery.cssHooks.borderColor = {
expand: function( value ) {
var expanded = {};
each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
expanded[ "border" + part + "Color" ] = value;
});
return expanded;
}
};
// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors = jQuery.Color.names = {
// 4.1. Basic color keywords
aqua: "#00ffff",
black: "#000000",
blue: "#0000ff",
fuchsia: "#ff00ff",
gray: "#808080",
green: "#008000",
lime: "#00ff00",
maroon: "#800000",
navy: "#000080",
olive: "#808000",
purple: "#800080",
red: "#ff0000",
silver: "#c0c0c0",
teal: "#008080",
white: "#ffffff",
yellow: "#ffff00",
// 4.2.3. "transparent" color keyword
transparent: [ null, null, null, 0 ],
_default: "#ffffff"
};
})( jQuery );
/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
(function() {
var classAnimationActions = [ "add", "remove", "toggle" ],
shorthandStyles = {
border: 1,
borderBottom: 1,
borderColor: 1,
borderLeft: 1,
borderRight: 1,
borderTop: 1,
borderWidth: 1,
margin: 1,
padding: 1
};
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
$.fx.step[ prop ] = function( fx ) {
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
jQuery.style( fx.elem, prop, fx.end );
fx.setAttr = true;
}
};
});
function getElementStyles( elem ) {
var key, len,
style = elem.ownerDocument.defaultView ?
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
elem.currentStyle,
styles = {};
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
len = style.length;
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
styles[ $.camelCase( key ) ] = style[ key ];
}
}
// support: Opera, IE <9
} else {
for ( key in style ) {
if ( typeof style[ key ] === "string" ) {
styles[ key ] = style[ key ];
}
}
}
return styles;
}
function styleDifference( oldStyle, newStyle ) {
var diff = {},
name, value;
for ( name in newStyle ) {
value = newStyle[ name ];
if ( oldStyle[ name ] !== value ) {
if ( !shorthandStyles[ name ] ) {
if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
diff[ name ] = value;
}
}
}
}
return diff;
}
// support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
$.effects.animateClass = function( value, duration, easing, callback ) {
var o = $.speed( duration, easing, callback );
return this.queue( function() {
var animated = $( this ),
baseClass = animated.attr( "class" ) || "",
applyClassChange,
allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
// map the animated objects to store the original styles.
allAnimations = allAnimations.map(function() {
var el = $( this );
return {
el: el,
start: getElementStyles( this )
};
});
// apply class change
applyClassChange = function() {
$.each( classAnimationActions, function(i, action) {
if ( value[ action ] ) {
animated[ action + "Class" ]( value[ action ] );
}
});
};
applyClassChange();
// map all animated objects again - calculate new styles and diff
allAnimations = allAnimations.map(function() {
this.end = getElementStyles( this.el[ 0 ] );
this.diff = styleDifference( this.start, this.end );
return this;
});
// apply original class
animated.attr( "class", baseClass );
// map all animated objects again - this time collecting a promise
allAnimations = allAnimations.map(function() {
var styleInfo = this,
dfd = $.Deferred(),
opts = $.extend({}, o, {
queue: false,
complete: function() {
dfd.resolve( styleInfo );
}
});
this.el.animate( this.diff, opts );
return dfd.promise();
});
// once all animations have completed:
$.when.apply( $, allAnimations.get() ).done(function() {
// set the final class
applyClassChange();
// for each animated element,
// clear all css properties that were animated
$.each( arguments, function() {
var el = this.el;
$.each( this.diff, function(key) {
el.css( key, "" );
});
});
// this is guarnteed to be there if you use jQuery.speed()
// it also handles dequeuing the next anim...
o.complete.call( animated[ 0 ] );
});
});
};
$.fn.extend({
addClass: (function( orig ) {
return function( classNames, speed, easing, callback ) {
return speed ?
$.effects.animateClass.call( this,
{ add: classNames }, speed, easing, callback ) :
orig.apply( this, arguments );
};
})( $.fn.addClass ),
removeClass: (function( orig ) {
return function( classNames, speed, easing, callback ) {
return arguments.length > 1 ?
$.effects.animateClass.call( this,
{ remove: classNames }, speed, easing, callback ) :
orig.apply( this, arguments );
};
})( $.fn.removeClass ),
toggleClass: (function( orig ) {
return function( classNames, force, speed, easing, callback ) {
if ( typeof force === "boolean" || force === undefined ) {
if ( !speed ) {
// without speed parameter
return orig.apply( this, arguments );
} else {
return $.effects.animateClass.call( this,
(force ? { add: classNames } : { remove: classNames }),
speed, easing, callback );
}
} else {
// without force parameter
return $.effects.animateClass.call( this,
{ toggle: classNames }, force, speed, easing );
}
};
})( $.fn.toggleClass ),
switchClass: function( remove, add, speed, easing, callback) {
return $.effects.animateClass.call( this, {
add: add,
remove: remove
}, speed, easing, callback );
}
});
})();
/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
(function() {
$.extend( $.effects, {
version: "1.11.4",
// Saves a set of properties in a data storage
save: function( element, set ) {
for ( var i = 0; i < set.length; i++ ) {
if ( set[ i ] !== null ) {
element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
}
}
},
// Restores a set of previously saved properties from a data storage
restore: function( element, set ) {
var val, i;
for ( i = 0; i < set.length; i++ ) {
if ( set[ i ] !== null ) {
val = element.data( dataSpace + set[ i ] );
// support: jQuery 1.6.2
// http://bugs.jquery.com/ticket/9917
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
// We can't differentiate between "" and 0 here, so we just assume
// empty string since it's likely to be a more common value...
if ( val === undefined ) {
val = "";
}
element.css( set[ i ], val );
}
}
},
setMode: function( el, mode ) {
if (mode === "toggle") {
mode = el.is( ":hidden" ) ? "show" : "hide";
}
return mode;
},
// Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
getBaseline: function( origin, original ) {
var y, x;
switch ( origin[ 0 ] ) {
case "top": y = 0; break;
case "middle": y = 0.5; break;
case "bottom": y = 1; break;
default: y = origin[ 0 ] / original.height;
}
switch ( origin[ 1 ] ) {
case "left": x = 0; break;
case "center": x = 0.5; break;
case "right": x = 1; break;
default: x = origin[ 1 ] / original.width;
}
return {
x: x,
y: y
};
},
// Wraps the element around a wrapper that copies position properties
createWrapper: function( element ) {
// if the element is already wrapped, return it
if ( element.parent().is( ".ui-effects-wrapper" )) {
return element.parent();
}
// wrap the element
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
"float": element.css( "float" )
},
wrapper = $( "<div></div>" )
.addClass( "ui-effects-wrapper" )
.css({
fontSize: "100%",
background: "transparent",
border: "none",
margin: 0,
padding: 0
}),
// Store the size in case width/height are defined in % - Fixes #5245
size = {
width: element.width(),
height: element.height()
},
active = document.activeElement;
// support: Firefox
// Firefox incorrectly exposes anonymous content
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try {
active.id;
} catch ( e ) {
active = document.body;
}
element.wrap( wrapper );
// Fixes #7595 - Elements lose focus when wrapped.
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
$( active ).focus();
}
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
// transfer positioning properties to the wrapper
if ( element.css( "position" ) === "static" ) {
wrapper.css({ position: "relative" });
element.css({ position: "relative" });
} else {
$.extend( props, {
position: element.css( "position" ),
zIndex: element.css( "z-index" )
});
$.each([ "top", "left", "bottom", "right" ], function(i, pos) {
props[ pos ] = element.css( pos );
if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
props[ pos ] = "auto";
}
});
element.css({
position: "relative",
top: 0,
left: 0,
right: "auto",
bottom: "auto"
});
}
element.css(size);
return wrapper.css( props ).show();
},
removeWrapper: function( element ) {
var active = document.activeElement;
if ( element.parent().is( ".ui-effects-wrapper" ) ) {
element.parent().replaceWith( element );
// Fixes #7595 - Elements lose focus when wrapped.
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
$( active ).focus();
}
}
return element;
},
setTransition: function( element, list, factor, value ) {
value = value || {};
$.each( list, function( i, x ) {
var unit = element.cssUnit( x );
if ( unit[ 0 ] > 0 ) {
value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
}
});
return value;
}
});
// return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {
// allow passing all options as the first parameter
if ( $.isPlainObject( effect ) ) {
options = effect;
effect = effect.effect;
}
// convert to an object
effect = { effect: effect };
// catch (effect, null, ...)
if ( options == null ) {
options = {};
}
// catch (effect, callback)
if ( $.isFunction( options ) ) {
callback = options;
speed = null;
options = {};
}
// catch (effect, speed, ?)
if ( typeof options === "number" || $.fx.speeds[ options ] ) {
callback = speed;
speed = options;
options = {};
}
// catch (effect, options, callback)
if ( $.isFunction( speed ) ) {
callback = speed;
speed = null;
}
// add options to effect
if ( options ) {
$.extend( effect, options );
}
speed = speed || options.duration;
effect.duration = $.fx.off ? 0 :
typeof speed === "number" ? speed :
speed in $.fx.speeds ? $.fx.speeds[ speed ] :
$.fx.speeds._default;
effect.complete = callback || options.complete;
return effect;
}
function standardAnimationOption( option ) {
// Valid standard speeds (nothing, number, named speed)
if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
return true;
}
// Invalid strings - treat as "normal" speed
if ( typeof option === "string" && !$.effects.effect[ option ] ) {
return true;
}
// Complete callback
if ( $.isFunction( option ) ) {
return true;
}
// Options hash (but not naming an effect)
if ( typeof option === "object" && !option.effect ) {
return true;
}
// Didn't match any standard API
return false;
}
$.fn.extend({
effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode,
queue = args.queue,
effectMethod = $.effects.effect[ args.effect ];
if ( $.fx.off || !effectMethod ) {
// delegate to the original method (e.g., .show()) if possible
if ( mode ) {
return this[ mode ]( args.duration, args.complete );
} else {
return this.each( function() {
if ( args.complete ) {
args.complete.call( this );
}
});
}
}
function run( next ) {
var elem = $( this ),
complete = args.complete,
mode = args.mode;
function done() {
if ( $.isFunction( complete ) ) {
complete.call( elem[0] );
}
if ( $.isFunction( next ) ) {
next();
}
}
// If the element already has the correct final state, delegate to
// the core methods so the internal tracking of "olddisplay" works.
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
elem[ mode ]();
done();
} else {
effectMethod.call( elem[0], args, done );
}
}
return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
},
show: (function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "show";
return this.effect.call( this, args );
}
};
})( $.fn.show ),
hide: (function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "hide";
return this.effect.call( this, args );
}
};
})( $.fn.hide ),
toggle: (function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "toggle";
return this.effect.call( this, args );
}
};
})( $.fn.toggle ),
// helper functions
cssUnit: function(key) {
var style = this.css( key ),
val = [];
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
if ( style.indexOf( unit ) > 0 ) {
val = [ parseFloat( style ), unit ];
}
});
return val;
}
});
})();
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
(function() {
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings = {};
$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
baseEasings[ name ] = function( p ) {
return Math.pow( p, i + 2 );
};
});
$.extend( baseEasings, {
Sine: function( p ) {
return 1 - Math.cos( p * Math.PI / 2 );
},
Circ: function( p ) {
return 1 - Math.sqrt( 1 - p * p );
},
Elastic: function( p ) {
return p === 0 || p === 1 ? p :
-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
},
Back: function( p ) {
return p * p * ( 3 * p - 2 );
},
Bounce: function( p ) {
var pow2,
bounce = 4;
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
}
});
$.each( baseEasings, function( name, easeIn ) {
$.easing[ "easeIn" + name ] = easeIn;
$.easing[ "easeOut" + name ] = function( p ) {
return 1 - easeIn( 1 - p );
};
$.easing[ "easeInOut" + name ] = function( p ) {
return p < 0.5 ?
easeIn( p * 2 ) / 2 :
1 - easeIn( p * -2 + 2 ) / 2;
};
});
})();
var effect = $.effects;
/*!
* jQuery UI Effects Blind 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/blind-effect/
*/
var effectBlind = $.effects.effect.blind = function( o, done ) {
// Create element
var el = $( this ),
rvertical = /up|down|vertical/,
rpositivemotion = /up|left|vertical|horizontal/,
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
direction = o.direction || "up",
vertical = rvertical.test( direction ),
ref = vertical ? "height" : "width",
ref2 = vertical ? "top" : "left",
motion = rpositivemotion.test( direction ),
animation = {},
show = mode === "show",
wrapper, distance, margin;
// if already wrapped, the wrapper's properties are my property. #6245
if ( el.parent().is( ".ui-effects-wrapper" ) ) {
$.effects.save( el.parent(), props );
} else {
$.effects.save( el, props );
}
el.show();
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
distance = wrapper[ ref ]();
margin = parseFloat( wrapper.css( ref2 ) ) || 0;
animation[ ref ] = show ? distance : 0;
if ( !motion ) {
el
.css( vertical ? "bottom" : "right", 0 )
.css( vertical ? "top" : "left", "auto" )
.css({ position: "absolute" });
animation[ ref2 ] = show ? margin : distance + margin;
}
// start at 0 if we are showing
if ( show ) {
wrapper.css( ref, 0 );
if ( !motion ) {
wrapper.css( ref2, margin + distance );
}
}
// Animate
wrapper.animate( animation, {
duration: o.duration,
easing: o.easing,
queue: false,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
/*!
* jQuery UI Effects Bounce 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/bounce-effect/
*/
var effectBounce = $.effects.effect.bounce = function( o, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
// defaults:
mode = $.effects.setMode( el, o.mode || "effect" ),
hide = mode === "hide",
show = mode === "show",
direction = o.direction || "up",
distance = o.distance,
times = o.times || 5,
// number of internal animations
anims = times * 2 + ( show || hide ? 1 : 0 ),
speed = o.duration / anims,
easing = o.easing,
// utility:
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ),
i,
upAnim,
downAnim,
// we will need to re-assemble the queue to stack our animations in place
queue = el.queue(),
queuelen = queue.length;
// Avoid touching opacity to prevent clearType and PNG issues in IE
if ( show || hide ) {
props.push( "opacity" );
}
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el ); // Create Wrapper
// default distance for the BIGGEST bounce is the outer Distance / 3
if ( !distance ) {
distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
}
if ( show ) {
downAnim = { opacity: 1 };
downAnim[ ref ] = 0;
// if we are showing, force opacity 0 and set the initial position
// then do the "first" animation
el.css( "opacity", 0 )
.css( ref, motion ? -distance * 2 : distance * 2 )
.animate( downAnim, speed, easing );
}
// start at the smallest distance if we are hiding
if ( hide ) {
distance = distance / Math.pow( 2, times - 1 );
}
downAnim = {};
downAnim[ ref ] = 0;
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
for ( i = 0; i < times; i++ ) {
upAnim = {};
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
el.animate( upAnim, speed, easing )
.animate( downAnim, speed, easing );
distance = hide ? distance * 2 : distance / 2;
}
// Last Bounce when Hiding
if ( hide ) {
upAnim = { opacity: 0 };
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
el.animate( upAnim, speed, easing );
}
el.queue(function() {
if ( hide ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
// inject all the animations we just queued to be first in line (after "inprogress")
if ( queuelen > 1) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
el.dequeue();
};
/*!
* jQuery UI Effects Clip 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/clip-effect/
*/
var effectClip = $.effects.effect.clip = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
show = mode === "show",
direction = o.direction || "vertical",
vert = direction === "vertical",
size = vert ? "height" : "width",
position = vert ? "top" : "left",
animation = {},
wrapper, animate, distance;
// Save & Show
$.effects.save( el, props );
el.show();
// Create Wrapper
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
distance = animate[ size ]();
// Shift
if ( show ) {
animate.css( size, 0 );
animate.css( position, distance / 2 );
}
// Create Animation Object:
animation[ size ] = show ? distance : 0;
animation[ position ] = show ? 0 : distance / 2;
// Animate
animate.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( !show ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
/*!
* jQuery UI Effects Drop 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/drop-effect/
*/
var effectDrop = $.effects.effect.drop = function( o, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
show = mode === "show",
direction = o.direction || "left",
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
animation = {
opacity: show ? 1 : 0
},
distance;
// Adjust
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
if ( show ) {
el
.css( "opacity", 0 )
.css( ref, motion === "pos" ? -distance : distance );
}
// Animation
animation[ ref ] = ( show ?
( motion === "pos" ? "+=" : "-=" ) :
( motion === "pos" ? "-=" : "+=" ) ) +
distance;
// Animate
el.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
/*!
* jQuery UI Effects Explode 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/explode-effect/
*/
var effectExplode = $.effects.effect.explode = function( o, done ) {
var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
cells = rows,
el = $( this ),
mode = $.effects.setMode( el, o.mode || "hide" ),
show = mode === "show",
// show and then visibility:hidden the element before calculating offset
offset = el.show().css( "visibility", "hidden" ).offset(),
// width and height of a piece
width = Math.ceil( el.outerWidth() / cells ),
height = Math.ceil( el.outerHeight() / rows ),
pieces = [],
// loop
i, j, left, top, mx, my;
// children animate complete:
function childComplete() {
pieces.push( this );
if ( pieces.length === rows * cells ) {
animComplete();
}
}
// clone the element for each row and cell.
for ( i = 0; i < rows ; i++ ) { // ===>
top = offset.top + i * height;
my = i - ( rows - 1 ) / 2 ;
for ( j = 0; j < cells ; j++ ) { // |||
left = offset.left + j * width;
mx = j - ( cells - 1 ) / 2 ;
// Create a clone of the now hidden main element that will be absolute positioned
// within a wrapper div off the -left and -top equal to size of our pieces
el
.clone()
.appendTo( "body" )
.wrap( "<div></div>" )
.css({
position: "absolute",
visibility: "visible",
left: -j * width,
top: -i * height
})
// select the wrapper - make it overflow: hidden and absolute positioned based on
// where the original was located +left and +top equal to the size of pieces
.parent()
.addClass( "ui-effects-explode" )
.css({
position: "absolute",
overflow: "hidden",
width: width,
height: height,
left: left + ( show ? mx * width : 0 ),
top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1
}).animate({
left: left + ( show ? 0 : mx * width ),
top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0
}, o.duration || 500, o.easing, childComplete );
}
}
function animComplete() {
el.css({
visibility: "visible"
});
$( pieces ).remove();
if ( !show ) {
el.hide();
}
done();
}
};
/*!
* jQuery UI Effects Fade 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/fade-effect/
*/
var effectFade = $.effects.effect.fade = function( o, done ) {
var el = $( this ),
mode = $.effects.setMode( el, o.mode || "toggle" );
el.animate({
opacity: mode
}, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: done
});
};
/*!
* jQuery UI Effects Fold 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/fold-effect/
*/
var effectFold = $.effects.effect.fold = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
show = mode === "show",
hide = mode === "hide",
size = o.size || 15,
percent = /([0-9]+)%/.exec( size ),
horizFirst = !!o.horizFirst,
widthFirst = show !== horizFirst,
ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
duration = o.duration / 2,
wrapper, distance,
animation1 = {},
animation2 = {};
$.effects.save( el, props );
el.show();
// Create Wrapper
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
distance = widthFirst ?
[ wrapper.width(), wrapper.height() ] :
[ wrapper.height(), wrapper.width() ];
if ( percent ) {
size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
}
if ( show ) {
wrapper.css( horizFirst ? {
height: 0,
width: size
} : {
height: size,
width: 0
});
}
// Animation
animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
// Animate
wrapper
.animate( animation1, duration, o.easing )
.animate( animation2, duration, o.easing, function() {
if ( hide ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
};
/*!
* jQuery UI Effects Highlight 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/highlight-effect/
*/
var effectHighlight = $.effects.effect.highlight = function( o, done ) {
var elem = $( this ),
props = [ "backgroundImage", "backgroundColor", "opacity" ],
mode = $.effects.setMode( elem, o.mode || "show" ),
animation = {
backgroundColor: elem.css( "backgroundColor" )
};
if (mode === "hide") {
animation.opacity = 0;
}
$.effects.save( elem, props );
elem
.show()
.css({
backgroundImage: "none",
backgroundColor: o.color || "#ffff99"
})
.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
elem.hide();
}
$.effects.restore( elem, props );
done();
}
});
};
/*!
* jQuery UI Effects Size 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/size-effect/
*/
var effectSize = $.effects.effect.size = function( o, done ) {
// Create element
var original, baseline, factor,
el = $( this ),
props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
// Always restore
props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
// Copy for children
props2 = [ "width", "height", "overflow" ],
cProps = [ "fontSize" ],
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
// Set options
mode = $.effects.setMode( el, o.mode || "effect" ),
restore = o.restore || mode !== "effect",
scale = o.scale || "both",
origin = o.origin || [ "middle", "center" ],
position = el.css( "position" ),
props = restore ? props0 : props1,
zero = {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
};
if ( mode === "show" ) {
el.show();
}
original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
};
if ( o.mode === "toggle" && mode === "show" ) {
el.from = o.to || zero;
el.to = o.from || original;
} else {
el.from = o.from || ( mode === "show" ? zero : original );
el.to = o.to || ( mode === "hide" ? zero : original );
}
// Set scaling factor
factor = {
from: {
y: el.from.height / original.height,
x: el.from.width / original.width
},
to: {
y: el.to.height / original.height,
x: el.to.width / original.width
}
};
// Scale the css box
if ( scale === "box" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( vProps );
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
props = props.concat( hProps );
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
}
}
// Scale the content
if ( scale === "content" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( cProps ).concat( props2 );
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
}
}
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
el.css( "overflow", "hidden" ).css( el.from );
// Adjust
if (origin) { // Calculate baseline shifts
baseline = $.effects.getBaseline( origin, original );
el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
}
el.css( el.from ); // set top & left
// Animate
if ( scale === "content" || scale === "both" ) { // Scale the children
// Add margins/font-size
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
hProps = hProps.concat([ "marginLeft", "marginRight" ]);
props2 = props0.concat(vProps).concat(hProps);
el.find( "*[width]" ).each( function() {
var child = $( this ),
c_original = {
height: child.height(),
width: child.width(),
outerHeight: child.outerHeight(),
outerWidth: child.outerWidth()
};
if (restore) {
$.effects.save(child, props2);
}
child.from = {
height: c_original.height * factor.from.y,
width: c_original.width * factor.from.x,
outerHeight: c_original.outerHeight * factor.from.y,
outerWidth: c_original.outerWidth * factor.from.x
};
child.to = {
height: c_original.height * factor.to.y,
width: c_original.width * factor.to.x,
outerHeight: c_original.height * factor.to.y,
outerWidth: c_original.width * factor.to.x
};
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
}
// Animate children
child.css( child.from );
child.animate( child.to, o.duration, o.easing, function() {
// Restore children
if ( restore ) {
$.effects.restore( child, props2 );
}
});
});
}
// Animate
el.animate( el.to, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( el.to.opacity === 0 ) {
el.css( "opacity", el.from.opacity );
}
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
if ( !restore ) {
// we need to calculate our new positioning based on the scaling
if ( position === "static" ) {
el.css({
position: "relative",
top: el.to.top,
left: el.to.left
});
} else {
$.each([ "top", "left" ], function( idx, pos ) {
el.css( pos, function( _, str ) {
var val = parseInt( str, 10 ),
toRef = idx ? el.to.left : el.to.top;
// if original was "auto", recalculate the new value from wrapper
if ( str === "auto" ) {
return toRef + "px";
}
return val + toRef + "px";
});
});
}
}
$.effects.removeWrapper( el );
done();
}
});
};
/*!
* jQuery UI Effects Scale 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/scale-effect/
*/
var effectScale = $.effects.effect.scale = function( o, done ) {
// Create element
var el = $( this ),
options = $.extend( true, {}, o ),
mode = $.effects.setMode( el, o.mode || "effect" ),
percent = parseInt( o.percent, 10 ) ||
( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
direction = o.direction || "both",
origin = o.origin,
original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
},
factor = {
y: direction !== "horizontal" ? (percent / 100) : 1,
x: direction !== "vertical" ? (percent / 100) : 1
};
// We are going to pass this effect to the size effect:
options.effect = "size";
options.queue = false;
options.complete = done;
// Set default origin and restore for show/hide
if ( mode !== "effect" ) {
options.origin = origin || [ "middle", "center" ];
options.restore = true;
}
options.from = o.from || ( mode === "show" ? {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
} : original );
options.to = {
height: original.height * factor.y,
width: original.width * factor.x,
outerHeight: original.outerHeight * factor.y,
outerWidth: original.outerWidth * factor.x
};
// Fade option to support puff
if ( options.fade ) {
if ( mode === "show" ) {
options.from.opacity = 0;
options.to.opacity = 1;
}
if ( mode === "hide" ) {
options.from.opacity = 1;
options.to.opacity = 0;
}
}
// Animate
el.effect( options );
};
/*!
* jQuery UI Effects Puff 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/puff-effect/
*/
var effectPuff = $.effects.effect.puff = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "hide" ),
hide = mode === "hide",
percent = parseInt( o.percent, 10 ) || 150,
factor = percent / 100,
original = {
height: elem.height(),
width: elem.width(),
outerHeight: elem.outerHeight(),
outerWidth: elem.outerWidth()
};
$.extend( o, {
effect: "scale",
queue: false,
fade: true,
mode: mode,
complete: done,
percent: hide ? percent : 100,
from: hide ?
original :
{
height: original.height * factor,
width: original.width * factor,
outerHeight: original.outerHeight * factor,
outerWidth: original.outerWidth * factor
}
});
elem.effect( o );
};
/*!
* jQuery UI Effects Pulsate 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/pulsate-effect/
*/
var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "show" ),
show = mode === "show",
hide = mode === "hide",
showhide = ( show || mode === "hide" ),
// showing or hiding leaves of the "last" animation
anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = o.duration / anims,
animateTo = 0,
queue = elem.queue(),
queuelen = queue.length,
i;
if ( show || !elem.is(":visible")) {
elem.css( "opacity", 0 ).show();
animateTo = 1;
}
// anims - 1 opacity "toggles"
for ( i = 1; i < anims; i++ ) {
elem.animate({
opacity: animateTo
}, duration, o.easing );
animateTo = 1 - animateTo;
}
elem.animate({
opacity: animateTo
}, duration, o.easing);
elem.queue(function() {
if ( hide ) {
elem.hide();
}
done();
});
// We just queued up "anims" animations, we need to put them next in the queue
if ( queuelen > 1 ) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
elem.dequeue();
};
/*!
* jQuery UI Effects Shake 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/shake-effect/
*/
var effectShake = $.effects.effect.shake = function( o, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "effect" ),
direction = o.direction || "left",
distance = o.distance || 20,
times = o.times || 3,
anims = times * 2 + 1,
speed = Math.round( o.duration / anims ),
ref = (direction === "up" || direction === "down") ? "top" : "left",
positiveMotion = (direction === "up" || direction === "left"),
animation = {},
animation1 = {},
animation2 = {},
i,
// we will need to re-assemble the queue to stack our animations in place
queue = el.queue(),
queuelen = queue.length;
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
// Animation
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
// Animate
el.animate( animation, speed, o.easing );
// Shakes
for ( i = 1; i < times; i++ ) {
el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
}
el
.animate( animation1, speed, o.easing )
.animate( animation, speed / 2, o.easing )
.queue(function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
// inject all the animations we just queued to be first in line (after "inprogress")
if ( queuelen > 1) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
el.dequeue();
};
/*!
* jQuery UI Effects Slide 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/slide-effect/
*/
var effectSlide = $.effects.effect.slide = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
mode = $.effects.setMode( el, o.mode || "show" ),
show = mode === "show",
direction = o.direction || "left",
ref = (direction === "up" || direction === "down") ? "top" : "left",
positiveMotion = (direction === "up" || direction === "left"),
distance,
animation = {};
// Adjust
$.effects.save( el, props );
el.show();
distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
$.effects.createWrapper( el ).css({
overflow: "hidden"
});
if ( show ) {
el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
}
// Animation
animation[ ref ] = ( show ?
( positiveMotion ? "+=" : "-=") :
( positiveMotion ? "-=" : "+=")) +
distance;
// Animate
el.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
/*!
* jQuery UI Effects Transfer 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/transfer-effect/
*/
var effectTransfer = $.effects.effect.transfer = function( o, done ) {
var elem = $( this ),
target = $( o.to ),
targetFixed = target.css( "position" ) === "fixed",
body = $("body"),
fixTop = targetFixed ? body.scrollTop() : 0,
fixLeft = targetFixed ? body.scrollLeft() : 0,
endPosition = target.offset(),
animation = {
top: endPosition.top - fixTop,
left: endPosition.left - fixLeft,
height: target.innerHeight(),
width: target.innerWidth()
},
startPosition = elem.offset(),
transfer = $( "<div class='ui-effects-transfer'></div>" )
.appendTo( document.body )
.addClass( o.className )
.css({
top: startPosition.top - fixTop,
left: startPosition.left - fixLeft,
height: elem.innerHeight(),
width: elem.innerWidth(),
position: targetFixed ? "fixed" : "absolute"
})
.animate( animation, o.duration, o.easing, function() {
transfer.remove();
done();
});
};
})); |
/* eslint-disable prefer-arrow-callback */
/* eslint-disable func-names */
/* eslint-disable no-undef */
const { assert } = require('chai');
const seeder = require('../../seeder/seeder');
const db = require('../../database-mysql');
describe('Database', function () {
describe('Update Database', function () {
const names = ['Bob', 'Charlie', 'Jack', 'Jill', 'DrNy', 'Chris', 'Sarah', 'Kim', 'Mary', 'xxAio', 'shaneGiant', 'F.O', 'M.A', 'W.W', 'L.L', 'Arkoo'];
const dates = ['08-20-2020', '01-10-2020', '02-12-2020', '03-22-2020', '09-24-2020', '07-02-2020', '10-29-2020', '03-10-2020', '04-05-2020'];
it('Should upload mock data to the database', function () {
const seedPromisify = function () {
return new Promise((resolve, reject) => {
seeder(names, dates, (err, result) => {
if (err) {
reject(error);
} else {
resolve(result);
}
});
});
};
seedPromisify()
.then(() => {
db.findAll((err, result) => {
if (err) {
throw (err);
} else {
return result;
}
});
})
.then((result) => {
assert.equal(typeof result, 'array');
})
.then(() => {
db.clearDb((err, result) => {
if (err) {
throw err;
} else {
return result;
}
});
})
.catch((error) => {
throw (error);
});
});
});
describe('Find All', function () {
it('Should return results from the database', function () {
const findAllPromisify = function () {
return new Promise((resolve, reject) => {
db.findAll((err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
};
findAllPromisify()
.then((result) => {
assert.equal(typeof result, 'object');
})
.catch((error) => {
throw (error);
});
});
});
describe('Clear Database', function () {
it('Should clear the database, leaving only the tables', function () {
const clearDbPromisify = function () {
return new Promise((resolve, reject) => {
db.clearDb((err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
};
clearDbPromisify()
.then(() => {
db.findAll((err, result) => {
if (err) {
throw err;
} else {
return result;
}
});
})
.then((results) => {
assert.equal(results.data.length, 0);
})
.catch((error) => {
throw (error);
});
});
});
});
|
const { GraphQLString } = require('graphql');
const TokenScalar = require('../scalars/token.scalar.js');
const DateScalar = require('../scalars/date.scalar.js');
const UriScalar = require('../scalars/uri.scalar.js');
/**
* @name exports
* @static
* @summary Arguments for the operationdefinition query
*/
module.exports = {
// http://hl7.org/fhir/SearchParameter/OperationDefinition-base
base: {
type: GraphQLString,
fhirtype: 'reference',
xpath: 'OperationDefinition.base',
description: 'Marks this as a profile of the base',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-code
code: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.code',
description: 'Name used to invoke the operation',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-date
date: {
type: DateScalar,
fhirtype: 'date',
xpath: 'OperationDefinition.date',
description: 'Date for this version of the operation definition',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-instance
instance: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.instance',
description: 'Invoke on an instance?',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-kind
kind: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.kind',
description: 'operation | query',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-name
name: {
type: GraphQLString,
fhirtype: 'string',
xpath: 'OperationDefinition.name',
description: 'Informal name for this operation',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-profile
profile: {
type: GraphQLString,
fhirtype: 'reference',
xpath: 'OperationDefinition.parameter.profile',
description: 'Profile on the type',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-publisher
publisher: {
type: GraphQLString,
fhirtype: 'string',
xpath: 'OperationDefinition.publisher',
description: 'Name of the publisher (Organization or individual)',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-status
status: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.status',
description: 'draft | active | retired',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-system
system: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.system',
description: 'Invoke at the system level?',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-type
type: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.type',
description: 'Invoke at resource level for these type',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-url
url: {
type: UriScalar,
fhirtype: 'uri',
xpath: 'OperationDefinition.url',
description: 'Logical URL to reference this operation definition',
},
// http://hl7.org/fhir/SearchParameter/OperationDefinition-version
version: {
type: TokenScalar,
fhirtype: 'token',
xpath: 'OperationDefinition.version',
description: 'Logical id for this version of the operation definition',
},
};
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M.01 0h24v24h-24V0z" /><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z" /></React.Fragment>
, 'SyncSharp');
|
# coding: utf-8
# ----------------------------------------------------------------------------
# <copyright company="Aspose" file="export_image.py">
# Copyright (c) 2019 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# </summary>
# ----------------------------------------------------------------------------
import os
import asposeimagingcloud.models.requests as requests
from asposeimagingcloudexamples.imaging_base import ImagingBase
class ExportImage(ImagingBase):
"""Export image example"""
def __init__(self, imaging_api):
ImagingBase.__init__(self, imaging_api)
self._print_header('Export image example:')
def _get_sample_image_file_name(self):
return 'ExportSampleImage.bmp'
def save_image_as_from_storage(self):
"""Export an image to another format"""
print('Export an image to another format')
self._upload_sample_image_to_cloud()
# Please refer to
# https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-Export(SaveAs)
# for possible output formats
format = 'pdf' # Resulting image format
folder = ImagingBase.CLOUD_PATH # Input file is saved at the Examples folder in the storage
storage = None # We are using default Cloud Storage
request = requests.ConvertImageRequest(self._get_sample_image_file_name(), format, folder, storage)
print('Call SaveImageAs with params: format: {0}'.format(format))
updated_image = self._imaging_api.convert_image(request)
self._save_updated_sample_image_to_output(updated_image, False, format)
print()
def save_image_as_and_upload_to_storage(self):
"""Export an image to another format"""
print('Export an image to another format and upload to cloud storage')
self._upload_sample_image_to_cloud()
# Please refer to
# https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-Export(SaveAs)
# for possible output formats
format = 'pdf' # Resulting image format
folder = ImagingBase.CLOUD_PATH # Input file is saved at the Examples folder in the storage
storage = None # We are using default Cloud Storage
request = requests.ConvertImageRequest(self._get_sample_image_file_name(), format, folder, storage)
print('Call SaveImageAs with params: format: {0}'.format(format))
updated_image = self._imaging_api.convert_image(request)
self._upload_image_to_cloud(self._get_modified_sample_image_file_name(False, format), updated_image)
print()
def create_saved_image_as_from_request_body(self):
"""Export an image to another format. Image data is passed in a request stream"""
print('Export an image to another format. Image data is passed in a request body')
# Please refer to
# https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-Export(SaveAs)
# for possible output formats
format = 'pdf' # Resulting image format
storage = None # We are using default Cloud Storage
out_path = None # Path to updated file (if this is empty, response contains streamed image)
input_stream = os.path.join(ImagingBase.EXAMPLE_IMAGES_FOLDER, self._get_sample_image_file_name())
request = requests.CreateConvertedImageRequest(input_stream, format, out_path, storage)
print('Call CreateSavedImageAs with params: format: {0}'.format(format))
updated_image = self._imaging_api.create_converted_image(request)
self._save_updated_sample_image_to_output(updated_image, False, format)
print()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.