dump: 1.1.001
|
@ -0,0 +1,21 @@
|
|||
# bgtoolset
|
||||
|
||||
This is a dump of excellent Ps3xploit Team [bgtoolset](https://www.ps3xploit.net/bgtoolset/). **I'm not an author of any of these tools**, all credits go to
|
||||
Ps3xploit team. If you find these tools useful, please consider a donation via Paypal at team@ps3xploit.net or in BTC at either of the addresses below:
|
||||
|
||||
| ![Legacy P2PKH](assets/images/qr-legacy-P2PKH.png) | ![Segwit BECH32](assets/images/qr-native-segwit-BECH32.png) | ![PayNyms](assets/images/qr-PayNyms.png) |
|
||||
|:---:|:---:|:---:|
|
||||
| Legacy P2PKH | Segwit BECH32 | PayNyms |
|
||||
|
||||
## IMPORTANT INFO, please read carefuly.
|
||||
|
||||
- **This is NOT official repository of bgtoolset**. It's a dump which I made for myself, to be able jailbreak my console if for whatever reason [Ps3Xploit](https://www.ps3xploit.com/)
|
||||
website goes down.
|
||||
- **Use this mirror as a last resort** - you should always go to [bgtoolset page](https://www.ps3xploit.net/bgtoolset/) first, and use tools provided there.
|
||||
Not only they are more reliable, and written by people who actually know what they're doing - they're also always up to date.
|
||||
- **I'm not responsible for any damage you may do to your console**. This stuff if used inproperly, can brick your PS3.
|
||||
- I tested this dump on my `CECHJ03 PAL` PS3 FAT console, with `4.87` firmware, and it worked without any issues. However I do not guarantee that it will work for you.
|
||||
- I'm not providing any info how to use this locally, if you don't know it - you probably shouldn't do this.
|
||||
- It's not a full dump, I only focused on happy path, of flashing PS3. Memory editor probably wouldn't work, logs are also not reliable. Original toolset uses `*.php` files,
|
||||
which (for obvious reasons) I couldn't dump, so most of them are just plain HTML output of the scripts. The `file.php` is my dummy, minimal implementation which makes
|
||||
all this stuff work.
|
|
@ -0,0 +1,6 @@
|
|||
@font-face {
|
||||
font-family: 'Space Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(assets/fonts//v6/i7dPIFZifjKcF5UAWdDRYEF8QA.ttf) format('truetype');
|
||||
}
|
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 42 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 400 B |
After Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 405 B |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 42 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 42 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 399 B |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 42 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 401 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
$file = $_REQUEST['file'];
|
||||
|
||||
$files = array(
|
||||
'FP9TesterK.swf' => array(
|
||||
'path' => __DIR__ . '/files/FP9TesterK.swf',
|
||||
'type' => 'application/x-shockwave-flash',
|
||||
'kind' => 'flash',
|
||||
),
|
||||
'PS3FP9NC.swf' => array(
|
||||
'path' => __DIR__ . '/files/PS3FP9NC.swf',
|
||||
'type' => 'application/x-shockwave-flash',
|
||||
'kind' => 'flash',
|
||||
),
|
||||
'PS3LoaderK.swf' => array(
|
||||
'path' => __DIR__ . '/files/PS3LoaderK.swf',
|
||||
'type' => 'application/x-shockwave-flash',
|
||||
'kind' => 'flash',
|
||||
),
|
||||
'biginteger.pmin.js' => array(
|
||||
'path' => __DIR__ . '/files/biginteger.pmin.js',
|
||||
'type' => 'application/x-javascript',
|
||||
'kind' => 'js',
|
||||
),
|
||||
'framework.pmin.js' => array(
|
||||
'path' => __DIR__ . '/files/framework.pmin.js',
|
||||
'type' => 'application/x-javascript',
|
||||
'kind' => 'js',
|
||||
),
|
||||
'nofsm_patch_487.bin' => array(
|
||||
'path' => __DIR__ . '/files/nofsm_patch_487.bin',
|
||||
'type' => 'application/octet-stream',
|
||||
'kind' => 'bin',
|
||||
)
|
||||
);
|
||||
|
||||
$item = $files[$file];
|
||||
|
||||
if(!file_exists($item['path'])) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: ' . $item['type']);
|
||||
header('Content-Length: ' . filesize($item['path']));
|
||||
if($item['kind'] == 'flash') {
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
}
|
||||
if($item['kind'] == 'js') {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Disposition: inline; filename="' . $file . '"');
|
||||
}
|
||||
if($item['kind'] == 'bin') {
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Disposition: attachment; filename="' . $file . '"');
|
||||
}
|
||||
readfile($item['path']);
|
|
@ -0,0 +1,931 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>PS3 Toolset by @bguerville</title>
|
||||
<script type='text/javascript' src="js/logger.pmin.js"></script>
|
||||
<script>
|
||||
"use strict"
|
||||
var token=null;
|
||||
var ftoken=null;
|
||||
var libraries = [
|
||||
//{'library':'cookies','async':true,'fail':0,'url':'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js','data':null},
|
||||
//{'library':'jquery','async':true,'fail':0,'url':'https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js','data':null},
|
||||
//{'library':'jqueryui','async':true,'fail':0,'url':'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js','data':null},
|
||||
{'library':'cookies','async':true,'fail':0,'url':'js/js.cookie.min.js','data':null},
|
||||
{'library':'jquery','async':true,'fail':0,'url':'js/jquery-1.12.4.min.js','data':null},
|
||||
{'library':'jqueryui','async':true,'fail':0,'url':'js/jquery-ui.min.js','data':null},
|
||||
{'library':'mscb','async':true,'fail':0,'url':'js/mCustomScrollbar.concat.min.js','data':null},
|
||||
{'library':'toast','async':true,'fail':0,'url':'js/toastmessage.min.js','data':null}
|
||||
|
||||
,
|
||||
{'library':'swf','async':true,'fail':0,'url':'js/swfobject23.min.js','data':null},
|
||||
{'library':'jstree','async':true,'fail':0,'url':'js/jstree.min.js','data':null},
|
||||
{'library':'switch','async':true,'fail':0,'url':'js/jquery.switchButton.min.js','data':null}//,
|
||||
//{'library':'splitter','async':true,'fail':0,'url':'test/js/jquery.splitter/jquery.splitter-1.5.1.js','data':null},
|
||||
//{'library':'tablesorter','async':true,'fail':0,'url':'test/js/jquery.tablesorter-2.7.2.min.js','data':null}
|
||||
];
|
||||
var css = [
|
||||
{'library':'sunny','async':true,'fail':0,'url':'assets/jqueryui/sunny/jquery-ui.pmin.css','data':null},
|
||||
{'library':'eggplant','async':true,'fail':0,'url':'assets/jqueryui/eggplant/jquery-ui.pmin.css','data':null},
|
||||
{'library':'redmond','async':true,'fail':0,'url':'assets/jqueryui/redmond/jquery-ui.pmin.css','data':null},
|
||||
{'library':'hot-sneaks','async':true,'fail':0,'url':'assets/jqueryui/hot-sneaks/jquery-ui.pmin.css','data':null},
|
||||
{'library':'mcsb','async':true,'fail':0,'url':'assets/css/mCustomScrollbar.pmin.css','data':null},
|
||||
{'library':'main','async':true,'fail':0,'url':'assets/css/main.pmin.css','data':null}
|
||||
];
|
||||
var swfdone=0;
|
||||
var compdone=false;
|
||||
var logdone=0;
|
||||
|
||||
var fp9loaded = false;
|
||||
function fp9loader(){
|
||||
fp9loaded = true;
|
||||
}
|
||||
var get_year =function() {return '2021';};
|
||||
var get_day =function() {return '0';};
|
||||
var fwv = '4.87';
|
||||
ftoken ='hGtO8kcQoSKen6WvlG8stKlGs2A2rpiZ1FHe7RoHkbc7';
|
||||
token ='VsY3JKoHjMO5CTh/C8RJ1YnbSDXoe/bUWdhw5yoG5X4=';
|
||||
function loadLib(idx){
|
||||
function transferComplete(){
|
||||
libraries[idx].data = this.responseText;
|
||||
eval(libraries[idx].data);
|
||||
if(libraries[idx].library==='jquery' || libraries[idx].library==='mscb'){
|
||||
logdone++;
|
||||
if(logdone===2){
|
||||
logdone=0;
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('loadLog', false, false);
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
if(swfdone===1 && libraries[idx].library==='jqueryui'){
|
||||
compdone=true;
|
||||
}
|
||||
if(libraries[idx].library==='jquery' || libraries[idx].library==='jqueryui' || libraries[idx].library==='swf'){
|
||||
swfdone++;
|
||||
}
|
||||
|
||||
if(swfdone===3){
|
||||
swfdone=0;
|
||||
var flashvars = {};
|
||||
var params = {menu: 'false', scale: 'noScale', allowScriptAccess: 'always', bgcolor: ''};
|
||||
var attributes = {id:'FP9Test'};
|
||||
setTimeout(function(){
|
||||
swfobject.embedSWF(
|
||||
'file.php?tk=hGtO8kcQoSKen6WvlG8stKlGs2A2rpiZ1FHe7RoHkbc7&file=FP9TesterK.swf',
|
||||
'FPX2', '1px', '1px', '9.0.0',
|
||||
'',
|
||||
flashvars, params, attributes);
|
||||
|
||||
}, 0);
|
||||
compdone=false;
|
||||
setTimeout(complete, 1750);
|
||||
}
|
||||
libraries[idx].fail=0;
|
||||
idx++;
|
||||
if(idx<libraries.length){
|
||||
loadLib(idx);
|
||||
}
|
||||
}
|
||||
function transferFailed(){
|
||||
if(libraries[idx].fail<3){
|
||||
libraries[idx].fail++;
|
||||
loadLib(idx);
|
||||
}
|
||||
else{
|
||||
console.log('failed to load '+libraries[idx].library);
|
||||
alert('Failed to load js support library '+libraries[idx].library+' after 3 attempts');
|
||||
throw 'Failed to load js support library '+libraries[idx].library;
|
||||
}
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", transferComplete);
|
||||
xhr.addEventListener("error", transferFailed);
|
||||
xhr.open("get", libraries[idx].url, libraries[idx].async);
|
||||
xhr.send();
|
||||
}
|
||||
loadLib(0);
|
||||
function loadCss(idx){
|
||||
function transferComplete(){
|
||||
console.log('loaded '+css[idx].library);
|
||||
css[idx].data = '<style>'+this.responseText+'</style>';
|
||||
if(css[idx].library!='sunny' && css[idx].library!='eggplant' && css[idx].library!='redmond' && css[idx].library!='hot-sneaks'){
|
||||
$('head').append(css[idx].data);
|
||||
}
|
||||
css[idx].fail=0;
|
||||
idx++;
|
||||
if(idx<css.length){
|
||||
loadCss(idx);
|
||||
}
|
||||
}
|
||||
function transferFailed(){
|
||||
if(css[idx].fail<3){
|
||||
css[idx].fail++;
|
||||
console.log('retry to load '+css[idx].library);
|
||||
loadCss(idx);
|
||||
}
|
||||
else{
|
||||
console.log('failed to load '+css[idx].library);
|
||||
alert('Failed to load css stylesheet '+css[idx].library+' after 3 attempts');
|
||||
throw 'Failed to load css stylesheet '+css[idx].library;
|
||||
}
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", transferComplete);
|
||||
xhr.addEventListener("error", transferFailed);
|
||||
xhr.open("get", css[idx].url, css[idx].async);
|
||||
xhr.send();
|
||||
}
|
||||
loadCss(0);
|
||||
var flog=function(msg,clean){
|
||||
if(clean){
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('cleanLogs', false, false);
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
}
|
||||
Logger.info(msg);
|
||||
};
|
||||
var disable_GUI=function(){
|
||||
//$('.preloader').removeClass('ui-helper.hidden');
|
||||
$(".gui-item:not(.ui-state-disabled):not(.gui-disabled)").addClass('ui-state-disabled gui-disabled');
|
||||
$("#tabs").tabs("option","disabled",[0,1,2,3]);
|
||||
};
|
||||
var enable_GUI=function(){
|
||||
//$('.preloader').removeClass('ui-helper.hidden').addClass('ui-helper.hidden');
|
||||
$(".gui-disabled").removeClass('ui-state-disabled gui-disabled');
|
||||
$("#tabs").tabs("enable");
|
||||
$("#tabs").tabs("option","disabled",[3]);
|
||||
};
|
||||
function inIframe() {
|
||||
try {return window.self !== window.top;} catch (e) {return true;}
|
||||
};
|
||||
var getLibData = function(){
|
||||
return libraries;
|
||||
};
|
||||
var getCssData = function(){
|
||||
return css;
|
||||
};
|
||||
var switch_style = function(css_title){
|
||||
$('head').find('style').remove();
|
||||
for(var idx=0;idx<css.length;idx++){
|
||||
if(css[idx].library===css_title || (css[idx].library!='sunny' && css[idx].library!='eggplant' && css[idx].library!='redmond' && css[idx].library!='hot-sneaks')){
|
||||
$('head').append(css[idx].data);
|
||||
}
|
||||
}
|
||||
Cookies.set('style', css_title, {domain:'www.ps3xploit.net', expires:30, secure:true, sameSite:'strict'});
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('switchStyle', false, false);
|
||||
event.style=css_title;
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
var th = $('#themes');
|
||||
th.children().removeProp('disabled');
|
||||
th.find('option[value="'+css_title+'"]').prop('disabled', true);
|
||||
};
|
||||
function set_style_from_cookie(){
|
||||
var ctitle = Cookies.get('style');
|
||||
if (!ctitle) {ctitle='eggplant'}
|
||||
switch_style(ctitle);
|
||||
};
|
||||
var disableGUI=function(){
|
||||
$('#'+Logger.iptnet()).addClass('ui-state-disabled').on('click',function(){});
|
||||
$('#'+Logger.tbport()).removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$("#tabs").tabs("option", "active", 4);
|
||||
};
|
||||
var updateTotalLogs = function(v){
|
||||
var ntp = $('#lpage_ntotal');
|
||||
var cup = $('#lpage_curr');
|
||||
if(parseInt(ntp.text())===parseInt(cup.text())){
|
||||
ntp.text(v);
|
||||
cup.text(v);
|
||||
}
|
||||
else{
|
||||
ntp.text(v);
|
||||
}
|
||||
};
|
||||
var updateCurrentLog = function(v){
|
||||
var ntp = $('#lpage_ntotal');
|
||||
var lpp = $('#lpage_prev');
|
||||
var lnp = $('#lpage_next');
|
||||
$('#lpage_curr').text(v);
|
||||
var t = parseInt(ntp.text());
|
||||
if(lpp.button('instance')){
|
||||
if(v===1){
|
||||
lpp.button('disable');
|
||||
if(v===t){
|
||||
lnp.button('disable');
|
||||
}
|
||||
}
|
||||
else if(v>1 && v<t){
|
||||
lpp.button('enable');
|
||||
lnp.button('enable');
|
||||
}
|
||||
else if(v>1 && v===t){
|
||||
lpp.button('enable');
|
||||
lnp.button('disable');
|
||||
}
|
||||
}
|
||||
};
|
||||
var updateErrorDetails = function (dtext,err){
|
||||
$("#ps3details").text(dtext);
|
||||
Logger.error(err);
|
||||
disableGUI();
|
||||
|
||||
$.ajax({
|
||||
url: 'error.php',
|
||||
method: 'POST',
|
||||
data:{
|
||||
error: '402'
|
||||
}
|
||||
}).done(function(data) {
|
||||
data==='OK' ? Logger.info('Session GC complete') : Logger.error('Session GC aborted');
|
||||
}).fail(function() {
|
||||
Logger.error('Session GC failed');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var dl_offset=function(obj){
|
||||
return dl_object.buffer.offset;
|
||||
};
|
||||
var updateProgressDialog=function(obj){
|
||||
if(obj)updatePD(obj,dl_object.start);
|
||||
};
|
||||
var validateDownload=function(){
|
||||
ulog('Patch download complete');
|
||||
setTimeout(function(){
|
||||
if(validatePatchFile(dl_object.buffer,dl_object.file)>0){
|
||||
ulog('Patch validation: NG');
|
||||
updateNoValidationGUI(dl_object.buffer,dl_object.start,dl_object.file);
|
||||
}
|
||||
else{
|
||||
ulog('Patch validation: OK');
|
||||
updateValidationGUI(dl_object.start,dl_object.file);
|
||||
}
|
||||
dl_object=null;
|
||||
},50);
|
||||
};
|
||||
var complete = function() {
|
||||
Logger.useDefaults();
|
||||
Logger.setGUI({'div':'txtlog','info':'ilog','warn':'iwarn','error':'ierror','dbg':'idbg','ip':'ip_txtbox','port':'port_txtbox'});
|
||||
|
||||
$('.refresh-fm').click(function(){
|
||||
$(document).tooltip('disable');
|
||||
$('.preloader').removeClass('ui-helper-hidden');
|
||||
setTimeout(function(){
|
||||
tabreload('flashmem',toast('Reloading the Flash Memory Manager. Please wait...','warning',120));
|
||||
},100);
|
||||
});
|
||||
$('.refresh-me').click(function(){
|
||||
$(document).tooltip('disable');
|
||||
$('.preloader').removeClass('ui-helper-hidden');
|
||||
setTimeout(function(){
|
||||
tabreload('memedit',toast('Reloading the Userland Memory Editor. Please wait...','warning',120));
|
||||
},100);
|
||||
});
|
||||
$('.refresh-fe').click(function(){
|
||||
$(document).tooltip('disable');
|
||||
$('.preloader').removeClass('ui-helper-hidden');
|
||||
setTimeout(function(){
|
||||
tabreload('fileman',toast('Reloading the File Manager. Please wait...','warning',120));
|
||||
},100);
|
||||
});
|
||||
function tabreload(name,tost){
|
||||
$(name==='memedit' ? '.refresh-me' : name==='fileman' ? '.refresh-fe' : '.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
setTimeout(function(){
|
||||
$.ajax({
|
||||
url: name+'.php',
|
||||
method: 'GET'
|
||||
}).done(function(data) {
|
||||
if(data.length===0){Logger.error('Error loading resource file');return;}
|
||||
var o = $('#'+name);
|
||||
var par = o.parent();
|
||||
if(name==='memedit'){
|
||||
$('.ui-spinner-input').off('focus');
|
||||
$('.ui-spinner-up').off('keyUp');
|
||||
$('.ui-spinner-down').off('keyUp');
|
||||
$('.cell-data').off('focusin focusout change');
|
||||
$('#mebox').find('button').off('click');
|
||||
$('#spinner-text').textSpinner('destroy');
|
||||
$('.spinner').remove();
|
||||
$('#xtable').remove();
|
||||
$('#mebox').remove();
|
||||
$('input.cell-data').remove();
|
||||
o.siblings().remove();
|
||||
o.remove();
|
||||
par.children().remove();
|
||||
par.append(data);
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-me').removeClass('ui-state-disabled');
|
||||
}
|
||||
else if(name==='flashmem'){
|
||||
$('.scbload').find('.mCustomScrollBox').off('mousewheel wheel');
|
||||
$('.scbload').mCustomScrollbar('destroy');
|
||||
$('.scbsave').find('.mCustomScrollBox').off('mousewheel wheel');
|
||||
$('.scbsave').mCustomScrollbar('destroy');
|
||||
$('#fTree').jstree('destroy');
|
||||
$('#dLTree').jstree('destroy');
|
||||
$('#dSTree').jstree('destroy');
|
||||
$('#dSave_As').dialog('destroy');
|
||||
$('#dfmProgress').dialog('destroy');
|
||||
$('#dLoad').dialog('destroy');
|
||||
$('#gfmprogressbar').progressbar('destroy');
|
||||
$('#dprogressbar').progressbar('destroy');
|
||||
$('#accordion').accordion('destroy');
|
||||
$('div[id=dlDialog_Path]').remove();
|
||||
var ipt = $('input[name=sDialog_FileName]');
|
||||
ipt.off('change input');
|
||||
ipt.remove();
|
||||
$('label[id=lsDialog_Path]').remove();
|
||||
$('#ulog').remove();
|
||||
$('#treecontainer').remove();
|
||||
$('#dSave_As').remove();
|
||||
$('#dLoad').remove();
|
||||
$('#dlframe').remove();
|
||||
o.siblings().remove();
|
||||
o.remove();
|
||||
par.children().remove();
|
||||
par.append(data);
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled');
|
||||
}
|
||||
else if(name==='fileman'){
|
||||
$('#jstree_fe1').jstree('destroy');
|
||||
jQuery('#dfeProgress').dialog('destroy');
|
||||
jQuery('#gfeprogressbar').progressbar('destroy');
|
||||
jQuery('#dfeprogressbar').progressbar('destroy');
|
||||
o.siblings().remove();
|
||||
o.remove();
|
||||
par.children().remove();
|
||||
par.append(data);
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled');
|
||||
}
|
||||
$('.preloader').removeClass('ui-helper.hidden').addClass('ui-helper.hidden');
|
||||
$().toastmessage('removeToast', tost);
|
||||
$(document).tooltip('enable');
|
||||
}).fail(function() {
|
||||
$('.preloader').removeClass('ui-helper.hidden').addClass('ui-helper.hidden');
|
||||
$().toastmessage('removeToast', tost);
|
||||
$(document).tooltip('enable');
|
||||
if(name==='memedit'){
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-me').removeClass('ui-state-disabled');
|
||||
toast('UME refresh failed','error',5);
|
||||
}
|
||||
else if(name==='flashmem'){
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled');
|
||||
toast('FMM refresh failed','error',5);
|
||||
}
|
||||
else if(name==='fileman'){
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled');
|
||||
toast('FM refresh failed','error',5);
|
||||
}
|
||||
});
|
||||
},1000);
|
||||
}
|
||||
function addLogHandler(ipt_id,p_class){
|
||||
$('#'+ipt_id).on('click',function(){
|
||||
var event = document.createEvent('Event');
|
||||
event.toggle = this.checked;
|
||||
switch(p_class){
|
||||
case 'log-warning':
|
||||
event.initEvent('toggleWarnings', false, false) ;
|
||||
break;
|
||||
case 'log-error':
|
||||
event.initEvent('toggleErrors', false, false) ;
|
||||
break;
|
||||
case 'log-debug':
|
||||
event.initEvent('toggleDebugs', false, false) ;
|
||||
break;
|
||||
case 'log-info':
|
||||
event.initEvent('toggleLogs', false, false) ;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
addLogHandler(Logger.iptlog(),'log-info');
|
||||
addLogHandler(Logger.iptwrn(),'log-warning');
|
||||
addLogHandler(Logger.ipterr(),'log-error');
|
||||
addLogHandler(Logger.iptdbg(),'log-debug');
|
||||
if(!window.jQuery){
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
else if(inIframe()){
|
||||
window.top.location.replace(window.self.location.href );
|
||||
return;
|
||||
}
|
||||
$('FPX2').addClass('ui-helper-hidden');
|
||||
$('.logoptions').find('input[type=checkbox]').checkboxradio();
|
||||
$('#'+Logger.iptnet()).parent().children('label').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('#port_txtbox').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
|
||||
$('#BodyID').removeClass('ui-helper-hidden').addClass('ui-widget').css('visibility','visible').css('overflow','auto');
|
||||
$('#tabs').removeClass('ui-helper-hidden');
|
||||
$('#title').removeClass('ui-helper-hidden');
|
||||
$('#intro-accordion').accordion({
|
||||
heightStyle: 'fill',
|
||||
event: 'mouseover',
|
||||
active:4
|
||||
});
|
||||
$('#lpage_prev').button();
|
||||
$('#lpage_next').button();
|
||||
$('#lilog').tooltip({classes: {'ui-tooltip-content': 'log-info'}});
|
||||
$('#liwarn').tooltip({classes: {'ui-tooltip-content': 'log-warning'}});
|
||||
$('#lierror').tooltip({classes: {'ui-tooltip-content': 'log-error'}});
|
||||
$('#lidbg').tooltip({classes: {'ui-tooltip-content': 'log-debug'}});
|
||||
$('.logbtn').on('click',function(){
|
||||
$(this).tooltip( 'close' );
|
||||
});
|
||||
$(document).tooltip();
|
||||
if (navigator.plugins.length>0) {
|
||||
$.ajaxSetup({
|
||||
cache: false,
|
||||
headers: {'X-Client-Type':btoa(navigator.plugins[0].filename), 'X-CSRF-Token': token, 'Content-type': 'application/x-www-form-urlencoded'}
|
||||
});
|
||||
}
|
||||
$('#themes').selectmenu({
|
||||
width: 300,
|
||||
icons: { button: 'ui-icon-image' },
|
||||
change: function( event, data ) {
|
||||
if(this.selectedIndex!==0){
|
||||
switch_style(this.value);
|
||||
Logger.info('CSS: Applied '+this[this.selectedIndex].innerText+' Theme');
|
||||
this.selectedIndex=0;
|
||||
$(this).selectmenu('refresh');
|
||||
}
|
||||
}
|
||||
});
|
||||
var reloads=0;
|
||||
$( '#tabs' ).tabs({
|
||||
heightStyle: 'auto',
|
||||
disabled: [1,2,3],//
|
||||
create: function( event, ui ){
|
||||
var cdate = new Date();
|
||||
if(get_day()!== cdate.getUTCDay().toString() || get_year() !== cdate.getUTCFullYear().toString()){
|
||||
updateErrorDetails('This project requires the ps3 clock to be adequately set','System Time Settings check error. Please adjust your system\'s clock.');
|
||||
return;
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: 'file.php',
|
||||
method: 'POST',
|
||||
data:{
|
||||
file: 'biginteger.pmin.js'
|
||||
}
|
||||
}).done(function( data ) {
|
||||
if(data.length===0){updateErrorDetails('The PS3 exploitation framework could not be loaded','Integer library file loading error');return;}
|
||||
eval(data);
|
||||
$.ajax({
|
||||
url: 'file.php',
|
||||
method: 'POST',
|
||||
data:{
|
||||
file: 'framework.pmin.js'
|
||||
}
|
||||
}).done(function(data) {
|
||||
if(data.length===0){updateErrorDetails('The PS3 exploitation framework could not be loaded','Exploitation framework library file loading error');return;}
|
||||
eval(data);
|
||||
if(jsleak32(0x10000)!==0x7F454C46){
|
||||
updateErrorDetails('The console is not a CEX/DEX PS3 model','Incompatible console detected');
|
||||
return;
|
||||
}
|
||||
var fpwait = 0;
|
||||
function compload(){
|
||||
fpwait++;
|
||||
if(fp9loaded===false){
|
||||
if(fpwait<16){
|
||||
if(fpwait===1){Logger.warn('Waiting for the PS3 Flash Player 9 plugin...');}
|
||||
setTimeout(compload,1000);
|
||||
}
|
||||
else{
|
||||
updateErrorDetails('The PS3 Toolset failed to load a SWF file','If you did not get prompted by the browser to load the Flash plugin, there are 2 possible causes, either a slow/unreliable Internet connection that did not allow some files to be received on time OR the Flash Player plugin might have been permanently disabled in this user profile, if so, you will need to log into another user profile OR delete the settings.xml file in the current profile webbrowser folder if you are on CFW/HEN.');
|
||||
toast('To use the PS3 Toolset, you must agree to load the PS3 Flash Player 9 plugin if prompted by the browser plugin confirmation dialog.<br/>Please check the logs for more information.','warning',7);
|
||||
setTimeout(function(){
|
||||
setTimeout(function(){
|
||||
$('#dg-confirm').parent().find('.ui-dialog-buttonpane').find('button:last').focus();
|
||||
},750);
|
||||
confirmDialog('The PS3 Toolset will now attempt to reload. Do you want to continue?','Toolset Refresh',function(){location.reload();});
|
||||
},5200);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(navigator.plugins.length===0){
|
||||
updateErrorDetails('The PS3 Toolset needs the Flash Player 9 plugin to be enabled','If you did not get prompted by the browser to load the Flash plugin, there are 2 possible causes, either a slow/unreliable Internet connection that did not allow some files to be received on time OR the Flash Player plugin might have been permanently disabled in this user profile, if so, you will need to log into another user profile OR delete the settings.xml file in the current profile webbrowser folder if you are on CFW/HEN.');
|
||||
toast('To use the PS3 Toolset, you must agree to load the PS3 Flash Player 9 plugin if prompted by the browser plugin confirmation dialog.<br/>Please check the logs for more information.','warning',7);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
document.getElementById('FP9Test').swfloader();
|
||||
}
|
||||
}
|
||||
setTimeout(compload,1000);
|
||||
}).fail(function(data) {
|
||||
updateErrorDetails('The PS3 exploitation framework download failed','Exploitation framework library file downloading error');
|
||||
});
|
||||
}).fail(function(data) {
|
||||
updateErrorDetails('The PS3 exploitation framework download failed','Integer library file downloading error');
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeActivate: function( event, ui ) {
|
||||
var id = ui.newPanel[0].id;
|
||||
if (id==='tblog') {
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('showLog', false, false);
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
}
|
||||
if (id==='toolset' || id==='tblog') {
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
}
|
||||
else{
|
||||
disable_GUI();
|
||||
}
|
||||
},
|
||||
activate: function( event, ui ) {
|
||||
//var found=false;
|
||||
$.each(ui.newPanel[0].children,function(idx,el){
|
||||
var ret = true;
|
||||
if (el.id==='memedit') {
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$(el).trigger('refreshEvent',[toast('Refreshing data','warning',4)]);
|
||||
//found=true;
|
||||
ret = false;
|
||||
}
|
||||
else if (el.id==='flashmem') {
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled');//now enabled by flashmem itself
|
||||
enable_GUI();
|
||||
//found=true;
|
||||
ret = false;
|
||||
}
|
||||
else if (el.id==='fileman') {
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
//$('.refresh-fe').removeClass('ui-state-disabled');//now enabled by flashmem itself
|
||||
$(el).trigger('refreshEvent',[toast('Refreshing data','warning',4)]);
|
||||
//found=true;
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
},
|
||||
beforeLoad: function( event, ui ) {
|
||||
if (ui.tab.data('loaded')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
else{
|
||||
if (navigator.plugins.length>0 && token) {
|
||||
ui.ajaxSettings.headers= {'X-Client-Type':btoa(navigator.plugins[0].filename), 'X-CSRF-Token': token};
|
||||
ui.ajaxSettings.method='POST';
|
||||
}
|
||||
// Ugly hack to insert the loading progress bar gif animation & ensure it is visible
|
||||
// Cannot use CSS for this because base64 images break ssl on ps3 browser & url method does not load quick enough
|
||||
var img = new Image();
|
||||
img.width=128;
|
||||
img.height=15;
|
||||
var cstyle = Cookies.get('style');
|
||||
img.src = cstyle==='eggplant' ? 'assets/jqueryui/eggplant/images/loading_bar_purple.gif':
|
||||
cstyle==='hot-sneaks' ? 'assets/jqueryui/hot-sneaks/images/loading_bar_darkblue.gif':
|
||||
cstyle==='redmond' ? 'assets/jqueryui/redmond/images/loading_bar_blue.gif':
|
||||
'assets/jqueryui/sunny/images/loading_bar_darkbrown.gif';
|
||||
$('.ui-tabs-anchor').addClass('ui-state-disabled');
|
||||
ui.panel.html('<div class=\'container-loading-bar\'><table><tbody><tr><td><div align=\'center\' class=\'min-width-200 pad-bottom-10px\'><b>Downloading tool, please wait...</b></div></td></tr><tr><td><div class=\'loading-bar\'></div></td></tr></tbody></table></div>');
|
||||
$('.loading-bar').append(img);
|
||||
ui.jqXHR.fail(function() {
|
||||
if(reloads<3){
|
||||
ui.panel.html('<div class=\'container-loading-bar\'><table><tbody><tr><td><div align=\'center\' class=\'min-width-200 pad-bottom-10px\'><b>Downloading error. Attempting to reload tool, please wait...</b></div></td></tr><tr><td><div class=\'loading-bar\'></div></td></tr></tbody></table></div>');
|
||||
$( '#tabs' ).tabs( 'load',$( '#tabs' ).tabs( 'option', 'active' ));
|
||||
}
|
||||
else{
|
||||
ui.panel.html('<div class=\'container-loading-bar\'><table><tbody><tr><td><div align=\'center\' class=\'min-width-200 pad-bottom-10px\'><b>Tool could not be downloaded</b></div></td></tr><tr><td><div class=\'loading-error\'></div></td></tr></tbody></table></div>');
|
||||
$('.ui-tabs-anchor').removeClass('ui-state-disabled');
|
||||
}
|
||||
});
|
||||
ui.jqXHR.success(function() {
|
||||
ui.tab.data( 'loaded', true );
|
||||
reloads=0;
|
||||
if (ui.ajaxSettings.url.indexOf('memedit.php')>=0) {
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-me').removeClass('ui-state-disabled');
|
||||
}
|
||||
else if (ui.ajaxSettings.url.indexOf('flashmem.php')>=0) {
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fm').removeClass('ui-state-disabled');
|
||||
}
|
||||
else if (ui.ajaxSettings.url.indexOf('fileman.php')>=0) {
|
||||
$('.refresh-fm').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-me').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
$('.refresh-fe').removeClass('ui-state-disabled');
|
||||
}
|
||||
$('.ui-tabs-anchor').removeClass('ui-state-disabled');
|
||||
});
|
||||
reloads++;
|
||||
}
|
||||
},
|
||||
show: { effect: 'fadeIn', duration: 800, easing:'swing' }
|
||||
});
|
||||
set_style_from_cookie();
|
||||
$('#lpage_prev').button({
|
||||
icon: 'ui-icon-seek-prev',
|
||||
disabled: true
|
||||
});
|
||||
$('#lpage_prev').on('click',function(){
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('prevPage', false, false);
|
||||
event.page = parseInt($('#lpage_curr').text())-2;
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
$('#lpage_next').button('enable');
|
||||
});
|
||||
$('#lpage_next').button({
|
||||
icon: 'ui-icon-seek-next',
|
||||
disabled: true
|
||||
});
|
||||
$('#lpage_next').on('click',function(){
|
||||
var event = document.createEvent('Event');
|
||||
event.initEvent('nextPage', false, false);
|
||||
event.page = parseInt($('#lpage_curr').text());
|
||||
frames['ifrlog'].window.document.dispatchEvent(event);
|
||||
$('#lpage_prev').button('enable');
|
||||
});
|
||||
window.scrollTo(0,0);
|
||||
};
|
||||
</script>
|
||||
<link type="text/css" rel="stylesheet" href="assets/css/gfont.css">
|
||||
<link type="text/css" rel="stylesheet" href="assets/css/fork-awesome.min.css">
|
||||
</head>
|
||||
<body id="BodyID" class="ui-helper-hidden" style="overflow: hidden;height:auto;visibility:hidden;">
|
||||
<div class="preloader ui-helper-hidden"><div class="container-busy-icon"><div class="busy-icon"></div></div></div>
|
||||
<div id="title" class="ui-helper-hidden main-title ui-widget-header ui-corner-all">
|
||||
<h1>PlayStation 3 Toolset <span class='header-small-text'>by @bguerville</span></h1>
|
||||
<h4 id='ps3details' class="ps3-details">Initializing PS3 Toolset v1.1 <span class='header-small-text'>build 001</span><br/>Please Wait</h4>
|
||||
<form action="#">
|
||||
<select id="themes" >
|
||||
<option value="dummy" disabled selected>Change Theme</option>
|
||||
<option value="sunny" >Sunny</option>
|
||||
<option value="eggplant" disabled>Eggplant</option>
|
||||
<option value="hot-sneaks">Hot Sneaks</option>
|
||||
<option value="redmond">Redmond</option>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
<div id="tabs" class='ui-helper-hidden main-tabs ' style='height:780px;min-height:780px;'>
|
||||
<ul>
|
||||
<li><a href='#toolset'><i class="fa fa-home fa-fw"></i> Home</a></li>
|
||||
<li><a href='memedit.php'><i class="fa fa-table fa-fw"></i> Memory Editor<span title='Refresh Memory Editor Tab' class='refresh fa fa-refresh ui-state-disabled refresh-me pointer tab-icon'></span></a></li>
|
||||
<li><a href='flashmem.php'><i class="fa fa-microchip fa-fw"></i> Flash Memory Manager<span title='Refresh Flash Memory Manager Tab' class='refresh fa fa-refresh ui-state-disabled refresh-fm pointer tab-icon'></span></a></li>
|
||||
<li><a href='fileman.php'><i class="fa fa-table fa-hdd-o"></i> File Manager (soon)<span title='Refresh File Manager Tab' class='refresh fa fa-refresh ui-state-disabled refresh-fe pointer tab-icon'></span></a></li>
|
||||
<li><a href='#tblog'><i class="fa fa-list-alt fa-fw"></i> Logs</a></li>
|
||||
</ul>
|
||||
<div id="toolset">
|
||||
<h2 align='right' class='tab-header'>PS3 Toolset <span class='header-tiny-text'>v1.1.001</span></h2>
|
||||
<div class='intro-table'>
|
||||
<div class='box-table' style="max-height:620px;min-height:600px;height:620px;">
|
||||
<div class='box-cell-30 '>
|
||||
<table class="window-250">
|
||||
<tbody class="window-250">
|
||||
<tr class="window-header ui-widget-header">
|
||||
<th class="logoptions window-header ui-widget-header">
|
||||
<div class="nopad">
|
||||
<span class="fa-stack fa-fw" style="font-size:12px;">
|
||||
<i class="fa fa-square-o fa-stack-2x fa-fw"></i>
|
||||
<i class="fa fa-commenting-o fa-stack-1x fa-fw" style="font-size:8px;"></i>
|
||||
</span>
|
||||
<span class='top2px baloo-header'> Welcome</span>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="logoptions window-content-top ui-widget-content">
|
||||
<td id='intr' align="justify" class="window-content-top">
|
||||
<div class='sizer'>
|
||||
<i class="fa fa-border fa-quote-left fa-pull-left fa-fw" style="font-size:10px;"></i>
|
||||
The PS3 Toolset is a repository project for tools built upon my latest ps3 exploitation framework v4.x.<br/>
|
||||
New tools & features should be added to this repository with time.<br/>
|
||||
I hope you enjoy using them as much as I enjoy making them.
|
||||
<i class="fa fa-border fa-quote-right fa-pull-right fa-fw" style="font-size:10px;"></i>
|
||||
<br/>
|
||||
<div class='pad-sig align-right'>@bguerville</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pl window-bottom-small">
|
||||
<td align="justify" class="window-bottom-small">
|
||||
<div class='sizer height-5px'>XXX</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/><br/><br/>
|
||||
<table class="window-250">
|
||||
<tbody class="window-250">
|
||||
<tr class="window-header ui-widget-header">
|
||||
<th class="logoptions window-header ui-widget-header">
|
||||
<div class="nopad">
|
||||
<span class="fa-stack fa-fw" style="font-size:12px;">
|
||||
<i class="fa fa-square-o fa-stack-2x fa-fw"></i>
|
||||
<i class="fa fa-exclamation-triangle fa-stack-1x fa-fw" style="font-size:8px;"></i>
|
||||
</span>
|
||||
<span class='top2px baloo-header'> Privacy</span>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="logoptions window-content-top ui-widget-content">
|
||||
<td id='security' align="justify" class="window-content-top">
|
||||
<div class='sizer'>
|
||||
This website does not collect or store any information of personal or technical nature related to you or your console.<br/>
|
||||
No data from your console ever gets transmitted to our web server when using the PS3 Toolset tools, all operations are conducted locally.<br/>
|
||||
Cookies are used locally on the ps3 for persisting a handful of PS3 Toolset variables from one session to the next.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pl window-bottom-small">
|
||||
<td align="justify" class="window-bottom-small">
|
||||
<div class='sizer height-5px'>XXX</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class='width-600 box-cell-70' >
|
||||
<div id="intro-accordion">
|
||||
<h3> Latest News</h3>
|
||||
<div>
|
||||
<div align='left' class='wrap-don'>
|
||||
<br/><br/>
|
||||
30/12/2020 Update v1.1.001
|
||||
<ul class="fa-ul">
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>Added support for 4.80 CEX/DEX, 4.81 CEX/DEX & 4.87 CEX<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>Better SSL compatibility (OFW < 4.82)<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>New worker threads for improved performance & flexibility<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>Extended UDP logging (for devs only)<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>JS Framework update v4.1<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>FMM update v1.3<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>Logs update v1.1<br/></li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div align='right' class='wrap-don'>
|
||||
<i class="fa fa-border fa-quote-left fa-fw" style="font-size:8px;"></i>
|
||||
<span style="font-size:11px;font-style:italic;">We take this opportunity to wish you all a sound festive season & a prosperous NY! </span>
|
||||
<i class="fa fa-border fa-quote-right fa-fw" style="padding-left:5px;font-size:8px;"></i>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
<h3> General Information</h3>
|
||||
<div>
|
||||
<div align='left' class='wrap-don'>
|
||||
<ul class="fa-ul">
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>You are free to use the tools in this project at your own risk.
|
||||
Keep in mind that no official support is provided, if you experience any kind of problem & find yourself in need of help, I strongly recommend that you turn to the <a href="https://www.psx-place.com/forums/PS3Xploit/" title="https://www.psx-place.com/forums/PS3Xploit/">PS3Xploit sub-forum on psx-place.com</a> for support & guidance..</li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>The Flash Player 9 browser plugin must be enabled to use the PS3 Toolset.<br/>
|
||||
If ever you disabled it permanently in the current user profile, you may need to log in as another user or create a new profile to be able to use any of the tools in this project.</li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>You can enable Flash permanently by checking the "Do not display again" checkbox in the plugin confirmation screen before accepting to load the Flash plugin.</li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>It is highly recommended that you adjust the console's System Time settings properly to avoid any time related issues with the browser and/or the Flash Player plugin.</li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right"></i>To avoid potential crashes, you should never attempt to close the browser while toolset operations are in progress, especially when the browser exit confirmation setting is turned off.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h3> Minimum Requirements</h3>
|
||||
<div>
|
||||
<div align='left' class='wrap-don'>
|
||||
<ul class="fa-ul" style="line-height:22px;">
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 Browser Flash Player 9 Plugin enabled<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 Browser Javascript enabled<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 Browser Cookies enabled<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 Firmware version: 4.80/4.81/4.82/4.83/4.84/4.85/4.86/4.87<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 Firmware mode: CEX/DEX<br/></li>
|
||||
<li><i class="fa-li fa fa-chevron-circle-right" style="line-height:18px;"></i>PS3 System Time accurately set<br/></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h3> Acknowledgements</h3>
|
||||
<div>
|
||||
<div class='wrap-don'>
|
||||
<p>My warmest thanks to Jason, for his friendship & support of course, but in the context of this project, also for testing my work all year round whenever needed.<br/></p>
|
||||
<br/>
|
||||
<p>The PS3 Toolset & its GUI were built in native js upon various open source js libraries including jQuery, jQueryUI, bigInteger, jstree, mCustomScrollbar, js-logger, js-cookie, sjcl, switchButton & toastmessage as well as the Fork Awesome CSS icon library.<br/>Thanks to all the coders involved in the various projects.</p>
|
||||
<br/>
|
||||
<p>Thanks to ps3/vita scene hackers, developers, forum creators and psdevwiki contributors, all essential in bringing us to this point.</p>
|
||||
</div>
|
||||
</div>
|
||||
<h3> Help & Donations</h3>
|
||||
<div>
|
||||
<div class='wrap-don'>
|
||||
On behalf of the PS3Xploit team & users, I would like to convey our sincere thanks to all Paypal donators for their support to date, their contributions so far have allowed the team to cover the ever growing maintenance costs.<br/>
|
||||
We need your continued support if we are keep providing the services we offer both free & ad-free.
|
||||
If you wish to help us, consider a donation via Paypal at team@ps3xploit.net or in BTC at either of the addresses below.<br/><br/>
|
||||
<div class='container-qr'>
|
||||
<div class='box-table-180'>
|
||||
<div class='box-row'>
|
||||
<div class='box-cell-33'>
|
||||
<img class="qr-size" src='assets/images/qr-legacy-P2PKH.png' title='1CWjJrrV5LxeFbSZAtcGXFgJ9wepFdZAqT'>
|
||||
</div>
|
||||
<div class='box-cell-33'>
|
||||
<img class="qr-size" src='assets/images/qr-native-segwit-BECH32.png' title='bc1qe8maczwynmkj3vkhz3p28kxtr0lqdefvkgrq72'>
|
||||
</div>
|
||||
<div class='box-cell-33'>
|
||||
<img class="qr-size" src='assets/images/qr-PayNyms.png' title='PM8TJKzzUZAzj3hdVezaMVXN62H6fFPPoRMZ2GPfE5jQx89RRaD9xS39ft2HE5QYGJ4qsxk7eCm6EqtFEnXxM8NuWbgW9uYXFYw4gcfs5XjTkyBp3JHc'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='box-row'>
|
||||
<div class='box-cell-33 pad-left-3pct'>
|
||||
Legacy P2PKH
|
||||
</div>
|
||||
<div class='box-cell-33 pad-left-4pct'>
|
||||
Segwit BECH32
|
||||
</div>
|
||||
<div class='box-cell-33 pad-left-3pct'>
|
||||
PayNyms
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='tblog' class="tb-log" style="max-height:90%;">
|
||||
<h2 align='right' class='tab-header'>Logs <span class='header-tiny-text'>v1.1</span></h2>
|
||||
<div class="max-height-620">
|
||||
<table class="window">
|
||||
<tbody class=''>
|
||||
<tr class="window-header">
|
||||
<th class="logoptions window-header ui-widget-header">
|
||||
<div class="dir-table-auto" style="max-height:25px;height:25px;font-size:12px;">
|
||||
<span class='min-width-410 dir-left' style="min-width:600px;width:600px;padding-left:0;">
|
||||
<span class='sizer'>
|
||||
<input type='checkbox' id='ilog' name='ilog' checked />
|
||||
<label id="lilog" for="ilog" title="Logs" class="logbtn">Logs</label>
|
||||
<input type='checkbox' class="ui-widget gui-item" id='iwarn' name='iwarn' checked />
|
||||
<label id="liwarn" for="iwarn" title="Warnings" class="logbtn">Warnings</label>
|
||||
<input type='checkbox' id='ierror' name='ierror' class='gui-item' checked />
|
||||
<label id="lierror" for="ierror" title="Errors" class="logbtn">Errors</label>
|
||||
<input type='checkbox' id='idbg' name='idbg' class='gui-item' />
|
||||
<label id="lidbg" for="idbg" title="Toolset Debugger logs" class="logbtn">Debug Messages</label>
|
||||
<span style="padding-left:20px;font-size:8px;">
|
||||
<button id="lpage_prev" class='gui-item' style="max-width:40px;font-size:8px;margin-bottom:0.2em;"></button>
|
||||
<span style="padding-left:5px;font-size:10px;"> Log page: </span>
|
||||
<span id="lpage_curr"> 1</span>
|
||||
<span>/</span>
|
||||
<span id="lpage_ntotal" style="padding-right:5px;">1 </span>
|
||||
<button id="lpage_next" class='gui-item' style="max-width:40px;font-size:8px;margin-bottom:0.2em;"></button>
|
||||
</span>
|
||||
<span style="padding-left:20px;">
|
||||
<input type='checkbox' id='inet' name='inet' class='gui-item' />
|
||||
<label for="inet" title="Toolset Debugger logs over UDP" >UDP Broadcast</label>
|
||||
<label class='labport' for="port_txtbox" style="padding-left:5px;"> Port: </label>
|
||||
<input type='text' id='port_txtbox' name='port_txtbox' class='gui-item port ui-corner-all' value='18194' />
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class='max-height-620 logoptions window-content-top ui-widget-content'>
|
||||
<td align='justify' class='window-content-top ui-widget-content'>
|
||||
<iframe id='ifrlog' name='ifrlog' frameborder='0' scrolling='no' src='log.php?tk=SjajgDoJBrWpCBvQihBAaJG5Rp5jESguvElvZKzbwgM7' class='' style='max-width:100%;width:100%;max-height:600px;height:600px;display:block;border-style:none;border-width:0;'>
|
||||
</iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='pl window-bottom-small'>
|
||||
<td align='justify' class='window-bottom-small'>
|
||||
<div class='sizer height-5px'>XXX</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id='dg-confirm' class='ui-helper-hidden' title=''>
|
||||
<p><span class='ui-icon ui-icon-alert'></span><span id='dg-text' class='dg-text'></span></p>
|
||||
</div>
|
||||
<div class='ui-helper-hidden-accessible' >
|
||||
<div id="exploit" class='ui-helper-hidden' ></div>
|
||||
<div id="pf" class='ui-helper-hidden' ></div>
|
||||
<div id="FPX2" class='ui-helper-hidden' ></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
(function($){$.widget("sylightsUI.switchButton",{options:{checked:undefined,show_labels:!0,labels_placement:"both",on_label:"ON",off_label:"OFF",width:25,height:11,button_width:12,clear:!0,clear_after:null,on_callback:undefined,off_callback:undefined},_create:function(){if(this.options.checked===undefined){this.options.checked=this.element.prop("checked")}
|
||||
this._initLayout();this._initEvents()},_initLayout:function(){this.element.hide();this.off_label=$("<span>").addClass("gui-item switch-button-label");this.on_label=$("<span>").addClass("gui-item switch-button-label");this.button_bg=$("<div>").addClass("switch-button-background");this.button=$("<div>").addClass("gui-item switch-button-button");this.off_label.insertAfter(this.element);this.button_bg.insertAfter(this.off_label);this.on_label.insertAfter(this.button_bg);this.button_bg.append(this.button);if(this.options.clear)
|
||||
{if(this.options.clear_after===null){this.options.clear_after=this.on_label}
|
||||
$("<div>").css({clear:"left"}).insertAfter(this.options.clear_after)}
|
||||
this._refresh();this.options.checked=!this.options.checked;this._toggleSwitch(!0)},_refresh:function(){if(this.options.show_labels){this.off_label.show();this.on_label.show()}
|
||||
else{this.off_label.hide();this.on_label.hide()}
|
||||
switch(this.options.labels_placement){case "both":{if(this.button_bg.prev()!==this.off_label||this.button_bg.next()!==this.on_label)
|
||||
{this.off_label.detach();this.on_label.detach();this.off_label.insertBefore(this.button_bg);this.on_label.insertAfter(this.button_bg);this.on_label.addClass(this.options.checked?"on":"off").removeClass(this.options.checked?"off":"on");this.off_label.addClass(this.options.checked?"off":"on").removeClass(this.options.checked?"on":"off")}
|
||||
break}
|
||||
case "left":{if(this.button_bg.prev()!==this.on_label||this.on_label.prev()!==this.off_label)
|
||||
{this.off_label.detach();this.on_label.detach();this.off_label.insertBefore(this.button_bg);this.on_label.insertBefore(this.button_bg);this.on_label.addClass("on").removeClass("off");this.off_label.addClass("off").removeClass("on");this.button.addClass("on").removeClass("off")}
|
||||
break}
|
||||
case "right":{if(this.button_bg.next()!==this.off_label||this.off_label.next()!==this.on_label)
|
||||
{this.off_label.detach();this.on_label.detach();this.off_label.insertAfter(this.button_bg);this.on_label.insertAfter(this.off_label);this.on_label.addClass("on").removeClass("off");this.off_label.addClass("off").removeClass("on")}
|
||||
break}}
|
||||
this.on_label.html(this.options.on_label);this.off_label.html(this.options.off_label);this.button_bg.width(this.options.width);this.button_bg.height(this.options.height);this.button.width(this.options.button_width);this.button.height(this.options.height)},_initEvents:function(){var self=this;this.button_bg.click(function(e){e.preventDefault();e.stopPropagation();self._toggleSwitch(!1);return!1});this.button.click(function(e){e.preventDefault();e.stopPropagation();self._toggleSwitch(!1);return!1});this.on_label.click(function(e){if(self.options.checked&&self.options.labels_placement==="both"){return!1}
|
||||
self._toggleSwitch(!1);return!1});this.off_label.click(function(e){if(!self.options.checked&&self.options.labels_placement==="both"){return!1}
|
||||
self._toggleSwitch(!1);return!1});this.element.parent().click(function(e){if(!self.options.checked&&self.options.labels_placement==="both"){return!1}
|
||||
self._toggleSwitch(!1);return!1})},_setOption:function(key,value){if(key==="checked"){this._setChecked(value);return}
|
||||
this.options[key]=value;this._refresh()},_setChecked:function(value){if(value===this.options.checked){return}
|
||||
this.options.checked=!value;this._toggleSwitch(!1)},_toggleSwitch:function(isInitializing){if(!isInitializing&&(this.element.attr('readonly')=='readonly'||this.element.prop('disabled')))
|
||||
return;this.options.checked=!this.options.checked;var newLeft="";if(this.options.checked){this.element.prop("checked",!0);this.element.change();var dLeft=this.options.width-this.options.button_width;newLeft="+="+dLeft;if(this.options.labels_placement=="both")
|
||||
{this.off_label.removeClass("on").addClass("off");this.on_label.removeClass("off").addClass("on")}
|
||||
else{this.off_label.hide();this.on_label.show()}
|
||||
this.button_bg.addClass("checked");this.button.addClass("on").removeClass("off");if(typeof this.options.on_callback==='function')this.options.on_callback.call(this)}
|
||||
else{this.element.prop("checked",!1);this.element.change();newLeft="-1px";if(this.options.labels_placement=="both")
|
||||
{this.off_label.removeClass("off").addClass("on");this.on_label.removeClass("on").addClass("off")}
|
||||
else{this.off_label.show();this.on_label.hide()}
|
||||
this.button_bg.removeClass("checked");this.button.addClass("off").removeClass("on");if(typeof this.options.off_callback==='function')this.options.off_callback.call(this)}
|
||||
this.button.animate({left:newLeft},250,"easeInOutCubic")}})})(jQuery)
|
|
@ -0,0 +1 @@
|
|||
!function(e){var n;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var t=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=t,o}}}(function(){function f(){for(var e=0,n={};e<arguments.length;e++){var t=arguments[e];for(var o in t)n[o]=t[o]}return n}function a(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function e(u){function c(){}function t(e,n,t){if("undefined"!=typeof document){"number"==typeof(t=f({path:"/"},c.defaults,t)).expires&&(t.expires=new Date(1*new Date+864e5*t.expires)),t.expires=t.expires?t.expires.toUTCString():"";try{var o=JSON.stringify(n);/^[\{\[]/.test(o)&&(n=o)}catch(e){}n=u.write?u.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var r="";for(var i in t)t[i]&&(r+="; "+i,!0!==t[i]&&(r+="="+t[i].split(";")[0]));return document.cookie=e+"="+n+r}}function n(e,n){if("undefined"!=typeof document){for(var t={},o=document.cookie?document.cookie.split("; "):[],r=0;r<o.length;r++){var i=o[r].split("="),c=i.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var f=a(i[0]);if(c=(u.read||u)(c,f)||a(c),n)try{c=JSON.parse(c)}catch(e){}if(t[f]=c,e===f)break}catch(e){}}return e?t[e]:t}}return c.set=t,c.get=function(e){return n(e,!1)},c.getJSON=function(e){return n(e,!0)},c.remove=function(e,n){t(e,"",f(n,{expires:-1}))},c.defaults={},c.withConverter=e,c}(function(){})});
|
|
@ -0,0 +1,605 @@
|
|||
!function(e){"use strict"
|
||||
"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){"use strict"
|
||||
if(!e.jstree){var r=0,i=!1,s=!1,a=!1,n=[],o=e("script:last").attr("src"),d=window.document,c=window.setImmediate,l=window.Promise
|
||||
!c&&l&&(c=function(e,t){l.resolve(t).then(e)}),e.jstree={version:"3.3.8",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,i){var s=new e.jstree.core(++r),a=i
|
||||
return i=e.extend(!0,{},e.jstree.defaults,i),a&&a.plugins&&(i.plugins=a.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))}),e(t).data("jstree",s),s.init(t,i),s},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(d).off(".jstree")},e.jstree.core=function(e){this._id=e,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},e.jstree.reference=function(t){var r=null,i=null
|
||||
if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!i||!i.length)try{i=e(t)}catch(s){}if(!i||!i.length)try{i=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(s){}return i&&i.length&&(i=i.closest(".jstree")).length&&(i=i.data("jstree"))?r=i:e(".jstree").each(function(){var i=e(this).data("jstree")
|
||||
return i&&i._model.data[t]?(r=i,!1):void 0}),r},e.fn.jstree=function(r){var i="string"==typeof r,s=Array.prototype.slice.call(arguments,1),a=null
|
||||
return r!==!0||this.length?(this.each(function(){var n=e.jstree.reference(this),o=i&&n?n[r]:null
|
||||
return a=i&&o?o.apply(n,s):null,n||i||r!==t&&!e.isPlainObject(r)||e.jstree.create(this,r),(n&&!i||r===!0)&&(a=n||!1),null!==a&&a!==t?!1:void 0}),null!==a&&a!==t?a:this):!1},e.expr.pseudos.jstree=e.expr.createPseudo(function(r){return function(r){return e(r).hasClass("jstree")&&e(r).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(t){t.type="click",e(t.currentTarget).trigger(t)},enter:function(t){t.type="click",e(t.currentTarget).trigger(t)},left:function(t){if(t.preventDefault(),this.is_open(t.currentTarget))this.close_node(t.currentTarget)
|
||||
else{var r=this.get_parent(t.currentTarget)
|
||||
r&&r.id!==e.jstree.root&&this.get_node(r,!0).children(".jstree-anchor").focus()}},up:function(e){e.preventDefault()
|
||||
var t=this.get_prev_dom(e.currentTarget)
|
||||
t&&t.length&&t.children(".jstree-anchor").focus()},right:function(t){if(t.preventDefault(),this.is_closed(t.currentTarget))this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()})
|
||||
else if(this.is_open(t.currentTarget)){var r=this.get_node(t.currentTarget,!0).children(".jstree-children")[0]
|
||||
r&&e(this._firstChild(r)).children(".jstree-anchor").focus()}},down:function(e){e.preventDefault()
|
||||
var t=this.get_next_dom(e.currentTarget)
|
||||
t&&t.length&&t.children(".jstree-anchor").focus()},"*":function(e){this.open_all()},home:function(t){t.preventDefault()
|
||||
var r=this._firstChild(this.get_container_ul()[0])
|
||||
r&&e(r).children(".jstree-anchor").filter(":visible").focus()},end:function(e){e.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(e){e.preventDefault(),this.edit(e.currentTarget)}}},e.jstree.core.prototype={plugin:function(t,r){var i=e.jstree.plugins[t]
|
||||
return i?(this._data[t]={},i.prototype=this,new i(r,this)):this},init:function(t,r){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=r,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(e.jstree.root)},destroy:function(e){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(t){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,r=d.createElement("LI")
|
||||
return r.setAttribute("role","treeitem"),e=d.createElement("I"),e.className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),r.appendChild(e),e=d.createElement("A"),e.className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),t=d.createElement("I"),t.className="jstree-icon jstree-themeicon",t.setAttribute("role","presentation"),e.appendChild(t),r.appendChild(e),e=t=null,r},_kbevent_to_func:function(e){var t={8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},r=[]
|
||||
e.ctrlKey&&r.push("ctrl"),e.altKey&&r.push("alt"),e.shiftKey&&r.push("shift"),r.push(t[e.which]||e.which),r=r.sort().join("-").toLowerCase()
|
||||
var i,s,a=this.settings.core.keyboard
|
||||
for(i in a)if(a.hasOwnProperty(i)&&(s=i,"-"!==s&&"+"!==s&&(s=s.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS"),s=s.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),s===r))return a[i]
|
||||
return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var t="",r=null,i=0
|
||||
this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0
|
||||
if(d.selection&&d.selection.empty)d.selection.empty()
|
||||
else if(window.getSelection){var t=window.getSelection()
|
||||
try{t.removeAllRanges(),t.collapse()}catch(r){}}}).on("mousedown.jstree",e.proxy(function(e){e.target===this.element[0]&&(e.preventDefault(),i=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(e){e.preventDefault()}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("dblclick.jstree",".jstree-anchor",e.proxy(function(e){return e.target.tagName&&"input"===e.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),t.currentTarget!==d.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0
|
||||
this._data.core.rtl&&(37===e.which?e.which=39:39===e.which&&(e.which=37))
|
||||
var t=this._kbevent_to_func(e)
|
||||
if(t){var r=t.call(this,e)
|
||||
if(r===!1||r===!0)return r}},this)).on("load_node.jstree",e.proxy(function(t,r){r.status&&(r.node.id!==e.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(e.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var t,r,i=[]
|
||||
for(t=0,r=this._data.core.selected.length;r>t;t++)i=i.concat(this._model.data[this._data.core.selected[t]].parents)
|
||||
for(i=e.vakata.array_unique(i),t=0,r=i.length;r>t;t++)this.open_node(i[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",e.proxy(function(i){if(i.target.tagName&&"input"===i.target.tagName.toLowerCase())return!0
|
||||
r&&clearTimeout(r),r=setTimeout(function(){t=""},500)
|
||||
var s=String.fromCharCode(i.which).toLowerCase(),a=this.element.find(".jstree-anchor").filter(":visible"),n=a.index(d.activeElement)||0,o=!1
|
||||
if(t+=s,t.length>1){if(a.slice(n).each(e.proxy(function(r,i){return 0===e(i).text().toLowerCase().indexOf(t)?(e(i).focus(),o=!0,!1):void 0},this)),o)return
|
||||
if(a.slice(0,n).each(e.proxy(function(r,i){return 0===e(i).text().toLowerCase().indexOf(t)?(e(i).focus(),o=!0,!1):void 0},this)),o)return}if(new RegExp("^"+s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(a.slice(n+1).each(e.proxy(function(t,r){return e(r).text().toLowerCase().charAt(0)===s?(e(r).focus(),o=!0,!1):void 0},this)),o)return
|
||||
if(a.slice(0,n+1).each(e.proxy(function(t,r){return e(r).text().toLowerCase().charAt(0)===s?(e(r).focus(),o=!0,!1):void 0},this)),o)return}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes
|
||||
this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",e.proxy(function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){var r=this.get_node(t.currentTarget)
|
||||
r&&r.id&&(this._data.core.focused=r.id),this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave"),e(t.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")},this)).on("focus.jstree",e.proxy(function(){if(+new Date-i>500&&!this._data.core.focused&&this.settings.core.restore_focus){i=0
|
||||
var e=this.get_node(this.element.attr("aria-activedescendant"),!0)
|
||||
e&&e.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(d).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var r=this.settings.core.strings
|
||||
return e.isFunction(r)?r.call(this,t):r&&r[t]?r[t]:t},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling
|
||||
return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling
|
||||
return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling
|
||||
return e},get_node:function(t,r){t&&t.id&&(t=t.id),t instanceof e&&t.length&&t[0].id&&(t=t[0].id)
|
||||
var i
|
||||
try{if(this._model.data[t])t=this._model.data[t]
|
||||
else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")]
|
||||
else if("string"==typeof t&&(i=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[i.closest(".jstree-node").attr("id")])t=this._model.data[i.closest(".jstree-node").attr("id")]
|
||||
else if((i=this.element.find(t)).length&&this._model.data[i.closest(".jstree-node").attr("id")])t=this._model.data[i.closest(".jstree-node").attr("id")]
|
||||
else{if(!(i=this.element.find(t)).length||!i.hasClass("jstree"))return!1
|
||||
t=this._model.data[e.jstree.root]}return r&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(s){return!1}},get_path:function(t,r,i){if(t=t.parents?t:this.get_node(t),!t||t.id===e.jstree.root||!t.parents)return!1
|
||||
var s,a,n=[]
|
||||
for(n.push(i?t.id:t.text),s=0,a=t.parents.length;a>s;s++)n.push(i?t.parents[s]:this.get_text(t.parents[s]))
|
||||
return n=n.reverse().slice(1),r?n.join(r):n},get_next_dom:function(t,r){var i
|
||||
if(t=this.get_node(t,!0),t[0]===this.element[0]){for(i=this._firstChild(this.get_container_ul()[0]);i&&0===i.offsetHeight;)i=this._nextSibling(i)
|
||||
return i?e(i):!1}if(!t||!t.length)return!1
|
||||
if(r){i=t[0]
|
||||
do i=this._nextSibling(i)
|
||||
while(i&&0===i.offsetHeight)
|
||||
return i?e(i):!1}if(t.hasClass("jstree-open")){for(i=this._firstChild(t.children(".jstree-children")[0]);i&&0===i.offsetHeight;)i=this._nextSibling(i)
|
||||
if(null!==i)return e(i)}i=t[0]
|
||||
do i=this._nextSibling(i)
|
||||
while(i&&0===i.offsetHeight)
|
||||
return null!==i?e(i):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,r){var i
|
||||
if(t=this.get_node(t,!0),t[0]===this.element[0]){for(i=this.get_container_ul()[0].lastChild;i&&0===i.offsetHeight;)i=this._previousSibling(i)
|
||||
return i?e(i):!1}if(!t||!t.length)return!1
|
||||
if(r){i=t[0]
|
||||
do i=this._previousSibling(i)
|
||||
while(i&&0===i.offsetHeight)
|
||||
return i?e(i):!1}i=t[0]
|
||||
do i=this._previousSibling(i)
|
||||
while(i&&0===i.offsetHeight)
|
||||
if(null!==i){for(t=e(i);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last")
|
||||
return t}return i=t[0].parentNode.parentNode,i&&i.className&&-1!==i.className.indexOf("jstree-node")?e(i):!1},get_parent:function(t){return t=this.get_node(t),t&&t.id!==e.jstree.root?t.parent:!1},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):e&&e.length?e.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length>0)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e),e&&e.state&&e.state.loading},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,r){var i,s,a,n,o
|
||||
if(e.isArray(t))return this._load_nodes(t.slice(),r),!0
|
||||
if(t=this.get_node(t),!t)return r&&r.call(this,t,!1),!1
|
||||
if(t.state.loaded){for(t.state.loaded=!1,a=0,n=t.parents.length;n>a;a++)this._model.data[t.parents[a]].children_d=e.vakata.array_filter(this._model.data[t.parents[a]].children_d,function(r){return-1===e.inArray(r,t.children_d)})
|
||||
for(i=0,s=t.children_d.length;s>i;i++)this._model.data[t.children_d[i]].state.selected&&(o=!0),delete this._model.data[t.children_d[i]]
|
||||
o&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(r){return-1===e.inArray(r,t.children_d)})),t.children=[],t.children_d=[],o&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy(function(e){t=this._model.data[t.id],t.state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded
|
||||
var i=this.get_node(t,!0),s=0,a=0,n=this._model.data,o=!1
|
||||
for(s=0,a=t.children.length;a>s;s++)if(n[t.children[s]]&&!n[t.children[s]].state.hidden){o=!0
|
||||
break}t.state.loaded&&i&&i.length&&(i.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&i.addClass(t.state.opened?"jstree-open":"jstree-closed"):i.addClass("jstree-leaf")),i.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),r&&r.call(this,t,e)},this)),!0},_load_nodes:function(e,t,r,i){var s,a,n=!0,o=function(){this._load_nodes(e,t,!0)},d=this._model.data,c=[]
|
||||
for(s=0,a=e.length;a>s;s++)d[e[s]]&&(!d[e[s]].state.loaded&&!d[e[s]].state.failed||!r&&i)&&(this.is_loading(e[s])||this.load_node(e[s],o),n=!1)
|
||||
if(n){for(s=0,a=e.length;a>s;s++)d[e[s]]&&d[e[s]].state.loaded&&c.push(e[s])
|
||||
t&&!t.done&&(t.call(this,c),t.done=!0)}},load_all:function(t,r){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1
|
||||
var i,s,a=[],n=this._model.data,o=n[t.id].children_d
|
||||
for(t.state&&!t.state.loaded&&a.push(t.id),i=0,s=o.length;s>i;i++)n[o[i]]&&n[o[i]].state&&!n[o[i]].state.loaded&&a.push(o[i])
|
||||
a.length?this._load_nodes(a,function(){this.load_all(t,r)}):(r&&r.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,r){var i,s=this.settings.core.data,a=function(){return 3!==this.nodeType&&8!==this.nodeType}
|
||||
return s?e.isFunction(s)?s.call(this,t,e.proxy(function(i){i===!1?r.call(this,!1):this["string"==typeof i?"_append_html_data":"_append_json_data"](t,"string"==typeof i?e(e.parseHTML(i)).filter(a):i,function(e){r.call(this,e)})},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,t)),e.isFunction(s.data)&&(s.data=s.data.call(this,t)),e.ajax(s).done(e.proxy(function(i,s,n){var o=n.getResponseHeader("Content-Type")
|
||||
return o&&-1!==o.indexOf("json")||"object"==typeof i?this._append_json_data(t,i,function(e){r.call(this,e)}):o&&-1!==o.indexOf("html")||"string"==typeof i?this._append_html_data(t,e(e.parseHTML(i)).filter(a),function(e){r.call(this,e)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:n})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1))},this)).fail(e.proxy(function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},r.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(i=e.isArray(s)?e.extend(!0,[],s):e.isPlainObject(s)?e.extend(!0,{},s):s,t.id===e.jstree.root?this._append_json_data(t,i,function(e){r.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1))):"string"==typeof s?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(s)).filter(a),function(e){r.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1)):r.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),function(e){r.call(this,e)}):r.call(this,!1)},_node_changed:function(t){t=this.get_node(t),t&&-1===e.inArray(t.id,this._model.changed)&&this._model.changed.push(t.id)},_append_html_data:function(t,r,i){t=this.get_node(t),t.children=[],t.children_d=[]
|
||||
var s,a,n,o=r.is("ul")?r.children():r,d=t.id,c=[],l=[],h=this._model.data,_=h[d],u=this._data.core.selected.length
|
||||
for(o.each(e.proxy(function(t,r){s=this._parse_model_from_html(e(r),d,_.parents.concat()),s&&(c.push(s),l.push(s),h[s].children_d.length&&(l=l.concat(h[s].children_d)))},this)),_.children=c,_.children_d=l,a=0,n=_.parents.length;n>a;a++)h[_.parents[a]].children_d=h[_.parents[a]].children_d.concat(l)
|
||||
this.trigger("model",{nodes:l,parent:d}),d!==e.jstree.root?(this._node_changed(d),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==u&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),i.call(this,!0)},_append_json_data:function(t,r,i,s){if(null!==this.element){t=this.get_node(t),t.children=[],t.children_d=[],r.d&&(r=r.d,"string"==typeof r&&(r=JSON.parse(r))),e.isArray(r)||(r=[r])
|
||||
var a=null,n={df:this._model.default_state,dat:r,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},o=this,d=function(e,t){e.data&&(e=e.data)
|
||||
var r,i,s,a,n=e.dat,d=e.par,c=[],l=[],h=[],_=e.df,u=e.t_id,g=e.t_cnt,f=e.m,p=f[d],m=e.sel,v=function(e,r,i){i=i?i.concat():[],r&&i.unshift(r)
|
||||
var s,a,n,o,d=e.id.toString(),c={id:d,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:r,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1}
|
||||
for(s in _)_.hasOwnProperty(s)&&(c.state[s]=_[s])
|
||||
if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(c.icon=e.data.jstree.icon),(c.icon===t||null===c.icon||""===c.icon)&&(c.icon=!0),e&&e.data&&(c.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(c.state[s]=e.data.jstree[s])
|
||||
if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(c.state[s]=e.state[s])
|
||||
if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(c.li_attr[s]=e.li_attr[s])
|
||||
if(c.li_attr.id||(c.li_attr.id=d),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(c.a_attr[s]=e.a_attr[s])
|
||||
for(e&&e.children&&e.children===!0&&(c.state.loaded=!1,c.children=[],c.children_d=[]),f[c.id]=c,s=0,a=c.children.length;a>s;s++)n=v(f[c.children[s]],c.id,i),o=f[n],c.children_d.push(n),o.children_d.length&&(c.children_d=c.children_d.concat(o.children_d))
|
||||
return delete e.data,delete e.children,f[c.id].original=e,c.state.selected&&h.push(c.id),c.id},j=function(e,r,i){i=i?i.concat():[],r&&i.unshift(r)
|
||||
var s,a,n,o,d,c=!1
|
||||
do c="j"+u+"_"+ ++g
|
||||
while(f[c])
|
||||
d={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1}
|
||||
for(s in _)_.hasOwnProperty(s)&&(d.state[s]=_[s])
|
||||
if(e&&e.id&&(d.id=e.id.toString()),e&&e.text&&(d.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),(d.icon===t||null===d.icon||""===d.icon)&&(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(d.state[s]=e.data.jstree[s])
|
||||
if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(d.state[s]=e.state[s])
|
||||
if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(d.li_attr[s]=e.li_attr[s])
|
||||
if(d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString()),d.id||(d.id=c),d.li_attr.id||(d.li_attr.id=d.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(d.a_attr[s]=e.a_attr[s])
|
||||
if(e&&e.children&&e.children.length){for(s=0,a=e.children.length;a>s;s++)n=j(e.children[s],d.id,i),o=f[n],d.children.push(n),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d))
|
||||
d.children_d=d.children_d.concat(d.children)}return e&&e.children&&e.children===!0&&(d.state.loaded=!1,d.children=[],d.children_d=[]),delete e.data,delete e.children,d.original=e,f[d.id]=d,d.state.selected&&h.push(d.id),d.id}
|
||||
if(n.length&&n[0].id!==t&&n[0].parent!==t){for(i=0,s=n.length;s>i;i++)n[i].children||(n[i].children=[]),n[i].state||(n[i].state={}),f[n[i].id.toString()]=n[i]
|
||||
for(i=0,s=n.length;s>i;i++)f[n[i].parent.toString()]?(f[n[i].parent.toString()].children.push(n[i].id.toString()),p.children_d.push(n[i].id.toString())):"undefined"!=typeof o&&(o._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:n[i].id.toString(),parent:n[i].parent.toString()})},o.settings.core.error.call(o,o._data.core.last_error))
|
||||
for(i=0,s=p.children.length;s>i;i++)r=v(f[p.children[i]],d,p.parents.concat()),l.push(r),f[r].children_d.length&&(l=l.concat(f[r].children_d))
|
||||
for(i=0,s=p.parents.length;s>i;i++)f[p.parents[i]].children_d=f[p.parents[i]].children_d.concat(l)
|
||||
a={cnt:g,mod:f,sel:m,par:d,dpc:l,add:h}}else{for(i=0,s=n.length;s>i;i++)r=j(n[i],d,p.parents.concat()),r&&(c.push(r),l.push(r),f[r].children_d.length&&(l=l.concat(f[r].children_d)))
|
||||
for(p.children=c,p.children_d=l,i=0,s=p.parents.length;s>i;i++)f[p.parents[i]].children_d=f[p.parents[i]].children_d.concat(l)
|
||||
a={cnt:g,mod:f,sel:m,par:d,dpc:l,add:h}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?a:void postMessage(a)},l=function(t,r){if(null!==this.element){this._cnt=t.cnt
|
||||
var s,a=this._model.data
|
||||
for(s in a)a.hasOwnProperty(s)&&a[s].state&&a[s].state.loading&&t.mod[s]&&(t.mod[s].state.loading=!0)
|
||||
if(this._model.data=t.mod,r){var n,d=t.add,l=t.sel,h=this._data.core.selected.slice()
|
||||
if(a=this._model.data,l.length!==h.length||e.vakata.array_unique(l.concat(h)).length!==l.length){for(s=0,n=l.length;n>s;s++)-1===e.inArray(l[s],d)&&-1===e.inArray(l[s],h)&&(a[l[s]].state.selected=!1)
|
||||
for(s=0,n=h.length;n>s;s++)-1===e.inArray(h[s],l)&&(a[h[s]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!r&&c?c(function(){i.call(o,!0)}):i.call(o,!0)}}
|
||||
if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+d.toString()],{type:"text/javascript"}))),!this._data.core.working||s?(this._data.core.working=!0,a=new window.Worker(this._wrk),a.onmessage=e.proxy(function(e){l.call(this,e.data,!0)
|
||||
try{a.terminate(),a=null}catch(t){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),n.par?a.postMessage(n):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,r,i,!0])}catch(h){l.call(this,d(n),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else l.call(this,d(n),!1)}},_parse_model_from_html:function(r,i,s){s=s?[].concat(s):[],i&&s.unshift(i)
|
||||
var a,n,o,d,c,l=this._model.data,h={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1}
|
||||
for(o in this._model.default_state)this._model.default_state.hasOwnProperty(o)&&(h.state[o]=this._model.default_state[o])
|
||||
if(d=e.vakata.attributes(r,!0),e.each(d,function(t,r){return r=e.trim(r),r.length?(h.li_attr[t]=r,void("id"===t&&(h.id=r.toString()))):!0}),d=r.children("a").first(),d.length&&(d=e.vakata.attributes(d,!0),e.each(d,function(t,r){r=e.trim(r),r.length&&(h.a_attr[t]=r)})),d=r.children("a").first().length?r.children("a").first().clone():r.clone(),d.children("ins, i, ul").remove(),d=d.html(),d=e("<div />").html(d),h.text=this.settings.core.force_text?d.text():d.html(),d=r.data(),h.data=d?e.extend(!0,{},d):null,h.state.opened=r.hasClass("jstree-open"),h.state.selected=r.children("a").hasClass("jstree-clicked"),h.state.disabled=r.children("a").hasClass("jstree-disabled"),h.data&&h.data.jstree)for(o in h.data.jstree)h.data.jstree.hasOwnProperty(o)&&(h.state[o]=h.data.jstree[o])
|
||||
d=r.children("a").children(".jstree-themeicon"),d.length&&(h.icon=d.hasClass("jstree-themeicon-hidden")?!1:d.attr("rel")),h.state.icon!==t&&(h.icon=h.state.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),d=r.children("ul").children("li")
|
||||
do c="j"+this._id+"_"+ ++this._cnt
|
||||
while(l[c])
|
||||
return h.id=h.li_attr.id?h.li_attr.id.toString():c,d.length?(d.each(e.proxy(function(t,r){a=this._parse_model_from_html(e(r),h.id,s),n=this._model.data[a],h.children.push(a),n.children_d.length&&(h.children_d=h.children_d.concat(n.children_d))},this)),h.children_d=h.children_d.concat(h.children)):r.hasClass("jstree-closed")&&(h.state.loaded=!1),h.li_attr["class"]&&(h.li_attr["class"]=h.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),h.a_attr["class"]&&(h.a_attr["class"]=h.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_flat_json:function(e,r,i){i=i?i.concat():[],r&&i.unshift(r)
|
||||
var s,a,n,o,d=e.id.toString(),c=this._model.data,l=this._model.default_state,h={id:d,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:r,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1}
|
||||
for(s in l)l.hasOwnProperty(s)&&(h.state[s]=l[s])
|
||||
if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(h.state[s]=e.data.jstree[s])
|
||||
if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(h.state[s]=e.state[s])
|
||||
if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(h.li_attr[s]=e.li_attr[s])
|
||||
if(h.li_attr.id||(h.li_attr.id=d),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(h.a_attr[s]=e.a_attr[s])
|
||||
for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),c[h.id]=h,s=0,a=h.children.length;a>s;s++)n=this._parse_model_from_flat_json(c[h.children[s]],h.id,i),o=c[n],h.children_d.push(n),o.children_d.length&&(h.children_d=h.children_d.concat(o.children_d))
|
||||
return delete e.data,delete e.children,c[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,r,i){i=i?i.concat():[],r&&i.unshift(r)
|
||||
var s,a,n,o,d,c=!1,l=this._model.data,h=this._model.default_state
|
||||
do c="j"+this._id+"_"+ ++this._cnt
|
||||
while(l[c])
|
||||
d={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1}
|
||||
for(s in h)h.hasOwnProperty(s)&&(d.state[s]=h[s])
|
||||
if(e&&e.id&&(d.id=e.id.toString()),e&&e.text&&(d.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),(d.icon===t||null===d.icon||""===d.icon)&&(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(d.state[s]=e.data.jstree[s])
|
||||
if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(d.state[s]=e.state[s])
|
||||
if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(d.li_attr[s]=e.li_attr[s])
|
||||
if(d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString()),d.id||(d.id=c),d.li_attr.id||(d.li_attr.id=d.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(d.a_attr[s]=e.a_attr[s])
|
||||
if(e&&e.children&&e.children.length){for(s=0,a=e.children.length;a>s;s++)n=this._parse_model_from_json(e.children[s],d.id,i),o=l[n],d.children.push(n),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d))
|
||||
d.children_d=d.children.concat(d.children_d)}return e&&e.children&&e.children===!0&&(d.state.loaded=!1,d.children=[],d.children_d=[]),delete e.data,delete e.children,d.original=e,l[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_redraw:function(){var t,r,i,s=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),a=d.createElement("UL"),n=this._data.core.focused
|
||||
for(r=0,i=s.length;i>r;r++)t=this.redraw_node(s[r],!0,this._model.force_full_redraw),t&&this._model.force_full_redraw&&a.appendChild(t)
|
||||
this._model.force_full_redraw&&(a.className=this.get_container_ul()[0].className,a.setAttribute("role","group"),this.element.empty().append(a)),null!==n&&this.settings.core.restore_focus&&(t=this.get_node(n,!0),t&&t.length&&t.children(".jstree-anchor")[0]!==d.activeElement?t.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:s})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(t){var r=this.get_node(t),i=!1,s=!1,a=!1,n=d
|
||||
if(!r)return!1
|
||||
if(r.id===e.jstree.root)return this.redraw(!0)
|
||||
if(t=this.get_node(t,!0),!t||!t.length)return!1
|
||||
if(t.children(".jstree-children").remove(),t=t[0],r.children.length&&r.state.loaded){for(a=n.createElement("UL"),a.setAttribute("role","group"),a.className="jstree-children",i=0,s=r.children.length;s>i;i++)a.appendChild(this.redraw_node(r.children[i],!0,!0))
|
||||
t.appendChild(a)}},redraw_node:function(t,r,i,s){var a=this.get_node(t),n=!1,o=!1,c=!1,l=!1,h=!1,_=!1,u="",g=d,f=this._model.data,p=!1,m=null,v=0,j=0,y=!1,k=!1
|
||||
if(!a)return!1
|
||||
if(a.id===e.jstree.root)return this.redraw(!0)
|
||||
if(r=r||0===a.children.length,t=d.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(a.id[0])?"\\3"+a.id[0]+" "+a.id.substr(1).replace(e.jstree.idregex,"\\$&"):a.id.replace(e.jstree.idregex,"\\$&"))):d.getElementById(a.id))t=e(t),i||(n=t.parent().parent()[0],n===this.element[0]&&(n=null),o=t.index()),r||!a.children.length||t.children(".jstree-children").length||(r=!0),r||(c=t.children(".jstree-children")[0]),p=t.children(".jstree-anchor")[0]===d.activeElement,t.remove()
|
||||
else if(r=!0,!i){if(n=a.parent!==e.jstree.root?e("#"+a.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===n||n&&f[a.parent].state.opened))return!1
|
||||
o=e.inArray(a.id,null===n?f[e.jstree.root].children:f[a.parent].children)}t=this._data.core.node.cloneNode(!0),u="jstree-node "
|
||||
for(l in a.li_attr)if(a.li_attr.hasOwnProperty(l)){if("id"===l)continue
|
||||
"class"!==l?t.setAttribute(l,a.li_attr[l]):u+=a.li_attr[l]}for(a.a_attr.id||(a.a_attr.id=a.id+"_anchor"),t.setAttribute("aria-selected",!!a.state.selected),t.setAttribute("aria-level",a.parents.length),t.setAttribute("aria-labelledby",a.a_attr.id),a.state.disabled&&t.setAttribute("aria-disabled",!0),l=0,h=a.children.length;h>l;l++)if(!f[a.children[l]].state.hidden){y=!0
|
||||
break}if(null!==a.parent&&f[a.parent]&&!a.state.hidden&&(l=e.inArray(a.id,f[a.parent].children),k=a.id,-1!==l))for(l++,h=f[a.parent].children.length;h>l&&(f[f[a.parent].children[l]].state.hidden||(k=f[a.parent].children[l]),k===a.id);l++);a.state.hidden&&(u+=" jstree-hidden"),a.state.loading&&(u+=" jstree-loading"),a.state.loaded&&!y?u+=" jstree-leaf":(u+=a.state.opened&&a.state.loaded?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",a.state.opened&&a.state.loaded)),k===a.id&&(u+=" jstree-last"),t.id=a.id,t.className=u,u=(a.state.selected?" jstree-clicked":"")+(a.state.disabled?" jstree-disabled":"")
|
||||
for(h in a.a_attr)if(a.a_attr.hasOwnProperty(h)){if("href"===h&&"#"===a.a_attr[h])continue
|
||||
"class"!==h?t.childNodes[1].setAttribute(h,a.a_attr[h]):u+=" "+a.a_attr[h]}if(u.length&&(t.childNodes[1].className="jstree-anchor "+u),(a.icon&&a.icon!==!0||a.icon===!1)&&(a.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===a.icon.indexOf("/")&&-1===a.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+a.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+a.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(g.createTextNode(a.text)):t.childNodes[1].innerHTML+=a.text,r&&a.children.length&&(a.state.opened||s)&&a.state.loaded){for(_=g.createElement("UL"),_.setAttribute("role","group"),_.className="jstree-children",l=0,h=a.children.length;h>l;l++)_.appendChild(this.redraw_node(a.children[l],r,!0))
|
||||
t.appendChild(_)}if(c&&t.appendChild(c),!i){for(n||(n=this.element[0]),l=0,h=n.childNodes.length;h>l;l++)if(n.childNodes[l]&&n.childNodes[l].className&&-1!==n.childNodes[l].className.indexOf("jstree-children")){m=n.childNodes[l]
|
||||
break}m||(m=g.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",n.appendChild(m)),n=m,o<n.childNodes.length?n.insertBefore(t,n.childNodes[o]):n.appendChild(t),p&&(v=this.element[0].scrollTop,j=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=v,this.element[0].scrollLeft=j)}return a.state.opened&&!a.state.loaded&&(a.state.opened=!1,setTimeout(e.proxy(function(){this.open_node(a.id,!1,0)},this),0)),t},open_node:function(r,i,s){var a,n,o,d
|
||||
if(e.isArray(r)){for(r=r.slice(),a=0,n=r.length;n>a;a++)this.open_node(r[a],i,s)
|
||||
return!0}return r=this.get_node(r),r&&r.id!==e.jstree.root?(s=s===t?this.settings.core.animation:s,this.is_closed(r)?this.is_loaded(r)?(o=this.get_node(r,!0),d=this,o.length&&(s&&o.children(".jstree-children").length&&o.children(".jstree-children").stop(!0,!0),r.children.length&&!this._firstChild(o.children(".jstree-children")[0])&&this.draw_children(r),s?(this.trigger("before_open",{node:r}),o.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(s,function(){this.style.display="",d.element&&d.trigger("after_open",{node:r})})):(this.trigger("before_open",{node:r}),o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),r.state.opened=!0,i&&i.call(this,r,!0),o.length||this.trigger("before_open",{node:r}),this.trigger("open_node",{node:r}),s&&o.length||this.trigger("after_open",{node:r}),!0):this.is_loading(r)?setTimeout(e.proxy(function(){this.open_node(r,i,s)},this),500):void this.load_node(r,function(e,t){return t?this.open_node(e,i,s):i?i.call(this,e,!1):!1}):(i&&i.call(this,r,!1),!1)):!1},_open_to:function(t){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1
|
||||
var r,i,s=t.parents
|
||||
for(r=0,i=s.length;i>r;r+=1)r!==e.jstree.root&&this.open_node(s[r],!1,0)
|
||||
return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(r,i){var s,a,n,o
|
||||
if(e.isArray(r)){for(r=r.slice(),s=0,a=r.length;a>s;s++)this.close_node(r[s],i)
|
||||
return!0}return r=this.get_node(r),r&&r.id!==e.jstree.root?this.is_closed(r)?!1:(i=i===t?this.settings.core.animation:i,n=this,o=this.get_node(r,!0),r.state.opened=!1,this.trigger("close_node",{node:r}),void(o.length?i?o.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(i,function(){this.style.display="",o.children(".jstree-children").remove(),n.element&&n.trigger("after_close",{node:r})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:r})):this.trigger("after_close",{node:r}))):!1},toggle_node:function(t){var r,i
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.toggle_node(t[r])
|
||||
return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,r,i){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1
|
||||
var s,a,n,o=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0)
|
||||
if(!o.length){for(s=0,a=t.children_d.length;a>s;s++)this.is_closed(this._model.data[t.children_d[s]])&&(this._model.data[t.children_d[s]].state.opened=!0)
|
||||
return this.trigger("open_all",{node:t})}i=i||o,n=this,o=this.is_closed(t)?o.find(".jstree-closed").addBack():o.find(".jstree-closed"),o.each(function(){n.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,r,i)},r||0)}),0===i.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(i)})},close_all:function(t,r){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1
|
||||
var i,s,a=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),n=this
|
||||
for(a.length&&(a=this.is_open(t)?a.find(".jstree-open").addBack():a.find(".jstree-open"),e(a.get().reverse()).each(function(){n.close_node(this,r||0)})),i=0,s=t.children_d.length;s>i;i++)this._model.data[t.children_d[i]].state.opened=!1
|
||||
this.trigger("close_all",{node:t})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(t){var r,i
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.enable_node(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:t})):!1},disable_node:function(t){var r,i
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.disable_node(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:t})):!1},is_hidden:function(e){return e=this.get_node(e),e.state.hidden===!0},hide_node:function(t,r){var i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.hide_node(t[i],!0)
|
||||
return r||this.redraw(),!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?void(t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),r||this.redraw(),this.trigger("hide_node",{node:t}))):!1},show_node:function(t,r){var i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.show_node(t[i],!0)
|
||||
return r||this.redraw(),!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?void(t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),r||this.redraw(),this.trigger("show_node",{node:t}))):!1},hide_all:function(t){var r,i=this._model.data,s=[]
|
||||
for(r in i)i.hasOwnProperty(r)&&r!==e.jstree.root&&!i[r].state.hidden&&(i[r].state.hidden=!0,s.push(r))
|
||||
return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:s}),s},show_all:function(t){var r,i=this._model.data,s=[]
|
||||
for(r in i)i.hasOwnProperty(r)&&r!==e.jstree.root&&i[r].state.hidden&&(i[r].state.hidden=!1,s.push(r))
|
||||
return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:s}),s},activate_node:function(e,r){if(this.is_disabled(e))return!1
|
||||
if(r&&"object"==typeof r||(r={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(r.metaKey||r.ctrlKey||r.shiftKey)&&(!r.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(r.shiftKey){var i,s,a=this.get_node(e).id,n=this._data.core.last_clicked.id,o=this.get_node(this._data.core.last_clicked.parent).children,d=!1
|
||||
for(i=0,s=o.length;s>i;i+=1)o[i]===a&&(d=!d),o[i]===n&&(d=!d),this.is_disabled(o[i])||!d&&o[i]!==a&&o[i]!==n?this.deselect_node(o[i],!0,r):this.is_hidden(o[i])||this.select_node(o[i],!0,!1,r)
|
||||
this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:r})}else this.is_selected(e)?this.deselect_node(e,!1,r):this.select_node(e,!1,!1,r)
|
||||
else!this.settings.core.multiple&&(r.metaKey||r.ctrlKey||r.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,r):(this.deselect_all(!0),this.select_node(e,!1,!1,r),this._data.core.last_clicked=this.get_node(e))
|
||||
this.trigger("activate_node",{node:this.get_node(e),event:r})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1
|
||||
var t=this.element.find(".jstree-hovered"),r=this.element
|
||||
t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout(function(){r.attr("aria-activedescendant",e[0].id)},0)},dehover_node:function(e){return e=this.get_node(e,!0),e&&e.length&&e.children(".jstree-hovered").length?(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)})):!1},select_node:function(t,r,i,s){var a,n,o
|
||||
if(e.isArray(t)){for(t=t.slice(),n=0,o=t.length;o>n;n++)this.select_node(t[n],r,i,s)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(a=this.get_node(t,!0),void(t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),i||(a=this._open_to(t)),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:s}),r||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:s})))):!1},deselect_node:function(t,r,i){var s,a,n
|
||||
if(e.isArray(t)){for(t=t.slice(),s=0,a=t.length;a>s;s++)this.deselect_node(t[s],r,i)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(n=this.get_node(t,!0),void(t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:i}),r||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:i})))):!1},select_all:function(t){var r,i,s=this._data.core.selected.concat([])
|
||||
for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),r=0,i=this._data.core.selected.length;i>r;r++)this._model.data[this._data.core.selected[r]]&&(this._model.data[this._data.core.selected[r]].state.selected=!0)
|
||||
this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:s})},deselect_all:function(e){var t,r,i=this._data.core.selected.concat([])
|
||||
for(t=0,r=this._data.core.selected.length;r>t;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1)
|
||||
this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:i}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:i})},is_selected:function(t){return t=this.get_node(t),t&&t.id!==e.jstree.root?t.state.selected:!1},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected.slice()},get_top_selected:function(t){var r,i,s,a,n=this.get_selected(!0),o={}
|
||||
for(r=0,i=n.length;i>r;r++)o[n[r].id]=n[r]
|
||||
for(r=0,i=n.length;i>r;r++)for(s=0,a=n[r].children_d.length;a>s;s++)o[n[r].children_d[s]]&&delete o[n[r].children_d[s]]
|
||||
n=[]
|
||||
for(r in o)o.hasOwnProperty(r)&&n.push(r)
|
||||
return t?e.map(n,e.proxy(function(e){return this.get_node(e)},this)):n},get_bottom_selected:function(t){var r,i,s=this.get_selected(!0),a=[]
|
||||
for(r=0,i=s.length;i>r;r++)s[r].children.length||a.push(s[r].id)
|
||||
return t?e.map(a,e.proxy(function(e){return this.get_node(e)},this)):a},get_state:function(){var t,r={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}}
|
||||
for(t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==e.jstree.root&&(this._model.data[t].state.loaded&&this.settings.core.loaded_state&&r.core.loaded.push(t),this._model.data[t].state.opened&&r.core.open.push(t),this._model.data[t].state.selected&&r.core.selected.push(t))
|
||||
return r},set_state:function(r,i){if(r){if(r.core&&r.core.selected&&r.core.initial_selection===t&&(r.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),r.core){var s,a
|
||||
if(r.core.loaded)return this.settings.core.loaded_state&&e.isArray(r.core.loaded)&&r.core.loaded.length?this._load_nodes(r.core.loaded,function(e){delete r.core.loaded,this.set_state(r,i)}):(delete r.core.loaded,this.set_state(r,i)),!1
|
||||
if(r.core.open)return e.isArray(r.core.open)&&r.core.open.length?this._load_nodes(r.core.open,function(e){this.open_node(e,!1,0),delete r.core.open,this.set_state(r,i)}):(delete r.core.open,this.set_state(r,i)),!1
|
||||
if(r.core.scroll)return r.core.scroll&&r.core.scroll.left!==t&&this.element.scrollLeft(r.core.scroll.left),r.core.scroll&&r.core.scroll.top!==t&&this.element.scrollTop(r.core.scroll.top),delete r.core.scroll,this.set_state(r,i),!1
|
||||
if(r.core.selected)return s=this,(r.core.initial_selection===t||r.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),e.each(r.core.selected,function(e,t){s.select_node(t,!1,!0)})),delete r.core.initial_selection,delete r.core.selected,this.set_state(r,i),!1
|
||||
for(a in r)r.hasOwnProperty(a)&&"core"!==a&&-1===e.inArray(a,this.settings.plugins)&&delete r[a]
|
||||
if(e.isEmptyObject(r.core))return delete r.core,this.set_state(r,i),!1}return e.isEmptyObject(r)?(r=null,i&&i.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(t,r){this._data.core.state=r===!0?{}:this.get_state(),r&&e.isFunction(r)&&(this._data.core.state=r.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null
|
||||
var i=this.get_container_ul()[0].className
|
||||
t||(this.element.html("<ul class='"+i+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(e.jstree.root,function(t,r){r&&(this.get_container_ul()[0].className=i,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(t){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1
|
||||
var r=[],i=[],s=this._data.core.selected.concat([])
|
||||
i.push(t.id),t.state.opened===!0&&r.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){i.push(this.id),r.push(this.id)}),this._load_nodes(i,e.proxy(function(e){this.open_node(r,!1,0),this.select_node(s),this.trigger("refresh_node",{node:t,nodes:e})},this),!1,!0)},set_id:function(t,r){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1
|
||||
var i,s,a=this._model.data,n=t.id
|
||||
for(r=r.toString(),a[t.parent].children[e.inArray(t.id,a[t.parent].children)]=r,i=0,s=t.parents.length;s>i;i++)a[t.parents[i]].children_d[e.inArray(t.id,a[t.parents[i]].children_d)]=r
|
||||
for(i=0,s=t.children.length;s>i;i++)a[t.children[i]].parent=r
|
||||
for(i=0,s=t.children_d.length;s>i;i++)a[t.children_d[i]].parents[e.inArray(t.id,a[t.children_d[i]].parents)]=r
|
||||
return i=e.inArray(t.id,this._data.core.selected),-1!==i&&(this._data.core.selected[i]=r),i=this.get_node(t.id,!0),i&&(i.attr("id",r),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",r)),delete a[t.id],t.id=r,t.li_attr.id=r,a[r]=t,this.trigger("set_id",{node:t,"new":t.id,old:n}),!0},get_text:function(t){return t=this.get_node(t),t&&t.id!==e.jstree.root?t.text:!1},set_text:function(t,r){var i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_text(t[i],r)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(t.text=r,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:r}),!0):!1},get_json:function(t,r,i){if(t=this.get_node(t||e.jstree.root),!t)return!1
|
||||
r&&r.flat&&!i&&(i=[])
|
||||
var s,a,n={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:r&&r.no_data?!1:e.extend(!0,e.isArray(t.data)?[]:{},t.data)}
|
||||
if(r&&r.flat?n.parent=t.parent:n.children=[],r&&r.no_state)delete n.state
|
||||
else for(s in t.state)t.state.hasOwnProperty(s)&&(n.state[s]=t.state[s])
|
||||
if(r&&r.no_li_attr&&delete n.li_attr,r&&r.no_a_attr&&delete n.a_attr,r&&r.no_id&&(delete n.id,n.li_attr&&n.li_attr.id&&delete n.li_attr.id,n.a_attr&&n.a_attr.id&&delete n.a_attr.id),r&&r.flat&&t.id!==e.jstree.root&&i.push(n),!r||!r.no_children)for(s=0,a=t.children.length;a>s;s++)r&&r.flat?this.get_json(t.children[s],r,i):n.children.push(this.get_json(t.children[s],r))
|
||||
return r&&r.flat?i:t.id===e.jstree.root?n.children:n},create_node:function(r,i,s,a,n){if(null===r&&(r=e.jstree.root),r=this.get_node(r),!r)return!1
|
||||
if(s=s===t?"last":s,!s.toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(r))return this.load_node(r,function(){this.create_node(r,i,s,a,!0)})
|
||||
i||(i={text:this.get_string("New node")}),i="string"==typeof i?{text:i}:e.extend(!0,{},i),i.text===t&&(i.text=this.get_string("New node"))
|
||||
var o,d,c,l
|
||||
switch(r.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":o=this.get_node(r.parent),s=e.inArray(r.id,o.children),r=o
|
||||
break
|
||||
case"after":o=this.get_node(r.parent),s=e.inArray(r.id,o.children)+1,r=o
|
||||
break
|
||||
case"inside":case"first":s=0
|
||||
break
|
||||
case"last":s=r.children.length
|
||||
break
|
||||
default:s||(s=0)}if(s>r.children.length&&(s=r.children.length),i.id||(i.id=!0),!this.check("create_node",i,r,s))return this.settings.core.error.call(this,this._data.core.last_error),!1
|
||||
if(i.id===!0&&delete i.id,i=this._parse_model_from_json(i,r.id,r.parents.concat()),!i)return!1
|
||||
for(o=this.get_node(i),d=[],d.push(i),d=d.concat(o.children_d),this.trigger("model",{nodes:d,parent:r.id}),r.children_d=r.children_d.concat(d),c=0,l=r.parents.length;l>c;c++)this._model.data[r.parents[c]].children_d=this._model.data[r.parents[c]].children_d.concat(d)
|
||||
for(i=o,o=[],c=0,l=r.children.length;l>c;c++)o[c>=s?c+1:c]=r.children[c]
|
||||
return o[s]=i.id,r.children=o,this.redraw_node(r,!0),this.trigger("create_node",{node:this.get_node(i),parent:r.id,position:s}),a&&a.call(this,this.get_node(i)),i.id},rename_node:function(t,r){var i,s,a
|
||||
if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.rename_node(t[i],r)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(a=t.text,this.check("rename_node",t,this.get_parent(t),r)?(this.set_text(t,r),this.trigger("rename_node",{node:t,text:r,old:a}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(t){var r,i,s,a,n,o,d,c,l,h,_,u
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.delete_node(t[r])
|
||||
return!0}if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1
|
||||
if(s=this.get_node(t.parent),a=e.inArray(t.id,s.children),h=!1,!this.check("delete_node",t,s,a))return this.settings.core.error.call(this,this._data.core.last_error),!1
|
||||
for(-1!==a&&(s.children=e.vakata.array_remove(s.children,a)),n=t.children_d.concat([]),n.push(t.id),o=0,d=t.parents.length;d>o;o++)this._model.data[t.parents[o]].children_d=e.vakata.array_filter(this._model.data[t.parents[o]].children_d,function(t){return-1===e.inArray(t,n)})
|
||||
for(c=0,l=n.length;l>c;c++)if(this._model.data[n[c]].state.selected){h=!0
|
||||
break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(t){return-1===e.inArray(t,n)})),this.trigger("delete_node",{node:t,parent:s.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),c=0,l=n.length;l>c;c++)delete this._model.data[n[c]]
|
||||
return-1!==e.inArray(this._data.core.focused,n)&&(this._data.core.focused=null,_=this.element[0].scrollTop,u=this.element[0].scrollLeft,s.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(s,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=_,this.element[0].scrollLeft=u),this.redraw_node(s,!0),!0},check:function(t,r,i,s,a){r=r&&r.id?r:this.get_node(r),i=i&&i.id?i:this.get_node(i)
|
||||
var n=t.match(/^move_node|copy_node|create_node$/i)?i:r,o=this.settings.core.check_callback
|
||||
if("move_node"===t||"copy_node"===t){if(!(a&&a.is_multi||"move_node"!==t||e.inArray(r.id,i.children)!==s))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:t,pos:s,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})},!1
|
||||
if(!(a&&a.is_multi||r.id!==i.id&&("move_node"!==t||e.inArray(r.id,i.children)!==s)&&-1===e.inArray(i.id,r.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:s,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})},!1}return n&&n.data&&(n=n.data),n&&n.functions&&(n.functions[t]===!1||n.functions[t]===!0)?(n.functions[t]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})}),n.functions[t]):o===!1||e.isFunction(o)&&o.call(this,t,r,i,s,a)===!1||o&&o[t]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})},!1):!0},last_error:function(){return this._data.core.last_error},move_node:function(r,i,s,a,n,o,d){var c,l,h,_,u,g,f,p,m,v,j,y,k,x
|
||||
if(i=this.get_node(i),s=s===t?0:s,!i)return!1
|
||||
if(!s.toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(i))return this.load_node(i,function(){this.move_node(r,i,s,a,!0,!1,d)})
|
||||
if(e.isArray(r)){if(1!==r.length){for(c=0,l=r.length;l>c;c++)(m=this.move_node(r[c],i,s,a,n,!1,d))&&(i=m,s="after")
|
||||
return this.redraw(),!0}r=r[0]}if(r=r&&r.id?r:this.get_node(r),!r||r.id===e.jstree.root)return!1
|
||||
if(h=(r.parent||e.jstree.root).toString(),u=s.toString().match(/^(before|after)$/)&&i.id!==e.jstree.root?this.get_node(i.parent):i,g=d?d:this._model.data[r.id]?this:e.jstree.reference(r.id),f=!g||!g._id||this._id!==g._id,_=g&&g._id&&h&&g._model.data[h]&&g._model.data[h].children?e.inArray(r.id,g._model.data[h].children):-1,g&&g._id&&(r=g._model.data[r.id]),f)return(m=this.copy_node(r,i,s,a,n,!1,d))?(g&&g.delete_node(r),m):!1
|
||||
switch(i.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,u.children)
|
||||
break
|
||||
case"after":s=e.inArray(i.id,u.children)+1
|
||||
break
|
||||
case"inside":case"first":s=0
|
||||
break
|
||||
case"last":s=u.children.length
|
||||
break
|
||||
default:s||(s=0)}if(s>u.children.length&&(s=u.children.length),!this.check("move_node",r,u,s,{core:!0,origin:d,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1
|
||||
if(r.parent===u.id){for(p=u.children.concat(),m=e.inArray(r.id,p),-1!==m&&(p=e.vakata.array_remove(p,m),s>m&&s--),m=[],v=0,j=p.length;j>v;v++)m[v>=s?v+1:v]=p[v]
|
||||
m[s]=r.id,u.children=m,this._node_changed(u.id),this.redraw(u.id===e.jstree.root)}else{for(m=r.children_d.concat(),m.push(r.id),v=0,j=r.parents.length;j>v;v++){for(p=[],x=g._model.data[r.parents[v]].children_d,y=0,k=x.length;k>y;y++)-1===e.inArray(x[y],m)&&p.push(x[y])
|
||||
g._model.data[r.parents[v]].children_d=p}for(g._model.data[h].children=e.vakata.array_remove_item(g._model.data[h].children,r.id),v=0,j=u.parents.length;j>v;v++)this._model.data[u.parents[v]].children_d=this._model.data[u.parents[v]].children_d.concat(m)
|
||||
for(p=[],v=0,j=u.children.length;j>v;v++)p[v>=s?v+1:v]=u.children[v]
|
||||
for(p[s]=r.id,u.children=p,u.children_d.push(r.id),u.children_d=u.children_d.concat(r.children_d),r.parent=u.id,m=u.parents.concat(),m.unshift(u.id),x=r.parents.length,r.parents=m,m=m.concat(),v=0,j=r.children_d.length;j>v;v++)this._model.data[r.children_d[v]].parents=this._model.data[r.children_d[v]].parents.slice(0,-1*x),Array.prototype.push.apply(this._model.data[r.children_d[v]].parents,m);(h===e.jstree.root||u.id===e.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(u.id)),o||this.redraw()}return a&&a.call(this,r,u,s),this.trigger("move_node",{node:r,parent:u.id,position:s,old_parent:h,old_position:_,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id,old_instance:g,new_instance:this}),r.id},copy_node:function(r,i,s,a,n,o,d){var c,l,h,_,u,g,f,p,m,v,j
|
||||
if(i=this.get_node(i),s=s===t?0:s,!i)return!1
|
||||
if(!s.toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(i))return this.load_node(i,function(){this.copy_node(r,i,s,a,!0,!1,d)})
|
||||
if(e.isArray(r)){if(1!==r.length){for(c=0,l=r.length;l>c;c++)(_=this.copy_node(r[c],i,s,a,n,!0,d))&&(i=_,s="after")
|
||||
return this.redraw(),!0}r=r[0]}if(r=r&&r.id?r:this.get_node(r),!r||r.id===e.jstree.root)return!1
|
||||
switch(p=(r.parent||e.jstree.root).toString(),m=s.toString().match(/^(before|after)$/)&&i.id!==e.jstree.root?this.get_node(i.parent):i,v=d?d:this._model.data[r.id]?this:e.jstree.reference(r.id),j=!v||!v._id||this._id!==v._id,v&&v._id&&(r=v._model.data[r.id]),i.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,m.children)
|
||||
break
|
||||
case"after":s=e.inArray(i.id,m.children)+1
|
||||
break
|
||||
case"inside":case"first":s=0
|
||||
break
|
||||
case"last":s=m.children.length
|
||||
break
|
||||
default:s||(s=0)}if(s>m.children.length&&(s=m.children.length),!this.check("copy_node",r,m,s,{core:!0,origin:d,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1
|
||||
if(f=v?v.get_json(r,{no_id:!0,no_data:!0,no_state:!0}):r,!f)return!1
|
||||
if(f.id===!0&&delete f.id,f=this._parse_model_from_json(f,m.id,m.parents.concat()),!f)return!1
|
||||
for(_=this.get_node(f),r&&r.state&&r.state.loaded===!1&&(_.state.loaded=!1),h=[],h.push(f),h=h.concat(_.children_d),this.trigger("model",{nodes:h,parent:m.id}),u=0,g=m.parents.length;g>u;u++)this._model.data[m.parents[u]].children_d=this._model.data[m.parents[u]].children_d.concat(h)
|
||||
for(h=[],u=0,g=m.children.length;g>u;u++)h[u>=s?u+1:u]=m.children[u]
|
||||
return h[s]=_.id,m.children=h,m.children_d.push(_.id),m.children_d=m.children_d.concat(_.children_d),m.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(m.id),o||this.redraw(m.id===e.jstree.root),a&&a.call(this,_,m,s),this.trigger("copy_node",{node:_,original:r,parent:m.id,position:s,old_parent:p,old_position:v&&v._id&&p&&v._model.data[p]&&v._model.data[p].children?e.inArray(r.id,v._model.data[p].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),_.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1
|
||||
var r,n,o,d=[]
|
||||
for(n=0,o=t.length;o>n;n++)r=this.get_node(t[n]),r&&r.id&&r.id!==e.jstree.root&&d.push(r)
|
||||
return d.length?(i=d,a=this,s="move_node",void this.trigger("cut",{node:t})):!1},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1
|
||||
var r,n,o,d=[]
|
||||
for(n=0,o=t.length;o>n;n++)r=this.get_node(t[n]),r&&r.id&&r.id!==e.jstree.root&&d.push(r)
|
||||
return d.length?(i=d,a=this,s="copy_node",void this.trigger("copy",{node:t})):!1},get_buffer:function(){return{mode:s,node:i,inst:a}},can_paste:function(){return s!==!1&&i!==!1},get_checked_nodes:function(){return e.grep(this.get_checked(!0),function(e,t){return e!==!1})},get_fullpath:function(t){t=this.get_node(t)
|
||||
var r=this,i=""
|
||||
if(t&&t.id!==e.jstree.root){for(var s=t,a=[];s.parent;)s=this.get_node(s.parent),a.push(s.id)
|
||||
e.each(a.reverse(),function(t,s){i+=s!==e.jstree.root?r.get_node(s).text+"/":""})}return i+=t.text?t.text:""},is_readonly:function(e){var t=this.get_fullpath(e)
|
||||
return t.startsWith("/dev_flash")||t.startsWith("/dev_bdvd")},paste:function(e,t){return e=this.get_node(e),e&&s&&s.match(/^(copy_node|move_node)$/)&&i?(this[s](i,e,t,!1,!1,!1,a)&&this.trigger("paste",{parent:e.id,node:i,mode:s}),i=!1,s=!1,void(a=!1)):!1},clear_buffer:function(){i=!1,s=!1,a=!1,this.trigger("clear_buffer")},edit:function(t,r,i){var s,a,n,o,c,l,h,_,u,g=!1
|
||||
return(t=this.get_node(t))?this.check("edit",t,this.get_parent(t))?(u=t,r="string"==typeof r?r:t.text,this.set_text(t,""),t=this._open_to(t),u.text=r,s=this._data.core.rtl,a=this.element.width(),this._data.core.focused=u.id,n=t.children(".jstree-anchor").focus(),o=e("<span>"),c=r,l=e("<div />",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo(d.body),h=e("<input />",{value:c,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(r){r.stopImmediatePropagation(),r.preventDefault()
|
||||
var s,a=o.children(".jstree-rename-input"),d=a.val(),_=this.settings.core.force_text,f=/^[^\\/:\*\#~!?" <>\|]+$/,p=/^\./,m=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i
|
||||
return d.length>255||f.test(d)===!1||p.test(d)===!0||m.test(d)===!0?!1:(""===d&&(d=c),l.remove(),o.replaceWith(n),o.remove(),c=_?c:e("<div></div>").append(e.parseHTML(c)).html(),t=this.get_node(t),this.set_text(t,c),s=!!this.rename_node(t,_?e("<div></div>").text(d).text():e("<div></div>").append(e.parseHTML(d)).html()),s||this.set_text(t,c),this._data.core.focused=u.id,setTimeout(e.proxy(function(){var e=this.get_node(u.id,!0)
|
||||
e.length&&(this._data.core.focused=u.id,e.children(".jstree-anchor").focus())},this),0),i&&i.call(this,u,s,g),void(h=null))},this),keydown:function(e){var t=e.which
|
||||
27===t&&(g=!0,this.value=c),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(l.text("pW"+this.value).width(),a))},keypress:function(e){return 13===e.which?!1:void 0}}),_={fontFamily:n.css("fontFamily")||"",fontSize:n.css("fontSize")||"",fontWeight:n.css("fontWeight")||"",fontStyle:n.css("fontStyle")||"",fontStretch:n.css("fontStretch")||"",fontVariant:n.css("fontVariant")||"",letterSpacing:n.css("letterSpacing")||"",wordSpacing:n.css("wordSpacing")||""},o.attr("class",n.attr("class")).append(n.contents().clone()).append(h),n.replaceWith(o),l.css(_),h.css(_).width(Math.min(l.text("pW"+h[0].value).width(),a))[0].select(),void e(d).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(t){h&&t.target!==h&&e(h).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!1},set_theme:function(t,r){if(!t)return!1
|
||||
if(r===!0){var i=this.settings.core.themes.dir
|
||||
i||(i=e.jstree.path+"/themes"),r=i+"/"+t+"/style.css"}r&&-1===e.inArray(r,n)&&(e("head").append('<link rel="stylesheet" href="'+r+'" type="text/css" />'),n.push(r)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(r,i){var s,a,n,o
|
||||
if(e.isArray(r)){for(r=r.slice(),s=0,a=r.length;a>s;s++)this.set_icon(r[s],i)
|
||||
return!0}return r=this.get_node(r),r&&r.id!==e.jstree.root?(o=r.icon,r.icon=i===!0||null===i||i===t||""===i?!0:i,n=this.get_node(r,!0).children(".jstree-anchor").children(".jstree-themeicon"),i===!1?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),this.hide_icon(r)):i===!0||null===i||i===t||""===i?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),o===!1&&this.show_icon(r)):-1===i.indexOf("/")&&-1===i.indexOf(".")?(n.removeClass(o).css("background",""),n.addClass(i+" jstree-themeicon-custom").attr("rel",i),o===!1&&this.show_icon(r)):(n.removeClass(o).css("background",""),n.addClass("jstree-themeicon-custom").css("background","url('"+i+"') center center no-repeat").attr("rel",i),o===!1&&this.show_icon(r)),!0):!1},get_icon:function(t){return t=this.get_node(t),t&&t.id!==e.jstree.root?t.icon:!1},hide_icon:function(t){var r,i
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.hide_icon(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t!==e.jstree.root?(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(t){var r,i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.show_icon(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t!==e.jstree.root?(s=this.get_node(t,!0),t.icon=s.length?s.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,t.icon||(t.icon=!0),s.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},e.vakata={},e.vakata.attributes=function(t,r){t=e(t)[0]
|
||||
var i=r?{}:[]
|
||||
return t&&t.attributes&&e.each(t.attributes,function(t,s){-1===e.inArray(s.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==s.value&&""!==e.trim(s.value)&&(r?i[s.name]=s.value:i.push(s.name))}),i},e.vakata.array_unique=function(e){var r,i,s=[],a={}
|
||||
for(r=0,i=e.length;i>r;r++)a[e[r]]===t&&(s.push(e[r]),a[e[r]]=!0)
|
||||
return s},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,r){var i=e.inArray(r,t)
|
||||
return-1!==i?e.vakata.array_remove(t,i):t},e.vakata.array_filter=function(e,t,r,i,s){if(e.filter)return e.filter(t,r)
|
||||
i=[]
|
||||
for(s in e)~~s+""==s+""&&s>=0&&t.call(r,e[s],+s,e)&&i.push(e[s])
|
||||
return i},e.jstree.plugins.changed=function(e,t){var r=[]
|
||||
this.trigger=function(e,i){var s,a
|
||||
if(i||(i={}),"changed"===e.replace(".jstree","")){i.changed={selected:[],deselected:[]}
|
||||
var n={}
|
||||
for(s=0,a=r.length;a>s;s++)n[r[s]]=1
|
||||
for(s=0,a=i.selected.length;a>s;s++)n[i.selected[s]]?n[i.selected[s]]=2:i.changed.selected.push(i.selected[s])
|
||||
for(s=0,a=r.length;a>s;s++)1===n[r[s]]&&i.changed.deselected.push(r[s])
|
||||
r=i.selected.slice()}t.trigger.call(this,e,i)},this.refresh=function(e,i){return r=[],t.refresh.apply(this,arguments)}}
|
||||
var h=d.createElement("I")
|
||||
h.className="jstree-icon jstree-checkbox",h.setAttribute("role","presentation"),e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},e.jstree.plugins.checkbox=function(r,i){this.bind=function(){i.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",e.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",e.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy(function(e,t){var r,i,s=this._model.data,a=(s[t.parent],t.nodes)
|
||||
for(r=0,i=a.length;i>r;r++)s[a[r]].state.checked=s[a[r]].state.checked||s[a[r]].original&&s[a[r]].original.state&&s[a[r]].original.state.checked,s[a[r]].state.checked&&this._data.checkbox.selected.push(a[r])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",e.proxy(function(t,r){var i,s,a,n,o,d,c=this._model.data,l=c[r.parent],h=r.nodes,_=[],u=this.settings.checkbox.cascade,g=this.settings.checkbox.tie_selection
|
||||
if(-1!==u.indexOf("down"))if(l.state[g?"selected":"checked"]){for(s=0,a=h.length;a>s;s++)c[h[s]].state[g?"selected":"checked"]=!0
|
||||
this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(h)}else for(s=0,a=h.length;a>s;s++)if(c[h[s]].state[g?"selected":"checked"]){for(n=0,o=c[h[s]].children_d.length;o>n;n++)c[c[h[s]].children_d[n]].state[g?"selected":"checked"]=!0
|
||||
this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(c[h[s]].children_d)}if(-1!==u.indexOf("up")){for(s=0,a=l.children_d.length;a>s;s++)c[l.children_d[s]].children.length||_.push(c[l.children_d[s]].parent)
|
||||
for(_=e.vakata.array_unique(_),n=0,o=_.length;o>n;n++)for(l=c[_[n]];l&&l.id!==e.jstree.root;){for(i=0,s=0,a=l.children.length;a>s;s++)i+=c[l.children[s]].state[g?"selected":"checked"]
|
||||
if(i!==a)break
|
||||
l.state[g?"selected":"checked"]=!0,this._data[g?"core":"checkbox"].selected.push(l.id),d=this.get_node(l,!0),d&&d.length&&d.attr("aria-selected",!0).children(".jstree-anchor").addClass(g?"jstree-clicked":"jstree-checked"),l=this.get_node(l.parent)}}this._data[g?"core":"checkbox"].selected=e.vakata.array_unique(this._data[g?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy(function(t,r){var i,s,a,n,o=r.node,d=this._model.data,c=this.get_node(o.parent),l=this.settings.checkbox.cascade,h=this.settings.checkbox.tie_selection,_={},u=this._data[h?"core":"checkbox"].selected
|
||||
for(i=0,s=u.length;s>i;i++)_[u[i]]=!0
|
||||
if(-1!==l.indexOf("down")){var g=this._cascade_new_checked_state(o.id,!0),f=o.children_d.concat(o.id)
|
||||
for(i=0,s=f.length;s>i;i++)g.indexOf(f[i])>-1?_[f[i]]=!0:delete _[f[i]]}if(-1!==l.indexOf("up"))for(;c&&c.id!==e.jstree.root;){for(a=0,i=0,s=c.children.length;s>i;i++)a+=d[c.children[i]].state[h?"selected":"checked"]
|
||||
if(a!==s)break
|
||||
c.state[h?"selected":"checked"]=!0,_[c.id]=!0,n=this.get_node(c,!0),n&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}u=[]
|
||||
for(i in _)_.hasOwnProperty(i)&&u.push(i)
|
||||
this._data[h?"core":"checkbox"].selected=u},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy(function(t,r){var i,s,a,n=this.get_node(e.jstree.root),o=this._model.data
|
||||
for(i=0,s=n.children_d.length;s>i;i++)a=o[n.children_d[i]],a&&a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy(function(t,r){var i,s,a,n=r.node,o=(this.get_node(n,!0),this.settings.checkbox.cascade),d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,l=n.children_d.concat(n.id)
|
||||
if(-1!==o.indexOf("down")){var h=this._cascade_new_checked_state(n.id,!1)
|
||||
c=e.vakata.array_filter(c,function(e){return-1===l.indexOf(e)||h.indexOf(e)>-1})}if(-1!==o.indexOf("up")&&-1===c.indexOf(n.id)){for(i=0,s=n.parents.length;s>i;i++)a=this._model.data[n.parents[i]],a.state[d?"selected":"checked"]=!1,a&&a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=!1),a=this.get_node(n.parents[i],!0),a&&a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked")
|
||||
c=e.vakata.array_filter(c,function(e){return-1===n.parents.indexOf(e)})}this._data[d?"core":"checkbox"].selected=c},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy(function(t,r){for(var i,s,a,n,o=this.get_node(r.parent),d=this._model.data,c=this.settings.checkbox.tie_selection;o&&o.id!==e.jstree.root&&!o.state[c?"selected":"checked"];){for(a=0,i=0,s=o.children.length;s>i;i++)a+=d[o.children[i]].state[c?"selected":"checked"]
|
||||
if(!(s>0&&a===s))break
|
||||
o.state[c?"selected":"checked"]=!0,this._data[c?"core":"checkbox"].selected.push(o.id),n=this.get_node(o,!0),n&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(c?"jstree-clicked":"jstree-checked"),o=this.get_node(o.parent)}},this)).on("move_node.jstree",e.proxy(function(t,r){var i,s,a,n,o,d=r.is_multi,c=r.old_parent,l=this.get_node(r.parent),h=this._model.data,_=this.settings.checkbox.tie_selection
|
||||
if(!d)for(i=this.get_node(c);i&&i.id!==e.jstree.root&&!i.state[_?"selected":"checked"];){for(s=0,a=0,n=i.children.length;n>a;a++)s+=h[i.children[a]].state[_?"selected":"checked"]
|
||||
if(!(n>0&&s===n))break
|
||||
i.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(i.id),o=this.get_node(i,!0),o&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"),i=this.get_node(i.parent)}for(i=l;i&&i.id!==e.jstree.root;){for(s=0,a=0,n=i.children.length;n>a;a++)s+=h[i.children[a]].state[_?"selected":"checked"]
|
||||
if(s===n)i.state[_?"selected":"checked"]||(i.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(i.id),o=this.get_node(i,!0),o&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"))
|
||||
else{if(!i.state[_?"selected":"checked"])break
|
||||
i.state[_?"selected":"checked"]=!1,this._data[_?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[_?"core":"checkbox"].selected,i.id),o=this.get_node(i,!0),o&&o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass(_?"jstree-clicked":"jstree-checked")}i=this.get_node(i.parent)}},this))},this.get_undetermined=function(r){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[]
|
||||
var i,s,a,n,o={},d=this._model.data,c=this.settings.checkbox.tie_selection,l=this._data[c?"core":"checkbox"].selected,h=[],_=this,u=[]
|
||||
for(i=0,s=l.length;s>i;i++)if(d[l[i]]&&d[l[i]].parents)for(a=0,n=d[l[i]].parents.length;n>a&&o[d[l[i]].parents[a]]===t;a++)d[l[i]].parents[a]!==e.jstree.root&&(o[d[l[i]].parents[a]]=!0,h.push(d[l[i]].parents[a]))
|
||||
for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var r,c=_.get_node(this)
|
||||
if(c)if(c.state.loaded){for(i=0,s=c.children_d.length;s>i;i++)if(r=d[c.children_d[i]],!r.state.loaded&&r.original&&r.original.state&&r.original.state.undetermined&&r.original.state.undetermined===!0)for(o[r.id]===t&&r.id!==e.jstree.root&&(o[r.id]=!0,h.push(r.id)),a=0,n=r.parents.length;n>a;a++)o[r.parents[a]]===t&&r.parents[a]!==e.jstree.root&&(o[r.parents[a]]=!0,h.push(r.parents[a]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&c.original.state.undetermined===!0)for(o[c.id]===t&&c.id!==e.jstree.root&&(o[c.id]=!0,h.push(c.id)),a=0,n=c.parents.length;n>a;a++)o[c.parents[a]]===t&&c.parents[a]!==e.jstree.root&&(o[c.parents[a]]=!0,h.push(c.parents[a]))}),i=0,s=h.length;s>i;i++)d[h[i]].state[c?"selected":"checked"]||u.push(r?d[h[i]]:h[i])
|
||||
return u},this._undetermined=function(){if(null!==this.element){var e,t,r,i=this.get_undetermined(!1)
|
||||
for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,t=i.length;t>e;e++)r=this.get_node(i[e],!0),r&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,r,s,a){if(t=i.redraw_node.apply(this,arguments)){var n,o,d=null,c=null
|
||||
for(n=0,o=t.childNodes.length;o>n;n++)if(t.childNodes[n]&&t.childNodes[n].className&&-1!==t.childNodes[n].className.indexOf("jstree-anchor")){d=t.childNodes[n]
|
||||
break}d&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(d.className+=" jstree-checked"),c=h.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(c.className+=" jstree-checkbox-disabled"),d.insertBefore(c,d.childNodes[0]))}return s||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(t){t=this.get_node(t)
|
||||
var r,i,s=this.settings.checkbox.cascade,a=this.settings.checkbox.tie_selection,n=this._data[a?"core":"checkbox"].selected,o=this._model.data
|
||||
if(!t||t.state[a?"selected":"checked"]===!0||-1===s.indexOf("undetermined")||-1===s.indexOf("down")&&-1===s.indexOf("up"))return!1
|
||||
if(!t.state.loaded&&t.original.state.undetermined===!0)return!0
|
||||
for(r=0,i=t.children_d.length;i>r;r++)if(-1!==e.inArray(t.children_d[r],n)||!o[t.children_d[r]].state.loaded&&o[t.children_d[r]].original.state.undetermined)return!0
|
||||
return!1},this.disable_checkbox=function(t){var r,i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.disable_checkbox(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(s=this.get_node(t,!0),void(t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t})))):!1},this.enable_checkbox=function(t){var r,i,s
|
||||
if(e.isArray(t)){for(t=t.slice(),r=0,i=t.length;i>r;r++)this.enable_checkbox(t[r])
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(s=this.get_node(t,!0),void(t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t})))):!1},this.activate_node=function(t,r){return e(r.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(r.target).hasClass("jstree-checkbox"))&&(r.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(r.target).hasClass("jstree-checkbox")?i.activate_node.call(this,t,r):this.is_disabled(t)?!1:(this.is_checked(t)?this.uncheck_node(t,r):this.check_node(t,r),void this.trigger("activate_node",{node:this.get_node(t)})))},this._cascade_new_checked_state=function(e,t){var r,i,s,a=this,n=this.settings.checkbox.tie_selection,o=this._model.data[e],d=[],c=[]
|
||||
if(!this.settings.checkbox.cascade_to_disabled&&o.state.disabled||!this.settings.checkbox.cascade_to_hidden&&o.state.hidden)s=this.get_checked_descendants(e),o.state[n?"selected":"checked"]&&s.push(o.id),d=d.concat(s)
|
||||
else{if(o.children)for(r=0,i=o.children.length;i>r;r++){var l=o.children[r]
|
||||
s=a._cascade_new_checked_state(l,t),d=d.concat(s),s.indexOf(l)>-1&&c.push(l)}var h=a.get_node(o,!0),_=c.length>0&&c.length<o.children.length
|
||||
o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=_),_?(o.state[n?"selected":"checked"]=!1,h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(n?"jstree-clicked":"jstree-checked")):t&&c.length===o.children.length?(o.state[n?"selected":"checked"]=t,d.push(o.id),h.attr("aria-selected",!0).children(".jstree-anchor").addClass(n?"jstree-clicked":"jstree-checked")):(o.state[n?"selected":"checked"]=!1,h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(n?"jstree-clicked":"jstree-checked"))}return d},this.get_checked_descendants=function(r,i){(null===i||i===t)&&(i=!0)
|
||||
var s=this,a=s.settings.checkbox.tie_selection,n=s._model.data[r]
|
||||
return e.vakata.array_filter(i===!0?n.children_d:n.children,function(e){return s._model.data[e].state[a?"selected":"checked"]})},this.check_node=function(t,r){if(this.settings.checkbox.tie_selection)return this.select_node(t,!1,!0,r)
|
||||
var i,s,a
|
||||
if(e.isArray(t)){for(t=t.slice(),s=0,a=t.length;a>s;s++)this.check_node(t[s],r)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(i=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),i&&i.length&&i.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:r})))):!1},this.uncheck_node=function(t,r){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,r)
|
||||
var i,s,a
|
||||
if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.uncheck_node(t[i],r)
|
||||
return!0}return t=this.get_node(t),t&&t.id!==e.jstree.root?(a=this.get_node(t,!0),void(t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),a.length&&a.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:r})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all()
|
||||
var t,r
|
||||
this._data.checkbox.selected.concat([])
|
||||
for(this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),t=0,r=this._data.checkbox.selected.length;r>t;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0)
|
||||
this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all()
|
||||
var e,t,r=this._data.checkbox.selected.concat([])
|
||||
for(e=0,t=this._data.checkbox.selected.length;t>e;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!1)
|
||||
this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:r})},this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):(t=this.get_node(t),t&&t.id!==e.jstree.root?t.state.checked:!1)},this.get_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_selected(t)
|
||||
var r=e.map(this._data.checkbox.selected,e.proxy(function(e){return this.get_node(e)},this)),i=this._data.checkbox.selected.slice()
|
||||
return t?r:i},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t)
|
||||
var r,i,s,a,n=this.get_checked(!0),o={}
|
||||
for(r=0,i=n.length;i>r;r++)o[n[r].id]=n[r]
|
||||
for(r=0,i=n.length;i>r;r++)for(s=0,a=n[r].children_d.length;a>s;s++)o[n[r].children_d[s]]&&delete o[n[r].children_d[s]]
|
||||
n=[]
|
||||
for(r in o)o.hasOwnProperty(r)&&n.push(r)
|
||||
return t?e.map(n,e.proxy(function(e){return this.get_node(e)},this)):n},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t)
|
||||
var r,i,s=this.get_checked(!0),a=[]
|
||||
for(r=0,i=s.length;i>r;r++)s[r].children.length||a.push(s[r].id)
|
||||
return t?e.map(a,e.proxy(function(e){return this.get_node(e)},this)):a},this.load_node=function(t,r){var s,a,n,o
|
||||
if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(o=this.get_node(t),o&&o.state.loaded))for(s=0,a=o.children_d.length;a>s;s++)this._model.data[o.children_d[s]].state.checked&&(n=!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,o.children_d[s]))
|
||||
return i.load_node.apply(this,arguments)},this.get_state=function(){var e=i.get_state.apply(this,arguments)
|
||||
return this.settings.checkbox.tie_selection?e:(e.checkbox=this._data.checkbox.selected.slice(),e)},this.set_state=function(t,r){var s=i.set_state.apply(this,arguments)
|
||||
if(s&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all()
|
||||
var a=this
|
||||
e.each(t.checkbox,function(e,t){a.check_node(t)})}return delete t.checkbox,this.set_state(t,r),!1}return s},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),i.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,r){return this.settings.conditionalselect.call(this,this.get_node(e),r)?t.activate_node.call(this,e,r):void 0}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,r){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.create_node(i,{},"last",function(e){try{r.edit(e)}catch(t){setTimeout(function(){r.edit(e)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.edit(i)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.is_selected(i)?r.delete_node(r.get_selected()):r.delete_node(i)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.is_selected(i)?r.cut(r.get_top_selected()):r.cut(i)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.is_selected(i)?r.copy(r.get_top_selected()):r.copy(i)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference)
|
||||
r.paste(i)}}}}}}},e.jstree.plugins.contextmenu=function(r,i){this.bind=function(){i.bind.call(this)
|
||||
var t,r,s=0,a=null
|
||||
this.element.on("init.jstree loading.jstree ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),s=e.ctrlKey?+new Date:0,(t||a)&&(s=+new Date+1e4),a&&clearTimeout(a),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){this._data.contextmenu.visible&&(!s||+new Date-s>250)&&e.vakata.context.hide(),s=0},this)).on("touchstart.jstree",".jstree-anchor",function(i){i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(t=i.originalEvent.changedTouches[0].clientX,r=i.originalEvent.changedTouches[0].clientY,a=setTimeout(function(){e(i.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(i){a&&i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(Math.abs(t-i.originalEvent.changedTouches[0].clientX)>10||Math.abs(r-i.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(a),e.vakata.context.hide())}).on("touchend.vakata.jstree",function(e){a&&clearTimeout(a)}),e(d).on("context_hide.vakata.jstree",e.proxy(function(t,r){this._data.contextmenu.visible=!1,e(r.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(r,i,s,a){if(r=this.get_node(r),!r||r.id===e.jstree.root)return!1
|
||||
var n=this.settings.contextmenu,o=this.get_node(r,!0),d=o.children(".jstree-anchor"),c=!1,l=!1;(n.show_at_node||i===t||s===t)&&(c=d.offset(),i=c.left,s=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(r)&&this.activate_node(r,a),l=n.items,e.isFunction(l)&&(l=l.call(this,r,e.proxy(function(e){this._show_contextmenu(r,i,s,e)},this))),e.isPlainObject(l)&&this._show_contextmenu(r,i,s,l)},this._show_contextmenu=function(t,r,i,s){var a=this.get_node(t,!0),n=a.children(".jstree-anchor")
|
||||
e(d).one("context_show.vakata.jstree",e.proxy(function(t,r){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu"
|
||||
e(r.element).addClass(i),n.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(n,{x:r,y:i},s),this.trigger("show_contextmenu",{node:t,x:r,y:i})}},function(e){var t=!1,r={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1}
|
||||
e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(d).triggerHandler("context_"+t+".vakata",{reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}})},_execute:function(t){return t=r.items[t],t&&(!t._disabled||e.isFunction(t._disabled)&&!t._disabled({item:t,reference:r.reference,element:r.element}))&&t.action?t.action.call(null,{item:t,reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}}):!1},_parse:function(t,i){if(!t)return!1
|
||||
i||(r.html="",r.items=[])
|
||||
var s,a="",n=!1
|
||||
return i&&(a+="<ul>"),e.each(t,function(t,i){return i?(r.items.push(i),!n&&i.separator_before&&(a+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>"),n=!1,a+="<li class='"+(i._class||"")+(i._disabled===!0||e.isFunction(i._disabled)&&i._disabled({item:i,reference:r.reference,element:r.element})?" vakata-contextmenu-disabled ":"")+"' "+(i.shortcut?" data-shortcut='"+i.shortcut+"' ":"")+">",a+="<a href='#' rel='"+(r.items.length-1)+"' "+(i.title?"title='"+i.title+"'":"")+">",e.vakata.context.settings.icons&&(a+="<i ",i.icon&&(a+=-1!==i.icon.indexOf("/")||-1!==i.icon.indexOf(".")?" style='background:url(\""+i.icon+"\") center center no-repeat' ":" class='"+i.icon+"' "),a+="></i><span class='vakata-contextmenu-sep'> </span>"),a+=(e.isFunction(i.label)?i.label({item:t,reference:r.reference,element:r.element}):i.label)+(i.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+i.shortcut+'">'+(i.shortcut_label||"")+"</span>":"")+"</a>",i.submenu&&(s=e.vakata.context._parse(i.submenu,!0),s&&(a+=s)),a+="</li>",void(i.separator_after&&(a+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>",n=!0))):!0}),a=a.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),i&&(a+="</ul>"),i||(r.html=a,e.vakata.context._trigger("parse")),a.length>10?a:!1},_show_submenu:function(r){if(r=e(r),r.length&&r.children("ul").length){var i=r.children("ul"),s=r.offset().left,a=s+r.outerWidth(),n=r.offset().top,o=i.width(),d=i.height(),c=e(window).width()+e(window).scrollLeft(),l=e(window).height()+e(window).scrollTop()
|
||||
t?r[a-(o+10+r.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):r[a+o>c&&s>c-a?"addClass":"removeClass"]("vakata-context-right"),n+d+10>l&&i.css("bottom","-1px"),r.hasClass("vakata-context-right")?o>s&&i.css("margin-right",s-o):o>c-a&&i.css("margin-left",c-a-o),i.show()}},show:function(i,s,a){var n,o,c,l,h,_,u,g,f=!0
|
||||
switch(r.element&&r.element.length&&r.element.width(""),f){case!s&&!i:return!1
|
||||
case!!s&&!!i:r.reference=i,r.position_x=s.x,r.position_y=s.y
|
||||
break
|
||||
case!s&&!!i:r.reference=i,n=i.offset(),r.position_x=n.left+i.outerHeight(),r.position_y=n.top
|
||||
break
|
||||
case!!s&&!i:r.position_x=s.x,r.position_y=s.y}i&&!a&&e(i).data("vakata_contextmenu")&&(a=e(i).data("vakata_contextmenu")),e.vakata.context._parse(a)&&r.element.html(r.html),r.items.length&&(r.element.appendTo(d.body),o=r.element,c=r.position_x,l=r.position_y,h=o.width(),_=o.height(),u=e(window).width()+e(window).scrollLeft(),g=e(window).height()+e(window).scrollTop(),t&&(c-=o.outerWidth()-e(i).outerWidth(),c<e(window).scrollLeft()+20&&(c=e(window).scrollLeft()+20)),c+h+20>u&&(c=u-(h+20)),l+_+20>g&&(l=g-(_+20)),r.element.css({left:c,top:l}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),r.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){r.is_visible&&(r.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),r.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){t="rtl"===e(d.body).css("direction")
|
||||
var i=!1
|
||||
r.element=e("<ul class='vakata-context'></ul>"),r.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(i&&clearTimeout(i),r.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(i=setTimeout(function(t){return function(){e.vakata.context.hide()}}(this),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||e.vakata.context._execute(e(this).attr("rel"))===!1||e.vakata.context.hide()}).on("keydown","a",function(t){var i=null
|
||||
switch(t.which){case 13:case 32:t.type="click",t.preventDefault(),e(t.currentTarget).trigger(t)
|
||||
break
|
||||
case 37:r.is_visible&&(r.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault())
|
||||
break
|
||||
case 38:r.is_visible&&(i=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),i.length||(i=r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault())
|
||||
break
|
||||
case 39:r.is_visible&&(r.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault())
|
||||
break
|
||||
case 40:r.is_visible&&(i=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),i.length||(i=r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault())
|
||||
break
|
||||
case 27:e.vakata.context.hide(),t.preventDefault()}}).on("keydown",function(e){e.preventDefault()
|
||||
var t=r.element.find(".vakata-contextmenu-shortcut-"+e.which).parent()
|
||||
t.parent().not(".vakata-context-disabled")&&t.click()}),e(d).on("mousedown.vakata.jstree",function(t){r.is_visible&&r.element[0]!==t.target&&!e.contains(r.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata.jstree",function(e,i){r.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&r.element.addClass("vakata-context-rtl").css("direction","rtl"),r.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1}
|
||||
var _,u
|
||||
e.jstree.plugins.dnd=function(t,r){this.init=function(e,t){r.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in d.createElement("span")},this.bind=function(){r.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",e.proxy(function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0
|
||||
if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0
|
||||
var r=this.get_node(t.target),i=this.is_selected(r)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,s=i>1?i+" "+this.get_string("nodes"):this.get_text(t.currentTarget)
|
||||
if(this.settings.core.force_text&&(s=e.vakata.html.escape(s)),r&&r.id&&r.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(this.settings.dnd.is_draggable===!0||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i>1?this.get_top_selected(!0):[r],t))){if(_={jstree:!0,origin:this,obj:this.get_node(r,!0),nodes:i>1?this.get_top_selected():[r.id]},u=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,_,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+s+'<ins class="jstree-copy" style="display:none;">+</ins></div>')
|
||||
e.vakata.dnd._trigger("start",t,{helper:e(),element:u,data:_})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:_}),!1}).on("drop.jstree",e.proxy(function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:_}),!1},this))},this.redraw_node=function(e,t,i,s){if(e=r.redraw_node.apply(this,arguments),e&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0)
|
||||
else{var a,n,o=null
|
||||
for(a=0,n=e.childNodes.length;n>a;a++)if(e.childNodes[a]&&e.childNodes[a].className&&-1!==e.childNodes[a].className.indexOf("jstree-anchor")){o=e.childNodes[a]
|
||||
break}o&&o.setAttribute("draggable",!0)}return e}},e(function(){var r=!1,i=!1,s=!1,a=!1,n=e('<div id="jstree-marker"> </div>').hide()
|
||||
e(d).on("dragover.vakata.jstree",function(t){u&&e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:_})}).on("drop.vakata.jstree",function(t){u&&(e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:_}),u=null,_=null)}).on("dnd_start.vakata.jstree",function(e,t){r=!1,s=!1,t&&t.data&&t.data.jstree&&n.appendTo(d.body)}).on("dnd_move.vakata.jstree",function(o,d){var c=d.event.target!==s.target
|
||||
if(a&&(!d.event||"dragover"!==d.event.type||c)&&clearTimeout(a),d&&d.data&&d.data.jstree&&(!d.event.target.id||"jstree-marker"!==d.event.target.id)){s=d.event
|
||||
var l,h,_,u,g,f,p,m,v,j,y,k,x,b,w,C,A=e.jstree.reference(d.event.target),T=!1,N=!1,O=!1
|
||||
if(A&&A._data&&A._data.dnd)if(n.attr("class","jstree-"+A.get_theme()+(A.settings.core.themes.responsive?" jstree-dnd-responsive":"")),w=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey)),d.helper.children().attr("class","jstree-"+A.get_theme()+" jstree-"+A.get_theme()+"-"+A.get_theme_variant()+" "+(A.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[w?"show":"hide"](),d.event.target!==A.element[0]&&d.event.target!==A.get_container_ul()[0]||0!==A.get_container_ul().children().length){if(T=A.settings.dnd.large_drop_target?e(d.event.target).closest(".jstree-node").children(".jstree-anchor"):e(d.event.target).closest(".jstree-anchor"),T&&T.length&&T.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(N=T.offset(),O=(d.event.pageY!==t?d.event.pageY:d.event.originalEvent.pageY)-N.top,_=T.outerHeight(),f=_/3>O?["b","i","a"]:O>_-_/3?["a","i","b"]:O>_/2?["i","a","b"]:["i","b","a"],e.each(f,function(t,s){switch(s){case"b":l=N.left-6,h=N.top,u=A.get_parent(T),g=T.parent().index()
|
||||
break
|
||||
case"i":x=A.settings.dnd.inside_pos,b=A.get_node(T.parent()),l=N.left-2,h=N.top+_/2+1,u=b.id,g="first"===x?0:"last"===x?b.children.length:Math.min(x,b.children.length)
|
||||
break
|
||||
case"a":l=N.left-6,h=N.top+_,u=A.get_parent(T),g=T.parent().index()+1}for(p=!0,m=0,v=d.data.nodes.length;v>m;m++)if(j=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",y=g,"move_node"===j&&"a"===s&&d.data.origin&&d.data.origin===A&&u===A.get_parent(d.data.nodes[m])&&(k=A.get_node(u),y>e.inArray(d.data.nodes[m],k.children)&&(y-=1)),p=p&&(A&&A.settings&&A.settings.dnd&&A.settings.dnd.check_while_dragging===!1||A.check(j,d.data.origin&&d.data.origin!==A?d.data.origin.get_node(d.data.nodes[m]):d.data.nodes[m],u,y,{dnd:!0,ref:A.get_node(T.parent()),pos:s,origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==A,is_foreign:!d.data.origin})),!p){A&&A.last_error&&(i=A.last_error())
|
||||
break}return"i"===s&&T.parent().is(".jstree-closed")&&A.settings.dnd.open_timeout&&(!d.event||"dragover"!==d.event.type||c)&&(a&&clearTimeout(a),a=setTimeout(function(e,t){return function(){e.open_node(t)}}(A,T),A.settings.dnd.open_timeout)),p?(C=A.get_node(u,!0),C.hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),C.addClass("jstree-dnd-parent")),r={ins:A,par:u,pos:"i"!==s||"last"!==x||0!==g||A.is_loaded(b)?g:"last"},n.css({left:l+"px",top:h+"px"}).show(),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"),i={},f=!0,!1):void 0}),f===!0))return}else{for(p=!0,m=0,v=d.data.nodes.length;v>m&&(p=p&&A.check(d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",d.data.origin&&d.data.origin!==A?d.data.origin.get_node(d.data.nodes[m]):d.data.nodes[m],e.jstree.root,"last",{dnd:!0,ref:A.get_node(e.jstree.root),pos:"i",origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==A,is_foreign:!d.data.origin}),p);m++);if(p)return r={ins:A,par:e.jstree.root,pos:"last"},n.hide(),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=w?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),r=!1,d.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),d.event.originalEvent&&d.event.originalEvent.dataTransfer,n.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(n.hide(),r=!1,s=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(t,o){if(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),a&&clearTimeout(a),o&&o.data&&o.data.jstree){n.hide().detach()
|
||||
var d,c,l=[]
|
||||
if(r){for(d=0,c=o.data.nodes.length;c>d;d++)l[d]=o.data.origin?o.data.origin.get_node(o.data.nodes[d]):o.data.nodes[d]
|
||||
r.ins[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node"](l,r.par,r.pos,!1,!1,!1,o.data.origin)}else d=e(o.event.target).closest(".jstree"),d.length&&i&&i.error&&"check"===i.error&&(d=d.jstree(!0),d&&d.settings.core.error.call(this,i))
|
||||
s=!1,r=!1}}).on("keyup.jstree keydown.jstree",function(t,o){o=e.vakata.dnd._get(),o&&o.data&&o.data.jstree&&("keyup"===t.type&&27===t.which?(a&&clearTimeout(a),r=!1,i=!1,s=!1,a=!1,n.hide().detach(),e.vakata.dnd._clean()):(o.helper.find(".jstree-copy").first()[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),s&&(s.metaKey=t.metaKey,s.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",s))))})}),function(e){e.vakata.html={div:e("<div />"),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}}
|
||||
var r={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1}
|
||||
e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(r,i,s){s===t&&(s=e.vakata.dnd._get()),s.event=i,e(d).triggerHandler("dnd_"+r+".vakata",s)},_get:function(){return{data:r.data,element:r.element,helper:r.helper}},_clean:function(){r.helper&&r.helper.remove(),r.scroll_i&&(clearInterval(r.scroll_i),r.scroll_i=!1),r={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},e(d).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(d).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!r.scroll_e||!r.scroll_l&&!r.scroll_t)return r.scroll_i&&(clearInterval(r.scroll_i),r.scroll_i=!1),!1
|
||||
if(!r.scroll_i)return r.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1
|
||||
if(t===!0)return!1
|
||||
var i=r.scroll_e.scrollTop(),s=r.scroll_e.scrollLeft()
|
||||
r.scroll_e.scrollTop(i+r.scroll_t*e.vakata.dnd.settings.scroll_speed),r.scroll_e.scrollLeft(s+r.scroll_l*e.vakata.dnd.settings.scroll_speed),(i!==r.scroll_e.scrollTop()||s!==r.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",r.scroll_e)},start:function(t,i,s){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_drag&&e.vakata.dnd.stop({})
|
||||
try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(a){}return r.init_x=t.pageX,r.init_y=t.pageY,r.data=i,r.is_down=!0,r.element=t.currentTarget,r.target=t.target,r.is_touch="touchstart"===t.type,s!==!1&&(r.helper=e("<div id='vakata-dnd'></div>").html(s).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(d).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(d).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_down){if(!r.is_drag){if(!(Math.abs(t.pageX-r.init_x)>(r.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-r.init_y)>(r.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return
|
||||
r.helper&&(r.helper.appendTo(d.body),r.helper_w=r.helper.outerWidth()),r.is_drag=!0,e(r.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var i=!1,s=!1,a=!1,n=!1,o=!1,c=!1,l=!1,h=!1,_=!1,u=!1
|
||||
return r.scroll_t=0,r.scroll_l=0,r.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var i=e(this),s=i.offset()
|
||||
return this.scrollHeight>this.offsetHeight&&(s.top+i.height()-t.pageY<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=1),t.pageY-s.top<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(s.left+i.width()-t.pageX<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=1),t.pageX-s.left<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=-1)),r.scroll_t||r.scroll_l?(r.scroll_e=e(this),!1):void 0}),r.scroll_e||(i=e(d),s=e(window),a=i.height(),n=s.height(),o=i.width(),c=s.width(),l=i.scrollTop(),h=i.scrollLeft(),a>n&&t.pageY-l<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=-1),a>n&&n-(t.pageY-l)<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=1),o>c&&t.pageX-h<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=-1),o>c&&c-(t.pageX-h)<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=1),(r.scroll_t||r.scroll_l)&&(r.scroll_e=i)),r.scroll_e&&e.vakata.dnd._scroll(!0),r.helper&&(_=parseInt(t.pageY+e.vakata.dnd.settings.helper_top,10),u=parseInt(t.pageX+e.vakata.dnd.settings.helper_left,10),a&&_+25>a&&(_=a-50),o&&u+r.helper_w>o&&(u=o-(r.helper_w+2)),r.helper.css({left:u+"px",top:_+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_drag)t.target!==r.target&&e(r.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t)
|
||||
else if("touchend"===t.type&&t.target===r.target){var i=setTimeout(function(){e(t.target).click()},100)
|
||||
e(t.target).one("click",function(){i&&clearTimeout(i)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,r){this.init=function(e,t){this._data.massload={},r.init.call(this,e,t)},this._load_nodes=function(t,i,s,a){var n,o,d,c=this.settings.massload,l=(JSON.stringify(t),[]),h=this._model.data
|
||||
if(!s){for(n=0,o=t.length;o>n;n++)(!h[t[n]]||!h[t[n]].state.loaded&&!h[t[n]].state.failed||a)&&(l.push(t[n]),d=this.get_node(t[n],!0),d&&d.length&&d.addClass("jstree-loading").attr("aria-busy",!0))
|
||||
if(this._data.massload={},l.length){if(e.isFunction(c))return c.call(this,l,e.proxy(function(e){var n,o
|
||||
if(e)for(n in e)e.hasOwnProperty(n)&&(this._data.massload[n]=e[n])
|
||||
for(n=0,o=t.length;o>n;n++)d=this.get_node(t[n],!0),d&&d.length&&d.removeClass("jstree-loading").attr("aria-busy",!1)
|
||||
r._load_nodes.call(this,t,i,s,a)},this))
|
||||
if("object"==typeof c&&c&&c.url)return c=e.extend(!0,{},c),e.isFunction(c.url)&&(c.url=c.url.call(this,l)),e.isFunction(c.data)&&(c.data=c.data.call(this,l)),e.ajax(c).done(e.proxy(function(e,n,o){var c,l
|
||||
if(e)for(c in e)e.hasOwnProperty(c)&&(this._data.massload[c]=e[c])
|
||||
for(c=0,l=t.length;l>c;c++)d=this.get_node(t[c],!0),d&&d.length&&d.removeClass("jstree-loading").attr("aria-busy",!1)
|
||||
r._load_nodes.call(this,t,i,s,a)},this)).fail(e.proxy(function(e){r._load_nodes.call(this,t,i,s,a)},this))}}return r._load_nodes.call(this,t,i,s,a)},this._load_node=function(t,i){var s,a=this._data.massload[t.id],n=null
|
||||
return a?(n=this["string"==typeof a?"_append_html_data":"_append_json_data"](t,"string"==typeof a?e(e.parseHTML(a)).filter(function(){return 3!==this.nodeType}):a,function(e){i.call(this,e)}),s=this.get_node(t.id,!0),s&&s.length&&s.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],n):r._load_node.call(this,t,i)}},e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(r,i){this.bind=function(){i.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",e.proxy(function(t,r){if(this._data.search.som&&r.res.length){var i,s,a,n,o=this._model.data,d=[]
|
||||
for(i=0,s=r.res.length;s>i;i++)if(o[r.res[i]]&&!o[r.res[i]].state.hidden&&(d.push(r.res[i]),d=d.concat(o[r.res[i]].parents),this._data.search.smc))for(a=0,n=o[r.res[i]].children_d.length;n>a;a++)o[o[r.res[i]].children_d[a]]&&!o[o[r.res[i]].children_d[a]].state.hidden&&d.push(o[r.res[i]].children_d[a])
|
||||
d=e.vakata.array_remove_item(e.vakata.array_unique(d),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(d,!0),this.redraw(!0)}},this)).on("clear_search.jstree",e.proxy(function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(r,i,s,a,n,o){if(r===!1||""===e.trim(r.toString()))return this.clear_search()
|
||||
a=this.get_node(a),a=a&&a.id?a.id:null,r=r.toString()
|
||||
var d,c,l=this.settings.search,h=l.ajax?l.ajax:!1,_=this._model.data,u=null,g=[],f=[]
|
||||
if(this._data.search.res.length&&!n&&this.clear_search(),s===t&&(s=l.show_only_matches),o===t&&(o=l.show_only_matches_children),!i&&h!==!1)return e.isFunction(h)?h.call(this,r,e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(r,!0,s,a,n,o)})},this),a):(h=e.extend({},h),h.data||(h.data={}),h.data.str=r,a&&(h.data.inside=a),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=e.ajax(h).fail(e.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(h)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(r,!0,s,a,n,o)})},this)),this._data.search.lastRequest)
|
||||
if(n||(this._data.search.str=r,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=s,this._data.search.smc=o),u=new e.vakata.search(r,!0,{caseSensitive:l.case_sensitive,fuzzy:l.fuzzy}),e.each(_[a?a:e.jstree.root].children_d,function(e,t){var i=_[t]
|
||||
i.text&&!i.state.hidden&&(!l.search_leaves_only||i.state.loaded&&0===i.children.length)&&(l.search_callback&&l.search_callback.call(this,r,i)||!l.search_callback&&u.search(i.text).isMatch)&&(g.push(t),f=f.concat(i.parents))}),g.length){for(f=e.vakata.array_unique(f),d=0,c=f.length;c>d;d++)f[d]!==e.jstree.root&&_[f[d]]&&this.open_node(f[d],null,0)===!0&&this._data.search.opn.push(f[d])
|
||||
n?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(g,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(g))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(g,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=g),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:r,res:this._data.search.res,show_only_matches:s})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this.redraw_node=function(t,r,s,a){if(t=i.redraw_node.apply(this,arguments),t&&-1!==e.inArray(t.id,this._data.search.res)){var n,o,d=null
|
||||
for(n=0,o=t.childNodes.length;o>n;n++)if(t.childNodes[n]&&t.childNodes[n].className&&-1!==t.childNodes[n].className.indexOf("jstree-anchor")){d=t.childNodes[n]
|
||||
break}d&&(d.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,r,i){i=i||{},i=e.extend({},e.vakata.search.defaults,i),i.fuzzy!==!1&&(i.fuzzy=!0),t=i.caseSensitive?t:t.toLowerCase()
|
||||
var s,a,n,o,d=i.location,c=i.distance,l=i.threshold,h=t.length
|
||||
return h>32&&(i.fuzzy=!1),i.fuzzy&&(s=1<<h-1,a=function(){var e={},r=0
|
||||
for(r=0;h>r;r++)e[t.charAt(r)]=0
|
||||
for(r=0;h>r;r++)e[t.charAt(r)]|=1<<h-r-1
|
||||
return e}(),n=function(e,t){var r=e/h,i=Math.abs(d-t)
|
||||
return c?r+i/c:i?1:r}),o=function(e){if(e=i.caseSensitive?e:e.toLowerCase(),t===e||-1!==e.indexOf(t))return{isMatch:!0,score:0}
|
||||
if(!i.fuzzy)return{isMatch:!1,score:1}
|
||||
var r,o,c,_,u,g,f,p,m,v=e.length,j=l,y=e.indexOf(t,d),k=h+v,x=1,b=[]
|
||||
for(-1!==y&&(j=Math.min(n(0,y),j),y=e.lastIndexOf(t,d+h),-1!==y&&(j=Math.min(n(0,y),j))),y=-1,r=0;h>r;r++){for(c=0,_=k;_>c;)n(r,d+_)<=j?c=_:k=_,_=Math.floor((k-c)/2+c)
|
||||
for(k=_,g=Math.max(1,d-_+1),f=Math.min(d+_,v)+h,p=new Array(f+2),p[f+1]=(1<<r)-1,o=f;o>=g;o--)if(m=a[e.charAt(o-1)],0===r?p[o]=(p[o+1]<<1|1)&m:p[o]=(p[o+1]<<1|1)&m|((u[o+1]|u[o])<<1|1)|u[o+1],p[o]&s&&(x=n(r,o-1),j>=x)){if(j=x,y=o-1,b.push(y),!(y>d))break
|
||||
g=Math.max(1,2*d-y)}if(n(r+1,d)>j)break
|
||||
u=p}return{isMatch:y>=0,score:x}},r===!0?{search:o}:o(r)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,r){this.bind=function(){r.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,r){var i,s
|
||||
if(t=this.get_node(t),t&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),r))for(i=0,s=t.children_d.length;s>i;i++)this.sort(t.children_d[i],!1)}}
|
||||
var g=!1
|
||||
e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},e.jstree.plugins.state=function(t,r){this.bind=function(){r.bind.call(this)
|
||||
var t=e.proxy(function(){this.element.on(this.settings.state.events,e.proxy(function(){g&&clearTimeout(g),g=setTimeout(e.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this)
|
||||
this.element.on("ready.jstree",e.proxy(function(e,r){this.element.one("restore_state.jstree",t),this.restore_state()||t()},this))},this.save_state=function(){var t=this.get_state()
|
||||
this.settings.state.preserve_loaded||delete t.core.loaded
|
||||
var r={state:t,ttl:this.settings.state.ttl,sec:+new Date}
|
||||
e.vakata.storage.set(this.settings.state.key,JSON.stringify(r))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key)
|
||||
if(t)try{t=JSON.parse(t)}catch(r){return!1}return t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl?!1:(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),t?(this.settings.state.preserve_loaded||delete t.core.loaded,this.element.one("set_state.jstree",function(r,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0):!1)},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={"default":{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(r,i){this.init=function(r,s){var a,n
|
||||
if(s&&s.types&&s.types["default"])for(a in s.types)if("default"!==a&&a!==e.jstree.root&&s.types.hasOwnProperty(a))for(n in s.types["default"])s.types["default"].hasOwnProperty(n)&&s.types[a][n]===t&&(s.types[a][n]=s.types["default"][n])
|
||||
i.init.call(this,r,s),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,r){i.refresh.call(this,t,r),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy(function(r,i){var s,a,n,o=this._model.data,d=i.nodes,c=this.settings.types,l="default"
|
||||
for(s=0,a=d.length;a>s;s++){if(l="default",o[d[s]].original&&o[d[s]].original.type&&c[o[d[s]].original.type]&&(l=o[d[s]].original.type),o[d[s]].data&&o[d[s]].data.jstree&&o[d[s]].data.jstree.type&&c[o[d[s]].data.jstree.type]&&(l=o[d[s]].data.jstree.type),o[d[s]].type=l,o[d[s]].icon===!0&&c[l].icon!==t&&(o[d[s]].icon=c[l].icon),c[l].li_attr!==t&&"object"==typeof c[l].li_attr)for(n in c[l].li_attr)if(c[l].li_attr.hasOwnProperty(n)){if("id"===n)continue
|
||||
o[d[s]].li_attr[n]===t?o[d[s]].li_attr[n]=c[l].li_attr[n]:"class"===n&&(o[d[s]].li_attr["class"]=c[l].li_attr["class"]+" "+o[d[s]].li_attr["class"])}if(c[l].a_attr!==t&&"object"==typeof c[l].a_attr)for(n in c[l].a_attr)if(c[l].a_attr.hasOwnProperty(n)){if("id"===n)continue
|
||||
o[d[s]].a_attr[n]===t?o[d[s]].a_attr[n]=c[l].a_attr[n]:"href"===n&&"#"===o[d[s]].a_attr[n]?o[d[s]].a_attr.href=c[l].a_attr.href:"class"===n&&(o[d[s]].a_attr["class"]=c[l].a_attr["class"]+" "+o[d[s]].a_attr["class"])}}o[e.jstree.root].type=e.jstree.root},this)),i.bind.call(this)},this.get_json=function(t,r,s){var a,n,o=this._model.data,d=r?e.extend(!0,{},r,{no_id:!1}):{},c=i.get_json.call(this,t,d,s)
|
||||
if(c===!1)return!1
|
||||
if(e.isArray(c))for(a=0,n=c.length;n>a;a++)c[a].type=c[a].id&&o[c[a].id]&&o[c[a].id].type?o[c[a].id].type:"default",r&&r.no_id&&(delete c[a].id,c[a].li_attr&&c[a].li_attr.id&&delete c[a].li_attr.id,c[a].a_attr&&c[a].a_attr.id&&delete c[a].a_attr.id)
|
||||
else c.type=c.id&&o[c.id]&&o[c.id].type?o[c.id].type:"default",r&&r.no_id&&(c=this._delete_ids(c))
|
||||
return c},this._delete_ids=function(t){if(e.isArray(t)){for(var r=0,i=t.length;i>r;r++)t[r]=this._delete_ids(t[r])
|
||||
return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(r,s,a,n,o){if(i.check.call(this,r,s,a,n,o)===!1)return!1
|
||||
s=s&&s.id?s:this.get_node(s),a=a&&a.id?a:this.get_node(a)
|
||||
var d,c,l,h,_=s&&s.id?o&&o.origin?o.origin:e.jstree.reference(s.id):null
|
||||
switch(_=_&&_._model&&_._model.data?_._model.data:null,r){case"create_node":case"move_node":case"copy_node":if("move_node"!==r||-1===e.inArray(s.id,a.children)){if(d=this.get_rules(a),d.max_children!==t&&-1!==d.max_children&&d.max_children===a.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:s&&s.id?s.id:!1,par:a&&a.id?a.id:!1})},!1
|
||||
if(d.valid_children!==t&&-1!==d.valid_children&&-1===e.inArray(s.type||"default",d.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:s&&s.id?s.id:!1,par:a&&a.id?a.id:!1})},!1
|
||||
if(_&&s.children_d&&s.parents){for(c=0,l=0,h=s.children_d.length;h>l;l++)c=Math.max(c,_[s.children_d[l]].parents.length)
|
||||
c=c-s.parents.length+1}(0>=c||c===t)&&(c=1)
|
||||
do{if(d.max_depth!==t&&-1!==d.max_depth&&d.max_depth<c)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:s&&s.id?s.id:!1,par:a&&a.id?a.id:!1})},!1
|
||||
a=this.get_node(a.parent),d=this.get_rules(a),c++}while(a)}}return!0},this.get_rules=function(e){if(e=this.get_node(e),!e)return!1
|
||||
var r=this.get_type(e,!0)
|
||||
return r.max_depth===t&&(r.max_depth=-1),r.max_children===t&&(r.max_children=-1),r.valid_children===t&&(r.valid_children=-1),r},this.get_type=function(t,r){return t=this.get_node(t),t?r?e.extend({type:t.type},this.settings.types[t.type]):t.type:!1},this.set_type=function(r,i){var s,a,n,o,d,c,l,h,_=this._model.data
|
||||
if(e.isArray(r)){for(r=r.slice(),a=0,n=r.length;n>a;a++)this.set_type(r[a],i)
|
||||
return!0}if(s=this.settings.types,r=this.get_node(r),!s[i]||!r)return!1
|
||||
if(l=this.get_node(r,!0),l&&l.length&&(h=l.children(".jstree-anchor")),o=r.type,d=this.get_icon(r),r.type=i,(d===!0||!s[o]||s[o].icon!==t&&d===s[o].icon)&&this.set_icon(r,s[i].icon!==t?s[i].icon:!0),s[o]&&s[o].li_attr!==t&&"object"==typeof s[o].li_attr)for(c in s[o].li_attr)if(s[o].li_attr.hasOwnProperty(c)){if("id"===c)continue
|
||||
"class"===c?(_[r.id].li_attr["class"]=(_[r.id].li_attr["class"]||"").replace(s[o].li_attr[c],""),l&&l.removeClass(s[o].li_attr[c])):_[r.id].li_attr[c]===s[o].li_attr[c]&&(_[r.id].li_attr[c]=null,l&&l.removeAttr(c))}if(s[o]&&s[o].a_attr!==t&&"object"==typeof s[o].a_attr)for(c in s[o].a_attr)if(s[o].a_attr.hasOwnProperty(c)){if("id"===c)continue
|
||||
"class"===c?(_[r.id].a_attr["class"]=(_[r.id].a_attr["class"]||"").replace(s[o].a_attr[c],""),h&&h.removeClass(s[o].a_attr[c])):_[r.id].a_attr[c]===s[o].a_attr[c]&&("href"===c?(_[r.id].a_attr[c]="#",h&&h.attr("href","#")):(delete _[r.id].a_attr[c],h&&h.removeAttr(c)))}if(s[i].li_attr!==t&&"object"==typeof s[i].li_attr)for(c in s[i].li_attr)if(s[i].li_attr.hasOwnProperty(c)){if("id"===c)continue
|
||||
_[r.id].li_attr[c]===t?(_[r.id].li_attr[c]=s[i].li_attr[c],l&&("class"===c?l.addClass(s[i].li_attr[c]):l.attr(c,s[i].li_attr[c]))):"class"===c&&(_[r.id].li_attr["class"]=s[i].li_attr[c]+" "+_[r.id].li_attr["class"],l&&l.addClass(s[i].li_attr[c]))}if(s[i].a_attr!==t&&"object"==typeof s[i].a_attr)for(c in s[i].a_attr)if(s[i].a_attr.hasOwnProperty(c)){if("id"===c)continue
|
||||
_[r.id].a_attr[c]===t?(_[r.id].a_attr[c]=s[i].a_attr[c],h&&("class"===c?h.addClass(s[i].a_attr[c]):h.attr(c,s[i].a_attr[c]))):"href"===c&&"#"===_[r.id].a_attr[c]?(_[r.id].a_attr.href=s[i].a_attr.href,h&&h.attr("href",s[i].a_attr.href)):"class"===c&&(_[r.id].a_attr["class"]=s[i].a_attr["class"]+" "+_[r.id].a_attr["class"],h&&h.addClass(s[i].a_attr[c]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(r,i){this.check=function(t,r,s,a,n){if(i.check.call(this,t,r,s,a,n)===!1)return!1
|
||||
if(r=r&&r.id?r:this.get_node(r),s=s&&s.id?s:this.get_node(s),!s||!s.children)return!0
|
||||
var o,d,c,l="rename_node"===t?a:r.text,h=[],_=this.settings.unique.case_sensitive,u=this.settings.unique.trim_whitespace,g=this._model.data
|
||||
for(o=0,d=s.children.length;d>o;o++)c=g[s.children[o]].text,_||(c=c.toLowerCase()),u&&(c=c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),h.push(c)
|
||||
switch(_||(l=l.toLowerCase()),u&&(l=l.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),t){case"delete_node":return!0
|
||||
case"rename_node":return c=r.text||"",_||(c=c.toLowerCase()),u&&(c=c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),o=-1===e.inArray(l,h)||r.text&&c===l,o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+l+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:r&&r.id?r.id:!1,par:s&&s.id?s.id:!1})}),o
|
||||
case"create_node":return o=-1===e.inArray(l,h),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+l+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:r&&r.id?r.id:!1,par:s&&s.id?s.id:!1})}),o
|
||||
case"copy_node":return o=-1===e.inArray(l,h),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+l+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:r&&r.id?r.id:!1,par:s&&s.id?s.id:!1})}),o
|
||||
case"move_node":return o=r.parent===s.id&&(!n||!n.is_multi)||-1===e.inArray(l,h),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+l+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:r&&r.id?r.id:!1,par:s&&s.id?s.id:!1})}),o}return!0},this.create_node=function(r,s,a,n,o){if(!s||s.text===t){if(null===r&&(r=e.jstree.root),r=this.get_node(r),!r)return i.create_node.call(this,r,s,a,n,o)
|
||||
if(a=a===t?"last":a,!a.toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(r))return i.create_node.call(this,r,s,a,n,o)
|
||||
s||(s={})
|
||||
var d,c,l,h,_,u,g=this._model.data,f=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,m=this.settings.unique.duplicate
|
||||
for(c=d=this.get_string("New node"),l=[],h=0,_=r.children.length;_>h;h++)u=g[r.children[h]].text,f||(u=u.toLowerCase()),p&&(u=u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),l.push(u)
|
||||
for(h=1,u=c,f||(u=u.toLowerCase()),p&&(u=u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==e.inArray(u,l);)c=m.call(this,d,++h).toString(),u=c,f||(u=u.toLowerCase()),p&&(u=u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))
|
||||
s.text=c}return i.create_node.call(this,r,s,a,n,o)}}
|
||||
var f=d.createElement("DIV")
|
||||
if(f.setAttribute("unselectable","on"),f.setAttribute("role","presentation"),f.className="jstree-wholerow",f.innerHTML=" ",e.jstree.plugins.wholerow=function(t,r){this.bind=function(){r.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")
|
||||
var r,i,s=!1
|
||||
for(r=0,i=t.selected.length;i>r;r++)s=this.get_node(t.selected[r],!0),s&&s.length&&s.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",e.proxy(function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy(function(t){if(this._data.contextmenu){t.preventDefault()
|
||||
var r=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY})
|
||||
e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r)}},this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation()
|
||||
var r=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey})
|
||||
e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()}).on("dblclick.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation()
|
||||
var r=e.Event("dblclick",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey})
|
||||
e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation()
|
||||
var r=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey})
|
||||
e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),r.teardown.call(this)},this.redraw_node=function(t,i,s,a){if(t=r.redraw_node.apply(this,arguments)){var n=f.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(n.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(n.className+=" jstree-wholerow-hovered"),t.insertBefore(n,t.childNodes[0])}return t}},window.customElements&&Object&&Object.create){var p=Object.create(HTMLElement.prototype)
|
||||
p.createdCallback=function(){var t,r={core:{},plugins:[]}
|
||||
for(t in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(r.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(r[t]=JSON.parse(this.getAttribute(t))))
|
||||
for(t in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(r.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t))
|
||||
e(this).jstree(r)}
|
||||
try{window.customElements.define("vakata-jstree",function(){},{prototype:p})}catch(m){}}}})
|
|
@ -0,0 +1 @@
|
|||
!function(t){var e={inEffect:{opacity:"show"},inEffectDuration:600,stayTime:3e3,text:"",sticky:!1,type:"notice",position:"top-right",closeText:"",close:null},o={init:function(o){o&&t.extend(e,o)},showToast:function(o){var s,a,n,i={};return t.extend(i,e,o),s=t(".toast-container").length?t(".toast-container"):t("<div></div>").addClass("toast-container").addClass("toast-position-"+i.position).appendTo("body"),a=t("<div></div>").addClass("toast-item-wrapper"),n=t("<div></div>").hide().addClass("toast-item toast-type-"+i.type).appendTo(s).html(t("<p>").append(i.text)).animate(i.inEffect,i.inEffectDuration).wrap(a),t("<div></div>").addClass("toast-item-close").prependTo(n).html(i.closeText).click(function(){t().toastmessage("removeToast",n,i)}),t("<div></div>").addClass("toast-item-image").addClass("toast-item-image-"+i.type).prependTo(n),navigator.userAgent.match(/MSIE 6/i)&&s.css({top:document.documentElement.scrollTop}),i.sticky||setTimeout(function(){t().toastmessage("removeToast",n,i)},i.stayTime),n},showNoticeToast:function(e){var o={text:e,type:"notice"};return t().toastmessage("showToast",o)},showSuccessToast:function(e){var o={text:e,type:"success"};return t().toastmessage("showToast",o)},showErrorToast:function(e){var o={text:e,type:"error"};return t().toastmessage("showToast",o)},showWarningToast:function(e){var o={text:e,type:"warning"};return t().toastmessage("showToast",o)},removeToast:function(t,e){t.animate({opacity:"0"},600,function(){t.parent().animate({height:"0px"},300,function(){t.parent().remove()})}),e&&null!==e.close&&e.close()}};t.fn.toastmessage=function(e){return o[e]?o[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error("Method "+e+" does not exist on jQuery.toastmessage"):o.init.apply(this,arguments)}}(jQuery);
|
|
@ -0,0 +1,200 @@
|
|||
|
||||
<html class='ui-widget-content' style='border-width:0;'>
|
||||
<head>
|
||||
<link type='text/css' rel='stylesheet' href='assets/css/fork-awesome.min.css' >
|
||||
<link type='text/css' rel='stylesheet' href='assets/css/gfont.css'>
|
||||
</head>
|
||||
<body class='ui-widget-content' style='border-width:0;'>
|
||||
<div id='sflog' class='ui-widget-content' style='border-width:0;'>
|
||||
<div id='txtlog' class='txt-log' style='border-width:0;'></div>
|
||||
</div>
|
||||
<script>
|
||||
function load_logs(){
|
||||
document.removeEventListener('loadLog',load_logs);
|
||||
if(typeof(jQuery)=='undefined' && typeof(parent.getLibData)=='function'){
|
||||
var libs = parent.getLibData();
|
||||
for(var i=0;i<libs.length;i++){
|
||||
if(libs[i].library==='jquery' || libs[i].library==='mscb'){
|
||||
if(libs[i].data===null){
|
||||
alert('null data');
|
||||
setTimeout(load_logs,1000);
|
||||
return;
|
||||
}
|
||||
eval(libs[i].data);
|
||||
}
|
||||
}
|
||||
}
|
||||
jQuery.each(parent.getCssData(),function(j,css){
|
||||
if(css.library!='sunny' && css.library!='eggplant' && css.library!='redmond' && css.library!='hot-sneaks'){
|
||||
$('head').append(css.data);
|
||||
}
|
||||
});
|
||||
var tx = document.getElementById('txtlog');
|
||||
var flg = jQuery('#sflog');
|
||||
var curr_css = 'eggplant';
|
||||
var clog=true;
|
||||
var cwarn=true;
|
||||
var cerr=true;
|
||||
var cdeb=false;
|
||||
var pages = [''];
|
||||
//var maxbuf = 0x100000;//1Mb
|
||||
var maxbuf = 0x20000;//128kb
|
||||
var rt_page=true;
|
||||
function switch_style(e){
|
||||
curr_css = e.style;
|
||||
jQuery('head').find('style').remove();
|
||||
jQuery.each(parent.getCssData(),function(j,css){
|
||||
if(css.library===curr_css || (css.library!='sunny' && css.library!='eggplant' && css.library!='redmond' && css.library!='hot-sneaks')){
|
||||
jQuery('head').append(css.data);
|
||||
}
|
||||
});
|
||||
refresh_scrollbar();
|
||||
}
|
||||
function clean_log(){
|
||||
tx.innerHTML='';
|
||||
}
|
||||
function destroy_sb(){
|
||||
flg.mCustomScrollbar('destroy');
|
||||
}
|
||||
function refresh_scrollbar(){
|
||||
destroy_sb();
|
||||
flg.mCustomScrollbar({
|
||||
theme: (curr_css==='eggplant') ? 'light-thick' : 'dark-thick',
|
||||
advanced:{
|
||||
updateOnContentResize: true,
|
||||
updateOnImageLoad: true
|
||||
}
|
||||
});
|
||||
}
|
||||
function filter_data(p_class,checked){
|
||||
var li = jQuery(document.body).find('.'+p_class).removeClass('ui-helper-hidden');
|
||||
if(checked!==true){
|
||||
li.addClass('ui-helper-hidden');
|
||||
}
|
||||
}
|
||||
function toggle_log(e){
|
||||
if(e && typeof e.toggle === 'boolean'){
|
||||
filter_data('log-info',e.toggle);
|
||||
clog = e.toggle===true ? true: false;
|
||||
}
|
||||
}
|
||||
function toggle_warn(e){
|
||||
if(e && typeof e.toggle === 'boolean'){
|
||||
filter_data('log-warning',e.toggle);
|
||||
cwarn = e.toggle===true ? true: false;
|
||||
}
|
||||
}
|
||||
function toggle_error(e){
|
||||
if(e && typeof e.toggle === 'boolean'){
|
||||
filter_data('log-error',e.toggle);
|
||||
cerr = e.toggle===true ? true: false;
|
||||
|
||||
}
|
||||
}
|
||||
function toggle_dbg(e){
|
||||
if(e && typeof e.toggle === 'boolean'){
|
||||
filter_data('log-debug',e.toggle);
|
||||
cdeb = e.toggle===true ? true: false;
|
||||
}
|
||||
}
|
||||
var show_page = function(idx){
|
||||
function scroll(){
|
||||
flg.mCustomScrollbar('scrollTo','bottom',{
|
||||
timeout:50,
|
||||
scrollInertia:3000,
|
||||
scrollEasing:'easeOut'
|
||||
});
|
||||
}
|
||||
function update(){
|
||||
tx.innerHTML = pages[idx];
|
||||
scroll();
|
||||
parent.updateCurrentLog(idx+1);
|
||||
filter_all();
|
||||
}
|
||||
if(pages.length>1 && idx>=0 && idx<pages.length-1){
|
||||
update();
|
||||
rt_page=false;
|
||||
}
|
||||
else if(pages.length>1 && idx===pages.length-1){
|
||||
update();
|
||||
rt_page=true;
|
||||
}
|
||||
else if(idx===pages.length-1){
|
||||
update();
|
||||
rt_page=true;
|
||||
}
|
||||
}
|
||||
function add_log(){
|
||||
if(rt_page){
|
||||
show_page(pages.length-1);
|
||||
}
|
||||
}
|
||||
function queue_log(e){
|
||||
if(e && typeof e.message === 'string' && e.message.length>0){
|
||||
if(pages[pages.length-1].length+e.message.length<maxbuf){
|
||||
pages[pages.length-1]+=e.message;
|
||||
}
|
||||
else{
|
||||
pages.push(e.message);
|
||||
parent.updateTotalLogs(pages.length);
|
||||
}
|
||||
if(e.immediate){add_log();}
|
||||
}
|
||||
}
|
||||
function filter_all(){
|
||||
filter_data('log-info',clog);
|
||||
filter_data('log-warning',cwarn);
|
||||
filter_data('log-error',cerr);
|
||||
filter_data('log-debug',cdeb);
|
||||
}
|
||||
function first_page(e){
|
||||
show_page(0);
|
||||
}
|
||||
function last_page(e){
|
||||
show_page(pages.length-1);
|
||||
}
|
||||
function next_page(e){
|
||||
show_page(e.page);
|
||||
}
|
||||
function prev_page(e){
|
||||
show_page(e.page);
|
||||
}
|
||||
document.addEventListener('firstPage',first_page);
|
||||
document.addEventListener('lastPage',last_page);
|
||||
document.addEventListener('nextPage',next_page);
|
||||
document.addEventListener('prevPage',prev_page);
|
||||
document.addEventListener('showLog',add_log);
|
||||
document.addEventListener('addLog',queue_log);
|
||||
document.addEventListener('cleanLogs',clean_log);
|
||||
document.addEventListener('updateScroll',refresh_scrollbar);
|
||||
document.addEventListener('toggleLogs',toggle_log);
|
||||
document.addEventListener('toggleErrors',toggle_error);
|
||||
document.addEventListener('toggleWarnings',toggle_warn);
|
||||
document.addEventListener('toggleDebugs',toggle_dbg);
|
||||
document.addEventListener('destroyScrollbar',destroy_sb);
|
||||
document.addEventListener('switchStyle',switch_style);
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
document.removeEventListener('firstPage',first_page);
|
||||
document.removeEventListener('lastPage',last_page);
|
||||
document.removeEventListener('nextPage',next_page);
|
||||
document.removeEventListener('prevPage',prev_page);
|
||||
document.removeEventListener('showLog',add_log);
|
||||
document.removeEventListener('updateScroll',refresh_scrollbar);
|
||||
document.removeEventListener('toggleLogs',toggle_log);
|
||||
document.removeEventListener('toggleErrors',toggle_error);
|
||||
document.removeEventListener('toggleWarnings',toggle_warn);
|
||||
document.removeEventListener('toggleDebugs',toggle_dbg);
|
||||
document.removeEventListener('destroyScrollbar',destroy_sb);
|
||||
document.removeEventListener('switchStyle',switch_style);
|
||||
document.removeEventListener('cleanLogs',clean_log);
|
||||
document.removeEventListener('addLog',queue_log);
|
||||
};
|
||||
}
|
||||
window.onload = function(){
|
||||
document.addEventListener('loadLog',load_logs);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,534 @@
|
|||
|
||||
<div id='memedit'>
|
||||
<h2 align='right' class='tab-header'>Userland Memory Editor <span class='header-tiny-text'>v1.1</span></h2>
|
||||
<div class='me-sizer'>
|
||||
<table id ='mebox' class='window'>
|
||||
<tbody class='ui-corner-all'>
|
||||
<tr class='window-header ui-widget-header'>
|
||||
<th class='logoptions window-header ui-widget-header '><div class='dir-table'><span class='dir-left'>
|
||||
<div class='spinner min-width-550' tabindex='0' >
|
||||
<input id='spinner-text' class='spinner' value=''readonly />
|
||||
<span class='spinner-go-button '>
|
||||
<button id='btn_spinner' class='gui-item ui-button ui-corner-all ui-state-disabled'>Go to</button>
|
||||
</span>
|
||||
</div></span><span id='spanmode' class='dir-ume' title='Disable UME Strict Mode to browse userland memory without restrictions.Keep in mind however that any attempt to access unallocated memory addresses with UME Strict Mode off will crash the console.'><div class='switch-wrapper pointer' tabindex='0'><input type='checkbox' name='mode' id='memhexmode' value='true' checked='true' ></div></span></div></th>
|
||||
</tr>
|
||||
<tr class='window-content ui-widget-content'>
|
||||
<td align='justify' class='window-content ui-widget-content'>
|
||||
<div id='hexTable' class='hexeditor'>
|
||||
<table id='xtable' class='x-table ui-widget ui-corner-all'>
|
||||
<colgroup>
|
||||
<col class='cell-offset' />
|
||||
<col class='cell-value' />
|
||||
<col class='cell-value' />
|
||||
<col class='cell-value' />
|
||||
<col class='cell-value' />
|
||||
<col class='cell-ascii' />
|
||||
</colgroup>
|
||||
<thead class='table-header ui-widget-header ui-corner-all'>
|
||||
<tr class='row-header'>
|
||||
<th class='cell-header ui-corner-tl'>Offset</th>
|
||||
<th class='cell-header '>0</th>
|
||||
<th class='cell-header'>+0x4</th>
|
||||
<th class='cell-header '>+0x8</th>
|
||||
<th class='cell-header '>+0xC</th>
|
||||
<th class='cell-header ui-corner-tr'>ASCII</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='window-bottom ui-widget-header '>
|
||||
<td class='window-bottom btlogoptions ui-widget-header '>
|
||||
<div class='dir-table ui-corner-bottom '>
|
||||
<span class='dir-left min-width-210'>
|
||||
<button id='btn2bis' class='gui-item ui-button ui-corner-all' title = ''>
|
||||
<i class='fa fa-fast-backward fa-fw'></i>
|
||||
</button>
|
||||
<button id='btn2' class='gui-item ui-button ui-corner-all' title = ''>
|
||||
<i class='fa fa-step-backward fa-fw'></i>
|
||||
</button>
|
||||
</span>
|
||||
<span class='dir-center min-width-210'>
|
||||
<button id='btn1' class='gui-item ui-button ui-corner-all' title = 'Go to the memory offset provided in the textbox'>Go to Offset</button>
|
||||
<span class='top-2px'>
|
||||
<input align='center' size='10' type='text' title = 'Enter a 32 bit userland memory address' id='offset' class='gui-item ui-widget ui-corner-all'/>
|
||||
</span>
|
||||
</span>
|
||||
<span class='dir-right min-width-210'>
|
||||
<button id='btn3' class='gui-item ui-button ui-corner-all' title = ''>
|
||||
<i class='fa fa-step-forward fa-fw'></i>
|
||||
</button>
|
||||
<button id='btn3bis' class='gui-item ui-button ui-corner-all' title = ''>
|
||||
<i class='fa fa-fast-forward fa-fw'></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery('.preloader').removeClass('ui-helper-hidden');
|
||||
disable_GUI();
|
||||
var current = {'id':'current','name':'Current Segment','start':0,'end':0,'offset':0};
|
||||
var rec_offset=0;
|
||||
var current_index =0;
|
||||
var ranges = [{'id':'vsh_text','name':'VSH Text Segment','start':0x10000,'end':helper.vshgadgets_box.vshdata_seg,'offset':0},
|
||||
{'id':'vsh_data','name':'VSH Data Segment','start':helper.vshgadgets_box.vshdata_seg,'end':0x800000,'offset':0},
|
||||
{'id':'browser_container','name':'PS3 Browser Memory Container','start':0x80000000,'end':0x90000000,'offset':0}
|
||||
];
|
||||
jQuery.widget('ui.textSpinner', jQuery.ui.spinner, {
|
||||
options: {
|
||||
wrap: true
|
||||
},
|
||||
_parse: function (value) {
|
||||
if ((value === '') || isNaN(value)) {
|
||||
value = this.options.values.indexOf(value);
|
||||
if (value === -1) {
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
if (value < 0) {
|
||||
value = this.options.wrap ? (this.options.values.length -1) : 0;
|
||||
} else if (value >= this.options.values.length) {
|
||||
value = this.options.wrap ? 0 : (this.options.values.length - 1);
|
||||
}
|
||||
return value;
|
||||
},
|
||||
_format: function (value) {
|
||||
return this.options.values[value];
|
||||
},
|
||||
_adjustValue: function (value) {
|
||||
if (value < 0) {
|
||||
value = this.options.wrap ? (this.options.values.length - 1) : 0;
|
||||
} else if (value >= this.options.values.length) {
|
||||
value = this.options.wrap ? 0 : (this.options.values.length - 1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
var createSpinner = function(){
|
||||
var arrSpin = [];
|
||||
for(var i=0;i<ranges.length;i++){
|
||||
arrSpin[i]=ranges[i].name;
|
||||
}
|
||||
//Crazy hack to get rid of automatic focusing nightmare on ps3. np on other browsers of course lol
|
||||
jQuery('#spinner-text').textSpinner({
|
||||
values: arrSpin,
|
||||
spin: function(event,ui) {
|
||||
// index of spin entry in ui.value
|
||||
// text value of spin entry in this.values[ui.value]
|
||||
event.stopPropagation();
|
||||
var bt = jQuery('#btn_spinner');
|
||||
if(current===ranges[ui.value]){
|
||||
bt.removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
}
|
||||
else{
|
||||
bt.removeClass('ui-state-disabled');
|
||||
}
|
||||
bt.off('click');
|
||||
bt.on('click',function(e){
|
||||
current = ranges[ui.value];
|
||||
current.offset = ranges[ui.value].start;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
bt.removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
});
|
||||
jQuery('#btn_spinner').off('keyUp');
|
||||
jQuery('.ui-spinner-button').off('keyUp');
|
||||
jQuery('.ui-spinner-input').off('keyDown');
|
||||
jQuery('.ui-spinner-input').off('blur');
|
||||
jQuery('.ui-spinner-input').on('focus',function(){
|
||||
jQuery(this).blur();
|
||||
jQuery('.ui-spinner-up').focus();
|
||||
});
|
||||
jQuery('.ui-spinner-up').on('keyUp',function(){
|
||||
jQuery('#spinner-text').textSpinner('stepUp',1);
|
||||
jQuery(this).focus();
|
||||
});
|
||||
jQuery('.ui-spinner-down').on('keyUp',function(){
|
||||
jQuery('#spinner-text').textSpinner('stepDown',1);
|
||||
jQuery(this).focus();
|
||||
});
|
||||
};
|
||||
var mapModules = function(close_toast){
|
||||
var mods = 0;
|
||||
var ret = 0;
|
||||
var bs = helper.heap.store(0x600);
|
||||
var module_list = bs;
|
||||
var idlist = bs+0x18;
|
||||
var module_info = bs+0x218;
|
||||
var file_name = bs+0x260;
|
||||
var seg_info = bs+0x360;
|
||||
var s_module_info = bs+0x5E0;
|
||||
helper.memory.upokes(module_list,'0000000000000020000000000000008000000000'+idlist.toString32());
|
||||
helper.memory.upokes(s_module_info,'0000000000000010'+module_info.toString32());
|
||||
helper.memory.upokes(module_info,'0000000000000048000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'+file_name.toString32()+'00000100'+seg_info.toString32()+'00000008');
|
||||
ret = helper.rop.rrun(syscall32(helper.sys_prx_get_module_list,2,module_list,0));
|
||||
if(ret===0){
|
||||
var count = helper.memory.upeek32(module_list+0x10);
|
||||
var id_peek = helper.memory.upeeks(idlist,count*4);
|
||||
function extract(from, size, peek,s,f,seg){
|
||||
var cnt = size-from<10? size-from : 10;
|
||||
for(var i=from;i<from+cnt;i++){
|
||||
var id = parseInt('0x'+peek.substr(i*0x8,0x8),16);
|
||||
if(id <= 0){continue;}
|
||||
helper.rop.run(syscall32(helper.sys_prx_get_module_info,id,0,s));
|
||||
var plugin_name = helper.memory.upeeks(f,0xFF,true);
|
||||
for(var j=0;j<2;j++){
|
||||
var speek = helper.memory.upeeks(seg+j*0x28,0x28);
|
||||
var base = parseInt('0x'+speek.substr(0x8,0x8),16);
|
||||
var t = j>0 ? 'Data' : 'Text';
|
||||
mods++;
|
||||
ranges.push({'name':plugin_name+' Module '+t+' Segment','start':base,'end':base+parseInt('0x'+speek.substr(0x28,0x8),16),'offset':0});
|
||||
}
|
||||
}
|
||||
if(from+cnt<size){
|
||||
setTimeout(function(){
|
||||
extract(from+cnt, count, peek,s,f,seg);
|
||||
},600);
|
||||
}
|
||||
else{
|
||||
helper.heap.free([bs]);
|
||||
Logger.info('mapModules: Number of sprx module segments mapped '+mods.toString());
|
||||
jQuery('#spinner-text' ).textSpinner( 'destroy' );
|
||||
createSpinner();
|
||||
jQuery().toastmessage('removeToast', close_toast);
|
||||
jQuery('.preloader').removeClass('ui-helper-hidden').addClass('ui-helper-hidden');
|
||||
helper.sp.playOK();
|
||||
return;
|
||||
}
|
||||
}
|
||||
extract(0,count,id_peek,s_module_info,file_name,seg_info);
|
||||
}
|
||||
else{
|
||||
helper.sp.playNG();
|
||||
Logger.error('mapModules: sys_prx_get_module_list error 0x'+ret.toString(16));
|
||||
}
|
||||
};
|
||||
var isInCurrentRange=function (off){
|
||||
if(off>=current.start && off < current.end){return true;}
|
||||
else{return false;}
|
||||
};
|
||||
var isValid=function (off){
|
||||
if(helper.me_usermode>0){return true;}
|
||||
for(var i=0;i<ranges.length;i++){
|
||||
if(off>=ranges[i].start && off < ranges[i].end){return true;}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var findRangeKey=function (off){
|
||||
for(var i=0;i<ranges.length;i++){
|
||||
if(off>=ranges[i].start && off < ranges[i].end){return ranges[i].id;}
|
||||
}
|
||||
return helper.me_usermode>0?{'start':0x0,'end':0xFFFFFFFF}:null;
|
||||
};
|
||||
var findRangeIndex=function (off){
|
||||
for(var i=0;i<ranges.length;i++){
|
||||
if(off>=ranges[i].start && off < ranges[i].end){return i;}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
function toAsciiStr(str){
|
||||
var ret='';
|
||||
for(var i=0;i<str.length/2;i++){
|
||||
var tval = parseInt('0x'+str.substr(i*2,2),16)&0xFF;
|
||||
ret += tval===0 ? '.': String.fromCharCode(tval);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function updateMemory(e){
|
||||
var data = e.data;
|
||||
var ipt = jQuery('#'+data.offset.toString(16));
|
||||
ipt.removeClass('ui-state-error');
|
||||
ipt.off('change');
|
||||
ipt.off('focusout');
|
||||
ipt.off('focusin');
|
||||
var ival = ('00000000'+ipt.val().toUpperCase()).slice(-8);
|
||||
var val = parseInt(ival,16);
|
||||
var sval = val.toString32().toUpperCase();
|
||||
if(sval===ival && ival.length<=8){
|
||||
Logger.info('memedit: Updating 4 bytes at offset 0x'+data.offset.toString(16)+' with 32 bit value: 0x'+sval);
|
||||
helper.memory.upoke32(data.offset,val);
|
||||
data.value=sval;
|
||||
var ofst = data.offset.toString32();
|
||||
ofst=ofst.substr(0,ofst.length-1)+'0';
|
||||
jQuery('.ascii_'+ofst).text(toAsciiStr(helper.memory.upeeks(parseInt(ofst,16),0x10).toUpperCase()));
|
||||
}
|
||||
ipt.val(data.value);
|
||||
ipt.on('focusout',data,cancel);
|
||||
ipt.on('focusin',data,clean);
|
||||
ipt.on('change',data,updateMemory);
|
||||
}
|
||||
function cancel(e){
|
||||
var ipt = jQuery('#'+e.data.offset.toString(16));
|
||||
ipt.off('focusout');
|
||||
ipt.off('focusin');
|
||||
var pk = helper.memory.upeek32(e.data.offset).toString32().toUpperCase();
|
||||
if(pk===e.data.value){
|
||||
changeValue(e.data.offset,e.data.value);
|
||||
ipt.on('focusout',e.data,cancel);
|
||||
ipt.on('focusin',e.data,clean);
|
||||
}
|
||||
else{
|
||||
changeValue(e.data.offset,'undefined',pk);
|
||||
ipt.removeClass('ui-state-error').addClass('ui-state-error');
|
||||
ipt.parent().children().css({'height':'22px'});
|
||||
ipt.attr('title','Value out of synchronisation, the browser main thread or another userland thread is preventing us from getting a reliable reading at this offset.');
|
||||
jQuery(document).tooltip();
|
||||
}
|
||||
}
|
||||
function clean(e){
|
||||
changeValue(e.data.offset,'',e.data.value);
|
||||
}
|
||||
function changeValue(offset,valin,valout){
|
||||
var ipt = jQuery('#'+offset.toString(16));
|
||||
ipt.off('change');
|
||||
ipt.val(valin);
|
||||
ipt.on('change',{'offset':offset,'value':valout ? valout : valin},updateMemory);
|
||||
}
|
||||
function convertToAscii(str){
|
||||
var ascii='';
|
||||
for(var i=0;i<str.length;i++){
|
||||
ascii += str.charCodeAt(i).toString8();
|
||||
}
|
||||
return ascii;
|
||||
}
|
||||
function convertfromAscii(str){
|
||||
var ret='';
|
||||
var i=0;
|
||||
while(i<str.length/2){
|
||||
ret += String.fromCharCode(parseInt(str.substr(i*2,2),16));
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function addHexTable(offset) {
|
||||
if(!current){Logger.error('addHexTable: Unexpected Range error');return;}
|
||||
jQuery('.x-table input').remove();
|
||||
jQuery('.x-table td').remove();
|
||||
jQuery('.x-table tr:not(.row-header)').remove();
|
||||
var arr = [];
|
||||
var i=0;
|
||||
var cnt=0;
|
||||
var table=document.getElementById('xtable');
|
||||
for(i=0;i<0x40;i++){
|
||||
if(isValid(offset+i*0x4)){cnt++;}
|
||||
if(cnt===1){rec_offset=offset+i*0x4;}
|
||||
}
|
||||
var pad='';
|
||||
for(i=0;i<0x40-cnt;i++){
|
||||
pad+='3F3F3F3F';
|
||||
}
|
||||
var speek = helper.memory.upeeks(rec_offset,cnt*0x4).toUpperCase();
|
||||
speek=rec_offset===offset ? speek+pad:pad+speek ;
|
||||
var end = rec_offset + cnt*0x4;
|
||||
for(i=0;i<16;i++){
|
||||
var row = table.insertRow( table.rows.length);
|
||||
arr[i] = [];
|
||||
var t1 = i===15 ? ' ui-corner-bl' : '';
|
||||
var t2 = i===15 ? ' ui-corner-br' : '';
|
||||
row.className = i===15 ? 'cell-row ui-corner-bottom' : '';
|
||||
var off = rec_offset+i*0x10;
|
||||
arr[i][0]=row.insertCell(0);
|
||||
arr[i][0].className = 'cell-header'+t1;
|
||||
arr[i][0].id='x'+off.toString32();
|
||||
arr[i][0].innerHTML= '0x'+off.toString32();
|
||||
arr[i][1]=row.insertCell(1);
|
||||
var i_1 = document.createElement('input');
|
||||
var test = offset+i*0x10 >= rec_offset && offset+i*0x10 < end;
|
||||
i_1.type='text';
|
||||
i_1.maxlength=9;
|
||||
i_1.size=16;
|
||||
i_1.className= test ? 'txt-center cell-data' : 'txt-center cell-data ui-state-disabled';
|
||||
i_1.id = off.toString(16);
|
||||
i_1.value = test ? speek.substr(0x20*i,8) : 'undefined';
|
||||
jQuery(arr[i][1]).append(i_1);
|
||||
var c_1 = jQuery('#'+i_1.id);
|
||||
c_1.on('focusin',{offset:off,value:i_1.value},clean);
|
||||
c_1.on('focusout',{offset:off,value:i_1.value},cancel);
|
||||
c_1.on('change',{offset:off,value:i_1.value},updateMemory);
|
||||
arr[i][2]=row.insertCell(2);
|
||||
var i_2 = document.createElement('input');
|
||||
test = offset+4+i*0x10 >= rec_offset && offset+4+i*0x10 < end;
|
||||
i_2.type='text';
|
||||
i_2.maxlength=9;
|
||||
i_2.size=16;
|
||||
i_2.className=test ? 'txt-center cell-data' : 'txt-center cell-data ui-state-disabled';
|
||||
i_2.id = (off+4).toString(16);
|
||||
i_2.value = test ? speek.substr(0x20*i+8,8) : 'undefined';
|
||||
jQuery(arr[i][2]).append(i_2);
|
||||
var c_2 = jQuery('#'+i_2.id);
|
||||
c_2.on('focusin',{offset:off+4,value:i_2.value},clean);
|
||||
c_2.on('focusout',{offset:off+4,value:i_2.value},cancel);
|
||||
c_2.on('change',{offset:off+4,value:i_2.value},updateMemory);
|
||||
arr[i][3]=row.insertCell(3);
|
||||
var i_3 = document.createElement('input');
|
||||
test = offset+8+i*0x10 >= rec_offset && offset+8+i*0x10 < end;
|
||||
i_3.type='text';
|
||||
i_3.maxlength=9;
|
||||
i_3.size=16;
|
||||
i_3.className=test ? 'txt-center cell-data' : 'txt-center cell-data ui-state-disabled';
|
||||
i_3.id = (off+8).toString(16);
|
||||
i_3.value = test ? speek.substr(0x20*i+16,8) : 'undefined';
|
||||
jQuery(arr[i][3]).append(i_3);
|
||||
var c_3 = jQuery('#'+i_3.id);
|
||||
c_3.on('focusin',{offset:off+8,value:i_3.value},clean);
|
||||
c_3.on('focusout',{offset:off+8,value:i_3.value},cancel);
|
||||
c_3.on('change',{offset:off+8,value:i_3.value},updateMemory);
|
||||
arr[i][4]=row.insertCell(4);
|
||||
var i_4 = document.createElement('input');
|
||||
test = offset+0xC+i*0x10 >= rec_offset && offset+0xC+i*0x10 < end;
|
||||
i_4.type='text';
|
||||
i_4.maxlength=9;
|
||||
i_4.size=16;
|
||||
i_4.className=test ? 'txt-center cell-data' : 'txt-center cell-data ui-state-disabled';
|
||||
i_4.id = (off+0xC).toString(16);
|
||||
i_4.value = test ? speek.substr(0x20*i+24,8) : 'undefined';
|
||||
jQuery(arr[i][4]).append(i_4);
|
||||
var c_4 = jQuery('#'+i_4.id);
|
||||
c_4.on('focusin',{offset:off+0xC,value:i_4.value},clean);
|
||||
c_4.on('focusout',{offset:off+0xC,value:i_4.value},cancel);
|
||||
c_4.on('change',{offset:off+0xC,value:i_4.value},updateMemory);
|
||||
arr[i][5]=row.insertCell(5);
|
||||
arr[i][5].className = 'cell-header'+t2;
|
||||
arr[i][5].innerHTML= '<div class=\'txt-center'+t2+' ascii ascii_'+off.toString32()+'\'>'+toAsciiStr(speek.substr(0x20*i,0x20))+'</div>';
|
||||
}
|
||||
arr=[];
|
||||
document.getElementById('offset').value = '0x'+rec_offset.toString(16).toUpperCase();
|
||||
document.getElementById('btn1').onclick = function(){
|
||||
var val = parseInt(document.getElementById('offset').value, 16);
|
||||
if(isNaN(val)===false){
|
||||
if(isValid(val)){
|
||||
current.offset = val;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
}
|
||||
else{
|
||||
alert('0x'+val.toString(16).toUpperCase()+' is not located in an accessible memory range');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
alert(document.getElementById('offset').value+' is not a valid 32 bit address');
|
||||
}
|
||||
};
|
||||
var b2 = document.getElementById('btn2');
|
||||
var cn2 = isValid(rec_offset-0x100) ? '': 'ui-state-disabled';
|
||||
b2.title = 'Go to offset 0x'+(rec_offset-0x100).toString(16).toUpperCase();
|
||||
b2.onclick = function(){
|
||||
current.offset = rec_offset-0x100;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
};
|
||||
|
||||
var b2b = document.getElementById('btn2bis');
|
||||
var cn2b = isValid(rec_offset-0x1000) ? '': 'ui-state-disabled';
|
||||
b2b.title = 'Go to offset 0x'+(rec_offset-0x1000).toString(16).toUpperCase();
|
||||
b2b.onclick = function(){
|
||||
current.offset = rec_offset-0x1000;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
};
|
||||
|
||||
var b3 = document.getElementById('btn3');
|
||||
var cn3 = isValid(rec_offset+0x100) ? '': 'ui-state-disabled';
|
||||
b3.title = 'Go to offset 0x'+(rec_offset+0x100).toString(16).toUpperCase();
|
||||
b3.onclick = function(){
|
||||
current.offset = rec_offset+0x100;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
};
|
||||
|
||||
var b3b = document.getElementById('btn3bis');
|
||||
var cn3b = isValid(rec_offset+0x1000) ? '':'ui-state-disabled';
|
||||
b3b.title = 'Go to offset 0x'+(rec_offset+0x1000).toString(16).toUpperCase();
|
||||
b3b.onclick = function(){
|
||||
current.offset = rec_offset+0x1000;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
};
|
||||
var idx = findRangeIndex(rec_offset);
|
||||
if(idx>=0){
|
||||
current = ranges[idx];
|
||||
jQuery( '#spinner-text' ).textSpinner( 'value', ranges[idx].name );
|
||||
}
|
||||
if(current.name.indexOf('Text Segment')>0 && helper.me_usermode===0){
|
||||
jQuery('.cell-data').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
}
|
||||
current.offset=offset;
|
||||
Logger.info('memedit: Created Memory Hex Table offset 0x'+rec_offset.toString(16).toUpperCase());
|
||||
jQuery('#memedit' ).off( 'refreshEvent');
|
||||
enable_GUI();
|
||||
jQuery(b2).removeClass('gui-disabled ui-state-disabled').addClass(cn2);
|
||||
jQuery(b2b).removeClass('gui-disabled ui-state-disabled').addClass(cn2b);
|
||||
jQuery(b3).removeClass('gui-disabled ui-state-disabled').addClass(cn3);
|
||||
jQuery(b3b).removeClass('gui-disabled ui-state-disabled').addClass(cn3b);
|
||||
jQuery('#btn_spinner').removeClass('ui-state-disabled').addClass(rec_offset===current.start ? 'ui-state-disabled':'');
|
||||
jQuery('#memedit' ).on( 'refreshEvent', function( event,tost ) {
|
||||
disable_GUI();
|
||||
setTimeout(function(){
|
||||
addHexTable(current.offset);
|
||||
jQuery('.refresh-me').removeClass('ui-state-disabled');
|
||||
jQuery().toastmessage('removeToast', tost);
|
||||
},0);
|
||||
});
|
||||
setTimeout(function(){
|
||||
jQuery(document).tooltip('disable');
|
||||
jQuery(document).tooltip();
|
||||
jQuery(document).tooltip('enable');
|
||||
},200);
|
||||
};
|
||||
try{
|
||||
var init_ume=false;
|
||||
jQuery('#memhexmode').switchButton({
|
||||
labels_placement: 'left',
|
||||
clear: false,
|
||||
on_label: 'UME Strict Mode ON ',
|
||||
off_label: 'UME Strict Mode OFF',
|
||||
on_callback: function (){
|
||||
jQuery(document).tooltip('disable');
|
||||
helper.me_usermode = 0;
|
||||
if(init_ume===true){
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
}
|
||||
init_ume=true;
|
||||
|
||||
jQuery(document).tooltip('enable');
|
||||
},
|
||||
off_callback: function(){
|
||||
jQuery(document).tooltip('disable');
|
||||
function confirmMode(){
|
||||
helper.me_usermode = 1;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
jQuery(document).tooltip('enable');
|
||||
}
|
||||
confirmDialog('Disabling Memory Editor Strict Mode is not recommended.<br><br>This tool will crash the ps3 if you attempt to access unallocated memory areas.','Are you sure you want to continue?',confirmMode,null,function(ck){jQuery('#memhexmode').switchButton('option','checked', ck);jQuery(document).tooltip('enable');},true);//jQuery('#memhex').tooltip();
|
||||
}
|
||||
});
|
||||
createSpinner();
|
||||
current = ranges[1];
|
||||
jQuery('#btn_spinner').on('click',function(e){
|
||||
current = ranges[1];
|
||||
current.offset = current.start;
|
||||
jQuery('#memedit' ).trigger( 'refreshEvent',[ toast('Refreshing data','warning',4)]);
|
||||
jQuery('#btn_spinner').removeClass('ui-state-disabled').addClass('ui-state-disabled');
|
||||
});
|
||||
jQuery( '#spinner-text' ).textSpinner( 'value', ranges[1].name );
|
||||
current.offset = current.start;
|
||||
addHexTable(current.start);
|
||||
var calc_toast = toast('Mapping sprx modules segments. Please wait...','warning',120);
|
||||
setTimeout(function(){
|
||||
mapModules(calc_toast);
|
||||
enable_GUI();
|
||||
},2200);
|
||||
}
|
||||
catch(e){
|
||||
Logger.error('<h2><b>JS Exception: '+e+'</b></h2><br>');
|
||||
}
|
||||
</script>
|
||||
|