First commit
BIN
media/3.png
Executable file
|
After Width: | Height: | Size: 378 KiB |
BIN
media/4.png
Executable file
|
After Width: | Height: | Size: 486 KiB |
BIN
media/Forward normal rough diffuse mapping.png
Executable file
|
After Width: | Height: | Size: 764 KiB |
BIN
media/aa.png
Executable file
|
After Width: | Height: | Size: 1.9 MiB |
BIN
media/asd.png
Executable file
|
After Width: | Height: | Size: 215 KiB |
BIN
media/deferred lighting 6 - good light.png
Executable file
|
After Width: | Height: | Size: 547 KiB |
BIN
media/diffuse.png
Executable file
|
After Width: | Height: | Size: 1.4 MiB |
126
media/examples.js
Executable file
@@ -0,0 +1,126 @@
|
||||
import keplerEngine from './engine/kepler.js';
|
||||
import entity from './engine/entity.js';
|
||||
import material from './engine/material.js';
|
||||
import sampler2D from './engine/sampler2D.js';
|
||||
import mesh from './engine/mesh.js';
|
||||
import viewport from './engine/viewport.js';
|
||||
import {matrix4} from './engine/math.js';
|
||||
import template from './engine/renderPasses/template.js';
|
||||
import sceneNode from './engine/sceneNode.js';
|
||||
|
||||
kepler = new keplerEngine();
|
||||
|
||||
// Viewport
|
||||
var ViewPort = new viewport("keplerEngine");
|
||||
|
||||
// Load model
|
||||
kepler.assimpLoader.load( "demo.json", ViewPort.scene );
|
||||
|
||||
// Add viewport
|
||||
kepler.addViewport( ViewPort );
|
||||
|
||||
// Material
|
||||
var groundMaterial = new material();
|
||||
|
||||
// Samplers
|
||||
var normalTexture = kepler.resources.getTexture("floorTiles_normal");
|
||||
var normalSampler = new sampler2D();
|
||||
normalSampler.addTexture(normalTexture);
|
||||
|
||||
var diffuseTexture = kepler.resources.getTexture("floorTiles_diff");
|
||||
var diffuseSampler = new sampler2D();
|
||||
diffuseSampler.addTexture(diffuseTexture);
|
||||
|
||||
groundMaterial.addTexture(diffuseSampler);
|
||||
groundMaterial.addNormal(normalSampler);
|
||||
//groundMaterial.addRoughness(normalSampler);
|
||||
|
||||
// Properties
|
||||
groundMaterial.diffuseColor = [179/256,199/256,217/256];
|
||||
groundMaterial.alpha = 1;
|
||||
groundMaterial.reflection = 0.2;
|
||||
groundMaterial.roughness = 0.3;
|
||||
groundMaterial.metalic = 0.1;
|
||||
groundMaterial.uvMultiplier = 6;
|
||||
groundMaterial.create();
|
||||
|
||||
// Cube mesh
|
||||
var cubeMesh = ViewPort.primitives.createCube(10);
|
||||
cubeMesh.addMaterial(groundMaterial);
|
||||
|
||||
// Cube Entity
|
||||
var cubeEntity = new entity( );
|
||||
cubeEntity.addMesh( cubeMesh );
|
||||
cubeEntity.name = "sky sphere";
|
||||
cubeEntity.transform.position = [0, -10, 0];
|
||||
cubeEntity.transform.update();
|
||||
|
||||
ViewPort.scene.addEntity( cubeEntity );
|
||||
|
||||
// Start application
|
||||
kepler.application();
|
||||
|
||||
|
||||
|
||||
|
||||
// Template.js
|
||||
|
||||
import framebuffer from '../framebuffer.js';
|
||||
import sampler2D from '../sampler2D.js';
|
||||
import {math, vector3, matrix4} from '../math.js';
|
||||
import samplerCube from '../samplerCube.js';
|
||||
import shader from '../shader.js';
|
||||
|
||||
class template {
|
||||
|
||||
/**
|
||||
* set viewport
|
||||
* @param {(viewport)} viewport
|
||||
**/
|
||||
setViewport( viewport ){
|
||||
|
||||
this.viewport = viewport;
|
||||
this.gl = viewport.gl;
|
||||
|
||||
}
|
||||
|
||||
prepare() {
|
||||
|
||||
this.width = this.viewport.width;
|
||||
this.height = this.viewport.height;
|
||||
|
||||
this.targetSampler = new sampler2D( );
|
||||
this.targetSampler.type = this.gl.FLOAT;
|
||||
|
||||
this.framebuffer = new framebuffer( );
|
||||
this.framebuffer.setViewport( this.viewport );
|
||||
|
||||
this.framebuffer.width = this.width;
|
||||
this.framebuffer.height = this.height;
|
||||
|
||||
this.framebuffer.addSampler( this.targetSampler );
|
||||
this.framebuffer.create();
|
||||
|
||||
|
||||
this.shader = new shader();
|
||||
this.shader.createFromFile("shaders/template.shader");
|
||||
|
||||
this.shader.setUniform("viewProjection", this.viewport.quad.viewProjection );
|
||||
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
//this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this.framebuffer.glFramebuffer);
|
||||
this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);
|
||||
|
||||
this.gl.clearColor( 0, 0, 0, 1 );
|
||||
this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
|
||||
|
||||
this.viewport.quad.draw( this.shader );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export {template as default};
|
||||
BIN
media/fonts/SegoeUIMono-Regular.TTF
Executable file
BIN
media/fonts/myriad/MyriadPro-Black.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackCond.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackCondIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackSemiCn.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackSemiCnIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackSemiExt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BlackSemiExtIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Bold.eot
Executable file
BIN
media/fonts/myriad/MyriadPro-Bold.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Bold.otf.eot
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldCond.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldCondIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldSemiCn.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldSemiCnIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldSemiExt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-BoldSemiExtIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Cond.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-CondIt.eot
Executable file
BIN
media/fonts/myriad/MyriadPro-CondIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-It.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Light.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightCond.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightCondIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightSemiCn.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightSemiCnIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightSemiExt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-LightSemiExtIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Regular.eot
Executable file
BIN
media/fonts/myriad/MyriadPro-Regular.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiCn.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiCnIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiExt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiExtIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-Semibold.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldCond.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldCondIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldSemiCn.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldSemiCnIt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldSemiExt.otf
Executable file
BIN
media/fonts/myriad/MyriadPro-SemiboldSemiExtIt.otf
Executable file
BIN
media/fonts/myriad/aa/MyriadPro-Bold.eot
Executable file
BIN
media/fonts/myriad/myriadpro-cond-webfont.eot
Executable file
BIN
media/fonts/myriad/myriadpro-semiboldcond-webfont.eot
Executable file
BIN
media/libs/images/Thumbs.db
Executable file
BIN
media/libs/images/blank.gif
Executable file
|
After Width: | Height: | Size: 49 B |
BIN
media/libs/images/colorpicker_background.png
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
media/libs/images/colorpicker_hex.png
Executable file
|
After Width: | Height: | Size: 794 B |
BIN
media/libs/images/colorpicker_hsb_b.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/libs/images/colorpicker_hsb_h.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/libs/images/colorpicker_hsb_s.png
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
media/libs/images/colorpicker_indic.gif
Executable file
|
After Width: | Height: | Size: 86 B |
BIN
media/libs/images/colorpicker_overlay.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
media/libs/images/colorpicker_rgb_b.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/libs/images/colorpicker_rgb_g.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/images/colorpicker_rgb_r.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/images/colorpicker_select.gif
Executable file
|
After Width: | Height: | Size: 78 B |
BIN
media/libs/images/colorpicker_submit.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/libs/images/custom_background.png
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
media/libs/images/custom_hex.png
Executable file
|
After Width: | Height: | Size: 814 B |
BIN
media/libs/images/custom_hsb_b.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/images/custom_hsb_h.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/libs/images/custom_hsb_s.png
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
media/libs/images/custom_indic.gif
Executable file
|
After Width: | Height: | Size: 86 B |
BIN
media/libs/images/custom_rgb_b.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/libs/images/custom_rgb_g.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/images/custom_rgb_r.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/images/custom_submit.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/libs/images/select.png
Executable file
|
After Width: | Height: | Size: 655 B |
BIN
media/libs/images/select2.png
Executable file
|
After Width: | Height: | Size: 646 B |
BIN
media/libs/images/slider.png
Executable file
|
After Width: | Height: | Size: 548 B |
161
media/libs/jquery/colorpicker.css
Executable file
@@ -0,0 +1,161 @@
|
||||
.colorpicker {
|
||||
width: 356px;
|
||||
height: 176px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
background: url(../images/colorpicker_background.png);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
display: none;
|
||||
}
|
||||
.colorpicker_color {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
left: 14px;
|
||||
top: 13px;
|
||||
position: absolute;
|
||||
background: #f00;
|
||||
overflow: hidden;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.colorpicker_color div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(../images/colorpicker_overlay.png);
|
||||
}
|
||||
.colorpicker_color div div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_select.gif);
|
||||
margin: -5px 0 0 -5px;
|
||||
}
|
||||
.colorpicker_hue {
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
left: 171px;
|
||||
width: 35px;
|
||||
height: 150px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_hue div {
|
||||
position: absolute;
|
||||
width: 35px;
|
||||
height: 9px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_indic.gif) left top;
|
||||
margin: -4px 0 0 0;
|
||||
left: 0px;
|
||||
}
|
||||
.colorpicker_new_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 213px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker_current_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 283px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker input {
|
||||
background-color: transparent;
|
||||
border: 1px solid transparent;
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #898989;
|
||||
top: 4px;
|
||||
right: 11px;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 11px;
|
||||
}
|
||||
.colorpicker_hex {
|
||||
position: absolute;
|
||||
width: 72px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_hex.png) top;
|
||||
left: 212px;
|
||||
top: 142px;
|
||||
}
|
||||
.colorpicker_hex input {
|
||||
right: 6px;
|
||||
}
|
||||
.colorpicker_field {
|
||||
height: 22px;
|
||||
width: 62px;
|
||||
background-position: top;
|
||||
position: absolute;
|
||||
}
|
||||
.colorpicker_field span {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 22px;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
right: 0;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_rgb_r {
|
||||
background-image: url(../images/colorpicker_rgb_r.png);
|
||||
top: 52px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_g {
|
||||
background-image: url(../images/colorpicker_rgb_g.png);
|
||||
top: 82px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_b {
|
||||
background-image: url(../images/colorpicker_rgb_b.png);
|
||||
top: 112px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_hsb_h {
|
||||
background-image: url(../images/colorpicker_hsb_h.png);
|
||||
top: 52px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_s {
|
||||
background-image: url(../images/colorpicker_hsb_s.png);
|
||||
top: 82px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_b {
|
||||
background-image: url(../images/colorpicker_hsb_b.png);
|
||||
top: 112px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_submit {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_submit.png) top;
|
||||
left: 322px;
|
||||
top: 142px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.colorpicker_focus {
|
||||
background-position: center;
|
||||
}
|
||||
.colorpicker_hex.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_submit.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_slider {
|
||||
background-position: bottom;
|
||||
}
|
||||
484
media/libs/jquery/colorpicker.js
vendored
Executable file
@@ -0,0 +1,484 @@
|
||||
/**
|
||||
*
|
||||
* Color picker
|
||||
* Author: Stefan Petre www.eyecon.ro
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses
|
||||
*
|
||||
*/
|
||||
(function ($) {
|
||||
var ColorPicker = function () {
|
||||
var
|
||||
ids = {},
|
||||
inAction,
|
||||
charMin = 65,
|
||||
visible,
|
||||
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
|
||||
defaults = {
|
||||
eventName: 'click',
|
||||
onShow: function () {},
|
||||
onBeforeShow: function(){},
|
||||
onHide: function () {},
|
||||
onChange: function () {},
|
||||
onSubmit: function () {},
|
||||
color: 'ff0000',
|
||||
livePreview: true,
|
||||
flat: false
|
||||
},
|
||||
fillRGBFields = function (hsb, cal) {
|
||||
var rgb = HSBToRGB(hsb);
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(1).val(rgb.r).end()
|
||||
.eq(2).val(rgb.g).end()
|
||||
.eq(3).val(rgb.b).end();
|
||||
},
|
||||
fillHSBFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(4).val(hsb.h).end()
|
||||
.eq(5).val(hsb.s).end()
|
||||
.eq(6).val(hsb.b).end();
|
||||
},
|
||||
fillHexFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(0).val(HSBToHex(hsb)).end();
|
||||
},
|
||||
setSelector = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
|
||||
$(cal).data('colorpicker').selectorIndic.css({
|
||||
left: parseInt(150 * hsb.s/100, 10),
|
||||
top: parseInt(150 * (100-hsb.b)/100, 10)
|
||||
});
|
||||
},
|
||||
setHue = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
|
||||
},
|
||||
setCurrentColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
setNewColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
keyDown = function (ev) {
|
||||
var pressedKey = ev.charCode || ev.keyCode || -1;
|
||||
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
|
||||
return false;
|
||||
}
|
||||
var cal = $(this).parent().parent();
|
||||
if (cal.data('colorpicker').livePreview === true) {
|
||||
change.apply(this);
|
||||
}
|
||||
},
|
||||
change = function (ev) {
|
||||
var cal = $(this).parent().parent(), col;
|
||||
if (this.parentNode.className.indexOf('_hex') > 0) {
|
||||
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
|
||||
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
||||
cal.data('colorpicker').color = col = fixHSB({
|
||||
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
|
||||
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
|
||||
});
|
||||
} else {
|
||||
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
|
||||
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
|
||||
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
|
||||
}));
|
||||
}
|
||||
if (ev) {
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
}
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
||||
},
|
||||
blur = function (ev) {
|
||||
var cal = $(this).parent().parent();
|
||||
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
},
|
||||
focus = function () {
|
||||
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
|
||||
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
$(this).parent().addClass('colorpicker_focus');
|
||||
},
|
||||
downIncrement = function (ev) {
|
||||
var field = $(this).parent().find('input').focus();
|
||||
var current = {
|
||||
el: $(this).parent().addClass('colorpicker_slider'),
|
||||
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
||||
y: ev.pageY,
|
||||
field: field,
|
||||
val: parseInt(field.val(), 10),
|
||||
preview: $(this).parent().parent().data('colorpicker').livePreview
|
||||
};
|
||||
$(document).bind('mouseup', current, upIncrement);
|
||||
$(document).bind('mousemove', current, moveIncrement);
|
||||
},
|
||||
moveIncrement = function (ev) {
|
||||
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
|
||||
if (ev.data.preview) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upIncrement = function (ev) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
|
||||
$(document).unbind('mouseup', upIncrement);
|
||||
$(document).unbind('mousemove', moveIncrement);
|
||||
return false;
|
||||
},
|
||||
downHue = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
y: $(this).offset().top
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).bind('mouseup', current, upHue);
|
||||
$(document).bind('mousemove', current, moveHue);
|
||||
},
|
||||
moveHue = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(4)
|
||||
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upHue = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).unbind('mouseup', upHue);
|
||||
$(document).unbind('mousemove', moveHue);
|
||||
return false;
|
||||
},
|
||||
downSelector = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
pos: $(this).offset()
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).bind('mouseup', current, upSelector);
|
||||
$(document).bind('mousemove', current, moveSelector);
|
||||
},
|
||||
moveSelector = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(6)
|
||||
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
|
||||
.end()
|
||||
.eq(5)
|
||||
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upSelector = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).unbind('mouseup', upSelector);
|
||||
$(document).unbind('mousemove', moveSelector);
|
||||
return false;
|
||||
},
|
||||
enterSubmit = function (ev) {
|
||||
$(this).addClass('colorpicker_focus');
|
||||
},
|
||||
leaveSubmit = function (ev) {
|
||||
$(this).removeClass('colorpicker_focus');
|
||||
},
|
||||
clickSubmit = function (ev) {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').color;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
setCurrentColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
|
||||
},
|
||||
show = function (ev) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
|
||||
var pos = $(this).offset();
|
||||
var viewPort = getViewport();
|
||||
var top = pos.top + this.offsetHeight;
|
||||
var left = pos.left;
|
||||
if (top + 176 > viewPort.t + viewPort.h) {
|
||||
top -= this.offsetHeight + 176;
|
||||
}
|
||||
if (left + 356 > viewPort.l + viewPort.w) {
|
||||
left -= 356;
|
||||
}
|
||||
cal.css({left: left + 'px', top: top + 'px'});
|
||||
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
|
||||
cal.show();
|
||||
}
|
||||
$(document).bind('mousedown', {cal: cal}, hide);
|
||||
return false;
|
||||
},
|
||||
hide = function (ev) {
|
||||
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
||||
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||
ev.data.cal.hide();
|
||||
}
|
||||
$(document).unbind('mousedown', hide);
|
||||
}
|
||||
},
|
||||
isChildOf = function(parentEl, el, container) {
|
||||
if (parentEl == el) {
|
||||
return true;
|
||||
}
|
||||
if (parentEl.contains) {
|
||||
return parentEl.contains(el);
|
||||
}
|
||||
if ( parentEl.compareDocumentPosition ) {
|
||||
return !!(parentEl.compareDocumentPosition(el) & 16);
|
||||
}
|
||||
var prEl = el.parentNode;
|
||||
while(prEl && prEl != container) {
|
||||
if (prEl == parentEl)
|
||||
return true;
|
||||
prEl = prEl.parentNode;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getViewport = function () {
|
||||
var m = document.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||
};
|
||||
},
|
||||
fixHSB = function (hsb) {
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, hsb.h)),
|
||||
s: Math.min(100, Math.max(0, hsb.s)),
|
||||
b: Math.min(100, Math.max(0, hsb.b))
|
||||
};
|
||||
},
|
||||
fixRGB = function (rgb) {
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, rgb.r)),
|
||||
g: Math.min(255, Math.max(0, rgb.g)),
|
||||
b: Math.min(255, Math.max(0, rgb.b))
|
||||
};
|
||||
},
|
||||
fixHex = function (hex) {
|
||||
var len = 6 - hex.length;
|
||||
if (len > 0) {
|
||||
var o = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
o.push('0');
|
||||
}
|
||||
o.push(hex);
|
||||
hex = o.join('');
|
||||
}
|
||||
return hex;
|
||||
},
|
||||
HexToRGB = function (hex) {
|
||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
||||
},
|
||||
HexToHSB = function (hex) {
|
||||
return RGBToHSB(HexToRGB(hex));
|
||||
},
|
||||
RGBToHSB = function (rgb) {
|
||||
var hsb = {
|
||||
h: 0,
|
||||
s: 0,
|
||||
b: 0
|
||||
};
|
||||
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||
var delta = max - min;
|
||||
hsb.b = max;
|
||||
if (max != 0) {
|
||||
|
||||
}
|
||||
hsb.s = max != 0 ? 255 * delta / max : 0;
|
||||
if (hsb.s != 0) {
|
||||
if (rgb.r == max) {
|
||||
hsb.h = (rgb.g - rgb.b) / delta;
|
||||
} else if (rgb.g == max) {
|
||||
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||
} else {
|
||||
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||
}
|
||||
} else {
|
||||
hsb.h = -1;
|
||||
}
|
||||
hsb.h *= 60;
|
||||
if (hsb.h < 0) {
|
||||
hsb.h += 360;
|
||||
}
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
},
|
||||
HSBToRGB = function (hsb) {
|
||||
var rgb = {};
|
||||
var h = Math.round(hsb.h);
|
||||
var s = Math.round(hsb.s*255/100);
|
||||
var v = Math.round(hsb.b*255/100);
|
||||
if(s == 0) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = (255-s)*v/255;
|
||||
var t3 = (t1-t2)*(h%60)/60;
|
||||
if(h==360) h = 0;
|
||||
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
|
||||
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
|
||||
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
|
||||
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
|
||||
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
|
||||
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
|
||||
else {rgb.r=0; rgb.g=0; rgb.b=0}
|
||||
}
|
||||
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
|
||||
},
|
||||
RGBToHex = function (rgb) {
|
||||
var hex = [
|
||||
rgb.r.toString(16),
|
||||
rgb.g.toString(16),
|
||||
rgb.b.toString(16)
|
||||
];
|
||||
$.each(hex, function (nr, val) {
|
||||
if (val.length == 1) {
|
||||
hex[nr] = '0' + val;
|
||||
}
|
||||
});
|
||||
return hex.join('');
|
||||
},
|
||||
HSBToHex = function (hsb) {
|
||||
return RGBToHex(HSBToRGB(hsb));
|
||||
},
|
||||
restoreOriginal = function () {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').origColor;
|
||||
cal.data('colorpicker').color = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
};
|
||||
return {
|
||||
init: function (opt) {
|
||||
opt = $.extend({}, defaults, opt||{});
|
||||
if (typeof opt.color == 'string') {
|
||||
opt.color = HexToHSB(opt.color);
|
||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
||||
opt.color = RGBToHSB(opt.color);
|
||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
||||
opt.color = fixHSB(opt.color);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function () {
|
||||
if (!$(this).data('colorpickerId')) {
|
||||
var options = $.extend({}, opt);
|
||||
options.origColor = opt.color;
|
||||
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
||||
$(this).data('colorpickerId', id);
|
||||
var cal = $(tpl).attr('id', id);
|
||||
if (options.flat) {
|
||||
cal.appendTo(this).show();
|
||||
} else {
|
||||
cal.appendTo(document.body);
|
||||
}
|
||||
options.fields = cal
|
||||
.find('input')
|
||||
.bind('keyup', keyDown)
|
||||
.bind('change', change)
|
||||
.bind('blur', blur)
|
||||
.bind('focus', focus);
|
||||
cal
|
||||
.find('span').bind('mousedown', downIncrement).end()
|
||||
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
|
||||
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
|
||||
options.selectorIndic = options.selector.find('div div');
|
||||
options.el = this;
|
||||
options.hue = cal.find('div.colorpicker_hue div');
|
||||
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
|
||||
options.newColor = cal.find('div.colorpicker_new_color');
|
||||
options.currentColor = cal.find('div.colorpicker_current_color');
|
||||
cal.data('colorpicker', options);
|
||||
cal.find('div.colorpicker_submit')
|
||||
.bind('mouseenter', enterSubmit)
|
||||
.bind('mouseleave', leaveSubmit)
|
||||
.bind('click', clickSubmit);
|
||||
fillRGBFields(options.color, cal.get(0));
|
||||
fillHSBFields(options.color, cal.get(0));
|
||||
fillHexFields(options.color, cal.get(0));
|
||||
setHue(options.color, cal.get(0));
|
||||
setSelector(options.color, cal.get(0));
|
||||
setCurrentColor(options.color, cal.get(0));
|
||||
setNewColor(options.color, cal.get(0));
|
||||
if (options.flat) {
|
||||
cal.css({
|
||||
position: 'relative',
|
||||
display: 'block'
|
||||
});
|
||||
} else {
|
||||
$(this).bind(options.eventName, show);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showPicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
show.apply(this);
|
||||
}
|
||||
});
|
||||
},
|
||||
hidePicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
$('#' + $(this).data('colorpickerId')).hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
setColor: function(col) {
|
||||
if (typeof col == 'string') {
|
||||
col = HexToHSB(col);
|
||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||
col = RGBToHSB(col);
|
||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||
col = fixHSB(col);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function(){
|
||||
if ($(this).data('colorpickerId')) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').color = col;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setCurrentColor(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
$.fn.extend({
|
||||
ColorPicker: ColorPicker.init,
|
||||
ColorPickerHide: ColorPicker.hidePicker,
|
||||
ColorPickerShow: ColorPicker.showPicker,
|
||||
ColorPickerSetColor: ColorPicker.setColor
|
||||
});
|
||||
})(jQuery)
|
||||
50
media/libs/jquery/demos/accordion/collapsible.html
Executable file
@@ -0,0 +1,50 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Collapse content</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion({
|
||||
collapsible: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>By default, accordions always keep one section open. To allow for all sections to be be collapsible, set the <code>collapsible</code> option to true. Click on the currently open section to collapse its content pane.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
64
media/libs/jquery/demos/accordion/custom-icons.html
Executable file
@@ -0,0 +1,64 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Customize icons</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<script src="../../ui/jquery.ui.button.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
var icons = {
|
||||
header: "ui-icon-circle-arrow-e",
|
||||
activeHeader: "ui-icon-circle-arrow-s"
|
||||
};
|
||||
$( "#accordion" ).accordion({
|
||||
icons: icons
|
||||
});
|
||||
$( "#toggle" ).button().click(function() {
|
||||
if ( $( "#accordion" ).accordion( "option", "icons" ) ) {
|
||||
$( "#accordion" ).accordion( "option", "icons", null );
|
||||
} else {
|
||||
$( "#accordion" ).accordion( "option", "icons", icons );
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="toggle">Toggle icons</button>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>Customize the header icons with the <code>icons</code> option, which accepts classes for the header's default and active (open) state. Use any class from the UI CSS framework, or create custom classes with background images.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
80
media/libs/jquery/demos/accordion/default.html
Executable file
@@ -0,0 +1,80 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Default functionality</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>
|
||||
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
|
||||
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
|
||||
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
|
||||
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
|
||||
</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>
|
||||
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
|
||||
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
|
||||
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
|
||||
suscipit faucibus urna.
|
||||
</p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>
|
||||
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
|
||||
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
|
||||
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
|
||||
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
|
||||
</p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>
|
||||
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
|
||||
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
|
||||
mauris vel est.
|
||||
</p>
|
||||
<p>
|
||||
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
|
||||
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
|
||||
inceptos himenaeos.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>
|
||||
Click headers to expand/collapse content that is broken into logical sections, much like tabs.
|
||||
Optionally, toggle sections open/closed on mouseover.
|
||||
</p>
|
||||
<p>
|
||||
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
|
||||
usable without JavaScript.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
72
media/libs/jquery/demos/accordion/fillspace.html
Executable file
@@ -0,0 +1,72 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Fill space</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||
<script src="../../ui/jquery.ui.resizable.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<style>
|
||||
#accordion-resizer {
|
||||
padding: 10px;
|
||||
width: 350px;
|
||||
height: 220px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion({
|
||||
heightStyle: "fill"
|
||||
});
|
||||
});
|
||||
$(function() {
|
||||
$( "#accordion-resizer" ).resizable({
|
||||
minHeight: 140,
|
||||
minWidth: 200,
|
||||
resize: function() {
|
||||
$( "#accordion" ).accordion( "refresh" );
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3 class="docs">Resize the outer container:</h3>
|
||||
|
||||
<div id="accordion-resizer" class="ui-widget-content">
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>Because the accordion is comprised of block-level elements, by default its width fills the available horizontal space. To fill the vertical space allocated by its container, set the <code>heightStyle</code> option to <code>"fill"</code>, and the script will automatically set the dimensions of the accordion to the height of its parent container.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
133
media/libs/jquery/demos/accordion/hoverintent.html
Executable file
@@ -0,0 +1,133 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Open on hoverintent</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion({
|
||||
event: "click hoverintent"
|
||||
});
|
||||
});
|
||||
|
||||
var cfg = ($.hoverintent = {
|
||||
sensitivity: 7,
|
||||
interval: 100
|
||||
});
|
||||
|
||||
$.event.special.hoverintent = {
|
||||
setup: function() {
|
||||
$( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler );
|
||||
},
|
||||
teardown: function() {
|
||||
$( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler );
|
||||
},
|
||||
handler: function( event ) {
|
||||
var that = this,
|
||||
args = arguments,
|
||||
target = $( event.target ),
|
||||
cX, cY, pX, pY;
|
||||
|
||||
function track( event ) {
|
||||
cX = event.pageX;
|
||||
cY = event.pageY;
|
||||
};
|
||||
pX = event.pageX;
|
||||
pY = event.pageY;
|
||||
function clear() {
|
||||
target
|
||||
.unbind( "mousemove", track )
|
||||
.unbind( "mouseout", arguments.callee );
|
||||
clearTimeout( timeout );
|
||||
}
|
||||
function handler() {
|
||||
if ( ( Math.abs( pX - cX ) + Math.abs( pY - cY ) ) < cfg.sensitivity ) {
|
||||
clear();
|
||||
event.type = "hoverintent";
|
||||
// prevent accessing the original event since the new event
|
||||
// is fired asynchronously and the old event is no longer
|
||||
// usable (#6028)
|
||||
event.originalEvent = {};
|
||||
jQuery.event.handle.apply( that, args );
|
||||
} else {
|
||||
pX = cX;
|
||||
pY = cY;
|
||||
timeout = setTimeout( handler, cfg.interval );
|
||||
}
|
||||
}
|
||||
var timeout = setTimeout( handler, cfg.interval );
|
||||
target.mousemove( track ).mouseout( clear );
|
||||
return true;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>
|
||||
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
|
||||
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
|
||||
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
|
||||
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
|
||||
</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>
|
||||
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
|
||||
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
|
||||
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
|
||||
suscipit faucibus urna.
|
||||
</p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>
|
||||
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
|
||||
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
|
||||
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
|
||||
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
|
||||
</p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>
|
||||
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
|
||||
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
|
||||
mauris vel est.
|
||||
</p>
|
||||
<p>
|
||||
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
|
||||
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
|
||||
inceptos himenaeos.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>
|
||||
Click headers to expand/collapse content that is broken into logical sections, much like tabs.
|
||||
Optionally, toggle sections open/closed on mouseover.
|
||||
</p>
|
||||
<p>
|
||||
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
|
||||
usable without JavaScript.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
20
media/libs/jquery/demos/accordion/index.html
Executable file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion Demos</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<ul>
|
||||
<li><a href="default.html">Default functionality</a></li>
|
||||
<li><a href="fillspace.html">Fill space</a></li>
|
||||
<li><a href="no-auto-height.html">No auto height</a></li>
|
||||
<li><a href="collapsible.html">Collapse content</a></li>
|
||||
<li><a href="hoverintent.html">Open on hoverintent</a></li>
|
||||
<li><a href="custom-icons.html">Customize icons</a></li>
|
||||
<li><a href="sortable.html">Sortable</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
50
media/libs/jquery/demos/accordion/no-auto-height.html
Executable file
@@ -0,0 +1,50 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - No auto height</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
|
||||
</div>
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
|
||||
</div>
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
|
||||
<ul>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
<li>List item</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>Setting <code>heightStyle: "content"</code> allows the accordion panels to keep their native height.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
74
media/libs/jquery/demos/accordion/sortable.html
Executable file
@@ -0,0 +1,74 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Accordion - Sortable</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||
<script src="../../ui/jquery.ui.sortable.js"></script>
|
||||
<script src="../../ui/jquery.ui.accordion.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<style>
|
||||
/* IE has layout issues when sorting (see #5413) */
|
||||
.group { zoom: 1 }
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" )
|
||||
.accordion({
|
||||
header: "> div > h3"
|
||||
})
|
||||
.sortable({
|
||||
axis: "y",
|
||||
handle: "h3",
|
||||
stop: function( event, ui ) {
|
||||
// IE doesn't register the blur when sorting
|
||||
// so trigger focusout handlers to remove .ui-state-focus
|
||||
ui.item.children( "h3" ).triggerHandler( "focusout" );
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="accordion">
|
||||
<div class="group">
|
||||
<h3>Section 1</h3>
|
||||
<div>
|
||||
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<h3>Section 2</h3>
|
||||
<div>
|
||||
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<h3>Section 3</h3>
|
||||
<div>
|
||||
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
|
||||
<ul>
|
||||
<li>List item one</li>
|
||||
<li>List item two</li>
|
||||
<li>List item three</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<h3>Section 4</h3>
|
||||
<div>
|
||||
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>Drag the header to re-order panels.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
67
media/libs/jquery/demos/autocomplete/categories.html
Executable file
@@ -0,0 +1,67 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Autocomplete - Categories</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.position.js"></script>
|
||||
<script src="../../ui/jquery.ui.menu.js"></script>
|
||||
<script src="../../ui/jquery.ui.autocomplete.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<style>
|
||||
.ui-autocomplete-category {
|
||||
font-weight: bold;
|
||||
padding: .2em .4em;
|
||||
margin: .8em 0 .2em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$.widget( "custom.catcomplete", $.ui.autocomplete, {
|
||||
_renderMenu: function( ul, items ) {
|
||||
var that = this,
|
||||
currentCategory = "";
|
||||
$.each( items, function( index, item ) {
|
||||
if ( item.category != currentCategory ) {
|
||||
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
|
||||
currentCategory = item.category;
|
||||
}
|
||||
that._renderItemData( ul, item );
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
var data = [
|
||||
{ label: "anders", category: "" },
|
||||
{ label: "andreas", category: "" },
|
||||
{ label: "antal", category: "" },
|
||||
{ label: "annhhx10", category: "Products" },
|
||||
{ label: "annk K12", category: "Products" },
|
||||
{ label: "annttop C13", category: "Products" },
|
||||
{ label: "anders andersson", category: "People" },
|
||||
{ label: "andreas andersson", category: "People" },
|
||||
{ label: "andreas johnson", category: "People" }
|
||||
];
|
||||
|
||||
$( "#search" ).catcomplete({
|
||||
delay: 0,
|
||||
source: data
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<label for="search">Search: </label>
|
||||
<input id="search">
|
||||
|
||||
<div class="demo-description">
|
||||
<p>A categorized search result. Try typing "a" or "n".</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
206
media/libs/jquery/demos/autocomplete/combobox.html
Executable file
@@ -0,0 +1,206 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Autocomplete - Combobox</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.button.js"></script>
|
||||
<script src="../../ui/jquery.ui.position.js"></script>
|
||||
<script src="../../ui/jquery.ui.menu.js"></script>
|
||||
<script src="../../ui/jquery.ui.autocomplete.js"></script>
|
||||
<script src="../../ui/jquery.ui.tooltip.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<style>
|
||||
.ui-combobox {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.ui-combobox-toggle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin-left: -1px;
|
||||
padding: 0;
|
||||
/* support: IE7 */
|
||||
*height: 1.7em;
|
||||
*top: 0.1em;
|
||||
}
|
||||
.ui-combobox-input {
|
||||
margin: 0;
|
||||
padding: 0.3em;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
(function( $ ) {
|
||||
$.widget( "ui.combobox", {
|
||||
_create: function() {
|
||||
var input,
|
||||
that = this,
|
||||
wasOpen = false,
|
||||
select = this.element.hide(),
|
||||
selected = select.children( ":selected" ),
|
||||
value = selected.val() ? selected.text() : "",
|
||||
wrapper = this.wrapper = $( "<span>" )
|
||||
.addClass( "ui-combobox" )
|
||||
.insertAfter( select );
|
||||
|
||||
function removeIfInvalid( element ) {
|
||||
var value = $( element ).val(),
|
||||
matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
|
||||
valid = false;
|
||||
select.children( "option" ).each(function() {
|
||||
if ( $( this ).text().match( matcher ) ) {
|
||||
this.selected = valid = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ( !valid ) {
|
||||
// remove invalid value, as it didn't match anything
|
||||
$( element )
|
||||
.val( "" )
|
||||
.attr( "title", value + " didn't match any item" )
|
||||
.tooltip( "open" );
|
||||
select.val( "" );
|
||||
setTimeout(function() {
|
||||
input.tooltip( "close" ).attr( "title", "" );
|
||||
}, 2500 );
|
||||
input.data( "ui-autocomplete" ).term = "";
|
||||
}
|
||||
}
|
||||
|
||||
input = $( "<input>" )
|
||||
.appendTo( wrapper )
|
||||
.val( value )
|
||||
.attr( "title", "" )
|
||||
.addClass( "ui-state-default ui-combobox-input" )
|
||||
.autocomplete({
|
||||
delay: 0,
|
||||
minLength: 0,
|
||||
source: function( request, response ) {
|
||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
||||
response( select.children( "option" ).map(function() {
|
||||
var text = $( this ).text();
|
||||
if ( this.value && ( !request.term || matcher.test(text) ) )
|
||||
return {
|
||||
label: text.replace(
|
||||
new RegExp(
|
||||
"(?![^&;]+;)(?!<[^<>]*)(" +
|
||||
$.ui.autocomplete.escapeRegex(request.term) +
|
||||
")(?![^<>]*>)(?![^&;]+;)", "gi"
|
||||
), "<strong>$1</strong>" ),
|
||||
value: text,
|
||||
option: this
|
||||
};
|
||||
}) );
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
ui.item.option.selected = true;
|
||||
that._trigger( "selected", event, {
|
||||
item: ui.item.option
|
||||
});
|
||||
},
|
||||
change: function( event, ui ) {
|
||||
if ( !ui.item ) {
|
||||
removeIfInvalid( this );
|
||||
}
|
||||
}
|
||||
})
|
||||
.addClass( "ui-widget ui-widget-content ui-corner-left" );
|
||||
|
||||
input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
|
||||
return $( "<li>" )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
|
||||
$( "<a>" )
|
||||
.attr( "tabIndex", -1 )
|
||||
.attr( "title", "Show All Items" )
|
||||
.tooltip()
|
||||
.appendTo( wrapper )
|
||||
.button({
|
||||
icons: {
|
||||
primary: "ui-icon-triangle-1-s"
|
||||
},
|
||||
text: false
|
||||
})
|
||||
.removeClass( "ui-corner-all" )
|
||||
.addClass( "ui-corner-right ui-combobox-toggle" )
|
||||
.mousedown(function() {
|
||||
wasOpen = input.autocomplete( "widget" ).is( ":visible" );
|
||||
})
|
||||
.click(function() {
|
||||
input.focus();
|
||||
|
||||
// close if already visible
|
||||
if ( wasOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// pass empty string as value to search for, displaying all results
|
||||
input.autocomplete( "search", "" );
|
||||
});
|
||||
|
||||
input.tooltip({
|
||||
tooltipClass: "ui-state-highlight"
|
||||
});
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.wrapper.remove();
|
||||
this.element.show();
|
||||
}
|
||||
});
|
||||
})( jQuery );
|
||||
|
||||
$(function() {
|
||||
$( "#combobox" ).combobox();
|
||||
$( "#toggle" ).click(function() {
|
||||
$( "#combobox" ).toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="ui-widget">
|
||||
<label>Your preferred programming language: </label>
|
||||
<select id="combobox">
|
||||
<option value="">Select one...</option>
|
||||
<option value="ActionScript">ActionScript</option>
|
||||
<option value="AppleScript">AppleScript</option>
|
||||
<option value="Asp">Asp</option>
|
||||
<option value="BASIC">BASIC</option>
|
||||
<option value="C">C</option>
|
||||
<option value="C++">C++</option>
|
||||
<option value="Clojure">Clojure</option>
|
||||
<option value="COBOL">COBOL</option>
|
||||
<option value="ColdFusion">ColdFusion</option>
|
||||
<option value="Erlang">Erlang</option>
|
||||
<option value="Fortran">Fortran</option>
|
||||
<option value="Groovy">Groovy</option>
|
||||
<option value="Haskell">Haskell</option>
|
||||
<option value="Java">Java</option>
|
||||
<option value="JavaScript">JavaScript</option>
|
||||
<option value="Lisp">Lisp</option>
|
||||
<option value="Perl">Perl</option>
|
||||
<option value="PHP">PHP</option>
|
||||
<option value="Python">Python</option>
|
||||
<option value="Ruby">Ruby</option>
|
||||
<option value="Scala">Scala</option>
|
||||
<option value="Scheme">Scheme</option>
|
||||
</select>
|
||||
</div>
|
||||
<button id="toggle">Show underlying select</button>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>A custom widget built by composition of Autocomplete and Button. You can either type something into the field to get filtered suggestions based on your input, or use the button to get the full list of selections.</p>
|
||||
<p>The input is read from an existing select-element for progressive enhancement, passed to Autocomplete with a customized source-option.</p>
|
||||
<p>This is not a supported or even complete widget. Its purely for demoing what autocomplete can do with a bit of customization. <a href="http://www.learningjquery.com/2010/06/a-jquery-ui-combobox-under-the-hood">For a detailed explanation of how the widget works, check out this Learning jQuery article.</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
90
media/libs/jquery/demos/autocomplete/custom-data.html
Executable file
@@ -0,0 +1,90 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Autocomplete - Custom data and display</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.position.js"></script>
|
||||
<script src="../../ui/jquery.ui.menu.js"></script>
|
||||
<script src="../../ui/jquery.ui.autocomplete.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<style>
|
||||
#project-label {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#project-icon {
|
||||
float: left;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
}
|
||||
#project-description {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
var projects = [
|
||||
{
|
||||
value: "jquery",
|
||||
label: "jQuery",
|
||||
desc: "the write less, do more, JavaScript library",
|
||||
icon: "jquery_32x32.png"
|
||||
},
|
||||
{
|
||||
value: "jquery-ui",
|
||||
label: "jQuery UI",
|
||||
desc: "the official user interface library for jQuery",
|
||||
icon: "jqueryui_32x32.png"
|
||||
},
|
||||
{
|
||||
value: "sizzlejs",
|
||||
label: "Sizzle JS",
|
||||
desc: "a pure-JavaScript CSS selector engine",
|
||||
icon: "sizzlejs_32x32.png"
|
||||
}
|
||||
];
|
||||
|
||||
$( "#project" ).autocomplete({
|
||||
minLength: 0,
|
||||
source: projects,
|
||||
focus: function( event, ui ) {
|
||||
$( "#project" ).val( ui.item.label );
|
||||
return false;
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$( "#project" ).val( ui.item.label );
|
||||
$( "#project-id" ).val( ui.item.value );
|
||||
$( "#project-description" ).html( ui.item.desc );
|
||||
$( "#project-icon" ).attr( "src", "images/" + ui.item.icon );
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||
return $( "<li>" )
|
||||
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="project-label">Select a project (type "j" for a start):</div>
|
||||
<img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default" alt="">
|
||||
<input id="project">
|
||||
<input type="hidden" id="project-id">
|
||||
<p id="project-description"></p>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>You can use your own custom data formats and displays by simply overriding the default focus and select actions.</p>
|
||||
<p>Try typing "j" to get a list of projects or just press the down arrow.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
58
media/libs/jquery/demos/autocomplete/default.html
Executable file
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Autocomplete - Default functionality</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.position.js"></script>
|
||||
<script src="../../ui/jquery.ui.menu.js"></script>
|
||||
<script src="../../ui/jquery.ui.autocomplete.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
var availableTags = [
|
||||
"ActionScript",
|
||||
"AppleScript",
|
||||
"Asp",
|
||||
"BASIC",
|
||||
"C",
|
||||
"C++",
|
||||
"Clojure",
|
||||
"COBOL",
|
||||
"ColdFusion",
|
||||
"Erlang",
|
||||
"Fortran",
|
||||
"Groovy",
|
||||
"Haskell",
|
||||
"Java",
|
||||
"JavaScript",
|
||||
"Lisp",
|
||||
"Perl",
|
||||
"PHP",
|
||||
"Python",
|
||||
"Ruby",
|
||||
"Scala",
|
||||
"Scheme"
|
||||
];
|
||||
$( "#tags" ).autocomplete({
|
||||
source: availableTags
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="ui-widget">
|
||||
<label for="tags">Tags: </label>
|
||||
<input id="tags">
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
|
||||
<p>The datasource is a simple JavaScript array, provided to the widget using the source-option.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
56
media/libs/jquery/demos/autocomplete/folding.html
Executable file
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Autocomplete - Accent folding</title>
|
||||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||
<script src="../../jquery-1.9.0.js"></script>
|
||||
<script src="../../ui/jquery.ui.core.js"></script>
|
||||
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||
<script src="../../ui/jquery.ui.position.js"></script>
|
||||
<script src="../../ui/jquery.ui.menu.js"></script>
|
||||
<script src="../../ui/jquery.ui.autocomplete.js"></script>
|
||||
<link rel="stylesheet" href="../demos.css">
|
||||
<script>
|
||||
$(function() {
|
||||
var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
|
||||
|
||||
var accentMap = {
|
||||
"á": "a",
|
||||
"ö": "o"
|
||||
};
|
||||
var normalize = function( term ) {
|
||||
var ret = "";
|
||||
for ( var i = 0; i < term.length; i++ ) {
|
||||
ret += accentMap[ term.charAt(i) ] || term.charAt(i);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
$( "#developer" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
||||
response( $.grep( names, function( value ) {
|
||||
value = value.label || value.value || value;
|
||||
return matcher.test( value ) || matcher.test( normalize( value ) );
|
||||
}) );
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="ui-widget">
|
||||
<form>
|
||||
<label for="developer">Developer: </label>
|
||||
<input id="developer">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="demo-description">
|
||||
<p>The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented.</p>
|
||||
<p>Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
media/libs/jquery/demos/autocomplete/images/jquery_32x32.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
media/libs/jquery/demos/autocomplete/images/jqueryui_32x32.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |