new pisilinux web sites
This commit is contained in:
@@ -0,0 +1,540 @@
|
||||
/* =========================================================
|
||||
* bootstrap-colorpicker.js
|
||||
* http://www.eyecon.ro/bootstrap-colorpicker
|
||||
* =========================================================
|
||||
* Copyright 2012 Stefan Petre
|
||||
*
|
||||
* 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( $ ) {
|
||||
|
||||
// Color object
|
||||
|
||||
var Color = function(val) {
|
||||
this.value = {
|
||||
h: 1,
|
||||
s: 1,
|
||||
b: 1,
|
||||
a: 1
|
||||
};
|
||||
this.setColor(val);
|
||||
};
|
||||
|
||||
Color.prototype = {
|
||||
constructor: Color,
|
||||
|
||||
//parse a string to HSB
|
||||
setColor: function(val){
|
||||
val = val.toLowerCase();
|
||||
var that = this;
|
||||
$.each( CPGlobal.stringParsers, function( i, parser ) {
|
||||
var match = parser.re.exec( val ),
|
||||
values = match && parser.parse( match ),
|
||||
space = parser.space||'rgba';
|
||||
if ( values ) {
|
||||
if (space === 'hsla') {
|
||||
that.value = CPGlobal.RGBtoHSB.apply(null, CPGlobal.HSLtoRGB.apply(null, values));
|
||||
} else {
|
||||
that.value = CPGlobal.RGBtoHSB.apply(null, values);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setHue: function(h) {
|
||||
this.value.h = 1- h;
|
||||
},
|
||||
|
||||
setSaturation: function(s) {
|
||||
this.value.s = s;
|
||||
},
|
||||
|
||||
setLightness: function(b) {
|
||||
this.value.b = 1- b;
|
||||
},
|
||||
|
||||
setAlpha: function(a) {
|
||||
this.value.a = parseInt((1 - a)*100, 10)/100;
|
||||
},
|
||||
|
||||
// HSBtoRGB from RaphaelJS
|
||||
// https://github.com/DmitryBaranovskiy/raphael/
|
||||
toRGB: function(h, s, b, a) {
|
||||
if (!h) {
|
||||
h = this.value.h;
|
||||
s = this.value.s;
|
||||
b = this.value.b;
|
||||
}
|
||||
h *= 360;
|
||||
var R, G, B, X, C;
|
||||
h = (h % 360) / 60;
|
||||
C = b * s;
|
||||
X = C * (1 - Math.abs(h % 2 - 1));
|
||||
R = G = B = b - C;
|
||||
|
||||
h = ~~h;
|
||||
R += [C, X, 0, 0, X, C][h];
|
||||
G += [X, C, C, X, 0, 0][h];
|
||||
B += [0, 0, X, C, C, X][h];
|
||||
return {
|
||||
r: Math.round(R*255),
|
||||
g: Math.round(G*255),
|
||||
b: Math.round(B*255),
|
||||
a: a||this.value.a
|
||||
};
|
||||
},
|
||||
|
||||
toHex: function(h, s, b, a){
|
||||
var rgb = this.toRGB(h, s, b, a);
|
||||
return '#'+((1 << 24) | (parseInt(rgb.r) << 16) | (parseInt(rgb.g) << 8) | parseInt(rgb.b)).toString(16).substr(1);
|
||||
},
|
||||
|
||||
toHSL: function(h, s, b, a){
|
||||
if (!h) {
|
||||
h = this.value.h;
|
||||
s = this.value.s;
|
||||
b = this.value.b;
|
||||
}
|
||||
var H = h,
|
||||
L = (2 - s) * b,
|
||||
S = s * b;
|
||||
if (L > 0 && L <= 1) {
|
||||
S /= L;
|
||||
} else {
|
||||
S /= 2 - L;
|
||||
}
|
||||
L /= 2;
|
||||
if (S > 1) {
|
||||
S = 1;
|
||||
}
|
||||
return {
|
||||
h: H,
|
||||
s: S,
|
||||
l: L,
|
||||
a: a||this.value.a
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Picker object
|
||||
|
||||
var Colorpicker = function(element, options){
|
||||
this.element = $(element);
|
||||
var format = options.format||this.element.data('color-format')||'hex';
|
||||
this.format = CPGlobal.translateFormats[format];
|
||||
this.isInput = this.element.is('input');
|
||||
this.component = this.element.is('.color') ? this.element.find('.add-on') : false;
|
||||
|
||||
this.picker = $(CPGlobal.template)
|
||||
.appendTo('body')
|
||||
.on('mousedown', $.proxy(this.mousedown, this));
|
||||
|
||||
if (this.isInput) {
|
||||
this.element.on({
|
||||
'focus': $.proxy(this.show, this),
|
||||
'keyup': $.proxy(this.update, this)
|
||||
});
|
||||
} else if (this.component){
|
||||
this.component.on({
|
||||
'click': $.proxy(this.show, this)
|
||||
});
|
||||
} else {
|
||||
this.element.on({
|
||||
'click': $.proxy(this.show, this)
|
||||
});
|
||||
}
|
||||
if (format === 'rgba' || format === 'hsla') {
|
||||
this.picker.addClass('alpha');
|
||||
this.alpha = this.picker.find('.colorpicker-alpha')[0].style;
|
||||
}
|
||||
|
||||
if (this.component){
|
||||
this.picker.find('.colorpicker-color').hide();
|
||||
this.preview = this.element.find('i')[0].style;
|
||||
} else {
|
||||
this.preview = this.picker.find('div:last')[0].style;
|
||||
}
|
||||
|
||||
this.base = this.picker.find('div:first')[0].style;
|
||||
this.update();
|
||||
};
|
||||
|
||||
Colorpicker.prototype = {
|
||||
constructor: Colorpicker,
|
||||
|
||||
show: function(e) {
|
||||
this.picker.show();
|
||||
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
||||
this.place();
|
||||
$(window).on('resize', $.proxy(this.place, this));
|
||||
if (!this.isInput) {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
$(document).on({
|
||||
'mousedown': $.proxy(this.hide, this)
|
||||
});
|
||||
this.element.trigger({
|
||||
type: 'show',
|
||||
color: this.color
|
||||
});
|
||||
},
|
||||
|
||||
update: function(){
|
||||
this.color = new Color(this.isInput ? this.element.prop('value') : this.element.data('color'));
|
||||
this.picker.find('i')
|
||||
.eq(0).css({left: this.color.value.s*100, top: 100 - this.color.value.b*100}).end()
|
||||
.eq(1).css('top', 100 * (1 - this.color.value.h)).end()
|
||||
.eq(2).css('top', 100 * (1 - this.color.value.a));
|
||||
this.previewColor();
|
||||
},
|
||||
|
||||
setValue: function(newColor) {
|
||||
this.color = new Color(newColor);
|
||||
this.picker.find('i')
|
||||
.eq(0).css({left: this.color.value.s*100, top: 100 - this.color.value.b*100}).end()
|
||||
.eq(1).css('top', 100 * (1 - this.color.value.h)).end()
|
||||
.eq(2).css('top', 100 * (1 - this.color.value.a));
|
||||
this.previewColor();
|
||||
this.element.trigger({
|
||||
type: 'changeColor',
|
||||
color: this.color
|
||||
});
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.picker.hide();
|
||||
$(window).off('resize', this.place);
|
||||
if (!this.isInput) {
|
||||
$(document).off({
|
||||
'mousedown': this.hide
|
||||
});
|
||||
if (this.component){
|
||||
this.element.find('input').prop('value', this.format.call(this));
|
||||
}
|
||||
this.element.data('color', this.format.call(this));
|
||||
} else {
|
||||
this.element.prop('value', this.format.call(this));
|
||||
}
|
||||
this.element.trigger({
|
||||
type: 'hide',
|
||||
color: this.color
|
||||
});
|
||||
},
|
||||
|
||||
place: function(){
|
||||
var offset = this.component ? this.component.offset() : this.element.offset();
|
||||
this.picker.css({
|
||||
top: offset.top + this.height,
|
||||
left: offset.left
|
||||
});
|
||||
},
|
||||
|
||||
//preview color change
|
||||
previewColor: function(){
|
||||
try {
|
||||
this.preview.backgroundColor = this.format.call(this);
|
||||
} catch(e) {
|
||||
this.preview.backgroundColor = this.color.toHex();
|
||||
}
|
||||
//set the color for brightness/saturation slider
|
||||
this.base.backgroundColor = this.color.toHex(this.color.value.h, 1, 1, 1);
|
||||
//set te color for alpha slider
|
||||
if (this.alpha) {
|
||||
this.alpha.backgroundColor = this.color.toHex();
|
||||
}
|
||||
},
|
||||
|
||||
pointer: null,
|
||||
|
||||
slider: null,
|
||||
|
||||
mousedown: function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
var target = $(e.target);
|
||||
|
||||
//detect the slider and set the limits and callbacks
|
||||
var zone = target.closest('div');
|
||||
if (!zone.is('.colorpicker')) {
|
||||
if (zone.is('.colorpicker-saturation')) {
|
||||
this.slider = $.extend({}, CPGlobal.sliders.saturation);
|
||||
}
|
||||
else if (zone.is('.colorpicker-hue')) {
|
||||
this.slider = $.extend({}, CPGlobal.sliders.hue);
|
||||
}
|
||||
else if (zone.is('.colorpicker-alpha')) {
|
||||
this.slider = $.extend({}, CPGlobal.sliders.alpha);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
var offset = zone.offset();
|
||||
//reference to knob's style
|
||||
this.slider.knob = zone.find('i')[0].style;
|
||||
this.slider.left = e.pageX - offset.left;
|
||||
this.slider.top = e.pageY - offset.top;
|
||||
this.pointer = {
|
||||
left: e.pageX,
|
||||
top: e.pageY
|
||||
};
|
||||
//trigger mousemove to move the knob to the current position
|
||||
$(document).on({
|
||||
mousemove: $.proxy(this.mousemove, this),
|
||||
mouseup: $.proxy(this.mouseup, this)
|
||||
}).trigger('mousemove');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
mousemove: function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var left = Math.max(
|
||||
0,
|
||||
Math.min(
|
||||
this.slider.maxLeft,
|
||||
this.slider.left + ((e.pageX||this.pointer.left) - this.pointer.left)
|
||||
)
|
||||
);
|
||||
var top = Math.max(
|
||||
0,
|
||||
Math.min(
|
||||
this.slider.maxTop,
|
||||
this.slider.top + ((e.pageY||this.pointer.top) - this.pointer.top)
|
||||
)
|
||||
);
|
||||
this.slider.knob.left = left + 'px';
|
||||
this.slider.knob.top = top + 'px';
|
||||
if (this.slider.callLeft) {
|
||||
this.color[this.slider.callLeft].call(this.color, left/100);
|
||||
}
|
||||
if (this.slider.callTop) {
|
||||
this.color[this.slider.callTop].call(this.color, top/100);
|
||||
}
|
||||
this.previewColor();
|
||||
this.element.trigger({
|
||||
type: 'changeColor',
|
||||
color: this.color
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
mouseup: function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$(document).off({
|
||||
mousemove: this.mousemove,
|
||||
mouseup: this.mouseup
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.colorpicker = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('colorpicker'),
|
||||
options = typeof option === 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('colorpicker', (data = new Colorpicker(this, $.extend({}, $.fn.colorpicker.defaults,options))));
|
||||
}
|
||||
if (typeof option === 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.colorpicker.defaults = {
|
||||
};
|
||||
|
||||
$.fn.colorpicker.Constructor = Colorpicker;
|
||||
|
||||
var CPGlobal = {
|
||||
|
||||
// translate a format from Color object to a string
|
||||
translateFormats: {
|
||||
'rgb': function(){
|
||||
var rgb = this.color.toRGB();
|
||||
return 'rgb('+rgb.r+','+rgb.g+','+rgb.b+')';
|
||||
},
|
||||
|
||||
'rgba': function(){
|
||||
var rgb = this.color.toRGB();
|
||||
return 'rgba('+rgb.r+','+rgb.g+','+rgb.b+','+rgb.a+')';
|
||||
},
|
||||
|
||||
'hsl': function(){
|
||||
var hsl = this.color.toHSL();
|
||||
return 'hsl('+Math.round(hsl.h*360)+','+Math.round(hsl.s*100)+'%,'+Math.round(hsl.l*100)+'%)';
|
||||
},
|
||||
|
||||
'hsla': function(){
|
||||
var hsl = this.color.toHSL();
|
||||
return 'hsla('+Math.round(hsl.h*360)+','+Math.round(hsl.s*100)+'%,'+Math.round(hsl.l*100)+'%,'+hsl.a+')';
|
||||
},
|
||||
|
||||
'hex': function(){
|
||||
return this.color.toHex();
|
||||
}
|
||||
},
|
||||
|
||||
sliders: {
|
||||
saturation: {
|
||||
maxLeft: 100,
|
||||
maxTop: 100,
|
||||
callLeft: 'setSaturation',
|
||||
callTop: 'setLightness'
|
||||
},
|
||||
|
||||
hue: {
|
||||
maxLeft: 0,
|
||||
maxTop: 100,
|
||||
callLeft: false,
|
||||
callTop: 'setHue'
|
||||
},
|
||||
|
||||
alpha: {
|
||||
maxLeft: 0,
|
||||
maxTop: 100,
|
||||
callLeft: false,
|
||||
callTop: 'setAlpha'
|
||||
}
|
||||
},
|
||||
|
||||
// HSBtoRGB from RaphaelJS
|
||||
// https://github.com/DmitryBaranovskiy/raphael/
|
||||
RGBtoHSB: function (r, g, b, a){
|
||||
r /= 255;
|
||||
g /= 255;
|
||||
b /= 255;
|
||||
|
||||
var H, S, V, C;
|
||||
V = Math.max(r, g, b);
|
||||
C = V - Math.min(r, g, b);
|
||||
H = (C === 0 ? null :
|
||||
V == r ? (g - b) / C :
|
||||
V == g ? (b - r) / C + 2 :
|
||||
(r - g) / C + 4
|
||||
);
|
||||
H = ((H + 360) % 6) * 60 / 360;
|
||||
S = C === 0 ? 0 : C / V;
|
||||
return {h: H||1, s: S, b: V, a: a||1};
|
||||
},
|
||||
|
||||
HueToRGB: function (p, q, h) {
|
||||
if (h < 0)
|
||||
h += 1;
|
||||
else if (h > 1)
|
||||
h -= 1;
|
||||
|
||||
if ((h * 6) < 1)
|
||||
return p + (q - p) * h * 6;
|
||||
else if ((h * 2) < 1)
|
||||
return q;
|
||||
else if ((h * 3) < 2)
|
||||
return p + (q - p) * ((2 / 3) - h) * 6;
|
||||
else
|
||||
return p;
|
||||
},
|
||||
|
||||
HSLtoRGB: function (h, s, l, a)
|
||||
{
|
||||
if (s < 0) {
|
||||
s = 0;
|
||||
}
|
||||
var q;
|
||||
if (l <= 0.5) {
|
||||
q = l * (1 + s);
|
||||
} else {
|
||||
q = l + s - (l * s);
|
||||
}
|
||||
|
||||
var p = 2 * l - q;
|
||||
|
||||
var tr = h + (1 / 3);
|
||||
var tg = h;
|
||||
var tb = h - (1 / 3);
|
||||
|
||||
var r = Math.round(CPGlobal.HueToRGB(p, q, tr) * 255);
|
||||
var g = Math.round(CPGlobal.HueToRGB(p, q, tg) * 255);
|
||||
var b = Math.round(CPGlobal.HueToRGB(p, q, tb) * 255);
|
||||
return [r, g, b, a||1];
|
||||
},
|
||||
|
||||
// a set of RE's that can match strings and generate color tuples.
|
||||
// from John Resig color plugin
|
||||
// https://github.com/jquery/jquery-color/
|
||||
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 [
|
||||
2.55 * execResult[1],
|
||||
2.55 * execResult[2],
|
||||
2.55 * execResult[3],
|
||||
execResult[ 4 ]
|
||||
];
|
||||
}
|
||||
}, {
|
||||
re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
parseInt( execResult[ 1 ], 16 ),
|
||||
parseInt( execResult[ 2 ], 16 ),
|
||||
parseInt( execResult[ 3 ], 16 )
|
||||
];
|
||||
}
|
||||
}, {
|
||||
re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-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]/360,
|
||||
execResult[2] / 100,
|
||||
execResult[3] / 100,
|
||||
execResult[4]
|
||||
];
|
||||
}
|
||||
}
|
||||
],
|
||||
template: '<div class="colorpicker dropdown-menu">'+
|
||||
'<div class="colorpicker-saturation"><i><b></b></i></div>'+
|
||||
'<div class="colorpicker-hue"><i></i></div>'+
|
||||
'<div class="colorpicker-alpha"><i></i></div>'+
|
||||
'<div class="colorpicker-color"><div /></div>'+
|
||||
'</div>'
|
||||
};
|
||||
|
||||
}( window.jQuery )
|
||||
@@ -0,0 +1,454 @@
|
||||
/* =========================================================
|
||||
* bootstrap-datepicker.js
|
||||
* http://www.eyecon.ro/bootstrap-datepicker
|
||||
* =========================================================
|
||||
* Copyright 2012 Stefan Petre
|
||||
*
|
||||
* 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 Datepicker = function(element, options){
|
||||
this.element = $(element);
|
||||
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
|
||||
this.picker = $(DPGlobal.template)
|
||||
.appendTo('body')
|
||||
.on({
|
||||
click: $.proxy(this.click, this),
|
||||
mousedown: $.proxy(this.mousedown, this)
|
||||
});
|
||||
this.isInput = this.element.is('input');
|
||||
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
|
||||
|
||||
if (this.isInput) {
|
||||
this.element.on({
|
||||
focus: $.proxy(this.show, this),
|
||||
blur: $.proxy(this.hide, this),
|
||||
keyup: $.proxy(this.update, this)
|
||||
});
|
||||
} else {
|
||||
if (this.component){
|
||||
this.component.on('click', $.proxy(this.show, this));
|
||||
} else {
|
||||
this.element.on('click', $.proxy(this.show, this));
|
||||
}
|
||||
}
|
||||
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();
|
||||
};
|
||||
|
||||
Datepicker.prototype = {
|
||||
constructor: Datepicker,
|
||||
|
||||
show: function(e) {
|
||||
this.picker.show();
|
||||
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
||||
this.place();
|
||||
$(window).on('resize', $.proxy(this.place, this));
|
||||
if (e ) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!this.isInput) {
|
||||
$(document).on('mousedown', $.proxy(this.hide, this));
|
||||
}
|
||||
this.element.trigger({
|
||||
type: 'show',
|
||||
date: this.date
|
||||
});
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.picker.hide();
|
||||
$(window).off('resize', this.place);
|
||||
this.viewMode = this.startViewMode;
|
||||
this.showMode();
|
||||
if (!this.isInput) {
|
||||
$(document).off('mousedown', this.hide);
|
||||
}
|
||||
this.set();
|
||||
this.element.trigger({
|
||||
type: 'hide',
|
||||
date: this.date
|
||||
});
|
||||
},
|
||||
|
||||
set: function() {
|
||||
var formated = DPGlobal.formatDate(this.date, this.format);
|
||||
if (!this.isInput) {
|
||||
if (this.component){
|
||||
this.element.find('input').prop('value', formated);
|
||||
}
|
||||
this.element.data('date', formated);
|
||||
} else {
|
||||
this.element.prop('value', formated);
|
||||
}
|
||||
},
|
||||
|
||||
setValue: function(newDate) {
|
||||
if (typeof newDate === 'string') {
|
||||
this.date = DPGlobal.parseDate(newDate, this.format);
|
||||
} else {
|
||||
this.date = new Date(newDate);
|
||||
}
|
||||
this.set();
|
||||
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
this.fill();
|
||||
},
|
||||
|
||||
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){
|
||||
this.date = DPGlobal.parseDate(
|
||||
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
|
||||
this.format
|
||||
);
|
||||
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
this.fill();
|
||||
},
|
||||
|
||||
fillDow: function(){
|
||||
var dowCnt = this.weekStart;
|
||||
var html = '<tr>';
|
||||
while (dowCnt < this.weekStart + 7) {
|
||||
html += '<th class="dow">'+DPGlobal.dates.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">'+DPGlobal.dates.monthsShort[i++]+'</span>';
|
||||
}
|
||||
this.picker.find('.datepicker-months td').append(html);
|
||||
},
|
||||
|
||||
fill: function() {
|
||||
var d = new Date(this.viewDate),
|
||||
year = d.getFullYear(),
|
||||
month = d.getMonth(),
|
||||
currentDate = this.date.valueOf();
|
||||
this.picker.find('.datepicker-days th:eq(1)')
|
||||
.text(DPGlobal.dates.months[month]+' '+year);
|
||||
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
|
||||
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
|
||||
prevMonth.setDate(day);
|
||||
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
|
||||
var nextMonth = new Date(prevMonth);
|
||||
nextMonth.setDate(nextMonth.getDate() + 42);
|
||||
nextMonth = nextMonth.valueOf();
|
||||
html = [];
|
||||
var clsName;
|
||||
while(prevMonth.valueOf() < nextMonth) {
|
||||
if (prevMonth.getDay() === this.weekStart) {
|
||||
html.push('<tr>');
|
||||
}
|
||||
clsName = '';
|
||||
if (prevMonth.getMonth() < month) {
|
||||
clsName += ' old';
|
||||
} else if (prevMonth.getMonth() > month) {
|
||||
clsName += ' new';
|
||||
}
|
||||
if (prevMonth.valueOf() === currentDate) {
|
||||
clsName += ' active';
|
||||
}
|
||||
html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
|
||||
if (prevMonth.getDay() === this.weekEnd) {
|
||||
html.push('</tr>');
|
||||
}
|
||||
prevMonth.setDate(prevMonth.getDate()+1);
|
||||
}
|
||||
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
|
||||
var currentYear = this.date.getFullYear();
|
||||
|
||||
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.getMonth()).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);
|
||||
},
|
||||
|
||||
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.fill();
|
||||
this.set();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'span':
|
||||
if (target.is('.month')) {
|
||||
var month = target.parent().find('span').index(target);
|
||||
this.viewDate.setMonth(month);
|
||||
} else {
|
||||
var year = parseInt(target.text(), 10)||0;
|
||||
this.viewDate.setFullYear(year);
|
||||
}
|
||||
if (this.viewMode !== 0) {
|
||||
this.date = new Date(this.viewDate);
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date,
|
||||
viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
});
|
||||
}
|
||||
this.showMode(-1);
|
||||
this.fill();
|
||||
this.set();
|
||||
break;
|
||||
case 'td':
|
||||
if (target.is('.day')){
|
||||
var day = parseInt(target.text(), 10)||1;
|
||||
var month = this.viewDate.getMonth();
|
||||
if (target.is('.old')) {
|
||||
month -= 1;
|
||||
} else if (target.is('.new')) {
|
||||
month += 1;
|
||||
}
|
||||
var year = this.viewDate.getFullYear();
|
||||
this.date = new Date(year, month, day,0,0,0,0);
|
||||
this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
|
||||
this.fill();
|
||||
this.set();
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date,
|
||||
viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
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('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.datepicker = function ( option, val ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('datepicker'),
|
||||
options = typeof option === 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
|
||||
}
|
||||
if (typeof option === 'string') data[option](val);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.datepicker.defaults = {
|
||||
};
|
||||
$.fn.datepicker.Constructor = Datepicker;
|
||||
|
||||
var DPGlobal = {
|
||||
modes: [
|
||||
{
|
||||
clsName: 'days',
|
||||
navFnc: 'Month',
|
||||
navStep: 1
|
||||
},
|
||||
{
|
||||
clsName: 'months',
|
||||
navFnc: 'FullYear',
|
||||
navStep: 1
|
||||
},
|
||||
{
|
||||
clsName: 'years',
|
||||
navFnc: 'FullYear',
|
||||
navStep: 10
|
||||
}],
|
||||
dates:{
|
||||
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"]
|
||||
},
|
||||
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]
|
||||
},
|
||||
parseFormat: function(format){
|
||||
var separator = format.match(/[.\/\-\s].*?/),
|
||||
parts = format.split(/\W+/);
|
||||
if (!separator || !parts || parts.length === 0){
|
||||
throw new Error("Invalid date format.");
|
||||
}
|
||||
return {separator: separator, parts: parts};
|
||||
},
|
||||
parseDate: function(date, format) {
|
||||
var parts = date.split(format.separator),
|
||||
date = new Date(),
|
||||
val;
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
date.setSeconds(0);
|
||||
date.setMilliseconds(0);
|
||||
if (parts.length === format.parts.length) {
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
val = parseInt(parts[i], 10)||1;
|
||||
switch(format.parts[i]) {
|
||||
case 'dd':
|
||||
case 'd':
|
||||
date.setDate(val);
|
||||
break;
|
||||
case 'mm':
|
||||
case 'm':
|
||||
date.setMonth(val - 1);
|
||||
break;
|
||||
case 'yy':
|
||||
date.setFullYear(2000 + val);
|
||||
break;
|
||||
case 'yyyy':
|
||||
date.setFullYear(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return date;
|
||||
},
|
||||
formatDate: function(date, format){
|
||||
var val = {
|
||||
d: date.getDate(),
|
||||
m: date.getMonth() + 1,
|
||||
yy: date.getFullYear().toString().substring(2),
|
||||
yyyy: date.getFullYear()
|
||||
};
|
||||
val.dd = (val.d < 10 ? '0' : '') + val.d;
|
||||
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
||||
var date = [];
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
date.push(val[format.parts[i]]);
|
||||
}
|
||||
return date.join(format.separator);
|
||||
},
|
||||
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 dropdown-menu">'+
|
||||
'<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>'+
|
||||
'</div>';
|
||||
|
||||
}( window.jQuery )
|
||||
@@ -0,0 +1,478 @@
|
||||
!function($, wysi) {
|
||||
"use strict";
|
||||
|
||||
var tpl = {
|
||||
"font-styles": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li class='dropdown'>" +
|
||||
"<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#'>" +
|
||||
"<i class='icon-font'></i> <span class='current-font'>" + locale.font_styles.normal + "</span> <b class='caret'></b>" +
|
||||
"</a>" +
|
||||
"<ul class='dropdown-menu'>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='div'>" + locale.font_styles.normal + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h1'>" + locale.font_styles.h1 + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h2'>" + locale.font_styles.h2 + "</a></li>" +
|
||||
"<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h3'>" + locale.font_styles.h3 + "</a></li>" +
|
||||
"</ul>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"emphasis": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='bold' title='CTRL+B'>" + locale.emphasis.bold + "</a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='italic' title='CTRL+I'>" + locale.emphasis.italic + "</a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='underline' title='CTRL+U'>" + locale.emphasis.underline + "</a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"lists": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertUnorderedList' title='" + locale.lists.unordered + "'><i class='icon-list'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertOrderedList' title='" + locale.lists.ordered + "'><i class='icon-th-list'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='Outdent' title='" + locale.lists.outdent + "'><i class='icon-indent-right'></i></a>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='Indent' title='" + locale.lists.indent + "'><i class='icon-indent-left'></i></a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"link": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='bootstrap-wysihtml5-insert-link-modal modal hide fade'>" +
|
||||
"<div class='modal-header'>" +
|
||||
"<a class='close' data-dismiss='modal'></a>" +
|
||||
"<h3>" + locale.link.insert + "</h3>" +
|
||||
"</div>" +
|
||||
"<div class='modal-body'>" +
|
||||
"<input value='http://' class='bootstrap-wysihtml5-insert-link-url m-wrap large' type='text'>" +
|
||||
"</div>" +
|
||||
"<div class='modal-footer'>" +
|
||||
"<a href='#' class='btn' data-dismiss='modal'>" + locale.link.cancel + "</a>" +
|
||||
"<a href='#' class='btn green btn-primary' data-dismiss='modal'>" + locale.link.insert + "</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='createLink' title='" + locale.link.insert + "'><i class='icon-share'></i></a>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"image": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='bootstrap-wysihtml5-insert-image-modal modal hide fade'>" +
|
||||
"<div class='modal-header'>" +
|
||||
"<a class='close' data-dismiss='modal'></a>" +
|
||||
"<h3>" + locale.image.insert + "</h3>" +
|
||||
"</div>" +
|
||||
"<div class='modal-body'>" +
|
||||
"<input value='http://' class='bootstrap-wysihtml5-insert-image-url m-wrap large' type='text'>" +
|
||||
"</div>" +
|
||||
"<div class='modal-footer'>" +
|
||||
"<a href='#' class='btn' data-dismiss='modal'>" + locale.image.cancel + "</a>" +
|
||||
"<a href='#' class='btn green btn-primary' data-dismiss='modal'>" + locale.image.insert + "</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-command='insertImage' title='" + locale.image.insert + "'><i class='icon-picture'></i></a>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"html": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li>" +
|
||||
"<div class='btn-group'>" +
|
||||
"<a class='btn" + size + "' data-wysihtml5-action='change_view' title='" + locale.html.edit + "'><i class='icon-pencil'></i></a>" +
|
||||
"</div>" +
|
||||
"</li>";
|
||||
},
|
||||
|
||||
"color": function(locale, options) {
|
||||
var size = (options && options.size) ? ' btn-'+options.size : '';
|
||||
return "<li class='dropdown'>" +
|
||||
"<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#'>" +
|
||||
"<span class='current-color'>" + locale.colours.black + "</span> <b class='caret'></b>" +
|
||||
"</a>" +
|
||||
"<ul class='dropdown-menu'>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='black'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='black'>" + locale.colours.black + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='silver'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='silver'>" + locale.colours.silver + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='gray'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='gray'>" + locale.colours.gray + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='maroon'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='maroon'>" + locale.colours.maroon + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='red'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='red'>" + locale.colours.red + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='purple'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='purple'>" + locale.colours.purple + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='green'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='green'>" + locale.colours.green + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='olive'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='olive'>" + locale.colours.olive + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='navy'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='navy'>" + locale.colours.navy + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='blue'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='blue'>" + locale.colours.blue + "</a></li>" +
|
||||
"<li><div class='wysihtml5-colors' data-wysihtml5-command-value='orange'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='orange'>" + locale.colours.orange + "</a></li>" +
|
||||
"</ul>" +
|
||||
"</li>";
|
||||
}
|
||||
};
|
||||
|
||||
var templates = function(key, locale, options) {
|
||||
return tpl[key](locale, options);
|
||||
};
|
||||
|
||||
|
||||
var Wysihtml5 = function(el, options) {
|
||||
this.el = el;
|
||||
var toolbarOpts = options || defaultOptions;
|
||||
for(var t in toolbarOpts.customTemplates) {
|
||||
tpl[t] = toolbarOpts.customTemplates[t];
|
||||
}
|
||||
this.toolbar = this.createToolbar(el, toolbarOpts);
|
||||
this.editor = this.createEditor(options);
|
||||
|
||||
window.editor = this.editor;
|
||||
|
||||
$('iframe.wysihtml5-sandbox').each(function(i, el){
|
||||
$(el.contentWindow).off('focus.wysihtml5').on({
|
||||
'focus.wysihtml5' : function(){
|
||||
$('li.dropdown').removeClass('open');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Wysihtml5.prototype = {
|
||||
|
||||
constructor: Wysihtml5,
|
||||
|
||||
createEditor: function(options) {
|
||||
options = options || {};
|
||||
options.toolbar = this.toolbar[0];
|
||||
|
||||
var editor = new wysi.Editor(this.el[0], options);
|
||||
|
||||
if(options && options.events) {
|
||||
for(var eventName in options.events) {
|
||||
editor.on(eventName, options.events[eventName]);
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
},
|
||||
|
||||
createToolbar: function(el, options) {
|
||||
var self = this;
|
||||
var toolbar = $("<ul/>", {
|
||||
'class' : "wysihtml5-toolbar",
|
||||
'style': "display:none"
|
||||
});
|
||||
var culture = options.locale || defaultOptions.locale || "en";
|
||||
for(var key in defaultOptions) {
|
||||
var value = false;
|
||||
|
||||
if(options[key] !== undefined) {
|
||||
if(options[key] === true) {
|
||||
value = true;
|
||||
}
|
||||
} else {
|
||||
value = defaultOptions[key];
|
||||
}
|
||||
|
||||
if(value === true) {
|
||||
toolbar.append(templates(key, locale[culture], options));
|
||||
|
||||
if(key === "html") {
|
||||
this.initHtml(toolbar);
|
||||
}
|
||||
|
||||
if(key === "link") {
|
||||
this.initInsertLink(toolbar);
|
||||
}
|
||||
|
||||
if(key === "image") {
|
||||
this.initInsertImage(toolbar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(options.toolbar) {
|
||||
for(key in options.toolbar) {
|
||||
toolbar.append(options.toolbar[key]);
|
||||
}
|
||||
}
|
||||
|
||||
toolbar.find("a[data-wysihtml5-command='formatBlock']").click(function(e) {
|
||||
var target = e.target || e.srcElement;
|
||||
var el = $(target);
|
||||
self.toolbar.find('.current-font').text(el.html());
|
||||
});
|
||||
|
||||
toolbar.find("a[data-wysihtml5-command='foreColor']").click(function(e) {
|
||||
var target = e.target || e.srcElement;
|
||||
var el = $(target);
|
||||
self.toolbar.find('.current-color').text(el.html());
|
||||
});
|
||||
|
||||
this.el.before(toolbar);
|
||||
|
||||
return toolbar;
|
||||
},
|
||||
|
||||
initHtml: function(toolbar) {
|
||||
var changeViewSelector = "a[data-wysihtml5-action='change_view']";
|
||||
toolbar.find(changeViewSelector).click(function(e) {
|
||||
toolbar.find('a.btn').not(changeViewSelector).toggleClass('disabled');
|
||||
});
|
||||
},
|
||||
|
||||
initInsertImage: function(toolbar) {
|
||||
var self = this;
|
||||
var insertImageModal = toolbar.find('.bootstrap-wysihtml5-insert-image-modal');
|
||||
var urlInput = insertImageModal.find('.bootstrap-wysihtml5-insert-image-url');
|
||||
var insertButton = insertImageModal.find('a.btn-primary');
|
||||
var initialValue = urlInput.val();
|
||||
|
||||
var insertImage = function() {
|
||||
var url = urlInput.val();
|
||||
urlInput.val(initialValue);
|
||||
self.editor.currentView.element.focus();
|
||||
self.editor.composer.commands.exec("insertImage", url);
|
||||
};
|
||||
|
||||
urlInput.keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
insertImage();
|
||||
insertImageModal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
insertButton.click(insertImage);
|
||||
|
||||
insertImageModal.on('shown', function() {
|
||||
urlInput.focus();
|
||||
});
|
||||
|
||||
insertImageModal.on('hide', function() {
|
||||
self.editor.currentView.element.focus();
|
||||
});
|
||||
|
||||
toolbar.find('a[data-wysihtml5-command=insertImage]').click(function() {
|
||||
var activeButton = $(this).hasClass("wysihtml5-command-active");
|
||||
|
||||
if (!activeButton) {
|
||||
insertImageModal.modal('show');
|
||||
insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initInsertLink: function(toolbar) {
|
||||
var self = this;
|
||||
var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
|
||||
var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
|
||||
var insertButton = insertLinkModal.find('a.btn-primary');
|
||||
var initialValue = urlInput.val();
|
||||
|
||||
var insertLink = function() {
|
||||
var url = urlInput.val();
|
||||
urlInput.val(initialValue);
|
||||
self.editor.currentView.element.focus();
|
||||
self.editor.composer.commands.exec("createLink", {
|
||||
href: url,
|
||||
target: "_blank",
|
||||
rel: "nofollow"
|
||||
});
|
||||
};
|
||||
var pressedEnter = false;
|
||||
|
||||
urlInput.keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
insertLink();
|
||||
insertLinkModal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
insertButton.click(insertLink);
|
||||
|
||||
insertLinkModal.on('shown', function() {
|
||||
urlInput.focus();
|
||||
});
|
||||
|
||||
insertLinkModal.on('hide', function() {
|
||||
self.editor.currentView.element.focus();
|
||||
});
|
||||
|
||||
toolbar.find('a[data-wysihtml5-command=createLink]').click(function() {
|
||||
var activeButton = $(this).hasClass("wysihtml5-command-active");
|
||||
|
||||
if (!activeButton) {
|
||||
insertLinkModal.appendTo('body').modal('show');
|
||||
insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// these define our public api
|
||||
var methods = {
|
||||
resetDefaults: function() {
|
||||
$.fn.wysihtml5.defaultOptions = $.extend(true, {}, $.fn.wysihtml5.defaultOptionsCache);
|
||||
},
|
||||
bypassDefaults: function(options) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
$this.data('wysihtml5', new Wysihtml5($this, options));
|
||||
});
|
||||
},
|
||||
shallowExtend: function (options) {
|
||||
var settings = $.extend({}, $.fn.wysihtml5.defaultOptions, options || {});
|
||||
var that = this;
|
||||
return methods.bypassDefaults.apply(that, [settings]);
|
||||
},
|
||||
deepExtend: function(options) {
|
||||
var settings = $.extend(true, {}, $.fn.wysihtml5.defaultOptions, options || {});
|
||||
var that = this;
|
||||
return methods.bypassDefaults.apply(that, [settings]);
|
||||
},
|
||||
init: function(options) {
|
||||
var that = this;
|
||||
return methods.shallowExtend.apply(that, [options]);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.wysihtml5 = function ( method ) {
|
||||
if ( methods[method] ) {
|
||||
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return methods.init.apply( this, arguments );
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.wysihtml5' );
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.wysihtml5.Constructor = Wysihtml5;
|
||||
|
||||
var defaultOptions = $.fn.wysihtml5.defaultOptions = {
|
||||
"font-styles": true,
|
||||
"color": false,
|
||||
"emphasis": true,
|
||||
"lists": true,
|
||||
"html": false,
|
||||
"link": true,
|
||||
"image": true,
|
||||
events: {},
|
||||
parserRules: {
|
||||
classes: {
|
||||
// (path_to_project/lib/css/wysiwyg-color.css)
|
||||
"wysiwyg-color-silver" : 1,
|
||||
"wysiwyg-color-gray" : 1,
|
||||
"wysiwyg-color-white" : 1,
|
||||
"wysiwyg-color-maroon" : 1,
|
||||
"wysiwyg-color-red" : 1,
|
||||
"wysiwyg-color-purple" : 1,
|
||||
"wysiwyg-color-fuchsia" : 1,
|
||||
"wysiwyg-color-green" : 1,
|
||||
"wysiwyg-color-lime" : 1,
|
||||
"wysiwyg-color-olive" : 1,
|
||||
"wysiwyg-color-yellow" : 1,
|
||||
"wysiwyg-color-navy" : 1,
|
||||
"wysiwyg-color-blue" : 1,
|
||||
"wysiwyg-color-teal" : 1,
|
||||
"wysiwyg-color-aqua" : 1,
|
||||
"wysiwyg-color-orange" : 1
|
||||
},
|
||||
tags: {
|
||||
"b": {},
|
||||
"i": {},
|
||||
"br": {},
|
||||
"ol": {},
|
||||
"ul": {},
|
||||
"li": {},
|
||||
"h1": {},
|
||||
"h2": {},
|
||||
"h3": {},
|
||||
"blockquote": {},
|
||||
"u": 1,
|
||||
"img": {
|
||||
"check_attributes": {
|
||||
"width": "numbers",
|
||||
"alt": "alt",
|
||||
"src": "url",
|
||||
"height": "numbers"
|
||||
}
|
||||
},
|
||||
"a": {
|
||||
set_attributes: {
|
||||
target: "_blank",
|
||||
rel: "nofollow"
|
||||
},
|
||||
check_attributes: {
|
||||
href: "url" // important to avoid XSS
|
||||
}
|
||||
},
|
||||
"span": 1,
|
||||
"div": 1
|
||||
}
|
||||
},
|
||||
stylesheets: ["./lib/css/wysiwyg-color.css"], // (path_to_project/lib/css/wysiwyg-color.css)
|
||||
locale: "en"
|
||||
};
|
||||
|
||||
if (typeof $.fn.wysihtml5.defaultOptionsCache === 'undefined') {
|
||||
$.fn.wysihtml5.defaultOptionsCache = $.extend(true, {}, $.fn.wysihtml5.defaultOptions);
|
||||
}
|
||||
|
||||
var locale = $.fn.wysihtml5.locale = {
|
||||
en: {
|
||||
font_styles: {
|
||||
normal: "Normal text",
|
||||
h1: "Heading 1",
|
||||
h2: "Heading 2",
|
||||
h3: "Heading 3"
|
||||
},
|
||||
emphasis: {
|
||||
bold: "Bold",
|
||||
italic: "Italic",
|
||||
underline: "Underline"
|
||||
},
|
||||
lists: {
|
||||
unordered: "Unordered list",
|
||||
ordered: "Ordered list",
|
||||
outdent: "Outdent",
|
||||
indent: "Indent"
|
||||
},
|
||||
link: {
|
||||
insert: "Insert link",
|
||||
cancel: "Cancel"
|
||||
},
|
||||
image: {
|
||||
insert: "Insert image",
|
||||
cancel: "Cancel"
|
||||
},
|
||||
html: {
|
||||
edit: "Edit HTML"
|
||||
},
|
||||
colours: {
|
||||
black: "Black",
|
||||
silver: "Silver",
|
||||
gray: "Grey",
|
||||
maroon: "Maroon",
|
||||
red: "Red",
|
||||
purple: "Purple",
|
||||
green: "Green",
|
||||
olive: "Olive",
|
||||
navy: "Navy",
|
||||
blue: "Blue",
|
||||
orange: "Orange"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}(window.jQuery, window.wysihtml5);
|
||||
+2268
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,71 @@
|
||||
/* Created by jankoatwarpspeed.com */
|
||||
|
||||
$.fn.formToWizard = function(options) {
|
||||
options = $.extend({
|
||||
submitButton: ""
|
||||
}, options);
|
||||
|
||||
var element = this;
|
||||
|
||||
var steps = $(element).find("fieldset");
|
||||
var count = steps.size();
|
||||
var submmitButtonName = "#" + options.submitButton;
|
||||
$(submmitButtonName).hide();
|
||||
|
||||
// 2
|
||||
$(element).before("<ul id='steps'></ul>");
|
||||
|
||||
steps.each(function(i) {
|
||||
$(this).wrap("<div id='step" + i + "'></div>");
|
||||
$(this).append("<p id='step" + i + "commands'></p>");
|
||||
|
||||
// 2
|
||||
var name = $(this).find("legend").html();
|
||||
$("#steps").append("<li id='stepDesc" + i + "'>Adım " + (i + 1) + "<span>" + name + "</span></li>");
|
||||
|
||||
if (i == 0) {
|
||||
createNextButton(i);
|
||||
selectStep(i);
|
||||
}
|
||||
else if (i == count - 1) {
|
||||
$("#step" + i).hide();
|
||||
createPrevButton(i);
|
||||
}
|
||||
else {
|
||||
$("#step" + i).hide();
|
||||
createPrevButton(i);
|
||||
createNextButton(i);
|
||||
}
|
||||
});
|
||||
|
||||
function createPrevButton(i) {
|
||||
var stepName = "step" + i;
|
||||
$("#" + stepName + "commands").append("<button type='button' id='" + stepName + "Prev' class='prev btn btn-primary'><i class='icon-chevron-left'></i> Önceki Adım</button> ");
|
||||
|
||||
$("#" + stepName + "Prev").bind("click", function(e) {
|
||||
$("#" + stepName).hide();
|
||||
$("#step" + (i - 1)).show();
|
||||
$(submmitButtonName).hide();
|
||||
selectStep(i - 1);
|
||||
});
|
||||
}
|
||||
|
||||
function createNextButton(i) {
|
||||
var stepName = "step" + i;
|
||||
$("#" + stepName + "commands").append(" <button type='button' id='" + stepName + "Next' class='next btn btn-primary'>Sonraki Adım <i class='icon-chevron-right'></i></button>");
|
||||
|
||||
$("#" + stepName + "Next").bind("click", function(e) {
|
||||
$("#" + stepName).hide();
|
||||
$("#step" + (i + 1)).show();
|
||||
if (i + 2 == count)
|
||||
$(submmitButtonName).show();
|
||||
selectStep(i + 1);
|
||||
});
|
||||
}
|
||||
|
||||
function selectStep(i) {
|
||||
$("#steps li").removeClass("current");
|
||||
$("#stepDesc" + i).addClass("current");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
(function(m,oa){function wb(a){m.extend(true,Ya,a)}function Yb(a,b,e){function d(k){if(E){u();q();ma();S(k)}else f()}function f(){B=b.theme?"ui":"fc";a.addClass("fc");b.isRTL&&a.addClass("fc-rtl");b.theme&&a.addClass("ui-widget");E=m("<div class='fc-content' style='position:relative'/>").prependTo(a);C=new Zb(X,b);(P=C.render())&&a.prepend(P);y(b.defaultView);m(window).resize(na);t()||g()}function g(){setTimeout(function(){!n.start&&t()&&S()},0)}function l(){m(window).unbind("resize",na);C.destroy();
|
||||
E.remove();a.removeClass("fc fc-rtl ui-widget")}function j(){return i.offsetWidth!==0}function t(){return m("body")[0].offsetWidth!==0}function y(k){if(!n||k!=n.name){F++;pa();var D=n,Z;if(D){(D.beforeHide||xb)();Za(E,E.height());D.element.hide()}else Za(E,1);E.css("overflow","hidden");if(n=Y[k])n.element.show();else n=Y[k]=new Ja[k](Z=s=m("<div class='fc-view fc-view-"+k+"' style='position:absolute'/>").appendTo(E),X);D&&C.deactivateButton(D.name);C.activateButton(k);S();E.css("overflow","");D&&
|
||||
Za(E,1);Z||(n.afterShow||xb)();F--}}function S(k){if(j()){F++;pa();o===oa&&u();var D=false;if(!n.start||k||r<n.start||r>=n.end){n.render(r,k||0);fa(true);D=true}else if(n.sizeDirty){n.clearEvents();fa();D=true}else if(n.eventsDirty){n.clearEvents();D=true}n.sizeDirty=false;n.eventsDirty=false;ga(D);W=a.outerWidth();C.updateTitle(n.title);k=new Date;k>=n.start&&k<n.end?C.disableButton("today"):C.enableButton("today");F--;n.trigger("viewDisplay",i)}}function Q(){q();if(j()){u();fa();pa();n.clearEvents();
|
||||
n.renderEvents(J);n.sizeDirty=false}}function q(){m.each(Y,function(k,D){D.sizeDirty=true})}function u(){o=b.contentHeight?b.contentHeight:b.height?b.height-(P?P.height():0)-Sa(E):Math.round(E.width()/Math.max(b.aspectRatio,0.5))}function fa(k){F++;n.setHeight(o,k);if(s){s.css("position","relative");s=null}n.setWidth(E.width(),k);F--}function na(){if(!F)if(n.start){var k=++v;setTimeout(function(){if(k==v&&!F&&j())if(W!=(W=a.outerWidth())){F++;Q();n.trigger("windowResize",i);F--}},200)}else g()}function ga(k){if(!b.lazyFetching||
|
||||
ya(n.visStart,n.visEnd))ra();else k&&da()}function ra(){K(n.visStart,n.visEnd)}function sa(k){J=k;da()}function ha(k){da(k)}function da(k){ma();if(j()){n.clearEvents();n.renderEvents(J,k);n.eventsDirty=false}}function ma(){m.each(Y,function(k,D){D.eventsDirty=true})}function ua(k,D,Z){n.select(k,D,Z===oa?true:Z)}function pa(){n&&n.unselect()}function U(){S(-1)}function ca(){S(1)}function ka(){gb(r,-1);S()}function qa(){gb(r,1);S()}function G(){r=new Date;S()}function p(k,D,Z){if(k instanceof Date)r=
|
||||
N(k);else yb(r,k,D,Z);S()}function L(k,D,Z){k!==oa&&gb(r,k);D!==oa&&hb(r,D);Z!==oa&&ba(r,Z);S()}function c(){return N(r)}function z(){return n}function H(k,D){if(D===oa)return b[k];if(k=="height"||k=="contentHeight"||k=="aspectRatio"){b[k]=D;Q()}}function T(k,D){if(b[k])return b[k].apply(D||i,Array.prototype.slice.call(arguments,2))}var X=this;X.options=b;X.render=d;X.destroy=l;X.refetchEvents=ra;X.reportEvents=sa;X.reportEventChange=ha;X.rerenderEvents=da;X.changeView=y;X.select=ua;X.unselect=pa;
|
||||
X.prev=U;X.next=ca;X.prevYear=ka;X.nextYear=qa;X.today=G;X.gotoDate=p;X.incrementDate=L;X.formatDate=function(k,D){return Oa(k,D,b)};X.formatDates=function(k,D,Z){return ib(k,D,Z,b)};X.getDate=c;X.getView=z;X.option=H;X.trigger=T;$b.call(X,b,e);var ya=X.isFetchNeeded,K=X.fetchEvents,i=a[0],C,P,E,B,n,Y={},W,o,s,v=0,F=0,r=new Date,J=[],M;yb(r,b.year,b.month,b.date);b.droppable&&m(document).bind("dragstart",function(k,D){var Z=k.target,ja=m(Z);if(!ja.parents(".fc").length){var ia=b.dropAccept;if(m.isFunction(ia)?
|
||||
ia.call(Z,ja):ja.is(ia)){M=Z;n.dragStart(M,k,D)}}}).bind("dragstop",function(k,D){if(M){n.dragStop(M,k,D);M=null}})}function Zb(a,b){function e(){q=b.theme?"ui":"fc";if(b.header)return Q=m("<div class='fc-header' style='width:100%'/>").append(m("<div>").append(f("left")).append(f("center")).append(f("right")))}function d(){Q.remove()}function f(u){var fa=m("<div class='fc-header-"+u+"'/>");(u=b.header[u])&&m.each(u.split(" "),function(na){na>0&&fa.append("");var ga;
|
||||
m.each(this.split(","),function(ra,sa){if(sa=="title"){fa.append("<span class='fc-header-title'><strong> </strong></span>");ga&&ga.addClass(q+"-corner-right");ga=null}else{var ha;if(a[sa])ha=a[sa];else if(Ja[sa])ha=function(){ma.removeClass(q+"-state-hover");a.changeView(sa)};if(ha){ra=b.theme?jb(b.buttonIcons,sa):null;var da=jb(b.buttonText,sa),ma=m("<span class='fc-button fc-button-"+sa+" "+q+"-state-default'><span class='fc-button-inner'><span class='fc-button-content'>"+(ra?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+
|
||||
ra+"'/></span>":da)+"</span></span></span>");if(ma){ma.click(function(){ma.hasClass(q+"-state-disabled")||ha()}).mousedown(function(){ma.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-down")}).mouseup(function(){ma.removeClass(q+"-state-down")}).hover(function(){ma.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-hover")},function(){ma.removeClass(q+"-state-hover").removeClass(q+"-state-down")}).appendTo(fa);
|
||||
ga||ma.addClass(q+"-corner-left");ga=ma}}}});ga&&ga.addClass(q+"-corner-right")});return fa}function g(u){Q.find("strong").html(u)}function l(u){Q.find("span.fc-button-"+u).addClass(q+"-state-active")}function j(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-active")}function t(u){Q.find("span.fc-button-"+u).addClass(q+"-state-disabled")}function y(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-disabled")}var S=this;S.render=e;S.destroy=d;S.updateTitle=g;S.activateButton=l;S.deactivateButton=
|
||||
j;S.disableButton=t;S.enableButton=y;var Q=m([]),q}function $b(a,b){function e(c,z){return!ca||c<ca||z>ka}function d(c,z){ca=c;ka=z;L=[];c=++qa;G=z=U.length;for(var H=0;H<z;H++)f(U[H],c)}function f(c,z){g(c,function(H){if(z==qa){if(H){for(var T=0;T<H.length;T++){H[T].source=c;na(H[T])}L=L.concat(H)}G--;G||ua(L)}})}function g(c,z){var H,T=Aa.sourceFetchers,X;for(H=0;H<T.length;H++){X=T[H](c,ca,ka,z);if(X===true)return;else if(typeof X=="object"){g(X,z);return}}if(H=c.events)if(m.isFunction(H)){u();
|
||||
H(N(ca),N(ka),function(C){z(C);fa()})}else m.isArray(H)?z(H):z();else if(c.url){var ya=c.success,K=c.error,i=c.complete;H=m.extend({},c.data||{});T=Ta(c.startParam,a.startParam);X=Ta(c.endParam,a.endParam);if(T)H[T]=Math.round(+ca/1E3);if(X)H[X]=Math.round(+ka/1E3);u();m.ajax(m.extend({},ac,c,{data:H,success:function(C){C=C||[];var P=$a(ya,this,arguments);if(m.isArray(P))C=P;z(C)},error:function(){$a(K,this,arguments);z()},complete:function(){$a(i,this,arguments);fa()}}))}else z()}function l(c){if(c=
|
||||
j(c)){G++;f(c,qa)}}function j(c){if(m.isFunction(c)||m.isArray(c))c={events:c};else if(typeof c=="string")c={url:c};if(typeof c=="object"){ga(c);U.push(c);return c}}function t(c){U=m.grep(U,function(z){return!ra(z,c)});L=m.grep(L,function(z){return!ra(z.source,c)});ua(L)}function y(c){var z,H=L.length,T,X=ma().defaultEventEnd,ya=c.start-c._start,K=c.end?c.end-(c._end||X(c)):0;for(z=0;z<H;z++){T=L[z];if(T._id==c._id&&T!=c){T.start=new Date(+T.start+ya);T.end=c.end?T.end?new Date(+T.end+K):new Date(+X(T)+
|
||||
K):null;T.title=c.title;T.url=c.url;T.allDay=c.allDay;T.className=c.className;T.editable=c.editable;T.color=c.color;T.backgroudColor=c.backgroudColor;T.borderColor=c.borderColor;T.textColor=c.textColor;na(T)}}na(c);ua(L)}function S(c,z){na(c);if(!c.source){if(z){pa.events.push(c);c.source=pa}L.push(c)}ua(L)}function Q(c){if(c){if(!m.isFunction(c)){var z=c+"";c=function(T){return T._id==z}}L=m.grep(L,c,true);for(H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=m.grep(U[H].events,c,true)}else{L=
|
||||
[];for(var H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=[]}ua(L)}function q(c){if(m.isFunction(c))return m.grep(L,c);else if(c){c+="";return m.grep(L,function(z){return z._id==c})}return L}function u(){p++||da("loading",null,true)}function fa(){--p||da("loading",null,false)}function na(c){var z=c.source||{},H=Ta(z.ignoreTimezone,a.ignoreTimezone);c._id=c._id||(c.id===oa?"_fc"+bc++:c.id+"");if(c.date){if(!c.start)c.start=c.date;delete c.date}c._start=N(c.start=kb(c.start,H));c.end=kb(c.end,
|
||||
H);if(c.end&&c.end<=c.start)c.end=null;c._end=c.end?N(c.end):null;if(c.allDay===oa)c.allDay=Ta(z.allDayDefault,a.allDayDefault);if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[]}function ga(c){if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[];for(var z=Aa.sourceNormalizers,H=0;H<z.length;H++)z[H](c)}function ra(c,z){return c&&z&&sa(c)==sa(z)}function sa(c){return(typeof c=="object"?c.events||
|
||||
c.url:"")||c}var ha=this;ha.isFetchNeeded=e;ha.fetchEvents=d;ha.addEventSource=l;ha.removeEventSource=t;ha.updateEvent=y;ha.renderEvent=S;ha.removeEvents=Q;ha.clientEvents=q;ha.normalizeEvent=na;var da=ha.trigger,ma=ha.getView,ua=ha.reportEvents,pa={events:[]},U=[pa],ca,ka,qa=0,G=0,p=0,L=[];for(ha=0;ha<b.length;ha++)j(b[ha])}function gb(a,b,e){a.setFullYear(a.getFullYear()+b);e||Ka(a);return a}function hb(a,b,e){if(+a){b=a.getMonth()+b;var d=N(a);d.setDate(1);d.setMonth(b);a.setMonth(b);for(e||Ka(a);a.getMonth()!=
|
||||
d.getMonth();)a.setDate(a.getDate()+(a<d?1:-1))}return a}function ba(a,b,e){if(+a){b=a.getDate()+b;var d=N(a);d.setHours(9);d.setDate(b);a.setDate(b);e||Ka(a);lb(a,d)}return a}function lb(a,b){if(+a)for(;a.getDate()!=b.getDate();)a.setTime(+a+(a<b?1:-1)*cc)}function xa(a,b){a.setMinutes(a.getMinutes()+b);return a}function Ka(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a}function N(a,b){if(b)return Ka(new Date(+a));return new Date(+a)}function zb(){var a=0,b;do b=new Date(1970,
|
||||
a++,1);while(b.getHours());return b}function Fa(a,b,e){for(b=b||1;!a.getDay()||e&&a.getDay()==1||!e&&a.getDay()==6;)ba(a,b);return a}function Ca(a,b){return Math.round((N(a,true)-N(b,true))/Ab)}function yb(a,b,e,d){if(b!==oa&&b!=a.getFullYear()){a.setDate(1);a.setMonth(0);a.setFullYear(b)}if(e!==oa&&e!=a.getMonth()){a.setDate(1);a.setMonth(e)}d!==oa&&a.setDate(d)}function kb(a,b){if(typeof a=="object")return a;if(typeof a=="number")return new Date(a*1E3);if(typeof a=="string"){if(a.match(/^\d+(\.\d+)?$/))return new Date(parseFloat(a)*
|
||||
1E3);if(b===oa)b=true;return Bb(a,b)||(a?new Date(a):null)}return null}function Bb(a,b){a=a.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!a)return null;var e=new Date(a[1],0,1);if(b||!a[13]){b=new Date(a[1],0,1,9,0);if(a[3]){e.setMonth(a[3]-1);b.setMonth(a[3]-1)}if(a[5]){e.setDate(a[5]);b.setDate(a[5])}lb(e,b);a[7]&&e.setHours(a[7]);a[8]&&e.setMinutes(a[8]);a[10]&&e.setSeconds(a[10]);a[12]&&e.setMilliseconds(Number("0."+
|
||||
a[12])*1E3);lb(e,b)}else{e.setUTCFullYear(a[1],a[3]?a[3]-1:0,a[5]||1);e.setUTCHours(a[7]||0,a[8]||0,a[10]||0,a[12]?Number("0."+a[12])*1E3:0);if(a[14]){b=Number(a[16])*60+(a[18]?Number(a[18]):0);b*=a[15]=="-"?1:-1;e=new Date(+e+b*60*1E3)}}return e}function mb(a){if(typeof a=="number")return a*60;if(typeof a=="object")return a.getHours()*60+a.getMinutes();if(a=a.match(/(\d+)(?::(\d+))?\s*(\w+)?/)){var b=parseInt(a[1],10);if(a[3]){b%=12;if(a[3].toLowerCase().charAt(0)=="p")b+=12}return b*60+(a[2]?parseInt(a[2],
|
||||
10):0)}}function Oa(a,b,e){return ib(a,null,b,e)}function ib(a,b,e,d){d=d||Ya;var f=a,g=b,l,j=e.length,t,y,S,Q="";for(l=0;l<j;l++){t=e.charAt(l);if(t=="'")for(y=l+1;y<j;y++){if(e.charAt(y)=="'"){if(f){Q+=y==l+1?"'":e.substring(l+1,y);l=y}break}}else if(t=="(")for(y=l+1;y<j;y++){if(e.charAt(y)==")"){l=Oa(f,e.substring(l+1,y),d);if(parseInt(l.replace(/\D/,""),10))Q+=l;l=y;break}}else if(t=="[")for(y=l+1;y<j;y++){if(e.charAt(y)=="]"){t=e.substring(l+1,y);l=Oa(f,t,d);if(l!=Oa(g,t,d))Q+=l;l=y;break}}else if(t==
|
||||
"{"){f=b;g=a}else if(t=="}"){f=a;g=b}else{for(y=j;y>l;y--)if(S=dc[e.substring(l,y)]){if(f)Q+=S(f,d);l=y-1;break}if(y==l)if(f)Q+=t}}return Q}function Ua(a){return a.end?ec(a.end,a.allDay):ba(N(a.start),1)}function ec(a,b){a=N(a);return b||a.getHours()||a.getMinutes()?ba(a,1):Ka(a)}function fc(a,b){return(b.msLength-a.msLength)*100+(a.event.start-b.event.start)}function Cb(a,b){return a.end>b.start&&a.start<b.end}function nb(a,b,e,d){var f=[],g,l=a.length,j,t,y,S,Q;for(g=0;g<l;g++){j=a[g];t=j.start;
|
||||
y=b[g];if(y>e&&t<d){if(t<e){t=N(e);S=false}else{t=t;S=true}if(y>d){y=N(d);Q=false}else{y=y;Q=true}f.push({event:j,start:t,end:y,isStart:S,isEnd:Q,msLength:y-t})}}return f.sort(fc)}function ob(a){var b=[],e,d=a.length,f,g,l,j;for(e=0;e<d;e++){f=a[e];for(g=0;;){l=false;if(b[g])for(j=0;j<b[g].length;j++)if(Cb(b[g][j],f)){l=true;break}if(l)g++;else break}if(b[g])b[g].push(f);else b[g]=[f]}return b}function Db(a,b,e){a.unbind("mouseover").mouseover(function(d){for(var f=d.target,g;f!=this;){g=f;f=f.parentNode}if((f=
|
||||
g._fci)!==oa){g._fci=oa;g=b[f];e(g.event,g.element,g);m(d.target).trigger(d)}d.stopPropagation()})}function Va(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.width(Math.max(0,b-pb(f,e)))}}function Eb(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.height(Math.max(0,b-Sa(f,e)))}}function pb(a,b){return gc(a)+hc(a)+(b?ic(a):0)}function gc(a){return(parseFloat(m.curCSS(a[0],"paddingLeft",true))||0)+(parseFloat(m.curCSS(a[0],"paddingRight",true))||0)}function ic(a){return(parseFloat(m.curCSS(a[0],
|
||||
"marginLeft",true))||0)+(parseFloat(m.curCSS(a[0],"marginRight",true))||0)}function hc(a){return(parseFloat(m.curCSS(a[0],"borderLeftWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderRightWidth",true))||0)}function Sa(a,b){return jc(a)+kc(a)+(b?Fb(a):0)}function jc(a){return(parseFloat(m.curCSS(a[0],"paddingTop",true))||0)+(parseFloat(m.curCSS(a[0],"paddingBottom",true))||0)}function Fb(a){return(parseFloat(m.curCSS(a[0],"marginTop",true))||0)+(parseFloat(m.curCSS(a[0],"marginBottom",true))||0)}
|
||||
function kc(a){return(parseFloat(m.curCSS(a[0],"borderTopWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderBottomWidth",true))||0)}function Za(a,b){b=typeof b=="number"?b+"px":b;a.each(function(e,d){d.style.cssText+=";min-height:"+b+";_height:"+b})}function xb(){}function Gb(a,b){return a-b}function Hb(a){return Math.max.apply(Math,a)}function Pa(a){return(a<10?"0":"")+a}function jb(a,b){if(a[b]!==oa)return a[b];b=b.split(/(?=[A-Z])/);for(var e=b.length-1,d;e>=0;e--){d=a[b[e].toLowerCase()];if(d!==
|
||||
oa)return d}return a[""]}function Qa(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}
|
||||
function rb(a,b){a.each(function(e,d){d.className=d.className.replace(/^fc-\w*/,"fc-"+lc[b.getDay()])})}function Jb(a,b){var e=a.source||{},d=a.color,f=e.color,g=b("eventColor"),l=a.backgroundColor||d||e.backgroundColor||f||b("eventBackgroundColor")||g;d=a.borderColor||d||e.borderColor||f||b("eventBorderColor")||g;a=a.textColor||e.textColor||b("eventTextColor");b=[];l&&b.push("background-color:"+l);d&&b.push("border-color:"+d);a&&b.push("color:"+a);return b.join(";")}function $a(a,b,e){if(m.isFunction(a))a=
|
||||
[a];if(a){var d,f;for(d=0;d<a.length;d++)f=a[d].apply(b,e)||f;return f}}function Ta(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==oa)return arguments[a]}function mc(a,b){function e(j,t){if(t){hb(j,t);j.setDate(1)}j=N(j,true);j.setDate(1);t=hb(N(j),1);var y=N(j),S=N(t),Q=f("firstDay"),q=f("weekends")?0:1;if(q){Fa(y);Fa(S,-1,true)}ba(y,-((y.getDay()-Math.max(Q,q)+7)%7));ba(S,(7-S.getDay()+Math.max(Q,q))%7);Q=Math.round((S-y)/(Ab*7));if(f("weekMode")=="fixed"){ba(S,(6-Q)*7);Q=6}d.title=l(j,
|
||||
f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(6,Q,q?5:7,true)}var d=this;d.render=e;sb.call(d,a,b,"month");var f=d.opt,g=d.renderBasic,l=b.formatDate}function nc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(1,1,Q?7:5,false)}var d=this;d.render=e;sb.call(d,a,b,"basicWeek");var f=d.opt,g=d.renderBasic,
|
||||
l=b.formatDates}function oc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}d.title=l(j,f("titleFormat"));d.start=d.visStart=N(j,true);d.end=d.visEnd=ba(N(d.start),1);g(1,1,1,false)}var d=this;d.render=e;sb.call(d,a,b,"basicDay");var f=d.opt,g=d.renderBasic,l=b.formatDate}function sb(a,b,e){function d(w,I,R,V){v=I;F=R;f();(I=!C)?g(w,V):z();l(I)}function f(){if(k=L("isRTL")){D=-1;Z=F-1}else{D=1;Z=0}ja=L("firstDay");ia=L("weekends")?0:1;la=L("theme")?"ui":"fc";$=L("columnFormat")}function g(w,
|
||||
I){var R,V=la+"-widget-header",ea=la+"-widget-content",aa;R="<table class='fc-border-separate' style='width:100%' cellspacing='0'><thead><tr>";for(aa=0;aa<F;aa++)R+="<th class='fc- "+V+"'/>";R+="</tr></thead><tbody>";for(aa=0;aa<w;aa++){R+="<tr class='fc-week"+aa+"'>";for(V=0;V<F;V++)R+="<td class='fc- "+ea+" fc-day"+(aa*F+V)+"'><div>"+(I?"<div class='fc-day-number'/>":"")+"<div class='fc-day-content'><div style='position:relative'> </div></div></div></td>";R+="</tr>"}R+="</tbody></table>";w=
|
||||
m(R).appendTo(a);K=w.find("thead");i=K.find("th");C=w.find("tbody");P=C.find("tr");E=C.find("td");B=E.filter(":first-child");n=P.eq(0).find("div.fc-day-content div");ab(K.add(K.find("tr")));ab(P);P.eq(0).addClass("fc-first");y(E);Y=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a)}function l(w){var I=w||v==1,R=p.start.getMonth(),V=Ka(new Date),ea,aa,va;I&&i.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);ea.html(ya(aa,$));rb(ea,aa)});E.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);aa.getMonth()==
|
||||
R?ea.removeClass("fc-other-month"):ea.addClass("fc-other-month");+aa==+V?ea.addClass(la+"-state-highlight fc-today"):ea.removeClass(la+"-state-highlight fc-today");ea.find("div.fc-day-number").text(aa.getDate());I&&rb(ea,aa)});P.each(function(wa,Ga){va=m(Ga);if(wa<v){va.show();wa==v-1?va.addClass("fc-last"):va.removeClass("fc-last")}else va.hide()})}function j(w){o=w;w=o-K.height();var I,R,V;if(L("weekMode")=="variable")I=R=Math.floor(w/(v==1?2:6));else{I=Math.floor(w/v);R=w-I*(v-1)}B.each(function(ea,
|
||||
aa){if(ea<v){V=m(aa);Za(V.find("> div"),(ea==v-1?R:I)-Sa(V))}})}function t(w){W=w;M.clear();s=Math.floor(W/F);Va(i.slice(0,-1),s)}function y(w){w.click(S).mousedown(X)}function S(w){if(!L("selectable")){var I=parseInt(this.className.match(/fc\-day(\d+)/)[1]);I=ca(I);c("dayClick",this,I,true,w)}}function Q(w,I,R){R&&r.build();R=N(p.visStart);for(var V=ba(N(R),F),ea=0;ea<v;ea++){var aa=new Date(Math.max(R,w)),va=new Date(Math.min(V,I));if(aa<va){var wa;if(k){wa=Ca(va,R)*D+Z+1;aa=Ca(aa,R)*D+Z+1}else{wa=
|
||||
Ca(aa,R);aa=Ca(va,R)}y(q(ea,wa,ea,aa-1))}ba(R,7);ba(V,7)}}function q(w,I,R,V){w=r.rect(w,I,R,V,a);return H(w,a)}function u(w){return N(w)}function fa(w,I){Q(w,ba(N(I),1),true)}function na(){T()}function ga(w,I,R){var V=ua(w);c("dayClick",E[V.row*F+V.col],w,I,R)}function ra(w,I){J.start(function(R){T();R&&q(R.row,R.col,R.row,R.col)},I)}function sa(w,I,R){var V=J.stop();T();if(V){V=pa(V);c("drop",w,V,true,I,R)}}function ha(w){return N(w.start)}function da(w){return M.left(w)}function ma(w){return M.right(w)}
|
||||
function ua(w){return{row:Math.floor(Ca(w,p.visStart)/7),col:ka(w.getDay())}}function pa(w){return U(w.row,w.col)}function U(w,I){return ba(N(p.visStart),w*7+I*D+Z)}function ca(w){return U(Math.floor(w/F),w%F)}function ka(w){return(w-Math.max(ja,ia)+F)%F*D+Z}function qa(w){return P.eq(w)}function G(){return{left:0,right:W}}var p=this;p.renderBasic=d;p.setHeight=j;p.setWidth=t;p.renderDayOverlay=Q;p.defaultSelectionEnd=u;p.renderSelection=fa;p.clearSelection=na;p.reportDayClick=ga;p.dragStart=ra;p.dragStop=
|
||||
sa;p.defaultEventEnd=ha;p.getHoverListener=function(){return J};p.colContentLeft=da;p.colContentRight=ma;p.dayOfWeekCol=ka;p.dateCell=ua;p.cellDate=pa;p.cellIsAllDay=function(){return true};p.allDayRow=qa;p.allDayBounds=G;p.getRowCnt=function(){return v};p.getColCnt=function(){return F};p.getColWidth=function(){return s};p.getDaySegmentContainer=function(){return Y};Kb.call(p,a,b,e);Lb.call(p);Mb.call(p);pc.call(p);var L=p.opt,c=p.trigger,z=p.clearEvents,H=p.renderOverlay,T=p.clearOverlays,X=p.daySelectionMousedown,
|
||||
ya=b.formatDate,K,i,C,P,E,B,n,Y,W,o,s,v,F,r,J,M,k,D,Z,ja,ia,la,$;qb(a.addClass("fc-grid"));r=new Nb(function(w,I){var R,V,ea;i.each(function(aa,va){R=m(va);V=R.offset().left;if(aa)ea[1]=V;ea=[V];I[aa]=ea});ea[1]=V+R.outerWidth();P.each(function(aa,va){if(aa<v){R=m(va);V=R.offset().top;if(aa)ea[1]=V;ea=[V];w[aa]=ea}});ea[1]=V+R.outerHeight()});J=new Ob(r);M=new Pb(function(w){return n.eq(w)})}function pc(){function a(U,ca){S(U);ua(e(U),ca)}function b(){Q();ga().empty()}function e(U){var ca=da(),ka=
|
||||
ma(),qa=N(g.visStart);ka=ba(N(qa),ka);var G=m.map(U,Ua),p,L,c,z,H,T,X=[];for(p=0;p<ca;p++){L=ob(nb(U,G,qa,ka));for(c=0;c<L.length;c++){z=L[c];for(H=0;H<z.length;H++){T=z[H];T.row=p;T.level=c;X.push(T)}}ba(qa,7);ba(ka,7)}return X}function d(U,ca,ka){t(U)&&f(U,ca);ka.isEnd&&y(U)&&pa(U,ca,ka);q(U,ca)}function f(U,ca){var ka=ra(),qa;ca.draggable({zIndex:9,delay:50,opacity:l("dragOpacity"),revertDuration:l("dragRevertDuration"),start:function(G,p){j("eventDragStart",ca,U,G,p);fa(U,ca);ka.start(function(L,
|
||||
c,z,H){ca.draggable("option","revert",!L||!z&&!H);ha();if(L){qa=z*7+H*(l("isRTL")?-1:1);sa(ba(N(U.start),qa),ba(Ua(U),qa))}else qa=0},G,"drag")},stop:function(G,p){ka.stop();ha();j("eventDragStop",ca,U,G,p);if(qa)na(this,U,qa,0,U.allDay,G,p);else{ca.css("filter","");u(U,ca)}}})}var g=this;g.renderEvents=a;g.compileDaySegs=e;g.clearEvents=b;g.bindDaySeg=d;Qb.call(g);var l=g.opt,j=g.trigger,t=g.isEventDraggable,y=g.isEventResizable,S=g.reportEvents,Q=g.reportEventClear,q=g.eventElementHandlers,u=g.showEvents,
|
||||
fa=g.hideEvents,na=g.eventDrop,ga=g.getDaySegmentContainer,ra=g.getHoverListener,sa=g.renderDayOverlay,ha=g.clearOverlays,da=g.getRowCnt,ma=g.getColCnt,ua=g.renderDaySegs,pa=g.resizableDayEvent}function qc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(Q?7:5)}var d=this;d.render=e;Rb.call(d,a,b,"agendaWeek");
|
||||
var f=d.opt,g=d.renderAgenda,l=b.formatDates}function rc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}t=N(j,true);var y=ba(N(t),1);d.title=l(j,f("titleFormat"));d.start=d.visStart=t;d.end=d.visEnd=y;g(1)}var d=this;d.render=e;Rb.call(d,a,b,"agendaDay");var f=d.opt,g=d.renderAgenda,l=b.formatDate}function Rb(a,b,e){function d(h){Ba=h;f();v?P():g();l()}function f(){Wa=i("theme")?"ui":"fc";Sb=i("weekends")?0:1;Tb=i("firstDay");if(Ub=i("isRTL")){Ha=-1;Ia=Ba-1}else{Ha=1;Ia=0}La=mb(i("minTime"));
|
||||
bb=mb(i("maxTime"));Vb=i("columnFormat")}function g(){var h=Wa+"-widget-header",O=Wa+"-widget-content",x,A,ta,za,Da,Ea=i("slotMinutes")%15==0;x="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'><thead><tr><th class='fc-agenda-axis "+h+"'> </th>";for(A=0;A<Ba;A++)x+="<th class='fc- fc-col"+A+" "+h+"'/>";x+="<th class='fc-agenda-gutter "+h+"'> </th></tr></thead><tbody><tr><th class='fc-agenda-axis "+h+"'> </th>";for(A=0;A<Ba;A++)x+="<td class='fc- fc-col"+
|
||||
A+" "+O+"'><div><div class='fc-day-content'><div style='position:relative'> </div></div></div></td>";x+="<td class='fc-agenda-gutter "+O+"'> </td></tr></tbody></table>";v=m(x).appendTo(a);F=v.find("thead");r=F.find("th").slice(1,-1);J=v.find("tbody");M=J.find("td").slice(0,-1);k=M.find("div.fc-day-content div");D=M.eq(0);Z=D.find("> div");ab(F.add(F.find("tr")));ab(J.add(J.find("tr")));aa=F.find("th:first");va=v.find(".fc-agenda-gutter");ja=m("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(a);
|
||||
if(i("allDaySlot")){ia=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ja);x="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+h+" fc-agenda-axis'>"+i("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+h+" fc-agenda-gutter'> </th></tr></table>";la=m(x).appendTo(ja);$=la.find("tr");q($.find("td"));aa=aa.add(la.find("th:first"));va=va.add(la.find("th.fc-agenda-gutter"));ja.append("<div class='fc-agenda-divider "+
|
||||
h+"'><div class='fc-agenda-divider-inner'/></div>")}else ia=m([]);w=m("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ja);I=m("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(w);R=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(I);x="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";ta=zb();za=xa(N(ta),bb);xa(ta,La);for(A=tb=0;ta<za;A++){Da=ta.getMinutes();x+="<tr class='fc-slot"+A+" "+
|
||||
(!Da?"":"fc-minor")+"'><th class='fc-agenda-axis "+h+"'>"+(!Ea||!Da?s(ta,i("axisFormat")):" ")+"</th><td class='"+O+"'><div style='position:relative'> </div></td></tr>";xa(ta,i("slotMinutes"));tb++}x+="</tbody></table>";V=m(x).appendTo(I);ea=V.find("div:first");u(V.find("td"));aa=aa.add(V.find("th:first"))}function l(){var h,O,x,A,ta=Ka(new Date);for(h=0;h<Ba;h++){A=ua(h);O=r.eq(h);O.html(s(A,Vb));x=M.eq(h);+A==+ta?x.addClass(Wa+"-state-highlight fc-today"):x.removeClass(Wa+"-state-highlight fc-today");
|
||||
rb(O.add(x),A)}}function j(h,O){if(h===oa)h=Wb;Wb=h;ub={};var x=J.position().top,A=w.position().top;h=Math.min(h-x,V.height()+A+1);Z.height(h-Sa(D));ja.css("top",x);w.height(h-A-1);Xa=ea.height()+1;O&&y()}function t(h){Ga=h;cb.clear();Ma=0;Va(aa.width("").each(function(O,x){Ma=Math.max(Ma,m(x).outerWidth())}),Ma);h=w[0].clientWidth;if(vb=w.width()-h){Va(va,vb);va.show().prev().removeClass("fc-last")}else va.hide().prev().addClass("fc-last");db=Math.floor((h-Ma)/Ba);Va(r.slice(0,-1),db)}function y(){function h(){w.scrollTop(A)}
|
||||
var O=zb(),x=N(O);x.setHours(i("firstHour"));var A=ca(O,x)+1;h();setTimeout(h,0)}function S(){Xb=w.scrollTop()}function Q(){w.scrollTop(Xb)}function q(h){h.click(fa).mousedown(W)}function u(h){h.click(fa).mousedown(H)}function fa(h){if(!i("selectable")){var O=Math.min(Ba-1,Math.floor((h.pageX-v.offset().left-Ma)/db)),x=ua(O),A=this.parentNode.className.match(/fc-slot(\d+)/);if(A){A=parseInt(A[1])*i("slotMinutes");var ta=Math.floor(A/60);x.setHours(ta);x.setMinutes(A%60+La);C("dayClick",M[O],x,false,
|
||||
h)}else C("dayClick",M[O],x,true,h)}}function na(h,O,x){x&&Na.build();var A=N(K.visStart);if(Ub){x=Ca(O,A)*Ha+Ia+1;h=Ca(h,A)*Ha+Ia+1}else{x=Ca(h,A);h=Ca(O,A)}x=Math.max(0,x);h=Math.min(Ba,h);x<h&&q(ga(0,x,0,h-1))}function ga(h,O,x,A){h=Na.rect(h,O,x,A,ja);return E(h,ja)}function ra(h,O){for(var x=N(K.visStart),A=ba(N(x),1),ta=0;ta<Ba;ta++){var za=new Date(Math.max(x,h)),Da=new Date(Math.min(A,O));if(za<Da){var Ea=ta*Ha+Ia;Ea=Na.rect(0,Ea,0,Ea,I);za=ca(x,za);Da=ca(x,Da);Ea.top=za;Ea.height=Da-za;u(E(Ea,
|
||||
I))}ba(x,1);ba(A,1)}}function sa(h){return cb.left(h)}function ha(h){return cb.right(h)}function da(h){return{row:Math.floor(Ca(h,K.visStart)/7),col:U(h.getDay())}}function ma(h){var O=ua(h.col);h=h.row;i("allDaySlot")&&h--;h>=0&&xa(O,La+h*i("slotMinutes"));return O}function ua(h){return ba(N(K.visStart),h*Ha+Ia)}function pa(h){return i("allDaySlot")&&!h.row}function U(h){return(h-Math.max(Tb,Sb)+Ba)%Ba*Ha+Ia}function ca(h,O){h=N(h,true);if(O<xa(N(h),La))return 0;if(O>=xa(N(h),bb))return V.height();
|
||||
h=i("slotMinutes");O=O.getHours()*60+O.getMinutes()-La;var x=Math.floor(O/h),A=ub[x];if(A===oa)A=ub[x]=V.find("tr:eq("+x+") td div")[0].offsetTop;return Math.max(0,Math.round(A-1+Xa*(O%h/h)))}function ka(){return{left:Ma,right:Ga-vb}}function qa(){return $}function G(h){var O=N(h.start);if(h.allDay)return O;return xa(O,i("defaultEventMinutes"))}function p(h,O){if(O)return N(h);return xa(N(h),i("slotMinutes"))}function L(h,O,x){if(x)i("allDaySlot")&&na(h,ba(N(O),1),true);else c(h,O)}function c(h,O){var x=
|
||||
i("selectHelper");Na.build();if(x){var A=Ca(h,K.visStart)*Ha+Ia;if(A>=0&&A<Ba){A=Na.rect(0,A,0,A,I);var ta=ca(h,h),za=ca(h,O);if(za>ta){A.top=ta;A.height=za-ta;A.left+=2;A.width-=5;if(m.isFunction(x)){if(h=x(h,O)){A.position="absolute";A.zIndex=8;wa=m(h).css(A).appendTo(I)}}else{A.isStart=true;A.isEnd=true;wa=m(o({title:"",start:h,end:O,className:["fc-select-helper"],editable:false},A));wa.css("opacity",i("dragOpacity"))}if(wa){u(wa);I.append(wa);Va(wa,A.width,true);Eb(wa,A.height,true)}}}}else ra(h,
|
||||
O)}function z(){B();if(wa){wa.remove();wa=null}}function H(h){if(h.which==1&&i("selectable")){Y(h);var O;Ra.start(function(x,A){z();if(x&&x.col==A.col&&!pa(x)){A=ma(A);x=ma(x);O=[A,xa(N(A),i("slotMinutes")),x,xa(N(x),i("slotMinutes"))].sort(Gb);c(O[0],O[3])}else O=null},h);m(document).one("mouseup",function(x){Ra.stop();if(O){+O[0]==+O[1]&&T(O[0],false,x);n(O[0],O[3],false,x)}})}}function T(h,O,x){C("dayClick",M[U(h.getDay())],h,O,x)}function X(h,O){Ra.start(function(x){B();if(x)if(pa(x))ga(x.row,
|
||||
x.col,x.row,x.col);else{x=ma(x);var A=xa(N(x),i("defaultEventMinutes"));ra(x,A)}},O)}function ya(h,O,x){var A=Ra.stop();B();A&&C("drop",h,ma(A),pa(A),O,x)}var K=this;K.renderAgenda=d;K.setWidth=t;K.setHeight=j;K.beforeHide=S;K.afterShow=Q;K.defaultEventEnd=G;K.timePosition=ca;K.dayOfWeekCol=U;K.dateCell=da;K.cellDate=ma;K.cellIsAllDay=pa;K.allDayRow=qa;K.allDayBounds=ka;K.getHoverListener=function(){return Ra};K.colContentLeft=sa;K.colContentRight=ha;K.getDaySegmentContainer=function(){return ia};
|
||||
K.getSlotSegmentContainer=function(){return R};K.getMinMinute=function(){return La};K.getMaxMinute=function(){return bb};K.getBodyContent=function(){return I};K.getRowCnt=function(){return 1};K.getColCnt=function(){return Ba};K.getColWidth=function(){return db};K.getSlotHeight=function(){return Xa};K.defaultSelectionEnd=p;K.renderDayOverlay=na;K.renderSelection=L;K.clearSelection=z;K.reportDayClick=T;K.dragStart=X;K.dragStop=ya;Kb.call(K,a,b,e);Lb.call(K);Mb.call(K);sc.call(K);var i=K.opt,C=K.trigger,
|
||||
P=K.clearEvents,E=K.renderOverlay,B=K.clearOverlays,n=K.reportSelection,Y=K.unselect,W=K.daySelectionMousedown,o=K.slotSegHtml,s=b.formatDate,v,F,r,J,M,k,D,Z,ja,ia,la,$,w,I,R,V,ea,aa,va,wa,Ga,Wb,Ma,db,vb,Xa,Xb,Ba,tb,Na,Ra,cb,ub={},Wa,Tb,Sb,Ub,Ha,Ia,La,bb,Vb;qb(a.addClass("fc-agenda"));Na=new Nb(function(h,O){function x(eb){return Math.max(Ea,Math.min(tc,eb))}var A,ta,za;r.each(function(eb,uc){A=m(uc);ta=A.offset().left;if(eb)za[1]=ta;za=[ta];O[eb]=za});za[1]=ta+A.outerWidth();if(i("allDaySlot")){A=
|
||||
$;ta=A.offset().top;h[0]=[ta,ta+A.outerHeight()]}for(var Da=I.offset().top,Ea=w.offset().top,tc=Ea+w.outerHeight(),fb=0;fb<tb;fb++)h.push([x(Da+Xa*fb),x(Da+Xa*(fb+1))])});Ra=new Ob(Na);cb=new Pb(function(h){return k.eq(h)})}function sc(){function a(o,s){sa(o);var v,F=o.length,r=[],J=[];for(v=0;v<F;v++)o[v].allDay?r.push(o[v]):J.push(o[v]);if(u("allDaySlot")){L(e(r),s);ma()}g(d(J),s)}function b(){ha();ua().empty();pa().empty()}function e(o){o=ob(nb(o,m.map(o,Ua),q.visStart,q.visEnd));var s,v=o.length,
|
||||
F,r,J,M=[];for(s=0;s<v;s++){F=o[s];for(r=0;r<F.length;r++){J=F[r];J.row=0;J.level=s;M.push(J)}}return M}function d(o){var s=z(),v=ka(),F=ca(),r=xa(N(q.visStart),v),J=m.map(o,f),M,k,D,Z,ja,ia,la=[];for(M=0;M<s;M++){k=ob(nb(o,J,r,xa(N(r),F-v)));vc(k);for(D=0;D<k.length;D++){Z=k[D];for(ja=0;ja<Z.length;ja++){ia=Z[ja];ia.col=M;ia.level=D;la.push(ia)}}ba(r,1,true)}return la}function f(o){return o.end?N(o.end):xa(N(o.start),u("defaultEventMinutes"))}function g(o,s){var v,F=o.length,r,J,M,k,D,Z,ja,ia,la,
|
||||
$="",w,I,R={},V={},ea=pa(),aa;v=z();if(w=u("isRTL")){I=-1;aa=v-1}else{I=1;aa=0}for(v=0;v<F;v++){r=o[v];J=r.event;M=qa(r.start,r.start);k=qa(r.start,r.end);D=r.col;Z=r.level;ja=r.forward||0;ia=G(D*I+aa);la=p(D*I+aa)-ia;la=Math.min(la-6,la*0.95);D=Z?la/(Z+ja+1):ja?(la/(ja+1)-6)*2:la;Z=ia+la/(Z+ja+1)*Z*I+(w?la-D:0);r.top=M;r.left=Z;r.outerWidth=D;r.outerHeight=k-M;$+=l(J,r)}ea[0].innerHTML=$;w=ea.children();for(v=0;v<F;v++){r=o[v];J=r.event;$=m(w[v]);I=fa("eventRender",J,J,$);if(I===false)$.remove();
|
||||
else{if(I&&I!==true){$.remove();$=m(I).css({position:"absolute",top:r.top,left:r.left}).appendTo(ea)}r.element=$;if(J._id===s)t(J,$,r);else $[0]._fci=v;ya(J,$)}}Db(ea,o,t);for(v=0;v<F;v++){r=o[v];if($=r.element){J=R[s=r.key=Ib($[0])];r.vsides=J===oa?(R[s]=Sa($,true)):J;J=V[s];r.hsides=J===oa?(V[s]=pb($,true)):J;s=$.find("div.fc-event-content");if(s.length)r.contentTop=s[0].offsetTop}}for(v=0;v<F;v++){r=o[v];if($=r.element){$[0].style.width=Math.max(0,r.outerWidth-r.hsides)+"px";R=Math.max(0,r.outerHeight-
|
||||
r.vsides);$[0].style.height=R+"px";J=r.event;if(r.contentTop!==oa&&R-r.contentTop<10){$.find("div.fc-event-time").text(Y(J.start,u("timeFormat"))+" - "+J.title);$.find("div.fc-event-title").remove()}fa("eventAfterRender",J,J,$)}}}function l(o,s){var v="<",F=o.url,r=Jb(o,u),J=r?" style='"+r+"'":"",M=["fc-event","fc-event-skin","fc-event-vert"];na(o)&&M.push("fc-event-draggable");s.isStart&&M.push("fc-corner-top");s.isEnd&&M.push("fc-corner-bottom");M=M.concat(o.className);if(o.source)M=M.concat(o.source.className||
|
||||
[]);v+=F?"a href='"+Qa(o.url)+"'":"div";v+=" class='"+M.join(" ")+"' style='position:absolute;z-index:8;top:"+s.top+"px;left:"+s.left+"px;"+r+"'><div class='fc-event-inner fc-event-skin'"+J+"><div class='fc-event-head fc-event-skin'"+J+"><div class='fc-event-time'>"+Qa(W(o.start,o.end,u("timeFormat")))+"</div></div><div class='fc-event-content'><div class='fc-event-title'>"+Qa(o.title)+"</div></div><div class='fc-event-bg'></div></div>";if(s.isEnd&&ga(o))v+="<div class='ui-resizable-handle ui-resizable-s'>=</div>";
|
||||
v+="</"+(F?"a":"div")+">";return v}function j(o,s,v){na(o)&&y(o,s,v.isStart);v.isEnd&&ga(o)&&c(o,s,v);da(o,s)}function t(o,s,v){var F=s.find("div.fc-event-time");na(o)&&S(o,s,F);v.isEnd&&ga(o)&&Q(o,s,F);da(o,s)}function y(o,s,v){function F(){if(!M){s.width(r).height("").draggable("option","grid",null);M=true}}var r,J,M=true,k,D=u("isRTL")?-1:1,Z=U(),ja=H(),ia=T(),la=ka();s.draggable({zIndex:9,opacity:u("dragOpacity","month"),revertDuration:u("dragRevertDuration"),start:function($,w){fa("eventDragStart",
|
||||
s,o,$,w);i(o,s);r=s.width();Z.start(function(I,R,V,ea){B();if(I){J=false;k=ea*D;if(I.row)if(v){if(M){s.width(ja-10);Eb(s,ia*Math.round((o.end?(o.end-o.start)/wc:u("defaultEventMinutes"))/u("slotMinutes")));s.draggable("option","grid",[ja,1]);M=false}}else J=true;else{E(ba(N(o.start),k),ba(Ua(o),k));F()}J=J||M&&!k}else{F();J=true}s.draggable("option","revert",J)},$,"drag")},stop:function($,w){Z.stop();B();fa("eventDragStop",s,o,$,w);if(J){F();s.css("filter","");K(o,s)}else{var I=0;M||(I=Math.round((s.offset().top-
|
||||
X().offset().top)/ia)*u("slotMinutes")+la-(o.start.getHours()*60+o.start.getMinutes()));C(this,o,k,I,M,$,w)}}})}function S(o,s,v){function F(I){var R=xa(N(o.start),I),V;if(o.end)V=xa(N(o.end),I);v.text(W(R,V,u("timeFormat")))}function r(){if(M){v.css("display","");s.draggable("option","grid",[$,w]);M=false}}var J,M=false,k,D,Z,ja=u("isRTL")?-1:1,ia=U(),la=z(),$=H(),w=T();s.draggable({zIndex:9,scroll:false,grid:[$,w],axis:la==1?"y":false,opacity:u("dragOpacity"),revertDuration:u("dragRevertDuration"),
|
||||
start:function(I,R){fa("eventDragStart",s,o,I,R);i(o,s);J=s.position();D=Z=0;ia.start(function(V,ea,aa,va){s.draggable("option","revert",!V);B();if(V){k=va*ja;if(u("allDaySlot")&&!V.row){if(!M){M=true;v.hide();s.draggable("option","grid",null)}E(ba(N(o.start),k),ba(Ua(o),k))}else r()}},I,"drag")},drag:function(I,R){D=Math.round((R.position.top-J.top)/w)*u("slotMinutes");if(D!=Z){M||F(D);Z=D}},stop:function(I,R){var V=ia.stop();B();fa("eventDragStop",s,o,I,R);if(V&&(k||D||M))C(this,o,k,M?0:D,M,I,R);
|
||||
else{r();s.css("filter","");s.css(J);F(0);K(o,s)}}})}function Q(o,s,v){var F,r,J=T();s.resizable({handles:{s:"div.ui-resizable-s"},grid:J,start:function(M,k){F=r=0;i(o,s);s.css("z-index",9);fa("eventResizeStart",this,o,M,k)},resize:function(M,k){F=Math.round((Math.max(J,s.height())-k.originalSize.height)/J);if(F!=r){v.text(W(o.start,!F&&!o.end?null:xa(ra(o),u("slotMinutes")*F),u("timeFormat")));r=F}},stop:function(M,k){fa("eventResizeStop",this,o,M,k);if(F)P(this,o,0,u("slotMinutes")*F,M,k);else{s.css("z-index",
|
||||
8);K(o,s)}}})}var q=this;q.renderEvents=a;q.compileDaySegs=e;q.clearEvents=b;q.slotSegHtml=l;q.bindDaySeg=j;Qb.call(q);var u=q.opt,fa=q.trigger,na=q.isEventDraggable,ga=q.isEventResizable,ra=q.eventEnd,sa=q.reportEvents,ha=q.reportEventClear,da=q.eventElementHandlers,ma=q.setHeight,ua=q.getDaySegmentContainer,pa=q.getSlotSegmentContainer,U=q.getHoverListener,ca=q.getMaxMinute,ka=q.getMinMinute,qa=q.timePosition,G=q.colContentLeft,p=q.colContentRight,L=q.renderDaySegs,c=q.resizableDayEvent,z=q.getColCnt,
|
||||
H=q.getColWidth,T=q.getSlotHeight,X=q.getBodyContent,ya=q.reportEventElement,K=q.showEvents,i=q.hideEvents,C=q.eventDrop,P=q.eventResize,E=q.renderDayOverlay,B=q.clearOverlays,n=q.calendar,Y=n.formatDate,W=n.formatDates}function vc(a){var b,e,d,f,g,l;for(b=a.length-1;b>0;b--){f=a[b];for(e=0;e<f.length;e++){g=f[e];for(d=0;d<a[b-1].length;d++){l=a[b-1][d];if(Cb(g,l))l.forward=Math.max(l.forward||0,(g.forward||0)+1)}}}}function Kb(a,b,e){function d(G,p){G=qa[G];if(typeof G=="object")return jb(G,p||e);
|
||||
return G}function f(G,p){return b.trigger.apply(b,[G,p||da].concat(Array.prototype.slice.call(arguments,2),[da]))}function g(G){return j(G)&&!d("disableDragging")}function l(G){return j(G)&&!d("disableResizing")}function j(G){return Ta(G.editable,(G.source||{}).editable,d("editable"))}function t(G){U={};var p,L=G.length,c;for(p=0;p<L;p++){c=G[p];if(U[c._id])U[c._id].push(c);else U[c._id]=[c]}}function y(G){return G.end?N(G.end):ma(G)}function S(G,p){ca.push(p);if(ka[G._id])ka[G._id].push(p);else ka[G._id]=
|
||||
[p]}function Q(){ca=[];ka={}}function q(G,p){p.click(function(L){if(!p.hasClass("ui-draggable-dragging")&&!p.hasClass("ui-resizable-resizing"))return f("eventClick",this,G,L)}).hover(function(L){f("eventMouseover",this,G,L)},function(L){f("eventMouseout",this,G,L)})}function u(G,p){na(G,p,"show")}function fa(G,p){na(G,p,"hide")}function na(G,p,L){G=ka[G._id];var c,z=G.length;for(c=0;c<z;c++)if(!p||G[c][0]!=p[0])G[c][L]()}function ga(G,p,L,c,z,H,T){var X=p.allDay,ya=p._id;sa(U[ya],L,c,z);f("eventDrop",
|
||||
G,p,L,c,z,function(){sa(U[ya],-L,-c,X);pa(ya)},H,T);pa(ya)}function ra(G,p,L,c,z,H){var T=p._id;ha(U[T],L,c);f("eventResize",G,p,L,c,function(){ha(U[T],-L,-c);pa(T)},z,H);pa(T)}function sa(G,p,L,c){L=L||0;for(var z,H=G.length,T=0;T<H;T++){z=G[T];if(c!==oa)z.allDay=c;xa(ba(z.start,p,true),L);if(z.end)z.end=xa(ba(z.end,p,true),L);ua(z,qa)}}function ha(G,p,L){L=L||0;for(var c,z=G.length,H=0;H<z;H++){c=G[H];c.end=xa(ba(y(c),p,true),L);ua(c,qa)}}var da=this;da.element=a;da.calendar=b;da.name=e;da.opt=
|
||||
d;da.trigger=f;da.isEventDraggable=g;da.isEventResizable=l;da.reportEvents=t;da.eventEnd=y;da.reportEventElement=S;da.reportEventClear=Q;da.eventElementHandlers=q;da.showEvents=u;da.hideEvents=fa;da.eventDrop=ga;da.eventResize=ra;var ma=da.defaultEventEnd,ua=b.normalizeEvent,pa=b.reportEventChange,U={},ca=[],ka={},qa=b.options}function Qb(){function a(i,C){var P=z(),E=pa(),B=U(),n=0,Y,W,o=i.length,s,v;P[0].innerHTML=e(i);d(i,P.children());f(i);g(i,P,C);l(i);j(i);t(i);C=y();for(P=0;P<E;P++){Y=[];for(W=
|
||||
0;W<B;W++)Y[W]=0;for(;n<o&&(s=i[n]).row==P;){W=Hb(Y.slice(s.startCol,s.endCol));s.top=W;W+=s.outerHeight;for(v=s.startCol;v<s.endCol;v++)Y[v]=W;n++}C[P].height(Hb(Y))}Q(i,S(C))}function b(i,C,P){var E=m("<div/>"),B=z(),n=i.length,Y;E[0].innerHTML=e(i);E=E.children();B.append(E);d(i,E);l(i);j(i);t(i);Q(i,S(y()));E=[];for(B=0;B<n;B++)if(Y=i[B].element){i[B].row===C&&Y.css("top",P);E.push(Y[0])}return m(E)}function e(i){var C=fa("isRTL"),P,E=i.length,B,n,Y,W;P=ka();var o=P.left,s=P.right,v,F,r,J,M,k=
|
||||
"";for(P=0;P<E;P++){B=i[P];n=B.event;W=["fc-event","fc-event-skin","fc-event-hori"];ga(n)&&W.push("fc-event-draggable");if(C){B.isStart&&W.push("fc-corner-right");B.isEnd&&W.push("fc-corner-left");v=p(B.end.getDay()-1);F=p(B.start.getDay());r=B.isEnd?qa(v):o;J=B.isStart?G(F):s}else{B.isStart&&W.push("fc-corner-left");B.isEnd&&W.push("fc-corner-right");v=p(B.start.getDay());F=p(B.end.getDay()-1);r=B.isStart?qa(v):o;J=B.isEnd?G(F):s}W=W.concat(n.className);if(n.source)W=W.concat(n.source.className||
|
||||
[]);Y=n.url;M=Jb(n,fa);k+=Y?"<a href='"+Qa(Y)+"'":"<div";k+=" class='"+W.join(" ")+"' style='position:absolute;z-index:8;left:"+r+"px;"+M+"'><div class='fc-event-inner fc-event-skin'"+(M?" style='"+M+"'":"")+">";if(!n.allDay&&B.isStart)k+="<span class='fc-event-time'>"+Qa(T(n.start,n.end,fa("timeFormat")))+" </span>";k+="<span class='fc-event-title'>"+Qa(n.title)+"</span></div>";if(B.isEnd&&ra(n))k+="<div class='ui-resizable-handle ui-resizable-"+(C?"w":"e")+"'> </div>";k+="</"+(Y?
|
||||
"a":"div")+">";B.left=r;B.outerWidth=J-r;B.startCol=v;B.endCol=F+1}return k}function d(i,C){var P,E=i.length,B,n,Y;for(P=0;P<E;P++){B=i[P];n=B.event;Y=m(C[P]);n=na("eventRender",n,n,Y);if(n===false)Y.remove();else{if(n&&n!==true){n=m(n).css({position:"absolute",left:B.left});Y.replaceWith(n);Y=n}B.element=Y}}}function f(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];(B=E.element)&&ha(E.event,B)}}function g(i,C,P){var E,B=i.length,n,Y,W;for(E=0;E<B;E++){n=i[E];if(Y=n.element){W=n.event;if(W._id===
|
||||
P)H(W,Y,n);else Y[0]._fci=E}}Db(C,i,H)}function l(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key=Ib(B[0]);Y=W[n];if(Y===oa)Y=W[n]=pb(B,true);E.hsides=Y}}}function j(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];if(B=E.element)B[0].style.width=Math.max(0,E.outerWidth-E.hsides)+"px"}}function t(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key;Y=W[n];if(Y===oa)Y=W[n]=Fb(B);E.outerHeight=B[0].offsetHeight+Y}}}function y(){var i,C=pa(),
|
||||
P=[];for(i=0;i<C;i++)P[i]=ca(i).find("td:first div.fc-day-content > div");return P}function S(i){var C,P=i.length,E=[];for(C=0;C<P;C++)E[C]=i[C][0].offsetTop;return E}function Q(i,C){var P,E=i.length,B,n;for(P=0;P<E;P++){B=i[P];if(n=B.element){n[0].style.top=C[B.row]+(B.top||0)+"px";B=B.event;na("eventAfterRender",B,B,n)}}}function q(i,C,P){var E=fa("isRTL"),B=E?"w":"e",n=C.find("div.ui-resizable-"+B),Y=false;qb(C);C.mousedown(function(W){W.preventDefault()}).click(function(W){if(Y){W.preventDefault();
|
||||
W.stopImmediatePropagation()}});n.mousedown(function(W){function o(ia){na("eventResizeStop",this,i,ia);m("body").css("cursor","");s.stop();ya();k&&ua(this,i,k,0,ia);setTimeout(function(){Y=false},0)}if(W.which==1){Y=true;var s=u.getHoverListener(),v=pa(),F=U(),r=E?-1:1,J=E?F-1:0,M=C.css("top"),k,D,Z=m.extend({},i),ja=L(i.start);K();m("body").css("cursor",B+"-resize").one("mouseup",o);na("eventResizeStart",this,i,W);s.start(function(ia,la){if(ia){var $=Math.max(ja.row,ia.row);ia=ia.col;if(v==1)$=0;
|
||||
if($==ja.row)ia=E?Math.min(ja.col,ia):Math.max(ja.col,ia);k=$*7+ia*r+J-(la.row*7+la.col*r+J);la=ba(sa(i),k,true);if(k){Z.end=la;$=D;D=b(c([Z]),P.row,M);D.find("*").css("cursor",B+"-resize");$&&$.remove();ma(i)}else if(D){da(i);D.remove();D=null}ya();X(i.start,ba(N(la),1))}},W)}})}var u=this;u.renderDaySegs=a;u.resizableDayEvent=q;var fa=u.opt,na=u.trigger,ga=u.isEventDraggable,ra=u.isEventResizable,sa=u.eventEnd,ha=u.reportEventElement,da=u.showEvents,ma=u.hideEvents,ua=u.eventResize,pa=u.getRowCnt,
|
||||
U=u.getColCnt,ca=u.allDayRow,ka=u.allDayBounds,qa=u.colContentLeft,G=u.colContentRight,p=u.dayOfWeekCol,L=u.dateCell,c=u.compileDaySegs,z=u.getDaySegmentContainer,H=u.bindDaySeg,T=u.calendar.formatDates,X=u.renderDayOverlay,ya=u.clearOverlays,K=u.clearSelection}function Mb(){function a(Q,q,u){b();q||(q=j(Q,u));t(Q,q,u);e(Q,q,u)}function b(Q){if(S){S=false;y();l("unselect",null,Q)}}function e(Q,q,u,fa){S=true;l("select",null,Q,q,u,fa)}function d(Q){var q=f.cellDate,u=f.cellIsAllDay,fa=f.getHoverListener(),
|
||||
na=f.reportDayClick;if(Q.which==1&&g("selectable")){b(Q);var ga;fa.start(function(ra,sa){y();if(ra&&u(ra)){ga=[q(sa),q(ra)].sort(Gb);t(ga[0],ga[1],true)}else ga=null},Q);m(document).one("mouseup",function(ra){fa.stop();if(ga){+ga[0]==+ga[1]&&na(ga[0],true,ra);e(ga[0],ga[1],true,ra)}})}}var f=this;f.select=a;f.unselect=b;f.reportSelection=e;f.daySelectionMousedown=d;var g=f.opt,l=f.trigger,j=f.defaultSelectionEnd,t=f.renderSelection,y=f.clearSelection,S=false;g("selectable")&&g("unselectAuto")&&m(document).mousedown(function(Q){var q=
|
||||
g("unselectCancel");if(q)if(m(Q.target).parents(q).length)return;b(Q)})}function Lb(){function a(g,l){var j=f.shift();j||(j=m("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"));j[0].parentNode!=l[0]&&j.appendTo(l);d.push(j.css(g).show());return j}function b(){for(var g;g=d.shift();)f.push(g.hide().unbind())}var e=this;e.renderOverlay=a;e.clearOverlays=b;var d=[],f=[]}function Nb(a){var b=this,e,d;b.build=function(){e=[];d=[];a(e,d)};b.cell=function(f,g){var l=e.length,j=d.length,
|
||||
t,y=-1,S=-1;for(t=0;t<l;t++)if(g>=e[t][0]&&g<e[t][1]){y=t;break}for(t=0;t<j;t++)if(f>=d[t][0]&&f<d[t][1]){S=t;break}return y>=0&&S>=0?{row:y,col:S}:null};b.rect=function(f,g,l,j,t){t=t.offset();return{top:e[f][0]-t.top,left:d[g][0]-t.left,width:d[j][1]-d[g][0],height:e[l][1]-e[f][0]}}}function Ob(a){function b(j){j=a.cell(j.pageX,j.pageY);if(!j!=!l||j&&(j.row!=l.row||j.col!=l.col)){if(j){g||(g=j);f(j,g,j.row-g.row,j.col-g.col)}else f(j,g);l=j}}var e=this,d,f,g,l;e.start=function(j,t,y){f=j;g=l=null;
|
||||
a.build();b(t);d=y||"mousemove";m(document).bind(d,b)};e.stop=function(){m(document).unbind(d,b);return l}}function Pb(a){function b(l){return d[l]=d[l]||a(l)}var e=this,d={},f={},g={};e.left=function(l){return f[l]=f[l]===oa?b(l).position().left:f[l]};e.right=function(l){return g[l]=g[l]===oa?e.left(l)+b(l).width():g[l]};e.clear=function(){d={};f={};g={}}}var Ya={defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:true,allDayDefault:true,ignoreTimezone:true,
|
||||
lazyFetching:true,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '—'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:false,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday",
|
||||
"Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"",next:"",prevYear:" << ",nextYear:" >> ",today:"",month:"month",week:"week",day:"day"},theme:false,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:true,dropAccept:"*"},xc={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:" ► ",next:" ◄ ",
|
||||
prevYear:" >> ",nextYear:" << "},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},Aa=m.fullCalendar={version:"1.5.2"},Ja=Aa.views={};m.fn.fullCalendar=function(a){if(typeof a=="string"){var b=Array.prototype.slice.call(arguments,1),e;this.each(function(){var f=m.data(this,"fullCalendar");if(f&&m.isFunction(f[a])){f=f[a].apply(f,b);if(e===oa)e=f;a=="destroy"&&m.removeData(this,"fullCalendar")}});if(e!==oa)return e;return this}var d=a.eventSources||[];
|
||||
delete a.eventSources;if(a.events){d.push(a.events);delete a.events}a=m.extend(true,{},Ya,a.isRTL||a.isRTL===oa&&Ya.isRTL?xc:{},a);this.each(function(f,g){f=m(g);g=new Yb(f,a,d);f.data("fullCalendar",g);g.render()});return this};Aa.sourceNormalizers=[];Aa.sourceFetchers=[];var ac={dataType:"json",cache:false},bc=1;Aa.addDays=ba;Aa.cloneDate=N;Aa.parseDate=kb;Aa.parseISO8601=Bb;Aa.parseTime=mb;Aa.formatDate=Oa;Aa.formatDates=ib;var lc=["sun","mon","tue","wed","thu","fri","sat"],Ab=864E5,cc=36E5,wc=
|
||||
6E4,dc={s:function(a){return a.getSeconds()},ss:function(a){return Pa(a.getSeconds())},m:function(a){return a.getMinutes()},mm:function(a){return Pa(a.getMinutes())},h:function(a){return a.getHours()%12||12},hh:function(a){return Pa(a.getHours()%12||12)},H:function(a){return a.getHours()},HH:function(a){return Pa(a.getHours())},d:function(a){return a.getDate()},dd:function(a){return Pa(a.getDate())},ddd:function(a,b){return b.dayNamesShort[a.getDay()]},dddd:function(a,b){return b.dayNames[a.getDay()]},
|
||||
M:function(a){return a.getMonth()+1},MM:function(a){return Pa(a.getMonth()+1)},MMM:function(a,b){return b.monthNamesShort[a.getMonth()]},MMMM:function(a,b){return b.monthNames[a.getMonth()]},yy:function(a){return(a.getFullYear()+"").substring(2)},yyyy:function(a){return a.getFullYear()},t:function(a){return a.getHours()<12?"a":"p"},tt:function(a){return a.getHours()<12?"am":"pm"},T:function(a){return a.getHours()<12?"A":"P"},TT:function(a){return a.getHours()<12?"AM":"PM"},u:function(a){return Oa(a,
|
||||
"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(a){a=a.getDate();if(a>10&&a<20)return"th";return["st","nd","rd"][a%10-1]||"th"}};Aa.applyAll=$a;Ja.month=mc;Ja.basicWeek=nc;Ja.basicDay=oc;wb({weekMode:"fixed"});Ja.agendaWeek=qc;Ja.agendaDay=rc;wb({allDaySlot:true,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,maxTime:24})})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,185 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
|
||||
/*
|
||||
Easy pie chart is a jquery plugin to display simple animated pie charts for only one value
|
||||
|
||||
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
|
||||
Built on top of the jQuery library (http://jquery.com)
|
||||
|
||||
@source: http://github.com/rendro/easy-pie-chart/
|
||||
@autor: Robert Fleischmann
|
||||
@version: 1.0.1
|
||||
|
||||
Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210
|
||||
Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
(function($) {
|
||||
$.easyPieChart = function(el, options) {
|
||||
var addScaleLine, animateLine, drawLine, easeInOutQuad, renderBackground, renderScale, renderTrack,
|
||||
_this = this;
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.$el.data("easyPieChart", this);
|
||||
this.init = function() {
|
||||
var percent;
|
||||
_this.options = $.extend({}, $.easyPieChart.defaultOptions, options);
|
||||
percent = parseInt(_this.$el.data('percent'), 10);
|
||||
_this.percentage = 0;
|
||||
_this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0);
|
||||
_this.$el.append(_this.canvas);
|
||||
if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) {
|
||||
G_vmlCanvasManager.initElement(_this.canvas);
|
||||
}
|
||||
_this.ctx = _this.canvas.getContext('2d');
|
||||
if (window.devicePixelRatio > 1.5) {
|
||||
$(_this.canvas).css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size
|
||||
});
|
||||
_this.canvas.width *= 2;
|
||||
_this.canvas.height *= 2;
|
||||
_this.ctx.scale(2, 2);
|
||||
}
|
||||
_this.ctx.translate(_this.options.size / 2, _this.options.size / 2);
|
||||
_this.$el.addClass('easyPieChart');
|
||||
_this.$el.css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size,
|
||||
lineHeight: "" + _this.options.size + "px"
|
||||
});
|
||||
_this.update(percent);
|
||||
return _this;
|
||||
};
|
||||
this.update = function(percent) {
|
||||
if (_this.options.animate === false) {
|
||||
return drawLine(percent);
|
||||
} else {
|
||||
return animateLine(_this.percentage, percent);
|
||||
}
|
||||
};
|
||||
renderScale = function() {
|
||||
var i, _i, _results;
|
||||
_this.ctx.fillStyle = _this.options.scaleColor;
|
||||
_this.ctx.lineWidth = 1;
|
||||
_results = [];
|
||||
for (i = _i = 0; _i <= 24; i = ++_i) {
|
||||
_results.push(addScaleLine(i));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
addScaleLine = function(i) {
|
||||
var offset;
|
||||
offset = i % 6 === 0 ? 0 : _this.options.size * 0.017;
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(i * Math.PI / 12);
|
||||
_this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1);
|
||||
return _this.ctx.restore();
|
||||
};
|
||||
renderTrack = function() {
|
||||
var offset;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true);
|
||||
_this.ctx.closePath();
|
||||
_this.ctx.strokeStyle = _this.options.trackColor;
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
return _this.ctx.stroke();
|
||||
};
|
||||
renderBackground = function() {
|
||||
if (_this.options.scaleColor !== false) {
|
||||
renderScale();
|
||||
}
|
||||
if (_this.options.trackColor !== false) {
|
||||
return renderTrack();
|
||||
}
|
||||
};
|
||||
drawLine = function(percent) {
|
||||
var offset;
|
||||
renderBackground();
|
||||
_this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor;
|
||||
_this.ctx.lineCap = _this.options.lineCap;
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(-Math.PI / 2);
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false);
|
||||
_this.ctx.stroke();
|
||||
return _this.ctx.restore();
|
||||
};
|
||||
animateLine = function(from, to) {
|
||||
var currentStep, fps, steps;
|
||||
fps = 30;
|
||||
steps = fps * _this.options.animate / 1000;
|
||||
currentStep = 0;
|
||||
_this.options.onStart.call(_this);
|
||||
_this.percentage = to;
|
||||
if (_this.animation) {
|
||||
clearInterval(_this.animation);
|
||||
_this.animation = false;
|
||||
}
|
||||
return _this.animation = setInterval(function() {
|
||||
_this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size);
|
||||
renderBackground.call(_this);
|
||||
drawLine.call(_this, [easeInOutQuad(currentStep, from, to - from, steps)]);
|
||||
currentStep++;
|
||||
if ((currentStep / steps) > 1) {
|
||||
clearInterval(_this.animation);
|
||||
_this.animation = false;
|
||||
return _this.options.onStop.call(_this);
|
||||
}
|
||||
}, 1000 / fps);
|
||||
};
|
||||
easeInOutQuad = function(t, b, c, d) {
|
||||
var easeIn, easing;
|
||||
easeIn = function(t) {
|
||||
return Math.pow(t, 2);
|
||||
};
|
||||
easing = function(t) {
|
||||
if (t < 1) {
|
||||
return easeIn(t);
|
||||
} else {
|
||||
return 2 - easeIn((t / 2) * -2 + 2);
|
||||
}
|
||||
};
|
||||
t /= d / 2;
|
||||
return c / 2 * easing(t) + b;
|
||||
};
|
||||
return this.init();
|
||||
};
|
||||
$.easyPieChart.defaultOptions = {
|
||||
barColor: '#ef1e25',
|
||||
trackColor: '#f2f2f2',
|
||||
scaleColor: '#dfe0e0',
|
||||
lineCap: 'round',
|
||||
size: 110,
|
||||
lineWidth: 3,
|
||||
animate: false,
|
||||
onStart: $.noop,
|
||||
onStop: $.noop
|
||||
};
|
||||
$.fn.easyPieChart = function(options) {
|
||||
return $.each(this, function(i, el) {
|
||||
var $el;
|
||||
$el = $(el);
|
||||
if (!$el.data('easyPieChart')) {
|
||||
return $el.data('easyPieChart', new $.easyPieChart(el, options));
|
||||
}
|
||||
});
|
||||
};
|
||||
return void 0;
|
||||
})(jQuery);
|
||||
|
||||
}).call(this);
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
Flot plugin for showing crosshairs, thin lines, when the mouse hovers
|
||||
over the plot.
|
||||
|
||||
crosshair: {
|
||||
mode: null or "x" or "y" or "xy"
|
||||
color: color
|
||||
lineWidth: number
|
||||
}
|
||||
|
||||
Set the mode to one of "x", "y" or "xy". The "x" mode enables a
|
||||
vertical crosshair that lets you trace the values on the x axis, "y"
|
||||
enables a horizontal crosshair and "xy" enables them both. "color" is
|
||||
the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"),
|
||||
"lineWidth" is the width of the drawn lines (default is 1).
|
||||
|
||||
The plugin also adds four public methods:
|
||||
|
||||
- setCrosshair(pos)
|
||||
|
||||
Set the position of the crosshair. Note that this is cleared if
|
||||
the user moves the mouse. "pos" is in coordinates of the plot and
|
||||
should be on the form { x: xpos, y: ypos } (you can use x2/x3/...
|
||||
if you're using multiple axes), which is coincidentally the same
|
||||
format as what you get from a "plothover" event. If "pos" is null,
|
||||
the crosshair is cleared.
|
||||
|
||||
- clearCrosshair()
|
||||
|
||||
Clear the crosshair.
|
||||
|
||||
- lockCrosshair(pos)
|
||||
|
||||
Cause the crosshair to lock to the current location, no longer
|
||||
updating if the user moves the mouse. Optionally supply a position
|
||||
(passed on to setCrosshair()) to move it to.
|
||||
|
||||
Example usage:
|
||||
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
|
||||
$("#graph").bind("plothover", function (evt, position, item) {
|
||||
if (item) {
|
||||
// Lock the crosshair to the data point being hovered
|
||||
myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] });
|
||||
}
|
||||
else {
|
||||
// Return normal crosshair operation
|
||||
myFlot.unlockCrosshair();
|
||||
}
|
||||
});
|
||||
|
||||
- unlockCrosshair()
|
||||
|
||||
Free the crosshair to move again after locking it.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var options = {
|
||||
crosshair: {
|
||||
mode: null, // one of null, "x", "y" or "xy",
|
||||
color: "rgba(170, 0, 0, 0.80)",
|
||||
lineWidth: 1
|
||||
}
|
||||
};
|
||||
|
||||
function init(plot) {
|
||||
// position of crosshair in pixels
|
||||
var crosshair = { x: -1, y: -1, locked: false };
|
||||
|
||||
plot.setCrosshair = function setCrosshair(pos) {
|
||||
if (!pos)
|
||||
crosshair.x = -1;
|
||||
else {
|
||||
var o = plot.p2c(pos);
|
||||
crosshair.x = Math.max(0, Math.min(o.left, plot.width()));
|
||||
crosshair.y = Math.max(0, Math.min(o.top, plot.height()));
|
||||
}
|
||||
|
||||
plot.triggerRedrawOverlay();
|
||||
};
|
||||
|
||||
plot.clearCrosshair = plot.setCrosshair; // passes null for pos
|
||||
|
||||
plot.lockCrosshair = function lockCrosshair(pos) {
|
||||
if (pos)
|
||||
plot.setCrosshair(pos);
|
||||
crosshair.locked = true;
|
||||
}
|
||||
|
||||
plot.unlockCrosshair = function unlockCrosshair() {
|
||||
crosshair.locked = false;
|
||||
}
|
||||
|
||||
function onMouseOut(e) {
|
||||
if (crosshair.locked)
|
||||
return;
|
||||
|
||||
if (crosshair.x != -1) {
|
||||
crosshair.x = -1;
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseMove(e) {
|
||||
if (crosshair.locked)
|
||||
return;
|
||||
|
||||
if (plot.getSelection && plot.getSelection()) {
|
||||
crosshair.x = -1; // hide the crosshair while selecting
|
||||
return;
|
||||
}
|
||||
|
||||
var offset = plot.offset();
|
||||
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
|
||||
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
|
||||
plot.hooks.bindEvents.push(function (plot, eventHolder) {
|
||||
if (!plot.getOptions().crosshair.mode)
|
||||
return;
|
||||
|
||||
eventHolder.mouseout(onMouseOut);
|
||||
eventHolder.mousemove(onMouseMove);
|
||||
});
|
||||
|
||||
plot.hooks.drawOverlay.push(function (plot, ctx) {
|
||||
var c = plot.getOptions().crosshair;
|
||||
if (!c.mode)
|
||||
return;
|
||||
|
||||
var plotOffset = plot.getPlotOffset();
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(plotOffset.left, plotOffset.top);
|
||||
|
||||
if (crosshair.x != -1) {
|
||||
ctx.strokeStyle = c.color;
|
||||
ctx.lineWidth = c.lineWidth;
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
if (c.mode.indexOf("x") != -1) {
|
||||
ctx.moveTo(crosshair.x, 0);
|
||||
ctx.lineTo(crosshair.x, plot.height());
|
||||
}
|
||||
if (c.mode.indexOf("y") != -1) {
|
||||
ctx.moveTo(0, crosshair.y);
|
||||
ctx.lineTo(plot.width(), crosshair.y);
|
||||
}
|
||||
ctx.stroke();
|
||||
}
|
||||
ctx.restore();
|
||||
});
|
||||
|
||||
plot.hooks.shutdown.push(function (plot, eventHolder) {
|
||||
eventHolder.unbind("mouseout", onMouseOut);
|
||||
eventHolder.unbind("mousemove", onMouseMove);
|
||||
});
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'crosshair',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,750 @@
|
||||
/*
|
||||
Flot plugin for rendering pie charts. The plugin assumes the data is
|
||||
coming is as a single data value for each series, and each of those
|
||||
values is a positive value or zero (negative numbers don't make
|
||||
any sense and will cause strange effects). The data values do
|
||||
NOT need to be passed in as percentage values because it
|
||||
internally calculates the total and percentages.
|
||||
|
||||
* Created by Brian Medendorp, June 2009
|
||||
* Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars
|
||||
|
||||
* Changes:
|
||||
2009-10-22: lineJoin set to round
|
||||
2009-10-23: IE full circle fix, donut
|
||||
2009-11-11: Added basic hover from btburnett3 - does not work in IE, and center is off in Chrome and Opera
|
||||
2009-11-17: Added IE hover capability submitted by Anthony Aragues
|
||||
2009-11-18: Added bug fix submitted by Xavi Ivars (issues with arrays when other JS libraries are included as well)
|
||||
|
||||
|
||||
Available options are:
|
||||
series: {
|
||||
pie: {
|
||||
show: true/false
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
||||
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
||||
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
||||
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
||||
offset: {
|
||||
top: integer value to move the pie up or down
|
||||
left: integer value to move the pie left or right, or 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
||||
width: integer pixel width of the stroke
|
||||
},
|
||||
label: {
|
||||
show: true/false, or 'auto'
|
||||
formatter: a user-defined function that modifies the text/style of the label text
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
||||
background: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
||||
opacity: 0-1
|
||||
},
|
||||
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
||||
},
|
||||
combine: {
|
||||
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
||||
label: any text value of what the combined slice should be labeled
|
||||
}
|
||||
highlight: {
|
||||
opacity: 0-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
More detail and specific examples can be found in the included HTML file.
|
||||
|
||||
*/
|
||||
|
||||
(function ($)
|
||||
{
|
||||
function init(plot) // this is the "body" of the plugin
|
||||
{
|
||||
var canvas = null;
|
||||
var target = null;
|
||||
var maxRadius = null;
|
||||
var centerLeft = null;
|
||||
var centerTop = null;
|
||||
var total = 0;
|
||||
var redraw = true;
|
||||
var redrawAttempts = 10;
|
||||
var shrink = 0.95;
|
||||
var legendWidth = 0;
|
||||
var processed = false;
|
||||
var raw = false;
|
||||
|
||||
// interactive variables
|
||||
var highlights = [];
|
||||
|
||||
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
||||
plot.hooks.processOptions.push(checkPieEnabled);
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
|
||||
// check to see if the pie plugin is enabled
|
||||
function checkPieEnabled(plot, options)
|
||||
{
|
||||
if (options.series.pie.show)
|
||||
{
|
||||
//disable grid
|
||||
options.grid.show = false;
|
||||
|
||||
// set labels.show
|
||||
if (options.series.pie.label.show=='auto')
|
||||
if (options.legend.show)
|
||||
options.series.pie.label.show = false;
|
||||
else
|
||||
options.series.pie.label.show = true;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius=='auto')
|
||||
if (options.series.pie.label.show)
|
||||
options.series.pie.radius = 3/4;
|
||||
else
|
||||
options.series.pie.radius = 1;
|
||||
|
||||
// ensure sane tilt
|
||||
if (options.series.pie.tilt>1)
|
||||
options.series.pie.tilt=1;
|
||||
if (options.series.pie.tilt<0)
|
||||
options.series.pie.tilt=0;
|
||||
|
||||
// add processData hook to do transformations on the data
|
||||
plot.hooks.processDatapoints.push(processDatapoints);
|
||||
plot.hooks.drawOverlay.push(drawOverlay);
|
||||
|
||||
// add draw hook
|
||||
plot.hooks.draw.push(draw);
|
||||
}
|
||||
}
|
||||
|
||||
// bind hoverable events
|
||||
function bindEvents(plot, eventHolder)
|
||||
{
|
||||
var options = plot.getOptions();
|
||||
|
||||
if (options.series.pie.show && options.grid.hoverable)
|
||||
eventHolder.unbind('mousemove').mousemove(onMouseMove);
|
||||
|
||||
if (options.series.pie.show && options.grid.clickable)
|
||||
eventHolder.unbind('click').click(onClick);
|
||||
}
|
||||
|
||||
|
||||
// debugging function that prints out an object
|
||||
function alertObject(obj)
|
||||
{
|
||||
var msg = '';
|
||||
function traverse(obj, depth)
|
||||
{
|
||||
if (!depth)
|
||||
depth = 0;
|
||||
for (var i = 0; i < obj.length; ++i)
|
||||
{
|
||||
for (var j=0; j<depth; j++)
|
||||
msg += '\t';
|
||||
|
||||
if( typeof obj[i] == "object")
|
||||
{ // its an object
|
||||
msg += ''+i+':\n';
|
||||
traverse(obj[i], depth+1);
|
||||
}
|
||||
else
|
||||
{ // its a value
|
||||
msg += ''+i+': '+obj[i]+'\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
traverse(obj);
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
function calcTotal(data)
|
||||
{
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
var item = parseFloat(data[i].data[0][1]);
|
||||
if (item)
|
||||
total += item;
|
||||
}
|
||||
}
|
||||
|
||||
function processDatapoints(plot, series, data, datapoints)
|
||||
{
|
||||
if (!processed)
|
||||
{
|
||||
processed = true;
|
||||
|
||||
canvas = plot.getCanvas();
|
||||
target = $(canvas).parent();
|
||||
options = plot.getOptions();
|
||||
|
||||
plot.setData(combine(plot.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
function setupPie()
|
||||
{
|
||||
legendWidth = target.children().filter('.legend').children().width();
|
||||
|
||||
// calculate maximum radius and center point
|
||||
maxRadius = Math.min(canvas.width,(canvas.height/options.series.pie.tilt))/2;
|
||||
centerTop = (canvas.height/2)+options.series.pie.offset.top;
|
||||
centerLeft = (canvas.width/2);
|
||||
|
||||
if (options.series.pie.offset.left=='auto')
|
||||
if (options.legend.position.match('w'))
|
||||
centerLeft += legendWidth/2;
|
||||
else
|
||||
centerLeft -= legendWidth/2;
|
||||
else
|
||||
centerLeft += options.series.pie.offset.left;
|
||||
|
||||
if (centerLeft<maxRadius)
|
||||
centerLeft = maxRadius;
|
||||
else if (centerLeft>canvas.width-maxRadius)
|
||||
centerLeft = canvas.width-maxRadius;
|
||||
}
|
||||
|
||||
function fixData(data)
|
||||
{
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
if (typeof(data[i].data)=='number')
|
||||
data[i].data = [[1,data[i].data]];
|
||||
else if (typeof(data[i].data)=='undefined' || typeof(data[i].data[0])=='undefined')
|
||||
{
|
||||
if (typeof(data[i].data)!='undefined' && typeof(data[i].data.label)!='undefined')
|
||||
data[i].label = data[i].data.label; // fix weirdness coming from flot
|
||||
data[i].data = [[1,0]];
|
||||
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function combine(data)
|
||||
{
|
||||
data = fixData(data);
|
||||
calcTotal(data);
|
||||
var combined = 0;
|
||||
var numCombined = 0;
|
||||
var color = options.series.pie.combine.color;
|
||||
|
||||
var newdata = [];
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
// make sure its a number
|
||||
data[i].data[0][1] = parseFloat(data[i].data[0][1]);
|
||||
if (!data[i].data[0][1])
|
||||
data[i].data[0][1] = 0;
|
||||
|
||||
if (data[i].data[0][1]/total<=options.series.pie.combine.threshold)
|
||||
{
|
||||
combined += data[i].data[0][1];
|
||||
numCombined++;
|
||||
if (!color)
|
||||
color = data[i].color;
|
||||
}
|
||||
else
|
||||
{
|
||||
newdata.push({
|
||||
data: [[1,data[i].data[0][1]]],
|
||||
color: data[i].color,
|
||||
label: data[i].label,
|
||||
angle: (data[i].data[0][1]*(Math.PI*2))/total,
|
||||
percent: (data[i].data[0][1]/total*100)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (numCombined>0)
|
||||
newdata.push({
|
||||
data: [[1,combined]],
|
||||
color: color,
|
||||
label: options.series.pie.combine.label,
|
||||
angle: (combined*(Math.PI*2))/total,
|
||||
percent: (combined/total*100)
|
||||
});
|
||||
return newdata;
|
||||
}
|
||||
|
||||
function draw(plot, newCtx)
|
||||
{
|
||||
if (!target) return; // if no series were passed
|
||||
ctx = newCtx;
|
||||
|
||||
setupPie();
|
||||
var slices = plot.getData();
|
||||
|
||||
var attempts = 0;
|
||||
while (redraw && attempts<redrawAttempts)
|
||||
{
|
||||
redraw = false;
|
||||
if (attempts>0)
|
||||
maxRadius *= shrink;
|
||||
attempts += 1;
|
||||
clear();
|
||||
if (options.series.pie.tilt<=0.8)
|
||||
drawShadow();
|
||||
drawPie();
|
||||
}
|
||||
if (attempts >= redrawAttempts) {
|
||||
clear();
|
||||
target.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>');
|
||||
}
|
||||
|
||||
if ( plot.setSeries && plot.insertLegend )
|
||||
{
|
||||
plot.setSeries(slices);
|
||||
plot.insertLegend();
|
||||
}
|
||||
|
||||
// we're actually done at this point, just defining internal functions at this point
|
||||
|
||||
function clear()
|
||||
{
|
||||
ctx.clearRect(0,0,canvas.width,canvas.height);
|
||||
target.children().filter('.pieLabel, .pieLabelBackground').remove();
|
||||
}
|
||||
|
||||
function drawShadow()
|
||||
{
|
||||
var shadowLeft = 5;
|
||||
var shadowTop = 15;
|
||||
var edge = 10;
|
||||
var alpha = 0.02;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius>1)
|
||||
var radius = options.series.pie.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.radius;
|
||||
|
||||
if (radius>=(canvas.width/2)-shadowLeft || radius*options.series.pie.tilt>=(canvas.height/2)-shadowTop || radius<=edge)
|
||||
return; // shadow would be outside canvas, so don't draw it
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(shadowLeft,shadowTop);
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.fillStyle = '#000';
|
||||
|
||||
// center and rotate to starting position
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
|
||||
//radius -= edge;
|
||||
for (var i=1; i<=edge; i++)
|
||||
{
|
||||
ctx.beginPath();
|
||||
ctx.arc(0,0,radius,0,Math.PI*2,false);
|
||||
ctx.fill();
|
||||
radius -= i;
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawPie()
|
||||
{
|
||||
startAngle = Math.PI*options.series.pie.startAngle;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius>1)
|
||||
var radius = options.series.pie.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.radius;
|
||||
|
||||
// center and rotate to starting position
|
||||
ctx.save();
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
||||
|
||||
// draw slices
|
||||
ctx.save();
|
||||
var currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
slices[i].startAngle = currentAngle;
|
||||
drawSlice(slices[i].angle, slices[i].color, true);
|
||||
}
|
||||
ctx.restore();
|
||||
|
||||
// draw slice outlines
|
||||
ctx.save();
|
||||
ctx.lineWidth = options.series.pie.stroke.width;
|
||||
currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
||||
ctx.restore();
|
||||
|
||||
// draw donut hole
|
||||
drawDonutHole(ctx);
|
||||
|
||||
// draw labels
|
||||
if (options.series.pie.label.show)
|
||||
drawLabels();
|
||||
|
||||
// restore to original state
|
||||
ctx.restore();
|
||||
|
||||
function drawSlice(angle, color, fill)
|
||||
{
|
||||
if (angle<=0)
|
||||
return;
|
||||
|
||||
if (fill)
|
||||
ctx.fillStyle = color;
|
||||
else
|
||||
{
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineJoin = 'round';
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
if (Math.abs(angle - Math.PI*2) > 0.000000001)
|
||||
ctx.moveTo(0,0); // Center of the pie
|
||||
else if ($.browser.msie)
|
||||
angle -= 0.0001;
|
||||
//ctx.arc(0,0,radius,0,angle,false); // This doesn't work properly in Opera
|
||||
ctx.arc(0,0,radius,currentAngle,currentAngle+angle,false);
|
||||
ctx.closePath();
|
||||
//ctx.rotate(angle); // This doesn't work properly in Opera
|
||||
currentAngle += angle;
|
||||
|
||||
if (fill)
|
||||
ctx.fill();
|
||||
else
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function drawLabels()
|
||||
{
|
||||
var currentAngle = startAngle;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.label.radius>1)
|
||||
var radius = options.series.pie.label.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.label.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
if (slices[i].percent >= options.series.pie.label.threshold*100)
|
||||
drawLabel(slices[i], currentAngle, i);
|
||||
currentAngle += slices[i].angle;
|
||||
}
|
||||
|
||||
function drawLabel(slice, startAngle, index)
|
||||
{
|
||||
if (slice.data[0][1]==0)
|
||||
return;
|
||||
|
||||
// format label text
|
||||
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
||||
if (lf)
|
||||
text = lf(slice.label, slice);
|
||||
else
|
||||
text = slice.label;
|
||||
if (plf)
|
||||
text = plf(text, slice);
|
||||
|
||||
var halfAngle = ((startAngle+slice.angle) + startAngle)/2;
|
||||
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
||||
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
||||
|
||||
var html = '<span class="pieLabel" id="pieLabel'+index+'" style="position:absolute;top:' + y + 'px;left:' + x + 'px;">' + text + "</span>";
|
||||
target.append(html);
|
||||
var label = target.children('#pieLabel'+index);
|
||||
var labelTop = (y - label.height()/2);
|
||||
var labelLeft = (x - label.width()/2);
|
||||
label.css('top', labelTop);
|
||||
label.css('left', labelLeft);
|
||||
|
||||
// check to make sure that the label is not outside the canvas
|
||||
if (0-labelTop>0 || 0-labelLeft>0 || canvas.height-(labelTop+label.height())<0 || canvas.width-(labelLeft+label.width())<0)
|
||||
redraw = true;
|
||||
|
||||
if (options.series.pie.label.background.opacity != 0) {
|
||||
// put in the transparent background separately to avoid blended labels and label boxes
|
||||
var c = options.series.pie.label.background.color;
|
||||
if (c == null) {
|
||||
c = slice.color;
|
||||
}
|
||||
var pos = 'top:'+labelTop+'px;left:'+labelLeft+'px;';
|
||||
$('<div class="pieLabelBackground" style="position:absolute;width:' + label.width() + 'px;height:' + label.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').insertBefore(label).css('opacity', options.series.pie.label.background.opacity);
|
||||
}
|
||||
} // end individual label function
|
||||
} // end drawLabels function
|
||||
} // end drawPie function
|
||||
} // end draw function
|
||||
|
||||
// Placed here because it needs to be accessed from multiple locations
|
||||
function drawDonutHole(layer)
|
||||
{
|
||||
// draw donut hole
|
||||
if(options.series.pie.innerRadius > 0)
|
||||
{
|
||||
// subtract the center
|
||||
layer.save();
|
||||
innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
||||
layer.globalCompositeOperation = 'destination-out'; // this does not work with excanvas, but it will fall back to using the stroke color
|
||||
layer.beginPath();
|
||||
layer.fillStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0,0,innerRadius,0,Math.PI*2,false);
|
||||
layer.fill();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// add inner stroke
|
||||
layer.save();
|
||||
layer.beginPath();
|
||||
layer.strokeStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0,0,innerRadius,0,Math.PI*2,false);
|
||||
layer.stroke();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
||||
}
|
||||
}
|
||||
|
||||
//-- Additional Interactive related functions --
|
||||
|
||||
function isPointInPoly(poly, pt)
|
||||
{
|
||||
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
||||
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
||||
&& (c = !c);
|
||||
return c;
|
||||
}
|
||||
|
||||
function findNearbySlice(mouseX, mouseY)
|
||||
{
|
||||
var slices = plot.getData(),
|
||||
options = plot.getOptions(),
|
||||
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var s = slices[i];
|
||||
|
||||
if(s.pie.show)
|
||||
{
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0,0); // Center of the pie
|
||||
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
||||
ctx.arc(0,0,radius,s.startAngle,s.startAngle+s.angle,false);
|
||||
ctx.closePath();
|
||||
x = mouseX-centerLeft;
|
||||
y = mouseY-centerTop;
|
||||
if(ctx.isPointInPath)
|
||||
{
|
||||
if (ctx.isPointInPath(mouseX-centerLeft, mouseY-centerTop))
|
||||
{
|
||||
//alert('found slice!');
|
||||
ctx.restore();
|
||||
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
||||
p1X = (radius * Math.cos(s.startAngle));
|
||||
p1Y = (radius * Math.sin(s.startAngle));
|
||||
p2X = (radius * Math.cos(s.startAngle+(s.angle/4)));
|
||||
p2Y = (radius * Math.sin(s.startAngle+(s.angle/4)));
|
||||
p3X = (radius * Math.cos(s.startAngle+(s.angle/2)));
|
||||
p3Y = (radius * Math.sin(s.startAngle+(s.angle/2)));
|
||||
p4X = (radius * Math.cos(s.startAngle+(s.angle/1.5)));
|
||||
p4Y = (radius * Math.sin(s.startAngle+(s.angle/1.5)));
|
||||
p5X = (radius * Math.cos(s.startAngle+s.angle));
|
||||
p5Y = (radius * Math.sin(s.startAngle+s.angle));
|
||||
arrPoly = [[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]];
|
||||
arrPoint = [x,y];
|
||||
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
||||
if(isPointInPoly(arrPoly, arrPoint))
|
||||
{
|
||||
ctx.restore();
|
||||
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function onMouseMove(e)
|
||||
{
|
||||
triggerClickHoverEvent('plothover', e);
|
||||
}
|
||||
|
||||
function onClick(e)
|
||||
{
|
||||
triggerClickHoverEvent('plotclick', e);
|
||||
}
|
||||
|
||||
// trigger click or hover event (they send the same parameters so we share their code)
|
||||
function triggerClickHoverEvent(eventname, e)
|
||||
{
|
||||
var offset = plot.offset(),
|
||||
canvasX = parseInt(e.pageX - offset.left),
|
||||
canvasY = parseInt(e.pageY - offset.top),
|
||||
item = findNearbySlice(canvasX, canvasY);
|
||||
|
||||
if (options.grid.autoHighlight)
|
||||
{
|
||||
// clear auto-highlights
|
||||
for (var i = 0; i < highlights.length; ++i)
|
||||
{
|
||||
var h = highlights[i];
|
||||
if (h.auto == eventname && !(item && h.series == item.series))
|
||||
unhighlight(h.series);
|
||||
}
|
||||
}
|
||||
|
||||
// highlight the slice
|
||||
if (item)
|
||||
highlight(item.series, eventname);
|
||||
|
||||
// trigger any hover bind events
|
||||
var pos = { pageX: e.pageX, pageY: e.pageY };
|
||||
target.trigger(eventname, [ pos, item ]);
|
||||
}
|
||||
|
||||
function highlight(s, auto)
|
||||
{
|
||||
if (typeof s == "number")
|
||||
s = series[s];
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
if (i == -1)
|
||||
{
|
||||
highlights.push({ series: s, auto: auto });
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
else if (!auto)
|
||||
highlights[i].auto = false;
|
||||
}
|
||||
|
||||
function unhighlight(s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
highlights = [];
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
|
||||
if (typeof s == "number")
|
||||
s = series[s];
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
if (i != -1)
|
||||
{
|
||||
highlights.splice(i, 1);
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function indexOfHighlight(s)
|
||||
{
|
||||
for (var i = 0; i < highlights.length; ++i)
|
||||
{
|
||||
var h = highlights[i];
|
||||
if (h.series == s)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function drawOverlay(plot, octx)
|
||||
{
|
||||
//alert(options.series.pie.radius);
|
||||
var options = plot.getOptions();
|
||||
//alert(options.series.pie.radius);
|
||||
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
octx.save();
|
||||
octx.translate(centerLeft, centerTop);
|
||||
octx.scale(1, options.series.pie.tilt);
|
||||
|
||||
for (i = 0; i < highlights.length; ++i)
|
||||
drawHighlight(highlights[i].series);
|
||||
|
||||
drawDonutHole(octx);
|
||||
|
||||
octx.restore();
|
||||
|
||||
function drawHighlight(series)
|
||||
{
|
||||
if (series.angle < 0) return;
|
||||
|
||||
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
||||
octx.fillStyle = "rgba(255, 255, 255, "+options.series.pie.highlight.opacity+")"; // this is temporary until we have access to parseColor
|
||||
|
||||
octx.beginPath();
|
||||
if (Math.abs(series.angle - Math.PI*2) > 0.000000001)
|
||||
octx.moveTo(0,0); // Center of the pie
|
||||
octx.arc(0,0,radius,series.startAngle,series.startAngle+series.angle,false);
|
||||
octx.closePath();
|
||||
octx.fill();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // end init (plugin body)
|
||||
|
||||
// define pie specific options and their default values
|
||||
var options = {
|
||||
series: {
|
||||
pie: {
|
||||
show: false,
|
||||
radius: 'auto', // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
||||
innerRadius:0, /* for donut */
|
||||
startAngle: 3/2,
|
||||
tilt: 1,
|
||||
offset: {
|
||||
top: 0,
|
||||
left: 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: '#FFF',
|
||||
width: 1
|
||||
},
|
||||
label: {
|
||||
show: 'auto',
|
||||
formatter: function(label, slice){
|
||||
return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+label+'<br/>'+Math.round(slice.percent)+'%</div>';
|
||||
}, // formatter function
|
||||
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
||||
background: {
|
||||
color: null,
|
||||
opacity: 0
|
||||
},
|
||||
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
||||
},
|
||||
combine: {
|
||||
threshold: -1, // percentage at which to combine little slices into one larger slice
|
||||
color: null, // color to give the new slice (auto-generated if null)
|
||||
label: 'Other' // label to give the new slice
|
||||
},
|
||||
highlight: {
|
||||
//color: '#FFF', // will add this functionality once parseColor is available
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "pie",
|
||||
version: "1.0"
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
(function(n,p,u){var w=n([]),s=n.resize=n.extend(n.resize,{}),o,l="setTimeout",m="resize",t=m+"-special-event",v="delay",r="throttleWindow";s[v]=250;s[r]=true;n.event.special[m]={setup:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.add(a);n.data(this,t,{w:a.width(),h:a.height()});if(w.length===1){q()}},teardown:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.not(a);a.removeData(t);if(!w.length){clearTimeout(o)}},add:function(b){if(!s[r]&&this[l]){return false}var c;function a(d,h,g){var f=n(this),e=n.data(this,t);e.w=h!==u?h:f.width();e.h=g!==u?g:f.height();c.apply(this,arguments)}if(n.isFunction(b)){c=b;return a}else{c=b.handler;b.handler=a}}};function q(){o=p[l](function(){w.each(function(){var d=n(this),a=d.width(),b=d.height(),c=n.data(this,t);if(a!==c.w||b!==c.h){d.trigger(m,[c.w=a,c.h=b])}});q()},s[v])}})(jQuery,this);(function(b){var a={};function c(f){function e(){var h=f.getPlaceholder();if(h.width()==0||h.height()==0){return}f.resize();f.setupGrid();f.draw()}function g(i,h){i.getPlaceholder().resize(e)}function d(i,h){i.getPlaceholder().unbind("resize",e)}f.hooks.bindEvents.push(g);f.hooks.shutdown.push(d)}b.plot.plugins.push({init:c,options:a,name:"resize",version:"1.0"})})(jQuery);
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
Flot plugin for stacking data sets, i.e. putting them on top of each
|
||||
other, for accumulative graphs.
|
||||
|
||||
The plugin assumes the data is sorted on x (or y if stacking
|
||||
horizontally). For line charts, it is assumed that if a line has an
|
||||
undefined gap (from a null point), then the line above it should have
|
||||
the same gap - insert zeros instead of "null" if you want another
|
||||
behaviour. This also holds for the start and end of the chart. Note
|
||||
that stacking a mix of positive and negative values in most instances
|
||||
doesn't make sense (so it looks weird).
|
||||
|
||||
Two or more series are stacked when their "stack" attribute is set to
|
||||
the same key (which can be any number or string or just "true"). To
|
||||
specify the default stack, you can set
|
||||
|
||||
series: {
|
||||
stack: null or true or key (number/string)
|
||||
}
|
||||
|
||||
or specify it for a specific series
|
||||
|
||||
$.plot($("#placeholder"), [{ data: [ ... ], stack: true }])
|
||||
|
||||
The stacking order is determined by the order of the data series in
|
||||
the array (later series end up on top of the previous).
|
||||
|
||||
Internally, the plugin modifies the datapoints in each series, adding
|
||||
an offset to the y value. For line series, extra data points are
|
||||
inserted through interpolation. If there's a second y value, it's also
|
||||
adjusted (e.g for bar charts or filled areas).
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var options = {
|
||||
series: { stack: null } // or number/string
|
||||
};
|
||||
|
||||
function init(plot) {
|
||||
function findMatchingSeries(s, allseries) {
|
||||
var res = null
|
||||
for (var i = 0; i < allseries.length; ++i) {
|
||||
if (s == allseries[i])
|
||||
break;
|
||||
|
||||
if (allseries[i].stack == s.stack)
|
||||
res = allseries[i];
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
function stackData(plot, s, datapoints) {
|
||||
if (s.stack == null)
|
||||
return;
|
||||
|
||||
var other = findMatchingSeries(s, plot.getData());
|
||||
if (!other)
|
||||
return;
|
||||
|
||||
var ps = datapoints.pointsize,
|
||||
points = datapoints.points,
|
||||
otherps = other.datapoints.pointsize,
|
||||
otherpoints = other.datapoints.points,
|
||||
newpoints = [],
|
||||
px, py, intery, qx, qy, bottom,
|
||||
withlines = s.lines.show,
|
||||
horizontal = s.bars.horizontal,
|
||||
withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
|
||||
withsteps = withlines && s.lines.steps,
|
||||
fromgap = true,
|
||||
keyOffset = horizontal ? 1 : 0,
|
||||
accumulateOffset = horizontal ? 0 : 1,
|
||||
i = 0, j = 0, l;
|
||||
|
||||
while (true) {
|
||||
if (i >= points.length)
|
||||
break;
|
||||
|
||||
l = newpoints.length;
|
||||
|
||||
if (points[i] == null) {
|
||||
// copy gaps
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
i += ps;
|
||||
}
|
||||
else if (j >= otherpoints.length) {
|
||||
// for lines, we can't use the rest of the points
|
||||
if (!withlines) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
}
|
||||
i += ps;
|
||||
}
|
||||
else if (otherpoints[j] == null) {
|
||||
// oops, got a gap
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(null);
|
||||
fromgap = true;
|
||||
j += otherps;
|
||||
}
|
||||
else {
|
||||
// cases where we actually got two points
|
||||
px = points[i + keyOffset];
|
||||
py = points[i + accumulateOffset];
|
||||
qx = otherpoints[j + keyOffset];
|
||||
qy = otherpoints[j + accumulateOffset];
|
||||
bottom = 0;
|
||||
|
||||
if (px == qx) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
|
||||
newpoints[l + accumulateOffset] += qy;
|
||||
bottom = qy;
|
||||
|
||||
i += ps;
|
||||
j += otherps;
|
||||
}
|
||||
else if (px > qx) {
|
||||
// we got past point below, might need to
|
||||
// insert interpolated extra point
|
||||
if (withlines && i > 0 && points[i - ps] != null) {
|
||||
intery = py + (points[i - ps + accumulateOffset] - py) * (qx - px) / (points[i - ps + keyOffset] - px);
|
||||
newpoints.push(qx);
|
||||
newpoints.push(intery + qy);
|
||||
for (m = 2; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
bottom = qy;
|
||||
}
|
||||
|
||||
j += otherps;
|
||||
}
|
||||
else { // px < qx
|
||||
if (fromgap && withlines) {
|
||||
// if we come from a gap, we just skip this point
|
||||
i += ps;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
|
||||
// we might be able to interpolate a point below,
|
||||
// this can give us a better y
|
||||
if (withlines && j > 0 && otherpoints[j - otherps] != null)
|
||||
bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);
|
||||
|
||||
newpoints[l + accumulateOffset] += bottom;
|
||||
|
||||
i += ps;
|
||||
}
|
||||
|
||||
fromgap = false;
|
||||
|
||||
if (l != newpoints.length && withbottom)
|
||||
newpoints[l + 2] += bottom;
|
||||
}
|
||||
|
||||
// maintain the line steps invariant
|
||||
if (withsteps && l != newpoints.length && l > 0
|
||||
&& newpoints[l] != null
|
||||
&& newpoints[l] != newpoints[l - ps]
|
||||
&& newpoints[l + 1] != newpoints[l - ps + 1]) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints[l + ps + m] = newpoints[l + m];
|
||||
newpoints[l + 1] = newpoints[l - ps + 1];
|
||||
}
|
||||
}
|
||||
|
||||
datapoints.points = newpoints;
|
||||
}
|
||||
|
||||
plot.hooks.processDatapoints.push(stackData);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'stack',
|
||||
version: '1.2'
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
(function(b){b.gritter={};b.gritter.options={position:"",class_name:"",fade_in_speed:"medium",fade_out_speed:1000,time:6000};b.gritter.add=function(f){try{return a.add(f||{})}catch(d){var c="Gritter Error: "+d;(typeof(console)!="undefined"&&console.error)?console.error(c,f):alert(c)}};b.gritter.remove=function(d,c){a.removeSpecific(d,c||{})};b.gritter.removeAll=function(c){a.stop(c||{})};var a={position:"",fade_in_speed:"",fade_out_speed:"",time:"",_custom_timer:0,_item_count:0,_is_setup:0,_tpl_close:'<div class="gritter-close"></div>',_tpl_title:'<span class="gritter-title">[[title]]</span>',_tpl_item:'<div id="gritter-item-[[number]]" class="gritter-item-wrapper [[item_class]]" style="display:none"><div class="gritter-top"></div><div class="gritter-item">[[close]][[image]]<div class="[[class_name]]">[[title]]<p>[[text]]</p></div><div style="clear:both"></div></div><div class="gritter-bottom"></div></div>',_tpl_wrap:'<div id="gritter-notice-wrapper"></div>',add:function(g){if(typeof(g)=="string"){g={text:g}}if(!g.text){throw'You must supply "text" parameter.'}if(!this._is_setup){this._runSetup()}var k=g.title,n=g.text,e=g.image||"",l=g.sticky||false,m=g.class_name||b.gritter.options.class_name,j=b.gritter.options.position,d=g.time||"";this._verifyWrapper();this._item_count++;var f=this._item_count,i=this._tpl_item;b(["before_open","after_open","before_close","after_close"]).each(function(p,q){a["_"+q+"_"+f]=(b.isFunction(g[q]))?g[q]:function(){}});this._custom_timer=0;if(d){this._custom_timer=d}var c=(e!="")?'<img src="'+e+'" class="gritter-image" />':"",h=(e!="")?"gritter-with-image":"gritter-without-image";if(k){k=this._str_replace("[[title]]",k,this._tpl_title)}else{k=""}i=this._str_replace(["[[title]]","[[text]]","[[close]]","[[image]]","[[number]]","[[class_name]]","[[item_class]]"],[k,n,this._tpl_close,c,this._item_count,h,m],i);if(this["_before_open_"+f]()===false){return false}b("#gritter-notice-wrapper").addClass(j).append(i);var o=b("#gritter-item-"+this._item_count);o.fadeIn(this.fade_in_speed,function(){a["_after_open_"+f](b(this))});if(!l){this._setFadeTimer(o,f)}b(o).bind("mouseenter mouseleave",function(p){if(p.type=="mouseenter"){if(!l){a._restoreItemIfFading(b(this),f)}}else{if(!l){a._setFadeTimer(b(this),f)}}a._hoverState(b(this),p.type)});b(o).find(".gritter-close").click(function(){a.removeSpecific(f,{},null,true)});return f},_countRemoveWrapper:function(c,d,f){d.remove();this["_after_close_"+c](d,f);if(b(".gritter-item-wrapper").length==0){b("#gritter-notice-wrapper").remove()}},_fade:function(g,d,j,f){var j=j||{},i=(typeof(j.fade)!="undefined")?j.fade:true,c=j.speed||this.fade_out_speed,h=f;this["_before_close_"+d](g,h);if(f){g.unbind("mouseenter mouseleave")}if(i){g.animate({opacity:0},c,function(){g.animate({height:0},300,function(){a._countRemoveWrapper(d,g,h)})})}else{this._countRemoveWrapper(d,g)}},_hoverState:function(d,c){if(c=="mouseenter"){d.addClass("hover");d.find(".gritter-close").show()}else{d.removeClass("hover");d.find(".gritter-close").hide()}},removeSpecific:function(c,g,f,d){if(!f){var f=b("#gritter-item-"+c)}this._fade(f,c,g||{},d)},_restoreItemIfFading:function(d,c){clearTimeout(this["_int_id_"+c]);d.stop().css({opacity:"",height:""})},_runSetup:function(){for(opt in b.gritter.options){this[opt]=b.gritter.options[opt]}this._is_setup=1},_setFadeTimer:function(f,d){var c=(this._custom_timer)?this._custom_timer:this.time;this["_int_id_"+d]=setTimeout(function(){a._fade(f,d)},c)},stop:function(e){var c=(b.isFunction(e.before_close))?e.before_close:function(){};var f=(b.isFunction(e.after_close))?e.after_close:function(){};var d=b("#gritter-notice-wrapper");c(d);d.fadeOut(function(){b(this).remove();f()})},_str_replace:function(v,e,o,n){var k=0,h=0,t="",m="",g=0,q=0,l=[].concat(v),c=[].concat(e),u=o,d=c instanceof Array,p=u instanceof Array;u=[].concat(u);if(n){this.window[n]=0}for(k=0,g=u.length;k<g;k++){if(u[k]===""){continue}for(h=0,q=l.length;h<q;h++){t=u[k]+"";m=d?(c[h]!==undefined?c[h]:""):c[0];u[k]=(t).split(l[h]).join(m);if(n&&u[k]!==t){this.window[n]+=(t.length-u[k].length)/l[h].length}}}return p?u:u[0]},_verifyWrapper:function(){if(b("#gritter-notice-wrapper").length==0){b("body").append(this._tpl_wrap)}}}})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
|
||||
// Peity jQuery plugin version 0.6.0
|
||||
// (c) 2011 Ben Pickles
|
||||
//
|
||||
// http://benpickles.github.com/peity/
|
||||
//
|
||||
// Released under MIT license.
|
||||
(function(i,k){function o(a,h){var b=k.createElement("canvas");b.setAttribute("width",a*m);b.setAttribute("height",h*m);m!=1&&b.setAttribute("style","width:"+a+"px;height:"+h+"px");return b}var g=i.fn.peity=function(a,h){k.createElement("canvas").getContext&&this.each(function(){i(this).change(function(){var b=i.extend({},h),d=this;i.each(b,function(a,c){i.isFunction(c)&&(b[a]=c.call(d))});var f=i(this).html();g.graphers[a].call(this,i.extend({},g.defaults[a],b));i(this).trigger("chart:changed",f)}).trigger("change")});
|
||||
return this};g.graphers={};g.defaults={};g.add=function(a,h,b){g.graphers[a]=b;g.defaults[a]=h};var m=window.devicePixelRatio||1;g.add("pie",{colours:["#FFF4DD","#FF9900"],delimeter:"/",diameter:16},function(a){var h=i(this),b=h.text().split(a.delimeter),d=parseFloat(b[0]),f=parseFloat(b[1]),b=-Math.PI/2,d=d/f*Math.PI*2,f=o(a.diameter,a.diameter),e=f.getContext("2d"),c=f.width/2;e.beginPath();e.moveTo(c,c);e.arc(c,c,c,d+b,d==0?Math.PI*2:b,!1);e.fillStyle=a.colours[0];e.fill();e.beginPath();e.moveTo(c,
|
||||
c);e.arc(c,c,c,b,d+b,!1);e.fillStyle=a.colours[1];e.fill();h.wrapInner(i("<span>").hide()).append(f)});g.add("line",{colour:"#c6d9fd",strokeColour:"#4d89f9",strokeWidth:1,delimeter:",",height:16,max:null,min:0,width:32},function(a){var h=i(this),b=o(a.width,a.height),d=h.text().split(a.delimeter);d.length==1&&d.push(d[0]);var f=Math.max.apply(Math,d.concat([a.max])),e=Math.min.apply(Math,d.concat([a.min])),c=b.getContext("2d"),g=b.width,l=b.height,q=g/(d.length-1),f=l/(f-e),n=[],j;c.beginPath();c.moveTo(0,
|
||||
l+e*f);for(j=0;j<d.length;j++){var k=j*q,p=l-f*(d[j]-e);n.push({x:k,y:p});c.lineTo(k,p)}c.lineTo(g,l+e*f);c.fillStyle=a.colour;c.fill();if(a.strokeWidth){c.beginPath();c.moveTo(0,n[0].y);for(j=0;j<n.length;j++)c.lineTo(n[j].x,n[j].y);c.lineWidth=a.strokeWidth*m;c.strokeStyle=a.strokeColour;c.stroke()}h.wrapInner(i("<span>").hide()).append(b)});g.add("bar",{colour:"#4D89F9",delimeter:",",height:16,max:null,min:0,width:32},function(a){var h=i(this),b=h.text().split(a.delimeter),d=Math.max.apply(Math,
|
||||
b.concat([a.max])),f=Math.min.apply(Math,b.concat([a.min])),e=o(a.width,a.height),c=e.getContext("2d"),g=e.height,d=g/(d-f),l=m/2,k=(e.width+l)/b.length;c.fillStyle=a.colour;for(a=0;a<b.length;a++)c.fillRect(a*k,g-d*(b[a]-f),k-l,d*b[a]);h.wrapInner(i("<span>").hide()).append(e)})})(jQuery,document);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,672 @@
|
||||
/*
|
||||
|
||||
Uniform v1.7.5
|
||||
Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC
|
||||
http://pixelmatrixdesign.com
|
||||
|
||||
Requires jQuery 1.4 or newer
|
||||
|
||||
Much thanks to Thomas Reynolds and Buck Wilson for their help and advice on this
|
||||
|
||||
Disabling text selection is made possible by Mathias Bynens <http://mathiasbynens.be/>
|
||||
and his noSelect plugin. <http://github.com/mathiasbynens/noSelect-jQuery-Plugin>
|
||||
|
||||
Also, thanks to David Kaneda and Eugene Bond for their contributions to the plugin
|
||||
|
||||
License:
|
||||
MIT License - http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
Enjoy!
|
||||
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.uniform = {
|
||||
options: {
|
||||
selectClass: 'selector',
|
||||
radioClass: 'radio',
|
||||
checkboxClass: 'checker',
|
||||
fileClass: 'uploader',
|
||||
filenameClass: 'filename',
|
||||
fileBtnClass: 'action',
|
||||
fileDefaultText: 'No file selected',
|
||||
fileBtnText: 'Choose File',
|
||||
checkedClass: 'checked',
|
||||
focusClass: 'focus',
|
||||
disabledClass: 'disabled',
|
||||
buttonClass: 'button',
|
||||
activeClass: 'active',
|
||||
hoverClass: 'hover',
|
||||
useID: true,
|
||||
idPrefix: 'uniform',
|
||||
resetSelector: false,
|
||||
autoHide: true
|
||||
},
|
||||
elements: []
|
||||
};
|
||||
|
||||
if($.browser.msie && $.browser.version < 7){
|
||||
$.support.selectOpacity = false;
|
||||
}else{
|
||||
$.support.selectOpacity = true;
|
||||
}
|
||||
|
||||
$.fn.uniform = function(options) {
|
||||
|
||||
options = $.extend($.uniform.options, options);
|
||||
|
||||
var el = this;
|
||||
//code for specifying a reset button
|
||||
if(options.resetSelector != false){
|
||||
$(options.resetSelector).mouseup(function(){
|
||||
function resetThis(){
|
||||
$.uniform.update(el);
|
||||
}
|
||||
setTimeout(resetThis, 10);
|
||||
});
|
||||
}
|
||||
|
||||
function doInput(elem){
|
||||
$el = $(elem);
|
||||
$el.addClass($el.attr("type"));
|
||||
storeElement(elem);
|
||||
}
|
||||
|
||||
function doTextarea(elem){
|
||||
$(elem).addClass("uniform");
|
||||
storeElement(elem);
|
||||
}
|
||||
|
||||
function doButton(elem){
|
||||
var $el = $(elem);
|
||||
|
||||
var divTag = $("<div>"),
|
||||
spanTag = $("<span>");
|
||||
|
||||
divTag.addClass(options.buttonClass);
|
||||
|
||||
if(options.useID && $el.attr("id") != "") divTag.attr("id", options.idPrefix+"-"+$el.attr("id"));
|
||||
|
||||
var btnText;
|
||||
|
||||
if($el.is("a") || $el.is("button")){
|
||||
btnText = $el.text();
|
||||
}else if($el.is(":submit") || $el.is(":reset") || $el.is("input[type=button]")){
|
||||
btnText = $el.attr("value");
|
||||
}
|
||||
|
||||
btnText = btnText == "" ? $el.is(":reset") ? "Reset" : "Submit" : btnText;
|
||||
|
||||
spanTag.html(btnText);
|
||||
|
||||
$el.css("opacity", 0);
|
||||
$el.wrap(divTag);
|
||||
$el.wrap(spanTag);
|
||||
|
||||
//redefine variables
|
||||
divTag = $el.closest("div");
|
||||
spanTag = $el.closest("span");
|
||||
|
||||
if($el.is(":disabled")) divTag.addClass(options.disabledClass);
|
||||
|
||||
divTag.bind({
|
||||
"mouseenter.uniform": function(){
|
||||
divTag.addClass(options.hoverClass);
|
||||
},
|
||||
"mouseleave.uniform": function(){
|
||||
divTag.removeClass(options.hoverClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mousedown.uniform touchbegin.uniform": function(){
|
||||
divTag.addClass(options.activeClass);
|
||||
},
|
||||
"mouseup.uniform touchend.uniform": function(){
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"click.uniform touchend.uniform": function(e){
|
||||
if($(e.target).is("span") || $(e.target).is("div")){
|
||||
if(elem[0].dispatchEvent){
|
||||
var ev = document.createEvent('MouseEvents');
|
||||
ev.initEvent( 'click', true, true );
|
||||
elem[0].dispatchEvent(ev);
|
||||
}else{
|
||||
elem[0].click();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
elem.bind({
|
||||
"focus.uniform": function(){
|
||||
divTag.addClass(options.focusClass);
|
||||
},
|
||||
"blur.uniform": function(){
|
||||
divTag.removeClass(options.focusClass);
|
||||
}
|
||||
});
|
||||
|
||||
$.uniform.noSelect(divTag);
|
||||
storeElement(elem);
|
||||
|
||||
}
|
||||
|
||||
function doSelect(elem){
|
||||
var $el = $(elem);
|
||||
|
||||
var divTag = $('<div />'),
|
||||
spanTag = $('<span />');
|
||||
|
||||
if(!$el.css("display") == "none" && options.autoHide){
|
||||
divTag.hide();
|
||||
}
|
||||
|
||||
divTag.addClass(options.selectClass);
|
||||
|
||||
if(options.useID && elem.attr("id") != ""){
|
||||
divTag.attr("id", options.idPrefix+"-"+elem.attr("id"));
|
||||
}
|
||||
|
||||
var selected = elem.find(":selected:first");
|
||||
if(selected.length == 0){
|
||||
selected = elem.find("option:first");
|
||||
}
|
||||
spanTag.html(selected.html());
|
||||
|
||||
elem.css('opacity', 0);
|
||||
elem.wrap(divTag);
|
||||
elem.before(spanTag);
|
||||
|
||||
//redefine variables
|
||||
divTag = elem.parent("div");
|
||||
spanTag = elem.siblings("span");
|
||||
|
||||
elem.bind({
|
||||
"change.uniform": function() {
|
||||
spanTag.text(elem.find(":selected").html());
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"focus.uniform": function() {
|
||||
divTag.addClass(options.focusClass);
|
||||
},
|
||||
"blur.uniform": function() {
|
||||
divTag.removeClass(options.focusClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mousedown.uniform touchbegin.uniform": function() {
|
||||
divTag.addClass(options.activeClass);
|
||||
},
|
||||
"mouseup.uniform touchend.uniform": function() {
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"click.uniform touchend.uniform": function(){
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mouseenter.uniform": function() {
|
||||
divTag.addClass(options.hoverClass);
|
||||
},
|
||||
"mouseleave.uniform": function() {
|
||||
divTag.removeClass(options.hoverClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"keyup.uniform": function(){
|
||||
spanTag.text(elem.find(":selected").html());
|
||||
}
|
||||
});
|
||||
|
||||
//handle disabled state
|
||||
if($(elem).attr("disabled")){
|
||||
//box is checked by default, check our box
|
||||
divTag.addClass(options.disabledClass);
|
||||
}
|
||||
$.uniform.noSelect(spanTag);
|
||||
|
||||
storeElement(elem);
|
||||
|
||||
}
|
||||
|
||||
function doCheckbox(elem){
|
||||
var $el = $(elem);
|
||||
|
||||
var divTag = $('<div />'),
|
||||
spanTag = $('<span />');
|
||||
|
||||
if(!$el.css("display") == "none" && options.autoHide){
|
||||
divTag.hide();
|
||||
}
|
||||
|
||||
divTag.addClass(options.checkboxClass);
|
||||
|
||||
//assign the id of the element
|
||||
if(options.useID && elem.attr("id") != ""){
|
||||
divTag.attr("id", options.idPrefix+"-"+elem.attr("id"));
|
||||
}
|
||||
|
||||
//wrap with the proper elements
|
||||
$(elem).wrap(divTag);
|
||||
$(elem).wrap(spanTag);
|
||||
|
||||
//redefine variables
|
||||
spanTag = elem.parent();
|
||||
divTag = spanTag.parent();
|
||||
|
||||
//hide normal input and add focus classes
|
||||
$(elem)
|
||||
.css("opacity", 0)
|
||||
.bind({
|
||||
"focus.uniform": function(){
|
||||
divTag.addClass(options.focusClass);
|
||||
},
|
||||
"blur.uniform": function(){
|
||||
divTag.removeClass(options.focusClass);
|
||||
},
|
||||
"click.uniform touchend.uniform": function(){
|
||||
if(!$(elem).attr("checked")){
|
||||
//box was just unchecked, uncheck span
|
||||
spanTag.removeClass(options.checkedClass);
|
||||
}else{
|
||||
//box was just checked, check span.
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
},
|
||||
"mousedown.uniform touchbegin.uniform": function() {
|
||||
divTag.addClass(options.activeClass);
|
||||
},
|
||||
"mouseup.uniform touchend.uniform": function() {
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mouseenter.uniform": function() {
|
||||
divTag.addClass(options.hoverClass);
|
||||
},
|
||||
"mouseleave.uniform": function() {
|
||||
divTag.removeClass(options.hoverClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
}
|
||||
});
|
||||
|
||||
//handle defaults
|
||||
if($(elem).attr("checked")){
|
||||
//box is checked by default, check our box
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
|
||||
//handle disabled state
|
||||
if($(elem).attr("disabled")){
|
||||
//box is checked by default, check our box
|
||||
divTag.addClass(options.disabledClass);
|
||||
}
|
||||
|
||||
storeElement(elem);
|
||||
}
|
||||
|
||||
function doRadio(elem){
|
||||
var $el = $(elem);
|
||||
|
||||
var divTag = $('<div />'),
|
||||
spanTag = $('<span />');
|
||||
|
||||
if(!$el.css("display") == "none" && options.autoHide){
|
||||
divTag.hide();
|
||||
}
|
||||
|
||||
divTag.addClass(options.radioClass);
|
||||
|
||||
if(options.useID && elem.attr("id") != ""){
|
||||
divTag.attr("id", options.idPrefix+"-"+elem.attr("id"));
|
||||
}
|
||||
|
||||
//wrap with the proper elements
|
||||
$(elem).wrap(divTag);
|
||||
$(elem).wrap(spanTag);
|
||||
|
||||
//redefine variables
|
||||
spanTag = elem.parent();
|
||||
divTag = spanTag.parent();
|
||||
|
||||
//hide normal input and add focus classes
|
||||
$(elem)
|
||||
.css("opacity", 0)
|
||||
.bind({
|
||||
"focus.uniform": function(){
|
||||
divTag.addClass(options.focusClass);
|
||||
},
|
||||
"blur.uniform": function(){
|
||||
divTag.removeClass(options.focusClass);
|
||||
},
|
||||
"click.uniform touchend.uniform": function(){
|
||||
if(!$(elem).attr("checked")){
|
||||
//box was just unchecked, uncheck span
|
||||
spanTag.removeClass(options.checkedClass);
|
||||
}else{
|
||||
//box was just checked, check span
|
||||
var classes = options.radioClass.split(" ")[0];
|
||||
$("." + classes + " span." + options.checkedClass + ":has([name='" + $(elem).attr('name') + "'])").removeClass(options.checkedClass);
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
},
|
||||
"mousedown.uniform touchend.uniform": function() {
|
||||
if(!$(elem).is(":disabled")){
|
||||
divTag.addClass(options.activeClass);
|
||||
}
|
||||
},
|
||||
"mouseup.uniform touchbegin.uniform": function() {
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mouseenter.uniform touchend.uniform": function() {
|
||||
divTag.addClass(options.hoverClass);
|
||||
},
|
||||
"mouseleave.uniform": function() {
|
||||
divTag.removeClass(options.hoverClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
}
|
||||
});
|
||||
|
||||
//handle defaults
|
||||
if($(elem).attr("checked")){
|
||||
//box is checked by default, check span
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
//handle disabled state
|
||||
if($(elem).attr("disabled")){
|
||||
//box is checked by default, check our box
|
||||
divTag.addClass(options.disabledClass);
|
||||
}
|
||||
|
||||
storeElement(elem);
|
||||
|
||||
}
|
||||
|
||||
function doFile(elem){
|
||||
//sanitize input
|
||||
var $el = $(elem);
|
||||
|
||||
var divTag = $('<div />'),
|
||||
filenameTag = $('<span>'+options.fileDefaultText+'</span>'),
|
||||
btnTag = $('<span>'+options.fileBtnText+'</span>');
|
||||
|
||||
if(!$el.css("display") == "none" && options.autoHide){
|
||||
divTag.hide();
|
||||
}
|
||||
|
||||
divTag.addClass(options.fileClass);
|
||||
filenameTag.addClass(options.filenameClass);
|
||||
btnTag.addClass(options.fileBtnClass);
|
||||
|
||||
if(options.useID && $el.attr("id") != ""){
|
||||
divTag.attr("id", options.idPrefix+"-"+$el.attr("id"));
|
||||
}
|
||||
|
||||
//wrap with the proper elements
|
||||
$el.wrap(divTag);
|
||||
$el.after(btnTag);
|
||||
$el.after(filenameTag);
|
||||
|
||||
//redefine variables
|
||||
divTag = $el.closest("div");
|
||||
filenameTag = $el.siblings("."+options.filenameClass);
|
||||
btnTag = $el.siblings("."+options.fileBtnClass);
|
||||
|
||||
//set the size
|
||||
if(!$el.attr("size")){
|
||||
var divWidth = divTag.width();
|
||||
//$el.css("width", divWidth);
|
||||
$el.attr("size", divWidth/10);
|
||||
}
|
||||
|
||||
//actions
|
||||
var setFilename = function()
|
||||
{
|
||||
var filename = $el.val();
|
||||
if (filename === '')
|
||||
{
|
||||
filename = options.fileDefaultText;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = filename.split(/[\/\\]+/);
|
||||
filename = filename[(filename.length-1)];
|
||||
}
|
||||
filenameTag.text(filename);
|
||||
};
|
||||
|
||||
// Account for input saved across refreshes
|
||||
setFilename();
|
||||
|
||||
$el
|
||||
.css("opacity", 0)
|
||||
.bind({
|
||||
"focus.uniform": function(){
|
||||
divTag.addClass(options.focusClass);
|
||||
},
|
||||
"blur.uniform": function(){
|
||||
divTag.removeClass(options.focusClass);
|
||||
},
|
||||
"mousedown.uniform": function() {
|
||||
if(!$(elem).is(":disabled")){
|
||||
divTag.addClass(options.activeClass);
|
||||
}
|
||||
},
|
||||
"mouseup.uniform": function() {
|
||||
divTag.removeClass(options.activeClass);
|
||||
},
|
||||
"mouseenter.uniform": function() {
|
||||
divTag.addClass(options.hoverClass);
|
||||
},
|
||||
"mouseleave.uniform": function() {
|
||||
divTag.removeClass(options.hoverClass);
|
||||
divTag.removeClass(options.activeClass);
|
||||
}
|
||||
});
|
||||
|
||||
// IE7 doesn't fire onChange until blur or second fire.
|
||||
if ($.browser.msie){
|
||||
// IE considers browser chrome blocking I/O, so it
|
||||
// suspends tiemouts until after the file has been selected.
|
||||
$el.bind('click.uniform.ie7', function() {
|
||||
setTimeout(setFilename, 0);
|
||||
});
|
||||
}else{
|
||||
// All other browsers behave properly
|
||||
$el.bind('change.uniform', setFilename);
|
||||
}
|
||||
|
||||
//handle defaults
|
||||
if($el.attr("disabled")){
|
||||
//box is checked by default, check our box
|
||||
divTag.addClass(options.disabledClass);
|
||||
}
|
||||
|
||||
$.uniform.noSelect(filenameTag);
|
||||
$.uniform.noSelect(btnTag);
|
||||
|
||||
storeElement(elem);
|
||||
|
||||
}
|
||||
|
||||
$.uniform.restore = function(elem){
|
||||
if(elem == undefined){
|
||||
elem = $($.uniform.elements);
|
||||
}
|
||||
|
||||
$(elem).each(function(){
|
||||
if($(this).is(":checkbox")){
|
||||
//unwrap from span and div
|
||||
$(this).unwrap().unwrap();
|
||||
}else if($(this).is("select")){
|
||||
//remove sibling span
|
||||
$(this).siblings("span").remove();
|
||||
//unwrap parent div
|
||||
$(this).unwrap();
|
||||
}else if($(this).is(":radio")){
|
||||
//unwrap from span and div
|
||||
$(this).unwrap().unwrap();
|
||||
}else if($(this).is(":file")){
|
||||
//remove sibling spans
|
||||
$(this).siblings("span").remove();
|
||||
//unwrap parent div
|
||||
$(this).unwrap();
|
||||
}else if($(this).is("button, :submit, :reset, a, input[type='button']")){
|
||||
//unwrap from span and div
|
||||
$(this).unwrap().unwrap();
|
||||
}
|
||||
|
||||
//unbind events
|
||||
$(this).unbind(".uniform");
|
||||
|
||||
//reset inline style
|
||||
$(this).css("opacity", "1");
|
||||
|
||||
//remove item from list of uniformed elements
|
||||
var index = $.inArray($(elem), $.uniform.elements);
|
||||
$.uniform.elements.splice(index, 1);
|
||||
});
|
||||
};
|
||||
|
||||
function storeElement(elem){
|
||||
//store this element in our global array
|
||||
elem = $(elem).get();
|
||||
if(elem.length > 1){
|
||||
$.each(elem, function(i, val){
|
||||
$.uniform.elements.push(val);
|
||||
});
|
||||
}else{
|
||||
$.uniform.elements.push(elem);
|
||||
}
|
||||
}
|
||||
|
||||
//noSelect v1.0
|
||||
$.uniform.noSelect = function(elem) {
|
||||
function f() {
|
||||
return false;
|
||||
};
|
||||
$(elem).each(function() {
|
||||
this.onselectstart = this.ondragstart = f; // Webkit & IE
|
||||
$(this)
|
||||
.mousedown(f) // Webkit & Opera
|
||||
.css({ MozUserSelect: 'none' }); // Firefox
|
||||
});
|
||||
};
|
||||
|
||||
$.uniform.update = function(elem){
|
||||
if(elem == undefined){
|
||||
elem = $($.uniform.elements);
|
||||
}
|
||||
//sanitize input
|
||||
elem = $(elem);
|
||||
|
||||
elem.each(function(){
|
||||
//do to each item in the selector
|
||||
//function to reset all classes
|
||||
var $e = $(this);
|
||||
|
||||
if($e.is("select")){
|
||||
//element is a select
|
||||
var spanTag = $e.siblings("span");
|
||||
var divTag = $e.parent("div");
|
||||
|
||||
divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
|
||||
|
||||
//reset current selected text
|
||||
spanTag.html($e.find(":selected").html());
|
||||
|
||||
if($e.is(":disabled")){
|
||||
divTag.addClass(options.disabledClass);
|
||||
}else{
|
||||
divTag.removeClass(options.disabledClass);
|
||||
}
|
||||
|
||||
}else if($e.is(":checkbox")){
|
||||
//element is a checkbox
|
||||
var spanTag = $e.closest("span");
|
||||
var divTag = $e.closest("div");
|
||||
|
||||
divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
|
||||
spanTag.removeClass(options.checkedClass);
|
||||
|
||||
if($e.is(":checked")){
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
if($e.is(":disabled")){
|
||||
divTag.addClass(options.disabledClass);
|
||||
}else{
|
||||
divTag.removeClass(options.disabledClass);
|
||||
}
|
||||
|
||||
}else if($e.is(":radio")){
|
||||
//element is a radio
|
||||
var spanTag = $e.closest("span");
|
||||
var divTag = $e.closest("div");
|
||||
|
||||
divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
|
||||
spanTag.removeClass(options.checkedClass);
|
||||
|
||||
if($e.is(":checked")){
|
||||
spanTag.addClass(options.checkedClass);
|
||||
}
|
||||
|
||||
if($e.is(":disabled")){
|
||||
divTag.addClass(options.disabledClass);
|
||||
}else{
|
||||
divTag.removeClass(options.disabledClass);
|
||||
}
|
||||
}else if($e.is(":file")){
|
||||
var divTag = $e.parent("div");
|
||||
var filenameTag = $e.siblings(options.filenameClass);
|
||||
btnTag = $e.siblings(options.fileBtnClass);
|
||||
|
||||
divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
|
||||
|
||||
filenameTag.text($e.val());
|
||||
|
||||
if($e.is(":disabled")){
|
||||
divTag.addClass(options.disabledClass);
|
||||
}else{
|
||||
divTag.removeClass(options.disabledClass);
|
||||
}
|
||||
}else if($e.is(":submit") || $e.is(":reset") || $e.is("button") || $e.is("a") || elem.is("input[type=button]")){
|
||||
var divTag = $e.closest("div");
|
||||
divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
|
||||
|
||||
if($e.is(":disabled")){
|
||||
divTag.addClass(options.disabledClass);
|
||||
}else{
|
||||
divTag.removeClass(options.disabledClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
return this.each(function() {
|
||||
if($.support.selectOpacity){
|
||||
var elem = $(this);
|
||||
|
||||
if(elem.is("select")){
|
||||
//element is a select
|
||||
if(elem.attr("multiple") != true){
|
||||
//element is not a multi-select
|
||||
if(elem.attr("size") == undefined || elem.attr("size") <= 1){
|
||||
doSelect(elem);
|
||||
}
|
||||
}
|
||||
}else if(elem.is(":checkbox")){
|
||||
//element is a checkbox
|
||||
doCheckbox(elem);
|
||||
}else if(elem.is(":radio")){
|
||||
//element is a radio
|
||||
doRadio(elem);
|
||||
}else if(elem.is(":file")){
|
||||
//element is a file upload
|
||||
doFile(elem);
|
||||
}else if(elem.is(":text, :password, input[type='email']")){
|
||||
doInput(elem);
|
||||
}else if(elem.is("textarea")){
|
||||
doTextarea(elem);
|
||||
}else if(elem.is("a") || elem.is(":submit") || elem.is(":reset") || elem.is("button") || elem.is("input[type=button]")){
|
||||
doButton(elem);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,456 @@
|
||||
/*
|
||||
* jQuery wizard plug-in 3.0.5
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2011 Jan Sundman (jan.sundman[at]aland.net)
|
||||
*
|
||||
* http://www.thecodemine.org
|
||||
*
|
||||
* Licensed under the MIT licens:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
(function($){
|
||||
$.widget("ui.formwizard", {
|
||||
|
||||
_init: function() {
|
||||
|
||||
var wizard = this;
|
||||
var formOptionsSuccess = this.options.formOptions.success;
|
||||
var formOptionsComplete = this.options.formOptions.complete;
|
||||
var formOptionsBeforeSend = this.options.formOptions.beforeSend;
|
||||
var formOptionsBeforeSubmit = this.options.formOptions.beforeSubmit;
|
||||
var formOptionsBeforeSerialize = this.options.formOptions.beforeSerialize;
|
||||
this.options.formOptions = $.extend(this.options.formOptions,{
|
||||
success : function(responseText, textStatus, xhr){
|
||||
if(formOptionsSuccess){
|
||||
formOptionsSuccess(responseText, textStatus, xhr);
|
||||
}
|
||||
if(wizard.options.formOptions && wizard.options.formOptions.resetForm || !wizard.options.formOptions){
|
||||
wizard._reset();
|
||||
}
|
||||
},
|
||||
complete : function(xhr, textStatus){
|
||||
if(formOptionsComplete){
|
||||
formOptionsComplete(xhr, textStatus);
|
||||
}
|
||||
wizard._enableNavigation();
|
||||
},
|
||||
beforeSubmit : function(arr, theForm, options) {
|
||||
if(formOptionsBeforeSubmit){
|
||||
var shouldSubmit = formOptionsBeforeSubmit(arr, theForm, options);
|
||||
if(!shouldSubmit)
|
||||
wizard._enableNavigation();
|
||||
return shouldSubmit;
|
||||
}
|
||||
},
|
||||
beforeSend : function(xhr) {
|
||||
if(formOptionsBeforeSend){
|
||||
var shouldSubmit = formOptionsBeforeSend(xhr);
|
||||
if(!shouldSubmit)
|
||||
wizard._enableNavigation();
|
||||
return shouldSubmit;
|
||||
}
|
||||
},
|
||||
beforeSerialize: function(form, options) {
|
||||
if(formOptionsBeforeSerialize){
|
||||
var shouldSubmit = formOptionsBeforeSerialize(form, options);
|
||||
if(!shouldSubmit)
|
||||
wizard._enableNavigation();
|
||||
return shouldSubmit;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.steps = this.element.find(".step").hide();
|
||||
|
||||
this.firstStep = this.steps.eq(0).attr("id");
|
||||
this.activatedSteps = new Array();
|
||||
this.isLastStep = false;
|
||||
this.previousStep = undefined;
|
||||
this.currentStep = this.steps.eq(0).attr("id");
|
||||
this.nextButton = this.element.find(this.options.next)
|
||||
.click(function() {
|
||||
return wizard._next();
|
||||
});
|
||||
|
||||
this.nextButtonInitinalValue = this.nextButton.val();
|
||||
this.nextButton.val(this.options.textNext);
|
||||
|
||||
this.backButton = this.element.find(this.options.back)
|
||||
.click(function() {
|
||||
wizard._back();return false;
|
||||
});
|
||||
|
||||
this.backButtonInitinalValue = this.backButton.val();
|
||||
this.backButton.val(this.options.textBack);
|
||||
|
||||
if(this.options.validationEnabled && jQuery().validate == undefined){
|
||||
this.options.validationEnabled = false;
|
||||
if( (window['console'] !== undefined) ){
|
||||
console.log("%s", "validationEnabled option set, but the validation plugin is not included");
|
||||
}
|
||||
}else if(this.options.validationEnabled){
|
||||
this.element.validate(this.options.validationOptions);
|
||||
}
|
||||
if(this.options.formPluginEnabled && jQuery().ajaxSubmit == undefined){
|
||||
this.options.formPluginEnabled = false;
|
||||
if( (window['console'] !== undefined) ){
|
||||
console.log("%s", "formPluginEnabled option set but the form plugin is not included");
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.disableInputFields == true){
|
||||
$(this.steps).find(":input:not('.wizard-ignore')").attr("disabled","disabled");
|
||||
}
|
||||
|
||||
if(this.options.historyEnabled){
|
||||
$(window).bind('hashchange', undefined, function(event){
|
||||
var hashStep = event.getState( "_" + $(wizard.element).attr( 'id' )) || wizard.firstStep;
|
||||
if(hashStep !== wizard.currentStep){
|
||||
if(wizard.options.validationEnabled && hashStep === wizard._navigate(wizard.currentStep)){
|
||||
if(!wizard.element.valid()){
|
||||
wizard._updateHistory(wizard.currentStep);
|
||||
wizard.element.validate().focusInvalid();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(hashStep !== wizard.currentStep)
|
||||
wizard._show(hashStep);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.element.addClass("ui-formwizard");
|
||||
this.element.find(":input").addClass("ui-wizard-content");
|
||||
this.steps.addClass("ui-formwizard-content");
|
||||
this.backButton.addClass("ui-formwizard-button ui-wizard-content");
|
||||
this.nextButton.addClass("ui-formwizard-button ui-wizard-content");
|
||||
|
||||
if(!this.options.disableUIStyles){
|
||||
this.element.addClass("ui-helper-reset ui-widget ui-widget-content ui-helper-reset ui-corner-all");
|
||||
this.element.find(":input").addClass("ui-helper-reset ui-state-default");
|
||||
this.steps.addClass("ui-helper-reset ui-corner-all");
|
||||
this.backButton.addClass("ui-helper-reset ui-state-default");
|
||||
this.nextButton.addClass("ui-helper-reset ui-state-default");
|
||||
}
|
||||
this._show(undefined);
|
||||
return $(this);
|
||||
},
|
||||
|
||||
_next : function(){
|
||||
if(this.options.validationEnabled){
|
||||
if(!this.element.valid()){
|
||||
this.element.validate().focusInvalid();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.remoteAjax != undefined){
|
||||
var options = this.options.remoteAjax[this.currentStep];
|
||||
var wizard = this;
|
||||
if(options !== undefined){
|
||||
var success = options.success;
|
||||
var beforeSend = options.beforeSend;
|
||||
var complete = options.complete;
|
||||
|
||||
options = $.extend({},options,{
|
||||
success: function(data, statusText){
|
||||
if((success !== undefined && success(data, statusText)) || (success == undefined)){
|
||||
wizard._continueToNextStep();
|
||||
}
|
||||
},
|
||||
beforeSend : function(xhr){
|
||||
wizard._disableNavigation();
|
||||
if(beforeSend !== undefined)
|
||||
beforeSend(xhr);
|
||||
$(wizard.element).trigger('before_remote_ajax', {"currentStep" : wizard.currentStep});
|
||||
},
|
||||
complete : function(xhr, statusText){
|
||||
if(complete !== undefined)
|
||||
complete(xhr, statusText);
|
||||
$(wizard.element).trigger('after_remote_ajax', {"currentStep" : wizard.currentStep});
|
||||
wizard._enableNavigation();
|
||||
}
|
||||
})
|
||||
this.element.ajaxSubmit(options);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return this._continueToNextStep();
|
||||
},
|
||||
|
||||
_back : function(){
|
||||
if(this.activatedSteps.length > 0){
|
||||
if(this.options.historyEnabled){
|
||||
this._updateHistory(this.activatedSteps[this.activatedSteps.length - 2]);
|
||||
}else{
|
||||
this._show(this.activatedSteps[this.activatedSteps.length - 2], true);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_continueToNextStep : function(){
|
||||
if(this.isLastStep){
|
||||
for(var i = 0; i < this.activatedSteps.length; i++){
|
||||
this.steps.filter("#" + this.activatedSteps[i]).find(":input").not(".wizard-ignore").removeAttr("disabled");
|
||||
}
|
||||
if(!this.options.formPluginEnabled){
|
||||
return true;
|
||||
}else{
|
||||
this._disableNavigation();
|
||||
this.element.ajaxSubmit(this.options.formOptions);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var step = this._navigate(this.currentStep);
|
||||
if(step == this.currentStep){
|
||||
return false;
|
||||
}
|
||||
if(this.options.historyEnabled){
|
||||
this._updateHistory(step);
|
||||
}else{
|
||||
this._show(step, true);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_updateHistory : function(step){
|
||||
var state = {};
|
||||
state["_" + $(this.element).attr('id')] = step;
|
||||
$.bbq.pushState(state);
|
||||
},
|
||||
|
||||
_disableNavigation : function(){
|
||||
this.nextButton.attr("disabled","disabled");
|
||||
this.backButton.attr("disabled","disabled");
|
||||
if(!this.options.disableUIStyles){
|
||||
this.nextButton.removeClass("ui-state-active").addClass("ui-state-disabled");
|
||||
this.backButton.removeClass("ui-state-active").addClass("ui-state-disabled");
|
||||
}
|
||||
},
|
||||
|
||||
_enableNavigation : function(){
|
||||
if(this.isLastStep){
|
||||
this.nextButton.val(this.options.textSubmit);
|
||||
}else{
|
||||
this.nextButton.val(this.options.textNext);
|
||||
}
|
||||
|
||||
if($.trim(this.currentStep) !== this.steps.eq(0).attr("id")){
|
||||
this.backButton.removeAttr("disabled");
|
||||
if(!this.options.disableUIStyles){
|
||||
this.backButton.removeClass("ui-state-disabled").addClass("ui-state-active");
|
||||
}
|
||||
}
|
||||
|
||||
this.nextButton.removeAttr("disabled");
|
||||
if(!this.options.disableUIStyles){
|
||||
this.nextButton.removeClass("ui-state-disabled").addClass("ui-state-active");
|
||||
}
|
||||
},
|
||||
|
||||
_animate : function(oldStep, newStep, stepShownCallback){
|
||||
this._disableNavigation();
|
||||
var old = this.steps.filter("#" + oldStep);
|
||||
var current = this.steps.filter("#" + newStep);
|
||||
old.find(":input").not(".wizard-ignore").attr("disabled","disabled");
|
||||
current.find(":input").not(".wizard-ignore").removeAttr("disabled");
|
||||
var wizard = this;
|
||||
old.animate(wizard.options.outAnimation, wizard.options.outDuration, wizard.options.easing, function(){
|
||||
current.animate(wizard.options.inAnimation, wizard.options.inDuration, wizard.options.easing, function(){
|
||||
if(wizard.options.focusFirstInput)
|
||||
current.find(":input:first").focus();
|
||||
wizard._enableNavigation();
|
||||
|
||||
stepShownCallback.apply(wizard);
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
|
||||
_checkIflastStep : function(step){
|
||||
this.isLastStep = false;
|
||||
if($("#" + step).hasClass(this.options.submitStepClass) || this.steps.filter(":last").attr("id") == step){
|
||||
this.isLastStep = true;
|
||||
}
|
||||
},
|
||||
|
||||
_getLink : function(step){
|
||||
var link = undefined;
|
||||
var links = this.steps.filter("#" + step).find(this.options.linkClass);
|
||||
|
||||
if(links != undefined){
|
||||
if(links.filter(":radio,:checkbox").size() > 0){
|
||||
link = links.filter(this.options.linkClass + ":checked").val();
|
||||
}else{
|
||||
link = $(links).val();
|
||||
}
|
||||
}
|
||||
return link;
|
||||
},
|
||||
|
||||
_navigate : function(step){
|
||||
var link = this._getLink(step);
|
||||
if(link != undefined){
|
||||
if((link != "" && link != null && link != undefined) && this.steps.filter("#" + link).attr("id") != undefined){
|
||||
return link;
|
||||
}
|
||||
return this.currentStep;
|
||||
}else if(link == undefined && !this.isLastStep){
|
||||
var step1 = this.steps.filter("#" + step).next().attr("id");
|
||||
return step1;
|
||||
}
|
||||
},
|
||||
|
||||
_show : function(step){
|
||||
var backwards = false;
|
||||
var triggerStepShown = step !== undefined;
|
||||
if(step == undefined || step == ""){
|
||||
this.activatedSteps.pop();
|
||||
step = this.firstStep;
|
||||
this.activatedSteps.push(step);
|
||||
}else{
|
||||
if($.inArray(step, this.activatedSteps) > -1){
|
||||
backwards = true;
|
||||
this.activatedSteps.pop();
|
||||
}else {
|
||||
this.activatedSteps.push(step);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.currentStep !== step || step === this.firstStep){
|
||||
this.previousStep = this.currentStep;
|
||||
this._checkIflastStep(step);
|
||||
this.currentStep = step;
|
||||
var stepShownCallback = function(){if(triggerStepShown)$(this.element).trigger('step_shown', $.extend({"isBackNavigation" : backwards},this._state()));};
|
||||
this._animate(this.previousStep, step, stepShownCallback);
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
|
||||
_reset : function(){
|
||||
this.element.resetForm()
|
||||
$("label,:input,textarea",this).removeClass("error");
|
||||
for(var i = 0; i < this.activatedSteps.length; i++){
|
||||
this.steps.filter("#" + this.activatedSteps[i]).hide().find(":input").attr("disabled","disabled");
|
||||
}
|
||||
this.activatedSteps = new Array();
|
||||
this.previousStep = undefined;
|
||||
this.isLastStep = false;
|
||||
if(this.options.historyEnabled){
|
||||
this._updateHistory(this.firstStep);
|
||||
}else{
|
||||
this._show(this.firstStep);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_state : function(state){
|
||||
var currentState = { "settings" : this.options,
|
||||
"activatedSteps" : this.activatedSteps,
|
||||
"isLastStep" : this.isLastStep,
|
||||
"isFirstStep" : this.currentStep === this.firstStep,
|
||||
"previousStep" : this.previousStep,
|
||||
"currentStep" : this.currentStep,
|
||||
"backButton" : this.backButton,
|
||||
"nextButton" : this.nextButton,
|
||||
"steps" : this.steps,
|
||||
"firstStep" : this.firstStep
|
||||
}
|
||||
|
||||
if(state !== undefined)
|
||||
return currentState[state];
|
||||
|
||||
return currentState;
|
||||
},
|
||||
|
||||
/*Methods*/
|
||||
|
||||
show : function(step){
|
||||
if(this.options.historyEnabled){
|
||||
this._updateHistory(step);
|
||||
}else{
|
||||
this._show(step);
|
||||
}
|
||||
},
|
||||
|
||||
state : function(state){
|
||||
return this._state(state);
|
||||
},
|
||||
|
||||
reset : function(){
|
||||
this._reset();
|
||||
},
|
||||
|
||||
next : function(){
|
||||
this._next();
|
||||
},
|
||||
|
||||
back : function(){
|
||||
this._back();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.element.find("*").removeAttr("disabled").show();
|
||||
this.nextButton.unbind("click").val(this.nextButtonInitinalValue).removeClass("ui-state-disabled").addClass("ui-state-active");
|
||||
this.backButton.unbind("click").val(this.backButtonInitinalValue).removeClass("ui-state-disabled").addClass("ui-state-active");
|
||||
this.backButtonInitinalValue = undefined;
|
||||
this.nextButtonInitinalValue = undefined;
|
||||
this.activatedSteps = undefined;
|
||||
this.previousStep = undefined;
|
||||
this.currentStep = undefined;
|
||||
this.isLastStep = undefined;
|
||||
this.options = undefined;
|
||||
this.nextButton = undefined;
|
||||
this.backButton = undefined;
|
||||
this.formwizard = undefined;
|
||||
this.element = undefined;
|
||||
this.steps = undefined;
|
||||
this.firstStep = undefined;
|
||||
},
|
||||
|
||||
update_steps : function(){
|
||||
this.steps = this.element.find(".step").addClass("ui-formwizard-content");
|
||||
this.steps.not("#" + this.currentStep).hide().find(":input").addClass("ui-wizard-content").attr("disabled","disabled");
|
||||
this._checkIflastStep(this.currentStep);
|
||||
this._enableNavigation();
|
||||
if(!this.options.disableUIStyles){
|
||||
this.steps.addClass("ui-helper-reset ui-corner-all");
|
||||
this.steps.find(":input").addClass("ui-helper-reset ui-state-default");
|
||||
}
|
||||
},
|
||||
|
||||
options: {
|
||||
historyEnabled : false,
|
||||
validationEnabled : false,
|
||||
validationOptions : undefined,
|
||||
formPluginEnabled : false,
|
||||
linkClass : ".link",
|
||||
submitStepClass : "submit_step",
|
||||
back : ":reset",
|
||||
next : ":submit",
|
||||
textSubmit : 'Submit',
|
||||
textNext : 'Next',
|
||||
textBack : 'Back',
|
||||
remoteAjax : undefined,
|
||||
inAnimation : {opacity: 'show'},
|
||||
outAnimation: {opacity: 'hide'},
|
||||
inDuration : 400,
|
||||
outDuration: 400,
|
||||
easing: 'swing',
|
||||
focusFirstInput : false,
|
||||
disableInputFields : true,
|
||||
formOptions : { reset: true, success: function(data) { if( (window['console'] !== undefined) ){console.log("%s", "form submit successful");}},
|
||||
disableUIStyles : false
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
jQuery Masked Input Plugin
|
||||
Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
|
||||
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
||||
Version: 1.4.1
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a<g.placeholder.length?a:0)}function q(a){for(;++a<n&&!j[a];);return a}function r(a){for(;--a>=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.begin<l&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}else{for(A(!0);b.begin<n&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}h()}function v(){A(),B.val()!=E&&B.change()}function w(a){if(!B.prop("readonly")){var b,c,e,f=a.which||a.keyCode;o=B.val(),8===f||46===f||d&&127===f?(b=B.caret(),c=b.begin,e=b.end,e-c===0&&(c=46!==f?r(c):e=q(c-1),e=46===f?q(e):e),y(c,e),s(c,e-1),a.preventDefault()):13===f?v.call(this,a):27===f&&(B.val(E),B.caret(0,A()),a.preventDefault())}}function x(b){if(!B.prop("readonly")){var c,d,e,g=b.which||b.keyCode,i=B.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>g)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++<e.length;)if(c=e.charAt(d-1),j[b].test(c)){C[b]=c,f=b;break}if(d>e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
|
||||
@@ -0,0 +1,107 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
maruti.init();
|
||||
|
||||
$('#add-event-submit').click(function(){
|
||||
maruti.add_event();
|
||||
});
|
||||
|
||||
$('#event-name').keypress(function(e){
|
||||
if(e.which == 13) {
|
||||
maruti.add_event();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
maruti = {
|
||||
|
||||
// === Initialize the fullCalendar and external draggable events === //
|
||||
init: function() {
|
||||
// Prepare the dates
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
$('#fullcalendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next',
|
||||
center: 'title',
|
||||
right: 'month,basicWeek,basicDay'
|
||||
},
|
||||
editable: true,
|
||||
droppable: true, // this allows things to be dropped onto the calendar !!!
|
||||
drop: function(date, allDay) { // this function is called when something is dropped
|
||||
|
||||
// retrieve the dropped element's stored Event Object
|
||||
var originalEventObject = $(this).data('eventObject');
|
||||
|
||||
// we need to copy it, so that multiple events don't have a reference to the same object
|
||||
var copiedEventObject = $.extend({}, originalEventObject);
|
||||
|
||||
// assign it the date that was reported
|
||||
copiedEventObject.start = date;
|
||||
copiedEventObject.allDay = allDay;
|
||||
|
||||
// render the event on the calendar
|
||||
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
|
||||
$('#fullcalendar').fullCalendar('renderEvent', copiedEventObject, true);
|
||||
|
||||
// is the "remove after drop" checkbox checked?
|
||||
|
||||
// if so, remove the element from the "Draggable Events" list
|
||||
$(this).remove();
|
||||
|
||||
}
|
||||
});
|
||||
this.external_events();
|
||||
},
|
||||
|
||||
// === Adds an event if name is provided === //
|
||||
add_event: function(){
|
||||
if($('#event-name').val() != '') {
|
||||
var event_name = $('#event-name').val();
|
||||
$('#external-events .panel-content').append('<div class="external-event ui-draggable label label-inverse">'+event_name+'</div>');
|
||||
this.external_events();
|
||||
$('#modal-add-event').modal('hide');
|
||||
$('#event-name').val('');
|
||||
} else {
|
||||
this.show_error();
|
||||
}
|
||||
},
|
||||
|
||||
// === Initialize the draggable external events === //
|
||||
external_events: function(){
|
||||
/* initialize the external events
|
||||
-----------------------------------------------------------------*/
|
||||
$('#external-events div.external-event').each(function() {
|
||||
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
||||
// it doesn't need to have a start or end
|
||||
var eventObject = {
|
||||
title: $.trim($(this).text()) // use the element's text as the event title
|
||||
};
|
||||
|
||||
// store the Event Object in the DOM element so we can get to it later
|
||||
$(this).data('eventObject', eventObject);
|
||||
|
||||
// make the event draggable using jQuery UI
|
||||
$(this).draggable({
|
||||
zIndex: 999,
|
||||
revert: true, // will cause the event to go back to its
|
||||
revertDuration: 0 // original position after the drag
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// === Show error if no event name is provided === //
|
||||
show_error: function(){
|
||||
$('#modal-error').remove();
|
||||
$('<div style="border-radius: 5px; top: 70px; font-size:14px; left: 50%; margin-left: -70px; position: absolute;width: 140px; background-color: #f00; text-align: center; padding: 5px; color: #ffffff;" id="modal-error">Enter event name!</div>').appendTo('#modal-add-event .modal-body');
|
||||
$('#modal-error').delay('1500').fadeOut(700,function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [], cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [], cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
|
||||
// === Make chart === //
|
||||
var plot = $.plot($(".chart"),
|
||||
[ { data: sin, label: "sin(x)", color: "#ee7951"}, { data: cos, label: "cos(x)",color: "#4fb9f0" } ], {
|
||||
series: {
|
||||
lines: { show: true },
|
||||
points: { show: true }
|
||||
},
|
||||
grid: { hoverable: true, clickable: true },
|
||||
yaxis: { min: -1.6, max: 1.6 }
|
||||
});
|
||||
|
||||
// === Point hover in chart === //
|
||||
var previousPoint = null;
|
||||
$(".chart").bind("plothover", function (event, pos, item) {
|
||||
|
||||
if (item) {
|
||||
if (previousPoint != item.dataIndex) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
$('#tooltip').fadeOut(200,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var x = item.datapoint[0].toFixed(2),
|
||||
y = item.datapoint[1].toFixed(2);
|
||||
|
||||
maruti.flot_tooltip(item.pageX, item.pageY,item.series.label + " of " + x + " = " + y);
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#tooltip').fadeOut(200,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var data = [];
|
||||
var series = Math.floor(Math.random()*10)+1;
|
||||
for( var i = 0; i<series; i++)
|
||||
{
|
||||
data[i] = { label: "Series"+(i+1), data: Math.floor(Math.random()*100)+1 }
|
||||
}
|
||||
|
||||
var pie = $.plot($(".pie"), data,{
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
formatter: function(label, series){
|
||||
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'+label+'<br/>'+Math.round(series.percent)+'%</div>';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.5,
|
||||
color: '#000'
|
||||
}
|
||||
},
|
||||
innerRadius: 0.2
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
});
|
||||
var d1 = [];
|
||||
for (var i = 0; i <= 10; i += 1) d1.push([i, parseInt(Math.random() * 30)]);
|
||||
|
||||
var data = new Array();
|
||||
data.push({
|
||||
data:d1,
|
||||
bars: {
|
||||
show: true,
|
||||
barWidth: 0.4,
|
||||
order: 1,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Display graph
|
||||
var bar = $.plot($(".bars"), data, {
|
||||
legend: true
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
maruti = {
|
||||
// === Tooltip for flot charts === //
|
||||
flot_tooltip: function(x, y, contents) {
|
||||
|
||||
$('<div id="tooltip">' + contents + '</div>').css( {
|
||||
top: y + 5,
|
||||
left: x + 5
|
||||
}).appendTo("body").fadeIn(200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var msg_template = '<p><span class="msg-block"><strong></strong><span class="time"></span><span class="msg"></span></span></p>';
|
||||
|
||||
$('.chat-message button').click(function(){
|
||||
var input = $(this).siblings('span').children('input[type=text]');
|
||||
if(input.val() != ''){
|
||||
add_message('You','img/demo/av1.jpg',input.val(),true);
|
||||
}
|
||||
});
|
||||
|
||||
$('.chat-message input').keypress(function(e){
|
||||
if(e.which == 13) {
|
||||
if($(this).val() != ''){
|
||||
add_message('You','img/demo/av1.jpg',$(this).val(),true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function(){
|
||||
add_message('Linda','img/demo/av2.jpg','Hello Every one do u want to freindship with me?')
|
||||
},'1000');
|
||||
setTimeout(function(){
|
||||
add_message('Mark','img/demo/av3.jpg','Yuppi! why not sirji!!.')
|
||||
},'4000');
|
||||
setTimeout(function(){
|
||||
add_message('Linda','img/demo/av2.jpg','Thanks!!! See you soon than')
|
||||
},'8000');
|
||||
setTimeout(function(){
|
||||
add_message('Mark','img/demo/av3.jpg','ok Bye than!!!.')
|
||||
},'12000');
|
||||
setTimeout(function(){
|
||||
remove_user('Linda','Linda')
|
||||
},'16000');
|
||||
var i = 0;
|
||||
function add_message(name,img,msg,clear) {
|
||||
i = i + 1;
|
||||
var inner = $('#chat-messages-inner');
|
||||
var time = new Date();
|
||||
var hours = time.getHours();
|
||||
var minutes = time.getMinutes();
|
||||
if(hours < 10) hours = '0' + hours;
|
||||
if(minutes < 10) minutes = '0' + minutes;
|
||||
var id = 'msg-'+i;
|
||||
var idname = name.replace(' ','-').toLowerCase();
|
||||
inner.append('<p id="'+id+'" class="user-'+idname+'">'
|
||||
+'<span class="msg-block"><img src="'+img+'" alt="" /><strong>'+name+'</strong> <span class="time">- '+hours+':'+minutes+'</span>'
|
||||
+'<span class="msg">'+msg+'</span></span></p>');
|
||||
$('#'+id).hide().fadeIn(800);
|
||||
if(clear) {
|
||||
$('.chat-message input').val('').focus();
|
||||
}
|
||||
$('#chat-messages').animate({ scrollTop: inner.height() },1000);
|
||||
}
|
||||
function remove_user(userid,name) {
|
||||
i = i + 1;
|
||||
$('.contact-list li#user-'+userid).addClass('offline').delay(1000).slideUp(800,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var inner = $('#chat-messages-inner');
|
||||
var id = 'msg-'+i;
|
||||
inner.append('<p class="offline" id="'+id+'"><span>User '+name+' left the chat</span></p>');
|
||||
$('#'+id).hide().fadeIn(800);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,164 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
|
||||
// === Prepare peity charts === //
|
||||
maruti.peity();
|
||||
|
||||
// === Prepare the chart data ===/
|
||||
var sin = [], cos = [];
|
||||
for (var i = 0; i < 14; i += 0.5) {
|
||||
sin.push([i, Math.sin(i)]);
|
||||
cos.push([i, Math.cos(i)]);
|
||||
}
|
||||
|
||||
// === Make chart === //
|
||||
var plot = $.plot($(".chart"),
|
||||
[ { data: sin, label: "sin(x)", color: "#ee7951"}, { data: cos, label: "cos(x)",color: "#4fb9f0" } ], {
|
||||
series: {
|
||||
lines: { show: true },
|
||||
points: { show: true }
|
||||
},
|
||||
grid: { hoverable: true, clickable: true },
|
||||
yaxis: { min: -1.6, max: 1.6 }
|
||||
});
|
||||
|
||||
// === Point hover in chart === //
|
||||
var previousPoint = null;
|
||||
$(".chart").bind("plothover", function (event, pos, item) {
|
||||
|
||||
if (item) {
|
||||
if (previousPoint != item.dataIndex) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
$('#tooltip').fadeOut(200,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var x = item.datapoint[0].toFixed(2),
|
||||
y = item.datapoint[1].toFixed(2);
|
||||
|
||||
maruti.flot_tooltip(item.pageX, item.pageY,item.series.label + " of " + x + " = " + y);
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#tooltip').fadeOut(200,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// === Calendar === //
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
||||
$('.calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next',
|
||||
center: 'title',
|
||||
right: 'month,basicWeek,basicDay'
|
||||
},
|
||||
editable: true,
|
||||
events: [
|
||||
{
|
||||
title: 'All day event',
|
||||
start: new Date(y, m, 1)
|
||||
},
|
||||
{
|
||||
title: 'Long event',
|
||||
start: new Date(y, m, 5),
|
||||
end: new Date(y, m, 8)
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating event',
|
||||
start: new Date(y, m, 2, 16, 0),
|
||||
end: new Date(y, m, 3, 18, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
title: 'Repeating event',
|
||||
start: new Date(y, m, 9, 16, 0),
|
||||
end: new Date(y, m, 10, 18, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Lunch',
|
||||
start: new Date(y, m, 14, 12, 0),
|
||||
end: new Date(y, m, 15, 14, 0),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Birthday PARTY',
|
||||
start: new Date(y, m, 18),
|
||||
end: new Date(y, m, 20),
|
||||
allDay: false
|
||||
},
|
||||
{
|
||||
title: 'Click for Google',
|
||||
start: new Date(y, m, 27),
|
||||
end: new Date(y, m, 29),
|
||||
url: 'http://www.google.com'
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
maruti = {
|
||||
// === Peity charts === //
|
||||
peity: function(){
|
||||
$.fn.peity.defaults.line = {
|
||||
strokeWidth: 1,
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50
|
||||
};
|
||||
$.fn.peity.defaults.bar = {
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50
|
||||
};
|
||||
$(".peity_line_good span").peity("line", {
|
||||
colour: "#57a532",
|
||||
strokeColour: "#459D1C"
|
||||
});
|
||||
$(".peity_line_bad span").peity("line", {
|
||||
colour: "#FFC4C7",
|
||||
strokeColour: "#BA1E20"
|
||||
});
|
||||
$(".peity_line_neutral span").peity("line", {
|
||||
colour: "#CCCCCC",
|
||||
strokeColour: "#757575"
|
||||
});
|
||||
$(".peity_bar_good span").peity("bar", {
|
||||
colour: "#459D1C"
|
||||
});
|
||||
$(".peity_bar_bad span").peity("bar", {
|
||||
colour: "#BA1E20"
|
||||
});
|
||||
$(".peity_bar_neutral span").peity("bar", {
|
||||
colour: "#4fb9f0"
|
||||
});
|
||||
},
|
||||
|
||||
// === Tooltip for flot charts === //
|
||||
flot_tooltip: function(x, y, contents) {
|
||||
|
||||
$('<div id="tooltip">' + contents + '</div>').css( {
|
||||
top: y + 5,
|
||||
left: x + 5
|
||||
}).appendTo("body").fadeIn(200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('input[type=checkbox],input[type=radio],input[type=file]').uniform();
|
||||
|
||||
$('select').select2();
|
||||
$('.colorpicker').colorpicker();
|
||||
$('.datepicker').datepicker();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
//------------- Tags plugin -------------//
|
||||
|
||||
$("#tags").select2({
|
||||
tags:["red", "green", "blue", "orange"]
|
||||
});
|
||||
|
||||
//------------- Elastic textarea -------------//
|
||||
if ($('textarea').hasClass('elastic')) {
|
||||
$('.elastic').elastic();
|
||||
}
|
||||
|
||||
//------------- Input limiter -------------//
|
||||
if ($('textarea').hasClass('limit')) {
|
||||
$('.limit').inputlimiter({
|
||||
limit: 100
|
||||
});
|
||||
}
|
||||
|
||||
//------------- Masked input fields -------------//
|
||||
$("#mask-phone").mask("(999) 999-99-99", {completed:function(){alert("Callback action after complete");}});
|
||||
$("#mask-phone2").mask("(999) 999-99-99", {completed:function(){alert("Callback action after complete");}});
|
||||
$("#mask-phoneExt").mask("(999) 999-9999? x99999");
|
||||
$("#mask-phoneInt").mask("+40 999 999 999");
|
||||
$("#mask-date").mask("99/99/9999");
|
||||
$("#mask-ssn").mask("999-99-9999");
|
||||
$("#mask-productKey").mask("a*-999-a999", { placeholder: "*" });
|
||||
$("#mask-eyeScript").mask("~9.99 ~9.99 999");
|
||||
$("#mask-percent").mask("99%");
|
||||
|
||||
//------------- Toggle button -------------//
|
||||
|
||||
$('.normal-toggle-button').toggleButtons();
|
||||
$('.text-toggle-button').toggleButtons({
|
||||
width: 140,
|
||||
label: {
|
||||
enabled: "ONLINE",
|
||||
disabled: "OFFLINE"
|
||||
}
|
||||
});
|
||||
$('.iToggle-button').toggleButtons({
|
||||
width: 70,
|
||||
label: {
|
||||
enabled: "<span class='icon16 icomoon-icon-checkmark-2 white'></span>",
|
||||
disabled: "<span class='icon16 icomoon-icon-cancel-3 white marginL5'></span>"
|
||||
}
|
||||
});
|
||||
|
||||
//------------- Spinners with steps -------------//
|
||||
$( "#spinner1" ).spinner();
|
||||
|
||||
/*Demacial*/
|
||||
$( "#spinner2" ).spinner({
|
||||
step: 0.01,
|
||||
numberFormat: "n"
|
||||
});
|
||||
|
||||
/*Custom step size*/
|
||||
$( "#spinner3" ).spinner({
|
||||
step: 5
|
||||
});
|
||||
|
||||
/*Currency spinner*/
|
||||
$( "#spinner4" ).spinner({
|
||||
numberFormat: "C"
|
||||
});
|
||||
|
||||
//------------- Colorpicker -------------//
|
||||
if($('div').hasClass('picker')){
|
||||
$('.picker').farbtastic('#color');
|
||||
}
|
||||
//------------- Datepicker -------------//
|
||||
if($('#datepicker').length) {
|
||||
$("#datepicker").datepicker({
|
||||
showOtherMonths:true
|
||||
});
|
||||
}
|
||||
if($('#datepicker-inline').length) {
|
||||
$('#datepicker-inline').datepicker({
|
||||
inline: true,
|
||||
showOtherMonths:true
|
||||
});
|
||||
}
|
||||
|
||||
//------------- Combined picker -------------//
|
||||
if($('#combined-picker').length) {
|
||||
$('#combined-picker').datetimepicker();
|
||||
}
|
||||
|
||||
//------------- Time entry (picker) -------------//
|
||||
$('#timepicker').timeEntry({
|
||||
show24Hours: true,
|
||||
spinnerImage: ''
|
||||
});
|
||||
$('#timepicker').timeEntry('setTime', '22:15')
|
||||
|
||||
//------------- Select plugin -------------//
|
||||
$("#select1").select2();
|
||||
$("#select2").select2();
|
||||
|
||||
//--------------- Dual multi select ------------------//
|
||||
$.configureBoxes();
|
||||
|
||||
//--------------- Tinymce ------------------//
|
||||
$('textarea.tinymce').tinymce({
|
||||
// Location of TinyMCE script
|
||||
script_url : 'plugins/forms/tiny_mce/tiny_mce.js',
|
||||
|
||||
// General options
|
||||
theme : "advanced",
|
||||
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
|
||||
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
|
||||
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
|
||||
// Example content CSS (should be your site CSS)
|
||||
content_css : "css/main.css",
|
||||
|
||||
// Drop lists for link/image/media/template dialogs
|
||||
template_external_list_url : "lists/template_list.js",
|
||||
external_link_list_url : "lists/link_list.js",
|
||||
external_image_list_url : "lists/image_list.js",
|
||||
media_external_list_url : "lists/media_list.js",
|
||||
|
||||
// Replace values for the template plugin
|
||||
template_replace_values : {
|
||||
username : "SuprUser",
|
||||
staffid : "991234"
|
||||
}
|
||||
});
|
||||
|
||||
//Boostrap modal
|
||||
$('#myModal').modal({ show: false});
|
||||
|
||||
//add event to modal after closed
|
||||
$('#myModal').on('hidden', function () {
|
||||
console.log('modal is closed');
|
||||
})
|
||||
|
||||
});//End document ready functions
|
||||
|
||||
//sparkline in sidebar area
|
||||
var positive = [1,5,3,7,8,6,10];
|
||||
var negative = [10,6,8,7,3,5,1]
|
||||
var negative1 = [7,6,8,7,6,5,4]
|
||||
|
||||
$('#stat1').sparkline(positive,{
|
||||
height:15,
|
||||
spotRadius: 0,
|
||||
barColor: '#9FC569',
|
||||
type: 'bar'
|
||||
});
|
||||
$('#stat2').sparkline(negative,{
|
||||
height:15,
|
||||
spotRadius: 0,
|
||||
barColor: '#ED7A53',
|
||||
type: 'bar'
|
||||
});
|
||||
$('#stat3').sparkline(negative1,{
|
||||
height:15,
|
||||
spotRadius: 0,
|
||||
barColor: '#ED7A53',
|
||||
type: 'bar'
|
||||
});
|
||||
$('#stat4').sparkline(positive,{
|
||||
height:15,
|
||||
spotRadius: 0,
|
||||
barColor: '#9FC569',
|
||||
type: 'bar'
|
||||
});
|
||||
//sparkline in widget
|
||||
$('#stat5').sparkline(positive,{
|
||||
height:15,
|
||||
spotRadius: 0,
|
||||
barColor: '#9FC569',
|
||||
type: 'bar'
|
||||
});
|
||||
|
||||
$('#stat6').sparkline(positive, {
|
||||
width: 70,//Width of the chart - Defaults to 'auto' - May be any valid css width - 1.5em, 20px, etc (using a number without a unit specifier won't do what you want) - This option does nothing for bar and tristate chars (see barWidth)
|
||||
height: 20,//Height of the chart - Defaults to 'auto' (line height of the containing tag)
|
||||
lineColor: '#88bbc8',//Used by line and discrete charts to specify the colour of the line drawn as a CSS values string
|
||||
fillColor: '#f2f7f9',//Specify the colour used to fill the area under the graph as a CSS value. Set to false to disable fill
|
||||
spotColor: '#e72828',//The CSS colour of the final value marker. Set to false or an empty string to hide it
|
||||
maxSpotColor: '#005e20',//The CSS colour of the marker displayed for the maximum value. Set to false or an empty string to hide it
|
||||
minSpotColor: '#f7941d',//The CSS colour of the marker displayed for the mimum value. Set to false or an empty string to hide it
|
||||
spotRadius: 3,//Radius of all spot markers, In pixels (default: 1.5) - Integer
|
||||
lineWidth: 2//In pixels (default: 1) - Integer
|
||||
});
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('input[type=checkbox],input[type=radio],input[type=file]').uniform();
|
||||
|
||||
$('select').select2();
|
||||
|
||||
// Form Validation
|
||||
$("#basic_validate").validate({
|
||||
rules:{
|
||||
required:{
|
||||
required:true
|
||||
},
|
||||
email:{
|
||||
required:true,
|
||||
email: true
|
||||
},
|
||||
date:{
|
||||
required:true,
|
||||
date: true
|
||||
},
|
||||
url:{
|
||||
required:true,
|
||||
url: true
|
||||
}
|
||||
},
|
||||
errorClass: "help-inline",
|
||||
errorElement: "span",
|
||||
highlight:function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').addClass('error');
|
||||
},
|
||||
unhighlight: function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').removeClass('error');
|
||||
$(element).parents('.control-group').addClass('success');
|
||||
}
|
||||
});
|
||||
|
||||
$("#number_validate").validate({
|
||||
rules:{
|
||||
min:{
|
||||
required: true,
|
||||
min:10
|
||||
},
|
||||
max:{
|
||||
required:true,
|
||||
max:24
|
||||
},
|
||||
number:{
|
||||
required:true,
|
||||
number:true
|
||||
}
|
||||
},
|
||||
errorClass: "help-inline",
|
||||
errorElement: "span",
|
||||
highlight:function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').addClass('error');
|
||||
},
|
||||
unhighlight: function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').removeClass('error');
|
||||
$(element).parents('.control-group').addClass('success');
|
||||
}
|
||||
});
|
||||
|
||||
$("#password_validate").validate({
|
||||
rules:{
|
||||
pwd:{
|
||||
required: true,
|
||||
minlength:6,
|
||||
maxlength:20
|
||||
},
|
||||
pwd2:{
|
||||
required:true,
|
||||
minlength:6,
|
||||
maxlength:20,
|
||||
equalTo:"#pwd"
|
||||
}
|
||||
},
|
||||
errorClass: "help-inline",
|
||||
errorElement: "span",
|
||||
highlight:function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').addClass('error');
|
||||
},
|
||||
unhighlight: function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').removeClass('error');
|
||||
$(element).parents('.control-group').addClass('success');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// === jQuery Peity === //
|
||||
$.fn.peity.defaults.line = {
|
||||
strokeWidth: 1,
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50
|
||||
};
|
||||
$.fn.peity.defaults.bar = {
|
||||
delimeter: ",",
|
||||
height: 24,
|
||||
max: null,
|
||||
min: 0,
|
||||
width: 50
|
||||
};
|
||||
$(".peity_line_good span").peity("line", {
|
||||
colour: "#B1FFA9",
|
||||
strokeColour: "#459D1C"
|
||||
});
|
||||
$(".peity_line_bad span").peity("line", {
|
||||
colour: "#FFC4C7",
|
||||
strokeColour: "#BA1E20"
|
||||
});
|
||||
$(".peity_line_neutral span").peity("line", {
|
||||
colour: "#CCCCCC",
|
||||
strokeColour: "#757575"
|
||||
});
|
||||
$(".peity_bar_good span").peity("bar", {
|
||||
colour: "#459D1C"
|
||||
});
|
||||
$(".peity_bar_bad span").peity("bar", {
|
||||
colour: "#BA1E20"
|
||||
});
|
||||
$(".peity_bar_neutral span").peity("bar", {
|
||||
colour: "#757575"
|
||||
});
|
||||
|
||||
// === jQeury Gritter, a growl-like notifications === //
|
||||
$.gritter.add({
|
||||
title: 'Important Unread messages',
|
||||
text: 'You have 12 unread messages.',
|
||||
image: 'img/demo/envelope.png',
|
||||
sticky: false
|
||||
});
|
||||
$('#gritter-notify .normal').click(function(){
|
||||
$.gritter.add({
|
||||
title: 'Normal notification',
|
||||
text: 'This is a normal notification',
|
||||
sticky: false
|
||||
});
|
||||
});
|
||||
|
||||
$('#gritter-notify .sticky').click(function(){
|
||||
$.gritter.add({
|
||||
title: 'Sticky notification',
|
||||
text: 'This is a sticky notification',
|
||||
sticky: true
|
||||
});
|
||||
});
|
||||
|
||||
$('#gritter-notify .image').click(function(){
|
||||
var imgsrc = $(this).attr('data-image');
|
||||
$.gritter.add({
|
||||
title: 'Important Unread messages',
|
||||
text: 'You have 12 unread messages.',
|
||||
image: imgsrc,
|
||||
sticky: false
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,165 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// === Sidebar navigation === //
|
||||
|
||||
$('.submenu > a').click(function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var submenu = $(this).siblings('ul');
|
||||
var li = $(this).parents('li');
|
||||
var submenus = $('#sidebar li.submenu ul');
|
||||
var submenus_parents = $('#sidebar li.submenu');
|
||||
if(li.hasClass('open'))
|
||||
{
|
||||
if(($(window).width() > 768) || ($(window).width() < 479)) {
|
||||
submenu.slideUp();
|
||||
} else {
|
||||
submenu.fadeOut(250);
|
||||
}
|
||||
li.removeClass('open');
|
||||
} else
|
||||
{
|
||||
if(($(window).width() > 768) || ($(window).width() < 479)) {
|
||||
submenus.slideUp();
|
||||
submenu.slideDown();
|
||||
} else {
|
||||
submenus.fadeOut(250);
|
||||
submenu.fadeIn(250);
|
||||
}
|
||||
submenus_parents.removeClass('open');
|
||||
li.addClass('open');
|
||||
}
|
||||
});
|
||||
|
||||
var ul = $('#sidebar > ul');
|
||||
|
||||
$('#sidebar > a').click(function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var sidebar = $('#sidebar');
|
||||
if(sidebar.hasClass('open'))
|
||||
{
|
||||
sidebar.removeClass('open');
|
||||
ul.slideUp(250);
|
||||
} else
|
||||
{
|
||||
sidebar.addClass('open');
|
||||
ul.slideDown(250);
|
||||
}
|
||||
});
|
||||
|
||||
// === Resize window related === //
|
||||
$(window).resize(function()
|
||||
{
|
||||
if($(window).width() > 479)
|
||||
{
|
||||
ul.css({'display':'block'});
|
||||
$('#content-header .btn-group').css({width:'auto'});
|
||||
}
|
||||
if($(window).width() < 479)
|
||||
{
|
||||
ul.css({'display':'none'});
|
||||
fix_position();
|
||||
}
|
||||
if($(window).width() > 768)
|
||||
{
|
||||
$('#user-nav > ul').css({width:'auto',margin:'0'});
|
||||
$('#content-header .btn-group').css({width:'auto'});
|
||||
}
|
||||
});
|
||||
|
||||
if($(window).width() < 468)
|
||||
{
|
||||
ul.css({'display':'none'});
|
||||
fix_position();
|
||||
}
|
||||
|
||||
if($(window).width() > 479)
|
||||
{
|
||||
$('#content-header .btn-group').css({width:'auto'});
|
||||
ul.css({'display':'block'});
|
||||
}
|
||||
|
||||
// === Tooltips === //
|
||||
$('.tip').tooltip();
|
||||
$('.tip-left').tooltip({ placement: 'left' });
|
||||
$('.tip-right').tooltip({ placement: 'right' });
|
||||
$('.tip-top').tooltip({ placement: 'top' });
|
||||
$('.tip-bottom').tooltip({ placement: 'bottom' });
|
||||
|
||||
// === Search input typeahead === //
|
||||
$('#search input[type=text]').typeahead({
|
||||
source: ['Dashboard','Form elements','Common Elements','Validation','Wizard','Buttons','Icons','Interface elements','Support','Calendar','Gallery','Reports','Charts','Graphs','Widgets'],
|
||||
items: 4
|
||||
});
|
||||
|
||||
// === Fixes the position of buttons group in content header and top user navigation === //
|
||||
function fix_position()
|
||||
{
|
||||
var uwidth = $('#user-nav > ul').width();
|
||||
$('#user-nav > ul').css({width:uwidth,'margin-left':'-' + uwidth / 2 + 'px'});
|
||||
|
||||
var cwidth = $('#content-header .btn-group').width();
|
||||
$('#content-header .btn-group').css({width:cwidth,'margin-left':'-' + uwidth / 2 + 'px'});
|
||||
}
|
||||
|
||||
// === Style switcher === //
|
||||
$('#style-switcher i').click(function()
|
||||
{
|
||||
if($(this).hasClass('open'))
|
||||
{
|
||||
$(this).parent().animate({marginRight:'-=190'});
|
||||
$(this).removeClass('open');
|
||||
} else
|
||||
{
|
||||
$(this).parent().animate({marginRight:'+=190'});
|
||||
$(this).addClass('open');
|
||||
}
|
||||
$(this).toggleClass('icon-arrow-left');
|
||||
$(this).toggleClass('icon-arrow-right');
|
||||
});
|
||||
|
||||
$('#style-switcher a').click(function()
|
||||
{
|
||||
var style = $(this).attr('href').replace('#','');
|
||||
$('.skin-color').attr('href','css/maruti.'+style+'.css');
|
||||
$(this).siblings('a').css({'border-color':'transparent'});
|
||||
$(this).css({'border-color':'#aaaaaa'});
|
||||
});
|
||||
|
||||
$('.lightbox_trigger').click(function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var image_href = $(this).attr("href");
|
||||
|
||||
if ($('#lightbox').length > 0) {
|
||||
|
||||
$('#imgbox').html('<img src="' + image_href + '" /><p><i class="icon-remove icon-white"></i></p>');
|
||||
|
||||
$('#lightbox').slideDown(500);
|
||||
}
|
||||
|
||||
else {
|
||||
var lightbox =
|
||||
'<div id="lightbox" style="display:none;">' +
|
||||
'<div id="imgbox"><img src="' + image_href +'" />' +
|
||||
'<p><i class="icon-remove icon-white"></i></p>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
$('body').append(lightbox);
|
||||
$('#lightbox').slideDown(500);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#lightbox').live('click', function() {
|
||||
$('#lightbox').hide(200);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var login = $('#loginform');
|
||||
var recover = $('#recoverform');
|
||||
var speed = 400;
|
||||
|
||||
$('#to-recover').click(function(){
|
||||
|
||||
$("#loginform").slideUp();
|
||||
$("#recoverform").fadeIn();
|
||||
});
|
||||
$('#to-login').click(function(){
|
||||
|
||||
$("#recoverform").hide();
|
||||
$("#loginform").fadeIn();
|
||||
});
|
||||
|
||||
|
||||
$('#to-login').click(function(){
|
||||
|
||||
});
|
||||
|
||||
if($.browser.msie == true && $.browser.version.slice(0,3) < 10) {
|
||||
$('input[placeholder]').each(function(){
|
||||
|
||||
var input = $(this);
|
||||
|
||||
$(input).val(input.attr('placeholder'));
|
||||
|
||||
$(input).focus(function(){
|
||||
if (input.val() == input.attr('placeholder')) {
|
||||
input.val('');
|
||||
}
|
||||
});
|
||||
|
||||
$(input).blur(function(){
|
||||
if (input.val() == '' || input.val() == input.attr('placeholder')) {
|
||||
input.val(input.attr('placeholder'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
$(function ()
|
||||
{ $("#example, #example2, #example3, #example4").popover();
|
||||
});
|
||||
|
||||
|
||||
!function( $ ) {
|
||||
"use strict"
|
||||
var Popover = function ( element, options ) {
|
||||
this.init('popover', element, options)
|
||||
}
|
||||
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
||||
========================================== */
|
||||
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
||||
constructor: Popover
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
, title = this.getTitle()
|
||||
, content = this.getContent()
|
||||
$tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
|
||||
$tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
|
||||
$tip.removeClass('fade top bottom left right in')
|
||||
}
|
||||
, hasContent: function () {
|
||||
return this.getTitle() || this.getContent()
|
||||
}
|
||||
, getContent: function () {
|
||||
var content
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
content = $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
||||
content = content.toString().replace(/(^\s*|\s*$)/, "")
|
||||
return content
|
||||
}
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
})
|
||||
/* POPOVER PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
$.fn.popover = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('popover')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
$.fn.popover.Constructor = Popover
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
||||
placement: 'right'
|
||||
, content: ''
|
||||
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
|
||||
})
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('.data-table').dataTable({
|
||||
"bJQueryUI": true,
|
||||
"sPaginationType": "full_numbers",
|
||||
"sDom": '<""l>t<"F"fp>'
|
||||
});
|
||||
|
||||
$('input[type=checkbox],input[type=radio],input[type=file]').uniform();
|
||||
|
||||
$('select').select2();
|
||||
|
||||
$("span.icon input:checkbox, th input:checkbox").click(function() {
|
||||
var checkedStatus = this.checked;
|
||||
var checkbox = $(this).parents('.widget-box').find('tr td:first-child input:checkbox');
|
||||
checkbox.each(function() {
|
||||
this.checked = checkedStatus;
|
||||
if (checkedStatus == this.checked) {
|
||||
$(this).closest('.checker > span').removeClass('checked');
|
||||
}
|
||||
if (this.checked) {
|
||||
$(this).closest('.checker > span').addClass('checked');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#form-wizard").formwizard({
|
||||
formPluginEnabled: true,
|
||||
validationEnabled: true,
|
||||
focusFirstInput : true,
|
||||
disableUIStyles : true,
|
||||
|
||||
formOptions :{
|
||||
success: function(data){$("#status").fadeTo(500,1,function(){ $(this).html("<span>Form was submitted!</span>").fadeTo(5000, 0); })},
|
||||
beforeSubmit: function(data){$("#submitted").html("<span>Form was submitted with ajax. Data sent to the server: " + $.param(data) + "</span>");},
|
||||
dataType: 'json',
|
||||
resetForm: true
|
||||
},
|
||||
validationOptions : {
|
||||
rules: {
|
||||
username: "required",
|
||||
password: "required",
|
||||
password2: {
|
||||
equalTo: "#password"
|
||||
},
|
||||
email: { required: true, email: true },
|
||||
eula: "required"
|
||||
},
|
||||
messages: {
|
||||
username: "Please enter your name or username",
|
||||
password: "You must enter the password",
|
||||
password2: { equalTo: "Password don't match" },
|
||||
email: { required: "Please, enter your email", email: "Correct email format is name@domain.com" },
|
||||
eula: "You must accept the eula"
|
||||
},
|
||||
errorClass: "help-inline",
|
||||
errorElement: "span",
|
||||
highlight:function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').addClass('error');
|
||||
},
|
||||
unhighlight: function(element, errorClass, validClass) {
|
||||
$(element).parents('.control-group').removeClass('error');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,170 @@
|
||||
$(function(){
|
||||
$('#example1').DataTable();
|
||||
$('#datatable').DataTable();
|
||||
$('#activemembers').DataTable();
|
||||
$('#wiki_list').DataTable({
|
||||
"language": {"url": "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Turkish.json"}
|
||||
});
|
||||
|
||||
$('.username').select2();
|
||||
|
||||
|
||||
$('body').on('click', '#selectAll', function () {
|
||||
if ($(this).hasClass('allChecked')) {
|
||||
$('input[type="checkbox"]', '#example').prop('checked', false);
|
||||
} else {
|
||||
$('input[type="checkbox"]', '#example').prop('checked', true);
|
||||
}
|
||||
$(this).toggleClass('allChecked');
|
||||
})
|
||||
|
||||
$('.link').click(function(){
|
||||
var name = $(this).attr("data-link");
|
||||
$("#title").val(name);
|
||||
|
||||
});
|
||||
|
||||
$('.status').click(function(){
|
||||
var stat = $(this).data("status");
|
||||
var id = $(this).data("id");
|
||||
$.post('ajax/duyuruStatusChange', {id:id, status:status}, function(response){
|
||||
location.reload();
|
||||
});
|
||||
})
|
||||
|
||||
$('.downloadStatus').click(function(){
|
||||
var stat = $(this).data("status");
|
||||
var id = $(this).data("id");
|
||||
$.post('ajax/downloadStatusChange', {id:id, status:status}, function(response){
|
||||
location.reload();
|
||||
});
|
||||
})
|
||||
|
||||
$('.sliderStat').click(function(){
|
||||
var id = $(this).attr("data-id");
|
||||
var status = $(this).attr("data-status");
|
||||
$.post('slayt/sliderStatusChange', {id:id, status:status}, function(response){
|
||||
location.reload();
|
||||
});
|
||||
})//sliderStat end
|
||||
|
||||
$(".activetionSend").click(function(){
|
||||
var param = $(this).data("id");
|
||||
|
||||
$.post('/panel/user/activemailSendAjax',{par:param},function(data, status, xhr){
|
||||
Swal.fire({
|
||||
title: data,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});//activetionSend
|
||||
|
||||
$(".sendform").click(function(){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: 'ajax/emailSend',
|
||||
data: $('#cevap1').serialize(),
|
||||
success:function(cvp){
|
||||
|
||||
$.confirm({
|
||||
title: 'Pisilinux Eposta!',
|
||||
content: cvp,
|
||||
theme: 'dark',
|
||||
buttons: {
|
||||
Mesajlar: function(){
|
||||
$(location).attr('href', '/panel/iletisim');
|
||||
},
|
||||
Anasayfa: function(){
|
||||
$(location).attr('href', '/panel');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(".delete_member").click(function(){
|
||||
|
||||
var param = $(this).data("id");
|
||||
Swal.fire({
|
||||
title: 'Üyeyi Silmek İstediğinizden Eminmisiniz?',
|
||||
text: "Bu işlemi geri alamazsınız",
|
||||
icon: 'error',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'EVET ÜYEYİ SİL',
|
||||
cancelButtonText: 'Silme'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$.post('user/deleteMemberAjax',{par:param},function(response){
|
||||
Swal.fire({
|
||||
title: response,
|
||||
timer: 1500,
|
||||
timerProgressBar: true,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
willClose: () => {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$(".disable_member").click(function(){
|
||||
var param = $(this).data("id");
|
||||
$.post('user/disableMemberAjax',{par:param},function(response){
|
||||
Swal.fire({
|
||||
title: response,
|
||||
timer: 2000,
|
||||
timerProgressBar: true,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
willClose: () => {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var sayac1 = Number($("#sayac").val())-1;
|
||||
|
||||
if(sayac1){
|
||||
|
||||
var sayac=sayac1+1;
|
||||
}else{
|
||||
var sayac=1;
|
||||
}
|
||||
|
||||
$('.add').click(function() {
|
||||
sayac++;
|
||||
var form = "<div class='control-group'><label class='control-label'>LINK"+sayac+" :</label><div class='controls pals' >";
|
||||
var form1 = "<select name='downlink["+sayac+"][]' class='span2 count' id='count'><option >Selected Countries</option></select>";
|
||||
var form2 = "<input type='text' name='downlink["+sayac+"][]' class='span8' required placeholder='link'><input type='hidden' name='downlink["+sayac+"][]' value='0'></div></div></div>";
|
||||
|
||||
$.getJSON('/countries.json', null, function(data) {
|
||||
$.each(data, function(idx, obj) {
|
||||
$(".count").append('<option value="'+obj.id+'">'+obj.name+'</option>' );
|
||||
});
|
||||
});
|
||||
|
||||
$(".download").append(form + form1+ form2);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,207 @@
|
||||
$(function(){
|
||||
|
||||
$('#example1').DataTable();
|
||||
$('#datatable').DataTable();
|
||||
$('#activemembers').DataTable();
|
||||
$('#wiki_list').DataTable({
|
||||
"language": {"url": "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Turkish.json"}
|
||||
});
|
||||
|
||||
$('.username').select2();
|
||||
|
||||
$('.ayarSec').click(function(){
|
||||
var id = $(this).attr("data-id")
|
||||
var title = $(this).attr("data-title")
|
||||
var value = $(this).attr("data-value")
|
||||
$(".modal-body #title").val( title );
|
||||
$(".modal-body #value").val( value );
|
||||
$(".modal-body #id").val( id );
|
||||
});
|
||||
|
||||
$('.logoValue').click(function(){
|
||||
var value = $(this).attr("data-value");
|
||||
$.post('selectLogo', {value:value}, function(rest){
|
||||
location.reload();
|
||||
// alert(rest)
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('body').on('click', '#selectAll', function () {
|
||||
if ($(this).hasClass('allChecked')) {
|
||||
$('input[type="checkbox"]', '#example').prop('checked', false);
|
||||
} else {
|
||||
$('input[type="checkbox"]', '#example').prop('checked', true);
|
||||
}
|
||||
$(this).toggleClass('allChecked');
|
||||
})
|
||||
|
||||
$('.link').click(function(){
|
||||
var name = $(this).attr("data-link");
|
||||
$("#title").val(name);
|
||||
|
||||
});
|
||||
|
||||
$('.status').click(function(){
|
||||
var stat = $(this).data("status");
|
||||
var id = $(this).data("id");
|
||||
$.post('ajax/duyuruStatusChange', {id:id, status:status}, function(response){
|
||||
|
||||
location.reload();
|
||||
});
|
||||
})
|
||||
|
||||
$('.sliderStat').click(function(){
|
||||
var id = $(this).attr("data-id");
|
||||
var status = $(this).attr("data-status");
|
||||
$.post('slayt/sliderStatusChange', {id:id, status:status}, function(response){
|
||||
location.reload();
|
||||
});
|
||||
})//sliderStat end
|
||||
|
||||
|
||||
$(".activetionSend").click(function(){
|
||||
var param = $(this).data("id");
|
||||
|
||||
$.post('/panel/user/activemailSendAjax',{par:param},function(data, status, xhr){
|
||||
Swal.fire({
|
||||
title: data,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});//activetionSend
|
||||
|
||||
$(".sendform").click(function(){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: 'ajax/emailSend',
|
||||
data: $('#cevap1').serialize(),
|
||||
success:function(cvp){
|
||||
|
||||
$.confirm({
|
||||
title: 'Pisilinux Eposta!',
|
||||
content: cvp,
|
||||
theme: 'dark',
|
||||
buttons: {
|
||||
Mesajlar: function(){
|
||||
$(location).attr('href', '/panel/iletisim');
|
||||
},
|
||||
Anasayfa: function(){
|
||||
$(location).attr('href', '/panel');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(".delete_member").click(function(){
|
||||
|
||||
var param = $(this).data("id");
|
||||
Swal.fire({
|
||||
title: 'Üyeyi Silmek İstediğinizden Eminmisiniz?',
|
||||
text: "Bu işlemi geri alamazsınız",
|
||||
icon: 'error',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'EVET ÜYEYİ SİL',
|
||||
cancelButtonText: 'Silme'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$.post('user/deleteMemberAjax',{par:param},function(response){
|
||||
Swal.fire({
|
||||
title: response,
|
||||
timer: 1500,
|
||||
timerProgressBar: true,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
willClose: () => {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$(".disable_member").click(function(){
|
||||
var param = $(this).data("id");
|
||||
$.post('user/disableMemberAjax',{par:param},function(response){
|
||||
Swal.fire({
|
||||
title: response,
|
||||
timer: 2000,
|
||||
timerProgressBar: true,
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
willClose: () => {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var sayac1 = Number($("#sayac").val())-1;
|
||||
|
||||
if(sayac1){
|
||||
|
||||
var sayac=sayac1+1;
|
||||
}else{
|
||||
var sayac=1;
|
||||
}
|
||||
|
||||
$('.add').click(function() {
|
||||
sayac++;
|
||||
var form = "<div class='control-group'><label class='control-label'>LINK"+sayac+" :</label><div class='controls pals' >";
|
||||
var form1 = "<select name='downlink["+sayac+"][]' class='span2 count' id='count'><option >Selected Countries</option></select>";
|
||||
var form2 = "<input type='text' name='downlink["+sayac+"][]' class='span8' required placeholder='link'><input type='hidden' name='downlink["+sayac+"][]' value='0'><input type='hidden' name='downlink["+sayac+"][]' value='1'></div></div></div>";
|
||||
|
||||
$.getJSON('/countries.json', null, function(data) {
|
||||
$.each(data, function(idx, obj) {
|
||||
$(".count").append('<option value="'+obj.id+'">'+obj.name+'</option>' );
|
||||
});
|
||||
});
|
||||
|
||||
$(".download").append(form + form1+ form2);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('.downlinkstatus').click(function(){
|
||||
var id = $(this).attr("data-id");
|
||||
var status = $(this).attr("data-status");
|
||||
$.post('/panel/download/downlinkdStatusChange', {id:id, status:status}, function(response){
|
||||
//alert(response);
|
||||
location.reload();
|
||||
});
|
||||
})
|
||||
|
||||
$('.downlinkDelete').click(function(){
|
||||
var id = $(this).attr("data-id");
|
||||
$.post('/panel/download/downlinkDelete', {id:id}, function(response){
|
||||
location.reload();
|
||||
})
|
||||
})
|
||||
|
||||
$('.downloadStatusChange').click(function(){
|
||||
var id = $(this).attr("data-id");
|
||||
var status = $(this).attr("data-status");
|
||||
$.post('/panel/download/downloadStatusChange', {id:id, status:status}, function(response){
|
||||
location.reload();
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright 2012 Igor Vaynberg
|
||||
|
||||
Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in
|
||||
compliance with the License. You may obtain a copy of the License in the LICENSE file, or 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(e){"undefined"==typeof e.fn.each2&&e.fn.extend({each2:function(g){for(var i=e([0]),m=-1,s=this.length;++m<s&&(i.context=i[0]=this[m])&&!1!==g.call(i[0],m,i););return this}})})(jQuery);
|
||||
(function(e,g){function i(a,b){var c=0,d=b.length,j;if("undefined"===typeof a)return-1;if(a.constructor===String)for(;c<d;c+=1){if(0===a.localeCompare(b[c]))return c}else for(;c<d;c+=1)if(j=b[c],j.constructor===String){if(0===j.localeCompare(a))return c}else if(j===a)return c;return-1}function m(a,b){return a===b?!0:a===g||b===g||null===a||null===b?!1:a.constructor===String?0===a.localeCompare(b):b.constructor===String?0===b.localeCompare(a):!1}function s(a,b){var c,d,j;if(null===a||1>a.length)return[];
|
||||
c=a.split(b);d=0;for(j=c.length;d<j;d+=1)c[d]=e.trim(c[d]);return c}function A(a,b,c){var c=c||g,d;return function(){var j=arguments;window.clearTimeout(d);d=window.setTimeout(function(){b.apply(c,j)},a)}}function l(a){a.preventDefault();a.stopPropagation()}function B(a,b,c){var d=a.toUpperCase().indexOf(b.toUpperCase()),b=b.length;0>d?c.push(a):(c.push(a.substring(0,d)),c.push("<span class='select2-match'>"),c.push(a.substring(d,d+b)),c.push("</span>"),c.push(a.substring(d+b,a.length)))}function C(a){var b,
|
||||
c=0,d=null,j=a.quietMillis||100;return function(h){window.clearTimeout(b);b=window.setTimeout(function(){var b=c+=1,j=a.data,n=a.transport||e.ajax,f=a.traditional||!1,g=a.type||"GET",j=j.call(this,h.term,h.page,h.context);null!==d&&d.abort();d=n.call(null,{url:a.url,dataType:a.dataType,data:j,type:g,traditional:f,success:function(d){b<c||(d=a.results(d,h.page),h.callback(d))}})},j)}}function D(a){var b=a,c,d=function(a){return""+a.text};e.isArray(b)||(d=b.text,e.isFunction(d)||(c=b.text,d=function(a){return a[c]}),
|
||||
b=b.results);return function(a){var c=a.term,f={results:[]},k;if(c==="")a.callback({results:b});else{k=function(b,f){var g,t,b=b[0];if(b.children){g={};for(t in b)b.hasOwnProperty(t)&&(g[t]=b[t]);g.children=[];e(b.children).each2(function(a,b){k(b,g.children)});g.children.length&&f.push(g)}else a.matcher(c,d(b))&&f.push(b)};e(b).each2(function(a,b){k(b,f.results)});a.callback(f)}}}function E(a){return e.isFunction(a)?a:function(b){var c=b.term,d={results:[]};e(a).each(function(){var a=this.text!==
|
||||
g,e=a?this.text:this;if(""===c||b.matcher(c,e))d.results.push(a?this:{id:this,text:this})});b.callback(d)}}function u(a){if(e.isFunction(a))return!0;if(!a)return!1;throw Error("formatterName must be a function or a falsy value");}function v(a){return e.isFunction(a)?a():a}function F(a){var b=0;e.each(a,function(a,d){d.children?b+=F(d.children):b++});return b}function H(a,b,c,d){var e=a,h=!1,f,k,n,o;if(!d.createSearchChoice||!d.tokenSeparators||1>d.tokenSeparators.length)return g;for(;;){h=-1;k=0;
|
||||
for(n=d.tokenSeparators.length;k<n&&!(o=d.tokenSeparators[k],h=a.indexOf(o),0<=h);k++);if(0>h)break;f=a.substring(0,h);a=a.substring(h+o.length);if(0<f.length&&(f=d.createSearchChoice(f,b),f!==g&&null!==f&&d.id(f)!==g&&null!==d.id(f))){h=!1;k=0;for(n=b.length;k<n;k++)if(m(d.id(f),d.id(b[k]))){h=!0;break}h||c(f)}}if(0!=e.localeCompare(a))return a}function x(a,b){var c=function(){};c.prototype=new a;c.prototype.constructor=c;c.prototype.parent=a.prototype;c.prototype=e.extend(c.prototype,b);return c}
|
||||
if(window.Select2===g){var f,w,y,z,G,q;f={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){a=a.which?a.which:a;switch(a){case f.LEFT:case f.RIGHT:case f.UP:case f.DOWN:return!0}return!1},isControl:function(a){switch(a.which){case f.SHIFT:case f.CTRL:case f.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){a=a.which?a.which:a;return 112<=a&&123>=a}};var I=1;G=function(){return I++};
|
||||
e(document).delegate("body","mousemove",function(a){e.data(document,"select2-lastpos",{x:a.pageX,y:a.pageY})});e(document).ready(function(){e(document).delegate("body","mousedown touchend",function(a){var b=e(a.target).closest("div.select2-container").get(0),c;b?e(document).find("div.select2-container-active").each(function(){this!==b&&e(this).data("select2").blur()}):(b=e(a.target).closest("div.select2-drop").get(0),e(document).find("div.select2-drop-active").each(function(){this!==b&&e(this).data("select2").blur()}));
|
||||
b=e(a.target);c=b.attr("for");"LABEL"===a.target.tagName&&(c&&0<c.length)&&(b=e("#"+c),b=b.data("select2"),b!==g&&(b.focus(),a.preventDefault()))})});w=x(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(a){var b,c;this.opts=a=this.prepareOpts(a);this.id=a.id;a.element.data("select2")!==g&&null!==a.element.data("select2")&&this.destroy();this.enabled=!0;this.container=this.createContainer();this.containerId="s2id_"+(a.element.attr("id")||"autogen"+G());this.containerSelector=
|
||||
"#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1");this.container.attr("id",this.containerId);var d=!1,j;this.body=function(){!1===d&&(j=a.element.closest("body"),d=!0);return j};a.element.attr("class")!==g&&this.container.addClass(a.element.attr("class").replace(/validate\[[\S ]+] ?/,""));this.container.css(v(a.containerCss));this.container.addClass(v(a.containerCssClass));this.opts.element.data("select2",this).hide().before(this.container);this.container.data("select2",
|
||||
this);this.dropdown=this.container.find(".select2-drop");this.dropdown.addClass(v(a.dropdownCssClass));this.dropdown.data("select2",this);this.results=b=this.container.find(".select2-results");this.search=c=this.container.find("input.select2-input");c.attr("tabIndex",this.opts.element.attr("tabIndex"));this.resultsPage=0;this.context=null;this.initContainer();this.initContainerWidth();this.results.bind("mousemove",function(a){var b=e.data(document,"select2-lastpos");(b===g||b.x!==a.pageX||b.y!==a.pageY)&&
|
||||
e(a.target).trigger("mousemove-filtered",a)});this.dropdown.delegate(".select2-results","mousemove-filtered",this.bind(this.highlightUnderEvent));var h=this.results,f=A(80,function(a){h.trigger("scroll-debounced",a)});h.bind("scroll",function(a){0<=i(a.target,h.get())&&f(a)});this.dropdown.delegate(".select2-results","scroll-debounced",this.bind(this.loadMoreIfNeeded));e.fn.mousewheel&&b.mousewheel(function(a,c,d,e){c=b.scrollTop();0<e&&0>=c-e?(b.scrollTop(0),l(a)):0>e&&b.get(0).scrollHeight-b.scrollTop()+
|
||||
e<=b.height()&&(b.scrollTop(b.get(0).scrollHeight-b.height()),l(a))});c.bind("keydown",function(){e.data(c,"keyup-change-value")===g&&e.data(c,"keyup-change-value",c.val())});c.bind("keyup",function(){var a=e.data(c,"keyup-change-value");a!==g&&c.val()!==a&&(e.removeData(c,"keyup-change-value"),c.trigger("keyup-change"))});c.bind("keyup-change",this.bind(this.updateResults));c.bind("focus",function(){c.addClass("select2-focused");" "===c.val()&&c.val("")});c.bind("blur",function(){c.removeClass("select2-focused")});
|
||||
this.dropdown.delegate(".select2-results","mouseup",this.bind(function(a){0<e(a.target).closest(".select2-result-selectable:not(.select2-disabled)").length?(this.highlightUnderEvent(a),this.selectHighlighted(a)):this.focusSearch();l(a)}));this.dropdown.bind("click mouseup mousedown",function(a){a.stopPropagation()});e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource());(a.element.is(":disabled")||a.element.is("[readonly='readonly']"))&&this.disable()},destroy:function(){var a=
|
||||
this.opts.element.data("select2");a!==g&&(a.container.remove(),a.dropdown.remove(),a.opts.element.removeData("select2").unbind(".select2").show())},prepareOpts:function(a){var b,c,d;b=a.element;"select"===b.get(0).tagName.toLowerCase()&&(this.select=c=a.element);c&&e.each("id multiple ajax query createSearchChoice initSelection data tags".split(" "),function(){if(this in a)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.");});a=e.extend({},{populateResults:function(b,
|
||||
c,d){var f,n=this.opts.id,o=this;f=function(b,c,j){var h,l,i,m,r,p,q;h=0;for(l=b.length;h<l;h=h+1){i=b[h];m=n(i)!==g;r=i.children&&i.children.length>0;p=e("<li></li>");p.addClass("select2-results-dept-"+j);p.addClass("select2-result");p.addClass(m?"select2-result-selectable":"select2-result-unselectable");r&&p.addClass("select2-result-with-children");p.addClass(o.opts.formatResultCssClass(i));m=e("<div></div>");m.addClass("select2-result-label");q=a.formatResult(i,m,d);q!==g&&m.html(o.opts.escapeMarkup(q));
|
||||
p.append(m);if(r){r=e("<ul></ul>");r.addClass("select2-result-sub");f(i.children,r,j+1);p.append(r)}p.data("select2-data",i);c.append(p)}};f(c,b,0)}},e.fn.select2.defaults,a);"function"!==typeof a.id&&(d=a.id,a.id=function(a){return a[d]});if(c)a.query=this.bind(function(a){var c={results:[],more:false},d=a.term,f,n,o;o=function(b,c){var e;if(b.is("option"))a.matcher(d,b.text(),b)&&c.push({id:b.attr("value"),text:b.text(),element:b.get(),css:b.attr("class")});else if(b.is("optgroup")){e={text:b.attr("label"),
|
||||
children:[],element:b.get(),css:b.attr("class")};b.children().each2(function(a,b){o(b,e.children)});e.children.length>0&&c.push(e)}};f=b.children();if(this.getPlaceholder()!==g&&f.length>0){n=f[0];e(n).text()===""&&(f=f.not(n))}f.each2(function(a,b){o(b,c.results)});a.callback(c)}),a.id=function(a){return a.id},a.formatResultCssClass=function(a){return a.css};else if(!("query"in a))if("ajax"in a){if((c=a.element.data("ajax-url"))&&0<c.length)a.ajax.url=c;a.query=C(a.ajax)}else"data"in a?a.query=D(a.data):
|
||||
"tags"in a&&(a.query=E(a.tags),a.createSearchChoice=function(a){return{id:a,text:a}},a.initSelection=function(b,c){var d=[];e(s(b.val(),a.separator)).each(function(){var b=this,c=this,j=a.tags;e.isFunction(j)&&(j=j());e(j).each(function(){if(m(this.id,b)){c=this.text;return false}});d.push({id:b,text:c})});c(d)});if("function"!==typeof a.query)throw"query function not defined for Select2 "+a.element.attr("id");return a},monitorSource:function(){this.opts.element.bind("change.select2",this.bind(function(){!0!==
|
||||
this.opts.element.data("select2-change-triggered")&&this.initSelection()}))},triggerChange:function(a){a=a||{};a=e.extend({},a,{type:"change",val:this.val()});this.opts.element.data("select2-change-triggered",!0);this.opts.element.trigger(a);this.opts.element.data("select2-change-triggered",!1);this.opts.element.click();this.opts.blurOnChange&&this.opts.element.blur()},enable:function(){this.enabled||(this.enabled=!0,this.container.removeClass("select2-container-disabled"))},disable:function(){this.enabled&&
|
||||
(this.close(),this.enabled=!1,this.container.addClass("select2-container-disabled"))},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var a=this.container.offset(),b=this.container.outerHeight(),c=this.container.outerWidth(),d=this.dropdown.outerHeight(),j=e(window).scrollTop()+document.documentElement.clientHeight,b=a.top+b,f=a.left,j=b+d<=j,g=a.top-d>=this.body().scrollTop(),k=this.dropdown.hasClass("select2-drop-above"),n;"static"!==this.body().css("position")&&
|
||||
(n=this.body().offset(),b-=n.top,f-=n.left);k?(k=!0,!g&&j&&(k=!1)):(k=!1,!j&&g&&(k=!0));k?(b=a.top-d,this.container.addClass("select2-drop-above"),this.dropdown.addClass("select2-drop-above")):(this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above"));a=e.extend({top:b,left:f,width:c},v(this.opts.dropdownCss));this.dropdown.css(a)},shouldOpen:function(){var a;if(this.opened())return!1;a=e.Event("open");this.opts.element.trigger(a);return!a.isDefaultPrevented()},
|
||||
clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above");this.dropdown.removeClass("select2-drop-above")},open:function(){if(!this.shouldOpen())return!1;window.setTimeout(this.bind(this.opening),1);return!0},opening:function(){var a=this.containerId,b=this.containerSelector,c="scroll."+a,d="resize."+a;this.container.parents().each(function(){e(this).bind(c,function(){var a=e(b);0==a.length&&e(this).unbind(c);a.select2("close")})});e(window).bind(d,function(){var a=
|
||||
e(b);0==a.length&&e(window).unbind(d);a.select2("close")});this.clearDropdownAlignmentPreference();" "===this.search.val()&&this.search.val("");this.container.addClass("select2-dropdown-open").addClass("select2-container-active");this.updateResults(!0);this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body());this.dropdown.show();this.positionDropdown();this.dropdown.addClass("select2-drop-active");this.ensureHighlightVisible();this.focusSearch()},close:function(){if(this.opened()){var a=
|
||||
this;this.container.parents().each(function(){e(this).unbind("scroll."+a.containerId)});e(window).unbind("resize."+this.containerId);this.clearDropdownAlignmentPreference();this.dropdown.hide();this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");this.results.empty();this.clearSearch();this.opts.element.trigger(e.Event("close"))}},clearSearch:function(){},ensureHighlightVisible:function(){var a=this.results,b,c,d,f;c=this.highlight();0>c||(0==c?a.scrollTop(0):
|
||||
(b=a.find(".select2-result-selectable"),d=e(b[c]),f=d.offset().top+d.outerHeight(),c===b.length-1&&(b=a.find("li.select2-more-results"),0<b.length&&(f=b.offset().top+b.outerHeight())),b=a.offset().top+a.outerHeight(),f>b&&a.scrollTop(a.scrollTop()+(f-b)),d=d.offset().top-a.offset().top,0>d&&a.scrollTop(a.scrollTop()+d)))},moveHighlight:function(a){for(var b=this.results.find(".select2-result-selectable"),c=this.highlight();-1<c&&c<b.length;){var c=c+a,d=e(b[c]);if(d.hasClass("select2-result-selectable")&&
|
||||
!d.hasClass("select2-disabled")){this.highlight(c);break}}},highlight:function(a){var b=this.results.find(".select2-result-selectable").not(".select2-disabled");if(0===arguments.length)return i(b.filter(".select2-highlighted")[0],b.get());a>=b.length&&(a=b.length-1);0>a&&(a=0);b.removeClass("select2-highlighted");e(b[a]).addClass("select2-highlighted");this.ensureHighlightVisible()},countSelectableResults:function(){return this.results.find(".select2-result-selectable").not(".select2-disabled").length},
|
||||
highlightUnderEvent:function(a){a=e(a.target).closest(".select2-result-selectable");if(0<a.length&&!a.is(".select2-highlighted")){var b=this.results.find(".select2-result-selectable");this.highlight(b.index(a))}else 0==a.length&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var a=this.results,b=a.find("li.select2-more-results"),c,d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-
|
||||
a.height(),0>=c&&(b.addClass("select2-active"),this.opts.query({term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),!0===c.more?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d)})})))},tokenize:function(){},updateResults:function(a){function b(){f.scrollTop(0);d.removeClass("select2-active");
|
||||
k.positionDropdown()}function c(a){f.html(k.opts.escapeMarkup(a));b()}var d=this.search,f=this.results,h=this.opts,i,k=this;if(!(!0!==a&&(!1===this.showSearchInput||!this.opened()))){d.addClass("select2-active");if(1<=h.maximumSelectionSize&&(i=this.data(),e.isArray(i)&&i.length>=h.maximumSelectionSize&&u(h.formatSelectionTooBig,"formatSelectionTooBig"))){c("<li class='select2-selection-limit'>"+h.formatSelectionTooBig(h.maximumSelectionSize)+"</li>");return}d.val().length<h.minimumInputLength&&u(h.formatInputTooShort,
|
||||
"formatInputTooShort")?c("<li class='select2-no-results'>"+h.formatInputTooShort(d.val(),h.minimumInputLength)+"</li>"):(c("<li class='select2-searching'>"+h.formatSearching()+"</li>"),i=this.tokenize(),i!=g&&null!=i&&d.val(i),this.resultsPage=1,h.query({term:d.val(),page:this.resultsPage,context:null,matcher:h.matcher,callback:this.bind(function(i){var l;this.opened()&&((this.context=i.context===g?null:i.context,this.opts.createSearchChoice&&""!==d.val()&&(l=this.opts.createSearchChoice.call(null,
|
||||
d.val(),i.results),l!==g&&null!==l&&k.id(l)!==g&&null!==k.id(l)&&0===e(i.results).filter(function(){return m(k.id(this),k.id(l))}).length&&i.results.unshift(l)),0===i.results.length&&u(h.formatNoMatches,"formatNoMatches"))?c("<li class='select2-no-results'>"+h.formatNoMatches(d.val())+"</li>"):(f.empty(),k.opts.populateResults.call(this,f,i.results,{term:d.val(),page:this.resultsPage,context:null}),!0===i.more&&u(h.formatLoadMore,"formatLoadMore")&&(f.append("<li class='select2-more-results'>"+k.opts.escapeMarkup(h.formatLoadMore(this.resultsPage))+
|
||||
"</li>"),window.setTimeout(function(){k.loadMoreIfNeeded()},10)),this.postprocessResults(i,a),b()))})}))}},cancel:function(){this.close()},blur:function(){this.close();this.container.removeClass("select2-container-active");this.dropdown.removeClass("select2-drop-active");this.search[0]===document.activeElement&&this.search.blur();this.clearSearch();this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){this.search.show();this.search.focus();
|
||||
window.setTimeout(this.bind(function(){this.search.show();this.search.focus();this.search.val(this.search.val())}),10)},selectHighlighted:function(){var a=this.highlight(),b=this.results.find(".select2-highlighted").not(".select2-disabled"),c=b.closest(".select2-result-selectable").data("select2-data");c&&(b.addClass("select2-disabled"),this.highlight(a),this.onSelect(c))},getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||
|
||||
this.opts.placeholder},initContainerWidth:function(){var a=function(){var a,c,d,f;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth()?"auto":this.opts.element.outerWidth()+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){a=this.opts.element.attr("style");if(a!==g){a=a.split(";");d=0;for(f=a.length;d<f;d+=1)if(c=a[d].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/),null!==c&&1<=c.length)return c[1]}return"resolve"===
|
||||
this.opts.width?(a=this.opts.element.css("width"),0<a.indexOf("%")?a:0===this.opts.element.outerWidth()?"auto":this.opts.element.outerWidth()+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}.call(this);null!==a&&this.container.attr("style","width: "+a)}});y=x(w,{createContainer:function(){return e("<div></div>",{"class":"select2-container"}).html(" <a href='#' onclick='return false;' class='select2-choice'> <span></span><abbr class='select2-search-choice-close' style='display:none;'></abbr> <div><b></b></div></a> <div class='select2-drop select2-offscreen'> <div class='select2-search'> <input type='text' autocomplete='off' class='select2-input'/> </div> <ul class='select2-results'> </ul></div>")},
|
||||
opening:function(){this.search.show();this.parent.opening.apply(this,arguments);this.dropdown.removeClass("select2-offscreen")},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show())},focus:function(){this.close();this.selection.focus()},isFocused:function(){return this.selection[0]===document.activeElement},cancel:function(){this.parent.cancel.apply(this,arguments);this.selection.focus()},
|
||||
initContainer:function(){var a,b=this.dropdown;this.selection=a=this.container.find(".select2-choice");this.search.bind("keydown",this.bind(function(a){if(this.enabled)if(a.which===f.PAGE_UP||a.which===f.PAGE_DOWN)l(a);else if(this.opened())switch(a.which){case f.UP:case f.DOWN:this.moveHighlight(a.which===f.UP?-1:1);l(a);break;case f.TAB:case f.ENTER:this.selectHighlighted();l(a);break;case f.ESC:this.cancel(a),l(a)}else a.which===f.TAB||f.isControl(a)||f.isFunctionKey(a)||a.which===f.ESC||!1===
|
||||
this.opts.openOnEnter&&a.which===f.ENTER||this.open()}));this.search.bind("focus",this.bind(function(){this.selection.attr("tabIndex","-1")}));this.search.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active");window.setTimeout(this.bind(function(){this.selection.attr("tabIndex",this.opts.element.attr("tabIndex"))}),10)}));a.bind("mousedown",this.bind(function(){this.opened()?(this.close(),this.selection.focus()):this.enabled&&this.open()}));b.bind("mousedown",
|
||||
this.bind(function(){this.search.focus()}));a.bind("focus",this.bind(function(){this.container.addClass("select2-container-active");this.search.attr("tabIndex","-1")}));a.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active");window.setTimeout(this.bind(function(){this.search.attr("tabIndex",this.opts.element.attr("tabIndex"))}),10)}));a.bind("keydown",this.bind(function(a){if(this.enabled)if(a.which===f.PAGE_UP||a.which===f.PAGE_DOWN)l(a);else if(!(a.which===
|
||||
f.TAB||f.isControl(a)||f.isFunctionKey(a)||a.which===f.ESC)&&!(!1===this.opts.openOnEnter&&a.which===f.ENTER))if(a.which==f.DELETE)this.opts.allowClear&&this.clear();else{this.open();if(a.which!==f.ENTER&&!(48>a.which)){var b=String.fromCharCode(a.which).toLowerCase();a.shiftKey&&(b=b.toUpperCase());this.search.focus();this.search.val(b)}l(a)}}));a.delegate("abbr","mousedown",this.bind(function(a){this.enabled&&(this.clear(),l(a),this.close(),this.triggerChange(),this.selection.focus())}));this.setPlaceholder();
|
||||
this.search.bind("focus",this.bind(function(){this.container.addClass("select2-container-active")}))},clear:function(){this.opts.element.val("");this.selection.find("span").empty();this.selection.removeData("select2-data");this.setPlaceholder()},initSelection:function(){if(""===this.opts.element.val())this.close(),this.setPlaceholder();else{var a=this;this.opts.initSelection.call(null,this.opts.element,function(b){b!==g&&null!==b&&(a.updateSelection(b),a.close(),a.setPlaceholder())})}},prepareOpts:function(){var a=
|
||||
this.parent.prepareOpts.apply(this,arguments);"select"===a.element.get(0).tagName.toLowerCase()&&(a.initSelection=function(a,c){var d=a.find(":selected");e.isFunction(c)&&c({id:d.attr("value"),text:d.text()})});return a},setPlaceholder:function(){var a=this.getPlaceholder();""===this.opts.element.val()&&a!==g&&!(this.select&&""!==this.select.find("option:first").text())&&(this.selection.find("span").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.selection.find("abbr").hide())},
|
||||
postprocessResults:function(a,b){var c=0,d=this,f=!0;this.results.find(".select2-result-selectable").each2(function(a,b){if(m(d.id(b.data("select2-data")),d.opts.element.val()))return c=a,!1});this.highlight(c);!0===b&&(f=this.showSearchInput=F(a.results)>=this.opts.minimumResultsForSearch,this.dropdown.find(".select2-search")[f?"removeClass":"addClass"]("select2-search-hidden"),e(this.dropdown,this.container)[f?"addClass":"removeClass"]("select2-with-searchbox"))},onSelect:function(a){var b=this.opts.element.val();
|
||||
this.opts.element.val(this.id(a));this.updateSelection(a);this.close();this.selection.focus();m(b,this.id(a))||this.triggerChange()},updateSelection:function(a){var b=this.selection.find("span");this.selection.data("select2-data",a);b.empty();a=this.opts.formatSelection(a,b);a!==g&&b.append(this.opts.escapeMarkup(a));this.selection.removeClass("select2-default");this.opts.allowClear&&this.getPlaceholder()!==g&&this.selection.find("abbr").show()},val:function(){var a,b=null,c=this;if(0===arguments.length)return this.opts.element.val();
|
||||
a=arguments[0];if(this.select)this.select.val(a).find(":selected").each2(function(a,c){b={id:c.attr("value"),text:c.text()};return!1}),this.updateSelection(b),this.setPlaceholder();else{if(this.opts.initSelection===g)throw Error("cannot call val() if initSelection() is not defined");a?(this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){c.opts.element.val(!a?"":c.id(a));c.updateSelection(a);c.setPlaceholder()})):this.clear()}},clearSearch:function(){this.search.val("")},
|
||||
data:function(a){var b;if(0===arguments.length)return b=this.selection.data("select2-data"),b==g&&(b=null),b;!a||""===a?this.clear():(this.opts.element.val(!a?"":this.id(a)),this.updateSelection(a))}});z=x(w,{createContainer:function(){return e("<div></div>",{"class":"select2-container select2-container-multi"}).html(" <ul class='select2-choices'> <li class='select2-search-field'> <input type='text' autocomplete='off' class='select2-input'> </li></ul><div class='select2-drop select2-drop-multi' style='display:none;'> <ul class='select2-results'> </ul></div>")},
|
||||
prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments);"select"===a.element.get(0).tagName.toLowerCase()&&(a.initSelection=function(a,c){var d=[];a.find(":selected").each2(function(a,b){d.push({id:b.attr("value"),text:b.text()})});e.isFunction(c)&&c(d)});return a},initContainer:function(){var a;this.searchContainer=this.container.find(".select2-search-field");this.selection=a=this.container.find(".select2-choices");this.search.bind("keydown",this.bind(function(b){if(this.enabled){if(b.which===
|
||||
f.BACKSPACE&&""===this.search.val()){this.close();var c;c=a.find(".select2-search-choice-focus");if(0<c.length){this.unselect(c.first());this.search.width(10);l(b);return}c=a.find(".select2-search-choice");0<c.length&&c.last().addClass("select2-search-choice-focus")}else a.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");if(this.opened())switch(b.which){case f.UP:case f.DOWN:this.moveHighlight(b.which===f.UP?-1:1);l(b);return;case f.ENTER:case f.TAB:this.selectHighlighted();
|
||||
l(b);return;case f.ESC:this.cancel(b);l(b);return}if(!(b.which===f.TAB||f.isControl(b)||f.isFunctionKey(b)||b.which===f.BACKSPACE||b.which===f.ESC)&&!(!1===this.opts.openOnEnter&&b.which===f.ENTER))this.open(),(b.which===f.PAGE_UP||b.which===f.PAGE_DOWN)&&l(b)}}));this.search.bind("keyup",this.bind(this.resizeSearch));this.search.bind("blur",this.bind(function(a){this.container.removeClass("select2-container-active");this.search.removeClass("select2-focused");this.clearSearch();a.stopImmediatePropagation()}));
|
||||
this.container.delegate(".select2-choices","mousedown",this.bind(function(a){this.enabled&&!(0<e(a.target).closest(".select2-search-choice").length)&&(this.clearPlaceholder(),this.open(),this.focusSearch(),a.preventDefault())}));this.container.delegate(".select2-choices","focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())}));this.clearSearch()},enable:function(){this.enabled||(this.parent.enable.apply(this,
|
||||
arguments),this.search.removeAttr("disabled"))},disable:function(){this.enabled&&(this.parent.disable.apply(this,arguments),this.search.attr("disabled",!0))},initSelection:function(){""===this.opts.element.val()&&(this.updateSelection([]),this.close(),this.clearSearch());if(this.select||""!==this.opts.element.val()){var a=this;this.opts.initSelection.call(null,this.opts.element,function(b){if(b!==g&&b!==null){a.updateSelection(b);a.close();a.clearSearch()}})}},clearSearch:function(){var a=this.getPlaceholder();
|
||||
a!==g&&0===this.getVal().length&&!1===this.search.hasClass("select2-focused")?(this.search.val(a).addClass("select2-default"),this.resizeSearch()):this.search.val(" ").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")?this.search.val("").removeClass("select2-default"):" "===this.search.val()&&this.search.val("")},opening:function(){this.parent.opening.apply(this,arguments);this.clearPlaceholder();this.resizeSearch();this.focusSearch()},close:function(){this.opened()&&
|
||||
this.parent.close.apply(this,arguments)},focus:function(){this.close();this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(a){var b=[],c=[],d=this;e(a).each(function(){0>i(d.id(this),b)&&(b.push(d.id(this)),c.push(this))});a=c;this.selection.find(".select2-search-choice").remove();e(a).each(function(){d.addSelectedChoice(this)});d.postprocessResults()},tokenize:function(){var a=this.search.val(),a=this.opts.tokenizer(a,this.data(),this.bind(this.onSelect),
|
||||
this.opts);null!=a&&a!=g&&(this.search.val(a),0<a.length&&this.open())},onSelect:function(a){this.addSelectedChoice(a);this.select&&this.postprocessResults();this.opts.closeOnSelect?(this.close(),this.search.width(10)):0<this.countSelectableResults()?(this.search.width(10),this.resizeSearch(),this.positionDropdown()):this.close();this.triggerChange({added:a});this.focusSearch()},cancel:function(){this.close();this.focusSearch()},addSelectedChoice:function(a){var b=e("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),
|
||||
c=this.id(a),d=this.getVal(),f;f=this.opts.formatSelection(a,b);b.find("div").replaceWith("<div>"+this.opts.escapeMarkup(f)+"</div>");b.find(".select2-search-choice-close").bind("mousedown",l).bind("click dblclick",this.bind(function(a){this.enabled&&(e(a.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(e(a.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");this.close();this.focusSearch()})).dequeue(),
|
||||
l(a))})).bind("focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))}));b.data("select2-data",a);b.insertBefore(this.searchContainer);d.push(c);this.setVal(d)},unselect:function(a){var b=this.getVal(),c,d,a=a.closest(".select2-search-choice");if(0===a.length)throw"Invalid argument: "+a+". Must be .select2-search-choice";c=a.data("select2-data");d=i(this.id(c),b);0<=d&&(b.splice(d,1),this.setVal(b),this.select&&
|
||||
this.postprocessResults());a.remove();this.triggerChange({removed:c})},postprocessResults:function(){var a=this.getVal(),b=this.results.find(".select2-result-selectable"),c=this.results.find(".select2-result-with-children"),d=this;b.each2(function(b,c){var e=d.id(c.data("select2-data"));0<=i(e,a)?c.addClass("select2-disabled").removeClass("select2-result-selectable"):c.removeClass("select2-disabled").addClass("select2-result-selectable")});c.each2(function(a,b){0==b.find(".select2-result-selectable").length?
|
||||
b.addClass("select2-disabled"):b.removeClass("select2-disabled")});b.each2(function(a,b){if(!b.hasClass("select2-disabled")&&b.hasClass("select2-result-selectable"))return d.highlight(0),!1})},resizeSearch:function(){var a,b,c,d,f=this.search.outerWidth()-this.search.width();a=this.search;q||(c=a[0].currentStyle||window.getComputedStyle(a[0],null),q=e("<div></div>").css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,
|
||||
fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),e("body").append(q));q.text(a.val());a=q.width()+10;b=this.search.offset().left;c=this.selection.width();d=this.selection.offset().left;b=c-(b-d)-f;b<a&&(b=c-f);40>b&&(b=c-f);this.search.width(b)},getVal:function(){var a;if(this.select)return a=this.select.val(),null===a?[]:a;a=this.opts.element.val();return s(a,this.opts.separator)},setVal:function(a){var b;this.select?this.select.val(a):(b=
|
||||
[],e(a).each(function(){0>i(this,b)&&b.push(this)}),this.opts.element.val(0===b.length?"":b.join(this.opts.separator)))},val:function(){var a,b=[],c=this;if(0===arguments.length)return this.getVal();if(a=arguments[0])if(this.setVal(a),this.select)this.select.find(":selected").each(function(){b.push({id:e(this).attr("value"),text:e(this).text()})}),this.updateSelection(b);else{if(this.opts.initSelection===g)throw Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,
|
||||
function(a){var b=e(a).map(c.id);c.setVal(b);c.updateSelection(a);c.clearSearch()})}else this.opts.element.val(""),this.updateSelection([]);this.clearSearch()},onSortStart:function(){if(this.select)throw Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0);this.searchContainer.hide()},onSortEnd:function(){var a=[],b=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();
|
||||
this.selection.find(".select2-search-choice").each(function(){a.push(b.opts.id(e(this).data("select2-data")))});this.setVal(a);this.triggerChange()},data:function(a){var b=this,c;if(0===arguments.length)return this.selection.find(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get();a||(a=[]);c=e.map(a,function(a){return b.opts.id(a)});this.setVal(c);this.updateSelection(a);this.clearSearch()}});e.fn.select2=function(){var a=Array.prototype.slice.call(arguments,0),b,
|
||||
c,d,f,h="val destroy opened open close focus isFocused container onSortStart onSortEnd enable disable positionDropdown data".split(" ");this.each(function(){if(0===a.length||"object"===typeof a[0])b=0===a.length?{}:e.extend({},a[0]),b.element=e(this),"select"===b.element.get(0).tagName.toLowerCase()?f=b.element.attr("multiple"):(f=b.multiple||!1,"tags"in b&&(b.multiple=f=!0)),c=f?new z:new y,c.init(b);else if("string"===typeof a[0]){if(0>i(a[0],h))throw"Unknown method: "+a[0];d=g;c=e(this).data("select2");
|
||||
if(c!==g&&(d="container"===a[0]?c.container:c[a[0]].apply(c,a.slice(1)),d!==g))return!1}else throw"Invalid arguments to select2 plugin: "+a;});return d===g?this:d};e.fn.select2.defaults={width:"copy",closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c){b=[];B(a.text,c.term,b);return b.join("")},formatSelection:function(a){return a?a.text:g},formatResultCssClass:function(){return g},formatNoMatches:function(){return"No matches found"},
|
||||
formatInputTooShort:function(a,b){return"Please enter "+(b-a.length)+" more characters"},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return 0<=b.toUpperCase().indexOf(a.toUpperCase())},separator:",",tokenSeparators:[],tokenizer:H,
|
||||
escapeMarkup:function(a){return a&&"string"===typeof a?a.replace(/&/g,"&"):a},blurOnChange:!1};window.Select2={query:{ajax:C,local:D,tags:E},util:{debounce:A,markMatch:B},"class":{"abstract":w,single:y,multi:z}}}})(jQuery);
|
||||
@@ -0,0 +1,260 @@
|
||||
tinymce.addI18n('tr_TR',{
|
||||
"Redo": "Yinele",
|
||||
"Undo": "Geri Al",
|
||||
"Cut": "Kes",
|
||||
"Copy": "Kopyala",
|
||||
"Paste": "Yap\u0131\u015ft\u0131r",
|
||||
"Select all": "T\u00fcm\u00fcn\u00fc se\u00e7",
|
||||
"New document": "Yeni dok\u00fcman",
|
||||
"Ok": "Tamam",
|
||||
"Cancel": "\u0130ptal",
|
||||
"Visual aids": "G\u00f6rsel ara\u00e7lar",
|
||||
"Bold": "Kal\u0131n",
|
||||
"Italic": "\u0130talik",
|
||||
"Underline": "Alt\u0131 \u00e7izili",
|
||||
"Strikethrough": "\u00dcst\u00fc \u00e7izili",
|
||||
"Superscript": "\u00dcst simge",
|
||||
"Subscript": "Alt simge",
|
||||
"Clear formatting": "Bi\u00e7imi temizle",
|
||||
"Align left": "Sola hizala",
|
||||
"Align center": "Ortala",
|
||||
"Align right": "Sa\u011fa hizala",
|
||||
"Justify": "\u0130ki yana yasla",
|
||||
"Bullet list": "S\u0131ras\u0131z liste",
|
||||
"Numbered list": "S\u0131ral\u0131 liste",
|
||||
"Decrease indent": "Girintiyi azalt",
|
||||
"Increase indent": "Girintiyi art\u0131r",
|
||||
"Close": "Kapat",
|
||||
"Formats": "Bi\u00e7imler",
|
||||
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Taray\u0131c\u0131n\u0131z panoya direk eri\u015fimi desteklemiyor. L\u00fctfen Ctrl+X\/C\/V klavye k\u0131sayollar\u0131n\u0131 kullan\u0131n.",
|
||||
"Headers": "Ba\u015fl\u0131klar",
|
||||
"Header 1": "Ba\u015fl\u0131k 1",
|
||||
"Header 2": "Ba\u015fl\u0131k 2",
|
||||
"Header 3": "Ba\u015fl\u0131k 3",
|
||||
"Header 4": "Ba\u015fl\u0131k 4",
|
||||
"Header 5": "Ba\u015fl\u0131k 5",
|
||||
"Header 6": "Ba\u015fl\u0131k 6",
|
||||
"Headings": "Ba\u015fl\u0131klar",
|
||||
"Heading 1": "Ba\u015fl\u0131k 1",
|
||||
"Heading 2": "Ba\u015fl\u0131k 2",
|
||||
"Heading 3": "Ba\u015fl\u0131k 3",
|
||||
"Heading 4": "Ba\u015fl\u0131k 4",
|
||||
"Heading 5": "Ba\u015fl\u0131k 5",
|
||||
"Heading 6": "Ba\u015fl\u0131k 6",
|
||||
"Div": "Div",
|
||||
"Pre": "\u00d6n",
|
||||
"Code": "Kod",
|
||||
"Paragraph": "Paragraf",
|
||||
"Blockquote": "Al\u0131nt\u0131",
|
||||
"Inline": "Sat\u0131r i\u00e7i",
|
||||
"Blocks": "Bloklar",
|
||||
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "D\u00fcz metin modunda yap\u0131\u015ft\u0131r. Bu se\u00e7ene\u011fi kapatana kadar i\u00e7erikler d\u00fcz metin olarak yap\u0131\u015ft\u0131r\u0131l\u0131r.",
|
||||
"Font Family": "Yaz\u0131tipi Ailesi",
|
||||
"Font Sizes": "Yaz\u0131tipi B\u00fcy\u00fckl\u00fc\u011f\u00fc",
|
||||
"Class": "S\u0131n\u0131f",
|
||||
"Browse for an image": "Bir resim aray\u0131n",
|
||||
"OR": "ya da",
|
||||
"Drop an image here": "Buraya bir resim koy",
|
||||
"Upload": "Y\u00fckle",
|
||||
"Block": "Blok",
|
||||
"Align": "Hizala",
|
||||
"Default": "Varsay\u0131lan",
|
||||
"Circle": "Daire",
|
||||
"Disc": "Disk",
|
||||
"Square": "Kare",
|
||||
"Lower Alpha": "K\u00fc\u00e7\u00fck ABC",
|
||||
"Lower Greek": "K\u00fc\u00e7\u00fck Yunan alfabesi",
|
||||
"Lower Roman": "K\u00fc\u00e7\u00fck Roman alfabesi",
|
||||
"Upper Alpha": "B\u00fcy\u00fck ABC",
|
||||
"Upper Roman": "B\u00fcy\u00fck Roman alfabesi",
|
||||
"Anchor": "\u00c7apa",
|
||||
"Name": "\u0130sim",
|
||||
"Id": "Id",
|
||||
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "Id bir harf ile ba\u015flamal\u0131d\u0131r ve sadece harfleri, rakamlar\u0131, \u00e7izgileri, noktalar\u0131, virg\u00fclleri veya alt \u00e7izgileri i\u00e7ermelidir.",
|
||||
"You have unsaved changes are you sure you want to navigate away?": "Kaydedilmemi\u015f de\u011fi\u015fiklikler var, sayfadan ayr\u0131lmak istedi\u011finize emin misiniz?",
|
||||
"Restore last draft": "Son tasla\u011f\u0131 kurtar",
|
||||
"Special character": "\u00d6zel karakter",
|
||||
"Source code": "Kaynak kodu",
|
||||
"Insert\/Edit code sample": "Kod \u00f6rne\u011fini Kaydet\/D\u00fczenle",
|
||||
"Language": "Dil",
|
||||
"Code sample": "Kod \u00f6rne\u011fi",
|
||||
"Color": "Renk",
|
||||
"R": "R",
|
||||
"G": "G",
|
||||
"B": "B",
|
||||
"Left to right": "Soldan sa\u011fa",
|
||||
"Right to left": "Sa\u011fdan sola",
|
||||
"Emoticons": "G\u00fcl\u00fcc\u00fckler",
|
||||
"Document properties": "Dok\u00fcman \u00f6zellikleri",
|
||||
"Title": "Ba\u015fl\u0131k",
|
||||
"Keywords": "Anahtar kelimeler",
|
||||
"Description": "A\u00e7\u0131klama",
|
||||
"Robots": "Robotlar",
|
||||
"Author": "Yazar",
|
||||
"Encoding": "Kodlama",
|
||||
"Fullscreen": "Tam ekran",
|
||||
"Action": "Eylem",
|
||||
"Shortcut": "K\u0131sayol",
|
||||
"Help": "Yard\u0131m",
|
||||
"Address": "Adres",
|
||||
"Focus to menubar": "Men\u00fc \u00e7ubu\u011funa odaklan.",
|
||||
"Focus to toolbar": "Ara\u00e7 \u00e7ubu\u011funa odaklan.",
|
||||
"Focus to element path": "Eleman yoluna odaklan",
|
||||
"Focus to contextual toolbar": "Ba\u011flamsal ara\u00e7 \u00e7ubu\u011funa odaklan",
|
||||
"Insert link (if link plugin activated)": "Link ekle (Link eklentisi aktif ise)",
|
||||
"Save (if save plugin activated)": "Kaydet (Kay\u0131t eklentisi aktif ise)",
|
||||
"Find (if searchreplace plugin activated)": "Bul (SearchReplace eklentisi aktif ise)",
|
||||
"Plugins installed ({0}):": "Y\u00fckl\u00fc eklenti say\u0131s\u0131 : ({0}):",
|
||||
"Premium plugins:": "Premium eklentileri",
|
||||
"Learn more...": "Daha fazla bilgi edinin.",
|
||||
"You are using {0}": "{0} kullan\u0131yorsun.",
|
||||
"Plugins": "Eklentiler",
|
||||
"Handy Shortcuts": "Kullan\u0131\u015fl\u0131 K\u0131sayollar",
|
||||
"Horizontal line": "Yatay \u00e7izgi",
|
||||
"Insert\/edit image": "Resim ekle\/d\u00fczenle",
|
||||
"Image description": "Resim a\u00e7\u0131klamas\u0131",
|
||||
"Source": "Kaynak",
|
||||
"Dimensions": "Boyutlar",
|
||||
"Constrain proportions": "En - Boy oran\u0131n\u0131 koru",
|
||||
"General": "Genel",
|
||||
"Advanced": "Geli\u015fmi\u015f",
|
||||
"Style": "Stil",
|
||||
"Vertical space": "Dikey bo\u015fluk",
|
||||
"Horizontal space": "Yatay bo\u015fluk",
|
||||
"Border": "\u00c7er\u00e7eve",
|
||||
"Insert image": "Resim ekle",
|
||||
"Image": "Resim",
|
||||
"Image list": "Resim listesi",
|
||||
"Rotate counterclockwise": "Saat y\u00f6n\u00fcn\u00fcn tersine d\u00f6nd\u00fcr",
|
||||
"Rotate clockwise": "Saat y\u00f6n\u00fcnde d\u00f6nd\u00fcr",
|
||||
"Flip vertically": "Dikey \u00e7evir",
|
||||
"Flip horizontally": "Yatay \u00e7evir",
|
||||
"Edit image": "G\u00f6r\u00fcnt\u00fcy\u00fc d\u00fczenle",
|
||||
"Image options": "G\u00f6r\u00fcnt\u00fc se\u00e7enekleri",
|
||||
"Zoom in": "Yak\u0131nla\u015ft\u0131r",
|
||||
"Zoom out": "Uzakla\u015ft\u0131r",
|
||||
"Crop": "Kes",
|
||||
"Resize": "Yeniden Boyutland\u0131r",
|
||||
"Orientation": "Y\u00f6n\u00fcn\u00fc Belirle",
|
||||
"Brightness": "Parlakl\u0131k",
|
||||
"Sharpen": "Keskinle\u015ftir",
|
||||
"Contrast": "Kontrast",
|
||||
"Color levels": "Renk seviyesi",
|
||||
"Gamma": "Gama",
|
||||
"Invert": "Tersine \u00e7evir",
|
||||
"Apply": "Uygula",
|
||||
"Back": "Geri",
|
||||
"Insert date\/time": "Tarih \/ Zaman ekle",
|
||||
"Date\/time": "Tarih\/zaman",
|
||||
"Insert link": "Ba\u011flant\u0131 ekle",
|
||||
"Insert\/edit link": "Ba\u011flant\u0131 ekle\/d\u00fczenle",
|
||||
"Text to display": "G\u00f6r\u00fcnen yaz\u0131",
|
||||
"Url": "Url",
|
||||
"Target": "Hedef",
|
||||
"None": "Hi\u00e7biri",
|
||||
"New window": "Yeni pencere",
|
||||
"Remove link": "Ba\u011flant\u0131y\u0131 kald\u0131r",
|
||||
"Anchors": "\u00c7apalar",
|
||||
"Link": "Ba\u011flant\u0131",
|
||||
"Paste or type a link": "Bir ba\u011flant\u0131 yap\u0131\u015ft\u0131r\u0131n yada yaz\u0131n.",
|
||||
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "Girdi\u011finiz URL bir eposta adresi gibi g\u00f6z\u00fck\u00fcyor. Gerekli olan mailto: \u00f6nekini eklemek ister misiniz?",
|
||||
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "Girdi\u011finiz URL bir d\u0131\u015f ba\u011flant\u0131 gibi g\u00f6z\u00fck\u00fcyor. Gerekli olan http:\/\/ \u00f6nekini eklemek ister misiniz?",
|
||||
"Link list": "Link listesi",
|
||||
"Insert video": "Video ekle",
|
||||
"Insert\/edit video": "Video ekle\/d\u00fczenle",
|
||||
"Insert\/edit media": "Medya ekle\/d\u00fczenle",
|
||||
"Alternative source": "Alternatif kaynak",
|
||||
"Poster": "Poster",
|
||||
"Paste your embed code below:": "Medya g\u00f6mme kodunu buraya yap\u0131\u015ft\u0131r:",
|
||||
"Embed": "G\u00f6mme",
|
||||
"Media": "Medya",
|
||||
"Nonbreaking space": "B\u00f6l\u00fcnemez bo\u015fluk",
|
||||
"Page break": "Sayfa sonu",
|
||||
"Paste as text": "Metin olarak yap\u0131\u015ft\u0131r",
|
||||
"Preview": "\u00d6nizleme",
|
||||
"Print": "Yazd\u0131r",
|
||||
"Save": "Kaydet",
|
||||
"Find": "Bul",
|
||||
"Replace with": "Bununla de\u011fi\u015ftir",
|
||||
"Replace": "De\u011fi\u015ftir",
|
||||
"Replace all": "T\u00fcm\u00fcn\u00fc de\u011fi\u015ftir",
|
||||
"Prev": "\u00d6nceki",
|
||||
"Next": "Sonraki",
|
||||
"Find and replace": "Bul ve de\u011fi\u015ftir",
|
||||
"Could not find the specified string.": "Herhangi bir sonu\u00e7 bulunamad\u0131.",
|
||||
"Match case": "B\u00fcy\u00fck \/ K\u00fc\u00e7\u00fck harfe duyarl\u0131",
|
||||
"Whole words": "Tam s\u00f6zc\u00fckler",
|
||||
"Spellcheck": "Yaz\u0131m denetimi",
|
||||
"Ignore": "Yoksay",
|
||||
"Ignore all": "T\u00fcm\u00fcn\u00fc yoksay",
|
||||
"Finish": "Bitir",
|
||||
"Add to Dictionary": "S\u00f6zl\u00fc\u011fe ekle",
|
||||
"Insert table": "Tablo ekle",
|
||||
"Table properties": "Tablo \u00f6zellikleri",
|
||||
"Delete table": "Tabloyu sil",
|
||||
"Cell": "H\u00fccre",
|
||||
"Row": "Sat\u0131r",
|
||||
"Column": "S\u00fctun",
|
||||
"Cell properties": "H\u00fccre \u00f6zellikleri",
|
||||
"Merge cells": "H\u00fccreleri birle\u015ftir",
|
||||
"Split cell": "H\u00fccreleri ay\u0131r",
|
||||
"Insert row before": "\u00d6ncesine yeni sat\u0131r ekle",
|
||||
"Insert row after": "Sonras\u0131na yeni sat\u0131r ekle",
|
||||
"Delete row": "Sat\u0131r\u0131 sil",
|
||||
"Row properties": "Sat\u0131r \u00f6zellikleri",
|
||||
"Cut row": "Sat\u0131r\u0131 kes",
|
||||
"Copy row": "Sat\u0131r\u0131 kopyala",
|
||||
"Paste row before": "\u00d6ncesine sat\u0131r yap\u0131\u015ft\u0131r",
|
||||
"Paste row after": "Sonras\u0131na sat\u0131r yap\u0131\u015ft\u0131r",
|
||||
"Insert column before": "\u00d6ncesine yeni s\u00fctun ekle",
|
||||
"Insert column after": "Sonras\u0131na yeni s\u00fctun ekle",
|
||||
"Delete column": "S\u00fctunu sil",
|
||||
"Cols": "S\u00fctunlar",
|
||||
"Rows": "Sat\u0131rlar",
|
||||
"Width": "Geni\u015flik",
|
||||
"Height": "Y\u00fckseklik",
|
||||
"Cell spacing": "H\u00fccre aral\u0131\u011f\u0131",
|
||||
"Cell padding": "H\u00fccre i\u00e7 bo\u015flu\u011fu",
|
||||
"Caption": "Ba\u015fl\u0131k",
|
||||
"Left": "Sol",
|
||||
"Center": "Orta",
|
||||
"Right": "Sa\u011f",
|
||||
"Cell type": "H\u00fccre tipi",
|
||||
"Scope": "Kapsam",
|
||||
"Alignment": "Hizalama",
|
||||
"H Align": "Yatay Hizalama",
|
||||
"V Align": "Dikey Hizalama",
|
||||
"Top": "\u00dcst",
|
||||
"Middle": "Orta",
|
||||
"Bottom": "Alt",
|
||||
"Header cell": "Ba\u015fl\u0131k h\u00fccresi",
|
||||
"Row group": "Sat\u0131r grubu",
|
||||
"Column group": "S\u00fctun grubu",
|
||||
"Row type": "Sat\u0131r tipi",
|
||||
"Header": "Ba\u015fl\u0131k",
|
||||
"Body": "G\u00f6vde",
|
||||
"Footer": "Alt",
|
||||
"Border color": "Kenarl\u0131k Rengi",
|
||||
"Insert template": "\u015eablon ekle",
|
||||
"Templates": "\u015eablonlar",
|
||||
"Template": "Tema",
|
||||
"Text color": "Yaz\u0131 rengi",
|
||||
"Background color": "Arkaplan rengi",
|
||||
"Custom...": "\u00d6zel",
|
||||
"Custom color": "\u00d6zel Renk",
|
||||
"No color": "Renk Yok",
|
||||
"Table of Contents": "\u0130\u00e7indekiler",
|
||||
"Show blocks": "Bloklar\u0131 g\u00f6r\u00fcnt\u00fcle",
|
||||
"Show invisible characters": "G\u00f6r\u00fcnmez karakterleri g\u00f6ster",
|
||||
"Words: {0}": "Kelime: {0}",
|
||||
"{0} words": "{0} kelime",
|
||||
"File": "Dosya",
|
||||
"Edit": "D\u00fczenle",
|
||||
"Insert": "Ekle",
|
||||
"View": "G\u00f6r\u00fcnt\u00fcle",
|
||||
"Format": "Bi\u00e7im",
|
||||
"Table": "Tablo",
|
||||
"Tools": "Ara\u00e7lar",
|
||||
"Powered by {0}": "{0} taraf\u0131ndan yap\u0131lm\u0131\u015ft\u0131r ",
|
||||
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Zengin Metin Alan\u0131. Men\u00fc i\u00e7in ALT-F9 k\u0131sayolunu kullan\u0131n. Ara\u00e7 \u00e7ubu\u011fu i\u00e7in ALT-F10 k\u0131sayolunu kullan\u0131n. Yard\u0131m i\u00e7in ALT-0 k\u0131sayolunu kullan\u0131n."
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user