Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/jquery/ui
File: selectable.js
/*!
[0] Fix | Delete
* jQuery UI Selectable 1.12.1
[1] Fix | Delete
* http://jqueryui.com
[2] Fix | Delete
*
[3] Fix | Delete
* Copyright jQuery Foundation and other contributors
[4] Fix | Delete
* Released under the MIT license.
[5] Fix | Delete
* http://jquery.org/license
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
//>>label: Selectable
[9] Fix | Delete
//>>group: Interactions
[10] Fix | Delete
//>>description: Allows groups of elements to be selected with the mouse.
[11] Fix | Delete
//>>docs: http://api.jqueryui.com/selectable/
[12] Fix | Delete
//>>demos: http://jqueryui.com/selectable/
[13] Fix | Delete
//>>css.structure: ../../themes/base/selectable.css
[14] Fix | Delete
[15] Fix | Delete
( function( factory ) {
[16] Fix | Delete
if ( typeof define === "function" && define.amd ) {
[17] Fix | Delete
[18] Fix | Delete
// AMD. Register as an anonymous module.
[19] Fix | Delete
define( [
[20] Fix | Delete
"jquery",
[21] Fix | Delete
"./mouse",
[22] Fix | Delete
"./core"
[23] Fix | Delete
], factory );
[24] Fix | Delete
} else {
[25] Fix | Delete
[26] Fix | Delete
// Browser globals
[27] Fix | Delete
factory( jQuery );
[28] Fix | Delete
}
[29] Fix | Delete
}( function( $ ) {
[30] Fix | Delete
[31] Fix | Delete
return $.widget( "ui.selectable", $.ui.mouse, {
[32] Fix | Delete
version: "1.12.1",
[33] Fix | Delete
options: {
[34] Fix | Delete
appendTo: "body",
[35] Fix | Delete
autoRefresh: true,
[36] Fix | Delete
distance: 0,
[37] Fix | Delete
filter: "*",
[38] Fix | Delete
tolerance: "touch",
[39] Fix | Delete
[40] Fix | Delete
// Callbacks
[41] Fix | Delete
selected: null,
[42] Fix | Delete
selecting: null,
[43] Fix | Delete
start: null,
[44] Fix | Delete
stop: null,
[45] Fix | Delete
unselected: null,
[46] Fix | Delete
unselecting: null
[47] Fix | Delete
},
[48] Fix | Delete
_create: function() {
[49] Fix | Delete
var that = this;
[50] Fix | Delete
[51] Fix | Delete
this._addClass( "ui-selectable" );
[52] Fix | Delete
[53] Fix | Delete
this.dragged = false;
[54] Fix | Delete
[55] Fix | Delete
// Cache selectee children based on filter
[56] Fix | Delete
this.refresh = function() {
[57] Fix | Delete
that.elementPos = $( that.element[ 0 ] ).offset();
[58] Fix | Delete
that.selectees = $( that.options.filter, that.element[ 0 ] );
[59] Fix | Delete
that._addClass( that.selectees, "ui-selectee" );
[60] Fix | Delete
that.selectees.each( function() {
[61] Fix | Delete
var $this = $( this ),
[62] Fix | Delete
selecteeOffset = $this.offset(),
[63] Fix | Delete
pos = {
[64] Fix | Delete
left: selecteeOffset.left - that.elementPos.left,
[65] Fix | Delete
top: selecteeOffset.top - that.elementPos.top
[66] Fix | Delete
};
[67] Fix | Delete
$.data( this, "selectable-item", {
[68] Fix | Delete
element: this,
[69] Fix | Delete
$element: $this,
[70] Fix | Delete
left: pos.left,
[71] Fix | Delete
top: pos.top,
[72] Fix | Delete
right: pos.left + $this.outerWidth(),
[73] Fix | Delete
bottom: pos.top + $this.outerHeight(),
[74] Fix | Delete
startselected: false,
[75] Fix | Delete
selected: $this.hasClass( "ui-selected" ),
[76] Fix | Delete
selecting: $this.hasClass( "ui-selecting" ),
[77] Fix | Delete
unselecting: $this.hasClass( "ui-unselecting" )
[78] Fix | Delete
} );
[79] Fix | Delete
} );
[80] Fix | Delete
};
[81] Fix | Delete
this.refresh();
[82] Fix | Delete
[83] Fix | Delete
this._mouseInit();
[84] Fix | Delete
[85] Fix | Delete
this.helper = $( "<div>" );
[86] Fix | Delete
this._addClass( this.helper, "ui-selectable-helper" );
[87] Fix | Delete
},
[88] Fix | Delete
[89] Fix | Delete
_destroy: function() {
[90] Fix | Delete
this.selectees.removeData( "selectable-item" );
[91] Fix | Delete
this._mouseDestroy();
[92] Fix | Delete
},
[93] Fix | Delete
[94] Fix | Delete
_mouseStart: function( event ) {
[95] Fix | Delete
var that = this,
[96] Fix | Delete
options = this.options;
[97] Fix | Delete
[98] Fix | Delete
this.opos = [ event.pageX, event.pageY ];
[99] Fix | Delete
this.elementPos = $( this.element[ 0 ] ).offset();
[100] Fix | Delete
[101] Fix | Delete
if ( this.options.disabled ) {
[102] Fix | Delete
return;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
this.selectees = $( options.filter, this.element[ 0 ] );
[106] Fix | Delete
[107] Fix | Delete
this._trigger( "start", event );
[108] Fix | Delete
[109] Fix | Delete
$( options.appendTo ).append( this.helper );
[110] Fix | Delete
[111] Fix | Delete
// position helper (lasso)
[112] Fix | Delete
this.helper.css( {
[113] Fix | Delete
"left": event.pageX,
[114] Fix | Delete
"top": event.pageY,
[115] Fix | Delete
"width": 0,
[116] Fix | Delete
"height": 0
[117] Fix | Delete
} );
[118] Fix | Delete
[119] Fix | Delete
if ( options.autoRefresh ) {
[120] Fix | Delete
this.refresh();
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
this.selectees.filter( ".ui-selected" ).each( function() {
[124] Fix | Delete
var selectee = $.data( this, "selectable-item" );
[125] Fix | Delete
selectee.startselected = true;
[126] Fix | Delete
if ( !event.metaKey && !event.ctrlKey ) {
[127] Fix | Delete
that._removeClass( selectee.$element, "ui-selected" );
[128] Fix | Delete
selectee.selected = false;
[129] Fix | Delete
that._addClass( selectee.$element, "ui-unselecting" );
[130] Fix | Delete
selectee.unselecting = true;
[131] Fix | Delete
[132] Fix | Delete
// selectable UNSELECTING callback
[133] Fix | Delete
that._trigger( "unselecting", event, {
[134] Fix | Delete
unselecting: selectee.element
[135] Fix | Delete
} );
[136] Fix | Delete
}
[137] Fix | Delete
} );
[138] Fix | Delete
[139] Fix | Delete
$( event.target ).parents().addBack().each( function() {
[140] Fix | Delete
var doSelect,
[141] Fix | Delete
selectee = $.data( this, "selectable-item" );
[142] Fix | Delete
if ( selectee ) {
[143] Fix | Delete
doSelect = ( !event.metaKey && !event.ctrlKey ) ||
[144] Fix | Delete
!selectee.$element.hasClass( "ui-selected" );
[145] Fix | Delete
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
[146] Fix | Delete
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
[147] Fix | Delete
selectee.unselecting = !doSelect;
[148] Fix | Delete
selectee.selecting = doSelect;
[149] Fix | Delete
selectee.selected = doSelect;
[150] Fix | Delete
[151] Fix | Delete
// selectable (UN)SELECTING callback
[152] Fix | Delete
if ( doSelect ) {
[153] Fix | Delete
that._trigger( "selecting", event, {
[154] Fix | Delete
selecting: selectee.element
[155] Fix | Delete
} );
[156] Fix | Delete
} else {
[157] Fix | Delete
that._trigger( "unselecting", event, {
[158] Fix | Delete
unselecting: selectee.element
[159] Fix | Delete
} );
[160] Fix | Delete
}
[161] Fix | Delete
return false;
[162] Fix | Delete
}
[163] Fix | Delete
} );
[164] Fix | Delete
[165] Fix | Delete
},
[166] Fix | Delete
[167] Fix | Delete
_mouseDrag: function( event ) {
[168] Fix | Delete
[169] Fix | Delete
this.dragged = true;
[170] Fix | Delete
[171] Fix | Delete
if ( this.options.disabled ) {
[172] Fix | Delete
return;
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
var tmp,
[176] Fix | Delete
that = this,
[177] Fix | Delete
options = this.options,
[178] Fix | Delete
x1 = this.opos[ 0 ],
[179] Fix | Delete
y1 = this.opos[ 1 ],
[180] Fix | Delete
x2 = event.pageX,
[181] Fix | Delete
y2 = event.pageY;
[182] Fix | Delete
[183] Fix | Delete
if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
[184] Fix | Delete
if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
[185] Fix | Delete
this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
[186] Fix | Delete
[187] Fix | Delete
this.selectees.each( function() {
[188] Fix | Delete
var selectee = $.data( this, "selectable-item" ),
[189] Fix | Delete
hit = false,
[190] Fix | Delete
offset = {};
[191] Fix | Delete
[192] Fix | Delete
//prevent helper from being selected if appendTo: selectable
[193] Fix | Delete
if ( !selectee || selectee.element === that.element[ 0 ] ) {
[194] Fix | Delete
return;
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
offset.left = selectee.left + that.elementPos.left;
[198] Fix | Delete
offset.right = selectee.right + that.elementPos.left;
[199] Fix | Delete
offset.top = selectee.top + that.elementPos.top;
[200] Fix | Delete
offset.bottom = selectee.bottom + that.elementPos.top;
[201] Fix | Delete
[202] Fix | Delete
if ( options.tolerance === "touch" ) {
[203] Fix | Delete
hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
[204] Fix | Delete
offset.bottom < y1 ) );
[205] Fix | Delete
} else if ( options.tolerance === "fit" ) {
[206] Fix | Delete
hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
[207] Fix | Delete
offset.bottom < y2 );
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
if ( hit ) {
[211] Fix | Delete
[212] Fix | Delete
// SELECT
[213] Fix | Delete
if ( selectee.selected ) {
[214] Fix | Delete
that._removeClass( selectee.$element, "ui-selected" );
[215] Fix | Delete
selectee.selected = false;
[216] Fix | Delete
}
[217] Fix | Delete
if ( selectee.unselecting ) {
[218] Fix | Delete
that._removeClass( selectee.$element, "ui-unselecting" );
[219] Fix | Delete
selectee.unselecting = false;
[220] Fix | Delete
}
[221] Fix | Delete
if ( !selectee.selecting ) {
[222] Fix | Delete
that._addClass( selectee.$element, "ui-selecting" );
[223] Fix | Delete
selectee.selecting = true;
[224] Fix | Delete
[225] Fix | Delete
// selectable SELECTING callback
[226] Fix | Delete
that._trigger( "selecting", event, {
[227] Fix | Delete
selecting: selectee.element
[228] Fix | Delete
} );
[229] Fix | Delete
}
[230] Fix | Delete
} else {
[231] Fix | Delete
[232] Fix | Delete
// UNSELECT
[233] Fix | Delete
if ( selectee.selecting ) {
[234] Fix | Delete
if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
[235] Fix | Delete
that._removeClass( selectee.$element, "ui-selecting" );
[236] Fix | Delete
selectee.selecting = false;
[237] Fix | Delete
that._addClass( selectee.$element, "ui-selected" );
[238] Fix | Delete
selectee.selected = true;
[239] Fix | Delete
} else {
[240] Fix | Delete
that._removeClass( selectee.$element, "ui-selecting" );
[241] Fix | Delete
selectee.selecting = false;
[242] Fix | Delete
if ( selectee.startselected ) {
[243] Fix | Delete
that._addClass( selectee.$element, "ui-unselecting" );
[244] Fix | Delete
selectee.unselecting = true;
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
// selectable UNSELECTING callback
[248] Fix | Delete
that._trigger( "unselecting", event, {
[249] Fix | Delete
unselecting: selectee.element
[250] Fix | Delete
} );
[251] Fix | Delete
}
[252] Fix | Delete
}
[253] Fix | Delete
if ( selectee.selected ) {
[254] Fix | Delete
if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
[255] Fix | Delete
that._removeClass( selectee.$element, "ui-selected" );
[256] Fix | Delete
selectee.selected = false;
[257] Fix | Delete
[258] Fix | Delete
that._addClass( selectee.$element, "ui-unselecting" );
[259] Fix | Delete
selectee.unselecting = true;
[260] Fix | Delete
[261] Fix | Delete
// selectable UNSELECTING callback
[262] Fix | Delete
that._trigger( "unselecting", event, {
[263] Fix | Delete
unselecting: selectee.element
[264] Fix | Delete
} );
[265] Fix | Delete
}
[266] Fix | Delete
}
[267] Fix | Delete
}
[268] Fix | Delete
} );
[269] Fix | Delete
[270] Fix | Delete
return false;
[271] Fix | Delete
},
[272] Fix | Delete
[273] Fix | Delete
_mouseStop: function( event ) {
[274] Fix | Delete
var that = this;
[275] Fix | Delete
[276] Fix | Delete
this.dragged = false;
[277] Fix | Delete
[278] Fix | Delete
$( ".ui-unselecting", this.element[ 0 ] ).each( function() {
[279] Fix | Delete
var selectee = $.data( this, "selectable-item" );
[280] Fix | Delete
that._removeClass( selectee.$element, "ui-unselecting" );
[281] Fix | Delete
selectee.unselecting = false;
[282] Fix | Delete
selectee.startselected = false;
[283] Fix | Delete
that._trigger( "unselected", event, {
[284] Fix | Delete
unselected: selectee.element
[285] Fix | Delete
} );
[286] Fix | Delete
} );
[287] Fix | Delete
$( ".ui-selecting", this.element[ 0 ] ).each( function() {
[288] Fix | Delete
var selectee = $.data( this, "selectable-item" );
[289] Fix | Delete
that._removeClass( selectee.$element, "ui-selecting" )
[290] Fix | Delete
._addClass( selectee.$element, "ui-selected" );
[291] Fix | Delete
selectee.selecting = false;
[292] Fix | Delete
selectee.selected = true;
[293] Fix | Delete
selectee.startselected = true;
[294] Fix | Delete
that._trigger( "selected", event, {
[295] Fix | Delete
selected: selectee.element
[296] Fix | Delete
} );
[297] Fix | Delete
} );
[298] Fix | Delete
this._trigger( "stop", event );
[299] Fix | Delete
[300] Fix | Delete
this.helper.remove();
[301] Fix | Delete
[302] Fix | Delete
return false;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
} );
[306] Fix | Delete
[307] Fix | Delete
} ) );
[308] Fix | Delete
[309] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function