mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
697257670c
commit
02ae9ec81e
123 changed files with 13600 additions and 531 deletions
115
dashboard-ui/bower_components/jstree/src/jstree.wholerow.js
vendored
Normal file
115
dashboard-ui/bower_components/jstree/src/jstree.wholerow.js
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* ### Wholerow plugin
|
||||
*
|
||||
* Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.
|
||||
*/
|
||||
/*globals jQuery, define, exports, require */
|
||||
(function (factory) {
|
||||
"use strict";
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('jstree.wholerow', ['jquery','jstree'], factory);
|
||||
}
|
||||
else if(typeof exports === 'object') {
|
||||
factory(require('jquery'), require('jstree'));
|
||||
}
|
||||
else {
|
||||
factory(jQuery, jQuery.jstree);
|
||||
}
|
||||
}(function ($, jstree, undefined) {
|
||||
"use strict";
|
||||
|
||||
if($.jstree.plugins.wholerow) { return; }
|
||||
|
||||
var div = document.createElement('DIV');
|
||||
div.setAttribute('unselectable','on');
|
||||
div.setAttribute('role','presentation');
|
||||
div.className = 'jstree-wholerow';
|
||||
div.innerHTML = ' ';
|
||||
$.jstree.plugins.wholerow = function (options, parent) {
|
||||
this.bind = function () {
|
||||
parent.bind.call(this);
|
||||
|
||||
this.element
|
||||
.on('ready.jstree set_state.jstree', $.proxy(function () {
|
||||
this.hide_dots();
|
||||
}, this))
|
||||
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
|
||||
//div.style.height = this._data.core.li_height + 'px';
|
||||
this.get_container_ul().addClass('jstree-wholerow-ul');
|
||||
}, this))
|
||||
.on("deselect_all.jstree", $.proxy(function (e, data) {
|
||||
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
||||
}, this))
|
||||
.on("changed.jstree", $.proxy(function (e, data) {
|
||||
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
||||
var tmp = false, i, j;
|
||||
for(i = 0, j = data.selected.length; i < j; i++) {
|
||||
tmp = this.get_node(data.selected[i], true);
|
||||
if(tmp && tmp.length) {
|
||||
tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
||||
}
|
||||
}
|
||||
}, this))
|
||||
.on("open_node.jstree", $.proxy(function (e, data) {
|
||||
this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
||||
}, this))
|
||||
.on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
|
||||
if(e.type === "hover_node" && this.is_disabled(data.node)) { return; }
|
||||
this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered');
|
||||
}, this))
|
||||
.on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) {
|
||||
e.preventDefault();
|
||||
var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY });
|
||||
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp);
|
||||
}, this))
|
||||
/*!
|
||||
.on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) {
|
||||
if(e.target === e.currentTarget) {
|
||||
var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor");
|
||||
e.target = a[0];
|
||||
a.trigger(e);
|
||||
}
|
||||
})
|
||||
*/
|
||||
.on("click.jstree", ".jstree-wholerow", function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
||||
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
||||
})
|
||||
.on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
||||
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
||||
}, this))
|
||||
.on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
if(!this.is_disabled(e.currentTarget)) {
|
||||
this.hover_node(e.currentTarget);
|
||||
}
|
||||
return false;
|
||||
}, this))
|
||||
.on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) {
|
||||
this.dehover_node(e.currentTarget);
|
||||
}, this));
|
||||
};
|
||||
this.teardown = function () {
|
||||
if(this.settings.wholerow) {
|
||||
this.element.find(".jstree-wholerow").remove();
|
||||
}
|
||||
parent.teardown.call(this);
|
||||
};
|
||||
this.redraw_node = function(obj, deep, callback, force_render) {
|
||||
obj = parent.redraw_node.apply(this, arguments);
|
||||
if(obj) {
|
||||
var tmp = div.cloneNode(true);
|
||||
//tmp.style.height = this._data.core.li_height + 'px';
|
||||
if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }
|
||||
if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; }
|
||||
obj.insertBefore(tmp, obj.childNodes[0]);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
};
|
||||
// include the wholerow plugin by default
|
||||
// $.jstree.defaults.plugins.push("wholerow");
|
||||
}));
|
Loading…
Add table
Add a link
Reference in a new issue