initial commit of file from CVS for smeserver-phpsysinfo on Sat Sep 7 20:53:46 AEST 2024
This commit is contained in:
58
root/opt/phpsysinfo/js/jQuery/README
Normal file
58
root/opt/phpsysinfo/js/jQuery/README
Normal file
@@ -0,0 +1,58 @@
|
||||
versions, links and simple description of used jquery files
|
||||
===========================================================
|
||||
|
||||
jquery.js
|
||||
---------
|
||||
VERSION : 2.1.4
|
||||
URL : http://jquery.com/
|
||||
DESC : jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle
|
||||
events, perform animations, and add Ajax interactions to your web pages.
|
||||
USED : used for the entire userinterface
|
||||
|
||||
jquery-1.js
|
||||
---------
|
||||
VERSION : 1.11.3
|
||||
URL : http://jquery.com/
|
||||
DESC : jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle
|
||||
events, perform animations, and add Ajax interactions to your web pages.
|
||||
USED : used for the entire userinterface
|
||||
|
||||
|
||||
jquery.dataTables.js
|
||||
--------------------
|
||||
VERSION : 1.8.2
|
||||
URL : http://plugins.jquery.com/project/DataTables
|
||||
DESC : dataTables is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable
|
||||
table without page refreshes.
|
||||
USED : provide tablesorting for the filesystem table
|
||||
|
||||
jquery.nyroModal.js
|
||||
-------------------
|
||||
VERSION : 1.6.2+jquery1.8fix
|
||||
URL : http://plugins.jquery.com/project/nyroModal
|
||||
DESC : nyroModal is a high customizable modal window plugin.
|
||||
USED : provide a modal dialog, that is shown when errors are found during execution of the php parsers, or lets say
|
||||
in this way: if there are error elements in the xml file
|
||||
|
||||
jquery.timers.js
|
||||
----------------
|
||||
VERSION : 0.1
|
||||
URL : http://plugins.jquery.com/project/Timer
|
||||
DESC : provides a cleaner way to handle intervals
|
||||
USED : automatic reloading of the entire page
|
||||
|
||||
jquery.jgrowl.js
|
||||
----------------
|
||||
VERSION : 1.2.6
|
||||
URL : http://plugins.jquery.com/project/jGrowl
|
||||
DESC : jGrowl is a jQuery plugin that raises unobtrusive messages within the browser, similar to the way that OS X's Growl Framework works
|
||||
USED : show alert and error message
|
||||
|
||||
jquery.treeTable.js
|
||||
-------------------
|
||||
VERSION : 2009-06-22+statefix
|
||||
URL : http://plugins.jquery.com/project/jQTreeTable; http://www.hanpau.com/index.php?page=jqtreetable
|
||||
DESC : Take a plain html table, wrap the rows you want collapsing/expanding in a tbody tag with an id of treetable, map each row to it's parent row, set some options, and let jQTreeTable take it from there.
|
||||
USED : Hardware, Memory, UPS blocks
|
||||
|
||||
$Id: README 702 2012-09-21 16:52:32Z namiltd $
|
25
root/opt/phpsysinfo/js/jQuery/README_bootstrap
Normal file
25
root/opt/phpsysinfo/js/jQuery/README_bootstrap
Normal file
@@ -0,0 +1,25 @@
|
||||
versions, links and simple description of used jquery files
|
||||
===========================================================
|
||||
|
||||
jquery.js
|
||||
---------
|
||||
VERSION : 2.1.4
|
||||
URL : http://jquery.com/
|
||||
DESC : jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle
|
||||
events, perform animations, and add Ajax interactions to your web pages.
|
||||
USED : used for the entire userinterface
|
||||
|
||||
jquery-1.js
|
||||
---------
|
||||
VERSION : 1.11.3
|
||||
URL : http://jquery.com/
|
||||
DESC : jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle
|
||||
events, perform animations, and add Ajax interactions to your web pages.
|
||||
USED : used for the entire userinterface
|
||||
|
||||
jquery.treegrid.js
|
||||
-------------------
|
||||
VERSION : 0.3.0
|
||||
URL : http://plugins.jquery.com/treegrid/; http://maxazan.github.io/jquery-treegrid/
|
||||
DESC : TreeGrid is a lightweight and flexible jQuery plugin to create a tree grid component that renders hierarchical, nested and flat data in a table.
|
||||
USED : Hardware, Memory, UPS blocks
|
10351
root/opt/phpsysinfo/js/jQuery/jquery-1.js
vendored
Normal file
10351
root/opt/phpsysinfo/js/jQuery/jquery-1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7440
root/opt/phpsysinfo/js/jQuery/jquery.dataTables.js
vendored
Normal file
7440
root/opt/phpsysinfo/js/jQuery/jquery.dataTables.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
338
root/opt/phpsysinfo/js/jQuery/jquery.jgrowl.js
Normal file
338
root/opt/phpsysinfo/js/jQuery/jquery.jgrowl.js
Normal file
@@ -0,0 +1,338 @@
|
||||
/**
|
||||
* jGrowl 1.2.6
|
||||
*
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Written by Stan Lemon <stosh1985@gmail.com>
|
||||
* Last updated: 2011.03.27
|
||||
*
|
||||
* jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These
|
||||
* notifications function similarly to the Growl Framework available for
|
||||
* Mac OS X (http://growl.info).
|
||||
*
|
||||
* To Do:
|
||||
* - Move library settings to containers and allow them to be changed per container
|
||||
*
|
||||
* Changes in 1.2.6
|
||||
* - Fixed js error when a notification is opening and closing at the same time
|
||||
*
|
||||
* Changes in 1.2.5
|
||||
* - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults
|
||||
* - Added themeState option to control 'highlight' or 'error' for jQuery UI
|
||||
* - Ammended some CSS to provide default positioning for nested usage.
|
||||
* - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues
|
||||
* - Added two new options - openDuration and closeDuration to allow
|
||||
* better control of notification open and close speeds, respectively
|
||||
* Patch contributed by Jesse Vincet.
|
||||
* - Added afterOpen callback. Patch contributed by Russel Branca.
|
||||
*
|
||||
* Changes in 1.2.4
|
||||
* - Fixed IE bug with the close-all button
|
||||
* - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
|
||||
* - Update IE opacity CSS
|
||||
* - Changed font sizes to use "em", and only set the base style
|
||||
*
|
||||
* Changes in 1.2.3
|
||||
* - The callbacks no longer use the container as context, instead they use the actual notification
|
||||
* - The callbacks now receive the container as a parameter after the options parameter
|
||||
* - beforeOpen and beforeClose now check the return value, if it's false - the notification does
|
||||
* not continue. The open callback will also halt execution if it returns false.
|
||||
* - Fixed bug where containers would get confused
|
||||
* - Expanded the pause functionality to pause an entire container.
|
||||
*
|
||||
* Changes in 1.2.2
|
||||
* - Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan!
|
||||
*
|
||||
* Changes in 1.2.1
|
||||
* - Fixed instance where the interval would fire the close method multiple times.
|
||||
* - Added CSS to hide from print media
|
||||
* - Fixed issue with closer button when div { position: relative } is set
|
||||
* - Fixed leaking issue with multiple containers. Special thanks to Matthew Hanlon!
|
||||
*
|
||||
* Changes in 1.2.0
|
||||
* - Added message pooling to limit the number of messages appearing at a given time.
|
||||
* - Closing a notification is now bound to the notification object and triggered by the close button.
|
||||
*
|
||||
* Changes in 1.1.2
|
||||
* - Added iPhone styled example
|
||||
* - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
|
||||
* - Added template for the close button, so that it's content could be customized.
|
||||
*
|
||||
* Changes in 1.1.1
|
||||
* - Fixed CSS styling bug for ie6 caused by a mispelling
|
||||
* - Changes height restriction on default notifications to min-height
|
||||
* - Added skinned examples using a variety of images
|
||||
* - Added the ability to customize the content of the [close all] box
|
||||
* - Added jTweet, an example of using jGrowl + Twitter
|
||||
*
|
||||
* Changes in 1.1.0
|
||||
* - Multiple container and instances.
|
||||
* - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
|
||||
* - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
|
||||
* - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
|
||||
* - Added new log callback which is called before anything is done for the notification
|
||||
* - Corner's attribute are now applied on an individual notification basis.
|
||||
*
|
||||
* Changes in 1.0.4
|
||||
* - Various CSS fixes so that jGrowl renders correctly in IE6.
|
||||
*
|
||||
* Changes in 1.0.3
|
||||
* - Fixed bug with options persisting across notifications
|
||||
* - Fixed theme application bug
|
||||
* - Simplified some selectors and manipulations.
|
||||
* - Added beforeOpen and beforeClose callbacks
|
||||
* - Reorganized some lines of code to be more readable
|
||||
* - Removed unnecessary this.defaults context
|
||||
* - If corners plugin is present, it's now customizable.
|
||||
* - Customizable open animation.
|
||||
* - Customizable close animation.
|
||||
* - Customizable animation easing.
|
||||
* - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
|
||||
*
|
||||
* Changes in 1.0.2
|
||||
* - All CSS styling is now external.
|
||||
* - Added a theme parameter which specifies a secondary class for styling, such
|
||||
* that notifications can be customized in appearance on a per message basis.
|
||||
* - Notification life span is now customizable on a per message basis.
|
||||
* - Added the ability to disable the global closer, enabled by default.
|
||||
* - Added callbacks for when a notification is opened or closed.
|
||||
* - Added callback for the global closer.
|
||||
* - Customizable animation speed.
|
||||
* - jGrowl now set itself up and tears itself down.
|
||||
*
|
||||
* Changes in 1.0.1:
|
||||
* - Removed dependency on metadata plugin in favor of .data()
|
||||
* - Namespaced all events
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
|
||||
$.jGrowl = function( m , o ) {
|
||||
// To maintain compatibility with older version that only supported one instance we'll create the base container.
|
||||
if ( $('#jGrowl').size() == 0 )
|
||||
$('<div id="jGrowl"></div>').addClass( (o && o.position) ? o.position : $.jGrowl.defaults.position ).appendTo('body');
|
||||
|
||||
// Create a notification on the container.
|
||||
$('#jGrowl').jGrowl(m,o);
|
||||
};
|
||||
|
||||
|
||||
/** Raise jGrowl Notification on a jGrowl Container **/
|
||||
$.fn.jGrowl = function( m , o ) {
|
||||
if ( $.isFunction(this.each) ) {
|
||||
var args = arguments;
|
||||
|
||||
return this.each(function() {
|
||||
var self = this;
|
||||
|
||||
/** Create a jGrowl Instance on the Container if it does not exist **/
|
||||
if ( $(this).data('jGrowl.instance') == undefined ) {
|
||||
$(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } ));
|
||||
$(this).data('jGrowl.instance').startup( this );
|
||||
}
|
||||
|
||||
/** Optionally call jGrowl instance methods, or just raise a normal notification **/
|
||||
if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
|
||||
$(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
|
||||
} else {
|
||||
$(this).data('jGrowl.instance').create( m , o );
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
$.extend( $.fn.jGrowl.prototype , {
|
||||
|
||||
/** Default JGrowl Settings **/
|
||||
defaults: {
|
||||
pool: 0,
|
||||
header: '',
|
||||
group: '',
|
||||
sticky: false,
|
||||
position: 'top-right',
|
||||
glue: 'after',
|
||||
theme: 'default',
|
||||
themeState: 'highlight',
|
||||
corners: '10px',
|
||||
check: 250,
|
||||
life: 3000,
|
||||
closeDuration: 'normal',
|
||||
openDuration: 'normal',
|
||||
easing: 'swing',
|
||||
closer: true,
|
||||
closeTemplate: '×',
|
||||
closerTemplate: '<div>[ close all ]</div>',
|
||||
log: function(e,m,o) {},
|
||||
beforeOpen: function(e,m,o) {},
|
||||
afterOpen: function(e,m,o) {},
|
||||
open: function(e,m,o) {},
|
||||
beforeClose: function(e,m,o) {},
|
||||
close: function(e,m,o) {},
|
||||
animateOpen: {
|
||||
opacity: 'show'
|
||||
},
|
||||
animateClose: {
|
||||
opacity: 'hide'
|
||||
}
|
||||
},
|
||||
|
||||
notifications: [],
|
||||
|
||||
/** jGrowl Container Node **/
|
||||
element: null,
|
||||
|
||||
/** Interval Function **/
|
||||
interval: null,
|
||||
|
||||
/** Create a Notification **/
|
||||
create: function( message , o ) {
|
||||
var o = $.extend({}, this.defaults, o);
|
||||
|
||||
/* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
|
||||
if (typeof o.speed !== 'undefined') {
|
||||
o.openDuration = o.speed;
|
||||
o.closeDuration = o.speed;
|
||||
}
|
||||
|
||||
this.notifications.push({ message: message , options: o });
|
||||
|
||||
o.log.apply( this.element , [this.element,message,o] );
|
||||
},
|
||||
|
||||
render: function( notification ) {
|
||||
var self = this;
|
||||
var message = notification.message;
|
||||
var o = notification.options;
|
||||
|
||||
// Support for jQuery theme-states, if this is not used it displays a widget header
|
||||
o.themeState = (o.themeState == '') ? '' : 'ui-state-' + o.themeState;
|
||||
|
||||
var notification = $(
|
||||
'<div class="jGrowl-notification ' + o.themeState + ' ui-corner-all' +
|
||||
((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '">' +
|
||||
'<div class="jGrowl-close">' + o.closeTemplate + '</div>' +
|
||||
'<div class="jGrowl-header">' + o.header + '</div>' +
|
||||
'<div class="jGrowl-message">' + message + '</div></div>'
|
||||
).data("jGrowl", o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl", function() {
|
||||
$(this).parent().trigger('jGrowl.close');
|
||||
}).parent();
|
||||
|
||||
|
||||
/** Notification Actions **/
|
||||
$(notification).bind("mouseover.jGrowl", function() {
|
||||
$('div.jGrowl-notification', self.element).data("jGrowl.pause", true);
|
||||
}).bind("mouseout.jGrowl", function() {
|
||||
$('div.jGrowl-notification', self.element).data("jGrowl.pause", false);
|
||||
}).bind('jGrowl.beforeOpen', function() {
|
||||
if ( o.beforeOpen.apply( notification , [notification,message,o,self.element] ) != false ) {
|
||||
$(this).trigger('jGrowl.open');
|
||||
}
|
||||
}).bind('jGrowl.open', function() {
|
||||
if ( o.open.apply( notification , [notification,message,o,self.element] ) != false ) {
|
||||
if ( o.glue == 'after' ) {
|
||||
$('div.jGrowl-notification:last', self.element).after(notification);
|
||||
} else {
|
||||
$('div.jGrowl-notification:first', self.element).before(notification);
|
||||
}
|
||||
|
||||
$(this).animate(o.animateOpen, o.openDuration, o.easing, function() {
|
||||
// Fixes some anti-aliasing issues with IE filters.
|
||||
if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0))
|
||||
this.style.removeAttribute('filter');
|
||||
|
||||
if ( $(this).data("jGrowl") != null ) // Happens when a notification is closing before it's open.
|
||||
$(this).data("jGrowl").created = new Date();
|
||||
|
||||
$(this).trigger('jGrowl.afterOpen');
|
||||
});
|
||||
}
|
||||
}).bind('jGrowl.afterOpen', function() {
|
||||
o.afterOpen.apply( notification , [notification,message,o,self.element] );
|
||||
}).bind('jGrowl.beforeClose', function() {
|
||||
if ( o.beforeClose.apply( notification , [notification,message,o,self.element] ) != false )
|
||||
$(this).trigger('jGrowl.close');
|
||||
}).bind('jGrowl.close', function() {
|
||||
// Pause the notification, lest during the course of animation another close event gets called.
|
||||
$(this).data('jGrowl.pause', true);
|
||||
$(this).animate(o.animateClose, o.closeDuration, o.easing, function() {
|
||||
if ( $.isFunction(o.close) ) {
|
||||
if ( o.close.apply( notification , [notification,message,o,self.element] ) !== false )
|
||||
$(this).remove();
|
||||
} else {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}).trigger('jGrowl.beforeOpen');
|
||||
|
||||
/** Optional Corners Plugin **/
|
||||
if ( o.corners != '' && $.fn.corner != undefined ) $(notification).corner( o.corners );
|
||||
|
||||
/** Add a Global Closer if more than one notification exists **/
|
||||
if ( $('div.jGrowl-notification:parent', self.element).size() > 1 &&
|
||||
$('div.jGrowl-closer', self.element).size() == 0 && this.defaults.closer != false ) {
|
||||
$(this.defaults.closerTemplate).addClass('jGrowl-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
|
||||
.appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
|
||||
.bind("click.jGrowl", function() {
|
||||
$(this).siblings().trigger("jGrowl.beforeClose");
|
||||
|
||||
if ( $.isFunction( self.defaults.closer ) ) {
|
||||
self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
/** Update the jGrowl Container, removing old jGrowl notifications **/
|
||||
update: function() {
|
||||
$(this.element).find('div.jGrowl-notification:parent').each( function() {
|
||||
if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created != undefined &&
|
||||
($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life)) < (new Date()).getTime() &&
|
||||
$(this).data("jGrowl").sticky != true &&
|
||||
($(this).data("jGrowl.pause") == undefined || $(this).data("jGrowl.pause") != true) ) {
|
||||
|
||||
// Pause the notification, lest during the course of animation another close event gets called.
|
||||
$(this).trigger('jGrowl.beforeClose');
|
||||
}
|
||||
});
|
||||
|
||||
if ( this.notifications.length > 0 &&
|
||||
(this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
|
||||
this.render( this.notifications.shift() );
|
||||
|
||||
if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
|
||||
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/** Setup the jGrowl Notification Container **/
|
||||
startup: function(e) {
|
||||
this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
|
||||
this.interval = setInterval( function() {
|
||||
$(e).data('jGrowl.instance').update();
|
||||
}, parseInt(this.defaults.check));
|
||||
|
||||
if ($.browser.msie && parseInt($.browser.version) < 7 && !window["XMLHttpRequest"]) {
|
||||
$(this.element).addClass('ie6');
|
||||
}
|
||||
},
|
||||
|
||||
/** Shutdown jGrowl, removing it and clearing the interval **/
|
||||
shutdown: function() {
|
||||
$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();
|
||||
clearInterval( this.interval );
|
||||
},
|
||||
|
||||
close: function() {
|
||||
$(this.element).find('div.jGrowl-notification').each(function(){
|
||||
$(this).trigger('jGrowl.beforeClose');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
|
||||
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
|
||||
|
||||
})(jQuery);
|
9210
root/opt/phpsysinfo/js/jQuery/jquery.js
vendored
Normal file
9210
root/opt/phpsysinfo/js/jQuery/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1707
root/opt/phpsysinfo/js/jQuery/jquery.nyroModal.js
Normal file
1707
root/opt/phpsysinfo/js/jQuery/jquery.nyroModal.js
Normal file
File diff suppressed because it is too large
Load Diff
75
root/opt/phpsysinfo/js/jQuery/jquery.timers.js
Normal file
75
root/opt/phpsysinfo/js/jQuery/jquery.timers.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
*
|
||||
* jQuery Timer plugin v0.1
|
||||
* Matt Schmidt [http://www.mattptr.net]
|
||||
*
|
||||
* Licensed under the BSD License:
|
||||
* http://mattptr.net/license/license.txt
|
||||
*
|
||||
*/
|
||||
|
||||
jQuery.timer = function (interval, callback)
|
||||
{
|
||||
/**
|
||||
*
|
||||
* timer() provides a cleaner way to handle intervals
|
||||
*
|
||||
* @usage
|
||||
* $.timer(interval, callback);
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* $.timer(1000, function (timer) {
|
||||
* alert("hello");
|
||||
* timer.stop();
|
||||
* });
|
||||
* @desc Show an alert box after 1 second and stop
|
||||
*
|
||||
* @example
|
||||
* var second = false;
|
||||
* $.timer(1000, function (timer) {
|
||||
* if (!second) {
|
||||
* alert('First time!');
|
||||
* second = true;
|
||||
* timer.reset(3000);
|
||||
* }
|
||||
* else {
|
||||
* alert('Second time');
|
||||
* timer.stop();
|
||||
* }
|
||||
* });
|
||||
* @desc Show an alert box after 1 second and show another after 3 seconds
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
var interval = interval || 100;
|
||||
|
||||
if (!callback)
|
||||
return false;
|
||||
|
||||
_timer = function (interval, callback) {
|
||||
this.stop = function () {
|
||||
clearInterval(self.id);
|
||||
};
|
||||
|
||||
this.internalCallback = function () {
|
||||
callback(self);
|
||||
};
|
||||
|
||||
this.reset = function (val) {
|
||||
if (self.id)
|
||||
clearInterval(self.id);
|
||||
|
||||
var val = val || 100;
|
||||
this.id = setInterval(this.internalCallback, val);
|
||||
};
|
||||
|
||||
this.interval = interval;
|
||||
this.id = setInterval(this.internalCallback, this.interval);
|
||||
|
||||
var self = this;
|
||||
};
|
||||
|
||||
return new _timer(interval, callback);
|
||||
};
|
124
root/opt/phpsysinfo/js/jQuery/jquery.treeTable.js
Normal file
124
root/opt/phpsysinfo/js/jQuery/jquery.treeTable.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
Copyright: Paul Hanlon
|
||||
|
||||
Released under the MIT/BSD licence which means you can do anything you want
|
||||
with it, as long as you keep this copyright notice on the page
|
||||
*/
|
||||
(function(jq){
|
||||
jq.fn.jqTreeTable=function(map, options){
|
||||
var opts = jq.extend({openImg:"",shutImg:"",leafImg:"",lastOpenImg:"",lastShutImg:"",lastLeafImg:"",vertLineImg:"",blankImg:"",collapse:false,column:0,striped:false,highlight:false,state:true},options),
|
||||
mapa=[],mapb=[],tid=this.attr("id"),collarr=[],
|
||||
stripe=function(){
|
||||
if(opts.striped){
|
||||
$("#"+tid+" tr:not(.collapsed)").filter(":even").addClass("even").removeClass("odd").end().filter(":odd").removeClass("even").addClass("odd");
|
||||
}
|
||||
},
|
||||
buildText = function(parno, preStr){//Recursively build up the text for the images that make it work
|
||||
var mp=mapa[parno], ro=0, pre="", pref, img;
|
||||
for (var y=0,yl=mp.length;y<yl;y++){
|
||||
ro = mp[y];
|
||||
if (mapa[ro]){//It's a parent as well. Build it's string and move on to it's children
|
||||
pre=(y==yl-1)? opts.blankImg: opts.vertLineImg;
|
||||
img=(y==yl-1)? opts.lastOpenImg: opts.openImg;
|
||||
mapb[ro-1] = preStr + '<img src="'+img+'" class="parimg" id="'+tid+ro+'">';
|
||||
pref = preStr + '<img src="'+pre+'" class="preimg">';
|
||||
arguments.callee(ro, pref);
|
||||
}else{//it's a child
|
||||
img = (y==yl-1)? opts.lastLeafImg: opts.leafImg;//It's the last child, It's child will have a blank field behind it
|
||||
mapb[ro-1] = preStr + '<img src="'+img+'" class="ttimage" id="'+tid+ro+'">';
|
||||
}
|
||||
}
|
||||
},
|
||||
expandKids = function(num, last){//Expands immediate children, and their uncollapsed children
|
||||
jq("#"+tid+num).attr("src", (last)? opts.lastOpenImg: opts.openImg);//
|
||||
for (var x=0, xl=mapa[num].length;x<xl;x++){
|
||||
var mnx = mapa[num][x];
|
||||
jq("#"+tid+mnx).parents("tr").removeClass("collapsed");
|
||||
if (mapa[mnx] && opts.state && jq.inArray(mnx, collarr)<0){////If it is a parent and its number is not in the collapsed array
|
||||
arguments.callee(mnx,(x==xl-1));//Expand it. More intuitive way of displaying the tree
|
||||
}
|
||||
}
|
||||
},
|
||||
collapseKids = function(num, last){//Recursively collapses all children and their children and change icon
|
||||
if (mapa[num]){
|
||||
jq("#"+tid+num).attr("src", (last)? opts.lastShutImg: opts.shutImg);
|
||||
for (var x=0, xl=mapa[num].length;x<xl;x++){
|
||||
var mnx = mapa[num][x];
|
||||
jq("#"+tid+mnx).parents("tr").addClass("collapsed");
|
||||
if (mapa[mnx]){//If it is a parent
|
||||
arguments.callee(mnx,(x==xl-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
creset = function(num, exp){//Resets the collapse array
|
||||
var o = (exp)? collarr.splice(jq.inArray(num, collarr), 1): collarr.push(num);
|
||||
cset(tid,collarr);
|
||||
},
|
||||
cget = function(n){
|
||||
var v='',c=' '+document.cookie+';',s=c.indexOf(' '+n+'=');
|
||||
if (s>=0) {
|
||||
s+=n.length+2;
|
||||
v=(c.substring(s,c.indexOf(';',s))).split("|");
|
||||
}
|
||||
return v||[];
|
||||
},
|
||||
cset = function (n,v) {
|
||||
v = arrUniq(v);
|
||||
document.cookie = n+"="+v.join("|")+";";
|
||||
},
|
||||
arrUniq = function(a) {/* http://www.shamasis.net/2009/09/fast-algorithm-to-find-unique-items-in-javascript-array/ */
|
||||
var o = {}, i, l = a.length, r = [];
|
||||
for(i=0; i<l;i++) o[a[i]] = a[i];
|
||||
for(i in o) r.push(o[i]);
|
||||
return r;
|
||||
};
|
||||
for (var x=0,xl=map.length; x<xl;x++){//From map of parents, get map of kids
|
||||
num = map[x];
|
||||
if (!mapa[num]){
|
||||
mapa[num]=[];
|
||||
}
|
||||
mapa[num].push(x+1);
|
||||
}
|
||||
buildText(0,"");
|
||||
jq("tbody tr", this).each(function(i){//Inject the images into the column to make it work
|
||||
jq(this).children("td").eq(opts.column).prepend(mapb[i]);
|
||||
});
|
||||
if(opts.state) collarr = cget(tid);
|
||||
if (!collarr.length){
|
||||
if(opts.collapse.constructor == Array) {
|
||||
collarr=collarr.concat(opts.collapse);
|
||||
if ((collarr.length) && (opts.state)){
|
||||
cset(tid,collarr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (collarr.length){
|
||||
for (var y=0,yl=collarr.length;y<yl;y++){
|
||||
collapseKids(collarr[y], $("#"+tid+collarr[y]+ ".parimg").attr("src")==opts.lastOpenImg);
|
||||
}
|
||||
}
|
||||
stripe();
|
||||
jq(".parimg", this).each(function(i){
|
||||
var jqt = jq(this),last;
|
||||
jqt.click(function(){
|
||||
var num = parseInt(jqt.attr("id").substr(tid.length));//Number of the row
|
||||
if (jqt.parents("tr").next().is(".collapsed")){//If the table row directly below is collapsed
|
||||
expandKids(num, (jqt.attr("src")==opts.lastShutImg));//Then expand all children not in collarr
|
||||
if(opts.state){creset(num,true);}//If state is set, store in cookie
|
||||
}else{//Collapse all and set image to opts.shutImg or opts.lastShutImg on parents
|
||||
collapseKids(num, (jqt.attr("src")==opts.lastOpenImg));
|
||||
if(opts.state){creset(num,false);}//If state is set, store in cookie
|
||||
}
|
||||
stripe();//Restripe the rows
|
||||
});
|
||||
});
|
||||
if (opts.highlight){//This is where it highlights the rows
|
||||
jq("tr", this).hover(
|
||||
function(){jq(this).addClass("over");},
|
||||
function(){jq(this).removeClass("over");}
|
||||
);
|
||||
};
|
||||
};
|
||||
return this;
|
||||
})(jQuery);
|
626
root/opt/phpsysinfo/js/jQuery/jquery.treegrid.js
Normal file
626
root/opt/phpsysinfo/js/jQuery/jquery.treegrid.js
Normal file
@@ -0,0 +1,626 @@
|
||||
/*
|
||||
* jQuery treegrid Plugin 0.3.0
|
||||
* https://github.com/maxazan/jquery-treegrid
|
||||
*
|
||||
* Copyright 2013, Pomazan Max
|
||||
* Licensed under the MIT licenses.
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
var methods = {
|
||||
/**
|
||||
* Initialize tree
|
||||
*
|
||||
* @param {Object} options
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
initTree: function(options) {
|
||||
var settings = $.extend({}, this.treegrid.defaults, options);
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('setTreeContainer', $(this));
|
||||
$this.treegrid('setSettings', settings);
|
||||
settings.getRootNodes.apply(this, [$(this)]).treegrid('initNode', settings);
|
||||
$this.treegrid('getRootNodes').treegrid('render');
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Initialize node
|
||||
*
|
||||
* @param {Object} settings
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
initNode: function(settings) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('setTreeContainer', settings.getTreeGridContainer.apply(this));
|
||||
$this.treegrid('getChildNodes').treegrid('initNode', settings);
|
||||
$this.treegrid('initExpander').treegrid('initIndent').treegrid('initEvents').treegrid('initState').treegrid('initChangeEvent').treegrid("initSettingsEvents");
|
||||
});
|
||||
},
|
||||
initChangeEvent: function() {
|
||||
var $this = $(this);
|
||||
//Save state on change
|
||||
$this.on("change", function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('render');
|
||||
if ($this.treegrid('getSetting', 'saveState')) {
|
||||
$this.treegrid('saveState');
|
||||
}
|
||||
});
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Initialize node events
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
initEvents: function() {
|
||||
var $this = $(this);
|
||||
//Default behavior on collapse
|
||||
$this.on("collapse", function() {
|
||||
var $this = $(this);
|
||||
$this.removeClass('treegrid-expanded');
|
||||
$this.addClass('treegrid-collapsed');
|
||||
});
|
||||
//Default behavior on expand
|
||||
$this.on("expand", function() {
|
||||
var $this = $(this);
|
||||
$this.removeClass('treegrid-collapsed');
|
||||
$this.addClass('treegrid-expanded');
|
||||
});
|
||||
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Initialize events from settings
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
initSettingsEvents: function() {
|
||||
var $this = $(this);
|
||||
//Save state on change
|
||||
$this.on("change", function() {
|
||||
var $this = $(this);
|
||||
if (typeof($this.treegrid('getSetting', 'onChange')) === "function") {
|
||||
$this.treegrid('getSetting', 'onChange').apply($this);
|
||||
}
|
||||
});
|
||||
//Default behavior on collapse
|
||||
$this.on("collapse", function() {
|
||||
var $this = $(this);
|
||||
if (typeof($this.treegrid('getSetting', 'onCollapse')) === "function") {
|
||||
$this.treegrid('getSetting', 'onCollapse').apply($this);
|
||||
}
|
||||
});
|
||||
//Default behavior on expand
|
||||
$this.on("expand", function() {
|
||||
var $this = $(this);
|
||||
if (typeof($this.treegrid('getSetting', 'onExpand')) === "function") {
|
||||
$this.treegrid('getSetting', 'onExpand').apply($this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Initialize expander for node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
initExpander: function() {
|
||||
var $this = $(this);
|
||||
var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn'));
|
||||
var tpl = $this.treegrid('getSetting', 'expanderTemplate');
|
||||
var expander = $this.treegrid('getSetting', 'getExpander').apply(this);
|
||||
if (expander) {
|
||||
expander.remove();
|
||||
}
|
||||
$(tpl).prependTo(cell).click(function() {
|
||||
$($(this).closest('tr')).treegrid('toggle');
|
||||
});
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Initialize indent for node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
initIndent: function() {
|
||||
var $this = $(this);
|
||||
$this.find('.treegrid-indent').remove();
|
||||
var tpl = $this.treegrid('getSetting', 'indentTemplate');
|
||||
var expander = $this.find('.treegrid-expander');
|
||||
var depth = $this.treegrid('getDepth');
|
||||
for (var i = 0; i < depth; i++) {
|
||||
$(tpl).insertBefore(expander);
|
||||
}
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Initialise state of node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
initState: function() {
|
||||
var $this = $(this);
|
||||
if ($this.treegrid('getSetting', 'saveState') && !$this.treegrid('isFirstInit')) {
|
||||
$this.treegrid('restoreState');
|
||||
} else {
|
||||
if ($this.treegrid('getSetting', 'initialState') === "expanded") {
|
||||
$this.treegrid('expand');
|
||||
} else {
|
||||
$this.treegrid('collapse');
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Return true if this tree was never been initialised
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isFirstInit: function() {
|
||||
var tree = $(this).treegrid('getTreeContainer');
|
||||
if (tree.data('first_init') === undefined) {
|
||||
tree.data('first_init', $.cookie(tree.treegrid('getSetting', 'saveStateName')) === undefined);
|
||||
}
|
||||
return tree.data('first_init');
|
||||
},
|
||||
/**
|
||||
* Save state of current node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
saveState: function() {
|
||||
var $this = $(this);
|
||||
if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') {
|
||||
|
||||
var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || '';
|
||||
var stateArray = (stateArrayString === '' ? [] : stateArrayString.split(','));
|
||||
var nodeId = $this.treegrid('getNodeId');
|
||||
|
||||
if ($this.treegrid('isExpanded')) {
|
||||
if ($.inArray(nodeId, stateArray) === -1) {
|
||||
stateArray.push(nodeId);
|
||||
}
|
||||
} else if ($this.treegrid('isCollapsed')) {
|
||||
if ($.inArray(nodeId, stateArray) !== -1) {
|
||||
stateArray.splice($.inArray(nodeId, stateArray), 1);
|
||||
}
|
||||
}
|
||||
$.cookie($this.treegrid('getSetting', 'saveStateName'), stateArray.join(','));
|
||||
}
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Restore state of current node.
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
restoreState: function() {
|
||||
var $this = $(this);
|
||||
if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') {
|
||||
var stateArray = $.cookie($this.treegrid('getSetting', 'saveStateName')).split(',');
|
||||
if ($.inArray($this.treegrid('getNodeId'), stateArray) !== -1) {
|
||||
$this.treegrid('expand');
|
||||
} else {
|
||||
$this.treegrid('collapse');
|
||||
}
|
||||
|
||||
}
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Method return setting by name
|
||||
*
|
||||
* @param {type} name
|
||||
* @returns {unresolved}
|
||||
*/
|
||||
getSetting: function(name) {
|
||||
if (!$(this).treegrid('getTreeContainer')) {
|
||||
return null;
|
||||
}
|
||||
return $(this).treegrid('getTreeContainer').data('settings')[name];
|
||||
},
|
||||
/**
|
||||
* Add new settings
|
||||
*
|
||||
* @param {Object} settings
|
||||
*/
|
||||
setSettings: function(settings) {
|
||||
$(this).treegrid('getTreeContainer').data('settings', settings);
|
||||
},
|
||||
/**
|
||||
* Return tree container
|
||||
*
|
||||
* @returns {HtmlElement}
|
||||
*/
|
||||
getTreeContainer: function() {
|
||||
return $(this).data('treegrid');
|
||||
},
|
||||
/**
|
||||
* Set tree container
|
||||
*
|
||||
* @param {HtmlE;ement} container
|
||||
*/
|
||||
setTreeContainer: function(container) {
|
||||
return $(this).data('treegrid', container);
|
||||
},
|
||||
/**
|
||||
* Method return all root nodes of tree.
|
||||
*
|
||||
* Start init all child nodes from it.
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
getRootNodes: function() {
|
||||
return $(this).treegrid('getSetting', 'getRootNodes').apply(this, [$(this).treegrid('getTreeContainer')]);
|
||||
},
|
||||
/**
|
||||
* Method return all nodes of tree.
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
getAllNodes: function() {
|
||||
return $(this).treegrid('getSetting', 'getAllNodes').apply(this, [$(this).treegrid('getTreeContainer')]);
|
||||
},
|
||||
/**
|
||||
* Mthod return true if element is Node
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
isNode: function() {
|
||||
return $(this).treegrid('getNodeId') !== null;
|
||||
},
|
||||
/**
|
||||
* Mthod return id of node
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
getNodeId: function() {
|
||||
if ($(this).treegrid('getSetting', 'getNodeId') === null) {
|
||||
return null;
|
||||
} else {
|
||||
return $(this).treegrid('getSetting', 'getNodeId').apply(this);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Method return parent id of node or null if root node
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
getParentNodeId: function() {
|
||||
return $(this).treegrid('getSetting', 'getParentNodeId').apply(this);
|
||||
},
|
||||
/**
|
||||
* Method return parent node or null if root node
|
||||
*
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
getParentNode: function() {
|
||||
if ($(this).treegrid('getParentNodeId') === null) {
|
||||
return null;
|
||||
} else {
|
||||
return $(this).treegrid('getSetting', 'getNodeById').apply(this, [$(this).treegrid('getParentNodeId'), $(this).treegrid('getTreeContainer')]);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Method return array of child nodes or null if node is leaf
|
||||
*
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
getChildNodes: function() {
|
||||
return $(this).treegrid('getSetting', 'getChildNodes').apply(this, [$(this).treegrid('getNodeId'), $(this).treegrid('getTreeContainer')]);
|
||||
},
|
||||
/**
|
||||
* Method return depth of tree.
|
||||
*
|
||||
* This method is needs for calculate indent
|
||||
*
|
||||
* @returns {Number}
|
||||
*/
|
||||
getDepth: function() {
|
||||
if ($(this).treegrid('getParentNode') === null) {
|
||||
return 0;
|
||||
}
|
||||
return $(this).treegrid('getParentNode').treegrid('getDepth') + 1;
|
||||
},
|
||||
/**
|
||||
* Method return true if node is root
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isRoot: function() {
|
||||
return $(this).treegrid('getDepth') === 0;
|
||||
},
|
||||
/**
|
||||
* Method return true if node has no child nodes
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isLeaf: function() {
|
||||
return $(this).treegrid('getChildNodes').length === 0;
|
||||
},
|
||||
/**
|
||||
* Method return true if node last in branch
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isLast: function() {
|
||||
if ($(this).treegrid('isNode')) {
|
||||
var parentNode = $(this).treegrid('getParentNode');
|
||||
if (parentNode === null) {
|
||||
if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').last().treegrid('getNodeId')) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').last().treegrid('getNodeId')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* Method return true if node first in branch
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isFirst: function() {
|
||||
if ($(this).treegrid('isNode')) {
|
||||
var parentNode = $(this).treegrid('getParentNode');
|
||||
if (parentNode === null) {
|
||||
if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').first().treegrid('getNodeId')) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').first().treegrid('getNodeId')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* Return true if node expanded
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isExpanded: function() {
|
||||
return $(this).hasClass('treegrid-expanded');
|
||||
},
|
||||
/**
|
||||
* Return true if node collapsed
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isCollapsed: function() {
|
||||
return $(this).hasClass('treegrid-collapsed');
|
||||
},
|
||||
/**
|
||||
* Return true if at least one of parent node is collapsed
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isOneOfParentsCollapsed: function() {
|
||||
var $this = $(this);
|
||||
if ($this.treegrid('isRoot')) {
|
||||
return false;
|
||||
} else {
|
||||
if ($this.treegrid('getParentNode').treegrid('isCollapsed')) {
|
||||
return true;
|
||||
} else {
|
||||
return $this.treegrid('getParentNode').treegrid('isOneOfParentsCollapsed');
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Expand node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
expand: function() {
|
||||
if (!this.treegrid('isLeaf') && !this.treegrid("isExpanded")) {
|
||||
this.trigger("expand");
|
||||
this.trigger("change");
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Expand all nodes
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
expandAll: function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('getRootNodes').treegrid('expandRecursive');
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Expand current node and all child nodes begin from current
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
expandRecursive: function() {
|
||||
return $(this).each(function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('expand');
|
||||
if (!$this.treegrid('isLeaf')) {
|
||||
$this.treegrid('getChildNodes').treegrid('expandRecursive');
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Collapse node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
collapse: function() {
|
||||
return $(this).each(function() {
|
||||
var $this = $(this);
|
||||
if (!$this.treegrid('isLeaf') && !$this.treegrid("isCollapsed")) {
|
||||
$this.trigger("collapse");
|
||||
$this.trigger("change");
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Collapse all nodes
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
collapseAll: function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('getRootNodes').treegrid('collapseRecursive');
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Collapse current node and all child nodes begin from current
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
collapseRecursive: function() {
|
||||
return $(this).each(function() {
|
||||
var $this = $(this);
|
||||
$this.treegrid('collapse');
|
||||
if (!$this.treegrid('isLeaf')) {
|
||||
$this.treegrid('getChildNodes').treegrid('collapseRecursive');
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Expand if collapsed, Collapse if expanded
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
toggle: function() {
|
||||
var $this = $(this);
|
||||
if ($this.treegrid('isExpanded')) {
|
||||
$this.treegrid('collapse');
|
||||
} else {
|
||||
$this.treegrid('expand');
|
||||
}
|
||||
return $this;
|
||||
},
|
||||
/**
|
||||
* Rendering node
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
render: function() {
|
||||
return $(this).each(function() {
|
||||
var $this = $(this);
|
||||
//if parent colapsed we hidden
|
||||
if ($this.treegrid('isOneOfParentsCollapsed')) {
|
||||
$this.hide();
|
||||
} else {
|
||||
$this.show();
|
||||
}
|
||||
if (!$this.treegrid('isLeaf')) {
|
||||
$this.treegrid('renderExpander');
|
||||
$this.treegrid('getChildNodes').treegrid('render');
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Rendering expander depends on node state
|
||||
*
|
||||
* @returns {Node}
|
||||
*/
|
||||
renderExpander: function() {
|
||||
return $(this).each(function() {
|
||||
var $this = $(this);
|
||||
var expander = $this.treegrid('getSetting', 'getExpander').apply(this);
|
||||
if (expander) {
|
||||
|
||||
if (!$this.treegrid('isCollapsed')) {
|
||||
expander.removeClass($this.treegrid('getSetting', 'expanderCollapsedClass'));
|
||||
expander.addClass($this.treegrid('getSetting', 'expanderExpandedClass'));
|
||||
} else {
|
||||
expander.removeClass($this.treegrid('getSetting', 'expanderExpandedClass'));
|
||||
expander.addClass($this.treegrid('getSetting', 'expanderCollapsedClass'));
|
||||
}
|
||||
} else {
|
||||
$this.treegrid('initExpander');
|
||||
$this.treegrid('renderExpander');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$.fn.treegrid = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || !method) {
|
||||
return methods.initTree.apply(this, arguments);
|
||||
} else {
|
||||
$.error('Method with name ' + method + ' does not exists for jQuery.treegrid');
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Plugin's default options
|
||||
*/
|
||||
$.fn.treegrid.defaults = {
|
||||
initialState: 'expanded',
|
||||
saveState: false,
|
||||
saveStateMethod: 'cookie',
|
||||
saveStateName: 'tree-grid-state',
|
||||
expanderTemplate: '<span class="treegrid-expander"></span>',
|
||||
indentTemplate: '<span class="treegrid-indent"></span>',
|
||||
expanderExpandedClass: 'treegrid-expander-expanded',
|
||||
expanderCollapsedClass: 'treegrid-expander-collapsed',
|
||||
treeColumn: 0,
|
||||
getExpander: function() {
|
||||
return $(this).find('.treegrid-expander');
|
||||
},
|
||||
getNodeId: function() {
|
||||
var template = /treegrid-([A-Za-z0-9_-]+)/;
|
||||
if (template.test($(this).attr('class'))) {
|
||||
return template.exec($(this).attr('class'))[1];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
getParentNodeId: function() {
|
||||
var template = /treegrid-parent-([A-Za-z0-9_-]+)/;
|
||||
if (template.test($(this).attr('class'))) {
|
||||
return template.exec($(this).attr('class'))[1];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
getNodeById: function(id, treegridContainer) {
|
||||
var templateClass = "treegrid-" + id;
|
||||
return treegridContainer.find('tr.' + templateClass);
|
||||
},
|
||||
getChildNodes: function(id, treegridContainer) {
|
||||
var templateClass = "treegrid-parent-" + id;
|
||||
return treegridContainer.find('tr.' + templateClass);
|
||||
},
|
||||
getTreeGridContainer: function() {
|
||||
return $(this).closest('table');
|
||||
},
|
||||
getRootNodes: function(treegridContainer) {
|
||||
var result = $.grep(treegridContainer.find('tr'), function(element) {
|
||||
var classNames = $(element).attr('class');
|
||||
var templateClass = /treegrid-([A-Za-z0-9_-]+)/;
|
||||
var templateParentClass = /treegrid-parent-([A-Za-z0-9_-]+)/;
|
||||
return templateClass.test(classNames) && !templateParentClass.test(classNames);
|
||||
});
|
||||
return $(result);
|
||||
},
|
||||
getAllNodes: function(treegridContainer) {
|
||||
var result = $.grep(treegridContainer.find('tr'), function(element) {
|
||||
var classNames = $(element).attr('class');
|
||||
var templateClass = /treegrid-([A-Za-z0-9_-]+)/;
|
||||
return templateClass.test(classNames);
|
||||
});
|
||||
return $(result);
|
||||
},
|
||||
//Events
|
||||
onCollapse: null,
|
||||
onExpand: null,
|
||||
onChange: null
|
||||
|
||||
};
|
||||
})(jQuery);
|
Reference in New Issue
Block a user